diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 25c9ef8daa6594..c4f48058b70416 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -402,6 +402,7 @@ DevKitM devtype df dfe +DFILE dfu DgDxsfHx dhclient @@ -649,6 +650,7 @@ href HSM hsm HTTPS +Humidistat HW hwadr HydrogenConcentrationMeasurement @@ -1354,6 +1356,7 @@ SVR SWD SWU symlinks +sysbuild sysconfdir SysConfig sysctl diff --git a/.github/actions/bootstrap-cache/action.yaml b/.github/actions/bootstrap-cache/action.yaml index 9a883ecf22da79..f5ed24ba3f06e7 100644 --- a/.github/actions/bootstrap-cache/action.yaml +++ b/.github/actions/bootstrap-cache/action.yaml @@ -11,7 +11,7 @@ runs: attempt_limit: 3 attempt_delay: 2000 with: | - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**', '/etc/lsb-release') }} path: | .environment build_overrides/pigweed_environment.gni diff --git a/.github/actions/bootstrap/action.yaml b/.github/actions/bootstrap/action.yaml index 749dcb739b9854..ea06ceed7b3952 100644 --- a/.github/actions/bootstrap/action.yaml +++ b/.github/actions/bootstrap/action.yaml @@ -26,7 +26,12 @@ runs: # because the bootstrapped Pigweed environment contains absolute paths. echo "Calculating bootstrap cache key for '$PWD'" FILES_HASH="${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }}" - FINAL_HASH="$(echo "$PWD:$FILES_HASH" | shasum -a 256 | cut -d' ' -f1)" + case "$RUNNER_OS" in + macOS) OS_HASH="$(sw_vers | shasum -a 256 | cut -d' ' -f1)";; + *) OS_HASH="$(shasum -a 256 /etc/lsb-release | cut -d' ' -f1)";; + esac + PYTHON_HASH="$(python --version | shasum -a 256 | cut -d' ' -f1)" + FINAL_HASH="$(echo "$PWD:$FILES_HASH:$OS_HASH:$PYTHON_HASH" | shasum -a 256 | cut -d' ' -f1)" echo key="${RUNNER_OS}-${RUNNER_ARCH}-${{ inputs.platform }}-${FINAL_HASH}" | tee -a "$GITHUB_OUTPUT" # Split caches across backends diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8275c9f1164d0a..b55417cdba78ed 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -50,7 +50,6 @@ updates: - dependency-name: "third_party/nlassert/repo" - dependency-name: "third_party/nlfaultinjection/repo" - dependency-name: "third_party/nlio/repo" - - dependency-name: "third_party/nlunit-test/repo" - dependency-name: "third_party/nxp/repo" - dependency-name: "third_party/open-iot-sdk/repo" - dependency-name: "third_party/ot-br-posix/repo" diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index a1b93c882bf64f..12c7ee42e8faf7 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:54 + image: ghcr.io/project-chip/chip-build:66 steps: - name: Checkout diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c1073d90678ed2..10f638a67de092 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -26,14 +26,14 @@ on: run-codeql: required: false type: boolean - + concurrency: group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} cancel-in-progress: true env: CHIP_NO_LOG_TIMESTAMPS: true - + jobs: build_linux_gcc_debug: name: Build on Linux (gcc_debug) @@ -42,7 +42,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:54 + image: ghcr.io/project-chip/chip-build:66 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -204,11 +204,13 @@ jobs: run: | ./scripts/run_in_build_env.sh "./scripts/run_codegen_targets.sh out/sanitizers" - name: Clang-tidy validation + # NOTE: clang-tidy crashes on CodegenDataModel_Write due to Nullable/std::optional check. + # See https://github.com/llvm/llvm-project/issues/97426 run: | ./scripts/run_in_build_env.sh \ "./scripts/run-clang-tidy-on-compile-commands.py \ --compile-database out/sanitizers/compile_commands.json \ - --file-exclude-regex '/(repo|zzz_generated|lwip/standalone)/|-ReadImpl|-InvokeSubscribeImpl' \ + --file-exclude-regex '/(repo|zzz_generated|lwip/standalone)/|-ReadImpl|-InvokeSubscribeImpl|CodegenDataModel_Write|QuieterReporting' \ check \ " - name: Clean output @@ -241,7 +243,7 @@ jobs: run: | rm -rf ./zzz_pregenerated mv scripts/codegen.py.renamed scripts/codegen.py - mv scripts/tools/zap/generate.py.renamed scripts/tools/zap/generate.py + mv scripts/tools/zap/generate.py.renamed scripts/tools/zap/generate.py - name: Run fake linux tests with build_examples run: | ./scripts/run_in_build_env.sh \ @@ -251,7 +253,7 @@ jobs: uses: ./.github/actions/perform-codeql-analysis with: language: cpp - + - name: Uploading core files uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} @@ -422,10 +424,13 @@ jobs: run: | ./scripts/run_in_build_env.sh "./scripts/run_codegen_targets.sh out/default" - name: Clang-tidy validation + # NOTE: clang-tidy crashes on CodegenDataModel_Write due to Nullable/std::optional check. + # See https://github.com/llvm/llvm-project/issues/97426 run: | ./scripts/run_in_build_env.sh \ "./scripts/run-clang-tidy-on-compile-commands.py \ --compile-database out/default/compile_commands.json \ + --file-exclude-regex '/(repo|zzz_generated|lwip/standalone)/|CodegenDataModel_Write|QuieterReporting' \ check \ " - name: Uploading diagnostic logs @@ -440,7 +445,7 @@ jobs: uses: ./.github/actions/perform-codeql-analysis with: language: cpp - + # TODO Log Upload https://github.com/project-chip/connectedhomeip/issues/2227 # TODO https://github.com/project-chip/connectedhomeip/issues/1512 @@ -451,7 +456,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:54 + image: ghcr.io/project-chip/chip-build:66 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index b3d3f7f3a90f7c..da12476696bce9 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:54 + image: ghcr.io/project-chip/chip-build:66 options: --user root steps: @@ -56,7 +56,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:54 + image: ghcr.io/project-chip/chip-build-esp32:66 options: --user root steps: @@ -77,7 +77,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:54 + image: ghcr.io/project-chip/chip-build-nrf-platform:66 options: --user root steps: @@ -98,7 +98,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:57 + image: ghcr.io/project-chip/chip-build-telink:66 options: --user root steps: diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml index b3e2f9d1086ee8..6fe17c3558c767 100644 --- a/.github/workflows/cirque.yaml +++ b/.github/workflows/cirque.yaml @@ -42,7 +42,7 @@ jobs: # need to run with privilege, which isn't supported by job.XXX.contaner # https://github.com/actions/container-action/issues/2 # container: - # image: ghcr.io/project-chip/chip-build-cirque:54 + # image: ghcr.io/project-chip/chip-build-cirque: # volumes: # - "/tmp:/tmp" # - "/dev/pts:/dev/pts" diff --git a/.github/workflows/darwin-tests.yaml b/.github/workflows/darwin-tests.yaml index a916250572bb6e..815293204b09de 100644 --- a/.github/workflows/darwin-tests.yaml +++ b/.github/workflows/darwin-tests.yaml @@ -95,6 +95,7 @@ jobs: --target darwin-x64-lit-icd-${BUILD_VARIANT} \ --target darwin-x64-microwave-oven-${BUILD_VARIANT} \ --target darwin-x64-rvc-${BUILD_VARIANT} \ + --target darwin-x64-network-manager-${BUILD_VARIANT} \ build \ --copy-artifacts-to objdir-clone \ " @@ -116,6 +117,7 @@ jobs: --bridge-app ./out/darwin-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \ --microwave-oven-app ./out/darwin-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \ --rvc-app ./out/darwin-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \ + --network-manager-app ./out/darwin-x64-network-manager-${BUILD_VARIANT}/matter-network-manager-app \ " - name: Run OTA Test run: | diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index abe0568fb9e011..df53d87c4a9d57 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -81,7 +81,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-doxygen:54 + image: ghcr.io/project-chip/chip-build-doxygen:66 if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml index f238d10a5cf6b3..b6fdcfd84945a0 100644 --- a/.github/workflows/examples-asr.yaml +++ b/.github/workflows/examples-asr.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-asr:54 + image: ghcr.io/project-chip/chip-build-asr:66 options: --user root steps: diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index eaaedd226e778b..5a8f5359358063 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-efr32:56 + image: ghcr.io/project-chip/chip-build-efr32:66 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index 92415c0ce96930..cdfdee65148aff 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:54 + image: ghcr.io/project-chip/chip-build-esp32:66 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -126,7 +126,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:54 + image: ghcr.io/project-chip/chip-build-esp32:66 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index 4bf103ddae4542..eec3e41ec875e8 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-crosscompile:54 + image: ghcr.io/project-chip/chip-build-crosscompile:66 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -67,6 +67,8 @@ jobs: --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 \ + --target linux-arm64-fabric-bridge-no-ble-clang-rpc \ build \ " - name: Bloat report - chip-tool diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index 53728d33eac42a..5ece2df040e562 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:54 + image: ghcr.io/project-chip/chip-build:66 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 ca6d1b6ea20e5c..4ab6bbbb1cf233 100644 --- a/.github/workflows/examples-linux-tv-casting-app.yaml +++ b/.github/workflows/examples-linux-tv-casting-app.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:54 + image: ghcr.io/project-chip/chip-build:66 steps: - name: Checkout @@ -63,12 +63,25 @@ jobs: ./scripts/run_in_build_env.sh \ "scripts/examples/gn_build_example.sh examples/tv-casting-app/linux/ out/tv-casting-app chip_casting_simplified=true" - - name: Test casting from Linux tv-casting-app to Linux tv-app + - name: + Test casting from Linux tv-casting-app to Linux tv-app - + Commissionee Generated Passcode run: | ./scripts/run_in_build_env.sh \ "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: Uploading Size Reports uses: ./.github/actions/upload-size-reports if: ${{ !env.ACT }} diff --git a/.github/workflows/examples-mbed.yaml b/.github/workflows/examples-mbed.yaml index e74ad8afc7a600..5b39c51e8fa0a8 100644 --- a/.github/workflows/examples-mbed.yaml +++ b/.github/workflows/examples-mbed.yaml @@ -42,7 +42,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-mbed-os:54 + image: ghcr.io/project-chip/chip-build-mbed-os:66 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-mw320.yaml b/.github/workflows/examples-mw320.yaml index 780543a70d1f11..cd4081c51cd164 100644 --- a/.github/workflows/examples-mw320.yaml +++ b/.github/workflows/examples-mw320.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:54 + image: ghcr.io/project-chip/chip-build:66 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index c8d997d5ca6631..3e0452b5258dc8 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:54 + image: ghcr.io/project-chip/chip-build-nrf-platform:66 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -78,119 +78,119 @@ jobs: - name: Build example nRF Connect SDK Lock App on nRF52840 DK if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' run: | - scripts/examples/nrfconnect_example.sh lock-app nrf52840dk_nrf52840 + scripts/examples/nrfconnect_example.sh lock-app nrf52840dk/nrf52840 .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf52840dk_nrf52840 lock-app \ - examples/lock-app/nrfconnect/build/zephyr/zephyr.elf \ + examples/lock-app/nrfconnect/build/nrfconnect/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: Build example nRF Connect SDK Lighting App on nRF52840 Dongle if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' run: | - scripts/examples/nrfconnect_example.sh lighting-app nrf52840dongle_nrf52840 -DCONF_FILE=prj_no_dfu.conf -DCONFIG_CHIP_ROTATING_DEVICE_ID=y + scripts/examples/nrfconnect_example.sh lighting-app nrf52840dongle/nrf52840 -DCONFIG_CHIP_ROTATING_DEVICE_ID=y .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf52840dongle_nrf52840 lighting-app \ - examples/lighting-app/nrfconnect/build/zephyr/zephyr.elf \ + examples/lighting-app/nrfconnect/build/nrfconnect/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: Build example nRF Connect SDK Lighting App on nRF52840 DK with RPC if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' run: | - scripts/examples/nrfconnect_example.sh lighting-app nrf52840dk_nrf52840 -DOVERLAY_CONFIG=rpc.overlay + scripts/examples/nrfconnect_example.sh lighting-app nrf52840dk/nrf52840 -DOVERLAY_CONFIG=rpc.overlay .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf52840dk_nrf52840+rpc lighting-app \ - examples/lighting-app/nrfconnect/build/zephyr/zephyr.elf \ + examples/lighting-app/nrfconnect/build/nrfconnect/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: Build example nRF Connect SDK Light Switch App on nRF52840 DK if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' run: | - scripts/examples/nrfconnect_example.sh light-switch-app nrf52840dk_nrf52840 + scripts/examples/nrfconnect_example.sh light-switch-app nrf52840dk/nrf52840 .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf52840dk_nrf52840 light-switch-app \ - examples/light-switch-app/nrfconnect/build/zephyr/zephyr.elf \ + examples/light-switch-app/nrfconnect/build/nrfconnect/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: Build example nRF Connect SDK Shell on nRF52840 DK if: github.event_name == 'push' || steps.changed_paths.outputs.shell == 'true' run: | - scripts/examples/nrfconnect_example.sh shell nrf52840dk_nrf52840 + scripts/examples/nrfconnect_example.sh shell nrf52840dk/nrf52840 .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf52840dk_nrf52840 shell \ - examples/shell/nrfconnect/build/zephyr/zephyr.elf \ + examples/shell/nrfconnect/build/nrfconnect/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: Build example nRF Connect SDK Pump App on nRF52840 DK if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' run: | - scripts/examples/nrfconnect_example.sh pump-app nrf52840dk_nrf52840 + scripts/examples/nrfconnect_example.sh pump-app nrf52840dk/nrf52840 .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf52840dk_nrf52840 pump-app \ - examples/pump-app/nrfconnect/build/zephyr/zephyr.elf \ + examples/pump-app/nrfconnect/build/nrfconnect/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: Build example nRF Connect SDK Pump Controller App on nRF52840 DK if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' run: | - scripts/examples/nrfconnect_example.sh pump-controller-app nrf52840dk_nrf52840 + scripts/examples/nrfconnect_example.sh pump-controller-app nrf52840dk/nrf52840 .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf52840dk_nrf52840 pump-controller-app \ - examples/pump-controller-app/nrfconnect/build/zephyr/zephyr.elf \ + examples/pump-controller-app/nrfconnect/build/nrfconnect/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: Build example nRF Connect SDK All Clusters App on nRF52840 DK run: | - scripts/examples/nrfconnect_example.sh all-clusters-app nrf52840dk_nrf52840 + scripts/examples/nrfconnect_example.sh all-clusters-app nrf52840dk/nrf52840 .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf52840dk_nrf52840 all-clusters-app \ - examples/all-clusters-app/nrfconnect/build/zephyr/zephyr.elf \ + examples/all-clusters-app/nrfconnect/build/nrfconnect/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: Build example nRF Connect SDK All Clusters Minimal App on nRF52840 DK run: | - scripts/examples/nrfconnect_example.sh all-clusters-minimal-app nrf52840dk_nrf52840 -DCONF_FILE=prj_dfu.conf + scripts/examples/nrfconnect_example.sh all-clusters-minimal-app nrf52840dk/nrf52840 -DFILE_SUFFIX=dfu .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf52840dk_nrf52840 all-clusters-minimal-app \ - examples/all-clusters-minimal-app/nrfconnect/build/zephyr/zephyr.elf \ + examples/all-clusters-minimal-app/nrfconnect/build/nrfconnect/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: Build example nRF Connect SDK Lock App on nRF5340 DK if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' run: | - scripts/examples/nrfconnect_example.sh lock-app nrf5340dk_nrf5340_cpuapp + scripts/examples/nrfconnect_example.sh lock-app nrf5340dk/nrf5340/cpuapp .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf5340dk_nrf5340_cpuapp lock-app \ - examples/lock-app/nrfconnect/build/zephyr/zephyr.elf \ + examples/lock-app/nrfconnect/build/nrfconnect/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: Build example nRF Connect SDK Lighting App on nRF5340 DK if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' run: | - scripts/examples/nrfconnect_example.sh lighting-app nrf5340dk_nrf5340_cpuapp + scripts/examples/nrfconnect_example.sh lighting-app nrf5340dk/nrf5340/cpuapp .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf5340dk_nrf5340_cpuapp lighting-app \ - examples/lighting-app/nrfconnect/build/zephyr/zephyr.elf \ + examples/lighting-app/nrfconnect/build/nrfconnect/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: Build example nRF Connect SDK Lock App on nRF7002 PDK if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' run: | - scripts/examples/nrfconnect_example.sh lock-app nrf7002dk_nrf5340_cpuapp + scripts/examples/nrfconnect_example.sh lock-app nrf7002dk/nrf5340/cpuapp .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf7002dk_nrf5340_cpuapp lock-app \ - examples/lock-app/nrfconnect/build/zephyr/zephyr.elf \ + examples/lock-app/nrfconnect/build/nrfconnect/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: Build example nRF Connect SDK Light Switch App on nRF7002 PDK if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' run: | - scripts/examples/nrfconnect_example.sh light-switch-app nrf7002dk_nrf5340_cpuapp + scripts/examples/nrfconnect_example.sh light-switch-app nrf7002dk/nrf5340/cpuapp .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf7002dk_nrf5340_cpuapp light-switch-app \ - examples/light-switch-app/nrfconnect/build/zephyr/zephyr.elf \ + examples/light-switch-app/nrfconnect/build/nrfconnect/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: Build example nRF Connect SDK Lighting App on nRF7002 PDK if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' run: | - scripts/examples/nrfconnect_example.sh lighting-app nrf7002dk_nrf5340_cpuapp + scripts/examples/nrfconnect_example.sh lighting-app nrf7002dk/nrf5340/cpuapp .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf7002dk_nrf5340_cpuapp lighting-app \ - examples/light-switch-app/nrfconnect/build/zephyr/zephyr.elf \ + examples/light-switch-app/nrfconnect/build/nrfconnect/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: Build example nRF Connect SDK All Clusters App on nRF7002 PDK run: | - scripts/examples/nrfconnect_example.sh all-clusters-app nrf7002dk_nrf5340_cpuapp -DCONF_FILE=prj_release.conf + scripts/examples/nrfconnect_example.sh all-clusters-app nrf7002dk/nrf5340/cpuapp -DFILE_SUFFIX=release .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf7002dk_nrf5340_cpuapp all-clusters-app \ - examples/all-clusters-app/nrfconnect/build/zephyr/zephyr.elf \ + examples/all-clusters-app/nrfconnect/build/nrfconnect/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: Run unit tests for Zephyr native_posix_64 platform if: github.event_name == 'push' || steps.changed_paths.outputs.tests == 'true' || steps.changed_paths.outputs.nrfconnect == 'true' diff --git a/.github/workflows/examples-nuttx.yaml b/.github/workflows/examples-nuttx.yaml index 5ffd19b1319ff5..3fc296f4a6478a 100644 --- a/.github/workflows/examples-nuttx.yaml +++ b/.github/workflows/examples-nuttx.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nuttx:54 + image: ghcr.io/project-chip/chip-build-nuttx:66 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nxp.yaml b/.github/workflows/examples-nxp.yaml index 05d434b0a67792..d3ea4af06df3dc 100644 --- a/.github/workflows/examples-nxp.yaml +++ b/.github/workflows/examples-nxp.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-k32w:54 + image: ghcr.io/project-chip/chip-build-k32w:66 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -60,14 +60,14 @@ jobs: run: | scripts/run_in_build_env.sh "\ ./scripts/build/build_examples.py \ - --target nxp-k32w0-lighting \ - --target nxp-k32w0-lighting-factory \ - --target nxp-k32w0-lighting-rotating-id \ - --target nxp-k32w0-contact-sensor \ - --target nxp-k32w0-contact-sensor-low-power \ - --target nxp-k32w0-contact-sensor-low-power-factory \ - --target nxp-k32w1-lighting \ - --target nxp-k32w1-contact-sensor-low-power \ + --target nxp-k32w0-freertos-lighting \ + --target nxp-k32w0-freertos-lighting-factory \ + --target nxp-k32w0-freertos-lighting-rotating-id \ + --target nxp-k32w0-freertos-contact-sensor \ + --target nxp-k32w0-freertos-contact-sensor-low-power \ + --target nxp-k32w0-freertos-contact-sensor-low-power-factory \ + --target nxp-k32w1-freertos-lighting \ + --target nxp-k32w1-freertos-contact-sensor-low-power \ build \ --copy-artifacts-to out/artifacts \ " @@ -75,24 +75,51 @@ jobs: run: | .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nxp k32w0+release light \ - out/artifacts/nxp-k32w0-lighting/chip-k32w0x-light-example.elf \ + out/artifacts/nxp-k32w0-freertos-lighting/chip-k32w0x-light-example.elf \ /tmp/bloat_reports/ .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nxp k32w1+release light \ - out/artifacts/nxp-k32w1-lighting/chip-k32w1-light-example.elf \ + out/artifacts/nxp-k32w1-freertos-lighting/chip-k32w1-light-example.elf \ /tmp/bloat_reports/ - name: Get contact sensor size stats run: | .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nxp k32w0+release contact \ - out/artifacts/nxp-k32w0-contact-sensor-low-power/chip-k32w0x-contact-example.elf \ + out/artifacts/nxp-k32w0-freertos-contact-sensor-low-power/chip-k32w0x-contact-example.elf \ /tmp/bloat_reports/ .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nxp k32w1+release contact \ - out/artifacts/nxp-k32w1-contact-sensor-low-power/chip-k32w1-contact-example.elf \ + out/artifacts/nxp-k32w1-freertos-contact-sensor-low-power/chip-k32w1-contact-example.elf \ /tmp/bloat_reports/ - name: Uploading Size Reports uses: ./.github/actions/upload-size-reports if: ${{ !env.ACT }} with: platform-name: K32W + + zephyr: + name: ZEPHYR_RW61X + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: ghcr.io/project-chip/chip-build-nxp-zephyr:66 + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Checkout submodules & Bootstrap + uses: ./.github/actions/checkout-submodules-and-bootstrap + with: + platform: nxp + + - name: Build RW61x Zephyr examples + run: | + scripts/run_in_build_env.sh "\ + ./scripts/build/build_examples.py \ + --target nxp-rw61x-zephyr-all-clusters \ + --target nxp-rw61x-zephyr-thermostat \ + --target nxp-rw61x-zephyr-laundry-washer-factory \ + build \ + " diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index 2f878ea48e4540..57577e02e774c7 100644 --- a/.github/workflows/examples-openiotsdk.yaml +++ b/.github/workflows/examples-openiotsdk.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-openiotsdk:54 + image: ghcr.io/project-chip/chip-build-openiotsdk:66 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" options: --privileged diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index 2bb85ad4acbfac..9c6f300a861429 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:54 + image: ghcr.io/project-chip/chip-build:66 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-rw61x.yaml b/.github/workflows/examples-rw61x.yaml index 15c25699f72284..8766a9b1958e10 100644 --- a/.github/workflows/examples-rw61x.yaml +++ b/.github/workflows/examples-rw61x.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-rw61x:54 + image: ghcr.io/project-chip/chip-build-rw61x:66 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-stm32.yaml b/.github/workflows/examples-stm32.yaml index 809861cdee179e..897f0477089151 100644 --- a/.github/workflows/examples-stm32.yaml +++ b/.github/workflows/examples-stm32.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:54 + image: ghcr.io/project-chip/chip-build:66 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index 15926e99cd470c..22007fb77a3085 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:57 + image: ghcr.io/project-chip/chip-build-telink:66 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -189,13 +189,13 @@ jobs: - name: clean out build output run: rm -rf ./out - - name: Build example Telink (B91) Pump App + - name: Build example Telink (B91 USB) Pump App run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-pump' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-pump-usb' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tlsr9518adk80d pump-app \ - out/telink-tlsr9518adk80d-pump/zephyr/zephyr.elf \ + telink tlsr9518adk80d pump-app-usb \ + out/telink-tlsr9518adk80d-pump-usb/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 ae5a847026d3c1..8c1dc592d68676 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen:54 + image: ghcr.io/project-chip/chip-build-tizen:66 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 c86839d8f51708..0acfb215576caa 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:54 + image: ghcr.io/project-chip/chip-build-android:66 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index 30b697c5f1f6ce..e9f2061a2c033b 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:54 + image: ghcr.io/project-chip/chip-build:66 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index ff734d2d4fe338..c70cfa6c37826d 100644 --- a/.github/workflows/java-tests.yaml +++ b/.github/workflows/java-tests.yaml @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-java:54 + image: ghcr.io/project-chip/chip-build-java:66 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 2b5bbeff0fe465..98dd81edceca88 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:54 + image: ghcr.io/project-chip/chip-build:66 steps: - name: Checkout @@ -98,7 +98,6 @@ jobs: --known-failure controller/ExamplePersistentStorage.cpp \ --known-failure controller/ExamplePersistentStorage.h \ --known-failure app/AttributeAccessToken.h \ - --known-failure app/CommandHandlerInterface.h \ --known-failure app/CommandResponseSender.h \ --known-failure app/CommandSenderLegacyCallback.h \ --known-failure app/ReadHandler.h \ @@ -288,7 +287,18 @@ jobs: type-safe setters if: always() run: | - git grep -I -n 'emberAfWriteAttribute' -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' ':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' ':(exclude)src/app/util/attribute-table.cpp' ':(exclude)examples/common/pigweed/rpc_services/Attributes.h' ':(exclude)src/app/util/attribute-table.h' ':(exclude)src/app/util/ember-compatibility-functions.cpp' && exit 1 || exit 0 + git grep -I -n 'emberAfWriteAttribute' -- './*' \ + ':(exclude).github/workflows/lint.yml' \ + ':(exclude)examples/common/pigweed/rpc_services/Attributes.h' \ + ':(exclude)src/app/codegen-data-model/CodegenDataModel_Write.cpp' \ + ':(exclude)src/app/codegen-data-model/tests/EmberReadWriteOverride.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)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' \ + && exit 1 || exit 0 # Run ruff python linter - name: Check for errors using ruff Python linter diff --git a/.github/workflows/minimal-build.yaml b/.github/workflows/minimal-build.yaml index 6fd9a96e151ec6..57ccaef312e144 100644 --- a/.github/workflows/minimal-build.yaml +++ b/.github/workflows/minimal-build.yaml @@ -33,7 +33,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:54 + image: ghcr.io/project-chip/chip-build-minimal:66 steps: - name: Checkout @@ -55,7 +55,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:54 + image: ghcr.io/project-chip/chip-build-minimal:66 steps: - name: Checkout diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index bff12a5999586e..acced0da5d9849 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32-qemu:54 + image: ghcr.io/project-chip/chip-build-esp32-qemu:66 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index be862403037423..97468ec3b5ce0c 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:54 + image: ghcr.io/project-chip/chip-build-esp32:66 steps: - name: Checkout diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index 014573614a0448..f6e06fc1dbbaac 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:54 + image: ghcr.io/project-chip/chip-build-android:66 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index de9bd0d9f64193..2681222648c394 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -112,6 +112,7 @@ jobs: src/app/zap-templates/zcl/data-model/chip/channel-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/clusters-extensions.xml \ src/app/zap-templates/zcl/data-model/chip/color-control-cluster.xml \ + src/app/zap-templates/zcl/data-model/chip/commissioner-control-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/concentration-measurement-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/content-launch-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/content-app-observer-cluster.xml \ @@ -126,6 +127,7 @@ jobs: src/app/zap-templates/zcl/data-model/chip/microwave-oven-mode-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml \ + src/app/zap-templates/zcl/data-model/chip/ecosystem-information-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/energy-evse-mode-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/ethernet-network-diagnostics-cluster.xml \ @@ -184,6 +186,7 @@ jobs: src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/thread-border-router-management-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/thread-network-diagnostics-cluster.xml \ + src/app/zap-templates/zcl/data-model/chip/thread-network-directory-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/time-format-localization-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/time-synchronization-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/timer-cluster.xml \ @@ -191,6 +194,7 @@ jobs: src/app/zap-templates/zcl/data-model/chip/unit-localization-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/wake-on-lan-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/washer-controls-cluster.xml \ + src/app/zap-templates/zcl/data-model/chip/water-heater-management-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/wifi-network-management-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/window-covering.xml \ @@ -220,6 +224,7 @@ jobs: --target linux-x64-lit-icd-${BUILD_VARIANT} \ --target linux-x64-microwave-oven-${BUILD_VARIANT} \ --target linux-x64-rvc-${BUILD_VARIANT} \ + --target linux-x64-network-manager-${BUILD_VARIANT} \ build \ --copy-artifacts-to objdir-clone \ " @@ -242,6 +247,7 @@ jobs: --lit-icd-app ./out/linux-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \ --microwave-oven-app ./out/linux-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \ --rvc-app ./out/linux-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \ + --network-manager-app ./out/linux-x64-network-manager-${BUILD_VARIANT}/matter-network-manager-app \ " - name: Run purposeful failure tests using the python parser sending commands to chip-tool @@ -283,6 +289,7 @@ jobs: --lit-icd-app ./out/linux-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \ --microwave-oven-app ./out/linux-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \ --rvc-app ./out/linux-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \ + --network-manager-app ./out/linux-x64-network-manager-${BUILD_VARIANT}/matter-network-manager-app \ " - name: Run Tests using chip-repl (including slow) if: github.event_name == 'push' @@ -302,6 +309,7 @@ jobs: --lit-icd-app ./out/linux-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \ --microwave-oven-app ./out/linux-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \ --rvc-app ./out/linux-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \ + --network-manager-app ./out/linux-x64-network-manager-${BUILD_VARIANT}/matter-network-manager-app \ " - name: Uploading core files uses: actions/upload-artifact@v4 @@ -370,6 +378,7 @@ jobs: --target darwin-x64-lit-icd-${BUILD_VARIANT} \ --target darwin-x64-microwave-oven-${BUILD_VARIANT} \ --target darwin-x64-rvc-${BUILD_VARIANT} \ + --target darwin-x64-network-manager-${BUILD_VARIANT} \ build \ --copy-artifacts-to objdir-clone \ " @@ -393,6 +402,7 @@ jobs: --lit-icd-app ./out/darwin-x64-lit-icd-${BUILD_VARIANT}/lit-icd-app \ --microwave-oven-app ./out/darwin-x64-microwave-oven-${BUILD_VARIANT}/chip-microwave-oven-app \ --rvc-app ./out/darwin-x64-rvc-${BUILD_VARIANT}/chip-rvc-app \ + --network-manager-app ./out/darwin-x64-network-manager-${BUILD_VARIANT}/matter-network-manager-app \ " - name: Run purposeful failure tests using the python parser sending commands to chip-tool @@ -443,7 +453,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:54 + image: ghcr.io/project-chip/chip-build:66 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" @@ -493,13 +503,15 @@ jobs: - name: Run Tests run: | mkdir -p out/trace_data - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script-args "--log-level INFO -t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + 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 './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_ACE_1_2.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_ACE_1_3.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_ACE_1_4.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_ACE_1_5.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_AccessChecker.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_CC_10_1.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_CGEN_2_4.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_CNET_1_4.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_DA_1_2.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_DA_1_5.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_DA_1_7.py' @@ -509,12 +521,21 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_DRLK_2_3.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_DeviceBasicComposition.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_DeviceConformance.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_DEM_2_2.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_DEM_2_3.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_DEM_2_4.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_DEM_2_5.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_DEM_2_6.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_DEM_2_7.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_DEM_2_8.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_DEM_2_9.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_EEM_2_1.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_EEM_2_2.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_EEM_2_3.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_EEM_2_4.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_EEM_2_5.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_EEVSE_2_2.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_EEVSE_2_3.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_EEVSE_2_4.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_EEVSE_2_5.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_EPM_2_1.py' @@ -529,6 +550,7 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_ICDManagementCluster.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_IDM_1_2.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_IDM_1_4.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_IDM_4_2.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_PWRTL_2_1.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_RR_1_1.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_SC_3_6.py' @@ -548,6 +570,7 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_TestEventTrigger.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TestBatchInvoke.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TestGroupTableReports.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_OPCREDS_3_1.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_OPCREDS_3_2.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_OPSTATE_2_1.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_OPSTATE_2_2.py' @@ -563,6 +586,7 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_MWOCTRL_2_2.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_MWOCTRL_2_4.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_MWOM_1_2.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_PS_2_3.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_RVCRUNM_1_2.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_RVCRUNM_2_1.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_RVCRUNM_2_2.py' @@ -572,13 +596,22 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_RVCOPSTATE_2_1.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_RVCOPSTATE_2_3.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_RVCOPSTATE_2_4.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_SC_7_1.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_SWTCH.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_LVL_2_3.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TCP_Tests.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestConformanceSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestMatterTestingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestSpecParsingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py' - scripts/run_in_python_env.sh out/venv './src/python_testing/test_testing/test_TC_DA_1_2.py' scripts/run_in_python_env.sh out/venv './src/python_testing/test_testing/test_TC_ICDM_2_1.py' 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' + scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/test_testing/test_IDM_10_4.py' + scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/test_testing/test_TC_SC_7_1.py' + scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/test_testing/TestDecorators.py' + - name: Uploading core files uses: actions/upload-artifact@v4 diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index c1d3bebddde5ae..33f9cefae684fe 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -39,7 +39,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:54 + image: ghcr.io/project-chip/chip-build:66 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index 81ffbcbb3b057a..68faf6b066e750 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:54 + image: ghcr.io/project-chip/chip-build:66 defaults: run: shell: sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index 987cc82a2e3f06..8ffe08e158c611 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:54 + image: ghcr.io/project-chip/chip-build:66 defaults: run: shell: sh diff --git a/.gitmodules b/.gitmodules index dee55fa9536e7e..1f4129f9f2df9d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,10 +6,6 @@ path = third_party/nlio/repo url = https://github.com/nestlabs/nlio.git branch = master -[submodule "nlunit-test"] - path = third_party/nlunit-test/repo - url = https://github.com/nestlabs/nlunit-test.git - branch = master [submodule "mbedtls"] path = third_party/mbedtls/repo url = https://github.com/ARMmbed/mbedtls.git @@ -101,11 +97,6 @@ path = third_party/infineon/psoc6/psoc6_sdk/libs/abstraction-rtos url = https://github.com/Infineon/abstraction-rtos platforms = infineon -[submodule "p6/bluetooth-freertos"] - path = third_party/infineon/psoc6/psoc6_sdk/libs/bluetooth-freertos - url = https://github.com/Infineon/bluetooth-freertos - branch = v2.X - platforms = infineon [submodule "p6/btstack"] path = third_party/infineon/psoc6/psoc6_sdk/libs/btstack url = https://github.com/Infineon/btstack @@ -138,10 +129,6 @@ path = third_party/infineon/psoc6/psoc6_sdk/libs/mtb-pdl-cat1 url = https://github.com/Infineon/mtb-pdl-cat1 platforms = infineon -[submodule "p6/psoc6cm0p"] - path = third_party/infineon/psoc6/psoc6_sdk/libs/psoc6cm0p - url = https://github.com/Infineon/psoc6cm0p - platforms = infineon [submodule "p6/whd-bsp-integration"] path = third_party/infineon/psoc6/psoc6_sdk/libs/whd-bsp-integration url = https://github.com/Infineon/whd-bsp-integration @@ -189,10 +176,6 @@ [submodule "third_party/jsoncpp/repo"] path = third_party/jsoncpp/repo url = https://github.com/open-source-parsers/jsoncpp.git -[submodule "third_party/p6/p6_sdk/libs/anycloud-ota"] - path = third_party/infineon/psoc6/psoc6_sdk/libs/anycloud-ota - url = https://github.com/Infineon/anycloud-ota - platforms = infineon [submodule "third_party/mbed-mcu-boot/repo"] path = third_party/mbed-mcu-boot/repo url = https://github.com/ATmobica/mcuboot.git @@ -316,12 +299,37 @@ url = https://github.com/STMicroelectronics/STM32CubeWB.git branch = v1.18.0 platforms = stm32 -[submodule "p6/lwip-network-interface-integration"] - path = third_party/infineon/psoc6/psoc6_sdk/libs/lwip-network-interface-integration - url = https://github.com/Infineon/lwip-network-interface-integration.git - platforms = infineon [submodule "third_party/infineon/trustm/optiga-trust-m"] path = third_party/infineon/trustm/optiga-trust-m url = https://github.com/Infineon/optiga-trust-m.git branch = matter_support platforms = infineon +[submodule "third_party/nxp/nxp_matter_support"] + path = third_party/nxp/nxp_matter_support + url = https://github.com/NXP/nxp_matter_support.git + branch = master + platforms = nxp +[submodule "third_party/infineon/psoc6/psoc6_sdk/libs/btstack-integration"] + path = third_party/infineon/psoc6/psoc6_sdk/libs/btstack-integration + url = https://github.com/Infineon/btstack-integration.git + platforms = infineon +[submodule "third_party/infineon/psoc6/psoc6_sdk/libs/cat1cm0p"] + path = third_party/infineon/psoc6/psoc6_sdk/libs/cat1cm0p + url = https://github.com/Infineon/cat1cm0p.git + platforms = infineon +[submodule "third_party/infineon/psoc6/psoc6_sdk/libs/cmsis"] + path = third_party/infineon/psoc6/psoc6_sdk/libs/cmsis + url = https://github.com/Infineon/cmsis.git + platforms = infineon +[submodule "third_party/infineon/psoc6/psoc6_sdk/libs/ota-bootloader-abstraction"] + path = third_party/infineon/psoc6/psoc6_sdk/libs/ota-bootloader-abstraction + url = https://github.com/Infineon/ota-bootloader-abstraction.git + platforms = infineon +[submodule "third_party/infineon/psoc6/psoc6_sdk/libs/ota-update"] + path = third_party/infineon/psoc6/psoc6_sdk/libs/ota-update + url = https://github.com/Infineon/ota-update.git + platforms = infineon +[submodule "third_party/infineon/psoc6/psoc6_sdk/libs/lwip-network-interface-integration"] + path = third_party/infineon/psoc6/psoc6_sdk/libs/lwip-network-interface-integration + url = https://github.com/Infineon/lwip-network-interface-integration.git + platforms = infineon diff --git a/.restyled.yaml b/.restyled.yaml index 5e9a492aaaaf41..f55a0e367d91bd 100644 --- a/.restyled.yaml +++ b/.restyled.yaml @@ -55,7 +55,6 @@ exclude: - "third_party/nlassert/repo/**/*" # from here down built with $ awk '/path =/ {print $3 "/**/*"}' .gitmodules - "third_party/nlfaultinjection/repo/**/*" - "third_party/nlio/repo/**/*" - - "third_party/nlunit-test/repo/**/*" - "third_party/mbedtls/repo/**/*" - "examples/common/QRCode/repo/**/*" - "examples/common/m5stack-tft/repo/**/*" diff --git a/.vscode/extensions.json b/.vscode/extensions.json index d5969bc3ae58f2..9cf1f09cc666bc 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -21,7 +21,9 @@ "vadimcn.vscode-lldb", "xaver.clang-format", "yuichinukiyama.vscode-preview-server", - "yzhang.markdown-all-in-one" + "yzhang.markdown-all-in-one", + "ms-python.autopep8", + "ms-python.isort" ], // List of extensions recommended by VS Code that should not be recommended for users of this workspace. "unwantedRecommendations": [] diff --git a/.vscode/settings.json b/.vscode/settings.json index d38758524ac8a5..a8b3dd631afe4f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -133,7 +133,8 @@ "random": "cpp", "thread": "cpp", "variant": "cpp", - "any": "cpp" + "any": "cpp", + "future": "cpp" }, // Configure paths or glob patterns to exclude from file watching. "files.watcherExclude": { @@ -191,5 +192,5 @@ "[python]": { "editor.defaultFormatter": "ms-python.autopep8" }, - "python.formatting.provider": "none" + "autopep8.args": ["--max-line-length", "132"] } diff --git a/BUILD.gn b/BUILD.gn index ddd893a4ca49d8..4d76100fbe6d20 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -67,6 +67,7 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { "//examples/common/pigweed/rpc_console/py:chip_rpc", "//integrations/mobly:chip_mobly", "//scripts/py_matter_yamltests:matter_yamltests", + "//src/python_testing/matter_testing_infrastructure:metadata_parser", ] pw_python_venv("matter_build_venv") { @@ -107,6 +108,7 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { deps = [ "${chip_root}/scripts:matter_yamltests_distribution.wheel", "${chip_root}/src/controller/python:chip-repl", + "${chip_root}/src/python_testing/matter_testing_infrastructure:metadata_parser.wheel", ] if (enable_pylib) { deps += [ "${chip_root}/src/pybindings/pycontroller" ] @@ -146,6 +148,8 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { if (chip_build_tests) { deps += [ "//src:tests" ] + deps += [ "//examples:example_tests" ] + if (current_os == "android" && current_toolchain == default_toolchain) { deps += [ "${chip_root}/build/chip/java/tests:java_build_test" ] } @@ -232,8 +236,8 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { "//scripts/build:build_examples.tests", "//scripts/py_matter_idl:matter_idl.tests", "//scripts/py_matter_yamltests:matter_yamltests.tests", - "//scripts/tests/py:metadata_parser.tests", "//src:tests_run", + "//src/python_testing/matter_testing_infrastructure:metadata_parser.tests", ] if (current_os == "linux" || current_os == "mac") { diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 1e634152a61d49..93333078f6f477 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -14,6 +14,7 @@ import("//build_overrides/build.gni") import("//build_overrides/pigweed.gni") +import("//build_overrides/pigweed_environment.gni") import("${build_root}/chip/java/config.gni") import("${build_root}/config/compiler/compiler.gni") import("${build_root}/config/sysroot.gni") @@ -348,7 +349,14 @@ config("cosmetic_default") { } config("runtime_default") { - if (is_clang) { # Using Pigweed clang instead of Darwin host clang + if (is_clang && + current_os == "mac") { # Using Pigweed clang instead of Darwin host clang + # Without pw_env_setup_CIPD_PIGWEED defined the hostclang:no_system_libcpp + # config silently uses the system libc++, usually resulting in linker errors. + assert( + defined(pw_env_setup_CIPD_PIGWEED), + "//build_overrides/pigweed_environment.gni must define pw_env_setup_CIPD_PIGWEED when using pigweed clang") + configs = [ "$dir_pw_toolchain/host_clang:no_system_libcpp", "$dir_pw_toolchain/host_clang:xcode_sysroot", diff --git a/build_overrides/nxp_sdk.gni b/build_overrides/nxp_sdk.gni index 0fb6234c7d5aaf..480a0ea71caf69 100644 --- a/build_overrides/nxp_sdk.gni +++ b/build_overrides/nxp_sdk.gni @@ -14,5 +14,9 @@ declare_args() { # Root directory for NXP SDKs. - nxp_sdk_build_root = "//third_party/nxp" + nxp_sdk_matter_support_root = "//third_party/nxp/nxp_matter_support" +} + +declare_args() { + nxp_sdk_build_root = "${nxp_sdk_matter_support_root}/gn_build" } diff --git a/config/ameba/chip.cmake b/config/ameba/chip.cmake index d221ab57352f94..47444055f66733 100644 --- a/config/ameba/chip.cmake +++ b/config/ameba/chip.cmake @@ -63,7 +63,6 @@ list( ${CHIP_ROOT}/src/app ${CHIP_ROOT}/third_party/nlassert/repo/include ${CHIP_ROOT}/third_party/nlio/repo/include - ${CHIP_ROOT}/third_party/nlunit-test/repo/src ) execute_process( diff --git a/config/esp32/components/chip/CMakeLists.txt b/config/esp32/components/chip/CMakeLists.txt index d0c1fc4463f442..7929e8bbbd14aa 100644 --- a/config/esp32/components/chip/CMakeLists.txt +++ b/config/esp32/components/chip/CMakeLists.txt @@ -224,6 +224,9 @@ endif() if (CONFIG_ENABLE_MATTER_OVER_THREAD) chip_gn_arg_append("chip_enable_openthread" "true") + if (CONFIG_THREAD_NETWORK_COMMISSIONING_DRIVER) + chip_gn_arg_append("chip_device_config_thread_network_endpoint_id" ${CONFIG_THREAD_NETWORK_ENDPOINT_ID}) + endif() else() chip_gn_arg_append("chip_enable_openthread" "false") endif() @@ -234,6 +237,12 @@ else() chip_gn_arg_append("chip_openthread_ftd" "false") endif() +if (CONFIG_OPENTHREAD_BORDER_ROUTER) + chip_gn_arg_append("chip_openthread_border_router" "true") +else() + chip_gn_arg_append("chip_openthread_border_router" "false") +endif() + if (CONFIG_ENABLE_OTA_REQUESTOR) chip_gn_arg_append("chip_enable_ota_requestor" "true") endif() @@ -463,7 +472,11 @@ if (CONFIG_ENABLE_ENCRYPTED_OTA) list(APPEND chip_libraries $) endif() -idf_component_get_property(main_lib main COMPONENT_LIB) +# Let user set EXECUTABLE_COMPONENT_NAME and defaults to main if not specified +if (NOT EXECUTABLE_COMPONENT_NAME) + set(EXECUTABLE_COMPONENT_NAME "main") +endif() +idf_component_get_property(main_lib ${EXECUTABLE_COMPONENT_NAME} COMPONENT_LIB) list(APPEND chip_libraries $) if (CONFIG_SEC_CERT_DAC_PROVIDER) @@ -472,7 +485,15 @@ if (CONFIG_SEC_CERT_DAC_PROVIDER) endif() if (CONFIG_ENABLE_ESP_INSIGHTS_TRACE) - idf_component_get_property(esp_insights_lib espressif__esp_insights COMPONENT_LIB) + idf_build_get_property(build_components BUILD_COMPONENTS) + # esp_insights can be used as an independent component or through component manager so, + # We should check and add the right component. + if("espressif__esp_insights" IN_LIST build_components) + idf_component_get_property(esp_insights_lib espressif__esp_insights COMPONENT_LIB) + elseif("esp_insights" IN_LIST build_components) + idf_component_get_property(esp_insights_lib esp_insights COMPONENT_LIB) + endif() + list(APPEND chip_libraries $) endif() diff --git a/config/esp32/components/chip/Kconfig b/config/esp32/components/chip/Kconfig index e2f9dcc099eba6..5cd2700bb972b6 100644 --- a/config/esp32/components/chip/Kconfig +++ b/config/esp32/components/chip/Kconfig @@ -157,6 +157,12 @@ menu "CHIP Core" help Option to enable/disable CHIP log level filtering APIs. + config ENABLE_CHIP_DATA_MODEL + bool "Enable CHIP data model" + default y + help + Option to enable/disable CHIP data model. + endmenu # "General Options" menu "Networking Options" @@ -330,9 +336,11 @@ menu "CHIP Device Layer" config MAX_EVENT_QUEUE_SIZE int "Max Event Queue Size" range 0 65535 - default 25 + default 40 help The maximum number of events that can be held in the CHIP Platform event queue. + Should be set greater than CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM. For SoCs other than + ESP32-C2, where the Wi-Fi buffer number is 8, recommended to use the default value. config ENABLE_EXTENDED_DISCOVERY bool "Enable Extended discovery Support" @@ -1287,4 +1295,52 @@ menu "CHIP Device Layer" endmenu + menu "Network Commissioning Driver Endpoint Id" + config THREAD_NETWORK_COMMISSIONING_DRIVER + bool "Use the generic Thread network commissioning driver" + depends on ENABLE_MATTER_OVER_THREAD && ENABLE_CHIP_DATA_MODEL + default y + help + Option to enable/disable the use of generic Thread network commissioning driver. + + config THREAD_NETWORK_ENDPOINT_ID + int "Endpoint Id for Thread network" + depends on THREAD_NETWORK_COMMISSIONING_DRIVER + range 0 65534 + default 0 + help + The endpoint id for the generic Thread network commissioning driver. + + config WIFI_NETWORK_COMMISSIONING_DRIVER + bool "Use ESP Wi-Fi network commissioning driver" + depends on (ENABLE_WIFI_STATION || ENABLE_WIFI_AP) && ENABLE_CHIP_DATA_MODEL + default y + help + Option to enable/disable the use of ESP Wi-Fi network commissioning driver. + + config WIFI_NETWORK_ENDPOINT_ID + int "Endpoint Id for Wi-Fi network" + depends on WIFI_NETWORK_COMMISSIONING_DRIVER + range 0 65534 + default 0 + help + The endpoint id for the ESP Wi-Fi network commissioning driver. + + config ETHERNET_NETWORK_COMMISSIONING_DRIVER + bool "Use ESP Ethernet network commissioning driver" + depends on ENABLE_ETHERNET_TELEMETRY && ENABLE_CHIP_DATA_MODEL + default y + help + Option to enable/disable the use of ESP Ethernet network commissioning driver. + + config ETHERNET_NETWORK_ENDPOINT_ID + int "Endpoint Id for Ethernet network" + depends on ETHERNET_NETWORK_COMMISSIONING_DRIVER + range 0 65534 + default 0 + help + The endpoint id for the ESP Ethernet network commissioning driver. + + endmenu + endmenu diff --git a/config/nrfconnect/.nrfconnect-recommended-revision b/config/nrfconnect/.nrfconnect-recommended-revision index 8a965c116821a9..873ca0fa627c90 100644 --- a/config/nrfconnect/.nrfconnect-recommended-revision +++ b/config/nrfconnect/.nrfconnect-recommended-revision @@ -1 +1 @@ -v2.6.0 +v2.7.0 diff --git a/config/nrfconnect/app/check-sysbuild-use.cmake b/config/nrfconnect/app/check-sysbuild-use.cmake new file mode 100644 index 00000000000000..bd70da84a7479d --- /dev/null +++ b/config/nrfconnect/app/check-sysbuild-use.cmake @@ -0,0 +1,31 @@ +# +# 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. +# + +# This script checks is sysbuild is used to build the target. If not, it prints the fatal error +# message, as the nRF Connect examples do not support deprecated child-image approach anymore. + +if (NOT SYSBUILD) + message(FATAL_ERROR " ###################################################################################\n" + " # This example does not support child-image approach anymore. #\n" + " # The nRF Connect SDK platform marked child-image approach as deprecated #\n" + " # from v2.7.0 and it is recommended to use the new sysbuild solution. #\n" + " # #\n" + " # To build this application with sysbuild support enabled, #\n" + " # you have to add --sysbuild flag to the build command, for example: #\n" + " # #\n" + " # west build -b --sysbuild #\n" + " ###################################################################################\n") +endif() diff --git a/config/nrfconnect/app/flashing.cmake b/config/nrfconnect/app/flashing.cmake index c6c90ef0270986..578d47a7765c49 100644 --- a/config/nrfconnect/app/flashing.cmake +++ b/config/nrfconnect/app/flashing.cmake @@ -40,9 +40,9 @@ add_custom_command(OUTPUT "${FLASHBUNDLE_FLASHER_PLATFORM}" VERBATIM) if (merged_hex_to_flash) - set(flashbundle_hex_to_copy "zephyr/${merged_hex_to_flash}") + set(flashbundle_hex_to_copy "${merged_hex_to_flash}") else() - set(flashbundle_hex_to_copy "zephyr/${KERNEL_HEX_NAME}") + set(flashbundle_hex_to_copy "../merged.hex") endif() add_custom_command(OUTPUT "${FLASHBUNDLE_FIRMWARE}" diff --git a/config/nrfconnect/chip-module/CMakeLists.txt b/config/nrfconnect/chip-module/CMakeLists.txt index 29560db74f38cc..20c5c692b68633 100644 --- a/config/nrfconnect/chip-module/CMakeLists.txt +++ b/config/nrfconnect/chip-module/CMakeLists.txt @@ -200,7 +200,6 @@ matter_generate_args_tmp_file() # ============================================================================== matter_build(chip - LIB_SHELL ${CONFIG_CHIP_LIB_SHELL} LIB_TESTS ${CONFIG_CHIP_BUILD_TESTS} DEVICE_INFO_EXAMPLE_PROVIDER ${CONFIG_CHIP_EXAMPLE_DEVICE_INFO_PROVIDER} GN_DEPENDENCIES kernel @@ -225,11 +224,21 @@ if (CONFIG_CHIP_MALLOC_SYS_HEAP_OVERRIDE) ) endif() +if (CONFIG_CHIP_LIB_SHELL) + # Force pulling chip::Shell::Engine::RunMainLoop() in the final binary. + # Without this workaround, the linker script does not process the shell and + # init objects defined in MainLoopZephyr.cpp unless the Matter library or + # the Matter shell library is linked using the '--whole-archive' flag. + target_link_options(chip INTERFACE + -Wl,-u,_ZN4chip5Shell6Engine11RunMainLoopEv + ) +endif() + # ============================================================================== # Define 'chip-ota-image' target for building CHIP OTA image # ============================================================================== -if (CONFIG_CHIP_OTA_IMAGE_BUILD) +if (CONFIG_CHIP_OTA_IMAGE_BUILD AND NOT SYSBUILD) chip_ota_image(chip-ota-image INPUT_FILES ${PROJECT_BINARY_DIR}/dfu_multi_image.bin OUTPUT_FILE ${PROJECT_BINARY_DIR}/${CONFIG_CHIP_OTA_IMAGE_FILE_NAME} @@ -240,7 +249,7 @@ endif() # Define 'factory_data' target for generating a factory data partition # ============================================================================== -if (CONFIG_CHIP_FACTORY_DATA_BUILD) +if(CONFIG_CHIP_FACTORY_DATA_BUILD AND (NOT SYSBUILD OR NOT CONFIG_PARTITION_MANAGER_ENABLED)) nrfconnect_generate_factory_data() endif() diff --git a/config/nrfconnect/chip-module/Kconfig b/config/nrfconnect/chip-module/Kconfig index d4ccccd983ed3f..2fd4f45de4b60c 100644 --- a/config/nrfconnect/chip-module/Kconfig +++ b/config/nrfconnect/chip-module/Kconfig @@ -34,15 +34,6 @@ config CHIP_NRF_PLATFORM config CHIP_DEVICE_VENDOR_NAME default "Nordic Semiconductor ASA" -config CHIP_APP_LOG_LEVEL - int "Logging level in application" - default LOG_DEFAULT_LEVEL - depends on LOG - help - Sets the logging level in the Matter application. Use this configuration - option only within the application. To set the logging level for the - Matter stack, use the MATTER_LOG_LEVEL configuration option. - config CHIP_NFC_COMMISSIONING bool "Share onboarding payload in NFC tag" default n @@ -306,4 +297,9 @@ config CHIP_PERSISTENT_SUBSCRIPTIONS # selecting experimental for this feature since there is an issue with multiple controllers. select EXPERIMENTAL +config CHIP_ENABLE_BDX_LOG_TRANSFER + bool "Enable BDX transfer for diagnostic logs" + help + Enables the BDX protocol for diagnostics log transfer purposes. + endif # CHIP diff --git a/config/nrfconnect/chip-module/Kconfig.defaults b/config/nrfconnect/chip-module/Kconfig.defaults index 218f39a3fa8f8a..a2e0a2ba5ee36a 100644 --- a/config/nrfconnect/chip-module/Kconfig.defaults +++ b/config/nrfconnect/chip-module/Kconfig.defaults @@ -40,9 +40,6 @@ config ASSERT_NO_MSG_INFO config HW_STACK_PROTECTION default y -config FPU - default y - config POSIX_MAX_FDS default 16 @@ -204,12 +201,12 @@ config CHIP_QSPI_NOR # nRF7002DK uses SPI NOR external flash -if BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF7001_NRF5340_CPUAPP +if BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF7001_NRF5340_CPUAPP || BOARD_NRF54L15PDK_NRF54L15_CPUAPP config CHIP_SPI_NOR default y -endif # BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF7001_NRF5340_CPUAPP +endif # BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF7001_NRF5340_CPUAPP || BOARD_NRF54L15PDK_NRF54L15_CPUAPP config BOOT_IMAGE_ACCESS_HOOKS default y if SOC_SERIES_NRF53X @@ -385,9 +382,6 @@ config MBEDTLS_ECP_DP_SECP256R1_ENABLED endif # !CHIP_CRYPTO_PSA -config MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG - default n if CHIP_WIFI - config MBEDTLS_SSL_OUT_CONTENT_LEN default 900 if CHIP_WIFI @@ -423,6 +417,9 @@ config MBEDTLS_SSL_SRV_C config MBEDTLS_SSL_COOKIE_C default n +config MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH + default y + # ============================================================================== # Logging configuration # ============================================================================== diff --git a/config/nrfconnect/chip-module/Kconfig.features b/config/nrfconnect/chip-module/Kconfig.features index 667894c7696d85..fbae62d28e1f24 100644 --- a/config/nrfconnect/chip-module/Kconfig.features +++ b/config/nrfconnect/chip-module/Kconfig.features @@ -60,6 +60,7 @@ config CHIP_SPI_NOR imply SPI_NOR imply MULTITHREADING imply PM_OVERRIDE_EXTERNAL_DRIVER_CHECK + imply MCUMGR_GRP_IMG_ALLOW_ERASE_PENDING help Enables SPI NOR flash with a set of options for configuring pages and buffer sizes. @@ -149,7 +150,7 @@ endif config CHIP_DFU_OVER_BT_SMP bool "Enable DFU over Bluetooth LE SMP feature set" imply CHIP_QSPI_NOR if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF52840DK_NRF52840 - imply CHIP_SPI_NOR if BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF7001_NRF5340_CPUAPP + imply CHIP_SPI_NOR if BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF7001_NRF5340_CPUAPP || BOARD_NRF54L15PDK_NRF54L15_CPUAPP imply BOOTLOADER_MCUBOOT select MCUMGR select MCUMGR_TRANSPORT_BT diff --git a/config/nrfconnect/chip-module/Kconfig.hci_ipc.defaults b/config/nrfconnect/chip-module/Kconfig.hci_ipc.defaults deleted file mode 100644 index bede85fd2541d3..00000000000000 --- a/config/nrfconnect/chip-module/Kconfig.hci_ipc.defaults +++ /dev/null @@ -1,83 +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. -# - -# The purpose of this file is to define new default values of settings used when building hci_ipc child image for Matter samples. - -config LOG - default n - -config HEAP_MEM_POOL_SIZE - default 8192 - -config MAIN_STACK_SIZE - default 2048 - -config SYSTEM_WORKQUEUE_STACK_SIZE - default 2048 - -config BT - default y - -config BT_HCI_RAW - default y - -config BT_MAX_CONN - default 1 - -config BT_PERIPHERAL - default y - -config BT_CENTRAL - default n - -config BT_BUF_ACL_RX_SIZE - default 502 - -config BT_BUF_ACL_TX_SIZE - default 251 - -config BT_CTLR_DATA_LENGTH_MAX - default 251 - -config BT_CTLR_ASSERT_HANDLER - default y - -config BT_HCI_RAW_RESERVE - default 1 - -# Disable 2M PHY due to interoperability issues. -config BT_CTLR_PHY_2M - default n - -# Workaround: Unable to allocate command buffer when using K_NO_WAIT since -# Host number of completed commands does not follow normal flow control. -config BT_BUF_CMD_TX_COUNT - default 10 - -config ASSERT - default y - -config DEBUG_INFO - default y - -config EXCEPTION_STACK_TRACE - default y - -config IPC_SERVICE - default y - -config MBOX - default y diff --git a/config/nrfconnect/chip-module/Kconfig.hci_ipc.root b/config/nrfconnect/chip-module/Kconfig.hci_ipc.root deleted file mode 100644 index 1fe8ff85f43ee8..00000000000000 --- a/config/nrfconnect/chip-module/Kconfig.hci_ipc.root +++ /dev/null @@ -1,21 +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. -# - -# The purpose of this file is to create a wrapper Kconfig file that will be set as -# hci_ipc_KCONFIG_ROOT and processed before any other Kconfig for hci_ipc child image. - -rsource "Kconfig.hci_ipc.defaults" -source "Kconfig.zephyr" diff --git a/config/nrfconnect/chip-module/Kconfig.mcuboot.defaults b/config/nrfconnect/chip-module/Kconfig.mcuboot.defaults deleted file mode 100644 index 11c7dd0320f464..00000000000000 --- a/config/nrfconnect/chip-module/Kconfig.mcuboot.defaults +++ /dev/null @@ -1,138 +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. -# - -# The purpose of this file is to define new default values of settings used when building mcuboot child image for Matter samples. - -config MAIN_STACK_SIZE - default 10240 - -config BOOT_ENCRYPT_IMAGE - default n - -config BOOT_BOOTSTRAP - default n - -config PM - default n - -config FLASH - default y - -config FPROTECT - default y - -choice LIBC_IMPLEMENTATION - default MINIMAL_LIBC -endchoice - -# nRF7002DK uses SPI NOR external flash -if BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF7001_NRF5340_CPUAPP - -config SPI - default y - -choice SPI_NOR_SFDP - default SPI_NOR_SFDP_DEVICETREE -endchoice - -config SPI_NOR_FLASH_LAYOUT_PAGE_SIZE - default 4096 - -config MULTITHREADING - default y - -config PM_OVERRIDE_EXTERNAL_DRIVER_CHECK - default y - -endif - -# All boards beside nRF7002DK use QSPI NOR external flash -if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF52840DK_NRF52840 - -config NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE - default 4096 - -config NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE - default 16 - -endif - -config BOOT_MAX_IMG_SECTORS - default 256 - -config LOG - default n - -config CONSOLE_HANDLER - default n - -config BOOT_BANNER - default n - -config TIMESLICING - default n - -config RESET_ON_FATAL_ERROR - default n - -config MULTITHREADING - default n - -config TICKLESS_KERNEL - default n - -config TIMEOUT_64BIT - default n - -config NRF_ENABLE_ICACHE - default n - -if SOC_SERIES_NRF53X - -# The following configurations are required to support simultaneous multi image update -config PCD_APP - default y - -config UPDATEABLE_IMAGE_NUMBER - default 2 - -# Multi-image updates do not support image swapping yet. -choice BOOT_IMAGE_UPGRADE_MODE - default BOOT_UPGRADE_ONLY -endchoice - -# The network core cannot access external flash directly. The flash simulator must be used to -# provide a memory region that is used to forward the new firmware to the network core. -config FLASH_SIMULATOR - default y - -config FLASH_SIMULATOR_DOUBLE_WRITES - default y - -config FLASH_SIMULATOR_STATS - default n - -# Enable custom command to erase settings partition. -config ENABLE_MGMT_PERUSER - default y - -config ZCBOR - default y - -config BOOT_MGMT_CUSTOM_STORAGE_ERASE - default y - -endif # SOC_SERIES_NRF53X diff --git a/config/nrfconnect/chip-module/Kconfig.mcuboot.root b/config/nrfconnect/chip-module/Kconfig.mcuboot.root deleted file mode 100644 index e8756636dfd66d..00000000000000 --- a/config/nrfconnect/chip-module/Kconfig.mcuboot.root +++ /dev/null @@ -1,21 +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. -# - -# The purpose of this file is to create a wrapper Kconfig file that will be set as -# mcuboot_KCONFIG_ROOT and processed before any other Kconfig for mcuboot child image. - -rsource "Kconfig.mcuboot.defaults" -source "${ZEPHYR_BASE}/../bootloader/mcuboot/boot/zephyr/Kconfig" diff --git a/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.defaults b/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.defaults deleted file mode 100644 index 3d40e47429a074..00000000000000 --- a/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.defaults +++ /dev/null @@ -1,83 +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. -# - -# The purpose of this file is to define new default values of settings used when building multiprotocol_rpmsg child image for Matter samples. - -config LOG - default n - -config HEAP_MEM_POOL_SIZE - default 8192 - -config MAIN_STACK_SIZE - default 2048 - -config SYSTEM_WORKQUEUE_STACK_SIZE - default 2048 - -config BT - default y - -config BT_HCI_RAW - default y - -config BT_MAX_CONN - default 1 - -config BT_PERIPHERAL - default y - -config BT_CENTRAL - default n - -config BT_BUF_ACL_RX_SIZE - default 502 - -config BT_BUF_ACL_TX_SIZE - default 251 - -config BT_CTLR_DATA_LENGTH_MAX - default 251 - -config BT_CTLR_ASSERT_HANDLER - default y - -config BT_HCI_RAW_RESERVE - default 1 - -# Disable 2M PHY due to interoperability issues. -config BT_CTLR_PHY_2M - default n - -# Workaround: Unable to allocate command buffer when using K_NO_WAIT since -# Host number of completed commands does not follow normal flow control. -config BT_BUF_CMD_TX_COUNT - default 10 - -config ASSERT - default y - -config DEBUG_INFO - default y - -config EXCEPTION_STACK_TRACE - default y - -config NRF_802154_SER_RADIO - default y - -config NRF_802154_ENCRYPTION - default y diff --git a/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root b/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root deleted file mode 100644 index b34c82243585b4..00000000000000 --- a/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root +++ /dev/null @@ -1,21 +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. -# - -# The purpose of this file is to create a wrapper Kconfig file that will be set as -# multiprotocol_rpmsg_KCONFIG_ROOT and processed before any other Kconfig for multiprotocol_rpmsg child image. - -rsource "Kconfig.multiprotocol_rpmsg.defaults" -source "Kconfig.zephyr" diff --git a/config/nrfconnect/chip-module/generate_factory_data_sysbuild.cmake b/config/nrfconnect/chip-module/generate_factory_data_sysbuild.cmake new file mode 100644 index 00000000000000..ff37a5f57e01a8 --- /dev/null +++ b/config/nrfconnect/chip-module/generate_factory_data_sysbuild.cmake @@ -0,0 +1,249 @@ +# +# Copyright (c) 2022-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. +# + + +# Create a .hex file in CBOR format based on factory data given via kConfigs. +# +# This function creates a list of arguments for external script and then run it to write a JSON file. +# Created JSON file can be checked using JSON SCHEMA file if it is provided. +# Next, the resulting .hex file is generated based on previously created JSON file. +# +# This script can be manipulated using following kConfigs: +# - To merge generated factory data with final zephyr.hex file set kConfig SB_CONFIG_MATTER_FACTORY_DATA_MERGE_WITH_FIRMWARE=y +# - To use default certification paths set CONFIG_CHIP_FACTORY_DATA_USE_DEFAULTS_CERTS_PATH=y +# +# During generation process the following files will be created in zephyr's build directory: +# - .json a file containing all factory data written in JSON format. +# - .hex a file containing all factory data in CBOR format. +# - .bin a binary file containing all raw factory data in CBOR format. +# - .cbor a file containing all factory data in CBOR format. +# +# [Args]: +# factory_data_target - a name for target to generate factory_data. +# script_path - a path to script that makes a JSON factory data file from given arguments. +# schema_path - a path to JSON schema file which can be used to verify generated factory data JSON file. +# This argument is optional, if you don't want to verify the JSON file put it empty "". +# output_path - a path to output directory, where created hex and JSON files will be stored. +function(nrfconnect_create_factory_data factory_data_target script_path schema_path output_path image) + sysbuild_get(CONFIG_CHIP_DEVICE_SERIAL_NUMBER IMAGE ${image} VAR CONFIG_CHIP_DEVICE_SERIAL_NUMBER KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_MANUFACTURING_DATE IMAGE ${image} VAR CONFIG_CHIP_DEVICE_MANUFACTURING_DATE KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_VENDOR_ID IMAGE ${image} VAR CONFIG_CHIP_DEVICE_VENDOR_ID KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_PRODUCT_ID IMAGE ${image} VAR CONFIG_CHIP_DEVICE_PRODUCT_ID KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_VENDOR_NAME IMAGE ${image} VAR CONFIG_CHIP_DEVICE_VENDOR_NAME KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_PRODUCT_NAME IMAGE ${image} VAR CONFIG_CHIP_DEVICE_PRODUCT_NAME KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_HARDWARE_VERSION IMAGE ${image} VAR CONFIG_CHIP_DEVICE_HARDWARE_VERSION KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_HARDWARE_VERSION_STRING IMAGE ${image} VAR CONFIG_CHIP_DEVICE_HARDWARE_VERSION_STRING KCONFIG) + sysbuild_get(CONFIG_CHIP_ROTATING_DEVICE_ID IMAGE ${image} VAR CONFIG_CHIP_ROTATING_DEVICE_ID KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_GENERATE_ROTATING_DEVICE_UID IMAGE ${image} VAR CONFIG_CHIP_DEVICE_GENERATE_ROTATING_DEVICE_UID KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_ROTATING_DEVICE_UID IMAGE ${image} VAR CONFIG_CHIP_DEVICE_ROTATING_DEVICE_UID KCONFIG) + sysbuild_get(CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_GENERATED IMAGE ${image} VAR CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_GENERATED KCONFIG) + sysbuild_get(CONFIG_CHIP_FACTORY_DATA_GENERATE_CD IMAGE ${image} VAR CONFIG_CHIP_FACTORY_DATA_GENERATE_CD KCONFIG) + sysbuild_get(CONFIG_CHIP_FACTORY_DATA_USE_DEFAULT_CERTS IMAGE ${image} VAR CONFIG_CHIP_FACTORY_DATA_USE_DEFAULT_CERTS KCONFIG) + sysbuild_get(CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_USER IMAGE ${image} VAR CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_USER KCONFIG) + sysbuild_get(CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_CERT IMAGE ${image} VAR CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_CERT KCONFIG) + sysbuild_get(CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_KEY IMAGE ${image} VAR CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_KEY KCONFIG) + sysbuild_get(CONFIG_CHIP_FACTORY_DATA_USER_CERTS_PAI_CERT IMAGE ${image} VAR CONFIG_CHIP_FACTORY_DATA_USER_CERTS_PAI_CERT KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_SPAKE2_IT IMAGE ${image} VAR CONFIG_CHIP_DEVICE_SPAKE2_IT KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_SPAKE2_SALT IMAGE ${image} VAR CONFIG_CHIP_DEVICE_SPAKE2_SALT KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_DISCRIMINATOR IMAGE ${image} VAR CONFIG_CHIP_DEVICE_DISCRIMINATOR KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE IMAGE ${image} VAR CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_SPAKE2_TEST_VERIFIER IMAGE ${image} VAR CONFIG_CHIP_DEVICE_SPAKE2_TEST_VERIFIER KCONFIG) + sysbuild_get(CONFIG_CHIP_FACTORY_DATA_GENERATE_SPAKE2_VERIFIER IMAGE ${image} VAR CONFIG_CHIP_FACTORY_DATA_GENERATE_SPAKE2_VERIFIER KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_PRODUCT_FINISH IMAGE ${image} VAR CONFIG_CHIP_DEVICE_PRODUCT_FINISH KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_PRODUCT_COLOR IMAGE ${image} VAR CONFIG_CHIP_DEVICE_PRODUCT_COLOR KCONFIG) + sysbuild_get(CONFIG_CHIP_FACTORY_DATA_GENERATE_ONBOARDING_CODES IMAGE ${image} VAR CONFIG_CHIP_FACTORY_DATA_GENERATE_ONBOARDING_CODES KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_ENABLE_KEY IMAGE ${image} VAR CONFIG_CHIP_DEVICE_ENABLE_KEY KCONFIG) + + # Set script args for future purpose + set(script_args) + + # Generate all script arguments + string(APPEND script_args "--sn \"${CONFIG_CHIP_DEVICE_SERIAL_NUMBER}\"\n") + string(APPEND script_args "--date \"${CONFIG_CHIP_DEVICE_MANUFACTURING_DATE}\"\n") + string(APPEND script_args "--vendor_id ${CONFIG_CHIP_DEVICE_VENDOR_ID}\n") + string(APPEND script_args "--product_id ${CONFIG_CHIP_DEVICE_PRODUCT_ID}\n") + string(APPEND script_args "--vendor_name \"${CONFIG_CHIP_DEVICE_VENDOR_NAME}\"\n") + string(APPEND script_args "--product_name \"${CONFIG_CHIP_DEVICE_PRODUCT_NAME}\"\n") + string(APPEND script_args "--hw_ver ${CONFIG_CHIP_DEVICE_HARDWARE_VERSION}\n") + string(APPEND script_args "--hw_ver_str \"${CONFIG_CHIP_DEVICE_HARDWARE_VERSION_STRING}\"\n") + + # Check if Rotating Device Id Unique Id should be generated + if(CONFIG_CHIP_ROTATING_DEVICE_ID) + if(NOT CONFIG_CHIP_DEVICE_GENERATE_ROTATING_DEVICE_UID) + if(NOT DEFINED CONFIG_CHIP_DEVICE_ROTATING_DEVICE_UID) + message(FATAL_ERROR "CHIP_DEVICE_ROTATING_DEVICE_UID was not provided. To generate it use CONFIG_CHIP_DEVICE_GENERATE_ROTATING_DEVICE_UID=y") + else() + string(APPEND script_args "--rd_uid \"${CONFIG_CHIP_DEVICE_ROTATING_DEVICE_UID}\"\n") + endif() + else() + string(APPEND script_args "--generate_rd_uid\n") + endif() + endif() + + if(CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_GENERATED OR CONFIG_CHIP_FACTORY_DATA_GENERATE_CD) + find_program(chip_cert_exe NAMES chip-cert REQUIRED) + string(APPEND script_args "--chip_cert_path ${chip_cert_exe}\n") + endif() + + if(CONFIG_CHIP_FACTORY_DATA_GENERATE_CD) + string(APPEND script_args "--gen_cd\n") + endif() + + # For development purpose user can use default certs instead of generating or providing them + if(CONFIG_CHIP_FACTORY_DATA_USE_DEFAULT_CERTS) + # Convert decimal VID to its hexadecimal representation to find out certification files in repository + math(EXPR LOCAL_VID "${CONFIG_CHIP_DEVICE_VENDOR_ID}" OUTPUT_FORMAT HEXADECIMAL) + string(SUBSTRING ${LOCAL_VID} 2 -1 raw_vid) + string(TOUPPER ${raw_vid} raw_vid_upper) + # Convert decimal PID to its hexadecimal representation to find out certification files in repository + math(EXPR LOCAL_PID "${CONFIG_CHIP_DEVICE_PRODUCT_ID}" OUTPUT_FORMAT HEXADECIMAL) + string(SUBSTRING ${LOCAL_PID} 2 -1 raw_pid) + string(TOUPPER ${raw_pid} raw_pid_upper) + # All certs are located in ${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/credentials/development/attestation + # it can be used during development without need to generate new certifications + string(APPEND script_args "--dac_cert \"${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/credentials/development/attestation/Matter-Development-DAC-${raw_vid_upper}-${raw_pid_upper}-Cert.der\"\n") + string(APPEND script_args "--dac_key \"${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/credentials/development/attestation/Matter-Development-DAC-${raw_vid_upper}-${raw_pid_upper}-Key.der\"\n") + string(APPEND script_args "--pai_cert \"${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/credentials/development/attestation/Matter-Development-PAI-${raw_vid_upper}-noPID-Cert.der\"\n") + elseif(CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_USER) + string(APPEND script_args "--dac_cert \"${CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_CERT}\"\n") + string(APPEND script_args "--dac_key \"${CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_KEY}\"\n") + string(APPEND script_args "--pai_cert \"${CONFIG_CHIP_FACTORY_DATA_USER_CERTS_PAI_CERT}\"\n") + elseif(CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_GENERATED) + string(APPEND script_args "--gen_certs\n") + endif() + + # Add Password-Authenticated Key Exchange parameters + string(APPEND script_args "--spake2_it \"${CONFIG_CHIP_DEVICE_SPAKE2_IT}\"\n") + string(APPEND script_args "--spake2_salt \"${CONFIG_CHIP_DEVICE_SPAKE2_SALT}\"\n") + string(APPEND script_args "--discriminator ${CONFIG_CHIP_DEVICE_DISCRIMINATOR}\n") + string(APPEND script_args "--passcode ${CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE}\n") + string(APPEND script_args "--include_passcode\n") + string(APPEND script_args "--overwrite\n") + # Check if spake2 verifier should be generated using script + if(NOT CONFIG_CHIP_FACTORY_DATA_GENERATE_SPAKE2_VERIFIER) + # Spake2 verifier should be provided using kConfig + string(APPEND script_args "--spake2_verifier \"${CONFIG_CHIP_DEVICE_SPAKE2_TEST_VERIFIER}\"\n") + endif() + + # Product appearance + string(APPEND script_args "--product_finish ${CONFIG_CHIP_DEVICE_PRODUCT_FINISH}\n") + if(CONFIG_CHIP_DEVICE_PRODUCT_COLOR) + string(APPEND script_args "--product_color ${CONFIG_CHIP_DEVICE_PRODUCT_COLOR}\n") + endif() + + if(CONFIG_CHIP_FACTORY_DATA_GENERATE_ONBOARDING_CODES) + string(APPEND script_args "--generate_onboarding\n") + endif() + + if(CONFIG_CHIP_DEVICE_ENABLE_KEY) + # Add optional EnableKey that triggers user-specific action. + string(APPEND script_args "--enable_key \"${CONFIG_CHIP_DEVICE_ENABLE_KEY}\"\n") + endif() + + # Set output path and path to SCHEMA file to validate generated factory data + set(factory_data_output_path ${output_path}/${factory_data_target}) + string(APPEND script_args "-o \"${factory_data_output_path}\"\n") + string(APPEND script_args "-s \"${schema_path}\"\n") + + # Add optional offset and size arguments to generate .hex file as well as .json. + if(SB_CONFIG_PARTITION_MANAGER) + string(APPEND script_args "--offset $\n") + string(APPEND script_args "--size $\n") + else() + include(${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/dts.cmake) + + get_target_property(factory_data_alias devicetree_target "DT_ALIAS|factory-data") + get_target_property(factory_data_address devicetree_target "DT_REG|${factory_data_alias}|ADDR") + get_target_property(factory_data_size devicetree_target "DT_REG|${factory_data_alias}|SIZE") + + # remove ; from address and size properties + string(SUBSTRING ${factory_data_address} 0 -1 factory_data_address) + string(SUBSTRING ${factory_data_size} 0 -1 factory_data_size) + if(NOT (DEFINED factory_data_alias AND DEFINED factory_data_address AND DEFINED factory_data_size)) + message(FATAL_ERROR "factory-data alias does not exist in DTS") + endif() + + string(APPEND script_args "--offset ${factory_data_address}\n") + string(APPEND script_args "--size ${factory_data_size}\n") + endif() + + # Execute first script to create a JSON file + separate_arguments(separated_script_args NATIVE_COMMAND ${script_args}) + add_custom_command( + OUTPUT ${factory_data_output_path}.hex + DEPENDS ${FACTORY_DATA_SCRIPT_PATH} + COMMAND ${Python3_EXECUTABLE} ${FACTORY_DATA_SCRIPT_PATH} ${separated_script_args} + COMMENT "Generating new Factory Data..." + ) + add_custom_target(${factory_data_target} ALL + DEPENDS ${factory_data_output_path}.hex + ) +endfunction() + +# Generate factory data partition using given args +# +# +# During generation process a some file will be created in zephyr's build directory: +# - merged.hex a file containing firmware and factory data merged to single file +# - factory_data.hex a file containing only a factory data partition including proper offset +# +function(nrfconnect_generate_factory_data) + if(NOT ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR) + message(FATAL_ERROR "ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR variable is not set, ensure the matter module is in your manifest") + endif() + + # Localize all scripts needed to generate factory data partition + set(FACTORY_DATA_SCRIPT_PATH ${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py) + set(GENERATE_CBOR_SCRIPT_PATH ${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/scripts/tools/nrfconnect/nrfconnect_generate_partition.py) + set(FACTORY_DATA_SCHEMA_PATH ${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/scripts/tools/nrfconnect/nrfconnect_factory_data.schema) + set(OUTPUT_FILE_PATH ${APPLICATION_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr) + + # Create a .hex file with factory data in CBOR format based on the JSON file created previously + nrfconnect_create_factory_data(factory_data + ${FACTORY_DATA_SCRIPT_PATH} + ${FACTORY_DATA_SCHEMA_PATH} + ${OUTPUT_FILE_PATH} + ${DEFAULT_IMAGE} + ) + + if(SB_CONFIG_MATTER_FACTORY_DATA_MERGE_WITH_FIRMWARE) + if(SB_CONFIG_PARTITION_MANAGER) + # Set custom target for merging factory_data hex file + set_property(GLOBAL PROPERTY factory_data_PM_HEX_FILE ${OUTPUT_FILE_PATH}/factory_data.hex) + set_property(GLOBAL PROPERTY factory_data_PM_TARGET factory_data) + else() + add_custom_command(OUTPUT ${OUTPUT_FILE_PATH}/merged.hex + COMMAND + ${PYTHON_EXECUTABLE} + ${ZEPHYR_BASE}/scripts/build/mergehex.py + -o ${OUTPUT_FILE_PATH}/merged.hex + ${OUTPUT_FILE_PATH}/factory_data.hex + ${OUTPUT_FILE_PATH}/zephyr.hex + DEPENDS + ${DEFAULT_IMAGE}_extra_byproducts + factory_data + ${OUTPUT_FILE_PATH}/factory_data.hex + ${OUTPUT_FILE_PATH}/zephyr.hex + ) + + # Wrapper target for the merge command. + add_custom_target(merged_hex + ALL DEPENDS + ${OUTPUT_FILE_PATH}/merged.hex + ) + endif() + endif() +endfunction() diff --git a/config/nxp/chip-module/Kconfig b/config/nxp/chip-module/Kconfig index ae95e1ce348f57..152d1161f9f435 100644 --- a/config/nxp/chip-module/Kconfig +++ b/config/nxp/chip-module/Kconfig @@ -30,15 +30,6 @@ config CHIP_NXP_PLATFORM config CHIP_DEVICE_VENDOR_NAME default "NXP Semiconductors" -config CHIP_APP_LOG_LEVEL - int "Logging level in application" - default LOG_DEFAULT_LEVEL - depends on LOG - help - Sets the logging level in the Matter application. Use this configuration - option only within the application. To set the logging level for the - Matter stack, use the MATTER_LOG_LEVEL configuration option. - config CHIP_EXAMPLE_DEVICE_INFO_PROVIDER bool "Include default device information provider build" default y diff --git a/config/python/CHIPProjectConfig.h b/config/python/CHIPProjectConfig.h index 5effaaa13c6479..4412c5bec75a01 100644 --- a/config/python/CHIPProjectConfig.h +++ b/config/python/CHIPProjectConfig.h @@ -26,14 +26,19 @@ #define CHIP_CONFIG_EVENT_LOGGING_NUM_EXTERNAL_CALLBACKS 2 // Uncomment this for a large Tunnel MTU. -//#define CHIP_CONFIG_TUNNEL_INTERFACE_MTU (9000) +// #define CHIP_CONFIG_TUNNEL_INTERFACE_MTU (9000) // Enable support functions for parsing command-line arguments #define CHIP_CONFIG_ENABLE_ARG_PARSER 1 -// Use a default pairing code if one hasn't been provisioned in flash. -#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 -#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 +// Enable use of test setup parameters for testing purposes only. +// +// WARNING: This option makes it possible to circumvent basic chip security functionality. +// Because of this it SHOULD NEVER BE ENABLED IN PRODUCTION BUILDS. +// +#ifndef CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS +#define CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS 1 +#endif // Enable reading DRBG seed data from /dev/(u)random. // This is needed for test applications and the CHIP device manager to function @@ -46,6 +51,8 @@ // WARNING: These options make it possible to circumvent basic Chip security functionality, // including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. // +// To build with this flag, pass 'treat_warnings_as_errors=false' to gn/ninja. +// #define CHIP_CONFIG_SECURITY_TEST_MODE 0 #define CHIP_CONFIG_ENABLE_UPDATE 1 diff --git a/config/telink/app/bootloader_usb.conf b/config/telink/app/bootloader_usb.conf index b6b0098bfc31b1..67ec09a790913d 100644 --- a/config/telink/app/bootloader_usb.conf +++ b/config/telink/app/bootloader_usb.conf @@ -16,5 +16,5 @@ # USB DFU configuration CONFIG_USB_DFU_WILL_DETACH=n -CONFIG_BOOT_USB_DFU_GPIO=y -CONFIG_MCUBOOT_INDICATION_LED=y +CONFIG_BOOT_USB_DFU_GPIO=n +CONFIG_MCUBOOT_INDICATION_LED=n diff --git a/config/telink/chip-module/Kconfig b/config/telink/chip-module/Kconfig index 46dc36b8973d77..d09f4534835ddf 100644 --- a/config/telink/chip-module/Kconfig +++ b/config/telink/chip-module/Kconfig @@ -22,15 +22,6 @@ if CHIP config CHIP_DEVICE_VENDOR_NAME default "Telink Semiconductor" -config CHIP_APP_LOG_LEVEL - int "Logging level in application" - default LOG_DEFAULT_LEVEL - depends on LOG - help - Sets the logging level in the Matter application. Use this configuration - option only within the application. To set the logging level for the - Matter stack, use the MATTER_LOG_LEVEL configuration option. - config CHIP_NFC_COMMISSIONING bool "Share onboarding payload in NFC tag" default n diff --git a/config/telink/chip-module/Kconfig.defaults b/config/telink/chip-module/Kconfig.defaults index ea5a6822b74cb5..9c27fe1059451f 100644 --- a/config/telink/chip-module/Kconfig.defaults +++ b/config/telink/chip-module/Kconfig.defaults @@ -286,10 +286,10 @@ config NET_IPV6_NBR_CACHE default n config NET_MAX_CONN - default 1 + default 1 if !WIFI config NET_MAX_CONTEXTS - default 1 + default 1 if !WIFI config NET_CONFIG_INIT_TIMEOUT default 0 diff --git a/config/zephyr/Kconfig b/config/zephyr/Kconfig index 95cea7cec1a707..fb06e106e29a38 100644 --- a/config/zephyr/Kconfig +++ b/config/zephyr/Kconfig @@ -42,6 +42,15 @@ menuconfig CHIP if CHIP +config CHIP_APP_LOG_LEVEL + int "Logging level in application" + default LOG_DEFAULT_LEVEL + depends on LOG + help + Sets the logging level in the Matter application. Use this configuration + option only within the application. To set the logging level for the + Matter stack, use the MATTER_LOG_LEVEL configuration option. + # Device and firmware identifers config CHIP_DEVICE_VENDOR_ID diff --git a/examples/fabric-bridge-app/linux/Dockerfile b/config/zephyr/chip-module/Kconfig.logging similarity index 56% rename from examples/fabric-bridge-app/linux/Dockerfile rename to config/zephyr/chip-module/Kconfig.logging index 5194431decc644..85cf1847a49cce 100644 --- a/examples/fabric-bridge-app/linux/Dockerfile +++ b/config/zephyr/chip-module/Kconfig.logging @@ -1,6 +1,5 @@ # -# Copyright (c) 2024 Project CHIP Authors -# All rights reserved. +# Copyright (c) 2021 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,11 +14,28 @@ # limitations under the License. # -ARG VERSION=1 -FROM ghcr.io/project-chip/chip-cirque-device-base:${VERSION} -LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip +config LOG + default y -COPY out/debug/chip-bridge-app /usr/bin/ -COPY entrypoint.sh / +if LOG -ENTRYPOINT ["/entrypoint.sh", "server"] +choice LOG_MODE + default LOG_MODE_MINIMAL +endchoice + +choice MATTER_LOG_LEVEL_CHOICE + default MATTER_LOG_LEVEL_DBG +endchoice + +config CHIP_APP_LOG_LEVEL + default 4 # debug + +config LOG_DEFAULT_LEVEL + default 1 # error + +# disable synchronous printk to avoid blocking IRQs which +# may affect time sensitive components +config PRINTK_SYNC + default n + +endif # LOG \ No newline at end of file diff --git a/config/zephyr/ota-image_sysbuild.cmake b/config/zephyr/ota-image_sysbuild.cmake new file mode 100644 index 00000000000000..2bd78ea6ee5afb --- /dev/null +++ b/config/zephyr/ota-image_sysbuild.cmake @@ -0,0 +1,102 @@ +# +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Create CMake target for building Matter OTA (Over-the-air update) image. +# +# Required arguments: +# INPUT_FILES file1[, file2...] Binary files to be included in Matter OTA image +# OUTPUT_FILE file Location of generated Matter OTA image +# +function(chip_ota_image TARGET_NAME) + cmake_parse_arguments(ARG "" "OUTPUT_FILE" "INPUT_FILES" ${ARGN}) + + if(NOT ARG_INPUT_FILES OR NOT ARG_OUTPUT_FILE) + message(FATAL_ERROR "Both INPUT_FILES and OUTPUT_FILE arguments must be specified") + endif() + + sysbuild_get(CONFIG_CHIP_DEVICE_SOFTWARE_VERSION IMAGE ${DEFAULT_IMAGE} VAR CONFIG_CHIP_DEVICE_SOFTWARE_VERSION KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING IMAGE ${DEFAULT_IMAGE} VAR CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_VENDOR_ID IMAGE ${DEFAULT_IMAGE} VAR CONFIG_CHIP_DEVICE_VENDOR_ID KCONFIG) + sysbuild_get(CONFIG_CHIP_DEVICE_PRODUCT_ID IMAGE ${DEFAULT_IMAGE} VAR CONFIG_CHIP_DEVICE_PRODUCT_ID KCONFIG) + + # Prepare ota_image_tool.py argument list + if(EXISTS ${APP_DIR}/VERSION) + file(READ ${APP_DIR}/VERSION ver) + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${APP_DIR}/VERSION) + string(REGEX MATCH "VERSION_MAJOR = ([0-9]*)" _ ${ver}) + set(app_version_major ${CMAKE_MATCH_1}) + string(REGEX MATCH "VERSION_MINOR = ([0-9]*)" _ ${ver}) + set(app_version_minor ${CMAKE_MATCH_1}) + string(REGEX MATCH "PATCHLEVEL = ([0-9]*)" _ ${ver}) + set(app_version_patchlevel ${CMAKE_MATCH_1}) + string(REGEX MATCH "VERSION_TWEAK = ([0-9]*)" _ ${ver}) + set(app_version_tweak ${CMAKE_MATCH_1}) + + set(APP_VERSION_STRING "${app_version_major}.${app_version_minor}.${app_version_patchlevel}+${app_version_tweak}") + math(EXPR APPVERSION "(${app_version_major} << 24) | (${app_version_minor} << 16) | (${app_version_patchlevel} << 8) | ${app_version_tweak}" OUTPUT_FORMAT HEXADECIMAL) + + set(OTA_ARGS + "--vendor-id" + ${CONFIG_CHIP_DEVICE_VENDOR_ID} + "--product-id" + ${CONFIG_CHIP_DEVICE_PRODUCT_ID} + "--version" + ${APPVERSION} + "--version-str" + ${APP_VERSION_STRING} + "--digest-algorithm" + "sha256" + ) + else() + set(OTA_ARGS + "--vendor-id" + ${CONFIG_CHIP_DEVICE_VENDOR_ID} + "--product-id" + ${CONFIG_CHIP_DEVICE_PRODUCT_ID} + "--version" + ${CONFIG_CHIP_DEVICE_SOFTWARE_VERSION} + "--version-str" + ${CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING} + "--digest-algorithm" + "sha256" + ) + endif() + + separate_arguments(OTA_EXTRA_ARGS NATIVE_COMMAND "${CHIP_OTA_IMAGE_EXTRA_ARGS}") + + list(APPEND OTA_ARGS ${OTA_EXTRA_ARGS}) + list(APPEND OTA_ARGS ${ARG_INPUT_FILES}) + list(APPEND OTA_ARGS ${ARG_OUTPUT_FILE}) + + # Convert the argument list to multi-line string + string(REPLACE ";" "\n" OTA_ARGS "${OTA_ARGS}") + + # Pass the argument list via file to avoid hitting Windows command-line length limit + file(GENERATE + OUTPUT ${ARG_OUTPUT_FILE}.args + CONTENT ${OTA_ARGS} + ) + + add_custom_command(OUTPUT ${ARG_OUTPUT_FILE} + COMMAND ${Python3_EXECUTABLE} ${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/ota_image_tool.py create @${ARG_OUTPUT_FILE}.args + DEPENDS ${ARG_INPUT_FILES} ${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/ota_image_tool.py + ) + + add_custom_target(${TARGET_NAME} ALL + DEPENDS ${ARG_OUTPUT_FILE} + ) +endfunction() diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_70mai_Matter_PAA_vid_0x140B.der b/credentials/development/paa-root-certs/dcld_mirror_CN_70mai_Matter_PAA_vid_0x140B.der new file mode 100644 index 00000000000000..eb604af4036b25 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_70mai_Matter_PAA_vid_0x140B.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_70mai_Matter_PAA_vid_0x140B.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_70mai_Matter_PAA_vid_0x140B.pem new file mode 100644 index 00000000000000..64725b6729e88f --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_70mai_Matter_PAA_vid_0x140B.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBxjCCAWygAwIBAgIRANBskmmy8YAEmHofOp/xYmcwCgYIKoZIzj0EAwIwMTEZ +MBcGA1UEAwwQNzBtYWkgTWF0dGVyIFBBQTEUMBIGCisGAQQBgqJ8AgEMBDE0MEIw +IBcNMjMwNzI0MDcwMTMxWhgPMjUyMzAzMjUwODAxMzFaMDExGTAXBgNVBAMMEDcw +bWFpIE1hdHRlciBQQUExFDASBgorBgEEAYKifAIBDAQxNDBCMFkwEwYHKoZIzj0C +AQYIKoZIzj0DAQcDQgAEh7YSUJl3gJtgkIssE/7ZO9pRO5XbfS73b1zF2/Wjbi9r +igxSqAyIMVpObAMsfdin8f8+WwBeG4deexmwq5jzhKNjMGEwDwYDVR0TAQH/BAUw +AwEB/zAdBgNVHQ4EFgQUFFpRtZs7j1lqjNmWQvB1DDSYOG8wDgYDVR0PAQH/BAQD +AgGGMB8GA1UdIwQYMBaAFBRaUbWbO49ZaozZlkLwdQw0mDhvMAoGCCqGSM49BAMC +A0gAMEUCIEACwkh/UMcjnV6noWfg7pjYQt1Z9tB5S32YvDKUQg44AiEAkXj2t5TC +7huhrQmdHeBr3e1+Eci4q068qd2nI4zECM0= +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Anker_Innovations_Matter_PAA_vid_0x1533.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Anker_Innovations_Matter_PAA_vid_0x1533.der new file mode 100644 index 00000000000000..1300a90a351e31 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Anker_Innovations_Matter_PAA_vid_0x1533.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Anker_Innovations_Matter_PAA_vid_0x1533.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Anker_Innovations_Matter_PAA_vid_0x1533.pem new file mode 100644 index 00000000000000..19b6468c3f20b5 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Anker_Innovations_Matter_PAA_vid_0x1533.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB0zCCAXqgAwIBAgIEEAAACTAKBggqhkjOPQQDAjA9MRQwEgYKKwYBBAGConwC +AQwEMTUzMzElMCMGA1UEAwwcQW5rZXIgSW5ub3ZhdGlvbnMgTWF0dGVyIFBBQTAg +Fw0yNDA1MTYwOTI2MjhaGA85OTk5MTIzMDA5MjYyOFowPTEUMBIGCisGAQQBgqJ8 +AgEMBDE1MzMxJTAjBgNVBAMMHEFua2VyIElubm92YXRpb25zIE1hdHRlciBQQUEw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQGMvtbso2avjK1ARPNTFoXX/3kpKmu +e8i4zfRjCFjs8mxZkOrmbS4IOw3wlWgaL91danRizORhbWilHsdyDiKOo2YwZDAS +BgNVHRMBAf8ECDAGAQH/AgEBMB8GA1UdIwQYMBaAFF0RbnEDG5pPw1S1mMx4V6Su +ULKGMB0GA1UdDgQWBBRdEW5xAxuaT8NUtZjMeFekrlCyhjAOBgNVHQ8BAf8EBAMC +AQYwCgYIKoZIzj0EAwIDRwAwRAIgfLXElnmPFMYwytT/mOOkp7enq1G6a/zpYKQu +oSJ6EUoCIDdhtSd9z6h+/dN4mSly8OIRE2Zo6z9bFpQVZFt6BzBy +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Aqara_Matter_PAA_01_O_Lumi_United_Technology_Co__Ltd.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Aqara_Matter_PAA_01_O_Lumi_United_Technology_Co__Ltd.der new file mode 100644 index 00000000000000..6887a91e999698 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Aqara_Matter_PAA_01_O_Lumi_United_Technology_Co__Ltd.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Aqara_Matter_PAA_01_O_Lumi_United_Technology_Co__Ltd.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Aqara_Matter_PAA_01_O_Lumi_United_Technology_Co__Ltd.pem new file mode 100644 index 00000000000000..1df7012d14a480 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Aqara_Matter_PAA_01_O_Lumi_United_Technology_Co__Ltd.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB9TCCAZygAwIBAgIRAJ4ckIzu1/EXWiYXT/3PzuEwCgYIKoZIzj0EAwIwSTEo +MCYGA1UECgwfTHVtaSBVbml0ZWQgVGVjaG5vbG9neSBDby4sIEx0ZDEdMBsGA1UE +AwwUQXFhcmEgTWF0dGVyIFBBQSAjMDEwIBcNMjMwNjIwMDgxMjM3WhgPOTk5OTEy +MzEyMzU5NTlaMEkxKDAmBgNVBAoMH0x1bWkgVW5pdGVkIFRlY2hub2xvZ3kgQ28u +LCBMdGQxHTAbBgNVBAMMFEFxYXJhIE1hdHRlciBQQUEgIzAxMFkwEwYHKoZIzj0C +AQYIKoZIzj0DAQcDQgAEy3JmW4dkIzN5HbDL3v9Kr3ZY9c9an7DUCwY6CyKRyzxE +QE6z5Yy3TzannQBoomkMbnK9wkCPJJTNnR8NOr9S8qNjMGEwDwYDVR0TAQH/BAUw +AwEB/zAdBgNVHQ4EFgQUmpf77hNiX3/vVXQL+TXxdHHeS3YwDgYDVR0PAQH/BAQD +AgGGMB8GA1UdIwQYMBaAFJqX++4TYl9/71V0C/k18XRx3kt2MAoGCCqGSM49BAMC +A0cAMEQCIEWIzz9hCLfUsSNzuDWrWgI+omq1E9NlP2heP4ugfB2PAiB21Wzrf7m/ +jk0rmvAP1eqJjCwh9uvI34offdV04/bHfA== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_BouffaloLab_Matter_PAA_vid_0x130D.der b/credentials/development/paa-root-certs/dcld_mirror_CN_BouffaloLab_Matter_PAA_vid_0x130D.der new file mode 100644 index 00000000000000..af9aa7f1c2d153 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_BouffaloLab_Matter_PAA_vid_0x130D.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_BouffaloLab_Matter_PAA_vid_0x130D.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_BouffaloLab_Matter_PAA_vid_0x130D.pem new file mode 100644 index 00000000000000..a7553c76ab1361 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_BouffaloLab_Matter_PAA_vid_0x130D.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB0TCCAXegAwIBAgIQaITTalFdhyvSwC28BV1ngjAKBggqhkjOPQQDAjA3MR8w +HQYDVQQDDBZCb3VmZmFsb0xhYiBNYXR0ZXIgUEFBMRQwEgYKKwYBBAGConwCAQwE +MTMwRDAgFw0yMzA2MTkwNDI3MDVaGA8yMTIyMDYxOTA1MjcwNVowNzEfMB0GA1UE +AwwWQm91ZmZhbG9MYWIgTWF0dGVyIFBBQTEUMBIGCisGAQQBgqJ8AgEMBDEzMEQw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAT9qtlVs5p+5yzS91xz5hmcfXOglIDW +p7fqYE9uFmq2x8IthHxwXF9PXG4LbMlgaq3cL/ijr9kqfSjQ1q+3iaY3o2MwYTAP +BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRltKiB/t9YUSOvkqlSypCPRj116zAO +BgNVHQ8BAf8EBAMCAYYwHwYDVR0jBBgwFoAUZbSogf7fWFEjr5KpUsqQj0Y9desw +CgYIKoZIzj0EAwIDSAAwRQIgOXeXdhQxz1kKq5W+Pt0QDPVfR4OqRvFW4GZ3Kj0K +fFoCIQC7qxHppHx023BdMTCyAXoDDqKQ5z5BFNw1k/Xil2Q8lw== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_DSC_Matter_PAA_O_Dream_Security_Co__Ltd_C_KR.der b/credentials/development/paa-root-certs/dcld_mirror_CN_DSC_Matter_PAA_O_Dream_Security_Co__Ltd_C_KR.der new file mode 100644 index 00000000000000..38871931650057 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_DSC_Matter_PAA_O_Dream_Security_Co__Ltd_C_KR.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_DSC_Matter_PAA_O_Dream_Security_Co__Ltd_C_KR.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_DSC_Matter_PAA_O_Dream_Security_Co__Ltd_C_KR.pem new file mode 100644 index 00000000000000..f2d5c366c63bab --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_DSC_Matter_PAA_O_Dream_Security_Co__Ltd_C_KR.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB/DCCAaKgAwIBAgIUAUlzLLkOLfiBQM1Mtdd715RoIpcwCgYIKoZIzj0EAwIw +STELMAkGA1UEBhMCS1IxITAfBgNVBAoMGERyZWFtIFNlY3VyaXR5IENvLiwgTHRk +LjEXMBUGA1UEAwwORFNDIE1hdHRlciBQQUEwIBcNMjMxMDEzMDM0ODUzWhgPOTk5 +OTEyMzExNDU5NTlaMEkxCzAJBgNVBAYTAktSMSEwHwYDVQQKDBhEcmVhbSBTZWN1 +cml0eSBDby4sIEx0ZC4xFzAVBgNVBAMMDkRTQyBNYXR0ZXIgUEFBMFkwEwYHKoZI +zj0CAQYIKoZIzj0DAQcDQgAEwna+mEy1wfCZ0iDK4hoKP4js4HE9XmiRe7pZ1RLp +ahkjnkABlV+R4CixltIwnagyn0HuyhEWRFXhf2Na6nGORqNmMGQwHwYDVR0jBBgw +FoAUSvBR2pNudxvmFRNxKN5AJTNeaY0wHQYDVR0OBBYEFErwUdqTbncb5hUTcSje +QCUzXmmNMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEBMAoGCCqG +SM49BAMCA0gAMEUCIBFvRkkx9tuuocwTIBdNWg7or7XqaNp0pNK0BRKfEOkRAiEA +ykq93kYuFbX6lSzl3n0eJJ8Wo3L7b/l1mHtYTdhBQzE= +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Ecovacs_Matter_PAA_O_ECOVACS_IOT_vid_0x1405.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Ecovacs_Matter_PAA_O_ECOVACS_IOT_vid_0x1405.der new file mode 100644 index 00000000000000..ecf361dae6cc39 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Ecovacs_Matter_PAA_O_ECOVACS_IOT_vid_0x1405.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Ecovacs_Matter_PAA_O_ECOVACS_IOT_vid_0x1405.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Ecovacs_Matter_PAA_O_ECOVACS_IOT_vid_0x1405.pem new file mode 100644 index 00000000000000..8cef24133c1c0c --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Ecovacs_Matter_PAA_O_ECOVACS_IOT_vid_0x1405.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB1DCCAXqgAwIBAgIQW09Lv9ptt+IhqXXbbGzKTzAKBggqhkjOPQQDAjBJMRsw +GQYDVQQDDBJFY292YWNzIE1hdHRlciBQQUExFDASBgorBgEEAYKifAIBDAQxNDA1 +MRQwEgYDVQQKDAtFQ09WQUNTIElPVDAgFw0yNDAyMjEwNjM0MzlaGA85OTk5MTIz +MTIzNTk1OVowSTEbMBkGA1UEAwwSRWNvdmFjcyBNYXR0ZXIgUEFBMRQwEgYKKwYB +BAGConwCAQwEMTQwNTEUMBIGA1UECgwLRUNPVkFDUyBJT1QwWTATBgcqhkjOPQIB +BggqhkjOPQMBBwNCAAT/Qmenu+SAjEForNL9yxVa9swLcalKRiuZaH/DzH1yLP4X +JCmLbx6G67zSQoQSfpp77LqgutIbSJ8r7+oqANY5o0IwQDAPBgNVHRMBAf8EBTAD +AQH/MB0GA1UdDgQWBBQiJnIKCNppY2KxFpI8tHQtEus6UDAOBgNVHQ8BAf8EBAMC +AYYwCgYIKoZIzj0EAwIDSAAwRQIhAOGDpMmCrjYdlz102PIkf2DHsIg1rdocfPTc +340dgyNxAiA9GmencY7sOJp5KjYmHgppFtuKkY6/k7x1xD0GlCOcyQ== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Energy_Magic_Cube_Matter_PAA_001_vid_0x1462.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Energy_Magic_Cube_Matter_PAA_001_vid_0x1462.der new file mode 100644 index 00000000000000..6438781dc45163 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Energy_Magic_Cube_Matter_PAA_001_vid_0x1462.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Energy_Magic_Cube_Matter_PAA_001_vid_0x1462.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Energy_Magic_Cube_Matter_PAA_001_vid_0x1462.pem new file mode 100644 index 00000000000000..67697392583be6 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Energy_Magic_Cube_Matter_PAA_001_vid_0x1462.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB5jCCAYygAwIBAgIRAPlpOvhByCYEtN9DBypV0jQwCgYIKoZIzj0EAwIwQTEp +MCcGA1UEAwwgRW5lcmd5IE1hZ2ljIEN1YmUgTWF0dGVyIFBBQSAwMDExFDASBgor +BgEEAYKifAIBDAQxNDYyMCAXDTIzMDcyNzEzMDA1NloYDzIyOTcwNTEwMTQwMDU2 +WjBBMSkwJwYDVQQDDCBFbmVyZ3kgTWFnaWMgQ3ViZSBNYXR0ZXIgUEFBIDAwMTEU +MBIGCisGAQQBgqJ8AgEMBDE0NjIwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARe +uoz+NvT1NIHBc0aNiaHp1Vcw2ysyUq6Pgi61CSJMLQ6seo1WhSVMCYof6NCJNGan +M8YeVOQINZI4h0iXKnwDo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSu +akG67t30MGPMHc7nzcgTP8ynODAOBgNVHQ8BAf8EBAMCAYYwHwYDVR0jBBgwFoAU +rmpBuu7d9DBjzB3O583IEz/MpzgwCgYIKoZIzj0EAwIDSAAwRQIgXd+gekuzZQlD +nEnpvn16oe8qf83XWNLOBU7kpYvXjjYCIQDhbZRrEq6U7skYoqJn478a+b4EEexA +4790Zm8JHbhRlQ== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Espressif_Matter_Open_PAA_O_Espressif_Systems.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Espressif_Matter_Open_PAA_O_Espressif_Systems.der new file mode 100644 index 00000000000000..7ec9d617be0fc5 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Espressif_Matter_Open_PAA_O_Espressif_Systems.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Espressif_Matter_Open_PAA_O_Espressif_Systems.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Espressif_Matter_Open_PAA_O_Espressif_Systems.pem new file mode 100644 index 00000000000000..459570181a08b3 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Espressif_Matter_Open_PAA_O_Espressif_Systems.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB6DCCAY2gAwIBAgIRANvFEo4HItdgmPRAoZzjBm0wCgYIKoZIzj0EAwIwQDEi +MCAGA1UEAwwZRXNwcmVzc2lmIE1hdHRlciBPcGVuIFBBQTEaMBgGA1UECgwRRXNw +cmVzc2lmIFN5c3RlbXMwIBcNMjQwMTA1MDUxMzI1WhgPOTk5OTEyMzEyMzU5NTla +MEAxIjAgBgNVBAMMGUVzcHJlc3NpZiBNYXR0ZXIgT3BlbiBQQUExGjAYBgNVBAoM +EUVzcHJlc3NpZiBTeXN0ZW1zMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEOXAK +KrklPSU2LY/wvSf2GWxEHXqyHPm5cid870KN3R8LSHWshC9kH54QFUmoNHcTviE3 +5DkjJwhNL5OR/ccfq6NmMGQwEgYDVR0TAQH/BAgwBgEB/wIBATAfBgNVHSMEGDAW +gBRmTMGwLTMc15FUbp4UiDMxib1v0DAdBgNVHQ4EFgQUZkzBsC0zHNeRVG6eFIgz +MYm9b9AwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA0kAMEYCIQD+igSgqYgP +rKC7jLCWGQ8NydYpU591po+wJ6Vc6PkWWgIhANPW0FQv9FuBMXP8zp0l8eAW8h6A +4GB6+MmFQeq97qcz +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Feit_Electric_PAA_vid_0x1423.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Feit_Electric_PAA_vid_0x1423.der new file mode 100644 index 00000000000000..94dcffaedae0f6 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Feit_Electric_PAA_vid_0x1423.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Feit_Electric_PAA_vid_0x1423.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Feit_Electric_PAA_vid_0x1423.pem new file mode 100644 index 00000000000000..963d6673897371 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Feit_Electric_PAA_vid_0x1423.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIByzCCAXGgAwIBAgIUe3w51hygpwHd6Tlxj2adk6IF5pswCgYIKoZIzj0EAwIw +MjEaMBgGA1UEAwwRRmVpdCBFbGVjdHJpYyBQQUExFDASBgorBgEEAYKifAIBDAQx +NDIzMCAXDTIzMDcyMTA1MzM1MFoYDzgzMjMwOTA3MDUzMzUwWjAyMRowGAYDVQQD +DBFGZWl0IEVsZWN0cmljIFBBQTEUMBIGCisGAQQBgqJ8AgEMBDE0MjMwWTATBgcq +hkjOPQIBBggqhkjOPQMBBwNCAAQT516150jQlChLACUsk9Y+KWG6i53J9UFXF8hS +QeD91fdRMagNnT9fvq67FaQxw+I8ZJlhr0S6dmWcJ2mg/l+io2MwYTAPBgNVHRMB +Af8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUBp6Gv3HbUvnfPOp9 +5CkMn1uZaPEwHwYDVR0jBBgwFoAUBp6Gv3HbUvnfPOp95CkMn1uZaPEwCgYIKoZI +zj0EAwIDSAAwRQIgL85qVK45czuhx53cqICB+NUVZTnyx5n+Yxc1hjZjrt4CIQDQ ++vG34+tSW9Yu870l08ArF9MDmh2slLXKEOlXKXZ4Ew== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Freedompro_vid_0x1411_vid_0x1411.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Freedompro_vid_0x1411_vid_0x1411.der new file mode 100644 index 00000000000000..f05b1fa37a5a0d Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Freedompro_vid_0x1411_vid_0x1411.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Freedompro_vid_0x1411_vid_0x1411.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Freedompro_vid_0x1411_vid_0x1411.pem new file mode 100644 index 00000000000000..40c6b0ce9c2459 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Freedompro_vid_0x1411_vid_0x1411.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIByzCCAXCgAwIBAgIIGBv/c3jnq0YwCgYIKoZIzj0EAwIwNjEeMBwGA1UEAwwV +RnJlZWRvbXBybyx2aWQ9MHgxNDExMRQwEgYKKwYBBAGConwCAQwEMTQxMTAgFw0y +NDAxMDEwMDAwMDBaGA85OTk5MTIzMTIzNTk1OVowNjEeMBwGA1UEAwwVRnJlZWRv +bXBybyx2aWQ9MHgxNDExMRQwEgYKKwYBBAGConwCAQwEMTQxMTBZMBMGByqGSM49 +AgEGCCqGSM49AwEHA0IABJZ76CU2fZUWA7xdv+qJmsHWVH8BhZGeaph0IdSGYhc2 +EHuKTqnwHt/RdfJFwx23BLAWAkCIZajILqxSo8CCqKSjZjBkMBIGA1UdEwEB/wQI +MAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBQ8wKeoW2LBxfThfQZH +KREr2wkGwzAfBgNVHSMEGDAWgBQ8wKeoW2LBxfThfQZHKREr2wkGwzAKBggqhkjO +PQQDAgNJADBGAiEA3RyF7r8Us70mn2qUBWuSqLZqHxfc5Vf+ojENI7jaGOoCIQDd +RFsNUBD5e8rGbBENvySrN9JpRu4s8T6xiqB0bJUwbA== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_HOPERF_Matter_PAA_01_vid_0x1470.der b/credentials/development/paa-root-certs/dcld_mirror_CN_HOPERF_Matter_PAA_01_vid_0x1470.der new file mode 100644 index 00000000000000..db85defaeed865 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_HOPERF_Matter_PAA_01_vid_0x1470.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_HOPERF_Matter_PAA_01_vid_0x1470.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_HOPERF_Matter_PAA_01_vid_0x1470.pem new file mode 100644 index 00000000000000..85255162c07d1b --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_HOPERF_Matter_PAA_01_vid_0x1470.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzjCCAXSgAwIBAgIRAMB+YpaZQeu05JIuF/AMsiYwCgYIKoZIzj0EAwIwNTEd +MBsGA1UEAwwUSE9QRVJGIE1hdHRlciBQQUEgMDExFDASBgorBgEEAYKifAIBDAQx +NDcwMCAXDTIzMDgyNTA1Mjk1N1oYDzIyMjMwNzA4MDYyOTU3WjA1MR0wGwYDVQQD +DBRIT1BFUkYgTWF0dGVyIFBBQSAwMTEUMBIGCisGAQQBgqJ8AgEMBDE0NzAwWTAT +BgcqhkjOPQIBBggqhkjOPQMBBwNCAATVxJPVN3fr7vg9sOX24AO3WyMLWN/O9u5Z +pjjquJNYiPXVziNj1Yq7o1fFT+JJ/V8gEkq3az3CMfTgr5A3DhHko2MwYTAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBTpFg3EF/dBnJUyC782VnGTP/MSIjAOBgNV +HQ8BAf8EBAMCAYYwHwYDVR0jBBgwFoAU6RYNxBf3QZyVMgu/NlZxkz/zEiIwCgYI +KoZIzj0EAwIDSAAwRQIhAMghj3vry4WnuZhyPK8ZGqyFG2aNdKkJCqwy/4SkcHT7 +AiBxxCLcAC5bDcze/6tJcCuLX5vWaVQYw6IVwBwciEo+rw== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_HuaCheng_vid_0x1517.der b/credentials/development/paa-root-certs/dcld_mirror_CN_HuaCheng_vid_0x1517.der new file mode 100644 index 00000000000000..70f88707babe26 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_HuaCheng_vid_0x1517.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_HuaCheng_vid_0x1517.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_HuaCheng_vid_0x1517.pem new file mode 100644 index 00000000000000..46c19d08a6ebaf --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_HuaCheng_vid_0x1517.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBtDCCAVugAwIBAgIQMTnvQ8Ysuuff3Cmdn0VyATAKBggqhkjOPQQDAjApMREw +DwYDVQQDDAhIdWFDaGVuZzEUMBIGCisGAQQBgqJ8AgEMBDE1MTcwIBcNMjQwNjA1 +MDcyMTEwWhgPMjA1NDA1MjkwODIxMTBaMCkxETAPBgNVBAMMCEh1YUNoZW5nMRQw +EgYKKwYBBAGConwCAQwEMTUxNzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABO6k +hF5Vx6fsRTeVPGUif/NVZ5oehv2GaTvLCubOPs5JmoTkFold5kbDRIYHQ9CjKZRR +HnvMX7bnXfceXrgg8vyjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJbG +HZztCtKeBCkmjjgkc8j432nNMA4GA1UdDwEB/wQEAwIBhjAfBgNVHSMEGDAWgBSW +xh2c7QrSngQpJo44JHPI+N9pzTAKBggqhkjOPQQDAgNHADBEAiBzn5SFeh8DbTI8 +73sMeGFpwfgGOyBnhPxHQW/U6al/3QIgJqYZB8V0Kp+IpFP6BGrrqeqXBCvEOsdh +r83FJwSB0E0= +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_IKEA_of_Sweden_Matter_PAA_G1_vid_0x117C.der b/credentials/development/paa-root-certs/dcld_mirror_CN_IKEA_of_Sweden_Matter_PAA_G1_vid_0x117C.der new file mode 100644 index 00000000000000..acfdd885ebfe9f Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_IKEA_of_Sweden_Matter_PAA_G1_vid_0x117C.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_IKEA_of_Sweden_Matter_PAA_G1_vid_0x117C.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_IKEA_of_Sweden_Matter_PAA_G1_vid_0x117C.pem new file mode 100644 index 00000000000000..d275a9a64f8ec0 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_IKEA_of_Sweden_Matter_PAA_G1_vid_0x117C.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB4zCCAYqgAwIBAgIUPqEhcfoGwW/yt/qRsBs+jf7MklswCgYIKoZIzj0EAwIw +PTElMCMGA1UEAwwcSUtFQSBvZiBTd2VkZW4gTWF0dGVyIFBBQSBHMTEUMBIGCisG +AQQBgqJ8AgEMBDExN0MwIBcNMjQwMjE0MTQ1ODMzWhgPMjA5OTAxMjYxNDU4MzJa +MD0xJTAjBgNVBAMMHElLRUEgb2YgU3dlZGVuIE1hdHRlciBQQUEgRzExFDASBgor +BgEEAYKifAIBDAQxMTdDMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE6/PMOZHP +VJqqJbBLzK6Q5+9kjTEnjCnJ6Ba9+/3kCQPRZmiZnXYHB0Z0cUYmenTFXPlGfUCp +blSOtmL48AtPF6NmMGQwEgYDVR0TAQH/BAgwBgEB/wIBATAfBgNVHSMEGDAWgBRr +MYz86Zkg1zKPX0NtXqMyuLddmjAdBgNVHQ4EFgQUazGM/OmZINcyj19DbV6jMri3 +XZowDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA0cAMEQCIETlgc4Us5SE7gPJ +TY9W4D9Fh27DGjtosGP/l99EWrmYAiAXFqbpGtFV1FAx2GxDNa5zYssd4ZpLoewg +rJdUrJOP/g== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Nexus_Matter_PAA_G1_O_Technology_Nexus_SBS_AB_C_SE.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Nexus_Matter_PAA_G1_O_Technology_Nexus_SBS_AB_C_SE.der new file mode 100644 index 00000000000000..cae1616ad4858b Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Nexus_Matter_PAA_G1_O_Technology_Nexus_SBS_AB_C_SE.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Nexus_Matter_PAA_G1_O_Technology_Nexus_SBS_AB_C_SE.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Nexus_Matter_PAA_G1_O_Technology_Nexus_SBS_AB_C_SE.pem new file mode 100644 index 00000000000000..aba32c22d0e4a9 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Nexus_Matter_PAA_G1_O_Technology_Nexus_SBS_AB_C_SE.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIICATCCAaagAwIBAgIQQbk6g1NwvzyrSGCoTI9JgDAKBggqhkjOPQQDAjBNMQsw +CQYDVQQGEwJTRTEgMB4GA1UEChMXVGVjaG5vbG9neSBOZXh1cyBTQlMgQUIxHDAa +BgNVBAMTE05leHVzIE1hdHRlciBQQUEgRzEwIBcNMjMxMjA2MDkxODUyWhgPOTk5 +OTEyMzEyMzU5NTlaME0xCzAJBgNVBAYTAlNFMSAwHgYDVQQKExdUZWNobm9sb2d5 +IE5leHVzIFNCUyBBQjEcMBoGA1UEAxMTTmV4dXMgTWF0dGVyIFBBQSBHMTBZMBMG +ByqGSM49AgEGCCqGSM49AwEHA0IABBvboumawHfPKRmcmdS+qMiSiSb2JdGnbcge +qGGDIfs+iwLVIy3mX8LQNNUftI8MGcfr+wlxZBcbsDeIfRr6oUCjZjBkMBIGA1Ud +EwEB/wQIMAYBAf8CAQEwHQYDVR0OBBYEFKjZp1YgGMB2xrt8vfZ3dEZB3ranMB8G +A1UdIwQYMBaAFKjZp1YgGMB2xrt8vfZ3dEZB3ranMA4GA1UdDwEB/wQEAwIBBjAK +BggqhkjOPQQDAgNJADBGAiEA58S/WXdqoF5E23LJ4B00fZNEZY1NumThNsDV18Td +YCkCIQC8Rt3z9E1Gb6aa6/l6tYCTHjuJSTLXU1fU06tYgXuFVw== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Quectel_Matter_CA_PAA_vid_0x1410.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Quectel_Matter_CA_PAA_vid_0x1410.der new file mode 100644 index 00000000000000..c328fa914b5514 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Quectel_Matter_CA_PAA_vid_0x1410.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Quectel_Matter_CA_PAA_vid_0x1410.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Quectel_Matter_CA_PAA_vid_0x1410.pem new file mode 100644 index 00000000000000..9d55c08f1fa355 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Quectel_Matter_CA_PAA_vid_0x1410.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB0DCCAXagAwIBAgIRAIEvACmo2CmWcJt7n1iIlgUwCgYIKoZIzj0EAwIwNjEe +MBwGA1UEAwwVUXVlY3RlbCBNYXR0ZXIgQ0EgUEFBMRQwEgYKKwYBBAGConwCAQwE +MTQxMDAgFw0yMzA3MDMwMjQyMDlaGA85OTk5MDcwMzAzNDIwOVowNjEeMBwGA1UE +AwwVUXVlY3RlbCBNYXR0ZXIgQ0EgUEFBMRQwEgYKKwYBBAGConwCAQwEMTQxMDBZ +MBMGByqGSM49AgEGCCqGSM49AwEHA0IABHbK+6EZuOMXSfvxUMciJk195OMMkqqo +ni2yuhqViOOoUbIrYORv3KUOEGEQXv90jBNztsY6GqITxulM0rQnzr6jYzBhMA8G +A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFACMIPa55crFKDvbu/C8KWu4f4BTMA4G +A1UdDwEB/wQEAwIBhjAfBgNVHSMEGDAWgBQAjCD2ueXKxSg727vwvClruH+AUzAK +BggqhkjOPQQDAgNIADBFAiEAi5IdUgcMX656APT93NrxihH6nHtC4Xq6xm1ok5Jb +sI0CIF/e32TmBhYfaJGuy3aTt3uf64/u7dwrtyJJdinAAAvT +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Safemo_Matter_PAA_vid_0x1506.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Safemo_Matter_PAA_vid_0x1506.der new file mode 100644 index 00000000000000..aa0fee19220bf6 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Safemo_Matter_PAA_vid_0x1506.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Safemo_Matter_PAA_vid_0x1506.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Safemo_Matter_PAA_vid_0x1506.pem new file mode 100644 index 00000000000000..74cf5e689e0856 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Safemo_Matter_PAA_vid_0x1506.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIByDCCAW6gAwIBAgIRAJbGQ0wgEtKWe2yXGITJcggwCgYIKoZIzj0EAwIwMjEa +MBgGA1UEAwwRU2FmZW1vIE1hdHRlciBQQUExFDASBgorBgEEAYKifAIBDAQxNTA2 +MCAXDTIzMTIxOTAyNTExNVoYDzk5OTkxMjMxMjM1OTU5WjAyMRowGAYDVQQDDBFT +YWZlbW8gTWF0dGVyIFBBQTEUMBIGCisGAQQBgqJ8AgEMBDE1MDYwWTATBgcqhkjO +PQIBBggqhkjOPQMBBwNCAASnyGSMLdXvtFpLCf3ER4b2cWnzsDIuGDqV5qdOqwHV +MMgOOMf3CIIG1eIapDIIynEGH814Kgo2MwmACe3Sl7mJo2MwYTAPBgNVHRMBAf8E +BTADAQH/MB0GA1UdDgQWBBQrACL5tHEfXSTZbQ8Dc6oJDqXbkzAOBgNVHQ8BAf8E +BAMCAYYwHwYDVR0jBBgwFoAUKwAi+bRxH10k2W0PA3OqCQ6l25MwCgYIKoZIzj0E +AwIDSAAwRQIhAO4k9enw9QkBsaNJiqaYsq4GOXCNY5KwEHsijJ/R72dtAiAqLfFC +QLytRarca/d8H1ebYil3mTULKIw+T9SdF2DTtQ== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Schneider_Electric_Matter_PAA_01_vid_0x105E.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Schneider_Electric_Matter_PAA_01_vid_0x105E.der new file mode 100644 index 00000000000000..a4fb97ac768bd0 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Schneider_Electric_Matter_PAA_01_vid_0x105E.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Schneider_Electric_Matter_PAA_01_vid_0x105E.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Schneider_Electric_Matter_PAA_01_vid_0x105E.pem new file mode 100644 index 00000000000000..0ff7d45e7e6b66 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Schneider_Electric_Matter_PAA_01_vid_0x105E.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB6jCCAY+gAwIBAgIUTLcD1z2L5rjjLDgXGe9eaRjDJbIwCgYIKoZIzj0EAwIw +QTEpMCcGA1UEAwwgU2NobmVpZGVyIEVsZWN0cmljIE1hdHRlciBQQUEgMDExFDAS +BgorBgEEAYKifAIBDAQxMDVFMCAXDTIzMDUzMDA4NTkzNVoYDzk5OTkxMjMxMjM1 +OTU5WjBBMSkwJwYDVQQDDCBTY2huZWlkZXIgRWxlY3RyaWMgTWF0dGVyIFBBQSAw +MTEUMBIGCisGAQQBgqJ8AgEMBDEwNUUwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC +AASeiLYu4iC/FuzAZky9ZRnekYyoAQp3mFJlvSk45uOzShg0H3atpNOjHnLJsT3c +y33TIL8d2QECHk3lxh32KQ3Uo2MwYTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQY +MBaAFKrUcaKhFhHJQSjxqzXLwmy0pksAMB0GA1UdDgQWBBSq1HGioRYRyUEo8as1 +y8JstKZLADAOBgNVHQ8BAf8EBAMCAYYwCgYIKoZIzj0EAwIDSQAwRgIhAJFw9Pzr +wPbnxoI+kmjiyVJWTbbEdEj851UVqUQzQyyzAiEA39kgmOdpo8i+IQK0JeybWT1O +y5R/tH3fkBE1UmdU9vs= +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Siterwell_Matter_PAA_vid_0x1280.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Siterwell_Matter_PAA_vid_0x1280.der new file mode 100644 index 00000000000000..3bef6e3cd241ed Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Siterwell_Matter_PAA_vid_0x1280.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Siterwell_Matter_PAA_vid_0x1280.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Siterwell_Matter_PAA_vid_0x1280.pem new file mode 100644 index 00000000000000..058ad61c6bbd4e --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Siterwell_Matter_PAA_vid_0x1280.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBrDCCAVKgAwIBAgIQRiyCdXmivf3OlrNzD0ppxzAKBggqhkjOPQQDAjA1MR0w +GwYDVQQDDBRTaXRlcndlbGwgTWF0dGVyIFBBQTEUMBIGCisGAQQBgqJ8AgEMBDEy +ODAwIBcNMjMwNzMxMDUxOTExWhgPMjA3MzA3MzEwNjE4NThaMDUxHTAbBgNVBAMM +FFNpdGVyd2VsbCBNYXR0ZXIgUEFBMRQwEgYKKwYBBAGConwCAQwEMTI4MDBZMBMG +ByqGSM49AgEGCCqGSM49AwEHA0IABKqK8wz3+8y4v2tI4y5yLxS7MgELWsbOD+7M +BnwC5bnvMmep7k1J/Izj+w5csov3X6DXfnM/2pAWdkW5zNEdOjmjQjBAMA8GA1Ud +EwEB/wQFMAMBAf8wHQYDVR0OBBYEFFRB4Wuy7Mz+27DfvgBZeJfvUQpCMA4GA1Ud +DwEB/wQEAwIBhjAKBggqhkjOPQQDAgNIADBFAiBDG8NgmpCao831XgOF2Z3O68Xi +Rfjt/aIMJP75T7aZAwIhAIPnZzUVnXzqjSwvwjAs7NoN8GFHR2IMtTPX/eCfQ9Mb +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Snowball_Matter_PAA_01.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Snowball_Matter_PAA_01.der new file mode 100644 index 00000000000000..1918a5ab7a88a6 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Snowball_Matter_PAA_01.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Snowball_Matter_PAA_01.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Snowball_Matter_PAA_01.pem new file mode 100644 index 00000000000000..a16459e91393b3 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Snowball_Matter_PAA_01.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBpjCCAUygAwIBAgIRALcJaooAL54UjCdg4g1WTlkwCgYIKoZIzj0EAwIwITEf +MB0GA1UEAwwWU25vd2JhbGwgTWF0dGVyIFBBQSAwMTAgFw0yMzA1MjYwMjQ2NDZa +GA85OTk5MTIzMTIzNTk1OVowITEfMB0GA1UEAwwWU25vd2JhbGwgTWF0dGVyIFBB +QSAwMTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABIg+JlpiMQ4B2XmkKsdifmVg +VTUyynb14BHfL+QYMtJOUh9OD+gncUsI/kUMpsZIsfQZMvmjVcAhFyCyofgXAR+j +YzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFPMKfvfKk0OqvqSAG79FSE/+ ++B5lMA4GA1UdDwEB/wQEAwIBhjAfBgNVHSMEGDAWgBTzCn73ypNDqr6kgBu/RUhP +/vgeZTAKBggqhkjOPQQDAgNIADBFAiBIqFNj7y0/uczzcen/QRBBtaCEx95taH/Y +/L6AGycY3AIhAJsGJzv3Dp79e89XvqjUIpZ6Gc26YYBjIslm1RiPJqOh +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_SwitchBot_Matter_PAA_vid_0x1397.der b/credentials/development/paa-root-certs/dcld_mirror_CN_SwitchBot_Matter_PAA_vid_0x1397.der new file mode 100644 index 00000000000000..c790f5f8275d0b Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_SwitchBot_Matter_PAA_vid_0x1397.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_SwitchBot_Matter_PAA_vid_0x1397.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_SwitchBot_Matter_PAA_vid_0x1397.pem new file mode 100644 index 00000000000000..3357104a819302 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_SwitchBot_Matter_PAA_vid_0x1397.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBrTCCAVOgAwIBAgIRAKH/1ohrnkBd4iGtRVxQypEwCgYIKoZIzj0EAwIwNTEd +MBsGA1UEAwwUU3dpdGNoQm90IE1hdHRlciBQQUExFDASBgorBgEEAYKifAIBDAQx +Mzk3MCAXDTI0MDUyMDA2NTM1NloYDzk5OTkxMjMxMjM1OTU5WjA1MR0wGwYDVQQD +DBRTd2l0Y2hCb3QgTWF0dGVyIFBBQTEUMBIGCisGAQQBgqJ8AgEMBDEzOTcwWTAT +BgcqhkjOPQIBBggqhkjOPQMBBwNCAASEiZlGTnuCQv6nMESGdy6k8Mmfjx594NlF +6LbfNAy+7lzF9kwWHNe8LJ8tfy0K2s/lhj6nE5+lGJDiyx6J6GOUo0IwQDAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBTDlqbmlIzEa0Kigk0qb2lHl+pgBDAOBgNV +HQ8BAf8EBAMCAYYwCgYIKoZIzj0EAwIDSAAwRQIhAIA5Bmac8qsY0Nn0As13JtAS +NiTo10DyhJgcH4JTAkHmAiBvDxfGuxxmPcBd3Z32m+vWvRJWdRdAxeUWOThq/VEc +Gw== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Tuya_Global_Matter_PAA.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Tuya_Global_Matter_PAA.der new file mode 100644 index 00000000000000..5fbe23e150fbe5 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_Tuya_Global_Matter_PAA.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Tuya_Global_Matter_PAA.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Tuya_Global_Matter_PAA.pem new file mode 100644 index 00000000000000..c7acc15eff6d6e --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Tuya_Global_Matter_PAA.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBqTCCAU+gAwIBAgIRAjag4Z9E4rs66DU81lWM2BowCgYIKoZIzj0EAwIwITEf +MB0GA1UEAwwWVHV5YSBHbG9iYWwgTWF0dGVyIFBBQTAgFw0yMzA1MTEwMzM3NTJa +GA85OTk5MTIzMTIzNTk1OVowITEfMB0GA1UEAwwWVHV5YSBHbG9iYWwgTWF0dGVy +IFBBQTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABH4CeKD2gYwer2ruMLHlaHHQ +rAOojboW2PVJgF1yNaoWJX7kJpMvL3l2g95Ia687IpmYCbtoH6Q4hZwwaSICO/Gj +ZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwHwYDVR0jBBgwFoAUhLmLZqwa/Za2RQ8j +07uWTU6KnGYwHQYDVR0OBBYEFIS5i2asGv2WtkUPI9O7lk1OipxmMA4GA1UdDwEB +/wQEAwIBBjAKBggqhkjOPQQDAgNIADBFAiEA/b0F0/4AiOXOexodWOFMjHDTc3Wu +IyZPa6pbKDgROdsCIGBPa6+9WufbJfEDqMG6APR6y4UL6EJ38aQ0nzfvGL7X +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_U-tec_Group_Matter_PAA_vid_0x147F.der b/credentials/development/paa-root-certs/dcld_mirror_CN_U-tec_Group_Matter_PAA_vid_0x147F.der new file mode 100644 index 00000000000000..ea374038f5f675 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_U-tec_Group_Matter_PAA_vid_0x147F.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_U-tec_Group_Matter_PAA_vid_0x147F.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_U-tec_Group_Matter_PAA_vid_0x147F.pem new file mode 100644 index 00000000000000..2b9a9f28045d8a --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_U-tec_Group_Matter_PAA_vid_0x147F.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB0TCCAXegAwIBAgIQcW2ozBN3DXDRxu5WB+7pQDAKBggqhkjOPQQDAjA3MR8w +HQYDVQQDDBZVLXRlYyBHcm91cCBNYXR0ZXIgUEFBMRQwEgYKKwYBBAGConwCAQwE +MTQ3RjAgFw0yMzA5MjgwODIwMjVaGA85OTk5MTIzMTIzNTk1OVowNzEfMB0GA1UE +AwwWVS10ZWMgR3JvdXAgTWF0dGVyIFBBQTEUMBIGCisGAQQBgqJ8AgEMBDE0N0Yw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQwlTnGXMTv/ti+2RiWW+jo5YAnQZCQ +O5YRB/H2CsJxaPGd8vMO+dkAojDGZ75WeX9i6BANsumrTVPxQEMEHF6Oo2MwYTAP +BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSd4k9reLK0iTyCYxhrD2lOaLdwQDAO +BgNVHQ8BAf8EBAMCAYYwHwYDVR0jBBgwFoAUneJPa3iytIk8gmMYaw9pTmi3cEAw +CgYIKoZIzj0EAwIDSAAwRQIgeXVod4h2ZTejsAUFkqLHqhJoRl+6SMAIdx30vb3J +oAICIQCBsHNxeUOBR5Wr1mAislT44BDbwxg+1ImdAmcmicK/Qw== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_heiman_Matter_Protocol_PAA_vid_0x120B.der b/credentials/development/paa-root-certs/dcld_mirror_CN_heiman_Matter_Protocol_PAA_vid_0x120B.der new file mode 100644 index 00000000000000..306b4606d06e99 Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_CN_heiman_Matter_Protocol_PAA_vid_0x120B.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_heiman_Matter_Protocol_PAA_vid_0x120B.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_heiman_Matter_Protocol_PAA_vid_0x120B.pem new file mode 100644 index 00000000000000..9a310f1fa5f28d --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_heiman_Matter_Protocol_PAA_vid_0x120B.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB2zCCAYCgAwIBAgIRAPzT02W5Sj7DtbZGJF4Hm9cwCgYIKoZIzj0EAwIwOzEj +MCEGA1UEAwwaaGVpbWFuIE1hdHRlciBQcm90b2NvbCBQQUExFDASBgorBgEEAYKi +fAIBDAQxMjBCMCAXDTIzMDYwNjA1MTcyOFoYDzIyOTcwMzIwMDYxNzI4WjA7MSMw +IQYDVQQDDBpoZWltYW4gTWF0dGVyIFByb3RvY29sIFBBQTEUMBIGCisGAQQBgqJ8 +AgEMBDEyMEIwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAR8ZlgiorZXXfbaRRJr +qfcK8VMnJHVAmn1nx112Z7NAgrib9rBtXdga8llOxxxxHcEw463RFRkNKl3BioIz +V4Xao2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTZElNw6DDRCBGCv5UH +zVBPY1tnTzAOBgNVHQ8BAf8EBAMCAYYwHwYDVR0jBBgwFoAU2RJTcOgw0QgRgr+V +B81QT2NbZ08wCgYIKoZIzj0EAwIDSQAwRgIhAPoAVZ3kzmh3VI2pEDxx/7Gj0raO +9qPmjQ+fiEj+FOFSAiEAvzSukdMbjA26I55CG23E/LAfpzzQFFfJEN+r5G4bWk8= +-----END CERTIFICATE----- \ No newline at end of file diff --git a/credentials/development/paa-root-certs/dcld_mirror_SERIALNUMBER_63709330400004_CN_NXP_Matter_PAA_G2.der b/credentials/development/paa-root-certs/dcld_mirror_SERIALNUMBER_63709330400004_CN_NXP_Matter_PAA_G2.der new file mode 100644 index 00000000000000..660cda4956548c Binary files /dev/null and b/credentials/development/paa-root-certs/dcld_mirror_SERIALNUMBER_63709330400004_CN_NXP_Matter_PAA_G2.der differ diff --git a/credentials/development/paa-root-certs/dcld_mirror_SERIALNUMBER_63709330400004_CN_NXP_Matter_PAA_G2.pem b/credentials/development/paa-root-certs/dcld_mirror_SERIALNUMBER_63709330400004_CN_NXP_Matter_PAA_G2.pem new file mode 100644 index 00000000000000..2a5978727a7756 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_SERIALNUMBER_63709330400004_CN_NXP_Matter_PAA_G2.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB0TCCAXagAwIBAgIQPG2i2IIJe1nGYTjIGE2dRDAKBggqhkjOPQQDAjA1MRow +GAYDVQQDDBFOWFAgTWF0dGVyIFBBQSBHMjEXMBUGA1UEBRMONjM3MDkzMzA0MDAw +MDQwIBcNMjQwMzI1MTIwMDAwWhgPOTk5OTEyMzEyMzU5NTlaMDUxGjAYBgNVBAMM +EU5YUCBNYXR0ZXIgUEFBIEcyMRcwFQYDVQQFEw42MzcwOTMzMDQwMDAwNDBZMBMG +ByqGSM49AgEGCCqGSM49AwEHA0IABFQG9AzXs7Vj4mSfBcAotpFch33eiMtSmSPh +ppZWEcu+536+jhBeMcTqAxQKVxXYWVSVrSO8eAM/qnDav0LKmumjZjBkMBIGA1Ud +EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBREifg5wyJ0 +XTDaZrzD4bI7HzjPCDAfBgNVHSMEGDAWgBREifg5wyJ0XTDaZrzD4bI7HzjPCDAK +BggqhkjOPQQDAgNJADBGAiEA6Y7u2GyMhQ6m01NW7k/mSo1LNOXKZvSHwDYhoyS4 +jNECIQDofYDdYnwlCiGvhO05iTTO91Nfs1ZPBcBpQwWWV19SdA== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/data_model/1.3/clusters/ACL-Cluster.xml b/data_model/1.3/clusters/ACL-Cluster.xml index a193ef2ac3206f..deed8c409337a5 100644 --- a/data_model/1.3/clusters/ACL-Cluster.xml +++ b/data_model/1.3/clusters/ACL-Cluster.xml @@ -169,19 +169,19 @@ Davis, CA 95616, USA - + - + - + diff --git a/data_model/1.3/clusters/AdminCommissioningCluster.xml b/data_model/1.3/clusters/AdminCommissioningCluster.xml index ccbb579134dc00..8e95e46f128db0 100644 --- a/data_model/1.3/clusters/AdminCommissioningCluster.xml +++ b/data_model/1.3/clusters/AdminCommissioningCluster.xml @@ -91,12 +91,12 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/1.3/clusters/AlarmBase.xml b/data_model/1.3/clusters/AlarmBase.xml index fd0ccb5bc19d46..e374dcc382d208 100644 --- a/data_model/1.3/clusters/AlarmBase.xml +++ b/data_model/1.3/clusters/AlarmBase.xml @@ -80,7 +80,7 @@ Davis, CA 95616, USA - + @@ -91,7 +91,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/ApplicationBasic.xml b/data_model/1.3/clusters/ApplicationBasic.xml index ee39b8a421209d..28e47e7800352e 100644 --- a/data_model/1.3/clusters/ApplicationBasic.xml +++ b/data_model/1.3/clusters/ApplicationBasic.xml @@ -92,29 +92,29 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -125,14 +125,14 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/1.3/clusters/ApplicationLauncher.xml b/data_model/1.3/clusters/ApplicationLauncher.xml index 57d6858dd8ce14..27fa528a81e8cf 100644 --- a/data_model/1.3/clusters/ApplicationLauncher.xml +++ b/data_model/1.3/clusters/ApplicationLauncher.xml @@ -103,14 +103,14 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/1.3/clusters/BallastConfiguration.xml b/data_model/1.3/clusters/BallastConfiguration.xml index 0f37d86067e994..9dbf4e61887d76 100644 --- a/data_model/1.3/clusters/BallastConfiguration.xml +++ b/data_model/1.3/clusters/BallastConfiguration.xml @@ -65,7 +65,9 @@ Davis, CA 95616, USA - + + + @@ -116,12 +118,12 @@ Davis, CA 95616, USA - + - + @@ -141,12 +143,12 @@ Davis, CA 95616, USA - + - + @@ -155,7 +157,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/BasicInformationCluster.xml b/data_model/1.3/clusters/BasicInformationCluster.xml index 137e8b70408bf8..69a882a09490d8 100644 --- a/data_model/1.3/clusters/BasicInformationCluster.xml +++ b/data_model/1.3/clusters/BasicInformationCluster.xml @@ -174,100 +174,100 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -276,29 +276,29 @@ Davis, CA 95616, USA - + - + - + - + - + diff --git a/data_model/1.3/clusters/Binding-Cluster.xml b/data_model/1.3/clusters/Binding-Cluster.xml index 444c99b315348d..055725f0b9ee47 100644 --- a/data_model/1.3/clusters/Binding-Cluster.xml +++ b/data_model/1.3/clusters/Binding-Cluster.xml @@ -97,7 +97,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/BooleanState.xml b/data_model/1.3/clusters/BooleanState.xml index 5bb29f53ae0c3e..ddb16e26a1d6ad 100644 --- a/data_model/1.3/clusters/BooleanState.xml +++ b/data_model/1.3/clusters/BooleanState.xml @@ -68,7 +68,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/BooleanStateConfiguration.xml b/data_model/1.3/clusters/BooleanStateConfiguration.xml index 01444d565294b3..719cd9569b5ae2 100644 --- a/data_model/1.3/clusters/BooleanStateConfiguration.xml +++ b/data_model/1.3/clusters/BooleanStateConfiguration.xml @@ -106,7 +106,7 @@ Davis, CA 95616, USA - + @@ -114,7 +114,7 @@ Davis, CA 95616, USA - + @@ -122,7 +122,7 @@ Davis, CA 95616, USA - + @@ -145,7 +145,7 @@ Davis, CA 95616, USA - + @@ -155,7 +155,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/Channel.xml b/data_model/1.3/clusters/Channel.xml index 17144c9032c3e5..6177bfe6a652cc 100644 --- a/data_model/1.3/clusters/Channel.xml +++ b/data_model/1.3/clusters/Channel.xml @@ -307,7 +307,7 @@ Davis, CA 95616, USA - + @@ -315,7 +315,7 @@ Davis, CA 95616, USA - + @@ -366,6 +366,7 @@ Davis, CA 95616, USA + @@ -400,6 +401,7 @@ Davis, CA 95616, USA + @@ -412,6 +414,7 @@ Davis, CA 95616, USA + @@ -437,6 +440,7 @@ Davis, CA 95616, USA + diff --git a/data_model/1.3/clusters/ColorControl.xml b/data_model/1.3/clusters/ColorControl.xml index 456b3ff14cfff9..ebf29e0b51e758 100644 --- a/data_model/1.3/clusters/ColorControl.xml +++ b/data_model/1.3/clusters/ColorControl.xml @@ -74,16 +74,16 @@ Davis, CA 95616, USA - + - + - + @@ -91,7 +91,7 @@ Davis, CA 95616, USA - + @@ -99,7 +99,7 @@ Davis, CA 95616, USA - + @@ -112,7 +112,7 @@ Davis, CA 95616, USA - + @@ -120,7 +120,7 @@ Davis, CA 95616, USA - + @@ -155,7 +155,7 @@ Davis, CA 95616, USA - + @@ -174,7 +174,7 @@ Davis, CA 95616, USA - + @@ -191,110 +191,110 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -319,7 +319,7 @@ Davis, CA 95616, USA - + @@ -334,7 +334,7 @@ Davis, CA 95616, USA - + @@ -349,12 +349,12 @@ Davis, CA 95616, USA - + - + @@ -375,27 +375,27 @@ Davis, CA 95616, USA - + - + - + - + @@ -439,11 +439,11 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/1.3/clusters/ConcentrationMeasurement.xml b/data_model/1.3/clusters/ConcentrationMeasurement.xml index 4b51cffa124321..b622a3560b4ff0 100644 --- a/data_model/1.3/clusters/ConcentrationMeasurement.xml +++ b/data_model/1.3/clusters/ConcentrationMeasurement.xml @@ -62,16 +62,16 @@ Davis, CA 95616, USA - - - - - - - - - - + + + + + + + + + + @@ -181,7 +181,7 @@ Davis, CA 95616, USA - + @@ -189,7 +189,7 @@ Davis, CA 95616, USA - + @@ -197,7 +197,7 @@ Davis, CA 95616, USA - + @@ -205,7 +205,7 @@ Davis, CA 95616, USA - + @@ -213,7 +213,7 @@ Davis, CA 95616, USA - + @@ -221,7 +221,7 @@ Davis, CA 95616, USA - + @@ -229,7 +229,7 @@ Davis, CA 95616, USA - + @@ -244,14 +244,14 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/1.3/clusters/ContentControl.xml b/data_model/1.3/clusters/ContentControl.xml index b2539cf445c289..6848886c43ac02 100644 --- a/data_model/1.3/clusters/ContentControl.xml +++ b/data_model/1.3/clusters/ContentControl.xml @@ -60,7 +60,9 @@ Davis, CA 95616, USA - + + + diff --git a/data_model/1.3/clusters/ContentLauncher.xml b/data_model/1.3/clusters/ContentLauncher.xml index 9a5674efa8eb64..b4d6e7fa26500c 100644 --- a/data_model/1.3/clusters/ContentLauncher.xml +++ b/data_model/1.3/clusters/ContentLauncher.xml @@ -299,7 +299,7 @@ Davis, CA 95616, USA - + @@ -307,7 +307,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/Descriptor-Cluster.xml b/data_model/1.3/clusters/Descriptor-Cluster.xml index 659b2ffaa5ddc0..d648f1c7f1be91 100644 --- a/data_model/1.3/clusters/Descriptor-Cluster.xml +++ b/data_model/1.3/clusters/Descriptor-Cluster.xml @@ -84,20 +84,20 @@ Davis, CA 95616, USA - + - + - + @@ -108,7 +108,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/DeviceEnergyManagement.xml b/data_model/1.3/clusters/DeviceEnergyManagement.xml index f74d7e572550cc..0fe30cc92e5506 100644 --- a/data_model/1.3/clusters/DeviceEnergyManagement.xml +++ b/data_model/1.3/clusters/DeviceEnergyManagement.xml @@ -64,7 +64,9 @@ Davis, CA 95616, USA - + + + @@ -473,6 +475,63 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data_model/1.3/clusters/DiagnosticsEthernet.xml b/data_model/1.3/clusters/DiagnosticsEthernet.xml index dfcd3d11c41f52..fd2bb0341ca06c 100644 --- a/data_model/1.3/clusters/DiagnosticsEthernet.xml +++ b/data_model/1.3/clusters/DiagnosticsEthernet.xml @@ -62,7 +62,9 @@ Davis, CA 95616, USA - + + + @@ -108,57 +110,57 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + diff --git a/data_model/1.3/clusters/DiagnosticsGeneral.xml b/data_model/1.3/clusters/DiagnosticsGeneral.xml index 4da912b03dc3df..ff78100fe3a7d3 100644 --- a/data_model/1.3/clusters/DiagnosticsGeneral.xml +++ b/data_model/1.3/clusters/DiagnosticsGeneral.xml @@ -223,17 +223,17 @@ Davis, CA 95616, USA - + - + - + @@ -310,7 +310,6 @@ Davis, CA 95616, USA - diff --git a/data_model/1.3/clusters/DiagnosticsSoftware.xml b/data_model/1.3/clusters/DiagnosticsSoftware.xml index 7cb3c9ff39ad2f..c7ee8ee842bf02 100644 --- a/data_model/1.3/clusters/DiagnosticsSoftware.xml +++ b/data_model/1.3/clusters/DiagnosticsSoftware.xml @@ -62,7 +62,9 @@ Davis, CA 95616, USA - + + + diff --git a/data_model/1.3/clusters/DiagnosticsThread.xml b/data_model/1.3/clusters/DiagnosticsThread.xml index 120efaddf8c08e..1da3eba21a4e4e 100644 --- a/data_model/1.3/clusters/DiagnosticsThread.xml +++ b/data_model/1.3/clusters/DiagnosticsThread.xml @@ -63,7 +63,9 @@ Davis, CA 95616, USA - + + + @@ -257,38 +259,38 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + @@ -305,356 +307,356 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/data_model/1.3/clusters/DiagnosticsWiFi.xml b/data_model/1.3/clusters/DiagnosticsWiFi.xml index b3951d967dc31f..6ef28ee4cc09e0 100644 --- a/data_model/1.3/clusters/DiagnosticsWiFi.xml +++ b/data_model/1.3/clusters/DiagnosticsWiFi.xml @@ -55,14 +55,16 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + - + - + + + @@ -141,81 +143,81 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/data_model/1.3/clusters/DoorLock.xml b/data_model/1.3/clusters/DoorLock.xml index fcf86f3a95aa24..11b5de565e2afb 100644 --- a/data_model/1.3/clusters/DoorLock.xml +++ b/data_model/1.3/clusters/DoorLock.xml @@ -570,7 +570,7 @@ Davis, CA 95616, USA - + @@ -738,7 +738,7 @@ Davis, CA 95616, USA - + @@ -753,7 +753,7 @@ Davis, CA 95616, USA - + @@ -779,167 +779,167 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -950,7 +950,7 @@ Davis, CA 95616, USA - + @@ -961,7 +961,7 @@ Davis, CA 95616, USA - + @@ -973,7 +973,7 @@ Davis, CA 95616, USA - + @@ -986,7 +986,7 @@ Davis, CA 95616, USA - + @@ -994,12 +994,12 @@ Davis, CA 95616, USA - + - + @@ -1009,21 +1009,21 @@ Davis, CA 95616, USA - + - + - + @@ -1033,7 +1033,7 @@ Davis, CA 95616, USA - + @@ -1043,14 +1043,14 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/1.3/clusters/ElectricalEnergyMeasurement.xml b/data_model/1.3/clusters/ElectricalEnergyMeasurement.xml index f8bbec4c03db95..9a4012eebc5327 100644 --- a/data_model/1.3/clusters/ElectricalEnergyMeasurement.xml +++ b/data_model/1.3/clusters/ElectricalEnergyMeasurement.xml @@ -135,12 +135,12 @@ Davis, CA 95616, USA - + - + @@ -150,7 +150,7 @@ Davis, CA 95616, USA - + @@ -160,7 +160,7 @@ Davis, CA 95616, USA - + @@ -170,7 +170,7 @@ Davis, CA 95616, USA - + @@ -180,7 +180,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/ElectricalPowerMeasurement.xml b/data_model/1.3/clusters/ElectricalPowerMeasurement.xml index cfb8ce9018e73c..3f4e79ccdefcec 100644 --- a/data_model/1.3/clusters/ElectricalPowerMeasurement.xml +++ b/data_model/1.3/clusters/ElectricalPowerMeasurement.xml @@ -170,39 +170,39 @@ Davis, CA 95616, USA - + - + - + - + - + - + @@ -210,7 +210,7 @@ Davis, CA 95616, USA - + @@ -218,13 +218,13 @@ Davis, CA 95616, USA - + - + @@ -232,7 +232,7 @@ Davis, CA 95616, USA - + @@ -240,7 +240,7 @@ Davis, CA 95616, USA - + @@ -248,7 +248,7 @@ Davis, CA 95616, USA - + @@ -256,7 +256,7 @@ Davis, CA 95616, USA - + @@ -264,7 +264,7 @@ Davis, CA 95616, USA - + @@ -273,7 +273,7 @@ Davis, CA 95616, USA - + @@ -282,7 +282,7 @@ Davis, CA 95616, USA - + @@ -290,7 +290,7 @@ Davis, CA 95616, USA - + @@ -298,7 +298,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/EnergyEVSE.xml b/data_model/1.3/clusters/EnergyEVSE.xml index 4b881f5a1135a4..13052281c5157c 100644 --- a/data_model/1.3/clusters/EnergyEVSE.xml +++ b/data_model/1.3/clusters/EnergyEVSE.xml @@ -252,7 +252,7 @@ Davis, CA 95616, USA - + @@ -265,37 +265,37 @@ Davis, CA 95616, USA - + - + - + - + - + - + @@ -303,33 +303,33 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -337,14 +337,14 @@ Davis, CA 95616, USA - + - + @@ -352,14 +352,14 @@ Davis, CA 95616, USA - + - + @@ -367,7 +367,7 @@ Davis, CA 95616, USA - + @@ -375,23 +375,23 @@ Davis, CA 95616, USA - + - + - + - + diff --git a/data_model/1.3/clusters/EnergyPreference.xml b/data_model/1.3/clusters/EnergyPreference.xml index eafb527a868b22..c43161d8dff6f9 100644 --- a/data_model/1.3/clusters/EnergyPreference.xml +++ b/data_model/1.3/clusters/EnergyPreference.xml @@ -62,7 +62,9 @@ Davis, CA 95616, USA - + + + @@ -102,7 +104,7 @@ Davis, CA 95616, USA - + @@ -110,7 +112,7 @@ Davis, CA 95616, USA - + @@ -118,7 +120,7 @@ Davis, CA 95616, USA - + @@ -127,7 +129,7 @@ Davis, CA 95616, USA - + @@ -135,7 +137,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/FanControl.xml b/data_model/1.3/clusters/FanControl.xml index 224f811261f68b..1016b8923ba308 100644 --- a/data_model/1.3/clusters/FanControl.xml +++ b/data_model/1.3/clusters/FanControl.xml @@ -119,36 +119,36 @@ Davis, CA 95616, USA - + - + - + - + - + - + @@ -187,13 +187,13 @@ Davis, CA 95616, USA - + - + @@ -201,13 +201,13 @@ Davis, CA 95616, USA - + - + @@ -218,7 +218,7 @@ Davis, CA 95616, USA - + @@ -226,7 +226,7 @@ Davis, CA 95616, USA - + @@ -234,7 +234,7 @@ Davis, CA 95616, USA - + @@ -242,7 +242,7 @@ Davis, CA 95616, USA - + @@ -250,7 +250,7 @@ Davis, CA 95616, USA - + @@ -258,7 +258,7 @@ Davis, CA 95616, USA - + @@ -266,7 +266,7 @@ Davis, CA 95616, USA - + @@ -274,7 +274,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/FlowMeasurement.xml b/data_model/1.3/clusters/FlowMeasurement.xml index 71178874d57c14..717641eacb84eb 100644 --- a/data_model/1.3/clusters/FlowMeasurement.xml +++ b/data_model/1.3/clusters/FlowMeasurement.xml @@ -70,19 +70,19 @@ Davis, CA 95616, USA - + - + - + diff --git a/data_model/1.3/clusters/GeneralCommissioningCluster.xml b/data_model/1.3/clusters/GeneralCommissioningCluster.xml index e440222780ea02..285bb4455d8f49 100644 --- a/data_model/1.3/clusters/GeneralCommissioningCluster.xml +++ b/data_model/1.3/clusters/GeneralCommissioningCluster.xml @@ -109,7 +109,7 @@ Davis, CA 95616, USA - + @@ -119,12 +119,12 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/1.3/clusters/Group-Key-Management-Cluster.xml b/data_model/1.3/clusters/Group-Key-Management-Cluster.xml index c1819628e34d7b..4e9ae482a064ed 100644 --- a/data_model/1.3/clusters/Group-Key-Management-Cluster.xml +++ b/data_model/1.3/clusters/Group-Key-Management-Cluster.xml @@ -167,7 +167,7 @@ Davis, CA 95616, USA - + @@ -179,12 +179,12 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/1.3/clusters/Groups.xml b/data_model/1.3/clusters/Groups.xml index 1f168e13fad933..6c53c1a602f255 100644 --- a/data_model/1.3/clusters/Groups.xml +++ b/data_model/1.3/clusters/Groups.xml @@ -83,7 +83,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/ICDManagement.xml b/data_model/1.3/clusters/ICDManagement.xml index 512dfd119efef7..b1b478a166ee80 100644 --- a/data_model/1.3/clusters/ICDManagement.xml +++ b/data_model/1.3/clusters/ICDManagement.xml @@ -120,24 +120,24 @@ Davis, CA 95616, USA - + - + - + - + @@ -145,14 +145,14 @@ Davis, CA 95616, USA - + - + @@ -160,7 +160,7 @@ Davis, CA 95616, USA - + @@ -171,7 +171,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/IlluminanceMeasurement.xml b/data_model/1.3/clusters/IlluminanceMeasurement.xml index d3228b845ca058..02aa466de6b8a6 100644 --- a/data_model/1.3/clusters/IlluminanceMeasurement.xml +++ b/data_model/1.3/clusters/IlluminanceMeasurement.xml @@ -83,20 +83,20 @@ Davis, CA 95616, USA - + - + - + @@ -107,7 +107,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/Label-Cluster-FixedLabelCluster.xml b/data_model/1.3/clusters/Label-Cluster-FixedLabelCluster.xml index 98106b6fc33e40..b915e77bb5a01f 100644 --- a/data_model/1.3/clusters/Label-Cluster-FixedLabelCluster.xml +++ b/data_model/1.3/clusters/Label-Cluster-FixedLabelCluster.xml @@ -70,7 +70,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/Label-Cluster-LabelCluster.xml b/data_model/1.3/clusters/Label-Cluster-LabelCluster.xml index 0ca5566f0dc132..43148b6dc9186f 100644 --- a/data_model/1.3/clusters/Label-Cluster-LabelCluster.xml +++ b/data_model/1.3/clusters/Label-Cluster-LabelCluster.xml @@ -80,7 +80,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/Label-Cluster-UserLabelCluster.xml b/data_model/1.3/clusters/Label-Cluster-UserLabelCluster.xml index eba0099ffb59d2..40dac53a4242cd 100644 --- a/data_model/1.3/clusters/Label-Cluster-UserLabelCluster.xml +++ b/data_model/1.3/clusters/Label-Cluster-UserLabelCluster.xml @@ -70,7 +70,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/LaundryDryerControls.xml b/data_model/1.3/clusters/LaundryDryerControls.xml index af4f787c0432b7..d860d2ef9dcf21 100644 --- a/data_model/1.3/clusters/LaundryDryerControls.xml +++ b/data_model/1.3/clusters/LaundryDryerControls.xml @@ -88,7 +88,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/LaundryWasherControls.xml b/data_model/1.3/clusters/LaundryWasherControls.xml index 6c4f4bc0b0c3a5..2718142b74f991 100644 --- a/data_model/1.3/clusters/LaundryWasherControls.xml +++ b/data_model/1.3/clusters/LaundryWasherControls.xml @@ -108,7 +108,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/LevelControl.xml b/data_model/1.3/clusters/LevelControl.xml index fa6cbe397a672a..2753325511ada6 100644 --- a/data_model/1.3/clusters/LevelControl.xml +++ b/data_model/1.3/clusters/LevelControl.xml @@ -68,7 +68,9 @@ Davis, CA 95616, USA - + + + @@ -120,7 +122,7 @@ Davis, CA 95616, USA - + @@ -153,7 +155,7 @@ Davis, CA 95616, USA - + @@ -184,28 +186,28 @@ Davis, CA 95616, USA - + - + - + - + - + diff --git a/data_model/1.3/clusters/LocalizationConfiguration.xml b/data_model/1.3/clusters/LocalizationConfiguration.xml index 66809f545389be..7ddfba8efcc9cb 100644 --- a/data_model/1.3/clusters/LocalizationConfiguration.xml +++ b/data_model/1.3/clusters/LocalizationConfiguration.xml @@ -66,7 +66,7 @@ Davis, CA 95616, USA - + @@ -75,7 +75,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/LocalizationTimeFormat.xml b/data_model/1.3/clusters/LocalizationTimeFormat.xml index db8b809b0341a9..2ede281c7352a9 100644 --- a/data_model/1.3/clusters/LocalizationTimeFormat.xml +++ b/data_model/1.3/clusters/LocalizationTimeFormat.xml @@ -125,12 +125,12 @@ Davis, CA 95616, USA - + - + @@ -138,7 +138,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/LocalizationUnit.xml b/data_model/1.3/clusters/LocalizationUnit.xml index 2c6e1ecbd648e6..0157ebb53b0d39 100644 --- a/data_model/1.3/clusters/LocalizationUnit.xml +++ b/data_model/1.3/clusters/LocalizationUnit.xml @@ -84,7 +84,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/MediaPlayback.xml b/data_model/1.3/clusters/MediaPlayback.xml index 03175277dc12c5..dae60d7a1b2572 100644 --- a/data_model/1.3/clusters/MediaPlayback.xml +++ b/data_model/1.3/clusters/MediaPlayback.xml @@ -223,7 +223,7 @@ Davis, CA 95616, USA - + @@ -231,7 +231,7 @@ Davis, CA 95616, USA - + @@ -239,7 +239,7 @@ Davis, CA 95616, USA - + @@ -254,7 +254,7 @@ Davis, CA 95616, USA - + @@ -262,7 +262,7 @@ Davis, CA 95616, USA - + @@ -270,7 +270,7 @@ Davis, CA 95616, USA - + @@ -279,7 +279,7 @@ Davis, CA 95616, USA - + @@ -287,7 +287,7 @@ Davis, CA 95616, USA - + @@ -296,7 +296,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/MicrowaveOvenControl.xml b/data_model/1.3/clusters/MicrowaveOvenControl.xml index ecc9d23b143d4b..5c92c309d6de00 100644 --- a/data_model/1.3/clusters/MicrowaveOvenControl.xml +++ b/data_model/1.3/clusters/MicrowaveOvenControl.xml @@ -89,7 +89,7 @@ Davis, CA 95616, USA - + @@ -102,7 +102,7 @@ Davis, CA 95616, USA - + @@ -110,7 +110,7 @@ Davis, CA 95616, USA - + @@ -118,7 +118,7 @@ Davis, CA 95616, USA - + @@ -127,7 +127,7 @@ Davis, CA 95616, USA - + @@ -148,7 +148,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/ModeBase.xml b/data_model/1.3/clusters/ModeBase.xml index dcd6cf1c448028..0fcc581d07aaf1 100644 --- a/data_model/1.3/clusters/ModeBase.xml +++ b/data_model/1.3/clusters/ModeBase.xml @@ -99,25 +99,25 @@ Require at least one standard mode tag. Define reserved ranges for base/derived - + - + - + - + @@ -134,7 +134,6 @@ Require at least one standard mode tag. Define reserved ranges for base/derived - diff --git a/data_model/1.3/clusters/ModeSelect.xml b/data_model/1.3/clusters/ModeSelect.xml index cfdf7adb92761c..76ebf5874af273 100644 --- a/data_model/1.3/clusters/ModeSelect.xml +++ b/data_model/1.3/clusters/ModeSelect.xml @@ -97,38 +97,38 @@ Davis, CA 95616, USA - + - + - + - + - + - + diff --git a/data_model/1.3/clusters/Mode_DeviceEnergyManagement.xml b/data_model/1.3/clusters/Mode_DeviceEnergyManagement.xml index e167e8649650ba..ff849a081ff573 100644 --- a/data_model/1.3/clusters/Mode_DeviceEnergyManagement.xml +++ b/data_model/1.3/clusters/Mode_DeviceEnergyManagement.xml @@ -62,7 +62,9 @@ Davis, CA 95616, USA - + + + diff --git a/data_model/1.3/clusters/NetworkCommissioningCluster.xml b/data_model/1.3/clusters/NetworkCommissioningCluster.xml index 855947e5dda349..fdd404312f446d 100644 --- a/data_model/1.3/clusters/NetworkCommissioningCluster.xml +++ b/data_model/1.3/clusters/NetworkCommissioningCluster.xml @@ -161,13 +161,13 @@ Davis, CA 95616, USA - + - + - + @@ -262,7 +262,7 @@ Davis, CA 95616, USA - + @@ -274,7 +274,7 @@ Davis, CA 95616, USA - + @@ -285,7 +285,7 @@ Davis, CA 95616, USA - + @@ -296,29 +296,29 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -326,14 +326,14 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/1.3/clusters/OTARequestor.xml b/data_model/1.3/clusters/OTARequestor.xml index f6a5ff0365abed..3a562c9f18a046 100644 --- a/data_model/1.3/clusters/OTARequestor.xml +++ b/data_model/1.3/clusters/OTARequestor.xml @@ -149,7 +149,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/OccupancySensing.xml b/data_model/1.3/clusters/OccupancySensing.xml index 48756121d24769..b576e91078e663 100644 --- a/data_model/1.3/clusters/OccupancySensing.xml +++ b/data_model/1.3/clusters/OccupancySensing.xml @@ -103,7 +103,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/OnOff.xml b/data_model/1.3/clusters/OnOff.xml index 9366985e5ce35e..1072b96d56a243 100644 --- a/data_model/1.3/clusters/OnOff.xml +++ b/data_model/1.3/clusters/OnOff.xml @@ -145,7 +145,7 @@ Davis, CA 95616, USA - + @@ -168,7 +168,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/OperationalCredentialCluster.xml b/data_model/1.3/clusters/OperationalCredentialCluster.xml index 2aa070f96b2573..b3811db4a5774a 100644 --- a/data_model/1.3/clusters/OperationalCredentialCluster.xml +++ b/data_model/1.3/clusters/OperationalCredentialCluster.xml @@ -155,26 +155,26 @@ Davis, CA 95616, USA - + - + - + - + @@ -183,7 +183,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/OperationalState.xml b/data_model/1.3/clusters/OperationalState.xml index 3648a8c81ec8f4..44567fa726f6fd 100644 --- a/data_model/1.3/clusters/OperationalState.xml +++ b/data_model/1.3/clusters/OperationalState.xml @@ -114,19 +114,19 @@ Davis, CA 95616, USA - + - + - + @@ -179,7 +179,6 @@ Davis, CA 95616, USA - diff --git a/data_model/1.3/clusters/PowerSourceCluster.xml b/data_model/1.3/clusters/PowerSourceCluster.xml index 1c01cc548bfdee..4596880e32b938 100644 --- a/data_model/1.3/clusters/PowerSourceCluster.xml +++ b/data_model/1.3/clusters/PowerSourceCluster.xml @@ -556,32 +556,32 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -589,21 +589,21 @@ Davis, CA 95616, USA - + - + - + @@ -624,14 +624,14 @@ Davis, CA 95616, USA - + - + @@ -639,7 +639,7 @@ Davis, CA 95616, USA - + @@ -659,7 +659,7 @@ Davis, CA 95616, USA - + @@ -680,7 +680,7 @@ Davis, CA 95616, USA - + @@ -688,7 +688,7 @@ Davis, CA 95616, USA - + @@ -696,7 +696,7 @@ Davis, CA 95616, USA - + @@ -704,7 +704,7 @@ Davis, CA 95616, USA - + @@ -712,7 +712,7 @@ Davis, CA 95616, USA - + @@ -720,7 +720,7 @@ Davis, CA 95616, USA - + @@ -730,7 +730,7 @@ Davis, CA 95616, USA - + @@ -744,7 +744,7 @@ Davis, CA 95616, USA - + @@ -757,7 +757,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/PowerSourceConfigurationCluster.xml b/data_model/1.3/clusters/PowerSourceConfigurationCluster.xml index 6a47ce1b54cdbd..5348f6f0b091b6 100644 --- a/data_model/1.3/clusters/PowerSourceConfigurationCluster.xml +++ b/data_model/1.3/clusters/PowerSourceConfigurationCluster.xml @@ -67,7 +67,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/PowerTopology.xml b/data_model/1.3/clusters/PowerTopology.xml index 4ebdda614a4aec..b958d03c01aeb1 100644 --- a/data_model/1.3/clusters/PowerTopology.xml +++ b/data_model/1.3/clusters/PowerTopology.xml @@ -83,7 +83,7 @@ Davis, CA 95616, USA - + @@ -92,7 +92,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/PressureMeasurement.xml b/data_model/1.3/clusters/PressureMeasurement.xml index a46e911253941f..bf9b6a9286e381 100644 --- a/data_model/1.3/clusters/PressureMeasurement.xml +++ b/data_model/1.3/clusters/PressureMeasurement.xml @@ -75,19 +75,19 @@ Davis, CA 95616, USA - + - + - + @@ -98,7 +98,7 @@ Davis, CA 95616, USA - + @@ -106,7 +106,7 @@ Davis, CA 95616, USA - + @@ -114,7 +114,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/ProxyConfiguration-Cluster.xml b/data_model/1.3/clusters/ProxyConfiguration-Cluster.xml index 8ad566ec8527b2..c33ed5cd03b841 100644 --- a/data_model/1.3/clusters/ProxyConfiguration-Cluster.xml +++ b/data_model/1.3/clusters/ProxyConfiguration-Cluster.xml @@ -60,7 +60,9 @@ Davis, CA 95616, USA - + + + @@ -82,7 +84,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/ProxyDiscovery-Cluster.xml b/data_model/1.3/clusters/ProxyDiscovery-Cluster.xml index 6fa4a9eb6f3a06..159bdff7333853 100644 --- a/data_model/1.3/clusters/ProxyDiscovery-Cluster.xml +++ b/data_model/1.3/clusters/ProxyDiscovery-Cluster.xml @@ -60,7 +60,9 @@ Davis, CA 95616, USA - + + + diff --git a/data_model/1.3/clusters/PumpConfigurationControl.xml b/data_model/1.3/clusters/PumpConfigurationControl.xml index 79fafe659c95e2..b197f63bb4373f 100644 --- a/data_model/1.3/clusters/PumpConfigurationControl.xml +++ b/data_model/1.3/clusters/PumpConfigurationControl.xml @@ -175,22 +175,22 @@ Davis, CA 95616, USA - + - + - + - + @@ -202,7 +202,7 @@ Davis, CA 95616, USA - + @@ -214,7 +214,7 @@ Davis, CA 95616, USA - + @@ -226,7 +226,7 @@ Davis, CA 95616, USA - + @@ -238,7 +238,7 @@ Davis, CA 95616, USA - + @@ -250,7 +250,7 @@ Davis, CA 95616, USA - + @@ -262,7 +262,7 @@ Davis, CA 95616, USA - + @@ -274,7 +274,7 @@ Davis, CA 95616, USA - + @@ -286,7 +286,7 @@ Davis, CA 95616, USA - + @@ -299,7 +299,7 @@ Davis, CA 95616, USA - + @@ -312,62 +312,62 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + - + - + diff --git a/data_model/1.3/clusters/ResourceMonitoring.xml b/data_model/1.3/clusters/ResourceMonitoring.xml index 6b0e8f3a203ded..09cc479618295f 100644 --- a/data_model/1.3/clusters/ResourceMonitoring.xml +++ b/data_model/1.3/clusters/ResourceMonitoring.xml @@ -62,8 +62,8 @@ Davis, CA 95616, USA - - + + @@ -73,7 +73,7 @@ Davis, CA 95616, USA - + @@ -103,13 +103,13 @@ Davis, CA 95616, USA - + - + @@ -136,7 +136,7 @@ Davis, CA 95616, USA - + @@ -152,13 +152,13 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/1.3/clusters/Scenes.xml b/data_model/1.3/clusters/Scenes.xml index bf68f8528fa159..2bbd2e246a06cc 100644 --- a/data_model/1.3/clusters/Scenes.xml +++ b/data_model/1.3/clusters/Scenes.xml @@ -165,12 +165,12 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/1.3/clusters/SmokeCOAlarm.xml b/data_model/1.3/clusters/SmokeCOAlarm.xml index 25c034ac94082c..4ba9bd2708b476 100644 --- a/data_model/1.3/clusters/SmokeCOAlarm.xml +++ b/data_model/1.3/clusters/SmokeCOAlarm.xml @@ -163,31 +163,31 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -196,12 +196,12 @@ Davis, CA 95616, USA - + - + @@ -226,7 +226,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/Switch.xml b/data_model/1.3/clusters/Switch.xml index c7b607c637c74c..14912208782baa 100644 --- a/data_model/1.3/clusters/Switch.xml +++ b/data_model/1.3/clusters/Switch.xml @@ -95,19 +95,19 @@ Davis, CA 95616, USA - + - + - + diff --git a/data_model/1.3/clusters/TemperatureControl.xml b/data_model/1.3/clusters/TemperatureControl.xml index 3f5fa9c00332d6..2f2527ce4ad0fa 100644 --- a/data_model/1.3/clusters/TemperatureControl.xml +++ b/data_model/1.3/clusters/TemperatureControl.xml @@ -86,7 +86,7 @@ Davis, CA 95616, USA - + @@ -94,7 +94,7 @@ Davis, CA 95616, USA - + @@ -102,7 +102,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/TemperatureMeasurement.xml b/data_model/1.3/clusters/TemperatureMeasurement.xml index 176fad6b246a60..0935b18edab675 100644 --- a/data_model/1.3/clusters/TemperatureMeasurement.xml +++ b/data_model/1.3/clusters/TemperatureMeasurement.xml @@ -71,19 +71,19 @@ Davis, CA 95616, USA - + - + - + diff --git a/data_model/1.3/clusters/Thermostat.xml b/data_model/1.3/clusters/Thermostat.xml index 75640c697e0478..66d927c3bc6ad0 100644 --- a/data_model/1.3/clusters/Thermostat.xml +++ b/data_model/1.3/clusters/Thermostat.xml @@ -472,12 +472,12 @@ Davis, CA 95616, USA - + - + @@ -489,7 +489,7 @@ Davis, CA 95616, USA - + @@ -497,7 +497,7 @@ Davis, CA 95616, USA - + @@ -505,7 +505,7 @@ Davis, CA 95616, USA - + @@ -513,7 +513,7 @@ Davis, CA 95616, USA - + @@ -521,7 +521,7 @@ Davis, CA 95616, USA - + @@ -529,7 +529,7 @@ Davis, CA 95616, USA - + @@ -537,13 +537,13 @@ Davis, CA 95616, USA - + - + @@ -553,7 +553,7 @@ Davis, CA 95616, USA - + @@ -561,7 +561,7 @@ Davis, CA 95616, USA - + @@ -569,7 +569,7 @@ Davis, CA 95616, USA - + @@ -580,7 +580,7 @@ Davis, CA 95616, USA - + @@ -591,7 +591,7 @@ Davis, CA 95616, USA - + @@ -599,7 +599,7 @@ Davis, CA 95616, USA - + @@ -607,7 +607,7 @@ Davis, CA 95616, USA - + @@ -615,7 +615,7 @@ Davis, CA 95616, USA - + @@ -623,7 +623,7 @@ Davis, CA 95616, USA - + @@ -631,19 +631,19 @@ Davis, CA 95616, USA - + - + - + @@ -663,7 +663,7 @@ Davis, CA 95616, USA - + @@ -671,33 +671,33 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -713,7 +713,7 @@ Davis, CA 95616, USA - + @@ -722,7 +722,7 @@ Davis, CA 95616, USA - + @@ -730,7 +730,7 @@ Davis, CA 95616, USA - + @@ -738,7 +738,7 @@ Davis, CA 95616, USA - + @@ -746,7 +746,7 @@ Davis, CA 95616, USA - + @@ -757,7 +757,7 @@ Davis, CA 95616, USA - + @@ -768,7 +768,7 @@ Davis, CA 95616, USA - + @@ -779,29 +779,29 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -811,18 +811,18 @@ Davis, CA 95616, USA - + - + - + diff --git a/data_model/1.3/clusters/TimeSync.xml b/data_model/1.3/clusters/TimeSync.xml index 9d4057db8bdb85..a506a647aeb8a3 100644 --- a/data_model/1.3/clusters/TimeSync.xml +++ b/data_model/1.3/clusters/TimeSync.xml @@ -213,7 +213,7 @@ Davis, CA 95616, USA - + @@ -228,14 +228,14 @@ Davis, CA 95616, USA - + - + @@ -244,7 +244,7 @@ Davis, CA 95616, USA - + @@ -253,21 +253,21 @@ Davis, CA 95616, USA - + - + - + @@ -280,7 +280,7 @@ Davis, CA 95616, USA - + @@ -288,7 +288,7 @@ Davis, CA 95616, USA - + @@ -296,7 +296,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/ValidProxies-Cluster.xml b/data_model/1.3/clusters/ValidProxies-Cluster.xml index b9db8e1762647f..c5740c90e52433 100644 --- a/data_model/1.3/clusters/ValidProxies-Cluster.xml +++ b/data_model/1.3/clusters/ValidProxies-Cluster.xml @@ -60,7 +60,9 @@ Davis, CA 95616, USA - + + + @@ -75,7 +77,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/ValveConfigurationControl.xml b/data_model/1.3/clusters/ValveConfigurationControl.xml index b0f2ec91b0fa95..86e511505fd12b 100644 --- a/data_model/1.3/clusters/ValveConfigurationControl.xml +++ b/data_model/1.3/clusters/ValveConfigurationControl.xml @@ -108,55 +108,55 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + @@ -168,7 +168,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/WakeOnLAN.xml b/data_model/1.3/clusters/WakeOnLAN.xml index 4f6e032c084b38..7f5c08bdd624ad 100644 --- a/data_model/1.3/clusters/WakeOnLAN.xml +++ b/data_model/1.3/clusters/WakeOnLAN.xml @@ -68,13 +68,13 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/1.3/clusters/WaterContentMeasurement.xml b/data_model/1.3/clusters/WaterContentMeasurement.xml index 85d44793c93ae4..af11c9cf8d514c 100644 --- a/data_model/1.3/clusters/WaterContentMeasurement.xml +++ b/data_model/1.3/clusters/WaterContentMeasurement.xml @@ -70,19 +70,19 @@ Davis, CA 95616, USA - + - + - + diff --git a/data_model/1.3/clusters/WindowCovering.xml b/data_model/1.3/clusters/WindowCovering.xml index af59da5a9f72de..88d7e3dc512cba 100644 --- a/data_model/1.3/clusters/WindowCovering.xml +++ b/data_model/1.3/clusters/WindowCovering.xml @@ -391,13 +391,13 @@ Davis, CA 95616, USA - + - + @@ -408,7 +408,7 @@ Davis, CA 95616, USA - + @@ -419,7 +419,7 @@ Davis, CA 95616, USA - + @@ -431,7 +431,7 @@ Davis, CA 95616, USA - + @@ -443,27 +443,27 @@ Davis, CA 95616, USA - + - + - + - + @@ -473,7 +473,7 @@ Davis, CA 95616, USA - + @@ -484,13 +484,13 @@ Davis, CA 95616, USA - + - + @@ -500,7 +500,7 @@ Davis, CA 95616, USA - + @@ -510,13 +510,13 @@ Davis, CA 95616, USA - + - + @@ -527,7 +527,7 @@ Davis, CA 95616, USA - + @@ -538,7 +538,7 @@ Davis, CA 95616, USA - + @@ -550,7 +550,7 @@ Davis, CA 95616, USA - + @@ -562,7 +562,7 @@ Davis, CA 95616, USA - + @@ -574,7 +574,7 @@ Davis, CA 95616, USA - + @@ -595,7 +595,7 @@ Davis, CA 95616, USA - + @@ -607,7 +607,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/clusters/cluster_ids.json b/data_model/1.3/clusters/cluster_ids.json index 40a46edd00722e..82a258ee0c6d7f 100644 --- a/data_model/1.3/clusters/cluster_ids.json +++ b/data_model/1.3/clusters/cluster_ids.json @@ -22,7 +22,7 @@ "51": "General Diagnostics", "52": "Software Diagnostics", "53": "Thread Network Diagnostics", - "54": "Wi", + "54": "Wi-Fi Network Diagnostics", "55": "Ethernet Network Diagnostics", "56": "Time Synchronization", "57": "Bridged Device Basic Information", @@ -88,7 +88,7 @@ "1037": "Carbon Dioxide Concentration Measurement", "1043": "Nitrogen Dioxide Concentration Measurement", "1045": "Ozone Concentration Measurement", - "1066": "PM2", + "1066": "PM2.5 Concentration Measurement", "1067": "Formaldehyde Concentration Measurement", "1068": "PM1 Concentration Measurement", "1069": "PM10 Concentration Measurement", diff --git a/data_model/1.3/device_types/AirQualitySensor.xml b/data_model/1.3/device_types/AirQualitySensor.xml index 602781819d1696..bf56eb754f24c6 100644 --- a/data_model/1.3/device_types/AirQualitySensor.xml +++ b/data_model/1.3/device_types/AirQualitySensor.xml @@ -86,7 +86,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/device_types/DimmablePlug-InUnit.xml b/data_model/1.3/device_types/DimmablePlug-InUnit.xml index 4d344bfc9fb89c..65f6b6e1dd2e9c 100644 --- a/data_model/1.3/device_types/DimmablePlug-InUnit.xml +++ b/data_model/1.3/device_types/DimmablePlug-InUnit.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/1.3/device_types/DoorLockController.xml b/data_model/1.3/device_types/DoorLockController.xml index 4d031a37be1eec..64d26eba8d8eeb 100644 --- a/data_model/1.3/device_types/DoorLockController.xml +++ b/data_model/1.3/device_types/DoorLockController.xml @@ -74,10 +74,7 @@ Davis, CA 95616, USA - - - - + diff --git a/data_model/1.3/device_types/OnOffPlug-inUnit.xml b/data_model/1.3/device_types/OnOffPlug-inUnit.xml index 3be1ed0f9eb13d..888f365bed0b83 100644 --- a/data_model/1.3/device_types/OnOffPlug-inUnit.xml +++ b/data_model/1.3/device_types/OnOffPlug-inUnit.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/1.3/device_types/RootNodeDeviceType.xml b/data_model/1.3/device_types/RootNodeDeviceType.xml index c2028f07d91548..0288e8848cb321 100644 --- a/data_model/1.3/device_types/RootNodeDeviceType.xml +++ b/data_model/1.3/device_types/RootNodeDeviceType.xml @@ -124,7 +124,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.3/device_types/Thermostat.xml b/data_model/1.3/device_types/Thermostat.xml index 49ba4b6779f084..62c7060bf03584 100644 --- a/data_model/1.3/device_types/Thermostat.xml +++ b/data_model/1.3/device_types/Thermostat.xml @@ -83,16 +83,10 @@ Davis, CA 95616, USA - - - - + - - - - + diff --git a/data_model/1.3/scraper_version b/data_model/1.3/scraper_version index e8ea05db81420d..c813fe116c9f9e 100644 --- a/data_model/1.3/scraper_version +++ b/data_model/1.3/scraper_version @@ -1 +1 @@ -1.2.4 +1.2.5 diff --git a/data_model/1.3/spec_sha b/data_model/1.3/spec_sha index 274f0d55122714..9166e9f7a4977c 100644 --- a/data_model/1.3/spec_sha +++ b/data_model/1.3/spec_sha @@ -1 +1 @@ -ab9cf4653d40fe9193bbc7fe9febf74c08bf7dfa +6b8d0a46a59d5ec5e2d2662e0b4a0b4810118bd6 diff --git a/data_model/master/clusters/ACL-Cluster.xml b/data_model/master/clusters/ACL-Cluster.xml index 5c4c96a687cb13..2278f7c7920ce4 100644 --- a/data_model/master/clusters/ACL-Cluster.xml +++ b/data_model/master/clusters/ACL-Cluster.xml @@ -57,15 +57,18 @@ Davis, CA 95616, USA --> - - + + - + + + + @@ -80,11 +83,6 @@ Davis, CA 95616, USA - - - - - @@ -106,6 +104,20 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + @@ -164,6 +176,45 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -175,29 +226,40 @@ Davis, CA 95616, USA - + + + - + - + - + - - + + + + + + + + + + + @@ -205,6 +267,27 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + @@ -229,7 +312,9 @@ Davis, CA 95616, USA - + + + @@ -248,5 +333,30 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/master/clusters/AccountLogin.xml b/data_model/master/clusters/AccountLogin.xml index 8a9ed7d9389f40..6205fb6cb73261 100644 --- a/data_model/master/clusters/AccountLogin.xml +++ b/data_model/master/clusters/AccountLogin.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/AdminCommissioningCluster.xml b/data_model/master/clusters/AdminCommissioningCluster.xml index ccbb579134dc00..77a8862b2eedc7 100644 --- a/data_model/master/clusters/AdminCommissioningCluster.xml +++ b/data_model/master/clusters/AdminCommissioningCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -91,12 +91,12 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/master/clusters/AirQuality.xml b/data_model/master/clusters/AirQuality.xml index c05717863c5ff4..69387d451a38c0 100644 --- a/data_model/master/clusters/AirQuality.xml +++ b/data_model/master/clusters/AirQuality.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/AlarmBase.xml b/data_model/master/clusters/AlarmBase.xml index fd0ccb5bc19d46..e374dcc382d208 100644 --- a/data_model/master/clusters/AlarmBase.xml +++ b/data_model/master/clusters/AlarmBase.xml @@ -80,7 +80,7 @@ Davis, CA 95616, USA - + @@ -91,7 +91,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/ApplicationBasic.xml b/data_model/master/clusters/ApplicationBasic.xml index ee39b8a421209d..93ffeeb958ad3a 100644 --- a/data_model/master/clusters/ApplicationBasic.xml +++ b/data_model/master/clusters/ApplicationBasic.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -92,29 +92,29 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -125,14 +125,14 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/master/clusters/ApplicationLauncher.xml b/data_model/master/clusters/ApplicationLauncher.xml index 57d6858dd8ce14..51fcde769007e9 100644 --- a/data_model/master/clusters/ApplicationLauncher.xml +++ b/data_model/master/clusters/ApplicationLauncher.xml @@ -57,9 +57,10 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + - + + @@ -75,10 +76,19 @@ Davis, CA 95616, USA - + - + + + + + + + + + + @@ -103,14 +113,14 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/master/clusters/AudioOutput.xml b/data_model/master/clusters/AudioOutput.xml index 27bb5a20bb7952..9972a8a87e7a6f 100644 --- a/data_model/master/clusters/AudioOutput.xml +++ b/data_model/master/clusters/AudioOutput.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/BallastConfiguration.xml b/data_model/master/clusters/BallastConfiguration.xml index 0f37d86067e994..9dbf4e61887d76 100644 --- a/data_model/master/clusters/BallastConfiguration.xml +++ b/data_model/master/clusters/BallastConfiguration.xml @@ -65,7 +65,9 @@ Davis, CA 95616, USA - + + + @@ -116,12 +118,12 @@ Davis, CA 95616, USA - + - + @@ -141,12 +143,12 @@ Davis, CA 95616, USA - + - + @@ -155,7 +157,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/BasicInformationCluster.xml b/data_model/master/clusters/BasicInformationCluster.xml index 428c683a0ea803..168a0353761159 100644 --- a/data_model/master/clusters/BasicInformationCluster.xml +++ b/data_model/master/clusters/BasicInformationCluster.xml @@ -54,25 +54,18 @@ This notice and disclaimer must be included on all copies of this document. Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA - -:xrefstyle: basic --> - + - + - - - - - @@ -182,100 +175,100 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -284,46 +277,38 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - - - - - - - - @@ -350,15 +335,5 @@ Davis, CA 95616, USA - - - - - - - - - - \ No newline at end of file diff --git a/data_model/master/clusters/Binding-Cluster.xml b/data_model/master/clusters/Binding-Cluster.xml index 444c99b315348d..72fc1eb6b3282d 100644 --- a/data_model/master/clusters/Binding-Cluster.xml +++ b/data_model/master/clusters/Binding-Cluster.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -97,7 +97,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/BooleanState.xml b/data_model/master/clusters/BooleanState.xml index 5bb29f53ae0c3e..9754a7af60b57a 100644 --- a/data_model/master/clusters/BooleanState.xml +++ b/data_model/master/clusters/BooleanState.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -68,7 +68,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/BooleanStateConfiguration.xml b/data_model/master/clusters/BooleanStateConfiguration.xml index 01444d565294b3..d4ae791ad7649f 100644 --- a/data_model/master/clusters/BooleanStateConfiguration.xml +++ b/data_model/master/clusters/BooleanStateConfiguration.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -106,7 +106,7 @@ Davis, CA 95616, USA - + @@ -114,7 +114,7 @@ Davis, CA 95616, USA - + @@ -122,7 +122,7 @@ Davis, CA 95616, USA - + @@ -145,7 +145,7 @@ Davis, CA 95616, USA - + @@ -155,7 +155,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/Channel.xml b/data_model/master/clusters/Channel.xml index 17144c9032c3e5..a2edf151cb6001 100644 --- a/data_model/master/clusters/Channel.xml +++ b/data_model/master/clusters/Channel.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -307,7 +307,7 @@ Davis, CA 95616, USA - + @@ -315,7 +315,7 @@ Davis, CA 95616, USA - + @@ -366,6 +366,7 @@ Davis, CA 95616, USA + @@ -400,6 +401,7 @@ Davis, CA 95616, USA + @@ -412,6 +414,7 @@ Davis, CA 95616, USA + @@ -437,6 +440,7 @@ Davis, CA 95616, USA + diff --git a/data_model/master/clusters/ColorControl.xml b/data_model/master/clusters/ColorControl.xml index 90d999fa20b4ac..6901b6ee4130c6 100644 --- a/data_model/master/clusters/ColorControl.xml +++ b/data_model/master/clusters/ColorControl.xml @@ -65,7 +65,8 @@ Davis, CA 95616, USA - + @@ -111,19 +112,10 @@ Davis, CA 95616, USA - + - - - - - - - - - - + @@ -252,7 +244,7 @@ Davis, CA 95616, USA - + @@ -260,7 +252,7 @@ Davis, CA 95616, USA - + @@ -268,13 +260,13 @@ Davis, CA 95616, USA - + - + @@ -282,7 +274,7 @@ Davis, CA 95616, USA - + @@ -299,7 +291,7 @@ Davis, CA 95616, USA - + @@ -307,7 +299,7 @@ Davis, CA 95616, USA - + @@ -317,13 +309,13 @@ Davis, CA 95616, USA - + - + @@ -337,7 +329,7 @@ Davis, CA 95616, USA - + @@ -351,7 +343,7 @@ Davis, CA 95616, USA - + @@ -364,7 +356,7 @@ Davis, CA 95616, USA - + @@ -378,7 +370,7 @@ Davis, CA 95616, USA - + @@ -392,7 +384,7 @@ Davis, CA 95616, USA - + @@ -405,7 +397,7 @@ Davis, CA 95616, USA - + @@ -419,7 +411,7 @@ Davis, CA 95616, USA - + @@ -433,7 +425,7 @@ Davis, CA 95616, USA - + @@ -446,7 +438,7 @@ Davis, CA 95616, USA - + @@ -460,7 +452,7 @@ Davis, CA 95616, USA - + @@ -474,7 +466,7 @@ Davis, CA 95616, USA - + @@ -487,7 +479,7 @@ Davis, CA 95616, USA - + @@ -501,7 +493,7 @@ Davis, CA 95616, USA - + @@ -515,7 +507,7 @@ Davis, CA 95616, USA - + @@ -528,7 +520,7 @@ Davis, CA 95616, USA - + @@ -542,7 +534,7 @@ Davis, CA 95616, USA - + @@ -556,7 +548,7 @@ Davis, CA 95616, USA - + @@ -589,7 +581,7 @@ Davis, CA 95616, USA - + @@ -604,7 +596,7 @@ Davis, CA 95616, USA - + @@ -619,24 +611,24 @@ Davis, CA 95616, USA - + - + - + - + @@ -644,7 +636,7 @@ Davis, CA 95616, USA - + @@ -652,7 +644,7 @@ Davis, CA 95616, USA - + @@ -696,11 +688,11 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/master/clusters/CommissionerControlCluster.xml b/data_model/master/clusters/CommissionerControlCluster.xml index eaaa3c51ec4a30..9cda8f414c89da 100644 --- a/data_model/master/clusters/CommissionerControlCluster.xml +++ b/data_model/master/clusters/CommissionerControlCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/ConcentrationMeasurement.xml b/data_model/master/clusters/ConcentrationMeasurement.xml index 4b51cffa124321..b622a3560b4ff0 100644 --- a/data_model/master/clusters/ConcentrationMeasurement.xml +++ b/data_model/master/clusters/ConcentrationMeasurement.xml @@ -62,16 +62,16 @@ Davis, CA 95616, USA - - - - - - - - - - + + + + + + + + + + @@ -181,7 +181,7 @@ Davis, CA 95616, USA - + @@ -189,7 +189,7 @@ Davis, CA 95616, USA - + @@ -197,7 +197,7 @@ Davis, CA 95616, USA - + @@ -205,7 +205,7 @@ Davis, CA 95616, USA - + @@ -213,7 +213,7 @@ Davis, CA 95616, USA - + @@ -221,7 +221,7 @@ Davis, CA 95616, USA - + @@ -229,7 +229,7 @@ Davis, CA 95616, USA - + @@ -244,14 +244,14 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/master/clusters/ContentAppObserver.xml b/data_model/master/clusters/ContentAppObserver.xml index d6808baf982215..7ffe0b11d04377 100644 --- a/data_model/master/clusters/ContentAppObserver.xml +++ b/data_model/master/clusters/ContentAppObserver.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/ContentControl.xml b/data_model/master/clusters/ContentControl.xml index b2539cf445c289..6b72a298ebeead 100644 --- a/data_model/master/clusters/ContentControl.xml +++ b/data_model/master/clusters/ContentControl.xml @@ -57,10 +57,12 @@ Davis, CA 95616, USA --> - + - + + + diff --git a/data_model/master/clusters/ContentLauncher.xml b/data_model/master/clusters/ContentLauncher.xml index 9a5674efa8eb64..5470a14ce1da64 100644 --- a/data_model/master/clusters/ContentLauncher.xml +++ b/data_model/master/clusters/ContentLauncher.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -299,7 +299,7 @@ Davis, CA 95616, USA - + @@ -307,7 +307,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/DemandResponseLoadControl.xml b/data_model/master/clusters/DemandResponseLoadControl.xml index c20a7c3b7f013f..1acd1ea26c6088 100644 --- a/data_model/master/clusters/DemandResponseLoadControl.xml +++ b/data_model/master/clusters/DemandResponseLoadControl.xml @@ -311,51 +311,51 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + diff --git a/data_model/master/clusters/Descriptor-Cluster.xml b/data_model/master/clusters/Descriptor-Cluster.xml index 94d262473d4c9c..fabc3a2a16c658 100644 --- a/data_model/master/clusters/Descriptor-Cluster.xml +++ b/data_model/master/clusters/Descriptor-Cluster.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -85,20 +85,20 @@ Davis, CA 95616, USA - + - + - + @@ -109,7 +109,7 @@ Davis, CA 95616, USA - + @@ -117,7 +117,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/DeviceEnergyManagement.xml b/data_model/master/clusters/DeviceEnergyManagement.xml index ee1b2f0f2725e6..cb7f46c008f5e1 100644 --- a/data_model/master/clusters/DeviceEnergyManagement.xml +++ b/data_model/master/clusters/DeviceEnergyManagement.xml @@ -59,13 +59,15 @@ Davis, CA 95616, USA --> - + - + + + @@ -118,6 +120,7 @@ Davis, CA 95616, USA + @@ -472,12 +475,12 @@ Davis, CA 95616, USA - + - + @@ -495,14 +498,14 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/master/clusters/DiagnosticLogsCluster.xml b/data_model/master/clusters/DiagnosticLogsCluster.xml index 38520e81a85e16..9dc7f4c7ef448d 100644 --- a/data_model/master/clusters/DiagnosticLogsCluster.xml +++ b/data_model/master/clusters/DiagnosticLogsCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/DiagnosticsEthernet.xml b/data_model/master/clusters/DiagnosticsEthernet.xml index dfcd3d11c41f52..f000669f64156c 100644 --- a/data_model/master/clusters/DiagnosticsEthernet.xml +++ b/data_model/master/clusters/DiagnosticsEthernet.xml @@ -57,12 +57,14 @@ Davis, CA 95616, USA --> - + - + + + @@ -108,57 +110,57 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + diff --git a/data_model/master/clusters/DiagnosticsGeneral.xml b/data_model/master/clusters/DiagnosticsGeneral.xml index 4da912b03dc3df..1266705ba6d0dc 100644 --- a/data_model/master/clusters/DiagnosticsGeneral.xml +++ b/data_model/master/clusters/DiagnosticsGeneral.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -200,12 +200,12 @@ Davis, CA 95616, USA - + - + @@ -223,17 +223,17 @@ Davis, CA 95616, USA - + - + - + @@ -310,7 +310,6 @@ Davis, CA 95616, USA - diff --git a/data_model/master/clusters/DiagnosticsSoftware.xml b/data_model/master/clusters/DiagnosticsSoftware.xml index 7cb3c9ff39ad2f..55e865af040763 100644 --- a/data_model/master/clusters/DiagnosticsSoftware.xml +++ b/data_model/master/clusters/DiagnosticsSoftware.xml @@ -57,12 +57,14 @@ Davis, CA 95616, USA --> - + - + + + diff --git a/data_model/master/clusters/DiagnosticsThread.xml b/data_model/master/clusters/DiagnosticsThread.xml index 120efaddf8c08e..a55412d7fd3eff 100644 --- a/data_model/master/clusters/DiagnosticsThread.xml +++ b/data_model/master/clusters/DiagnosticsThread.xml @@ -55,15 +55,18 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + - + + - + + + @@ -257,38 +260,38 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + @@ -305,356 +308,356 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -663,6 +666,16 @@ Davis, CA 95616, USA + + + + + + + + + + diff --git a/data_model/master/clusters/DiagnosticsWiFi.xml b/data_model/master/clusters/DiagnosticsWiFi.xml index b3951d967dc31f..87f7e44dc92b55 100644 --- a/data_model/master/clusters/DiagnosticsWiFi.xml +++ b/data_model/master/clusters/DiagnosticsWiFi.xml @@ -55,14 +55,16 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + - + - + - + + + @@ -141,81 +143,81 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/data_model/master/clusters/DoorLock.xml b/data_model/master/clusters/DoorLock.xml index ea4b9fe1ebbbf8..46d659da94a690 100644 --- a/data_model/master/clusters/DoorLock.xml +++ b/data_model/master/clusters/DoorLock.xml @@ -66,7 +66,7 @@ Davis, CA 95616, USA - @@ -116,9 +116,6 @@ Davis, CA 95616, USA - - - @@ -279,23 +276,6 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - @@ -494,66 +474,6 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -598,29 +518,6 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - - - - - - - @@ -703,7 +600,7 @@ Davis, CA 95616, USA - + @@ -778,56 +675,6 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -871,7 +718,7 @@ Davis, CA 95616, USA - + @@ -886,7 +733,7 @@ Davis, CA 95616, USA - + @@ -912,153 +759,156 @@ Davis, CA 95616, USA - + - + - + - + + - + + - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1069,7 +919,7 @@ Davis, CA 95616, USA - + @@ -1080,7 +930,7 @@ Davis, CA 95616, USA - + @@ -1092,7 +942,7 @@ Davis, CA 95616, USA - + @@ -1106,7 +956,7 @@ Davis, CA 95616, USA - + @@ -1114,73 +964,12 @@ Davis, CA 95616, USA - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -1188,7 +977,7 @@ Davis, CA 95616, USA - + @@ -1196,7 +985,7 @@ Davis, CA 95616, USA - + @@ -1207,7 +996,7 @@ Davis, CA 95616, USA - + @@ -1215,7 +1004,7 @@ Davis, CA 95616, USA - + @@ -1226,7 +1015,7 @@ Davis, CA 95616, USA - + @@ -1234,21 +1023,21 @@ Davis, CA 95616, USA - + - + - + @@ -1872,18 +1661,12 @@ Davis, CA 95616, USA - - - - - - + + + + + + @@ -1961,47 +1744,6 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2034,18 +1776,12 @@ Davis, CA 95616, USA - - - - - - + + + + + + diff --git a/data_model/master/clusters/ElectricalEnergyMeasurement.xml b/data_model/master/clusters/ElectricalEnergyMeasurement.xml index d89b19472a6bbb..259f9f512aec02 100644 --- a/data_model/master/clusters/ElectricalEnergyMeasurement.xml +++ b/data_model/master/clusters/ElectricalEnergyMeasurement.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -124,12 +124,12 @@ Davis, CA 95616, USA - + - + @@ -139,7 +139,7 @@ Davis, CA 95616, USA - + @@ -149,7 +149,7 @@ Davis, CA 95616, USA - + @@ -159,7 +159,7 @@ Davis, CA 95616, USA - + @@ -169,7 +169,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/ElectricalPowerMeasurement.xml b/data_model/master/clusters/ElectricalPowerMeasurement.xml index 89ad5fa3255fcd..5953d36b9d992e 100644 --- a/data_model/master/clusters/ElectricalPowerMeasurement.xml +++ b/data_model/master/clusters/ElectricalPowerMeasurement.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -170,39 +170,39 @@ Davis, CA 95616, USA - + - + - + - + - + - + @@ -210,7 +210,7 @@ Davis, CA 95616, USA - + @@ -218,13 +218,13 @@ Davis, CA 95616, USA - + - + @@ -232,7 +232,7 @@ Davis, CA 95616, USA - + @@ -240,7 +240,7 @@ Davis, CA 95616, USA - + @@ -248,7 +248,7 @@ Davis, CA 95616, USA - + @@ -256,7 +256,7 @@ Davis, CA 95616, USA - + @@ -264,7 +264,7 @@ Davis, CA 95616, USA - + @@ -273,7 +273,7 @@ Davis, CA 95616, USA - + @@ -282,7 +282,7 @@ Davis, CA 95616, USA - + @@ -290,7 +290,7 @@ Davis, CA 95616, USA - + @@ -298,7 +298,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/EnergyCalendar.xml b/data_model/master/clusters/EnergyCalendar.xml index 40a8a87f04ec17..5be0f8ff520aea 100644 --- a/data_model/master/clusters/EnergyCalendar.xml +++ b/data_model/master/clusters/EnergyCalendar.xml @@ -59,9 +59,9 @@ Davis, CA 95616, USA --> - + - + @@ -196,17 +196,17 @@ Davis, CA 95616, USA - + - + - + @@ -215,70 +215,70 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/data_model/master/clusters/EnergyEVSE.xml b/data_model/master/clusters/EnergyEVSE.xml index 53605899d05550..a4c865c3096a60 100644 --- a/data_model/master/clusters/EnergyEVSE.xml +++ b/data_model/master/clusters/EnergyEVSE.xml @@ -57,12 +57,11 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + - + - - + @@ -76,16 +75,25 @@ Davis, CA 95616, USA - + + + + - + + + + - + + + + @@ -254,7 +262,12 @@ Davis, CA 95616, USA - + + + + + + @@ -262,7 +275,7 @@ Davis, CA 95616, USA - + @@ -275,37 +288,37 @@ Davis, CA 95616, USA - + - + - + - + - + - + @@ -313,33 +326,33 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -347,14 +360,14 @@ Davis, CA 95616, USA - + - + @@ -362,14 +375,14 @@ Davis, CA 95616, USA - + - + @@ -377,7 +390,7 @@ Davis, CA 95616, USA - + @@ -385,23 +398,23 @@ Davis, CA 95616, USA - + - + - + - + @@ -525,7 +538,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/EnergyPreference.xml b/data_model/master/clusters/EnergyPreference.xml index 37559dfbc30850..2534ccfc8474c6 100644 --- a/data_model/master/clusters/EnergyPreference.xml +++ b/data_model/master/clusters/EnergyPreference.xml @@ -59,10 +59,12 @@ Davis, CA 95616, USA --> - + - + + + @@ -102,7 +104,7 @@ Davis, CA 95616, USA - + @@ -110,7 +112,7 @@ Davis, CA 95616, USA - + @@ -118,7 +120,7 @@ Davis, CA 95616, USA - + @@ -127,7 +129,7 @@ Davis, CA 95616, USA - + @@ -135,7 +137,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/EnergyPrice.xml b/data_model/master/clusters/EnergyPrice.xml index fa46810900890f..aae07641398eeb 100644 --- a/data_model/master/clusters/EnergyPrice.xml +++ b/data_model/master/clusters/EnergyPrice.xml @@ -59,10 +59,10 @@ Davis, CA 95616, USA --> - + - + @@ -166,7 +166,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/FanControl.xml b/data_model/master/clusters/FanControl.xml index 12d57967801646..9eba1df549981c 100644 --- a/data_model/master/clusters/FanControl.xml +++ b/data_model/master/clusters/FanControl.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -120,36 +120,36 @@ Davis, CA 95616, USA - + - + - + - + - + - + @@ -188,36 +188,36 @@ Davis, CA 95616, USA - + - + - + - + - + - + @@ -225,7 +225,7 @@ Davis, CA 95616, USA - + @@ -233,7 +233,7 @@ Davis, CA 95616, USA - + @@ -241,7 +241,7 @@ Davis, CA 95616, USA - + @@ -249,7 +249,7 @@ Davis, CA 95616, USA - + @@ -257,7 +257,7 @@ Davis, CA 95616, USA - + @@ -265,7 +265,7 @@ Davis, CA 95616, USA - + @@ -273,7 +273,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/FlowMeasurement.xml b/data_model/master/clusters/FlowMeasurement.xml index d488b5899b05f0..85879977faa509 100644 --- a/data_model/master/clusters/FlowMeasurement.xml +++ b/data_model/master/clusters/FlowMeasurement.xml @@ -70,19 +70,19 @@ Davis, CA 95616, USA - + - + - + diff --git a/data_model/master/clusters/GeneralCommissioningCluster.xml b/data_model/master/clusters/GeneralCommissioningCluster.xml index 519285af02f103..2d9e65848f0c85 100644 --- a/data_model/master/clusters/GeneralCommissioningCluster.xml +++ b/data_model/master/clusters/GeneralCommissioningCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -65,7 +65,7 @@ Davis, CA 95616, USA - + @@ -130,7 +130,7 @@ Davis, CA 95616, USA - + @@ -140,12 +140,12 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/master/clusters/Group-Key-Management-Cluster.xml b/data_model/master/clusters/Group-Key-Management-Cluster.xml index c1819628e34d7b..784bdc903ec186 100644 --- a/data_model/master/clusters/Group-Key-Management-Cluster.xml +++ b/data_model/master/clusters/Group-Key-Management-Cluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -66,7 +66,7 @@ Davis, CA 95616, USA - + @@ -167,7 +167,7 @@ Davis, CA 95616, USA - + @@ -179,12 +179,12 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/master/clusters/Groups.xml b/data_model/master/clusters/Groups.xml index 1f168e13fad933..214e6c18280afa 100644 --- a/data_model/master/clusters/Groups.xml +++ b/data_model/master/clusters/Groups.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -83,7 +83,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/Humidistat.xml b/data_model/master/clusters/Humidistat.xml index b709b5d50d2f24..1af54698489d31 100644 --- a/data_model/master/clusters/Humidistat.xml +++ b/data_model/master/clusters/Humidistat.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -174,17 +174,17 @@ Davis, CA 95616, USA - + - + - + @@ -192,7 +192,7 @@ Davis, CA 95616, USA - + @@ -200,7 +200,7 @@ Davis, CA 95616, USA - + @@ -208,7 +208,7 @@ Davis, CA 95616, USA - + @@ -228,28 +228,28 @@ Davis, CA 95616, USA - + - + - + - + diff --git a/data_model/master/clusters/ICDManagement.xml b/data_model/master/clusters/ICDManagement.xml index 0f15a2729052fa..830f62fba2a63f 100644 --- a/data_model/master/clusters/ICDManagement.xml +++ b/data_model/master/clusters/ICDManagement.xml @@ -57,10 +57,11 @@ Davis, CA 95616, USA // Update Name --> - + - + + @@ -91,6 +92,14 @@ Davis, CA 95616, USA + + + + + + + + @@ -115,7 +124,7 @@ Davis, CA 95616, USA - + @@ -125,24 +134,24 @@ Davis, CA 95616, USA - + - + - + - + @@ -150,14 +159,14 @@ Davis, CA 95616, USA - + - + @@ -165,7 +174,7 @@ Davis, CA 95616, USA - + @@ -176,7 +185,7 @@ Davis, CA 95616, USA - + @@ -190,7 +199,7 @@ Davis, CA 95616, USA - + @@ -217,6 +226,9 @@ Davis, CA 95616, USA + + + diff --git a/data_model/master/clusters/Identify.xml b/data_model/master/clusters/Identify.xml index dbb9daca72fce4..a6682b7233d30a 100644 --- a/data_model/master/clusters/Identify.xml +++ b/data_model/master/clusters/Identify.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -122,7 +122,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/IlluminanceMeasurement.xml b/data_model/master/clusters/IlluminanceMeasurement.xml index 75cf30cd35d931..f24df314ca2ead 100644 --- a/data_model/master/clusters/IlluminanceMeasurement.xml +++ b/data_model/master/clusters/IlluminanceMeasurement.xml @@ -83,20 +83,20 @@ Davis, CA 95616, USA - + - + - + @@ -107,7 +107,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/JointFabricDatastoreCluster.xml b/data_model/master/clusters/JointFabricDatastoreCluster.xml index 40e46ecc78519c..79143f34d03f55 100644 --- a/data_model/master/clusters/JointFabricDatastoreCluster.xml +++ b/data_model/master/clusters/JointFabricDatastoreCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -75,14 +75,33 @@ Davis, CA 95616, USA - + + + + + + + + + + + + + + + + + + + + @@ -90,309 +109,376 @@ Davis, CA 95616, USA + - + + + + + + + + + - - + + + - + + - - + + + + + + + + + + + - + + - - - + + + - + + + - + + + - - + + + - + + + - + + - + + - - + + + - + + - - + + + + + - - + + + + + + + + + + + + + + + - + + - + + - + + - + - + - + - + - + - - - - - - - + - + - + - + + - + + - - - - - + + - - - - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + + - - - - - + + + - + + + - + - - - - + - + - + - + + - + + + + + - + - + + - + - - - - + - + - + - + + - + - + - + - + - + - + - + - + - - - - + - + - + @@ -402,32 +488,23 @@ Davis, CA 95616, USA - + - - - - + - + - + - - - - + - - - - + diff --git a/data_model/master/clusters/JointFabricPKICluster.xml b/data_model/master/clusters/JointFabricPKICluster.xml index 3519a11cec79c6..b8c9474b0163d8 100644 --- a/data_model/master/clusters/JointFabricPKICluster.xml +++ b/data_model/master/clusters/JointFabricPKICluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/KeypadInput.xml b/data_model/master/clusters/KeypadInput.xml index 57d6ef4650e013..efeb92ba28fb73 100644 --- a/data_model/master/clusters/KeypadInput.xml +++ b/data_model/master/clusters/KeypadInput.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/Label-Cluster-FixedLabelCluster.xml b/data_model/master/clusters/Label-Cluster-FixedLabelCluster.xml index 98106b6fc33e40..a172d1e281eff5 100644 --- a/data_model/master/clusters/Label-Cluster-FixedLabelCluster.xml +++ b/data_model/master/clusters/Label-Cluster-FixedLabelCluster.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -70,7 +70,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/Label-Cluster-LabelCluster.xml b/data_model/master/clusters/Label-Cluster-LabelCluster.xml index 0ca5566f0dc132..2f8a371f74042c 100644 --- a/data_model/master/clusters/Label-Cluster-LabelCluster.xml +++ b/data_model/master/clusters/Label-Cluster-LabelCluster.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -80,7 +80,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/Label-Cluster-UserLabelCluster.xml b/data_model/master/clusters/Label-Cluster-UserLabelCluster.xml index eba0099ffb59d2..466550f12520f1 100644 --- a/data_model/master/clusters/Label-Cluster-UserLabelCluster.xml +++ b/data_model/master/clusters/Label-Cluster-UserLabelCluster.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -70,7 +70,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/LaundryDryerControls.xml b/data_model/master/clusters/LaundryDryerControls.xml index af4f787c0432b7..85f7871b267be5 100644 --- a/data_model/master/clusters/LaundryDryerControls.xml +++ b/data_model/master/clusters/LaundryDryerControls.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -88,7 +88,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/LaundryWasherControls.xml b/data_model/master/clusters/LaundryWasherControls.xml index ff001c3a405652..046ecc3c51d697 100644 --- a/data_model/master/clusters/LaundryWasherControls.xml +++ b/data_model/master/clusters/LaundryWasherControls.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -109,7 +109,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/LevelControl.xml b/data_model/master/clusters/LevelControl.xml index c98db485e6e00a..28f88b96832c32 100644 --- a/data_model/master/clusters/LevelControl.xml +++ b/data_model/master/clusters/LevelControl.xml @@ -59,13 +59,15 @@ Davis, CA 95616, USA --> - + - + @@ -118,13 +120,13 @@ Davis, CA 95616, USA - + - + @@ -152,7 +154,7 @@ Davis, CA 95616, USA - + @@ -183,28 +185,29 @@ Davis, CA 95616, USA - + - + - + - + + - + diff --git a/data_model/master/clusters/LocalizationConfiguration.xml b/data_model/master/clusters/LocalizationConfiguration.xml index 66809f545389be..6bc3abd50600ab 100644 --- a/data_model/master/clusters/LocalizationConfiguration.xml +++ b/data_model/master/clusters/LocalizationConfiguration.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -66,7 +66,7 @@ Davis, CA 95616, USA - + @@ -75,7 +75,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/LocalizationTimeFormat.xml b/data_model/master/clusters/LocalizationTimeFormat.xml index db8b809b0341a9..2de3724879701d 100644 --- a/data_model/master/clusters/LocalizationTimeFormat.xml +++ b/data_model/master/clusters/LocalizationTimeFormat.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -125,12 +125,12 @@ Davis, CA 95616, USA - + - + @@ -138,7 +138,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/LocalizationUnit.xml b/data_model/master/clusters/LocalizationUnit.xml index 2c6e1ecbd648e6..e08ce0e8810f26 100644 --- a/data_model/master/clusters/LocalizationUnit.xml +++ b/data_model/master/clusters/LocalizationUnit.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -84,7 +84,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/LowPower.xml b/data_model/master/clusters/LowPower.xml index cf75cb0c680164..2e91a02c16a4b3 100644 --- a/data_model/master/clusters/LowPower.xml +++ b/data_model/master/clusters/LowPower.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/MediaInput.xml b/data_model/master/clusters/MediaInput.xml index a92985ff924a75..c01567f6e1ae3e 100644 --- a/data_model/master/clusters/MediaInput.xml +++ b/data_model/master/clusters/MediaInput.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/MediaPlayback.xml b/data_model/master/clusters/MediaPlayback.xml index 03175277dc12c5..e37d5944aeb366 100644 --- a/data_model/master/clusters/MediaPlayback.xml +++ b/data_model/master/clusters/MediaPlayback.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -223,7 +223,7 @@ Davis, CA 95616, USA - + @@ -231,7 +231,7 @@ Davis, CA 95616, USA - + @@ -239,7 +239,7 @@ Davis, CA 95616, USA - + @@ -254,7 +254,7 @@ Davis, CA 95616, USA - + @@ -262,7 +262,7 @@ Davis, CA 95616, USA - + @@ -270,7 +270,7 @@ Davis, CA 95616, USA - + @@ -279,7 +279,7 @@ Davis, CA 95616, USA - + @@ -287,7 +287,7 @@ Davis, CA 95616, USA - + @@ -296,7 +296,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/Messages.xml b/data_model/master/clusters/Messages.xml index 402310c4b92eea..d2dbd28ba87f81 100644 --- a/data_model/master/clusters/Messages.xml +++ b/data_model/master/clusters/Messages.xml @@ -98,7 +98,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/MicrowaveOvenControl.xml b/data_model/master/clusters/MicrowaveOvenControl.xml index b927685e534e0c..2169f7b1437945 100644 --- a/data_model/master/clusters/MicrowaveOvenControl.xml +++ b/data_model/master/clusters/MicrowaveOvenControl.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -89,7 +89,7 @@ Davis, CA 95616, USA - + @@ -102,7 +102,7 @@ Davis, CA 95616, USA - + @@ -110,7 +110,7 @@ Davis, CA 95616, USA - + @@ -118,7 +118,7 @@ Davis, CA 95616, USA - + @@ -127,7 +127,7 @@ Davis, CA 95616, USA - + @@ -148,7 +148,7 @@ Davis, CA 95616, USA - + @@ -157,21 +157,21 @@ Davis, CA 95616, USA - + - + - + - + diff --git a/data_model/master/clusters/ModeBase.xml b/data_model/master/clusters/ModeBase.xml index 48b4d4adac1634..c874eee69d3eb6 100644 --- a/data_model/master/clusters/ModeBase.xml +++ b/data_model/master/clusters/ModeBase.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -99,25 +99,25 @@ Davis, CA 95616, USA - + - + - + - + diff --git a/data_model/master/clusters/ModeSelect.xml b/data_model/master/clusters/ModeSelect.xml index cfdf7adb92761c..6e6f062182e503 100644 --- a/data_model/master/clusters/ModeSelect.xml +++ b/data_model/master/clusters/ModeSelect.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -97,38 +97,38 @@ Davis, CA 95616, USA - + - + - + - + - + - + diff --git a/data_model/master/clusters/Mode_DeviceEnergyManagement.xml b/data_model/master/clusters/Mode_DeviceEnergyManagement.xml index 9cb426eb51785d..ff8f7e910e94b0 100644 --- a/data_model/master/clusters/Mode_DeviceEnergyManagement.xml +++ b/data_model/master/clusters/Mode_DeviceEnergyManagement.xml @@ -59,10 +59,12 @@ Davis, CA 95616, USA --> - + - + + + diff --git a/data_model/master/clusters/Mode_Dishwasher.xml b/data_model/master/clusters/Mode_Dishwasher.xml index 40a19828d44ebb..8069fdddcf0cc3 100644 --- a/data_model/master/clusters/Mode_Dishwasher.xml +++ b/data_model/master/clusters/Mode_Dishwasher.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -80,6 +80,11 @@ Davis, CA 95616, USA + + + + + @@ -88,10 +93,10 @@ Davis, CA 95616, USA - + - + \ No newline at end of file diff --git a/data_model/master/clusters/Mode_EVSE.xml b/data_model/master/clusters/Mode_EVSE.xml index ffce1a6a2980ce..daf8042cc3293b 100644 --- a/data_model/master/clusters/Mode_EVSE.xml +++ b/data_model/master/clusters/Mode_EVSE.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -79,4 +79,23 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/master/clusters/Mode_LaundryWasher.xml b/data_model/master/clusters/Mode_LaundryWasher.xml index 5d3cce891790e1..444d536fd178fd 100644 --- a/data_model/master/clusters/Mode_LaundryWasher.xml +++ b/data_model/master/clusters/Mode_LaundryWasher.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -80,6 +80,11 @@ Davis, CA 95616, USA + + + + + @@ -88,10 +93,10 @@ Davis, CA 95616, USA - + - + \ No newline at end of file diff --git a/data_model/master/clusters/Mode_MicrowaveOven.xml b/data_model/master/clusters/Mode_MicrowaveOven.xml index 6f1e8ed895f489..b5076d8c270099 100644 --- a/data_model/master/clusters/Mode_MicrowaveOven.xml +++ b/data_model/master/clusters/Mode_MicrowaveOven.xml @@ -59,12 +59,17 @@ Davis, CA 95616, USA --> - + + + + + + diff --git a/data_model/master/clusters/Mode_Oven.xml b/data_model/master/clusters/Mode_Oven.xml index bf6c1b57928a57..f7e8c8a4268cf2 100644 --- a/data_model/master/clusters/Mode_Oven.xml +++ b/data_model/master/clusters/Mode_Oven.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -79,4 +79,23 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/master/clusters/Mode_RVCClean.xml b/data_model/master/clusters/Mode_RVCClean.xml index b48ffa24a35b50..26b5d15c185fe3 100644 --- a/data_model/master/clusters/Mode_RVCClean.xml +++ b/data_model/master/clusters/Mode_RVCClean.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -81,6 +81,11 @@ Davis, CA 95616, USA + + + + + diff --git a/data_model/master/clusters/Mode_RVCRun.xml b/data_model/master/clusters/Mode_RVCRun.xml index ddfad8adc89d2e..ad0d7601a45c22 100644 --- a/data_model/master/clusters/Mode_RVCRun.xml +++ b/data_model/master/clusters/Mode_RVCRun.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -81,6 +81,11 @@ Davis, CA 95616, USA + + + + + diff --git a/data_model/master/clusters/Mode_Refrigerator.xml b/data_model/master/clusters/Mode_Refrigerator.xml index b4550283daf9e5..84410d1ddfc465 100644 --- a/data_model/master/clusters/Mode_Refrigerator.xml +++ b/data_model/master/clusters/Mode_Refrigerator.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -80,6 +80,11 @@ Davis, CA 95616, USA + + + + + @@ -88,10 +93,10 @@ Davis, CA 95616, USA - + - + \ No newline at end of file diff --git a/data_model/master/clusters/Mode_WaterHeater.xml b/data_model/master/clusters/Mode_WaterHeater.xml index 482ea0e33d0f9a..1779e74bab8c84 100644 --- a/data_model/master/clusters/Mode_WaterHeater.xml +++ b/data_model/master/clusters/Mode_WaterHeater.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/NetworkCommissioningCluster.xml b/data_model/master/clusters/NetworkCommissioningCluster.xml index cb6e935dcd189e..8eefb234a2920a 100644 --- a/data_model/master/clusters/NetworkCommissioningCluster.xml +++ b/data_model/master/clusters/NetworkCommissioningCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -125,22 +125,22 @@ Davis, CA 95616, USA - + - + - + - + - + - + @@ -167,16 +167,16 @@ Davis, CA 95616, USA - + - + - + - + @@ -287,7 +287,7 @@ Davis, CA 95616, USA - + @@ -299,7 +299,7 @@ Davis, CA 95616, USA - + @@ -310,7 +310,7 @@ Davis, CA 95616, USA - + @@ -321,29 +321,29 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -351,14 +351,14 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/master/clusters/NetworkIdentityManagement.xml b/data_model/master/clusters/NetworkIdentityManagement.xml index 0cb3ee17251741..cef2f88f6ddad9 100644 --- a/data_model/master/clusters/NetworkIdentityManagement.xml +++ b/data_model/master/clusters/NetworkIdentityManagement.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -99,26 +99,26 @@ Davis, CA 95616, USA - + - + - + - + diff --git a/data_model/master/clusters/OTAProvider.xml b/data_model/master/clusters/OTAProvider.xml index 2a5be10961f02c..f300a419518675 100644 --- a/data_model/master/clusters/OTAProvider.xml +++ b/data_model/master/clusters/OTAProvider.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/OTARequestor.xml b/data_model/master/clusters/OTARequestor.xml index f6a5ff0365abed..83314d14d9551a 100644 --- a/data_model/master/clusters/OTARequestor.xml +++ b/data_model/master/clusters/OTARequestor.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -149,7 +149,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/OccupancySensing.xml b/data_model/master/clusters/OccupancySensing.xml index 2aae8530b1d512..4cd027deb07279 100644 --- a/data_model/master/clusters/OccupancySensing.xml +++ b/data_model/master/clusters/OccupancySensing.xml @@ -63,7 +63,7 @@ Davis, CA 95616, USA - - + - + @@ -164,7 +164,7 @@ Davis, CA 95616, USA - + @@ -178,7 +178,7 @@ Davis, CA 95616, USA - + @@ -410,7 +410,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/OnOff.xml b/data_model/master/clusters/OnOff.xml index a12de2b2e25eb8..b1ea6ebba4af7d 100644 --- a/data_model/master/clusters/OnOff.xml +++ b/data_model/master/clusters/OnOff.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -145,7 +145,7 @@ Davis, CA 95616, USA - + @@ -168,7 +168,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/OperationalCredentialCluster.xml b/data_model/master/clusters/OperationalCredentialCluster.xml index 2aa070f96b2573..338a8af007c5b9 100644 --- a/data_model/master/clusters/OperationalCredentialCluster.xml +++ b/data_model/master/clusters/OperationalCredentialCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -155,26 +155,26 @@ Davis, CA 95616, USA - + - + - + - + @@ -183,7 +183,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/OperationalState.xml b/data_model/master/clusters/OperationalState.xml index 124362e459e429..354efa2400bda7 100644 --- a/data_model/master/clusters/OperationalState.xml +++ b/data_model/master/clusters/OperationalState.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -115,19 +115,19 @@ Davis, CA 95616, USA - + - + - + @@ -180,7 +180,6 @@ Davis, CA 95616, USA - diff --git a/data_model/master/clusters/OperationalState_Oven.xml b/data_model/master/clusters/OperationalState_Oven.xml index fbcc634330faa7..710dea9806bf57 100644 --- a/data_model/master/clusters/OperationalState_Oven.xml +++ b/data_model/master/clusters/OperationalState_Oven.xml @@ -59,10 +59,21 @@ Davis, CA 95616, USA --> - + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/master/clusters/OperationalState_RVC.xml b/data_model/master/clusters/OperationalState_RVC.xml index f33791fcf86407..5d2d28db2c2cad 100644 --- a/data_model/master/clusters/OperationalState_RVC.xml +++ b/data_model/master/clusters/OperationalState_RVC.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/PowerSourceCluster.xml b/data_model/master/clusters/PowerSourceCluster.xml index 1c01cc548bfdee..a0b6b91c565dd8 100644 --- a/data_model/master/clusters/PowerSourceCluster.xml +++ b/data_model/master/clusters/PowerSourceCluster.xml @@ -55,10 +55,11 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + - + + @@ -556,32 +557,32 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -589,21 +590,21 @@ Davis, CA 95616, USA - + - + - + @@ -624,14 +625,14 @@ Davis, CA 95616, USA - + - + @@ -639,7 +640,7 @@ Davis, CA 95616, USA - + @@ -659,7 +660,7 @@ Davis, CA 95616, USA - + @@ -680,7 +681,7 @@ Davis, CA 95616, USA - + @@ -688,7 +689,7 @@ Davis, CA 95616, USA - + @@ -696,7 +697,7 @@ Davis, CA 95616, USA - + @@ -704,7 +705,7 @@ Davis, CA 95616, USA - + @@ -712,7 +713,7 @@ Davis, CA 95616, USA - + @@ -720,7 +721,7 @@ Davis, CA 95616, USA - + @@ -730,7 +731,7 @@ Davis, CA 95616, USA - + @@ -744,7 +745,7 @@ Davis, CA 95616, USA - + @@ -757,7 +758,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/PowerSourceConfigurationCluster.xml b/data_model/master/clusters/PowerSourceConfigurationCluster.xml index 6a47ce1b54cdbd..61df60149ca00f 100644 --- a/data_model/master/clusters/PowerSourceConfigurationCluster.xml +++ b/data_model/master/clusters/PowerSourceConfigurationCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -67,7 +67,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/PowerTopology.xml b/data_model/master/clusters/PowerTopology.xml index 4ebdda614a4aec..eb0a2d74f5e585 100644 --- a/data_model/master/clusters/PowerTopology.xml +++ b/data_model/master/clusters/PowerTopology.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -83,7 +83,7 @@ Davis, CA 95616, USA - + @@ -92,7 +92,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/PressureMeasurement.xml b/data_model/master/clusters/PressureMeasurement.xml index a46e911253941f..bf9b6a9286e381 100644 --- a/data_model/master/clusters/PressureMeasurement.xml +++ b/data_model/master/clusters/PressureMeasurement.xml @@ -75,19 +75,19 @@ Davis, CA 95616, USA - + - + - + @@ -98,7 +98,7 @@ Davis, CA 95616, USA - + @@ -106,7 +106,7 @@ Davis, CA 95616, USA - + @@ -114,7 +114,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/ProxyConfiguration-Cluster.xml b/data_model/master/clusters/ProxyConfiguration-Cluster.xml index 8ad566ec8527b2..6796e79ac9bf59 100644 --- a/data_model/master/clusters/ProxyConfiguration-Cluster.xml +++ b/data_model/master/clusters/ProxyConfiguration-Cluster.xml @@ -57,10 +57,12 @@ Davis, CA 95616, USA --> - + - + + + @@ -82,7 +84,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/ProxyDiscovery-Cluster.xml b/data_model/master/clusters/ProxyDiscovery-Cluster.xml index 6fa4a9eb6f3a06..7353386929c109 100644 --- a/data_model/master/clusters/ProxyDiscovery-Cluster.xml +++ b/data_model/master/clusters/ProxyDiscovery-Cluster.xml @@ -57,10 +57,12 @@ Davis, CA 95616, USA --> - + - + + + diff --git a/data_model/master/clusters/PumpConfigurationControl.xml b/data_model/master/clusters/PumpConfigurationControl.xml index c3f79ce8108975..95ede00d0eb72e 100644 --- a/data_model/master/clusters/PumpConfigurationControl.xml +++ b/data_model/master/clusters/PumpConfigurationControl.xml @@ -176,22 +176,22 @@ Davis, CA 95616, USA - + - + - + - + @@ -203,7 +203,7 @@ Davis, CA 95616, USA - + @@ -215,7 +215,7 @@ Davis, CA 95616, USA - + @@ -227,7 +227,7 @@ Davis, CA 95616, USA - + @@ -239,7 +239,7 @@ Davis, CA 95616, USA - + @@ -251,7 +251,7 @@ Davis, CA 95616, USA - + @@ -263,7 +263,7 @@ Davis, CA 95616, USA - + @@ -275,7 +275,7 @@ Davis, CA 95616, USA - + @@ -287,7 +287,7 @@ Davis, CA 95616, USA - + @@ -300,7 +300,7 @@ Davis, CA 95616, USA - + @@ -313,62 +313,62 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + - + - + diff --git a/data_model/master/clusters/ResourceMonitoring.xml b/data_model/master/clusters/ResourceMonitoring.xml index 43bf28868f3709..b9d26ff6dd9ecf 100644 --- a/data_model/master/clusters/ResourceMonitoring.xml +++ b/data_model/master/clusters/ResourceMonitoring.xml @@ -59,12 +59,12 @@ Davis, CA 95616, USA --> - + - - - + + + @@ -74,7 +74,7 @@ Davis, CA 95616, USA - + @@ -104,13 +104,13 @@ Davis, CA 95616, USA - + - + @@ -137,7 +137,7 @@ Davis, CA 95616, USA - + @@ -153,13 +153,13 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/master/clusters/Scenes.xml b/data_model/master/clusters/Scenes.xml index bf68f8528fa159..1479d3ffd7de86 100644 --- a/data_model/master/clusters/Scenes.xml +++ b/data_model/master/clusters/Scenes.xml @@ -62,7 +62,9 @@ Davis, CA 95616, USA - + + + @@ -165,12 +167,12 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/master/clusters/ServiceArea.xml b/data_model/master/clusters/ServiceArea.xml index 7963d93b7eb222..6a54264a94928b 100644 --- a/data_model/master/clusters/ServiceArea.xml +++ b/data_model/master/clusters/ServiceArea.xml @@ -57,67 +57,77 @@ Davis, CA 95616, USA --> - + - + - + + + + - + - + - + - + - - + + - + - - + + + - + + - - - + - - + + + - + + - + @@ -126,7 +136,7 @@ Davis, CA 95616, USA - + @@ -136,94 +146,91 @@ Davis, CA 95616, USA - + - - + + - + - - - + + + + - + - - + - - + - + - + - + - - - + + + + - + - + - - - - - - - + + + - + - + - - - + + + + - - + - + - + + diff --git a/data_model/master/clusters/SmokeCOAlarm.xml b/data_model/master/clusters/SmokeCOAlarm.xml index 25c034ac94082c..482a8a82f2abf5 100644 --- a/data_model/master/clusters/SmokeCOAlarm.xml +++ b/data_model/master/clusters/SmokeCOAlarm.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -163,31 +163,31 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -196,12 +196,12 @@ Davis, CA 95616, USA - + - + @@ -226,7 +226,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/Switch.xml b/data_model/master/clusters/Switch.xml index c7c94524bed52c..92489c1e9228a3 100644 --- a/data_model/master/clusters/Switch.xml +++ b/data_model/master/clusters/Switch.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -116,19 +116,19 @@ Davis, CA 95616, USA - + - + - + diff --git a/data_model/master/clusters/TargetNavigator.xml b/data_model/master/clusters/TargetNavigator.xml index c5fb59919585c1..b1fcff6d60cd1e 100644 --- a/data_model/master/clusters/TargetNavigator.xml +++ b/data_model/master/clusters/TargetNavigator.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/TemperatureControl.xml b/data_model/master/clusters/TemperatureControl.xml index 3f5fa9c00332d6..79519716ea1cf8 100644 --- a/data_model/master/clusters/TemperatureControl.xml +++ b/data_model/master/clusters/TemperatureControl.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -86,7 +86,7 @@ Davis, CA 95616, USA - + @@ -94,7 +94,7 @@ Davis, CA 95616, USA - + @@ -102,7 +102,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/TemperatureMeasurement.xml b/data_model/master/clusters/TemperatureMeasurement.xml index 176fad6b246a60..0935b18edab675 100644 --- a/data_model/master/clusters/TemperatureMeasurement.xml +++ b/data_model/master/clusters/TemperatureMeasurement.xml @@ -71,19 +71,19 @@ Davis, CA 95616, USA - + - + - + diff --git a/data_model/master/clusters/Thermostat.xml b/data_model/master/clusters/Thermostat.xml index 7345fc2e2c9177..de1743d8addf1a 100644 --- a/data_model/master/clusters/Thermostat.xml +++ b/data_model/master/clusters/Thermostat.xml @@ -1,6 +1,6 @@ - + @@ -63,8 +63,9 @@ Davis, CA 95616, USA - - + @@ -113,11 +114,6 @@ Davis, CA 95616, USA - - - - - @@ -401,10 +397,10 @@ Davis, CA 95616, USA - + - + @@ -414,6 +410,11 @@ Davis, CA 95616, USA + + + + + @@ -503,12 +504,12 @@ Davis, CA 95616, USA - + - + @@ -559,15 +560,6 @@ Davis, CA 95616, USA - - - - - - - - - @@ -603,7 +595,7 @@ Davis, CA 95616, USA - + @@ -660,24 +652,23 @@ Davis, CA 95616, USA - + - + - + - - + @@ -685,7 +676,7 @@ Davis, CA 95616, USA - + @@ -693,7 +684,7 @@ Davis, CA 95616, USA - + @@ -701,7 +692,7 @@ Davis, CA 95616, USA - + @@ -709,7 +700,7 @@ Davis, CA 95616, USA - + @@ -717,7 +708,7 @@ Davis, CA 95616, USA - + @@ -725,13 +716,13 @@ Davis, CA 95616, USA - + - + @@ -740,7 +731,7 @@ Davis, CA 95616, USA - + @@ -748,7 +739,7 @@ Davis, CA 95616, USA - + @@ -756,7 +747,7 @@ Davis, CA 95616, USA - + @@ -767,7 +758,7 @@ Davis, CA 95616, USA - + @@ -778,7 +769,7 @@ Davis, CA 95616, USA - + @@ -786,7 +777,7 @@ Davis, CA 95616, USA - + @@ -794,7 +785,7 @@ Davis, CA 95616, USA - + @@ -802,7 +793,7 @@ Davis, CA 95616, USA - + @@ -810,7 +801,7 @@ Davis, CA 95616, USA - + @@ -818,19 +809,19 @@ Davis, CA 95616, USA - + - + - + @@ -850,7 +841,7 @@ Davis, CA 95616, USA - + @@ -858,33 +849,33 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -900,7 +891,7 @@ Davis, CA 95616, USA - + @@ -909,7 +900,7 @@ Davis, CA 95616, USA - + @@ -917,7 +908,7 @@ Davis, CA 95616, USA - + @@ -925,7 +916,7 @@ Davis, CA 95616, USA - + @@ -933,7 +924,7 @@ Davis, CA 95616, USA - + @@ -944,7 +935,7 @@ Davis, CA 95616, USA - + @@ -955,7 +946,7 @@ Davis, CA 95616, USA - + @@ -966,29 +957,29 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -998,25 +989,25 @@ Davis, CA 95616, USA - + - + - + - + @@ -1025,7 +1016,7 @@ Davis, CA 95616, USA - + @@ -1033,35 +1024,35 @@ Davis, CA 95616, USA - + - + - + - + - + @@ -1069,7 +1060,7 @@ Davis, CA 95616, USA - + @@ -1078,7 +1069,7 @@ Davis, CA 95616, USA - + @@ -1087,33 +1078,17 @@ Davis, CA 95616, USA - + - - - - - - - - - - + - + - - - - - - - @@ -1243,48 +1218,6 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/master/clusters/ThermostatUserInterfaceConfiguration.xml b/data_model/master/clusters/ThermostatUserInterfaceConfiguration.xml index b4ecd49f93ae4a..d6a52248282321 100644 --- a/data_model/master/clusters/ThermostatUserInterfaceConfiguration.xml +++ b/data_model/master/clusters/ThermostatUserInterfaceConfiguration.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/ThreadBorderRouterManagement.xml b/data_model/master/clusters/ThreadBorderRouterManagement.xml index f1e88f8ab86e70..7ae4edab62f8b3 100644 --- a/data_model/master/clusters/ThreadBorderRouterManagement.xml +++ b/data_model/master/clusters/ThreadBorderRouterManagement.xml @@ -59,14 +59,14 @@ Davis, CA 95616, USA --> - + - + - + @@ -79,20 +79,26 @@ Davis, CA 95616, USA + - + - + - + + + + + + @@ -105,15 +111,15 @@ Davis, CA 95616, USA - + - - + + @@ -123,8 +129,8 @@ Davis, CA 95616, USA - - + + diff --git a/data_model/master/clusters/ThreadNetworkDirectory.xml b/data_model/master/clusters/ThreadNetworkDirectory.xml index 3a770c36a214f9..098b490fa5d369 100644 --- a/data_model/master/clusters/ThreadNetworkDirectory.xml +++ b/data_model/master/clusters/ThreadNetworkDirectory.xml @@ -59,42 +59,47 @@ Davis, CA 95616, USA --> - + - - + + + - + + + + - - - + + + + - - - + + + - + @@ -111,15 +116,17 @@ Davis, CA 95616, USA - + + - + - + + @@ -130,13 +137,4 @@ Davis, CA 95616, USA - - - - - - - - - \ No newline at end of file diff --git a/data_model/master/clusters/TimeSync.xml b/data_model/master/clusters/TimeSync.xml index 9d4057db8bdb85..e72a9d32467983 100644 --- a/data_model/master/clusters/TimeSync.xml +++ b/data_model/master/clusters/TimeSync.xml @@ -60,7 +60,7 @@ Davis, CA 95616, USA --> - + @@ -213,7 +213,7 @@ Davis, CA 95616, USA - + @@ -228,14 +228,14 @@ Davis, CA 95616, USA - + - + @@ -244,7 +244,7 @@ Davis, CA 95616, USA - + @@ -253,21 +253,21 @@ Davis, CA 95616, USA - + - + - + @@ -280,7 +280,7 @@ Davis, CA 95616, USA - + @@ -288,7 +288,7 @@ Davis, CA 95616, USA - + @@ -296,7 +296,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/ValidProxies-Cluster.xml b/data_model/master/clusters/ValidProxies-Cluster.xml index b9db8e1762647f..51cfeedb46926d 100644 --- a/data_model/master/clusters/ValidProxies-Cluster.xml +++ b/data_model/master/clusters/ValidProxies-Cluster.xml @@ -57,10 +57,12 @@ Davis, CA 95616, USA --> - + - + + + @@ -75,7 +77,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/ValveConfigurationControl.xml b/data_model/master/clusters/ValveConfigurationControl.xml index e8dcece07432d3..03d40acd480ff4 100644 --- a/data_model/master/clusters/ValveConfigurationControl.xml +++ b/data_model/master/clusters/ValveConfigurationControl.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -109,55 +109,55 @@ Davis, CA 95616, USA - + - + - + - + - + - + - + - + - + @@ -169,7 +169,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/WakeOnLAN.xml b/data_model/master/clusters/WakeOnLAN.xml index 4f6e032c084b38..092e0a8ea8f4de 100644 --- a/data_model/master/clusters/WakeOnLAN.xml +++ b/data_model/master/clusters/WakeOnLAN.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -68,13 +68,13 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/master/clusters/WaterContentMeasurement.xml b/data_model/master/clusters/WaterContentMeasurement.xml index 85d44793c93ae4..af11c9cf8d514c 100644 --- a/data_model/master/clusters/WaterContentMeasurement.xml +++ b/data_model/master/clusters/WaterContentMeasurement.xml @@ -70,19 +70,19 @@ Davis, CA 95616, USA - + - + - + diff --git a/data_model/master/clusters/WaterHeaterManagement.xml b/data_model/master/clusters/WaterHeaterManagement.xml index 52e1020f164472..cadf8e0a8af53b 100644 --- a/data_model/master/clusters/WaterHeaterManagement.xml +++ b/data_model/master/clusters/WaterHeaterManagement.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -74,6 +74,14 @@ Davis, CA 95616, USA + + + + + + + + @@ -112,7 +120,7 @@ Davis, CA 95616, USA - + @@ -137,7 +145,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/clusters/WiFiNetworkManagement.xml b/data_model/master/clusters/WiFiNetworkManagement.xml index e1c03fbc7061d4..3aad5935d2843d 100644 --- a/data_model/master/clusters/WiFiNetworkManagement.xml +++ b/data_model/master/clusters/WiFiNetworkManagement.xml @@ -57,25 +57,30 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + - + - + - + - + + + + + + - + diff --git a/data_model/master/clusters/WindowCovering.xml b/data_model/master/clusters/WindowCovering.xml index 7ec63dd442d8ae..f8c60b46901dc9 100644 --- a/data_model/master/clusters/WindowCovering.xml +++ b/data_model/master/clusters/WindowCovering.xml @@ -340,13 +340,13 @@ Davis, CA 95616, USA - + - + - + @@ -392,13 +392,13 @@ Davis, CA 95616, USA - + - + @@ -409,7 +409,7 @@ Davis, CA 95616, USA - + @@ -420,7 +420,7 @@ Davis, CA 95616, USA - + @@ -432,7 +432,7 @@ Davis, CA 95616, USA - + @@ -444,27 +444,27 @@ Davis, CA 95616, USA - + - + - + - + @@ -474,7 +474,7 @@ Davis, CA 95616, USA - + @@ -485,13 +485,13 @@ Davis, CA 95616, USA - + - + @@ -501,7 +501,7 @@ Davis, CA 95616, USA - + @@ -511,13 +511,13 @@ Davis, CA 95616, USA - + - + @@ -528,7 +528,7 @@ Davis, CA 95616, USA - + @@ -539,7 +539,7 @@ Davis, CA 95616, USA - + @@ -551,7 +551,7 @@ Davis, CA 95616, USA - + @@ -563,7 +563,7 @@ Davis, CA 95616, USA - + @@ -575,7 +575,7 @@ Davis, CA 95616, USA - + @@ -596,7 +596,7 @@ Davis, CA 95616, USA - + @@ -608,7 +608,7 @@ Davis, CA 95616, USA - + @@ -653,11 +653,11 @@ Davis, CA 95616, USA - + - + @@ -688,11 +688,11 @@ Davis, CA 95616, USA - + - + diff --git a/data_model/master/clusters/bridge-clusters-ActionsCluster.xml b/data_model/master/clusters/bridge-clusters-ActionsCluster.xml index 5b9b54429b9429..4874aca26bc504 100644 --- a/data_model/master/clusters/bridge-clusters-ActionsCluster.xml +++ b/data_model/master/clusters/bridge-clusters-ActionsCluster.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/clusters/bridge-clusters-BridgedDeviceBasicInformationCluster.xml b/data_model/master/clusters/bridge-clusters-BridgedDeviceBasicInformationCluster.xml index 318ad7fa54dd2a..4368d991c832f4 100644 --- a/data_model/master/clusters/bridge-clusters-BridgedDeviceBasicInformationCluster.xml +++ b/data_model/master/clusters/bridge-clusters-BridgedDeviceBasicInformationCluster.xml @@ -59,17 +59,17 @@ Davis, CA 95616, USA --> - + - + - + @@ -86,9 +86,7 @@ Davis, CA 95616, USA - - - + @@ -148,7 +146,7 @@ Davis, CA 95616, USA - + @@ -178,11 +176,15 @@ Davis, CA 95616, USA - + + + + + \ No newline at end of file diff --git a/data_model/master/clusters/bridge-clusters-EcosystemInformationCluster.xml b/data_model/master/clusters/bridge-clusters-EcosystemInformationCluster.xml index 42ae5c4fe44cee..22cc88097acf75 100644 --- a/data_model/master/clusters/bridge-clusters-EcosystemInformationCluster.xml +++ b/data_model/master/clusters/bridge-clusters-EcosystemInformationCluster.xml @@ -59,7 +59,7 @@ Davis, CA 95616, USA --> - + @@ -68,69 +68,79 @@ Davis, CA 95616, USA + - - - + + + - + + - - + + + + + + - + + + - + + - - + + + - - - - + + + + - - + + - - + + - + - - + + - + \ No newline at end of file diff --git a/data_model/master/clusters/cluster_ids.json b/data_model/master/clusters/cluster_ids.json index c7654179ede2b5..e04a90b04a76d8 100644 --- a/data_model/master/clusters/cluster_ids.json +++ b/data_model/master/clusters/cluster_ids.json @@ -21,7 +21,7 @@ "51": "General Diagnostics", "52": "Software Diagnostics", "53": "Thread Network Diagnostics", - "54": "Wi", + "54": "Wi-Fi Network Diagnostics", "55": "Ethernet Network Diagnostics", "56": "Time Synchronization", "57": "Bridged Device Basic Information", @@ -95,14 +95,14 @@ "1037": "Carbon Dioxide Concentration Measurement", "1043": "Nitrogen Dioxide Concentration Measurement", "1045": "Ozone Concentration Measurement", - "1066": "PM2", + "1066": "PM2.5 Concentration Measurement", "1067": "Formaldehyde Concentration Measurement", "1068": "PM1 Concentration Measurement", "1069": "PM10 Concentration Measurement", "1070": "Total Volatile Organic Compounds Concentration Measurement", "1071": "Radon Concentration Measurement", "1104": "Network Identity Management", - "1105": "Wi", + "1105": "Wi-Fi Network Management", "1106": "Thread Border Router Management", "1107": "Thread Network Directory", "1283": "Wake on LAN", diff --git a/data_model/master/device_types/Aggregator.xml b/data_model/master/device_types/Aggregator.xml index 48aa4347d850e1..a99ee1108c3b50 100644 --- a/data_model/master/device_types/Aggregator.xml +++ b/data_model/master/device_types/Aggregator.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/AirPurifier.xml b/data_model/master/device_types/AirPurifier.xml index 538d9a4e341efb..62045f090c71a5 100644 --- a/data_model/master/device_types/AirPurifier.xml +++ b/data_model/master/device_types/AirPurifier.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/AirQualitySensor.xml b/data_model/master/device_types/AirQualitySensor.xml index 602781819d1696..756b42e437ac9a 100644 --- a/data_model/master/device_types/AirQualitySensor.xml +++ b/data_model/master/device_types/AirQualitySensor.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -86,7 +86,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/device_types/BaseDeviceType.xml b/data_model/master/device_types/BaseDeviceType.xml index ddcc49f258f0cb..272b74feb5ff67 100644 --- a/data_model/master/device_types/BaseDeviceType.xml +++ b/data_model/master/device_types/BaseDeviceType.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/BasicVideoPlayer.xml b/data_model/master/device_types/BasicVideoPlayer.xml index ed82d08bc7a112..d35bbed3211422 100644 --- a/data_model/master/device_types/BasicVideoPlayer.xml +++ b/data_model/master/device_types/BasicVideoPlayer.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/BatteryStorage.xml b/data_model/master/device_types/BatteryStorage.xml index 321e9f9dfe2159..5f09eeb1d2dac9 100644 --- a/data_model/master/device_types/BatteryStorage.xml +++ b/data_model/master/device_types/BatteryStorage.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/BridgedNode.xml b/data_model/master/device_types/BridgedNode.xml index 59414205c052b5..6f309001975627 100644 --- a/data_model/master/device_types/BridgedNode.xml +++ b/data_model/master/device_types/BridgedNode.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/CastingVideoClient.xml b/data_model/master/device_types/CastingVideoClient.xml index 8f816b3e2a8056..949142a6bca151 100644 --- a/data_model/master/device_types/CastingVideoClient.xml +++ b/data_model/master/device_types/CastingVideoClient.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/CastingVideoPlayer.xml b/data_model/master/device_types/CastingVideoPlayer.xml index 0b65f4f7aab57d..5c88cf92947e0b 100644 --- a/data_model/master/device_types/CastingVideoPlayer.xml +++ b/data_model/master/device_types/CastingVideoPlayer.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/ColorDimmerSwitch.xml b/data_model/master/device_types/ColorDimmerSwitch.xml index 190ab6c7fc8b7e..abc027eaec711c 100644 --- a/data_model/master/device_types/ColorDimmerSwitch.xml +++ b/data_model/master/device_types/ColorDimmerSwitch.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/ColorTemperatureLight.xml b/data_model/master/device_types/ColorTemperatureLight.xml index 4f7cf64a9fd0a2..56db5416cf02c9 100644 --- a/data_model/master/device_types/ColorTemperatureLight.xml +++ b/data_model/master/device_types/ColorTemperatureLight.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/ContactSensor.xml b/data_model/master/device_types/ContactSensor.xml index 6fa5620a77bebb..2767e5e37a384b 100644 --- a/data_model/master/device_types/ContactSensor.xml +++ b/data_model/master/device_types/ContactSensor.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/ContentApp.xml b/data_model/master/device_types/ContentApp.xml index 300e3122336ef4..81b967db9c8dc1 100644 --- a/data_model/master/device_types/ContentApp.xml +++ b/data_model/master/device_types/ContentApp.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/ControlBridge.xml b/data_model/master/device_types/ControlBridge.xml index 04ff66db808cc9..ab07228e728f52 100644 --- a/data_model/master/device_types/ControlBridge.xml +++ b/data_model/master/device_types/ControlBridge.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/CookSurface.xml b/data_model/master/device_types/CookSurface.xml index a32425e2f1df08..3a0e8f062c7495 100644 --- a/data_model/master/device_types/CookSurface.xml +++ b/data_model/master/device_types/CookSurface.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/Cooktop.xml b/data_model/master/device_types/Cooktop.xml index ea94653008d25a..2c7795de12233b 100644 --- a/data_model/master/device_types/Cooktop.xml +++ b/data_model/master/device_types/Cooktop.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/DeviceEnergyManagement.xml b/data_model/master/device_types/DeviceEnergyManagement.xml index cf148dabc13679..85f7c5d9a7cd66 100644 --- a/data_model/master/device_types/DeviceEnergyManagement.xml +++ b/data_model/master/device_types/DeviceEnergyManagement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/DimmableLight.xml b/data_model/master/device_types/DimmableLight.xml index 059a0802f77906..4d6c53e4ae36fd 100644 --- a/data_model/master/device_types/DimmableLight.xml +++ b/data_model/master/device_types/DimmableLight.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/DimmablePlug-InUnit.xml b/data_model/master/device_types/DimmablePlug-InUnit.xml index 4d344bfc9fb89c..73fd2a37c48bab 100644 --- a/data_model/master/device_types/DimmablePlug-InUnit.xml +++ b/data_model/master/device_types/DimmablePlug-InUnit.xml @@ -55,9 +55,9 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + - + diff --git a/data_model/master/device_types/DimmerSwitch.xml b/data_model/master/device_types/DimmerSwitch.xml index 0ad9f23638349a..9dce28fdd7ce71 100644 --- a/data_model/master/device_types/DimmerSwitch.xml +++ b/data_model/master/device_types/DimmerSwitch.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/Dishwasher.xml b/data_model/master/device_types/Dishwasher.xml index 6e351f38360e4e..b13f9a42ebcc49 100644 --- a/data_model/master/device_types/Dishwasher.xml +++ b/data_model/master/device_types/Dishwasher.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/DoorLock.xml b/data_model/master/device_types/DoorLock.xml index 8b73bbf8679a6b..121ea179d14589 100644 --- a/data_model/master/device_types/DoorLock.xml +++ b/data_model/master/device_types/DoorLock.xml @@ -57,8 +57,8 @@ Davis, CA 95616, USA --> - - + + @@ -95,14 +95,49 @@ Davis, CA 95616, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/master/device_types/DoorLockController.xml b/data_model/master/device_types/DoorLockController.xml index 64d26eba8d8eeb..101dc46f5ccd40 100644 --- a/data_model/master/device_types/DoorLockController.xml +++ b/data_model/master/device_types/DoorLockController.xml @@ -57,8 +57,8 @@ Davis, CA 95616, USA --> - - + + diff --git a/data_model/master/device_types/EVSE.xml b/data_model/master/device_types/EVSE.xml index a6a1e3854c88eb..d468cb8a180f22 100644 --- a/data_model/master/device_types/EVSE.xml +++ b/data_model/master/device_types/EVSE.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/ElectricalSensor.xml b/data_model/master/device_types/ElectricalSensor.xml index 62c6dd9b4128b2..75c4b0bb7cbbed 100644 --- a/data_model/master/device_types/ElectricalSensor.xml +++ b/data_model/master/device_types/ElectricalSensor.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/EnergyTariff.xml b/data_model/master/device_types/EnergyTariff.xml index bf27554ff281db..887bfa420d8fd8 100644 --- a/data_model/master/device_types/EnergyTariff.xml +++ b/data_model/master/device_types/EnergyTariff.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/EnergyTariffCalendar.xml b/data_model/master/device_types/EnergyTariffCalendar.xml index ee3a6b9347db38..70d74b7239f41c 100644 --- a/data_model/master/device_types/EnergyTariffCalendar.xml +++ b/data_model/master/device_types/EnergyTariffCalendar.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/ExtendedColorLight.xml b/data_model/master/device_types/ExtendedColorLight.xml index b4057d6b5bc997..0678094669459f 100644 --- a/data_model/master/device_types/ExtendedColorLight.xml +++ b/data_model/master/device_types/ExtendedColorLight.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/ExtractorHood.xml b/data_model/master/device_types/ExtractorHood.xml index 6606b377f47a39..3e8064adb149f4 100644 --- a/data_model/master/device_types/ExtractorHood.xml +++ b/data_model/master/device_types/ExtractorHood.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/Fan.xml b/data_model/master/device_types/Fan.xml index 8bf8347e93c5b0..e5184cfe22aec7 100644 --- a/data_model/master/device_types/Fan.xml +++ b/data_model/master/device_types/Fan.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/FlowSensor.xml b/data_model/master/device_types/FlowSensor.xml index bcc27b318aac36..6a9023060e12f9 100644 --- a/data_model/master/device_types/FlowSensor.xml +++ b/data_model/master/device_types/FlowSensor.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/GenericSwitch.xml b/data_model/master/device_types/GenericSwitch.xml index acfa0a95005291..b8bc394b96e2e8 100644 --- a/data_model/master/device_types/GenericSwitch.xml +++ b/data_model/master/device_types/GenericSwitch.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/HeatPump.xml b/data_model/master/device_types/HeatPump.xml index ae0ce0e9a4d30a..61f556c6ed2a9b 100644 --- a/data_model/master/device_types/HeatPump.xml +++ b/data_model/master/device_types/HeatPump.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/HumidifierDehumidifier.xml b/data_model/master/device_types/HumidifierDehumidifier.xml index a917cbff4450f0..973919635fb4ae 100644 --- a/data_model/master/device_types/HumidifierDehumidifier.xml +++ b/data_model/master/device_types/HumidifierDehumidifier.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + \ No newline at end of file diff --git a/data_model/master/device_types/HumiditySensor.xml b/data_model/master/device_types/HumiditySensor.xml index 4a1808d7e0c580..c6def400a2a6bb 100644 --- a/data_model/master/device_types/HumiditySensor.xml +++ b/data_model/master/device_types/HumiditySensor.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/JointFabricAdmin.xml b/data_model/master/device_types/JointFabricAdmin.xml index eb57fad58127a4..7d29cbba1305d5 100644 --- a/data_model/master/device_types/JointFabricAdmin.xml +++ b/data_model/master/device_types/JointFabricAdmin.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/LaundryDryer.xml b/data_model/master/device_types/LaundryDryer.xml index d4692c7ad818a5..36dc182c393bd7 100644 --- a/data_model/master/device_types/LaundryDryer.xml +++ b/data_model/master/device_types/LaundryDryer.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/LaundryWasher.xml b/data_model/master/device_types/LaundryWasher.xml index 03b85f3bd363b4..d88ee7e9fd94ca 100644 --- a/data_model/master/device_types/LaundryWasher.xml +++ b/data_model/master/device_types/LaundryWasher.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/LightSensor.xml b/data_model/master/device_types/LightSensor.xml index 0eca130f921623..e7200e347726aa 100644 --- a/data_model/master/device_types/LightSensor.xml +++ b/data_model/master/device_types/LightSensor.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/MicrowaveOven.xml b/data_model/master/device_types/MicrowaveOven.xml index 3ae1fd8d5bf22d..98d2902d049610 100644 --- a/data_model/master/device_types/MicrowaveOven.xml +++ b/data_model/master/device_types/MicrowaveOven.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/ModeSelectDeviceType.xml b/data_model/master/device_types/ModeSelectDeviceType.xml index 7848ba0adc787f..ad4cf56671243b 100644 --- a/data_model/master/device_types/ModeSelectDeviceType.xml +++ b/data_model/master/device_types/ModeSelectDeviceType.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/MountedDimmableLoadControl.xml b/data_model/master/device_types/MountedDimmableLoadControl.xml new file mode 100644 index 00000000000000..2527eb6aaefcd2 --- /dev/null +++ b/data_model/master/device_types/MountedDimmableLoadControl.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/master/device_types/MountedOnOffControl.xml b/data_model/master/device_types/MountedOnOffControl.xml new file mode 100644 index 00000000000000..1be3cf746418aa --- /dev/null +++ b/data_model/master/device_types/MountedOnOffControl.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/master/device_types/NetworkInfraManager.xml b/data_model/master/device_types/NetworkInfraManager.xml index 800ca8ce10ace6..58cbae2e7ab440 100644 --- a/data_model/master/device_types/NetworkInfraManager.xml +++ b/data_model/master/device_types/NetworkInfraManager.xml @@ -57,12 +57,12 @@ Davis, CA 95616, USA --> - + - + diff --git a/data_model/master/device_types/OccupancySensor.xml b/data_model/master/device_types/OccupancySensor.xml index 233d04f196e388..f257bab38a7686 100644 --- a/data_model/master/device_types/OccupancySensor.xml +++ b/data_model/master/device_types/OccupancySensor.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/OnOffLight.xml b/data_model/master/device_types/OnOffLight.xml index f71c0bf77fa42c..c74f5f79000919 100644 --- a/data_model/master/device_types/OnOffLight.xml +++ b/data_model/master/device_types/OnOffLight.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/OnOffLightSwitch.xml b/data_model/master/device_types/OnOffLightSwitch.xml index d6ac7f79520d26..0cfa5ba7a3702c 100644 --- a/data_model/master/device_types/OnOffLightSwitch.xml +++ b/data_model/master/device_types/OnOffLightSwitch.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/OnOffPlug-inUnit.xml b/data_model/master/device_types/OnOffPlug-inUnit.xml index 3be1ed0f9eb13d..946f7919516e2d 100644 --- a/data_model/master/device_types/OnOffPlug-inUnit.xml +++ b/data_model/master/device_types/OnOffPlug-inUnit.xml @@ -55,9 +55,9 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + - + diff --git a/data_model/master/device_types/OnOffSensor.xml b/data_model/master/device_types/OnOffSensor.xml index 935a438fb0bbef..0fc76f8314a6b5 100644 --- a/data_model/master/device_types/OnOffSensor.xml +++ b/data_model/master/device_types/OnOffSensor.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/OtaProvider.xml b/data_model/master/device_types/OtaProvider.xml index 375ab4e36aa987..b148d27ebb74e5 100644 --- a/data_model/master/device_types/OtaProvider.xml +++ b/data_model/master/device_types/OtaProvider.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/OtaRequestor.xml b/data_model/master/device_types/OtaRequestor.xml index 840e322bdccb72..d782ee992c454b 100644 --- a/data_model/master/device_types/OtaRequestor.xml +++ b/data_model/master/device_types/OtaRequestor.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/Oven.xml b/data_model/master/device_types/Oven.xml index 9c5d23e86afda7..d34bc4c52bfbb6 100644 --- a/data_model/master/device_types/Oven.xml +++ b/data_model/master/device_types/Oven.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/PowerSource.xml b/data_model/master/device_types/PowerSource.xml index 9ed71e905535bd..4e6c6defabccf9 100644 --- a/data_model/master/device_types/PowerSource.xml +++ b/data_model/master/device_types/PowerSource.xml @@ -58,7 +58,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/device_types/PressureSensor.xml b/data_model/master/device_types/PressureSensor.xml index f2b7855db91c83..5b7ef86c25cc3d 100644 --- a/data_model/master/device_types/PressureSensor.xml +++ b/data_model/master/device_types/PressureSensor.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/Pump.xml b/data_model/master/device_types/Pump.xml index 461725136abaec..a39cd97b87e7ad 100644 --- a/data_model/master/device_types/Pump.xml +++ b/data_model/master/device_types/Pump.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/PumpController.xml b/data_model/master/device_types/PumpController.xml index 99acf1fa1c5757..25e9a8e982b5ff 100644 --- a/data_model/master/device_types/PumpController.xml +++ b/data_model/master/device_types/PumpController.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/RainSensor.xml b/data_model/master/device_types/RainSensor.xml index 473de6e31d1598..a03060c5415dc0 100644 --- a/data_model/master/device_types/RainSensor.xml +++ b/data_model/master/device_types/RainSensor.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/Refrigerator.xml b/data_model/master/device_types/Refrigerator.xml index 4899906c3b985e..c8bdf86e3ef737 100644 --- a/data_model/master/device_types/Refrigerator.xml +++ b/data_model/master/device_types/Refrigerator.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/RoboticVacuumCleaner.xml b/data_model/master/device_types/RoboticVacuumCleaner.xml index 2657a560109829..fd30668cd2e084 100644 --- a/data_model/master/device_types/RoboticVacuumCleaner.xml +++ b/data_model/master/device_types/RoboticVacuumCleaner.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/RoomAirConditioner.xml b/data_model/master/device_types/RoomAirConditioner.xml index 305a893dabc0fe..e2b3061a42b515 100644 --- a/data_model/master/device_types/RoomAirConditioner.xml +++ b/data_model/master/device_types/RoomAirConditioner.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/RootNodeDeviceType.xml b/data_model/master/device_types/RootNodeDeviceType.xml index 875a633f9ba9b8..c96759503bfb13 100644 --- a/data_model/master/device_types/RootNodeDeviceType.xml +++ b/data_model/master/device_types/RootNodeDeviceType.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -123,7 +123,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/device_types/SecondaryNetworkInterface.xml b/data_model/master/device_types/SecondaryNetworkInterface.xml index 186faac2718079..8217aea71529d0 100644 --- a/data_model/master/device_types/SecondaryNetworkInterface.xml +++ b/data_model/master/device_types/SecondaryNetworkInterface.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -69,7 +69,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/master/device_types/SmokeCOAlarm.xml b/data_model/master/device_types/SmokeCOAlarm.xml index 518809d449e35a..769e6f5f91bbe1 100644 --- a/data_model/master/device_types/SmokeCOAlarm.xml +++ b/data_model/master/device_types/SmokeCOAlarm.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/SolarPower.xml b/data_model/master/device_types/SolarPower.xml index 743da25e7a9a20..7556fb519a685d 100644 --- a/data_model/master/device_types/SolarPower.xml +++ b/data_model/master/device_types/SolarPower.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/Speaker.xml b/data_model/master/device_types/Speaker.xml index d1d9d85beb84c8..d3f9b1166e4458 100644 --- a/data_model/master/device_types/Speaker.xml +++ b/data_model/master/device_types/Speaker.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/TemperatureControlledCabinet.xml b/data_model/master/device_types/TemperatureControlledCabinet.xml index 299037e145d901..68788e22d7db06 100644 --- a/data_model/master/device_types/TemperatureControlledCabinet.xml +++ b/data_model/master/device_types/TemperatureControlledCabinet.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/TemperatureSensor.xml b/data_model/master/device_types/TemperatureSensor.xml index d6ccd5c18db89f..bf3221858dc103 100644 --- a/data_model/master/device_types/TemperatureSensor.xml +++ b/data_model/master/device_types/TemperatureSensor.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/Thermostat.xml b/data_model/master/device_types/Thermostat.xml index 6acdf63b10eba0..dfc55d628a5b6e 100644 --- a/data_model/master/device_types/Thermostat.xml +++ b/data_model/master/device_types/Thermostat.xml @@ -55,11 +55,12 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + - + + @@ -72,60 +73,27 @@ Davis, CA 95616, USA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + - - - - + + - - - - + + diff --git a/data_model/master/device_types/ThreadBorderRouter.xml b/data_model/master/device_types/ThreadBorderRouter.xml index 73561999d60eba..abe38a81396cd6 100644 --- a/data_model/master/device_types/ThreadBorderRouter.xml +++ b/data_model/master/device_types/ThreadBorderRouter.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/VideoRemoteControl.xml b/data_model/master/device_types/VideoRemoteControl.xml index 7896a6f6ee6be5..de83b02508a89f 100644 --- a/data_model/master/device_types/VideoRemoteControl.xml +++ b/data_model/master/device_types/VideoRemoteControl.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/WaterFreezeDetector.xml b/data_model/master/device_types/WaterFreezeDetector.xml index f3c5f0580af21f..b2f4a49a7847e4 100644 --- a/data_model/master/device_types/WaterFreezeDetector.xml +++ b/data_model/master/device_types/WaterFreezeDetector.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/WaterHeater.xml b/data_model/master/device_types/WaterHeater.xml index 6e80928d792cfc..9d038d89c55563 100644 --- a/data_model/master/device_types/WaterHeater.xml +++ b/data_model/master/device_types/WaterHeater.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/WaterLeakDetector.xml b/data_model/master/device_types/WaterLeakDetector.xml index 0518d148910c78..7277ce69908fb6 100644 --- a/data_model/master/device_types/WaterLeakDetector.xml +++ b/data_model/master/device_types/WaterLeakDetector.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/WaterValve.xml b/data_model/master/device_types/WaterValve.xml index 5c65f4565f6746..21b77edf5fc614 100644 --- a/data_model/master/device_types/WaterValve.xml +++ b/data_model/master/device_types/WaterValve.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + diff --git a/data_model/master/device_types/WindowCovering.xml b/data_model/master/device_types/WindowCovering.xml index a2d54453b7337f..a2e16beba60ee1 100644 --- a/data_model/master/device_types/WindowCovering.xml +++ b/data_model/master/device_types/WindowCovering.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -75,15 +75,6 @@ Davis, CA 95616, USA - - - - - - - - - diff --git a/data_model/master/device_types/WindowCoveringController.xml b/data_model/master/device_types/WindowCoveringController.xml index c48f327754c599..189fee3d9d6303 100644 --- a/data_model/master/device_types/WindowCoveringController.xml +++ b/data_model/master/device_types/WindowCoveringController.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA --> - + @@ -78,15 +78,6 @@ Davis, CA 95616, USA - - - - - - - - - diff --git a/data_model/master/scraper_version b/data_model/master/scraper_version index e8ea05db81420d..c813fe116c9f9e 100644 --- a/data_model/master/scraper_version +++ b/data_model/master/scraper_version @@ -1 +1 @@ -1.2.4 +1.2.5 diff --git a/data_model/master/spec_sha b/data_model/master/spec_sha index f0b38ddc8c8aac..16b2cbb1caa026 100644 --- a/data_model/master/spec_sha +++ b/data_model/master/spec_sha @@ -1 +1 @@ -b3652909bdf595c7634cea1da0f1e58f837ea35f +12e2fa3014b316b202eed892cb50dec7b6851d8e diff --git a/docs/getting_started/SDKBasics.md b/docs/getting_started/SDKBasics.md index fee03ae7cd484d..7f2c81f285fceb 100644 --- a/docs/getting_started/SDKBasics.md +++ b/docs/getting_started/SDKBasics.md @@ -58,7 +58,7 @@ logic is handled in the run-time installed interface layers. - examples - [examples/chip-tool](https://github.com/project-chip/connectedhomeip/blob/master/examples/chip-tool) - main controller example - - [examples/all-clusters-app](https://github.com/project-chip/connectedhomeip/blob/master/examples/all-cluster-app) - + - [examples/all-clusters-app](https://github.com/project-chip/connectedhomeip/blob/master/examples/all-clusters-app) - QA app - [examples/\](https://github.com/project-chip/connectedhomeip/blob/master/examples) - Specific Device examples diff --git a/docs/guides/esp32/config_options.md b/docs/guides/esp32/config_options.md index 646e725daa9d1e..6dc94b814b8335 100644 --- a/docs/guides/esp32/config_options.md +++ b/docs/guides/esp32/config_options.md @@ -11,3 +11,18 @@ Configure below options through `idf.py menuconfig` and build the app. CONFIG_DISABLE_IPV4=y CONFIG_LWIP_IPV4=n ``` + +### Executable component not in "main" component + +The ESP-IDF framework allows renaming the main component, which can be useful if +you want to place the app_main() function in a different component. + +For required changes in the executable component, please refer to the +[esp-idf documentation](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/build-system.html#renaming-main-component). + +If you're building applications that support Matter and want to place app_main() +in a component other than main, use the following command: + +``` +idf.py -DEXECUTABLE_COMPONENT_NAME="your_component" build +``` diff --git a/docs/guides/esp32/providers.md b/docs/guides/esp32/providers.md index 5174e1ccaceb11..59b91b624a49fc 100644 --- a/docs/guides/esp32/providers.md +++ b/docs/guides/esp32/providers.md @@ -15,6 +15,8 @@ Below are the providers that have been implemented: - [Device Info Provider](https://github.com/project-chip/connectedhomeip/blob/master/src/platform/ESP32/ESP32DeviceInfoProvider.h#L31) This provider provides fixed labels, supported calendar types, and supported locales from the factory partition. +- [Supported Modes](https://github.com/project-chip/connectedhomeip/blob/master/examples/platform/esp32/mode-support/static-supported-modes-manager.h#L28) + This provider offers the supported modes for the mode-select cluster. More information can be found in the [factory data guide](factory_data.md). diff --git a/docs/guides/esp32/setup_idf_chip.md b/docs/guides/esp32/setup_idf_chip.md index 5a6728c44d8417..035964bdfab1b5 100644 --- a/docs/guides/esp32/setup_idf_chip.md +++ b/docs/guides/esp32/setup_idf_chip.md @@ -13,25 +13,25 @@ step. ### Install Prerequisites -- [Linux](https://docs.espressif.com/projects/esp-idf/en/v5.1.2/esp32/get-started/linux-macos-setup.html#for-linux-users) -- [macOS](https://docs.espressif.com/projects/esp-idf/en/v5.1.2/esp32/get-started/linux-macos-setup.html#for-macos-users) +- [Linux](https://docs.espressif.com/projects/esp-idf/en/v5.3/esp32/get-started/linux-macos-setup.html#for-linux-users) +- [macOS](https://docs.espressif.com/projects/esp-idf/en/v5.3/esp32/get-started/linux-macos-setup.html#for-macos-users) ### Get IDF v5.1.2 -- Clone ESP-IDF [v5.1.2 - release](https://github.com/espressif/esp-idf/releases/tag/v5.1.2 +- Clone ESP-IDF [v5.3 + release](https://github.com/espressif/esp-idf/releases/tag/v5.3 ``` - git clone -b v5.1.2 --recursive --depth 1 --shallow-submodule https://github.com/espressif/esp-idf.git + git clone -b v5.3 --recursive --depth 1 --shallow-submodule https://github.com/espressif/esp-idf.git cd esp-idf ./install.sh ``` -- To update an existing esp-idf toolchain to v5.1.2: +- To update an existing esp-idf toolchain to v5.3: ``` cd path/to/esp-idf - git fetch --depth 1 origin v5.1.2 + git fetch --depth 1 origin v5.3 git reset --hard FETCH_HEAD git submodule update --depth 1 --recursive --init diff --git a/docs/guides/fabric_synchronization_guide.md b/docs/guides/fabric_synchronization_guide.md new file mode 100644 index 00000000000000..1b545ce36ead27 --- /dev/null +++ b/docs/guides/fabric_synchronization_guide.md @@ -0,0 +1,185 @@ +# Fabric Synchronization Guide + +- [Fabric Synchronization Guide](#fabric-synchronization-guide) + - [Fabric Sync Example Applications](#fabric-sync-example-applications) + - [Run Fabric Sync Demo on RP4](#run-fabric-sync-demo-on-rp4) + +## Fabric Sync Example Applications + +Fabric-Admin and Fabric-Bridge example applications are provided to demonstrate +Fabric Synchronization feature. You can find them in the examples. + +![matter_fabric_synchronization](images/matter_fabric_synchronization.png) + +Fabric-Admin example app implements the Fabric Administrator role and +communicates with the Fabric-Bridge-App on the other side, facilitating the +Fabric Synchronization process. + +Fabric-Bridge-App example app implements the Aggregator device type with Fabric +Synchronization condition met and demonstrates the end-to-end Fabric +Synchronization feature using dynamic endpoints. + +The Fabric-Admin and Fabric-Bridge-App example applications must be executed on +the same physical device and communicate with each other using RPC. + +Fabric Synchronization can be triggered from either side. The initiator of the +Fabric Synchronization process, who shares their devices, takes on the +Commissioner role. The recipient of the Fabric Synchronization request, who +receives the shared devices, assumes the Commissionee role. This flexibility +enables a seamless and efficient synchronization process. + +### Building the Example Application + +- Building the Fabric-Admin Application + + [Fabric-Admin](https://github.com/project-chip/connectedhomeip/tree/master/examples/fabric-admin/README.md) + +* Building the Fabric-Bridge Application + + [Fabric-Bridge](https://github.com/project-chip/connectedhomeip/tree/master/examples/fabric-bridge-app/linux/README.md) + +## Run Fabric Sync Demo on RP4 + +### Setup Fabric Source + +Connect to the Fabric Source server: + +``` +ssh ubuntu@xxx.xxx.xxx.xxx +``` + +Password: + +Run the Fabric Source script: + +``` +./run_fabric_source.sh +``` + +### Setup Fabric Sink + +Connect to the Fabric Sink server: + +``` +ssh ubuntu@xxx.xxx.xxx.xxx +``` + +Password: + +Run the Fabric Sink script: + +``` +./run_fabric_sink.sh +``` + +### Fabric Sync Setup + +Enable Fabric Auto Sync: + +In Fabric-Sync console: + +``` +fabricsync enable-auto-sync 1 +``` + +Pair the Fabric-Source bridge to Fabric-Sync with node ID 1: + +``` +fabricsync add-bridge 1 +``` + +### Pair Light Example to Fabric-Source + +Since Fabric-Bridge also functions as a Matter server, running it alongside the +Light Example app on the same machine would cause conflicts. Therefore, you need +to run the Matter Light Example app on a separate physical machine from the one +hosting Fabric-Admin and Fabric-Bridge. You can then commission the Matter Light +Example app using Fabric-Admin on the source side. + +There is a workaround to avoid conflicts when running multiple Matter server +applications on the same machine, you can use different ports and unique +Key-Value Store (KVS) paths for each app. Here's an example of how to launch a +Light App with custom settings: + +Light App with yet another set of different discriminator/passcode, ports and +KVS + +``` +./out/linux-x64-light-clang/chip-lighting-app --discriminator 3843 --passcode 20202023 --secured-device-port 5543 --unsecured-commissioner-port 5553 --KVS /tmp/chip_kvs_lighting_app +``` + +Pair the Light Example with node ID 3 using its payload number: + +``` +pairing already-discovered 3 20202021 5540 +``` + +After the Light Example is successfully paired in Fabric-Source, it will be +synced to Fabric-Sink with a new assigned node ID. + +Toggle the Light Example: + +From Fabric-Source: + +``` +onoff on 1 +onoff off 1 +``` + +From Fabric-Sink: (Use the node ID assigned) + +``` +onoff on x 1 +onoff off x 1 +``` + +### Remove Light Example from Fabric-Source + +Unpair the Light Example: + +``` +pairing unpair +``` + +After the Light Example is successfully unpaired from Fabric-Source, it will +also be removed from the Fabric-Sink. + +### Pair Commercial Switch to Fabric-Source + +Pair the switch using its payload number: + +In Fabric-Source console: + +``` +pairing code-wifi +``` + +After the switch is successfully paired in Fabric-Source, it will be synced to +Fabric-Sink with a new assigned node ID. + +Toggle the switch: + +From Fabric-Source: + +``` +onoff on 1 +onoff off 1 +``` + +From Fabric-Sink: (Use the node ID assigned) + +``` +onoff on 1 +onoff off 1 +``` + +### Remove Switch from Fabric-Source + +Unpair the switch: + +``` +pairing unpair +``` + +After the switch is successfully unpaired from Fabric-Source, it will also be +removed from the Fabric-Sink. diff --git a/docs/guides/images/matter_fabric_synchronization.png b/docs/guides/images/matter_fabric_synchronization.png new file mode 100644 index 00000000000000..95c99c4fe150b9 Binary files /dev/null and b/docs/guides/images/matter_fabric_synchronization.png differ diff --git a/docs/guides/infineon_psoc6_software_update.md b/docs/guides/infineon_psoc6_software_update.md index 4367142b79e4d8..e7e4f535be4d6a 100644 --- a/docs/guides/infineon_psoc6_software_update.md +++ b/docs/guides/infineon_psoc6_software_update.md @@ -25,7 +25,7 @@ Infineon PSoC6 example applications by passing the ``` $ scripts/build/build_examples.py --enable-flashbundle --target infineon-psoc6-lock-ota build - $ third_party/infineon/psoc6/psoc6_sdk/ota/ota_base_build.sh out/infineon-psoc6-lock-ota chip-psoc6-lock-example + $ third_party/infineon/psoc6/psoc6_sdk/ota/ota_base_build.sh psoc6-lock chip-psoc6-lock-example ``` - Build the PSoC6 OTA Update application from the chip root dir and create OTA @@ -33,15 +33,22 @@ Infineon PSoC6 example applications by passing the ``` $ scripts/build/build_examples.py --enable-flashbundle --no-log-timestamps --target infineon-psoc6-lock-ota-updateimage build - $ third_party/infineon/psoc6/psoc6_sdk/ota/ota_update_build.sh out/infineon-psoc6-lock-ota-updateimage chip-psoc6-lock-example + $ third_party/infineon/psoc6/psoc6_sdk/ota/ota_update_build.sh psoc6-lock chip-psoc6-lock-example ``` -* Additionally a pre-compiled bootloader must be flashed to the board using +* Additionally a pre-compiled bootloader must be flashed to the board before + flashing the application using [Cypress Programmer](https://softwaretools.infineon.com/tools/com.ifx.tb.tool.cypressprogrammer). This image can be found at: $ ./third_party/infineon/psoc6/psoc6_sdk/ota/matter-psoc6-mcuboot-bootloader.hex +* Flash the application after putting the CY8CKIT-062S2-43012 board on + KitProg3 CMSIS-DAP Mode by pressing the `MODE SELECT` button. + + $ cd ~/connectedhomeip + $ python3 out/infineon-psoc6-lock-ota/chip-psoc6-lock-example.flash.py + * In a terminal start the Provider app passing to it the path to the Matter OTA file created in the previous step:(output of ota_update_build step) diff --git a/docs/guides/nrfconnect_examples_software_update.md b/docs/guides/nrfconnect_examples_software_update.md index ebaf08f46a587f..9fc1f6e6e5bd3e 100644 --- a/docs/guides/nrfconnect_examples_software_update.md +++ b/docs/guides/nrfconnect_examples_software_update.md @@ -49,8 +49,8 @@ To test the DFU over Matter, you need to complete the following steps: 4. Run OTA Provider application with _matter.ota_ replaced with the path to the Matter OTA image which you wish to provide to the Matter device. Note that - the Matter OTA image is, by default, generated at _zephyr/matter.ota_ in the - example's build directory: + the Matter OTA image is, by default, generated in the example's build + directory: ``` $ out/provider/chip-ota-provider-app -f matter.ota @@ -180,10 +180,11 @@ Complete the following steps to perform DFU using mcumgr: that the Bluetooth LE advertising has started. See the user interface section in the example documentation to check the LED number. 4. Upload the application firmware image to the device by running the following - command in your example directory: + command in your example directory with the replaced by + your application name, for example `lock`: ``` - sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image upload build/zephyr/app_update.bin -n 0 -w 1 + sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image upload build//zephyr/zephyr.signed.bin -n 0 -w 1 ``` The operation can take a few minutes. Wait until the progress bar reaches @@ -246,10 +247,11 @@ Complete the following steps to perform DFU using mcumgr: go straight to the step 8. a. Upload the network core firmware image to the device by running the - following command in your example directory: + following command in your example directory with the + replaced by your network image name, for example `ipc_radio`: ``` - sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image upload build/zephyr/net_core_app_update.bin -n 1 -w 1 + sudo mcumgr --conntype ble --hci ble-hci-number --connstring peer_name='ble-device-name' image upload build/signed_by_mcuboot_and_b0_.bin -n 1 -w 1 ``` The operation can take a few minutes. Wait until the progress bar reaches diff --git a/docs/guides/nrfconnect_factory_data_configuration.md b/docs/guides/nrfconnect_factory_data_configuration.md index 212963d5266b66..27595e2888d616 100644 --- a/docs/guides/nrfconnect_factory_data_configuration.md +++ b/docs/guides/nrfconnect_factory_data_configuration.md @@ -635,7 +635,7 @@ For example, the build command for the nRF52840 DK could look like this: ``` $ west build -b nrf52840dk_nrf52840 -- \ -DCONFIG_CHIP_FACTORY_DATA=y \ --DCONFIG_CHIP_FACTORY_DATA_BUILD=y \ +-DSB_CONFIG_MATTER_FACTORY_DATA_GENERATE=y \ -DCONFIG_CHIP_FACTORY_DATA_GENERATE_ONBOARDING_CODES=y ``` @@ -760,13 +760,13 @@ $ python scripts/tools/nrfconnect/nrfconnect_generate_partition.py -h **Example of the command for the nRF52840 DK:** ``` -$ python scripts/tools/nrfconnect/nrfconnect_generate_partition.py -i build/zephyr/factory_data.json -o build/zephyr/factory_data --offset 0xfb000 --size 0x1000 +$ python scripts/tools/nrfconnect/nrfconnect_generate_partition.py -i build/light_bulb/zephyr/factory_data.json -o build/light_bulb/zephyr/factory_data --offset 0xfb000 --size 0x1000 ``` As a result, `factory_data.hex` and `factory_data.bin` files are created in the -`/build/zephyr/` directory. The first file contains the memory offset. For this -reason, it can be programmed directly to the device using a programmer (for -example, `nrfjprog`). +`/build/light_bulb/zephyr/` directory. The first file contains the memory +offset. For this reason, it can be programmed directly to the device using a +programmer (for example, `nrfjprog`).
@@ -783,11 +783,11 @@ directory and build the example with the following option (replace `nrf52840dk_nrf52840` with your board name): ``` -$ west build -b nrf52840dk_nrf52840 -- -DCONFIG_CHIP_FACTORY_DATA=y -DCONFIG_CHIP_FACTORY_DATA_BUILD=y +$ west build -b nrf52840dk_nrf52840 -- -DCONFIG_CHIP_FACTORY_DATA=y -DSB_CONFIG_MATTER_FACTORY_DATA_GENERATE=y ``` -Alternatively, you can also add `CONFIG_CHIP_FACTORY_DATA_BUILD=y` Kconfig -setting to the example's `prj.conf` file. +Alternatively, you can also add `SB_CONFIG_MATTER_FACTORY_DATA_GENERATE=y` +Kconfig setting to the example's `sysbuild.conf` file. Each factory data parameter has a default value. These are described in the [Kconfig file](../../config/nrfconnect/chip-module/Kconfig). Setting a new value @@ -802,7 +802,7 @@ them as an additional option for the west command. For example (replace `nrf52840dk_nrf52840` with own board name): ``` -$ west build -b nrf52840dk_nrf52840 -- -DCONFIG_CHIP_FACTORY_DATA=y --DCONFIG_CHIP_FACTORY_DATA_BUILD=y --DCONFIG_CHIP_DEVICE_DISCRIMINATOR=0xF11 +$ west build -b nrf52840dk_nrf52840 -- -DCONFIG_CHIP_FACTORY_DATA=y --DSB_CONFIG_MATTER_FACTORY_DATA_GENERATE=y --DCONFIG_CHIP_DEVICE_DISCRIMINATOR=0xF11 ``` Alternatively, you can add the relevant Kconfig option lines to the example's @@ -916,32 +916,32 @@ $ nrfjprog --family NRF52 --program factory_data.hex ``` > Note: For more information about how to use the `nrfjprog` utility, visit -> [Nordic Semiconductor's Infocenter](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_nrf_cltools%2FUG%2Fcltools%2Fnrf_nrfjprogexe.html). +> [Programming SoCs with nrfjprog](https://docs.nordicsemi.com/bundle/ug_nrf_cltools/page/UG/cltools/nrf_nrfjprogexe.html) Another way to program the factory data to a device is to use the nRF Connect platform build system described in [Building an example with factory data](#building-an-example-with-factory-data), and build an example with the additional option -`-DCONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=y`: +`-DSB_CONFIG_MATTER_FACTORY_DATA_MERGE_WITH_FIRMWARE=y`: ``` $ west build -b nrf52840dk_nrf52840 -- \ -DCONFIG_CHIP_FACTORY_DATA=y \ --DCONFIG_CHIP_FACTORY_DATA_BUILD=y \ --DCONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=y +-DSB_CONFIG_MATTER_FACTORY_DATA_GENERATE=y \ +-DSB_CONFIG_MATTER_FACTORY_DATA_MERGE_WITH_FIRMWARE=y ``` You can also build an example with auto-generation of new CD, DAC and PAI certificates. The newly generated certificates will be added to factory data set automatically. To generate new certificates disable using default certificates by building an example with the additional option -`-DCHIP_FACTORY_DATA_USE_DEFAULT_CERTS=n`: +`-DCONFIG_CHIP_FACTORY_DATA_USE_DEFAULT_CERTS=n`: ``` $ west build -b nrf52840dk_nrf52840 -- \ -DCONFIG_CHIP_FACTORY_DATA=y \ --DCONFIG_CHIP_FACTORY_DATA_BUILD=y \ --DCONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=y \ +-DSB_CONFIG_MATTER_FACTORY_DATA_GENERATE=y \ +-DSB_CONFIG_MATTER_FACTORY_DATA_MERGE_WITH_FIRMWARE=y \ -DCONFIG_CHIP_FACTORY_DATA_USE_DEFAULT_CERTS=n ``` diff --git a/docs/guides/openiotsdk_unit_tests.md b/docs/guides/openiotsdk_unit_tests.md index 7560d4dbd959a2..c255129e0aed61 100644 --- a/docs/guides/openiotsdk_unit_tests.md +++ b/docs/guides/openiotsdk_unit_tests.md @@ -20,13 +20,14 @@ The list of currently supported Matter's component tests: ``` accesstest +AppDataModelTests AppTests ASN1Tests BDXTests ChipCryptoTests +ControllerDataModelTests CoreTests CredentialsTest -DataModelTests ICDServerTests InetLayerTests MdnsTests diff --git a/docs/spec_clusters.md b/docs/spec_clusters.md index 976b9f85e42c19..05bd215fe583dc 100644 --- a/docs/spec_clusters.md +++ b/docs/spec_clusters.md @@ -7,7 +7,6 @@ This file was **AUTOMATICALLY** generated by `python scripts/generate_spec_xml.p |4 |0x0004 |Groups | |6 |0x0006 |On/Off | |8 |0x0008 |Level Control | -|28 |0x001C |Pulse Width Modulation | |29 |0x001D |Descriptor | |30 |0x001E |Binding | |31 |0x001F |AccessControl | @@ -26,7 +25,7 @@ This file was **AUTOMATICALLY** generated by `python scripts/generate_spec_xml.p |51 |0x0033 |General Diagnostics | |52 |0x0034 |Software Diagnostics | |53 |0x0035 |Thread Network Diagnostics | -|54 |0x0036 |Wi | +|54 |0x0036 |Wi-Fi Network Diagnostics | |55 |0x0037 |Ethernet Network Diagnostics | |56 |0x0038 |Time Synchronization | |57 |0x0039 |Bridged Device Basic Information | @@ -63,23 +62,31 @@ This file was **AUTOMATICALLY** generated by `python scripts/generate_spec_xml.p |98 |0x0062 |Scenes Management | |113 |0x0071 |HEPA Filter Monitoring | |114 |0x0072 |Activated Carbon Filter Monitoring | +|121 |0x0079 |Water Tank Level Monitoring | |128 |0x0080 |Boolean State Configuration | |129 |0x0081 |Valve Configuration and Control | |144 |0x0090 |Electrical Power Measurement | |145 |0x0091 |Electrical Energy Measurement | +|148 |0x0094 |Water Heater Management | +|149 |0x0095 |Energy Price | +|150 |0x0096 |Demand Response Load Control | |151 |0x0097 |Messages | |152 |0x0098 |Device Energy Management | |153 |0x0099 |Energy EVSE | +|154 |0x009A |Energy Calendar | |155 |0x009B |Energy Preference | |156 |0x009C |Power Topology | |157 |0x009D |Energy EVSE Mode | +|158 |0x009E |Water Heater Mode | |159 |0x009F |Device Energy Management Mode | |257 |0x0101 |Door Lock | |258 |0x0102 |Window Covering | +|336 |0x0150 |Service Area | |512 |0x0200 |Pump Configuration and Control | |513 |0x0201 |Thermostat | |514 |0x0202 |Fan Control | |516 |0x0204 |Thermostat User Interface Configuration | +|517 |0x0205 |Humidistat | |768 |0x0300 |Color Control | |769 |0x0301 |Ballast Configuration | |1024 |0x0400 |Illuminance Measurement | @@ -92,12 +99,16 @@ This file was **AUTOMATICALLY** generated by `python scripts/generate_spec_xml.p |1037 |0x040D |Carbon Dioxide Concentration Measurement | |1043 |0x0413 |Nitrogen Dioxide Concentration Measurement | |1045 |0x0415 |Ozone Concentration Measurement | -|1066 |0x042A |PM2 | +|1066 |0x042A |PM2.5 Concentration Measurement | |1067 |0x042B |Formaldehyde Concentration Measurement | |1068 |0x042C |PM1 Concentration Measurement | |1069 |0x042D |PM10 Concentration Measurement | |1070 |0x042E |Total Volatile Organic Compounds Concentration Measurement| |1071 |0x042F |Radon Concentration Measurement | +|1104 |0x0450 |Network Identity Management | +|1105 |0x0451 |Wi-Fi Network Management | +|1106 |0x0452 |Thread Border Router Management | +|1107 |0x0453 |Thread Network Directory | |1283 |0x0503 |Wake on LAN | |1284 |0x0504 |Channel | |1285 |0x0505 |Target Navigator | @@ -112,3 +123,5 @@ This file was **AUTOMATICALLY** generated by `python scripts/generate_spec_xml.p |1294 |0x050E |Account Login | |1295 |0x050F |Content Control | |1296 |0x0510 |Content App Observer | +|1872 |0x0750 |Ecosystem Information | +|1873 |0x0751 |Commissioner Control | diff --git a/docs/testing/python.md b/docs/testing/python.md index 06051fee4fb33b..354490c896c445 100644 --- a/docs/testing/python.md +++ b/docs/testing/python.md @@ -24,33 +24,39 @@ Python tests located in src/python_testing essential to define arguments at the top of the test script. This section should include various parameters and their respective values, which will guide the test runner on how to execute the tests. -- All test classes inherit from MatterBaseTest in +- All test classes inherit from `MatterBaseTest` in [matter_testing_support.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_support.py) - - support for commissioning using the python controller - - default controller (self.default_controller) of type ChipDeviceCtrl - - MatterBaseTest inherits from the Mobly BaseTestClass -- Test function(s) (start with test\_) and are all run automatically - - To run in the test harness, the test name must be test_TC_PICSCODE\_#\_# - - more information about integration with the test harness can be + - Support for commissioning using the python controller + - Default controller (`self.default_controller`) of type `ChipDeviceCtrl` + - `MatterBaseTest` inherits from the Mobly BaseTestClass +- Test method(s) (start with test\_) and are all run automatically + - To run in the test harness, the test method name must be + `test_TC_PICSCODE_#_#` + - More information about integration with the test harness can be found in [Test Harness helpers](#test-harness-helpers) section - - any tests that use async function (read / write / commands) should be + - Any tests that use async method (read / write / commands) should be decorated with the @async_test_body decorator -- Use ChipDeviceCtrl to interact with the DUT - - Controller API is in ChipDeviceCtrl.py (see API doc in file) - - some support functions in matter_testing_support.py +- Use `ChipDeviceCtrl` to interact with the DUT + - Controller API is in `ChipDeviceCtrl.py` (see API doc in file) + - Some support methods in `matter_testing_support.py` - Use Mobly assertions for failing tests -- self.step() along with a steps\_ function to mark test plan steps for cert +- `self.step()` along with a `steps_*` method to mark test plan steps for cert tests ### A simple test ``` +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === class TC_MYTEST_1_1(MatterBaseTest): @@ -74,69 +80,19 @@ default_matter_test_main() --- -In this test, asserts.assert_equal is used to fail the test on condition failure -(throws an exception). +In this test, `asserts.assert_equal` is used to fail the test on equality +assertion failure (throws an exception). -Because the test requires the use of the async function -read_single_attribute_check_success, the test is decorated with the +Because the test requires the use of the async method +`read_single_attribute_check_success`, the test is decorated with the `@async_test_body` decorator -The default_matter_test_main() function is used to run the test on the command +The `default_matter_test_main()` function is used to run the test on the command line. These two lines should appear verbatim at the bottom of every python test file. -## Defining the test arguments - -Below is the format: - -``` -# test-runner-runs: -# test-runner-run//app: ${TYPE_OF_APP} -# test-runner-run//factoryreset: -# test-runner-run//quiet: -# test-runner-run//app-args: -# test-runner-run//script-args: -``` - -### Description of Parameters - -- test-runner-runs: Specifies the identifier for the run. This can be any - unique identifier. - - - Example: run1 - -- test-runner-run//app: Indicates the application to be used - in the test. Different app types as needed could be referenced from section - [name: Generate an argument environment file ] of the file - [.github/workflows/tests.yaml](https://github.com/project-chip/connectedhomeip/blob/master/.github/workflows/tests.yaml) - - - Example: \${TYPE_OF_APP} - -- test-runner-run//factoryreset: Determines whether a factory - reset should be performed before the test. - - - Example: True - -- test-runner-run//quiet: Sets the verbosity level of the test - run. When set to True, the test run will be quieter. - - - Example: True - -- test-runner-run//app-args: Specifies the arguments to be - passed to the application during the test. - - - Example: --discriminator 1234 --KVS kvs1 --trace-to - json:\${TRACE_APP}.json - -- test-runner-run//script-args: Specifies the arguments to be - passed to the test script. - - Example: --storage-path admin_storage.json --commissioning-method - on-network --discriminator 1234 --passcode 20202021 --trace-to - json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto - -This structured format ensures that all necessary configurations are clearly -defined and easily understood, allowing for consistent and reliable test -execution. +The structured comments above the class definition are used to set up the CI for +the tests. Please see [Running tests in CI](#running-tests-in-ci). ## Cluster Codegen @@ -156,12 +112,12 @@ always: Each `Clusters.` will include the appropriate sub-classes (if defined for the cluster): -- Enums -- Bitmaps -- Structs -- Attributes -- Commands -- Events +- `Enums` +- `Bitmaps` +- `Structs` +- `Attributes` +- `Commands` +- `Events` ### Attributes @@ -176,42 +132,41 @@ Each `Clusters..Attributes.` class has: Example: -- class - Clusters.OnOff.Attributes.OnTime - - used for Read commands -- instance - Clusters.OnOff.Attributes.OnTime(5) - - sets the value to 5 - - pass the instance to write commands to write the value +- class - `Clusters.OnOff.Attributes.OnTime` + - Used for Read commands +- instance - `Clusters.OnOff.Attributes.OnTime(5)` + - Sets the value to `5` + - Pass the instance to Write method to write the value ### Commands -Commands derive from ClusterCommand +Commands derive from `ClusterCommand`. Each `Clusters..Commands.` class has: -- cluster_id -- command_id -- is_client -- response_type (None for status response) -- descriptor +- `cluster_id` +- `command_id` +- `is_client` +- `response_type` (None for status response) +- `descriptor` - data members (if required) Example: -- Clusters.OnOff.Commands.OnWithTimedOff(onOffControl=0, onTime=5, - offWaitTime=8) -- Clusters.OnOff.Commands.OnWithTimedOff() - - command with no fields +- `Clusters.OnOff.Commands.OnWithTimedOff(onOffControl=0, onTime=5, offWaitTime=8)` +- `Clusters.OnOff.Commands.OnWithTimedOff()` + - Command with no fields ### Events -Events derive from ClusterEvent +Events derive from `ClusterEvent`. Each `Clusters..Events.` class has: -- cluster_id -- event_id -- descriptor -- data members if required +- `cluster_id` +- `event_id` +- `descriptor` +- Other data members if required Example: @@ -219,16 +174,16 @@ Example: ### Enums -Enums derive from MatterIntEnum +Enums derive from `MatterIntEnum`. Each `Clusters..Enum.` has -- k -- kUnknownEnumValue (used for testing, do not transmit) +- `k` constants +- `kUnknownEnumValue` (used for testing, do not transmit) Example: -- Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kAdminister +- `Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kAdminister` ### Bitmaps @@ -238,26 +193,28 @@ Each `Clusters..Bitmaps.` has: - k Special class: -- class Feature(IntFlag) - contains the feature map bitmaps +- class `Feature(IntFlag)` - contains the feature map bitmaps Example: -- Clusters.LaundryWasherControls.Bitmaps.Feature.kSpin +- `Clusters.LaundryWasherControls.Bitmaps.Feature.kSpin` ### Structs -Structs derive from ClusterObject +Structs derive from `ClusterObject`. Each `Clusters..Structs.` has: -- descriptor -- data members +- A "descriptor" +- Data members -Example +Example: -- Clusters.BasicInformation.Structs.ProductAppearanceStruct( -- finish=Clusters.BasicInformation.Enums.ProductFinishEnum.kFabric, -- primaryColor=Clusters.BasicInformation.Enums.ColorEnum.kBlack) +``` +Clusters.BasicInformation.Structs.ProductAppearanceStruct( + finish=Clusters.BasicInformation.Enums.ProductFinishEnum.kFabric, + primaryColor=Clusters.BasicInformation.Enums.ColorEnum.kBlack) +``` ## Accessing Clusters and Cluster Elements by ID @@ -266,14 +223,14 @@ has a set of objects that map ID to the code generated object. `chip.clusters.ClusterObjects.ALL_CLUSTERS` -- dict[int, Cluster] - maps cluster ID to Cluster class -- cluster = chip.clusters.ClusterObjects.ALL_CLUSTERS[cluster_id] +- `dict[int, Cluster]` - maps cluster ID to Cluster class + - `cluster = chip.clusters.ClusterObjects.ALL_CLUSTERS[cluster_id]` `chip.clusters.ClusterObjects.ALL_ATTRIBUTES` -- dict[int, dict[int, ClusterAttributeDescriptor]] - maps cluster ID to a dict - of attribute ID to attribute class -- attr = chip.clusters.ClusterObjects.ALL_ATTRIBUTES[cluster_id][attribute_id] +- `dict[int, dict[int, ClusterAttributeDescriptor]]` - maps cluster ID to a + dict of attribute ID to attribute class + - `attr = chip.clusters.ClusterObjects.ALL_ATTRIBUTES[cluster_id][attribute_id]` `chip.clusters.ClusterObjects.ALL_ACCEPTED_COMMANDS/ALL_GENERATED_COMMANDS` @@ -282,15 +239,15 @@ has a set of objects that map ID to the code generated object. ## ChipDeviceCtrl API -The ChipDeviceCtrl API is implemented in +The `ChipDeviceCtrl` API is implemented in [ChipDeviceCtrl.py](https://github.com/project-chip/connectedhomeip/blob/master/src/controller/python/chip/ChipDeviceCtrl.py). -The ChipDeviceCtrl implements a python-based controller that can be used to +The `ChipDeviceCtrl` implements a python-based controller that can be used to commission and control devices. The API is documented here in the [ChipDeviceCtrl API documentation](./ChipDeviceCtrlAPI.md) The API doc gives full descriptions of the APIs being used. The most commonly -used functions are linked below +used methods are linked below. ### [Read](./ChipDeviceCtrlAPI.md#read) @@ -299,7 +256,7 @@ used functions are linked below ### [ReadAttribute](./ChipDeviceCtrlAPI.md#readattribute) -- convenience wrapper for Read for attributes +- Convenience wrapper for Read for attributes Examples: Wildcard read (all clusters, all endpoints): @@ -323,8 +280,9 @@ Multi-path ### [ReadEvent](./ChipDeviceCtrlAPI.md#readevent) -- convenience wrapper for Read -- Similar to ReadAttribute, but the tuple includes urgency as the last number +- Convenience wrapper for `Read` +- Similar to `ReadAttribute`, but the tuple includes urgency as the last + argument Example: @@ -337,19 +295,19 @@ Clusters.TimeSynchronization.Events.MissingTrustedTimeSource, urgent)]) ### Subscriptions -Subscriptions are handled in the Read / ReadAttribute / ReadEvent APIs. To -initiate a subscription, set the `reportInterval` tuple to set the floor and -ceiling. The `keepSubscriptions` and `autoResubscribe` parameters also apply to -subscriptions. +Subscriptions are handled in the `Read` / `ReadAttribute` / `ReadEvent` APIs. To +initiate a subscription, set the `reportInterval` tuple argument to set the +floor and ceiling. The `keepSubscriptions` and `autoResubscribe` arguments also +apply to subscriptions. Subscription return `ClusterAttribute.SubscriptionTransaction`. This can be used to set callbacks. The object is returned after the priming data read is complete, and the values there are used to populate the cache. The attribute callbacks are called on update. -- SetAttributeUpdateCallback +- `SetAttributeUpdateCallback` - Callable[[TypedAttributePath, SubscriptionTransaction], None] -- SetEventUpdateCallback +- `SetEventUpdateCallback` - Callable[[EventReadResult, SubscriptionTransaction], None] - await changes in the main loop using a trigger mechanism from the callback. @@ -387,7 +345,7 @@ asserts.assert_equal(ret[0].status, Status.Success, “write failed”) ### [SendCommand](./ChipDeviceCtrlAPI.md#sendcommand) -- Instantiate the command with the values you need to populate +- Instantiate the command object with the values you need to populate - If there is a non-status return, it’s returned from the command - If there is a pure status return it will return nothing - Raises InteractionModelError on failure @@ -403,62 +361,63 @@ pai = await dev_ctrl.SendCommand(nodeid, 0, Clusters.OperationalCredentials.Comm - Because we tend to do a lot of single read / single commands in tests, we added a couple of helpers in MatterBaseTest that use some of the default values - - read_single_attribute_check_success - - read_single_attribute_expect_error - - send_single_cmd -- step() function to mark step progress for the test harness -- skip / skip_step / skip_remaining_steps functions for test harness + - `read_single_attribute_check_success()` + - `read_single_attribute_expect_error()` + - `send_single_cmd()` +- `step()` method to mark step progress for the test harness +- `skip()` / `skip_step()` / `skip_remaining_steps()` methods for test harness integration -- check_pics / pics_guard to handle pics +- `check_pics()` / `pics_guard()` to handle pics ## Mobly helpers The test system is based on Mobly, and the [matter_testing_support.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_support.py) -class provides some helpers for Mobly integration +class provides some helpers for Mobly integration. -- default_matter_test_main - - Sets up commissioning and finds all tests, parses command arguments +- `default_matter_test_main` + - Sets up commissioning and finds all tests, parses command-line arguments use as: ``` if __name__ == "__main__": -default_matter_test_main() + default_matter_test_main() ``` -- Mobly will run all functions starting with test\_ by default - - use --tests command line argument to specify -- Setup / teardown functions - - setup_class / teardown_class - - setup_test / teardown_test - - Don’t forget to call the super() if you override these +- Mobly will run all methods starting with `test_` prefix by default + - use `--tests` command line argument to specify exact name,s +- Setup and teardown methods + - `setup_class` / `teardown_class` + - `setup_test` / `teardown_test` + - Don’t forget to call the `super()` if you override these ## Test harness helpers -The python testing system also includes several functions for integrations with +The python testing system also includes several methods for integrations with the test harness. To integrate with the test harness, you can define the -following functions on your class to allow the test harness UI to properly work +following methods on your class to allow the test harness UI to properly work through your tests. -All of these functions are demonstrated in the +All of these methods are demonstrated in the [hello_example.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/hello_test.py) reference. -- step enumeration - - define a function called `steps_YourFunctionName` to allow the test +- Steps enumeration: + - Define a method called `steps_` to allow the test harness to display the steps - - use the self.step(``) function to walk through the steps -- test description - - define a function called `desc_YourFunctionName` to send back a string + - Use the `self.step()` method to walk through the steps +- Test description: + - Define a method called `desc_` to send back a string with the test description -- top level PICS - - To guard your test on a top level PICS, define a function called - `pics_YourFunctionName` to send back a list of pics. If this function is - omitted, the test will be run for every endpoint on every device. -- overriding the default timeout - - if the test is exceptionally long running, define a property function - `default_timeout` to adjust the timeout. The default is 90 seconds +- Top-level PICS: + - To guard your test on a top level PICS, define a method called + `pics_` to send back a list of PICS. If this method + is omitted, the test will be run for every endpoint on every device. +- Overriding the default timeout: + - If the test is exceptionally long running, define a property getter + method `default_timeout` to adjust the timeout. The default is 90 + seconds. Deferred failures: For some tests, it makes sense to perform the entire test before failing and collect all the errors so the developers can address all the @@ -466,13 +425,13 @@ failures without needing to re-run the test multiple times. For example, tests that look at every attribute on the cluster and perform independent operations on them etc. -For such tests, use the ProblemNotice format and the convenience functions: +For such tests, use the ProblemNotice format and the convenience methods: -- self.record_error -- self.record_warning +- `self.record_error` +- `self.record_warning` -These functions keep track of the problems, and will print them at the end of -the test. The test will not be failed until the assert is called. +These methods keep track of the problems, and will print them at the end of the +test. The test will not be failed until an assert is called. A good example of this type of test can be found in the device basic composition tests, where all the test steps are independent and performed on a single read. @@ -481,16 +440,21 @@ See ## Command line arguments -- Use help to get a full list -- --commissioning-method - - need to re-commission to python controller as chip-tool and python +- Use `--help` to get a full list +- `--storage-path` + - Used to set a local storage file path for persisted data to avoid + clashing files. It is suggested to always provide this argument. Default + value is `admin_storage.json` in current directory. +- `--commissioning-method` + - Need to re-commission to python controller as chip-tool and python commissioner do not share a credentials -- --discriminator, --passcode, --qr-code, --manual-code -- --tests to select tests -- --PICS -- --int-arg, --bool-arg, --float-arg, --string-arg, --json-arg, --hex-arg - - specify as key:value ex --bool-arg pixit_name:False - - used for custom arguments to scripts (PIXITs) +- `--discriminator`, `--passcode`, `--qr-code`, `--manual-code` +- `--tests` to select tests +- `--PICS` +- `--int-arg`, `--bool-arg`, `--float-arg`, `--string-arg`, `--json-arg`, + `--hex-arg` + - Specify as key:value ex --bool-arg pixit_name:False + - Used for custom arguments to scripts (PIXITs) ## PICS and PIXITS @@ -504,7 +468,7 @@ See comments - pixit_value = self.user_params.get("pixit_name", default) -## Support functions +## Support functionality To create a controller on a new fabric: @@ -512,7 +476,7 @@ To create a controller on a new fabric: new_CA = self.certificate_authority_manager.NewCertificateAuthority() new_fabric_admin = new_certificate_authority.NewFabricAdmin(vendorId=0xFFF1, -fabricId=self.matter_test_config.fabric_id + 1) + fabricId=self.matter_test_config.fabric_id + 1) TH2 = new_fabric_admin.NewController(nodeId=112233) ``` @@ -524,22 +488,22 @@ params = self.OpenCommissioningWindow(dev_ctrl=self.default_controller, node_id= ``` To create a new controller on the SAME fabric, allocate a new controller from -the fabric admin +the fabric admin. Fabric admin for default controller: ``` -fa=self.certificate_authority_manager.activeCaList[0].adminList[0] -second_ctrl = fa.new_fabric_admin.NewController(nodeId=node_id) + fa = self.certificate_authority_manager.activeCaList[0].adminList[0] + second_ctrl = fa.new_fabric_admin.NewController(nodeId=node_id) ``` -## other support functions +## Other support utilities -- basic_composition_support +- `basic_composition_support` - wildcard read, whole device analysis -- CommissioningFlowBlocks +- `CommissioningFlowBlocks` - various commissioning support for core tests -- spec_parsing_support +- `spec_parsing_support` - parsing data model XML into python readable format # Running tests locally @@ -564,12 +528,12 @@ or bootstrap.sh should be used for for the first setup, activate.sh may be used for subsequent setups as it is faster. -Next build the python wheels and create / activate a venv (called `py` here, but -any name may be used) +Next build the python wheels and create / activate a venv (called `pyenv` here, +but any name may be used) ``` -./scripts/build_python.sh -i py -source py/bin/activate +./scripts/build_python.sh -i pyenv +source pyenv/bin/activate ``` ## Running tests @@ -589,11 +553,11 @@ python3 src/python_testing/TC_ACE_1_2.py --commissioning-method on-network --qr- ``` Some tests require additional arguments (ex. PIXITs or configuration variables -for the CI). These arguments can be passed as sets of key-value pairs using the -`---arg` command line arguments. For example +for the CI). These arguments can be passed as sets of key/value pairs using the +`---arg:` command line arguments. For example: ``` ---int-arg PIXIT.ACE.APPENDPOINT:1 PIXIT.ACE.APPDEVTYPEID:0x0100 --string-arg PIXIT.ACE.APPCLUSTER:OnOff PIXIT.ACE.APPATTRIBUTE:OnOff +--int-arg PIXIT.ACE.APPENDPOINT:1 --int-arg PIXIT.ACE.APPDEVTYPEID:0x0100 --string-arg PIXIT.ACE.APPCLUSTER:OnOff --string-arg PIXIT.ACE.APPATTRIBUTE:OnOff ``` ## Local host app testing @@ -605,8 +569,75 @@ example DUT on the host and includes factory reset support # Running tests in CI -- add to .github/workflows/tests.yaml repl_tests_linux -- don’t forget to set the PICS file to the ci-pics-values -- if there are things in your test that will fail on CI (ex. test vendor +- Add test to the `repl_tests_linux` section of `.github/workflows/tests.yaml` +- Don’t forget to set the PICS file to the ci-pics-values +- If there are steps in your test that will fail on CI (e.g. test vendor checks), gate them on the PICS_SDK_CI_ONLY - - is_ci = self.check_pics('PICS_SDK_CI_ONLY') + - `is_ci = self.check_pics('PICS_SDK_CI_ONLY')` + +The CI test runner uses a structured environment setup that can be declared +using structured comments at the top of the test file. To use this structured +format, use the `--load-from-env` flag with the `run_python_tests.py` runner. + +Ex: +`scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_ICDM_2_1.py'` + +## Defining the CI test arguments + +Below is the format of the structured environment definition comments: + +``` +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: +# test-runner-run//app: ${TYPE_OF_APP} +# test-runner-run//factoryreset: +# test-runner-run//quiet: +# test-runner-run//app-args: +# test-runner-run//script-args: +# === END CI TEST ARGUMENTS === +``` + +NOTE: The `=== BEGIN CI TEST ARGUMENTS ===` and `=== END CI TEST ARGUMENTS ===` +markers must be present. + +### Description of Parameters + +- `test-runner-runs`: Specifies the identifier for the run. This can be any + unique identifier. + + - Example: `run1` + +- `test-runner-run//app`: Indicates the application to be used + in the test. Different app types as needed could be referenced from section + [name: Generate an argument environment file ] of the file + [.github/workflows/tests.yaml](https://github.com/project-chip/connectedhomeip/blob/master/.github/workflows/tests.yaml) + + - Example: `${TYPE_OF_APP}` + +- `test-runner-run//factoryreset`: Determines whether a + factory reset should be performed before the test. + + - Example: `True` + +- `test-runner-run//quiet`: Sets the verbosity level of the + test run. When set to True, the test run will be quieter. + + - Example: `True` + +- `test-runner-run//app-args`: Specifies the arguments to be + passed to the application during the test. + + - Example: + `--discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json` + +- `test-runner-run//script-args`: Specifies the arguments to + be passed to the test script. + - Example: + `--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto` + +This structured format ensures that all necessary configurations are clearly +defined and easily understood, allowing for consistent and reliable test +execution. diff --git a/docs/testing/unit_testing.md b/docs/testing/unit_testing.md index 64046a4c21a9d6..243e35d9b380c9 100644 --- a/docs/testing/unit_testing.md +++ b/docs/testing/unit_testing.md @@ -218,8 +218,8 @@ your overriding function make sure to check `HasFailure()` and return if the parent function failed. If you don't override any of the setup/teardown functions, you can simply make a -type alias: `using YourTestContext = Test::AppContextPW;` instead of defining -your own text context class. +type alias: `using YourTestContext = Test::AppContext;` instead of defining your +own text context class. ## Best practices diff --git a/docs/upgrading.md b/docs/upgrading.md index cd18b533484279..9a8c68987bec3b 100644 --- a/docs/upgrading.md +++ b/docs/upgrading.md @@ -60,3 +60,19 @@ commandHandler->AddResponse(path, kReplyCommandId, replyEncoder); // so code does AddResponse rather than AddResponseData. ``` + +### `CommandHandlerInterface` in `chip::app::InteractionModelEngine` + +Command handler lists were placed in a separate registry class that is +independent of the InteractionModelEngine class. + +The following replacements exist: + +- `chip::app::InteractionModelEngine::RegisterCommandHandler` replaced by + `chip::app::CommandHandlerInterfaceRegistry::RegisterCommandHandler` +- `chip::app::InteractionModelEngine::UnregisterCommandHandler` replaced by + `chip::app::CommandHandlerInterfaceRegistry::UnregisterCommandHandler` +- `chip::app::InteractionModelEngine::FindCommandHandler` replaced by + `chip::app::CommandHandlerInterfaceRegistry::GetCommandHandler` +- `chip::app::InteractionModelEngine::UnregisterCommandHandlers` replaced by + `chip::app::CommandHandlerInterfaceRegistry::UnregisterAllCommandHandlersForEndpoint` diff --git a/docs/zap_clusters.md b/docs/zap_clusters.md index 7651e35b784ed1..93e37131626379 100644 --- a/docs/zap_clusters.md +++ b/docs/zap_clusters.md @@ -79,6 +79,7 @@ Generally regenerate using one of: | 129 | 0x81 | ValveConfigurationAndControl | | 144 | 0x90 | ElectricalPowerMeasurement | | 145 | 0x91 | ElectricalEnergyMeasurement | +| 148 | 0x94 | WaterHeaterManagement | | 150 | 0x96 | DemandResponseLoadControl | | 151 | 0x97 | Messages | | 152 | 0x98 | DeviceEnergyManagement | @@ -86,6 +87,7 @@ Generally regenerate using one of: | 155 | 0x9B | EnergyPreference | | 156 | 0x9C | PowerTopology | | 157 | 0x9D | EnergyEvseMode | +| 158 | 0x9E | WaterHeaterMode | | 159 | 0x9F | DeviceEnergyManagementMode | | 257 | 0x101 | DoorLock | | 258 | 0x102 | WindowCovering | @@ -130,6 +132,8 @@ Generally regenerate using one of: | 1294 | 0x50E | AccountLogin | | 1295 | 0x50F | ContentControl | | 1296 | 0x510 | ContentAppObserver | +| 1872 | 0x750 | EcosystemInformation | +| 1873 | 0x751 | CommissionerControl | | 2820 | 0xB04 | ElectricalMeasurement | | 4294048773 | 0xFFF1FC05 | UnitTesting | | 4294048774 | 0xFFF1FC06 | FaultInjection | diff --git a/third_party/nlunit-test/BUILD.gn b/examples/BUILD.gn similarity index 54% rename from third_party/nlunit-test/BUILD.gn rename to examples/BUILD.gn index f56d0a5e9d2cb5..a8cb18422949e2 100644 --- a/third_party/nlunit-test/BUILD.gn +++ b/examples/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2020 Project CHIP Authors +# Copyright (c) 2020-2021 Project CHIP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,30 +13,20 @@ # limitations under the License. import("//build_overrides/build.gni") -import("${build_root}/config/compiler/compiler.gni") - -config("nlunit-test_config") { - include_dirs = [ "repo/src" ] -} +import("//build_overrides/chip.gni") -config("nlunit-test_config_disable_warnings") { - cflags = [ "-Wno-conversion" ] - - if (is_clang) { - cflags += [ "-Wno-shorten-64-to-32" ] +import("${build_root}/config/compiler/compiler.gni") +import("${chip_root}/build/chip/tests.gni") +import("${chip_root}/src/platform/device.gni") + +if (chip_build_tests) { + import("${chip_root}/build/chip/chip_test_group.gni") + + chip_test_group("example_tests") { + deps = [] + tests = [] + if (chip_device_platform == "linux" && current_os == "linux") { + tests += [ "${chip_root}/examples/energy-management-app/energy-management-common/tests" ] + } } } - -static_library("nlunit-test") { - output_name = "libnlunit-test" - - output_dir = "${root_out_dir}/lib" - - sources = [ - "repo/src/nlunit-test.c", - "repo/src/nlunit-test.h", - ] - - public_configs = [ ":nlunit-test_config" ] - configs += [ ":nlunit-test_config_disable_warnings" ] -} diff --git a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter index a43824252c78c1..6e31f82460ed3a 100644 --- a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter +++ b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1277,7 +1348,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -1344,7 +1416,6 @@ cluster Thermostat = 513 { kMatterScheduleConfiguration = 0x80; kPresets = 0x100; kSetpoints = 0x200; - kQueuedPresetsSupported = 0x400; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -1404,11 +1475,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -1442,11 +1508,6 @@ cluster Thermostat = 513 { PresetTypeFeaturesBitmap presetTypeFeatures = 2; } - struct QueuedPresetStruct { - nullable octet_string<16> presetHandle = 0; - nullable epoch_s transitionTimestamp = 1; - } - struct ScheduleTypeStruct { SystemModeEnum systemMode = 0; int8u numberOfSchedules = 1; @@ -1519,9 +1580,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; - readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1559,17 +1618,12 @@ cluster Thermostat = 513 { request struct SetActivePresetRequestRequest { octet_string<16> presetHandle = 0; - optional int16u delayMinutes = 1; } request struct StartPresetsSchedulesEditRequestRequest { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -1588,10 +1642,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command is sent to cancel a queued preset. */ - command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for controlling a fan in a heating/cooling system. */ diff --git a/examples/air-purifier-app/ameba/chip_main.cmake b/examples/air-purifier-app/ameba/chip_main.cmake index df900f2508de17..c2a8d0e928fa0c 100755 --- a/examples/air-purifier-app/ameba/chip_main.cmake +++ b/examples/air-purifier-app/ameba/chip_main.cmake @@ -204,7 +204,6 @@ target_include_directories( ${chip_dir}/src/app/server/ ${chip_dir}/src/controller/data_model ${chip_dir}/third_party/nlio/repo/include/ - ${chip_dir}/third_party/nlunit-test/repo/src ) if (matter_enable_rpc) diff --git a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter index d3ecbc8e36075b..c7395570fccff4 100644 --- a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter +++ b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/air-quality-sensor-app/telink/README.md b/examples/air-quality-sensor-app/telink/README.md index 64b394c046b51a..e2c4b49a699991 100644 --- a/examples/air-quality-sensor-app/telink/README.md +++ b/examples/air-quality-sensor-app/telink/README.md @@ -4,6 +4,17 @@ You can use this example as a reference for creating your own application. ![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) +## Supported devices + +The example supports building and running on the following devices: + +| Board/SoC | Build target | Zephyr Board Info | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| [B91](https://wiki.telink-semi.cn/wiki/Hardware/B91_Generic_Starter_Kit_Hardware_Guide) [TLSR9518ADK80D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series) | `tlsr9518adk80d`, `tlsr9518adk80d-mars`, `tlsr9518adk80d-usb` | [TLSR9518ADK80D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9518adk80d/doc/index.rst) | +| [B92](https://wiki.telink-semi.cn/wiki/Hardware/B92_Generic_Starter_Kit_Hardware_Guide) [TLSR9528A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR952x-Series) | `tlsr9528a`, `tlsr9528a_retention` | [TLSR9528A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9528a/doc/index.rst) | +| [B95](https://wiki.telink-semi.cn/wiki/Hardware/B95_Generic_Starter_Kit_Hardware_Guide) [TLSR9258A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR925x-Series) | `tlsr9258a` | [TLSR9258A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9258a/doc/index.rst) | +| [W91](https://wiki.telink-semi.cn/wiki/Hardware/W91_Generic_Starter_Kit_Hardware_Guide) [TLSR9118BDK40D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR911x-Series) | `tlsr9118bdk40d` | [TLSR9118BDK40D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9118bdk40d/doc/index.rst) | + ## Build and flash 1. Run the Docker container: @@ -12,7 +23,7 @@ You can use this example as a reference for creating your own application. $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}') ``` - Compatible docker image version can be found in next file: + You can find the compatible Docker image version in the file: ```bash $ .github/workflows/examples-telink.yaml @@ -24,8 +35,8 @@ You can use this example as a reference for creating your own application. $ source ./scripts/activate.sh -p all,telink ``` -3. In the example dir run (replace __ with your board name, for - example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`): +3. Build the example (replace __ with your board name, see + [Supported devices](#supported-devices)): ```bash $ west build -b @@ -35,9 +46,12 @@ You can use this example as a reference for creating your own application. MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=4m`: ```bash - $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + $ west build -b -- -DFLASH_SIZE=4m ``` + You can find the target built file called **_zephyr.bin_** under the + **_build/zephyr_** directory. + 4. Flash binary: ``` @@ -56,16 +70,18 @@ To get output from device, connect UART to following pins: | TX | PB2 (pin 16 of J34 connector) | | GND | GND | +Baud rate: 115200 bits/s + ### Buttons The following buttons are available on **tlsr9518adk80d** board: -| Name | Function | Description | -| :------- | :--------------------- | :----------------------------------------------------------------------------------------------------- | -| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and back to uncommissioned state | -| Button 2 | `AirQuality` control | Manually triggers the `AirQuality` state | -| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | -| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | +| Name | Function | Description | +| :------- | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and return to a decommissioned state (to activate, push the button 3 times) | +| Button 2 | `AirQuality` control | Manually triggers the `AirQuality` state | +| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | +| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | ### LEDs diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index c4636b60e07b9b..1d15ec2b1d85d6 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -288,7 +305,7 @@ deprecated cluster OnOffSwitchConfiguration = 7 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -491,7 +508,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -507,12 +524,42 @@ cluster AccessControl = 31 { 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; @@ -548,17 +595,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides a standardized way for a Node (typically a Bridge, but could be any Node) to expose action information. */ @@ -820,7 +891,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -2731,8 +2802,8 @@ cluster OvenMode = 73 { command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0; } -/** This cluster supports remotely monitoring and controling the different typs of - functionality available to a drying device, such as a laundry dryer. */ +/** This cluster provides a way to access options associated with the operation of + a laundry dryer device type. */ cluster LaundryDryerControls = 74 { revision 1; @@ -3513,14 +3584,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + 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; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -3632,7 +3710,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** 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; @@ -4068,6 +4146,64 @@ cluster ElectricalEnergyMeasurement = 145 { readonly attribute int16u clusterRevision = 65533; } +/** This cluster is used to allow clients to control the operation of a hot water heating appliance so that it can be used with energy management. */ +provisional cluster WaterHeaterManagement = 148 { + revision 1; + + enum BoostStateEnum : enum8 { + kInactive = 0; + kActive = 1; + } + + bitmap Feature : bitmap32 { + kEnergyManagement = 0x1; + kTankPercent = 0x2; + } + + bitmap WaterHeaterDemandBitmap : bitmap8 { + kImmersionElement1 = 0x1; + kImmersionElement2 = 0x2; + kHeatPump = 0x4; + kBoiler = 0x8; + kOther = 0x10; + } + + bitmap WaterHeaterTypeBitmap : bitmap8 { + kImmersionElement1 = 0x1; + kImmersionElement2 = 0x2; + kHeatPump = 0x4; + kBoiler = 0x8; + kOther = 0x10; + } + + readonly attribute WaterHeaterTypeBitmap heaterTypes = 0; + readonly attribute WaterHeaterDemandBitmap heatDemand = 1; + readonly attribute optional int16u tankVolume = 2; + readonly attribute optional energy_mwh estimatedHeatRequired = 3; + readonly attribute optional percent tankPercentage = 4; + readonly attribute BoostStateEnum boostState = 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 BoostRequest { + elapsed_s duration = 0; + optional boolean oneShot = 1; + optional boolean emergencyBoost = 2; + optional temperature temporarySetpoint = 3; + optional percent targetPercentage = 4; + optional percent targetReheat = 5; + } + + /** Allows a client to request that the water heater is put into a Boost state. */ + command access(invoke: manage) Boost(BoostRequest): DefaultSuccess = 0; + /** Allows a client to cancel an ongoing Boost operation. */ + command access(invoke: manage) CancelBoost(): DefaultSuccess = 1; +} + /** This cluster allows a client to manage the power draw of a device. An example of such a client could be an Energy Management System (EMS) which controls an Energy Smart Appliance (ESA). */ provisional cluster DeviceEnergyManagement = 152 { revision 4; @@ -4291,7 +4427,7 @@ provisional cluster DeviceEnergyManagement = 152 { /** Electric Vehicle Supply Equipment (EVSE) is equipment used to charge an Electric Vehicle (EV) or Plug-In Hybrid Electric Vehicle. This cluster provides an interface to the functionality of Electric Vehicle Supply Equipment (EVSE) management. */ cluster EnergyEvse = 153 { - revision 2; + revision 4; enum EnergyTransferStoppedReasonEnum : enum8 { kEVStopped = 0; @@ -4335,6 +4471,7 @@ cluster EnergyEvse = 153 { kDischargingEnabled = 2; kDisabledError = 3; kDisabledDiagnostics = 4; + kEnabled = 5; } bitmap Feature : bitmap32 { @@ -4382,6 +4519,7 @@ cluster EnergyEvse = 153 { int32u sessionID = 0; StateEnum state = 1; amperage_ma maximumCurrent = 2; + optional amperage_ma maximumDischargeCurrent = 3; } info event EnergyTransferStopped = 3 { @@ -4389,6 +4527,7 @@ cluster EnergyEvse = 153 { StateEnum state = 1; EnergyTransferStoppedReasonEnum reason = 2; energy_mwh energyTransferred = 4; + optional energy_mwh energyDischarged = 5; } critical event Fault = 4 { @@ -4453,15 +4592,15 @@ cluster EnergyEvse = 153 { /** Allows a client to disable the EVSE from charging and discharging. */ timed command Disable(): DefaultSuccess = 1; - /** Allows a client to enable the EVSE to charge an EV. */ + /** This command allows a client to enable the EVSE to charge an EV, */ timed command EnableCharging(EnableChargingRequest): DefaultSuccess = 2; - /** Allows a client to enable the EVSE to discharge an EV. */ + /** Upon receipt, this SHALL allow a client to enable the discharge of an EV, */ timed command EnableDischarging(EnableDischargingRequest): DefaultSuccess = 3; /** Allows a client to put the EVSE into a self-diagnostics mode. */ timed command StartDiagnostics(): DefaultSuccess = 4; /** Allows a client to set the user specified charging targets. */ timed command SetTargets(SetTargetsRequest): DefaultSuccess = 5; - /** Allows a client to retrieve the user specified charging targets. */ + /** Allows a client to retrieve the current set of charging targets. */ timed command GetTargets(): GetTargetsResponse = 6; /** Allows a client to clear all stored charging targets. */ timed command ClearTargets(): DefaultSuccess = 7; @@ -4572,6 +4711,56 @@ cluster EnergyEvseMode = 157 { command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0; } +/** Attributes and commands for selecting a mode from a list of supported options. */ +cluster WaterHeaterMode = 158 { + revision 1; + + enum ModeTag : enum16 { + kOff = 16384; + kManual = 16385; + kTimed = 16386; + } + + bitmap Feature : bitmap32 { + kOnOff = 0x1; + } + + struct ModeTagStruct { + optional vendor_id mfgCode = 0; + enum16 value = 1; + } + + struct ModeOptionStruct { + char_string<64> label = 0; + int8u mode = 1; + ModeTagStruct modeTags[] = 2; + } + + readonly attribute ModeOptionStruct supportedModes[] = 0; + readonly attribute int8u currentMode = 1; + attribute optional nullable int8u startUpMode = 2; + attribute optional nullable int8u onMode = 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 ChangeToModeRequest { + int8u newMode = 0; + } + + response struct ChangeToModeResponse = 1 { + enum8 status = 0; + optional char_string statusText = 1; + } + + /** This command is used to change device modes. + On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */ + command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0; +} + /** Attributes and commands for selecting a mode from a list of supported options. */ provisional cluster DeviceEnergyManagementMode = 159 { revision 1; @@ -4996,7 +5185,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -5063,7 +5253,6 @@ cluster Thermostat = 513 { kMatterScheduleConfiguration = 0x80; kPresets = 0x100; kSetpoints = 0x200; - kQueuedPresetsSupported = 0x400; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -5123,11 +5312,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -5161,11 +5345,6 @@ cluster Thermostat = 513 { PresetTypeFeaturesBitmap presetTypeFeatures = 2; } - struct QueuedPresetStruct { - nullable octet_string<16> presetHandle = 0; - nullable epoch_s transitionTimestamp = 1; - } - struct ScheduleTypeStruct { SystemModeEnum systemMode = 0; int8u numberOfSchedules = 1; @@ -5238,9 +5417,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; - readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5278,17 +5455,12 @@ cluster Thermostat = 513 { request struct SetActivePresetRequestRequest { octet_string<16> presetHandle = 0; - optional int16u delayMinutes = 1; } request struct StartPresetsSchedulesEditRequestRequest { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -5307,10 +5479,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command is sent to cancel a queued preset. */ - command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for controlling a fan in a heating/cooling system. */ @@ -5431,7 +5599,7 @@ cluster ThermostatUserInterfaceConfiguration = 516 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -7837,7 +8005,7 @@ endpoint 1 { ram attribute defaultMoveRate default = 50; persist attribute startUpCurrentLevel default = 255; ram attribute featureMap default = 3; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; @@ -8367,6 +8535,24 @@ endpoint 1 { ram attribute clusterRevision default = 1; } + server cluster WaterHeaterManagement { + callback attribute heaterTypes; + callback attribute heatDemand; + callback attribute tankVolume; + callback attribute estimatedHeatRequired; + callback attribute tankPercentage; + callback attribute boostState; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + callback attribute featureMap; + callback attribute clusterRevision; + + handle command Boost; + handle command CancelBoost; + } + server cluster DeviceEnergyManagement { emits event PowerAdjustStart; emits event PowerAdjustEnd; @@ -8466,6 +8652,24 @@ endpoint 1 { server cluster EnergyEvseMode { callback attribute supportedModes; callback attribute currentMode; + ram attribute startUpMode; + ram attribute onMode; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + callback attribute featureMap; + ram attribute clusterRevision default = 1; + + handle command ChangeToMode; + handle command ChangeToModeResponse; + } + + server cluster WaterHeaterMode { + callback attribute supportedModes; + callback attribute currentMode; + ram attribute startUpMode; + ram attribute onMode; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; @@ -8480,6 +8684,8 @@ endpoint 1 { server cluster DeviceEnergyManagementMode { callback attribute supportedModes; callback attribute currentMode; + ram attribute startUpMode; + ram attribute onMode; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; @@ -8575,6 +8781,7 @@ endpoint 1 { ram attribute absMaxHeatSetpointLimit default = 0x0BB8; ram attribute absMinCoolSetpointLimit default = 0x0640; ram attribute absMaxCoolSetpointLimit default = 0x0C80; + ram attribute localTemperatureCalibration default = 0x00; ram attribute occupiedCoolingSetpoint default = 0x0A28; ram attribute occupiedHeatingSetpoint default = 0x07D0; ram attribute minHeatSetpointLimit default = 0x02BC; @@ -8584,19 +8791,6 @@ endpoint 1 { ram attribute minSetpointDeadBand default = 0x19; ram attribute controlSequenceOfOperation default = 0x04; ram attribute systemMode default = 0x01; - callback attribute presetTypes; - callback attribute scheduleTypes; - ram attribute numberOfPresets default = 0; - ram attribute numberOfSchedules default = 0; - ram attribute numberOfScheduleTransitionPerDay default = 0xFF; - ram attribute activePresetHandle; - ram attribute activeScheduleHandle; - callback attribute presets; - callback attribute schedules; - ram attribute presetsSchedulesEditable; - ram attribute temperatureSetpointHoldPolicy default = 0; - ram attribute setpointHoldExpiryTimestamp; - callback attribute queuedPreset; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; @@ -8688,7 +8882,7 @@ endpoint 1 { ram attribute coupleColorTempToLevelMinMireds; persist attribute startUpColorTemperatureMireds; ram attribute featureMap default = 0x1F; - ram attribute clusterRevision default = 6; + ram attribute clusterRevision default = 7; handle command MoveToHue; handle command MoveHue; @@ -8782,8 +8976,10 @@ endpoint 1 { ram attribute occupancy; ram attribute occupancySensorType; ram attribute occupancySensorTypeBitmap; - ram attribute featureMap default = 0; - ram attribute clusterRevision default = 4; + ram attribute holdTime default = 10; + callback attribute holdTimeLimits; + ram attribute featureMap default = 0x01; + ram attribute clusterRevision default = 5; } server cluster CarbonMonoxideConcentrationMeasurement { @@ -9251,8 +9447,87 @@ endpoint 2 { ram attribute occupancy; ram attribute occupancySensorType; ram attribute occupancySensorTypeBitmap; + ram attribute holdTime default = 20; + callback attribute holdTimeLimits; + ram attribute featureMap default = 0x01; + ram attribute clusterRevision default = 5; + } +} +endpoint 3 { + device type ma_genericswitch = 15, version 3; + + + server cluster Identify { + ram attribute identifyTime default = 0x0000; + ram attribute identifyType default = 0x00; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; + + handle command Identify; + handle command TriggerEffect; + } + + server cluster Descriptor { + callback attribute deviceTypeList; + callback attribute serverList; + callback attribute clientList; + callback attribute partsList; + callback attribute tagList; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + callback attribute featureMap; + callback attribute clusterRevision; + } + + server cluster Switch { + emits event InitialPress; + emits event LongPress; + emits event LongRelease; + emits event MultiPressComplete; + ram attribute numberOfPositions default = 2; + ram attribute currentPosition default = 0; + ram attribute multiPressMax default = 3; + ram attribute featureMap default = 58; + ram attribute clusterRevision default = 2; + } +} +endpoint 4 { + device type ma_genericswitch = 15, version 3; + + + server cluster Identify { + ram attribute identifyTime default = 0x0000; + ram attribute identifyType default = 0x00; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 4; + } + + server cluster Descriptor { + callback attribute deviceTypeList; + callback attribute serverList; + callback attribute clientList; + callback attribute partsList; + callback attribute tagList; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + callback attribute featureMap; + callback attribute clusterRevision; + } + + server cluster Switch { + ram attribute numberOfPositions default = 2; + ram attribute currentPosition default = 0; + ram attribute multiPressMax default = 3; + ram attribute featureMap default = 30; + ram attribute clusterRevision default = 2; } } endpoint 65534 { diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index c547030731c6cf..8975f7136d9486 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -7303,7 +7303,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -13413,6 +13413,227 @@ } ] }, + { + "name": "Water Heater Management", + "code": 148, + "mfgCode": null, + "define": "WATER_HEATER_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 1, + "apiMaturity": "provisional", + "commands": [ + { + "name": "Boost", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CancelBoost", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "HeaterTypes", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "WaterHeaterTypeBitmap", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "HeatDemand", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "WaterHeaterDemandBitmap", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TankVolume", + "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": "EstimatedHeatRequired", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "energy_mwh", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TankPercentage", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "percent", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BoostState", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "BoostStateEnum", + "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": "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, + "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": "Device Energy Management", "code": 152, @@ -14615,6 +14836,38 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "StartUpMode", + "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": "OnMode", + "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": "GeneratedCommandList", "code": 65528, @@ -14714,13 +14967,12 @@ ] }, { - "name": "Device Energy Management Mode", - "code": 159, + "name": "Water Heater Mode", + "code": 158, "mfgCode": null, - "define": "DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER", + "define": "WATER_HEATER_MODE_CLUSTER", "side": "server", "enabled": 1, - "apiMaturity": "provisional", "commands": [ { "name": "ChangeToMode", @@ -14773,23 +15025,244 @@ "reportableChange": 0 }, { - "name": "GeneratedCommandList", - "code": 65528, + "name": "StartUpMode", + "code": 2, "mfgCode": null, "side": "server", - "type": "array", + "type": "int8u", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": null, + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 }, { - "name": "AcceptedCommandList", + "name": "OnMode", + "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": "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": "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, + "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": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Device Energy Management Mode", + "code": 159, + "mfgCode": null, + "define": "DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER", + "side": "server", + "enabled": 1, + "apiMaturity": "provisional", + "commands": [ + { + "name": "ChangeToMode", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ChangeToModeResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "SupportedModes", + "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": "CurrentMode", + "code": 1, + "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": "StartUpMode", + "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": "OnMode", + "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": "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", @@ -16003,6 +16476,22 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "LocalTemperatureCalibration", + "code": 16, + "mfgCode": null, + "side": "server", + "type": "int8s", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "OccupiedCoolingSetpoint", "code": 17, @@ -16148,8 +16637,8 @@ "reportableChange": 0 }, { - "name": "PresetTypes", - "code": 72, + "name": "GeneratedCommandList", + "code": 65528, "mfgCode": null, "side": "server", "type": "array", @@ -16164,8 +16653,8 @@ "reportableChange": 0 }, { - "name": "ScheduleTypes", - "code": 73, + "name": "AcceptedCommandList", + "code": 65529, "mfgCode": null, "side": "server", "type": "array", @@ -16180,237 +16669,29 @@ "reportableChange": 0 }, { - "name": "NumberOfPresets", - "code": 74, + "name": "EventList", + "code": 65530, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 }, { - "name": "NumberOfSchedules", - "code": 75, + "name": "AttributeList", + "code": 65531, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "NumberOfScheduleTransitionPerDay", - "code": 77, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0xFF", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "ActivePresetHandle", - "code": 78, - "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": "ActiveScheduleHandle", - "code": 79, - "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": "Presets", - "code": 80, - "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": "Schedules", - "code": 81, - "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": "PresetsSchedulesEditable", - "code": 82, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "TemperatureSetpointHoldPolicy", - "code": 83, - "mfgCode": null, - "side": "server", - "type": "TemperatureSetpointHoldPolicyBitmap", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "SetpointHoldExpiryTimestamp", - "code": 84, - "mfgCode": null, - "side": "server", - "type": "epoch_s", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "QueuedPreset", - "code": 85, - "mfgCode": null, - "side": "server", - "type": "QueuedPresetStruct", - "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": "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, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": null, @@ -17807,7 +18088,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -18716,6 +18997,38 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "HoldTime", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "10", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "HoldTimeLimits", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "HoldTimeLimitsStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, @@ -18726,7 +19039,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "0x01", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -18742,7 +19055,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "4", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -21900,6 +22213,14 @@ "isIncoming": 1, "isEnabled": 1 }, + { + "name": "StringEchoResponse", + "code": 13, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, { "name": "TestEnumsRequest", "code": 14, @@ -21973,32 +22294,24 @@ "isEnabled": 1 }, { - "name": "TestDifferentVendorMeiRequest", - "code": 4294049962, + "name": "StringEchoRequest", + "code": 24, "mfgCode": null, "source": "client", "isIncoming": 1, "isEnabled": 1 }, { - "name": "TestDifferentVendorMeiResponse", - "code": 4294049979, - "mfgCode": null, - "source": "server", - "isIncoming": 0, - "isEnabled": 1 - }, - { - "name": "StringEchoRequest", - "code": 24, + "name": "TestDifferentVendorMeiRequest", + "code": 4294049962, "mfgCode": null, "source": "client", "isIncoming": 1, "isEnabled": 1 }, { - "name": "StringEchoResponse", - "code": 13, + "name": "TestDifferentVendorMeiResponse", + "code": 4294049979, "mfgCode": null, "source": "server", "isIncoming": 0, @@ -24746,11 +25059,653 @@ "reportableChange": 0 }, { - "name": "FeatureMap", - "code": 65532, + "name": "HoldTime", + "code": 3, "mfgCode": null, "side": "server", - "type": "bitmap32", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "20", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "HoldTimeLimits", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "HoldTimeLimitsStruct", + "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": "0x01", + "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": "5", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + } + ] + }, + { + "id": 4, + "name": "MA-genericswitch", + "deviceTypeRef": { + "code": 15, + "profileId": 259, + "label": "MA-genericswitch", + "name": "MA-genericswitch" + }, + "deviceTypes": [ + { + "code": 15, + "profileId": 259, + "label": "MA-genericswitch", + "name": "MA-genericswitch" + } + ], + "deviceVersions": [ + 3 + ], + "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": "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": "0x00", + "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": "4", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "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": "TagList", + "code": 4, + "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": 0, + "maxInterval": 65344, + "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": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "MultiPressMax", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "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": "58", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "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 + } + ], + "events": [ + { + "name": "InitialPress", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "LongPress", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "LongRelease", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "MultiPressComplete", + "code": 6, + "mfgCode": null, + "side": "server", + "included": 12 + } + ] + } + ] + }, + { + "id": 5, + "name": "MA-genericswitch", + "deviceTypeRef": { + "code": 15, + "profileId": 259, + "label": "MA-genericswitch", + "name": "MA-genericswitch" + }, + "deviceTypes": [ + { + "code": 15, + "profileId": 259, + "label": "MA-genericswitch", + "name": "MA-genericswitch" + } + ], + "deviceVersions": [ + 3 + ], + "deviceIdentifiers": [ + 15 + ], + "deviceTypeName": "MA-genericswitch", + "deviceTypeCode": 15, + "deviceTypeProfileId": 259, + "clusters": [ + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "server", + "enabled": 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": "0x00", + "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, @@ -24771,7 +25726,267 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "4", + "defaultValue": "4", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "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": "TagList", + "code": 4, + "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": 0, + "maxInterval": 65344, + "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": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "MultiPressMax", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "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": "30", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "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, @@ -24782,7 +25997,7 @@ ] }, { - "id": 4, + "id": 6, "name": "Anonymous Endpoint Type", "deviceTypeRef": { "code": 25, @@ -25315,9 +26530,25 @@ "parentEndpointIdentifier": null }, { - "endpointTypeName": "Anonymous Endpoint Type", + "endpointTypeName": "MA-genericswitch", "endpointTypeIndex": 3, "profileId": 259, + "endpointId": 3, + "networkId": 0, + "parentEndpointIdentifier": null + }, + { + "endpointTypeName": "MA-genericswitch", + "endpointTypeIndex": 4, + "profileId": 259, + "endpointId": 4, + "networkId": 0, + "parentEndpointIdentifier": null + }, + { + "endpointTypeName": "Anonymous Endpoint Type", + "endpointTypeIndex": 5, + "profileId": 259, "endpointId": 65534, "networkId": 0, "parentEndpointIdentifier": null diff --git a/examples/all-clusters-app/all-clusters-common/include/WhmDelegate.h b/examples/all-clusters-app/all-clusters-common/include/WhmDelegate.h new file mode 100644 index 00000000000000..ecabfe22792f25 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/include/WhmDelegate.h @@ -0,0 +1,270 @@ +/* + * + * 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 + +namespace chip { +namespace app { +namespace Clusters { +namespace WaterHeaterManagement { + +class WhmManufacturer; + +enum HeatingOp +{ + TurnHeatingOn, + TurnHeatingOff, + LeaveHeatingUnchanged +}; + +// This is an application level delegate to handle operational state commands according to the specific business logic. +class WaterHeaterManagementDelegate : public WaterHeaterManagement::Delegate +{ +public: + WaterHeaterManagementDelegate(EndpointId clustersEndpoint); + + virtual ~WaterHeaterManagementDelegate() = default; + + void SetWaterHeaterManagementInstance(WaterHeaterManagement::Instance & instance); + + void SetWhmManufacturer(WhmManufacturer & whmManufacturer); + + /********************************************************************************* + * + * Methods implementing the WaterHeaterManagement::Delegate interface + * + *********************************************************************************/ + + /** + * @brief Delegate should implement a handler to start boosting the water temperature as required. + * Upon receipt, the Water Heater SHALL transition into the BOOST state, which SHALL cause the + * water in the tank (or the TargetPercentage of the water, if included) to be heated towards + * the set point (or the TemporarySetpoint, if included), which in turn may cause a call for heat, + * even if the mode is OFF, or is TIMED and it is during one of the Off periods. + * + * @param duration Indicates the time period in seconds for which the BOOST state is activated before it + * automatically reverts to the previous mode (e.g. OFF, MANUAL or TIMED). + * @param oneShot Indicates whether the BOOST state should be automatically canceled once the hot water has + * first reached the set point temperature (or the TemporarySetpoint temperature, if specified) + * for the TargetPercentage (if specified). + * @param emergencyBoost Indicates that the consumer wants the water to be heated as quickly as practicable. + * This MAY cause multiple heat sources to be activated (e.g. a heat pump and direct + * electric heating element). + * @param temporarySetpoint Indicates the target temperature to which to heat the hot water for this Boost command. + * It SHALL be used instead of the normal set point temperature whilst the BOOST state is active. + * @param targetPercentage If the tank supports the TankPercent feature, this field indicates the amount of water + * that SHALL be heated by this Boost command before the heater is switched off. + * @param targetReheat If the tank supports the TankPercent feature, and the heating by this Boost command has ceased + * because the TargetPercentage of the water in the tank has been heated to the set point (or + * TemporarySetpoint if included), this field indicates the percentage to which the hot water in + * the tank SHALL be allowed to fall before again beginning to reheat it. + * + * @return Success if the boost command is accepted; otherwise the command SHALL be rejected with appropriate error. + */ + Protocols::InteractionModel::Status HandleBoost(uint32_t duration, Optional oneShot, Optional emergencyBoost, + Optional temporarySetpoint, Optional targetPercentage, + Optional targetReheat) override; + + /** + * @brief Delegate should implement a handler to cancel a boost command. + * Upon receipt, the Water Heater SHALL transition back from the BOOST state to the previous mode + * (e.g. OFF, MANUAL or TIMED). + * + * @return It should report SUCCESS if successful and FAILURE otherwise. + */ + Protocols::InteractionModel::Status HandleCancelBoost() override; + + // ------------------------------------------------------------------ + // Get attribute methods + BitMask GetHeaterTypes() override; + BitMask GetHeatDemand() override; + uint16_t GetTankVolume() override; + int64_t GetEstimatedHeatRequired() override; + Percent GetTankPercentage() override; + BoostStateEnum GetBoostState() override; + + // ------------------------------------------------------------------ + // Set attribute methods + void SetHeaterTypes(BitMask heaterTypes); + void SetHeatDemand(BitMask heatDemand); + void SetTankVolume(uint16_t tankVolume); + void SetEstimatedHeatRequired(int64_t estimatedHeatRequired); + void SetTankPercentage(Percent tankPercentage); + void SetBoostState(BoostStateEnum boostState); + + /********************************************************************************* + * + * WaterHeaterManagementDelegate specific methods + * + *********************************************************************************/ + + /** + * @brief Set the Water Header Mode and act accordingly. + * + * @param mode The Water Heater Mode (e.g. OFF, MANUAL or TIMED). + */ + Protocols::InteractionModel::Status SetWaterHeaterMode(uint8_t mode); + + /** + * @brief Set the water temperature of the tank + * + * @param waterTemperature The water temperature in 100th's Celsius + */ + void SetWaterTemperature(uint16_t waterTemperature); + + /** + * @brief Set the target water temperature of the tank + * + * @param targetWaterTemperature The water temperature in 100th's Celsius + */ + void SetTargetWaterTemperature(uint16_t targetWaterTemperature); + + /** + * @brief Determine whether the heating sources need to be turned on or off + */ + Protocols::InteractionModel::Status CheckIfHeatNeedsToBeTurnedOnOrOff(); + + /** + * @brief Static timer callback for when Boost timer expires. + */ + static void BoostTimerExpiry(System::Layer * systemLayer, void * delegate); + + /** + * @brief Object timer callback for when Boost timer expires. + */ + void HandleBoostTimerExpiry(); + + /** + * Determines whether the tank water temperature has reached the target temperature. + * + * @return Returns True is tank water temperature has reached the target temperature, False otherwise. + */ + bool HasWaterTemperatureReachedTarget() const; + + /** + * Simulates water being drawn from the water tank. + * + * @param percentageReplaced The % of water being replaced with water with a temperature of replacedWaterTemperature. + * @param replacedWaterTemperature The temperature of the percentageReplaced water. + */ + void DrawOffHotWater(uint8_t percentageReplaced, uint16_t replacedWaterTemperature); + +private: + /** + * @brief Determine whether heating needs to be turned on or off or left as is. + * + * @param heatingOp[out] Set as determined whether heating needs to be turned on/off or left unchanged. + * + * @return Success if the heating operation could be determined otherwise returns with appropriate error. + */ + Protocols::InteractionModel::Status DetermineIfChangingHeatingState(HeatingOp & heatingOp); + +private: + /********************************************************************************* + * + * WaterHeaterManagementDelegate specific attributes + * + *********************************************************************************/ + + // Need the following so can determine which features are supported + WaterHeaterManagement::Instance * mpWhmInstance; + + // Pointer to the manufacturer specific object which understand the hardware + WhmManufacturer * mpWhmManufacturer; + + // Target water temperature in 100ths of a C + uint16_t mTargetWaterTemperature; + + // Actual water temperature in 100ths of a C + uint16_t mWaterTemperature; + + // The % of water at temperature mReplacedWaterTemperature + uint16_t mReplacedWaterTemperature; + + // Boost command parameters + + // This field SHALL indicate whether the BOOST state should be automatically canceled once the hot water has first reached the + // set point temperature (or the TemporarySetpoint temperature, if specified) for the TargetPercentage (if specified). + Optional mBoostOneShot; + + // This field indicates that the consumer wants the water to be heated as quickly as practicable. This MAY cause multiple heat + // sources to be activated (e.g. a heat pump and direct electric heating element). + Optional mBoostEmergencyBoost; + + // This field indicates the target temperature to which to heat the hot water for this Boost command. It SHALL be used instead + // of the normal set point temperature whilst the BOOST state is active. + Optional mBoostTemporarySetpoint; + + // If the tank supports the TankPercent feature, this field indicates the amount of water that SHALL be heated by this Boost + // command before the heater is switched off. This field is optional, however it SHALL be included if the TargetReheat field is + // included. + Optional mBoostTargetPercentage; + + // If the tank supports the TankPercent feature, and the heating by this Boost command has ceased because the TargetPercentage + // of the water in the tank has been heated to the set point (or TemporarySetpoint if included), this field indicates the + // percentage to which the hot water in the tank SHALL be allowed to fall before again beginning to reheat it. For example if + // the TargetPercentage was 80%, and the TargetReheat was 40%, then after initial heating to 80% hot water, the tank may have + // hot water drawn off until only 40% hot water remains. At this point the heater will begin to heat back up to 80% of hot + // water. If this field and the OneShot field were both omitted, heating would begin again after any water draw which reduced + // the TankPercentage below 80%. + Optional mBoostTargetReheat; + + // Track whether the water temperature has reached the water temperature specified in the boost command. Used in conjunction + // with the boost command boostTargetReheat parameter + bool mBoostTargetTemperatureReached; + + /********************************************************************************* + * + * Member variables implementing the WaterHeaterManagement::Delegate interface + * + *********************************************************************************/ + + // This attribute SHALL indicate the methods to call for heat that the controller supports. If a bit is set then the controller + // supports the corresponding method. + BitMask mHeaterTypes; + + // This attribute SHALL indicate if the controller is asking for heat. If a bit is set then the corresponding call for heat is + // active. + BitMask mHeatDemand; + + // This attribute SHALL indicate the volume of water that the hot water tank can hold (in units of Litres). This allows an + // energy management system to estimate the required heating energy needed to reach the target temperature. + uint16_t mTankVolume; + + // This attribute SHALL indicate the estimated heat energy needed to raise the water temperature to the target setpoint. This + // can be computed by taking the specific heat capacity of water (4182 J/kg °C) and by knowing the current temperature of the + // water, the tank volume and target temperature. + int64_t mEstimatedHeatRequired; + + // This attribute SHALL indicate an approximate level of hot water stored in the tank, which may help consumers understand the + // amount of hot water remaining in the tank. + Percent mTankPercentage; + + // This attribute SHALL indicate if the BOOST state, as triggered by a Boost command, is currently active. + BoostStateEnum mBoostState; +}; + +} // namespace WaterHeaterManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/include/WhmInstance.h b/examples/all-clusters-app/all-clusters-common/include/WhmInstance.h new file mode 100644 index 00000000000000..a776bd92b99534 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/include/WhmInstance.h @@ -0,0 +1,58 @@ +/* + * + * 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 + +namespace chip { +namespace app { +namespace Clusters { +namespace WaterHeaterManagement { +using namespace chip::app::Clusters::WaterHeaterManagement; + +class WaterHeaterManagementInstance : public Instance +{ +public: + WaterHeaterManagementInstance(EndpointId aEndpointId, WaterHeaterManagementDelegate & aDelegate, Feature aFeature) : + WaterHeaterManagement::Instance(aEndpointId, aDelegate, aFeature) + { + mDelegate = &aDelegate; + } + + // Delete copy constructor and assignment operator. + WaterHeaterManagementInstance(const WaterHeaterManagementInstance &) = delete; + WaterHeaterManagementInstance(const WaterHeaterManagementInstance &&) = delete; + WaterHeaterManagementInstance & operator=(const WaterHeaterManagementInstance &) = delete; + + CHIP_ERROR Init(); + void Shutdown(); + + WaterHeaterManagementDelegate * GetDelegate() { return mDelegate; }; + +private: + WaterHeaterManagementDelegate * mDelegate; +}; + +} // namespace WaterHeaterManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/include/WhmMain.h b/examples/all-clusters-app/all-clusters-common/include/WhmMain.h new file mode 100644 index 00000000000000..21dc9d86519307 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/include/WhmMain.h @@ -0,0 +1,32 @@ +/* + * + * 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 + +namespace chip { +namespace app { +namespace Clusters { +namespace WaterHeaterManagement { + +void WhmApplicationInit(); +void WhmApplicationShutdown(); + +} // namespace WaterHeaterManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/include/WhmManufacturer.h b/examples/all-clusters-app/all-clusters-common/include/WhmManufacturer.h new file mode 100644 index 00000000000000..d51e6a62f2021c --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/include/WhmManufacturer.h @@ -0,0 +1,139 @@ +/* + * + * 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 WaterHeaterManagement { + +/** + * The WhmManufacturer example class + * + * Helps with handling the test triggers. + */ + +class WhmManufacturer +{ +public: + WhmManufacturer(WaterHeaterManagementInstance * whmInstance) { mWhmInstance = whmInstance; } + + WaterHeaterManagementInstance * GetWhmInstance() { return mWhmInstance; } + + WaterHeaterManagementDelegate * GetWhmDelegate() + { + if (mWhmInstance) + { + return mWhmInstance->GetDelegate(); + } + + return nullptr; + } + + /** + * @brief Called at start up to apply hardware settings + */ + CHIP_ERROR Init(); + + /** + * @brief Called at shutdown + */ + CHIP_ERROR Shutdown(); + + /** + * @brief Called to determine which heating sources to use, + */ + BitMask DetermineHeatingSources(); + + /** + * @brief Turn the heating of the water tank on. + * + * @param emergencyBoost Indicates that the consumer wants the water to be heated as quickly as practicable. This MAY cause + * multiple heat sources to be activated (e.g. a heat pump and direct electric heating element). + * @return An error if a problem occurs turning the heating on + */ + Protocols::InteractionModel::Status TurnHeatingOn(bool emergencyBoost); + + /** + * @brief Turn the heating of the water tank off. + * + * @return An error if a problem occurs turning the heating off + */ + Protocols::InteractionModel::Status TurnHeatingOff(); + + /** + * @brief Called to handle a boost command. + * + * @param duration Indicates the time period in seconds for which the BOOST state is activated before it automatically reverts + * to the previous mode (e.g. OFF, MANUAL or TIMED). + * @param oneShot Indicates whether the BOOST state should be automatically canceled once the hot water has first reached the + * set point temperature (or the TemporarySetpoint temperature, if specified) for the TargetPercentage (if + * specified). + * @param emergencyBoost Indicates that the consumer wants the water to be heated as quickly as practicable. This MAY cause + * multiple heat sources to be activated (e.g. a heat pump and direct electric heating element). + * @param temporarySetpoint Indicates the target temperature to which to heat the hot water for this Boost command. It SHALL be + * used instead of the normal set point temperature whilst the BOOST state is active. + * @param targetPercentage If the tank supports the TankPercent feature, this field indicates the amount of water that SHALL be + * heated by this Boost command before the heater is switched off. + * @param targetReheat If the tank supports the TankPercent feature, and the heating by this Boost command has ceased because + * the TargetPercentage of the water in the tank has been heated to the set point (or TemporarySetpoint if + * included), this field indicates the percentage to which the hot water in the tank SHALL be allowed to fall before again + * beginning to reheat it. + * + * @return Success if the boost command is successful; otherwise return the appropriate error. + */ + Protocols::InteractionModel::Status BoostCommandStarted(uint32_t duration, Optional oneShot, + Optional emergencyBoost, Optional temporarySetpoint, + Optional targetPercentage, + Optional targetReheat); + + /** + * @brief Called when the Boost command has been cancelled. + * + * @return It should report SUCCESS if successful and FAILURE otherwise. + */ + Protocols::InteractionModel::Status BoostCommandCancelled(); + + /** + * @brief Called when a boost command has completed. + */ + void BoostCommandFinished(); + +private: + WaterHeaterManagementInstance * mWhmInstance; +}; + +/** @brief Helper function to return the singleton WhmManufacturer instance + * + * This is needed by the WhmManufacturer class to support TestEventTriggers + * which are called outside of any class context. This allows the WhmManufacturer + * class to return the relevant Delegate instance in which to invoke the test + * events on. + * + * This function is typically found in main.cpp or wherever the singleton is created. + */ +WhmManufacturer * GetWhmManufacturer(); + +} // namespace WaterHeaterManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/include/water-heater-mode.h b/examples/all-clusters-app/all-clusters-common/include/water-heater-mode.h new file mode 100755 index 00000000000000..9f3515094ed255 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/include/water-heater-mode.h @@ -0,0 +1,73 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { + +namespace WaterHeaterMode { + +constexpr uint8_t kModeOff = 0; +constexpr uint8_t kModeManual = 1; +constexpr uint8_t kModeTimed = 2; + +/// This is an application level delegate to handle WaterHeaterMode commands according to the specific business logic. +class ExampleWaterHeaterModeDelegate : public ModeBase::Delegate +{ +private: + using ModeTagStructType = detail::Structs::ModeTagStruct::Type; + ModeTagStructType modeTagsOff[1] = { { .value = to_underlying(ModeTag::kOff) } }; + ModeTagStructType modeTagsManual[1] = { { .value = to_underlying(ModeTag::kManual) } }; + ModeTagStructType modeTagsTimed[1] = { { .value = to_underlying(ModeTag::kTimed) } }; + + const detail::Structs::ModeOptionStruct::Type kModeOptions[3] = { + detail::Structs::ModeOptionStruct::Type{ + .label = "Off"_span, .mode = kModeOff, .modeTags = DataModel::List(modeTagsOff) }, + detail::Structs::ModeOptionStruct::Type{ + .label = "Manual"_span, .mode = kModeManual, .modeTags = DataModel::List(modeTagsManual) }, + detail::Structs::ModeOptionStruct::Type{ + .label = "Timed"_span, .mode = kModeTimed, .modeTags = DataModel::List(modeTagsTimed) } + }; + + CHIP_ERROR Init() override; + void HandleChangeToMode(uint8_t mode, ModeBase::Commands::ChangeToModeResponse::Type & response) override; + + CHIP_ERROR GetModeLabelByIndex(uint8_t modeIndex, MutableCharSpan & label) override; + CHIP_ERROR GetModeValueByIndex(uint8_t modeIndex, uint8_t & value) override; + CHIP_ERROR GetModeTagsByIndex(uint8_t modeIndex, DataModel::List & tags) override; + +public: + ~ExampleWaterHeaterModeDelegate() override = default; +}; + +ModeBase::Instance * Instance(); + +void Shutdown(); + +} // namespace WaterHeaterMode + +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/src/WhmDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/WhmDelegateImpl.cpp new file mode 100644 index 00000000000000..fd19a3c59d740b --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/WhmDelegateImpl.cpp @@ -0,0 +1,461 @@ +/* + * + * 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 + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::WaterHeaterManagement; + +using Protocols::InteractionModel::Status; + +WaterHeaterManagementDelegate::WaterHeaterManagementDelegate(EndpointId clustersEndpoint) : + mpWhmInstance(nullptr), mpWhmManufacturer(nullptr), mWaterTemperature(0), mReplacedWaterTemperature(0), + mBoostTargetTemperatureReached(false), mTankVolume(0), mEstimatedHeatRequired(0), mTankPercentage(0), + mBoostState(BoostStateEnum::kInactive) +{} + +void WaterHeaterManagementDelegate::SetWaterHeaterManagementInstance(WaterHeaterManagement::Instance & instance) +{ + mpWhmInstance = &instance; +} + +void WaterHeaterManagementDelegate::SetWhmManufacturer(WhmManufacturer & whmManufacturer) +{ + mpWhmManufacturer = &whmManufacturer; +} + +/********************************************************************************* + * + * Methods implementing the WaterHeaterManagement::Delegate interace + * + *********************************************************************************/ + +BitMask WaterHeaterManagementDelegate::GetHeaterTypes() +{ + return mHeaterTypes; +} + +BitMask WaterHeaterManagementDelegate::GetHeatDemand() +{ + return mHeatDemand; +} + +uint16_t WaterHeaterManagementDelegate::GetTankVolume() +{ + return mTankVolume; +} + +int64_t WaterHeaterManagementDelegate::GetEstimatedHeatRequired() +{ + return mEstimatedHeatRequired; +} + +Percent WaterHeaterManagementDelegate::GetTankPercentage() +{ + return mTankPercentage; +} + +BoostStateEnum WaterHeaterManagementDelegate::GetBoostState() +{ + return mBoostState; +} + +void WaterHeaterManagementDelegate::SetHeaterTypes(BitMask heaterTypes) +{ + if (mHeaterTypes != heaterTypes) + { + mHeaterTypes = heaterTypes; + + MatterReportingAttributeChangeCallback(mEndpointId, WaterHeaterManagement::Id, Attributes::HeaterTypes::Id); + } +} + +void WaterHeaterManagementDelegate::SetHeatDemand(BitMask heatDemand) +{ + if (mHeatDemand != heatDemand) + { + mHeatDemand = heatDemand; + + MatterReportingAttributeChangeCallback(mEndpointId, WaterHeaterManagement::Id, Attributes::HeatDemand::Id); + } +} + +void WaterHeaterManagementDelegate::SetTankVolume(uint16_t tankVolume) +{ + if (mTankVolume != tankVolume) + { + mTankVolume = tankVolume; + + MatterReportingAttributeChangeCallback(mEndpointId, WaterHeaterManagement::Id, Attributes::TankVolume::Id); + } +} + +void WaterHeaterManagementDelegate::SetEstimatedHeatRequired(int64_t estimatedHeatRequired) +{ + if (mEstimatedHeatRequired != estimatedHeatRequired) + { + mEstimatedHeatRequired = estimatedHeatRequired; + + MatterReportingAttributeChangeCallback(mEndpointId, WaterHeaterManagement::Id, Attributes::EstimatedHeatRequired::Id); + } +} + +void WaterHeaterManagementDelegate::SetTankPercentage(Percent tankPercentage) +{ + if (mpWhmInstance != nullptr && mpWhmInstance->HasFeature(Feature::kTankPercent)) + { + if (mTankPercentage != tankPercentage) + { + mTankPercentage = tankPercentage; + + CheckIfHeatNeedsToBeTurnedOnOrOff(); + + MatterReportingAttributeChangeCallback(mEndpointId, WaterHeaterManagement::Id, Attributes::TankPercentage::Id); + } + } +} + +void WaterHeaterManagementDelegate::SetBoostState(BoostStateEnum boostState) +{ + if (mBoostState != boostState) + { + mBoostState = boostState; + + MatterReportingAttributeChangeCallback(mEndpointId, WaterHeaterManagement::Id, Attributes::BoostState::Id); + } +} + +/** + * @brief Handles the boost command + * + * Upon receipt, the Water Heater SHALL transition into the BOOST state, which SHALL cause the water in the tank (or + * the TargetPercentage of the water, if included) to be heated towards the set point (or the TemporarySetpoint, if + * included), which in turn may cause a call for heat, even if the mode is OFF, or is TIMED and it is during one of + * the Off periods. + */ +Status WaterHeaterManagementDelegate::HandleBoost(uint32_t durationS, Optional oneShot, Optional emergencyBoost, + Optional temporarySetpoint, Optional targetPercentage, + Optional targetReheat) +{ + Status status = Status::Success; + + ChipLogProgress(AppServer, "HandleBoost"); + + // Keep track of the boost command parameters + mBoostOneShot = oneShot; + mBoostEmergencyBoost = emergencyBoost; + mBoostTemporarySetpoint = temporarySetpoint; + mBoostTargetPercentage = targetPercentage; + mBoostTargetReheat = targetReheat; + + mBoostTargetTemperatureReached = false; + + // If a timer is running, cancel it so we can start a new boost command with the new duration + if (mBoostState == BoostStateEnum::kActive) + { + DeviceLayer::SystemLayer().CancelTimer(BoostTimerExpiry, this); + } + + CHIP_ERROR err = DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(durationS), BoostTimerExpiry, this); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "HandleBoost: Unable to start a Boost timer: %" CHIP_ERROR_FORMAT, err.Format()); + + // Not a lot we can do -> just set the boost state to inactive + SetBoostState(BoostStateEnum::kInactive); + + return Status::Failure; + } + + // Now running a boost command + SetBoostState(BoostStateEnum::kActive); + + if (mpWhmManufacturer != nullptr) + { + status = mpWhmManufacturer->BoostCommandStarted(durationS, oneShot, emergencyBoost, temporarySetpoint, targetPercentage, + targetReheat); + } + else + { + status = Status::InvalidInState; + ChipLogError(AppServer, "HandleBoost: mpWhmManufacturer == nullptr"); + } + + if (status == Status::Success) + { + // See if the heat needs to be turned on or off as a result of this boost command + status = CheckIfHeatNeedsToBeTurnedOnOrOff(); + } + + return status; +} + +void WaterHeaterManagementDelegate::BoostTimerExpiry(System::Layer * systemLayer, void * delegate) +{ + WaterHeaterManagementDelegate * dg = static_cast(delegate); + + dg->HandleBoostTimerExpiry(); +} + +/** + * @brief Timer for handling the completion of a boost command + */ +void WaterHeaterManagementDelegate::HandleBoostTimerExpiry() +{ + ChipLogError(AppServer, "HandleBoostTimerExpiry"); + + // The PowerAdjustment is no longer in progress + SetBoostState(BoostStateEnum::kInactive); + + if (mpWhmManufacturer != nullptr) + { + mpWhmManufacturer->BoostCommandFinished(); + } + else + { + ChipLogError(AppServer, "HandleBoostTimerExpiry: mpWhmManufacturer == nullptr"); + } + + CheckIfHeatNeedsToBeTurnedOnOrOff(); +} + +/** + * @brief Cancels a boost command + * + * Upon receipt, the Water Heater SHALL transition back from the BOOST state to the previous mode (e.g. OFF, MANUAL or TIMED). + */ +Status WaterHeaterManagementDelegate::HandleCancelBoost() +{ + ChipLogProgress(AppServer, "HandleCancelBoost"); + + if (mBoostState == BoostStateEnum::kActive) + { + SetBoostState(BoostStateEnum::kInactive); + mBoostEmergencyBoost.ClearValue(); + + DeviceLayer::SystemLayer().CancelTimer(BoostTimerExpiry, this); + + VerifyOrReturnValue(mpWhmManufacturer != nullptr, Status::InvalidInState); + + Status status = mpWhmManufacturer->BoostCommandCancelled(); + VerifyOrReturnValue(status == Status::Success, status); + + status = CheckIfHeatNeedsToBeTurnedOnOrOff(); + VerifyOrReturnValue(status == Status::Success, status); + } + + return Status::Success; +} + +/********************************************************************************* + * + * WaterHeaterManagementDelegate specific methods + * + *********************************************************************************/ + +void WaterHeaterManagementDelegate::SetWaterTemperature(uint16_t waterTemperature) +{ + mWaterTemperature = waterTemperature; + + if (mpWhmInstance != nullptr && mpWhmInstance->HasFeature(Feature::kTankPercent)) + { + mTankPercentage = 100; + } + + // See if the heat needs to be turned on or off + CheckIfHeatNeedsToBeTurnedOnOrOff(); +} + +void WaterHeaterManagementDelegate::SetTargetWaterTemperature(uint16_t targetWaterTemperature) +{ + mTargetWaterTemperature = targetWaterTemperature; + + // See if the heat needs to be turned on or off + CheckIfHeatNeedsToBeTurnedOnOrOff(); +} + +void WaterHeaterManagementDelegate::DrawOffHotWater(uint8_t percentageReplaced, uint16_t replacedWaterTemperature) +{ + // Only supported in the kTankPercent is supported. + // Replaces percentageReplaced% of the water in the tank with water of a temperature replacedWaterTemperature + if (mpWhmInstance != nullptr && mpWhmInstance->HasFeature(Feature::kTankPercent)) + { + // See if all of the water has now been replaced with replacedWaterTemperature + if (mTankPercentage >= percentageReplaced) + { + mTankPercentage -= percentageReplaced; + } + else + { + mTankPercentage = 0; + } + + mReplacedWaterTemperature = replacedWaterTemperature; + + CheckIfHeatNeedsToBeTurnedOnOrOff(); + } +} + +bool WaterHeaterManagementDelegate::HasWaterTemperatureReachedTarget() const +{ + // Determine the target temperature. If a boost command is in progress and has a mBoostTemporarySetpoint value use that as the + // target temperature. + // Note, in practise the actual heating is likely to be controlled by the thermostat's occupiedHeatingSetpoint most of the + // time, and the TemporarySetpoint (if not null) would be overiding the thermostat's occupiedHeatingSetpoint. + // However, this code doesn't rely upon the thermostat cluster. + uint16_t targetTemperature = (mBoostState == BoostStateEnum::kActive && mBoostTemporarySetpoint.HasValue()) + ? static_cast(mBoostTemporarySetpoint.Value()) + : mTargetWaterTemperature; + + VerifyOrReturnValue(mWaterTemperature >= targetTemperature, false); + + if (mBoostState == BoostStateEnum::kActive) + { + if (mBoostTargetTemperatureReached && mBoostTargetReheat.HasValue()) + { + // If the tank supports the TankPercent feature, and the heating by this Boost command has ceased because the + // TargetPercentage of the water in the tank has been heated to the set point (or TemporarySetpoint if included), + // mBoostTargetReheat indicates the percentage to which the hot water in the tank SHALL be allowed to fall before + // again beginning to reheat it. + // + // For example if the TargetPercentage was 80%, and the TargetReheat was 40%, then after initial heating to 80% hot + // water, the tank may have hot water drawn off until only 40% hot water remains. At this point the heater will begin to + // heat back up to 80% of hot water. If this field and the OneShot field were both omitted, heating would begin again + // after any water draw which reduced the TankPercentage below 80%. + + // If this field is included then the TargetPercentage field SHALL also be included, and the OneShot excluded. + VerifyOrReturnValue(mTankPercentage >= mBoostTargetReheat.Value(), false); + } + else if (mBoostTargetPercentage.HasValue()) + { + // If tank percentage is supported AND the targetPercentage.HasValue() then use target percentage to heat up. + VerifyOrReturnValue(mTankPercentage >= mBoostTargetPercentage.Value(), false); + } + } + + // Must have reached the right temperature + return true; +} + +Status WaterHeaterManagementDelegate::CheckIfHeatNeedsToBeTurnedOnOrOff() +{ + VerifyOrReturnError(mpWhmManufacturer != nullptr, Status::InvalidInState); + + HeatingOp heatingOp = HeatingOp::LeaveHeatingUnchanged; + + Status status = DetermineIfChangingHeatingState(heatingOp); + + VerifyOrReturnError(status == Status::Success, status); + + if (heatingOp == HeatingOp::TurnHeatingOn) + { + status = mpWhmManufacturer->TurnHeatingOn(mBoostEmergencyBoost.HasValue() ? mBoostEmergencyBoost.Value() : false); + } + else if (heatingOp == HeatingOp::TurnHeatingOff) + { + // If running a boost command with the oneShot parameter and turning heat off, then must have + // reached the boost command target temperature -> that's the boost command complete. + if (mBoostState == BoostStateEnum::kActive && mBoostOneShot.HasValue() && mBoostOneShot.Value()) + { + SetBoostState(BoostStateEnum::kInactive); + + DeviceLayer::SystemLayer().CancelTimer(BoostTimerExpiry, this); + + mBoostEmergencyBoost.ClearValue(); + + status = mpWhmManufacturer->BoostCommandCancelled(); + } + + // Turn the heating off + status = mpWhmManufacturer->TurnHeatingOff(); + } + + return status; +} + +Status WaterHeaterManagementDelegate::DetermineIfChangingHeatingState(HeatingOp & heatingOp) +{ + heatingOp = LeaveHeatingUnchanged; + + if (!HasWaterTemperatureReachedTarget()) + { + VerifyOrReturnError(WaterHeaterMode::Instance() != nullptr, Status::InvalidInState); + + uint8_t mode = WaterHeaterMode::Instance()->GetCurrentMode(); + + // The water in the tank is not at the target temperature. See if heating is currently off + if (mHeatDemand.Raw() == 0) + { + // Need to track whether the water temperature has reached the target temperature for the boost + // command when a oneShot option has been applied. + if (mBoostState == BoostStateEnum::kActive) + { + mBoostTargetTemperatureReached = false; + } + + // If a boost command is in progress or in manual mode, find a heating source and "turn it on". + if (mBoostState == BoostStateEnum::kActive || mode == WaterHeaterMode::kModeManual) + { + heatingOp = HeatingOp::TurnHeatingOn; + } + } + else if (mBoostState == BoostStateEnum::kInactive && mode == WaterHeaterMode::kModeOff) + { + // The water temperature is not at the target temperature but there is no boost command in progress and the mode is Off + // so need to ensure the heating is turned off. + ChipLogError(AppServer, "DetermineIfChangingHeatingState turning heating off due to no boost cmd and kModeOff"); + + heatingOp = HeatingOp::TurnHeatingOff; + } + } + else if (mHeatDemand.Raw() != 0) + { + // The water in the tank has reached the target temperature - need to turn the heating off + heatingOp = HeatingOp::TurnHeatingOff; + + // If a boost command is in progress, record that the target temperature has been reached. + mBoostTargetTemperatureReached = (mBoostState == BoostStateEnum::kActive); + } + + return Status::Success; +} + +Status WaterHeaterManagementDelegate::SetWaterHeaterMode(uint8_t modeValue) +{ + VerifyOrReturnError(WaterHeaterMode::Instance() != nullptr, Status::InvalidInState); + + if (!WaterHeaterMode::Instance()->IsSupportedMode(modeValue)) + { + ChipLogError(AppServer, "SetWaterHeaterMode bad mode"); + return Status::ConstraintError; + } + + Status status = WaterHeaterMode::Instance()->UpdateCurrentMode(modeValue); + if (status != Status::Success) + { + ChipLogError(AppServer, "SetWaterHeaterMode updateMode failed 0x%02x", to_underlying(status)); + return status; + } + + return CheckIfHeatNeedsToBeTurnedOnOrOff(); +} diff --git a/examples/all-clusters-app/all-clusters-common/src/WhmInstance.cpp b/examples/all-clusters-app/all-clusters-common/src/WhmInstance.cpp new file mode 100644 index 00000000000000..9d4ad58fefd976 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/WhmInstance.cpp @@ -0,0 +1,34 @@ +/* + * + * 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 + +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::WaterHeaterManagement; + +CHIP_ERROR WaterHeaterManagementInstance::Init() +{ + ChipLogDetail(AppServer, "WaterHeaterManagementInstance::Init()"); + return Instance::Init(); +} + +void WaterHeaterManagementInstance::Shutdown() +{ + Instance::Shutdown(); +} diff --git a/examples/all-clusters-app/all-clusters-common/src/WhmMain.cpp b/examples/all-clusters-app/all-clusters-common/src/WhmMain.cpp new file mode 100644 index 00000000000000..ea59fef2d095f5 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/WhmMain.cpp @@ -0,0 +1,194 @@ +/* + * + * 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 +#include +#include + +static constexpr int WHM_ENDPOINT = 1; + +using namespace chip; +using namespace chip::app; +using namespace chip::app::DataModel; +using namespace chip::app::Clusters; + +namespace chip { +namespace app { +namespace Clusters { +namespace WaterHeaterManagement { + +static std::unique_ptr gWhmDelegate; +static std::unique_ptr gWhmInstance; + +static std::unique_ptr gWhmManufacturer; + +WhmManufacturer * GetWhmManufacturer() +{ + return gWhmManufacturer.get(); +} + +/* + * @brief Creates a Delegate and Instance for Water Heater Management cluster + * + * The Instance is a container around the Delegate, so + * create the Delegate first, then wrap it in the Instance + * Then call the Instance->Init() to register the attribute and command handlers + */ +CHIP_ERROR WhmInit() +{ + CHIP_ERROR err; + + if (gWhmDelegate || gWhmInstance) + { + ChipLogError(AppServer, "WaterHeaterManager Instance or Delegate already exist."); + return CHIP_ERROR_INCORRECT_STATE; + } + + gWhmDelegate = std::make_unique(WHM_ENDPOINT); + if (!gWhmDelegate) + { + ChipLogError(AppServer, "Failed to allocate memory for WaterHeaterManagementDelegate"); + return CHIP_ERROR_NO_MEMORY; + } + + /* Manufacturer may optionally not support all features, commands & attributes */ + gWhmInstance = std::make_unique( + EndpointId(WHM_ENDPOINT), *gWhmDelegate, BitMask(Feature::kEnergyManagement, Feature::kTankPercent)); + if (!gWhmInstance) + { + ChipLogError(AppServer, "Failed to allocate memory for WaterHeaterManagementInstance"); + gWhmDelegate.reset(); + return CHIP_ERROR_NO_MEMORY; + } + + /* Register Attribute & Command handlers */ + err = gWhmInstance->Init(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "gWhmInstance->Init failed %s", chip::ErrorStr(err)); + gWhmInstance.reset(); + gWhmDelegate.reset(); + return err; + } + + gWhmDelegate->SetWaterHeaterManagementInstance(*gWhmInstance); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR WhmShutdown() +{ + /* Do this in the order Instance first, then delegate + * Ensure we call the Instance->Shutdown to free attribute & command handlers first + */ + if (gWhmInstance) + { + /* Deregister attribute & command handlers */ + gWhmInstance->Shutdown(); + gWhmInstance.reset(); + } + + if (gWhmDelegate) + { + gWhmDelegate.reset(); + } + + return CHIP_NO_ERROR; +} + +/* + * @brief Creates a WhmManufacturer class to hold the Whm cluster + * + * The Instance is a container around the Delegate, so + * create the Delegate first, then wrap it in the Instance + * Then call the Instance->Init() to register the attribute and command handlers + */ +CHIP_ERROR WhmManufacturerInit() +{ + CHIP_ERROR err; + + if (gWhmManufacturer) + { + ChipLogError(AppServer, "WhmManufacturer already exist."); + return CHIP_ERROR_INCORRECT_STATE; + } + + /* Now create WhmManufacturer */ + gWhmManufacturer = std::make_unique(gWhmInstance.get()); + if (!gWhmManufacturer) + { + ChipLogError(AppServer, "Failed to allocate memory for WhmManufacturer"); + return CHIP_ERROR_NO_MEMORY; + } + + /* Call Manufacturer specific init */ + err = gWhmManufacturer->Init(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Init failed on gWhmManufacturer"); + gWhmManufacturer.reset(); + return err; + } + + // Let the WhmDelegate know about the WhmManufacturer object. + gWhmDelegate->SetWhmManufacturer(*gWhmManufacturer); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR WhmManufacturerShutdown() +{ + if (gWhmManufacturer) + { + /* Shutdown the WhmManufacturer */ + gWhmManufacturer->Shutdown(); + gWhmManufacturer.reset(); + } + + return CHIP_NO_ERROR; +} + +void WhmApplicationInit() +{ + if (WhmInit() != CHIP_NO_ERROR) + { + return; + } + + /* Do this last so that the instances for other clusters can be wrapped inside */ + if (WhmManufacturerInit() != CHIP_NO_ERROR) + { + WhmShutdown(); + return; + } +} + +void WhmApplicationShutdown() +{ + /* Shutdown in reverse order that they were created */ + WhmManufacturerShutdown(); +} + +} // namespace WaterHeaterManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/src/WhmManufacturer.cpp b/examples/all-clusters-app/all-clusters-common/src/WhmManufacturer.cpp new file mode 100644 index 00000000000000..dd8452a5c816ca --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/WhmManufacturer.cpp @@ -0,0 +1,286 @@ +/* + * + * 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 +#include +#include + +using namespace chip; +using namespace chip::app::Clusters::WaterHeaterManagement; + +using Protocols::InteractionModel::Status; + +namespace chip { +namespace app { +namespace Clusters { +namespace WaterHeaterManagement { + +CHIP_ERROR WhmManufacturer::Init() +{ + WaterHeaterManagementDelegate * dg = GetWhmManufacturer()->GetWhmDelegate(); + if (dg == nullptr) + { + ChipLogError(AppServer, "WhmDelegate is not initialized"); + return CHIP_ERROR_UNINITIALIZED; + } + + dg->SetHeaterTypes(BitMask(WaterHeaterTypeBitmap::kImmersionElement1)); + dg->SetHeatDemand(BitMask(WaterHeaterDemandBitmap::kImmersionElement1)); + dg->SetEstimatedHeatRequired(10000); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR WhmManufacturer::Shutdown() +{ + return CHIP_NO_ERROR; +} + +BitMask WhmManufacturer::DetermineHeatingSources() +{ + WaterHeaterManagementDelegate * dg = GetWhmManufacturer()->GetWhmDelegate(); + if (dg == nullptr) + { + ChipLogError(AppServer, "WhmDelegate is not initialized"); + return BitMask(0); + } + + // A list of valid heaterTypes + uint8_t waterHeaterTypeValues[] = { + static_cast(WaterHeaterTypeBitmap::kImmersionElement1), + static_cast(WaterHeaterTypeBitmap::kImmersionElement2), + static_cast(WaterHeaterTypeBitmap::kHeatPump), + static_cast(WaterHeaterTypeBitmap::kBoiler), + static_cast(WaterHeaterTypeBitmap::kOther), + }; + + // The corresponding list of valid headerDemands + uint8_t waterHeaterDemandValues[] = { + static_cast(WaterHeaterDemandBitmap::kImmersionElement1), + static_cast(WaterHeaterDemandBitmap::kImmersionElement2), + static_cast(WaterHeaterDemandBitmap::kHeatPump), + static_cast(WaterHeaterDemandBitmap::kBoiler), + static_cast(WaterHeaterDemandBitmap::kOther), + }; + + // Iterate across the valid waterHeaterTypes seeing which heating sources are available based on heaterTypes. + // Set the corresponding bit in the heaterDemand bitmap. + BitMask heaterTypes = dg->GetHeaterTypes(); + + uint8_t heaterDemandMask = 0; + for (uint16_t idx = 0; idx < static_cast(sizeof(waterHeaterTypeValues) / sizeof(waterHeaterTypeValues[0])); idx++) + { + // Is this heating source being used? + if (heaterTypes.Raw() & waterHeaterTypeValues[idx]) + { + heaterDemandMask |= waterHeaterDemandValues[idx]; + } + } + + return BitMask(heaterDemandMask); +} + +Status WhmManufacturer::TurnHeatingOn(bool emergencyBoost) +{ + Status status = Status::Success; + + ChipLogProgress(AppServer, "WhmManufacturer::TurnHeatingOn"); + + WaterHeaterManagementDelegate * dg = GetWhmDelegate(); + + if (emergencyBoost) + { + // emergencyBoost that the consumer wants the water to be heated as quickly as practicable. + // Thus, cause multiple heat sources to be activated + dg->SetHeatDemand(BitMask(WaterHeaterDemandBitmap::kImmersionElement1, + WaterHeaterDemandBitmap::kImmersionElement2)); + } + else + { + dg->SetHeatDemand(BitMask(WaterHeaterDemandBitmap::kImmersionElement1)); + } + + return status; +} + +Status WhmManufacturer::TurnHeatingOff() +{ + Status status = Status::Success; + + ChipLogProgress(AppServer, "WhmManufacturer::TurnHeatingOff"); + + WaterHeaterManagementDelegate * dg = GetWhmDelegate(); + + dg->SetHeatDemand(BitMask(0)); + + return status; +} + +Status WhmManufacturer::BoostCommandStarted(uint32_t duration, Optional oneShot, Optional emergencyBoost, + Optional temporarySetpoint, Optional targetPercentage, + Optional targetReheat) +{ + return Status::Success; +} + +Status WhmManufacturer::BoostCommandCancelled() +{ + return Status::Success; +} + +void WhmManufacturer::BoostCommandFinished() {} + +WaterHeaterManagementDelegate * GetWhmDelegate() +{ + WhmManufacturer * mn = GetWhmManufacturer(); + VerifyOrDieWithMsg(mn != nullptr, AppServer, "WhmManufacturer is null"); + + WaterHeaterManagementDelegate * wg = mn->GetWhmDelegate(); + VerifyOrDieWithMsg(wg != nullptr, AppServer, "WhmDelegate is null"); + + return wg; +} + +void SetTestEventTrigger_BasicInstallationTestEvent() +{ + WaterHeaterManagementDelegate * dg = GetWhmDelegate(); + + // Simulate installation in a 100L tank full of water at 20C, with a target temperature of 60C, in OFF mode + dg->SetTankVolume(100); + dg->SetTargetWaterTemperature(6000); + dg->SetHeaterTypes(BitMask(WaterHeaterTypeBitmap::kImmersionElement1)); + dg->DrawOffHotWater(100, 2000); +} + +void SetTestEventTrigger_BasicInstallationTestEventClear() {} + +void SetTestEventTrigger_WaterTemperature20CTestEvent() +{ + WaterHeaterManagementDelegate * dg = GetWhmDelegate(); + + // Simulate 100% of the water in the tank being at 20C + dg->SetWaterTemperature(2000); +} + +void SetTestEventTrigger_WaterTemperature61CTestEvent() +{ + WaterHeaterManagementDelegate * dg = GetWhmDelegate(); + + // Simulate 100% of the water in the tank being at 61C + dg->SetWaterTemperature(6100); +} + +void SetTestEventTrigger_WaterTemperature66CTestEvent() +{ + WaterHeaterManagementDelegate * dg = GetWhmDelegate(); + + // Simulate 100% of the water in the tank being at 66C + dg->SetWaterTemperature(6600); +} + +void SetTestEventTrigger_ManualModeTestEvent() +{ + WaterHeaterManagementDelegate * dg = GetWhmDelegate(); + + // Simulate the Water Heater Mode being set to MANUAL + Status status = dg->SetWaterHeaterMode(WaterHeaterMode::kModeManual); + if (status != Status::Success) + { + ChipLogError(Zcl, "SetTestEventTrigger_OffModeTestEvent setting mode -> KModeManual failed 0x%02x", to_underlying(status)); + } +} + +void SetTestEventTrigger_OffModeTestEvent() +{ + WaterHeaterManagementDelegate * dg = GetWhmDelegate(); + + // Simulate the Water Heater Mode being set to OFF + Status status = dg->SetWaterHeaterMode(WaterHeaterMode::kModeOff); + if (status != Status::Success) + { + ChipLogError(Zcl, "SetTestEventTrigger_OffModeTestEvent setting mode -> KModeOff failed 0x%02x", to_underlying(status)); + } +} + +void SetTestEventTrigger_DrawOffHotWaterTestEvent() +{ + WaterHeaterManagementDelegate * dg = GetWhmDelegate(); + + // Simulate drawing off 25% of the tank volume of hot water, replaced with water at 20C + dg->DrawOffHotWater(25, 2000); +} + +} // namespace WaterHeaterManagement +} // namespace Clusters +} // namespace app +} // namespace chip + +using namespace chip::app::Clusters::WaterHeaterManagement; + +bool HandleWaterHeaterManagementTestEventTrigger(uint64_t eventTrigger) +{ + WaterHeaterManagementTrigger trigger = static_cast(eventTrigger); + + switch (trigger) + { + case WaterHeaterManagementTrigger::kBasicInstallationTestEvent: + ChipLogProgress(Support, + "[Whm::kBasicInstallationTestEvent] => Simulate installation in a 100L tank full of water at 20C, with a " + "target temperature of 60C, in OFF mode"); + SetTestEventTrigger_BasicInstallationTestEvent(); + break; + case WaterHeaterManagementTrigger::kBasicInstallationTestEventClear: + ChipLogProgress(Support, "[Whm::kBasicInstallationTestEventClear] => End simulation of installation"); + SetTestEventTrigger_BasicInstallationTestEventClear(); + break; + case WaterHeaterManagementTrigger::kWaterTemperature20CTestEvent: + ChipLogProgress(Support, "[Whm::kWaterTemperature20CTestEvent] => Simulate 100%% of the water in the tank being at 20C"); + SetTestEventTrigger_WaterTemperature20CTestEvent(); + break; + case WaterHeaterManagementTrigger::kWaterTemperature61CTestEvent: + ChipLogProgress(Support, "[Whm::kWaterTemperature61CTestEvent] => Simulate 100%% of the water in the tank being at 61C"); + SetTestEventTrigger_WaterTemperature61CTestEvent(); + break; + case WaterHeaterManagementTrigger::kWaterTemperature66CTestEvent: + ChipLogProgress(Support, "[Whm::kWaterTemperature66CTestEvent] => Simulate 100%% of the water in the tank being at 66C"); + SetTestEventTrigger_WaterTemperature66CTestEvent(); + break; + case WaterHeaterManagementTrigger::kManualModeTestEvent: + ChipLogProgress(Support, "[Whm::kManualModeTestEvent] => Simulate the Water Heater Mode being set to MANUAL"); + SetTestEventTrigger_ManualModeTestEvent(); + break; + case WaterHeaterManagementTrigger::kOffModeTestEvent: + ChipLogProgress(Support, "[Whm::kOffModeTestEvent] => Simulate the Water Heater Mode being set to OFF"); + SetTestEventTrigger_OffModeTestEvent(); + break; + case WaterHeaterManagementTrigger::kDrawOffHotWaterTestEvent: + ChipLogProgress(Support, + "[Whm::kDrawOffHotWaterTestEvent] => Simulate drawing off 25%% of the tank volume of hot water, replaced " + "with water at 20C"); + SetTestEventTrigger_DrawOffHotWaterTestEvent(); + break; + default: + return false; + } + + return true; +} diff --git a/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp index 72fe588995784e..6acc81ac285b65 100644 --- a/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp @@ -23,14 +23,24 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::EnergyEvse; static std::unique_ptr gDelegate; +static std::unique_ptr gEvseTargetsDelegate; static std::unique_ptr gInstance; void emberAfEnergyEvseClusterInitCallback(chip::EndpointId endpointId) { VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. + VerifyOrDie(!gDelegate); + VerifyOrDie(!gEvseTargetsDelegate); VerifyOrDie(!gInstance); - gDelegate = std::make_unique(); + gEvseTargetsDelegate = std::make_unique(); + if (!gEvseTargetsDelegate) + { + ChipLogError(AppServer, "Failed to allocate memory for EvseTargetsDelegate"); + return; + } + + gDelegate = std::make_unique(*gEvseTargetsDelegate); if (gDelegate) { gInstance = std::make_unique( diff --git a/examples/all-clusters-app/all-clusters-common/src/occupancy-sensing-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/occupancy-sensing-stub.cpp new file mode 100644 index 00000000000000..dcbb90ff659bcb --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/occupancy-sensing-stub.cpp @@ -0,0 +1,57 @@ +/* + * + * 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 +#include +#include +#include + +using namespace chip; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::OccupancySensing; +using namespace chip::app::Clusters::OccupancySensing::Structs; +using namespace chip::DeviceLayer; + +using chip::Protocols::InteractionModel::Status; + +static std::unique_ptr + gAttrAccess[MATTER_DM_OCCUPANCY_SENSING_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT]; + +void emberAfOccupancySensingClusterInitCallback(EndpointId endpointId) +{ + VerifyOrDie(!gAttrAccess[endpointId]); + + gAttrAccess[endpointId] = std::make_unique( + BitMask(OccupancySensing::Feature::kOther)); + + OccupancySensing::Structs::HoldTimeLimitsStruct::Type holdTimeLimits = { + .holdTimeMin = 1, + .holdTimeMax = 300, + .holdTimeDefault = 10, + }; + + uint16_t holdTime = 10; + + if (gAttrAccess[endpointId]) + { + gAttrAccess[endpointId]->Init(); + + SetHoldTimeLimits(endpointId, holdTimeLimits); + + SetHoldTime(endpointId, holdTime); + } +} diff --git a/examples/all-clusters-app/all-clusters-common/src/water-heater-mode.cpp b/examples/all-clusters-app/all-clusters-common/src/water-heater-mode.cpp new file mode 100755 index 00000000000000..9c4121fb70d668 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/water-heater-mode.cpp @@ -0,0 +1,105 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include +#include + +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::WaterHeaterMode; +using chip::Protocols::InteractionModel::Status; +template +using List = chip::app::DataModel::List; +using ModeTagStructType = chip::app::Clusters::detail::Structs::ModeTagStruct::Type; + +static ExampleWaterHeaterModeDelegate * gWaterHeaterModeDelegate = nullptr; +static ModeBase::Instance * gWaterHeaterModeInstance = nullptr; + +CHIP_ERROR ExampleWaterHeaterModeDelegate::Init() +{ + return CHIP_NO_ERROR; +} + +// todo refactor code by making a parent class for all ModeInstance classes to reduce flash usage. +void ExampleWaterHeaterModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands::ChangeToModeResponse::Type & response) +{ + response.status = to_underlying(ModeBase::StatusCode::kSuccess); +} + +CHIP_ERROR ExampleWaterHeaterModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label) +{ + if (modeIndex >= ArraySize(kModeOptions)) + { + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; + } + return chip::CopyCharSpanToMutableCharSpan(kModeOptions[modeIndex].label, label); +} + +CHIP_ERROR ExampleWaterHeaterModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value) +{ + if (modeIndex >= ArraySize(kModeOptions)) + { + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; + } + value = kModeOptions[modeIndex].mode; + return CHIP_NO_ERROR; +} + +CHIP_ERROR ExampleWaterHeaterModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List & tags) +{ + if (modeIndex >= ArraySize(kModeOptions)) + { + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; + } + + if (tags.size() < kModeOptions[modeIndex].modeTags.size()) + { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + std::copy(kModeOptions[modeIndex].modeTags.begin(), kModeOptions[modeIndex].modeTags.end(), tags.begin()); + tags.reduce_size(kModeOptions[modeIndex].modeTags.size()); + + return CHIP_NO_ERROR; +} + +ModeBase::Instance * WaterHeaterMode::Instance() +{ + return gWaterHeaterModeInstance; +} + +void WaterHeaterMode::Shutdown() +{ + if (gWaterHeaterModeInstance != nullptr) + { + delete gWaterHeaterModeInstance; + gWaterHeaterModeInstance = nullptr; + } + if (gWaterHeaterModeDelegate != nullptr) + { + delete gWaterHeaterModeDelegate; + gWaterHeaterModeDelegate = nullptr; + } +} + +void emberAfWaterHeaterModeClusterInitCallback(chip::EndpointId endpointId) +{ + VerifyOrDie(gWaterHeaterModeDelegate == nullptr && gWaterHeaterModeInstance == nullptr); + gWaterHeaterModeDelegate = new WaterHeaterMode::ExampleWaterHeaterModeDelegate; + gWaterHeaterModeInstance = + new ModeBase::Instance(gWaterHeaterModeDelegate, endpointId, WaterHeaterMode::Id, chip::to_underlying(Feature::kOnOff)); + gWaterHeaterModeInstance->Init(); +} diff --git a/examples/all-clusters-app/ameba/chip_main.cmake b/examples/all-clusters-app/ameba/chip_main.cmake old mode 100755 new mode 100644 index 2afdd4e8d70942..e6e9ee19a87394 --- a/examples/all-clusters-app/ameba/chip_main.cmake +++ b/examples/all-clusters-app/ameba/chip_main.cmake @@ -187,11 +187,15 @@ list( ${chip_dir}/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-device.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp ${chip_dir}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp ${chip_dir}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp ${chip_dir}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp ${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp ${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp ${chip_dir}/examples/platform/ameba/route_hook/ameba_route_hook.c ${chip_dir}/examples/platform/ameba/route_hook/ameba_route_table.c @@ -254,7 +258,6 @@ target_include_directories( ${chip_dir}/src/app/server/ ${chip_dir}/src/controller/data_model ${chip_dir}/third_party/nlio/repo/include/ - ${chip_dir}/third_party/nlunit-test/repo/src ) if (matter_enable_rpc) diff --git a/examples/all-clusters-app/asr/BUILD.gn b/examples/all-clusters-app/asr/BUILD.gn old mode 100755 new mode 100644 index 6b016c5d81119c..fc7ad9037b99de --- a/examples/all-clusters-app/asr/BUILD.gn +++ b/examples/all-clusters-app/asr/BUILD.gn @@ -82,11 +82,15 @@ asr_executable("clusters_app") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp", "${examples_plat_dir}/ButtonHandler.cpp", "${examples_plat_dir}/CHIPDeviceManager.cpp", "${examples_plat_dir}/LEDWidget.cpp", diff --git a/scripts/tests/py/__init__.py b/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn similarity index 100% rename from scripts/tests/py/__init__.py rename to examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn diff --git a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn index 2a5609fb98b928..c1cb81a9722f7d 100644 --- a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn +++ b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn @@ -72,11 +72,15 @@ ti_simplelink_executable("all-clusters-app") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp", "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", "${chip_root}/src/app/clusters/general-diagnostics-server/GenericFaultTestEventTriggerHandler.cpp", "${project_dir}/main/AppTask.cpp", diff --git a/examples/all-clusters-app/esp32/README.md b/examples/all-clusters-app/esp32/README.md index 60ee180c1337fd..0a3145dbc24da2 100644 --- a/examples/all-clusters-app/esp32/README.md +++ b/examples/all-clusters-app/esp32/README.md @@ -47,14 +47,20 @@ NetworkCommissioning Endpoint can be used to manage the driver of extra network interface. For ESP32-C6 DevKits, if `CHIP_DEVICE_CONFIG_ENABLE_WIFI` and -`CHIP_DEVICE_CONFIG_ENABLE_THREAD` are both enabled, the NetworkCommissioning -cluster in Endpoint 0 will be used for Thread network driver and the same -cluster on Endpoint 65534 will be used for Wi-Fi network driver. +`CHIP_DEVICE_CONFIG_ENABLE_THREAD` are both enabled, please set +`CONFIG_THREAD_NETWORK_ENDPOINT_ID` to 0 and set +`CONFIG_WIFI_NETWORK_ENDPOINT_ID` to 65534, which presents that the +NetworkCommissioning cluster in Endpoint 0 will be used for Thread network +driver and the same cluster on Endpoint 65534 will be used for Wi-Fi network +driver. Or vice versa. For ESP32-Ethernet-Kits, if `CHIP_DEVICE_CONFIG_ENABLE_WIFI` and -`CHIP_DEVICE_CONFIG_ENABLE_ETHERNET` are both enabled, the NetworkCommissioning -cluster in Endpoint 0 will be used for Ethernet network driver and the same -cluster on Endpoint 65534 will be used for Wi-Fi network driver. +`CHIP_DEVICE_CONFIG_ENABLE_ETHERNET` are both enabled, please set +`CONFIG_ETHERNET_NETWORK_ENDPOINT_ID` to 0 and set +`CONFIG_WIFI_NETWORK_ENDPOINT_ID` to 65534, which presents that the +NetworkCommissioning cluster in Endpoint 0 will be used for Ethernet network +driver and the same cluster on Endpoint 65534 will be used for Wi-Fi network +driver. Or vice versa. --- diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index dc41290765313a..7fd1d548609257 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -34,6 +34,7 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/mode-support" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/icd/server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util" @@ -105,6 +106,8 @@ set(SRC_DIRS_LIST ) +set(EXCLUDE_SRCS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp") + if (CONFIG_ENABLE_PW_RPC) # Append additional directories for RPC build set(PRIV_INCLUDE_DIRS_LIST "${PRIV_INCLUDE_DIRS_LIST}" diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp index b85f47d883c620..af94d2b2d36afe 100644 --- a/examples/all-clusters-app/esp32/main/main.cpp +++ b/examples/all-clusters-app/esp32/main/main.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -121,6 +122,13 @@ static void InitServer(intptr_t context) #if CONFIG_DEVICE_TYPE_M5STACK SetupPretendDevices(); #endif + CHIP_ERROR err = + app::Clusters::ModeSelect::StaticSupportedModesManager::getStaticSupportedModesManagerInstance().InitEndpointArray( + FIXED_ENDPOINT_COUNT); + if (err != CHIP_NO_ERROR) + { + ESP_LOGE(TAG, "Failed to initialize endpoint array for supported-modes, err:%" CHIP_ERROR_FORMAT, err.Format()); + } app::Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate); } diff --git a/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32c2 b/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32c2 index 6cb90db4f55b9d..200dc5825bc2e2 100644 --- a/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32c2 +++ b/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32c2 @@ -17,3 +17,6 @@ CONFIG_BT_NIMBLE_ROLE_OBSERVER=n CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 + +# Event Queue Size +CONFIG_MAX_EVENT_QUEUE_SIZE=25 diff --git a/examples/all-clusters-app/infineon/psoc6/BUILD.gn b/examples/all-clusters-app/infineon/psoc6/BUILD.gn index 64930593383bfe..9be06891342d7c 100644 --- a/examples/all-clusters-app/infineon/psoc6/BUILD.gn +++ b/examples/all-clusters-app/infineon/psoc6/BUILD.gn @@ -45,32 +45,38 @@ config("psoc6_ota_config") { ldflags = [ "-T" + rebase_path(linker_script, root_build_dir) ] - ldflags += [ "-Wl,--defsym,MCUBOOT_HEADER_SIZE=0x400,--defsym,MCUBOOT_BOOTLOADER_SIZE=0x18000,--defsym,CY_BOOT_PRIMARY_1_SIZE=0x1C0000" ] + ldflags += [ "-Wl,--undefined=uxTopUsedPriority -Wl,--defsym,MCUBOOT_HEADER_SIZE=0x400,--defsym,FLASH_AREA_IMG_1_PRIMARY_START=0x028000,--defsym,FLASH_AREA_IMG_1_PRIMARY_SIZE=0x1c0000" ] defines = [ "P6_OTA", - "OTA_SUPPORT ", - "OTA_USE_EXTERNAL_FLASH", - "CY_BOOT_USE_EXTERNAL_FLASH", - "MCUBOOT_HEADER_SIZE=0x400", - "MCUBOOT_MAX_IMG_SECTORS=3584", - "CY_BOOT_SCRATCH_SIZE=0x00004000", - "MCUBOOT_BOOTLOADER_SIZE=0x00018000", - "CY_BOOT_BOOTLOADER_SIZE=0x00018000", - "CY_BOOT_PRIMARY_1_START=0x00018000", - "CY_BOOT_PRIMARY_1_SIZE=0x1C0000", - "CY_BOOT_SECONDARY_1_START=0x00000000", - "CY_BOOT_SECONDARY_1_SIZE=0x001C0000", - "CY_FLASH_ERASE_VALUE=0xFF", + "COMPONENT_MCUBOOT", + "CY_BOOTLOADER=MCUBOOT", + "OTA_SUPPORT=1", + "COMPONENT_OTA_PSOC_062", + "PSOC_062_2M", + "OTA_USE_EXTERNAL_FLASH=1", + "ENABLE_OTA_LOGS", + "ENABLE_OTA_BOOTLOADER_ABSTRACTION_LOGS", "MCUBOOT_IMAGE_NUMBER=1", - "MCUBOOT_SLOT_SIZE=0x1C0000", - "MCUBOOT_SCRATCH_SIZE=0x4000", - "MCUBOOT_SECTOR_SIZE = 512", + "MCUBOOT_MAX_IMG_SECTORS=3584", + "FLASH_AREA_BOOTLOADER_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'", + "FLASH_AREA_BOOTLOADER_SIZE=0x028000", + "FLASH_AREA_BOOTLOADER_START=0x000000", + "FLASH_AREA_IMAGE_SCRATCH_DEV_ID='FLASH_DEVICE_EXTERNAL_FLASH(CY_BOOT_EXTERNAL_DEVICE_INDEX)'", + "FLASH_AREA_IMAGE_SCRATCH_SIZE=0x080000", + "FLASH_AREA_IMAGE_SCRATCH_START=0x440000", + "FLASH_AREA_IMAGE_SWAP_STATUS_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'", + "FLASH_AREA_IMAGE_SWAP_STATUS_SIZE=0x006c00", + "FLASH_AREA_IMAGE_SWAP_STATUS_START=0x1e8000", + "FLASH_AREA_IMG_1_PRIMARY_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'", + "FLASH_AREA_IMG_1_PRIMARY_SIZE=0x1c0000", + "FLASH_AREA_IMG_1_PRIMARY_START=0x028000", + "FLASH_AREA_IMG_1_SECONDARY_DEV_ID='FLASH_DEVICE_EXTERNAL_FLASH(CY_BOOT_EXTERNAL_DEVICE_INDEX)'", + "FLASH_AREA_IMG_1_SECONDARY_SIZE=0x1c0000", + "FLASH_AREA_IMG_1_SECONDARY_START=0x000200", "APP_VERSION_MAJOR=1", "APP_VERSION_MINOR=0", "APP_VERSION_BUILD=0", - "MCUBOOT_OVERWRITE_ONLY", - "CY_ENABLE_XIP_PROGRAM", ] if (build_update_image) { @@ -87,7 +93,7 @@ psoc6_sdk_sources("all_clusters_app_sdk_sources") { defines = [ "BOARD_ID=${psoc6_board}", - "P6_LOG_ENABLED=1", + "PSOC6_LOG_ENABLED=1", "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setup_pin_code}", ] @@ -118,11 +124,15 @@ psoc6_executable("clusters_app") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp", "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/init_psoc6Platform.cpp", "src/AppTask.cpp", diff --git a/examples/all-clusters-app/infineon/psoc6/include/AppConfig.h b/examples/all-clusters-app/infineon/psoc6/include/AppConfig.h index 35e45a8aef4223..cad1a523bfa188 100644 --- a/examples/all-clusters-app/infineon/psoc6/include/AppConfig.h +++ b/examples/all-clusters-app/infineon/psoc6/include/AppConfig.h @@ -48,14 +48,14 @@ #define THREAD_ACTIVE_POLLING_INTERVAL_MS 100 #define THREAD_INACTIVE_POLLING_INTERVAL_MS 1000 -// P6 Logging +// PSOC6 Logging #ifdef __cplusplus extern "C" { #endif void appError(int err); -void P6Log(const char * aFormat, ...); -#define P6_LOG(...) P6Log(__VA_ARGS__) +void PSOC6Log(const char * aFormat, ...); +#define PSOC6_LOG(...) PSOC6Log(__VA_ARGS__) #ifdef __cplusplus } diff --git a/examples/all-clusters-app/infineon/psoc6/include/AppTask.h b/examples/all-clusters-app/infineon/psoc6/include/AppTask.h index aa031fe3ba4b52..a80d8db688fc2d 100644 --- a/examples/all-clusters-app/infineon/psoc6/include/AppTask.h +++ b/examples/all-clusters-app/infineon/psoc6/include/AppTask.h @@ -29,6 +29,10 @@ #include #include +extern "C" { +#include "flash_map_backend.h" +} + // Application-defined error codes in the CHIP_ERROR space. #define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) #define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02) diff --git a/examples/all-clusters-app/infineon/psoc6/include/CHIPProjectConfig.h b/examples/all-clusters-app/infineon/psoc6/include/CHIPProjectConfig.h index f7bb585960ec3c..1b6f96ee03405f 100644 --- a/examples/all-clusters-app/infineon/psoc6/include/CHIPProjectConfig.h +++ b/examples/all-clusters-app/infineon/psoc6/include/CHIPProjectConfig.h @@ -42,10 +42,10 @@ #define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8003 /* The ProductName attribute of the Basic cluster. */ -#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME "P6-CYW43012 All Clusters" +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME "PSOC6-CYW43012 All Clusters" /* The HardwareVersionString attribute of the Basic cluster. */ -#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING "P6-43012" +#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING "PSOC6-43012" /* The HardwareVersion attribute of the Basic cluster. */ #define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION 43012 diff --git a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp index 0d0ba0f5b25663..143e25e87e0114 100644 --- a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp @@ -148,7 +148,7 @@ CHIP_ERROR AppTask::StartAppTask() sAppEventQueue = xQueueCreateStatic(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent), sAppEventQueueBuffer, &sAppEventQueueStruct); if (sAppEventQueue == NULL) { - P6_LOG("Failed to allocate app event queue"); + PSOC6_LOG("Failed to allocate app event queue"); appError(APP_ERROR_EVENT_QUEUE_FAILED); } // Start App task. @@ -160,10 +160,10 @@ CHIP_ERROR AppTask::Init() { CHIP_ERROR err = CHIP_NO_ERROR; #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - int rc = boot_set_confirmed(); + int rc = flash_area_boot_set_confirmed(); if (rc != 0) { - P6_LOG("boot_set_confirmed failed"); + PSOC6_LOG("flash_area_boot_set_confirmed failed"); appError(CHIP_ERROR_UNINITIALIZED); } #endif @@ -196,11 +196,11 @@ CHIP_ERROR AppTask::Init() ); if (sFunctionTimer == NULL) { - P6_LOG("funct timer create failed"); + PSOC6_LOG("funct timer create failed"); appError(APP_ERROR_CREATE_TIMER_FAILED); } NetWorkCommissioningInstInit(); - P6_LOG("Current Software Version: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); + PSOC6_LOG("Current Software Version: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); // Initialize LEDs sStatusLED.Init(SYSTEM_STATE_LED); @@ -221,11 +221,11 @@ void AppTask::AppTaskMain(void * pvParameter) CHIP_ERROR err = sAppTask.Init(); if (err != CHIP_NO_ERROR) { - P6_LOG("AppTask.Init() failed"); + PSOC6_LOG("AppTask.Init() failed"); appError(err); } - P6_LOG("App Task started"); + PSOC6_LOG("App Task started"); while (true) { @@ -301,7 +301,8 @@ void AppTask::FunctionHandler(AppEvent * event) { if (!sAppTask.mFunctionTimerActive && sAppTask.mFunction == Function::kNoneSelected) { - P6_LOG("Factory Reset Triggered. Press button again within %us to cancel.", FACTORY_RESET_CANCEL_WINDOW_TIMEOUT / 1000); + PSOC6_LOG("Factory Reset Triggered. Press button again within %us to cancel.", + FACTORY_RESET_CANCEL_WINDOW_TIMEOUT / 1000); // Start timer for FACTORY_RESET_CANCEL_WINDOW_TIMEOUT to allow user to // cancel, if required. sAppTask.StartTimer(FACTORY_RESET_CANCEL_WINDOW_TIMEOUT); @@ -325,7 +326,7 @@ void AppTask::FunctionHandler(AppEvent * event) // canceled. sAppTask.mFunction = Function::kNoneSelected; - P6_LOG("Factory Reset has been Canceled"); + PSOC6_LOG("Factory Reset has been Canceled"); } } } @@ -334,7 +335,7 @@ void AppTask::CancelTimer() { if (xTimerStop(sFunctionTimer, 0) == pdFAIL) { - P6_LOG("app timer stop() failed"); + PSOC6_LOG("app timer stop() failed"); appError(APP_ERROR_STOP_TIMER_FAILED); } @@ -345,7 +346,7 @@ void AppTask::StartTimer(uint32_t aTimeoutInMs) { if (xTimerIsTimerActive(sFunctionTimer)) { - P6_LOG("app timer already started!"); + PSOC6_LOG("app timer already started!"); CancelTimer(); } @@ -354,7 +355,7 @@ void AppTask::StartTimer(uint32_t aTimeoutInMs) // cannot immediately be sent to the timer command queue. if (xTimerChangePeriod(sFunctionTimer, aTimeoutInMs / portTICK_PERIOD_MS, 100) != pdPASS) { - P6_LOG("app timer start() failed"); + PSOC6_LOG("app timer start() failed"); appError(APP_ERROR_START_TIMER_FAILED); } @@ -385,11 +386,11 @@ void AppTask::PostEvent(const AppEvent * event) } if (!status) - P6_LOG("Failed to post event to app task event queue"); + PSOC6_LOG("Failed to post event to app task event queue"); } else { - P6_LOG("Event Queue is NULL should never happen"); + PSOC6_LOG("Event Queue is NULL should never happen"); } } @@ -401,7 +402,7 @@ void AppTask::DispatchEvent(AppEvent * event) } else { - P6_LOG("Event received with no handler. Dropping event."); + PSOC6_LOG("Event received with no handler. Dropping event."); } } @@ -414,7 +415,7 @@ void AppTask::OnOffUpdateClusterState(intptr_t context) if (status != Protocols::InteractionModel::Status::Success) { - P6_LOG("ERR: updating on/off %x", to_underlying(status)); + PSOC6_LOG("ERR: updating on/off %x", to_underlying(status)); } } @@ -435,7 +436,7 @@ void AppTask::InitOTARequestor() gRequestorUser.Init(&gRequestorCore, &gImageProcessor); - P6_LOG("Current Software Version: %u", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); - P6_LOG("Current Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); + PSOC6_LOG("Current Software Version: %u", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); + PSOC6_LOG("Current Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); } #endif diff --git a/examples/all-clusters-app/infineon/psoc6/src/ButtonHandler.cpp b/examples/all-clusters-app/infineon/psoc6/src/ButtonHandler.cpp index 7d65fc4134625e..3fbd1c13796fd1 100644 --- a/examples/all-clusters-app/infineon/psoc6/src/ButtonHandler.cpp +++ b/examples/all-clusters-app/infineon/psoc6/src/ButtonHandler.cpp @@ -102,7 +102,7 @@ void ButtonHandler::TimerCallback(TimerHandle_t xTimer) buttonevent = cyhal_gpio_read(APP_FUNCTION_BUTTON); break; default: - P6_LOG("Unhandled TimerID: %d", timerId); + PSOC6_LOG("Unhandled TimerID: %d", timerId); break; } diff --git a/examples/all-clusters-app/infineon/psoc6/src/ClusterManager.cpp b/examples/all-clusters-app/infineon/psoc6/src/ClusterManager.cpp index 6659131ea8b9ab..caf1ac85dabc9e 100644 --- a/examples/all-clusters-app/infineon/psoc6/src/ClusterManager.cpp +++ b/examples/all-clusters-app/infineon/psoc6/src/ClusterManager.cpp @@ -50,9 +50,9 @@ ClusterManager ClusterManager::sCluster; void ClusterManager::OnOnOffPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value) { VerifyOrExit(attributeId == OnOff::Attributes::OnOff::Id, - P6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId))); + PSOC6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId))); VerifyOrExit(endpointId == ENDPOINT_FIRST_IDX || endpointId == ENDPOINT_SECOND_IDX, - P6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); + PSOC6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); // At this point we can assume that value points to a bool value. mEndpointOnOffState[endpointId - 1] = *value; @@ -70,9 +70,9 @@ void ClusterManager::OnLevelControlAttributeChangeCallback(EndpointId endpointId uint8_t brightness = onOffState ? *value : 0; VerifyOrExit(attributeId == LevelControl::Attributes::CurrentLevel::Id, - P6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId))); + PSOC6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId))); VerifyOrExit(endpointId == ENDPOINT_FIRST_IDX || endpointId == ENDPOINT_SECOND_IDX, - P6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); + PSOC6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); endpointId == ENDPOINT_FIRST_IDX ? sClusterLED.SetBrightness(brightness) : sLightLED.SetBrightness(brightness); @@ -84,9 +84,9 @@ void ClusterManager::OnColorControlAttributeChangeCallback(EndpointId endpointId { VerifyOrExit(attributeId == ColorControl::Attributes::CurrentHue::Id || attributeId == ColorControl::Attributes::CurrentSaturation::Id, - P6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId))); + PSOC6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId))); VerifyOrExit(endpointId == ENDPOINT_FIRST_IDX || endpointId == ENDPOINT_SECOND_IDX, - P6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); + PSOC6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); if (endpointId == 1) { uint8_t hue, saturation; @@ -136,8 +136,8 @@ void IdentifyTimerHandler(Layer * systemLayer, void * appState) void ClusterManager::OnIdentifyPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value) { VerifyOrExit(attributeId == Identify::Attributes::IdentifyTime::Id, - P6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId))); - VerifyOrExit(endpointId == ENDPOINT_FIRST_IDX, P6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); + PSOC6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId))); + VerifyOrExit(endpointId == ENDPOINT_FIRST_IDX, PSOC6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); /* IdentifyTime Attribute Spec mentions "flashing a light with a period of 0.5 seconds" */ sStatusLED.Blink(kIdentifyTimerDelayMS * 2); diff --git a/examples/all-clusters-app/infineon/psoc6/src/ZclCallbacks.cpp b/examples/all-clusters-app/infineon/psoc6/src/ZclCallbacks.cpp index 9a439771026736..2e805ac61367ee 100644 --- a/examples/all-clusters-app/infineon/psoc6/src/ZclCallbacks.cpp +++ b/examples/all-clusters-app/infineon/psoc6/src/ZclCallbacks.cpp @@ -39,9 +39,9 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & EndpointId endpoint = attributePath.mEndpointId; ClusterId clusterId = attributePath.mClusterId; AttributeId attributeId = attributePath.mAttributeId; - P6_LOG("MatterPostAttributeChangeCallback - Cluster ID: " ChipLogFormatMEI - ", EndPoint ID: '0x%02x', Attribute ID: " ChipLogFormatMEI, - ChipLogValueMEI(clusterId), endpoint, ChipLogValueMEI(attributeId)); + PSOC6_LOG("MatterPostAttributeChangeCallback - Cluster ID: " ChipLogFormatMEI + ", EndPoint ID: '0x%02x', Attribute ID: " ChipLogFormatMEI, + ChipLogValueMEI(clusterId), endpoint, ChipLogValueMEI(attributeId)); switch (clusterId) { @@ -61,7 +61,7 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & ClusterMgr().OnColorControlAttributeChangeCallback(endpoint, attributeId, value); break; default: - P6_LOG("Unhandled cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); + PSOC6_LOG("Unhandled cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); break; } } diff --git a/examples/all-clusters-app/infineon/psoc6/src/main.cpp b/examples/all-clusters-app/infineon/psoc6/src/main.cpp index 2dc8d6353cc62c..2344f380f802fc 100644 --- a/examples/all-clusters-app/infineon/psoc6/src/main.cpp +++ b/examples/all-clusters-app/infineon/psoc6/src/main.cpp @@ -57,7 +57,7 @@ static void main_task(void * pvParameters); //================================================================================= void appError(int err) { - P6_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); + PSOC6_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); portDISABLE_INTERRUPTS(); while (true) ; @@ -90,35 +90,35 @@ static void main_task(void * pvParameters) CHIP_ERROR ret = chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init(); if (ret != CHIP_NO_ERROR) { - P6_LOG("PersistedStorage::KeyValueStoreMgrImpl().Init() failed"); + PSOC6_LOG("PersistedStorage::KeyValueStoreMgrImpl().Init() failed"); appError(ret); } ret = PlatformMgr().InitChipStack(); if (ret != CHIP_NO_ERROR) { - P6_LOG("PlatformMgr().InitChipStack() failed"); + PSOC6_LOG("PlatformMgr().InitChipStack() failed"); appError(ret); } - ret = chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName("P6_CLUSTERS"); + ret = chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName("PSOC6_CLUSTERS"); if (ret != CHIP_NO_ERROR) { - P6_LOG("ConnectivityMgr().SetBLEDeviceName() failed"); + PSOC6_LOG("ConnectivityMgr().SetBLEDeviceName() failed"); appError(ret); } - P6_LOG("Starting Platform Manager Event Loop"); + PSOC6_LOG("Starting Platform Manager Event Loop"); ret = PlatformMgr().StartEventLoopTask(); if (ret != CHIP_NO_ERROR) { - P6_LOG("PlatformMgr().StartEventLoopTask() failed"); + PSOC6_LOG("PlatformMgr().StartEventLoopTask() failed"); appError(ret); } ret = GetAppTask().StartAppTask(); if (ret != CHIP_NO_ERROR) { - P6_LOG("GetAppTask().Init() failed"); + PSOC6_LOG("GetAppTask().Init() failed"); appError(ret); } @@ -131,7 +131,7 @@ static void main_task(void * pvParameters) // ================================================================================ int main(void) { - init_p6Platform(); + init_psoc6Platform(); #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR // Clear watchdog timer (started by bootloader) so that it doesn't trigger a reset cyhal_wdt_t wdt_obj; @@ -142,9 +142,9 @@ int main(void) MemMonitoring::startHeapMonitoring(); #endif - P6_LOG("==================================================\r\n"); - P6_LOG("chip-p6-all-clusters-example starting Version %d\r\n", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); - P6_LOG("==================================================\r\n"); + PSOC6_LOG("==================================================\r\n"); + PSOC6_LOG("chip-psoc6-all-clusters-example starting Version %d\r\n", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); + PSOC6_LOG("==================================================\r\n"); /* Start the FreeRTOS scheduler */ vTaskStartScheduler(); @@ -154,5 +154,5 @@ int main(void) PlatformMgr().Shutdown(); // Should never get here. - P6_LOG("vTaskStartScheduler() failed"); + PSOC6_LOG("vTaskStartScheduler() failed"); } diff --git a/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp b/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp index 8effe6426cc49d..45ab1dac61bebc 100644 --- a/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp +++ b/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp @@ -28,6 +28,7 @@ #include #include +#include "ButtonEventsSimulator.h" #include #include #include @@ -36,13 +37,167 @@ #include #include +#include #include +#include using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::DeviceLayer; +namespace { + +std::unique_ptr sButtonSimulatorInstance{ nullptr }; + +bool HasNumericField(Json::Value & jsonValue, const std::string & field) +{ + return jsonValue.isMember(field) && jsonValue[field].isNumeric(); +} + +/** + * Named pipe handler for simulated long press + * + * Usage example: + * echo '{"Name": "SimulateLongPress", "EndpointId": 3, "ButtonId": 1, "LongPressDelayMillis": 800, + * "LongPressDurationMillis": 1000}' > /tmp/chip_all_clusters_fifo_1146610 + * + * JSON Arguments: + * - "Name": Must be "SimulateLongPress" + * - "EndpointId": number of endpoint having a switch cluster + * - "ButtonId": switch position in the switch cluster for "down" button (not idle) + * - "LongPressDelayMillis": Time in milliseconds before the LongPress + * - "LongPressDurationMillis": Total duration in milliseconds from start of the press to LongRelease + * - "FeatureMap": The feature map to simulate + * + * @param jsonValue - JSON payload from named pipe + */ +void HandleSimulateLongPress(Json::Value & jsonValue) +{ + if (sButtonSimulatorInstance != nullptr) + { + ChipLogError(NotSpecified, "Button simulation already in progress! Ignoring request."); + return; + } + + bool hasEndpointId = HasNumericField(jsonValue, "EndpointId"); + bool hasButtonId = HasNumericField(jsonValue, "ButtonId"); + bool hasLongPressDelayMillis = HasNumericField(jsonValue, "LongPressDelayMillis"); + bool hasLongPressDurationMillis = HasNumericField(jsonValue, "LongPressDurationMillis"); + bool hasFeatureMap = HasNumericField(jsonValue, "FeatureMap"); + if (!hasEndpointId || !hasButtonId || !hasLongPressDelayMillis || !hasLongPressDurationMillis || !hasFeatureMap) + { + std::string inputJson = jsonValue.toStyledString(); + ChipLogError(NotSpecified, + "Missing or invalid value for one of EndpointId, ButtonId, LongPressDelayMillis, LongPressDurationMillis or " + "FeatureMap in %s", + inputJson.c_str()); + return; + } + + EndpointId endpointId = static_cast(jsonValue["EndpointId"].asUInt()); + uint8_t buttonId = static_cast(jsonValue["ButtonId"].asUInt()); + System::Clock::Milliseconds32 longPressDelayMillis{ static_cast(jsonValue["LongPressDelayMillis"].asUInt()) }; + System::Clock::Milliseconds32 longPressDurationMillis{ static_cast(jsonValue["LongPressDurationMillis"].asUInt()) }; + uint32_t featureMap = static_cast(jsonValue["FeatureMap"].asUInt()); + auto buttonSimulator = std::make_unique(); + + bool success = buttonSimulator->SetMode(ButtonEventsSimulator::Mode::kModeLongPress) + .SetLongPressDelayMillis(longPressDelayMillis) + .SetLongPressDurationMillis(longPressDurationMillis) + .SetIdleButtonId(0) + .SetPressedButtonId(buttonId) + .SetEndpointId(endpointId) + .SetFeatureMap(featureMap) + .Execute([]() { sButtonSimulatorInstance.reset(); }); + + if (!success) + { + ChipLogError(NotSpecified, "Failed to start execution of button simulator!"); + return; + } + + sButtonSimulatorInstance = std::move(buttonSimulator); +} + +/** + * Named pipe handler for simulated multi-press. + * + * Usage example: + * echo '{"Name": "SimulateMultiPress", "EndpointId": 3, "ButtonId": 1, "MultiPressPressedTimeMillis": 100, + * "MultiPressReleasedTimeMillis": 350, "MultiPressNumPresses": 2, "FeatureMap": 58}' > /tmp/chip_all_clusters_fifo_1146610 + * + * JSON Arguments: + * - "Name": Must be "SimulateActionSwitchMultiPress" + * - "EndpointId": number of endpoint having a switch cluster + * - "ButtonId": switch position in the switch cluster for "down" button (not idle) + * - "MultiPressPressedTimeMillis": Pressed time in milliseconds for each press + * - "MultiPressReleasedTimeMillis": Released time in milliseconds after each press + * - "MultiPressNumPresses": Number of presses to simulate + * - "FeatureMap": The feature map to simulate + * - "MultiPressMax": max number of presses (from attribute). + * + * @param jsonValue - JSON payload from named pipe + */ +void HandleSimulateMultiPress(Json::Value & jsonValue) +{ + if (sButtonSimulatorInstance != nullptr) + { + ChipLogError(NotSpecified, "Button simulation already in progress! Ignoring request."); + return; + } + + bool hasEndpointId = HasNumericField(jsonValue, "EndpointId"); + bool hasButtonId = HasNumericField(jsonValue, "ButtonId"); + bool hasMultiPressPressedTimeMillis = HasNumericField(jsonValue, "MultiPressPressedTimeMillis"); + bool hasMultiPressReleasedTimeMillis = HasNumericField(jsonValue, "MultiPressReleasedTimeMillis"); + bool hasMultiPressNumPresses = HasNumericField(jsonValue, "MultiPressNumPresses"); + bool hasFeatureMap = HasNumericField(jsonValue, "FeatureMap"); + bool hasMultiPressMax = HasNumericField(jsonValue, "MultiPressMax"); + if (!hasEndpointId || !hasButtonId || !hasMultiPressPressedTimeMillis || !hasMultiPressReleasedTimeMillis || + !hasMultiPressNumPresses || !hasFeatureMap || !hasMultiPressMax) + { + std::string inputJson = jsonValue.toStyledString(); + ChipLogError(NotSpecified, + "Missing or invalid value for one of EndpointId, ButtonId, MultiPressPressedTimeMillis, " + "MultiPressReleasedTimeMillis, MultiPressNumPresses, FeatureMap or MultiPressMax in %s", + inputJson.c_str()); + return; + } + + EndpointId endpointId = static_cast(jsonValue["EndpointId"].asUInt()); + uint8_t buttonId = static_cast(jsonValue["ButtonId"].asUInt()); + System::Clock::Milliseconds32 multiPressPressedTimeMillis{ static_cast( + jsonValue["MultiPressPressedTimeMillis"].asUInt()) }; + System::Clock::Milliseconds32 multiPressReleasedTimeMillis{ static_cast( + jsonValue["MultiPressReleasedTimeMillis"].asUInt()) }; + uint8_t multiPressNumPresses = static_cast(jsonValue["MultiPressNumPresses"].asUInt()); + uint32_t featureMap = static_cast(jsonValue["FeatureMap"].asUInt()); + uint8_t multiPressMax = static_cast(jsonValue["MultiPressMax"].asUInt()); + auto buttonSimulator = std::make_unique(); + + bool success = buttonSimulator->SetMode(ButtonEventsSimulator::Mode::kModeMultiPress) + .SetMultiPressPressedTimeMillis(multiPressPressedTimeMillis) + .SetMultiPressReleasedTimeMillis(multiPressReleasedTimeMillis) + .SetMultiPressNumPresses(multiPressNumPresses) + .SetIdleButtonId(0) + .SetPressedButtonId(buttonId) + .SetEndpointId(endpointId) + .SetFeatureMap(featureMap) + .SetMultiPressMax(multiPressMax) + .Execute([]() { sButtonSimulatorInstance.reset(); }); + + if (!success) + { + ChipLogError(NotSpecified, "Failed to start execution of button simulator!"); + return; + } + + sButtonSimulatorInstance = std::move(buttonSimulator); +} + +} // namespace + AllClustersAppCommandHandler * AllClustersAppCommandHandler::FromJSON(const char * json) { Json::Reader reader; @@ -190,6 +345,14 @@ void AllClustersAppCommandHandler::HandleCommand(intptr_t context) std::string operation = self->mJsonValue["Operation"].asString(); self->OnOperationalStateChange(device, operation, self->mJsonValue["Param"]); } + else if (name == "SimulateLongPress") + { + HandleSimulateLongPress(self->mJsonValue); + } + else if (name == "SimulateMultiPress") + { + HandleSimulateMultiPress(self->mJsonValue); + } else { ChipLogError(NotSpecified, "Unhandled command: Should never happens"); diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 3d52ef748de90d..e8671e701a7227 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -29,6 +29,10 @@ if (chip_enable_pw_rpc) { source_set("chip-all-clusters-common") { sources = [ + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/WhmDelegateImpl.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/WhmInstance.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/WhmMain.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/WhmManufacturer.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/boolcfg-stub.cpp", @@ -46,6 +50,7 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-mode.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/microwave-oven-mode.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/occupancy-sensing-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/oven-operational-state-delegate.cpp", @@ -57,16 +62,24 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/water-heater-mode.cpp", "${chip_root}/examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/device-energy-management-mode.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/energy-evse-mode.cpp", "AllClustersCommandDelegate.cpp", + "AllClustersCommandDelegate.h", "AppOptions.cpp", + "ButtonEventsSimulator.cpp", + "ButtonEventsSimulator.h", "ValveControlDelegate.cpp", "WindowCoveringManager.cpp", "include/tv-callbacks.cpp", diff --git a/examples/all-clusters-app/linux/ButtonEventsSimulator.cpp b/examples/all-clusters-app/linux/ButtonEventsSimulator.cpp new file mode 100644 index 00000000000000..53a08672fdbc07 --- /dev/null +++ b/examples/all-clusters-app/linux/ButtonEventsSimulator.cpp @@ -0,0 +1,292 @@ +/* + * + * 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 "ButtonEventsSimulator.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace chip { +namespace app { + +namespace { + +void SetButtonPosition(EndpointId endpointId, uint8_t position) +{ + Clusters::Switch::Attributes::CurrentPosition::Set(endpointId, position); +} + +void EmitInitialPress(EndpointId endpointId, uint8_t newPosition) +{ + Clusters::Switch::Events::InitialPress::Type event{ newPosition }; + EventNumber eventNumber = 0; + + CHIP_ERROR err = LogEvent(event, endpointId, eventNumber); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to log InitialPress event: %" CHIP_ERROR_FORMAT, err.Format()); + } + else + { + ChipLogProgress(NotSpecified, "Logged InitialPress(%u) on Endpoint %u", static_cast(newPosition), + static_cast(endpointId)); + } +} + +void EmitLongPress(EndpointId endpointId, uint8_t newPosition) +{ + Clusters::Switch::Events::LongPress::Type event{ newPosition }; + EventNumber eventNumber = 0; + + CHIP_ERROR err = LogEvent(event, endpointId, eventNumber); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to log LongPress event: %" CHIP_ERROR_FORMAT, err.Format()); + } + else + { + ChipLogProgress(NotSpecified, "Logged LongPress(%u) on Endpoint %u", static_cast(newPosition), + static_cast(endpointId)); + } +} + +void EmitLongRelease(EndpointId endpointId, uint8_t previousPosition) +{ + Clusters::Switch::Events::LongRelease::Type event{}; + event.previousPosition = previousPosition; + EventNumber eventNumber = 0; + + CHIP_ERROR err = LogEvent(event, endpointId, eventNumber); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to log LongRelease event: %" CHIP_ERROR_FORMAT, err.Format()); + } + else + { + ChipLogProgress(NotSpecified, "Logged LongRelease on Endpoint %u", static_cast(endpointId)); + } +} + +void EmitMultiPressComplete(EndpointId endpointId, uint8_t previousPosition, uint8_t count) +{ + Clusters::Switch::Events::MultiPressComplete::Type event{}; + event.previousPosition = previousPosition; + event.totalNumberOfPressesCounted = count; + EventNumber eventNumber = 0; + + CHIP_ERROR err = LogEvent(event, endpointId, eventNumber); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to log MultiPressComplete event: %" CHIP_ERROR_FORMAT, err.Format()); + } + else + { + ChipLogProgress(NotSpecified, "Logged MultiPressComplete(count=%u) on Endpoint %u", static_cast(count), + static_cast(endpointId)); + } +} + +void EmitShortRelease(EndpointId endpointId, uint8_t previousPosition) +{ + Clusters::Switch::Events::ShortRelease::Type event{}; + event.previousPosition = previousPosition; + EventNumber eventNumber = 0; + + CHIP_ERROR err = LogEvent(event, endpointId, eventNumber); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to log ShortRelease event: %" CHIP_ERROR_FORMAT, err.Format()); + } + else + { + ChipLogProgress(NotSpecified, "Logged ShortRelease on Endpoint %u", static_cast(endpointId)); + } +} + +void EmitMultiPressOngoing(EndpointId endpointId, uint8_t newPosition, uint8_t count) +{ + Clusters::Switch::Events::MultiPressOngoing::Type event{}; + event.newPosition = newPosition; + event.currentNumberOfPressesCounted = count; + EventNumber eventNumber = 0; + + CHIP_ERROR err = LogEvent(event, endpointId, eventNumber); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to log MultiPressOngoing event: %" CHIP_ERROR_FORMAT, err.Format()); + } + else + { + ChipLogProgress(NotSpecified, "Logged MultiPressOngoing on Endpoint %u position %u, count %u", + static_cast(endpointId), newPosition, count); + } +} + +} // namespace + +void ButtonEventsSimulator::OnTimerDone(System::Layer * layer, void * appState) +{ + ButtonEventsSimulator * that = reinterpret_cast(appState); + that->Next(); +} + +bool ButtonEventsSimulator::Execute(DoneCallback && doneCallback) +{ + VerifyOrReturnValue(mIdleButtonId != mPressedButtonId, false); + + switch (mMode) + { + case Mode::kModeLongPress: + VerifyOrReturnValue(mLongPressDurationMillis > mLongPressDelayMillis, false); + SetState(State::kEmitStartOfLongPress); + break; + case Mode::kModeMultiPress: + VerifyOrReturnValue(mMultiPressPressedTimeMillis.count() > 0, false); + VerifyOrReturnValue(mMultiPressReleasedTimeMillis.count() > 0, false); + VerifyOrReturnValue(mMultiPressNumPresses > 0, false); + SetState(State::kEmitStartOfMultiPress); + break; + default: + return false; + } + mDoneCallback = std::move(doneCallback); + Next(); + return true; +} + +void ButtonEventsSimulator::SetState(ButtonEventsSimulator::State newState) +{ + ButtonEventsSimulator::State oldState = mState; + if (oldState != newState) + { + ChipLogProgress(NotSpecified, "ButtonEventsSimulator state change %u -> %u", static_cast(oldState), + static_cast(newState)); + } + + mState = newState; +} + +void ButtonEventsSimulator::StartTimer(System::Clock::Timeout duration) +{ + chip::DeviceLayer::SystemLayer().StartTimer(duration, &ButtonEventsSimulator::OnTimerDone, this); +} + +void ButtonEventsSimulator::Next() +{ + switch (mState) + { + case ButtonEventsSimulator::State::kIdle: { + ChipLogError(NotSpecified, "Found idle state where not expected!"); + break; + } + case ButtonEventsSimulator::State::kEmitStartOfLongPress: { + SetButtonPosition(mEndpointId, mPressedButtonId); + EmitInitialPress(mEndpointId, mPressedButtonId); + SetState(ButtonEventsSimulator::State::kEmitLongPress); + StartTimer(mLongPressDelayMillis); + break; + } + case ButtonEventsSimulator::State::kEmitLongPress: { + EmitLongPress(mEndpointId, mPressedButtonId); + SetState(ButtonEventsSimulator::State::kEmitLongRelease); + StartTimer(mLongPressDurationMillis - mLongPressDelayMillis); + break; + } + case ButtonEventsSimulator::State::kEmitLongRelease: { + SetButtonPosition(mEndpointId, mIdleButtonId); + if (mFeatureMap & static_cast(Clusters::Switch::Feature::kMomentarySwitchLongPress)) + { + EmitLongRelease(mEndpointId, mPressedButtonId); + } + else if (mFeatureMap & static_cast(Clusters::Switch::Feature::kMomentarySwitchRelease)) + { + EmitShortRelease(mEndpointId, mPressedButtonId); + } + SetState(ButtonEventsSimulator::State::kIdle); + mDoneCallback(); + break; + } + case ButtonEventsSimulator::State::kEmitStartOfMultiPress: { + EmitInitialPress(mEndpointId, mPressedButtonId); + if (mFeatureMap & static_cast(Clusters::Switch::Feature::kActionSwitch)) + { + StartTimer(mMultiPressNumPresses * (mMultiPressPressedTimeMillis + mMultiPressReleasedTimeMillis)); + SetState(ButtonEventsSimulator::State::kEmitEndOfMultiPress); + } + else + { + SetState(ButtonEventsSimulator::State::kMultiPressButtonRelease); + StartTimer(mMultiPressPressedTimeMillis); + } + break; + } + case ButtonEventsSimulator::State::kMultiPressButtonRelease: { + ++mMultiPressPressesDone; + if (mMultiPressPressesDone > 1) + { + EmitMultiPressOngoing(mEndpointId, mPressedButtonId, mMultiPressPressesDone); + } + + if (mMultiPressPressesDone == mMultiPressNumPresses) + { + SetState(ButtonEventsSimulator::State::kEmitEndOfMultiPress); + } + else + { + SetState(ButtonEventsSimulator::State::kEmitStartOfMultiPress); + } + + if (mFeatureMap & static_cast(Clusters::Switch::Feature::kMomentarySwitchRelease)) + { + EmitShortRelease(mEndpointId, mPressedButtonId); + } + StartTimer(mMultiPressReleasedTimeMillis); + break; + } + + case ButtonEventsSimulator::State::kEmitEndOfMultiPress: { + if (mFeatureMap & static_cast(Clusters::Switch::Feature::kActionSwitch) && mMultiPressNumPresses > mMultiPressMax) + { + EmitMultiPressComplete(mEndpointId, mPressedButtonId, 0); + } + else + { + EmitMultiPressComplete(mEndpointId, mPressedButtonId, mMultiPressNumPresses); + } + SetState(ButtonEventsSimulator::State::kIdle); + mDoneCallback(); + break; + } + } +} + +} // namespace app +} // namespace chip diff --git a/examples/all-clusters-app/linux/ButtonEventsSimulator.h b/examples/all-clusters-app/linux/ButtonEventsSimulator.h new file mode 100644 index 00000000000000..539b2010099bd6 --- /dev/null +++ b/examples/all-clusters-app/linux/ButtonEventsSimulator.h @@ -0,0 +1,161 @@ +/* + * + * 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 chip { +namespace app { + +/** + * State machine to emit button sequences. Configure with `SetXxx()` methods + * and then call `Execute()` with a functor to be called when done. + * + * The implementation has dependencies on SystemLayer (to start timers) and on + * EventLogging. + * + */ +class ButtonEventsSimulator +{ +public: + enum class Mode + { + kModeLongPress, + kModeMultiPress, + kModeMultiPressNonAs + }; + + using DoneCallback = std::function; + + ButtonEventsSimulator() = default; + + // Returns true on success to start execution, false on something going awry. + // `doneCallback` is called only if execution got started. + bool Execute(DoneCallback && doneCallback); + + ButtonEventsSimulator & SetLongPressDelayMillis(System::Clock::Milliseconds32 longPressDelayMillis) + { + mLongPressDelayMillis = longPressDelayMillis; + return *this; + } + + ButtonEventsSimulator & SetLongPressDurationMillis(System::Clock::Milliseconds32 longPressDurationMillis) + { + mLongPressDurationMillis = longPressDurationMillis; + return *this; + } + + ButtonEventsSimulator & SetMultiPressPressedTimeMillis(System::Clock::Milliseconds32 multiPressPressedTimeMillis) + { + mMultiPressPressedTimeMillis = multiPressPressedTimeMillis; + return *this; + } + + ButtonEventsSimulator & SetMultiPressReleasedTimeMillis(System::Clock::Milliseconds32 multiPressReleasedTimeMillis) + { + mMultiPressReleasedTimeMillis = multiPressReleasedTimeMillis; + return *this; + } + + ButtonEventsSimulator & SetMultiPressNumPresses(uint8_t multiPressNumPresses) + { + mMultiPressNumPresses = multiPressNumPresses; + return *this; + } + + ButtonEventsSimulator & SetIdleButtonId(uint8_t idleButtonId) + { + mIdleButtonId = idleButtonId; + return *this; + } + + ButtonEventsSimulator & SetPressedButtonId(uint8_t pressedButtonId) + { + mPressedButtonId = pressedButtonId; + return *this; + } + + ButtonEventsSimulator & SetMode(Mode mode) + { + mMode = mode; + return *this; + } + + ButtonEventsSimulator & SetEndpointId(EndpointId endpointId) + { + mEndpointId = endpointId; + return *this; + } + + ButtonEventsSimulator & SetFeatureMap(uint32_t featureMap) + { + mFeatureMap = featureMap; + return *this; + } + + ButtonEventsSimulator & SetMultiPressMax(uint8_t multiPressMax) + { + mMultiPressMax = multiPressMax; + return *this; + } + +private: + enum class State + { + kIdle = 0, + + kEmitStartOfLongPress = 1, + kEmitLongPress = 2, + kEmitLongRelease = 3, + + kEmitStartOfMultiPress = 4, + kEmitEndOfMultiPress = 5, + + kMultiPressButtonRelease = 6, + }; + + static void OnTimerDone(System::Layer * layer, void * appState); + void SetState(State newState); + void Next(); + void StartTimer(System::Clock::Timeout duration); + + DoneCallback mDoneCallback; + System::Clock::Milliseconds32 mLongPressDelayMillis{}; + System::Clock::Milliseconds32 mLongPressDurationMillis{}; + System::Clock::Milliseconds32 mMultiPressPressedTimeMillis{}; + System::Clock::Milliseconds32 mMultiPressReleasedTimeMillis{}; + uint8_t mMultiPressNumPresses{ 1 }; + uint8_t mMultiPressPressesDone{ 0 }; + uint8_t mIdleButtonId{ 0 }; + uint8_t mPressedButtonId{ 1 }; + EndpointId mEndpointId{ 1 }; + uint32_t mFeatureMap{ 0 }; + uint8_t mMultiPressMax{ 0 }; + + Mode mMode{ Mode::kModeLongPress }; + State mState{ State::kIdle }; +}; + +} // namespace app +} // namespace chip diff --git a/examples/all-clusters-app/linux/args.gni b/examples/all-clusters-app/linux/args.gni index d414ad5dedaf5d..92d01ea3358b30 100644 --- a/examples/all-clusters-app/linux/args.gni +++ b/examples/all-clusters-app/linux/args.gni @@ -29,3 +29,4 @@ matter_log_json_payload_decode_full = true matter_log_json_payload_hex = true chip_enable_smoke_co_trigger = true chip_enable_boolean_state_configuration_trigger = true +chip_enable_water_heater_management_trigger = true diff --git a/examples/all-clusters-app/linux/main-common.cpp b/examples/all-clusters-app/linux/main-common.cpp index 73af031ecbdb5d..bc547d5416377c 100644 --- a/examples/all-clusters-app/linux/main-common.cpp +++ b/examples/all-clusters-app/linux/main-common.cpp @@ -37,6 +37,7 @@ #include "rvc-modes.h" #include "rvc-operational-state-delegate-impl.h" #include "tcc-mode.h" +#include "water-heater-mode.h" #include #include #include @@ -62,6 +63,8 @@ #include +#include + using namespace chip; using namespace chip::app; using namespace chip::DeviceLayer; @@ -79,13 +82,19 @@ Clusters::ValveConfigurationAndControl::ValveControlDelegate sValveDelegate; Clusters::TimeSynchronization::ExtendedTimeSyncDelegate sTimeSyncDelegate; // Please refer to https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/master/src/namespaces -constexpr const uint8_t kNamespaceCommon = 7; +constexpr const uint8_t kNamespaceCommon = 7; +constexpr const uint8_t kNamespaceSwitches = 0x43; + // Common Number Namespace: 7, tag 0 (Zero) constexpr const uint8_t kTagCommonZero = 0; // Common Number Namespace: 7, tag 1 (One) constexpr const uint8_t kTagCommonOne = 1; // Common Number Namespace: 7, tag 2 (Two) constexpr const uint8_t kTagCommonTwo = 2; +// Switches namespace: 0x43, tag = 0x03 (Up) +constexpr const uint8_t kTagSwitchesUp = 0x03; +// Switches namespace: 0x43, tag = 0x04 (Down) +constexpr const uint8_t kTagSwitchesDown = 0x04; constexpr const uint8_t kNamespacePosition = 8; // Common Position Namespace: 8, tag: 0 (Left) @@ -103,6 +112,11 @@ const Clusters::Descriptor::Structs::SemanticTagStruct::Type gEp1TagList[] = { const Clusters::Descriptor::Structs::SemanticTagStruct::Type gEp2TagList[] = { { .namespaceID = kNamespaceCommon, .tag = kTagCommonTwo }, { .namespaceID = kNamespacePosition, .tag = kTagPositionRight } }; +// Endpoints 3 and 4 are an action switch and a non-action switch. On the device, they're tagged as up and down because why not. +const Clusters::Descriptor::Structs::SemanticTagStruct::Type gEp3TagList[] = { { .namespaceID = kNamespaceSwitches, + .tag = kTagSwitchesUp } }; +const Clusters::Descriptor::Structs::SemanticTagStruct::Type gEp4TagList[] = { { .namespaceID = kNamespaceSwitches, + .tag = kTagSwitchesDown } }; } // namespace #ifdef MATTER_DM_PLUGIN_DISHWASHER_ALARM_SERVER @@ -234,9 +248,13 @@ void ApplicationInit() Clusters::ValveConfigurationAndControl::SetDefaultDelegate(chip::EndpointId(1), &sValveDelegate); Clusters::TimeSynchronization::SetDefaultDelegate(&sTimeSyncDelegate); + Clusters::WaterHeaterManagement::WhmApplicationInit(); + SetTagList(/* endpoint= */ 0, Span(gEp0TagList)); SetTagList(/* endpoint= */ 1, Span(gEp1TagList)); SetTagList(/* endpoint= */ 2, Span(gEp2TagList)); + SetTagList(/* endpoint= */ 3, Span(gEp3TagList)); + SetTagList(/* endpoint= */ 4, Span(gEp4TagList)); } void ApplicationShutdown() @@ -259,6 +277,10 @@ void ApplicationShutdown() Clusters::DeviceEnergyManagementMode::Shutdown(); Clusters::EnergyEvseMode::Shutdown(); + Clusters::WaterHeaterMode::Shutdown(); + + Clusters::WaterHeaterManagement::WhmApplicationShutdown(); + Clusters::WaterHeaterMode::Shutdown(); if (sChipNamedPipeCommands.Stop() != CHIP_NO_ERROR) { diff --git a/examples/all-clusters-app/mbed/CMakeLists.txt b/examples/all-clusters-app/mbed/CMakeLists.txt index 3d1a179a93bbb2..427517aff9f8e1 100644 --- a/examples/all-clusters-app/mbed/CMakeLists.txt +++ b/examples/all-clusters-app/mbed/CMakeLists.txt @@ -72,12 +72,15 @@ target_sources(${APP_TARGET} PRIVATE ${ALL_CLUSTERS_COMMON}/src/smco-stub.cpp ${ALL_CLUSTERS_COMMON}/src/static-supported-modes-manager.cpp ${ALL_CLUSTERS_COMMON}/src/static-supported-temperature-levels.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/ChargingTargetsMemMgr.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementManager.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/EVSEManufacturerImpl.cpp ${ENERGY_MANAGEMENT_COMMON}/src/ElectricalPowerMeasurementDelegate.cpp ${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseDelegateImpl.cpp ${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseManager.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementDelegateImpl.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementManager.cpp - + ${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseTargetsStore.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/EnergyTimeUtils.cpp ) chip_configure_data_model(${APP_TARGET} diff --git a/examples/all-clusters-app/nrfconnect/CMakeLists.txt b/examples/all-clusters-app/nrfconnect/CMakeLists.txt index 563295e059b46c..e11dcbd14356fc 100644 --- a/examples/all-clusters-app/nrfconnect/CMakeLists.txt +++ b/examples/all-clusters-app/nrfconnect/CMakeLists.txt @@ -23,15 +23,6 @@ get_filename_component(ENERGY_MANAGEMENT_COMMON_DIR ${CHIP_ROOT}/examples/energy include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) -# Set Kconfig root files that will be processed as a first Kconfig for used child images. -set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root) -set(multiprotocol_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root) -set(hci_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.hci_rpmsg.root) - -if(DEFINED CONF_FILE AND NOT CONF_FILE STREQUAL "prj.conf") - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static_dfu.yml) -endif() - list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) @@ -43,6 +34,7 @@ target_compile_options(app PRIVATE -Werror -Wno-error=maybe-uninitialized) project(chip-nrfconnect-all-clusters-app-example) +include(${CHIP_ROOT}/config/nrfconnect/app/check-sysbuild-use.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/flashing.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) @@ -50,7 +42,7 @@ include(${CHIP_ROOT}/src/app/chip_data_model.cmake) target_include_directories(app PRIVATE main/include ${ALL_CLUSTERS_COMMON_DIR}/include - ${ENERGY_MANAGEMENT_COMMON_DIR}/include + ${ENERGY_MANAGEMENT_COMMON_DIR}/include ${GEN_DIR}/app-common ${GEN_DIR}/all-clusters-app ${NRFCONNECT_COMMON}/util/include) @@ -65,16 +57,20 @@ target_sources(app PRIVATE ${ALL_CLUSTERS_COMMON_DIR}/src/fan-stub.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/oven-modes.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/energy-evse-stub.cpp - ${ALL_CLUSTERS_COMMON_DIR}/src/device-energy-management-stub.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/device-energy-management-stub.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/binding-handler.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/air-quality-instance.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/concentration-measurement-instances.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/resource-monitoring-delegates.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/ChargingTargetsMemMgr.cpp ${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementDelegateImpl.cpp ${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementManager.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EVSEManufacturerImpl.cpp ${ENERGY_MANAGEMENT_COMMON_DIR}/src/ElectricalPowerMeasurementDelegate.cpp ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseDelegateImpl.cpp ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseManager.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseTargetsStore.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyTimeUtils.cpp ${NRFCONNECT_COMMON}/util/LEDWidget.cpp) chip_configure_data_model(app diff --git a/examples/all-clusters-app/nrfconnect/Kconfig.sysbuild b/examples/all-clusters-app/nrfconnect/Kconfig.sysbuild new file mode 100644 index 00000000000000..6d6f1d811109a9 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/Kconfig.sysbuild @@ -0,0 +1,67 @@ +# +# 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. +# + +#### Radio core selection +config NRF_DEFAULT_IPC_RADIO + default y + +# Enable IEEE802.15.4 serialization to network core +config NETCORE_IPC_RADIO_IEEE802154 + default y if (SOC_SERIES_NRF53X) && !WIFI_NRF700X + +# Enable Bluetooth serialization to network core +config NETCORE_IPC_RADIO_BT_HCI_IPC + default y if SOC_SERIES_NRF53X + +if BOOTLOADER_MCUBOOT + +#### DFU multi-image support +config DFU_MULTI_IMAGE_PACKAGE_BUILD + default y + +config DFU_MULTI_IMAGE_PACKAGE_APP + default y + +config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY + default y + +#### DFU network core configuration +if SOC_SERIES_NRF53X + +config MCUBOOT_UPDATEABLE_IMAGES + default 2 + +choice MCUBOOT_MODE + default MCUBOOT_MODE_OVERWRITE_ONLY +endchoice + +choice BOOT_SIGNATURE_TYPE + default BOOT_SIGNATURE_TYPE_RSA +endchoice + +config SECURE_BOOT_NETCORE + default y + +config NETCORE_APP_UPDATE + default y + +config DFU_MULTI_IMAGE_PACKAGE_NET + default y + +endif # SOC_SERIES_NRF53X +endif # BOOTLOADER_MCUBOOT + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/examples/all-clusters-app/nrfconnect/README.md b/examples/all-clusters-app/nrfconnect/README.md index 18df16f5e11654..3a58e448d76254 100644 --- a/examples/all-clusters-app/nrfconnect/README.md +++ b/examples/all-clusters-app/nrfconnect/README.md @@ -1,5 +1,21 @@ # Matter nRF Connect All Clusters Example Application +> **Note:** This example is intended only to perform smoke tests of a Matter +> solution integrated with nRF Connect SDK platform. The example quality is not +> production ready and it may contain minor bugs or use not optimal +> configuration. It is not recommended to use this example as a basis for +> creating a market ready product. +> +> For the production ready and optimized Matter samples, see +> [nRF Connect SDK samples](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/matter.html). +> The Matter samples in nRF Connect SDK use various additional software +> components and provide multiple optional features that improve the developer +> and user experience. To read more about it, see +> [Matter support in nRF Connect SDK](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/matter/index.html#ug-matter) +> page. Using Matter samples from nRF Connect SDK allows you to get a full +> Nordic technical support via [DevZone](https://devzone.nordicsemi.com/) +> portal. + The nRF All Clusters Example Application implements various ZCL clusters populated on three endpoints. You can use this example as a reference for creating your own application. @@ -85,10 +101,10 @@ The example supports building and running on the following devices: | Hardware platform | Build target | Platform image | | ------------------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk_nrf52840` |
nRF52840 DKnRF52840 DK
| -| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk_nrf5340_cpuapp` |
nRF5340 DKnRF5340 DK
| -| [nRF52840 Dongle](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle) | `nrf52840dongle_nrf52840` |
nRF52840 DonglenRF52840 Dongle
| -| [nRF7002 DK](https://www.nordicsemi.com/Products/Development-hardware/nRF7002-DK) | `nrf7002dk_nrf5340_cpuapp` |
nRF7002 DKnRF7002 DK
| +| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk/nrf52840` |
nRF52840 DKnRF52840 DK
| +| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk/nrf5340/cpuapp` |
nRF5340 DKnRF5340 DK
| +| [nRF52840 Dongle](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle) | `nrf52840dongle/nrf52840` |
nRF52840 DonglenRF52840 Dongle
| +| [nRF7002 DK](https://www.nordicsemi.com/Products/Development-hardware/nRF7002-DK) | `nrf7002dk/nrf5340/cpuapp` |
nRF7002 DKnRF7002 DK
|
@@ -97,9 +113,9 @@ The example supports building and running on the following devices: The development kits for this sample offer the following IPv6 network support for Matter: -- Matter over Thread is supported for `nrf52840dk_nrf52840` and - `nrf5340dk_nrf5340_cpuapp`. -- Matter over Wi-Fi is supported for `nrf7002dk_nrf5340_cpuapp`. +- Matter over Thread is supported for `nrf52840dk/nrf52840` and + `nrf5340dk/nrf5340/cpuapp`. +- Matter over Wi-Fi is supported for `nrf7002dk/nrf5340/cpuapp`. ## Device UI @@ -248,14 +264,15 @@ Complete the following steps to build the sample: 2. Run the following command to build the example, with _build-target_ replaced with the build target name of the Nordic Semiconductor's kit you own, for - example `nrf52840dk_nrf52840`: + example `nrf52840dk/nrf52840`: - $ west build -b build-target + $ west build -b build-target --sysbuild You only need to specify the build target on the first build. See [Requirements](#requirements) for the build target names of compatible kits. -The output `zephyr.hex` file will be available in the `build/zephyr/` directory. +The output `zephyr.hex` file will be available in the `build/nrfconnect/zephyr/` +directory. ### Removing build artifacts @@ -270,7 +287,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DCONF_FILE=prj_release.conf + $ west build -b build-target --sysbuild -- -DFILE_SUFFIX=release Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -281,9 +298,9 @@ Support for DFU using Matter OTA is disabled by default. To build the example with configuration that supports DFU, run the following command with _build-target_ replaced with the build target name of the Nordic -Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): +Semiconductor kit you are using (for example `nrf52840dk/nrf52840`): - $ west build -b build-target -- -DCONF_FILE=prj_dfu.conf + $ west build -b build-target --sysbuild -- -DFILE_SUFFIX=dfu > **Note**: > @@ -299,7 +316,7 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): #### Changing bootloader configuration To change the default MCUboot configuration, edit the `prj.conf` file located in -the `child_image/mcuboot` directory. +the `sysbuild/mcuboot` directory. #### Changing flash memory settings @@ -311,8 +328,9 @@ purposes. You can change these settings by defining This example uses this option to define using an external flash. To modify the flash settings of your board (that is, your _build-target_, for -example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the -`configuration/build-target/` directory. +example `nrf52840dk/nrf52840`), edit the `pm_static_.yml` file +(for example `pm_static_nrf52840dk_nrf52840.yml`), located in the main +application directory.
@@ -324,7 +342,7 @@ using the menuconfig utility. To open the menuconfig utility, run the following command from the example directory: - $ west build -b build-target -t menuconfig + $ west build -b build-target --sysbuild -t menuconfig Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. diff --git a/examples/all-clusters-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf b/examples/all-clusters-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf index 4da8bbcd8ac81b..78bdefbd4452da 100644 --- a/examples/all-clusters-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf +++ b/examples/all-clusters-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf @@ -38,6 +38,3 @@ CONFIG_MATTER_LOG_LEVEL_INF=y # Use partition manager to configure the settings partition not to overlap with Open Bootloader CONFIG_PM_SINGLE_IMAGE=y - -# Enable CHIP pairing automatically on application start. -CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y diff --git a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index f18e3e0cc16434..00000000000000 --- a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.overlay b/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/prj_dfu.conf b/examples/all-clusters-app/nrfconnect/child_image/mcuboot/prj_dfu.conf deleted file mode 100644 index 287c7829c6a5cf..00000000000000 --- a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/prj_dfu.conf +++ /dev/null @@ -1,30 +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. -# - -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. - -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" - -# Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. -CONFIG_GPIO=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_USE_SEGGER_RTT=n diff --git a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/prj_release.conf b/examples/all-clusters-app/nrfconnect/child_image/mcuboot/prj_release.conf deleted file mode 100644 index 287c7829c6a5cf..00000000000000 --- a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/prj_release.conf +++ /dev/null @@ -1,30 +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. -# - -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. - -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" - -# Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. -CONFIG_GPIO=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_USE_SEGGER_RTT=n diff --git a/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf b/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_dfu.conf b/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_dfu.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_dfu.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf b/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml b/examples/all-clusters-app/nrfconnect/pm_static_nrf52840dk_nrf52840_dfu.yml similarity index 100% rename from examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml rename to examples/all-clusters-app/nrfconnect/pm_static_nrf52840dk_nrf52840_dfu.yml diff --git a/examples/all-clusters-minimal-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml b/examples/all-clusters-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml similarity index 100% rename from examples/all-clusters-minimal-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml rename to examples/all-clusters-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml diff --git a/examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml b/examples/all-clusters-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_dfu.yml similarity index 100% rename from examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml rename to examples/all-clusters-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_dfu.yml diff --git a/examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml b/examples/all-clusters-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml similarity index 100% rename from examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml rename to examples/all-clusters-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml diff --git a/examples/all-clusters-app/nrfconnect/configuration/nrf7002dk_nrf5340_cpuapp/pm_static_dfu.yml b/examples/all-clusters-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp_dfu.yml similarity index 100% rename from examples/all-clusters-app/nrfconnect/configuration/nrf7002dk_nrf5340_cpuapp/pm_static_dfu.yml rename to examples/all-clusters-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp_dfu.yml diff --git a/examples/light-switch-app/nrfconnect/configuration/nrf7002dk_nrf5340_cpuapp/pm_static_dfu.yml b/examples/all-clusters-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp_release.yml similarity index 100% rename from examples/light-switch-app/nrfconnect/configuration/nrf7002dk_nrf5340_cpuapp/pm_static_dfu.yml rename to examples/all-clusters-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp_release.yml diff --git a/examples/all-clusters-app/nrfconnect/prj.conf b/examples/all-clusters-app/nrfconnect/prj.conf index dfb604a06349c1..5917c3a9c7a17e 100644 --- a/examples/all-clusters-app/nrfconnect/prj.conf +++ b/examples/all-clusters-app/nrfconnect/prj.conf @@ -25,6 +25,13 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 CONFIG_STD_CPP17=y +# Enable Matter pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/all-clusters-app/nrfconnect/prj_dfu.conf b/examples/all-clusters-app/nrfconnect/prj_dfu.conf index 3b5937b4073d9a..1925502dcad410 100644 --- a/examples/all-clusters-app/nrfconnect/prj_dfu.conf +++ b/examples/all-clusters-app/nrfconnect/prj_dfu.conf @@ -24,6 +24,13 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 CONFIG_STD_CPP17=y +# Enable Matter pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/all-clusters-app/nrfconnect/prj_release.conf b/examples/all-clusters-app/nrfconnect/prj_release.conf index 714fa9dd4ab740..18685a7488fce5 100644 --- a/examples/all-clusters-app/nrfconnect/prj_release.conf +++ b/examples/all-clusters-app/nrfconnect/prj_release.conf @@ -25,6 +25,13 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 CONFIG_STD_CPP17=y +# Enable Matter pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y @@ -55,3 +62,7 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=y # Enable the Read Client for binding purposes CONFIG_CHIP_ENABLE_READ_CLIENT=y + +# Enable LTO to reduce the flash usage +CONFIG_LTO=y +CONFIG_ISR_TABLES_LOCAL_DECLARATION=y diff --git a/examples/all-clusters-app/nrfconnect/sysbuild.conf b/examples/all-clusters-app/nrfconnect/sysbuild.conf new file mode 100644 index 00000000000000..e63a92c6b2bbab --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/sysbuild.conf @@ -0,0 +1,18 @@ +# +# 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. +# + +SB_CONFIG_MATTER=y +SB_CONFIG_MATTER_OTA=n diff --git a/examples/all-clusters-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf b/examples/all-clusters-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf new file mode 100644 index 00000000000000..8540585e53358b --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf @@ -0,0 +1,58 @@ +# +# 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. +# + +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# 802.15.4 configuration +CONFIG_NRF_802154_SER_RADIO=y +CONFIG_NRF_802154_ENCRYPTION=y +CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=2 + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_DEBUG_INFO=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y +CONFIG_IPC_RADIO_802154=y diff --git a/examples/all-clusters-app/nrfconnect/sysbuild/ipc_radio/boards/nrf7002dk_nrf5340_cpunet.conf b/examples/all-clusters-app/nrfconnect/sysbuild/ipc_radio/boards/nrf7002dk_nrf5340_cpunet.conf new file mode 100644 index 00000000000000..694c3b08242f29 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/sysbuild/ipc_radio/boards/nrf7002dk_nrf5340_cpunet.conf @@ -0,0 +1,52 @@ +# +# 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. +# + +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_DEBUG_INFO=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y diff --git a/examples/all-clusters-app/nrfconnect/sysbuild/ipc_radio/prj.conf b/examples/all-clusters-app/nrfconnect/sysbuild/ipc_radio/prj.conf new file mode 100644 index 00000000000000..8906415dda4fc7 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/sysbuild/ipc_radio/prj.conf @@ -0,0 +1,21 @@ +# +# 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. +# + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=n diff --git a/examples/all-clusters-app/nrfconnect/sysbuild/ipc_radio/prj_dfu.conf b/examples/all-clusters-app/nrfconnect/sysbuild/ipc_radio/prj_dfu.conf new file mode 100644 index 00000000000000..7f92a51630cce0 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/sysbuild/ipc_radio/prj_dfu.conf @@ -0,0 +1,20 @@ +# +# 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. +# +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=y diff --git a/examples/all-clusters-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf b/examples/all-clusters-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf new file mode 100644 index 00000000000000..7f92a51630cce0 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf @@ -0,0 +1,20 @@ +# +# 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. +# +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=y diff --git a/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/app.overlay b/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/app.overlay new file mode 100644 index 00000000000000..74d3dfbfd22f30 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/app.overlay @@ -0,0 +1,5 @@ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf b/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf new file mode 100644 index 00000000000000..50610217c762b5 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf @@ -0,0 +1,19 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 diff --git a/examples/lit-icd-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay similarity index 90% rename from examples/lit-icd-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay rename to examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay index 9f9128c6beff60..054f04712058a3 100644 --- a/examples/lit-icd-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay +++ b/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay @@ -1,5 +1,7 @@ /* + * * 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. @@ -16,6 +18,7 @@ / { chosen { + zephyr,code-partition = &boot_partition; nordic,pm-ext-flash = &mx25r64; }; }; diff --git a/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000000..2d86fe6442dd39 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -0,0 +1,35 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 + +CONFIG_BOOT_SWAP_USING_MOVE=n +# Multi-image updates do not support image swapping yet. +CONFIG_BOOT_UPGRADE_ONLY=y + +# The network core cannot access external flash directly. The flash simulator must be used to +# provide a memory region that is used to forward the new firmware to the network core. +CONFIG_FLASH_SIMULATOR=y +CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y +CONFIG_FLASH_SIMULATOR_STATS=n + +CONFIG_ZCBOR=y diff --git a/examples/lit-icd-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay b/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay similarity index 90% rename from examples/lit-icd-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay rename to examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay index 9f9128c6beff60..054f04712058a3 100644 --- a/examples/lit-icd-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay +++ b/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -1,5 +1,7 @@ /* + * * 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. @@ -16,6 +18,7 @@ / { chosen { + zephyr,code-partition = &boot_partition; nordic,pm-ext-flash = &mx25r64; }; }; diff --git a/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf b/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000000..81701b7eb63f70 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf @@ -0,0 +1,40 @@ +# +# 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. +# + +# nRF7002DK uses SPI NOR external flash +CONFIG_GPIO=y +CONFIG_SPI=y +CONFIG_SPI_NOR=y +CONFIG_SPI_NOR_SFDP_DEVICETREE=y +CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 + +CONFIG_MULTITHREADING=y +CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 + +# Multi-image updates do not support image swapping yet. +CONFIG_BOOT_UPGRADE_ONLY=y + +# The network core cannot access external flash directly. The flash simulator must be used to +# provide a memory region that is used to forward the new firmware to the network core. +CONFIG_FLASH_SIMULATOR=y +CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y +CONFIG_FLASH_SIMULATOR_STATS=n + +CONFIG_ZCBOR=y diff --git a/examples/lit-icd-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay b/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay similarity index 90% rename from examples/lit-icd-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay rename to examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay index 9f9128c6beff60..054f04712058a3 100644 --- a/examples/lit-icd-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay +++ b/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay @@ -1,5 +1,7 @@ /* + * * 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. @@ -16,6 +18,7 @@ / { chosen { + zephyr,code-partition = &boot_partition; nordic,pm-ext-flash = &mx25r64; }; }; diff --git a/examples/lit-icd-app/nrfconnect/child_image/mcuboot/prj.conf b/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/prj.conf similarity index 62% rename from examples/lit-icd-app/nrfconnect/child_image/mcuboot/prj.conf rename to examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/prj.conf index 3f43b733b4bb96..3bcb12fe7b8d25 100644 --- a/examples/lit-icd-app/nrfconnect/child_image/mcuboot/prj.conf +++ b/examples/all-clusters-app/nrfconnect/sysbuild/mcuboot/prj.conf @@ -14,17 +14,36 @@ # limitations under the License. # -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. +CONFIG_MAIN_STACK_SIZE=10240 + +CONFIG_BOOT_SWAP_SAVE_ENCTLV=n +CONFIG_BOOT_BOOTSTRAP=n +CONFIG_PM=n + +CONFIG_FLASH=y +CONFIG_FPROTECT=y CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +# Use minimal C library instead of the Picolib +CONFIG_MINIMAL_LIBC=y + # Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. CONFIG_CONSOLE=n CONFIG_SERIAL=n CONFIG_UART_CONSOLE=n CONFIG_USE_SEGGER_RTT=n CONFIG_GPIO=n + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +CONFIG_LOG=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_NCS_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/all-clusters-app/nrfconnect/sysbuild_dfu.conf b/examples/all-clusters-app/nrfconnect/sysbuild_dfu.conf new file mode 100644 index 00000000000000..edaaa8394e0155 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/sysbuild_dfu.conf @@ -0,0 +1,20 @@ +# +# 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. +# + +SB_CONFIG_MATTER=y +SB_CONFIG_MATTER_OTA=y +SB_CONFIG_BOOTLOADER_MCUBOOT=y +SB_CONFIG_MATTER_FACTORY_DATA_GENERATE=y diff --git a/examples/all-clusters-app/nrfconnect/sysbuild_release.conf b/examples/all-clusters-app/nrfconnect/sysbuild_release.conf new file mode 100644 index 00000000000000..edaaa8394e0155 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/sysbuild_release.conf @@ -0,0 +1,20 @@ +# +# 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. +# + +SB_CONFIG_MATTER=y +SB_CONFIG_MATTER_OTA=y +SB_CONFIG_BOOTLOADER_MCUBOOT=y +SB_CONFIG_MATTER_FACTORY_DATA_GENERATE=y diff --git a/examples/all-clusters-app/nxp/mw320/BUILD.gn b/examples/all-clusters-app/nxp/mw320/BUILD.gn index ebae8c34bccdee..e5e3671143ee99 100644 --- a/examples/all-clusters-app/nxp/mw320/BUILD.gn +++ b/examples/all-clusters-app/nxp/mw320/BUILD.gn @@ -89,11 +89,15 @@ mw320_executable("shell_mw320") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp", "${chip_root}/src/lib/shell/streamer_mw320.cpp", "binding-handler.cpp", "include/CHIPProjectConfig.h", diff --git a/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn b/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn index bfa4e89922f178..e6bf8d64d94524 100644 --- a/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn +++ b/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn @@ -49,7 +49,8 @@ declare_args() { setup_discriminator = 3840 } -example_platform_dir = "${chip_root}/examples/platform/nxp/${nxp_platform}" +example_platform_dir = + "${nxp_sdk_matter_support_root}/examples/platform/${nxp_platform}" common_example_dir = "${chip_root}/examples/platform/nxp/common" if (tcp_download == true && wifi_connect == true) { diff --git a/examples/all-clusters-app/nxp/zephyr/.gitignore b/examples/all-clusters-app/nxp/zephyr/.gitignore new file mode 100644 index 00000000000000..84c048a73cc2e5 --- /dev/null +++ b/examples/all-clusters-app/nxp/zephyr/.gitignore @@ -0,0 +1 @@ +/build/ diff --git a/examples/all-clusters-app/nxp/zephyr/CMakeLists.txt b/examples/all-clusters-app/nxp/zephyr/CMakeLists.txt new file mode 100644 index 00000000000000..2fa2d558a2724a --- /dev/null +++ b/examples/all-clusters-app/nxp/zephyr/CMakeLists.txt @@ -0,0 +1,115 @@ +# +# Copyright (c) 2023-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. +# +cmake_minimum_required(VERSION 3.13.1) + +get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) +get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) +get_filename_component(ALL_CLUSTERS_COMMON_DIR ${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common REALPATH) +get_filename_component(ALL_CLUSTERS_NXP_COMMON_DIR ${CHIP_ROOT}/examples/all-clusters-app/nxp/common REALPATH) +get_filename_component(EXAMPLE_PLATFORM_NXP_COMMON_DIR ${CHIP_ROOT}/examples/platform/nxp/common REALPATH) +get_filename_component(EXAMPLE_PLATFORM_NXP_ZEPHYR_DIR ${CHIP_ROOT}/examples/platform/nxp/zephyr REALPATH) + +# Perform common operations like detecting extra overlays in the platform folder for the target board +# This must be called before find_package(Zephyr) +include(${CHIP_ROOT}/config/nxp/app/pre-zephyr.cmake) + +list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nxp/chip-module) +find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) + +# -Wmaybe-uninitialized has too many false positives, including on std::optional +# and chip::Optional. Make it nonfatal. +# +# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635 +target_compile_options(app PRIVATE -Werror -Wno-error=maybe-uninitialized) + +project(chip-nxp-all-clusters-app-example) + +include(${CHIP_ROOT}/config/nxp/app/enable-gnu-std.cmake) +include(${CHIP_ROOT}/src/app/chip_data_model.cmake) + +target_include_directories(app + PRIVATE + ${ALL_CLUSTERS_NXP_COMMON_DIR}/main/include + ${ALL_CLUSTERS_COMMON_DIR}/include + ${GEN_DIR}/app-common + ${GEN_DIR}/all-clusters-app + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_manager/include + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/icd/include + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_callbacks/include + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/factory_data/include + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/app_task/include +) + +target_sources(app + PRIVATE + main/main.cpp + ${ALL_CLUSTERS_NXP_COMMON_DIR}/main/AppTask.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_manager/source/CHIPDeviceManager.cpp + ${ALL_CLUSTERS_NXP_COMMON_DIR}/main/DeviceCallbacks.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_callbacks/source/CommonDeviceCallbacks.cpp + ${ALL_CLUSTERS_NXP_COMMON_DIR}/main/ZclCallbacks.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/binding-handler.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/app_task/source/AppTaskBase.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/app_task/source/AppTaskZephyr.cpp + ${EXAMPLE_PLATFORM_NXP_ZEPHYR_DIR}/factory_data/source/AppFactoryDataExample.cpp +) + +target_compile_definitions(app PUBLIC + "EXTERNAL_FACTORY_DATA_PROVIDER_IMPL_HEADER=\"platform/nxp/zephyr/FactoryDataProviderImpl.h\"" +) + +if(CONFIG_CHIP_OTA_REQUESTOR) + target_sources(app PRIVATE + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/ota_requestor/source/OTARequestorInitiatorCommon.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/ota_requestor/source/OTARequestorInitiatorZephyr.cpp + ) + target_include_directories(app PRIVATE + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/ota_requestor/include/ + ) +endif() + +chip_configure_data_model(app + INCLUDE_SERVER + ZAP_FILE ${ALL_CLUSTERS_COMMON_DIR}/all-clusters-app.zap +) + +if(CONFIG_CHIP_LIB_SHELL) + target_compile_definitions(app PRIVATE ENABLE_CHIP_SHELL) + target_include_directories(app PRIVATE + ${CHIP_ROOT}/examples/shell/shell_common/include + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/matter_cli/include + ) + target_sources(app PRIVATE + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/matter_cli/source/AppCLIBase.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/matter_cli/source/AppCLIZephyr.cpp + ${CHIP_ROOT}/examples/shell/shell_common/cmd_misc.cpp + ${CHIP_ROOT}/examples/shell/shell_common/cmd_otcli.cpp + ${CHIP_ROOT}/examples/shell/shell_common/cmd_server.cpp + ) +endif() + +target_sources(app + PRIVATE + ${ALL_CLUSTERS_COMMON_DIR}/src/smco-stub.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/static-supported-modes-manager.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/static-supported-temperature-levels.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/bridged-actions-stub.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/fan-stub.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/air-quality-instance.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/concentration-measurement-instances.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/resource-monitoring-delegates.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/icd/source/ICDUtil.cpp +) diff --git a/examples/all-clusters-app/nxp/zephyr/Kconfig b/examples/all-clusters-app/nxp/zephyr/Kconfig new file mode 100644 index 00000000000000..748835a9d0fe6b --- /dev/null +++ b/examples/all-clusters-app/nxp/zephyr/Kconfig @@ -0,0 +1,20 @@ +# +# 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. +# +mainmenu "Matter NXP All Clusters Example Application" + +rsource "../../../../config/nxp/chip-module/Kconfig.features" +rsource "../../../../config/nxp/chip-module/Kconfig.defaults" +source "Kconfig.zephyr" diff --git a/examples/all-clusters-app/nxp/zephyr/README.md b/examples/all-clusters-app/nxp/zephyr/README.md new file mode 100644 index 00000000000000..45f71ee76c077b --- /dev/null +++ b/examples/all-clusters-app/nxp/zephyr/README.md @@ -0,0 +1,609 @@ +# CHIP NXP Zephyr All-clusters Application + +The all-clusters example implements a server which can be accessed by a CHIP +controller and can accept basic cluster commands. + +The example is based on +[Project CHIP](https://github.com/project-chip/connectedhomeip) and the NXP +Zephyr SDK, and provides a prototype application that demonstrates device +commissioning and different cluster control. + +
+ +- [Introduction](#introduction) +- [Building](#building) +- [Flashing and debugging](#flashing-and-debugging) +- [Factory data](#factory-data) +- [Manufacturing data](#generate-factory-data) +- [OTA Software Update](#ota-software-update) +- [Testing the example](#testing-the-example) +- [Using Matter CLI in NXP Zephyr examples](#using-matter-cli-in-nxp-zephyr-examples) + +
+ + + +## Introduction + +The Zephyr application provides a working demonstration of supported board +integration from Zephyr, built using the Project CHIP codebase and the +NXP/Zephyr SDK. + +The example supports: + +- Matter over Wi-Fi + +The supported boards are: + +- `rd_rw612_bga` + + + +## Building + +In order to build the Project CHIP example, we recommend using a Linux +distribution (the demo-application was compiled on Ubuntu 20.04). + +Prerequisites: + +- Follow instruction from [BUILDING.md](../../../../docs/guides/BUILDING.md) + to setup the Matter environment +- Follow instruction from + [Getting Started Guide](https://docs.zephyrproject.org/latest/develop/getting_started/index.html) + to setup a Zephyr workspace, however, the west init command to use is as + follows: + +```shell +$ west init zephyrproject -m https://github.com/nxp-zephyr-ear/zephyr.git --mr zephyr_rw61x_v3.6_RFP +``` + +> **Note**: Currently, supported NXP platforms in Zephyr targeting Matter are +> not available in the official Zephyr repo, you'll have to use the NXP fork +> `https://github.com/nxp-zephyr-ear/zephyr` github repo. Reach to your NXP +> contact for more details. + +Steps to build the example, targeting `rd_rw612_bga` board: + +1. Activate your Matter env: + +```shell +source /scripts/activate.sh +``` + +2. Source zephyr-env.sh: + +```shell +source /zephyr-env.sh +``` + +3. Run west build command: + +```shell +west build -b rd_rw612_bga -p +``` + +By default, a folder `build` will be created in the same folder you run the +command from. The binaries will be created in `build/zephyr` with the name +`zephyr.elf` and `zephyr.bin`. + +You can get more details on `west build` with +[Zephyr's building guide](https://docs.zephyrproject.org/latest/develop/west/build-flash-debug.html#building-west-build) + + + +## Flashing and debugging + +### Flashing without debugging + +`west` can be used to flash a target, as an example for `rd_rw612_bga` board: + +```shell +west flash -i +``` + +You can get more details on `west flash` with +[Zephyr's flashing guide](https://docs.zephyrproject.org/latest/develop/west/build-flash-debug.html#flashing-west-flash) + +> **Note**: `west flash` will not start a debug session, it will only flash and +> reset the device + +### Flash and debug + +To debug a Matter with Zephyr application, you could use several methods: + +- [MCUXpresso IDE (version >= 11.6.0)](https://www.nxp.com/design/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-integrated-development-environment-ide:MCUXpresso-IDE) +- `west debug` + [Zephyr's debugging guide](https://docs.zephyrproject.org/latest/develop/west/build-flash-debug.html#id29) + +> **Note**: As the build provides an elf file, any compatible debugging tool can +> be used. + + + +## Factory data + +NXP Zephyr examples are not using factory data support by default. Please refer +the the section below to build with factory data. + +You may refer to `src/platform/nxp/zephyr/boards//.overlay` file +to obtain the memory region used by this partition. + +For example, the factory data partition on `rd_rw612_bga` is reserved in the +last sector of the `flexspi` flash of `RD BGA` board, at `0x1BFFF000`. + +``` +&flexspi { + status = "okay"; + + mx25u51245g: mx25u51245g@0 { + ... + factory_partition: partition@3FFF000 { + label = "factory-data"; + reg = <0x03FFF000 DT_SIZE_K(4)>; + }; + }; +}; +``` + +> **Note**: You may also refer to +> `src/platform/nxp/zephyr/boards//.overlay` file to check other +> memory partitions used by the platform, such as the file system partition +> mentioned with the `storage` label. + +### Build with factory data support + +To build the example with factory data support, you can add +`-DFILE_SUFFIX=fdata` in the west build command line. + +Example: + +```bash +west build -b rd_rw612_bga -p -- -DFILE_SUFFIX=fdata +``` + +`prj_fdata.conf` configuration file will enable `CONFIG_CHIP_FACTORY_DATA` +Kconfig so the application will load the factory data at boot. + + + +### Generate factory data + +#### Automatically (recommended) + +The factory data can be generated automatically during the build of the +application. To do so, you can use the configuration +`CONFIG_CHIP_FACTORY_DATA_BUILD=y` in `prj_fdata.conf`. + +You will have to specify the source of the certificates to be used for the +factory data. Please refer to `CHIP_FACTORY_DATA_CERT_SOURCE` Kconfig for more +info. + +> **Note**: The application demonstrates the usage of encrypted Matter factory +> data storage. Matter factory data should be encrypted using an AES 128 +> software key before flashing them to the device flash. You can encrypt the +> factory data automatically during the build by enabling +> `CHIP_ENCRYPTED_FACTORY_DATA` Kconfig. See also +> `CHIP_ENCRYPTED_FACTORY_DATA_AES128_KEY` Kconfig if you want to use a specific +> key. + +The resulting factory data will be provided along `zephyr.bin` as a binary file +named `factory_data.bin`. In order to flash it to your device, you need to know +the partition address: please refer to `factory_partition` defined in +`src/platform/nxp/zephyr/boards//.overlay`. + +#### Manually + +See +[Guide for writing manufacturing data on NXP devices](../../../../docs/guides/nxp/nxp_manufacturing_flow.md) + + + +## OTA Software Update + +See +[Guide for OTA Software Update on NXP devices using Zephyr SDK](../../../../docs/guides/nxp/nxp_zephyr_ota_software_update.md) + + + +## Testing the example + +To know how to commission a device over BLE, follow the instructions from +[chip-tool's README.md 'Commission a device over BLE'](../../../chip-tool/README.md#commission-a-device-over-ble). + + + +## Using Matter CLI in NXP Zephyr examples + +Some Matter examples for the development kits from NXP include a command-line +interface that allows access to application logs and +[Zephyr shell](https://docs.zephyrproject.org/1.13.0/subsystems/shell.html). + +Depending on the platform, the CLI console and the logs can be split on two +different interfaces. + +You may refer to `boards/.overlay` file to check how the board is +configured for the example. The binding `zephyr,console` is used to print the +logs, while the binding `zephyr,shell-uart` is used for the CLI. If the logs and +the CLI are split among two serial interfaces, you will have to open both ports. + +As an example, the Matter CLI on `rd_rw612_bga` is configured to be output on +`flexcomm3` with a baudrate of `115200`. The logs are configured to be output on +`flexcomm0` with a baudrate of `115200`. + +> **Note**: `flexcomm3` is wired to the USB `FTDI` port of the `RD BGA` board by +> default. `flexcomm0` is wired to `GPIO2` (RX) and `GPIO3` (TX). Those pins are +> accessible on `HD2` pin header. + +To access the CLI console, use a serial terminal emulator of your choice, like +Minicom or GNU Screen. Use the baud rate set to `115200`. + +### Example: Starting the CLI console with Minicom + +For example, to start using the CLI console with Minicom, run the following +command with `/dev/ttyACM0` replaced with the device node name of your +development kit: + +``` +minicom -D /dev/ttyACM0 -b 115200 +``` + +When you reboot the kit, you will see the boot logs in the console, similar to +the following messages: + +```shell +uart:~$ MAC Address: C0:95:DA:00:00:6E +... +wlan-version +wlan-mac +wlan-thread-info +wlan-net-stats +... +*** Booting Zephyr OS build zephyr-v3.4.0-187-g2ddf1330209b *** +I: Init CHIP stack +... +``` + +This means that the console is working correctly and you can start using shell +commands. For example, issuing the `kernel threads` command will print +information about all running threads: + +```shell +uart:~$ kernel threads +Scheduler: 277 since last call +Threads: + 0x20006518 CHIP + options: 0x0, priority: -1 timeout: 536896912 + state: pending + stack size 8192, unused 7256, usage 936 / 8192 (11 %) + + 0x20004ab0 SDC RX + options: 0x0, priority: -10 timeout: 536890152 + state: pending + stack size 1024, unused 848, usage 176 / 1024 (17 %) +... +``` + +## Listing all commands + +To list all available commands, use the Tab key, which is normally used for the +command completion feature. + +Pressing the Tab key in an empty command line prints the list of available +commands: + +```shell +uart:~$ + clear device help history + hwinfo kernel matter resize + retval shell +``` + +Pressing the Tab key with a command entered in the command line cycles through +available options for the given command. + +You can also run the `help` command: + +```shell +uart:~$ help +Please press the button to see all available commands. +You can also use the button to prompt or auto-complete all commands or its subcommands. +You can try to call commands with <-h> or <--help> parameter for more information. + +Shell supports following meta-keys: + Ctrl + (a key from: abcdefklnpuw) + Alt + (a key from: bf) +Please refer to shell documentation for more details. + +Available commands: + clear :Clear screen. + device :Device commands + help :Prints the help message. + history :Command history. + hwinfo :HWINFO commands + kernel :Kernel commands + matter :Matter commands + resize :Console gets terminal screen size or assumes default in case + the readout fails. It must be executed after each terminal + width change to ensure correct text display. + retval :Print return value of most recent command + shell :Useful, not Unix-like shell commands. +``` + +## Using General purpose commands + +### `kernel` command group + +#### `reboot` subcommand + +Performs either a warm or cold reset. Difference between warm and cold resets +may vary from a platform to another, but on default Cortex-M architectures, both +methods are the same, so use either one if nothing is specific to your platform. + +```shell +uart:~$ kernel reboot cold|warm +``` + +## Using Matter-specific commands + +The NXP Zephyr examples let you use several Matter-specific CLI commands. + +These commands are not available by default and to enable using them, set the +`CONFIG_CHIP_LIB_SHELL=y` Kconfig option in the `prj.conf` file of the given +example. + +Every invoked command must be preceded by the `matter` prefix. + +See the following subsections for the description of each Matter-specific +command. + +### `device` command group + +Handles a group of commands that are used to manage the device. You must use +this command together with one of the additional subcommands listed below. + +#### `factoryreset` subcommand + +Performs device factory reset that is hardware reset preceded by erasing of the +whole Matter settings stored in a non-volatile memory. + +```shell +uart:~$ matter device factoryreset +Performing factory reset ... +``` + +### `onboardingcodes` command group + +Handles a group of commands that are used to view information about device +onboarding codes. The `onboardingcodes` command takes one required parameter for +the rendezvous type, then an optional parameter for printing a specific type of +onboarding code. + +The full format of the command is as follows: + +``` +onboardingcodes none|softap|ble|onnetwork [qrcode|qrcodeurl|manualpairingcode] +``` + +#### `none` subcommand + +Prints all onboarding codes. For example: + +```shell +uart:~$ matter onboardingcodes none +QRCode: MT:W0GU2OTB00KA0648G00 +QRCodeUrl: https://project-chip.github.io/connectedhomeip/qrcode.html?data=MT%3AW0GU2OTB00KA0648G00 +ManualPairingCode: 34970112332 +``` + +#### `none qrcode` subcommand + +Prints the device onboarding QR code payload. Takes no arguments. + +```shell +uart:~$ matter onboardingcodes none qrcode +MT:W0GU2OTB00KA0648G00 +``` + +#### `none qrcodeurl` subcommand + +Prints the URL to view the device onboarding QR code in a web browser. Takes no +arguments. + +```shell +uart:~$ matter onboardingcodes none qrcodeurl +https://project-chip.github.io/connectedhomeip/qrcode.html?data=MT%3AW0GU2OTB00KA0648G00 +``` + +#### `none manualpairingcode` subcommand + +Prints the pairing code for the manual onboarding of a device. Takes no +arguments. + +```shell +uart:~$ matter onboardingcodes none manualpairingcode +34970112332 +``` + +### `config` command group + +Handles a group of commands that are used to view device configuration +information. You can use this command without any subcommand to print all +available configuration data or to add a specific subcommand. + +```shell +uart:~$ matter config +VendorId: 65521 (0xFFF1) +ProductId: 32768 (0x8000) +HardwareVersion: 1 (0x1) +FabricId: +PinCode: 020202021 +Discriminator: f00 +DeviceId: +``` + +The `config` command can also take the subcommands listed below. + +#### `pincode` subcommand + +Prints the PIN code for device setup. Takes no arguments. + +```shell +uart:~$ matter config pincode +020202021 +``` + +#### `discriminator` subcommand + +Prints the device setup discriminator. Takes no arguments. + +```shell +uart:~$ matter config discriminator +f00 +``` + +#### `vendorid` subcommand + +Prints the vendor ID of the device. Takes no arguments. + +```shell +uart:~$ matter config vendorid +65521 (0xFFFF1) +``` + +#### `productid` subcommand + +Prints the product ID of the device. Takes no arguments. + +```shell +uart:~$ matter config productid +32768 (0x8000) +``` + +#### `hardwarever` subcommand + +Prints the hardware version of the device. Takes no arguments. + +```shell +uart:~$ matter config hardwarever +1 (0x1) +``` + +#### `deviceid` subcommand + +Prints the device identifier. Takes no arguments. + +#### `fabricid` subcommand + +Prints the fabric identifier. Takes no arguments. + +### `ble` command group + +Handles a group of commands that are used to control the device Bluetooth LE +transport state. You must use this command together with one of the additional +subcommands listed below. + +#### `help` subcommand + +Prints help information about the `ble` command group. + +```shell +uart:~$ matter ble help + help Usage: ble + adv Enable or disable advertisement. Usage: ble adv +``` + +#### `adv start` subcommand + +Enables Bluetooth LE advertising. + +```shell +uart:~$ matter ble adv start +Starting BLE advertising +``` + +#### `adv stop` subcommand + +Disables Bluetooth LE advertising. + +```shell +uart:~$ matter ble adv stop +Stopping BLE advertising +``` + +#### `adv status` subcommand + +Prints the information about the current Bluetooth LE advertising status. + +```shell +uart:~$ matter ble adv state +BLE advertising is disabled + +``` + +### `dns` command group + +Handles a group of commands that are used to trigger performing DNS queries. You +must use this command together with one of the additional subcommands listed +below. + +#### `browse` subcommand + +Browses for DNS services of `_matterc_udp` type and prints the received +response. Takes no argument. + +```shell +uart:~$ matter dns browse +Browsing ... +DNS browse succeeded: + Hostname: 0E824F0CA6DE309C + Vendor ID: 9050 + Product ID: 20043 + Long discriminator: 3840 + Device type: 0 + Device name: + Commissioning mode: 0 + IP addresses: + fd08:b65e:db8e:f9c7:2cc2:2043:1366:3b31 +``` + +#### `resolve` subcommand + +Resolves the specified Matter node service given by the _fabric-id_ and +_node-id_. + +```shell +uart:~$ matter dns resolve fabric-id node-id +Resolving ... +DNS resolve for 000000014A77CBB3-0000000000BC5C01 succeeded: + IP address: fd08:b65e:db8e:f9c7:8052:1a8e:4dd4:e1f3 + Port: 5540 +``` + +### `stat` command group + +Handles a group of commands that are used to get and reset the peak usage of +critical system resources used by Matter. These commands are only available when +the `CONFIG_CHIP_STATISTICS=y` Kconfig option is set. + +#### `peak` subcommand + +Prints the peak usage of system resources. + +```shell +uart:~$ matter stat peak +Packet Buffers: 1 +Timers: 2 +TCP endpoints: 0 +UDP endpoints: 1 +Exchange contexts: 0 +Unsolicited message handlers: 5 +Platform events: 2 +``` + +#### `reset` subcommand + +Resets the peak usage of system resources. + +```shell +uart:~$ matter stat reset +``` diff --git a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay b/examples/all-clusters-app/nxp/zephyr/boards/rd_rw612_bga.overlay similarity index 51% rename from examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay rename to examples/all-clusters-app/nxp/zephyr/boards/rd_rw612_bga.overlay index 0728eff3db8377..86bb20739527cd 100644 --- a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay +++ b/examples/all-clusters-app/nxp/zephyr/boards/rd_rw612_bga.overlay @@ -1,14 +1,15 @@ /* - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-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, + * 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. @@ -16,6 +17,23 @@ / { chosen { - nordic,pm-ext-flash = &mx25r64; + zephyr,console = &flexcomm0; + zephyr,shell-uart = &flexcomm3; }; }; + +&flexcomm0 { + compatible = "nxp,lpc-usart"; + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&pinmux_flexcomm0_usart>; + pinctrl-names = "default"; +}; + +&flexcomm3 { + compatible = "nxp,lpc-usart"; + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&pinmux_flexcomm3_usart>; + pinctrl-names = "default"; +}; diff --git a/examples/all-clusters-app/nrfconnect/child_image/hci_rpmsg/prj.conf b/examples/all-clusters-app/nxp/zephyr/boards/rd_rw612_bga_fdata.conf similarity index 57% rename from examples/all-clusters-app/nrfconnect/child_image/hci_rpmsg/prj.conf rename to examples/all-clusters-app/nxp/zephyr/boards/rd_rw612_bga_fdata.conf index 1622ffd00dbb91..73d139c3948d95 100644 --- a/examples/all-clusters-app/nrfconnect/child_image/hci_rpmsg/prj.conf +++ b/examples/all-clusters-app/nxp/zephyr/boards/rd_rw612_bga_fdata.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2022 Project CHIP Authors +# Copyright (c) 2023-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. @@ -14,12 +14,10 @@ # limitations under the License. # -# This target uses Kconfig.hci_rpmsg.defaults to set options common for all -# samples using hci_rpmsg. This file should contain only options specific for this sample -# hci_rpmsg configuration or overrides of default values. +CONFIG_SETTINGS_NVS_SECTOR_COUNT=16 -# Disable not used modules that cannot be set in Kconfig.hci_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n +# 0xA226 +CONFIG_CHIP_DEVICE_PRODUCT_ID=41510 +CONFIG_CHIP_DEVICE_PRODUCT_URL="https://www.nxp.com/products/wireless-connectivity/wi-fi-plus-bluetooth-plus-802-15-4/wireless-mcu-with-integrated-tri-radio-1x1-wi-fi-6-plus-bluetooth-low-energy-5-3-802-15-4:RW612" +CONFIG_CHIP_DEVICE_PRODUCT_LABEL="RW612" +CONFIG_CHIP_DEVICE_PART_NUMBER="RW612" diff --git a/third_party/nxp/rt_sdk/lwip/openthread/lwipopts.h b/examples/all-clusters-app/nxp/zephyr/main/include/CHIPProjectConfig.h similarity index 57% rename from third_party/nxp/rt_sdk/lwip/openthread/lwipopts.h rename to examples/all-clusters-app/nxp/zephyr/main/include/CHIPProjectConfig.h index 268b9fb6b21a11..f6c88ccef18162 100644 --- a/third_party/nxp/rt_sdk/lwip/openthread/lwipopts.h +++ b/examples/all-clusters-app/nxp/zephyr/main/include/CHIPProjectConfig.h @@ -1,7 +1,5 @@ /* - * - * Copyright (c) 2020 Nest Labs, Inc. - * Copyright 2023 NXP + * Copyright (c) 2023-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,19 +17,15 @@ /** * @file - * Compile-time configuration for LwIP + * Example project configuration file for CHIP. + * + * This is a place to put application or project-specific overrides + * to the default configuration values for general CHIP features. + * */ -#ifndef __LWIPOPTS_H__ -#define __LWIPOPTS_H__ - -#define CONFIG_NETWORK_HIGH_PERF 0 - -#define LWIP_DNS 0 -#define LWIP_IPV4 0 -#define PBUF_POOL_SIZE 20 -#define NETIF_MAX_HWADDR_LEN 8U - -#include "lwipopts_common.h" +#pragma once -#endif /* __LWIPOPTS_H__ */ +// All clusters app has 3 group endpoints. This needs to defined here so that +// CHIP_CONFIG_MAX_GROUPS_PER_FABRIC is properly configured. +#define CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC 3 diff --git a/third_party/nxp/rt_sdk/lwip/wifi/lwipopts.h b/examples/all-clusters-app/nxp/zephyr/main/main.cpp similarity index 57% rename from third_party/nxp/rt_sdk/lwip/wifi/lwipopts.h rename to examples/all-clusters-app/nxp/zephyr/main/main.cpp index ba7d6ca0f199ae..9be47dfe0a95d8 100644 --- a/third_party/nxp/rt_sdk/lwip/wifi/lwipopts.h +++ b/examples/all-clusters-app/nxp/zephyr/main/main.cpp @@ -1,6 +1,5 @@ /* - * - * Copyright (c) 2020 Nest Labs, Inc. + * Copyright (c) 2023-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,16 +15,23 @@ * limitations under the License. */ -/** - * @file - * Compile-time configuration for LwIP - */ +#include "AppTask.h" + +#include + +LOG_MODULE_REGISTER(app, CONFIG_CHIP_APP_LOG_LEVEL); -#ifndef __LWIPOPTS_H__ -#define __LWIPOPTS_H__ +using namespace ::chip; -#define LWIP_IPV4 1 +int main() +{ + CHIP_ERROR err = CHIP_NO_ERROR; -#include "lwipopts_common.h" + if (err == CHIP_NO_ERROR) + { + err = chip::NXP::App::GetAppTask().Start(); + } -#endif /* __LWIPOPTS_H__ */ + LOG_ERR("Exited with code %" CHIP_ERROR_FORMAT, err.Format()); + return err == CHIP_NO_ERROR ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/examples/all-clusters-app/nxp/zephyr/prj.conf b/examples/all-clusters-app/nxp/zephyr/prj.conf new file mode 100644 index 00000000000000..936bc5984f4f35 --- /dev/null +++ b/examples/all-clusters-app/nxp/zephyr/prj.conf @@ -0,0 +1,59 @@ +# +# Copyright (c) 2023-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. +# + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Enable CHIP +CONFIG_CHIP=y +CONFIG_STD_CPP17=y +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y +# CHIP PID: 32769 == 0x8001 (all-clusters-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 +CONFIG_CHIP_DEVICE_PRODUCT_NAME="All Clusters" +CONFIG_CHIP_DEVICE_DISCRIMINATOR=0x800 + +# Enable MbedTLS PSA - heavily experimental, not thread safe yet +# CONFIG_CHIP_CRYPTO_PSA=y + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="NXPAllClusters" + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y + +CONFIG_DEBUG=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_THREAD_INFO=y +# use this config if stepping during debug session is not consistent +# CONFIG_NO_OPTIMIZATIONS=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_ASSERT=y +# by default west will generate the full assembly output, which can take several minutes when binaries are large +CONFIG_OUTPUT_DISASSEMBLY=n +# embedded thread analyzer with thread statistics (stack usage, cpu usage...) +# CONFIG_THREAD_ANALYZER=y +# CONFIG_THREAD_ANALYZER_USE_PRINTK=y +# CONFIG_THREAD_ANALYZER_AUTO=y + +# enable Matter CLI +CONFIG_CHIP_LIB_SHELL=y +# enable NET commands if desired +#CONFIG_NET_SHELL=y +CONFIG_CHIP_STATISTICS=y diff --git a/examples/all-clusters-app/nxp/zephyr/prj_fdata.conf b/examples/all-clusters-app/nxp/zephyr/prj_fdata.conf new file mode 100644 index 00000000000000..a82618a5f46078 --- /dev/null +++ b/examples/all-clusters-app/nxp/zephyr/prj_fdata.conf @@ -0,0 +1,80 @@ +# +# Copyright (c) 2023-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. +# + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Enable CHIP +CONFIG_CHIP=y +CONFIG_STD_CPP17=y +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable MbedTLS PSA - heavily experimental, not thread safe yet +# CONFIG_CHIP_CRYPTO_PSA=y + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="NXPAllClusters" + +# enable Matter CLI +CONFIG_CHIP_LIB_SHELL=y +CONFIG_CHIP_STATISTICS=y + +# Factory data configuration +CONFIG_CHIP_DEVICE_VENDOR_ID=4151 +CONFIG_CHIP_DEVICE_DISCRIMINATOR=0xA00 +CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE=14014 +CONFIG_CHIP_DEVICE_PRODUCT_NAME="All Clusters" +CONFIG_CHIP_DEVICE_TYPE=115 +CONFIG_CHIP_DEVICE_MANUFACTURING_DATE="2023-01-01" +CONFIG_CHIP_DEVICE_SERIAL_NUMBER="12345678" +CONFIG_CHIP_DEVICE_PRODUCT_COLOR="Green" +CONFIG_CHIP_DEVICE_PRODUCT_FINISH="Matte" + +# Use factory data provider for device info +CONFIG_CHIP_FACTORY_DATA=y +# Generate factor data raw binary during the build process +# CONFIG_CHIP_FACTORY_DATA_BUILD=y +# Generate test certificates for factory data during the build process +# CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_GENERATED=y +# Spake2p verifier will be generated during factory data generation +# CONFIG_CHIP_FACTORY_DATA_GENERATE_SPAKE2_VERIFIER=y + +# Example of using pre-generated certificates +# CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_USER=y +# CONFIG_CHIP_FACTORY_DATA_USER_CERTS_CD_CERT="/Chip-Test-CD-1037-A226.der" +# CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_CERT="/Chip-DAC-NXP-1037-A226-Cert.der" +# CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_KEY="/Chip-DAC-NXP-1037-A226-Key.der" +# CONFIG_CHIP_FACTORY_DATA_USER_CERTS_PAI_CERT="/Chip-PAI-NXP-1037-A226-Cert.der" + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y + +CONFIG_DEBUG=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_THREAD_INFO=y +# use this config if stepping during debug session is not consistent +# CONFIG_NO_OPTIMIZATIONS=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_ASSERT=y +# by default west will generate the full assembly output, which can take several minutes when binaries are large +CONFIG_OUTPUT_DISASSEMBLY=n +# embedded thread analyzer with thread statistics (stack usage, cpu usage...) +# CONFIG_THREAD_ANALYZER=y +# CONFIG_THREAD_ANALYZER_USE_PRINTK=y +# CONFIG_THREAD_ANALYZER_AUTO=y diff --git a/examples/all-clusters-app/nxp/zephyr/prj_ota.conf b/examples/all-clusters-app/nxp/zephyr/prj_ota.conf new file mode 100644 index 00000000000000..bdc65e94fabf70 --- /dev/null +++ b/examples/all-clusters-app/nxp/zephyr/prj_ota.conf @@ -0,0 +1,31 @@ +# +# 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. +# + +# Options needed for OTA are located on this file +# This file should contain only options specific for this sample +# or overrides the default ones. + +CONFIG_CHIP_OTA_REQUESTOR=y + +# To generate an OTA image based on the application +CONFIG_CHIP_OTA_IMAGE_BUILD=y + +# By default, MCUBOOT bootloader uses a signature key provided in their repository. +# Change the key to the appropriate one. +# Note: You need to use the same signature key used by MCUBOOT, i.e BOOT_SIGNATURE_KEY_FILE. +# Default CONFIG_BOOT_SIGNATURE_KEY_FILE is defined in config/nxp/app/bootloader.conf +CONFIG_MCUBOOT_SIGNATURE_KEY_FILE="./bootloader/mcuboot/root-rsa-2048.pem" diff --git a/examples/all-clusters-app/nxp/zephyr/third_party/connectedhomeip b/examples/all-clusters-app/nxp/zephyr/third_party/connectedhomeip new file mode 120000 index 00000000000000..3efed95be5dbe9 --- /dev/null +++ b/examples/all-clusters-app/nxp/zephyr/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../../../ \ No newline at end of file diff --git a/examples/all-clusters-app/openiotsdk/CMakeLists.txt b/examples/all-clusters-app/openiotsdk/CMakeLists.txt index 6d2fb76c0db919..9db62a3df783a1 100644 --- a/examples/all-clusters-app/openiotsdk/CMakeLists.txt +++ b/examples/all-clusters-app/openiotsdk/CMakeLists.txt @@ -48,7 +48,7 @@ target_include_directories(${APP_TARGET} PRIVATE main/include ${ALL_CLUSTERS_COMMON}/include - ${ENERGY_MANAGEMENT_COMMON}/include + ${ENERGY_MANAGEMENT_COMMON}/include ) target_sources(${APP_TARGET} @@ -60,16 +60,20 @@ target_sources(${APP_TARGET} ${ALL_CLUSTERS_COMMON}/src/concentration-measurement-instances.cpp ${ALL_CLUSTERS_COMMON}/src/fan-stub.cpp ${ALL_CLUSTERS_COMMON}/src/oven-modes.cpp - ${ALL_CLUSTERS_COMMON}/src/device-energy-management-stub.cpp + ${ALL_CLUSTERS_COMMON}/src/device-energy-management-stub.cpp ${ALL_CLUSTERS_COMMON}/src/energy-evse-stub.cpp ${ALL_CLUSTERS_COMMON}/src/resource-monitoring-delegates.cpp ${ALL_CLUSTERS_COMMON}/src/static-supported-modes-manager.cpp ${ALL_CLUSTERS_COMMON}/src/binding-handler.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/ChargingTargetsMemMgr.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementManager.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/EVSEManufacturerImpl.cpp ${ENERGY_MANAGEMENT_COMMON}/src/ElectricalPowerMeasurementDelegate.cpp ${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseDelegateImpl.cpp ${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseManager.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementDelegateImpl.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementManager.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseTargetsStore.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/EnergyTimeUtils.cpp ) target_link_libraries(${APP_TARGET} diff --git a/examples/all-clusters-app/telink/CMakeLists.txt b/examples/all-clusters-app/telink/CMakeLists.txt index d5f2132c9d2747..675ea4d9eb7e74 100644 --- a/examples/all-clusters-app/telink/CMakeLists.txt +++ b/examples/all-clusters-app/telink/CMakeLists.txt @@ -31,7 +31,7 @@ project(chip-telink-all-clusters-app-example) target_include_directories(app PRIVATE include ${ALL_CLUSTERS_COMMON_DIR}/include - ${ENERGY_MANAGEMENT_COMMON_DIR}/include + ${ENERGY_MANAGEMENT_COMMON_DIR}/include ${GEN_DIR}/app-common ${GEN_DIR}/all-clusters-app ${TELINK_COMMON}/common/include @@ -48,14 +48,18 @@ target_sources(app PRIVATE ${ALL_CLUSTERS_COMMON_DIR}/src/air-quality-instance.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/concentration-measurement-instances.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/fan-stub.cpp - ${ALL_CLUSTERS_COMMON_DIR}/src/device-energy-management-stub.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/device-energy-management-stub.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/energy-evse-stub.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/resource-monitoring-delegates.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/ChargingTargetsMemMgr.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementManager.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EVSEManufacturerImpl.cpp ${ENERGY_MANAGEMENT_COMMON_DIR}/src/ElectricalPowerMeasurementDelegate.cpp ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseDelegateImpl.cpp ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseManager.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementDelegateImpl.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementManager.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseTargetsStore.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyTimeUtils.cpp ${TELINK_COMMON}/common/src/mainCommon.cpp ${TELINK_COMMON}/common/src/AppTaskCommon.cpp ${TELINK_COMMON}/util/src/LEDManager.cpp diff --git a/examples/all-clusters-app/telink/README.md b/examples/all-clusters-app/telink/README.md index 89d8221af75d3f..8404672d3134e6 100644 --- a/examples/all-clusters-app/telink/README.md +++ b/examples/all-clusters-app/telink/README.md @@ -6,6 +6,17 @@ creating your own application. ![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) +## Supported devices + +The example supports building and running on the following devices: + +| Board/SoC | Build target | Zephyr Board Info | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| [B91](https://wiki.telink-semi.cn/wiki/Hardware/B91_Generic_Starter_Kit_Hardware_Guide) [TLSR9518ADK80D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series) | `tlsr9518adk80d`, `tlsr9518adk80d-mars`, `tlsr9518adk80d-usb` | [TLSR9518ADK80D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9518adk80d/doc/index.rst) | +| [B92](https://wiki.telink-semi.cn/wiki/Hardware/B92_Generic_Starter_Kit_Hardware_Guide) [TLSR9528A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR952x-Series) | `tlsr9528a`, `tlsr9528a_retention` | [TLSR9528A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9528a/doc/index.rst) | +| [B95](https://wiki.telink-semi.cn/wiki/Hardware/B95_Generic_Starter_Kit_Hardware_Guide) [TLSR9258A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR925x-Series) | `tlsr9258a` | [TLSR9258A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9258a/doc/index.rst) | +| [W91](https://wiki.telink-semi.cn/wiki/Hardware/W91_Generic_Starter_Kit_Hardware_Guide) [TLSR9118BDK40D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR911x-Series) | `tlsr9118bdk40d` | [TLSR9118BDK40D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9118bdk40d/doc/index.rst) | + ## Build and flash 1. Run the Docker container: @@ -14,7 +25,7 @@ creating your own application. $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}') ``` - Compatible docker image version can be found in next file: + You can find the compatible Docker image version in the file: ```bash $ .github/workflows/examples-telink.yaml @@ -26,8 +37,8 @@ creating your own application. $ source ./scripts/activate.sh -p all,telink ``` -3. In the example dir run (replace __ with your board name, for - example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`): +3. Build the example (replace __ with your board name, see + [Supported devices](#supported-devices)): ```bash $ west build -b @@ -37,9 +48,12 @@ creating your own application. MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=4m`: ```bash - $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + $ west build -b -- -DFLASH_SIZE=4m ``` + You can find the target built file called **_zephyr.bin_** under the + **_build/zephyr_** directory. + 4. Flash binary: ``` @@ -58,16 +72,18 @@ To get output from device, connect UART to following pins: | TX | PB2 (pin 16 of J34 connector) | | GND | GND | +Baud rate: 115200 bits/s + ### Buttons The following buttons are available on **tlsr9518adk80d** board: -| Name | Function | Description | -| :------- | :--------------------- | :----------------------------------------------------------------------------------------------------- | -| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and back to uncommissioned state | -| Button 2 | Not used | Not used | -| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | -| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | +| Name | Function | Description | +| :------- | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and return to a decommissioned state (to activate, push the button 3 times) | +| Button 2 | Not used | Not used | +| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | +| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | ### LEDs diff --git a/examples/all-clusters-app/tizen/BUILD.gn b/examples/all-clusters-app/tizen/BUILD.gn index 364e9ce857d5da..855416c0446923 100644 --- a/examples/all-clusters-app/tizen/BUILD.gn +++ b/examples/all-clusters-app/tizen/BUILD.gn @@ -38,11 +38,15 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp", ] deps = [ diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 707e74cf1fa87c..8dfd81caf3a866 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -384,7 +401,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -400,12 +417,42 @@ cluster AccessControl = 31 { 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; @@ -441,17 +488,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides a standardized way for a Node (typically a Bridge, but could be any Node) to expose action information. */ @@ -713,7 +784,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -2425,14 +2496,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + 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; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -2544,7 +2622,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** 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; @@ -3544,7 +3622,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -3611,7 +3690,6 @@ cluster Thermostat = 513 { kMatterScheduleConfiguration = 0x80; kPresets = 0x100; kSetpoints = 0x200; - kQueuedPresetsSupported = 0x400; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -3671,11 +3749,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -3709,11 +3782,6 @@ cluster Thermostat = 513 { PresetTypeFeaturesBitmap presetTypeFeatures = 2; } - struct QueuedPresetStruct { - nullable octet_string<16> presetHandle = 0; - nullable epoch_s transitionTimestamp = 1; - } - struct ScheduleTypeStruct { SystemModeEnum systemMode = 0; int8u numberOfSchedules = 1; @@ -3786,9 +3854,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; - readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -3826,17 +3892,12 @@ cluster Thermostat = 513 { request struct SetActivePresetRequestRequest { octet_string<16> presetHandle = 0; - optional int16u delayMinutes = 1; } request struct StartPresetsSchedulesEditRequestRequest { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -3855,10 +3916,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command is sent to cancel a queued preset. */ - command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for controlling a fan in a heating/cooling system. */ @@ -3979,7 +4036,7 @@ cluster ThermostatUserInterfaceConfiguration = 516 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -5983,6 +6040,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; @@ -6332,7 +6390,7 @@ endpoint 1 { ram attribute onLevel default = 0xFF; persist attribute startUpCurrentLevel default = 255; ram attribute featureMap default = 0; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; @@ -6542,7 +6600,7 @@ endpoint 1 { ram attribute enhancedColorMode default = 0x01; ram attribute colorCapabilities default = 0x1F; ram attribute featureMap default = 0; - ram attribute clusterRevision default = 6; + ram attribute clusterRevision default = 7; } server cluster BallastConfiguration { diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap index 0f9b7495212b56..8afff9a3507a3c 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap @@ -900,6 +900,22 @@ "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": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, @@ -5031,7 +5047,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -7287,7 +7303,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -9049,6 +9065,14 @@ "isIncoming": 1, "isEnabled": 1 }, + { + "name": "StringEchoResponse", + "code": 13, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, { "name": "TestEnumsRequest", "code": 14, @@ -9122,32 +9146,24 @@ "isEnabled": 1 }, { - "name": "TestDifferentVendorMeiRequest", - "code": 4294049962, + "name": "StringEchoRequest", + "code": 24, "mfgCode": null, "source": "client", "isIncoming": 1, "isEnabled": 1 }, { - "name": "TestDifferentVendorMeiResponse", - "code": 4294049979, - "mfgCode": null, - "source": "server", - "isIncoming": 0, - "isEnabled": 1 - }, - { - "name": "StringEchoRequest", - "code": 24, + "name": "TestDifferentVendorMeiRequest", + "code": 4294049962, "mfgCode": null, "source": "client", "isIncoming": 1, "isEnabled": 1 }, { - "name": "StringEchoResponse", - "code": 13, + "name": "TestDifferentVendorMeiResponse", + "code": 4294049979, "mfgCode": null, "source": "server", "isIncoming": 0, diff --git a/examples/all-clusters-minimal-app/ameba/chip_main.cmake b/examples/all-clusters-minimal-app/ameba/chip_main.cmake index acd5032e661fbf..e8fa8393ddeb1c 100755 --- a/examples/all-clusters-minimal-app/ameba/chip_main.cmake +++ b/examples/all-clusters-minimal-app/ameba/chip_main.cmake @@ -187,7 +187,6 @@ target_include_directories( ${chip_dir}/src/app/server/ ${chip_dir}/src/controller/data_model ${chip_dir}/third_party/nlio/repo/include/ - ${chip_dir}/third_party/nlunit-test/repo/src ) if (matter_enable_rpc) diff --git a/examples/all-clusters-minimal-app/esp32/sdkconfig.defaults.esp32c2 b/examples/all-clusters-minimal-app/esp32/sdkconfig.defaults.esp32c2 index 6cb90db4f55b9d..200dc5825bc2e2 100644 --- a/examples/all-clusters-minimal-app/esp32/sdkconfig.defaults.esp32c2 +++ b/examples/all-clusters-minimal-app/esp32/sdkconfig.defaults.esp32c2 @@ -17,3 +17,6 @@ CONFIG_BT_NIMBLE_ROLE_OBSERVER=n CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 + +# Event Queue Size +CONFIG_MAX_EVENT_QUEUE_SIZE=25 diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/BUILD.gn b/examples/all-clusters-minimal-app/infineon/psoc6/BUILD.gn index c70c282db2ac17..c1bbd2b34aa130 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/BUILD.gn +++ b/examples/all-clusters-minimal-app/infineon/psoc6/BUILD.gn @@ -46,32 +46,38 @@ config("psoc6_ota_config") { ldflags = [ "-T" + rebase_path(linker_script, root_build_dir) ] - ldflags += [ "-Wl,--defsym,MCUBOOT_HEADER_SIZE=0x400,--defsym,MCUBOOT_BOOTLOADER_SIZE=0x18000,--defsym,CY_BOOT_PRIMARY_1_SIZE=0x1C0000" ] + ldflags += [ "-Wl,--undefined=uxTopUsedPriority -Wl,--defsym,MCUBOOT_HEADER_SIZE=0x400,--defsym,FLASH_AREA_IMG_1_PRIMARY_START=0x028000,--defsym,FLASH_AREA_IMG_1_PRIMARY_SIZE=0x1c0000" ] defines = [ "P6_OTA", - "OTA_SUPPORT ", - "OTA_USE_EXTERNAL_FLASH", - "CY_BOOT_USE_EXTERNAL_FLASH", - "MCUBOOT_HEADER_SIZE=0x400", - "MCUBOOT_MAX_IMG_SECTORS=3584", - "CY_BOOT_SCRATCH_SIZE=0x00004000", - "MCUBOOT_BOOTLOADER_SIZE=0x00018000", - "CY_BOOT_BOOTLOADER_SIZE=0x00018000", - "CY_BOOT_PRIMARY_1_START=0x00018000", - "CY_BOOT_PRIMARY_1_SIZE=0x1C0000", - "CY_BOOT_SECONDARY_1_START=0x00000000", - "CY_BOOT_SECONDARY_1_SIZE=0x001C0000", - "CY_FLASH_ERASE_VALUE=0xFF", + "COMPONENT_MCUBOOT", + "CY_BOOTLOADER=MCUBOOT", + "OTA_SUPPORT=1", + "COMPONENT_OTA_PSOC_062", + "PSOC_062_2M", + "OTA_USE_EXTERNAL_FLASH=1", + "ENABLE_OTA_LOGS", + "ENABLE_OTA_BOOTLOADER_ABSTRACTION_LOGS", "MCUBOOT_IMAGE_NUMBER=1", - "MCUBOOT_SLOT_SIZE=0x1C0000", - "MCUBOOT_SCRATCH_SIZE=0x4000", - "MCUBOOT_SECTOR_SIZE = 512", + "MCUBOOT_MAX_IMG_SECTORS=3584", + "FLASH_AREA_BOOTLOADER_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'", + "FLASH_AREA_BOOTLOADER_SIZE=0x028000", + "FLASH_AREA_BOOTLOADER_START=0x000000", + "FLASH_AREA_IMAGE_SCRATCH_DEV_ID='FLASH_DEVICE_EXTERNAL_FLASH(CY_BOOT_EXTERNAL_DEVICE_INDEX)'", + "FLASH_AREA_IMAGE_SCRATCH_SIZE=0x080000", + "FLASH_AREA_IMAGE_SCRATCH_START=0x440000", + "FLASH_AREA_IMAGE_SWAP_STATUS_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'", + "FLASH_AREA_IMAGE_SWAP_STATUS_SIZE=0x006c00", + "FLASH_AREA_IMAGE_SWAP_STATUS_START=0x1e8000", + "FLASH_AREA_IMG_1_PRIMARY_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'", + "FLASH_AREA_IMG_1_PRIMARY_SIZE=0x1c0000", + "FLASH_AREA_IMG_1_PRIMARY_START=0x028000", + "FLASH_AREA_IMG_1_SECONDARY_DEV_ID='FLASH_DEVICE_EXTERNAL_FLASH(CY_BOOT_EXTERNAL_DEVICE_INDEX)'", + "FLASH_AREA_IMG_1_SECONDARY_SIZE=0x1c0000", + "FLASH_AREA_IMG_1_SECONDARY_START=0x000200", "APP_VERSION_MAJOR=1", "APP_VERSION_MINOR=0", "APP_VERSION_BUILD=0", - "MCUBOOT_OVERWRITE_ONLY", - "CY_ENABLE_XIP_PROGRAM", ] if (build_update_image) { @@ -88,7 +94,7 @@ psoc6_sdk_sources("all_clusters_app_sdk_sources") { defines = [ "BOARD_ID=${psoc6_board}", - "P6_LOG_ENABLED=1", + "PSOC6_LOG_ENABLED=1", "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setup_pin_code}", ] diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/include/AppConfig.h b/examples/all-clusters-minimal-app/infineon/psoc6/include/AppConfig.h index 35e45a8aef4223..cad1a523bfa188 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/include/AppConfig.h +++ b/examples/all-clusters-minimal-app/infineon/psoc6/include/AppConfig.h @@ -48,14 +48,14 @@ #define THREAD_ACTIVE_POLLING_INTERVAL_MS 100 #define THREAD_INACTIVE_POLLING_INTERVAL_MS 1000 -// P6 Logging +// PSOC6 Logging #ifdef __cplusplus extern "C" { #endif void appError(int err); -void P6Log(const char * aFormat, ...); -#define P6_LOG(...) P6Log(__VA_ARGS__) +void PSOC6Log(const char * aFormat, ...); +#define PSOC6_LOG(...) PSOC6Log(__VA_ARGS__) #ifdef __cplusplus } diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/include/AppTask.h b/examples/all-clusters-minimal-app/infineon/psoc6/include/AppTask.h index b5102a153e25e1..82a9537df4b6cc 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/include/AppTask.h +++ b/examples/all-clusters-minimal-app/infineon/psoc6/include/AppTask.h @@ -29,6 +29,10 @@ #include #include +extern "C" { +#include "flash_map_backend.h" +} + // Application-defined error codes in the CHIP_ERROR space. #define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) #define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02) diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/include/CHIPProjectConfig.h b/examples/all-clusters-minimal-app/infineon/psoc6/include/CHIPProjectConfig.h index a371e16de2d7c0..e072cc6f2c4c0f 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/include/CHIPProjectConfig.h +++ b/examples/all-clusters-minimal-app/infineon/psoc6/include/CHIPProjectConfig.h @@ -42,10 +42,10 @@ #define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8004 /* The ProductName attribute of the Basic cluster. */ -#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME "P6-CYW43012 Clusters Minimal" +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME "PSOC6-CYW43012 Clusters Minimal" /* The HardwareVersionString attribute of the Basic cluster. */ -#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING "P6-43012" +#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING "PSOC6-43012" /* The HardwareVersion attribute of the Basic cluster. */ #define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION 43012 diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp b/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp index ccc271dd7a2d06..169b2f88acb7ab 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp @@ -145,7 +145,7 @@ CHIP_ERROR AppTask::StartAppTask() sAppEventQueue = xQueueCreateStatic(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent), sAppEventQueueBuffer, &sAppEventQueueStruct); if (sAppEventQueue == NULL) { - P6_LOG("Failed to allocate app event queue"); + PSOC6_LOG("Failed to allocate app event queue"); appError(APP_ERROR_EVENT_QUEUE_FAILED); } // Start App task. @@ -157,10 +157,10 @@ CHIP_ERROR AppTask::Init() { CHIP_ERROR err = CHIP_NO_ERROR; #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - int rc = boot_set_confirmed(); + int rc = flash_area_boot_set_confirmed(); if (rc != 0) { - P6_LOG("boot_set_confirmed failed"); + PSOC6_LOG("flash_area_boot_set_confirmed failed"); appError(CHIP_ERROR_UNINITIALIZED); } #endif @@ -193,11 +193,11 @@ CHIP_ERROR AppTask::Init() ); if (sFunctionTimer == NULL) { - P6_LOG("funct timer create failed"); + PSOC6_LOG("funct timer create failed"); appError(APP_ERROR_CREATE_TIMER_FAILED); } NetWorkCommissioningInstInit(); - P6_LOG("Current Software Version: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); + PSOC6_LOG("Current Software Version: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); // Initialize LEDs sStatusLED.Init(SYSTEM_STATE_LED); @@ -218,11 +218,11 @@ void AppTask::AppTaskMain(void * pvParameter) CHIP_ERROR err = sAppTask.Init(); if (err != CHIP_NO_ERROR) { - P6_LOG("AppTask.Init() failed"); + PSOC6_LOG("AppTask.Init() failed"); appError(err); } - P6_LOG("App Task started"); + PSOC6_LOG("App Task started"); while (true) { @@ -298,7 +298,8 @@ void AppTask::FunctionHandler(AppEvent * event) { if (!sAppTask.mFunctionTimerActive && sAppTask.mFunction == Function::kNoneSelected) { - P6_LOG("Factory Reset Triggered. Press button again within %us to cancel.", FACTORY_RESET_CANCEL_WINDOW_TIMEOUT / 1000); + PSOC6_LOG("Factory Reset Triggered. Press button again within %us to cancel.", + FACTORY_RESET_CANCEL_WINDOW_TIMEOUT / 1000); // Start timer for FACTORY_RESET_CANCEL_WINDOW_TIMEOUT to allow user to // cancel, if required. sAppTask.StartTimer(FACTORY_RESET_CANCEL_WINDOW_TIMEOUT); @@ -322,7 +323,7 @@ void AppTask::FunctionHandler(AppEvent * event) // canceled. sAppTask.mFunction = Function::kNoneSelected; - P6_LOG("Factory Reset has been Canceled"); + PSOC6_LOG("Factory Reset has been Canceled"); } } } @@ -331,7 +332,7 @@ void AppTask::CancelTimer() { if (xTimerStop(sFunctionTimer, 0) == pdFAIL) { - P6_LOG("app timer stop() failed"); + PSOC6_LOG("app timer stop() failed"); appError(APP_ERROR_STOP_TIMER_FAILED); } @@ -342,7 +343,7 @@ void AppTask::StartTimer(uint32_t aTimeoutInMs) { if (xTimerIsTimerActive(sFunctionTimer)) { - P6_LOG("app timer already started!"); + PSOC6_LOG("app timer already started!"); CancelTimer(); } @@ -351,7 +352,7 @@ void AppTask::StartTimer(uint32_t aTimeoutInMs) // cannot immediately be sent to the timer command queue. if (xTimerChangePeriod(sFunctionTimer, aTimeoutInMs / portTICK_PERIOD_MS, 100) != pdPASS) { - P6_LOG("app timer start() failed"); + PSOC6_LOG("app timer start() failed"); appError(APP_ERROR_START_TIMER_FAILED); } @@ -382,11 +383,11 @@ void AppTask::PostEvent(const AppEvent * aEvent) } if (!status) - P6_LOG("Failed to post event to app task event queue"); + PSOC6_LOG("Failed to post event to app task event queue"); } else { - P6_LOG("Event Queue is NULL should never happen"); + PSOC6_LOG("Event Queue is NULL should never happen"); } } @@ -398,7 +399,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) } else { - P6_LOG("Event received with no handler. Dropping event."); + PSOC6_LOG("Event received with no handler. Dropping event."); } } @@ -411,7 +412,7 @@ void AppTask::OnOffUpdateClusterState(intptr_t context) if (status != Protocols::InteractionModel::Status::Success) { - P6_LOG("ERR: updating on/off %x", to_underlying(status)); + PSOC6_LOG("ERR: updating on/off %x", to_underlying(status)); } } @@ -432,7 +433,7 @@ void AppTask::InitOTARequestor() gRequestorUser.Init(&gRequestorCore, &gImageProcessor); - P6_LOG("Current Software Version: %u", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); - P6_LOG("Current Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); + PSOC6_LOG("Current Software Version: %u", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); + PSOC6_LOG("Current Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); } #endif diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/src/ButtonHandler.cpp b/examples/all-clusters-minimal-app/infineon/psoc6/src/ButtonHandler.cpp index 7d65fc4134625e..3fbd1c13796fd1 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/src/ButtonHandler.cpp +++ b/examples/all-clusters-minimal-app/infineon/psoc6/src/ButtonHandler.cpp @@ -102,7 +102,7 @@ void ButtonHandler::TimerCallback(TimerHandle_t xTimer) buttonevent = cyhal_gpio_read(APP_FUNCTION_BUTTON); break; default: - P6_LOG("Unhandled TimerID: %d", timerId); + PSOC6_LOG("Unhandled TimerID: %d", timerId); break; } diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/src/ClusterManager.cpp b/examples/all-clusters-minimal-app/infineon/psoc6/src/ClusterManager.cpp index 38d009a53f8fc7..32428177bbd247 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/src/ClusterManager.cpp +++ b/examples/all-clusters-minimal-app/infineon/psoc6/src/ClusterManager.cpp @@ -50,9 +50,9 @@ ClusterManager ClusterManager::sCluster; void ClusterManager::OnOnOffPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value) { VerifyOrExit(attributeId == OnOff::Attributes::OnOff::Id, - P6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId))); + PSOC6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId))); VerifyOrExit(endpointId == ENDPOINT_FIRST_IDX || endpointId == ENDPOINT_SECOND_IDX, - P6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); + PSOC6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); // At this point we can assume that value points to a bool value. mEndpointOnOffState[endpointId - 1] = *value; @@ -70,9 +70,9 @@ void ClusterManager::OnLevelControlAttributeChangeCallback(EndpointId endpointId uint8_t brightness = onOffState ? *value : 0; VerifyOrExit(attributeId == LevelControl::Attributes::CurrentLevel::Id, - P6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId))); + PSOC6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId))); VerifyOrExit(endpointId == ENDPOINT_FIRST_IDX || endpointId == ENDPOINT_SECOND_IDX, - P6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); + PSOC6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); endpointId == ENDPOINT_FIRST_IDX ? sClusterLED.SetBrightness(brightness) : sLightLED.SetBrightness(brightness); @@ -85,9 +85,9 @@ void ClusterManager::OnColorControlAttributeChangeCallback(EndpointId endpointId using namespace ColorControl::Attributes; VerifyOrExit(attributeId == CurrentHue::Id || attributeId == CurrentSaturation::Id, - P6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId))); + PSOC6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId))); VerifyOrExit(endpointId == ENDPOINT_FIRST_IDX || endpointId == ENDPOINT_SECOND_IDX, - P6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); + PSOC6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); if (endpointId == 1) { uint8_t hue, saturation; @@ -137,8 +137,8 @@ void IdentifyTimerHandler(Layer * systemLayer, void * appState) void ClusterManager::OnIdentifyPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value) { VerifyOrExit(attributeId == Identify::Attributes::IdentifyTime::Id, - P6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId))); - VerifyOrExit(endpointId == ENDPOINT_FIRST_IDX, P6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); + PSOC6_LOG("Unhandled Attribute ID: '" ChipLogFormatMEI "'", ChipLogValueMEI(attributeId))); + VerifyOrExit(endpointId == ENDPOINT_FIRST_IDX, PSOC6_LOG("Unexpected EndPoint ID: `0x%02x'", endpointId)); /* IdentifyTime Attribute Spec mentions "flashing a light with a period of 0.5 seconds" */ sStatusLED.Blink(kIdentifyTimerDelayMS * 2); diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/src/ZclCallbacks.cpp b/examples/all-clusters-minimal-app/infineon/psoc6/src/ZclCallbacks.cpp index 9a439771026736..2e805ac61367ee 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/src/ZclCallbacks.cpp +++ b/examples/all-clusters-minimal-app/infineon/psoc6/src/ZclCallbacks.cpp @@ -39,9 +39,9 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & EndpointId endpoint = attributePath.mEndpointId; ClusterId clusterId = attributePath.mClusterId; AttributeId attributeId = attributePath.mAttributeId; - P6_LOG("MatterPostAttributeChangeCallback - Cluster ID: " ChipLogFormatMEI - ", EndPoint ID: '0x%02x', Attribute ID: " ChipLogFormatMEI, - ChipLogValueMEI(clusterId), endpoint, ChipLogValueMEI(attributeId)); + PSOC6_LOG("MatterPostAttributeChangeCallback - Cluster ID: " ChipLogFormatMEI + ", EndPoint ID: '0x%02x', Attribute ID: " ChipLogFormatMEI, + ChipLogValueMEI(clusterId), endpoint, ChipLogValueMEI(attributeId)); switch (clusterId) { @@ -61,7 +61,7 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & ClusterMgr().OnColorControlAttributeChangeCallback(endpoint, attributeId, value); break; default: - P6_LOG("Unhandled cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); + PSOC6_LOG("Unhandled cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); break; } } diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/src/main.cpp b/examples/all-clusters-minimal-app/infineon/psoc6/src/main.cpp index 5ac891ae1816f2..72a10004f39a3a 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/src/main.cpp +++ b/examples/all-clusters-minimal-app/infineon/psoc6/src/main.cpp @@ -57,7 +57,7 @@ static void main_task(void * pvParameters); //================================================================================= void appError(int err) { - P6_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); + PSOC6_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); portDISABLE_INTERRUPTS(); while (true) ; @@ -90,35 +90,35 @@ static void main_task(void * pvParameters) CHIP_ERROR ret = chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init(); if (ret != CHIP_NO_ERROR) { - P6_LOG("PersistedStorage::KeyValueStoreMgrImpl().Init() failed"); + PSOC6_LOG("PersistedStorage::KeyValueStoreMgrImpl().Init() failed"); appError(ret); } ret = PlatformMgr().InitChipStack(); if (ret != CHIP_NO_ERROR) { - P6_LOG("PlatformMgr().InitChipStack() failed"); + PSOC6_LOG("PlatformMgr().InitChipStack() failed"); appError(ret); } - ret = chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName("P6_CLUSTERS"); + ret = chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName("PSOC6_CLUSTERS"); if (ret != CHIP_NO_ERROR) { - P6_LOG("ConnectivityMgr().SetBLEDeviceName() failed"); + PSOC6_LOG("ConnectivityMgr().SetBLEDeviceName() failed"); appError(ret); } - P6_LOG("Starting Platform Manager Event Loop"); + PSOC6_LOG("Starting Platform Manager Event Loop"); ret = PlatformMgr().StartEventLoopTask(); if (ret != CHIP_NO_ERROR) { - P6_LOG("PlatformMgr().StartEventLoopTask() failed"); + PSOC6_LOG("PlatformMgr().StartEventLoopTask() failed"); appError(ret); } ret = GetAppTask().StartAppTask(); if (ret != CHIP_NO_ERROR) { - P6_LOG("GetAppTask().Init() failed"); + PSOC6_LOG("GetAppTask().Init() failed"); appError(ret); } @@ -131,7 +131,7 @@ static void main_task(void * pvParameters) // ================================================================================ int main(void) { - init_p6Platform(); + init_psoc6Platform(); #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR // Clear watchdog timer (started by bootloader) so that it doesn't trigger a reset cyhal_wdt_t wdt_obj; @@ -142,9 +142,9 @@ int main(void) MemMonitoring::startHeapMonitoring(); #endif - P6_LOG("==================================================\r\n"); - P6_LOG("chip-p6-all-clusters-minimal-example starting Version %d\r\n", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); - P6_LOG("==================================================\r\n"); + PSOC6_LOG("==================================================\r\n"); + PSOC6_LOG("chip-psoc6-all-clusters-minimal-example starting Version %d\r\n", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); + PSOC6_LOG("==================================================\r\n"); /* Start the FreeRTOS scheduler */ vTaskStartScheduler(); @@ -154,5 +154,5 @@ int main(void) PlatformMgr().Shutdown(); // Should never get here. - P6_LOG("vTaskStartScheduler() failed"); + PSOC6_LOG("vTaskStartScheduler() failed"); } diff --git a/examples/all-clusters-minimal-app/nrfconnect/CMakeLists.txt b/examples/all-clusters-minimal-app/nrfconnect/CMakeLists.txt index 2e5c3fbbf1102f..08feb83a62a40b 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/CMakeLists.txt +++ b/examples/all-clusters-minimal-app/nrfconnect/CMakeLists.txt @@ -22,14 +22,6 @@ get_filename_component(ALL_CLUSTERS_COMMON_DIR ${CHIP_ROOT}/examples/all-cluster include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) -# Set Kconfig root files that will be processed as a first Kconfig for used child images. -set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root) -set(multiprotocol_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root) - -if(DEFINED CONF_FILE AND NOT CONF_FILE STREQUAL "prj.conf") - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static_dfu.yml) -endif() - list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) @@ -41,6 +33,7 @@ target_compile_options(app PRIVATE -Werror -Wno-error=maybe-uninitialized) project(chip-nrfconnect-all-clusters-minimal-app-example) +include(${CHIP_ROOT}/config/nrfconnect/app/check-sysbuild-use.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/flashing.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) diff --git a/examples/all-clusters-minimal-app/nrfconnect/Kconfig.sysbuild b/examples/all-clusters-minimal-app/nrfconnect/Kconfig.sysbuild new file mode 100644 index 00000000000000..6d6f1d811109a9 --- /dev/null +++ b/examples/all-clusters-minimal-app/nrfconnect/Kconfig.sysbuild @@ -0,0 +1,67 @@ +# +# 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. +# + +#### Radio core selection +config NRF_DEFAULT_IPC_RADIO + default y + +# Enable IEEE802.15.4 serialization to network core +config NETCORE_IPC_RADIO_IEEE802154 + default y if (SOC_SERIES_NRF53X) && !WIFI_NRF700X + +# Enable Bluetooth serialization to network core +config NETCORE_IPC_RADIO_BT_HCI_IPC + default y if SOC_SERIES_NRF53X + +if BOOTLOADER_MCUBOOT + +#### DFU multi-image support +config DFU_MULTI_IMAGE_PACKAGE_BUILD + default y + +config DFU_MULTI_IMAGE_PACKAGE_APP + default y + +config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY + default y + +#### DFU network core configuration +if SOC_SERIES_NRF53X + +config MCUBOOT_UPDATEABLE_IMAGES + default 2 + +choice MCUBOOT_MODE + default MCUBOOT_MODE_OVERWRITE_ONLY +endchoice + +choice BOOT_SIGNATURE_TYPE + default BOOT_SIGNATURE_TYPE_RSA +endchoice + +config SECURE_BOOT_NETCORE + default y + +config NETCORE_APP_UPDATE + default y + +config DFU_MULTI_IMAGE_PACKAGE_NET + default y + +endif # SOC_SERIES_NRF53X +endif # BOOTLOADER_MCUBOOT + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/examples/all-clusters-minimal-app/nrfconnect/README.md b/examples/all-clusters-minimal-app/nrfconnect/README.md index a015c7a61ed115..932db10a2f2c89 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/README.md +++ b/examples/all-clusters-minimal-app/nrfconnect/README.md @@ -1,5 +1,21 @@ # Matter nRF Connect All Clusters Example Application +> **Note:** This example is intended only to perform smoke tests of a Matter +> solution integrated with nRF Connect SDK platform. The example quality is not +> production ready and it may contain minor bugs or use not optimal +> configuration. It is not recommended to use this example as a basis for +> creating a market ready product. +> +> For the production ready and optimized Matter samples, see +> [nRF Connect SDK samples](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/matter.html). +> The Matter samples in nRF Connect SDK use various additional software +> components and provide multiple optional features that improve the developer +> and user experience. To read more about it, see +> [Matter support in nRF Connect SDK](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/matter/index.html#ug-matter) +> page. Using Matter samples from nRF Connect SDK allows you to get a full +> Nordic technical support via [DevZone](https://devzone.nordicsemi.com/) +> portal. + The nRF All Clusters Example Application implements various ZCL clusters populated on three endpoints. You can use this example as a reference for creating your own application. @@ -77,9 +93,9 @@ The example supports building and running on the following devices: | Hardware platform | Build target | Platform image | | ------------------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk_nrf52840` |
nRF52840 DKnRF52840 DK
| -| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk_nrf5340_cpuapp` |
nRF5340 DKnRF5340 DK
| -| [nRF52840 Dongle](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle) | `nrf52840dongle_nrf52840` |
nRF52840 DonglenRF52840 Dongle
| +| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk/nrf52840` |
nRF52840 DKnRF52840 DK
| +| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk/nrf5340/cpuapp` |
nRF5340 DKnRF5340 DK
| +| [nRF52840 Dongle](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle) | `nrf52840dongle/nrf52840` |
nRF52840 DonglenRF52840 Dongle
|
@@ -240,14 +256,15 @@ environment: 2. Run the following command to build the example, with _build-target_ replaced with the build target name of the Nordic Semiconductor's kit you own, for - example `nrf52840dk_nrf52840`: + example `nrf52840dk/nrf52840`: - $ west build -b build-target + $ west build -b build-target --sysbuild You only need to specify the build target on the first build. See [Requirements](#requirements) for the build target names of compatible kits. -The output `zephyr.hex` file will be available in the `build/zephyr/` directory. +The output `zephyr.hex` file will be available in the `build/nrfconnect/zephyr/` +directory. ### Removing build artifacts @@ -262,7 +279,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DCONF_FILE=prj_release.conf + $ west build -b build-target --sysbuild -- -DFILE_SUFFIX=release Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -273,9 +290,9 @@ Support for DFU using Matter OTA is disabled by default. To build the example with configuration that supports DFU, run the following command with _build-target_ replaced with the build target name of the Nordic -Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): +Semiconductor kit you are using (for example `nrf52840dk/nrf52840`): - $ west build -b build-target -- -DCONF_FILE=prj_dfu.conf + $ west build -b build-target --sysbuild -- -DFILE_SUFFIX=dfu > **Note**: > @@ -291,7 +308,7 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): #### Changing bootloader configuration To change the default MCUboot configuration, edit the `prj.conf` file located in -the `child_image/mcuboot` directory. +the `sysbuild/mcuboot` directory. #### Changing flash memory settings @@ -303,8 +320,9 @@ purposes. You can change these settings by defining This example uses this option to define using an external flash. To modify the flash settings of your board (that is, your _build-target_, for -example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the -`configuration/build-target/` directory. +example `nrf52840dk/nrf52840`), edit the `pm_static_.yml` file +(for example `pm_static_nrf52840dk_nrf52840.yml`), located in the main +application directory.
@@ -316,7 +334,7 @@ using the menuconfig utility. To open the menuconfig utility, run the following command from the example directory: - $ west build -b build-target -t menuconfig + $ west build -b build-target --sysbuild -t menuconfig Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. diff --git a/examples/all-clusters-minimal-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf b/examples/all-clusters-minimal-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf index 4da8bbcd8ac81b..78bdefbd4452da 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf +++ b/examples/all-clusters-minimal-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf @@ -38,6 +38,3 @@ CONFIG_MATTER_LOG_LEVEL_INF=y # Use partition manager to configure the settings partition not to overlap with Open Bootloader CONFIG_PM_SINGLE_IMAGE=y - -# Enable CHIP pairing automatically on application start. -CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y diff --git a/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay b/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index f18e3e0cc16434..00000000000000 --- a/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay b/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/prj_dfu.conf b/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/prj_dfu.conf deleted file mode 100644 index 287c7829c6a5cf..00000000000000 --- a/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/prj_dfu.conf +++ /dev/null @@ -1,30 +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. -# - -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. - -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" - -# Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. -CONFIG_GPIO=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_USE_SEGGER_RTT=n diff --git a/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/prj_release.conf b/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/prj_release.conf deleted file mode 100644 index 287c7829c6a5cf..00000000000000 --- a/examples/all-clusters-minimal-app/nrfconnect/child_image/mcuboot/prj_release.conf +++ /dev/null @@ -1,30 +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. -# - -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. - -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" - -# Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. -CONFIG_GPIO=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_USE_SEGGER_RTT=n diff --git a/examples/all-clusters-minimal-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf b/examples/all-clusters-minimal-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/all-clusters-minimal-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/all-clusters-minimal-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_dfu.conf b/examples/all-clusters-minimal-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_dfu.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/all-clusters-minimal-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_dfu.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/all-clusters-minimal-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf b/examples/all-clusters-minimal-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/all-clusters-minimal-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml b/examples/all-clusters-minimal-app/nrfconnect/pm_static_nrf52840dk_nrf52840_dfu.yml similarity index 100% rename from examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml rename to examples/all-clusters-minimal-app/nrfconnect/pm_static_nrf52840dk_nrf52840_dfu.yml diff --git a/examples/all-clusters-minimal-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml b/examples/all-clusters-minimal-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml similarity index 100% rename from examples/all-clusters-minimal-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml rename to examples/all-clusters-minimal-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml diff --git a/examples/lit-icd-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml b/examples/all-clusters-minimal-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_dfu.yml similarity index 100% rename from examples/lit-icd-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml rename to examples/all-clusters-minimal-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_dfu.yml diff --git a/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml b/examples/all-clusters-minimal-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml similarity index 100% rename from examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml rename to examples/all-clusters-minimal-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml diff --git a/examples/all-clusters-minimal-app/nrfconnect/prj.conf b/examples/all-clusters-minimal-app/nrfconnect/prj.conf index 0491fbb825666f..58dae15804fe81 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/prj.conf +++ b/examples/all-clusters-minimal-app/nrfconnect/prj.conf @@ -25,6 +25,13 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 CONFIG_STD_CPP17=y +# Enable Matter pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/all-clusters-minimal-app/nrfconnect/prj_dfu.conf b/examples/all-clusters-minimal-app/nrfconnect/prj_dfu.conf index a96c97d2517580..46535f44bd21e4 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/prj_dfu.conf +++ b/examples/all-clusters-minimal-app/nrfconnect/prj_dfu.conf @@ -25,6 +25,13 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 CONFIG_STD_CPP17=y +# Enable Matter pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/all-clusters-minimal-app/nrfconnect/prj_release.conf b/examples/all-clusters-minimal-app/nrfconnect/prj_release.conf index e885563a98618f..4d81894306b6ca 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/prj_release.conf +++ b/examples/all-clusters-minimal-app/nrfconnect/prj_release.conf @@ -25,6 +25,13 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 CONFIG_STD_CPP17=y +# Enable Matter pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/all-clusters-minimal-app/nrfconnect/sysbuild.conf b/examples/all-clusters-minimal-app/nrfconnect/sysbuild.conf new file mode 100644 index 00000000000000..e63a92c6b2bbab --- /dev/null +++ b/examples/all-clusters-minimal-app/nrfconnect/sysbuild.conf @@ -0,0 +1,18 @@ +# +# 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. +# + +SB_CONFIG_MATTER=y +SB_CONFIG_MATTER_OTA=n diff --git a/examples/all-clusters-minimal-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf new file mode 100644 index 00000000000000..8540585e53358b --- /dev/null +++ b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf @@ -0,0 +1,58 @@ +# +# 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. +# + +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# 802.15.4 configuration +CONFIG_NRF_802154_SER_RADIO=y +CONFIG_NRF_802154_ENCRYPTION=y +CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=2 + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_DEBUG_INFO=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y +CONFIG_IPC_RADIO_802154=y diff --git a/examples/all-clusters-minimal-app/nrfconnect/sysbuild/ipc_radio/boards/nrf7002dk_nrf5340_cpunet.conf b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/ipc_radio/boards/nrf7002dk_nrf5340_cpunet.conf new file mode 100644 index 00000000000000..694c3b08242f29 --- /dev/null +++ b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/ipc_radio/boards/nrf7002dk_nrf5340_cpunet.conf @@ -0,0 +1,52 @@ +# +# 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. +# + +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_DEBUG_INFO=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y diff --git a/examples/all-clusters-minimal-app/nrfconnect/sysbuild/ipc_radio/prj.conf b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/ipc_radio/prj.conf new file mode 100644 index 00000000000000..8906415dda4fc7 --- /dev/null +++ b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/ipc_radio/prj.conf @@ -0,0 +1,21 @@ +# +# 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. +# + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=n diff --git a/examples/all-clusters-minimal-app/nrfconnect/sysbuild/ipc_radio/prj_dfu.conf b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/ipc_radio/prj_dfu.conf new file mode 100644 index 00000000000000..7f92a51630cce0 --- /dev/null +++ b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/ipc_radio/prj_dfu.conf @@ -0,0 +1,20 @@ +# +# 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. +# +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=y diff --git a/examples/all-clusters-minimal-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf new file mode 100644 index 00000000000000..7f92a51630cce0 --- /dev/null +++ b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf @@ -0,0 +1,20 @@ +# +# 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. +# +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=y diff --git a/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/app.overlay b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/app.overlay new file mode 100644 index 00000000000000..74d3dfbfd22f30 --- /dev/null +++ b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/app.overlay @@ -0,0 +1,5 @@ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf new file mode 100644 index 00000000000000..50610217c762b5 --- /dev/null +++ b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf @@ -0,0 +1,19 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 diff --git a/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000000..2d86fe6442dd39 --- /dev/null +++ b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -0,0 +1,35 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 + +CONFIG_BOOT_SWAP_USING_MOVE=n +# Multi-image updates do not support image swapping yet. +CONFIG_BOOT_UPGRADE_ONLY=y + +# The network core cannot access external flash directly. The flash simulator must be used to +# provide a memory region that is used to forward the new firmware to the network core. +CONFIG_FLASH_SIMULATOR=y +CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y +CONFIG_FLASH_SIMULATOR_STATS=n + +CONFIG_ZCBOR=y diff --git a/examples/lit-icd-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay similarity index 90% rename from examples/lit-icd-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay rename to examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay index 50069180506973..054f04712058a3 100644 --- a/examples/lit-icd-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -1,5 +1,7 @@ /* + * * 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. @@ -13,8 +15,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + / { chosen { + zephyr,code-partition = &boot_partition; nordic,pm-ext-flash = &mx25r64; }; }; diff --git a/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000000..81701b7eb63f70 --- /dev/null +++ b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf @@ -0,0 +1,40 @@ +# +# 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. +# + +# nRF7002DK uses SPI NOR external flash +CONFIG_GPIO=y +CONFIG_SPI=y +CONFIG_SPI_NOR=y +CONFIG_SPI_NOR_SFDP_DEVICETREE=y +CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 + +CONFIG_MULTITHREADING=y +CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 + +# Multi-image updates do not support image swapping yet. +CONFIG_BOOT_UPGRADE_ONLY=y + +# The network core cannot access external flash directly. The flash simulator must be used to +# provide a memory region that is used to forward the new firmware to the network core. +CONFIG_FLASH_SIMULATOR=y +CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y +CONFIG_FLASH_SIMULATOR_STATS=n + +CONFIG_ZCBOR=y diff --git a/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/lit-icd-app/nrfconnect/child_image/mcuboot/prj_release.conf b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/prj.conf similarity index 62% rename from examples/lit-icd-app/nrfconnect/child_image/mcuboot/prj_release.conf rename to examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/prj.conf index 3f43b733b4bb96..3bcb12fe7b8d25 100644 --- a/examples/lit-icd-app/nrfconnect/child_image/mcuboot/prj_release.conf +++ b/examples/all-clusters-minimal-app/nrfconnect/sysbuild/mcuboot/prj.conf @@ -14,17 +14,36 @@ # limitations under the License. # -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. +CONFIG_MAIN_STACK_SIZE=10240 + +CONFIG_BOOT_SWAP_SAVE_ENCTLV=n +CONFIG_BOOT_BOOTSTRAP=n +CONFIG_PM=n + +CONFIG_FLASH=y +CONFIG_FPROTECT=y CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +# Use minimal C library instead of the Picolib +CONFIG_MINIMAL_LIBC=y + # Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. CONFIG_CONSOLE=n CONFIG_SERIAL=n CONFIG_UART_CONSOLE=n CONFIG_USE_SEGGER_RTT=n CONFIG_GPIO=n + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +CONFIG_LOG=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_NCS_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/all-clusters-minimal-app/nrfconnect/sysbuild_dfu.conf b/examples/all-clusters-minimal-app/nrfconnect/sysbuild_dfu.conf new file mode 100644 index 00000000000000..7151539bc715fc --- /dev/null +++ b/examples/all-clusters-minimal-app/nrfconnect/sysbuild_dfu.conf @@ -0,0 +1,20 @@ +# +# 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. +# + +SB_CONFIG_MATTER=y +SB_CONFIG_MATTER_OTA=y +SB_CONFIG_BOOTLOADER_MCUBOOT=y + diff --git a/examples/all-clusters-minimal-app/nrfconnect/sysbuild_release.conf b/examples/all-clusters-minimal-app/nrfconnect/sysbuild_release.conf new file mode 100644 index 00000000000000..edaaa8394e0155 --- /dev/null +++ b/examples/all-clusters-minimal-app/nrfconnect/sysbuild_release.conf @@ -0,0 +1,20 @@ +# +# 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. +# + +SB_CONFIG_MATTER=y +SB_CONFIG_MATTER_OTA=y +SB_CONFIG_BOOTLOADER_MCUBOOT=y +SB_CONFIG_MATTER_FACTORY_DATA_GENERATE=y diff --git a/examples/all-clusters-minimal-app/telink/README.md b/examples/all-clusters-minimal-app/telink/README.md index 396afb1cc63091..f3a0646df97743 100644 --- a/examples/all-clusters-minimal-app/telink/README.md +++ b/examples/all-clusters-minimal-app/telink/README.md @@ -6,6 +6,17 @@ for creating your own application. ![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) +## Supported devices + +The example supports building and running on the following devices: + +| Board/SoC | Build target | Zephyr Board Info | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| [B91](https://wiki.telink-semi.cn/wiki/Hardware/B91_Generic_Starter_Kit_Hardware_Guide) [TLSR9518ADK80D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series) | `tlsr9518adk80d`, `tlsr9518adk80d-mars`, `tlsr9518adk80d-usb` | [TLSR9518ADK80D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9518adk80d/doc/index.rst) | +| [B92](https://wiki.telink-semi.cn/wiki/Hardware/B92_Generic_Starter_Kit_Hardware_Guide) [TLSR9528A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR952x-Series) | `tlsr9528a`, `tlsr9528a_retention` | [TLSR9528A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9528a/doc/index.rst) | +| [B95](https://wiki.telink-semi.cn/wiki/Hardware/B95_Generic_Starter_Kit_Hardware_Guide) [TLSR9258A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR925x-Series) | `tlsr9258a` | [TLSR9258A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9258a/doc/index.rst) | +| [W91](https://wiki.telink-semi.cn/wiki/Hardware/W91_Generic_Starter_Kit_Hardware_Guide) [TLSR9118BDK40D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR911x-Series) | `tlsr9118bdk40d` | [TLSR9118BDK40D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9118bdk40d/doc/index.rst) | + ## Build and flash 1. Run the Docker container: @@ -14,7 +25,7 @@ for creating your own application. $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}') ``` - Compatible docker image version can be found in next file: + You can find the compatible Docker image version in the file: ```bash $ .github/workflows/examples-telink.yaml @@ -26,8 +37,8 @@ for creating your own application. $ source ./scripts/activate.sh -p all,telink ``` -3. In the example dir run (replace __ with your board name, for - example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`): +3. Build the example (replace __ with your board name, see + [Supported devices](#supported-devices)): ```bash $ west build -b @@ -37,9 +48,12 @@ for creating your own application. MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=4m`: ```bash - $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + $ west build -b -- -DFLASH_SIZE=4m ``` + You can find the target built file called **_zephyr.bin_** under the + **_build/zephyr_** directory. + 4. Flash binary: ``` @@ -58,27 +72,31 @@ To get output from device, connect UART to following pins: | TX | PB2 (pin 16 of J34 connector) | | GND | GND | +Baud rate: 115200 bits/s + ### Buttons The following buttons are available on **tlsr9518adk80d** board: -| Name | Function | Description | -| :------- | :--------------------- | :----------------------------------------------------------------------------------------------------- | -| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and back to uncommissioned state | -| Button 2 | Not used | Not used | -| Button 2 | Not used | Not used | -| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | +| Name | Function | Description | +| :------- | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and return to a decommissioned state (to activate, push the button 3 times) | +| Button 2 | Not used | Not used | +| Button 2 | Not used | Not used | +| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | ### LEDs -**Red** LED indicates current state of Thread network. It ables to be in +#### Indicate current state of Thread network + +**Red** LED indicates current state of Thread network. It is able to be in following states: | State | Description | | :-------------------------- | :--------------------------------------------------------------------------- | | Blinks with short pulses | Device is not commissioned to Thread, Thread is disabled | -| Blinls with frequent pulses | Device is commissioned, Thread enabled. Device trying to JOIN thread network | -| Blinks with whde pulses | Device commissioned and joined to thread network as CHILD | +| Blinks with frequent pulses | Device is commissioned, Thread enabled. Device trying to JOIN thread network | +| Blinks with wide pulses | Device commissioned and joined to thread network as CHILD | ### CHIP tool commands diff --git a/examples/android/CHIPTest/BUILD.gn b/examples/android/CHIPTest/BUILD.gn index ad6ce1d9820afe..c8ccb2e614c103 100644 --- a/examples/android/CHIPTest/BUILD.gn +++ b/examples/android/CHIPTest/BUILD.gn @@ -37,7 +37,7 @@ shared_library("jni") { "${chip_root}/src/platform", "${chip_root}/src/platform/android", "${chip_root}/src/platform/android:java", - "${chip_root}/src/platform/logging:android", + "${chip_root}/src/platform/android:logging", "${chip_root}/src/platform/tests:tests", "${chip_root}/third_party/inipp", "${chip_root}/third_party/nlfaultinjection:nlfaultinjection", diff --git a/examples/bridge-app/bridge-common/bridge-app.matter b/examples/bridge-app/bridge-common/bridge-app.matter index ec5d045647a4bd..f35fd082eb9900 100644 --- a/examples/bridge-app/bridge-common/bridge-app.matter +++ b/examples/bridge-app/bridge-common/bridge-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -125,7 +142,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -307,7 +324,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -323,12 +340,42 @@ cluster AccessControl = 31 { 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; @@ -364,17 +411,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** The Access Control Cluster exposes a data model view of a @@ -382,7 +453,7 @@ cluster AccessControl = 31 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -398,12 +469,42 @@ cluster AccessControl = 31 { 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; @@ -439,17 +540,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides a standardized way for a Node (typically a Bridge, but could be any Node) to expose action information. */ @@ -711,7 +836,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -2330,7 +2455,7 @@ endpoint 2 { ram attribute defaultMoveRate; persist attribute startUpCurrentLevel default = 255; ram attribute featureMap default = 3; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; diff --git a/examples/bridge-app/bridge-common/bridge-app.zap b/examples/bridge-app/bridge-common/bridge-app.zap index 9e79b7848a4dda..1b6b16be94d51a 100644 --- a/examples/bridge-app/bridge-common/bridge-app.zap +++ b/examples/bridge-app/bridge-common/bridge-app.zap @@ -5387,7 +5387,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/bridge-app/linux/main.cpp b/examples/bridge-app/linux/main.cpp index 699a87fa8c7938..c7e1dfb5a9c50b 100644 --- a/examples/bridge-app/linux/main.cpp +++ b/examples/bridge-app/linux/main.cpp @@ -159,9 +159,6 @@ DeviceOnOff Light2("Light 2", "Office"); DeviceTempSensor TempSensor1("TempSensor 1", "Office", minMeasuredValue, maxMeasuredValue, initialMeasuredValue); DeviceTempSensor TempSensor2("TempSensor 2", "Office", minMeasuredValue, maxMeasuredValue, initialMeasuredValue); -DeviceTempSensor ComposedTempSensor1("Composed TempSensor 1", "Bedroom", minMeasuredValue, maxMeasuredValue, initialMeasuredValue); -DeviceTempSensor ComposedTempSensor2("Composed TempSensor 2", "Bedroom", minMeasuredValue, maxMeasuredValue, initialMeasuredValue); - // Declare Bridged endpoints used for Action clusters DataVersion gActionLight1DataVersions[ArraySize(bridgedLightClusters)]; DataVersion gActionLight2DataVersions[ArraySize(bridgedLightClusters)]; @@ -173,6 +170,12 @@ DeviceOnOff ActionLight2("Action Light 2", "Room 1"); DeviceOnOff ActionLight3("Action Light 3", "Room 2"); DeviceOnOff ActionLight4("Action Light 4", "Room 2"); +// Setup composed device with two temperature sensors and a power source +ComposedDevice gComposedDevice("Composed Device", "Bedroom"); +DeviceTempSensor ComposedTempSensor1("Composed TempSensor 1", "Bedroom", minMeasuredValue, maxMeasuredValue, initialMeasuredValue); +DeviceTempSensor ComposedTempSensor2("Composed TempSensor 2", "Bedroom", minMeasuredValue, maxMeasuredValue, initialMeasuredValue); +DevicePowerSource ComposedPowerSource("Composed Power Source", "Bedroom", PowerSource::Feature::kBattery); + Room room1("Room 1", 0xE001, Actions::EndpointListTypeEnum::kRoom, true); Room room2("Room 2", 0xE002, Actions::EndpointListTypeEnum::kRoom, true); Room room3("Zone 3", 0xE003, Actions::EndpointListTypeEnum::kZone, false); @@ -918,11 +921,7 @@ void ApplicationInit() ActionLight3.SetChangeCallback(&HandleDeviceOnOffStatusChanged); ActionLight4.SetChangeCallback(&HandleDeviceOnOffStatusChanged); - // Setup composed device with two temperature sensors and a power source - ComposedDevice ComposedDevice("Composed Device", "Bedroom"); - DevicePowerSource ComposedPowerSource("Composed Power Source", "Bedroom", PowerSource::Feature::kBattery); - - ComposedDevice.SetReachable(true); + gComposedDevice.SetReachable(true); ComposedTempSensor1.SetReachable(true); ComposedTempSensor2.SetReachable(true); ComposedPowerSource.SetReachable(true); @@ -952,14 +951,14 @@ void ApplicationInit() Span(gTempSensor2DataVersions), 1); // Add composed Device with two temperature sensors and a power source - AddDeviceEndpoint(&ComposedDevice, &bridgedComposedDeviceEndpoint, Span(gBridgedComposedDeviceTypes), + AddDeviceEndpoint(&gComposedDevice, &bridgedComposedDeviceEndpoint, Span(gBridgedComposedDeviceTypes), Span(gComposedDeviceDataVersions), 1); AddDeviceEndpoint(&ComposedTempSensor1, &bridgedTempSensorEndpoint, Span(gComposedTempSensorDeviceTypes), - Span(gComposedTempSensor1DataVersions), ComposedDevice.GetEndpointId()); + Span(gComposedTempSensor1DataVersions), gComposedDevice.GetEndpointId()); AddDeviceEndpoint(&ComposedTempSensor2, &bridgedTempSensorEndpoint, Span(gComposedTempSensorDeviceTypes), - Span(gComposedTempSensor2DataVersions), ComposedDevice.GetEndpointId()); + Span(gComposedTempSensor2DataVersions), gComposedDevice.GetEndpointId()); // Add 4 lights for the Action Clusters tests AddDeviceEndpoint(&ActionLight1, &bridgedLightEndpoint, Span(gBridgedOnOffDeviceTypes), @@ -975,11 +974,11 @@ void ApplicationInit() gDevices[CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT] = &ComposedPowerSource; // This provides power for the composed endpoint std::vector endpointList; - endpointList.push_back(ComposedDevice.GetEndpointId()); + endpointList.push_back(gComposedDevice.GetEndpointId()); endpointList.push_back(ComposedTempSensor1.GetEndpointId()); endpointList.push_back(ComposedTempSensor2.GetEndpointId()); ComposedPowerSource.SetEndpointList(endpointList); - ComposedPowerSource.SetEndpointId(ComposedDevice.GetEndpointId()); + ComposedPowerSource.SetEndpointId(gComposedDevice.GetEndpointId()); gRooms.push_back(&room1); gRooms.push_back(&room2); diff --git a/examples/bridge-app/telink/README.md b/examples/bridge-app/telink/README.md index 0855689cd1201f..7dc29dff9d1d58 100644 --- a/examples/bridge-app/telink/README.md +++ b/examples/bridge-app/telink/README.md @@ -83,6 +83,17 @@ defined: - This macro is used to declare an endpoint and its associated cluster list, which must be previously defined by the `DECLARE_DYNAMIC_CLUSTER...` macros. +## Supported devices + +The example supports building and running on the following devices: + +| Board/SoC | Build target | Zephyr Board Info | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| [B91](https://wiki.telink-semi.cn/wiki/Hardware/B91_Generic_Starter_Kit_Hardware_Guide) [TLSR9518ADK80D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series) | `tlsr9518adk80d`, `tlsr9518adk80d-mars`, `tlsr9518adk80d-usb` | [TLSR9518ADK80D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9518adk80d/doc/index.rst) | +| [B92](https://wiki.telink-semi.cn/wiki/Hardware/B92_Generic_Starter_Kit_Hardware_Guide) [TLSR9528A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR952x-Series) | `tlsr9528a`, `tlsr9528a_retention` | [TLSR9528A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9528a/doc/index.rst) | +| [B95](https://wiki.telink-semi.cn/wiki/Hardware/B95_Generic_Starter_Kit_Hardware_Guide) [TLSR9258A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR925x-Series) | `tlsr9258a` | [TLSR9258A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9258a/doc/index.rst) | +| [W91](https://wiki.telink-semi.cn/wiki/Hardware/W91_Generic_Starter_Kit_Hardware_Guide) [TLSR9118BDK40D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR911x-Series) | `tlsr9118bdk40d` | [TLSR9118BDK40D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9118bdk40d/doc/index.rst) | + ## Build and flash 1. Run the Docker container: @@ -91,7 +102,7 @@ defined: $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}') ``` - Compatible docker image version can be found in next file: + You can find the compatible Docker image version in the file: ```bash $ .github/workflows/examples-telink.yaml @@ -103,8 +114,8 @@ defined: $ source ./scripts/activate.sh -p all,telink ``` -3. In the example dir run (replace __ with your board name, for - example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`): +3. Build the example (replace __ with your board name, see + [Supported devices](#supported-devices)): ```bash $ west build -b @@ -114,9 +125,12 @@ defined: MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=4m`: ```bash - $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + $ west build -b -- -DFLASH_SIZE=4m ``` + You can find the target built file called **_zephyr.bin_** under the + **_build/zephyr_** directory. + 4. Flash binary: ``` @@ -135,16 +149,18 @@ To get output from device, connect UART to following pins: | TX | PB2 (pin 16 of J34 connector) | | GND | GND | +Baud rate: 115200 bits/s + ### Buttons The following buttons are available on **tlsr9518adk80d** board: -| Name | Function | Description | -| :------- | :--------------------- | :----------------------------------------------------------------------------------------------------- | -| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and back to uncommissioned state | -| Button 2 | Lighting control | Manually triggers the lighting state | -| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | -| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | +| Name | Function | Description | +| :------- | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and return to a decommissioned state (to activate, push the button 3 times) | +| Button 2 | Lighting control | Manually triggers the lighting state | +| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | +| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | ### LEDs diff --git a/examples/build_overrides/nxp_sdk.gni b/examples/build_overrides/nxp_sdk.gni index 5648cc858a728b..5364631f3b7ed4 100644 --- a/examples/build_overrides/nxp_sdk.gni +++ b/examples/build_overrides/nxp_sdk.gni @@ -14,5 +14,10 @@ declare_args() { # Root directory for NXP SDKs. - nxp_sdk_build_root = "//third_party/connectedhomeip/third_party/nxp" + nxp_sdk_matter_support_root = + "//third_party/connectedhomeip/third_party/nxp/nxp_matter_support" +} + +declare_args() { + nxp_sdk_build_root = "${nxp_sdk_matter_support_root}/gn_build" } diff --git a/examples/chef/ameba/chip_main.cmake b/examples/chef/ameba/chip_main.cmake index de17e0534cb7cd..df9f7fedd10ecc 100755 --- a/examples/chef/ameba/chip_main.cmake +++ b/examples/chef/ameba/chip_main.cmake @@ -78,7 +78,6 @@ target_include_directories( ${chip_dir}/src/app/server/ ${chip_dir}/src/controller/data_model ${chip_dir}/third_party/nlio/repo/include/ - ${chip_dir}/third_party/nlunit-test/repo/src ) list( diff --git a/examples/chef/chef.py b/examples/chef/chef.py index c4b7aa8aca162b..cecbf646ffeedf 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -199,6 +199,7 @@ def bundle_nrfconnect(device_name: str) -> None: nrf_root = os.path.join(_CHEF_SCRIPT_PATH, "nrfconnect", "build", + "nrfconnect", "zephyr") scripts_root = os.path.join(_REPO_BASE_PATH, "scripts", @@ -723,9 +724,10 @@ def main() -> int: f"cp build/$(git rev-parse HEAD)-{options.sample_device_type_name}.tar.xz {_CHEF_SCRIPT_PATH}") elif options.build_target == "nrfconnect": shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/nrfconnect") - nrf_build_cmds = ["west build -b nrf52840dk_nrf52840"] + nrf_build_cmds = ["west build -b nrf52840dk/nrf52840"] if options.do_clean: nrf_build_cmds.append("-p always") + nrf_build_cmds.append("--sysbuild") nrf_build_cmds.append("--") if options.do_rpc: nrf_build_cmds.append("-DOVERLAY_CONFIG=rpc.overlay") @@ -736,7 +738,7 @@ def main() -> int: nrf_build_cmds.append( f"-DCONFIG_CHIP_DEVICE_PRODUCT_NAME='\"{options.pname}\"'") nrf_build_cmds.append( - f"-DSAMPLE_NAME={options.sample_device_type_name}") + f"-DCONFIG_CHEF_DEVICE_TYPE='\"{options.sample_device_type_name}\"'") nrf_build_cmds.append( f"-DCONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING='\"{sw_ver_string}\"'") diff --git a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter index 372503cef8bad1..ed03c1ca8ca637 100644 --- a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter +++ b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -384,7 +401,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -400,12 +417,42 @@ cluster AccessControl = 31 { 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; @@ -441,17 +488,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -536,7 +607,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -2041,7 +2112,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 0x03; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; diff --git a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap index 1fe8c97a3cda61..444408ac97d1ac 100644 --- a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap +++ b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap @@ -4564,7 +4564,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/chef/devices/rootnode_airpurifier_73a6fe2651.matter b/examples/chef/devices/rootnode_airpurifier_73a6fe2651.matter index 95a5ebba08d8e5..ae8cdd66b8dd1b 100644 --- a/examples/chef/devices/rootnode_airpurifier_73a6fe2651.matter +++ b/examples/chef/devices/rootnode_airpurifier_73a6fe2651.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -161,7 +178,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -177,12 +194,42 @@ cluster AccessControl = 31 { 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; @@ -218,17 +265,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -313,7 +384,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_airpurifier_73a6fe2651.zap b/examples/chef/devices/rootnode_airpurifier_73a6fe2651.zap index d72b6d11800223..78aa987f1d8fa6 100644 --- a/examples/chef/devices/rootnode_airpurifier_73a6fe2651.zap +++ b/examples/chef/devices/rootnode_airpurifier_73a6fe2651.zap @@ -17,13 +17,6 @@ } ], "package": [ - { - "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", - "category": "matter", - "version": "chip-v1" - }, { "pathRelativity": "relativeToZap", "path": "../../../src/app/zap-templates/zcl/zcl.json", @@ -31,6 +24,13 @@ "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": [ diff --git a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter index ace9e7a92793d2..e79a65f165d0d0 100644 --- a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter +++ b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -166,7 +183,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -182,12 +199,42 @@ cluster AccessControl = 31 { 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; @@ -223,17 +270,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -318,7 +389,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1200,7 +1271,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -1267,7 +1339,6 @@ cluster Thermostat = 513 { kMatterScheduleConfiguration = 0x80; kPresets = 0x100; kSetpoints = 0x200; - kQueuedPresetsSupported = 0x400; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -1327,11 +1398,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -1365,11 +1431,6 @@ cluster Thermostat = 513 { PresetTypeFeaturesBitmap presetTypeFeatures = 2; } - struct QueuedPresetStruct { - nullable octet_string<16> presetHandle = 0; - nullable epoch_s transitionTimestamp = 1; - } - struct ScheduleTypeStruct { SystemModeEnum systemMode = 0; int8u numberOfSchedules = 1; @@ -1442,9 +1503,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; - readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1482,17 +1541,12 @@ cluster Thermostat = 513 { request struct SetActivePresetRequestRequest { octet_string<16> presetHandle = 0; - optional int16u delayMinutes = 1; } request struct StartPresetsSchedulesEditRequestRequest { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -1511,10 +1565,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command is sent to cancel a queued preset. */ - command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for controlling a fan in a heating/cooling system. */ diff --git a/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.matter b/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.matter index 2dab6c7a1a71df..7f86f3a66008b6 100644 --- a/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.matter +++ b/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.zap b/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.zap index 127d31dc60551f..535aa424e1d2a7 100644 --- a/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.zap +++ b/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.zap @@ -2997,7 +2997,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3013,7 +3013,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3029,7 +3029,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3045,7 +3045,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3061,7 +3061,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter b/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter index b1fa4a5e38adb3..f65d5fc5ad8555 100644 --- a/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter +++ b/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -125,7 +142,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -286,7 +303,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -302,12 +319,42 @@ cluster AccessControl = 31 { 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; @@ -343,17 +390,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -438,7 +509,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -2407,7 +2478,7 @@ endpoint 2 { callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; diff --git a/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.zap b/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.zap index 3935c80b5b62d8..6a4517c2962607 100644 --- a/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.zap +++ b/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.zap @@ -4666,7 +4666,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter index 3a4ed13ea40f55..6f7714fcbbf102 100644 --- a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter +++ b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -363,7 +380,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -379,12 +396,42 @@ cluster AccessControl = 31 { 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; @@ -420,17 +467,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -515,7 +586,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1404,7 +1475,7 @@ cluster GroupKeyManagement = 63 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -1988,7 +2059,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 0; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; @@ -2047,7 +2118,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 0x0010; - ram attribute clusterRevision default = 6; + ram attribute clusterRevision default = 7; handle command MoveToHue; handle command MoveHue; diff --git a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap index f3a2c9649d7356..d9ba9c9926b329 100644 --- a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap +++ b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap @@ -3047,7 +3047,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3925,7 +3925,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter b/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter index 46f2f9de05ba19..57718ed32895da 100644 --- a/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter +++ b/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter index 8855108dbd76ec..93df8c3e2c0b33 100644 --- a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter +++ b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -187,7 +204,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -203,12 +220,42 @@ cluster AccessControl = 31 { 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; @@ -244,17 +291,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -339,7 +410,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter index a44ffef19ce24b..9dd5331063e27b 100644 --- a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter +++ b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -384,7 +401,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -400,12 +417,42 @@ cluster AccessControl = 31 { 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; @@ -441,17 +488,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -536,7 +607,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1852,7 +1923,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 0x03; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; diff --git a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap index 29e4889ffbe438..3feb19881c6a29 100644 --- a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap +++ b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap @@ -3301,7 +3301,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter b/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter index 95ccd3897c1e6f..90b81ab8df5b44 100644 --- a/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter +++ b/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -384,7 +401,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -400,12 +417,42 @@ cluster AccessControl = 31 { 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; @@ -441,17 +488,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -536,7 +607,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1515,14 +1586,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + 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; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -1634,7 +1712,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** 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; diff --git a/examples/chef/devices/rootnode_dishwasher_cc105034fe.matter b/examples/chef/devices/rootnode_dishwasher_cc105034fe.matter index 4bbbf1e7545e71..67684011eff2b4 100644 --- a/examples/chef/devices/rootnode_dishwasher_cc105034fe.matter +++ b/examples/chef/devices/rootnode_dishwasher_cc105034fe.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter index e2ca298b2d9e77..ae0d89f00a685f 100644 --- a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter +++ b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter index fdd3a420d0da1c..32244ab3a10758 100644 --- a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter +++ b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -384,7 +401,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -400,12 +417,42 @@ cluster AccessControl = 31 { 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; @@ -441,17 +488,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -536,7 +607,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1505,7 +1576,7 @@ cluster FixedLabel = 64 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -2109,7 +2180,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 0x03; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; @@ -2159,7 +2230,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 0x1f; - ram attribute clusterRevision default = 6; + ram attribute clusterRevision default = 7; handle command MoveToHue; handle command MoveHue; diff --git a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.zap b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.zap index b72d455419f8a7..f0fc3c6c264c20 100644 --- a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.zap +++ b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.zap @@ -3269,7 +3269,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4029,7 +4029,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter b/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter index bb1d31727454b2..3b0a153455d728 100644 --- a/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter +++ b/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -166,7 +183,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -182,12 +199,42 @@ cluster AccessControl = 31 { 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; @@ -223,17 +270,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -318,7 +389,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter index a0eb473709e253..8cb484be472e10 100644 --- a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter +++ b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -187,7 +204,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -203,12 +220,42 @@ cluster AccessControl = 31 { 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; @@ -244,17 +291,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -339,7 +410,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_genericswitch_2dfff6e516.matter b/examples/chef/devices/rootnode_genericswitch_2dfff6e516.matter index bd71d94f7c871b..3a720c7c805fbf 100644 --- a/examples/chef/devices/rootnode_genericswitch_2dfff6e516.matter +++ b/examples/chef/devices/rootnode_genericswitch_2dfff6e516.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_genericswitch_9866e35d0b.matter b/examples/chef/devices/rootnode_genericswitch_9866e35d0b.matter index 4088d0b741a03e..020c9f0a93c8ed 100644 --- a/examples/chef/devices/rootnode_genericswitch_9866e35d0b.matter +++ b/examples/chef/devices/rootnode_genericswitch_9866e35d0b.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter index 20f10bcaaa3a86..40ddedabc2060d 100644 --- a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter +++ b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -384,7 +401,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -400,12 +417,42 @@ cluster AccessControl = 31 { 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; @@ -441,17 +488,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -536,7 +607,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1557,7 +1628,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -1624,7 +1696,6 @@ cluster Thermostat = 513 { kMatterScheduleConfiguration = 0x80; kPresets = 0x100; kSetpoints = 0x200; - kQueuedPresetsSupported = 0x400; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -1684,11 +1755,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -1722,11 +1788,6 @@ cluster Thermostat = 513 { PresetTypeFeaturesBitmap presetTypeFeatures = 2; } - struct QueuedPresetStruct { - nullable octet_string<16> presetHandle = 0; - nullable epoch_s transitionTimestamp = 1; - } - struct ScheduleTypeStruct { SystemModeEnum systemMode = 0; int8u numberOfSchedules = 1; @@ -1799,9 +1860,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; - readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1839,17 +1898,12 @@ cluster Thermostat = 513 { request struct SetActivePresetRequestRequest { octet_string<16> presetHandle = 0; - optional int16u delayMinutes = 1; } request struct StartPresetsSchedulesEditRequestRequest { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -1868,10 +1922,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command is sent to cancel a queued preset. */ - command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for controlling a fan in a heating/cooling system. */ @@ -2237,7 +2287,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 1; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; diff --git a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.zap b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.zap index cc2e7ef77d2186..88f0e7a0408646 100644 --- a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.zap +++ b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.zap @@ -19,18 +19,18 @@ "package": [ { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/zcl/zcl.json", - "type": "zcl-properties", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", "category": "matter", - "version": 1, - "description": "Matter SDK ZCL data" + "version": "chip-v1" }, { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", + "path": "../../../src/app/zap-templates/zcl/zcl.json", + "type": "zcl-properties", "category": "matter", - "version": "chip-v1" + "version": 1, + "description": "Matter SDK ZCL data" } ], "endpointTypes": [ @@ -3173,7 +3173,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter index 2a7cb52cd353a8..6db777fbefbfe5 100644 --- a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter +++ b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -187,7 +204,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -203,12 +220,42 @@ cluster AccessControl = 31 { 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; @@ -244,17 +291,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -339,7 +410,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter index 4c8b7a266357b3..878c3ca1a435c5 100644 --- a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter +++ b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter index 4e4a814a012e49..8a6aa2ec17f178 100644 --- a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter +++ b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -187,7 +204,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -203,12 +220,42 @@ cluster AccessControl = 31 { 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; @@ -244,17 +291,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -339,7 +410,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter index 778bb2daa5e0b6..434f47c71fd7f8 100644 --- a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter +++ b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -187,7 +204,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -203,12 +220,42 @@ cluster AccessControl = 31 { 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; @@ -244,17 +291,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -339,7 +410,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter index edfcf8f75c58f8..d0b5b1a910c11d 100644 --- a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter +++ b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -384,7 +401,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -400,12 +417,42 @@ cluster AccessControl = 31 { 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; @@ -441,17 +488,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -536,7 +607,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1789,7 +1860,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 3; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; diff --git a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap index c9ecb1d30b494c..e8625f2f612caf 100644 --- a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap +++ b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap @@ -3269,7 +3269,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/chef/devices/rootnode_onofflight_samplemei.matter b/examples/chef/devices/rootnode_onofflight_samplemei.matter index d0f453f5b7b15b..17140385015901 100644 --- a/examples/chef/devices/rootnode_onofflight_samplemei.matter +++ b/examples/chef/devices/rootnode_onofflight_samplemei.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -384,7 +401,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -400,12 +417,42 @@ cluster AccessControl = 31 { 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; @@ -441,17 +488,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -536,7 +607,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1821,7 +1892,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 3; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; diff --git a/examples/chef/devices/rootnode_onofflight_samplemei.zap b/examples/chef/devices/rootnode_onofflight_samplemei.zap index c7e4698ff78641..6670453d47603e 100644 --- a/examples/chef/devices/rootnode_onofflight_samplemei.zap +++ b/examples/chef/devices/rootnode_onofflight_samplemei.zap @@ -3269,7 +3269,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter index 3be01f97735caf..cb9f7f2eb6a4ae 100644 --- a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter +++ b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -331,7 +348,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -347,12 +364,42 @@ cluster AccessControl = 31 { 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; @@ -388,17 +435,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -483,7 +554,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter index 810bd5ae92d7a1..627b2c18d523bd 100644 --- a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter +++ b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -259,7 +276,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -275,12 +292,42 @@ cluster AccessControl = 31 { 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; @@ -316,17 +363,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -411,7 +482,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter index e2acfce11f40ba..67dbddaec37748 100644 --- a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter +++ b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -187,7 +204,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -203,12 +220,42 @@ cluster AccessControl = 31 { 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; @@ -244,17 +291,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -339,7 +410,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_pump_5f904818cc.matter b/examples/chef/devices/rootnode_pump_5f904818cc.matter index 39092cebbc1673..9a2c1905f3ec86 100644 --- a/examples/chef/devices/rootnode_pump_5f904818cc.matter +++ b/examples/chef/devices/rootnode_pump_5f904818cc.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -161,7 +178,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -177,12 +194,42 @@ cluster AccessControl = 31 { 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; @@ -218,17 +265,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -313,7 +384,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1271,6 +1342,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/chef/devices/rootnode_pump_5f904818cc.zap b/examples/chef/devices/rootnode_pump_5f904818cc.zap index c93cf13214ca17..f28d7cfbab317e 100644 --- a/examples/chef/devices/rootnode_pump_5f904818cc.zap +++ b/examples/chef/devices/rootnode_pump_5f904818cc.zap @@ -569,6 +569,22 @@ "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": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, diff --git a/examples/chef/devices/rootnode_pump_a811bb33a0.matter b/examples/chef/devices/rootnode_pump_a811bb33a0.matter index 9c465891d3343d..ee410b2a06de4c 100644 --- a/examples/chef/devices/rootnode_pump_a811bb33a0.matter +++ b/examples/chef/devices/rootnode_pump_a811bb33a0.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -161,7 +178,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -177,12 +194,42 @@ cluster AccessControl = 31 { 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; @@ -218,17 +265,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -313,7 +384,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1214,6 +1285,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/chef/devices/rootnode_pump_a811bb33a0.zap b/examples/chef/devices/rootnode_pump_a811bb33a0.zap index 6a68b8566319b4..6314e3fb0c2e3a 100644 --- a/examples/chef/devices/rootnode_pump_a811bb33a0.zap +++ b/examples/chef/devices/rootnode_pump_a811bb33a0.zap @@ -569,6 +569,22 @@ "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": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, diff --git a/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.matter b/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.matter index 27f4165cbb8140..7da74be02935b4 100644 --- a/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.matter +++ b/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter index 97cd5c65913b70..782bfe9c6e8371 100644 --- a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter +++ b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -166,7 +183,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -182,12 +199,42 @@ cluster AccessControl = 31 { 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; @@ -223,17 +270,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -318,7 +389,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter index 6c37c883be1909..77bff3c8eea1a3 100644 --- a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter +++ b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -238,7 +255,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -254,12 +271,42 @@ cluster AccessControl = 31 { 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; @@ -295,17 +342,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -390,7 +461,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1140,7 +1211,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -1207,7 +1279,6 @@ cluster Thermostat = 513 { kMatterScheduleConfiguration = 0x80; kPresets = 0x100; kSetpoints = 0x200; - kQueuedPresetsSupported = 0x400; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -1267,11 +1338,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -1305,11 +1371,6 @@ cluster Thermostat = 513 { PresetTypeFeaturesBitmap presetTypeFeatures = 2; } - struct QueuedPresetStruct { - nullable octet_string<16> presetHandle = 0; - nullable epoch_s transitionTimestamp = 1; - } - struct ScheduleTypeStruct { SystemModeEnum systemMode = 0; int8u numberOfSchedules = 1; @@ -1382,9 +1443,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; - readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1422,17 +1481,12 @@ cluster Thermostat = 513 { request struct SetActivePresetRequestRequest { octet_string<16> presetHandle = 0; - optional int16u delayMinutes = 1; } request struct StartPresetsSchedulesEditRequestRequest { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -1451,10 +1505,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command is sent to cancel a queued preset. */ - command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for controlling a fan in a heating/cooling system. */ diff --git a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.zap b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.zap index 6833a1a52bb222..f831de4d5d9a7c 100644 --- a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.zap +++ b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.zap @@ -17,13 +17,6 @@ } ], "package": [ - { - "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", - "category": "matter", - "version": "chip-v1" - }, { "pathRelativity": "relativeToZap", "path": "../../../src/app/zap-templates/zcl/zcl.json", @@ -31,13 +24,6 @@ "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": [ diff --git a/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.matter b/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.matter index 288b76c6d48dc0..ed06fdbadaf739 100644 --- a/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.matter +++ b/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -166,7 +183,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -182,12 +199,42 @@ cluster AccessControl = 31 { 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; @@ -223,17 +270,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -318,7 +389,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter index 6245e0efca2cfe..e5ba06a15048b2 100644 --- a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter +++ b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -125,7 +142,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -307,7 +324,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -323,12 +340,42 @@ cluster AccessControl = 31 { 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; @@ -364,17 +411,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -459,7 +530,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1686,7 +1757,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 0x1; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; diff --git a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.zap b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.zap index 03f05dae9248db..b766b72f319f87 100644 --- a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.zap +++ b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.zap @@ -2985,7 +2985,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter index b3fe19b27c738a..85b38d275b7802 100644 --- a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter +++ b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -187,7 +204,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -203,12 +220,42 @@ cluster AccessControl = 31 { 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; @@ -244,17 +291,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -339,7 +410,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter index f76b5208c97ceb..d532d09cd88569 100644 --- a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter +++ b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -187,7 +204,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -203,12 +220,42 @@ cluster AccessControl = 31 { 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; @@ -244,17 +291,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -339,7 +410,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1360,7 +1431,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -1427,7 +1499,6 @@ cluster Thermostat = 513 { kMatterScheduleConfiguration = 0x80; kPresets = 0x100; kSetpoints = 0x200; - kQueuedPresetsSupported = 0x400; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -1487,11 +1558,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -1525,11 +1591,6 @@ cluster Thermostat = 513 { PresetTypeFeaturesBitmap presetTypeFeatures = 2; } - struct QueuedPresetStruct { - nullable octet_string<16> presetHandle = 0; - nullable epoch_s transitionTimestamp = 1; - } - struct ScheduleTypeStruct { SystemModeEnum systemMode = 0; int8u numberOfSchedules = 1; @@ -1602,9 +1663,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; - readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1642,17 +1701,12 @@ cluster Thermostat = 513 { request struct SetActivePresetRequestRequest { octet_string<16> presetHandle = 0; - optional int16u delayMinutes = 1; } request struct StartPresetsSchedulesEditRequestRequest { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -1671,10 +1725,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command is sent to cancel a queued preset. */ - command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for controlling a fan in a heating/cooling system. */ diff --git a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter index a274c36636594a..f656ebddb7778a 100644 --- a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter +++ b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -187,7 +204,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -203,12 +220,42 @@ cluster AccessControl = 31 { 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; @@ -244,17 +291,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -339,7 +410,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/nrfconnect/CMakeLists.txt b/examples/chef/nrfconnect/CMakeLists.txt index 98f5cdeafdca75..081c510435c1e6 100644 --- a/examples/chef/nrfconnect/CMakeLists.txt +++ b/examples/chef/nrfconnect/CMakeLists.txt @@ -21,8 +21,6 @@ get_filename_component(CHEF ${CMAKE_CURRENT_SOURCE_DIR}/../ REALPATH) include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) -get_filename_component(GEN_DIR ${CHEF}/out/${SAMPLE_NAME}/zap-generated REALPATH) - set(CONF_FILE prj.conf) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -31,10 +29,6 @@ message(STATUS "Product ID " ${CONFIG_CHIP_DEVICE_PRODUCT_ID}) message(STATUS "Product Name " ${CONFIG_CHIP_DEVICE_PRODUCT_NAME}) message(STATUS "SW Version String" ${CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING}) -# Set Kconfig root files that will be processed as a first Kconfig for used child images. -set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root) -set(multiprotocol_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root) - list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.conf) @@ -43,8 +37,11 @@ endif() find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) +get_filename_component(GEN_DIR ${CHEF}/out/${CONFIG_CHEF_DEVICE_TYPE}/zap-generated REALPATH) + project(chip-nrfconnect-chef-example) +include(${CHIP_ROOT}/config/nrfconnect/app/check-sysbuild-use.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) @@ -107,10 +104,10 @@ target_sources(app PRIVATE ${CHEF}/nrfconnect/main.cpp ) -message(STATUS ${CHEF}/devices/${SAMPLE_NAME}.zap) +message(STATUS ${CHEF}/devices/${CONFIG_CHEF_DEVICE_TYPE}.zap) chip_configure_data_model(app INCLUDE_SERVER - ZAP_FILE ${CHEF}/devices/${SAMPLE_NAME}.zap + ZAP_FILE ${CHEF}/devices/${CONFIG_CHEF_DEVICE_TYPE}.zap ) include(${CHIP_ROOT}/config/nrfconnect/app/flashing.cmake) diff --git a/examples/chef/nrfconnect/Kconfig b/examples/chef/nrfconnect/Kconfig index 2b1125e68bbef6..f5ef9cd1aa1e2c 100644 --- a/examples/chef/nrfconnect/Kconfig +++ b/examples/chef/nrfconnect/Kconfig @@ -15,6 +15,12 @@ # mainmenu "Matter nRF Connect Chef Example Application" +config CHEF_DEVICE_TYPE + string "Chef app device type" + default "" + help + Specifies the device type used to generate data model for the chef app. It should be the string literal matching one of the file names located in the chef's devices directory. + rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults" rsource "../../../config/nrfconnect/chip-module/Kconfig.features" source "Kconfig.zephyr" diff --git a/examples/lit-icd-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf b/examples/chef/nrfconnect/Kconfig.sysbuild similarity index 60% rename from examples/lit-icd-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf rename to examples/chef/nrfconnect/Kconfig.sysbuild index 48deaa9fa18135..b3e964a82b5439 100644 --- a/examples/lit-icd-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf +++ b/examples/chef/nrfconnect/Kconfig.sysbuild @@ -14,12 +14,16 @@ # limitations under the License. # -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. +#### Radio core selection +config NRF_DEFAULT_IPC_RADIO + default y -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. +# Enable IEEE802.15.4 serialization to network core +config NETCORE_IPC_RADIO_IEEE802154 + default y if SOC_SERIES_NRF53X -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n +# Enable Bluetooth serialization to network core +config NETCORE_IPC_RADIO_BT_HCI_IPC + default y if SOC_SERIES_NRF53X + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/examples/chef/nrfconnect/README.md b/examples/chef/nrfconnect/README.md index 8e17340c92069b..ca59a609946baf 100644 --- a/examples/chef/nrfconnect/README.md +++ b/examples/chef/nrfconnect/README.md @@ -1,5 +1,21 @@ # CHIP nRF Connect SDK Shell Application +> **Note:** This example is intended only to perform smoke tests of a Matter +> solution integrated with nRF Connect SDK platform. The example quality is not +> production ready and it may contain minor bugs or use not optimal +> configuration. It is not recommended to use this example as a basis for +> creating a market ready product. +> +> For the production ready and optimized Matter samples, see +> [nRF Connect SDK samples](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/matter.html). +> The Matter samples in nRF Connect SDK use various additional software +> components and provide multiple optional features that improve the developer +> and user experience. To read more about it, see +> [Matter support in nRF Connect SDK](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/matter/index.html#ug-matter) +> page. Using Matter samples from nRF Connect SDK allows you to get a full +> Nordic technical support via [DevZone](https://devzone.nordicsemi.com/) +> portal. + A [chip-shell](../README.md) project for the Nordic nRF52840 and nRF5340 development kits, built using the nRF Connect SDK. diff --git a/examples/chef/nrfconnect/prj.conf b/examples/chef/nrfconnect/prj.conf index 03c7e188675c95..2f310436a50202 100644 --- a/examples/chef/nrfconnect/prj.conf +++ b/examples/chef/nrfconnect/prj.conf @@ -47,9 +47,13 @@ CONFIG_CHIP_PROJECT_CONFIG="CHIPProjectConfig.h" # 32773 == 0x8005 (example lighting-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 -# Enable CHIP pairing automatically on application start. +# Enable Matter pairing automatically on application start. CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Configure CHIP shell CONFIG_CHIP_LIB_SHELL=y CONFIG_OPENTHREAD_SHELL=y diff --git a/examples/chef/nrfconnect/sysbuild.conf b/examples/chef/nrfconnect/sysbuild.conf new file mode 100644 index 00000000000000..e63a92c6b2bbab --- /dev/null +++ b/examples/chef/nrfconnect/sysbuild.conf @@ -0,0 +1,18 @@ +# +# 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. +# + +SB_CONFIG_MATTER=y +SB_CONFIG_MATTER_OTA=n diff --git a/examples/chef/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf b/examples/chef/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf new file mode 100644 index 00000000000000..8540585e53358b --- /dev/null +++ b/examples/chef/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf @@ -0,0 +1,58 @@ +# +# 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. +# + +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# 802.15.4 configuration +CONFIG_NRF_802154_SER_RADIO=y +CONFIG_NRF_802154_ENCRYPTION=y +CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=2 + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_DEBUG_INFO=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y +CONFIG_IPC_RADIO_802154=y diff --git a/examples/chef/nrfconnect/sysbuild/ipc_radio/prj.conf b/examples/chef/nrfconnect/sysbuild/ipc_radio/prj.conf new file mode 100644 index 00000000000000..8906415dda4fc7 --- /dev/null +++ b/examples/chef/nrfconnect/sysbuild/ipc_radio/prj.conf @@ -0,0 +1,21 @@ +# +# 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. +# + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=n diff --git a/examples/chef/nrfconnect/sysbuild/ipc_radio/prj_release.conf b/examples/chef/nrfconnect/sysbuild/ipc_radio/prj_release.conf new file mode 100644 index 00000000000000..7f92a51630cce0 --- /dev/null +++ b/examples/chef/nrfconnect/sysbuild/ipc_radio/prj_release.conf @@ -0,0 +1,20 @@ +# +# 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. +# +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=y diff --git a/examples/chef/sample_app_util/test_files/sample_zap_file.zap b/examples/chef/sample_app_util/test_files/sample_zap_file.zap index 5dfd0fb28a9427..420eaa37ef5615 100644 --- a/examples/chef/sample_app_util/test_files/sample_zap_file.zap +++ b/examples/chef/sample_app_util/test_files/sample_zap_file.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 100, + "featureLevel": 102, "creator": "zap", "keyValuePairs": [ { @@ -29,6 +29,7 @@ "pathRelativity": "relativeToZap", "path": "../../../../src/app/zap-templates/app-templates.json", "type": "gen-templates-json", + "category": "matter", "version": "chip-v1" } ], @@ -4925,7 +4926,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/chip-tool/BUILD.gn b/examples/chip-tool/BUILD.gn index b5917f3bfaca62..94e1eebbde7508 100644 --- a/examples/chip-tool/BUILD.gn +++ b/examples/chip-tool/BUILD.gn @@ -109,6 +109,7 @@ static_library("chip-tool-utils") { "${chip_root}/src/app/tests/suites/commands/interaction_model", "${chip_root}/src/controller/data_model", "${chip_root}/src/credentials:file_attestation_trust_store", + "${chip_root}/src/credentials:test_dac_revocation_delegate", "${chip_root}/src/lib", "${chip_root}/src/lib/core:types", "${chip_root}/src/lib/support/jsontlv", diff --git a/examples/chip-tool/commands/clusters/CustomArgument.h b/examples/chip-tool/commands/clusters/CustomArgument.h index c7d81414659755..05da3a37936119 100644 --- a/examples/chip-tool/commands/clusters/CustomArgument.h +++ b/examples/chip-tool/commands/clusters/CustomArgument.h @@ -230,13 +230,7 @@ class CustomArgumentParser class CustomArgument { public: - ~CustomArgument() - { - if (mData != nullptr) - { - chip::Platform::MemoryFree(mData); - } - } + ~CustomArgument() { Reset(); } CHIP_ERROR Parse(const char * label, const char * json) { @@ -286,6 +280,15 @@ class CustomArgument return writer.CopyElement(tag, reader); } + void Reset() + { + if (mData != nullptr) + { + chip::Platform::MemoryFree(mData); + mData = nullptr; + } + } + // We trust our consumers to do the encoding of our data correctly, so don't // need to know whether we are being encoded for a write. static constexpr bool kIsFabricScoped = false; diff --git a/examples/chip-tool/commands/common/CHIPCommand.cpp b/examples/chip-tool/commands/common/CHIPCommand.cpp index 7e871f8e781e14..1c3df517bd89d0 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.cpp +++ b/examples/chip-tool/commands/common/CHIPCommand.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -48,7 +49,9 @@ constexpr chip::FabricId kIdentityOtherFabricId = 4; constexpr char kPAATrustStorePathVariable[] = "CHIPTOOL_PAA_TRUST_STORE_PATH"; constexpr char kCDTrustStorePathVariable[] = "CHIPTOOL_CD_TRUST_STORE_PATH"; -const chip::Credentials::AttestationTrustStore * CHIPCommand::sTrustStore = nullptr; +const chip::Credentials::AttestationTrustStore * CHIPCommand::sTrustStore = nullptr; +chip::Credentials::DeviceAttestationRevocationDelegate * CHIPCommand::sRevocationDelegate = nullptr; + chip::Credentials::GroupDataProviderImpl CHIPCommand::sGroupDataProvider{ kMaxGroupsPerFabric, kMaxGroupKeysPerFabric }; // All fabrics share the same ICD client storage. chip::app::DefaultICDClientStorage CHIPCommand::sICDClientStorage; @@ -87,6 +90,20 @@ CHIP_ERROR GetAttestationTrustStore(const char * paaTrustStorePath, const chip:: return CHIP_NO_ERROR; } +CHIP_ERROR GetAttestationRevocationDelegate(const char * revocationSetPath, + chip::Credentials::DeviceAttestationRevocationDelegate ** revocationDelegate) +{ + if (revocationSetPath == nullptr) + { + return CHIP_NO_ERROR; + } + + static chip::Credentials::TestDACRevocationDelegateImpl testDacRevocationDelegate; + ReturnErrorOnFailure(testDacRevocationDelegate.SetDeviceAttestationRevocationSetPath(revocationSetPath)); + *revocationDelegate = &testDacRevocationDelegate; + return CHIP_NO_ERROR; +} + } // namespace CHIP_ERROR CHIPCommand::MaybeSetUpStack() @@ -151,6 +168,8 @@ CHIP_ERROR CHIPCommand::MaybeSetUpStack() ReturnErrorOnFailure(GetAttestationTrustStore(mPaaTrustStorePath.ValueOr(nullptr), &sTrustStore)); + ReturnLogErrorOnFailure(GetAttestationRevocationDelegate(mDacRevocationSetPath.ValueOr(nullptr), &sRevocationDelegate)); + auto engine = chip::app::InteractionModelEngine::GetInstance(); VerifyOrReturnError(engine != nullptr, CHIP_ERROR_INCORRECT_STATE); ReturnLogErrorOnFailure(ChipToolCheckInDelegate()->Init(&sICDClientStorage, engine)); @@ -450,7 +469,7 @@ CHIP_ERROR CHIPCommand::InitializeCommissioner(CommissionerIdentity & identity, std::unique_ptr commissioner = std::make_unique(); chip::Controller::SetupParams commissionerParams; - ReturnLogErrorOnFailure(mCredIssuerCmds->SetupDeviceAttestation(commissionerParams, sTrustStore)); + ReturnLogErrorOnFailure(mCredIssuerCmds->SetupDeviceAttestation(commissionerParams, sTrustStore, sRevocationDelegate)); chip::Crypto::P256Keypair ephemeralKey; diff --git a/examples/chip-tool/commands/common/CHIPCommand.h b/examples/chip-tool/commands/common/CHIPCommand.h index 50ab851d284502..b48455ebed6821 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.h +++ b/examples/chip-tool/commands/common/CHIPCommand.h @@ -86,6 +86,10 @@ class CHIPCommand : public Command AddArgument("only-allow-trusted-cd-keys", 0, 1, &mOnlyAllowTrustedCdKeys, "Only allow trusted CD verifying keys (disallow test keys). If not provided or 0 (\"false\"), untrusted CD " "verifying keys are allowed. If 1 (\"true\"), test keys are disallowed."); + AddArgument("dac-revocation-set-path", &mDacRevocationSetPath, + "Path to JSON file containing the device attestation revocation set. " + "This argument caches the path to the revocation set. Once set, this will be used by all commands in " + "interactive mode."); #if CHIP_CONFIG_TRANSPORT_TRACE_ENABLED AddArgument("trace_file", &mTraceFile); AddArgument("trace_log", 0, 1, &mTraceLog); @@ -222,11 +226,16 @@ class CHIPCommand : public Command chip::Optional mCDTrustStorePath; chip::Optional mUseMaxSizedCerts; chip::Optional mOnlyAllowTrustedCdKeys; + chip::Optional mDacRevocationSetPath; // Cached trust store so commands other than the original startup command // can spin up commissioners as needed. static const chip::Credentials::AttestationTrustStore * sTrustStore; + // Cached DAC revocation delegate, this can be set using "--dac-revocation-set-path" argument + // Once set this will be used by all commands. + static chip::Credentials::DeviceAttestationRevocationDelegate * sRevocationDelegate; + static void RunQueuedCommand(intptr_t commandArg); typedef decltype(RunQueuedCommand) MatterWorkCallback; static void RunCommandCleanup(intptr_t commandArg); diff --git a/examples/chip-tool/commands/common/Command.cpp b/examples/chip-tool/commands/common/Command.cpp index 2c4f1eb3540e9f..82e9eedc461dd5 100644 --- a/examples/chip-tool/commands/common/Command.cpp +++ b/examples/chip-tool/commands/common/Command.cpp @@ -1069,6 +1069,11 @@ void Command::ResetArguments() auto vectorArgument = static_cast *>(arg.value); vectorArgument->clear(); } + else if (type == ArgumentType::Custom) + { + auto argument = static_cast(arg.value); + argument->Reset(); + } else if (type == ArgumentType::VectorCustom) { auto vectorArgument = static_cast *>(arg.value); diff --git a/examples/chip-tool/commands/common/CredentialIssuerCommands.h b/examples/chip-tool/commands/common/CredentialIssuerCommands.h index fd096b31835723..f8e225afec4c5e 100644 --- a/examples/chip-tool/commands/common/CredentialIssuerCommands.h +++ b/examples/chip-tool/commands/common/CredentialIssuerCommands.h @@ -57,10 +57,13 @@ class CredentialIssuerCommands * Verifier. * @param[in] trustStore A pointer to the PAA trust store to use to find valid PAA roots. * + * @param[in] revocationDelegate A pointer to the Device Attestation Revocation Delegate for checking revoked DACs and PAIs. + * * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error code. */ virtual CHIP_ERROR SetupDeviceAttestation(chip::Controller::SetupParams & setupParams, - const chip::Credentials::AttestationTrustStore * trustStore) = 0; + const chip::Credentials::AttestationTrustStore * trustStore, + chip::Credentials::DeviceAttestationRevocationDelegate * revocationDelegate) = 0; /** * @brief Add a list of additional non-default CD verifying keys (by certificate) diff --git a/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp b/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp index 9e4f29c5534757..294673512882b3 100644 --- a/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp +++ b/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp @@ -241,7 +241,8 @@ CHIP_ERROR LogDiscoveredNodeData(const chip::Dnssd::CommissionNodeData & nodeDat value["rotatingIdLen"] = static_cast(commissionData.rotatingIdLen); value["pairingHint"] = commissionData.pairingHint; value["pairingInstruction"] = commissionData.pairingInstruction; - value["supportsTcp"] = resolutionData.supportsTcp; + value["supportsTcpClient"] = resolutionData.supportsTcpClient; + value["supportsTcpServer"] = resolutionData.supportsTcpServer; value["port"] = resolutionData.port; value["numIPs"] = static_cast(resolutionData.numIPs); diff --git a/examples/chip-tool/commands/discover/Commands.h b/examples/chip-tool/commands/discover/Commands.h index e7a59dbaee9110..d308d4ab75b430 100644 --- a/examples/chip-tool/commands/discover/Commands.h +++ b/examples/chip-tool/commands/discover/Commands.h @@ -53,7 +53,8 @@ class Resolve : public DiscoverCommand, public chip::AddressResolve::NodeListene result.mrpRemoteConfig.mIdleRetransTimeout.count()); ChipLogProgress(chipTool, " MRP retry interval (active): %" PRIu32 "ms", result.mrpRemoteConfig.mActiveRetransTimeout.count()); - ChipLogProgress(chipTool, " Supports TCP: %s", result.supportsTcp ? "yes" : "no"); + ChipLogProgress(chipTool, " Supports TCP Client: %s", result.supportsTcpClient ? "yes" : "no"); + ChipLogProgress(chipTool, " Supports TCP Server: %s", result.supportsTcpServer ? "yes" : "no"); ChipLogProgress(chipTool, " ICD is operating as: %s", result.isICDOperatingAsLIT ? "LIT" : "SIT"); SetCommandExitStatus(CHIP_NO_ERROR); } diff --git a/examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h b/examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h index a23b45eae10627..495ae8d7a544d6 100644 --- a/examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h +++ b/examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h @@ -34,16 +34,18 @@ class ExampleCredentialIssuerCommands : public CredentialIssuerCommands return mOpCredsIssuer.Initialize(storage); } CHIP_ERROR SetupDeviceAttestation(chip::Controller::SetupParams & setupParams, - const chip::Credentials::AttestationTrustStore * trustStore) override + const chip::Credentials::AttestationTrustStore * trustStore, + chip::Credentials::DeviceAttestationRevocationDelegate * revocationDelegate) override { chip::Credentials::SetDeviceAttestationCredentialsProvider(chip::Credentials::Examples::GetExampleDACProvider()); - mDacVerifier = chip::Credentials::GetDefaultDACVerifier(trustStore); + mDacVerifier = chip::Credentials::GetDefaultDACVerifier(trustStore, revocationDelegate); setupParams.deviceAttestationVerifier = mDacVerifier; mDacVerifier->EnableCdTestKeySupport(mAllowTestCdSigningKey); return CHIP_NO_ERROR; } + chip::Controller::OperationalCredentialsDelegate * GetCredentialIssuer() override { return &mOpCredsIssuer; } void SetCredentialIssuerCATValues(chip::CATValues cats) override { mOpCredsIssuer.SetCATValuesForNextNOCRequest(cats); } CHIP_ERROR GenerateControllerNOCChain(chip::NodeId nodeId, chip::FabricId fabricId, const chip::CATValues & cats, diff --git a/examples/chip-tool/commands/pairing/Commands.h b/examples/chip-tool/commands/pairing/Commands.h index 41a35bb6bae6ad..c202178657df7b 100644 --- a/examples/chip-tool/commands/pairing/Commands.h +++ b/examples/chip-tool/commands/pairing/Commands.h @@ -181,6 +181,16 @@ class PairSoftAP : public PairingCommand {} }; +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +class PairWiFiPAF : public PairingCommand +{ +public: + PairWiFiPAF(CredentialIssuerCommands * credsIssuerConfig) : + PairingCommand("wifipaf-wifi", PairingMode::WiFiPAF, PairingNetworkType::WiFi, credsIssuerConfig) + {} +}; +#endif + class PairAlreadyDiscovered : public PairingCommand { public: @@ -243,6 +253,9 @@ void registerCommandsPairing(Commands & commands, CredentialIssuerCommands * cre make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + make_unique(credsIssuerConfig), +#endif make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), diff --git a/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.cpp b/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.cpp index 3d4c296e7864fb..bc80e568b2bd7f 100644 --- a/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.cpp +++ b/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.cpp @@ -34,10 +34,14 @@ CHIP_ERROR OpenCommissioningWindowCommand::RunCommand() if (mCommissioningWindowOption == Controller::CommissioningWindowOpener::CommissioningWindowOption::kTokenWithRandomPIN) { SetupPayload ignored; - return mWindowOpener->OpenCommissioningWindow(mNodeId, System::Clock::Seconds16(mCommissioningWindowTimeout), mIteration, - mDiscriminator, NullOptional, NullOptional, - &mOnOpenCommissioningWindowCallback, ignored, - /* readVIDPIDAttributes */ true); + return mWindowOpener->OpenCommissioningWindow(Controller::CommissioningWindowPasscodeParams() + .SetNodeId(mNodeId) + .SetTimeout(mCommissioningWindowTimeout) + .SetIteration(mIteration) + .SetDiscriminator(mDiscriminator) + .SetReadVIDPIDAttributes(true) + .SetCallback(&mOnOpenCommissioningWindowCallback), + ignored); } ChipLogError(chipTool, "Unknown commissioning window option: %d", to_underlying(mCommissioningWindowOption)); diff --git a/examples/chip-tool/commands/pairing/PairingCommand.cpp b/examples/chip-tool/commands/pairing/PairingCommand.cpp index 35ce2ba1cc7aaa..245c9ed57ff82c 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.cpp +++ b/examples/chip-tool/commands/pairing/PairingCommand.cpp @@ -80,6 +80,11 @@ CHIP_ERROR PairingCommand::RunInternal(NodeId remoteId) case PairingMode::SoftAP: err = Pair(remoteId, PeerAddress::UDP(mRemoteAddr.address, mRemotePort, mRemoteAddr.interfaceId)); break; +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + case PairingMode::WiFiPAF: + err = Pair(remoteId, PeerAddress::WiFiPAF(remoteId)); + break; +#endif case PairingMode::AlreadyDiscovered: err = Pair(remoteId, PeerAddress::UDP(mRemoteAddr.address, mRemotePort, mRemoteAddr.interfaceId)); break; diff --git a/examples/chip-tool/commands/pairing/PairingCommand.h b/examples/chip-tool/commands/pairing/PairingCommand.h index 0cf4e1de2de713..9965b663ec111c 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.h +++ b/examples/chip-tool/commands/pairing/PairingCommand.h @@ -35,6 +35,9 @@ enum class PairingMode CodePaseOnly, Ble, SoftAP, +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + WiFiPAF, +#endif AlreadyDiscovered, AlreadyDiscoveredByIndex, AlreadyDiscoveredByIndexWithCode, @@ -127,6 +130,13 @@ class PairingCommand : public CHIPCommand, AddArgument("device-remote-port", 0, UINT16_MAX, &mRemotePort); AddArgument("pase-only", 0, 1, &mPaseOnly); break; +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + case PairingMode::WiFiPAF: + AddArgument("skip-commissioning-complete", 0, 1, &mSkipCommissioningComplete); + AddArgument("setup-pin-code", 0, 134217727, &mSetupPINCode.emplace()); + AddArgument("discriminator", 0, 4096, &mDiscriminator.emplace()); + break; +#endif case PairingMode::AlreadyDiscovered: AddArgument("skip-commissioning-complete", 0, 1, &mSkipCommissioningComplete); AddArgument("setup-pin-code", 0, 134217727, &mSetupPINCode.emplace()); diff --git a/examples/chip-tool/commands/payload/SetupPayloadParseCommand.cpp b/examples/chip-tool/commands/payload/SetupPayloadParseCommand.cpp index 7ab62c7da5101d..de1afad1835385 100644 --- a/examples/chip-tool/commands/payload/SetupPayloadParseCommand.cpp +++ b/examples/chip-tool/commands/payload/SetupPayloadParseCommand.cpp @@ -108,6 +108,14 @@ CHIP_ERROR SetupPayloadParseCommand::Print(chip::SetupPayload payload) } humanFlags.Add("On IP network"); } + if (payload.rendezvousInformation.Value().Has(RendezvousInformationFlag::kWiFiPAF)) + { + if (!humanFlags.Empty()) + { + humanFlags.Add(", "); + } + humanFlags.Add("Wi-Fi PAF"); + } } else { diff --git a/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/decoder.py b/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/decoder.py index cd77147fff40d6..68effa7bb30dbc 100644 --- a/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/decoder.py +++ b/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/decoder.py @@ -322,7 +322,7 @@ def run(self, specs, value, cluster_name: str, typename: str, array: bool): provided_field_name = provided_field_name[0].lower( ) + provided_field_name[1:] - if provided_field_name in value and provided_field_name != field_name: + if provided_field_name in value: value[field_name] = self.run( specs, value[provided_field_name], @@ -330,7 +330,8 @@ def run(self, specs, value, cluster_name: str, typename: str, array: bool): field_type, field_array ) - del value[provided_field_name] + if provided_field_name != field_name: + del value[provided_field_name] if specs.is_fabric_scoped(struct): if _FABRIC_INDEX_FIELD_CODE in value: diff --git a/examples/chip-tool/templates/ComplexArgumentParser-src.zapt b/examples/chip-tool/templates/ComplexArgumentParser-src.zapt index f9b0f4bef764c5..a5e757b227f581 100644 --- a/examples/chip-tool/templates/ComplexArgumentParser-src.zapt +++ b/examples/chip-tool/templates/ComplexArgumentParser-src.zapt @@ -5,6 +5,8 @@ {{#zcl_structs}} {{#if has_more_than_one_cluster}} {{> struct_parser_impl namespace="detail"}} +{{else if has_no_clusters}} +{{> struct_parser_impl namespace="Globals"}} {{/if}} {{/zcl_structs}} diff --git a/examples/chip-tool/templates/ComplexArgumentParser.zapt b/examples/chip-tool/templates/ComplexArgumentParser.zapt index 7364b243188333..58cc5046dd5178 100644 --- a/examples/chip-tool/templates/ComplexArgumentParser.zapt +++ b/examples/chip-tool/templates/ComplexArgumentParser.zapt @@ -8,6 +8,8 @@ {{#zcl_structs}} {{#if has_more_than_one_cluster}} {{> struct_parser_decl namespace="detail"}} +{{else if has_no_clusters}} +{{> struct_parser_decl namespace="Globals"}} {{/if}} {{/zcl_structs}} diff --git a/examples/chip-tool/templates/logging/DataModelLogger-src.zapt b/examples/chip-tool/templates/logging/DataModelLogger-src.zapt index 167021f49577d2..0f41ff2e16b96a 100644 --- a/examples/chip-tool/templates/logging/DataModelLogger-src.zapt +++ b/examples/chip-tool/templates/logging/DataModelLogger-src.zapt @@ -7,6 +7,8 @@ using namespace chip::app::Clusters; {{#zcl_structs}} {{#if has_more_than_one_cluster}} {{> struct_logger_impl namespace="detail"}} +{{else if has_no_clusters}} +{{> struct_logger_impl namespace="Globals"}} {{/if}} {{/zcl_structs}} diff --git a/examples/chip-tool/templates/logging/DataModelLogger.zapt b/examples/chip-tool/templates/logging/DataModelLogger.zapt index befe9d4210ce07..97818566b43af5 100644 --- a/examples/chip-tool/templates/logging/DataModelLogger.zapt +++ b/examples/chip-tool/templates/logging/DataModelLogger.zapt @@ -6,6 +6,8 @@ {{#zcl_structs}} {{#if has_more_than_one_cluster}} {{> struct_logger_decl namespace="detail"}} +{{else if has_no_clusters}} +{{> struct_logger_decl namespace="Globals"}} {{/if}} {{/zcl_structs}} diff --git a/examples/common/m5stack-tft/repo b/examples/common/m5stack-tft/repo index d99f5ef8df180a..a6299b6c7c0b2e 160000 --- a/examples/common/m5stack-tft/repo +++ b/examples/common/m5stack-tft/repo @@ -1 +1 @@ -Subproject commit d99f5ef8df180ab34b3d9fff6888d5bede7665c5 +Subproject commit a6299b6c7c0b2e3eb62fa08ee4bf7155c39bad1f diff --git a/examples/common/pigweed/BUILD.gn b/examples/common/pigweed/BUILD.gn index e523bea380c03f..6252f86e637890 100644 --- a/examples/common/pigweed/BUILD.gn +++ b/examples/common/pigweed/BUILD.gn @@ -82,6 +82,7 @@ pw_proto_library("button_service") { pw_proto_library("fabric_admin_service") { sources = [ "protos/fabric_admin_service.proto" ] + inputs = [ "protos/fabric_admin_service.options" ] deps = [ "$dir_pw_protobuf:common_protos" ] strip_prefix = "protos" prefix = "fabric_admin_service" diff --git a/examples/common/pigweed/protos/fabric_admin_service.options b/examples/common/pigweed/protos/fabric_admin_service.options new file mode 100644 index 00000000000000..9a65ae8a2b61d1 --- /dev/null +++ b/examples/common/pigweed/protos/fabric_admin_service.options @@ -0,0 +1,2 @@ +chip.rpc.DeviceCommissioningWindowInfo.verifier max_size:97 // kSpake2p_VerifierSerialized_Length +chip.rpc.DeviceCommissioningWindowInfo.salt max_size:32 // kSpake2p_Max_PBKDF_Salt_Length diff --git a/examples/common/pigweed/protos/fabric_admin_service.proto b/examples/common/pigweed/protos/fabric_admin_service.proto index e52fd2951ac0d7..7f6ec4f4995b12 100644 --- a/examples/common/pigweed/protos/fabric_admin_service.proto +++ b/examples/common/pigweed/protos/fabric_admin_service.proto @@ -5,8 +5,13 @@ import 'pw_protobuf_protos/common.proto'; package chip.rpc; // Define the message for a synchronized end device with necessary fields -message DeviceInfo { +message DeviceCommissioningWindowInfo { uint64 node_id = 1; + uint32 commissioning_timeout = 2; + uint32 discriminator = 3; + uint32 iterations = 4; + bytes salt = 5; + bytes verifier = 6; } // Define the response message to convey the status of the operation @@ -15,6 +20,5 @@ message OperationStatus { } service FabricAdmin { - rpc OpenCommissioningWindow(DeviceInfo) returns (OperationStatus){} + rpc OpenCommissioningWindow(DeviceCommissioningWindowInfo) returns (OperationStatus){} } - diff --git a/examples/common/pigweed/rpc_services/FabricAdmin.h b/examples/common/pigweed/rpc_services/FabricAdmin.h index 5254b9e9054a0c..14de9d50f60673 100644 --- a/examples/common/pigweed/rpc_services/FabricAdmin.h +++ b/examples/common/pigweed/rpc_services/FabricAdmin.h @@ -34,7 +34,8 @@ class FabricAdmin : public pw_rpc::nanopb::FabricAdmin::Service public: virtual ~FabricAdmin() = default; - virtual pw::Status OpenCommissioningWindow(const chip_rpc_DeviceInfo & request, chip_rpc_OperationStatus & response) + virtual pw::Status OpenCommissioningWindow(const chip_rpc_DeviceCommissioningWindowInfo & request, + chip_rpc_OperationStatus & response) { return pw::Status::Unimplemented(); } diff --git a/examples/common/tracing/decoder/logging/ToCertificateString.cpp b/examples/common/tracing/decoder/logging/ToCertificateString.cpp index 423544a9cc2a0c..1abd27ef788c59 100644 --- a/examples/common/tracing/decoder/logging/ToCertificateString.cpp +++ b/examples/common/tracing/decoder/logging/ToCertificateString.cpp @@ -35,7 +35,7 @@ const char * ToCertificate(const chip::ByteSpan & source, chip::MutableCharSpan { // Reset the buffer memset(destination.data(), '\0', destination.size()); - + int snprintf_len = 0; if (source.size() == 0) { return destination.data(); @@ -70,7 +70,8 @@ const char * ToCertificate(const chip::ByteSpan & source, chip::MutableCharSpan ChipLogError(DataManagement, "Certificate size is greater than 400 bytes"); } - snprintf(destination.data(), destination.size(), "%s", str.Get()); + snprintf_len = snprintf(destination.data(), destination.size(), "%s", str.Get()); + VerifyOrExit(snprintf_len >= 0, ChipLogError(DataManagement, "Failed to write certificate");); } else { @@ -83,15 +84,23 @@ const char * ToCertificate(const chip::ByteSpan & source, chip::MutableCharSpan size_t inIndex = 0; size_t outIndex = strlen(header) + 1; - snprintf(destination.data(), destination.size(), "%s\n", header); + snprintf_len = snprintf(destination.data(), destination.size(), "%s\n", header); + VerifyOrExit(snprintf_len >= 0, ChipLogError(DataManagement, "Failed to write header");); for (; inIndex < base64DataLen; inIndex += 64) { - auto charsPrinted = snprintf(&destination.data()[outIndex], destination.size() - outIndex, "%.64s\n", &str[inIndex]); - outIndex += static_cast(charsPrinted); + snprintf_len = snprintf(&destination.data()[outIndex], destination.size() - outIndex, "%.64s\n", &str[inIndex]); + VerifyOrExit(snprintf_len >= 0, ChipLogError(DataManagement, "Failed to write certificate");); + + outIndex += static_cast(snprintf_len); } - snprintf(&destination.data()[outIndex], destination.size() - outIndex, "%s", footer); + snprintf_len = snprintf(&destination.data()[outIndex], destination.size() - outIndex, "%s", footer); + VerifyOrExit(snprintf_len >= 0, ChipLogError(DataManagement, "Failed to write footer");); + } +exit: + if (snprintf_len < 0) + { + memset(destination.data(), '\0', destination.size()); } - return destination.data(); } diff --git a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter index 9b1e4ba906ea19..e112e8f2e73671 100644 --- a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter +++ b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -166,7 +183,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -182,12 +199,42 @@ cluster AccessControl = 31 { 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; @@ -223,17 +270,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -318,7 +389,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/README.md b/examples/contact-sensor-app/nxp/k32w/k32w0/README.md index 5785c1143671d1..ac418ecbd4aa77 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/README.md +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/README.md @@ -14,36 +14,42 @@ network.
-- [CHIP K32W0 Contact Sensor Example Application](#chip-k32w061-contact-sensor-example-application) -- [Introduction](#introduction) - - [Bluetooth LE Advertising](#bluetooth-le-advertising) - - [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous) -- [Device UI](#device-ui) -- [Building](#building) - - [Overwrite board config files](#overwrite-board-config-files) - - [Known issues building](#known-issues-building) -- [Long Idle Time ICD Support](#long-idle-time-icd-support) -- [Manufacturing data](#manufacturing-data) -- [Flashing and debugging](#flashing-and-debugging) -- [Pigweed Tokenizer](#pigweed-tokenizer) - - [Detokenizer script](#detokenizer-script) - - [Notes](#notes) - - [Known issues tokenizer](#known-issues-tokenizer) -- [NXP Ultrafast P256 ECC Library](#nxp-ultrafast-p256-ecc-library) - - [Building steps](#building-steps) -- [Tinycrypt ECC library](#tinycrypt-ecc-library) - - [Building steps](#building-steps-1) -- [OTA](#ota) - - [Writing the SSBL](#writing-the-ssbl) - - [Writing the PSECT](#writing-the-psect) - - [Writing the application](#writing-the-application) - - [OTA Testing](#ota-testing) - - [Known issues ota](#known-issues-ota) -- [Low power](#low-power) - - [Known issues low power](#known-issues-low-power) -- [Removing SSBL Upgrade region](#removing-ssbl-upgrade-region) - - +- [CHIP K32W061 Contact Sensor Example Application](#chip-k32w061-contact-sensor-example-application) + - [Introduction](#introduction) + - [SE051H Secure Element](#se051h-secure-element) + - [Bluetooth LE Advertising](#bluetooth-le-advertising) + - [LIT ICD Active Mode](#lit-icd-active-mode) + - [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous) + - [Thread Provisioning](#thread-provisioning) + - [Device UI](#device-ui) + - [No expansion board](#no-expansion-board) + - [Building](#building) + - [Long Idle Time ICD Support](#long-idle-time-icd-support) + - [Overwrite board config files](#overwrite-board-config-files) + - [Known issues building](#known-issues-building) + - [Rotating device id](#rotating-device-id) + - [Manufacturing data](#manufacturing-data) + - [Flashing and debugging](#flashing-and-debugging) + - [Pigweed tokenizer](#pigweed-tokenizer) + - [Detokenizer script](#detokenizer-script) + - [Notes](#notes) + - [Known issues tokenizer](#known-issues-tokenizer) + - [NXP Ultrafast P256 ECC Library](#nxp-ultrafast-p256-ecc-library) + - [Building steps](#building-steps) + - [Tinycrypt ECC library](#tinycrypt-ecc-library) + - [Building steps](#building-steps-1) + - [OTA](#ota) + - [Writing the SSBL](#writing-the-ssbl) + - [Features](#features) + - [Multi image](#multi-image) + - [Simple hash verification](#simple-hash-verification) + - [Writing the PSECT](#writing-the-psect) + - [Writing the application](#writing-the-application) + - [OTA Testing](#ota-testing) + - [Known issues ota](#known-issues-ota) + - [Low power](#low-power) + - [Known issues low power](#known-issues-low-power) + - [Removing SSBL Upgrade Region](#removing-ssbl-upgrade-region) ## Introduction @@ -179,44 +185,47 @@ contact status. ## Building In order to build the Project CHIP example, we recommend using a Linux -distribution (the demo-application was compiled on Ubuntu 20.04). +distribution (supported Operating Systems are listed in +[BUILDING.md](../../../../../docs/guides/BUILDING.md#tested-operating systems)). -Activate the Matter environment: +- Make sure that below prerequisites are correctly installed (as described in + [BUILDING.md](../../../../../docs/guides/BUILDING.md#prerequisites))) -```bash -user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh +``` +sudo apt-get install git gcc g++ pkg-config libssl-dev libdbus-1-dev \ + libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev \ + python3-pip unzip libgirepository1.0-dev libcairo2-dev libreadline-dev ``` -To bring the SDK in the environment, the user can: +- Step 1: checkout NXP specific submodules only -- download it with west tool, in which case it will be handled automatically - by gn: +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ scripts/checkout_submodules.py --shallow --platform nxp --recursive +``` - ```bash - user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo - user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west init -l manifest --mf west.yml - user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west update - ``` +- Step 2: activate local environment - In case there are local modification to the already installed github NXP - SDK, use the below `west forall` command instead of the `west init` command - to reset the west workspace. Warning: all local changes will be lost after - running this command. +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ source scripts/activate.sh +``` - ```bash - user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo - user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west forall -c "git reset --hard && git clean -xdf" -a - ``` +If the script says the environment is out of date, you can update it by running +the following command: -- set up a custom path to the SDK, in which case - `k32w0_sdk_root=\"${NXP_K32W0_SDK_ROOT}\"` must be added to the `gn gen` - command: +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ source scripts/bootstrap.sh +``` - ``` - user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W0_SDK_ROOT=/custom/path/to/SDK - ``` +- Step 3: Init NXP SDK(s) -Start building the application: +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ scripts/setup/nxp/update_nxp_sdk.py --platform k32w0 +``` + +Note: By default setup/nxp/update_nxp_sdk.py will try to initialize all NXP +SDKs. Arg "-- help" could be used to view all available options. + +- Start building the application: ```bash user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/contact-sensor-app/nxp/k32w/k32w0 @@ -721,9 +730,14 @@ Please see more in the Here is an example that generates an OTA image with application update TLV: ``` -./scripts/tools/nxp/ota/ota_image_tool.py create -v 0xDEAD -p 0xBEEF -vn 42021 -vs "1.0" -da sha256 --app-input-file chip-k32w0x-contact-example.bin chip-k32w0x-contact-example.ota +./scripts/tools/nxp/ota/ota_image_tool.py create -v 0xDEAD -p 0xBEEF -vn 2 -vs "2.0" -da sha256 --enc_enable --input_ota_key "1234567890ABCDEFA1B2C3D4E5F6F1B4" --app-input-file chip-k32w0x-contact-example.bin chip-k32w0x-contact-example.ota ``` +Please note the two options `--enc_enable` and `--input_ota_key`, which are +mandatory when `chip_with_ota_encryption=1`. The value of `--input_ota_key` must +match the value of `chip_with_ota_key`. See `args.gni` for the default gn +configuration. + A note regarding OTA image header version (`-vn` option). An application binary has its own software version, given by `CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION` (`42020` by default), which can be diff --git a/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter b/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter index 9bffee1c83dce2..32f653289ae444 100644 --- a/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter +++ b/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1313,7 +1384,7 @@ cluster BooleanState = 69 { /** Allows servers to ensure that listed clients are notified when a server is available for communication. */ cluster IcdManagement = 70 { - revision 2; + revision 3; enum ClientTypeEnum : enum8 { kPermanent = 0; @@ -1329,6 +1400,7 @@ cluster IcdManagement = 70 { kCheckInProtocolSupport = 0x1; kUserActiveModeTrigger = 0x2; kLongIdleTimeSupport = 0x4; + kDynamicSitLitSupport = 0x8; } bitmap UserActiveModeTriggerBitmap : bitmap32 { @@ -1367,6 +1439,7 @@ cluster IcdManagement = 70 { 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; @@ -1452,6 +1525,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; @@ -1705,7 +1779,7 @@ endpoint 0 { callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0x0007; - ram attribute clusterRevision default = 2; + ram attribute clusterRevision default = 3; handle command RegisterClient; handle command RegisterClientResponse; diff --git a/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.zap b/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.zap index 90183a0e214f94..83c1526403104e 100644 --- a/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.zap +++ b/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.zap @@ -553,6 +553,22 @@ "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": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, @@ -3818,7 +3834,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter b/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter index 70cae9e994c4fd..ae2e6ea4b7b0eb 100644 --- a/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter +++ b/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1313,7 +1384,7 @@ cluster BooleanState = 69 { /** Allows servers to ensure that listed clients are notified when a server is available for communication. */ cluster IcdManagement = 70 { - revision 2; + revision 3; enum ClientTypeEnum : enum8 { kPermanent = 0; @@ -1329,6 +1400,7 @@ cluster IcdManagement = 70 { kCheckInProtocolSupport = 0x1; kUserActiveModeTrigger = 0x2; kLongIdleTimeSupport = 0x4; + kDynamicSitLitSupport = 0x8; } bitmap UserActiveModeTriggerBitmap : bitmap32 { @@ -1367,6 +1439,7 @@ cluster IcdManagement = 70 { 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; @@ -1452,6 +1525,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; @@ -1699,7 +1773,7 @@ endpoint 0 { callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0x0000; - ram attribute clusterRevision default = 2; + ram attribute clusterRevision default = 3; } } endpoint 1 { diff --git a/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.zap b/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.zap index c8607e299d782c..ae00575abd3592 100644 --- a/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.zap +++ b/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.zap @@ -553,6 +553,22 @@ "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": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, @@ -3680,7 +3696,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/contact-sensor-app/telink/README.md b/examples/contact-sensor-app/telink/README.md index 964b05a76ba109..cbceff71361ccf 100755 --- a/examples/contact-sensor-app/telink/README.md +++ b/examples/contact-sensor-app/telink/README.md @@ -4,6 +4,17 @@ You can use this example as a reference for creating your own application. ![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) +## Supported devices + +The example supports building and running on the following devices: + +| Board/SoC | Build target | Zephyr Board Info | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| [B91](https://wiki.telink-semi.cn/wiki/Hardware/B91_Generic_Starter_Kit_Hardware_Guide) [TLSR9518ADK80D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series) | `tlsr9518adk80d`, `tlsr9518adk80d-mars`, `tlsr9518adk80d-usb` | [TLSR9518ADK80D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9518adk80d/doc/index.rst) | +| [B92](https://wiki.telink-semi.cn/wiki/Hardware/B92_Generic_Starter_Kit_Hardware_Guide) [TLSR9528A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR952x-Series) | `tlsr9528a`, `tlsr9528a_retention` | [TLSR9528A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9528a/doc/index.rst) | +| [B95](https://wiki.telink-semi.cn/wiki/Hardware/B95_Generic_Starter_Kit_Hardware_Guide) [TLSR9258A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR925x-Series) | `tlsr9258a` | [TLSR9258A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9258a/doc/index.rst) | +| [W91](https://wiki.telink-semi.cn/wiki/Hardware/W91_Generic_Starter_Kit_Hardware_Guide) [TLSR9118BDK40D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR911x-Series) | `tlsr9118bdk40d` | [TLSR9118BDK40D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9118bdk40d/doc/index.rst) | + ## Build and flash 1. Run the Docker container: @@ -12,7 +23,7 @@ You can use this example as a reference for creating your own application. $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}') ``` - Compatible docker image version can be found in next file: + You can find the compatible Docker image version in the file: ```bash $ .github/workflows/examples-telink.yaml @@ -24,8 +35,8 @@ You can use this example as a reference for creating your own application. $ source ./scripts/activate.sh -p all,telink ``` -3. In the example dir run (replace __ with your board name, for - example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`): +3. Build the example (replace __ with your board name, see + [Supported devices](#supported-devices)): ```bash $ west build -b @@ -35,9 +46,12 @@ You can use this example as a reference for creating your own application. MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=4m`: ```bash - $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + $ west build -b -- -DFLASH_SIZE=4m ``` + You can find the target built file called **_zephyr.bin_** under the + **_build/zephyr_** directory. + 4. Flash binary: ``` @@ -56,16 +70,18 @@ To get output from device, connect UART to following pins: | TX | PB2 (pin 16 of J34 connector) | | GND | GND | +Baud rate: 115200 bits/s + ### Buttons The following buttons are available on **tlsr9518adk80d** board: -| Name | Function | Description | -| :------- | :--------------------- | :----------------------------------------------------------------------------------------------------- | -| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and back to uncommissioned state | -| Button 2 | Toggle Contact State | Manually triggers the Contact Sensor State | -| Button 3 | NA | NA | -| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | +| Name | Function | Description | +| :------- | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and return to a decommissioned state (to activate, push the button 3 times) | +| Button 2 | Toggle Contact State | Manually triggers the Contact Sensor State | +| Button 3 | NA | NA | +| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | ### LEDs diff --git a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h index 7dc5b848e22324..6cb580ded9c35f 100644 --- a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h +++ b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h @@ -39,7 +39,7 @@ class CHIPCommandBridge : public Command { { AddArgument("commissioner-name", &mCommissionerName); AddArgument("commissioner-nodeId", 0, UINT64_MAX, &mCommissionerNodeId, - "Sets the commisser node ID of the given " + "Sets the commissioner node ID of the given " "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("paa-trust-store-path", &mPaaTrustStorePath, diff --git a/examples/darwin-framework-tool/commands/pairing/DeviceControllerDelegateBridge.mm b/examples/darwin-framework-tool/commands/pairing/DeviceControllerDelegateBridge.mm index 9723199ed007a4..52f0fd4bb10a17 100644 --- a/examples/darwin-framework-tool/commands/pairing/DeviceControllerDelegateBridge.mm +++ b/examples/darwin-framework-tool/commands/pairing/DeviceControllerDelegateBridge.mm @@ -36,7 +36,7 @@ - (void)controller:(MTRDeviceController *)controller statusUpdate:(MTRCommission ChipLogError(chipTool, "MTRCommissioningStatusDiscoveringMoreDevices: This should not happen."); break; case MTRCommissioningStatusUnknown: - ChipLogError(chipTool, "Uknown Pairing Status"); + ChipLogError(chipTool, "Unknown Pairing Status"); break; } } diff --git a/examples/dishwasher-app/dishwasher-common/dishwasher-app.matter b/examples/dishwasher-app/dishwasher-common/dishwasher-app.matter index eb98a004051f5c..d118b44aed0ac1 100644 --- a/examples/dishwasher-app/dishwasher-common/dishwasher-app.matter +++ b/examples/dishwasher-app/dishwasher-common/dishwasher-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -187,7 +204,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -203,12 +220,42 @@ cluster AccessControl = 31 { 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; @@ -244,17 +291,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -339,7 +410,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/energy-management-app/energy-management-common/BUILD.gn b/examples/energy-management-app/energy-management-common/BUILD.gn index 937aca9f1746d0..e6b67461f40a3b 100644 --- a/examples/energy-management-app/energy-management-common/BUILD.gn +++ b/examples/energy-management-app/energy-management-common/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2023-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. diff --git a/examples/energy-management-app/energy-management-common/energy-management-app.matter b/examples/energy-management-app/energy-management-common/energy-management-app.matter index a5c23df3301be4..99512288265038 100644 --- a/examples/energy-management-app/energy-management-common/energy-management-app.matter +++ b/examples/energy-management-app/energy-management-common/energy-management-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1651,7 +1722,7 @@ provisional cluster DeviceEnergyManagement = 152 { /** Electric Vehicle Supply Equipment (EVSE) is equipment used to charge an Electric Vehicle (EV) or Plug-In Hybrid Electric Vehicle. This cluster provides an interface to the functionality of Electric Vehicle Supply Equipment (EVSE) management. */ cluster EnergyEvse = 153 { - revision 2; + revision 4; enum EnergyTransferStoppedReasonEnum : enum8 { kEVStopped = 0; @@ -1695,6 +1766,7 @@ cluster EnergyEvse = 153 { kDischargingEnabled = 2; kDisabledError = 3; kDisabledDiagnostics = 4; + kEnabled = 5; } bitmap Feature : bitmap32 { @@ -1742,6 +1814,7 @@ cluster EnergyEvse = 153 { int32u sessionID = 0; StateEnum state = 1; amperage_ma maximumCurrent = 2; + optional amperage_ma maximumDischargeCurrent = 3; } info event EnergyTransferStopped = 3 { @@ -1749,6 +1822,7 @@ cluster EnergyEvse = 153 { StateEnum state = 1; EnergyTransferStoppedReasonEnum reason = 2; energy_mwh energyTransferred = 4; + optional energy_mwh energyDischarged = 5; } critical event Fault = 4 { @@ -1813,15 +1887,15 @@ cluster EnergyEvse = 153 { /** Allows a client to disable the EVSE from charging and discharging. */ timed command Disable(): DefaultSuccess = 1; - /** Allows a client to enable the EVSE to charge an EV. */ + /** This command allows a client to enable the EVSE to charge an EV, */ timed command EnableCharging(EnableChargingRequest): DefaultSuccess = 2; - /** Allows a client to enable the EVSE to discharge an EV. */ + /** Upon receipt, this SHALL allow a client to enable the discharge of an EV, */ timed command EnableDischarging(EnableDischargingRequest): DefaultSuccess = 3; /** Allows a client to put the EVSE into a self-diagnostics mode. */ timed command StartDiagnostics(): DefaultSuccess = 4; /** Allows a client to set the user specified charging targets. */ timed command SetTargets(SetTargetsRequest): DefaultSuccess = 5; - /** Allows a client to retrieve the user specified charging targets. */ + /** Allows a client to retrieve the current set of charging targets. */ timed command GetTargets(): GetTargetsResponse = 6; /** Allows a client to clear all stored charging targets. */ timed command ClearTargets(): DefaultSuccess = 7; @@ -1993,6 +2067,7 @@ endpoint 0 { callback attribute softwareVersion; callback attribute softwareVersionString; callback attribute serialNumber; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; @@ -2327,6 +2402,8 @@ endpoint 1 { server cluster EnergyEvseMode { callback attribute supportedModes; callback attribute currentMode; + ram attribute startUpMode; + ram attribute onMode; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; @@ -2341,6 +2418,8 @@ endpoint 1 { server cluster DeviceEnergyManagementMode { callback attribute supportedModes; callback attribute currentMode; + ram attribute startUpMode; + ram attribute onMode; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; diff --git a/examples/energy-management-app/energy-management-common/energy-management-app.zap b/examples/energy-management-app/energy-management-common/energy-management-app.zap index 57ae22f51c9aab..566588ab8e4d0d 100644 --- a/examples/energy-management-app/energy-management-common/energy-management-app.zap +++ b/examples/energy-management-app/energy-management-common/energy-management-app.zap @@ -617,6 +617,22 @@ "maxInterval": 65534, "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": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, @@ -4663,6 +4679,38 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "StartUpMode", + "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": "OnMode", + "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": "GeneratedCommandList", "code": 65528, @@ -4820,6 +4868,38 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "StartUpMode", + "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": "OnMode", + "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": "GeneratedCommandList", "code": 65528, diff --git a/examples/energy-management-app/energy-management-common/include/ChargingTargetsMemMgr.h b/examples/energy-management-app/energy-management-common/include/ChargingTargetsMemMgr.h new file mode 100644 index 00000000000000..66009cdd84ca0e --- /dev/null +++ b/examples/energy-management-app/energy-management-common/include/ChargingTargetsMemMgr.h @@ -0,0 +1,156 @@ +/* + * + * 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 + +namespace chip { +namespace app { +namespace Clusters { +namespace EnergyEvse { + +/* + * The full Target data structure defined as: + * + * DataModel::List chargingTargetSchedules; + * + * contains a list of ChargingTargetScheduleStructs which in turn contains a list of ChargingTargetStructs. + * This means that somewhere the following memory needs to be allocated in the case where + * the Target is at its maximum size: + * + * ChargingTargetStruct::Type mDailyChargingTargets[kEvseTargetsMaxNumberOfDays][kEvseTargetsMaxTargetsPerDay] + * + * This is 1680B. + * + * However it is likely the number of chargingTargets configured will be considerably less. To avoid + * allocating the maximum possible Target size, each List is allocated + * separately. This class handles that allocation. + * + * When iterating through the chargingTargetSchedules, an index in this list is kept and the + * ChargingTargetsMemMgr::PrepareDaySchedule must be called so this object knows which day schedule it is tracking. + * This will free any previous memory allocated for the day schedule in this object. + * + * There are then three usage cases: + * + * 1. When loading the Target from persistent storage. In this scenario, it is not known upfront + * how many chargingTargets are associated with this day schedule so ChargingTargetsMemMgr::AddChargingTarget() + * needs to be called as each individual chargingTarget is loaded from persistent data. + * + * Once the chargingTargets for the day schedule have been loaded, ChargingTargetsMemMgr::AllocAndCopy() is + * called to allocate the memory to store the chargingTargets and the chargingTargets are copied. + * + * 2. When updating a Target and a day schedule is unaffected, the chargingTargets associated with + * day schedule need copying. The following should be called: + * + * ChargingTargetsMemMgr::AllocAndCopy(const DataModel::List & chargingTargets) + * + * 3. When in SetTargets, a new list of chargingTargets needs to be added to a day schedule, the following + * should be called: + * + * ChargingTargetsMemMgr::AllocAndCopy(const DataModel::DecodableList & + * chargingTargets) + * + * Having allocated and copied the chargingTargets accordingly, they can be added to a + * DataModel::List(ChargingTargetsMemMgr::GetChargingTargets(), + * ChargingTargetsMemMgr::GetNumDailyChargingTargets()); + * + * All memory allocated by this object is released When the ChargingTargetsMemMgr destructor is called. + * + */ + +class ChargingTargetsMemMgr +{ +public: + ChargingTargetsMemMgr(); + ~ChargingTargetsMemMgr(); + + /** + * @brief This method prepares a new day schedule. Subsequent calls to GetChargingTargets + * and the AllocAndCopy methods below will reference this day schedule. + * + * @param chargingTargetSchedulesIdx - The new day schedule index + */ + void PrepareDaySchedule(uint16_t chargingTargetSchedulesIdx); + + /** + * @brief Called as each individual chargingTarget is loaded from persistent data. + * When loading the Target from persistent storage, it is not known upfront + * how many chargingTargets are associated with this day schedule so + * ChargingTargetsMemMgr::AddChargingTarget() needs to be called as each individual + * chargingTarget is loaded from persistent data. + * + * @param chargingTarget - The chargingTarget that will be added into the current day schedule + */ + void AddChargingTarget(const EnergyEvse::Structs::ChargingTargetStruct::Type & chargingTarget); + + /** + * @brief Called to allocate and copy the chargingTargets added via AddChargingTarget into the + * current day schedule as set by PrepareDaySchedule(). + */ + CHIP_ERROR AllocAndCopy(); + + /** + * @brief Called to allocate and copy the chargingTargets into the current day schedule as set + * set by PrepareDaySchedule(). + * If an attempt is made to add more than kEvseTargetsMaxTargetsPerDay chargingTargets + * for the current day schedule, then the chargingTarget is not added and an error message + * is printed. + * + * @param chargingTargets - The chargingTargets to add into the current day schedule + */ + CHIP_ERROR AllocAndCopy(const DataModel::List & chargingTargets); + + /** + * @brief Called to allocate and copy the chargingTargets into the current day schedule as set + * set by PrepareDaySchedule(). + * + * @param chargingTargets - The chargingTargets to add into the current day schedule + */ + CHIP_ERROR AllocAndCopy(const DataModel::DecodableList & chargingTargets); + + /** + * @brief Returns the list of chargingTargets associated with the current day schedule. + * + * @return The charging targets associated with the current day schedule. + */ + EnergyEvse::Structs::ChargingTargetStruct::Type * GetChargingTargets() const; + + /** + * @brief Returns the number of chargingTargets associated with current day schedule. + * + * @return Returns the number of chargingTargets associated with current day schedule. + */ + uint16_t GetNumDailyChargingTargets() const; + +private: + EnergyEvse::Structs::ChargingTargetStruct::Type * mpListOfDays[kEvseTargetsMaxNumberOfDays]; + EnergyEvse::Structs::ChargingTargetStruct::Type mDailyChargingTargets[kEvseTargetsMaxTargetsPerDay]; + uint16_t mChargingTargetSchedulesIdx; + uint16_t mNumDailyChargingTargets; +}; + +} // namespace EnergyEvse +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/energy-management-app/energy-management-common/include/DEMManufacturerDelegate.h b/examples/energy-management-app/energy-management-common/include/DEMManufacturerDelegate.h new file mode 100644 index 00000000000000..65d214d31904ab --- /dev/null +++ b/examples/energy-management-app/energy-management-common/include/DEMManufacturerDelegate.h @@ -0,0 +1,88 @@ +/* + * + * 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 DeviceEnergyManagement { + +/** + * Class to abstract manufacturer specific functionality + */ +class DEMManufacturerDelegate +{ +public: + DEMManufacturerDelegate() {} + + virtual ~DEMManufacturerDelegate() {} + + // The PowerAdjustEnd event needs to report the approximate energy used by the ESA during the session. + virtual int64_t GetApproxEnergyDuringSession() = 0; + + virtual CHIP_ERROR HandleDeviceEnergyManagementPowerAdjustRequest(const int64_t powerMw, const uint32_t durationS, + AdjustmentCauseEnum cause) + { + return CHIP_NO_ERROR; + } + + virtual CHIP_ERROR HandleDeviceEnergyManagementPowerAdjustCompletion() { return CHIP_NO_ERROR; } + + virtual CHIP_ERROR HandleDeviceEnergyManagementCancelPowerAdjustRequest(CauseEnum cause) { return CHIP_NO_ERROR; } + + virtual CHIP_ERROR HandleDeviceEnergyManagementStartTimeAdjustRequest(const uint32_t requestedStartTimeUtc, + AdjustmentCauseEnum cause) + { + return CHIP_NO_ERROR; + } + + virtual CHIP_ERROR HandleDeviceEnergyManagementPauseRequest(const uint32_t durationS, AdjustmentCauseEnum cause) + { + return CHIP_NO_ERROR; + } + + virtual CHIP_ERROR HandleDeviceEnergyManagementPauseCompletion() { return CHIP_NO_ERROR; } + + virtual CHIP_ERROR HandleDeviceEnergyManagementCancelPauseRequest(CauseEnum cause) { return CHIP_NO_ERROR; } + + virtual CHIP_ERROR HandleDeviceEnergyManagementCancelRequest() { return CHIP_NO_ERROR; } + + virtual CHIP_ERROR + HandleModifyForecastRequest(const uint32_t forecastID, + const DataModel::DecodableList & slotAdjustments, + AdjustmentCauseEnum cause) + { + return CHIP_NO_ERROR; + } + + virtual CHIP_ERROR RequestConstraintBasedForecast( + const DataModel::DecodableList & constraints, + AdjustmentCauseEnum cause) + { + return CHIP_NO_ERROR; + } +}; + +} // namespace DeviceEnergyManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h index 1248fc405a3c8a..e540d56e030058 100644 --- a/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,12 +18,10 @@ #pragma once -#include "app/clusters/device-energy-management-server/device-energy-management-server.h" - +#include +#include #include -#include -using chip::Protocols::InteractionModel::Status; namespace chip { namespace app { namespace Clusters { @@ -35,52 +33,267 @@ namespace DeviceEnergyManagement { class DeviceEnergyManagementDelegate : public DeviceEnergyManagement::Delegate { public: - virtual Status PowerAdjustRequest(const int64_t power, const uint32_t duration, AdjustmentCauseEnum cause) override; - virtual Status CancelPowerAdjustRequest() override; - virtual Status StartTimeAdjustRequest(const uint32_t requestedStartTime, AdjustmentCauseEnum cause) override; - virtual Status PauseRequest(const uint32_t duration, AdjustmentCauseEnum cause) override; - virtual Status ResumeRequest() override; - virtual Status - ModifyForecastRequest(const uint32_t forecastId, + DeviceEnergyManagementDelegate(); + + void SetDeviceEnergyManagementInstance(DeviceEnergyManagement::Instance & instance); + + void SetDEMManufacturerDelegate(DEMManufacturerDelegate & deviceEnergyManagementManufacturerDelegate); + + /** + * + * Implement the DeviceEnergyManagement::Delegate interface + * + */ + + /** + * @brief Implements a handler to begin to adjust client power + * consumption/generation to the level requested. + * + * Note callers must call GetPowerAdjustmentCapability and ensure the return value is not null + * before calling PowerAdjustRequest. + * + * @param power Milli-Watts the ESA SHALL use during the adjustment period. + * @param duration The duration that the ESA SHALL maintain the requested power for. + * @return Success if the adjustment is accepted; otherwise the command SHALL be rejected with appropriate error. + */ + chip::Protocols::InteractionModel::Status PowerAdjustRequest(const int64_t powerMw, const uint32_t durationS, + AdjustmentCauseEnum cause) override; + + /** + * @brief Make the ESA end the active power adjustment session & return to normal (or idle) power levels. + * The ESA SHALL also generate an PowerAdjustEnd Event and the ESAState SHALL be restored to Online. + * + * @return It should report SUCCESS if successful and FAILURE otherwise. + */ + chip::Protocols::InteractionModel::Status CancelPowerAdjustRequest() override; + + /** + * @brief The ESA SHALL update its Forecast attribute with the RequestedStartTime including a new ForecastID. + * + * If the ESA supports ForecastAdjustment, and the ESAState is not UserOptOut and the RequestedStartTime is after + * the EarliestStartTime and the resulting EndTime is before the LatestEndTime, then ESA SHALL accept the request + * to modify the Start Time. + * A client can estimate the entire Forecast sequence duration by computing the EndTime - StartTime fields from the + * Forecast attribute, and therefore avoid scheduling the start time too late. + * + * @param requestedStartTime The requested start time in UTC that the client would like the appliance to shift its power + * forecast to. + * @param cause Who (Grid/local) is triggering this change. + * + * @return Success if the StartTime in the Forecast is updated, otherwise the command SHALL be rejected with appropriate + * IM_Status. + */ + chip::Protocols::InteractionModel::Status StartTimeAdjustRequest(const uint32_t requestedStartTimeUtc, + AdjustmentCauseEnum cause) override; + + /** + * @brief Handler for PauseRequest command + * + * If the ESA supports FA and the SlotIsPauseable field is true in the ActiveSlotNumber + * index in the Slots list, and the ESAState is not UserOptOut then the ESA SHALL allow its current + * operation to be Paused. + * + * During this state the ESA SHALL not consume or produce significant power (other than required to keep its + * basic control system operational). + * + * @param duration Duration that the ESA SHALL be paused for. + * @return Success if the ESA is paused, otherwise returns other IM_Status. + */ + chip::Protocols::InteractionModel::Status PauseRequest(const uint32_t durationS, AdjustmentCauseEnum cause) override; + + /** + * @brief Handler for ResumeRequest command + * + * If the ESA supports FA and it is currently Paused then the ESA SHALL resume its operation. + * The ESA SHALL also generate a Resumed Event and the ESAState SHALL be updated accordingly to + * reflect its current state. + * + * @return Success if the ESA is resumed, otherwise returns other IM_Status. + */ + chip::Protocols::InteractionModel::Status ResumeRequest() override; + + /** + * @brief Handler for ModifyForecastRequest + * + * If the ESA supports FA, and the ESAState is not UserOptOut it SHALL attempt to adjust its power forecast. + * This allows a one or more modifications in a single command by sending a list of modifications (one for each 'slot'). + * Attempts to modify slots which have already past, SHALL result in the entire command being rejected. + * If the ESA accepts the requested Forecast then it SHALL update its Forecast attribute (incrementing its ForecastID) + * and run the revised Forecast as its new intended operation. + * + * *** NOTE *** for the memory management of the forecast object, see the comment before the mForecast delaration below. + * + * @param forecastID Indicates the ESA ForecastID that is to be modified. + * @param slotAdjustments List of adjustments to be applied to the ESA, corresponding to the expected ESA forecastID. + * @return Success if the entire list of SlotAdjustmentStruct are accepted, otherwise the command + * SHALL be rejected returning other IM_Status. + */ + chip::Protocols::InteractionModel::Status + ModifyForecastRequest(const uint32_t forecastID, const DataModel::DecodableList & slotAdjustments, AdjustmentCauseEnum cause) override; - virtual Status + + /** + * @brief Handler for RequestConstraintBasedForecast + * + * The ESA SHALL inspect the requested power limits to ensure that there are no overlapping elements. The ESA + * manufacturer may also reject the request if it could cause the user’s preferences to be breached (e.g. may + * cause the home to be too hot or too cold, or a battery to be insufficiently charged). + * If the ESA can meet the requested power limits, it SHALL regenerate a new Power Forecast with a new ForecastID. + * + * @param constraints Sequence of turn up/down power requests that the ESA is being asked to constrain its operation within. + * @return Success if successful, otherwise the command SHALL be rejected returning other IM_Status. + */ + chip::Protocols::InteractionModel::Status RequestConstraintBasedForecast(const DataModel::DecodableList & constraints, AdjustmentCauseEnum cause) override; - virtual Status CancelRequest() override; + + /** + * @brief Handler for CancelRequest + * + * The ESA SHALL attempt to cancel the effects of any previous adjustment request commands, and re-evaluate its + * forecast for intended operation ignoring those previous requests. + * + * If the ESA ForecastStruct ForecastUpdateReason was already `Internal Optimization`, then the command SHALL + * be rejected with FAILURE. + * + * If the command is accepted, the ESA SHALL update its ESAState if required, and the command status returned + * SHALL be SUCCESS. + * + * The ESA SHALL update its Forecast attribute to match its new intended operation, and update the + * ForecastStruct.ForecastUpdateReason to `Internal Optimization` + * + * @return Success if successful, otherwise the command SHALL be rejected returning other IM_Status. + */ + chip::Protocols::InteractionModel::Status CancelRequest() override; // ------------------------------------------------------------------ - // Get attribute methods - virtual ESATypeEnum GetESAType() override; - virtual bool GetESACanGenerate() override; - virtual ESAStateEnum GetESAState() override; - virtual int64_t GetAbsMinPower() override; - virtual int64_t GetAbsMaxPower() override; - virtual Attributes::PowerAdjustmentCapability::TypeInfo::Type GetPowerAdjustmentCapability() override; - virtual DataModel::Nullable GetForecast() override; - virtual OptOutStateEnum GetOptOutState() override; + // Overridden DeviceEnergyManagement::Delegate Get attribute methods + + ESATypeEnum GetESAType() override; + bool GetESACanGenerate() override; + ESAStateEnum GetESAState() override; + int64_t GetAbsMinPower() override; + int64_t GetAbsMaxPower() override; + const DataModel::Nullable & GetPowerAdjustmentCapability() override; + const DataModel::Nullable & GetForecast() override; + OptOutStateEnum GetOptOutState() override; // ------------------------------------------------------------------ - // Set attribute methods - virtual CHIP_ERROR SetESAType(ESATypeEnum) override; - virtual CHIP_ERROR SetESACanGenerate(bool) override; - virtual CHIP_ERROR SetESAState(ESAStateEnum) override; - virtual CHIP_ERROR SetAbsMinPower(int64_t) override; - virtual CHIP_ERROR SetAbsMaxPower(int64_t) override; - virtual CHIP_ERROR SetPowerAdjustmentCapability(Attributes::PowerAdjustmentCapability::TypeInfo::Type) override; - virtual CHIP_ERROR SetForecast(DataModel::Nullable) override; - virtual CHIP_ERROR SetOptOutState(OptOutStateEnum) override; + // Overridden DeviceEnergyManagement::Delegate Set attribute methods + CHIP_ERROR SetESAState(ESAStateEnum) override; + + // Local Set methods + CHIP_ERROR SetESAType(ESATypeEnum); + CHIP_ERROR SetESACanGenerate(bool); + CHIP_ERROR SetAbsMinPower(int64_t); + CHIP_ERROR SetAbsMaxPower(int64_t); + CHIP_ERROR SetPowerAdjustmentCapability(const DataModel::Nullable &); + + // The DeviceEnergyManagementDelegate owns the master copy of the ForecastStruct object which is accessed via GetForecast and + // SetForecast. The slots field of forecast is owned and managed by the object that implements the DEMManufacturerDelegate + // interface. The slots memory MUST exist for the lifetime of the forecast object from where it is referenced. + // + // The rationale for this is as follows: + // It is envisioned there will be one master forecast object declared in DeviceEnergyManagementDelegate. When + // constructed, the field DataModel::List slots will be empty. + // + // The EVSEManufacturerImpl class (examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h) is + // an example implementation that a specific vendor can use as a template. It understands how the underlying energy appliance + // functions. EVSEManufacturerImpl inherits from DEMManufacturerDelegate + // (examples/energy-management-app/energy-management-common/include/DEMManufacturerDelegate.h) which is a generic interface + // and how the DeviceEnergyManagementDelegate class + // (examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp) communicates from the + // generic cluster world to the specific appliance implementation (EVSEManufacturerImpl). + // + // EVSEManufacturerImpl understands the slot structures of the appliance and configures the slot structures as follows: + // + // Call DeviceEnergyManagementDelegate::GetForecast() to get the current forecast + // Modify the slot structure - the slots memory is owned by EVSEManufacturerImpl + // Call DeviceEnergyManagementDelegate::GetForecast() to set the current forecast + // + // + // The cluster object DeviceEnergyManagement::Instance + // (src/app/clusters/device-energy-management-server/device-energy-management-server.cpp) only reads the slots field of + // forecast when checking commands (indeed it does not modify any forecast fields itself). The DeviceEnergyManagementDelegate + // object does modify some of forecast's fields but does NOT modify the slots field. The only command that can modify the + // slots field is HandleModifyForecastRequest. Whilst DeviceEnergyManagementDelegate::ModifyForecastRequest does some state + // checking, the slots field is only modified by the EVSEManufacturerImpl object via the call + // DEMManufacturerDelegate::HandleModifyForecastRequest. DEMManufacturerDelegate::HandleModifyForecastRequest may + // delete/allocate the slots memory but this will be done atomically in the call to + // DEMManufacturerDelegate::HandleModifyForecastRequest so the underlying memory is coherent => the call to + // DEMManufacturerDelegate::HandleModifyForecastRequest cannot be interrupted by any other CHIP task activity. + CHIP_ERROR SetForecast(const DataModel::Nullable &); + + CHIP_ERROR SetOptOutState(OptOutStateEnum); + + // Returns whether the DeviceEnergyManagement is supported + uint32_t HasFeature(Feature feature) const; private: + /** + * @brief Handle a PowerAdjustRequest failing + * + * Cleans up the PowerAdjust state should the request fail + */ + void HandlePowerAdjustRequestFailure(); + + // Methods to handle when a PowerAdjustment completes + static void PowerAdjustTimerExpiry(System::Layer * systemLayer, void * delegate); + void HandlePowerAdjustTimerExpiry(); + + // Method to cancel a PowerAdjustment + CHIP_ERROR CancelPowerAdjustRequestAndGenerateEvent(CauseEnum cause); + + // Method to generate a PowerAdjustEnd event + CHIP_ERROR GeneratePowerAdjustEndEvent(CauseEnum cause); + + /** + * @brief Handle a PauseRequest failing + * + * Cleans up the state should the PauseRequest fail + */ + void HandlePauseRequestFailure(); + + // Methods to handle when a PauseRequest completes + static void PauseRequestTimerExpiry(System::Layer * systemLayer, void * delegate); + void HandlePauseRequestTimerExpiry(); + + // Method to cancel a PauseRequest + CHIP_ERROR CancelPauseRequestAndGenerateEvent(CauseEnum cause); + + // Method to generate a Paused event + CHIP_ERROR GenerateResumedEvent(CauseEnum cause); + +private: + // Have a pointer to partner instance object + DeviceEnergyManagement::Instance * mpDEMInstance; + + // The DEMManufacturerDelegate object knows how to handle + // manufacturer/product specific operations + DEMManufacturerDelegate * mpDEMManufacturerDelegate; + + // Various attributes ESATypeEnum mEsaType; bool mEsaCanGenerate; ESAStateEnum mEsaState; - int64_t mAbsMinPower; - int64_t mAbsMaxPower; - Attributes::PowerAdjustmentCapability::TypeInfo::Type mPowerAdjustmentCapability; + int64_t mAbsMinPowerMw; + int64_t mAbsMaxPowerMw; + OptOutStateEnum mOptOutState; + + DataModel::Nullable mPowerAdjustCapabilityStruct; + + // See note above on SetForecast() about mForecast memory management DataModel::Nullable mForecast; - // Default to NoOptOut - OptOutStateEnum mOptOutState = OptOutStateEnum::kNoOptOut; + + // Keep track whether a PowerAdjustment is in progress + bool mPowerAdjustmentInProgress; + + // Keep track of when that PowerAdjustment started + uint32_t mPowerAdjustmentStartTimeUtc; + + // Keep track whether a PauseRequest is in progress + bool mPauseRequestInProgress; }; } // namespace DeviceEnergyManagement diff --git a/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementManager.h b/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementManager.h index aec875ff0d1f99..b7ae4565656ff3 100644 --- a/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementManager.h +++ b/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementManager.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include @@ -28,14 +27,11 @@ namespace app { namespace Clusters { using namespace chip::app::Clusters::DeviceEnergyManagement; + class DeviceEnergyManagementManager : public Instance { public: - DeviceEnergyManagementManager(EndpointId aEndpointId, DeviceEnergyManagementDelegate & aDelegate, Feature aFeature) : - DeviceEnergyManagement::Instance(aEndpointId, aDelegate, aFeature) - { - mDelegate = &aDelegate; - } + DeviceEnergyManagementManager(EndpointId aEndpointId, DeviceEnergyManagementDelegate & aDelegate, Feature aFeature); // Delete copy constructor and assignment operator. DeviceEnergyManagementManager(const DeviceEnergyManagementManager &) = delete; diff --git a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h index 7d288809952ee3..4cbee2a6b7ca9f 100644 --- a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h +++ b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h b/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h index 23994e7f5d9454..b94220d11b28f3 100644 --- a/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,6 +18,7 @@ #pragma once +#include #include #include #include @@ -33,20 +34,24 @@ namespace EnergyEvse { * The EVSEManufacturer example class */ -class EVSEManufacturer +class EVSEManufacturer : public DEMManufacturerDelegate { public: EVSEManufacturer(EnergyEvseManager * aEvseInstance, ElectricalPowerMeasurement::ElectricalPowerMeasurementInstance * aEPMInstance, - PowerTopology::PowerTopologyInstance * aPTInstance) + PowerTopology::PowerTopologyInstance * aPTInstance, DeviceEnergyManagementManager * aDEMInstance) { mEvseInstance = aEvseInstance; mEPMInstance = aEPMInstance; mPTInstance = aPTInstance; + mDEMInstance = aDEMInstance; } + + virtual ~EVSEManufacturer() {} + EnergyEvseManager * GetEvseInstance() { return mEvseInstance; } + ElectricalPowerMeasurement::ElectricalPowerMeasurementInstance * GetEPMInstance() { return mEPMInstance; } - PowerTopology::PowerTopologyInstance * GetPTInstance() { return mPTInstance; } EnergyEvseDelegate * GetEvseDelegate() { @@ -75,6 +80,40 @@ class EVSEManufacturer return nullptr; } + DeviceEnergyManagementDelegate * GetDEMDelegate() + { + if (mDEMInstance) + { + return mDEMInstance->GetDelegate(); + } + return nullptr; + } + + /** + * + * Implement the DEMManufacturerDelegate interface + * + */ + // The PowerAdjustEnd event needs to report the approximate energy used by the ESA during the session. + int64_t GetApproxEnergyDuringSession() override; + CHIP_ERROR HandleDeviceEnergyManagementPowerAdjustRequest(const int64_t powerMw, const uint32_t durationS, + AdjustmentCauseEnum cause) override; + CHIP_ERROR HandleDeviceEnergyManagementPowerAdjustCompletion() override; + CHIP_ERROR HandleDeviceEnergyManagementCancelPowerAdjustRequest(CauseEnum cause) override; + CHIP_ERROR HandleDeviceEnergyManagementStartTimeAdjustRequest(const uint32_t requestedStartTime, + AdjustmentCauseEnum cause) override; + CHIP_ERROR HandleDeviceEnergyManagementPauseRequest(const uint32_t durationS, AdjustmentCauseEnum cause) override; + CHIP_ERROR HandleDeviceEnergyManagementPauseCompletion() override; + CHIP_ERROR HandleDeviceEnergyManagementCancelPauseRequest(CauseEnum cause) override; + CHIP_ERROR HandleDeviceEnergyManagementCancelRequest() override; + CHIP_ERROR HandleModifyForecastRequest( + const uint32_t forecastID, + const DataModel::DecodableList & slotAdjustments, + AdjustmentCauseEnum cause) override; + CHIP_ERROR RequestConstraintBasedForecast( + const DataModel::DecodableList & constraints, + AdjustmentCauseEnum cause) override; + /** * @brief Called at start up to apply hardware settings */ @@ -90,6 +129,12 @@ class EVSEManufacturer */ static void ApplicationCallbackHandler(const EVSECbInfo * cb, intptr_t arg); + /** + * @brief Simple example to demonstrate how an EVSE can compute the start time + * and duration of a charging schedule + */ + CHIP_ERROR ComputeChargingSchedule(); + /** * @brief Allows a client application to initialise the Accuracy, Measurement types etc */ @@ -172,6 +217,7 @@ class EVSEManufacturer EnergyEvseManager * mEvseInstance; ElectricalPowerMeasurement::ElectricalPowerMeasurementInstance * mEPMInstance; PowerTopology::PowerTopologyInstance * mPTInstance; + DeviceEnergyManagementManager * mDEMInstance; int64_t mLastChargingEnergyMeter = 0; int64_t mLastDischargingEnergyMeter = 0; diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index df0d08b76f7e4e..c43707d9d09589 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,24 +20,22 @@ #include "app/clusters/energy-evse-server/energy-evse-server.h" #include +#include #include #include using chip::Protocols::InteractionModel::Status; -/** - * @brief Helper function to get current timestamp in Epoch format - * - * @param chipEpoch reference to hold return timestamp - */ -CHIP_ERROR GetEpochTS(uint32_t & chipEpoch); - namespace chip { namespace app { namespace Clusters { namespace EnergyEvse { +// A bitmap of all possible days (the union of the values in +// chip::app::Clusters::EnergyEvse::TargetDayOfWeekBitmap) +constexpr uint8_t kAllTargetDaysMask = 0x7f; + /* Local state machine Events to allow simpler handling of state transitions */ enum EVSEStateMachineEvent { @@ -107,8 +105,11 @@ class EvseSession class EnergyEvseDelegate : public EnergyEvse::Delegate { public: + EnergyEvseDelegate(EvseTargetsDelegate & aDelegate) : EnergyEvse::Delegate() { mEvseTargetsDelegate = &aDelegate; } ~EnergyEvseDelegate(); + EvseTargetsDelegate * GetEvseTargetsDelegate() { return mEvseTargetsDelegate; } + /** * @brief Called when EVSE cluster receives Disable command */ @@ -138,6 +139,37 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate */ Status StartDiagnostics() override; + /** + * @brief Called when EVSE cluster receives the SetTargets command + */ + Status SetTargets( + const DataModel::DecodableList & chargingTargetSchedules) override; + + /** + * @brief Delegate should implement a handler for LoadTargets + * + * This needs to load any stored targets into memory and MUST be called before + * GetTargets is called. + */ + Status LoadTargets() override; + + /** + * @brief Called when EVSE cluster receives the GetTargets command + * + * NOTE: LoadTargets MUST be called GetTargets is called. + */ + Protocols::InteractionModel::Status + GetTargets(DataModel::List & chargingTargetSchedules) override; + + /** + * @brief Called when EVSE cluster receives ClearTargets command + */ + Status ClearTargets() override; + + /* Helper functions for managing targets*/ + Status + ValidateTargets(const DataModel::DecodableList & chargingTargetSchedules); + /** * @brief Called by EVSE Hardware to register a single callback handler */ @@ -160,6 +192,12 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate */ Status ScheduleCheckOnEnabledTimeout(); + /** + * @brief Helper function to get know if the EV is plugged in based on state + * (regardless of if it is actually transferring energy) + */ + bool IsEvsePluggedIn(); + // ----------------------------------------------------------------- // Internal API to allow an EVSE to change its internal state etc Status HwSetMaxHardwareCurrentLimit(int64_t currentmA); @@ -216,9 +254,16 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate /* PREF attributes */ DataModel::Nullable GetNextChargeStartTime() override; + CHIP_ERROR SetNextChargeStartTime(DataModel::Nullable newNextChargeStartTimeUtc); + DataModel::Nullable GetNextChargeTargetTime() override; + CHIP_ERROR SetNextChargeTargetTime(DataModel::Nullable newNextChargeTargetTimeUtc); + DataModel::Nullable GetNextChargeRequiredEnergy() override; + CHIP_ERROR SetNextChargeRequiredEnergy(DataModel::Nullable newNextChargeRequiredEnergyMilliWattH); + DataModel::Nullable GetNextChargeTargetSoC() override; + CHIP_ERROR SetNextChargeTargetSoC(DataModel::Nullable newValue); DataModel::Nullable GetApproximateEVEfficiency() override; CHIP_ERROR SetApproximateEVEfficiency(DataModel::Nullable) override; @@ -236,11 +281,11 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate private: /* Constants */ - static constexpr int kDefaultMinChargeCurrent = 6000; /* 6A */ - static constexpr int kDefaultUserMaximumChargeCurrent = kMaximumChargeCurrent; /* 80A */ - static constexpr int kDefaultRandomizationDelayWindow = 600; /* 600s */ - static constexpr int kMaxVehicleIDBufSize = 32; - static constexpr int kPeriodicCheckIntervalRealTimeClockNotSynced = 30; + static constexpr int kDefaultMinChargeCurrent_mA = 6000; /* 6A */ + static constexpr int kDefaultUserMaximumChargeCurrent_mA = 80000; /* 80A */ + static constexpr int kDefaultRandomizationDelayWindow_sec = 600; /* 600s */ + static constexpr int kMaxVehicleIDBufSize = 32; + static constexpr int kPeriodicCheckIntervalRealTimeClockNotSynced_sec = 30; /* private variables for controlling the hardware - these are not attributes */ int64_t mMaxHardwareCurrentLimit = 0; /* Hardware current limit in mA */ @@ -257,6 +302,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate EVSECallbackWrapper mCallbacks = { .handler = nullptr, .arg = 0 }; /* Wrapper to allow callbacks to be registered */ Status NotifyApplicationCurrentLimitChange(int64_t maximumChargeCurrent); Status NotifyApplicationStateChange(); + Status NotifyApplicationChargingPreferencesChange(); Status GetEVSEEnergyMeterValue(ChargingDischargingType meterType, int64_t & aMeterValue); /* Local State machine handling */ @@ -292,11 +338,11 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate DataModel::Nullable mChargingEnabledUntil; // TODO Default to 0 to indicate disabled DataModel::Nullable mDischargingEnabledUntil; // TODO Default to 0 to indicate disabled int64_t mCircuitCapacity = 0; - int64_t mMinimumChargeCurrent = kDefaultMinChargeCurrent; + int64_t mMinimumChargeCurrent = kDefaultMinChargeCurrent_mA; int64_t mMaximumChargeCurrent = 0; int64_t mMaximumDischargeCurrent = 0; - int64_t mUserMaximumChargeCurrent = kDefaultUserMaximumChargeCurrent; // TODO update spec - uint32_t mRandomizationDelayWindow = kDefaultRandomizationDelayWindow; + int64_t mUserMaximumChargeCurrent = kDefaultUserMaximumChargeCurrent_mA; // TODO update spec + uint32_t mRandomizationDelayWindow = kDefaultRandomizationDelayWindow_sec; /* PREF attributes */ DataModel::Nullable mNextChargeStartTime; DataModel::Nullable mNextChargeTargetTime; @@ -316,6 +362,9 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate /* Helper variable to hold meter val since last EnergyTransferStarted event */ int64_t mMeterValueAtEnergyTransferStart; + + /* Targets Delegate */ + EvseTargetsDelegate * mEvseTargetsDelegate = nullptr; }; } // namespace EnergyEvse diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h index fc0d41b9259643..f39b0c0c5dd34a 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseTargetsStore.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseTargetsStore.h new file mode 100644 index 00000000000000..97379f8470e0ae --- /dev/null +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseTargetsStore.h @@ -0,0 +1,123 @@ +/* + * + * 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 +#include +#include + +#include + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace EnergyEvse { + +class EvseTargetsDelegate : public chip::FabricTable::Delegate +{ +public: + EvseTargetsDelegate(); + ~EvseTargetsDelegate(); + + CHIP_ERROR Init(PersistentStorageDelegate * targetStore); + + /** + * @brief Delegate should implement a handler for LoadTargets + * + * This needs to load any stored targets into memory + */ + CHIP_ERROR LoadTargets(); + + /** + * @brief This returns a reference to the existing targets + */ + const DataModel::List & GetTargets(); + + /** + * @brief Copies a ChargingTargetSchedule into our store + * + * @param [in] an entry from the SetTargets list containing: + * dayOfWeekForSequence and chargingTargets (list) + * + * This routine scans the existing targets to see if we have a day of week + * set that matches the new target dayOfWeek bits. If there is an existing + * matching day then it replaces the days existing targets with the new entry + */ + CHIP_ERROR SetTargets( + const DataModel::DecodableList & chargingTargetSchedulesChanges); + + /** + * @brief This deletes all targets and resets the list to empty + */ + CHIP_ERROR ClearTargets(); + + /** + * Part of the FabricTable::Delegate interface. Gets called when a fabric is deleted, such as on FabricTable::Delete(). + **/ + virtual void OnFabricRemoved(const FabricTable & fabricTable, FabricIndex fabricIndex) override; + +private: + // This is the upper bound in bytes of the TLV storage required to store the chargingTargetSchedulesList + static uint16_t GetTlvSizeUpperBound(); + + CHIP_ERROR SaveTargets(DataModel::List & chargingTargetSchedulesList); + + // For debug purposes + void PrintTargets(const DataModel::List & chargingTargetSchedules); + +protected: + enum class TargetEntryTag : uint8_t + { + kTargetEntry = 1, + kDayOfWeek = 2, + kChargingTargetsList = 3, + kChargingTargetsStruct = 4, + kTargetTime = 5, + kTargetSoC = 6, + kAddedEnergy = 7, + }; + +private: + // Object to handle the allocation of memory for the chargingTargets + ChargingTargetsMemMgr mChargingTargets; + + // Need memory to store the ChargingTargetScheduleStruct as this is pointed to from a + // List + Structs::ChargingTargetScheduleStruct::Type mChargingTargetSchedulesArray[kEvseTargetsMaxNumberOfDays]; + + // The current Target definition + DataModel::List mChargingTargetSchedulesList; + + // Pointer to the PeristentStorage + PersistentStorageDelegate * mpTargetStore = nullptr; + + // Need a key to store the Charging Preference Targets which is a TLV of list of lists + static constexpr const char * spEvseTargetsKeyName = "g/ev/targ"; +}; + +} // namespace EnergyEvse +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/energy-management-app/energy-management-common/include/EnergyManagementAppCmdLineOptions.h b/examples/energy-management-app/energy-management-common/include/EnergyManagementAppCmdLineOptions.h new file mode 100644 index 00000000000000..a44140b94c762b --- /dev/null +++ b/examples/energy-management-app/energy-management-common/include/EnergyManagementAppCmdLineOptions.h @@ -0,0 +1,34 @@ +/* + * + * 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 DeviceEnergyManagement { + +chip::BitMask GetFeatureMapFromCmdLine(); + +} // namespace DeviceEnergyManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/energy-management-app/energy-management-common/include/EnergyTimeUtils.h b/examples/energy-management-app/energy-management-common/include/EnergyTimeUtils.h new file mode 100644 index 00000000000000..5e882063ad7540 --- /dev/null +++ b/examples/energy-management-app/energy-management-common/include/EnergyTimeUtils.h @@ -0,0 +1,74 @@ +/* + * + * 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 +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace DeviceEnergyManagement { + +/** + * @brief Helper function to get current timestamp in Epoch format + * + * @param chipEpoch reference to hold return timestamp + */ +CHIP_ERROR GetEpochTS(uint32_t & chipEpoch); + +/** + * @brief Helper function to get current timestamp and work out the day of week + * + * NOTE that the time_t is converted using localtime to provide the timestamp + * in local time. If this is not supported on some platforms an alternative + * implementation may be required. + * + * @param unixEpoch (as time_t) + * + * @return bitmap value for day of week as defined by EnergyEvse::TargetDayOfWeekBitmap. Note + * only one bit will be set for the day of the week. + */ +BitMask GetLocalDayOfWeekFromUnixEpoch(time_t unixEpoch); + +/** + * @brief Helper function to get current timestamp and work out the day of week based on localtime + * + * @param reference to hold the day of week as a bitmap as defined by EnergyEvse::TargetDayOfWeekBitmap. + * Note only one bit will be set for the current day. + */ +CHIP_ERROR GetLocalDayOfWeekNow(BitMask & dayOfWeekMap); + +/** + * @brief Helper function to get current timestamp and work out the current number of minutes + * past midnight based on localtime + * + * @param reference to hold the number of minutes past midnight + */ +CHIP_ERROR GetMinutesPastMidnight(uint16_t & minutesPastMidnight); + +} // namespace DeviceEnergyManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/energy-management-app/energy-management-common/include/FakeReadings.h b/examples/energy-management-app/energy-management-common/include/FakeReadings.h new file mode 100644 index 00000000000000..f8334ba2708b7e --- /dev/null +++ b/examples/energy-management-app/energy-management-common/include/FakeReadings.h @@ -0,0 +1,115 @@ +/* + * + * 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 + +class FakeReadings +{ +public: + static FakeReadings & GetInstance(); + + /** + * @brief Starts a fake load/generator to periodically callback the power and energy + * clusters. + * @param[in] aEndpointId - which endpoint is the meter to be updated on + * @param[in] aPower_mW - the mean power of the load + * Positive power indicates Imported energy (e.g. a load) + * Negative power indicated Exported energy (e.g. a generator) + * @param[in] aPowerRandomness_mW This is used to define the max randomness of the + * random power values around the mean power of the load + * @param[in] aVoltage_mV - the nominal voltage measurement + * @param[in] aVoltageRandomness_mV This is used to define the max randomness of the + * random voltage values + * @param[in] aCurrent_mA - the nominal current measurement + * @param[in] aCurrentRandomness_mA This is used to define the max randomness of the + * random current values + * @param[in] aInterval_s - the callback interval in seconds + * @param[in] aReset - boolean: true will reset the energy values to 0 + */ + void StartFakeReadings(chip::EndpointId aEndpointId, int64_t aPower_mW, uint32_t aPowerRandomness_mW, int64_t aVoltage_mV, + uint32_t aVoltageRandomness_mV, int64_t aCurrent_mA, uint32_t aCurrentRandomness_mA, uint8_t aInterval_s, + bool aReset); + + /** + * @brief Stops any active updates to the fake load data callbacks + */ + void StopFakeReadings(); + + /** + * @brief Sends fake meter data into the cluster and restarts the timer + */ + void FakeReadingsUpdate(); + + /** + * @brief Timer expiry callback to handle fake load + */ + static void FakeReadingsTimerExpiry(chip::System::Layer * systemLayer, void * manufacturer); + + CHIP_ERROR ConfigureForecast(uint16_t numSlots); + +private: + FakeReadings(); + ~FakeReadings(); + +private: + /* If enabled then the timer callback will re-trigger */ + bool bEnabled; + + /* Which endpoint the meter is on */ + chip::EndpointId mEndpointId; + + /* Interval in seconds to callback */ + uint8_t mInterval_s; + + /* Active Power on the load in mW (signed value) +ve = imported */ + int64_t mPower_mW; + + /* The amount to randomize the Power on the load in mW */ + uint32_t mPowerRandomness_mW; + + /* Voltage reading in mV (signed value) */ + int64_t mVoltage_mV; + + /* The amount to randomize the Voltage in mV */ + uint32_t mVoltageRandomness_mV; + + /* ActiveCurrent reading in mA (signed value) */ + int64_t mCurrent_mA; + + /* The amount to randomize the ActiveCurrent in mA */ + uint32_t mCurrentRandomness_mA; + + /* These energy values can only be positive values. However the underlying + * energy type (power_mWh) is signed, so keeping with that convention. + */ + + /* Cumulative Energy Imported which is updated if mPower > 0 */ + int64_t mTotalEnergyImported = 0; + + /* Cumulative Energy Imported which is updated if mPower < 0 */ + int64_t mTotalEnergyExported = 0; + + /* Periodic Energy Imported which is updated if mPower > 0 */ + int64_t mPeriodicEnergyImported = 0; + + /* Periodic Energy Imported which is updated if mPower < 0 */ + int64_t mPeriodicEnergyExported = 0; +}; diff --git a/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp b/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp new file mode 100644 index 00000000000000..1642b76882178b --- /dev/null +++ b/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp @@ -0,0 +1,193 @@ +/* + * + * 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 "ChargingTargetsMemMgr.h" + +using namespace chip; +using namespace chip::app; +using namespace chip::app::DataModel; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::EnergyEvse; + +ChargingTargetsMemMgr::ChargingTargetsMemMgr() : mChargingTargetSchedulesIdx(0), mNumDailyChargingTargets(0) +{ + memset(mpListOfDays, 0, sizeof(mpListOfDays)); +} + +ChargingTargetsMemMgr::~ChargingTargetsMemMgr() +{ + // Free all memory allocated for the charging targets + for (uint16_t idx = 0; idx < kEvseTargetsMaxNumberOfDays; idx++) + { + if (mpListOfDays[idx] != nullptr) + { + chip::Platform::Delete(mpListOfDays[idx]); + } + } +} + +void ChargingTargetsMemMgr::PrepareDaySchedule(uint16_t chargingTargetSchedulesIdx) +{ + // MUST be called for each entry in DataModel::List chargingTargetSchedules + mNumDailyChargingTargets = 0; + + // Should not occur but just to be safe + if (chargingTargetSchedulesIdx >= kEvseTargetsMaxNumberOfDays) + { + ChipLogError(AppServer, "PrepareDaySchedule bad chargingTargetSchedulesIdx %u", chargingTargetSchedulesIdx); + return; + } + + mChargingTargetSchedulesIdx = chargingTargetSchedulesIdx; + + // Free up any memory associated with this targetSchedule + if (mpListOfDays[mChargingTargetSchedulesIdx] != nullptr) + { + chip::Platform::MemoryFree(mpListOfDays[mChargingTargetSchedulesIdx]); + mpListOfDays[mChargingTargetSchedulesIdx] = nullptr; + } +} + +void ChargingTargetsMemMgr::AddChargingTarget(const EnergyEvse::Structs::ChargingTargetStruct::Type & chargingTarget) +{ + if (mNumDailyChargingTargets < kEvseTargetsMaxTargetsPerDay) + { + mDailyChargingTargets[mNumDailyChargingTargets++] = chargingTarget; + } + else + { + ChipLogError(AppServer, "AddChargingTarget: trying to add too many chargingTargets"); + } +} + +EnergyEvse::Structs::ChargingTargetStruct::Type * ChargingTargetsMemMgr::GetChargingTargets() const +{ + return mpListOfDays[mChargingTargetSchedulesIdx]; +} + +uint16_t ChargingTargetsMemMgr::GetNumDailyChargingTargets() const +{ + return mNumDailyChargingTargets; +} + +CHIP_ERROR ChargingTargetsMemMgr::AllocAndCopy() +{ + // NOTE: ChargingTargetsMemMgr::PrepareDaySchedule() must be called as specified in the class comments in + // ChargingTargetsMemMgr.h before this method can be called. + + VerifyOrDie(mpListOfDays[mChargingTargetSchedulesIdx] == nullptr); + + if (mNumDailyChargingTargets > 0) + { + // Allocate the memory first and then use placement new to initialise the memory of each element in the array + mpListOfDays[mChargingTargetSchedulesIdx] = static_cast( + chip::Platform::MemoryAlloc(sizeof(EnergyEvse::Structs::ChargingTargetStruct::Type) * mNumDailyChargingTargets)); + + VerifyOrReturnError(mpListOfDays[mChargingTargetSchedulesIdx] != nullptr, CHIP_ERROR_NO_MEMORY); + + for (uint16_t idx = 0; idx < mNumDailyChargingTargets; idx++) + { + // This will cause the ChargingTargetStruct constructor to be called and this element in the array + new (mpListOfDays[mChargingTargetSchedulesIdx] + idx) EnergyEvse::Structs::ChargingTargetStruct::Type(); + + // Now copy the chargingTarget + mpListOfDays[mChargingTargetSchedulesIdx][idx] = mDailyChargingTargets[idx]; + } + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR +ChargingTargetsMemMgr::AllocAndCopy(const DataModel::List & chargingTargets) +{ + // NOTE: ChargingTargetsMemMgr::PrepareDaySchedule() must be called as specified in the class comments in + // ChargingTargetsMemMgr.h before this method can be called. + + VerifyOrDie(mpListOfDays[mChargingTargetSchedulesIdx] == nullptr); + + mNumDailyChargingTargets = static_cast(chargingTargets.size()); + + if (mNumDailyChargingTargets > 0) + { + // Allocate the memory first and then use placement new to initialise the memory of each element in the array + mpListOfDays[mChargingTargetSchedulesIdx] = static_cast( + chip::Platform::MemoryAlloc(sizeof(EnergyEvse::Structs::ChargingTargetStruct::Type) * chargingTargets.size())); + + VerifyOrReturnError(mpListOfDays[mChargingTargetSchedulesIdx] != nullptr, CHIP_ERROR_NO_MEMORY); + + uint16_t idx = 0; + for (auto & chargingTarget : chargingTargets) + { + // This will cause the ChargingTargetStruct constructor to be called and this element in the array + new (mpListOfDays[mChargingTargetSchedulesIdx] + idx) EnergyEvse::Structs::ChargingTargetStruct::Type(); + + // Now copy the chargingTarget + mpListOfDays[mChargingTargetSchedulesIdx][idx] = chargingTarget; + + idx++; + } + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR +ChargingTargetsMemMgr::AllocAndCopy(const DataModel::DecodableList & chargingTargets) +{ + // NOTE: ChargingTargetsMemMgr::PrepareDaySchedule() must be called as specified in the class comments in + // ChargingTargetsMemMgr.h before this method can be called. + + VerifyOrDie(mpListOfDays[mChargingTargetSchedulesIdx] == nullptr); + + size_t numDailyChargingTargets = 0; + ReturnErrorOnFailure(chargingTargets.ComputeSize(&numDailyChargingTargets)); + + mNumDailyChargingTargets = static_cast(numDailyChargingTargets); + + if (mNumDailyChargingTargets > 0) + { + // Allocate the memory first and then use placement new to initialise the memory of each element in the array + mpListOfDays[mChargingTargetSchedulesIdx] = static_cast( + chip::Platform::MemoryAlloc(sizeof(EnergyEvse::Structs::ChargingTargetStruct::Type) * mNumDailyChargingTargets)); + + VerifyOrReturnError(mpListOfDays[mChargingTargetSchedulesIdx] != nullptr, CHIP_ERROR_NO_MEMORY); + + uint16_t idx = 0; + auto it = chargingTargets.begin(); + while (it.Next()) + { + // Check that the idx is still valid + VerifyOrReturnError(idx < mNumDailyChargingTargets, CHIP_ERROR_INCORRECT_STATE); + + auto & chargingTarget = it.GetValue(); + + // This will cause the ChargingTargetStruct constructor to be called and this element in the array + new (mpListOfDays[mChargingTargetSchedulesIdx] + idx) EnergyEvse::Structs::ChargingTargetStruct::Type(); + + // Now copy the chargingTarget + mpListOfDays[mChargingTargetSchedulesIdx][idx] = chargingTarget; + + idx++; + } + } + + return CHIP_NO_ERROR; +} diff --git a/examples/energy-management-app/energy-management-common/src/DEMTestEventTriggers.cpp b/examples/energy-management-app/energy-management-common/src/DEMTestEventTriggers.cpp new file mode 100644 index 00000000000000..469b781a9b6211 --- /dev/null +++ b/examples/energy-management-app/energy-management-common/src/DEMTestEventTriggers.cpp @@ -0,0 +1,386 @@ +/* + * + * 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 + +#include "FakeReadings.h" + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::DeviceEnergyManagement; + +static constexpr uint16_t MAX_SLOTS = 10; +static constexpr uint16_t MAX_POWER_ADJUSTMENTS = 5; + +static chip::app::Clusters::DeviceEnergyManagement::Structs::SlotStruct::Type sSlots[MAX_SLOTS]; +static chip::app::Clusters::DeviceEnergyManagement::Structs::ForecastStruct::Type sForecastStruct; +static chip::app::DataModel::Nullable sForecast; + +static chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustStruct::Type sPowerAdjustments[MAX_POWER_ADJUSTMENTS]; +static chip::app::Clusters::DeviceEnergyManagement::Structs::PowerAdjustCapabilityStruct::Type sPowerAdjustCapabilityStruct; +static chip::app::DataModel::Nullable + sPowerAdjustmentCapability; + +DeviceEnergyManagementDelegate * GetDEMDelegate() +{ + EVSEManufacturer * mn = GetEvseManufacturer(); + VerifyOrDieWithMsg(mn != nullptr, AppServer, "EVSEManufacturer is null"); + DeviceEnergyManagementDelegate * dg = mn->GetDEMDelegate(); + VerifyOrDieWithMsg(dg != nullptr, AppServer, "DEM Delegate is null"); + + return dg; +} + +CHIP_ERROR ConfigureForecast(uint16_t numSlots) +{ + uint32_t chipEpoch = 0; + + CHIP_ERROR err = GetEpochTS(chipEpoch); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Support, "ConfigureForecast could not get time"); + return err; + } + + // planned start time, in UTC, for the entire Forecast. Allow to be a little + // time in the future as forecastStruct.startTime is used in some tests. + sForecastStruct.startTime = chipEpoch + 60; + + // earliest start time, in UTC, that the entire Forecast can be shifted to. null value indicates that it can be started + // immediately. + sForecastStruct.earliestStartTime = MakeOptional(DataModel::MakeNullable(chipEpoch)); + + // planned end time, in UTC, for the entire Forecast. + sForecastStruct.endTime = chipEpoch * 3; + + // latest end time, in UTC, for the entire Forecast + sForecastStruct.latestEndTime = MakeOptional(chipEpoch * 3); + + sForecastStruct.isPausable = true; + + sForecastStruct.activeSlotNumber.SetNonNull(0); + + sSlots[0].minDuration = 10; + sSlots[0].maxDuration = 20; + sSlots[0].defaultDuration = 15; + sSlots[0].elapsedSlotTime = 0; + sSlots[0].remainingSlotTime = 0; + + sSlots[0].slotIsPausable.SetValue(true); + sSlots[0].minPauseDuration.SetValue(10); + sSlots[0].maxPauseDuration.SetValue(60); + + if (GetDEMDelegate()->HasFeature(DeviceEnergyManagement::Feature::kPowerForecastReporting)) + { + sSlots[0].nominalPower.SetValue(1500); + sSlots[0].minPower.SetValue(1000); + sSlots[0].maxPower.SetValue(2000); + } + + sSlots[0].nominalEnergy.SetValue(2000); + + if (GetDEMDelegate()->HasFeature(DeviceEnergyManagement::Feature::kStateForecastReporting)) + { + sSlots[0].manufacturerESAState.SetValue(23); + } + + for (uint16_t slotNo = 1; slotNo < numSlots; slotNo++) + { + sSlots[slotNo].minDuration = 2 * sSlots[slotNo - 1].minDuration; + sSlots[slotNo].maxDuration = 2 * sSlots[slotNo - 1].maxDuration; + sSlots[slotNo].defaultDuration = 2 * sSlots[slotNo - 1].defaultDuration; + sSlots[slotNo].elapsedSlotTime = 2 * sSlots[slotNo - 1].elapsedSlotTime; + sSlots[slotNo].remainingSlotTime = 2 * sSlots[slotNo - 1].remainingSlotTime; + + // Need slotNo == 1 not to be pausible for test DEM 2.4 step 3b + sSlots[slotNo].slotIsPausable.SetValue((slotNo & 1) == 0 ? true : false); + sSlots[slotNo].minPauseDuration.SetValue(2 * sSlots[slotNo - 1].slotIsPausable.Value()); + sSlots[slotNo].maxPauseDuration.SetValue(2 * sSlots[slotNo - 1].maxPauseDuration.Value()); + + if (GetDEMDelegate()->HasFeature(DeviceEnergyManagement::Feature::kPowerForecastReporting)) + { + sSlots[slotNo].nominalPower.SetValue(2 * sSlots[slotNo - 1].nominalPower.Value()); + sSlots[slotNo].minPower.SetValue(2 * sSlots[slotNo - 1].minPower.Value()); + sSlots[slotNo].maxPower.SetValue(2 * sSlots[slotNo - 1].maxPower.Value()); + + sSlots[slotNo].nominalEnergy.SetValue(2 * sSlots[slotNo - 1].nominalEnergy.Value()); + } + + if (GetDEMDelegate()->HasFeature(DeviceEnergyManagement::Feature::kStateForecastReporting)) + { + sSlots[slotNo].manufacturerESAState.SetValue(sSlots[slotNo - 1].manufacturerESAState.Value() + 1); + } + } + + sForecastStruct.slots = DataModel::List(sSlots, numSlots); + + EVSEManufacturer * mn = GetEvseManufacturer(); + mn->GetDEMDelegate()->SetForecast(DataModel::MakeNullable(sForecastStruct)); + mn->GetDEMDelegate()->SetAbsMinPower(1000); + mn->GetDEMDelegate()->SetAbsMaxPower(256 * 2000 * 1000); + + return CHIP_NO_ERROR; +} + +void SetTestEventTrigger_PowerAdjustment() +{ + sPowerAdjustments[0].minPower = 5000 * 1000; // 5kW + sPowerAdjustments[0].maxPower = 30000 * 1000; // 30kW + sPowerAdjustments[0].minDuration = 10; // 30s + sPowerAdjustments[0].maxDuration = 60; // 60s + + DataModel::List powerAdjustmentList(sPowerAdjustments, 1); + + sPowerAdjustCapabilityStruct.cause = PowerAdjustReasonEnum::kNoAdjustment; + sPowerAdjustCapabilityStruct.powerAdjustCapability.SetNonNull(powerAdjustmentList); + sPowerAdjustmentCapability.SetNonNull(sPowerAdjustCapabilityStruct); + + CHIP_ERROR err = GetDEMDelegate()->SetPowerAdjustmentCapability(sPowerAdjustmentCapability); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Support, "SetTestEventTrigger_PowerAdjustment failed %s", chip::ErrorStr(err)); + } +} + +void SetTestEventTrigger_ClearForecast() +{ + sPowerAdjustments[0].minPower = 0; + sPowerAdjustments[0].maxPower = 0; + sPowerAdjustments[0].minDuration = 0; + sPowerAdjustments[0].maxDuration = 0; + + DataModel::List powerAdjustmentList(sPowerAdjustments, 1); + + sPowerAdjustCapabilityStruct.powerAdjustCapability.SetNonNull(powerAdjustmentList); + sPowerAdjustCapabilityStruct.cause = PowerAdjustReasonEnum::kNoAdjustment; + + DataModel::Nullable powerAdjustmentCapabilityStruct( + sPowerAdjustCapabilityStruct); + + CHIP_ERROR err = GetDEMDelegate()->SetPowerAdjustmentCapability(powerAdjustmentCapabilityStruct); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Support, "SetTestEventTrigger_PowerAdjustment failed %s", chip::ErrorStr(err)); + } +} + +void SetTestEventTrigger_StartTimeAdjustment() +{ + ConfigureForecast(2); + + // Get the current forecast ad update the earliestStartTime and latestEndTime + sForecastStruct = GetDEMDelegate()->GetForecast().Value(); + + uint32_t chipEpoch = 0; + + CHIP_ERROR err = GetEpochTS(chipEpoch); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Support, "ConfigureForecast_EarliestStartLatestEndTimes could not get time"); + } + + // planned start time, in UTC, for the entire Forecast. + sForecastStruct.startTime = chipEpoch; + + // Set the earliest start time, in UTC, to that before the startTime + sForecastStruct.earliestStartTime = Optional>{ DataModel::Nullable{ chipEpoch - 60 } }; + + // Planned end time, in UTC, for the entire Forecast. + sForecastStruct.endTime = chipEpoch * 3; + + // Latest end time, in UTC, for the entire Forecast which is > sForecastStruct.endTime + sForecastStruct.latestEndTime = Optional(chipEpoch * 3 + 60); + + GetDEMDelegate()->SetForecast(DataModel::MakeNullable(sForecastStruct)); +} + +void SetTestEventTrigger_StartTimeAdjustmentClear() +{ + // Get the current forecast ad update the earliestStartTime and latestEndTime + sForecastStruct = GetDEMDelegate()->GetForecast().Value(); + + sForecastStruct.startTime = static_cast(0); + sForecastStruct.endTime = static_cast(0); + + sForecastStruct.earliestStartTime = NullOptional; + sForecastStruct.latestEndTime = NullOptional; + + GetDEMDelegate()->SetForecast(DataModel::MakeNullable(sForecastStruct)); +} + +void SetTestEventTrigger_UserOptOutOptimization(OptOutStateEnum optOutState) +{ + GetDEMDelegate()->SetOptOutState(optOutState); +} + +void SetTestEventTrigger_Pausable() +{ + ConfigureForecast(2); +} + +void SetTestEventTrigger_PausableNextSlot() +{ + // Get the current forecast ad update the active slot number + sForecastStruct = GetDEMDelegate()->GetForecast().Value(); + sForecastStruct.activeSlotNumber.SetNonNull(1); + + GetDEMDelegate()->SetForecast(DataModel::MakeNullable(sForecastStruct)); +} + +void SetTestEventTrigger_Forecast() +{ + ConfigureForecast(2); +} + +void SetTestEventTrigger_ForecastClear() +{ + sForecastStruct.startTime = 0; + sForecastStruct.endTime = 0; + sForecastStruct.earliestStartTime.ClearValue(); + sForecastStruct.latestEndTime.ClearValue(); + sForecastStruct.isPausable = false; + sForecastStruct.activeSlotNumber.SetNull(); + sForecastStruct.slots = DataModel::List(); + + GetDEMDelegate()->SetForecast(DataModel::MakeNullable(sForecastStruct)); +} + +void SetTestEventTrigger_ForecastAdjustment() +{ + ConfigureForecast(2); + + // The following values need to match the equivalent values in src/python_testing/TC_DEM_2_5.py + sForecastStruct = GetDEMDelegate()->GetForecast().Value(); + sSlots[0].minPowerAdjustment.SetValue(20); + sSlots[0].maxPowerAdjustment.SetValue(2000); + sSlots[0].minDurationAdjustment.SetValue(120); + sSlots[0].maxDurationAdjustment.SetValue(240); + + sForecastStruct.slots = DataModel::List(sSlots, 2); + + GetDEMDelegate()->SetForecast(DataModel::MakeNullable(sForecastStruct)); +} + +void SetTestEventTrigger_ForecastAdjustmentNextSlot() +{ + sForecastStruct = GetDEMDelegate()->GetForecast().Value(); + sForecastStruct.activeSlotNumber.SetNonNull(sForecastStruct.activeSlotNumber.Value() + 1); + + GetDEMDelegate()->SetForecast(DataModel::MakeNullable(sForecastStruct)); +} + +void SetTestEventTrigger_ConstraintBasedAdjustment() +{ + ConfigureForecast(4); +} + +bool HandleDeviceEnergyManagementTestEventTrigger(uint64_t eventTrigger) +{ + DeviceEnergyManagementTrigger trigger = static_cast(eventTrigger); + + switch (trigger) + { + case DeviceEnergyManagementTrigger::kPowerAdjustment: + ChipLogProgress( + Support, + "[PowerAdjustment-Test-Event] => Simulate a fixed forecast power usage including one or more PowerAdjustmentStructs"); + SetTestEventTrigger_PowerAdjustment(); + break; + case DeviceEnergyManagementTrigger::kPowerAdjustmentClear: + ChipLogProgress(Support, "[PowerAdjustmentClear-Test-Event] => Clear the PowerAdjustment structs"); + SetTestEventTrigger_ClearForecast(); + break; + case DeviceEnergyManagementTrigger::kUserOptOutLocalOptimization: + ChipLogProgress(Support, "[UserOptOutLocalOptimization-Test-Event] => Simulate user opt-out of Local Optimization"); + SetTestEventTrigger_UserOptOutOptimization(OptOutStateEnum::kLocalOptOut); + break; + case DeviceEnergyManagementTrigger::kUserOptOutGridOptimization: + ChipLogProgress(Support, "[UserOptOutGrisOptimization-Test-Event] => Simulate user opt-out of Grid Optimization"); + SetTestEventTrigger_UserOptOutOptimization(OptOutStateEnum::kGridOptOut); + break; + case DeviceEnergyManagementTrigger::kUserOptOutClearAll: + ChipLogProgress(Support, "[UserOptOutClearAll-Test-Event] => Remove all user opt-out opting out"); + SetTestEventTrigger_UserOptOutOptimization(OptOutStateEnum::kNoOptOut); + break; + case DeviceEnergyManagementTrigger::kStartTimeAdjustment: + ChipLogProgress(Support, + "[StartTimeAdjustment-Test-Event] => Simulate a fixed forecast with EarliestStartTime earlier than " + "startTime, and LatestEndTime greater than EndTime"); + SetTestEventTrigger_StartTimeAdjustment(); + break; + case DeviceEnergyManagementTrigger::kStartTimeAdjustmentClear: + ChipLogProgress(Support, "[StartTimeAdjustmentClear-Test-Event] => Clear the StartTimeAdjustment simulated forecast"); + SetTestEventTrigger_StartTimeAdjustmentClear(); + break; + case DeviceEnergyManagementTrigger::kPausable: + ChipLogProgress(Support, + "[Pausable-Test-Event] => Simulate a fixed forecast with one pausable slot with MinPauseDuration >1, " + "MaxPauseDuration>1 and one non pausable slot"); + SetTestEventTrigger_Pausable(); + break; + case DeviceEnergyManagementTrigger::kPausableNextSlot: + ChipLogProgress(Support, "[PausableNextSlot-Test-Event] => Simulate a moving time to the next forecast slot"); + SetTestEventTrigger_PausableNextSlot(); + break; + case DeviceEnergyManagementTrigger::kPausableClear: + ChipLogProgress(Support, "[PausableClear-Test-Event] => Clear the Pausable simulated forecast"); + SetTestEventTrigger_ClearForecast(); + break; + case DeviceEnergyManagementTrigger::kForecastAdjustment: + ChipLogProgress(Support, + "[ForecastAdjustment-Test-Event] => Simulate a forecast power usage with at least 2 and at most 4 slots"); + SetTestEventTrigger_ForecastAdjustment(); + break; + case DeviceEnergyManagementTrigger::kForecastAdjustmentNextSlot: + ChipLogProgress(Support, "[ForecastAdjustmentNextSlot-Test-Event] => Simulate moving time to the next forecast slot"); + SetTestEventTrigger_ForecastAdjustmentNextSlot(); + break; + case DeviceEnergyManagementTrigger::kForecastAdjustmentClear: + ChipLogProgress(Support, "[ForecastAdjustmentClear-Test-Event] => Clear the forecast adjustment"); + SetTestEventTrigger_ClearForecast(); + break; + case DeviceEnergyManagementTrigger::kConstraintBasedAdjustment: + ChipLogProgress( + Support, + "[ConstraintBasedAdjustment-Test-Event] => Simulate a forecast power usage with at least 2 and at most 4 slots"); + SetTestEventTrigger_ConstraintBasedAdjustment(); + break; + case DeviceEnergyManagementTrigger::kConstraintBasedAdjustmentClear: + ChipLogProgress(Support, "[ConstraintBasedAdjustmentClear-Test-Event] => Clear the constraint based adjustment"); + SetTestEventTrigger_ClearForecast(); + break; + case DeviceEnergyManagementTrigger::kForecast: + ChipLogProgress(Support, "[Forecast-Test-Event] => Create a forecast with at least 1 slot"); + SetTestEventTrigger_Forecast(); + break; + case DeviceEnergyManagementTrigger::kForecastClear: + ChipLogProgress(Support, "[ForecastClear-Test-Event] => Clear the forecast"); + SetTestEventTrigger_ForecastClear(); + break; + + default: + return false; + } + + return true; +} diff --git a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp index 8f122bdac2b046..273bc9e0614333 100644 --- a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,8 +17,10 @@ */ #include "DeviceEnergyManagementDelegateImpl.h" - +#include "DEMManufacturerDelegate.h" +#include "EnergyTimeUtils.h" #include +#include using namespace chip; using namespace chip::app; @@ -26,10 +28,40 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::DeviceEnergyManagement; using namespace chip::app::Clusters::DeviceEnergyManagement::Attributes; +using chip::Protocols::InteractionModel::Status; + using chip::Optional; -using namespace chip::app; using CostsList = DataModel::List; +DeviceEnergyManagementDelegate::DeviceEnergyManagementDelegate() : + mpDEMManufacturerDelegate(nullptr), mEsaType(ESATypeEnum::kEvse), mEsaCanGenerate(false), mEsaState(ESAStateEnum::kOffline), + mAbsMinPowerMw(0), mAbsMaxPowerMw(0), mOptOutState(OptOutStateEnum::kNoOptOut), mPowerAdjustmentInProgress(false), + mPowerAdjustmentStartTimeUtc(0), mPauseRequestInProgress(false) +{} + +void DeviceEnergyManagementDelegate::SetDeviceEnergyManagementInstance(DeviceEnergyManagement::Instance & instance) +{ + mpDEMInstance = &instance; +} + +uint32_t DeviceEnergyManagementDelegate::HasFeature(Feature feature) const +{ + bool hasFeature = false; + + if (mpDEMInstance != nullptr) + { + hasFeature = mpDEMInstance->HasFeature(feature); + } + + return hasFeature; +} + +void DeviceEnergyManagementDelegate::SetDEMManufacturerDelegate( + DEMManufacturerDelegate & deviceEnergyManagementManufacturerDelegate) +{ + mpDEMManufacturerDelegate = &deviceEnergyManagementManufacturerDelegate; +} + /** * @brief Delegate handler for PowerAdjustRequest * @@ -47,27 +79,156 @@ using CostsList = DataModel::List; * 6) generate a PowerAdjustEnd event with cause NormalCompletion * 7) if necessary, update the forecast with new expected end time */ -Status DeviceEnergyManagementDelegate::PowerAdjustRequest(const int64_t power, const uint32_t duration, AdjustmentCauseEnum cause) +Status DeviceEnergyManagementDelegate::PowerAdjustRequest(const int64_t powerMw, const uint32_t durationS, + AdjustmentCauseEnum cause) { - Status status = Status::UnsupportedCommand; // Status::Success; + bool generateEvent = false; - // TODO: implement - mEsaState = ESAStateEnum::kPowerAdjustActive; + // If a timer is running, cancel it so we can start it with the new duration + if (mPowerAdjustmentInProgress) + { + DeviceLayer::SystemLayer().CancelTimer(PowerAdjustTimerExpiry, this); + } + else + { + // Going to start a new power adjustment so will need to generate an event + generateEvent = true; + + // Record when this PowerAdjustment starts. Note if we do not set this value if a PowerAdjustment is in progress + CHIP_ERROR err = GetEpochTS(mPowerAdjustmentStartTimeUtc); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Unable to get time: %" CHIP_ERROR_FORMAT, err.Format()); + return Status::Failure; + } + } - // TODO: Generate a PowerAdjustStart Event, then begins to adjust its power - // When done, raise PowerAdjustEnd & ESAState set to kOnline. + // Update the forecast with the new expected end time + if (mpDEMManufacturerDelegate != nullptr) + { + CHIP_ERROR err = mpDEMManufacturerDelegate->HandleDeviceEnergyManagementPowerAdjustRequest(powerMw, durationS, cause); + if (err != CHIP_NO_ERROR) + { + return Status::Failure; + } + } - MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAState::Id); + SetESAState(ESAStateEnum::kPowerAdjustActive); - return status; + // mPowerAdjustCapabilityStruct is guaranteed to have a value as validated in Instance::HandlePowerAdjustRequest. + // If it did not have a value, this method would not have been called. + switch (cause) + { + case AdjustmentCauseEnum::kLocalOptimization: + mPowerAdjustCapabilityStruct.Value().cause = PowerAdjustReasonEnum::kLocalOptimizationAdjustment; + break; + + case AdjustmentCauseEnum::kGridOptimization: + mPowerAdjustCapabilityStruct.Value().cause = PowerAdjustReasonEnum::kGridOptimizationAdjustment; + break; + + default: + HandlePowerAdjustRequestFailure(); + return Status::Failure; + } + + // Remember we have a timer running so we don't generate a PowerAdjustStart event should another request come + // in before this timer expires + mPowerAdjustmentInProgress = true; + + CHIP_ERROR err = DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(durationS), PowerAdjustTimerExpiry, this); + if (err != CHIP_NO_ERROR) + { + // TODO: Note: should the PowerAdjust just initiated be cancelled because an Event could not be logged? + ChipLogError(AppServer, "Unable to start a PowerAdjustStart timer: %" CHIP_ERROR_FORMAT, err.Format()); + HandlePowerAdjustRequestFailure(); + return Status::Failure; + } + + if (generateEvent) + { + Events::PowerAdjustStart::Type event; + EventNumber eventNumber; + err = LogEvent(event, mEndpointId, eventNumber); + if (CHIP_NO_ERROR != err) + { + // TODO: Note: should the PowerAdjust just initiated be cancelled because an Event could not be logged? + ChipLogError(AppServer, "Unable to generate PowerAdjustStart event: %" CHIP_ERROR_FORMAT, err.Format()); + HandlePowerAdjustRequestFailure(); + return Status::Failure; + } + } + + return Status::Success; +} + +/** + * @brief Handle a PowerAdjustRequest failing + * + * Cleans up the PowerAdjust state should the request fail + */ +void DeviceEnergyManagementDelegate::HandlePowerAdjustRequestFailure() +{ + DeviceLayer::SystemLayer().CancelTimer(PowerAdjustTimerExpiry, this); + + SetESAState(ESAStateEnum::kOnline); + + mPowerAdjustmentInProgress = false; + + mPowerAdjustCapabilityStruct.Value().cause = PowerAdjustReasonEnum::kNoAdjustment; + + // TODO + // Should we inform the mpDEMManufacturerDelegate that PowerAdjustRequest has failed? } + +/** + * @brief Timer for handling the PowerAdjustRequest + * + * This static function calls the non-static HandlePowerAdjustTimerExpiry method. + */ +void DeviceEnergyManagementDelegate::PowerAdjustTimerExpiry(System::Layer * systemLayer, void * delegate) +{ + DeviceEnergyManagementDelegate * dg = reinterpret_cast(delegate); + + dg->HandlePowerAdjustTimerExpiry(); +} + +/** + * @brief Timer for handling the completion of a PowerAdjustRequest + * + * When the timer expires: + * 1) notify the appliance's that it can resume its intended power setting (or go idle) + * 2) generate a PowerAdjustEnd event with cause NormalCompletion + * 3) if necessary, update the forecast with new expected end time + */ +void DeviceEnergyManagementDelegate::HandlePowerAdjustTimerExpiry() +{ + ChipLogError(AppServer, "DeviceEnergyManagementDelegate::HandlePowerAdjustTimerExpiry"); + + // The PowerAdjustment is no longer in progress + mPowerAdjustmentInProgress = false; + + SetESAState(ESAStateEnum::kOnline); + + mPowerAdjustCapabilityStruct.Value().cause = PowerAdjustReasonEnum::kNoAdjustment; + + // Generate a PowerAdjustEnd event + GeneratePowerAdjustEndEvent(CauseEnum::kNormalCompletion); + + // Update the forecast with new expected end time + if (mpDEMManufacturerDelegate != nullptr) + { + mpDEMManufacturerDelegate->HandleDeviceEnergyManagementPowerAdjustCompletion(); + } +} + /** * @brief Delegate handler for CancelPowerAdjustRequest * * Note: checking of the validity of the CancelPowerAdjustRequest has been done by the lower layer * * This function needs to notify the appliance that it should resume its intended power setting (or go idle). - + * * It should: * 1) notify the appliance's that it can resume its intended power setting (or go idle) * 2) generate a PowerAdjustEnd event with cause code Cancelled @@ -75,16 +236,91 @@ Status DeviceEnergyManagementDelegate::PowerAdjustRequest(const int64_t power, c */ Status DeviceEnergyManagementDelegate::CancelPowerAdjustRequest() { - Status status = Status::UnsupportedCommand; // Status::Success; + Status status = Status::Success; - // TODO: implement - /* TODO: If the command is accepted, the ESA SHALL generate an PowerAdjustEnd Event. */ - mEsaState = ESAStateEnum::kOnline; - MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAState::Id); + CHIP_ERROR err = CancelPowerAdjustRequestAndGenerateEvent(DeviceEnergyManagement::CauseEnum::kCancelled); + if (CHIP_NO_ERROR != err) + { + status = Status::Failure; + } return status; } +/** + * @brief Handles the cancelation of a PowerAdjust operation + * + * This function needs to notify the appliance that it should resume its intended power setting (or go idle). + * + * It should: + * 1) notify the appliance's that it can resume its intended power setting (or go idle) + * 2) generate a PowerAdjustEnd event with cause code Cancelled + * 3) if necessary, update the forecast with new expected end time + */ +CHIP_ERROR DeviceEnergyManagementDelegate::CancelPowerAdjustRequestAndGenerateEvent(CauseEnum cause) +{ + DeviceLayer::SystemLayer().CancelTimer(PowerAdjustTimerExpiry, this); + + SetESAState(ESAStateEnum::kOnline); + + mPowerAdjustmentInProgress = false; + + mPowerAdjustCapabilityStruct.Value().cause = PowerAdjustReasonEnum::kNoAdjustment; + + CHIP_ERROR err = GeneratePowerAdjustEndEvent(cause); + + // Notify the appliance's that it can resume its intended power setting (or go idle) + if (mpDEMManufacturerDelegate != nullptr) + { + // It is expected the mpDEMManufacturerDelegate will update the forecast with new expected end time + // as a consequence of the cancel request. + err = mpDEMManufacturerDelegate->HandleDeviceEnergyManagementCancelPowerAdjustRequest(cause); + } + + return err; +} + +/** + * @brief Generate a PowerAdjustEvent + * + */ +CHIP_ERROR DeviceEnergyManagementDelegate::GeneratePowerAdjustEndEvent(CauseEnum cause) +{ + Events::PowerAdjustEnd::Type event; + EventNumber eventNumber; + event.cause = cause; + + uint32_t timeNowUtc; + CHIP_ERROR err = GetEpochTS(timeNowUtc); + if (err == CHIP_NO_ERROR) + { + event.duration = timeNowUtc - mPowerAdjustmentStartTimeUtc; + } + else + { + ChipLogError(AppServer, "Unable to get time: %" CHIP_ERROR_FORMAT, err.Format()); + return err; + } + + if (mpDEMManufacturerDelegate != nullptr) + { + event.energyUse = mpDEMManufacturerDelegate->GetApproxEnergyDuringSession(); + } + else + { + event.energyUse = 0; + } + + err = LogEvent(event, mEndpointId, eventNumber); + if (CHIP_NO_ERROR != err) + { + ChipLogError(AppServer, "Unable to generate PowerAdjustEnd event: %" CHIP_ERROR_FORMAT, err.Format()); + return err; + } + + return err; +} + /** * @brief Delegate handler for StartTimeAdjustRequest * @@ -96,27 +332,58 @@ Status DeviceEnergyManagementDelegate::CancelPowerAdjustRequest() * 1) update the forecast attribute with the revised start time * 2) send a callback notification to the appliance so it can refresh its internal schedule */ -Status DeviceEnergyManagementDelegate::StartTimeAdjustRequest(const uint32_t requestedStartTime, AdjustmentCauseEnum cause) +Status DeviceEnergyManagementDelegate::StartTimeAdjustRequest(const uint32_t requestedStartTimeUtc, AdjustmentCauseEnum cause) { - DataModel::Nullable forecast = GetForecast(); + if (mForecast.IsNull()) + { + return Status::Failure; + } - if (forecast.IsNull()) + switch (cause) { + case AdjustmentCauseEnum::kLocalOptimization: + mForecast.Value().forecastUpdateReason = ForecastUpdateReasonEnum::kLocalOptimization; + break; + case AdjustmentCauseEnum::kGridOptimization: + mForecast.Value().forecastUpdateReason = ForecastUpdateReasonEnum::kGridOptimization; + break; + default: + ChipLogDetail(AppServer, "Bad cause %d", to_underlying(cause)); return Status::Failure; + break; } - uint32_t duration = forecast.Value().endTime - forecast.Value().startTime; // the current entire forecast duration + mForecast.Value().forecastID++; - /* Modify start time and end time */ - forecast.Value().startTime = requestedStartTime; - forecast.Value().endTime = requestedStartTime + duration; + uint32_t durationS = mForecast.Value().endTime - mForecast.Value().startTime; // the current entire forecast duration + + // Save the start and end time in case there is an issue with the mpDEMManufacturerDelegate handling this + // startTimeAdjustment request + uint32_t savedStartTime = mForecast.Value().startTime; + uint32_t savedEndTime = mForecast.Value().endTime; - SetForecast(forecast); // This will increment forecast ID + /* Modify start time and end time */ + mForecast.Value().startTime = requestedStartTimeUtc; + mForecast.Value().endTime = requestedStartTimeUtc + durationS; - // TODO: callback to the appliance to notify it of a new start time + if (mpDEMManufacturerDelegate != nullptr) + { + CHIP_ERROR err = + mpDEMManufacturerDelegate->HandleDeviceEnergyManagementStartTimeAdjustRequest(requestedStartTimeUtc, cause); + if (err != CHIP_NO_ERROR) + { + // Reset state + mForecast.Value().forecastUpdateReason = ForecastUpdateReasonEnum::kInternalOptimization; + mForecast.Value().startTime = savedStartTime; + mForecast.Value().endTime = savedEndTime; + + return Status::Failure; + } + } return Status::Success; } + /** * @brief Delegate handler for Pause Request * @@ -134,11 +401,184 @@ Status DeviceEnergyManagementDelegate::StartTimeAdjustRequest(const uint32_t req * 6) generate a Resumed event * 7) if necessary, update the forecast with new expected end time */ -Status DeviceEnergyManagementDelegate::PauseRequest(const uint32_t duration, AdjustmentCauseEnum cause) +Status DeviceEnergyManagementDelegate::PauseRequest(const uint32_t durationS, AdjustmentCauseEnum cause) { - Status status = Status::UnsupportedCommand; // Status::Success; - // TODO: implement the behaviour above - return status; + bool generateEvent = false; + + // If a timer is running, cancel it so we can start it with the new duration + if (mPauseRequestInProgress) + { + DeviceLayer::SystemLayer().CancelTimer(PauseRequestTimerExpiry, this); + } + else + { + generateEvent = true; + + // Remember we have a timer running so we don't generate a Paused event should another request come + // in before this timer expires + mPauseRequestInProgress = true; + } + + CHIP_ERROR err = DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(durationS), PauseRequestTimerExpiry, this); + if (err != CHIP_NO_ERROR) + { + HandlePauseRequestFailure(); + return Status::Failure; + } + + // Pause the appliance + if (mpDEMManufacturerDelegate != nullptr) + { + // It is expected that the mpDEMManufacturerDelegate will update the forecast with the new expected end time + err = mpDEMManufacturerDelegate->HandleDeviceEnergyManagementPauseRequest(durationS, cause); + if (err != CHIP_NO_ERROR) + { + HandlePauseRequestFailure(); + return Status::Failure; + } + } + + if (generateEvent) + { + Events::Paused::Type event; + EventNumber eventNumber; + err = LogEvent(event, mEndpointId, eventNumber); + if (CHIP_NO_ERROR != err) + { + ChipLogError(AppServer, "Unable to generate Paused event: %" CHIP_ERROR_FORMAT, err.Format()); + HandlePauseRequestFailure(); + return Status::Failure; + } + } + + SetESAState(ESAStateEnum::kPaused); + + // Update the forecaseUpdateReason based on the AdjustmentCause + if (cause == AdjustmentCauseEnum::kLocalOptimization) + { + mForecast.Value().forecastUpdateReason = ForecastUpdateReasonEnum::kLocalOptimization; + } + else if (cause == AdjustmentCauseEnum::kGridOptimization) + { + mForecast.Value().forecastUpdateReason = ForecastUpdateReasonEnum::kGridOptimization; + } + + return Status::Success; +} + +/** + * @brief Handle a PauseRequest failing + * + * Cleans up the state should the PauseRequest fail + */ +void DeviceEnergyManagementDelegate::HandlePauseRequestFailure() +{ + DeviceLayer::SystemLayer().CancelTimer(PowerAdjustTimerExpiry, this); + + SetESAState(ESAStateEnum::kOnline); + + mPauseRequestInProgress = false; + + // TODO + // Should we inform the mpDEMManufacturerDelegate that PauseRequest has failed? +} + +/** + * @brief Timer for handling the PauseRequest + * + * This static function calls the non-static HandlePauseRequestTimerExpiry method. + */ +void DeviceEnergyManagementDelegate::PauseRequestTimerExpiry(System::Layer * systemLayer, void * delegate) +{ + DeviceEnergyManagementDelegate * dg = reinterpret_cast(delegate); + + dg->HandlePauseRequestTimerExpiry(); +} + +/** + * @brief Timer for handling the completion of a PauseRequest + * + * When the timer expires: + * 1) restore the appliance's operational state + * 2) generate a Resumed event + * 3) if necessary, update the forecast with new expected end time + */ +void DeviceEnergyManagementDelegate::HandlePauseRequestTimerExpiry() +{ + // The PauseRequestment is no longer in progress + mPauseRequestInProgress = false; + + SetESAState(ESAStateEnum::kOnline); + + // Generate a Resumed event + GenerateResumedEvent(CauseEnum::kNormalCompletion); + + // It is expected the mpDEMManufacturerDelegate will update the forecast with new expected end time + if (mpDEMManufacturerDelegate != nullptr) + { + mpDEMManufacturerDelegate->HandleDeviceEnergyManagementPauseCompletion(); + } +} + +/** + * @brief Handles the cancelation of a pause operation + * + * This function needs to notify the appliance that it should resume its intended power setting (or go idle). + * + * It should: + * 1) notify the appliance's that it can resume its intended power setting (or go idle) + * 2) generate a PowerAdjustEnd event with cause code Cancelled + * 3) if necessary, update the forecast with new expected end time + */ +CHIP_ERROR DeviceEnergyManagementDelegate::CancelPauseRequestAndGenerateEvent(CauseEnum cause) +{ + mPauseRequestInProgress = false; + + SetESAState(ESAStateEnum::kOnline); + + DeviceLayer::SystemLayer().CancelTimer(PauseRequestTimerExpiry, this); + + CHIP_ERROR err = GenerateResumedEvent(cause); + CHIP_ERROR err2 = CHIP_NO_ERROR; + + // Notify the appliance's that it can resume its intended power setting (or go idle) + if (mpDEMManufacturerDelegate != nullptr) + { + // It is expected that the mpDEMManufacturerDelegate will update the forecast with new expected end time + err2 = mpDEMManufacturerDelegate->HandleDeviceEnergyManagementCancelPauseRequest(cause); + } + + // Need to pick one of the error codes two return... + if (err == CHIP_NO_ERROR && err2 == CHIP_NO_ERROR) + { + return CHIP_NO_ERROR; + } + + if (err2 != CHIP_NO_ERROR) + { + return err2; + } + + return err; +} + +/** + * @brief Generate a Resumed event + * + */ +CHIP_ERROR DeviceEnergyManagementDelegate::GenerateResumedEvent(CauseEnum cause) +{ + Events::Resumed::Type event; + EventNumber eventNumber; + event.cause = cause; + + CHIP_ERROR err = LogEvent(event, mEndpointId, eventNumber); + if (CHIP_NO_ERROR != err) + { + ChipLogError(AppServer, "Unable to generate Resumed event: %" CHIP_ERROR_FORMAT, err.Format()); + } + + return err; } /** @@ -156,10 +596,24 @@ Status DeviceEnergyManagementDelegate::PauseRequest(const uint32_t duration, Adj */ Status DeviceEnergyManagementDelegate::ResumeRequest() { - Status status = Status::UnsupportedCommand; // Status::Success; + Status status = Status::Failure; - // TODO: implement the behaviour above - SetESAState(ESAStateEnum::kOnline); + if (mPauseRequestInProgress) + { + // Guard against mForecast being null + if (!mForecast.IsNull()) + { + // The PauseRequest has effectively been cancelled so as a result the device should + // go back to InternalOptimisation + mForecast.Value().forecastUpdateReason = ForecastUpdateReasonEnum::kInternalOptimization; + } + + CHIP_ERROR err = CancelPauseRequestAndGenerateEvent(CauseEnum::kCancelled); + if (err == CHIP_NO_ERROR) + { + status = Status::Success; + } + } return status; } @@ -179,12 +633,47 @@ Status DeviceEnergyManagementDelegate::ResumeRequest() * 3) notify the appliance to follow the revised schedule */ Status DeviceEnergyManagementDelegate::ModifyForecastRequest( - const uint32_t forecastId, const DataModel::DecodableList & slotAdjustments, + const uint32_t forecastID, const DataModel::DecodableList & slotAdjustments, AdjustmentCauseEnum cause) { - Status status = Status::UnsupportedCommand; // Status::Success; + Status status = Status::Success; + + if (mForecast.IsNull()) + { + status = Status::Failure; + } + else if (mForecast.Value().forecastID != forecastID) + { + status = Status::Failure; + } + else if (mpDEMManufacturerDelegate != nullptr) + { + // Determine if the new forecast adjustments are acceptable to the appliance + CHIP_ERROR err = mpDEMManufacturerDelegate->HandleModifyForecastRequest(forecastID, slotAdjustments, cause); + if (err != CHIP_NO_ERROR) + { + status = Status::Failure; + } + } + + if (status == Status::Success) + { + switch (cause) + { + case AdjustmentCauseEnum::kLocalOptimization: + mForecast.Value().forecastUpdateReason = ForecastUpdateReasonEnum::kLocalOptimization; + break; + case AdjustmentCauseEnum::kGridOptimization: + mForecast.Value().forecastUpdateReason = ForecastUpdateReasonEnum::kGridOptimization; + break; + default: + // Already checked in chip::app::Clusters::DeviceEnergyManagement::Instance::HandleModifyForecastRequest + break; + } + + mForecast.Value().forecastID++; + } - // TODO: implement the behaviour above return status; } @@ -203,8 +692,42 @@ Status DeviceEnergyManagementDelegate::ModifyForecastRequest( Status DeviceEnergyManagementDelegate::RequestConstraintBasedForecast( const DataModel::DecodableList & constraints, AdjustmentCauseEnum cause) { - Status status = Status::UnsupportedCommand; // Status::Success; - // TODO: implement the behaviour above + Status status = Status::Success; + + if (mForecast.IsNull()) + { + status = Status::Failure; + } + else if (mpDEMManufacturerDelegate != nullptr) + { + // Determine if the new forecast adjustments are acceptable to the appliance + CHIP_ERROR err = mpDEMManufacturerDelegate->RequestConstraintBasedForecast(constraints, cause); + if (err != CHIP_NO_ERROR) + { + status = Status::Failure; + } + } + + if (status == Status::Success) + { + switch (cause) + { + case AdjustmentCauseEnum::kLocalOptimization: + mForecast.Value().forecastUpdateReason = ForecastUpdateReasonEnum::kLocalOptimization; + break; + case AdjustmentCauseEnum::kGridOptimization: + mForecast.Value().forecastUpdateReason = ForecastUpdateReasonEnum::kGridOptimization; + break; + default: + // Already checked in chip::app::Clusters::DeviceEnergyManagement::Instance::HandleModifyForecastRequest + break; + } + + mForecast.Value().forecastID++; + + status = Status::Success; + } + return status; } @@ -221,8 +744,23 @@ Status DeviceEnergyManagementDelegate::RequestConstraintBasedForecast( */ Status DeviceEnergyManagementDelegate::CancelRequest() { - Status status = Status::UnsupportedCommand; // Status::Success; - // TODO: implement the behaviour above + Status status = Status::Success; + + mForecast.Value().forecastUpdateReason = ForecastUpdateReasonEnum::kInternalOptimization; + + /* It is expected the mpDEMManufacturerDelegate will cancel the effects of any previous adjustment + * request commands, and re-evaluate its forecast for intended operation ignoring those previous + * requests. + */ + if (mpDEMManufacturerDelegate != nullptr) + { + CHIP_ERROR error = mpDEMManufacturerDelegate->HandleDeviceEnergyManagementCancelRequest(); + if (error != CHIP_NO_ERROR) + { + status = Status::Failure; + } + } + return status; } @@ -245,26 +783,30 @@ ESAStateEnum DeviceEnergyManagementDelegate::GetESAState() int64_t DeviceEnergyManagementDelegate::GetAbsMinPower() { - return mAbsMinPower; + return mAbsMinPowerMw; } int64_t DeviceEnergyManagementDelegate::GetAbsMaxPower() { - return mAbsMaxPower; + return mAbsMaxPowerMw; } -PowerAdjustmentCapability::TypeInfo::Type DeviceEnergyManagementDelegate::GetPowerAdjustmentCapability() +const DataModel::Nullable & +DeviceEnergyManagementDelegate::GetPowerAdjustmentCapability() { - return mPowerAdjustmentCapability; + return mPowerAdjustCapabilityStruct; } -DataModel::Nullable DeviceEnergyManagementDelegate::GetForecast() +const DataModel::Nullable & DeviceEnergyManagementDelegate::GetForecast() { + ChipLogDetail(Zcl, "DeviceEnergyManagementDelegate::GetForecast"); + return mForecast; } OptOutStateEnum DeviceEnergyManagementDelegate::GetOptOutState() { + ChipLogDetail(AppServer, "mOptOutState %d", to_underlying(mOptOutState)); return mOptOutState; } @@ -323,28 +865,28 @@ CHIP_ERROR DeviceEnergyManagementDelegate::SetESAState(ESAStateEnum newValue) return CHIP_NO_ERROR; } -CHIP_ERROR DeviceEnergyManagementDelegate::SetAbsMinPower(int64_t newValue) +CHIP_ERROR DeviceEnergyManagementDelegate::SetAbsMinPower(int64_t newValueMw) { - int64_t oldValue = mAbsMinPower; + int64_t oldValueMw = mAbsMinPowerMw; - mAbsMinPower = newValue; - if (oldValue != newValue) + mAbsMinPowerMw = newValueMw; + if (oldValueMw != newValueMw) { - ChipLogDetail(AppServer, "mAbsMinPower updated to %d", static_cast(mAbsMinPower)); + ChipLogDetail(AppServer, "mAbsMinPower updated to " ChipLogFormatX64, ChipLogValueX64(mAbsMinPowerMw)); MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, AbsMinPower::Id); } return CHIP_NO_ERROR; } -CHIP_ERROR DeviceEnergyManagementDelegate::SetAbsMaxPower(int64_t newValue) +CHIP_ERROR DeviceEnergyManagementDelegate::SetAbsMaxPower(int64_t newValueMw) { - int64_t oldValue = mAbsMaxPower; + int64_t oldValueMw = mAbsMaxPowerMw; - mAbsMaxPower = newValue; - if (oldValue != newValue) + mAbsMaxPowerMw = newValueMw; + if (oldValueMw != newValueMw) { - ChipLogDetail(AppServer, "mAbsMaxPower updated to %d", static_cast(mAbsMaxPower)); + ChipLogDetail(AppServer, "mAbsMaxPower updated to " ChipLogFormatX64, ChipLogValueX64(mAbsMaxPowerMw)); MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, AbsMaxPower::Id); } @@ -352,20 +894,111 @@ CHIP_ERROR DeviceEnergyManagementDelegate::SetAbsMaxPower(int64_t newValue) } CHIP_ERROR -DeviceEnergyManagementDelegate::SetPowerAdjustmentCapability(PowerAdjustmentCapability::TypeInfo::Type powerAdjustmentCapability) +DeviceEnergyManagementDelegate::SetPowerAdjustmentCapability( + const DataModel::Nullable & powerAdjustCapabilityStruct) { - // TODO see Issue #31147 + assertChipStackLockedByCurrentThread(); + + mPowerAdjustCapabilityStruct = powerAdjustCapabilityStruct; + + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, PowerAdjustmentCapability::Id); + return CHIP_NO_ERROR; } -CHIP_ERROR DeviceEnergyManagementDelegate::SetForecast(DataModel::Nullable forecast) +CHIP_ERROR DeviceEnergyManagementDelegate::SetForecast(const DataModel::Nullable & forecast) { + assertChipStackLockedByCurrentThread(); + // TODO see Issue #31147 + mForecast = forecast; + + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, Forecast::Id); return CHIP_NO_ERROR; } CHIP_ERROR DeviceEnergyManagementDelegate::SetOptOutState(OptOutStateEnum newValue) { - return CHIP_NO_ERROR; + CHIP_ERROR err = CHIP_NO_ERROR; + + OptOutStateEnum oldValue = mOptOutState; + + // The OptOutState is cumulative + if ((oldValue == OptOutStateEnum::kGridOptOut && newValue == OptOutStateEnum::kLocalOptOut) || + (oldValue == OptOutStateEnum::kLocalOptOut && newValue == OptOutStateEnum::kGridOptOut)) + { + mOptOutState = OptOutStateEnum::kOptOut; + } + else + { + mOptOutState = newValue; + } + + if (oldValue != newValue) + { + ChipLogDetail(AppServer, "mOptOutState updated to %d mPowerAdjustmentInProgress %d", to_underlying(mOptOutState), + mPowerAdjustmentInProgress); + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, OptOutState::Id); + } + + // Cancel any outstanding PowerAdjustment if necessary + if (mPowerAdjustmentInProgress) + { + if ((newValue == OptOutStateEnum::kLocalOptOut && + mPowerAdjustCapabilityStruct.Value().cause == PowerAdjustReasonEnum::kLocalOptimizationAdjustment) || + (newValue == OptOutStateEnum::kGridOptOut && + mPowerAdjustCapabilityStruct.Value().cause == PowerAdjustReasonEnum::kGridOptimizationAdjustment) || + newValue == OptOutStateEnum::kOptOut) + { + err = CancelPowerAdjustRequestAndGenerateEvent(DeviceEnergyManagement::CauseEnum::kUserOptOut); + } + } + + // Cancel any outstanding PauseRequest if necessary + if (mPauseRequestInProgress) + { + // Cancel any outstanding PauseRequest + if ((newValue == OptOutStateEnum::kLocalOptOut && + mForecast.Value().forecastUpdateReason == ForecastUpdateReasonEnum::kLocalOptimization) || + (newValue == OptOutStateEnum::kGridOptOut && + mForecast.Value().forecastUpdateReason == ForecastUpdateReasonEnum::kGridOptimization) || + newValue == OptOutStateEnum::kOptOut) + { + err = CancelPauseRequestAndGenerateEvent(DeviceEnergyManagement::CauseEnum::kUserOptOut); + } + } + + if (!mForecast.IsNull()) + { + switch (mForecast.Value().forecastUpdateReason) + { + case ForecastUpdateReasonEnum::kInternalOptimization: + // We don't need to redo a forecast since its internal already + break; + case ForecastUpdateReasonEnum::kLocalOptimization: + if ((mOptOutState == OptOutStateEnum::kOptOut) || (mOptOutState == OptOutStateEnum::kLocalOptOut)) + { + mForecast.Value().forecastUpdateReason = ForecastUpdateReasonEnum::kInternalOptimization; + // Generate a new forecast with Internal Optimization + // TODO + } + break; + case ForecastUpdateReasonEnum::kGridOptimization: + if ((mOptOutState == OptOutStateEnum::kOptOut) || (mOptOutState == OptOutStateEnum::kGridOptOut)) + { + mForecast.Value().forecastUpdateReason = ForecastUpdateReasonEnum::kInternalOptimization; + // Generate a new forecast with Internal Optimization + // TODO + } + break; + default: + ChipLogDetail(AppServer, "Bad ForecastUpdateReasonEnum value of %d", + to_underlying(mForecast.Value().forecastUpdateReason)); + return CHIP_ERROR_BAD_REQUEST; + break; + } + } + + return err; } diff --git a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp index c31e0624e4c743..12f754a53ff804 100644 --- a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp +++ b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,6 +22,16 @@ using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::DeviceEnergyManagement; +namespace chip { +namespace app { +namespace Clusters { + +DeviceEnergyManagementManager::DeviceEnergyManagementManager(EndpointId aEndpointId, DeviceEnergyManagementDelegate & aDelegate, + Feature aFeature) : + DeviceEnergyManagement::Instance(aEndpointId, aDelegate, aFeature), + mDelegate(&aDelegate) +{} + CHIP_ERROR DeviceEnergyManagementManager::Init() { return Instance::Init(); @@ -31,3 +41,7 @@ void DeviceEnergyManagementManager::Shutdown() { Instance::Shutdown(); } + +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp index d9848bcbc53515..00ced85a9aa2b6 100644 --- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,9 +16,15 @@ * limitations under the License. */ +#include +#include #include +#include #include +#include +#include +#include #include #include #include @@ -35,7 +41,6 @@ using namespace chip::app::Clusters; using namespace chip::app::Clusters::EnergyEvse; using namespace chip::app::Clusters::ElectricalPowerMeasurement; using namespace chip::app::Clusters::ElectricalEnergyMeasurement; -using namespace chip::app::Clusters::ElectricalEnergyMeasurement::Structs; using namespace chip::app::Clusters::PowerSource; using namespace chip::app::Clusters::PowerSource::Attributes; @@ -58,6 +63,13 @@ CHIP_ERROR EVSEManufacturer::Init() ReturnErrorOnFailure(InitializePowerMeasurementCluster()); ReturnErrorOnFailure(InitializePowerSourceCluster()); + + DeviceEnergyManagementDelegate * dem = GetEvseManufacturer()->GetDEMDelegate(); + VerifyOrReturnLogError(dem != nullptr, CHIP_ERROR_UNINITIALIZED); + + /* For Device Energy Management we need the ESA to be Online and ready to accept commands */ + dem->SetESAState(ESAStateEnum::kOnline); + /* * This is an example implementation for manufacturers to consider * @@ -104,6 +116,217 @@ CHIP_ERROR EVSEManufacturer::Shutdown() return CHIP_NO_ERROR; } +CHIP_ERROR FindNextTarget(const BitMask dayOfWeekMap, uint16_t minutesPastMidnightNow_m, + uint16_t & targetTimeMinutesPastMidnight_m, DataModel::Nullable & targetSoC, + DataModel::Nullable & addedEnergy_mWh, bool bAllowTargetsInPast) +{ + EnergyEvse::Structs::ChargingTargetScheduleStruct::Type entry; + + uint16_t minTimeToTarget_m = 24 * 60; // 24 hours + bool bFound = false; + + EVSEManufacturer * mn = GetEvseManufacturer(); + VerifyOrReturnError(mn != nullptr, CHIP_ERROR_UNINITIALIZED); + + EnergyEvseDelegate * dg = mn->GetEvseDelegate(); + VerifyOrReturnError(dg != nullptr, CHIP_ERROR_UNINITIALIZED); + + const DataModel::List & chargingTargetSchedules = + dg->GetEvseTargetsDelegate()->GetTargets(); + for (auto & chargingTargetScheduleEntry : chargingTargetSchedules) + { + if (chargingTargetScheduleEntry.dayOfWeekForSequence.HasAny(dayOfWeekMap)) + { + // We've found today's schedule - iterate through the targets on this day + for (auto & chargingTarget : chargingTargetScheduleEntry.chargingTargets) + { + if ((chargingTarget.targetTimeMinutesPastMidnight < minutesPastMidnightNow_m) && (bAllowTargetsInPast == false)) + { + // This target is in the past so move to the next if there is one + continue; + } + + if (chargingTarget.targetTimeMinutesPastMidnight < minTimeToTarget_m) + { + // This is the earliest target found in the day's targets so far + bFound = true; + minTimeToTarget_m = chargingTarget.targetTimeMinutesPastMidnight; + + targetTimeMinutesPastMidnight_m = chargingTarget.targetTimeMinutesPastMidnight; + + if (chargingTarget.targetSoC.HasValue()) + { + targetSoC.SetNonNull(chargingTarget.targetSoC.Value()); + } + else + { + targetSoC.SetNull(); + } + + if (chargingTarget.addedEnergy.HasValue()) + { + addedEnergy_mWh.SetNonNull(chargingTarget.addedEnergy.Value()); + } + else + { + addedEnergy_mWh.SetNull(); + } + } + } + } + + if (bFound) + { + // Skip the rest of the search + break; + } + } + + return bFound ? CHIP_NO_ERROR : CHIP_ERROR_NOT_FOUND; +} + +/** + * @brief Simple example to demonstrate how an EVSE can compute the start time + * and duration of a charging schedule + */ +CHIP_ERROR EVSEManufacturer::ComputeChargingSchedule() +{ + CHIP_ERROR err; + EVSEManufacturer * mn = GetEvseManufacturer(); + VerifyOrReturnError(mn != nullptr, CHIP_ERROR_UNINITIALIZED); + + EnergyEvseDelegate * dg = mn->GetEvseDelegate(); + VerifyOrReturnError(dg != nullptr, CHIP_ERROR_UNINITIALIZED); + + BitMask dayOfWeekMap = 0; + ReturnErrorOnFailure(GetLocalDayOfWeekNow(dayOfWeekMap)); + + uint16_t minutesPastMidnightNow_m = 0; + ReturnErrorOnFailure(GetMinutesPastMidnight(minutesPastMidnightNow_m)); + + uint32_t now_epoch_s = 0; + ReturnErrorOnFailure(GetEpochTS(now_epoch_s)); + + DataModel::Nullable startTime_epoch_s; + DataModel::Nullable targetTime_epoch_s; + DataModel::Nullable targetSoC; + DataModel::Nullable addedEnergy_mWh; + + uint32_t power_W; + uint32_t chargingDuration_s; + uint32_t tempTargetTime_epoch_s; + uint32_t tempStartTime_epoch_s; + uint16_t targetTimeMinutesPastMidnight_m; + + // Initialise the values to Null - if the FindNextTarget finds one, then it will update the value + targetTime_epoch_s.SetNull(); + targetSoC.SetNull(); + addedEnergy_mWh.SetNull(); + startTime_epoch_s.SetNull(); // If we FindNextTarget this will be computed below and set to a non null value + + /* We can only compute charging schedules if the EV is plugged in and the charging is enabled + * so we know the charging current - i.e. can get the max power, and therefore can calculate + * the charging duration and hence start time + */ + if (dg->IsEvsePluggedIn() && dg->GetSupplyState() == SupplyStateEnum::kChargingEnabled) + { + uint8_t searchDay = 0; + while (searchDay < 2) + { + err = FindNextTarget(dayOfWeekMap, minutesPastMidnightNow_m, targetTimeMinutesPastMidnight_m, targetSoC, + addedEnergy_mWh, (searchDay != 0)); + if (err == CHIP_ERROR_NOT_FOUND) + { + // We didn't find one for today, try tomorrow + searchDay++; + dayOfWeekMap = BitMask((dayOfWeekMap.Raw() << 1) & kAllTargetDaysMask); + + if (!dayOfWeekMap.HasAny()) + { + // Must be Saturday and shifted off, so set it to Sunday + dayOfWeekMap = BitMask(TargetDayOfWeekBitmap::kSunday); + } + } + else + { + break; // We found a target or we error'd out for some other reason + } + } + + if (err == CHIP_NO_ERROR) + { + /* Set the target Time in epoch_s format*/ + tempTargetTime_epoch_s = + ((now_epoch_s / 60) + targetTimeMinutesPastMidnight_m + (searchDay * 1440) - minutesPastMidnightNow_m) * 60; + targetTime_epoch_s.SetNonNull(tempTargetTime_epoch_s); + + if (!targetSoC.IsNull()) + { + if (targetSoC.Value() != 100) + { + ChipLogError(AppServer, "EVSE WARNING: TargetSoC is not 100%% and we don't know the EV SoC!"); + } + // We don't know the Vehicle SoC so we must charge now + // TODO make this use the SoC featureMap to determine if this is an error + startTime_epoch_s.SetNonNull(now_epoch_s); + } + else + { + // We expect to use AddedEnergy to determine the charging start time + if (addedEnergy_mWh.IsNull()) + { + ChipLogError(AppServer, "EVSE ERROR: Neither TargetSoC or AddedEnergy has been provided"); + return CHIP_ERROR_INTERNAL; + } + // Simple optimizer - assume a flat tariff throughout the day + // Compute power from nominal voltage and maxChargingRate + // GetMaximumChargeCurrent returns mA, but to help avoid overflow + // We use V (not mV) and compute power to the nearest Watt + power_W = static_cast((230 * dg->GetMaximumChargeCurrent()) / + 1000); // TODO don't use 230V - not all markets will use that + if (power_W == 0) + { + ChipLogError(AppServer, "EVSE Error: MaxCurrent = 0Amp - Can't schedule charging"); + return CHIP_ERROR_INTERNAL; + } + + // Time to charge(seconds) = (3600 * Energy(mWh) / Power(W)) / 1000 + // to avoid using floats we multiply by 36 and then divide by 10 (instead of x3600 and dividing by 1000) + chargingDuration_s = static_cast(((addedEnergy_mWh.Value() / power_W) * 36) / 10); + + // Add in 15 minutes leeway to account for slow starting vehicles + // that need to condition the battery or if it is cold etc + chargingDuration_s += (15 * 60); + + // A price optimizer can look for cheapest time of day + // However for now we'll start charging as late as possible + tempStartTime_epoch_s = tempTargetTime_epoch_s - chargingDuration_s; + + if (tempStartTime_epoch_s < now_epoch_s) + { + // we need to turn on the EVSE now - it won't have enough time to reach the target + startTime_epoch_s.SetNonNull(now_epoch_s); + // TODO call function to turn on the EV + } + else + { + // we turn off the EVSE for now + startTime_epoch_s.SetNonNull(tempStartTime_epoch_s); + // TODO have a periodic timer which checks if we should turn on the charger now + } + } + } + } + + // Update the attributes to allow a UI to inform the user + dg->SetNextChargeStartTime(startTime_epoch_s); + dg->SetNextChargeTargetTime(targetTime_epoch_s); + dg->SetNextChargeRequiredEnergy(addedEnergy_mWh); + dg->SetNextChargeTargetSoC(targetSoC); + + return err; +} + /** * @brief Allows a client application to initialise the Accuracy, Measurement types etc */ @@ -176,6 +399,8 @@ CHIP_ERROR EVSEManufacturer::SendPowerReading(EndpointId aEndpointId, int64_t aA return CHIP_NO_ERROR; } +using namespace chip::app::Clusters::ElectricalEnergyMeasurement::Structs; + /** * @brief Allows a client application to send cumulative energy readings into the system * @@ -322,147 +547,6 @@ CHIP_ERROR EVSEManufacturer::SendPeriodicEnergyReading(EndpointId aEndpointId, i return CHIP_NO_ERROR; } -struct FakeReadingsData -{ - bool bEnabled; /* If enabled then the timer callback will re-trigger */ - EndpointId mEndpointId; /* Which endpoint the meter is on */ - uint8_t mInterval_s; /* Interval in seconds to callback */ - int64_t mPower_mW; /* Active Power on the load in mW (signed value) +ve = imported */ - uint32_t mPowerRandomness_mW; /* The amount to randomize the Power on the load in mW */ - int64_t mVoltage_mV; /* Voltage reading in mV (signed value) */ - uint32_t mVoltageRandomness_mV; /* The amount to randomize the Voltage in mV */ - int64_t mCurrent_mA; /* ActiveCurrent reading in mA (signed value) */ - uint32_t mCurrentRandomness_mA; /* The amount to randomize the ActiveCurrent in mA */ - - /* These energy values can only be positive values. - * however the underlying energy type (power_mWh) is signed, so keeping with that convention */ - int64_t mTotalEnergyImported = 0; /* Cumulative Energy Imported which is updated if mPower > 0 */ - int64_t mTotalEnergyExported = 0; /* Cumulative Energy Imported which is updated if mPower < 0 */ - int64_t mPeriodicEnergyImported = 0; /* Periodic Energy Imported which is updated if mPower > 0 */ - int64_t mPeriodicEnergyExported = 0; /* Periodic Energy Imported which is updated if mPower < 0 */ -}; - -static FakeReadingsData gFakeReadingsData; - -/* This helper routine starts and handles a callback */ -/** - * @brief Starts a fake load/generator to periodically callback the power and energy - * clusters. - * @param[in] aEndpointId - which endpoint is the meter to be updated on - * @param[in] aPower_mW - the mean power of the load - * Positive power indicates Imported energy (e.g. a load) - * Negative power indicated Exported energy (e.g. a generator) - * @param[in] aPowerRandomness_mW This is used to define the max randomness of the - * random power values around the mean power of the load - * @param[in] aVoltage_mV - the nominal voltage measurement - * @param[in] aVoltageRandomness_mV This is used to define the max randomness of the - * random voltage values - * @param[in] aCurrent_mA - the nominal current measurement - * @param[in] aCurrentRandomness_mA This is used to define the max randomness of the - * random current values - * @param[in] aInterval_s - the callback interval in seconds - * @param[in] bReset - boolean: true will reset the energy values to 0 - */ -void EVSEManufacturer::StartFakeReadings(EndpointId aEndpointId, int64_t aPower_mW, uint32_t aPowerRandomness_mW, - int64_t aVoltage_mV, uint32_t aVoltageRandomness_mV, int64_t aCurrent_mA, - uint32_t aCurrentRandomness_mA, uint8_t aInterval_s, bool bReset) -{ - gFakeReadingsData.bEnabled = true; - gFakeReadingsData.mEndpointId = aEndpointId; - gFakeReadingsData.mPower_mW = aPower_mW; - gFakeReadingsData.mPowerRandomness_mW = aPowerRandomness_mW; - gFakeReadingsData.mVoltage_mV = aVoltage_mV; - gFakeReadingsData.mVoltageRandomness_mV = aVoltageRandomness_mV; - gFakeReadingsData.mCurrent_mA = aCurrent_mA; - gFakeReadingsData.mCurrentRandomness_mA = aCurrentRandomness_mA; - gFakeReadingsData.mInterval_s = aInterval_s; - - if (bReset) - { - gFakeReadingsData.mTotalEnergyImported = 0; - gFakeReadingsData.mTotalEnergyExported = 0; - } - - // Call update function to kick off regular readings - FakeReadingsUpdate(); -} -/** - * @brief Stops any active updates to the fake load data callbacks - */ -void EVSEManufacturer::StopFakeReadings() -{ - gFakeReadingsData.bEnabled = false; -} -/** - * @brief Sends fake meter data into the cluster and restarts the timer - */ -void EVSEManufacturer::FakeReadingsUpdate() -{ - /* Check to see if the fake Load is still running - don't send updates if the timer was already cancelled */ - if (!gFakeReadingsData.bEnabled) - { - return; - } - - // Update readings - // Avoid using floats - so we will do a basic rand() call which will generate a integer value between 0 and RAND_MAX - // first compute power as a mean + some random value in range +/- mPowerRandomness_mW - int64_t power = - (static_cast(rand()) % (2 * gFakeReadingsData.mPowerRandomness_mW)) - gFakeReadingsData.mPowerRandomness_mW; - power += gFakeReadingsData.mPower_mW; // add in the base power - - int64_t voltage = - (static_cast(rand()) % (2 * gFakeReadingsData.mVoltageRandomness_mV)) - gFakeReadingsData.mVoltageRandomness_mV; - voltage += gFakeReadingsData.mVoltage_mV; // add in the base voltage - - /* Note: whilst we could compute a current from the power and voltage, - * there will always be some random error from the sensor - * that measures it. To keep this simple and to avoid doing divides in integer - * format etc use the same approach here too. - * This is meant more as an example to show how to use the APIs, not - * to be a real representation of laws of physics. - */ - int64_t current = - (static_cast(rand()) % (2 * gFakeReadingsData.mCurrentRandomness_mA)) - gFakeReadingsData.mCurrentRandomness_mA; - current += gFakeReadingsData.mCurrent_mA; // add in the base current - - SendPowerReading(gFakeReadingsData.mEndpointId, power, voltage, current); - - // update the energy meter - we'll assume that the power has been constant during the previous interval - if (gFakeReadingsData.mPower_mW > 0) - { - // Positive power - means power is imported - gFakeReadingsData.mPeriodicEnergyImported = ((power * gFakeReadingsData.mInterval_s) / 3600); - gFakeReadingsData.mPeriodicEnergyExported = 0; - gFakeReadingsData.mTotalEnergyImported += gFakeReadingsData.mPeriodicEnergyImported; - } - else - { - // Negative power - means power is exported, but the exported energy is reported positive - gFakeReadingsData.mPeriodicEnergyImported = 0; - gFakeReadingsData.mPeriodicEnergyExported = ((-power * gFakeReadingsData.mInterval_s) / 3600); - gFakeReadingsData.mTotalEnergyExported += gFakeReadingsData.mPeriodicEnergyExported; - } - - SendPeriodicEnergyReading(gFakeReadingsData.mEndpointId, gFakeReadingsData.mPeriodicEnergyImported, - gFakeReadingsData.mPeriodicEnergyExported); - - SendCumulativeEnergyReading(gFakeReadingsData.mEndpointId, gFakeReadingsData.mTotalEnergyImported, - gFakeReadingsData.mTotalEnergyExported); - - // start/restart the timer - DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(gFakeReadingsData.mInterval_s), FakeReadingsTimerExpiry, this); -} -/** - * @brief Timer expiry callback to handle fake load - */ -void EVSEManufacturer::FakeReadingsTimerExpiry(System::Layer * systemLayer, void * manufacturer) -{ - EVSEManufacturer * mn = reinterpret_cast(manufacturer); - - mn->FakeReadingsUpdate(); -} - /** * @brief Main Callback handler - to be implemented by Manufacturer * @@ -479,10 +563,12 @@ void EVSEManufacturer::ApplicationCallbackHandler(const EVSECbInfo * cb, intptr_ { case EVSECallbackType::StateChanged: ChipLogProgress(AppServer, "EVSE callback - state changed"); + pClass->ComputeChargingSchedule(); break; case EVSECallbackType::ChargeCurrentChanged: ChipLogProgress(AppServer, "EVSE callback - maxChargeCurrent changed to %ld", static_cast(cb->ChargingCurrent.maximumChargeCurrent)); + pClass->ComputeChargingSchedule(); break; case EVSECallbackType::EnergyMeterReadingRequested: ChipLogProgress(AppServer, "EVSE callback - EnergyMeterReadingRequested"); @@ -496,232 +582,75 @@ void EVSEManufacturer::ApplicationCallbackHandler(const EVSECbInfo * cb, intptr_ } break; + case EVSECallbackType::ChargingPreferencesChanged: + ChipLogProgress(AppServer, "EVSE callback - ChargingPreferencesChanged"); + pClass->ComputeChargingSchedule(); + break; + default: ChipLogError(AppServer, "Unhandled EVSE Callback type %d", static_cast(cb->type)); } } -struct EVSETestEventSaveData -{ - int64_t mOldMaxHardwareCurrentLimit; - int64_t mOldCircuitCapacity; - int64_t mOldUserMaximumChargeCurrent; - int64_t mOldCableAssemblyLimit; - StateEnum mOldHwStateBasic; /* For storing hwState before Basic Func event */ - StateEnum mOldHwStatePluggedIn; /* For storing hwState before PluggedIn event */ - StateEnum mOldHwStatePluggedInDemand; /* For storing hwState before PluggedInDemand event */ -}; - -static EVSETestEventSaveData sEVSETestEventSaveData; - -EnergyEvseDelegate * GetEvseDelegate() -{ - EVSEManufacturer * mn = GetEvseManufacturer(); - VerifyOrDieWithMsg(mn != nullptr, AppServer, "EVSEManufacturer is null"); - EnergyEvseDelegate * dg = mn->GetEvseDelegate(); - VerifyOrDieWithMsg(dg != nullptr, AppServer, "EVSE Delegate is null"); - - return dg; -} - -void SetTestEventTrigger_BasicFunctionality() -{ - EnergyEvseDelegate * dg = GetEvseDelegate(); - - sEVSETestEventSaveData.mOldMaxHardwareCurrentLimit = dg->HwGetMaxHardwareCurrentLimit(); - sEVSETestEventSaveData.mOldCircuitCapacity = dg->GetCircuitCapacity(); - sEVSETestEventSaveData.mOldUserMaximumChargeCurrent = dg->GetUserMaximumChargeCurrent(); - sEVSETestEventSaveData.mOldHwStateBasic = dg->HwGetState(); - - dg->HwSetMaxHardwareCurrentLimit(32000); - dg->HwSetCircuitCapacity(32000); - dg->SetUserMaximumChargeCurrent(32000); - dg->HwSetState(StateEnum::kNotPluggedIn); -} -void SetTestEventTrigger_BasicFunctionalityClear() +// The PowerAdjustEnd event needs to report the approximate energy used by the ESA during the session. +int64_t EVSEManufacturer::GetApproxEnergyDuringSession() { - EnergyEvseDelegate * dg = GetEvseDelegate(); - - dg->HwSetMaxHardwareCurrentLimit(sEVSETestEventSaveData.mOldMaxHardwareCurrentLimit); - dg->HwSetCircuitCapacity(sEVSETestEventSaveData.mOldCircuitCapacity); - dg->SetUserMaximumChargeCurrent(sEVSETestEventSaveData.mOldUserMaximumChargeCurrent); - dg->HwSetState(sEVSETestEventSaveData.mOldHwStateBasic); + return 300; } -void SetTestEventTrigger_EVPluggedIn() -{ - EnergyEvseDelegate * dg = GetEvseDelegate(); - - sEVSETestEventSaveData.mOldCableAssemblyLimit = dg->HwGetCableAssemblyLimit(); - sEVSETestEventSaveData.mOldHwStatePluggedIn = dg->HwGetState(); - dg->HwSetCableAssemblyLimit(63000); - dg->HwSetState(StateEnum::kPluggedInNoDemand); -} -void SetTestEventTrigger_EVPluggedInClear() +CHIP_ERROR EVSEManufacturer::HandleDeviceEnergyManagementPowerAdjustRequest(const int64_t powerMw, const uint32_t durationS, + AdjustmentCauseEnum cause) { - EnergyEvseDelegate * dg = GetEvseDelegate(); - dg->HwSetCableAssemblyLimit(sEVSETestEventSaveData.mOldCableAssemblyLimit); - dg->HwSetState(sEVSETestEventSaveData.mOldHwStatePluggedIn); -} - -void SetTestEventTrigger_EVChargeDemand() -{ - EnergyEvseDelegate * dg = GetEvseDelegate(); - - sEVSETestEventSaveData.mOldHwStatePluggedInDemand = dg->HwGetState(); - dg->HwSetState(StateEnum::kPluggedInDemand); + return CHIP_NO_ERROR; } -void SetTestEventTrigger_EVChargeDemandClear() -{ - EnergyEvseDelegate * dg = GetEvseDelegate(); - dg->HwSetState(sEVSETestEventSaveData.mOldHwStatePluggedInDemand); -} -void SetTestEventTrigger_EVSEGroundFault() +CHIP_ERROR EVSEManufacturer::HandleDeviceEnergyManagementPowerAdjustCompletion() { - EnergyEvseDelegate * dg = GetEvseDelegate(); - - dg->HwSetFault(FaultStateEnum::kGroundFault); + return CHIP_NO_ERROR; } -void SetTestEventTrigger_EVSEOverTemperatureFault() +CHIP_ERROR EVSEManufacturer::HandleDeviceEnergyManagementCancelPowerAdjustRequest(CauseEnum cause) { - EnergyEvseDelegate * dg = GetEvseDelegate(); - - dg->HwSetFault(FaultStateEnum::kOverTemperature); + return CHIP_NO_ERROR; } -void SetTestEventTrigger_EVSEFaultClear() +CHIP_ERROR EVSEManufacturer::HandleDeviceEnergyManagementStartTimeAdjustRequest(const uint32_t requestedStartTimeUtc, + AdjustmentCauseEnum cause) { - EnergyEvseDelegate * dg = GetEvseDelegate(); - - dg->HwSetFault(FaultStateEnum::kNoError); + return CHIP_NO_ERROR; } -void SetTestEventTrigger_EVSEDiagnosticsComplete() +CHIP_ERROR EVSEManufacturer::HandleDeviceEnergyManagementPauseRequest(const uint32_t durationS, AdjustmentCauseEnum cause) { - EnergyEvseDelegate * dg = GetEvseDelegate(); - - dg->HwDiagnosticsComplete(); + return CHIP_NO_ERROR; } -void SetTestEventTrigger_FakeReadingsLoadStart() +CHIP_ERROR EVSEManufacturer::HandleDeviceEnergyManagementCancelPauseRequest(CauseEnum cause) { - EVSEManufacturer * mn = GetEvseManufacturer(); - VerifyOrDieWithMsg(mn != nullptr, AppServer, "EVSEManufacturer is null"); - - int64_t aPower_mW = 1'000'000; // Fake load 1000 W - uint32_t aPowerRandomness_mW = 20'000; // randomness 20W - int64_t aVoltage_mV = 230'000; // Fake Voltage 230V - uint32_t aVoltageRandomness_mV = 1'000; // randomness 1V - int64_t aCurrent_mA = 4'348; // Fake Current (at 1kW@230V = 4.3478 Amps) - uint32_t aCurrentRandomness_mA = 500; // randomness 500mA - uint8_t aInterval_s = 2; // 2s updates - bool bReset = true; - mn->StartFakeReadings(EndpointId(1), aPower_mW, aPowerRandomness_mW, aVoltage_mV, aVoltageRandomness_mV, aCurrent_mA, - aCurrentRandomness_mA, aInterval_s, bReset); + return CHIP_NO_ERROR; } -void SetTestEventTrigger_FakeReadingsGeneratorStart() +CHIP_ERROR EVSEManufacturer::HandleDeviceEnergyManagementPauseCompletion() { - EVSEManufacturer * mn = GetEvseManufacturer(); - VerifyOrDieWithMsg(mn != nullptr, AppServer, "EVSEManufacturer is null"); - - int64_t aPower_mW = -3'000'000; // Fake Generator -3000 W - uint32_t aPowerRandomness_mW = 20'000; // randomness 20W - int64_t aVoltage_mV = 230'000; // Fake Voltage 230V - uint32_t aVoltageRandomness_mV = 1'000; // randomness 1V - int64_t aCurrent_mA = -13'043; // Fake Current (at -3kW@230V = -13.0434 Amps) - uint32_t aCurrentRandomness_mA = 500; // randomness 500mA - uint8_t aInterval_s = 5; // 5s updates - bool bReset = true; - mn->StartFakeReadings(EndpointId(1), aPower_mW, aPowerRandomness_mW, aVoltage_mV, aVoltageRandomness_mV, aCurrent_mA, - aCurrentRandomness_mA, aInterval_s, bReset); + return CHIP_NO_ERROR; } -void SetTestEventTrigger_FakeReadingsStop() +CHIP_ERROR EVSEManufacturer::HandleDeviceEnergyManagementCancelRequest() { - EVSEManufacturer * mn = GetEvseManufacturer(); - VerifyOrDieWithMsg(mn != nullptr, AppServer, "EVSEManufacturer is null"); - mn->StopFakeReadings(); + return CHIP_NO_ERROR; } -bool HandleEnergyEvseTestEventTrigger(uint64_t eventTrigger) +CHIP_ERROR EVSEManufacturer::HandleModifyForecastRequest( + const uint32_t forecastID, + const DataModel::DecodableList & slotAdjustments, + AdjustmentCauseEnum cause) { - EnergyEvseTrigger trigger = static_cast(eventTrigger); - - switch (trigger) - { - case EnergyEvseTrigger::kBasicFunctionality: - ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => Basic Functionality install"); - SetTestEventTrigger_BasicFunctionality(); - break; - case EnergyEvseTrigger::kBasicFunctionalityClear: - ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => Basic Functionality clear"); - SetTestEventTrigger_BasicFunctionalityClear(); - break; - case EnergyEvseTrigger::kEVPluggedIn: - ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV plugged in"); - SetTestEventTrigger_EVPluggedIn(); - break; - case EnergyEvseTrigger::kEVPluggedInClear: - ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV unplugged"); - SetTestEventTrigger_EVPluggedInClear(); - break; - case EnergyEvseTrigger::kEVChargeDemand: - ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV Charge Demand"); - SetTestEventTrigger_EVChargeDemand(); - break; - case EnergyEvseTrigger::kEVChargeDemandClear: - ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV Charge NoDemand"); - SetTestEventTrigger_EVChargeDemandClear(); - break; - case EnergyEvseTrigger::kEVSEGroundFault: - ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EVSE has a GroundFault fault"); - SetTestEventTrigger_EVSEGroundFault(); - break; - case EnergyEvseTrigger::kEVSEOverTemperatureFault: - ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EVSE has a OverTemperature fault"); - SetTestEventTrigger_EVSEOverTemperatureFault(); - break; - case EnergyEvseTrigger::kEVSEFaultClear: - ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EVSE faults have cleared"); - SetTestEventTrigger_EVSEFaultClear(); - break; - case EnergyEvseTrigger::kEVSEDiagnosticsComplete: - ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EVSE Diagnostics Completed"); - SetTestEventTrigger_EVSEDiagnosticsComplete(); - break; - - default: - return false; - } - - return true; + return CHIP_NO_ERROR; } -bool HandleEnergyReportingTestEventTrigger(uint64_t eventTrigger) +CHIP_ERROR EVSEManufacturer::RequestConstraintBasedForecast( + const DataModel::DecodableList & constraints, + AdjustmentCauseEnum cause) { - EnergyReportingTrigger trigger = static_cast(eventTrigger); - - switch (trigger) - { - case EnergyReportingTrigger::kFakeReadingsStop: - ChipLogProgress(Support, "[EnergyReporting-Test-Event] => Stop Fake load"); - SetTestEventTrigger_FakeReadingsStop(); - break; - case EnergyReportingTrigger::kFakeReadingsLoadStart_1kW_2s: - ChipLogProgress(Support, "[EnergyReporting-Test-Event] => Start Fake load 1kW @2s Import"); - SetTestEventTrigger_FakeReadingsLoadStart(); - break; - case EnergyReportingTrigger::kFakeReadingsGenStart_3kW_5s: - ChipLogProgress(Support, "[EnergyReporting-Test-Event] => Start Fake generator 3kW @5s Export"); - SetTestEventTrigger_FakeReadingsGeneratorStart(); - break; - - default: - return false; - } - - return true; + return CHIP_NO_ERROR; } diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index 99619fc95b5fb0..6266be245c2a4a 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -42,13 +43,6 @@ EnergyEvseDelegate::~EnergyEvseDelegate() } } -/** - * @brief Helper function to get current timestamp in Epoch format - * - * @param chipEpoch reference to hold return timestamp - */ -CHIP_ERROR GetEpochTS(uint32_t & chipEpoch); - /** * @brief Called when EVSE cluster receives Disable command */ @@ -63,7 +57,9 @@ Status EnergyEvseDelegate::Disable() /* update MinimumChargeCurrent & MaximumChargeCurrent to 0 */ SetMinimumChargeCurrent(0); - SetMaximumChargeCurrent(0); + + mMaximumChargingCurrentLimitFromCommand = 0; + ComputeMaxChargeCurrentLimit(); /* update MaximumDischargeCurrent to 0 */ SetMaximumDischargeCurrent(0); @@ -83,13 +79,13 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable & { ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableCharging()"); - if (maximumChargeCurrent < kMinimumChargeCurrent || maximumChargeCurrent > kMaximumChargeCurrent) + if (maximumChargeCurrent < kMinimumChargeCurrent) { ChipLogError(AppServer, "Maximum Current outside limits"); return Status::ConstraintError; } - if (minimumChargeCurrent < kMinimumChargeCurrent || minimumChargeCurrent > kMaximumChargeCurrent) + if (minimumChargeCurrent < kMinimumChargeCurrent) { ChipLogError(AppServer, "Maximum Current outside limits"); return Status::ConstraintError; @@ -177,7 +173,7 @@ Status EnergyEvseDelegate::ScheduleCheckOnEnabledTimeout() return Status::Success; } - CHIP_ERROR err = GetEpochTS(chipEpoch); + CHIP_ERROR err = DeviceEnergyManagement::GetEpochTS(chipEpoch); if (err == CHIP_NO_ERROR) { /* time is sync'd */ @@ -198,7 +194,7 @@ Status EnergyEvseDelegate::ScheduleCheckOnEnabledTimeout() else if (err == CHIP_ERROR_REAL_TIME_NOT_SYNCED) { /* Real time isn't sync'd -lets check again in 30 seconds - otherwise keep the charger enabled */ - DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(kPeriodicCheckIntervalRealTimeClockNotSynced), + DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(kPeriodicCheckIntervalRealTimeClockNotSynced_sec), EvseCheckTimerExpiry, this); } return Status::Success; @@ -234,6 +230,83 @@ Status EnergyEvseDelegate::StartDiagnostics() return Status::Success; } +/** + * @brief Called when EVSE cluster receives SetTargets command + */ +Status EnergyEvseDelegate::SetTargets( + const DataModel::DecodableList & chargingTargetSchedules) +{ + ChipLogProgress(AppServer, "EnergyEvseDelegate::SetTargets()"); + + EvseTargetsDelegate * targets = GetEvseTargetsDelegate(); + VerifyOrReturnError(targets != nullptr, Status::Failure); + + CHIP_ERROR err = targets->SetTargets(chargingTargetSchedules); + VerifyOrReturnError(err == CHIP_NO_ERROR, StatusIB(err).mStatus); + + /* The Application needs to be told that the Targets have been updated + * so it can potentially re-optimize the charging start time etc + */ + NotifyApplicationChargingPreferencesChange(); + + return Status::Success; +} + +Status EnergyEvseDelegate::LoadTargets() +{ + ChipLogProgress(AppServer, "EnergyEvseDelegate::LoadTargets()"); + + EvseTargetsDelegate * targets = GetEvseTargetsDelegate(); + VerifyOrReturnError(targets != nullptr, StatusIB(CHIP_ERROR_UNINITIALIZED).mStatus); + + CHIP_ERROR err = targets->LoadTargets(); + VerifyOrReturnError(err == CHIP_NO_ERROR, StatusIB(err).mStatus); + + return Status::Success; +} + +Status EnergyEvseDelegate::GetTargets(DataModel::List & chargingTargetSchedules) +{ + ChipLogProgress(AppServer, "EnergyEvseDelegate::GetTargets()"); + + EvseTargetsDelegate * targets = GetEvseTargetsDelegate(); + VerifyOrReturnError(targets != nullptr, StatusIB(CHIP_ERROR_UNINITIALIZED).mStatus); + + chargingTargetSchedules = targets->GetTargets(); + + return Status::Success; +} + +/** + * @brief Called when EVSE cluster receives ClearTargets command + */ +Status EnergyEvseDelegate::ClearTargets() +{ + ChipLogProgress(AppServer, "EnergyEvseDelegate::ClearTargets()"); + + CHIP_ERROR err; + + EvseTargetsDelegate * targets = GetEvseTargetsDelegate(); + if (targets == nullptr) + { + return StatusIB(CHIP_ERROR_UNINITIALIZED).mStatus; + } + + err = targets->ClearTargets(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Failed to clear Evse targets: %" CHIP_ERROR_FORMAT, err.Format()); + return Status::Failure; + } + + /* The Application needs to be told that the Targets have been deleted + * so it can potentially re-optimize the charging start time etc + */ + NotifyApplicationChargingPreferencesChange(); + + return Status::Success; +} + /* --------------------------------------------------------------------------- * EVSE Hardware interface below */ @@ -269,7 +342,7 @@ Status EnergyEvseDelegate::HwRegisterEvseCallbackHandler(EVSECallbackFunc handle */ Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA) { - if (currentmA < kMinimumChargeCurrent || currentmA > kMaximumChargeCurrent) + if (currentmA < kMinimumChargeCurrent) { return Status::ConstraintError; } @@ -291,7 +364,7 @@ Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA) */ Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA) { - if (currentmA < kMinimumChargeCurrent || currentmA > kMaximumChargeCurrent) + if (currentmA < kMinimumChargeCurrent) { return Status::ConstraintError; } @@ -316,7 +389,7 @@ Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA) */ Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA) { - if (currentmA < kMinimumChargeCurrent || currentmA > kMaximumChargeCurrent) + if (currentmA < kMinimumChargeCurrent) { return Status::ConstraintError; } @@ -909,6 +982,20 @@ Status EnergyEvseDelegate::NotifyApplicationStateChange() return Status::Success; } +Status EnergyEvseDelegate::NotifyApplicationChargingPreferencesChange() +{ + EVSECbInfo cbInfo; + + cbInfo.type = EVSECallbackType::ChargingPreferencesChanged; + + if (mCallbacks.handler != nullptr) + { + mCallbacks.handler(&cbInfo, mCallbacks.arg); + } + + return Status::Success; +} + Status EnergyEvseDelegate::GetEVSEEnergyMeterValue(ChargingDischargingType meterType, int64_t & aMeterValue) { EVSECbInfo cbInfo; @@ -1227,7 +1314,7 @@ CHIP_ERROR EnergyEvseDelegate::SetCircuitCapacity(int64_t newValue) { int64_t oldValue = mCircuitCapacity; - if (newValue >= kMaximumChargeCurrent) + if (newValue < 0) { return CHIP_IM_GLOBAL_STATUS(ConstraintError); } @@ -1251,7 +1338,7 @@ CHIP_ERROR EnergyEvseDelegate::SetMinimumChargeCurrent(int64_t newValue) { int64_t oldValue = mMinimumChargeCurrent; - if (newValue >= kMaximumChargeCurrent) + if (newValue < 0) { return CHIP_IM_GLOBAL_STATUS(ConstraintError); } @@ -1271,24 +1358,6 @@ int64_t EnergyEvseDelegate::GetMaximumChargeCurrent() return mMaximumChargeCurrent; } -CHIP_ERROR EnergyEvseDelegate::SetMaximumChargeCurrent(int64_t newValue) -{ - int64_t oldValue = mMaximumChargeCurrent; - - if (newValue >= kMaximumChargeCurrent) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - - mMaximumChargeCurrent = newValue; - if (oldValue != mMaximumChargeCurrent) - { - ChipLogDetail(AppServer, "MaximumChargeCurrent updated to %ld", static_cast(mMaximumChargeCurrent)); - MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumChargeCurrent::Id); - } - return CHIP_NO_ERROR; -} - /* MaximumDischargeCurrent */ int64_t EnergyEvseDelegate::GetMaximumDischargeCurrent() { @@ -1299,7 +1368,7 @@ CHIP_ERROR EnergyEvseDelegate::SetMaximumDischargeCurrent(int64_t newValue) { int64_t oldValue = mMaximumDischargeCurrent; - if (newValue >= kMaximumChargeCurrent) + if (newValue < 0) { return CHIP_IM_GLOBAL_STATUS(ConstraintError); } @@ -1321,7 +1390,7 @@ int64_t EnergyEvseDelegate::GetUserMaximumChargeCurrent() CHIP_ERROR EnergyEvseDelegate::SetUserMaximumChargeCurrent(int64_t newValue) { - if ((newValue < 0) || (newValue > kMaximumChargeCurrent)) + if (newValue < 0) { return CHIP_IM_GLOBAL_STATUS(ConstraintError); } @@ -1378,18 +1447,105 @@ DataModel::Nullable EnergyEvseDelegate::GetNextChargeStartTime() { return mNextChargeStartTime; } +CHIP_ERROR EnergyEvseDelegate::SetNextChargeStartTime(DataModel::Nullable newNextChargeStartTimeUtc) +{ + if (newNextChargeStartTimeUtc == mNextChargeStartTime) + { + return CHIP_NO_ERROR; + } + + mNextChargeStartTime = newNextChargeStartTimeUtc; + if (mNextChargeStartTime.IsNull()) + { + ChipLogDetail(AppServer, "NextChargeStartTime updated to Null"); + } + else + { + ChipLogDetail(AppServer, "NextChargeStartTime updated to %lu", + static_cast(mNextChargeStartTime.Value())); + } + + MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, NextChargeStartTime::Id); + + return CHIP_NO_ERROR; +} + DataModel::Nullable EnergyEvseDelegate::GetNextChargeTargetTime() { return mNextChargeTargetTime; } +CHIP_ERROR EnergyEvseDelegate::SetNextChargeTargetTime(DataModel::Nullable newNextChargeTargetTimeUtc) +{ + if (newNextChargeTargetTimeUtc == mNextChargeTargetTime) + { + return CHIP_NO_ERROR; + } + + mNextChargeTargetTime = newNextChargeTargetTimeUtc; + if (mNextChargeTargetTime.IsNull()) + { + ChipLogDetail(AppServer, "NextChargeTargetTime updated to Null"); + } + else + { + ChipLogDetail(AppServer, "NextChargeTargetTime updated to %lu", + static_cast(mNextChargeTargetTime.Value())); + } + + MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, NextChargeTargetTime::Id); + + return CHIP_NO_ERROR; +} + DataModel::Nullable EnergyEvseDelegate::GetNextChargeRequiredEnergy() { return mNextChargeRequiredEnergy; } +CHIP_ERROR EnergyEvseDelegate::SetNextChargeRequiredEnergy(DataModel::Nullable newNextChargeRequiredEnergyMilliWattH) +{ + if (mNextChargeRequiredEnergy == newNextChargeRequiredEnergyMilliWattH) + { + return CHIP_NO_ERROR; + } + + mNextChargeRequiredEnergy = newNextChargeRequiredEnergyMilliWattH; + if (mNextChargeRequiredEnergy.IsNull()) + { + ChipLogDetail(AppServer, "NextChargeRequiredEnergy updated to Null"); + } + else + { + ChipLogDetail(AppServer, "NextChargeRequiredEnergy updated to %ld", static_cast(mNextChargeRequiredEnergy.Value())); + } + + MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, NextChargeRequiredEnergy::Id); + + return CHIP_NO_ERROR; +} + DataModel::Nullable EnergyEvseDelegate::GetNextChargeTargetSoC() { return mNextChargeTargetSoC; } +CHIP_ERROR EnergyEvseDelegate::SetNextChargeTargetSoC(DataModel::Nullable newValue) +{ + DataModel::Nullable oldValue = mNextChargeTargetSoC; + + mNextChargeTargetSoC = newValue; + if (oldValue != newValue) + { + if (newValue.IsNull()) + { + ChipLogDetail(AppServer, "NextChargeTargetSoC updated to Null"); + } + else + { + ChipLogDetail(AppServer, "NextChargeTargetSoC updated to %d %%", mNextChargeTargetSoC.Value()); + } + MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, NextChargeTargetSoC::Id); + } + return CHIP_NO_ERROR; +} /* ApproximateEVEfficiency */ DataModel::Nullable EnergyEvseDelegate::GetApproximateEVEfficiency() @@ -1402,7 +1558,7 @@ CHIP_ERROR EnergyEvseDelegate::SetApproximateEVEfficiency(DataModel::Nullable oldValue = mApproximateEVEfficiency; mApproximateEVEfficiency = newValue; - if ((oldValue != newValue)) + if (oldValue != newValue) { if (newValue.IsNull()) { @@ -1458,42 +1614,13 @@ DataModel::Nullable EnergyEvseDelegate::GetSessionEnergyDischarged() } /** - * @brief Helper function to get current timestamp in Epoch format - * - * @param chipEpoch reference to hold return timestamp + * @brief Helper function to get know if the EV is plugged in based on state + * (regardless of if it is actually transferring energy) */ -CHIP_ERROR GetEpochTS(uint32_t & chipEpoch) +bool EnergyEvseDelegate::IsEvsePluggedIn() { - chipEpoch = 0; - - System::Clock::Milliseconds64 cTMs; - CHIP_ERROR err = System::SystemClock().GetClock_RealTimeMS(cTMs); - - /* If the GetClock_RealTimeMS returns CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, then - * This platform cannot ever report real time ! - * This should not be certifiable since getting time is a Mandatory - * feature of EVSE Cluster - */ - if (err == CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE) - { - ChipLogError(Zcl, "Platform does not support GetClock_RealTimeMS. Check EVSE certification requirements!"); - return err; - } - - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "EVSE: Unable to get current time - err:%" CHIP_ERROR_FORMAT, err.Format()); - return err; - } - - auto unixEpoch = std::chrono::duration_cast(cTMs).count(); - if (!UnixEpochToChipEpochTime(unixEpoch, chipEpoch)) - { - ChipLogError(Zcl, "EVSE: unable to convert Unix Epoch time to Matter Epoch Time"); - return err; - } - - return CHIP_NO_ERROR; + return (mState == StateEnum::kPluggedInCharging || mState == StateEnum::kPluggedInDemand || + mState == StateEnum::kPluggedInDischarging || mState == StateEnum::kPluggedInNoDemand); } /** @@ -1506,7 +1633,7 @@ void EvseSession::StartSession(int64_t chargingMeterValue, int64_t dischargingMe { /* Get Timestamp */ uint32_t chipEpoch = 0; - CHIP_ERROR err = GetEpochTS(chipEpoch); + CHIP_ERROR err = DeviceEnergyManagement::GetEpochTS(chipEpoch); if (err != CHIP_NO_ERROR) { /* Note that the error will be also be logged inside GetErrorTS() - @@ -1548,6 +1675,8 @@ void EvseSession::StartSession(int64_t chargingMeterValue, int64_t dischargingMe // TODO persist mSessionEnergyDischargedAtStart } +/*---------------------- EvseSession functions --------------------------*/ + /** * @brief This function updates the session attrs to allow read attributes to return latest values */ @@ -1555,7 +1684,7 @@ void EvseSession::RecalculateSessionDuration() { /* Get Timestamp */ uint32_t chipEpoch = 0; - CHIP_ERROR err = GetEpochTS(chipEpoch); + CHIP_ERROR err = DeviceEnergyManagement::GetEpochTS(chipEpoch); if (err != CHIP_NO_ERROR) { /* Note that the error will be also be logged inside GetErrorTS() - diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseEventTriggers.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseEventTriggers.cpp new file mode 100644 index 00000000000000..a164bb0bafb341 --- /dev/null +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseEventTriggers.cpp @@ -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. + */ + +#include + +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::EnergyEvse; + +struct EVSETestEventSaveData +{ + int64_t mOldMaxHardwareCurrentLimit; + int64_t mOldCircuitCapacity; + int64_t mOldUserMaximumChargeCurrent; + int64_t mOldCableAssemblyLimit; + StateEnum mOldHwStateBasic; /* For storing hwState before Basic Func event */ + StateEnum mOldHwStatePluggedIn; /* For storing hwState before PluggedIn event */ + StateEnum mOldHwStatePluggedInDemand; /* For storing hwState before PluggedInDemand event */ +}; + +static EVSETestEventSaveData sEVSETestEventSaveData; + +EnergyEvseDelegate * GetEvseDelegate() +{ + EVSEManufacturer * mn = GetEvseManufacturer(); + VerifyOrDieWithMsg(mn != nullptr, AppServer, "EVSEManufacturer is null"); + EnergyEvseDelegate * dg = mn->GetEvseDelegate(); + VerifyOrDieWithMsg(dg != nullptr, AppServer, "EVSE Delegate is null"); + + return dg; +} + +void SetTestEventTrigger_BasicFunctionality() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + + sEVSETestEventSaveData.mOldMaxHardwareCurrentLimit = dg->HwGetMaxHardwareCurrentLimit(); + sEVSETestEventSaveData.mOldCircuitCapacity = dg->GetCircuitCapacity(); + sEVSETestEventSaveData.mOldUserMaximumChargeCurrent = dg->GetUserMaximumChargeCurrent(); + sEVSETestEventSaveData.mOldHwStateBasic = dg->HwGetState(); + + dg->HwSetMaxHardwareCurrentLimit(32000); + dg->HwSetCircuitCapacity(32000); + dg->SetUserMaximumChargeCurrent(32000); + dg->HwSetState(StateEnum::kNotPluggedIn); +} +void SetTestEventTrigger_BasicFunctionalityClear() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + + dg->HwSetMaxHardwareCurrentLimit(sEVSETestEventSaveData.mOldMaxHardwareCurrentLimit); + dg->HwSetCircuitCapacity(sEVSETestEventSaveData.mOldCircuitCapacity); + dg->SetUserMaximumChargeCurrent(sEVSETestEventSaveData.mOldUserMaximumChargeCurrent); + dg->HwSetState(sEVSETestEventSaveData.mOldHwStateBasic); +} +void SetTestEventTrigger_EVPluggedIn() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + + sEVSETestEventSaveData.mOldCableAssemblyLimit = dg->HwGetCableAssemblyLimit(); + sEVSETestEventSaveData.mOldHwStatePluggedIn = dg->HwGetState(); + + dg->HwSetCableAssemblyLimit(63000); + dg->HwSetState(StateEnum::kPluggedInNoDemand); +} +void SetTestEventTrigger_EVPluggedInClear() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + dg->HwSetCableAssemblyLimit(sEVSETestEventSaveData.mOldCableAssemblyLimit); + dg->HwSetState(sEVSETestEventSaveData.mOldHwStatePluggedIn); +} + +void SetTestEventTrigger_EVChargeDemand() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + + sEVSETestEventSaveData.mOldHwStatePluggedInDemand = dg->HwGetState(); + dg->HwSetState(StateEnum::kPluggedInDemand); +} +void SetTestEventTrigger_EVChargeDemandClear() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + + dg->HwSetState(sEVSETestEventSaveData.mOldHwStatePluggedInDemand); +} +void SetTestEventTrigger_EVTimeOfUseMode() +{ + // TODO - See #34249 +} +void SetTestEventTrigger_EVTimeOfUseModeClear() +{ + // TODO - See #34249 +} +void SetTestEventTrigger_EVSEGroundFault() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + + dg->HwSetFault(FaultStateEnum::kGroundFault); +} + +void SetTestEventTrigger_EVSEOverTemperatureFault() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + + dg->HwSetFault(FaultStateEnum::kOverTemperature); +} + +void SetTestEventTrigger_EVSEFaultClear() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + + dg->HwSetFault(FaultStateEnum::kNoError); +} + +void SetTestEventTrigger_EVSEDiagnosticsComplete() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + + dg->HwDiagnosticsComplete(); +} + +bool HandleEnergyEvseTestEventTrigger(uint64_t eventTrigger) +{ + EnergyEvseTrigger trigger = static_cast(eventTrigger); + + switch (trigger) + { + case EnergyEvseTrigger::kBasicFunctionality: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => Basic Functionality install"); + SetTestEventTrigger_BasicFunctionality(); + break; + case EnergyEvseTrigger::kBasicFunctionalityClear: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => Basic Functionality clear"); + SetTestEventTrigger_BasicFunctionalityClear(); + break; + case EnergyEvseTrigger::kEVPluggedIn: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV plugged in"); + SetTestEventTrigger_EVPluggedIn(); + break; + case EnergyEvseTrigger::kEVPluggedInClear: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV unplugged"); + SetTestEventTrigger_EVPluggedInClear(); + break; + case EnergyEvseTrigger::kEVChargeDemand: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV Charge Demand"); + SetTestEventTrigger_EVChargeDemand(); + break; + case EnergyEvseTrigger::kEVChargeDemandClear: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV Charge NoDemand"); + SetTestEventTrigger_EVChargeDemandClear(); + break; + case EnergyEvseTrigger::kEVTimeOfUseMode: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV TimeOfUse Mode"); + SetTestEventTrigger_EVTimeOfUseMode(); + break; + case EnergyEvseTrigger::kEVSEGroundFault: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EVSE has a GroundFault fault"); + SetTestEventTrigger_EVSEGroundFault(); + break; + case EnergyEvseTrigger::kEVSEOverTemperatureFault: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EVSE has a OverTemperature fault"); + SetTestEventTrigger_EVSEOverTemperatureFault(); + break; + case EnergyEvseTrigger::kEVSEFaultClear: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EVSE faults have cleared"); + SetTestEventTrigger_EVSEFaultClear(); + break; + case EnergyEvseTrigger::kEVSEDiagnosticsComplete: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EVSE Diagnostics Completed"); + SetTestEventTrigger_EVSEDiagnosticsComplete(); + break; + case EnergyEvseTrigger::kEVTimeOfUseModeClear: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV TimeOfUse Mode clear"); + SetTestEventTrigger_EVTimeOfUseModeClear(); + break; + default: + return false; + } + + return true; +} diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp index 6eeaaf8369c38c..bd22c67eafd9b5 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp @@ -16,6 +16,8 @@ * limitations under the License. */ +#include "EnergyManagementAppCmdLineOptions.h" + #include #include #include @@ -47,6 +49,7 @@ using namespace chip::app::Clusters::ElectricalEnergyMeasurement; using namespace chip::app::Clusters::PowerTopology; static std::unique_ptr gEvseDelegate; +static std::unique_ptr gEvseTargetsDelegate; static std::unique_ptr gEvseInstance; static std::unique_ptr gDEMDelegate; static std::unique_ptr gDEMInstance; @@ -86,13 +89,10 @@ CHIP_ERROR DeviceEnergyManagementInit() return CHIP_ERROR_NO_MEMORY; } + BitMask featureMap = GetFeatureMapFromCmdLine(); + /* Manufacturer may optionally not support all features, commands & attributes */ - gDEMInstance = std::make_unique( - EndpointId(ENERGY_EVSE_ENDPOINT), *gDEMDelegate, - BitMask( - DeviceEnergyManagement::Feature::kPowerAdjustment, DeviceEnergyManagement::Feature::kPowerForecastReporting, - DeviceEnergyManagement::Feature::kStateForecastReporting, DeviceEnergyManagement::Feature::kStartTimeAdjustment, - DeviceEnergyManagement::Feature::kPausable)); + gDEMInstance = std::make_unique(EndpointId(ENERGY_EVSE_ENDPOINT), *gDEMDelegate, featureMap); if (!gDEMInstance) { @@ -101,6 +101,8 @@ CHIP_ERROR DeviceEnergyManagementInit() return CHIP_ERROR_NO_MEMORY; } + gDEMDelegate->SetDeviceEnergyManagementInstance(*gDEMInstance); + CHIP_ERROR err = gDEMInstance->Init(); /* Register Attribute & Command handlers */ if (err != CHIP_NO_ERROR) { @@ -142,16 +144,24 @@ CHIP_ERROR EnergyEvseInit() { CHIP_ERROR err; - if (gEvseDelegate || gEvseInstance) + if (gEvseDelegate || gEvseInstance || gEvseTargetsDelegate) { - ChipLogError(AppServer, "EVSE Instance or Delegate already exist."); + ChipLogError(AppServer, "EVSE Instance, Delegate or TargetsDelegate already exist."); return CHIP_ERROR_INCORRECT_STATE; } - gEvseDelegate = std::make_unique(); + gEvseTargetsDelegate = std::make_unique(); + if (!gEvseTargetsDelegate) + { + ChipLogError(AppServer, "Failed to allocate memory for EvseTargetsDelegate"); + return CHIP_ERROR_NO_MEMORY; + } + + gEvseDelegate = std::make_unique(*gEvseTargetsDelegate); if (!gEvseDelegate) { ChipLogError(AppServer, "Failed to allocate memory for EnergyEvseDelegate"); + gEvseTargetsDelegate.reset(); return CHIP_ERROR_NO_MEMORY; } @@ -167,6 +177,7 @@ CHIP_ERROR EnergyEvseInit() if (!gEvseInstance) { ChipLogError(AppServer, "Failed to allocate memory for EnergyEvseManager"); + gEvseTargetsDelegate.reset(); gEvseDelegate.reset(); return CHIP_ERROR_NO_MEMORY; } @@ -175,6 +186,17 @@ CHIP_ERROR EnergyEvseInit() if (err != CHIP_NO_ERROR) { ChipLogError(AppServer, "Init failed on gEvseInstance"); + gEvseTargetsDelegate.reset(); + gEvseInstance.reset(); + gEvseDelegate.reset(); + return err; + } + + err = gEvseTargetsDelegate->LoadTargets(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Failed to LoadTargets"); + gEvseTargetsDelegate.reset(); gEvseInstance.reset(); gEvseDelegate.reset(); return err; @@ -375,13 +397,16 @@ CHIP_ERROR EVSEManufacturerInit() } /* Now create EVSEManufacturer */ - gEvseManufacturer = std::make_unique(gEvseInstance.get(), gEPMInstance.get(), gPTInstance.get()); + gEvseManufacturer = + std::make_unique(gEvseInstance.get(), gEPMInstance.get(), gPTInstance.get(), gDEMInstance.get()); if (!gEvseManufacturer) { ChipLogError(AppServer, "Failed to allocate memory for EvseManufacturer"); return CHIP_ERROR_NO_MEMORY; } + gDEMDelegate.get()->SetDEMManufacturerDelegate(*gEvseManufacturer.get()); + /* Call Manufacturer specific init */ err = gEvseManufacturer->Init(); if (err != CHIP_NO_ERROR) diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp index f4b3941e8c1ca7..52a8fec55673dd 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,6 +18,7 @@ #include #include +#include using namespace chip::app; using namespace chip::app::Clusters; @@ -117,6 +118,16 @@ CHIP_ERROR EnergyEvseManager::LoadPersistentAttributes() CHIP_ERROR EnergyEvseManager::Init() { ReturnErrorOnFailure(Instance::Init()); + + // Set up the EnergyEvseTargetsStore and persistent storage delegate + EnergyEvseDelegate * dg = GetDelegate(); + VerifyOrReturnLogError(dg != nullptr, CHIP_ERROR_UNINITIALIZED); + + EvseTargetsDelegate * targetsStore = dg->GetEvseTargetsDelegate(); + VerifyOrReturnLogError(targetsStore != nullptr, CHIP_ERROR_UNINITIALIZED); + + ReturnErrorOnFailure(targetsStore->Init(&Server::GetInstance().GetPersistentStorage())); + return LoadPersistentAttributes(); } diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp new file mode 100644 index 00000000000000..f15e0b7a109817 --- /dev/null +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp @@ -0,0 +1,489 @@ +/* + * + * 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 +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::DataModel; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::EnergyEvse; +using chip::Protocols::InteractionModel::Status; + +EvseTargetsDelegate::EvseTargetsDelegate() {} + +EvseTargetsDelegate::~EvseTargetsDelegate() {} + +CHIP_ERROR EvseTargetsDelegate::Init(PersistentStorageDelegate * targetStore) +{ + ChipLogProgress(AppServer, "EVSE: Initializing EvseTargetsDelegate"); + VerifyOrReturnError(targetStore != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + + mpTargetStore = targetStore; + + // Set FabricDelegate + chip::Server::GetInstance().GetFabricTable().AddFabricDelegate(this); + + return CHIP_NO_ERROR; +} + +const DataModel::List & EvseTargetsDelegate::GetTargets() +{ + return mChargingTargetSchedulesList; +} + +/* static */ +uint16_t EvseTargetsDelegate::GetTlvSizeUpperBound() +{ + size_t kListOverhead = 4; + size_t chargingTargetStuctEstimate = + TLV::EstimateStructOverhead(sizeof(uint16_t), sizeof(Optional), sizeof(Optional)); + size_t chargingTargetScheduleStructEstimate = TLV::EstimateStructOverhead(sizeof(chip::BitMask)) + + kListOverhead + kEvseTargetsMaxTargetsPerDay * chargingTargetStuctEstimate; + size_t totalEstimate = kEvseTargetsMaxNumberOfDays * chargingTargetScheduleStructEstimate + kListOverhead; + + return static_cast(totalEstimate); +} + +CHIP_ERROR EvseTargetsDelegate::LoadTargets() +{ + // The DataModel::List data structure contains a list of + // ChargingTargetScheduleStructs which in turn contains a list of ChargingTargetStructs. Lists contain pointers + // to objects allocated outside of the List. For mChargingTargetSchedulesList, that memory is allocated in + // mChargingTargets and mChargingTargetSchedulesArray. + + Platform::ScopedMemoryBuffer backingBuffer; + uint16_t length = GetTlvSizeUpperBound(); + ReturnErrorCodeIf(!backingBuffer.Calloc(length), CHIP_ERROR_NO_MEMORY); + + CHIP_ERROR err = mpTargetStore->SyncGetKeyValue(spEvseTargetsKeyName, backingBuffer.Get(), length); + if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) + { + // Targets does not exist persistent storage -> initialise mChargingTargetSchedulesList as empty + mChargingTargetSchedulesList = DataModel::List(); + + return CHIP_NO_ERROR; + } + ReturnErrorOnFailure(err); + + TLV::ScopedBufferTLVReader reader(std::move(backingBuffer), length); + + ReturnErrorOnFailure(reader.Next(TLV::kTLVType_Array, TLV::AnonymousTag())); + TLV::TLVType arrayType; + ReturnErrorOnFailure(reader.EnterContainer(arrayType)); + + uint16_t chargingTargetSchedulesIdx = 0; + while ((err = reader.Next(TLV::kTLVType_Structure, TLV::AnonymousTag())) == CHIP_NO_ERROR) + { + TLV::TLVType evseTargetEntryType; + + ReturnErrorOnFailure(reader.EnterContainer(evseTargetEntryType)); + + // Check we are not exceeding the size of the mChargingTargetSchedulesArray + VerifyOrReturnError(chargingTargetSchedulesIdx < kEvseTargetsMaxNumberOfDays, CHIP_ERROR_INCORRECT_STATE); + + // DayOfWeek bitmap + ReturnErrorOnFailure(reader.Next(TLV::ContextTag(TargetEntryTag::kDayOfWeek))); + ReturnErrorOnFailure(reader.Get(mChargingTargetSchedulesArray[chargingTargetSchedulesIdx].dayOfWeekForSequence)); + + ChipLogProgress(AppServer, "LoadTargets: DayOfWeekForSequence = 0x%02x", + mChargingTargetSchedulesArray[chargingTargetSchedulesIdx].dayOfWeekForSequence.GetField( + static_cast(kAllTargetDaysMask))); + + // ChargingTargets List + ReturnErrorOnFailure(reader.Next(TLV::kTLVType_List, TLV::ContextTag(TargetEntryTag::kChargingTargetsList))); + TLV::TLVType chargingTargetsListType; + ReturnErrorOnFailure(reader.EnterContainer(chargingTargetsListType)); + + // The mChargingTargets object handles the allocation of the chargingTargets. Let it know the currentSchedule index + mChargingTargets.PrepareDaySchedule(chargingTargetSchedulesIdx); + + // Load the chargingTargets associated with this schedule + while ((err = reader.Next(TLV::kTLVType_Structure, TLV::ContextTag(TargetEntryTag::kChargingTargetsStruct))) == + CHIP_NO_ERROR) + { + TLV::TLVType chargingTargetsStructType = TLV::kTLVType_Structure; + ReturnErrorOnFailure(reader.EnterContainer(chargingTargetsStructType)); + + // Keep track of the current chargingTarget being loaded + EnergyEvse::Structs::ChargingTargetStruct::Type chargingTarget; + + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + auto type = reader.GetType(); + auto tag = reader.GetTag(); + if (type == TLV::kTLVType_NotSpecified) + { + // Something wrong - we've lost alignment + return CHIP_ERROR_UNEXPECTED_TLV_ELEMENT; + } + + if (tag == TLV::ContextTag(TargetEntryTag::kTargetTime)) + { + ReturnErrorOnFailure(reader.Get(chargingTarget.targetTimeMinutesPastMidnight)); + } + else if (tag == TLV::ContextTag(TargetEntryTag::kTargetSoC)) + { + chip::Percent tempSoC; + ReturnErrorOnFailure(reader.Get(tempSoC)); + chargingTarget.targetSoC.SetValue(tempSoC); + } + else if (tag == TLV::ContextTag(TargetEntryTag::kAddedEnergy)) + { + int64_t tempAddedEnergy; + ReturnErrorOnFailure(reader.Get(tempAddedEnergy)); + chargingTarget.addedEnergy.SetValue(tempAddedEnergy); + } + else + { + // Something else unexpected here + return CHIP_ERROR_UNEXPECTED_TLV_ELEMENT; + } + } + + ReturnErrorOnFailure(reader.ExitContainer(chargingTargetsStructType)); + + ChipLogProgress(AppServer, + "LoadingTargets: targetTimeMinutesPastMidnight %u targetSoC %u addedEnergy 0x" ChipLogFormatX64, + chargingTarget.targetTimeMinutesPastMidnight, chargingTarget.targetSoC.ValueOr(0), + ChipLogValueX64(chargingTarget.addedEnergy.ValueOr(0))); + + // Update mChargingTargets which is tracking the chargingTargets + mChargingTargets.AddChargingTarget(chargingTarget); + } + + ReturnErrorOnFailure(reader.ExitContainer(chargingTargetsListType)); + ReturnErrorOnFailure(reader.ExitContainer(evseTargetEntryType)); + + // Allocate an array for the chargingTargets loaded for this schedule and copy the chargingTargets into that array. + // The allocated array will be pointed to in the List below. + err = mChargingTargets.AllocAndCopy(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "SetTargets: Failed to allocate memory during LoadTargets %s", chip::ErrorStr(err)); + return err; + } + + // Construct the List. mChargingTargetSchedulesArray will be pointed to in the + // List mChargingTargetSchedulesList below + mChargingTargetSchedulesArray[chargingTargetSchedulesIdx].chargingTargets = + chip::app::DataModel::List( + mChargingTargets.GetChargingTargets(), mChargingTargets.GetNumDailyChargingTargets()); + + chargingTargetSchedulesIdx++; + } + + ReturnErrorOnFailure(reader.ExitContainer(arrayType)); + + // Finalise mChargingTargetSchedulesList + mChargingTargetSchedulesList = DataModel::List(mChargingTargetSchedulesArray, + chargingTargetSchedulesIdx); + + return reader.VerifyEndOfContainer(); +} + +/** + * This function tries to compress a list of entries which has: + * dayOfWeek bitmask + * chargingTargetsList + * + * It takes a new entry and scans the existing list to see if the + * dayOfWeek bitmask is already included somewhere + * + * compute bitmask values: + * + * bitmaskA: (entry.bitmask & bitmask) + * work out which bits in the existing entry are the same (overlapping) + * + * Create and append a new entry for the bits that are the same + * newEntry.bitmask = bitmaskA; + * newEntry.chargingTargetsList = chargingTargetsList + * + * if entry.bitmask == bitmaskA + * this entry is being deleted and can share the newEntry + * delete it + * + * bitmaskB = (entry.bitmask & ~bitmask); + * work out which bits in the existing entry are different + * Remove these bits from the existing entry, (effectively deleting them) + * entry.bitmask = bitmaskB; + * + * NOTE: if `all` bits are removed then the existing entry can be deleted, + * but that's not possible because we check for a full match first + * + * We continue walking our list to see if other entries have overlapping bits + * If they do, then the newEntry.bitmask |= bitmaskA + * + */ +CHIP_ERROR EvseTargetsDelegate::SetTargets( + const DataModel::DecodableList & newChargingTargetSchedules) +{ + ChipLogProgress(AppServer, "SetTargets"); + + // We'll need to have a local copy of the chargingTargets that are referenced from updatedChargingTargetSchedules (which + // is a List where each ChargingTargetScheduleStruct has a List of ChargingTargetStructs). + // Note updatedChargingTargets only needs to exist for the duration of this method as once the new targets have been merged + // with the existing targets, we'll save the updated Targets structure to persistent storage and the reload it into + // mChargingTargetSchedulesList + ChargingTargetsMemMgr updatedChargingTargets; + + // Build up a new Targets structure + DataModel::DecodableList updatedChargingTargetSchedules; + + // updatedChargingTargetSchedules contains a List of ChargingTargetScheduleStruct where the memory of + // ChargingTargetScheduleStruct is which is allocated here. + Structs::ChargingTargetScheduleStruct::Type updatedChargingTargetSchedulesArray[kEvseTargetsMaxNumberOfDays]; + + // Iterate across the list of new schedules. For each schedule, iterate through the existing Target + // (mChargingTargetSchedulesList) working out how to merge the new schedule. + auto newIter = newChargingTargetSchedules.begin(); + while (newIter.Next()) + { + auto & newChargingTargetSchedule = newIter.GetValue(); + + uint8_t newBitmask = + newChargingTargetSchedule.dayOfWeekForSequence.GetField(static_cast(kAllTargetDaysMask)); + + ChipLogProgress(AppServer, "SetTargets: DayOfWeekForSequence = 0x%02x", newBitmask); + + PrintTargets(mChargingTargetSchedulesList); + + // Iterate across the existing schedule entries, seeing if there is overlap with + // the dayOfWeekForSequenceBitmap + bool found = false; + uint16_t updatedChargingTargetSchedulesIdx = 0; + + // Let the updatedChargingTargets object of the schedule index + updatedChargingTargets.PrepareDaySchedule(updatedChargingTargetSchedulesIdx); + + for (auto & currentChargingTargetSchedule : mChargingTargetSchedulesList) + { + uint8_t currentBitmask = + currentChargingTargetSchedule.dayOfWeekForSequence.GetField(static_cast(kAllTargetDaysMask)); + + ChipLogProgress(AppServer, "SetTargets: Scanning current entry %d of %d: bitmap 0x%02x", + updatedChargingTargetSchedulesIdx, static_cast(mChargingTargetSchedulesList.size()), + currentBitmask); + + // Work out if the new schedule dayOfWeekSequence overlaps with any existing schedules + uint8_t bitmaskA = static_cast(currentBitmask & newBitmask); + uint8_t bitmaskB = static_cast(currentBitmask & ~newBitmask); + + BitMask updatedBitmask; + + if (currentBitmask == bitmaskA) + { + // This entry has the all the same bits as the newEntry + updatedBitmask = BitMask(bitmaskA); + + // Copy the new chargingTargets to this schedule index + CHIP_ERROR err = updatedChargingTargets.AllocAndCopy(newChargingTargetSchedule.chargingTargets); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "SetTargets: Failed to copy the new chargingTargets %s", chip::ErrorStr(err)); + return err; + } + + found = true; + } + else + { + // This entry stays - but it has lost some days from the bitmask + updatedBitmask = BitMask(bitmaskB); + + // Copy the existing chargingTargets + CHIP_ERROR err = updatedChargingTargets.AllocAndCopy(currentChargingTargetSchedule.chargingTargets); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "SetTargets: Failed to copy the new chargingTargets %s", chip::ErrorStr(err)); + return err; + } + } + + // Update the new schedule with the dayOfWeekForSequence and list of chargingTargets + updatedChargingTargetSchedulesArray[updatedChargingTargetSchedulesIdx].dayOfWeekForSequence = updatedBitmask; + + updatedChargingTargetSchedulesArray[updatedChargingTargetSchedulesIdx].chargingTargets = + chip::app::DataModel::List( + updatedChargingTargets.GetChargingTargets(), updatedChargingTargets.GetNumDailyChargingTargets()); + + // Going to look at the next schedule entry + updatedChargingTargetSchedulesIdx++; + + // Let the updatedChargingTargets object of the schedule index + updatedChargingTargets.PrepareDaySchedule(updatedChargingTargetSchedulesIdx); + } + + // If found is false, then there were no existing entries for the dayOfWeekForSequence. Add a new entry + if (!found) + { + // Copy the new chargingTargets + CHIP_ERROR err = updatedChargingTargets.AllocAndCopy(newChargingTargetSchedule.chargingTargets); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "SetTargets: Failed to copy the new chargingTargets %s", chip::ErrorStr(err)); + return err; + } + + // Update the new schedule with the dayOfWeekForSequence and list of chargingTargets + updatedChargingTargetSchedulesArray[updatedChargingTargetSchedulesIdx].dayOfWeekForSequence = + newChargingTargetSchedule.dayOfWeekForSequence; + + updatedChargingTargetSchedulesArray[updatedChargingTargetSchedulesIdx].chargingTargets = + chip::app::DataModel::List( + updatedChargingTargets.GetChargingTargets(), updatedChargingTargets.GetNumDailyChargingTargets()); + + // We've added a new schedule entry + updatedChargingTargetSchedulesIdx++; + + // Let the updatedChargingTargets object of the schedule index + updatedChargingTargets.PrepareDaySchedule(updatedChargingTargetSchedulesIdx); + } + + // Now create the full Target data structure that we are going to save to persistent storage + DataModel::List updatedChargingTargetSchedulesList( + updatedChargingTargetSchedulesArray, updatedChargingTargetSchedulesIdx); + + CHIP_ERROR err = SaveTargets(updatedChargingTargetSchedulesList); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "SetTargets: Failed to save Target to persistent storage %s", chip::ErrorStr(err)); + return err; + } + + // Now reload from persistent storage so that mChargingTargetSchedulesList gets the update Target + err = LoadTargets(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "SetTargets: Failed to load Target from persistent storage %s", chip::ErrorStr(err)); + return err; + } + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR +EvseTargetsDelegate::SaveTargets(DataModel::List & chargingTargetSchedulesList) +{ + uint16_t total = GetTlvSizeUpperBound(); + + Platform::ScopedMemoryBuffer backingBuffer; + ReturnErrorCodeIf(!backingBuffer.Calloc(total), CHIP_ERROR_NO_MEMORY); + TLV::ScopedBufferTLVWriter writer(std::move(backingBuffer), total); + + TLV::TLVType arrayType; + ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Array, arrayType)); + for (auto & chargingTargetSchedule : chargingTargetSchedulesList) + { + ChipLogProgress( + AppServer, "SaveTargets: DayOfWeekForSequence = 0x%02x", + chargingTargetSchedule.dayOfWeekForSequence.GetField(static_cast(kAllTargetDaysMask))); + + TLV::TLVType evseTargetEntryType; + ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, evseTargetEntryType)); + ReturnErrorOnFailure(writer.Put(TLV::ContextTag(TargetEntryTag::kDayOfWeek), chargingTargetSchedule.dayOfWeekForSequence)); + + TLV::TLVType chargingTargetsListType; + ReturnErrorOnFailure(writer.StartContainer(TLV::ContextTag(TargetEntryTag::kChargingTargetsList), TLV::kTLVType_List, + chargingTargetsListType)); + for (auto & chargingTarget : chargingTargetSchedule.chargingTargets) + { + TLV::TLVType chargingTargetsStructType = TLV::kTLVType_Structure; + ReturnErrorOnFailure(writer.StartContainer(TLV::ContextTag(TargetEntryTag::kChargingTargetsStruct), + TLV::kTLVType_Structure, chargingTargetsStructType)); + ReturnErrorOnFailure( + writer.Put(TLV::ContextTag(TargetEntryTag::kTargetTime), chargingTarget.targetTimeMinutesPastMidnight)); + if (chargingTarget.targetSoC.HasValue()) + { + ReturnErrorOnFailure(writer.Put(TLV::ContextTag(TargetEntryTag::kTargetSoC), chargingTarget.targetSoC.Value())); + } + + if (chargingTarget.addedEnergy.HasValue()) + { + ReturnErrorOnFailure(writer.Put(TLV::ContextTag(TargetEntryTag::kAddedEnergy), chargingTarget.addedEnergy.Value())); + } + + ReturnErrorOnFailure(writer.EndContainer(chargingTargetsStructType)); + } + ReturnErrorOnFailure(writer.EndContainer(chargingTargetsListType)); + ReturnErrorOnFailure(writer.EndContainer(evseTargetEntryType)); + } + + ReturnErrorOnFailure(writer.EndContainer(arrayType)); + + uint64_t len = static_cast(writer.GetLengthWritten()); + ChipLogProgress(AppServer, "SaveTargets: length written 0x" ChipLogFormatX64, ChipLogValueX64(len)); + + writer.Finalize(backingBuffer); + + ReturnErrorOnFailure(mpTargetStore->SyncSetKeyValue(spEvseTargetsKeyName, backingBuffer.Get(), static_cast(len))); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR EvseTargetsDelegate::ClearTargets() +{ + /* We simply delete the data from the persistent store */ + mpTargetStore->SyncDeleteKeyValue(spEvseTargetsKeyName); + + // Now reload from persistent storage so that mChargingTargetSchedulesList gets updated (it will be empty) + CHIP_ERROR err = LoadTargets(); + + return err; +} + +void EvseTargetsDelegate::PrintTargets( + const DataModel::List & chargingTargetSchedules) +{ + ChipLogProgress(AppServer, "---------------------- TARGETS ---------------------"); + + uint16_t chargingTargetScheduleIdx = 0; + for (auto & chargingTargetSchedule : chargingTargetSchedules) + { + [[maybe_unused]] uint8_t bitmask = + chargingTargetSchedule.dayOfWeekForSequence.GetField(static_cast(kAllTargetDaysMask)); + ChipLogProgress(AppServer, "idx %u dayOfWeekForSequence 0x%02x", chargingTargetScheduleIdx, bitmask); + + uint16_t chargingTargetIdx = 0; + for (auto & chargingTarget : chargingTargetSchedule.chargingTargets) + { + [[maybe_unused]] int64_t addedEnergy = chargingTarget.addedEnergy.HasValue() ? chargingTarget.addedEnergy.Value() : 0; + + ChipLogProgress( + AppServer, "chargingTargetIdx %u targetTimeMinutesPastMidnight %u targetSoC %u addedEnergy 0x" ChipLogFormatX64, + chargingTargetIdx, chargingTarget.targetTimeMinutesPastMidnight, + chargingTarget.targetSoC.HasValue() ? chargingTarget.targetSoC.Value() : 0, ChipLogValueX64(addedEnergy)); + + chargingTargetIdx++; + } + + chargingTargetScheduleIdx++; + } +} + +/** + * Part of the FabricTable::Delegate interface. Gets called when a fabric is deleted, such as on FabricTable::Delete(). + **/ +void EvseTargetsDelegate::OnFabricRemoved(const FabricTable & fabricTable, FabricIndex fabricIndex) {} diff --git a/examples/energy-management-app/energy-management-common/src/EnergyReportingEventTriggers.cpp b/examples/energy-management-app/energy-management-common/src/EnergyReportingEventTriggers.cpp new file mode 100644 index 00000000000000..e01612a5f408d3 --- /dev/null +++ b/examples/energy-management-app/energy-management-common/src/EnergyReportingEventTriggers.cpp @@ -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. + */ + +#include "FakeReadings.h" + +#include + +using namespace chip; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::ElectricalEnergyMeasurement; +using namespace chip::app::Clusters::ElectricalEnergyMeasurement::Structs; + +void SetTestEventTrigger_FakeReadingsLoadStart() +{ + int64_t aPower_mW = 1'000'000; // Fake load 1000 W + uint32_t aPowerRandomness_mW = 20'000; // randomness 20W + int64_t aVoltage_mV = 230'000; // Fake Voltage 230V + uint32_t aVoltageRandomness_mV = 1'000; // randomness 1V + int64_t aCurrent_mA = 4'348; // Fake Current (at 1kW@230V = 4.3478 Amps) + uint32_t aCurrentRandomness_mA = 500; // randomness 500mA + uint8_t aInterval_s = 2; // 2s updates + bool bReset = true; + FakeReadings::GetInstance().StartFakeReadings(EndpointId(1), aPower_mW, aPowerRandomness_mW, aVoltage_mV, aVoltageRandomness_mV, + aCurrent_mA, aCurrentRandomness_mA, aInterval_s, bReset); +} + +void SetTestEventTrigger_FakeReadingsGeneratorStart() +{ + int64_t aPower_mW = -3'000'000; // Fake Generator -3000 W + uint32_t aPowerRandomness_mW = 20'000; // randomness 20W + int64_t aVoltage_mV = 230'000; // Fake Voltage 230V + uint32_t aVoltageRandomness_mV = 1'000; // randomness 1V + int64_t aCurrent_mA = -13'043; // Fake Current (at -3kW@230V = -13.0434 Amps) + uint32_t aCurrentRandomness_mA = 500; // randomness 500mA + uint8_t aInterval_s = 5; // 5s updates + bool bReset = true; + FakeReadings::GetInstance().StartFakeReadings(EndpointId(1), aPower_mW, aPowerRandomness_mW, aVoltage_mV, aVoltageRandomness_mV, + aCurrent_mA, aCurrentRandomness_mA, aInterval_s, bReset); +} + +void SetTestEventTrigger_FakeReadingsStop() +{ + FakeReadings::GetInstance().StopFakeReadings(); +} + +bool HandleEnergyReportingTestEventTrigger(uint64_t eventTrigger) +{ + EnergyReportingTrigger trigger = static_cast(eventTrigger); + + switch (trigger) + { + case EnergyReportingTrigger::kFakeReadingsStop: + ChipLogProgress(Support, "[EnergyReporting-Test-Event] => Stop Fake load"); + SetTestEventTrigger_FakeReadingsStop(); + break; + case EnergyReportingTrigger::kFakeReadingsLoadStart_1kW_2s: + ChipLogProgress(Support, "[EnergyReporting-Test-Event] => Start Fake load 1kW @2s Import"); + SetTestEventTrigger_FakeReadingsLoadStart(); + break; + case EnergyReportingTrigger::kFakeReadingsGenStart_3kW_5s: + ChipLogProgress(Support, "[EnergyReporting-Test-Event] => Start Fake generator 3kW @5s Export"); + SetTestEventTrigger_FakeReadingsGeneratorStart(); + break; + + default: + return false; + } + + return true; +} diff --git a/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp b/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp new file mode 100644 index 00000000000000..60732c0f3b0497 --- /dev/null +++ b/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp @@ -0,0 +1,153 @@ +/* + * + * 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 + +using namespace chip; +using namespace chip::app; +using namespace chip::app::DataModel; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::EnergyEvse; +using namespace chip::app::Clusters::EnergyEvse::Attributes; + +using chip::app::LogEvent; +using chip::Protocols::InteractionModel::Status; + +namespace chip { +namespace app { +namespace Clusters { +namespace DeviceEnergyManagement { + +/** + * @brief Helper function to get current timestamp in Epoch format + * + * @param[out] chipEpoch reference to hold return timestamp. Set to 0 if an error occurs. + */ +CHIP_ERROR GetEpochTS(uint32_t & chipEpoch) +{ + chipEpoch = 0; + + System::Clock::Milliseconds64 cTMs; + CHIP_ERROR err = System::SystemClock().GetClock_RealTimeMS(cTMs); + + /* If the GetClock_RealTimeMS returns CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, then + * This platform cannot ever report real time ! + * This should not be certifiable since getting time is a Mandatory + * feature of EVSE Cluster + */ + VerifyOrDie(err != CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Unable to get current time - err:%" CHIP_ERROR_FORMAT, err.Format()); + return err; + } + + auto unixEpoch = std::chrono::duration_cast(cTMs).count(); + if (!UnixEpochToChipEpochTime(unixEpoch, chipEpoch)) + { + ChipLogError(Zcl, "Unable to convert Unix Epoch time to Matter Epoch Time"); + return CHIP_ERROR_INCORRECT_STATE; + } + + return CHIP_NO_ERROR; +} + +/** + * @brief Helper function to get current timestamp and work out the day of week + * + * NOTE that the time_t is converted using localtime to provide the timestamp + * in local time. If this is not supported on some platforms an alternative + * implementation may be required. + * + * @param unixEpoch (as time_t) + * + * @return bitmap value for day of week as defined by EnergyEvse::TargetDayOfWeekBitmap. Note + * only one bit will be set for the day of the week. + */ +BitMask GetLocalDayOfWeekFromUnixEpoch(time_t unixEpoch) +{ + // Define a timezone structure and initialize it to the local timezone + // This will capture any daylight saving time changes + struct tm local_time; + localtime_r(&unixEpoch, &local_time); + + // Get the day of the week (0 = Sunday, 1 = Monday, ..., 6 = Saturday) + uint8_t dayOfWeek = static_cast(local_time.tm_wday); + + // Calculate the bitmap value based on the day of the week. Note that the value in bitmap + // maps directly to the definition in EnergyEvse::TargetDayOfWeekBitmap. + uint8_t bitmap = static_cast(1 << dayOfWeek); + + return bitmap; +} +/** + * @brief Helper function to get current timestamp and work out the day of week based on localtime + * + * @return bitmap value for day of week as defined by EnergyEvse::TargetDayOfWeekBitmap. Note + * only one bit will be set for the current day. + */ +CHIP_ERROR GetLocalDayOfWeekNow(BitMask & dayOfWeekMap) +{ + System::Clock::Milliseconds64 cTMs; + CHIP_ERROR err = chip::System::SystemClock().GetClock_RealTimeMS(cTMs); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Uable to get current time. error=%" CHIP_ERROR_FORMAT, err.Format()); + return err; + } + time_t unixEpoch = std::chrono::duration_cast(cTMs).count(); + dayOfWeekMap = GetLocalDayOfWeekFromUnixEpoch(unixEpoch); + + return CHIP_NO_ERROR; +} + +/** + * @brief Helper function to get current timestamp and work out the current number of minutes + * past midnight based on localtime + * + * @param reference to hold the number of minutes past midnight + */ +CHIP_ERROR GetMinutesPastMidnight(uint16_t & minutesPastMidnight) +{ + System::Clock::Milliseconds64 cTMs; + CHIP_ERROR err = System::SystemClock().GetClock_RealTimeMS(cTMs); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "EVSE: unable to get current time to check user schedules error=%" CHIP_ERROR_FORMAT, err.Format()); + return err; + } + time_t unixEpoch = std::chrono::duration_cast(cTMs).count(); + + // Define a timezone structure and initialize it to the local timezone + // This will capture any daylight saving time changes + struct tm local_time; + localtime_r(&unixEpoch, &local_time); + + minutesPastMidnight = static_cast((local_time.tm_hour * 60) + local_time.tm_min); + + return err; +} + +} // namespace DeviceEnergyManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/energy-management-app/energy-management-common/src/FakeReadings.cpp b/examples/energy-management-app/energy-management-common/src/FakeReadings.cpp new file mode 100644 index 00000000000000..c887357a5f7b58 --- /dev/null +++ b/examples/energy-management-app/energy-management-common/src/FakeReadings.cpp @@ -0,0 +1,182 @@ +/* + * + * 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 + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "FakeReadings.h" + +using namespace chip; +using namespace chip::app; +using namespace chip::app::DataModel; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::EnergyEvse; +using namespace chip::app::Clusters::ElectricalPowerMeasurement; +using namespace chip::app::Clusters::ElectricalEnergyMeasurement; +using namespace chip::app::Clusters::ElectricalEnergyMeasurement::Structs; +using namespace chip::app::Clusters::PowerSource; +using namespace chip::app::Clusters::PowerSource::Attributes; + +using Protocols::InteractionModel::Status; + +FakeReadings::FakeReadings() {} + +FakeReadings::~FakeReadings() {} + +/* static */ +FakeReadings & FakeReadings::GetInstance() +{ + static FakeReadings sInstance; + + return sInstance; +} + +/** + * @brief Starts a fake load/generator to periodically callback the power and energy + * clusters. + * @param[in] aEndpointId - which endpoint is the meter to be updated on + * @param[in] aPower_mW - the mean power of the load + * Positive power indicates Imported energy (e.g. a load) + * Negative power indicated Exported energy (e.g. a generator) + * @param[in] aPowerRandomness_mW This is used to define the max randomness of the + * random power values around the mean power of the load + * @param[in] aVoltage_mV - the nominal voltage measurement + * @param[in] aVoltageRandomness_mV This is used to define the max randomness of the + * random voltage values + * @param[in] aCurrent_mA - the nominal current measurement + * @param[in] aCurrentRandomness_mA This is used to define the max randomness of the + * random current values + * @param[in] aInterval_s - the callback interval in seconds + * @param[in] bReset - boolean: true will reset the energy values to 0 + */ +void FakeReadings::StartFakeReadings(EndpointId aEndpointId, int64_t aPower_mW, uint32_t aPowerRandomness_mW, int64_t aVoltage_mV, + uint32_t aVoltageRandomness_mV, int64_t aCurrent_mA, uint32_t aCurrentRandomness_mA, + uint8_t aInterval_s, bool bReset) +{ + bEnabled = true; + mEndpointId = aEndpointId; + mPower_mW = aPower_mW; + mPowerRandomness_mW = aPowerRandomness_mW; + mVoltage_mV = aVoltage_mV; + mVoltageRandomness_mV = aVoltageRandomness_mV; + mCurrent_mA = aCurrent_mA; + mCurrentRandomness_mA = aCurrentRandomness_mA; + mInterval_s = aInterval_s; + + if (bReset) + { + // Use a fixed random seed to try to avoid random CI test failures + // which are caused when the test is checking for 2 different numbers. + // This is statistically more likely when the test runs for a long time + // or if the seed is not set + srand(1); + + mTotalEnergyImported = 0; + mTotalEnergyExported = 0; + } + + // Call update function to kick off regular readings + FakeReadingsUpdate(); +} + +/** + * @brief Stops any active updates to the fake load data callbacks + */ +void FakeReadings::StopFakeReadings() +{ + bEnabled = false; +} + +/** + * @brief Sends fake meter data into the cluster and restarts the timer + */ +void FakeReadings::FakeReadingsUpdate() +{ + /* Check to see if the fake Load is still running - don't send updates if the timer was already cancelled */ + if (!bEnabled) + { + return; + } + + // Update readings + // Avoid using floats - so we will do a basic rand() call which will generate a integer value between 0 and RAND_MAX + // first compute power as a mean + some random value in range +/- mPowerRandomness_mW + int64_t power = (static_cast(rand()) % (2 * mPowerRandomness_mW)) - mPowerRandomness_mW; + power += mPower_mW; // add in the base power + + int64_t voltage = (static_cast(rand()) % (2 * mVoltageRandomness_mV)) - mVoltageRandomness_mV; + voltage += mVoltage_mV; // add in the base voltage + + /* Note: whilst we could compute a current from the power and voltage, + * there will always be some random error from the sensor + * that measures it. To keep this simple and to avoid doing divides in integer + * format etc use the same approach here too. + * This is meant more as an example to show how to use the APIs, not + * to be a real representation of laws of physics. + */ + int64_t current = (static_cast(rand()) % (2 * mCurrentRandomness_mA)) - mCurrentRandomness_mA; + current += mCurrent_mA; // add in the base current + + GetEvseManufacturer()->SendPowerReading(mEndpointId, power, voltage, current); + + // update the energy meter - we'll assume that the power has been constant during the previous interval + if (mPower_mW > 0) + { + // Positive power - means power is imported + mPeriodicEnergyImported = ((power * mInterval_s) / 3600); + mPeriodicEnergyExported = 0; + mTotalEnergyImported += mPeriodicEnergyImported; + } + else + { + // Negative power - means power is exported, but the exported energy is reported positive + mPeriodicEnergyImported = 0; + mPeriodicEnergyExported = ((-power * mInterval_s) / 3600); + mTotalEnergyExported += mPeriodicEnergyExported; + } + + GetEvseManufacturer()->SendPeriodicEnergyReading(mEndpointId, mPeriodicEnergyImported, mPeriodicEnergyExported); + + GetEvseManufacturer()->SendCumulativeEnergyReading(mEndpointId, mTotalEnergyImported, mTotalEnergyExported); + + // start/restart the timer + DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(mInterval_s), FakeReadingsTimerExpiry, this); +} + +/** + * @brief Timer expiry callback to handle fake load + */ +void FakeReadings::FakeReadingsTimerExpiry(System::Layer * systemLayer, void * manufacturer) +{ + FakeReadings * mn = reinterpret_cast(manufacturer); + + mn->FakeReadingsUpdate(); +} diff --git a/examples/energy-management-app/energy-management-common/tests/BUILD.gn b/examples/energy-management-app/energy-management-common/tests/BUILD.gn new file mode 100644 index 00000000000000..b55340a527233d --- /dev/null +++ b/examples/energy-management-app/energy-management-common/tests/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright (c) 2020-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("${chip_root}/build/chip/chip_test_suite.gni") + +config("tests_config") { + include_dirs = [ "${chip_root}/examples/energy-management-app/energy-management-common/include" ] +} + +chip_test_suite("tests") { + output_name = "libEnergyTest" + output_dir = "${root_out_dir}/lib" + + public_configs = [ ":tests_config" ] + + test_sources = [ "TestEvseTargetsStorage.cpp" ] + + cflags = [ "-Wconversion" ] + + public_deps = [ + "${chip_root}/examples/energy-management-app/energy-management-common", + "${chip_root}/examples/energy-management-app/linux:test-evse-targets-store", + "${chip_root}/src/app", + "${chip_root}/src/app/common:cluster-objects", + "${chip_root}/src/app/tests:helpers", + "${chip_root}/src/lib", + "${chip_root}/src/lib/core", + "${chip_root}/src/lib/support:testing", + ] +} diff --git a/examples/energy-management-app/energy-management-common/tests/TestEvseTargetsStorage.cpp b/examples/energy-management-app/energy-management-common/tests/TestEvseTargetsStorage.cpp new file mode 100644 index 00000000000000..6a1f2ec4c424f1 --- /dev/null +++ b/examples/energy-management-app/energy-management-common/tests/TestEvseTargetsStorage.cpp @@ -0,0 +1,219 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "EnergyEvseTargetsStore.h" + +using namespace chip; +using namespace chip::app; +using namespace chip::app::DataModel; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::EnergyEvse; + +namespace { + +constexpr uint16_t ENERGY_EVSE_SET_TARGETS_DAYS_IN_A_WEEK = 7; +constexpr uint16_t ENERGY_EVSE_SET_TARGETS_MAX_CHARGING_TARGETS = 10; + +class TestEvseTargetsStorage : public ::testing::Test +{ +public: + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } + + bool CompTargets(const DataModel::List & targets1, + const DataModel::List & targets2); + + void PopulateTargets(uint16_t numDays, uint16_t numChargingTargetsPerDay); + + void SetTargets(); + void CheckTargets(); + +private: + uint8_t mStore[4096]; + + EnergyEvse::Structs::ChargingTargetScheduleStruct::Type mChargingTargetSchedules[ENERGY_EVSE_SET_TARGETS_DAYS_IN_A_WEEK]; + EnergyEvse::Structs::ChargingTargetStruct::Type mChargingTargets[ENERGY_EVSE_SET_TARGETS_DAYS_IN_A_WEEK] + [ENERGY_EVSE_SET_TARGETS_MAX_CHARGING_TARGETS]; + chip::app::DataModel::List + mChargingTargetsList[ENERGY_EVSE_SET_TARGETS_DAYS_IN_A_WEEK]; + + chip::app::DataModel::List mRefChargingTargetSchedulesList; + DataModel::DecodableList mDecodableChargingTargetSchedulesList; + + TestPersistentStorageDelegate mStorageDelegate; + + EvseTargetsDelegate mEtd; + bool mEtdInitialised = false; +}; + +TEST_F(TestEvseTargetsStorage, TestEmpty) +{ + PopulateTargets(0, 0); + SetTargets(); + CheckTargets(); +} + +TEST_F(TestEvseTargetsStorage, TestFull) +{ + PopulateTargets(ENERGY_EVSE_SET_TARGETS_DAYS_IN_A_WEEK, ENERGY_EVSE_SET_TARGETS_MAX_CHARGING_TARGETS); + SetTargets(); + CheckTargets(); +} + +TEST_F(TestEvseTargetsStorage, TestPartial1) +{ + PopulateTargets(ENERGY_EVSE_SET_TARGETS_DAYS_IN_A_WEEK, 1); + SetTargets(); + CheckTargets(); +} + +TEST_F(TestEvseTargetsStorage, TestPartial2) +{ + PopulateTargets(1, ENERGY_EVSE_SET_TARGETS_MAX_CHARGING_TARGETS); + SetTargets(); + CheckTargets(); +} + +bool TestEvseTargetsStorage::CompTargets(const DataModel::List & targets1, + const DataModel::List & targets2) +{ + if (targets1.size() != targets2.size()) + { + ChipLogError(AppServer, "CompTargets: Different number of ChargingTargetScheduleStruct in lists"); + return false; + } + + uint16_t dayIdx = 0; + for (const auto & entry1 : targets1) + { + const auto & entry2 = targets2[dayIdx++]; + + if (entry1.dayOfWeekForSequence != entry2.dayOfWeekForSequence) + { + ChipLogError(AppServer, "CompTargets: Different dayOfWeekForSequence"); + return false; + } + + if (entry1.chargingTargets.size() != entry2.chargingTargets.size()) + { + ChipLogError(AppServer, "CompTargets: Different number of chargingTargets in day list"); + return false; + } + + uint16_t chargingTargetsIdx = 0; + for (const auto & targetStruct1 : entry1.chargingTargets) + { + const auto & targetStruct2 = entry2.chargingTargets[chargingTargetsIdx++]; + + if (targetStruct1.targetTimeMinutesPastMidnight != targetStruct2.targetTimeMinutesPastMidnight) + { + ChipLogError(AppServer, "CompTargets: Different targetTimeMinutesPastMidnight"); + return false; + } + + if (targetStruct1.targetSoC != targetStruct2.targetSoC) + { + ChipLogError(AppServer, "CompTargets: Different targetSoC"); + return false; + } + + if (targetStruct1.addedEnergy != targetStruct2.addedEnergy) + { + ChipLogError(AppServer, "CompTargets: Different addedEnergy"); + return false; + } + } + } + + return true; +} + +void TestEvseTargetsStorage::PopulateTargets(uint16_t numDays, uint16_t numChargingTargetsPerDay) +{ + for (uint16_t dayIdx = 0; dayIdx < numDays; dayIdx++) + { + for (uint16_t chargingTargetIdx = 0; chargingTargetIdx < numChargingTargetsPerDay; chargingTargetIdx++) + { + mChargingTargets[dayIdx][chargingTargetIdx].targetTimeMinutesPastMidnight = + static_cast(dayIdx * 60 + chargingTargetIdx); + mChargingTargets[dayIdx][chargingTargetIdx].targetSoC.SetValue(65); + mChargingTargets[dayIdx][chargingTargetIdx].addedEnergy.SetValue(400); + } + + mChargingTargetsList[dayIdx] = chip::app::DataModel::List( + mChargingTargets[dayIdx], numChargingTargetsPerDay); + + mChargingTargetSchedules[dayIdx].dayOfWeekForSequence.Set(static_cast(1 << dayIdx)); + mChargingTargetSchedules[dayIdx].chargingTargets = mChargingTargetsList[dayIdx]; + } + + chip::app::DataModel::List chargingTargetSchedulesList( + mChargingTargetSchedules, numDays); + + mRefChargingTargetSchedulesList = chargingTargetSchedulesList; + + TLV::TLVReader mReader; + TLV::TLVWriter mWriter; + + mWriter.Init(mStore, sizeof(mStore)); + + CHIP_ERROR err = DataModel::Encode(mWriter, TLV::AnonymousTag(), mRefChargingTargetSchedulesList); + EXPECT_EQ(err, CHIP_NO_ERROR); + + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); + + mReader.Init(mStore); + EXPECT_EQ(mReader.Next(), CHIP_NO_ERROR); + + err = DataModel::Decode(mReader, mDecodableChargingTargetSchedulesList); + EXPECT_EQ(err, CHIP_NO_ERROR); +} + +void TestEvseTargetsStorage::SetTargets() +{ + if (!mEtdInitialised) + { + mEtd.Init(&mStorageDelegate); + + mEtdInitialised = true; + } + + CHIP_ERROR err = mEtd.SetTargets(mDecodableChargingTargetSchedulesList); + EXPECT_EQ(err, CHIP_NO_ERROR); +} + +void TestEvseTargetsStorage::CheckTargets() +{ + const DataModel::List targets = mEtd.GetTargets(); + + EXPECT_TRUE(CompTargets(mRefChargingTargetSchedulesList, targets)); +} + +} // namespace diff --git a/examples/energy-management-app/esp32/main/CMakeLists.txt b/examples/energy-management-app/esp32/main/CMakeLists.txt index a9a8c4100ae2de..cce09303b58d72 100644 --- a/examples/energy-management-app/esp32/main/CMakeLists.txt +++ b/examples/energy-management-app/esp32/main/CMakeLists.txt @@ -20,6 +20,7 @@ set(PRIV_INCLUDE_DIRS_LIST "${APP_GEN_DIR}" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/esp32/main/include" "${CMAKE_CURRENT_LIST_DIR}/include" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" ) @@ -53,7 +54,6 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/energy-evse-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/device-energy-management-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/occupancy-sensor-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-requestor" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-server" diff --git a/examples/energy-management-app/esp32/main/include/CHIPProjectConfig.h b/examples/energy-management-app/esp32/main/include/CHIPProjectConfig.h index 559895608a08d0..b70a285ccfda0b 100644 --- a/examples/energy-management-app/esp32/main/include/CHIPProjectConfig.h +++ b/examples/energy-management-app/esp32/main/include/CHIPProjectConfig.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/examples/energy-management-app/esp32/main/main.cpp b/examples/energy-management-app/esp32/main/main.cpp index e61e6cb00cca9b..136817a7744095 100644 --- a/examples/energy-management-app/esp32/main/main.cpp +++ b/examples/energy-management-app/esp32/main/main.cpp @@ -111,6 +111,26 @@ chip::Credentials::DeviceAttestationCredentialsProvider * get_dac_provider(void) } // namespace +namespace chip { +namespace app { +namespace Clusters { +namespace DeviceEnergyManagement { + +// Keep track of the parsed featureMap option +static chip::BitMask sFeatureMap(Feature::kPowerAdjustment, Feature::kPowerForecastReporting, + Feature::kStateForecastReporting, Feature::kStartTimeAdjustment, Feature::kPausable, + Feature::kForecastAdjustment, Feature::kConstraintBasedAdjustment); + +chip::BitMask GetFeatureMapFromCmdLine() +{ + return sFeatureMap; +} + +} // namespace DeviceEnergyManagement +} // namespace Clusters +} // namespace app +} // namespace chip + void ApplicationInit() { ESP_LOGD(TAG, "Energy Management App: ApplicationInit()"); diff --git a/examples/energy-management-app/esp32/sdkconfig.defaults.esp32c2 b/examples/energy-management-app/esp32/sdkconfig.defaults.esp32c2 index 5e5d596cacb673..2347f73ec8cc6c 100644 --- a/examples/energy-management-app/esp32/sdkconfig.defaults.esp32c2 +++ b/examples/energy-management-app/esp32/sdkconfig.defaults.esp32c2 @@ -18,5 +18,8 @@ CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 +# Event Queue Size +CONFIG_MAX_EVENT_QUEUE_SIZE=25 + # Enable HKDF in mbedtls CONFIG_MBEDTLS_HKDF_C=y diff --git a/examples/energy-management-app/esp32/sdkconfig.optimize.defaults b/examples/energy-management-app/esp32/sdkconfig.optimize.defaults index 87248eebfcdfa7..85a5c0cbd4615c 100644 --- a/examples/energy-management-app/esp32/sdkconfig.optimize.defaults +++ b/examples/energy-management-app/esp32/sdkconfig.optimize.defaults @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2023-2024 Project CHIP Authors # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/examples/energy-management-app/linux/BUILD.gn b/examples/energy-management-app/linux/BUILD.gn index 4730c2c8ea82f3..1a6e2d287fed2e 100644 --- a/examples/energy-management-app/linux/BUILD.gn +++ b/examples/energy-management-app/linux/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2023-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. @@ -18,8 +18,6 @@ import("${chip_root}/build/chip/tools.gni") import("${chip_root}/src/app/common_flags.gni") import("${chip_root}/third_party/imgui/imgui.gni") -assert(chip_build_tools) - import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") if (chip_enable_pw_rpc) { @@ -36,13 +34,20 @@ config("includes") { executable("chip-energy-management-app") { sources = [ + "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DEMTestEventTriggers.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseEventTriggers.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyReportingEventTriggers.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/FakeReadings.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/PowerTopologyDelegate.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/device-energy-management-mode.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/energy-evse-mode.cpp", @@ -122,6 +127,23 @@ executable("chip-energy-management-app") { output_dir = root_out_dir } +source_set("test-evse-targets-store") { + sources = [ + "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", + ] + + include_dirs = [ + "include", + "${chip_root}/examples/energy-management-app/energy-management-common/include", + ] + + deps = [ + "${chip_root}/examples/energy-management-app/energy-management-common", + "${chip_root}/src/lib", + ] +} + group("linux") { deps = [ ":chip-energy-management-app" ] } diff --git a/examples/energy-management-app/linux/README.md b/examples/energy-management-app/linux/README.md index f91d341915ccd8..ab35600709de47 100644 --- a/examples/energy-management-app/linux/README.md +++ b/examples/energy-management-app/linux/README.md @@ -163,6 +163,14 @@ There are several test scripts provided for EVSE (in - `TC_EEVSE_2_3`: This validates Get/Set/Clear target commands - `TC_EEVSE_2_4`: This validates Faults - `TC_EEVSE_2_5`: This validates EVSE diagnostic command (optional) +- `TC_EEVSE_2_6`: This validates EVSE Forecast Adjustment with State Forecast + Reporting feature functionality +- `TC_EEVSE_2_7`: This validates EVSE Constraints-based Adjustment with Power + Forecast Reporting feature functionality +- `TC_EEVSE_2_8`: This validates EVSE Constraints-based Adjustment with State + Forecast Reporting feature functionality +- `TC_EEVSE_2_9`: This validates EVSE Power or State Forecast Reporting + feature functionality These scripts require the use of Test Event Triggers via the GeneralDiagnostics cluster on Endpoint 0. This requires an `enableKey` (16 bytes) and a set of @@ -183,6 +191,39 @@ chosen enable key is using the `--enable-key` command line option. From the top-level of the connectedhomeip repo type: +Start the chip-energy-management-app: + +```bash +rm -f evse.bin; out/debug/chip-energy-management-app --enable-key 000102030405060708090a0b0c0d0e0f --KVS evse.bin --featureSet $featureSet +``` + +where the \$featureSet depends on the test being run: + +``` +TC_DEM_2_2.py: 0x01 // PA +TC_DEM_2_3.py: 0x3b // STA, PAU, FA, CON + (PFR | SFR) +TC_DEM_2_4.py: 0x3b // STA, PAU, FA, CON + (PFR | SFR) +TC_DEM_2_5.py: 0x3b // STA, PAU, FA, CON + PFR +TC_DEM_2_6.py: 0x3d // STA, PAU, FA, CON + SFR +TC_DEM_2_7.py: 0x3b // STA, PAU, FA, CON + PFR +TC_DEM_2_8.py: 0x3d // STA, PAU, FA, CON + SFR +TC_DEM_2_9.py: 0x3f // STA, PAU, FA, CON + PFR + SFR +``` + +where + +``` +PA - DEM.S.F00(PowerAdjustment) +PFR - DEM.S.F01(PowerForecastReporting) +SFR - DEM.S.F02(StateForecastReporting) +STA - DEM.S.F03(StartTimeAdjustment) +PAU - DEM.S.F04(Pausable) +FA - DEM.S.F05(ForecastAdjustment) +CON -DEM.S.F06(ConstraintBasedAdjustment) +``` + +Then run the test: + ```bash $ python src/python_testing/TC_EEVSE_2_2.py --endpoint 1 -m on-network -n 1234 -p 20202021 -d 3840 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f ``` @@ -191,6 +232,12 @@ From the top-level of the connectedhomeip repo type: cluster is on endpoint 1. The `--hex-arg enableKey:` value must match the `--enable-key ` used on chip-energy-management-app args. +The chip-energy-management-app will need to be stopped before running each test +script as each test commissions the chip-energy-management-app in the first +step. That is also why the evse.bin is deleted before running +chip-energy-management-app as this is where the app stores the matter persistent +data (e.g. fabric info). + ## CHIP-REPL Interaction - See chip-repl documentation in diff --git a/examples/energy-management-app/linux/args.gni b/examples/energy-management-app/linux/args.gni index e1000e6cb3fa27..1f196e6122910c 100644 --- a/examples/energy-management-app/linux/args.gni +++ b/examples/energy-management-app/linux/args.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2023-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. @@ -31,3 +31,4 @@ matter_enable_tracing_support = true chip_enable_read_client = false chip_enable_energy_evse_trigger = true chip_enable_energy_reporting_trigger = true +chip_enable_device_energy_management_trigger = true diff --git a/examples/energy-management-app/linux/main.cpp b/examples/energy-management-app/linux/main.cpp index 7973c16025d640..cdc2c4ed53d844 100644 --- a/examples/energy-management-app/linux/main.cpp +++ b/examples/energy-management-app/linux/main.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,6 +18,71 @@ #include #include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::DeviceEnergyManagement; +using namespace chip::app::Clusters::DeviceEnergyManagement::Attributes; + +// Parse a hex (prefixed by 0x) or decimal (no-prefix) string +static uint32_t ParseNumber(const char * pString); + +// Parses the --featureMap option +static bool FeatureMapOptionHandler(const char * aProgram, chip::ArgParser::OptionSet * aOptions, int aIdentifier, + const char * aName, const char * aValue); + +constexpr uint16_t kOptionFeatureMap = 'f'; + +// Define the chip::ArgParser command line structures for extending the command line to support the +// -f/--featureMap option +static chip::ArgParser::OptionDef sFeatureMapOptionDefs[] = { + { "featureSet", chip::ArgParser::kArgumentRequired, kOptionFeatureMap }, { nullptr } +}; + +static chip::ArgParser::OptionSet sCmdLineOptions = { + FeatureMapOptionHandler, // handler function + sFeatureMapOptionDefs, // array of option definitions + "GENERAL OPTIONS", // help group + "-f, --featureSet " // option help text +}; + +namespace chip { +namespace app { +namespace Clusters { +namespace DeviceEnergyManagement { + +// Keep track of the parsed featureMap option +static chip::BitMask sFeatureMap(Feature::kPowerAdjustment, Feature::kPowerForecastReporting, + Feature::kStateForecastReporting, Feature::kStartTimeAdjustment, Feature::kPausable, + Feature::kForecastAdjustment, Feature::kConstraintBasedAdjustment); + +chip::BitMask GetFeatureMapFromCmdLine() +{ + return sFeatureMap; +} + +} // namespace DeviceEnergyManagement +} // namespace Clusters +} // namespace app +} // namespace chip + +static uint32_t ParseNumber(const char * pString) +{ + uint32_t num = 0; + if (strlen(pString) > 2 && pString[0] == '0' && pString[1] == 'x') + { + num = (uint32_t) strtoul(&pString[2], nullptr, 16); + } + else + { + num = (uint32_t) strtoul(pString, nullptr, 10); + } + + return num; +} void ApplicationInit() { @@ -31,9 +96,29 @@ void ApplicationShutdown() EvseApplicationShutdown(); } +static bool FeatureMapOptionHandler(const char * aProgram, chip::ArgParser::OptionSet * aOptions, int aIdentifier, + const char * aName, const char * aValue) +{ + bool retval = true; + + switch (aIdentifier) + { + case kOptionFeatureMap: + sFeatureMap = BitMask(ParseNumber(aValue)); + ChipLogDetail(Support, "Using FeatureMap 0x%04x", sFeatureMap.Raw()); + break; + default: + ChipLogError(Support, "%s: INTERNAL ERROR: Unhandled option: %s\n", aProgram, aName); + retval = false; + break; + } + + return (retval); +} + int main(int argc, char * argv[]) { - if (ChipLinuxAppInit(argc, argv) != 0) + if (ChipLinuxAppInit(argc, argv, &sCmdLineOptions) != 0) { return -1; } diff --git a/examples/fabric-admin/commands/common/RemoteDataModelLogger.cpp b/examples/fabric-admin/commands/common/RemoteDataModelLogger.cpp index c8e9d5a5450703..6334d42506d53f 100644 --- a/examples/fabric-admin/commands/common/RemoteDataModelLogger.cpp +++ b/examples/fabric-admin/commands/common/RemoteDataModelLogger.cpp @@ -241,7 +241,8 @@ CHIP_ERROR LogDiscoveredNodeData(const chip::Dnssd::CommissionNodeData & nodeDat value["rotatingIdLen"] = static_cast(commissionData.rotatingIdLen); value["pairingHint"] = commissionData.pairingHint; value["pairingInstruction"] = commissionData.pairingInstruction; - value["supportsTcp"] = resolutionData.supportsTcp; + value["supportsTcpClient"] = resolutionData.supportsTcpClient; + value["supportsTcpServer"] = resolutionData.supportsTcpServer; value["port"] = resolutionData.port; value["numIPs"] = static_cast(resolutionData.numIPs); diff --git a/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp b/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp index cd63510ab2215e..22b634145ab93f 100644 --- a/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp +++ b/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp @@ -40,7 +40,10 @@ namespace { constexpr char kInteractiveModePrompt[] = ">>> "; constexpr char kInteractiveModeHistoryFileName[] = "chip_tool_history"; constexpr char kInteractiveModeStopCommand[] = "quit()"; -constexpr uint16_t kRetryIntervalS = 5; + +#if defined(PW_RPC_ENABLED) +constexpr uint16_t kRetryIntervalS = 5; +#endif // File pointer for the log file FILE * sLogFile = nullptr; diff --git a/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.cpp b/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.cpp index 93d1f6f51002f8..b2d811fdc8b114 100644 --- a/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.cpp +++ b/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.cpp @@ -33,11 +33,33 @@ CHIP_ERROR OpenCommissioningWindowCommand::RunCommand() if (mCommissioningWindowOption == Controller::CommissioningWindowOpener::CommissioningWindowOption::kTokenWithRandomPIN) { - SetupPayload ignored; - return mWindowOpener->OpenCommissioningWindow(mNodeId, System::Clock::Seconds16(mCommissioningWindowTimeout), mIteration, - mDiscriminator, NullOptional, NullOptional, - &mOnOpenCommissioningWindowCallback, ignored, - /* readVIDPIDAttributes */ true); + if (mVerifier.HasValue()) + { + VerifyOrReturnError(mSalt.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + return mWindowOpener->OpenCommissioningWindow(Controller::CommissioningWindowVerifierParams() + .SetNodeId(mNodeId) + .SetEndpointId(mEndpointId) + .SetTimeout(mCommissioningWindowTimeout) + .SetIteration(mIteration) + .SetDiscriminator(mDiscriminator) + .SetVerifier(mVerifier.Value()) + .SetSalt(mSalt.Value()) + .SetCallback(&mOnOpenCommissioningWindowVerifierCallback)); + } + else + { + SetupPayload ignored; + return mWindowOpener->OpenCommissioningWindow(Controller::CommissioningWindowPasscodeParams() + .SetNodeId(mNodeId) + .SetEndpointId(mEndpointId) + .SetTimeout(mCommissioningWindowTimeout) + .SetIteration(mIteration) + .SetDiscriminator(mDiscriminator) + .SetSalt(mSalt) + .SetReadVIDPIDAttributes(true) + .SetCallback(&mOnOpenCommissioningWindowCallback), + ignored); + } } ChipLogError(NotSpecified, "Unknown commissioning window option: %d", to_underlying(mCommissioningWindowOption)); @@ -58,6 +80,11 @@ void OpenCommissioningWindowCommand::OnOpenCommissioningWindowResponse(void * co OnOpenBasicCommissioningWindowResponse(context, remoteId, err); } +void OpenCommissioningWindowCommand::OnOpenCommissioningWindowVerifierResponse(void * context, NodeId remoteId, CHIP_ERROR err) +{ + OnOpenBasicCommissioningWindowResponse(context, remoteId, err); +} + void OpenCommissioningWindowCommand::OnOpenBasicCommissioningWindowResponse(void * context, NodeId remoteId, CHIP_ERROR err) { LogErrorOnFailure(err); diff --git a/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h b/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h index 86e1b68c3d5f3f..09788507210aaf 100644 --- a/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h +++ b/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h @@ -35,6 +35,7 @@ class OpenCommissioningWindowCommand : public CHIPCommand OpenCommissioningWindowCommand(CredentialIssuerCommands * credIssuerCommands) : CHIPCommand("open-commissioning-window", credIssuerCommands), mOnOpenCommissioningWindowCallback(OnOpenCommissioningWindowResponse, this), + mOnOpenCommissioningWindowVerifierCallback(OnOpenCommissioningWindowVerifierResponse, this), mOnOpenBasicCommissioningWindowCallback(OnOpenBasicCommissioningWindowResponse, this) { AddArgument("node-id", 0, UINT64_MAX, &mNodeId, "Node to send command to."); @@ -47,6 +48,12 @@ class OpenCommissioningWindowCommand : public CHIPCommand &mIteration, "Number of PBKDF iterations to use to derive the verifier. Ignored if 'option' is 0."); AddArgument("discriminator", 0, 4096, &mDiscriminator, "Discriminator to use for advertising. Ignored if 'option' is 0."); AddArgument("timeout", 0, UINT16_MAX, &mTimeout, "Time, in seconds, before this command is considered to have timed out."); + AddArgument("salt", &mSalt, + "Salt payload encoded in hexadecimal. Random salt will be generated if absent. " + "This needs to be present if verifier is provided, corresponding to salt used for generating verifier"); + AddArgument("verifier", &mVerifier, + "PAKE Passcode verifier encoded in hexadecimal format. Will be generated from random setup pin and other " + "params if absent"); } void RegisterDelegate(CommissioningWindowDelegate * delegate) { mDelegate = delegate; } @@ -69,12 +76,16 @@ class OpenCommissioningWindowCommand : public CHIPCommand uint16_t mDiscriminator; chip::Optional mTimeout; + chip::Optional mSalt; + chip::Optional mVerifier; chip::Platform::UniquePtr mWindowOpener; static void OnOpenCommissioningWindowResponse(void * context, NodeId deviceId, CHIP_ERROR status, chip::SetupPayload payload); + static void OnOpenCommissioningWindowVerifierResponse(void * context, NodeId deviceId, CHIP_ERROR status); static void OnOpenBasicCommissioningWindowResponse(void * context, NodeId deviceId, CHIP_ERROR status); chip::Callback::Callback mOnOpenCommissioningWindowCallback; + chip::Callback::Callback mOnOpenCommissioningWindowVerifierCallback; chip::Callback::Callback mOnOpenBasicCommissioningWindowCallback; }; diff --git a/examples/fabric-admin/commands/pairing/PairingCommand.cpp b/examples/fabric-admin/commands/pairing/PairingCommand.cpp index 5a02739232b054..521325a796dce0 100644 --- a/examples/fabric-admin/commands/pairing/PairingCommand.cpp +++ b/examples/fabric-admin/commands/pairing/PairingCommand.cpp @@ -543,7 +543,9 @@ void PairingCommand::OnCurrentFabricRemove(void * context, NodeId nodeId, CHIP_E // print to console fprintf(stderr, "Device with Node ID: 0x%lx has been successfully removed.\n", nodeId); - // TODO: (#33973) Add RPC method RemoveSynchronizedDevice +#if defined(PW_RPC_ENABLED) + RemoveSynchronizedDevice(nodeId); +#endif } else { diff --git a/examples/fabric-admin/rpc/RpcClient.cpp b/examples/fabric-admin/rpc/RpcClient.cpp index f03c4f3f699838..00ca1204cc1f19 100644 --- a/examples/fabric-admin/rpc/RpcClient.cpp +++ b/examples/fabric-admin/rpc/RpcClient.cpp @@ -19,9 +19,11 @@ #include "RpcClient.h" #include "RpcClientProcessor.h" +#include +#include +#include #include #include -#include #include "fabric_bridge_service/fabric_bridge_service.rpc.pb.h" #include "pw_assert/check.h" @@ -36,16 +38,45 @@ using namespace chip; namespace { // Constants +constexpr uint32_t kRpcTimeoutMs = 1000; constexpr uint32_t kDefaultChannelId = 1; // Fabric Bridge Client rpc::pw_rpc::nanopb::FabricBridge::Client fabricBridgeClient(rpc::client::GetDefaultRpcClient(), kDefaultChannelId); -pw::rpc::NanopbUnaryReceiver<::pw_protobuf_Empty> addSynchronizedDeviceCall; -pw::rpc::NanopbUnaryReceiver<::pw_protobuf_Empty> removeSynchronizedDeviceCall; + +std::mutex responseMutex; +std::condition_variable responseCv; +bool responseReceived = false; +CHIP_ERROR responseError = CHIP_NO_ERROR; + +// By passing the `call` parameter into WaitForResponse we are explicitly trying to insure the caller takes into consideration that +// the lifetime of the `call` object when calling WaitForResponse +template +CHIP_ERROR WaitForResponse(CallType & call) +{ + std::unique_lock lock(responseMutex); + responseReceived = false; + responseError = CHIP_NO_ERROR; + + if (responseCv.wait_for(lock, std::chrono::milliseconds(kRpcTimeoutMs), [] { return responseReceived; })) + { + return responseError; + } + else + { + fprintf(stderr, "RPC Response timed out!"); + return CHIP_ERROR_TIMEOUT; + } +} // Callback function to be called when the RPC response is received void OnAddDeviceResponseCompleted(const pw_protobuf_Empty & response, pw::Status status) { + std::lock_guard lock(responseMutex); + responseReceived = true; + responseError = status.ok() ? CHIP_NO_ERROR : CHIP_ERROR_INTERNAL; + responseCv.notify_one(); + if (status.ok()) { ChipLogProgress(NotSpecified, "AddSynchronizedDevice RPC call succeeded!"); @@ -59,6 +90,11 @@ void OnAddDeviceResponseCompleted(const pw_protobuf_Empty & response, pw::Status // Callback function to be called when the RPC response is received void OnRemoveDeviceResponseCompleted(const pw_protobuf_Empty & response, pw::Status status) { + std::lock_guard lock(responseMutex); + responseReceived = true; + responseError = status.ok() ? CHIP_NO_ERROR : CHIP_ERROR_INTERNAL; + responseCv.notify_one(); + if (status.ok()) { ChipLogProgress(NotSpecified, "RemoveSynchronizedDevice RPC call succeeded!"); @@ -81,52 +117,38 @@ CHIP_ERROR AddSynchronizedDevice(chip::NodeId nodeId) { ChipLogProgress(NotSpecified, "AddSynchronizedDevice"); - if (addSynchronizedDeviceCall.active()) - { - ChipLogError(NotSpecified, "Add Synchronized Device operation is in progress\n"); - return CHIP_ERROR_BUSY; - } - chip_rpc_SynchronizedDevice device; device.node_id = nodeId; - // By assigning the returned call to the global 'addSynchronizedDeviceCall', the RPC - // call is kept alive until it completes. When a response is received, it - // will be logged by the handler function and the call will complete. - addSynchronizedDeviceCall = fabricBridgeClient.AddSynchronizedDevice(device, OnAddDeviceResponseCompleted); + // The RPC call is kept alive until it completes. When a response is received, it will be logged by the handler + // function and the call will complete. + auto call = fabricBridgeClient.AddSynchronizedDevice(device, OnAddDeviceResponseCompleted); - if (!addSynchronizedDeviceCall.active()) + if (!call.active()) { // The RPC call was not sent. This could occur due to, for example, an invalid channel ID. Handle if necessary. return CHIP_ERROR_INTERNAL; } - return CHIP_NO_ERROR; + return WaitForResponse(call); } CHIP_ERROR RemoveSynchronizedDevice(chip::NodeId nodeId) { ChipLogProgress(NotSpecified, "RemoveSynchronizedDevice"); - if (removeSynchronizedDeviceCall.active()) - { - ChipLogError(NotSpecified, "Remove Synchronized Device operation is in progress\n"); - return CHIP_ERROR_BUSY; - } - chip_rpc_SynchronizedDevice device; device.node_id = nodeId; - // By assigning the returned call to the global 'removeSynchronizedDeviceCall', the RPC - // call is kept alive until it completes. When a response is received, it - // will be logged by the handler function and the call will complete. - removeSynchronizedDeviceCall = fabricBridgeClient.RemoveSynchronizedDevice(device, OnRemoveDeviceResponseCompleted); + // The RPC call is kept alive until it completes. When a response is received, it will be logged by the handler + // function and the call will complete. + auto call = fabricBridgeClient.RemoveSynchronizedDevice(device, OnRemoveDeviceResponseCompleted); - if (!removeSynchronizedDeviceCall.active()) + if (!call.active()) { // The RPC call was not sent. This could occur due to, for example, an invalid channel ID. Handle if necessary. return CHIP_ERROR_INTERNAL; } - return CHIP_NO_ERROR; + return WaitForResponse(call); } diff --git a/examples/fabric-admin/rpc/RpcClient.h b/examples/fabric-admin/rpc/RpcClient.h index eb28c19bee7d3e..a1754b3846d508 100644 --- a/examples/fabric-admin/rpc/RpcClient.h +++ b/examples/fabric-admin/rpc/RpcClient.h @@ -41,7 +41,7 @@ CHIP_ERROR InitRpcClient(uint16_t rpcServerPort); * * @param nodeId The Node ID of the device to be added. * @return CHIP_ERROR An error code indicating the success or failure of the operation. - * - CHIP_NO_ERROR: The RPC command was successfully sent. + * - CHIP_NO_ERROR: The RPC command was successfully processed. * - CHIP_ERROR_BUSY: Another operation is currently in progress. * - CHIP_ERROR_INTERNAL: An internal error occurred while activating the RPC call. */ @@ -56,7 +56,7 @@ CHIP_ERROR AddSynchronizedDevice(chip::NodeId nodeId); * * @param nodeId The Node ID of the device to be removed. * @return CHIP_ERROR An error code indicating the success or failure of the operation. - * - CHIP_NO_ERROR: The RPC command was successfully sent. + * - CHIP_NO_ERROR: The RPC command was successfully processed. * - CHIP_ERROR_BUSY: Another operation is currently in progress. * - CHIP_ERROR_INTERNAL: An internal error occurred while activating the RPC call. */ diff --git a/examples/fabric-admin/rpc/RpcServer.cpp b/examples/fabric-admin/rpc/RpcServer.cpp index 51ecb1ff6c13c5..d4979e5a27c427 100644 --- a/examples/fabric-admin/rpc/RpcServer.cpp +++ b/examples/fabric-admin/rpc/RpcServer.cpp @@ -37,14 +37,27 @@ namespace { class FabricAdmin final : public rpc::FabricAdmin { public: - pw::Status OpenCommissioningWindow(const chip_rpc_DeviceInfo & request, chip_rpc_OperationStatus & response) override + pw::Status OpenCommissioningWindow(const chip_rpc_DeviceCommissioningWindowInfo & request, + chip_rpc_OperationStatus & response) override { - NodeId nodeId = request.node_id; + NodeId nodeId = request.node_id; + uint32_t commissioningTimeout = request.commissioning_timeout; + uint32_t iterations = request.iterations; + uint32_t discriminator = request.discriminator; + + char saltHex[Crypto::kSpake2p_Max_PBKDF_Salt_Length * 2 + 1]; + Encoding::BytesToHex(request.salt.bytes, request.salt.size, saltHex, sizeof(saltHex), Encoding::HexFlags::kNullTerminate); + + char verifierHex[Crypto::kSpake2p_VerifierSerialized_Length * 2 + 1]; + Encoding::BytesToHex(request.verifier.bytes, request.verifier.size, verifierHex, sizeof(verifierHex), + Encoding::HexFlags::kNullTerminate); + ChipLogProgress(NotSpecified, "Received OpenCommissioningWindow request: 0x%lx", nodeId); - char command[64]; - snprintf(command, sizeof(command), "pairing open-commissioning-window %ld %d %d %d %d %d", nodeId, kRootEndpointId, - kEnhancedCommissioningMethod, kWindowTimeout, kIteration, kDiscriminator); + char command[512]; + snprintf(command, sizeof(command), "pairing open-commissioning-window %ld %d %d %d %d %d --salt hex:%s --verifier hex:%s", + nodeId, kRootEndpointId, kEnhancedCommissioningMethod, commissioningTimeout, iterations, discriminator, saltHex, + verifierHex); PushCommand(command); diff --git a/examples/fabric-admin/scripts/run_fabric_sink.sh b/examples/fabric-admin/scripts/run_fabric_sink.sh new file mode 100755 index 00000000000000..3013965479268a --- /dev/null +++ b/examples/fabric-admin/scripts/run_fabric_sink.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +# Default paths +DEFAULT_CHOICES=( + "./fabric-admin" + "out/debug/standalone/fabric-admin" + "out/linux-x64-fabric-admin/fabric-admin" + "out/darwin-arm64-fabric-admin/fabric-admin" +) +FABRIC_ADMIN_LOG="/tmp/fabric_admin.log" +FABRIC_ADMIN_PATH="" + +# Function to find fabric-admin binary +find_fabric_admin() { + local choices=("$@") + for path in "${choices[@]}"; do + if [[ -e "$path" ]]; then + echo "$path" + return 0 + fi + done + return 1 +} + +# Parse arguments +VERBOSE=false +SPECIFIED_PATH="" + +for arg in "$@"; do + case $arg in + --verbose) + VERBOSE=true + ;; + --path=*) + SPECIFIED_PATH="${arg#*=}" + ;; + esac +done + +# Use specified path if provided +if [[ -n "$SPECIFIED_PATH" ]]; then + if [[ -e "$SPECIFIED_PATH" ]]; then + FABRIC_ADMIN_PATH="$SPECIFIED_PATH" + else + echo >&2 "Specified path does not exist: $SPECIFIED_PATH" + exit 1 + fi +else + FABRIC_ADMIN_PATH=$(find_fabric_admin "${DEFAULT_CHOICES[@]}") + if [[ $? -ne 0 ]]; then + echo >&2 "Could not find the fabric-admin binary" + exit 1 + fi +fi + +echo "PATH IS: $FABRIC_ADMIN_PATH" + +# Kill fabric-admin if it is running +echo "Checking for running fabric-admin process..." +fabric_admin_pid=$(pgrep -f "$FABRIC_ADMIN_PATH") +if [[ -n "$fabric_admin_pid" ]]; then + echo "Found fabric-admin with PID $fabric_admin_pid, attempting to kill..." + kill -9 "$fabric_admin_pid" + echo "Killed fabric-admin with PID $fabric_admin_pid" +fi + +# Remove /tmp/chip_* files and directories +echo "Removing /tmp/chip_* files and directories..." +sudo rm -rf /tmp/chip_* +echo "Removed /tmp/chip_* files and directories" + +# Start fabric-admin with or without log file path based on --verbose option +echo "Starting fabric-admin..." +if [ "$VERBOSE" = true ]; then + "$FABRIC_ADMIN_PATH" +else + "$FABRIC_ADMIN_PATH" --log-file-path "$FABRIC_ADMIN_LOG" +fi diff --git a/examples/fabric-admin/scripts/run_fabric_source.sh b/examples/fabric-admin/scripts/run_fabric_source.sh new file mode 100755 index 00000000000000..95df7a135bb596 --- /dev/null +++ b/examples/fabric-admin/scripts/run_fabric_source.sh @@ -0,0 +1,116 @@ +#!/bin/bash + +# Get the path to the current script +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# Default paths +DEFAULT_ADMIN_CHOICES=( + "./fabric-admin" + "out/debug/standalone/fabric-admin" + "out/linux-x64-fabric-admin/fabric-admin" + "out/darwin-arm64-fabric-admin/fabric-admin" +) +DEFAULT_BRIDGE_CHOICES=( + "./fabric-bridge-app" + "out/debug/standalone/fabric-bridge-app" + "out/linux-x64-fabric-bridge-app/fabric-bridge-app" + "out/darwin-arm64-fabric-bridge-app/fabric-bridge-app" +) +FABRIC_ADMIN_LOG="/tmp/fabric_admin.log" +FABRIC_BRIDGE_APP_LOG="/tmp/fabric_bridge_app.log" +FABRIC_ADMIN_PATH="" +FABRIC_BRIDGE_APP_PATH="" + +# Function to find a binary +find_binary() { + local choices=("$@") + for path in "${choices[@]}"; do + if [[ -e "$path" ]]; then + echo "$path" + return 0 + fi + done + return 1 +} + +# Parse arguments +VERBOSE=false +SPECIFIED_ADMIN_PATH="" +SPECIFIED_BRIDGE_PATH="" + +for arg in "$@"; do + case $arg in + --verbose) + VERBOSE=true + ;; + --admin-path=*) + SPECIFIED_ADMIN_PATH="${arg#*=}" + ;; + --bridge-path=*) + SPECIFIED_BRIDGE_PATH="${arg#*=}" + ;; + esac +done + +# Use specified paths if provided +if [[ -n "$SPECIFIED_ADMIN_PATH" ]]; then + if [[ -e "$SPECIFIED_ADMIN_PATH" ]]; then + FABRIC_ADMIN_PATH="$SPECIFIED_ADMIN_PATH" + else + echo >&2 "Specified admin path does not exist: $SPECIFIED_ADMIN_PATH" + exit 1 + fi +else + FABRIC_ADMIN_PATH=$(find_binary "${DEFAULT_ADMIN_CHOICES[@]}") + if [[ $? -ne 0 ]]; then + echo >&2 "Could not find the fabric-admin binary" + exit 1 + fi +fi + +if [[ -n "$SPECIFIED_BRIDGE_PATH" ]]; then + if [[ -e "$SPECIFIED_BRIDGE_PATH" ]]; then + FABRIC_BRIDGE_APP_PATH="$SPECIFIED_BRIDGE_PATH" + else + echo >&2 "Specified bridge path does not exist: $SPECIFIED_BRIDGE_PATH" + exit 1 + fi +else + FABRIC_BRIDGE_APP_PATH=$(find_binary "${DEFAULT_BRIDGE_CHOICES[@]}") + if [[ $? -ne 0 ]]; then + echo >&2 "Could not find the fabric-bridge-app binary" + exit 1 + fi +fi + +echo "Admin path: $FABRIC_ADMIN_PATH" +echo "Bridge path: $FABRIC_BRIDGE_APP_PATH" + +# Determine the path to stop_fabric_source.sh based on the location of run_fabric_source.sh +RUN_FABRIC_SOURCE_PATH=$(find_binary "$SCRIPT_DIR/run_fabric_source.sh") +if [[ $? -ne 0 ]]; then + echo >&2 "Could not find the run_fabric_source.sh script" + exit 1 +fi +STOP_FABRIC_SOURCE_PATH="${RUN_FABRIC_SOURCE_PATH/run_fabric_source/stop_fabric_source}" + +# Stop any running instances and clean up +if [[ -e "$STOP_FABRIC_SOURCE_PATH" ]]; then + "$STOP_FABRIC_SOURCE_PATH" +else + echo >&2 "Could not find the stop_fabric_source.sh script" + exit 1 +fi + +# 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 & + echo "Started fabric-bridge-app" +fi + +# Start fabric-admin with or without log file path based on --verbose option +if [ "$VERBOSE" = true ]; then + "$FABRIC_ADMIN_PATH" +else + "$FABRIC_ADMIN_PATH" --log-file-path "$FABRIC_ADMIN_LOG" +fi diff --git a/examples/fabric-admin/scripts/stop_fabric_source.sh b/examples/fabric-admin/scripts/stop_fabric_source.sh new file mode 100755 index 00000000000000..85fff9e3a878cc --- /dev/null +++ b/examples/fabric-admin/scripts/stop_fabric_source.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +FABRIC_ADMIN_PATH="/fabric-admin" +FABRIC_BRIDGE_APP_PATH="/fabric-bridge-app" + +# Kill fabric-admin if it is running +fabric_admin_pid=$(pgrep -f "$FABRIC_ADMIN_PATH") +if [ ! -z "$fabric_admin_pid" ]; then + kill -9 "$fabric_admin_pid" + echo "Killed fabric-admin with PID $fabric_admin_pid" +fi + +# Kill fabric-bridge-app if it is running +fabric_bridge_app_pid=$(pgrep -f "$FABRIC_BRIDGE_APP_PATH") +if [ ! -z "$fabric_bridge_app_pid" ]; then + kill -9 "$fabric_bridge_app_pid" + echo "Killed fabric-bridge-app with PID $fabric_bridge_app_pid" +fi + +# Remove /tmp/chip_* files and directories +sudo rm -rf /tmp/chip_* +echo "Removed /tmp/chip_* files and directories" diff --git a/examples/fabric-bridge-app/fabric-bridge-common/BUILD.gn b/examples/fabric-bridge-app/fabric-bridge-common/BUILD.gn index 70d9586b699c0f..3bc4c23b9e0f92 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/BUILD.gn +++ b/examples/fabric-bridge-app/fabric-bridge-common/BUILD.gn @@ -13,13 +13,32 @@ # limitations under the License. import("//build_overrides/chip.gni") - import("${chip_root}/src/app/chip_data_model.gni") +config("config") { + include_dirs = [ "include" ] +} + chip_data_model("fabric-bridge-common") { zap_file = "fabric-bridge-app.zap" - is_server = true - cflags = [ "-DDYNAMIC_ENDPOINT_COUNT=16" ] } + +source_set("fabric-bridge-lib") { + public_configs = [ ":config" ] + + sources = [ + "include/CHIPProjectAppConfig.h", + "include/Device.h", + "include/DeviceManager.h", + "src/Device.cpp", + "src/DeviceManager.cpp", + "src/ZCLCallbacks.cpp", + ] + + deps = [ + "${chip_root}/examples/fabric-bridge-app/fabric-bridge-common", + "${chip_root}/src/lib", + ] +} diff --git a/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.matter b/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.matter index 394a724877a8ea..f776b385bcc383 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.matter +++ b/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** The Access Control Cluster exposes a data model view of a @@ -164,7 +235,7 @@ cluster AccessControl = 31 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -180,12 +251,42 @@ cluster AccessControl = 31 { 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; @@ -221,17 +322,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -316,7 +441,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1334,6 +1459,57 @@ cluster GroupKeyManagement = 63 { fabric command access(invoke: administer) KeySetReadAllIndices(): KeySetReadAllIndicesResponse = 4; } +/** Supports the ability for clients to request the commissioning of themselves or other nodes onto a fabric which the cluster server can commission onto. */ +provisional cluster CommissionerControl = 1873 { + revision 1; + + bitmap SupportedDeviceCategoryBitmap : bitmap32 { + kFabricSynchronization = 0x1; + } + + fabric_sensitive info event access(read: manage) CommissioningRequestResult = 0 { + int64u requestId = 0; + node_id clientNodeId = 1; + enum8 statusCode = 2; + fabric_idx fabricIndex = 254; + } + + readonly attribute access(read: manage) SupportedDeviceCategoryBitmap supportedDeviceCategories = 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 RequestCommissioningApprovalRequest { + int64u requestId = 0; + vendor_id vendorId = 1; + int16u productId = 2; + optional char_string<64> label = 3; + } + + request struct CommissionNodeRequest { + int64u requestId = 0; + int16u responseTimeoutSeconds = 1; + optional octet_string ipAddress = 2; + optional int16u port = 3; + } + + response struct ReverseOpenCommissioningWindow = 2 { + int16u commissioningTimeout = 0; + octet_string PAKEPasscodeVerifier = 1; + int16u discriminator = 2; + int32u iterations = 3; + octet_string<32> salt = 4; + } + + /** This command is sent by a client to request approval for a future CommissionNode call. */ + command access(invoke: manage) RequestCommissioningApproval(RequestCommissioningApprovalRequest): DefaultSuccess = 0; + /** This command is sent by a client to request that the server begins commissioning a previously approved request. */ + command access(invoke: manage) CommissionNode(CommissionNodeRequest): ReverseOpenCommissioningWindow = 1; +} + endpoint 0 { device type ma_rootdevice = 22, version 1; @@ -1647,6 +1823,21 @@ endpoint 0 { handle command KeySetReadAllIndices; handle command KeySetReadAllIndicesResponse; } + + server cluster CommissionerControl { + emits event CommissioningRequestResult; + ram attribute supportedDeviceCategories default = 0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + + handle command RequestCommissioningApproval; + handle command CommissionNode; + handle command ReverseOpenCommissioningWindow; + } } endpoint 1 { device type ma_aggregator = 14, version 1; diff --git a/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.zap b/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.zap index cbf31a039b85ee..6345745cde4fce 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.zap +++ b/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.zap @@ -4003,6 +4003,164 @@ "reportableChange": 0 } ] + }, + { + "name": "Commissioner Control", + "code": 1873, + "mfgCode": null, + "define": "COMMISSIONER_CONTROL_CLUSTER", + "side": "server", + "enabled": 1, + "apiMaturity": "provisional", + "commands": [ + { + "name": "RequestCommissioningApproval", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CommissionNode", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ReverseOpenCommissioningWindow", + "code": 2, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "SupportedDeviceCategories", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "SupportedDeviceCategoryBitmap", + "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": "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, + "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 + } + ], + "events": [ + { + "name": "CommissioningRequestResult", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] } ] }, diff --git a/examples/fabric-bridge-app/linux/include/Device.h b/examples/fabric-bridge-app/fabric-bridge-common/include/Device.h similarity index 100% rename from examples/fabric-bridge-app/linux/include/Device.h rename to examples/fabric-bridge-app/fabric-bridge-common/include/Device.h diff --git a/examples/fabric-bridge-app/linux/include/DeviceManager.h b/examples/fabric-bridge-app/fabric-bridge-common/include/DeviceManager.h similarity index 100% rename from examples/fabric-bridge-app/linux/include/DeviceManager.h rename to examples/fabric-bridge-app/fabric-bridge-common/include/DeviceManager.h diff --git a/examples/fabric-bridge-app/linux/Device.cpp b/examples/fabric-bridge-app/fabric-bridge-common/src/Device.cpp similarity index 100% rename from examples/fabric-bridge-app/linux/Device.cpp rename to examples/fabric-bridge-app/fabric-bridge-common/src/Device.cpp diff --git a/examples/fabric-bridge-app/linux/DeviceManager.cpp b/examples/fabric-bridge-app/fabric-bridge-common/src/DeviceManager.cpp similarity index 100% rename from examples/fabric-bridge-app/linux/DeviceManager.cpp rename to examples/fabric-bridge-app/fabric-bridge-common/src/DeviceManager.cpp diff --git a/examples/fabric-bridge-app/fabric-bridge-common/src/ZCLCallbacks.cpp b/examples/fabric-bridge-app/fabric-bridge-common/src/ZCLCallbacks.cpp new file mode 100644 index 00000000000000..7a9521fa7820a7 --- /dev/null +++ b/examples/fabric-bridge-app/fabric-bridge-common/src/ZCLCallbacks.cpp @@ -0,0 +1,92 @@ +/* + * + * 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 "DeviceManager.h" + +#include +#include +#include +#include + +using namespace ::chip; +using namespace ::chip::app::Clusters; + +#define ZCL_DESCRIPTOR_CLUSTER_REVISION (1u) +#define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION (2u) +#define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP (0u) + +// External attribute read callback function +Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) +{ + uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); + AttributeId attributeId = attributeMetadata->attributeId; + + Device * dev = DeviceMgr().GetDevice(endpointIndex); + if (dev != nullptr && clusterId == app::Clusters::BridgedDeviceBasicInformation::Id) + { + using namespace app::Clusters::BridgedDeviceBasicInformation::Attributes; + ChipLogProgress(NotSpecified, "HandleReadBridgedDeviceBasicAttribute: attrId=%d, maxReadLength=%d", attributeId, + maxReadLength); + + if ((attributeId == Reachable::Id) && (maxReadLength == 1)) + { + *buffer = dev->IsReachable() ? 1 : 0; + } + else if ((attributeId == NodeLabel::Id) && (maxReadLength == 32)) + { + MutableByteSpan zclNameSpan(buffer, maxReadLength); + MakeZclCharString(zclNameSpan, dev->GetName()); + } + else if ((attributeId == ClusterRevision::Id) && (maxReadLength == 2)) + { + uint16_t rev = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION; + memcpy(buffer, &rev, sizeof(rev)); + } + else if ((attributeId == FeatureMap::Id) && (maxReadLength == 4)) + { + uint32_t featureMap = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP; + memcpy(buffer, &featureMap, sizeof(featureMap)); + } + else + { + return Protocols::InteractionModel::Status::Failure; + } + return Protocols::InteractionModel::Status::Success; + } + + return Protocols::InteractionModel::Status::Failure; +} + +// External attribute write callback function +Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer) +{ + uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); + Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Failure; + + Device * dev = DeviceMgr().GetDevice(endpointIndex); + if (dev != nullptr && dev->IsReachable()) + { + ChipLogProgress(NotSpecified, "emberAfExternalAttributeWriteCallback: ep=%d, clusterId=%d", endpoint, clusterId); + ret = Protocols::InteractionModel::Status::Success; + } + + return ret; +} diff --git a/examples/fabric-bridge-app/linux/BUILD.gn b/examples/fabric-bridge-app/linux/BUILD.gn index 2b408d52625fea..d0f60f30fbb2b9 100644 --- a/examples/fabric-bridge-app/linux/BUILD.gn +++ b/examples/fabric-bridge-app/linux/BUILD.gn @@ -33,15 +33,12 @@ if (bridge_enable_pw_rpc) { executable("fabric-bridge-app") { sources = [ "${chip_root}/examples/fabric-bridge-app/fabric-bridge-common/include/CHIPProjectAppConfig.h", - "Device.cpp", - "DeviceManager.cpp", - "include/Device.h", - "include/DeviceManager.h", "main.cpp", ] deps = [ "${chip_root}/examples/fabric-bridge-app/fabric-bridge-common", + "${chip_root}/examples/fabric-bridge-app/fabric-bridge-common:fabric-bridge-lib", "${chip_root}/examples/platform/linux:app-main", "${chip_root}/src/lib", ] diff --git a/examples/fabric-bridge-app/linux/RpcClient.cpp b/examples/fabric-bridge-app/linux/RpcClient.cpp index 815250f12bc328..d2aef5d1d82e5e 100644 --- a/examples/fabric-bridge-app/linux/RpcClient.cpp +++ b/examples/fabric-bridge-app/linux/RpcClient.cpp @@ -19,9 +19,11 @@ #include "RpcClient.h" #include "RpcClientProcessor.h" +#include +#include +#include #include #include -#include #include "fabric_admin_service/fabric_admin_service.rpc.pb.h" #include "pw_assert/check.h" @@ -36,15 +38,45 @@ using namespace chip; namespace { // Constants +constexpr uint32_t kRpcTimeoutMs = 1000; constexpr uint32_t kDefaultChannelId = 1; // Fabric Admin Client rpc::pw_rpc::nanopb::FabricAdmin::Client fabricAdminClient(rpc::client::GetDefaultRpcClient(), kDefaultChannelId); -pw::rpc::NanopbUnaryReceiver<::chip_rpc_OperationStatus> openCommissioningWindowCall; + +std::mutex responseMutex; +std::condition_variable responseCv; +bool responseReceived = false; +CHIP_ERROR responseError = CHIP_NO_ERROR; + +// By passing the `call` parameter into WaitForResponse we are explicitly trying to insure the caller takes into consideration that +// the lifetime of the `call` object when calling WaitForResponse +template +CHIP_ERROR WaitForResponse(CallType & call) +{ + std::unique_lock lock(responseMutex); + responseReceived = false; + responseError = CHIP_NO_ERROR; + + if (responseCv.wait_for(lock, std::chrono::milliseconds(kRpcTimeoutMs), [] { return responseReceived; })) + { + return responseError; + } + else + { + ChipLogError(NotSpecified, "RPC Response timed out!"); + return CHIP_ERROR_TIMEOUT; + } +} // Callback function to be called when the RPC response is received void OnOpenCommissioningWindowCompleted(const chip_rpc_OperationStatus & response, pw::Status status) { + std::lock_guard lock(responseMutex); + responseReceived = true; + responseError = status.ok() ? CHIP_NO_ERROR : CHIP_ERROR_INTERNAL; + responseCv.notify_one(); + if (status.ok()) { ChipLogProgress(NotSpecified, "OpenCommissioningWindow received operation status: %d", response.success); @@ -63,26 +95,51 @@ CHIP_ERROR InitRpcClient(uint16_t rpcServerPort) return rpc::client::StartPacketProcessing(); } -CHIP_ERROR OpenCommissioningWindow(NodeId nodeId) +CHIP_ERROR OpenCommissioningWindow(chip_rpc_DeviceCommissioningWindowInfo device) { - ChipLogProgress(NotSpecified, "OpenCommissioningWindow with Node Id 0x:" ChipLogFormatX64, ChipLogValueX64(nodeId)); + ChipLogProgress(NotSpecified, "OpenCommissioningWindow with Node Id 0x" ChipLogFormatX64, ChipLogValueX64(device.node_id)); + + // The RPC call is kept alive until it completes. When a response is received, it will be logged by the handler + // function and the call will complete. + auto call = fabricAdminClient.OpenCommissioningWindow(device, OnOpenCommissioningWindowCompleted); - if (openCommissioningWindowCall.active()) + if (!call.active()) { - ChipLogError(NotSpecified, "OpenCommissioningWindow is in progress\n"); - return CHIP_ERROR_BUSY; + // The RPC call was not sent. This could occur due to, for example, an invalid channel ID. Handle if necessary. + return CHIP_ERROR_INTERNAL; } - chip_rpc_DeviceInfo device; - device.node_id = nodeId; + return WaitForResponse(call); +} - // The RPC will remain active as long as `openCommissioningWindowCall` is alive. - openCommissioningWindowCall = fabricAdminClient.OpenCommissioningWindow(device, OnOpenCommissioningWindowCompleted); +CHIP_ERROR +OpenCommissioningWindow(chip::Controller::CommissioningWindowPasscodeParams params) +{ + chip_rpc_DeviceCommissioningWindowInfo device; + device.node_id = params.GetNodeId(); + device.commissioning_timeout = params.GetTimeout().count(); + device.discriminator = params.GetDiscriminator(); + device.iterations = params.GetIteration(); - if (!openCommissioningWindowCall.active()) - { - return CHIP_ERROR_INTERNAL; - } + return OpenCommissioningWindow(device); +} + +CHIP_ERROR +OpenCommissioningWindow(chip::Controller::CommissioningWindowVerifierParams params) +{ + chip_rpc_DeviceCommissioningWindowInfo device; + device.node_id = params.GetNodeId(); + device.commissioning_timeout = params.GetTimeout().count(); + device.discriminator = params.GetDiscriminator(); + device.iterations = params.GetIteration(); + + VerifyOrReturnError(params.GetSalt().size() <= sizeof(device.salt.bytes), CHIP_ERROR_BUFFER_TOO_SMALL); + memcpy(device.salt.bytes, params.GetSalt().data(), params.GetSalt().size()); + device.salt.size = static_cast(params.GetSalt().size()); + + VerifyOrReturnError(params.GetVerifier().size() <= sizeof(device.verifier.bytes), CHIP_ERROR_BUFFER_TOO_SMALL); + memcpy(device.verifier.bytes, params.GetVerifier().data(), params.GetVerifier().size()); + device.verifier.size = static_cast(params.GetVerifier().size()); - return CHIP_NO_ERROR; + return OpenCommissioningWindow(device); } diff --git a/examples/fabric-bridge-app/linux/include/RpcClient.h b/examples/fabric-bridge-app/linux/include/RpcClient.h index bd424e9d275910..e7e2cc5b48505c 100644 --- a/examples/fabric-bridge-app/linux/include/RpcClient.h +++ b/examples/fabric-bridge-app/linux/include/RpcClient.h @@ -18,6 +18,7 @@ #pragma once +#include #include constexpr uint16_t kFabricAdminServerPort = 33001; @@ -33,12 +34,25 @@ constexpr uint16_t kFabricAdminServerPort = 33001; CHIP_ERROR InitRpcClient(uint16_t rpcServerPort); /** - * Opens a commissioning window for a specified node. + * Opens a commissioning window for a specified node using setup PIN (passcode). * - * @param nodeId The identifier of the node for which the commissioning window should be opened. + * @param params Params for opening the commissioning window using passcode. + * @return CHIP_ERROR An error code indicating the success or failure of the operation. + * - CHIP_NO_ERROR: The RPC command was successfully processed. + * - CHIP_ERROR_BUSY: Another commissioning window is currently in progress. + * - CHIP_ERROR_INTERNAL: An internal error occurred. + */ +CHIP_ERROR +OpenCommissioningWindow(chip::Controller::CommissioningWindowPasscodeParams params); + +/** + * Opens a commissioning window for a specified node using pre-computed PAKE passcode verifier. + * + * @param params Params for opening the commissioning window using verifier. * @return CHIP_ERROR An error code indicating the success or failure of the operation. * - CHIP_NO_ERROR: The RPC command was successfully sent. * - CHIP_ERROR_BUSY: Another commissioning window is currently in progress. * - CHIP_ERROR_INTERNAL: An internal error occurred. */ -CHIP_ERROR OpenCommissioningWindow(chip::NodeId nodeId); +CHIP_ERROR +OpenCommissioningWindow(chip::Controller::CommissioningWindowVerifierParams params); diff --git a/examples/fabric-bridge-app/linux/main.cpp b/examples/fabric-bridge-app/linux/main.cpp index 2047e15877ee4c..d8fb45dea08a02 100644 --- a/examples/fabric-bridge-app/linux/main.cpp +++ b/examples/fabric-bridge-app/linux/main.cpp @@ -23,7 +23,7 @@ #include "DeviceManager.h" #include -#include +#include #if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE #include "RpcClient.h" @@ -40,10 +40,6 @@ using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::AdministratorCommissioning; -#define ZCL_DESCRIPTOR_CLUSTER_REVISION (1u) -#define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION (2u) -#define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP (0u) - namespace { constexpr uint16_t kPollIntervalMs = 100; @@ -74,7 +70,11 @@ void BridgePollingThread() #if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE else if (ch == 'o') { - CHIP_ERROR err = OpenCommissioningWindow(0x1234); + CHIP_ERROR err = OpenCommissioningWindow(chip::Controller::CommissioningWindowPasscodeParams() + .SetNodeId(0x1234) + .SetTimeout(300) + .SetDiscriminator(3840) + .SetIteration(1000)); if (err != CHIP_NO_ERROR) { ChipLogError(NotSpecified, "Failed to call OpenCommissioningWindow RPC: %" CHIP_ERROR_FORMAT, err.Format()); @@ -120,7 +120,7 @@ void AdministratorCommissioningCommandHandler::InvokeCommand(HandlerContext & ha using Protocols::InteractionModel::Status; EndpointId endpointId = handlerContext.mRequestPath.mEndpointId; - ChipLogProgress(NotSpecified, "Received command to open commissioning window on Endpoind: %d", endpointId); + ChipLogProgress(NotSpecified, "Received command to open commissioning window on Endpoint: %d", endpointId); if (handlerContext.mRequestPath.mCommandId != Commands::OpenCommissioningWindow::Id || endpointId == kRootEndpointId) { @@ -129,23 +129,37 @@ void AdministratorCommissioningCommandHandler::InvokeCommand(HandlerContext & ha } handlerContext.SetCommandHandled(); - Status status = Status::Success; + + Commands::OpenCommissioningWindow::DecodableType commandData; + if (DataModel::Decode(handlerContext.mPayload, commandData) != CHIP_NO_ERROR) + { + handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::InvalidCommand); + return; + } + + Status status = Status::Failure; #if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE Device * device = DeviceMgr().GetDevice(endpointId); // TODO: issues:#33784, need to make OpenCommissioningWindow synchronous - if (device != nullptr && OpenCommissioningWindow(device->GetNodeId()) == CHIP_NO_ERROR) + if (device != nullptr && + OpenCommissioningWindow(chip::Controller::CommissioningWindowVerifierParams() + .SetNodeId(device->GetNodeId()) + .SetTimeout(commandData.commissioningTimeout) + .SetDiscriminator(commandData.discriminator) + .SetIteration(commandData.iterations) + .SetSalt(commandData.salt) + .SetVerifier(commandData.PAKEPasscodeVerifier)) == CHIP_NO_ERROR) { ChipLogProgress(NotSpecified, "Commissioning window is now open"); + status = Status::Success; } else { - status = Status::Failure; ChipLogProgress(NotSpecified, "Commissioning window is failed to open"); } #else - status = Status::Failure; ChipLogProgress(NotSpecified, "Commissioning window failed to open: PW_RPC_FABRIC_BRIDGE_SERVICE not defined"); #endif // defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE @@ -158,7 +172,9 @@ AdministratorCommissioningCommandHandler gAdministratorCommissioningCommandHandl void ApplicationInit() { - InteractionModelEngine::GetInstance()->RegisterCommandHandler(&gAdministratorCommissioningCommandHandler); + ChipLogDetail(NotSpecified, "Fabric-Bridge: ApplicationInit()"); + + CommandHandlerInterfaceRegistry::RegisterCommandHandler(&gAdministratorCommissioningCommandHandler); #if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE InitRpcServer(kFabricBridgeServerPort); @@ -172,7 +188,10 @@ void ApplicationInit() DeviceMgr().Init(); } -void ApplicationShutdown() {} +void ApplicationShutdown() +{ + ChipLogDetail(NotSpecified, "Fabric-Bridge: ApplicationShutdown()"); +} int main(int argc, char * argv[]) { @@ -185,65 +204,3 @@ int main(int argc, char * argv[]) return 0; } - -// External attribute read callback function -Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, - uint8_t * buffer, uint16_t maxReadLength) -{ - uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); - AttributeId attributeId = attributeMetadata->attributeId; - - Device * dev = DeviceMgr().GetDevice(endpointIndex); - if (dev != nullptr && clusterId == app::Clusters::BridgedDeviceBasicInformation::Id) - { - using namespace app::Clusters::BridgedDeviceBasicInformation::Attributes; - ChipLogProgress(NotSpecified, "HandleReadBridgedDeviceBasicAttribute: attrId=%d, maxReadLength=%d", attributeId, - maxReadLength); - - if ((attributeId == Reachable::Id) && (maxReadLength == 1)) - { - *buffer = dev->IsReachable() ? 1 : 0; - } - else if ((attributeId == NodeLabel::Id) && (maxReadLength == 32)) - { - MutableByteSpan zclNameSpan(buffer, maxReadLength); - MakeZclCharString(zclNameSpan, dev->GetName()); - } - else if ((attributeId == ClusterRevision::Id) && (maxReadLength == 2)) - { - uint16_t rev = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION; - memcpy(buffer, &rev, sizeof(rev)); - } - else if ((attributeId == FeatureMap::Id) && (maxReadLength == 4)) - { - uint32_t featureMap = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP; - memcpy(buffer, &featureMap, sizeof(featureMap)); - } - else - { - return Protocols::InteractionModel::Status::Failure; - } - return Protocols::InteractionModel::Status::Success; - } - - return Protocols::InteractionModel::Status::Failure; -} - -// External attribute write callback function -Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, - const EmberAfAttributeMetadata * attributeMetadata, - uint8_t * buffer) -{ - uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); - Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Failure; - - Device * dev = DeviceMgr().GetDevice(endpointIndex); - if (dev != nullptr && dev->IsReachable()) - { - ChipLogProgress(NotSpecified, "emberAfExternalAttributeWriteCallback: ep=%d, clusterId=%d", endpoint, clusterId); - ret = Protocols::InteractionModel::Status::Success; - } - - return ret; -} diff --git a/examples/laundry-washer-app/nxp/common/main/operational-state-delegate-impl.cpp b/examples/laundry-washer-app/nxp/common/main/operational-state-delegate-impl.cpp index 4a6608842c174d..961fc868ed12b5 100644 --- a/examples/laundry-washer-app/nxp/common/main/operational-state-delegate-impl.cpp +++ b/examples/laundry-washer-app/nxp/common/main/operational-state-delegate-impl.cpp @@ -21,7 +21,6 @@ using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::OperationalState; -using namespace chip::app::Clusters::RvcOperationalState; CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalStateAtIndex(size_t index, GenericOperationalState & operationalState) { diff --git a/examples/laundry-washer-app/nxp/rt/rw61x/BUILD.gn b/examples/laundry-washer-app/nxp/rt/rw61x/BUILD.gn index d2dba4e2403655..081b5891b9c5f6 100644 --- a/examples/laundry-washer-app/nxp/rt/rw61x/BUILD.gn +++ b/examples/laundry-washer-app/nxp/rt/rw61x/BUILD.gn @@ -49,7 +49,8 @@ declare_args() { setup_discriminator = 3840 } -example_platform_dir = "${chip_root}/examples/platform/nxp/${nxp_platform}" +example_platform_dir = + "${nxp_sdk_matter_support_root}/examples/platform/${nxp_platform}" common_example_dir = "${chip_root}/examples/platform/nxp/common" if (tcp_download == true && wifi_connect == true) { diff --git a/examples/laundry-washer-app/nxp/zap/laundry-washer-app.matter b/examples/laundry-washer-app/nxp/zap/laundry-washer-app.matter index c59228b7e12612..ae49f1c25c7bb7 100644 --- a/examples/laundry-washer-app/nxp/zap/laundry-washer-app.matter +++ b/examples/laundry-washer-app/nxp/zap/laundry-washer-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -259,7 +276,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -275,12 +292,42 @@ cluster AccessControl = 31 { 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; @@ -316,17 +363,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -411,7 +482,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/laundry-washer-app/nxp/zephyr/.gitignore b/examples/laundry-washer-app/nxp/zephyr/.gitignore new file mode 100644 index 00000000000000..84c048a73cc2e5 --- /dev/null +++ b/examples/laundry-washer-app/nxp/zephyr/.gitignore @@ -0,0 +1 @@ +/build/ diff --git a/examples/laundry-washer-app/nxp/zephyr/CMakeLists.txt b/examples/laundry-washer-app/nxp/zephyr/CMakeLists.txt new file mode 100644 index 00000000000000..f7b32881ada959 --- /dev/null +++ b/examples/laundry-washer-app/nxp/zephyr/CMakeLists.txt @@ -0,0 +1,116 @@ +# +# Copyright (c) 2023-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. +# +cmake_minimum_required(VERSION 3.13.1) + +get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) +get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) +get_filename_component(ALL_CLUSTERS_COMMON_DIR ${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common REALPATH) +get_filename_component(LAUNDRY_WASHER_NXP_COMMON_DIR ${CHIP_ROOT}/examples/laundry-washer-app/nxp/common REALPATH) +get_filename_component(EXAMPLE_PLATFORM_NXP_COMMON_DIR ${CHIP_ROOT}/examples/platform/nxp/common REALPATH) +get_filename_component(EXAMPLE_PLATFORM_NXP_ZEPHYR_DIR ${CHIP_ROOT}/examples/platform/nxp/zephyr REALPATH) + +# Perform common operations like detecting extra overlays in the platform folder for the target board +# This must be called before find_package(Zephyr) +include(${CHIP_ROOT}/config/nxp/app/pre-zephyr.cmake) + +list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nxp/chip-module) +find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) + +# -Wmaybe-uninitialized has too many false positives, including on std::optional +# and chip::Optional. Make it nonfatal. +# +# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635 +target_compile_options(app PRIVATE -Werror -Wno-error=maybe-uninitialized) +target_compile_options(app PRIVATE -Werror PRIVATE -Wno-error=format) + +project(chip-nxp-all-clusters-app-example) + +include(${CHIP_ROOT}/config/nxp/app/enable-gnu-std.cmake) +include(${CHIP_ROOT}/src/app/chip_data_model.cmake) + +target_include_directories(app + PRIVATE + ${LAUNDRY_WASHER_NXP_COMMON_DIR}/main/include + ${LAUNDRY_WASHER_NXP_COMMON_DIR}/Zephyr/include + ${ALL_CLUSTERS_COMMON_DIR}/include + ${GEN_DIR}/app-common + ${GEN_DIR}/all-clusters-app + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_manager/include + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/icd/include + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_callbacks/include + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/factory_data/include + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/app_task/include +) + +target_sources(app + PRIVATE + main/main.cpp + ${LAUNDRY_WASHER_NXP_COMMON_DIR}/main/AppTask.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_manager/source/CHIPDeviceManager.cpp + ${LAUNDRY_WASHER_NXP_COMMON_DIR}/main/DeviceCallbacks.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_callbacks/source/CommonDeviceCallbacks.cpp + ${LAUNDRY_WASHER_NXP_COMMON_DIR}/main/ZclCallbacks.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/binding-handler.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/app_task/source/AppTaskBase.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/app_task/source/AppTaskZephyr.cpp + ${EXAMPLE_PLATFORM_NXP_ZEPHYR_DIR}/factory_data/source/AppFactoryDataExample.cpp +) + +target_compile_definitions(app PUBLIC + "EXTERNAL_FACTORY_DATA_PROVIDER_IMPL_HEADER=\"platform/nxp/zephyr/FactoryDataProviderImpl.h\"" +) + +if(CONFIG_CHIP_OTA_REQUESTOR) + target_sources(app PRIVATE + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/ota_requestor/source/OTARequestorInitiatorCommon.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/ota_requestor/source/OTARequestorInitiatorZephyr.cpp + ) + target_include_directories(app PRIVATE + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/ota_requestor/include/ + ) +endif() + +chip_configure_data_model(app + INCLUDE_SERVER + ZAP_FILE ${ALL_CLUSTERS_COMMON_DIR}/../../laundry-washer-app/nxp/zap/laundry-washer-app.zap +) + +if(CONFIG_CHIP_LIB_SHELL) + target_compile_definitions(app PRIVATE ENABLE_CHIP_SHELL) + target_include_directories(app PRIVATE + ${CHIP_ROOT}/examples/shell/shell_common/include + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/matter_cli/include + ) + target_sources(app PRIVATE + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/matter_cli/source/AppCLIBase.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/matter_cli/source/AppCLIZephyr.cpp + ${CHIP_ROOT}/examples/shell/shell_common/cmd_misc.cpp + ${CHIP_ROOT}/examples/shell/shell_common/cmd_otcli.cpp + ${CHIP_ROOT}/examples/shell/shell_common/cmd_server.cpp + ) +endif() + +target_sources(app + PRIVATE + ${ALL_CLUSTERS_COMMON_DIR}/src/smco-stub.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/bridged-actions-stub.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/static-supported-modes-manager.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/static-supported-temperature-levels.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/laundry-washer-mode.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/laundry-washer-controls-delegate-impl.cpp + ${LAUNDRY_WASHER_NXP_COMMON_DIR}/main/operational-state-delegate-impl.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/icd/source/ICDUtil.cpp +) diff --git a/examples/laundry-washer-app/nxp/zephyr/Kconfig b/examples/laundry-washer-app/nxp/zephyr/Kconfig new file mode 100644 index 00000000000000..1d8b3f96581e51 --- /dev/null +++ b/examples/laundry-washer-app/nxp/zephyr/Kconfig @@ -0,0 +1,20 @@ +# +# 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. +# +mainmenu "Matter NXP Laundry Washer Example Application" + +rsource "../../../../config/nxp/chip-module/Kconfig.features" +rsource "../../../../config/nxp/chip-module/Kconfig.defaults" +source "Kconfig.zephyr" diff --git a/examples/laundry-washer-app/nxp/zephyr/README.md b/examples/laundry-washer-app/nxp/zephyr/README.md new file mode 100644 index 00000000000000..406ee3b7796ede --- /dev/null +++ b/examples/laundry-washer-app/nxp/zephyr/README.md @@ -0,0 +1,4 @@ +# CHIP NXP Zephyr Laundry Washer Application + +All instructions describing how to use a Matter application on NXP Zephyr can be +found in [README.md](../../../all-clusters-app/nxp/zephyr/README.md) root readme diff --git a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/laundry-washer-app/nxp/zephyr/boards/rd_rw612_bga.overlay similarity index 51% rename from examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay rename to examples/laundry-washer-app/nxp/zephyr/boards/rd_rw612_bga.overlay index 0728eff3db8377..86bb20739527cd 100644 --- a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay +++ b/examples/laundry-washer-app/nxp/zephyr/boards/rd_rw612_bga.overlay @@ -1,14 +1,15 @@ /* - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-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, + * 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. @@ -16,6 +17,23 @@ / { chosen { - nordic,pm-ext-flash = &mx25r64; + zephyr,console = &flexcomm0; + zephyr,shell-uart = &flexcomm3; }; }; + +&flexcomm0 { + compatible = "nxp,lpc-usart"; + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&pinmux_flexcomm0_usart>; + pinctrl-names = "default"; +}; + +&flexcomm3 { + compatible = "nxp,lpc-usart"; + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&pinmux_flexcomm3_usart>; + pinctrl-names = "default"; +}; diff --git a/examples/all-clusters-app/nrfconnect/child_image/hci_rpmsg/prj_no_dfu.conf b/examples/laundry-washer-app/nxp/zephyr/boards/rd_rw612_bga_fdata.conf similarity index 57% rename from examples/all-clusters-app/nrfconnect/child_image/hci_rpmsg/prj_no_dfu.conf rename to examples/laundry-washer-app/nxp/zephyr/boards/rd_rw612_bga_fdata.conf index 1622ffd00dbb91..73d139c3948d95 100644 --- a/examples/all-clusters-app/nrfconnect/child_image/hci_rpmsg/prj_no_dfu.conf +++ b/examples/laundry-washer-app/nxp/zephyr/boards/rd_rw612_bga_fdata.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2022 Project CHIP Authors +# Copyright (c) 2023-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. @@ -14,12 +14,10 @@ # limitations under the License. # -# This target uses Kconfig.hci_rpmsg.defaults to set options common for all -# samples using hci_rpmsg. This file should contain only options specific for this sample -# hci_rpmsg configuration or overrides of default values. +CONFIG_SETTINGS_NVS_SECTOR_COUNT=16 -# Disable not used modules that cannot be set in Kconfig.hci_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n +# 0xA226 +CONFIG_CHIP_DEVICE_PRODUCT_ID=41510 +CONFIG_CHIP_DEVICE_PRODUCT_URL="https://www.nxp.com/products/wireless-connectivity/wi-fi-plus-bluetooth-plus-802-15-4/wireless-mcu-with-integrated-tri-radio-1x1-wi-fi-6-plus-bluetooth-low-energy-5-3-802-15-4:RW612" +CONFIG_CHIP_DEVICE_PRODUCT_LABEL="RW612" +CONFIG_CHIP_DEVICE_PART_NUMBER="RW612" diff --git a/examples/laundry-washer-app/nxp/zephyr/main/include/CHIPProjectConfig.h b/examples/laundry-washer-app/nxp/zephyr/main/include/CHIPProjectConfig.h new file mode 100644 index 00000000000000..84c57df1ea140d --- /dev/null +++ b/examples/laundry-washer-app/nxp/zephyr/main/include/CHIPProjectConfig.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2023-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. + */ + +/** + * @file + * Example project configuration file for CHIP. + * + * This is a place to put application or project-specific overrides + * to the default configuration values for general CHIP features. + * + */ + +#pragma once + +// Use a default pairing code if one hasn't been provisioned in flash. +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR CONFIG_CHIP_DEVICE_DISCRIMINATOR + +// All clusters app has 3 group endpoints. This needs to defined here so that +// CHIP_CONFIG_MAX_GROUPS_PER_FABRIC is properly configured. +#define CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC 3 diff --git a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay b/examples/laundry-washer-app/nxp/zephyr/main/main.cpp similarity index 54% rename from examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay rename to examples/laundry-washer-app/nxp/zephyr/main/main.cpp index 0728eff3db8377..9be47dfe0a95d8 100644 --- a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay +++ b/examples/laundry-washer-app/nxp/zephyr/main/main.cpp @@ -1,5 +1,6 @@ /* - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-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. @@ -14,8 +15,23 @@ * limitations under the License. */ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; +#include "AppTask.h" + +#include + +LOG_MODULE_REGISTER(app, CONFIG_CHIP_APP_LOG_LEVEL); + +using namespace ::chip; + +int main() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + if (err == CHIP_NO_ERROR) + { + err = chip::NXP::App::GetAppTask().Start(); + } + + LOG_ERR("Exited with code %" CHIP_ERROR_FORMAT, err.Format()); + return err == CHIP_NO_ERROR ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/examples/laundry-washer-app/nxp/zephyr/prj.conf b/examples/laundry-washer-app/nxp/zephyr/prj.conf new file mode 100644 index 00000000000000..ed59218a7da0e9 --- /dev/null +++ b/examples/laundry-washer-app/nxp/zephyr/prj.conf @@ -0,0 +1,59 @@ +# +# Copyright (c) 2023-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. +# + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Enable CHIP +CONFIG_CHIP=y +CONFIG_STD_CPP17=y +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y +# CHIP PID: 32769 == 0x8001 (all-clusters-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 +CONFIG_CHIP_DEVICE_PRODUCT_NAME="Laundry Washer" +CONFIG_CHIP_DEVICE_DISCRIMINATOR=0x800 + +# Enable MbedTLS PSA - heavily experimental, not thread safe yet +# CONFIG_CHIP_CRYPTO_PSA=y + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="LaundryWasher" + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y + +CONFIG_DEBUG=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_THREAD_INFO=y +# use this config if stepping during debug session is not consistent +# CONFIG_NO_OPTIMIZATIONS=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_ASSERT=y +# by default west will generate the full assembly output, which can take several minutes when binaries are large +CONFIG_OUTPUT_DISASSEMBLY=n +# embedded thread analyzer with thread statistics (stack usage, cpu usage...) +# CONFIG_THREAD_ANALYZER=y +# CONFIG_THREAD_ANALYZER_USE_PRINTK=y +# CONFIG_THREAD_ANALYZER_AUTO=y + +# enable Matter CLI +CONFIG_CHIP_LIB_SHELL=y +# enable NET commands if desired +#CONFIG_NET_SHELL=y +CONFIG_CHIP_STATISTICS=y diff --git a/examples/laundry-washer-app/nxp/zephyr/prj_fdata.conf b/examples/laundry-washer-app/nxp/zephyr/prj_fdata.conf new file mode 100644 index 00000000000000..986fc877aec5df --- /dev/null +++ b/examples/laundry-washer-app/nxp/zephyr/prj_fdata.conf @@ -0,0 +1,80 @@ +# +# Copyright (c) 2023-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. +# + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Enable CHIP +CONFIG_CHIP=y +CONFIG_STD_CPP17=y +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable MbedTLS PSA - heavily experimental, not thread safe yet +# CONFIG_CHIP_CRYPTO_PSA=y + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="LaundryWasher" + +# enable Matter CLI +CONFIG_CHIP_LIB_SHELL=y +CONFIG_CHIP_STATISTICS=y + +# Factory data configuration +CONFIG_CHIP_DEVICE_VENDOR_ID=4151 +CONFIG_CHIP_DEVICE_DISCRIMINATOR=0xA00 +CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE=14014 +CONFIG_CHIP_DEVICE_PRODUCT_NAME="Laundry Washer" +CONFIG_CHIP_DEVICE_TYPE=115 +CONFIG_CHIP_DEVICE_MANUFACTURING_DATE="2023-01-01" +CONFIG_CHIP_DEVICE_SERIAL_NUMBER="12345678" +CONFIG_CHIP_DEVICE_PRODUCT_COLOR="Green" +CONFIG_CHIP_DEVICE_PRODUCT_FINISH="Matte" + +# Use factory data provider for device info +CONFIG_CHIP_FACTORY_DATA=y +# Generate factor data raw binary during the build process +# CONFIG_CHIP_FACTORY_DATA_BUILD=y +# Generate test certificates for factory data during the build process +# CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_GENERATED=y +# Spake2p verifier will be generated during factory data generation +# CONFIG_CHIP_FACTORY_DATA_GENERATE_SPAKE2_VERIFIER=y + +# Example of using pre-generated certificates +# CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_USER=y +# CONFIG_CHIP_FACTORY_DATA_USER_CERTS_CD_CERT="/Chip-Test-CD-1037-A226.der" +# CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_CERT="/Chip-DAC-NXP-1037-A226-Cert.der" +# CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_KEY="/Chip-DAC-NXP-1037-A226-Key.der" +# CONFIG_CHIP_FACTORY_DATA_USER_CERTS_PAI_CERT="/Chip-PAI-NXP-1037-A226-Cert.der" + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y + +CONFIG_DEBUG=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_THREAD_INFO=y +# use this config if stepping during debug session is not consistent +# CONFIG_NO_OPTIMIZATIONS=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_ASSERT=y +# by default west will generate the full assembly output, which can take several minutes when binaries are large +CONFIG_OUTPUT_DISASSEMBLY=n +# embedded thread analyzer with thread statistics (stack usage, cpu usage...) +# CONFIG_THREAD_ANALYZER=y +# CONFIG_THREAD_ANALYZER_USE_PRINTK=y +# CONFIG_THREAD_ANALYZER_AUTO=y diff --git a/examples/laundry-washer-app/nxp/zephyr/prj_ota.conf b/examples/laundry-washer-app/nxp/zephyr/prj_ota.conf new file mode 100644 index 00000000000000..bdc65e94fabf70 --- /dev/null +++ b/examples/laundry-washer-app/nxp/zephyr/prj_ota.conf @@ -0,0 +1,31 @@ +# +# 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. +# + +# Options needed for OTA are located on this file +# This file should contain only options specific for this sample +# or overrides the default ones. + +CONFIG_CHIP_OTA_REQUESTOR=y + +# To generate an OTA image based on the application +CONFIG_CHIP_OTA_IMAGE_BUILD=y + +# By default, MCUBOOT bootloader uses a signature key provided in their repository. +# Change the key to the appropriate one. +# Note: You need to use the same signature key used by MCUBOOT, i.e BOOT_SIGNATURE_KEY_FILE. +# Default CONFIG_BOOT_SIGNATURE_KEY_FILE is defined in config/nxp/app/bootloader.conf +CONFIG_MCUBOOT_SIGNATURE_KEY_FILE="./bootloader/mcuboot/root-rsa-2048.pem" diff --git a/examples/laundry-washer-app/nxp/zephyr/third_party/connectedhomeip b/examples/laundry-washer-app/nxp/zephyr/third_party/connectedhomeip new file mode 120000 index 00000000000000..3efed95be5dbe9 --- /dev/null +++ b/examples/laundry-washer-app/nxp/zephyr/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../../../ \ No newline at end of file diff --git a/examples/light-switch-app/ameba/chip_main.cmake b/examples/light-switch-app/ameba/chip_main.cmake index 78f3c8c755f488..75e0d0116425fe 100755 --- a/examples/light-switch-app/ameba/chip_main.cmake +++ b/examples/light-switch-app/ameba/chip_main.cmake @@ -213,7 +213,6 @@ target_include_directories( ${chip_dir}/src/app/server/ ${chip_dir}/src/controller/data_model ${chip_dir}/third_party/nlio/repo/include/ - ${chip_dir}/third_party/nlunit-test/repo/src ) if (matter_enable_rpc) diff --git a/examples/light-switch-app/esp32/main/CMakeLists.txt b/examples/light-switch-app/esp32/main/CMakeLists.txt index e2600438b55346..b4b6f5946eb2f9 100644 --- a/examples/light-switch-app/esp32/main/CMakeLists.txt +++ b/examples/light-switch-app/esp32/main/CMakeLists.txt @@ -46,7 +46,6 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/localization-configuration-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-format-localization-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/occupancy-sensor-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-requestor" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server" diff --git a/examples/light-switch-app/infineon/cyw30739/README.md b/examples/light-switch-app/infineon/cyw30739/README.md index 70d650cfef97a3..0343563087a154 100644 --- a/examples/light-switch-app/infineon/cyw30739/README.md +++ b/examples/light-switch-app/infineon/cyw30739/README.md @@ -12,7 +12,7 @@ An example showing the use of Matter on the Infineon CYW30739 platform. - [Installing ModusToolbox™ Software](#installing-modustoolbox-software) - [ModusToolbox™ tools package](#modustoolbox-tools-package) - [Note for WSL (Windows Subsystem for Linux)](#note-for-wsl-windows-subsystem-for-linux) - - [Checkout Submodules](#checkout-submodules) + - [Checkout Submodules and Bootstrap](#checkout-submodules-and-bootstrap) - [Building](#building) - [Factory Data](#factory-data) - [Commissionable Data](#commissionable-data) @@ -65,7 +65,7 @@ If you are using WSL, please ensure you have installed the ModusToolbox™ Software for Linux. Running Windows tools directly from the WSL command line would cause path resolution failure in the build process. -### Checkout Submodules +### Checkout Submodules and Bootstrap Before building the example, check out the Matter repository and sync submodules using the following command: @@ -73,6 +73,7 @@ using the following command: ```bash $ cd ~/connectedhomeip $ scripts/checkout_submodules.py --platform infineon +$ bash scripts/bootstrap.sh -p all,infineon ``` ## Building diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.matter b/examples/light-switch-app/light-switch-common/light-switch-app.matter index 1380e672e747b2..f5e838972ad2d5 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.matter +++ b/examples/light-switch-app/light-switch-common/light-switch-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -309,7 +326,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -325,12 +342,42 @@ cluster AccessControl = 31 { 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; @@ -366,17 +413,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -461,7 +532,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1937,7 +2008,7 @@ cluster UserLabel = 65 { /** Allows servers to ensure that listed clients are notified when a server is available for communication. */ cluster IcdManagement = 70 { - revision 2; + revision 3; enum ClientTypeEnum : enum8 { kPermanent = 0; @@ -1953,6 +2024,7 @@ cluster IcdManagement = 70 { kCheckInProtocolSupport = 0x1; kUserActiveModeTrigger = 0x2; kLongIdleTimeSupport = 0x4; + kDynamicSitLitSupport = 0x8; } bitmap UserActiveModeTriggerBitmap : bitmap32 { @@ -1991,6 +2063,7 @@ cluster IcdManagement = 70 { 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; @@ -2043,14 +2116,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + 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; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -2162,7 +2242,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** 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; @@ -2182,7 +2262,7 @@ provisional cluster ScenesManagement = 98 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -2878,7 +2958,7 @@ endpoint 0 { callback attribute activeModeDuration; callback attribute activeModeThreshold; ram attribute featureMap default = 0x0000; - ram attribute clusterRevision default = 2; + ram attribute clusterRevision default = 3; } } endpoint 1 { diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.zap b/examples/light-switch-app/light-switch-common/light-switch-app.zap index c181f1ffae1120..ad7f46df3bc97d 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.zap +++ b/examples/light-switch-app/light-switch-common/light-switch-app.zap @@ -19,18 +19,18 @@ "package": [ { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/zcl/zcl.json", - "type": "zcl-properties", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", "category": "matter", - "version": 1, - "description": "Matter SDK ZCL data" + "version": "chip-v1" }, { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", + "path": "../../../src/app/zap-templates/zcl/zcl.json", + "type": "zcl-properties", "category": "matter", - "version": "chip-v1" + "version": 1, + "description": "Matter SDK ZCL data" } ], "endpointTypes": [ @@ -4570,7 +4570,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -5412,7 +5412,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/light-switch-app/nrfconnect/CMakeLists.txt b/examples/light-switch-app/nrfconnect/CMakeLists.txt index abd1a0c6d1a2b0..48329e053be562 100644 --- a/examples/light-switch-app/nrfconnect/CMakeLists.txt +++ b/examples/light-switch-app/nrfconnect/CMakeLists.txt @@ -22,15 +22,6 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) -# Set Kconfig root files that will be processed as a first Kconfig for used child images. -set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root) -set(multiprotocol_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root) -set(hci_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.hci_rpmsg.root) - -if(NOT CONF_FILE STREQUAL "prj_no_dfu.conf") - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static_dfu.yml) -endif() - list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) @@ -42,6 +33,7 @@ target_compile_options(app PRIVATE -Werror -Wno-error=maybe-uninitialized) project(chip-nrfconnect-light-switch-example) +include(${CHIP_ROOT}/config/nrfconnect/app/check-sysbuild-use.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/flashing.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) diff --git a/examples/light-switch-app/nrfconnect/Kconfig.sysbuild b/examples/light-switch-app/nrfconnect/Kconfig.sysbuild new file mode 100644 index 00000000000000..4a0b8f3656b1eb --- /dev/null +++ b/examples/light-switch-app/nrfconnect/Kconfig.sysbuild @@ -0,0 +1,76 @@ +# +# 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. +# + +#### Radio core selection +config NRF_DEFAULT_IPC_RADIO + default y + +# Enable IEEE802.15.4 serialization to network core +config NETCORE_IPC_RADIO_IEEE802154 + default y if (SOC_SERIES_NRF53X) && !WIFI_NRF700X + +# Enable Bluetooth serialization to network core +config NETCORE_IPC_RADIO_BT_HCI_IPC + default y if SOC_SERIES_NRF53X + +#### Bootloader +choice BOOTLOADER + default BOOTLOADER_MCUBOOT +endchoice + +if BOOTLOADER_MCUBOOT + +#### DFU multi-image support +config DFU_MULTI_IMAGE_PACKAGE_BUILD + default y + +config DFU_MULTI_IMAGE_PACKAGE_APP + default y + +config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY + default y + +#### DFU network core configuration +if SOC_SERIES_NRF53X + +config MCUBOOT_UPDATEABLE_IMAGES + default 2 + +choice MCUBOOT_MODE + default MCUBOOT_MODE_OVERWRITE_ONLY +endchoice + +choice BOOT_SIGNATURE_TYPE + default BOOT_SIGNATURE_TYPE_RSA +endchoice + +config SECURE_BOOT_NETCORE + default y + +config NETCORE_APP_UPDATE + default y + +config DFU_MULTI_IMAGE_PACKAGE_NET + default y + +endif # SOC_SERIES_NRF53X +endif # BOOTLOADER_MCUBOOT + +#### Enable generating factory data +config MATTER_FACTORY_DATA_GENERATE + default y + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/examples/light-switch-app/nrfconnect/README.md b/examples/light-switch-app/nrfconnect/README.md index ee78d91c2f7bd8..943759735f2bc2 100644 --- a/examples/light-switch-app/nrfconnect/README.md +++ b/examples/light-switch-app/nrfconnect/README.md @@ -1,5 +1,21 @@ # Matter nRF Connect Light Switch Example Application +> **Note:** This example is intended only to perform smoke tests of a Matter +> solution integrated with nRF Connect SDK platform. The example quality is not +> production ready and it may contain minor bugs or use not optimal +> configuration. It is not recommended to use this example as a basis for +> creating a market ready product. +> +> For the production ready and optimized Matter samples, see +> [nRF Connect SDK samples](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/matter.html). +> The Matter samples in nRF Connect SDK use various additional software +> components and provide multiple optional features that improve the developer +> and user experience. To read more about it, see +> [Matter support in nRF Connect SDK](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/matter/index.html#ug-matter) +> page. Using Matter samples from nRF Connect SDK allows you to get a full +> Nordic technical support via [DevZone](https://devzone.nordicsemi.com/) +> portal. + The nRF Connect Light Switch Example demonstrates how to remotely control a lighting devices such as light bulbs or LEDs. The application should be used together with the @@ -199,18 +215,18 @@ The example supports building and running on the following devices: | Hardware platform | Build target | Platform image | | ----------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | -| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk_nrf52840` |
nRF52840 DKnRF52840 DK
| -| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk_nrf5340_cpuapp` |
nRF5340 DKnRF5340 DK
| -| [nRF7002 DK](https://www.nordicsemi.com/Products/Development-hardware/nRF7002-DK) | `nrf7002dk_nrf5340_cpuapp` |
nRF7002 DKnRF7002 DK
| +| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk/nrf52840` |
nRF52840 DKnRF52840 DK
| +| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk/nrf5340/cpuapp` |
nRF5340 DKnRF5340 DK
| +| [nRF7002 DK](https://www.nordicsemi.com/Products/Development-hardware/nRF7002-DK) | `nrf7002dk/nrf5340/cpuapp` |
nRF7002 DKnRF7002 DK
| ### IPv6 network support The development kits for this sample offer the following IPv6 network support for Matter: -- Matter over Thread is supported for `nrf52840dk_nrf52840` and - `nrf5340dk_nrf5340_cpuapp`. -- Matter over Wi-Fi is supported for `nrf7002dk_nrf5340_cpuapp`. +- Matter over Thread is supported for `nrf52840dk/nrf52840` and + `nrf5340dk/nrf5340/cpuapp`. +- Matter over Wi-Fi is supported for `nrf7002dk/nrf5340/cpuapp`. ### Additional requirements for testing @@ -341,9 +357,9 @@ connection to Nordic Semiconductor's kit. To enable the Matter CLI, you must compile the Light Switch Example application with the additional option **-DCONFIG_CHIP_LIB_SHELL=y**. Run the following command with _build-target_ replaced with the build target name of Nordic -Semiconductor's kit you are using (for example, `nrf52840dk_nrf52840`): +Semiconductor's kit you are using (for example, `nrf52840dk/nrf52840`): - west build -b build-target -- -DCONFIG_CHIP_LIB_SHELL=y + west build -b build-target --sysbuild -- -DCONFIG_CHIP_LIB_SHELL=y You can use the following commands to control a device that is programmed with the Light Switch Example application by using the Matter CLI: @@ -441,14 +457,15 @@ Complete the following steps to build the sample: 2. Run the following command to build the example, with _build-target_ replaced with the build target name of the Nordic Semiconductor's kit you own, for - example `nrf52840dk_nrf52840`: + example `nrf52840dk/nrf52840`: - $ west build -b build-target + $ west build -b build-target --sysbuild You only need to specify the build target on the first build. See [Requirements](#requirements) for the build target names of compatible kits. -The output `zephyr.hex` file will be available in the `build/zephyr/` directory. +The output `zephyr.hex` file will be available in the `build/nrfconnect/zephyr/` +directory. ### Removing build artifacts @@ -463,7 +480,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DCONF_FILE=prj_release.conf + $ west build -b build-target --sysbuild -- -DFILE_SUFFIX=release Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -474,15 +491,9 @@ Support for DFU using Matter OTA is enabled by default. To enable DFU over Bluetooth LE, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are -using (for example `nrf52840dk_nrf52840`): - - $ west build -b build-target -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y - -To completely disable support for both DFU methods, run the following command -with _build-target_ replaced with the build target name of the Nordic -Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): +using (for example `nrf52840dk/nrf52840`): - $ west build -b build-target -- -DCONF_FILE=prj_no_dfu.conf + $ west build -b build-target --sysbuild -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y > **Note**: > @@ -496,7 +507,7 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): #### Changing bootloader configuration To change the default MCUboot configuration, edit the `prj.conf` file located in -the `child_image/mcuboot` directory. +the `sysbuild/mcuboot` directory. Make sure to keep the configuration consistent with changes made to the application configuration. This is necessary for the configuration to work, as @@ -513,8 +524,9 @@ purposes. You can change these settings by defining This example uses this option to define using an external flash. To modify the flash settings of your board (that is, your _build-target_, for -example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the -`configuration/build-target/` directory. +example `nrf52840dk/nrf52840`), edit the `pm_static_.yml` file +(for example `pm_static_nrf52840dk_nrf52840.yml`), located in the main +application directory.
@@ -526,7 +538,7 @@ using the menuconfig utility. To open the menuconfig utility, run the following command from the example directory: - $ west build -b build-target -t menuconfig + $ west build -b build-target --sysbuild -t menuconfig Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -556,9 +568,6 @@ depending on the selected board: command-line shell. - release -- Release version of the application - can be used to enable only the necessary application functionalities to optimize its performance. -- no_dfu -- Debug version of the application without Device Firmware Upgrade - feature support - can be used only for the nRF52840 DK and nRF5340 DK, as - those platforms have DFU enabled by default. For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) diff --git a/examples/light-switch-app/nrfconnect/child_image/hci_rpmsg/prj.conf b/examples/light-switch-app/nrfconnect/child_image/hci_rpmsg/prj.conf deleted file mode 100644 index 1622ffd00dbb91..00000000000000 --- a/examples/light-switch-app/nrfconnect/child_image/hci_rpmsg/prj.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.hci_rpmsg.defaults to set options common for all -# samples using hci_rpmsg. This file should contain only options specific for this sample -# hci_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.hci_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/light-switch-app/nrfconnect/child_image/hci_rpmsg/prj_no_dfu.conf b/examples/light-switch-app/nrfconnect/child_image/hci_rpmsg/prj_no_dfu.conf deleted file mode 100644 index 1622ffd00dbb91..00000000000000 --- a/examples/light-switch-app/nrfconnect/child_image/hci_rpmsg/prj_no_dfu.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.hci_rpmsg.defaults to set options common for all -# samples using hci_rpmsg. This file should contain only options specific for this sample -# hci_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.hci_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/light-switch-app/nrfconnect/child_image/hci_rpmsg/prj_release.conf b/examples/light-switch-app/nrfconnect/child_image/hci_rpmsg/prj_release.conf deleted file mode 100644 index 1622ffd00dbb91..00000000000000 --- a/examples/light-switch-app/nrfconnect/child_image/hci_rpmsg/prj_release.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.hci_rpmsg.defaults to set options common for all -# samples using hci_rpmsg. This file should contain only options specific for this sample -# hci_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.hci_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay b/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index f18e3e0cc16434..00000000000000 --- a/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay b/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay b/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.overlay b/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/light-switch-app/nrfconnect/child_image/mcuboot/prj_release.conf b/examples/light-switch-app/nrfconnect/child_image/mcuboot/prj_release.conf deleted file mode 100644 index 90969a32dbc414..00000000000000 --- a/examples/light-switch-app/nrfconnect/child_image/mcuboot/prj_release.conf +++ /dev/null @@ -1,30 +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. -# - -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. - -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" - -# Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_USE_SEGGER_RTT=n -CONFIG_GPIO=n diff --git a/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf b/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf b/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf b/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml b/examples/light-switch-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml similarity index 100% rename from examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml rename to examples/light-switch-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml diff --git a/examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml b/examples/light-switch-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml similarity index 100% rename from examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml rename to examples/light-switch-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml diff --git a/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml b/examples/light-switch-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml similarity index 100% rename from examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml rename to examples/light-switch-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml diff --git a/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml b/examples/light-switch-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml similarity index 100% rename from examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml rename to examples/light-switch-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml diff --git a/examples/lighting-app/nrfconnect/configuration/nrf7002dk_nrf5340_cpuapp/pm_static_dfu.yml b/examples/light-switch-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp.yml similarity index 100% rename from examples/lighting-app/nrfconnect/configuration/nrf7002dk_nrf5340_cpuapp/pm_static_dfu.yml rename to examples/light-switch-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp.yml diff --git a/examples/lock-app/nrfconnect/configuration/nrf7002dk_nrf5340_cpuapp/pm_static_dfu.yml b/examples/light-switch-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp_release.yml similarity index 100% rename from examples/lock-app/nrfconnect/configuration/nrf7002dk_nrf5340_cpuapp/pm_static_dfu.yml rename to examples/light-switch-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp_release.yml diff --git a/examples/light-switch-app/nrfconnect/prj.conf b/examples/light-switch-app/nrfconnect/prj.conf index dd75cdf99c4fd1..4ece5671b2f6df 100644 --- a/examples/light-switch-app/nrfconnect/prj.conf +++ b/examples/light-switch-app/nrfconnect/prj.conf @@ -25,6 +25,13 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32772 CONFIG_STD_CPP17=y +# Enable Matter pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/light-switch-app/nrfconnect/prj_no_dfu.conf b/examples/light-switch-app/nrfconnect/prj_no_dfu.conf deleted file mode 100644 index def17d5345e22c..00000000000000 --- a/examples/light-switch-app/nrfconnect/prj_no_dfu.conf +++ /dev/null @@ -1,52 +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. -# - -# This sample uses Kconfig.defaults to set options common for all -# samples. This file should contain only options specific for this sample -# or overrides of default values. - -# Enable CHIP -CONFIG_CHIP=y -CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" -# 32772 == 0x8004 (example light-switch-app) -CONFIG_CHIP_DEVICE_PRODUCT_ID=32772 -CONFIG_STD_CPP17=y - -# Add support for LEDs and buttons on Nordic development kits -CONFIG_DK_LIBRARY=y - -# General networking settings -CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=14 - -# Bluetooth Low Energy configuration -CONFIG_BT_DEVICE_NAME="MatterSwitch" - -# Other settings -CONFIG_THREAD_NAME=y -CONFIG_MPU_STACK_GUARD=y -CONFIG_RESET_ON_FATAL_ERROR=n - -# Reduce application size -CONFIG_USE_SEGGER_RTT=n - -# Disable Matter OTA DFU -CONFIG_CHIP_OTA_REQUESTOR=n - -# Disable QSPI NOR -CONFIG_CHIP_QSPI_NOR=n - -# Enable the Read Client for binding purposes -CONFIG_CHIP_ENABLE_READ_CLIENT=y diff --git a/examples/light-switch-app/nrfconnect/prj_release.conf b/examples/light-switch-app/nrfconnect/prj_release.conf index c57d5eb42bf168..74d128e682584e 100644 --- a/examples/light-switch-app/nrfconnect/prj_release.conf +++ b/examples/light-switch-app/nrfconnect/prj_release.conf @@ -25,6 +25,13 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32772 CONFIG_STD_CPP17=y +# Enable Matter pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.conf b/examples/light-switch-app/nrfconnect/sysbuild.conf similarity index 90% rename from examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.conf rename to examples/light-switch-app/nrfconnect/sysbuild.conf index cd9aab4101c6f5..d0c5eee2b93c39 100644 --- a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.conf +++ b/examples/light-switch-app/nrfconnect/sysbuild.conf @@ -1,5 +1,5 @@ # -# 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. @@ -14,4 +14,4 @@ # limitations under the License. # -CONFIG_GPIO=y +SB_CONFIG_MATTER=y diff --git a/examples/light-switch-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf b/examples/light-switch-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf new file mode 100644 index 00000000000000..8540585e53358b --- /dev/null +++ b/examples/light-switch-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf @@ -0,0 +1,58 @@ +# +# 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. +# + +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# 802.15.4 configuration +CONFIG_NRF_802154_SER_RADIO=y +CONFIG_NRF_802154_ENCRYPTION=y +CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=2 + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_DEBUG_INFO=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y +CONFIG_IPC_RADIO_802154=y diff --git a/examples/light-switch-app/nrfconnect/sysbuild/ipc_radio/boards/nrf7002dk_nrf5340_cpunet.conf b/examples/light-switch-app/nrfconnect/sysbuild/ipc_radio/boards/nrf7002dk_nrf5340_cpunet.conf new file mode 100644 index 00000000000000..694c3b08242f29 --- /dev/null +++ b/examples/light-switch-app/nrfconnect/sysbuild/ipc_radio/boards/nrf7002dk_nrf5340_cpunet.conf @@ -0,0 +1,52 @@ +# +# 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. +# + +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_DEBUG_INFO=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y diff --git a/examples/light-switch-app/nrfconnect/sysbuild/ipc_radio/prj.conf b/examples/light-switch-app/nrfconnect/sysbuild/ipc_radio/prj.conf new file mode 100644 index 00000000000000..8906415dda4fc7 --- /dev/null +++ b/examples/light-switch-app/nrfconnect/sysbuild/ipc_radio/prj.conf @@ -0,0 +1,21 @@ +# +# 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. +# + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=n diff --git a/examples/light-switch-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf b/examples/light-switch-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf new file mode 100644 index 00000000000000..7f92a51630cce0 --- /dev/null +++ b/examples/light-switch-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf @@ -0,0 +1,20 @@ +# +# 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. +# +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=y diff --git a/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/app.overlay b/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/app.overlay new file mode 100644 index 00000000000000..74d3dfbfd22f30 --- /dev/null +++ b/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/app.overlay @@ -0,0 +1,5 @@ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf b/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf new file mode 100644 index 00000000000000..50610217c762b5 --- /dev/null +++ b/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf @@ -0,0 +1,19 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 diff --git a/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000000..2d86fe6442dd39 --- /dev/null +++ b/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -0,0 +1,35 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 + +CONFIG_BOOT_SWAP_USING_MOVE=n +# Multi-image updates do not support image swapping yet. +CONFIG_BOOT_UPGRADE_ONLY=y + +# The network core cannot access external flash directly. The flash simulator must be used to +# provide a memory region that is used to forward the new firmware to the network core. +CONFIG_FLASH_SIMULATOR=y +CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y +CONFIG_FLASH_SIMULATOR_STATS=n + +CONFIG_ZCBOR=y diff --git a/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf b/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000000..81701b7eb63f70 --- /dev/null +++ b/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf @@ -0,0 +1,40 @@ +# +# 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. +# + +# nRF7002DK uses SPI NOR external flash +CONFIG_GPIO=y +CONFIG_SPI=y +CONFIG_SPI_NOR=y +CONFIG_SPI_NOR_SFDP_DEVICETREE=y +CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 + +CONFIG_MULTITHREADING=y +CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 + +# Multi-image updates do not support image swapping yet. +CONFIG_BOOT_UPGRADE_ONLY=y + +# The network core cannot access external flash directly. The flash simulator must be used to +# provide a memory region that is used to forward the new firmware to the network core. +CONFIG_FLASH_SIMULATOR=y +CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y +CONFIG_FLASH_SIMULATOR_STATS=n + +CONFIG_ZCBOR=y diff --git a/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay b/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/light-switch-app/nrfconnect/child_image/mcuboot/prj.conf b/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/prj.conf similarity index 59% rename from examples/light-switch-app/nrfconnect/child_image/mcuboot/prj.conf rename to examples/light-switch-app/nrfconnect/sysbuild/mcuboot/prj.conf index 90969a32dbc414..3bcb12fe7b8d25 100644 --- a/examples/light-switch-app/nrfconnect/child_image/mcuboot/prj.conf +++ b/examples/light-switch-app/nrfconnect/sysbuild/mcuboot/prj.conf @@ -1,5 +1,5 @@ # -# 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. @@ -14,17 +14,36 @@ # limitations under the License. # -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. +CONFIG_MAIN_STACK_SIZE=10240 + +CONFIG_BOOT_SWAP_SAVE_ENCTLV=n +CONFIG_BOOT_BOOTSTRAP=n +CONFIG_PM=n + +CONFIG_FLASH=y +CONFIG_FPROTECT=y CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +# Use minimal C library instead of the Picolib +CONFIG_MINIMAL_LIBC=y + # Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. CONFIG_CONSOLE=n CONFIG_SERIAL=n CONFIG_UART_CONSOLE=n CONFIG_USE_SEGGER_RTT=n CONFIG_GPIO=n + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +CONFIG_LOG=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_NCS_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/light-switch-app/qpg/include/AppTask.h b/examples/light-switch-app/qpg/include/AppTask.h index 9284e068ab8509..caf56977225280 100644 --- a/examples/light-switch-app/qpg/include/AppTask.h +++ b/examples/light-switch-app/qpg/include/AppTask.h @@ -58,6 +58,9 @@ class AppTask static void FunctionHandler(AppEvent * aEvent); static void TimerEventHandler(chip::System::Layer * aLayer, void * aAppState); + static void TotalHoursTimerHandler(chip::System::Layer * aLayer, void * aAppState); + static void MultiPressTimeoutHandler(chip::System::Layer * aLayer, void * aAppState); + static void LongPressTimeoutHandler(chip::System::Layer * aLayer, void * aAppState); static void MatterEventHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg); static void UpdateLEDs(void); diff --git a/examples/light-switch-app/qpg/include/SwitchManager.h b/examples/light-switch-app/qpg/include/SwitchManager.h index 41eedd10af4f13..df09260285c96d 100644 --- a/examples/light-switch-app/qpg/include/SwitchManager.h +++ b/examples/light-switch-app/qpg/include/SwitchManager.h @@ -55,7 +55,11 @@ class SwitchManager void Init(void); static void GenericSwitchInitialPressHandler(AppEvent * aEvent); - static void GenericSwitchReleasePressHandler(AppEvent * aEvent); + static void GenericSwitchShortReleaseHandler(AppEvent * aEvent); + static void GenericSwitchLongReleaseHandler(AppEvent * aEvent); + static void GenericSwitchLongPressHandler(AppEvent * aEvent); + static void GenericSwitchMultipressCompleteHandler(AppEvent * aEvent); + static void GenericSwitchMultipressOngoingHandler(AppEvent * aEvent); static void ToggleHandler(AppEvent * aEvent); static void LevelHandler(AppEvent * aEvent); static void ColorHandler(AppEvent * aEvent); diff --git a/examples/light-switch-app/qpg/src/AppTask.cpp b/examples/light-switch-app/qpg/src/AppTask.cpp index 4be2f4eeefbf39..7cb0a41a452aca 100644 --- a/examples/light-switch-app/qpg/src/AppTask.cpp +++ b/examples/light-switch-app/qpg/src/AppTask.cpp @@ -42,6 +42,10 @@ using namespace ::chip; #include #include +#if defined(QORVO_QPINCFG_ENABLE) +#include "qPinCfg.h" +#endif // QORVO_QPINCFG_ENABLE + #include #include @@ -58,9 +62,16 @@ using namespace ::chip::DeviceLayer; #define FACTORY_RESET_TRIGGER_TIMEOUT 3000 #define FACTORY_RESET_CANCEL_WINDOW_TIMEOUT 3000 +#define SWITCH_MULTIPRESS_WINDOW_MS 500 +#define SWITCH_LONGPRESS_WINDOW_MS 3000 +#define SWITCH_BUTTON_PRESSED 1 +#define SWITCH_BUTTON_UNPRESSED 0 + #define APP_TASK_STACK_SIZE (2 * 1024) #define APP_TASK_PRIORITY 2 #define APP_EVENT_QUEUE_SIZE 10 +#define SECONDS_IN_HOUR (3600) // we better keep this 3600 +#define TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS (1 * SECONDS_IN_HOUR) // increment every hour namespace { TaskHandle_t sAppTaskHandle; @@ -70,6 +81,9 @@ bool sIsThreadProvisioned = false; bool sIsThreadEnabled = false; bool sHaveBLEConnections = false; bool sIsBLEAdvertisingEnabled = false; +bool sIsMultipressOngoing = false; +bool sLongPressDetected = false; +uint8_t sSwitchButtonState = SWITCH_BUTTON_UNPRESSED; // NOTE! This key is for test/certification only and should not be available in production devices! uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, @@ -141,11 +155,19 @@ void OnTriggerIdentifyEffect(Identify * identify) } } -Identify gIdentify = { +Identify gIdentifyEp1 = { chip::EndpointId{ 1 }, [](Identify *) { ChipLogProgress(Zcl, "onIdentifyStart"); }, [](Identify *) { ChipLogProgress(Zcl, "onIdentifyStop"); }, - Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator, + Clusters::Identify::IdentifyTypeEnum::kNone, + OnTriggerIdentifyEffect, +}; + +Identify gIdentifyEp2 = { + chip::EndpointId{ 2 }, + [](Identify *) { ChipLogProgress(Zcl, "onIdentifyStart"); }, + [](Identify *) { ChipLogProgress(Zcl, "onIdentifyStop"); }, + Clusters::Identify::IdentifyTypeEnum::kNone, OnTriggerIdentifyEffect, }; @@ -224,6 +246,14 @@ CHIP_ERROR AppTask::Init() { CHIP_ERROR err = CHIP_NO_ERROR; +#if defined(QORVO_QPINCFG_ENABLE) + qResult_t res = Q_OK; + res = qPinCfg_Init(NULL); + if (res != Q_OK) + { + ChipLogError(NotSpecified, "qPinCfg_Init failed: %d", res); + } +#endif // QORVO_QPINCFG_ENABLE PlatformMgr().AddEventHandler(MatterEventHandler, 0); ChipLogProgress(NotSpecified, "Current Software Version: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); @@ -255,6 +285,14 @@ CHIP_ERROR AppTask::Init() sIsBLEAdvertisingEnabled = ConnectivityMgr().IsBLEAdvertisingEnabled(); UpdateLEDs(); + err = chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds32(TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS), + TotalHoursTimerHandler, this); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "StartTimer failed %s: ", chip::ErrorStr(err)); + } + return err; } @@ -275,7 +313,9 @@ void AppTask::AppTaskMain(void * pvParameter) void AppTask::ButtonEventHandler(uint8_t btnIdx, bool btnPressed) { - ChipLogProgress(NotSpecified, "ButtonEventHandler %d, %d", btnIdx, btnPressed); + CHIP_ERROR err = CHIP_NO_ERROR; + + ChipLogDetail(NotSpecified, "ButtonEventHandler %d, %d", btnIdx, btnPressed); AppEvent button_event = {}; button_event.Type = AppEvent::kEventType_Button; @@ -297,13 +337,54 @@ void AppTask::ButtonEventHandler(uint8_t btnIdx, bool btnPressed) case APP_FUNCTION2_SWITCH: { if (!btnPressed) { - ChipLogProgress(NotSpecified, "Switch release press"); - button_event.Handler = SwitchMgr().GenericSwitchReleasePressHandler; + ChipLogDetail(NotSpecified, "Switch button released"); + + button_event.Handler = + sLongPressDetected ? SwitchMgr().GenericSwitchLongReleaseHandler : SwitchMgr().GenericSwitchShortReleaseHandler; + + sIsMultipressOngoing = true; + sSwitchButtonState = SWITCH_BUTTON_UNPRESSED; + sLongPressDetected = false; + + chip::DeviceLayer::SystemLayer().CancelTimer(MultiPressTimeoutHandler, NULL); + // we start the MultiPress feature window after releasing the button + err = chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Milliseconds32(SWITCH_MULTIPRESS_WINDOW_MS), + MultiPressTimeoutHandler, NULL); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "StartTimer failed %s: ", chip::ErrorStr(err)); + } } else { - ChipLogProgress(NotSpecified, "Switch initial press"); - button_event.Handler = SwitchMgr().GenericSwitchInitialPressHandler; + ChipLogDetail(NotSpecified, "Switch button pressed"); + + sSwitchButtonState = SWITCH_BUTTON_PRESSED; + + chip::DeviceLayer::SystemLayer().CancelTimer(LongPressTimeoutHandler, NULL); + // we need to check if this is short or long press + err = chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Milliseconds32(SWITCH_LONGPRESS_WINDOW_MS), + LongPressTimeoutHandler, NULL); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "StartTimer failed %s: ", chip::ErrorStr(err)); + } + + // if we have active multipress window we need to send extra event + if (sIsMultipressOngoing) + { + ChipLogDetail(NotSpecified, "Switch MultipressOngoing"); + button_event.Handler = SwitchMgr().GenericSwitchInitialPressHandler; + sAppTask.PostEvent(&button_event); + chip::DeviceLayer::SystemLayer().CancelTimer(MultiPressTimeoutHandler, NULL); + button_event.Handler = SwitchMgr().GenericSwitchMultipressOngoingHandler; + } + else + { + button_event.Handler = SwitchMgr().GenericSwitchInitialPressHandler; + } } break; } @@ -348,6 +429,69 @@ void AppTask::TimerEventHandler(chip::System::Layer * aLayer, void * aAppState) sAppTask.PostEvent(&event); } +void AppTask::MultiPressTimeoutHandler(chip::System::Layer * aLayer, void * aAppState) +{ + ChipLogDetail(NotSpecified, "MultiPressTimeoutHandler"); + + sIsMultipressOngoing = false; + + AppEvent multipress_event = {}; + multipress_event.Type = AppEvent::kEventType_Button; + multipress_event.Handler = SwitchMgr().GenericSwitchMultipressCompleteHandler; + + sAppTask.PostEvent(&multipress_event); +} + +void AppTask::LongPressTimeoutHandler(chip::System::Layer * aLayer, void * aAppState) +{ + ChipLogDetail(NotSpecified, "LongPressTimeoutHandler"); + + // if the button is still pressed after threshold time, this is a LongPress, otherwise jsut ignore it + if (sSwitchButtonState == SWITCH_BUTTON_PRESSED) + { + sLongPressDetected = true; + AppEvent longpress_event = {}; + longpress_event.Type = AppEvent::kEventType_Button; + longpress_event.Handler = SwitchMgr().GenericSwitchLongPressHandler; + + sAppTask.PostEvent(&longpress_event); + } +} + +void AppTask::TotalHoursTimerHandler(chip::System::Layer * aLayer, void * aAppState) +{ + ChipLogDetail(NotSpecified, "HourlyTimer"); + + CHIP_ERROR err; + uint32_t totalOperationalHours = 0; + + err = ConfigurationMgr().GetTotalOperationalHours(totalOperationalHours); + + if (err == CHIP_NO_ERROR) + { + ConfigurationMgr().StoreTotalOperationalHours(totalOperationalHours + + (TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS / SECONDS_IN_HOUR)); + } + else if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) + { + totalOperationalHours = 0; // set this explicitly to 0 for safety + ConfigurationMgr().StoreTotalOperationalHours(totalOperationalHours + + (TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS / SECONDS_IN_HOUR)); + } + else + { + ChipLogError(DeviceLayer, "Failed to get total operational hours of the Node"); + } + + err = chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds32(TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS), + TotalHoursTimerHandler, nullptr); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "StartTimer failed %s: ", chip::ErrorStr(err)); + } +} + void AppTask::FunctionTimerEventHandler(AppEvent * aEvent) { if (aEvent->Type != AppEvent::kEventType_Timer) diff --git a/examples/light-switch-app/qpg/src/SwitchManager.cpp b/examples/light-switch-app/qpg/src/SwitchManager.cpp index 58b2f1d9bd8889..170bb8b454c765 100644 --- a/examples/light-switch-app/qpg/src/SwitchManager.cpp +++ b/examples/light-switch-app/qpg/src/SwitchManager.cpp @@ -26,10 +26,12 @@ SwitchManager SwitchManager::sSwitch; using namespace ::chip; using namespace chip::DeviceLayer; +static uint8_t multiPressCount = 1; void SwitchManager::Init(void) { - // init - TODO + uint8_t multiPressMax = 2; + chip::app::Clusters::Switch::Attributes::MultiPressMax::Set(GENERICSWITCH_ENDPOINT_ID, multiPressMax); } void SwitchManager::ToggleHandler(AppEvent * aEvent) @@ -46,6 +48,7 @@ void SwitchManager::ToggleHandler(AppEvent * aEvent) data->localEndpointId = SWITCH_ENDPOINT_ID; data->clusterId = chip::app::Clusters::OnOff::Id; data->commandId = chip::app::Clusters::OnOff::Commands::Toggle::Id; + data->isGroup = true; DeviceLayer::PlatformMgr().ScheduleWork(SwitchWorkerFunction, reinterpret_cast(data)); } @@ -118,7 +121,7 @@ void SwitchManager::GenericSwitchInitialPressHandler(AppEvent * aEvent) return; } - ChipLogProgress(NotSpecified, "GenericSwitchInitialPress new position %d", newPosition); + ChipLogDetail(NotSpecified, "GenericSwitchInitialPress new position %d", newPosition); SystemLayer().ScheduleLambda([newPosition] { chip::app::Clusters::Switch::Attributes::CurrentPosition::Set(GENERICSWITCH_ENDPOINT_ID, newPosition); // InitialPress event takes newPosition as event data @@ -126,10 +129,10 @@ void SwitchManager::GenericSwitchInitialPressHandler(AppEvent * aEvent) }); } -void SwitchManager::GenericSwitchReleasePressHandler(AppEvent * aEvent) +void SwitchManager::GenericSwitchLongPressHandler(AppEvent * aEvent) { - // Release moves Position from 1 (press) to 0 - uint8_t newPosition = 0; + // Press moves Position from 0 (idle) to 1 (press) + uint8_t newPosition = 1; if (aEvent->Type != AppEvent::kEventType_Button) { @@ -137,10 +140,76 @@ void SwitchManager::GenericSwitchReleasePressHandler(AppEvent * aEvent) return; } - ChipLogProgress(NotSpecified, "GenericSwitchReleasePress new position %d", newPosition); + ChipLogDetail(NotSpecified, "GenericSwitchLongPress new position %d", newPosition); SystemLayer().ScheduleLambda([newPosition] { + // LongPress event takes newPosition as event data + chip::app::Clusters::SwitchServer::Instance().OnLongPress(GENERICSWITCH_ENDPOINT_ID, newPosition); + }); +} + +void SwitchManager::GenericSwitchShortReleaseHandler(AppEvent * aEvent) +{ + // Release moves Position from 1 (press) to 0 + uint8_t newPosition = 0; + uint8_t previousPosition = 1; + + if (aEvent->Type != AppEvent::kEventType_Button) + { + ChipLogError(NotSpecified, "Event type not supported!"); + return; + } + + ChipLogDetail(NotSpecified, "GenericSwitchShortRelease new position %d", newPosition); + SystemLayer().ScheduleLambda([newPosition, previousPosition] { chip::app::Clusters::Switch::Attributes::CurrentPosition::Set(GENERICSWITCH_ENDPOINT_ID, newPosition); // Short Release event takes newPosition as event data - chip::app::Clusters::SwitchServer::Instance().OnShortRelease(GENERICSWITCH_ENDPOINT_ID, newPosition); + chip::app::Clusters::SwitchServer::Instance().OnShortRelease(GENERICSWITCH_ENDPOINT_ID, previousPosition); + }); +} + +void SwitchManager::GenericSwitchLongReleaseHandler(AppEvent * aEvent) +{ + // Release moves Position from 1 (press) to 0 + uint8_t newPosition = 0; + uint8_t previousPosition = 1; + + if (aEvent->Type != AppEvent::kEventType_Button) + { + ChipLogError(NotSpecified, "Event type not supported!"); + return; + } + + ChipLogDetail(NotSpecified, "GenericSwitchLongRelease new position %d", newPosition); + SystemLayer().ScheduleLambda([newPosition, previousPosition] { + chip::app::Clusters::Switch::Attributes::CurrentPosition::Set(GENERICSWITCH_ENDPOINT_ID, newPosition); + // LongRelease event takes newPosition as event data + chip::app::Clusters::SwitchServer::Instance().OnLongRelease(GENERICSWITCH_ENDPOINT_ID, previousPosition); + }); +} + +void SwitchManager::GenericSwitchMultipressOngoingHandler(AppEvent * aEvent) +{ + uint8_t newPosition = 1; + + multiPressCount++; + + ChipLogDetail(NotSpecified, "GenericSwitchMultiPressOngoing (%d)", multiPressCount); + + SystemLayer().ScheduleLambda([newPosition] { + chip::app::Clusters::SwitchServer::Instance().OnMultiPressOngoing(GENERICSWITCH_ENDPOINT_ID, newPosition, multiPressCount); }); } + +void SwitchManager::GenericSwitchMultipressCompleteHandler(AppEvent * aEvent) +{ + uint8_t previousPosition = 0; + + ChipLogProgress(NotSpecified, "GenericSwitchMultiPressComplete (%d)", multiPressCount); + + SystemLayer().ScheduleLambda([previousPosition] { + chip::app::Clusters::SwitchServer::Instance().OnMultiPressComplete(GENERICSWITCH_ENDPOINT_ID, previousPosition, + multiPressCount); + }); + + multiPressCount = 1; +} diff --git a/examples/light-switch-app/qpg/src/binding-handler.cpp b/examples/light-switch-app/qpg/src/binding-handler.cpp index 4dae4e12b44155..f2a7c266d62338 100644 --- a/examples/light-switch-app/qpg/src/binding-handler.cpp +++ b/examples/light-switch-app/qpg/src/binding-handler.cpp @@ -38,31 +38,120 @@ static void ProcessSwitchUnicastBindingCommand(CommandId commandId, const EmberB ChipLogError(NotSpecified, "Switch command failed: %" CHIP_ERROR_FORMAT, error.Format()); }; - switch (commandId) + switch (data->clusterId) { - case Clusters::OnOff::Commands::Toggle::Id: - Clusters::OnOff::Commands::Toggle::Type toggleCommand; - Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, toggleCommand, onSuccess, onFailure); + case Clusters::OnOff::Id: + switch (commandId) + { + case Clusters::OnOff::Commands::Toggle::Id: + Clusters::OnOff::Commands::Toggle::Type toggleCommand; + Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, toggleCommand, onSuccess, onFailure); + break; + case Clusters::OnOff::Commands::On::Id: + Clusters::OnOff::Commands::On::Type onCommand; + Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, onCommand, onSuccess, onFailure); + break; + + case Clusters::OnOff::Commands::Off::Id: + Clusters::OnOff::Commands::Off::Type offCommand; + Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, offCommand, onSuccess, onFailure); + break; + default: + ChipLogError(NotSpecified, "Unsupported Command Id"); + break; + } break; - case Clusters::LevelControl::Commands::MoveToLevel::Id: { - Clusters::LevelControl::Commands::MoveToLevel::Type moveToLevelCommand; - moveToLevelCommand.level = data->level; - Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, moveToLevelCommand, onSuccess, onFailure); - } - break; - case Clusters::ColorControl::Commands::MoveToColor::Id: { + case Clusters::LevelControl::Id: + if (commandId == Clusters::LevelControl::Commands::MoveToLevel::Id) + { + Clusters::LevelControl::Commands::MoveToLevel::Type moveToLevelCommand; + moveToLevelCommand.level = data->level; + Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, moveToLevelCommand, onSuccess, onFailure); + } + else + { + ChipLogError(NotSpecified, "Unsupported Command Id"); + } + break; - Clusters::ColorControl::Commands::MoveToColor::Type moveToColorCommand; + case Clusters::ColorControl::Id: + if (commandId == Clusters::ColorControl::Commands::MoveToColor::Id) + { + Clusters::ColorControl::Commands::MoveToColor::Type moveToColorCommand; + moveToColorCommand.colorX = data->colorXY.x; + moveToColorCommand.colorY = data->colorXY.y; + Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, moveToColorCommand, onSuccess, onFailure); + } + else + { + ChipLogError(NotSpecified, "Unsupported Command Id"); + } + break; - moveToColorCommand.colorX = data->colorXY.x; - moveToColorCommand.colorY = data->colorXY.y; - Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, moveToColorCommand, onSuccess, onFailure); + default: + ChipLogError(NotSpecified, "Unsupported Cluster Id"); + break; } - break; +} + +static void ProcessSwitchGroupBindingCommand(CommandId commandId, const EmberBindingTableEntry & binding, BindingCommandData * data) +{ + Messaging::ExchangeManager & exchangeMgr = Server::GetInstance().GetExchangeManager(); + + switch (data->clusterId) + { + case Clusters::OnOff::Id: + switch (commandId) + { + case Clusters::OnOff::Commands::Toggle::Id: + Clusters::OnOff::Commands::Toggle::Type toggleCommand; + Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, toggleCommand); + break; + case Clusters::OnOff::Commands::On::Id: + Clusters::OnOff::Commands::On::Type onCommand; + Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, onCommand); + + break; + case Clusters::OnOff::Commands::Off::Id: + Clusters::OnOff::Commands::Off::Type offCommand; + Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, offCommand); + break; + default: + ChipLogError(NotSpecified, "Unsupported Command Id"); + break; + } + break; + + case Clusters::LevelControl::Id: + if (commandId == Clusters::LevelControl::Commands::MoveToLevel::Id) + { + Clusters::LevelControl::Commands::MoveToLevel::Type moveToLevelCommand; + moveToLevelCommand.level = data->level; + Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, moveToLevelCommand); + } + else + { + ChipLogError(NotSpecified, "Unsupported Command Id"); + } + break; + + case Clusters::ColorControl::Id: + if (commandId == Clusters::ColorControl::Commands::MoveToColor::Id) + { + Clusters::ColorControl::Commands::MoveToColor::Type moveToColorCommand; + moveToColorCommand.colorX = data->colorXY.x; + moveToColorCommand.colorY = data->colorXY.y; + Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, moveToColorCommand); + } + else + { + ChipLogError(NotSpecified, "Unsupported Command Id"); + } + break; default: - ChipLogError(NotSpecified, "Unsupported Command Id"); + ChipLogError(NotSpecified, "Unsupported Cluster Id"); break; } } @@ -70,10 +159,20 @@ static void ProcessSwitchUnicastBindingCommand(CommandId commandId, const EmberB static void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, OperationalDeviceProxy * peer_device, void * context) { VerifyOrReturn(context != nullptr, ChipLogError(NotSpecified, "nullptr pointer passed")); - BindingCommandData * data = static_cast(context); - if (binding.type == MATTER_UNICAST_BINDING) + if (binding.type == MATTER_MULTICAST_BINDING && data->isGroup) + { + switch (data->clusterId) + { + case Clusters::OnOff::Id: + case Clusters::LevelControl::Id: + case Clusters::ColorControl::Id: + ProcessSwitchGroupBindingCommand(data->commandId, binding, data); + break; + } + } + else if (binding.type == MATTER_UNICAST_BINDING && !data->isGroup) { switch (data->clusterId) { diff --git a/examples/light-switch-app/qpg/zap/switch.matter b/examples/light-switch-app/qpg/zap/switch.matter index f42b1f07744809..bb43ffe002999a 100644 --- a/examples/light-switch-app/qpg/zap/switch.matter +++ b/examples/light-switch-app/qpg/zap/switch.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -252,7 +269,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -434,7 +451,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -450,12 +467,42 @@ cluster AccessControl = 31 { 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; @@ -491,17 +538,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -586,7 +657,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -755,6 +826,265 @@ cluster OtaSoftwareUpdateRequestor = 42 { command AnnounceOTAProvider(AnnounceOTAProviderRequest): DefaultSuccess = 0; } +/** This cluster is used to describe the configuration and capabilities of a physical power source that provides power to the Node. */ +cluster PowerSource = 47 { + revision 1; // NOTE: Default/not specifically set + + enum BatApprovedChemistryEnum : enum16 { + kUnspecified = 0; + kAlkaline = 1; + kLithiumCarbonFluoride = 2; + kLithiumChromiumOxide = 3; + kLithiumCopperOxide = 4; + kLithiumIronDisulfide = 5; + kLithiumManganeseDioxide = 6; + kLithiumThionylChloride = 7; + kMagnesium = 8; + kMercuryOxide = 9; + kNickelOxyhydride = 10; + kSilverOxide = 11; + kZincAir = 12; + kZincCarbon = 13; + kZincChloride = 14; + kZincManganeseDioxide = 15; + kLeadAcid = 16; + kLithiumCobaltOxide = 17; + kLithiumIon = 18; + kLithiumIonPolymer = 19; + kLithiumIronPhosphate = 20; + kLithiumSulfur = 21; + kLithiumTitanate = 22; + kNickelCadmium = 23; + kNickelHydrogen = 24; + kNickelIron = 25; + kNickelMetalHydride = 26; + kNickelZinc = 27; + kSilverZinc = 28; + kSodiumIon = 29; + kSodiumSulfur = 30; + kZincBromide = 31; + kZincCerium = 32; + } + + enum BatChargeFaultEnum : enum8 { + kUnspecified = 0; + kAmbientTooHot = 1; + kAmbientTooCold = 2; + kBatteryTooHot = 3; + kBatteryTooCold = 4; + kBatteryAbsent = 5; + kBatteryOverVoltage = 6; + kBatteryUnderVoltage = 7; + kChargerOverVoltage = 8; + kChargerUnderVoltage = 9; + kSafetyTimeout = 10; + } + + enum BatChargeLevelEnum : enum8 { + kOK = 0; + kWarning = 1; + kCritical = 2; + } + + enum BatChargeStateEnum : enum8 { + kUnknown = 0; + kIsCharging = 1; + kIsAtFullCharge = 2; + kIsNotCharging = 3; + } + + enum BatCommonDesignationEnum : enum16 { + kUnspecified = 0; + kAAA = 1; + kAA = 2; + kC = 3; + kD = 4; + k4v5 = 5; + k6v0 = 6; + k9v0 = 7; + k12AA = 8; + kAAAA = 9; + kA = 10; + kB = 11; + kF = 12; + kN = 13; + kNo6 = 14; + kSubC = 15; + kA23 = 16; + kA27 = 17; + kBA5800 = 18; + kDuplex = 19; + k4SR44 = 20; + k523 = 21; + k531 = 22; + k15v0 = 23; + k22v5 = 24; + k30v0 = 25; + k45v0 = 26; + k67v5 = 27; + kJ = 28; + kCR123A = 29; + kCR2 = 30; + k2CR5 = 31; + kCRP2 = 32; + kCRV3 = 33; + kSR41 = 34; + kSR43 = 35; + kSR44 = 36; + kSR45 = 37; + kSR48 = 38; + kSR54 = 39; + kSR55 = 40; + kSR57 = 41; + kSR58 = 42; + kSR59 = 43; + kSR60 = 44; + kSR63 = 45; + kSR64 = 46; + kSR65 = 47; + kSR66 = 48; + kSR67 = 49; + kSR68 = 50; + kSR69 = 51; + kSR516 = 52; + kSR731 = 53; + kSR712 = 54; + kLR932 = 55; + kA5 = 56; + kA10 = 57; + kA13 = 58; + kA312 = 59; + kA675 = 60; + kAC41E = 61; + k10180 = 62; + k10280 = 63; + k10440 = 64; + k14250 = 65; + k14430 = 66; + k14500 = 67; + k14650 = 68; + k15270 = 69; + k16340 = 70; + kRCR123A = 71; + k17500 = 72; + k17670 = 73; + k18350 = 74; + k18500 = 75; + k18650 = 76; + k19670 = 77; + k25500 = 78; + k26650 = 79; + k32600 = 80; + } + + enum BatFaultEnum : enum8 { + kUnspecified = 0; + kOverTemp = 1; + kUnderTemp = 2; + } + + enum BatReplaceabilityEnum : enum8 { + kUnspecified = 0; + kNotReplaceable = 1; + kUserReplaceable = 2; + kFactoryReplaceable = 3; + } + + enum PowerSourceStatusEnum : enum8 { + kUnspecified = 0; + kActive = 1; + kStandby = 2; + kUnavailable = 3; + } + + enum WiredCurrentTypeEnum : enum8 { + kAC = 0; + kDC = 1; + } + + enum WiredFaultEnum : enum8 { + kUnspecified = 0; + kOverVoltage = 1; + kUnderVoltage = 2; + } + + bitmap Feature : bitmap32 { + kWired = 0x1; + kBattery = 0x2; + kRechargeable = 0x4; + kReplaceable = 0x8; + } + + struct BatChargeFaultChangeType { + BatChargeFaultEnum current[] = 0; + BatChargeFaultEnum previous[] = 1; + } + + struct BatFaultChangeType { + BatFaultEnum current[] = 0; + BatFaultEnum previous[] = 1; + } + + struct WiredFaultChangeType { + WiredFaultEnum current[] = 0; + WiredFaultEnum previous[] = 1; + } + + info event WiredFaultChange = 0 { + WiredFaultEnum current[] = 0; + WiredFaultEnum previous[] = 1; + } + + info event BatFaultChange = 1 { + BatFaultEnum current[] = 0; + BatFaultEnum previous[] = 1; + } + + info event BatChargeFaultChange = 2 { + BatChargeFaultEnum current[] = 0; + BatChargeFaultEnum previous[] = 1; + } + + readonly attribute PowerSourceStatusEnum status = 0; + readonly attribute int8u order = 1; + readonly attribute char_string<60> description = 2; + readonly attribute optional nullable int32u wiredAssessedInputVoltage = 3; + readonly attribute optional nullable int16u wiredAssessedInputFrequency = 4; + readonly attribute optional WiredCurrentTypeEnum wiredCurrentType = 5; + readonly attribute optional nullable int32u wiredAssessedCurrent = 6; + readonly attribute optional int32u wiredNominalVoltage = 7; + readonly attribute optional int32u wiredMaximumCurrent = 8; + readonly attribute optional boolean wiredPresent = 9; + readonly attribute optional WiredFaultEnum activeWiredFaults[] = 10; + readonly attribute optional nullable int32u batVoltage = 11; + readonly attribute optional nullable int8u batPercentRemaining = 12; + readonly attribute optional nullable int32u batTimeRemaining = 13; + readonly attribute optional BatChargeLevelEnum batChargeLevel = 14; + readonly attribute optional boolean batReplacementNeeded = 15; + readonly attribute optional BatReplaceabilityEnum batReplaceability = 16; + readonly attribute optional boolean batPresent = 17; + readonly attribute optional BatFaultEnum activeBatFaults[] = 18; + readonly attribute optional char_string<60> batReplacementDescription = 19; + readonly attribute optional BatCommonDesignationEnum batCommonDesignation = 20; + readonly attribute optional char_string<20> batANSIDesignation = 21; + readonly attribute optional char_string<20> batIECDesignation = 22; + readonly attribute optional BatApprovedChemistryEnum batApprovedChemistry = 23; + readonly attribute optional int32u batCapacity = 24; + readonly attribute optional int8u batQuantity = 25; + readonly attribute optional BatChargeStateEnum batChargeState = 26; + readonly attribute optional nullable int32u batTimeToFullCharge = 27; + readonly attribute optional boolean batFunctionalWhileCharging = 28; + readonly attribute optional nullable int32u batChargingCurrent = 29; + readonly attribute optional BatChargeFaultEnum activeBatChargeFaults[] = 30; + readonly attribute endpoint_no endpointList[] = 31; + 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; +} + /** This cluster is used to manage global aspects of the Commissioning flow. */ cluster GeneralCommissioning = 48 { revision 1; // NOTE: Default/not specifically set @@ -1734,7 +2064,7 @@ cluster UserLabel = 65 { /** Allows servers to ensure that listed clients are notified when a server is available for communication. */ cluster IcdManagement = 70 { - revision 2; + revision 3; enum ClientTypeEnum : enum8 { kPermanent = 0; @@ -1750,6 +2080,7 @@ cluster IcdManagement = 70 { kCheckInProtocolSupport = 0x1; kUserActiveModeTrigger = 0x2; kLongIdleTimeSupport = 0x4; + kDynamicSitLitSupport = 0x8; } bitmap UserActiveModeTriggerBitmap : bitmap32 { @@ -1788,6 +2119,7 @@ cluster IcdManagement = 70 { 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; @@ -1840,14 +2172,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + 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; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -1959,7 +2298,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** 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; @@ -1979,7 +2318,7 @@ provisional cluster ScenesManagement = 98 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -2382,6 +2721,27 @@ endpoint 0 { handle command AnnounceOTAProvider; } + server cluster PowerSource { + ram attribute status; + ram attribute order; + ram attribute description; + ram attribute batVoltage; + ram attribute batPercentRemaining; + ram attribute batChargeLevel; + ram attribute batReplacementNeeded; + ram attribute batReplaceability; + ram attribute batReplacementDescription; + ram attribute batCommonDesignation; + ram attribute batQuantity; + callback attribute endpointList; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 10; + ram attribute clusterRevision default = 1; + } + server cluster GeneralCommissioning { ram attribute breadcrumb default = 0x0000000000000000; callback attribute basicCommissioningInfo; @@ -2653,7 +3013,7 @@ endpoint 0 { callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0x0007; - ram attribute clusterRevision default = 2; + ram attribute clusterRevision default = 3; handle command RegisterClient; handle command RegisterClientResponse; @@ -2666,7 +3026,6 @@ endpoint 1 { device type ma_colordimmerswitch = 261, version 1; binding cluster Identify; - binding cluster Groups; binding cluster OnOff; binding cluster LevelControl; binding cluster ScenesManagement; @@ -2686,6 +3045,26 @@ endpoint 1 { handle command TriggerEffect; } + server cluster Groups { + ram attribute nameSupport; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + 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; @@ -2742,14 +3121,19 @@ endpoint 2 { server cluster Switch { emits event InitialPress; + emits event LongPress; emits event ShortRelease; + emits event LongRelease; + emits event MultiPressOngoing; + emits event MultiPressComplete; ram attribute numberOfPositions default = 2; ram attribute currentPosition default = 0; + ram attribute multiPressMax default = 2; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 6; + ram attribute featureMap default = 30; ram attribute clusterRevision default = 1; } } diff --git a/examples/light-switch-app/qpg/zap/switch.zap b/examples/light-switch-app/qpg/zap/switch.zap index 0f65ac5eb64615..5578a0ff63b5e8 100644 --- a/examples/light-switch-app/qpg/zap/switch.zap +++ b/examples/light-switch-app/qpg/zap/switch.zap @@ -17,13 +17,6 @@ } ], "package": [ - { - "pathRelativity": "relativeToZap", - "path": "../../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", - "category": "matter", - "version": "chip-v1" - }, { "pathRelativity": "relativeToZap", "path": "../../../../src/app/zap-templates/zcl/zcl.json", @@ -31,6 +24,13 @@ "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": [ @@ -1185,6 +1185,304 @@ } ] }, + { + "name": "Power Source", + "code": 47, + "mfgCode": null, + "define": "POWER_SOURCE_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "Status", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "PowerSourceStatusEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Order", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Description", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatVoltage", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatPercentRemaining", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatChargeLevel", + "code": 14, + "mfgCode": null, + "side": "server", + "type": "BatChargeLevelEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatReplacementNeeded", + "code": 15, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatReplaceability", + "code": 16, + "mfgCode": null, + "side": "server", + "type": "BatReplaceabilityEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatReplacementDescription", + "code": 19, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatCommonDesignation", + "code": 20, + "mfgCode": null, + "side": "server", + "type": "BatCommonDesignationEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatQuantity", + "code": 25, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EndpointList", + "code": 31, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "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": "10", + "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 Commissioning", "code": 48, @@ -4651,7 +4949,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4909,7 +5207,7 @@ "code": 4, "mfgCode": null, "define": "GROUPS_CLUSTER", - "side": "client", + "side": "server", "enabled": 1, "commands": [ { @@ -4917,7 +5215,7 @@ "code": 0, "mfgCode": null, "source": "client", - "isIncoming": 0, + "isIncoming": 1, "isEnabled": 1 }, { @@ -4925,7 +5223,7 @@ "code": 0, "mfgCode": null, "source": "server", - "isIncoming": 1, + "isIncoming": 0, "isEnabled": 1 }, { @@ -4933,7 +5231,7 @@ "code": 1, "mfgCode": null, "source": "client", - "isIncoming": 0, + "isIncoming": 1, "isEnabled": 1 }, { @@ -4941,7 +5239,7 @@ "code": 1, "mfgCode": null, "source": "server", - "isIncoming": 1, + "isIncoming": 0, "isEnabled": 1 }, { @@ -4949,7 +5247,7 @@ "code": 2, "mfgCode": null, "source": "client", - "isIncoming": 0, + "isIncoming": 1, "isEnabled": 1 }, { @@ -4957,7 +5255,7 @@ "code": 2, "mfgCode": null, "source": "server", - "isIncoming": 1, + "isIncoming": 0, "isEnabled": 1 }, { @@ -4965,7 +5263,7 @@ "code": 3, "mfgCode": null, "source": "client", - "isIncoming": 0, + "isIncoming": 1, "isEnabled": 1 }, { @@ -4973,7 +5271,7 @@ "code": 3, "mfgCode": null, "source": "server", - "isIncoming": 1, + "isIncoming": 0, "isEnabled": 1 }, { @@ -4981,7 +5279,7 @@ "code": 4, "mfgCode": null, "source": "client", - "isIncoming": 0, + "isIncoming": 1, "isEnabled": 1 }, { @@ -4989,16 +5287,80 @@ "code": 5, "mfgCode": null, "source": "client", - "isIncoming": 0, + "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": "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": "client", + "side": "server", "type": "bitmap32", "included": 1, "storageOption": "RAM", @@ -5014,7 +5376,7 @@ "name": "ClusterRevision", "code": 65533, "mfgCode": null, - "side": "client", + "side": "server", "type": "int16u", "included": 1, "storageOption": "RAM", @@ -5022,9 +5384,9 @@ "bounded": 0, "defaultValue": "4", "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": null + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 } ] }, @@ -5140,7 +5502,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -5617,7 +5979,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6020,6 +6382,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "MultiPressMax", + "code": 2, + "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": "GeneratedCommandList", "code": 65528, @@ -6094,7 +6472,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "30", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6125,12 +6503,40 @@ "side": "server", "included": 1 }, + { + "name": "LongPress", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1 + }, { "name": "ShortRelease", "code": 3, "mfgCode": null, "side": "server", "included": 1 + }, + { + "name": "LongRelease", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "MultiPressOngoing", + "code": 5, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "MultiPressComplete", + "code": 6, + "mfgCode": null, + "side": "server", + "included": 1 } ] } diff --git a/examples/light-switch-app/telink/README.md b/examples/light-switch-app/telink/README.md index d222116f5f1a7f..c60dd6a27c3584 100755 --- a/examples/light-switch-app/telink/README.md +++ b/examples/light-switch-app/telink/README.md @@ -9,6 +9,17 @@ creating your own application. ![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) +## Supported devices + +The example supports building and running on the following devices: + +| Board/SoC | Build target | Zephyr Board Info | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| [B91](https://wiki.telink-semi.cn/wiki/Hardware/B91_Generic_Starter_Kit_Hardware_Guide) [TLSR9518ADK80D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series) | `tlsr9518adk80d`, `tlsr9518adk80d-mars`, `tlsr9518adk80d-usb` | [TLSR9518ADK80D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9518adk80d/doc/index.rst) | +| [B92](https://wiki.telink-semi.cn/wiki/Hardware/B92_Generic_Starter_Kit_Hardware_Guide) [TLSR9528A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR952x-Series) | `tlsr9528a`, `tlsr9528a_retention` | [TLSR9528A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9528a/doc/index.rst) | +| [B95](https://wiki.telink-semi.cn/wiki/Hardware/B95_Generic_Starter_Kit_Hardware_Guide) [TLSR9258A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR925x-Series) | `tlsr9258a` | [TLSR9258A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9258a/doc/index.rst) | +| [W91](https://wiki.telink-semi.cn/wiki/Hardware/W91_Generic_Starter_Kit_Hardware_Guide) [TLSR9118BDK40D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR911x-Series) | `tlsr9118bdk40d` | [TLSR9118BDK40D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9118bdk40d/doc/index.rst) | + ## Build and flash 1. Run the Docker container: @@ -17,7 +28,7 @@ creating your own application. $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}') ``` - Compatible docker image version can be found in next file: + You can find the compatible Docker image version in the file: ```bash $ .github/workflows/examples-telink.yaml @@ -29,8 +40,8 @@ creating your own application. $ source ./scripts/activate.sh -p all,telink ``` -3. In the example dir run (replace __ with your board name, for - example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`): +3. Build the example (replace __ with your board name, see + [Supported devices](#supported-devices)): ```bash $ west build -b @@ -40,9 +51,12 @@ creating your own application. MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=4m`: ```bash - $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + $ west build -b -- -DFLASH_SIZE=4m ``` + You can find the target built file called **_zephyr.bin_** under the + **_build/zephyr_** directory. + 4. Flash binary: ``` @@ -61,16 +75,18 @@ To get output from device, connect UART to following pins: | TX | PB2 (pin 16 of J34 connector) | | GND | GND | +Baud rate: 115200 bits/s + ### Buttons The following buttons are available on **tlsr9518adk80d** board: -| Name | Function | Description | -| :------- | :--------------------- | :----------------------------------------------------------------------------------------------------- | -| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and back to uncommissioned state | -| Button 2 | Light Switch control | Manually triggers the light switch state | -| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | -| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | +| Name | Function | Description | +| :------- | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and return to a decommissioned state (to activate, push the button 3 times) | +| Button 2 | Light Switch control | Manually triggers the light switch state | +| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | +| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | ### LEDs diff --git a/examples/lighting-app/ameba/chip_main.cmake b/examples/lighting-app/ameba/chip_main.cmake index 146ba5dbe934e7..3165047d3955be 100755 --- a/examples/lighting-app/ameba/chip_main.cmake +++ b/examples/lighting-app/ameba/chip_main.cmake @@ -208,7 +208,6 @@ target_include_directories( ${chip_dir}/src/app/server/ ${chip_dir}/src/controller/data_model ${chip_dir}/third_party/nlio/repo/include/ - ${chip_dir}/third_party/nlunit-test/repo/src ) if (matter_enable_rpc) diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter b/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter index 047dda758dc373..5b7b85f5857cff 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -363,7 +380,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -379,12 +396,42 @@ cluster AccessControl = 31 { 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; @@ -420,17 +467,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -515,7 +586,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1544,7 +1615,7 @@ cluster UserLabel = 65 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -2161,7 +2232,7 @@ endpoint 1 { ram attribute defaultMoveRate default = 50; persist attribute startUpCurrentLevel; ram attribute featureMap default = 3; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; @@ -2223,7 +2294,7 @@ endpoint 1 { ram attribute coupleColorTempToLevelMinMireds; ram attribute startUpColorTemperatureMireds; ram attribute featureMap default = 0x1F; - ram attribute clusterRevision default = 6; + ram attribute clusterRevision default = 7; handle command MoveToHue; handle command MoveHue; diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.zap b/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.zap index 23465bb5f517aa..87d6c2f4c2f2a8 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.zap +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.zap @@ -3374,7 +3374,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4300,7 +4300,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter b/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter index 1f0428c061de3e..1fbfa43ce0ab2e 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -363,7 +380,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -379,12 +396,42 @@ cluster AccessControl = 31 { 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; @@ -420,17 +467,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -515,7 +586,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1668,7 +1739,7 @@ cluster UserLabel = 65 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -2347,7 +2418,7 @@ endpoint 1 { ram attribute defaultMoveRate default = 50; persist attribute startUpCurrentLevel; ram attribute featureMap default = 3; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; @@ -2409,7 +2480,7 @@ endpoint 1 { ram attribute coupleColorTempToLevelMinMireds; ram attribute startUpColorTemperatureMireds; ram attribute featureMap default = 0x1F; - ram attribute clusterRevision default = 6; + ram attribute clusterRevision default = 7; handle command MoveToHue; handle command MoveHue; diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.zap b/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.zap index a90a3218a93c5e..95e21f91d9870a 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.zap +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.zap @@ -4350,7 +4350,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5276,7 +5276,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter index 676295ad2892f9..a914ba6caeb62b 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -363,7 +380,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -379,12 +396,42 @@ cluster AccessControl = 31 { 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; @@ -420,17 +467,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -515,7 +586,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1579,7 +1650,7 @@ cluster UserLabel = 65 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -2210,7 +2281,7 @@ endpoint 1 { ram attribute defaultMoveRate default = 50; persist attribute startUpCurrentLevel; ram attribute featureMap default = 3; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; @@ -2272,7 +2343,7 @@ endpoint 1 { ram attribute coupleColorTempToLevelMinMireds; ram attribute startUpColorTemperatureMireds; ram attribute featureMap default = 0x1F; - ram attribute clusterRevision default = 6; + ram attribute clusterRevision default = 7; handle command MoveToHue; handle command MoveHue; diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.zap b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.zap index dea7862fc7ce5c..35a6c1aa4c9d4a 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.zap +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.zap @@ -3557,7 +3557,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4483,7 +4483,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/lighting-app/esp32/sdkconfig.defaults.esp32c2 b/examples/lighting-app/esp32/sdkconfig.defaults.esp32c2 index 5e5d596cacb673..2347f73ec8cc6c 100644 --- a/examples/lighting-app/esp32/sdkconfig.defaults.esp32c2 +++ b/examples/lighting-app/esp32/sdkconfig.defaults.esp32c2 @@ -18,5 +18,8 @@ CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 +# Event Queue Size +CONFIG_MAX_EVENT_QUEUE_SIZE=25 + # Enable HKDF in mbedtls CONFIG_MBEDTLS_HKDF_C=y diff --git a/examples/lighting-app/infineon/cyw30739/README.md b/examples/lighting-app/infineon/cyw30739/README.md index b1ff7aa5304902..a69ddb0957c8fa 100644 --- a/examples/lighting-app/infineon/cyw30739/README.md +++ b/examples/lighting-app/infineon/cyw30739/README.md @@ -12,7 +12,7 @@ An example showing the use of Matter on the Infineon CYW30739 platform. - [Installing ModusToolbox™ Software](#installing-modustoolbox-software) - [ModusToolbox™ tools package](#modustoolbox-tools-package) - [Note for WSL (Windows Subsystem for Linux)](#note-for-wsl-windows-subsystem-for-linux) - - [Checkout Submodules](#checkout-submodules) + - [Checkout Submodules and Bootstrap](#checkout-submodules-and-bootstrap) - [Building](#building) - [Factory Data](#factory-data) - [Commissionable Data](#commissionable-data) @@ -65,7 +65,7 @@ If you are using WSL, please ensure you have installed the ModusToolbox™ Software for Linux. Running Windows tools directly from the WSL command line would cause path resolution failure in the build process. -### Checkout Submodules +### Checkout Submodules and Bootstrap Before building the example, check out the Matter repository and sync submodules using the following command: @@ -73,6 +73,7 @@ using the following command: ```bash $ cd ~/connectedhomeip $ scripts/checkout_submodules.py --platform infineon +$ bash scripts/bootstrap.sh -p all,infineon ``` ## Building diff --git a/examples/lighting-app/infineon/psoc6/BUILD.gn b/examples/lighting-app/infineon/psoc6/BUILD.gn index 3bd75cc14d9e2c..8460cfef6dfec4 100644 --- a/examples/lighting-app/infineon/psoc6/BUILD.gn +++ b/examples/lighting-app/infineon/psoc6/BUILD.gn @@ -45,32 +45,38 @@ config("psoc6_ota_config") { ldflags = [ "-T" + rebase_path(linker_script, root_build_dir) ] - ldflags += [ "-Wl,--defsym,MCUBOOT_HEADER_SIZE=0x400,--defsym,MCUBOOT_BOOTLOADER_SIZE=0x18000,--defsym,CY_BOOT_PRIMARY_1_SIZE=0x1C0000" ] + ldflags += [ "-Wl,--undefined=uxTopUsedPriority -Wl,--defsym,MCUBOOT_HEADER_SIZE=0x400,--defsym,FLASH_AREA_IMG_1_PRIMARY_START=0x028000,--defsym,FLASH_AREA_IMG_1_PRIMARY_SIZE=0x1c0000" ] defines = [ "P6_OTA", - "OTA_SUPPORT ", - "OTA_USE_EXTERNAL_FLASH", - "CY_BOOT_USE_EXTERNAL_FLASH", - "MCUBOOT_HEADER_SIZE=0x400", - "MCUBOOT_MAX_IMG_SECTORS=3584", - "CY_BOOT_SCRATCH_SIZE=0x00004000", - "MCUBOOT_BOOTLOADER_SIZE=0x00018000", - "CY_BOOT_BOOTLOADER_SIZE=0x00018000", - "CY_BOOT_PRIMARY_1_START=0x00018000", - "CY_BOOT_PRIMARY_1_SIZE=0x1C0000", - "CY_BOOT_SECONDARY_1_START=0x00000000", - "CY_BOOT_SECONDARY_1_SIZE=0x001C0000", - "CY_FLASH_ERASE_VALUE=0xFF", + "COMPONENT_MCUBOOT", + "CY_BOOTLOADER=MCUBOOT", + "OTA_SUPPORT=1", + "COMPONENT_OTA_PSOC_062", + "PSOC_062_2M", + "OTA_USE_EXTERNAL_FLASH=1", + "ENABLE_OTA_LOGS", + "ENABLE_OTA_BOOTLOADER_ABSTRACTION_LOGS", "MCUBOOT_IMAGE_NUMBER=1", - "MCUBOOT_SLOT_SIZE=0x1C0000", - "MCUBOOT_SCRATCH_SIZE=0x4000", - "MCUBOOT_SECTOR_SIZE = 512", + "MCUBOOT_MAX_IMG_SECTORS=3584", + "FLASH_AREA_BOOTLOADER_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'", + "FLASH_AREA_BOOTLOADER_SIZE=0x028000", + "FLASH_AREA_BOOTLOADER_START=0x000000", + "FLASH_AREA_IMAGE_SCRATCH_DEV_ID='FLASH_DEVICE_EXTERNAL_FLASH(CY_BOOT_EXTERNAL_DEVICE_INDEX)'", + "FLASH_AREA_IMAGE_SCRATCH_SIZE=0x080000", + "FLASH_AREA_IMAGE_SCRATCH_START=0x440000", + "FLASH_AREA_IMAGE_SWAP_STATUS_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'", + "FLASH_AREA_IMAGE_SWAP_STATUS_SIZE=0x006c00", + "FLASH_AREA_IMAGE_SWAP_STATUS_START=0x1e8000", + "FLASH_AREA_IMG_1_PRIMARY_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'", + "FLASH_AREA_IMG_1_PRIMARY_SIZE=0x1c0000", + "FLASH_AREA_IMG_1_PRIMARY_START=0x028000", + "FLASH_AREA_IMG_1_SECONDARY_DEV_ID='FLASH_DEVICE_EXTERNAL_FLASH(CY_BOOT_EXTERNAL_DEVICE_INDEX)'", + "FLASH_AREA_IMG_1_SECONDARY_SIZE=0x1c0000", + "FLASH_AREA_IMG_1_SECONDARY_START=0x000200", "APP_VERSION_MAJOR=1", "APP_VERSION_MINOR=0", "APP_VERSION_BUILD=0", - "MCUBOOT_OVERWRITE_ONLY", - "CY_ENABLE_XIP_PROGRAM", ] if (build_update_image) { @@ -87,7 +93,7 @@ psoc6_sdk_sources("lighting_app_sdk_sources") { defines = [ "BOARD_ID=${psoc6_board}", - "P6_LOG_ENABLED=1", + "PSOC6_LOG_ENABLED=1", "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setup_pin_code}", ] diff --git a/examples/lighting-app/infineon/psoc6/include/AppConfig.h b/examples/lighting-app/infineon/psoc6/include/AppConfig.h index 21b9e9467263fa..2fbc01038c0941 100644 --- a/examples/lighting-app/infineon/psoc6/include/AppConfig.h +++ b/examples/lighting-app/infineon/psoc6/include/AppConfig.h @@ -47,14 +47,14 @@ #define THREAD_ACTIVE_POLLING_INTERVAL_MS 100 #define THREAD_INACTIVE_POLLING_INTERVAL_MS 1000 -// P6 Logging +// PSOC6 Logging #ifdef __cplusplus extern "C" { #endif void appError(int err); -void P6Log(const char * aFormat, ...); -#define P6_LOG(...) P6Log(__VA_ARGS__) +void PSOC6Log(const char * aFormat, ...); +#define PSOC6_LOG(...) PSOC6Log(__VA_ARGS__) #ifdef __cplusplus } diff --git a/examples/lighting-app/infineon/psoc6/include/AppTask.h b/examples/lighting-app/infineon/psoc6/include/AppTask.h index 4f6f77663d18a4..2259880efb5726 100644 --- a/examples/lighting-app/infineon/psoc6/include/AppTask.h +++ b/examples/lighting-app/infineon/psoc6/include/AppTask.h @@ -30,6 +30,10 @@ #include #include +extern "C" { +#include "flash_map_backend.h" +} + // Application-defined error codes in the CHIP_ERROR space. #define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) #define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02) diff --git a/examples/lighting-app/infineon/psoc6/include/CHIPProjectConfig.h b/examples/lighting-app/infineon/psoc6/include/CHIPProjectConfig.h index ab00f26adecb76..15143de90103ca 100644 --- a/examples/lighting-app/infineon/psoc6/include/CHIPProjectConfig.h +++ b/examples/lighting-app/infineon/psoc6/include/CHIPProjectConfig.h @@ -41,10 +41,10 @@ #define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8005 /* The ProductName attribute of the Basic cluster. */ -#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME "P6-CYW43012 Light" +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME "PSOC6-CYW43012 Light" /* The HardwareVersionString attribute of the Basic cluster. */ -#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING "P6-43012" +#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING "PSOC6-43012" /* The HardwareVersion attribute of the Basic cluster. */ #define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION 43012 diff --git a/examples/lighting-app/infineon/psoc6/src/AppTask.cpp b/examples/lighting-app/infineon/psoc6/src/AppTask.cpp index 49e6278ab032c9..43a501ad7edb5c 100644 --- a/examples/lighting-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/lighting-app/infineon/psoc6/src/AppTask.cpp @@ -160,7 +160,7 @@ CHIP_ERROR AppTask::StartAppTask() sAppEventQueue = xQueueCreateStatic(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent), sAppEventQueueBuffer, &sAppEventQueueStruct); if (sAppEventQueue == NULL) { - P6_LOG("Failed to allocate app event queue"); + PSOC6_LOG("Failed to allocate app event queue"); appError(APP_ERROR_EVENT_QUEUE_FAILED); } @@ -173,10 +173,10 @@ CHIP_ERROR AppTask::Init() { CHIP_ERROR err = CHIP_NO_ERROR; #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - int rc = boot_set_confirmed(); + int rc = flash_area_boot_set_confirmed(); if (rc != 0) { - P6_LOG("boot_set_confirmed failed"); + PSOC6_LOG("flash_area_boot_set_confirmed failed"); appError(CHIP_ERROR_UNINITIALIZED); } #endif @@ -209,15 +209,15 @@ CHIP_ERROR AppTask::Init() ); if (sFunctionTimer == NULL) { - P6_LOG("funct timer create failed"); + PSOC6_LOG("funct timer create failed"); appError(APP_ERROR_CREATE_TIMER_FAILED); } NetWorkCommissioningInstInit(); - P6_LOG("Current Firmware Version: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); + PSOC6_LOG("Current Firmware Version: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); err = LightMgr().Init(); if (err != CHIP_NO_ERROR) { - P6_LOG("LightMgr().Init() failed"); + PSOC6_LOG("LightMgr().Init() failed"); appError(err); } @@ -243,11 +243,11 @@ void AppTask::AppTaskMain(void * pvParameter) CHIP_ERROR err = sAppTask.Init(); if (err != CHIP_NO_ERROR) { - P6_LOG("AppTask.Init() failed"); + PSOC6_LOG("AppTask.Init() failed"); appError(err); } - P6_LOG("App Task started"); + PSOC6_LOG("App Task started"); while (true) { @@ -337,7 +337,7 @@ void AppTask::LightActionEventHandler(AppEvent * event) if (!LightMgr().InitiateAction(actor, action)) { - P6_LOG("Action is already in progress or active."); + PSOC6_LOG("Action is already in progress or active."); } } @@ -395,7 +395,8 @@ void AppTask::FunctionHandler(AppEvent * event) { if (!sAppTask.mFunctionTimerActive && sAppTask.mFunction == Function::kNoneSelected) { - P6_LOG("Factory Reset Triggered. Press button again within %us to cancel.", FACTORY_RESET_CANCEL_WINDOW_TIMEOUT / 1000); + PSOC6_LOG("Factory Reset Triggered. Press button again within %us to cancel.", + FACTORY_RESET_CANCEL_WINDOW_TIMEOUT / 1000); // Start timer for FACTORY_RESET_CANCEL_WINDOW_TIMEOUT to allow user to // cancel, if required. sAppTask.StartTimer(FACTORY_RESET_CANCEL_WINDOW_TIMEOUT); @@ -421,7 +422,7 @@ void AppTask::FunctionHandler(AppEvent * event) // canceled. sAppTask.mFunction = Function::kNoneSelected; - P6_LOG("Factory Reset has been Canceled"); + PSOC6_LOG("Factory Reset has been Canceled"); } } } @@ -430,7 +431,7 @@ void AppTask::CancelTimer() { if (xTimerStop(sFunctionTimer, 0) == pdFAIL) { - P6_LOG("app timer stop() failed"); + PSOC6_LOG("app timer stop() failed"); appError(APP_ERROR_STOP_TIMER_FAILED); } @@ -441,7 +442,7 @@ void AppTask::StartTimer(uint32_t aTimeoutInMs) { if (xTimerIsTimerActive(sFunctionTimer)) { - P6_LOG("app timer already started!"); + PSOC6_LOG("app timer already started!"); CancelTimer(); } @@ -450,7 +451,7 @@ void AppTask::StartTimer(uint32_t aTimeoutInMs) // cannot immediately be sent to the timer command queue. if (xTimerChangePeriod(sFunctionTimer, aTimeoutInMs / portTICK_PERIOD_MS, 100) != pdPASS) { - P6_LOG("app timer start() failed"); + PSOC6_LOG("app timer start() failed"); appError(APP_ERROR_START_TIMER_FAILED); } @@ -462,12 +463,12 @@ void AppTask::ActionInitiated(LightingManager::Action_t action, int32_t actor) // Action initiated, update the light led if (action == LightingManager::ON_ACTION) { - P6_LOG("Turning light ON"); + PSOC6_LOG("Turning light ON"); sLightLED.Set(true); } else if (action == LightingManager::OFF_ACTION) { - P6_LOG("Turning light OFF"); + PSOC6_LOG("Turning light OFF"); sLightLED.Set(false); } @@ -482,11 +483,11 @@ void AppTask::ActionCompleted(LightingManager::Action_t action) // action has been completed bon the light if (action == LightingManager::ON_ACTION) { - P6_LOG("Light ON"); + PSOC6_LOG("Light ON"); } else if (action == LightingManager::OFF_ACTION) { - P6_LOG("Light OFF"); + PSOC6_LOG("Light OFF"); } if (sAppTask.mSyncClusterToButtonAction) @@ -530,11 +531,11 @@ void AppTask::PostEvent(const AppEvent * event) } if (!status) - P6_LOG("Failed to post event to app task event queue"); + PSOC6_LOG("Failed to post event to app task event queue"); } else { - P6_LOG("Event Queue is NULL should never happen"); + PSOC6_LOG("Event Queue is NULL should never happen"); } } @@ -546,7 +547,7 @@ void AppTask::DispatchEvent(AppEvent * event) } else { - P6_LOG("Event received with no handler. Dropping event."); + PSOC6_LOG("Event received with no handler. Dropping event."); } } @@ -558,7 +559,7 @@ void AppTask::UpdateClusterState(intptr_t context) Protocols::InteractionModel::Status status = app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue); if (status != Protocols::InteractionModel::Status::Success) { - P6_LOG("ERR: updating on/off %x", to_underlying(status)); + PSOC6_LOG("ERR: updating on/off %x", to_underlying(status)); } } #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR @@ -573,7 +574,7 @@ void AppTask::InitOTARequestor() gRequestorUser.Init(&gRequestorCore, &gImageProcessor); - P6_LOG("Current Software Version: %u", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); - P6_LOG("Current Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); + PSOC6_LOG("Current Software Version: %u", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); + PSOC6_LOG("Current Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); } #endif diff --git a/examples/lighting-app/infineon/psoc6/src/LightingManager.cpp b/examples/lighting-app/infineon/psoc6/src/LightingManager.cpp index b2db66900c8db6..5f0ffabb61915d 100644 --- a/examples/lighting-app/infineon/psoc6/src/LightingManager.cpp +++ b/examples/lighting-app/infineon/psoc6/src/LightingManager.cpp @@ -39,7 +39,7 @@ CHIP_ERROR LightingManager::Init() if (sLightTimer == NULL) { - P6_LOG("sLockTimer timer create failed"); + PSOC6_LOG("sLockTimer timer create failed"); return APP_ERROR_CREATE_TIMER_FAILED; } @@ -125,7 +125,7 @@ void LightingManager::StartTimer(uint32_t aTimeoutMs) { if (xTimerIsTimerActive(sLightTimer)) { - P6_LOG("app timer already started!"); + PSOC6_LOG("app timer already started!"); CancelTimer(); } @@ -134,7 +134,7 @@ void LightingManager::StartTimer(uint32_t aTimeoutMs) // cannot immediately be sent to the timer command queue. if (xTimerChangePeriod(sLightTimer, (aTimeoutMs / portTICK_PERIOD_MS), 100) != pdPASS) { - P6_LOG("sLockTimer timer start() failed"); + PSOC6_LOG("sLockTimer timer start() failed"); appError(APP_ERROR_START_TIMER_FAILED); } } @@ -143,7 +143,7 @@ void LightingManager::CancelTimer(void) { if (xTimerStop(sLightTimer, 0) == pdFAIL) { - P6_LOG("sLightTimer stop() failed"); + PSOC6_LOG("sLightTimer stop() failed"); appError(APP_ERROR_STOP_TIMER_FAILED); } } @@ -183,7 +183,7 @@ void LightingManager::AutoTurnOffTimerEventHandler(AppEvent * aEvent) light->mAutoTurnOffTimerArmed = false; - P6_LOG("Auto Turn Off has been triggered!"); + PSOC6_LOG("Auto Turn Off has been triggered!"); light->InitiateAction(actor, OFF_ACTION); } @@ -219,7 +219,7 @@ void LightingManager::ActuatorMovementTimerEventHandler(AppEvent * aEvent) light->mAutoTurnOffTimerArmed = true; - P6_LOG("Auto Turn off enabled. Will be triggered in %u seconds", light->mAutoTurnOffDuration); + PSOC6_LOG("Auto Turn off enabled. Will be triggered in %u seconds", light->mAutoTurnOffDuration); } } } diff --git a/examples/lighting-app/infineon/psoc6/src/main.cpp b/examples/lighting-app/infineon/psoc6/src/main.cpp index 66ec9addd01aab..5997aa53e60a84 100644 --- a/examples/lighting-app/infineon/psoc6/src/main.cpp +++ b/examples/lighting-app/infineon/psoc6/src/main.cpp @@ -56,7 +56,7 @@ static void main_task(void * pvParameters); //================================================================================= void appError(int err) { - P6_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); + PSOC6_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); portDISABLE_INTERRUPTS(); while (true) ; @@ -89,35 +89,35 @@ static void main_task(void * pvParameters) CHIP_ERROR ret = chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init(); if (ret != CHIP_NO_ERROR) { - P6_LOG("PersistedStorage::KeyValueStoreMgrImpl().Init() failed"); + PSOC6_LOG("PersistedStorage::KeyValueStoreMgrImpl().Init() failed"); appError(ret); } ret = PlatformMgr().InitChipStack(); if (ret != CHIP_NO_ERROR) { - P6_LOG("PlatformMgr().InitChipStack() failed"); + PSOC6_LOG("PlatformMgr().InitChipStack() failed"); appError(ret); } - ret = chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName("P6_LIGHT"); + ret = chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName("PSOC6_LIGHT"); if (ret != CHIP_NO_ERROR) { - P6_LOG("ConnectivityMgr().SetBLEDeviceName() failed"); + PSOC6_LOG("ConnectivityMgr().SetBLEDeviceName() failed"); appError(ret); } - P6_LOG("Starting Platform Manager Event Loop"); + PSOC6_LOG("Starting Platform Manager Event Loop"); ret = PlatformMgr().StartEventLoopTask(); if (ret != CHIP_NO_ERROR) { - P6_LOG("PlatformMgr().StartEventLoopTask() failed"); + PSOC6_LOG("PlatformMgr().StartEventLoopTask() failed"); appError(ret); } ret = GetAppTask().StartAppTask(); if (ret != CHIP_NO_ERROR) { - P6_LOG("GetAppTask().Init() failed"); + PSOC6_LOG("GetAppTask().Init() failed"); appError(ret); } @@ -130,7 +130,7 @@ static void main_task(void * pvParameters) // ================================================================================ int main(void) { - init_p6Platform(); + init_psoc6Platform(); #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR // Clear watchdog timer (started by bootloader) so that it doesn't trigger a reset cyhal_wdt_t wdt_obj; @@ -141,9 +141,9 @@ int main(void) MemMonitoring::startHeapMonitoring(); #endif - P6_LOG("==================================================\r\n"); - P6_LOG("chip-p6-lighting-example starting Version %d\r\n", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); - P6_LOG("==================================================\r\n"); + PSOC6_LOG("==================================================\r\n"); + PSOC6_LOG("chip-psoc6-lighting-example starting Version %d\r\n", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); + PSOC6_LOG("==================================================\r\n"); /* Start the FreeRTOS scheduler */ vTaskStartScheduler(); @@ -153,5 +153,5 @@ int main(void) PlatformMgr().Shutdown(); // Should never get here. - P6_LOG("vTaskStartScheduler() failed"); + PSOC6_LOG("vTaskStartScheduler() failed"); } diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index 4be0b2c2529409..6b50065c4c1c44 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -363,7 +380,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -379,12 +396,42 @@ cluster AccessControl = 31 { 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; @@ -420,17 +467,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -515,7 +586,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1853,14 +1924,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + 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; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -1972,7 +2050,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** 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; @@ -1992,7 +2070,7 @@ provisional cluster ScenesManagement = 98 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -2780,7 +2858,7 @@ endpoint 1 { ram attribute defaultMoveRate default = 50; persist attribute startUpCurrentLevel default = 255; ram attribute featureMap default = 3; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; @@ -2850,7 +2928,7 @@ endpoint 1 { ram attribute coupleColorTempToLevelMinMireds; persist attribute startUpColorTemperatureMireds; ram attribute featureMap default = 0x1F; - ram attribute clusterRevision default = 6; + ram attribute clusterRevision default = 7; handle command MoveToHue; handle command MoveHue; diff --git a/examples/lighting-app/lighting-common/lighting-app.zap b/examples/lighting-app/lighting-common/lighting-app.zap index 69ee10fe7794f0..730b68027a4cb1 100644 --- a/examples/lighting-app/lighting-common/lighting-app.zap +++ b/examples/lighting-app/lighting-common/lighting-app.zap @@ -19,18 +19,18 @@ "package": [ { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/zcl/zcl.json", - "type": "zcl-properties", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", "category": "matter", - "version": 1, - "description": "Matter SDK ZCL data" + "version": "chip-v1" }, { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", + "path": "../../../src/app/zap-templates/zcl/zcl.json", + "type": "zcl-properties", "category": "matter", - "version": "chip-v1" + "version": 1, + "description": "Matter SDK ZCL data" } ], "endpointTypes": [ @@ -4922,7 +4922,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5813,7 +5813,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/lighting-app/nrfconnect/CMakeLists.txt b/examples/lighting-app/nrfconnect/CMakeLists.txt index 04dacfac4af308..5b2647894e9ffb 100644 --- a/examples/lighting-app/nrfconnect/CMakeLists.txt +++ b/examples/lighting-app/nrfconnect/CMakeLists.txt @@ -22,20 +22,12 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) -# Set Kconfig root files that will be processed as a first Kconfig for used child images. -set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root) -set(multiprotocol_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root) -set(hci_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.hci_rpmsg.root) - -if(NOT CONF_FILE STREQUAL "prj_no_dfu.conf" AND NOT BOARD STREQUAL "nrf52840dongle_nrf52840") - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static_dfu.yml) -endif() - list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) project(chip-nrfconnect-lighting-example) +include(${CHIP_ROOT}/config/nrfconnect/app/check-sysbuild-use.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/flashing.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) diff --git a/examples/lighting-app/nrfconnect/Kconfig.sysbuild b/examples/lighting-app/nrfconnect/Kconfig.sysbuild new file mode 100644 index 00000000000000..4048c88bf51f0f --- /dev/null +++ b/examples/lighting-app/nrfconnect/Kconfig.sysbuild @@ -0,0 +1,79 @@ +# +# 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. +# + +#### Radio core selection +config NRF_DEFAULT_IPC_RADIO + default y + +# Enable IEEE802.15.4 serialization to network core +config NETCORE_IPC_RADIO_IEEE802154 + default y if (SOC_SERIES_NRF53X) && !WIFI_NRF700X + +# Enable Bluetooth serialization to network core +config NETCORE_IPC_RADIO_BT_HCI_IPC + default y if SOC_SERIES_NRF53X + +config MATTER_OTA + default n if BOARD_NRF52840DONGLE_NRF52840 + +#### Bootloader +choice BOOTLOADER + default BOOTLOADER_MCUBOOT if !BOARD_NRF52840DONGLE_NRF52840 +endchoice + +if BOOTLOADER_MCUBOOT + +#### DFU multi-image support +config DFU_MULTI_IMAGE_PACKAGE_BUILD + default y + +config DFU_MULTI_IMAGE_PACKAGE_APP + default y + +config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY + default y + +#### DFU network core configuration +if SOC_SERIES_NRF53X + +config MCUBOOT_UPDATEABLE_IMAGES + default 2 + +choice MCUBOOT_MODE + default MCUBOOT_MODE_OVERWRITE_ONLY +endchoice + +choice BOOT_SIGNATURE_TYPE + default BOOT_SIGNATURE_TYPE_RSA +endchoice + +config SECURE_BOOT_NETCORE + default y + +config NETCORE_APP_UPDATE + default y + +config DFU_MULTI_IMAGE_PACKAGE_NET + default y + +endif # SOC_SERIES_NRF53X +endif # BOOTLOADER_MCUBOOT + +#### Enable generating factory data +config MATTER_FACTORY_DATA_GENERATE + default y if !BOARD_NRF52840DONGLE_NRF52840 + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/examples/lighting-app/nrfconnect/README.md b/examples/lighting-app/nrfconnect/README.md index b5ef3d7024a0f6..3ba3c74f56d70f 100644 --- a/examples/lighting-app/nrfconnect/README.md +++ b/examples/lighting-app/nrfconnect/README.md @@ -1,5 +1,21 @@ # Matter nRF Connect Lighting Example Application +> **Note:** This example is intended only to perform smoke tests of a Matter +> solution integrated with nRF Connect SDK platform. The example quality is not +> production ready and it may contain minor bugs or use not optimal +> configuration. It is not recommended to use this example as a basis for +> creating a market ready product. +> +> For the production ready and optimized Matter samples, see +> [nRF Connect SDK samples](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/matter.html). +> The Matter samples in nRF Connect SDK use various additional software +> components and provide multiple optional features that improve the developer +> and user experience. To read more about it, see +> [Matter support in nRF Connect SDK](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/matter/index.html#ug-matter) +> page. Using Matter samples from nRF Connect SDK allows you to get a full +> Nordic technical support via [DevZone](https://devzone.nordicsemi.com/) +> portal. + The nRF Connect Lighting Example demonstrates how to remotely control a white dimmable light bulb. It uses buttons to test changing the lighting and device states and LEDs to show the state of these changes. You can use this example as @@ -153,10 +169,10 @@ The example supports building and running on the following devices: | Hardware platform | Build target | Platform image | | ------------------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk_nrf52840` |
nRF52840 DKnRF52840 DK
| -| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk_nrf5340_cpuapp` |
nRF5340 DKnRF5340 DK
| -| [nRF52840 Dongle](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle) | `nrf52840dongle_nrf52840` |
nRF52840 DonglenRF52840 Dongle
| -| [nRF7002 DK](https://www.nordicsemi.com/Products/Development-hardware/nRF7002-DK) | `nrf7002dk_nrf5340_cpuapp` |
nRF7002 DKnRF7002 DK
| +| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk/nrf52840` |
nRF52840 DKnRF52840 DK
| +| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk/nrf5340/cpuapp` |
nRF5340 DKnRF5340 DK
| +| [nRF52840 Dongle](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle) | `nrf52840dongle/nrf52840` |
nRF52840 DonglenRF52840 Dongle
| +| [nRF7002 DK](https://www.nordicsemi.com/Products/Development-hardware/nRF7002-DK) | `nrf7002dk/nrf5340/cpuapp` |
nRF7002 DKnRF7002 DK
|
@@ -165,9 +181,9 @@ The example supports building and running on the following devices: The development kits for this sample offer the following IPv6 network support for Matter: -- Matter over Thread is supported for `nrf52840dk_nrf52840` and - `nrf5340dk_nrf5340_cpuapp`. -- Matter over Wi-Fi is supported for `nrf7002dk_nrf5340_cpuapp`. +- Matter over Thread is supported for `nrf52840dk/nrf52840` and + `nrf5340dk/nrf5340/cpuapp`. +- Matter over Wi-Fi is supported for `nrf7002dk/nrf5340/cpuapp`. ## Device UI @@ -339,16 +355,17 @@ Complete the following steps to build the sample: 2. Run the following command to build the example, with _build-target_ replaced with the build target name of the Nordic Semiconductor's kit you own, for - example `nrf52840dk_nrf52840`: + example `nrf52840dk/nrf52840`: ``` - $ west build -b build-target + $ west build -b build-target --sysbuild ``` You only need to specify the build target on the first build. See [Requirements](#requirements) for the build target names of compatible kits. -The output `zephyr.hex` file will be available in the `build/zephyr/` directory. +The output `zephyr.hex` file will be available in the `build/nrfconnect/zephyr/` +directory. ### Removing build artifacts @@ -366,7 +383,7 @@ To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: ``` - $ west build -b build-target -- -DCONF_FILE=prj_release.conf + $ west build -b build-target --sysbuild -- -DFILE_SUFFIX=release ``` Remember to replace _build-target_ with the build target name of the Nordic @@ -381,7 +398,7 @@ command with _build-target_ replaced with the build target name of the Nordic Semiconductor's kit you own: ``` - $ west build -b build-target -- -DOVERLAY_CONFIG=rpc.overlay + $ west build -b build-target --sysbuild -- -DOVERLAY_CONFIG=rpc.overlay ``` ### Building with Device Firmware Upgrade support @@ -390,18 +407,10 @@ Support for DFU using Matter OTA is enabled by default. To enable DFU over Bluetooth LE, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are -using (for example `nrf52840dk_nrf52840`): - - ``` - $ west build -b build-target -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y - ``` - -To completely disable support for both DFU methods, run the following command -with _build-target_ replaced with the build target name of the Nordic -Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): +using (for example `nrf52840dk/nrf52840`): ``` - $ west build -b build-target -- -DCONF_FILE=prj_no_dfu.conf + $ west build -b build-target --sysbuild -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y ``` > **Note**: @@ -419,7 +428,7 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): #### Changing bootloader configuration To change the default MCUboot configuration, edit the `prj.conf` file located in -the `child_image/mcuboot` directory. +the `sysbuild/mcuboot` directory. Make sure to keep the configuration consistent with changes made to the application configuration. This is necessary for the configuration to work, as @@ -436,8 +445,9 @@ purposes. You can change these settings by defining This example uses this option to define using an external flash. To modify the flash settings of your board (that is, your _build-target_, for -example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the -`configuration/build-target/` directory. +example `nrf52840dk/nrf52840`), edit the `pm_static_.yml` file +(for example `pm_static_nrf52840dk_nrf52840.yml`), located in the main +application directory.
@@ -450,7 +460,7 @@ To open the menuconfig utility, run the following command from the example directory: ``` - $ west build -b build-target -t menuconfig + $ west build -b build-target --sysbuild -t menuconfig ``` Remember to replace _build-target_ with the build target name of the Nordic @@ -484,9 +494,6 @@ depending on the selected board: the necessary application functionalities to optimize its performance. It can be used only for the nRF52840 DK and nRF5340 DK, as those platforms have DFU enabled by default. -- no_dfu -- Debug version of the application without Device Firmware Upgrade - feature support - can be used for the nRF52840 DK, nRF5340 DK and nRF52840 - Dongle. For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) diff --git a/examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840_no_dfu.conf b/examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf similarity index 93% rename from examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840_no_dfu.conf rename to examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf index 01eedaf2e36856..db5151dc6c7ef4 100644 --- a/examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840_no_dfu.conf +++ b/examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf @@ -41,3 +41,9 @@ CONFIG_PM_SINGLE_IMAGE=y # Disable factory data support. CONFIG_CHIP_FACTORY_DATA=n CONFIG_CHIP_FACTORY_DATA_BUILD=n + +# Disable Matter OTA DFU +CONFIG_CHIP_OTA_REQUESTOR=n + +# Disable QSPI NOR +CONFIG_CHIP_QSPI_NOR=n diff --git a/examples/lighting-app/nrfconnect/child_image/hci_rpmsg/prj.conf b/examples/lighting-app/nrfconnect/child_image/hci_rpmsg/prj.conf deleted file mode 100644 index 1622ffd00dbb91..00000000000000 --- a/examples/lighting-app/nrfconnect/child_image/hci_rpmsg/prj.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.hci_rpmsg.defaults to set options common for all -# samples using hci_rpmsg. This file should contain only options specific for this sample -# hci_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.hci_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/lighting-app/nrfconnect/child_image/hci_rpmsg/prj_no_dfu.conf b/examples/lighting-app/nrfconnect/child_image/hci_rpmsg/prj_no_dfu.conf deleted file mode 100644 index 1622ffd00dbb91..00000000000000 --- a/examples/lighting-app/nrfconnect/child_image/hci_rpmsg/prj_no_dfu.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.hci_rpmsg.defaults to set options common for all -# samples using hci_rpmsg. This file should contain only options specific for this sample -# hci_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.hci_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/lighting-app/nrfconnect/child_image/hci_rpmsg/prj_release.conf b/examples/lighting-app/nrfconnect/child_image/hci_rpmsg/prj_release.conf deleted file mode 100644 index 1622ffd00dbb91..00000000000000 --- a/examples/lighting-app/nrfconnect/child_image/hci_rpmsg/prj_release.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.hci_rpmsg.defaults to set options common for all -# samples using hci_rpmsg. This file should contain only options specific for this sample -# hci_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.hci_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay b/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index f18e3e0cc16434..00000000000000 --- a/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay b/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf b/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf deleted file mode 100644 index cd9aab4101c6f5..00000000000000 --- a/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1,17 +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. -# - -CONFIG_GPIO=y diff --git a/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay b/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.conf b/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.conf deleted file mode 100644 index cd9aab4101c6f5..00000000000000 --- a/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.conf +++ /dev/null @@ -1,17 +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. -# - -CONFIG_GPIO=y diff --git a/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.overlay b/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/lighting-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/lighting-app/nrfconnect/child_image/mcuboot/prj_release.conf b/examples/lighting-app/nrfconnect/child_image/mcuboot/prj_release.conf deleted file mode 100644 index 90969a32dbc414..00000000000000 --- a/examples/lighting-app/nrfconnect/child_image/mcuboot/prj_release.conf +++ /dev/null @@ -1,30 +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. -# - -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. - -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" - -# Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_USE_SEGGER_RTT=n -CONFIG_GPIO=n diff --git a/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf b/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf b/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf b/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/lighting-app/nrfconnect/main/include/CHIPProjectConfig.h b/examples/lighting-app/nrfconnect/main/include/CHIPProjectConfig.h index 7e997d723549d2..4baa186190f638 100644 --- a/examples/lighting-app/nrfconnect/main/include/CHIPProjectConfig.h +++ b/examples/lighting-app/nrfconnect/main/include/CHIPProjectConfig.h @@ -26,8 +26,3 @@ */ #pragma once - -// Switching from Thread child to router may cause a few second packet stall. -// 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) diff --git a/examples/lit-icd-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml b/examples/lighting-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml similarity index 100% rename from examples/lit-icd-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml rename to examples/lighting-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml diff --git a/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml b/examples/lighting-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml similarity index 100% rename from examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml rename to examples/lighting-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml diff --git a/examples/lighting-app/nrfconnect/pm_static_nrf52840dongle_nrf52840_no_dfu.yml b/examples/lighting-app/nrfconnect/pm_static_nrf52840dongle_nrf52840.yml similarity index 100% rename from examples/lighting-app/nrfconnect/pm_static_nrf52840dongle_nrf52840_no_dfu.yml rename to examples/lighting-app/nrfconnect/pm_static_nrf52840dongle_nrf52840.yml diff --git a/examples/window-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml b/examples/lighting-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml similarity index 100% rename from examples/window-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/pm_static_dfu.yml rename to examples/lighting-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml diff --git a/examples/lighting-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml b/examples/lighting-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml new file mode 100644 index 00000000000000..10e8680c363a53 --- /dev/null +++ b/examples/lighting-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml @@ -0,0 +1,56 @@ +mcuboot: + address: 0x0 + size: 0x8000 + region: flash_primary +mcuboot_pad: + address: 0x8000 + size: 0x200 +app: + address: 0x8200 + size: 0xf2e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x8000 + size: 0xf3000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x8200 + size: 0xf2e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x0 + size: 0xf3000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xf3000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x133000 + size: 0x6CD000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/examples/lighting-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp.yml b/examples/lighting-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp.yml new file mode 100644 index 00000000000000..3c56dc0ddb1968 --- /dev/null +++ b/examples/lighting-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp.yml @@ -0,0 +1,56 @@ +mcuboot: + address: 0x0 + size: 0xC000 + region: flash_primary +mcuboot_pad: + address: 0xC000 + size: 0x200 +app: + address: 0xC200 + size: 0xeee00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0xC000 + size: 0xef000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0xC200 + size: 0xeee00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x0 + size: 0xef000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xef000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x12f000 + size: 0x6D1000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/examples/lighting-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp_release.yml b/examples/lighting-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp_release.yml new file mode 100644 index 00000000000000..3c56dc0ddb1968 --- /dev/null +++ b/examples/lighting-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp_release.yml @@ -0,0 +1,56 @@ +mcuboot: + address: 0x0 + size: 0xC000 + region: flash_primary +mcuboot_pad: + address: 0xC000 + size: 0x200 +app: + address: 0xC200 + size: 0xeee00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0xC000 + size: 0xef000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0xC200 + size: 0xeee00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x0 + size: 0xef000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xef000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x12f000 + size: 0x6D1000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/examples/lighting-app/nrfconnect/prj.conf b/examples/lighting-app/nrfconnect/prj.conf index 38c8be587d5600..c4f521be6960ea 100644 --- a/examples/lighting-app/nrfconnect/prj.conf +++ b/examples/lighting-app/nrfconnect/prj.conf @@ -25,9 +25,13 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 CONFIG_STD_CPP17=y -# Enable CHIP pairing automatically on application start. +# Enable Matter pairing automatically on application start. CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y CONFIG_PWM=y diff --git a/examples/lighting-app/nrfconnect/prj_no_dfu.conf b/examples/lighting-app/nrfconnect/prj_no_dfu.conf deleted file mode 100644 index 22cdc2b700ee9f..00000000000000 --- a/examples/lighting-app/nrfconnect/prj_no_dfu.conf +++ /dev/null @@ -1,56 +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. -# - -# This sample uses Kconfig.defaults to set options common for all -# samples. This file should contain only options specific for this sample -# or overrides of default values. - -# Enable CHIP -CONFIG_CHIP=y -CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" -# 32773 == 0x8005 (example lighting-app) -CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 -CONFIG_STD_CPP17=y - -# Enable CHIP pairing automatically on application start. -CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y - -# Add support for LEDs and buttons on Nordic development kits -CONFIG_DK_LIBRARY=y -CONFIG_PWM=y - -# General networking settings -CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=14 - -# Bluetooth Low Energy configuration -CONFIG_BT_DEVICE_NAME="MatterLight" - -# Other settings -CONFIG_THREAD_NAME=y -CONFIG_MPU_STACK_GUARD=y -CONFIG_RESET_ON_FATAL_ERROR=n - -# Reduce application size -CONFIG_USE_SEGGER_RTT=n - -# Stack size settings -CONFIG_IEEE802154_NRF5_RX_STACK_SIZE=1024 - -# Disable Matter OTA DFU -CONFIG_CHIP_OTA_REQUESTOR=n - -# Disable QSPI NOR -CONFIG_CHIP_QSPI_NOR=n diff --git a/examples/lighting-app/nrfconnect/prj_release.conf b/examples/lighting-app/nrfconnect/prj_release.conf index 4468a07e40b088..a51ed89060d0e6 100644 --- a/examples/lighting-app/nrfconnect/prj_release.conf +++ b/examples/lighting-app/nrfconnect/prj_release.conf @@ -25,9 +25,13 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 CONFIG_STD_CPP17=y -# Enable CHIP pairing automatically on application start. +# Enable Matter pairing automatically on application start. CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y CONFIG_PWM=y diff --git a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf b/examples/lighting-app/nrfconnect/sysbuild.conf similarity index 90% rename from examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf rename to examples/lighting-app/nrfconnect/sysbuild.conf index cd9aab4101c6f5..d0c5eee2b93c39 100644 --- a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf +++ b/examples/lighting-app/nrfconnect/sysbuild.conf @@ -1,5 +1,5 @@ # -# 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. @@ -14,4 +14,4 @@ # limitations under the License. # -CONFIG_GPIO=y +SB_CONFIG_MATTER=y diff --git a/examples/lighting-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf b/examples/lighting-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf new file mode 100644 index 00000000000000..8540585e53358b --- /dev/null +++ b/examples/lighting-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf @@ -0,0 +1,58 @@ +# +# 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. +# + +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# 802.15.4 configuration +CONFIG_NRF_802154_SER_RADIO=y +CONFIG_NRF_802154_ENCRYPTION=y +CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=2 + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_DEBUG_INFO=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y +CONFIG_IPC_RADIO_802154=y diff --git a/examples/lighting-app/nrfconnect/sysbuild/ipc_radio/boards/nrf7002dk_nrf5340_cpunet.conf b/examples/lighting-app/nrfconnect/sysbuild/ipc_radio/boards/nrf7002dk_nrf5340_cpunet.conf new file mode 100644 index 00000000000000..694c3b08242f29 --- /dev/null +++ b/examples/lighting-app/nrfconnect/sysbuild/ipc_radio/boards/nrf7002dk_nrf5340_cpunet.conf @@ -0,0 +1,52 @@ +# +# 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. +# + +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_DEBUG_INFO=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y diff --git a/examples/lighting-app/nrfconnect/sysbuild/ipc_radio/prj.conf b/examples/lighting-app/nrfconnect/sysbuild/ipc_radio/prj.conf new file mode 100644 index 00000000000000..8906415dda4fc7 --- /dev/null +++ b/examples/lighting-app/nrfconnect/sysbuild/ipc_radio/prj.conf @@ -0,0 +1,21 @@ +# +# 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. +# + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=n diff --git a/examples/lighting-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf b/examples/lighting-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf new file mode 100644 index 00000000000000..7f92a51630cce0 --- /dev/null +++ b/examples/lighting-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf @@ -0,0 +1,20 @@ +# +# 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. +# +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=y diff --git a/examples/lighting-app/nrfconnect/sysbuild/mcuboot/app.overlay b/examples/lighting-app/nrfconnect/sysbuild/mcuboot/app.overlay new file mode 100644 index 00000000000000..74d3dfbfd22f30 --- /dev/null +++ b/examples/lighting-app/nrfconnect/sysbuild/mcuboot/app.overlay @@ -0,0 +1,5 @@ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf b/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf new file mode 100644 index 00000000000000..50610217c762b5 --- /dev/null +++ b/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf @@ -0,0 +1,19 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 diff --git a/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000000..2d86fe6442dd39 --- /dev/null +++ b/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -0,0 +1,35 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 + +CONFIG_BOOT_SWAP_USING_MOVE=n +# Multi-image updates do not support image swapping yet. +CONFIG_BOOT_UPGRADE_ONLY=y + +# The network core cannot access external flash directly. The flash simulator must be used to +# provide a memory region that is used to forward the new firmware to the network core. +CONFIG_FLASH_SIMULATOR=y +CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y +CONFIG_FLASH_SIMULATOR_STATS=n + +CONFIG_ZCBOR=y diff --git a/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf b/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000000..81701b7eb63f70 --- /dev/null +++ b/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf @@ -0,0 +1,40 @@ +# +# 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. +# + +# nRF7002DK uses SPI NOR external flash +CONFIG_GPIO=y +CONFIG_SPI=y +CONFIG_SPI_NOR=y +CONFIG_SPI_NOR_SFDP_DEVICETREE=y +CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 + +CONFIG_MULTITHREADING=y +CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 + +# Multi-image updates do not support image swapping yet. +CONFIG_BOOT_UPGRADE_ONLY=y + +# The network core cannot access external flash directly. The flash simulator must be used to +# provide a memory region that is used to forward the new firmware to the network core. +CONFIG_FLASH_SIMULATOR=y +CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y +CONFIG_FLASH_SIMULATOR_STATS=n + +CONFIG_ZCBOR=y diff --git a/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay b/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/lighting-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/lighting-app/nrfconnect/child_image/mcuboot/prj.conf b/examples/lighting-app/nrfconnect/sysbuild/mcuboot/prj.conf similarity index 59% rename from examples/lighting-app/nrfconnect/child_image/mcuboot/prj.conf rename to examples/lighting-app/nrfconnect/sysbuild/mcuboot/prj.conf index 90969a32dbc414..3bcb12fe7b8d25 100644 --- a/examples/lighting-app/nrfconnect/child_image/mcuboot/prj.conf +++ b/examples/lighting-app/nrfconnect/sysbuild/mcuboot/prj.conf @@ -1,5 +1,5 @@ # -# 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. @@ -14,17 +14,36 @@ # limitations under the License. # -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. +CONFIG_MAIN_STACK_SIZE=10240 + +CONFIG_BOOT_SWAP_SAVE_ENCTLV=n +CONFIG_BOOT_BOOTSTRAP=n +CONFIG_PM=n + +CONFIG_FLASH=y +CONFIG_FPROTECT=y CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +# Use minimal C library instead of the Picolib +CONFIG_MINIMAL_LIBC=y + # Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. CONFIG_CONSOLE=n CONFIG_SERIAL=n CONFIG_UART_CONSOLE=n CONFIG_USE_SEGGER_RTT=n CONFIG_GPIO=n + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +CONFIG_LOG=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_NCS_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/lighting-app/nxp/k32w/k32w0/README.md b/examples/lighting-app/nxp/k32w/k32w0/README.md index 7cd4dd7d636ffc..a0f560e2e884c4 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/README.md +++ b/examples/lighting-app/nxp/k32w/k32w0/README.md @@ -17,30 +17,37 @@ network.
- [CHIP K32W061 Lighting Example Application](#chip-k32w061-lighting-example-application) -- [Introduction](#introduction) - - [Bluetooth LE Advertising](#bluetooth-le-advertising) - - [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous) -- [Device UI](#device-ui) -- [Building](#building) - - [Overwrite board config files](#overwrite-board-config-files) + - [Introduction](#introduction) + - [SE051H Secure Element](#se051h-secure-element) + - [Bluetooth LE Advertising](#bluetooth-le-advertising) + - [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous) + - [Thread Provisioning](#thread-provisioning) + - [Device UI](#device-ui) + - [No expansion board](#no-expansion-board) + - [Identify cluster LED state](#identify-cluster-led-state) + - [Building](#building) + - [Overwrite board config files](#overwrite-board-config-files) - [Known issues building](#known-issues-building) -- [Manufacturing data](#manufacturing-data) -- [Flashing and debugging](#flashing-and-debugging) -- [Pigweed Tokenizer](#pigweed-tokenizer) - - [Detokenizer script](#detokenizer-script) - - [Notes](#notes) - - [Known issues tokenizer](#known-issues-tokenizer) -- [NXP Ultrafast P256 ECC Library](#nxp-ultrafast-p256-ecc-library) - - [Building steps](#building-steps) -- [Tinycrypt ECC library](#tinycrypt-ecc-library) - - [Building steps](#building-steps-1) -- [OTA](#ota) - - [Writing the SSBL](#writing-the-ssbl) - - [Writing the PSECT](#writing-the-psect) - - [Writing the application](#writing-the-application) - - [OTA Testing](#ota-testing) - - [Known issues OTA](#known-issues-ota) - + - [Rotating device id](#rotating-device-id) + - [Manufacturing data](#manufacturing-data) + - [Flashing and debugging](#flashing-and-debugging) + - [Pigweed tokenizer](#pigweed-tokenizer) + - [Detokenizer script](#detokenizer-script) + - [Notes](#notes) + - [Known issues tokenizer](#known-issues-tokenizer) + - [NXP Ultrafast P256 ECC Library](#nxp-ultrafast-p256-ecc-library) + - [Building steps](#building-steps) + - [Tinycrypt ECC library](#tinycrypt-ecc-library) + - [Building steps](#building-steps-1) + - [OTA](#ota) + - [Writing the SSBL](#writing-the-ssbl) + - [Features](#features) + - [Multi image](#multi-image) + - [Simple hash verification](#simple-hash-verification) + - [Writing the PSECT](#writing-the-psect) + - [Writing the application](#writing-the-application) + - [OTA Testing](#ota-testing) + - [Known issues ota](#known-issues-ota) ## Introduction @@ -190,44 +197,47 @@ effects: ## Building In order to build the Project CHIP example, we recommend using a Linux -distribution (the demo-application was compiled on Ubuntu 20.04). +distribution (supported Operating Systems are listed in +[BUILDING.md](../../../../../docs/guides/BUILDING.md#tested-operating systems)). -Activate the Matter environment: +- Make sure that below prerequisites are correctly installed (as described in + [BUILDING.md](../../../../../docs/guides/BUILDING.md#prerequisites))) -```bash -user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh +``` +sudo apt-get install git gcc g++ pkg-config libssl-dev libdbus-1-dev \ + libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev \ + python3-pip unzip libgirepository1.0-dev libcairo2-dev libreadline-dev ``` -To bring the SDK in the environment, the user can: +- Step 1: checkout NXP specific submodules only -- download it with west tool, in which case it will be handled automatically - by gn: +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ scripts/checkout_submodules.py --shallow --platform nxp --recursive +``` - ```bash - user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo - user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west init -l manifest --mf west.yml - user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west update - ``` +- Step 2: activate local environment - In case there are local modification to the already installed github NXP - SDK, use the below `west forall` command instead of the `west init` command - to reset the west workspace. Warning: all local changes will be lost after - running this command. +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ source scripts/activate.sh +``` - ```bash - user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo - user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west forall -c "git reset --hard && git clean -xdf" -a - ``` +If the script says the environment is out of date, you can update it by running +the following command: -- set up a custom path to the SDK, in which case - `k32w0_sdk_root=\"${NXP_K32W0_SDK_ROOT}\"` must be added to the `gn gen` - command: +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ source scripts/bootstrap.sh +``` + +- Step 3: Init NXP SDK(s) + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ scripts/setup/nxp/update_nxp_sdk.py --platform k32w0 +``` - ``` - user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W0_SDK_ROOT=/custom/path/to/SDK - ``` +Note: By default setup/nxp/update_nxp_sdk.py will try to initialize all NXP +SDKs. Arg "-- help" could be used to view all available options. -Start building the application: +- Start building the application: ```bash user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/lighting-app/nxp/k32w/k32w0 diff --git a/examples/lighting-app/nxp/zap/lighting-on-off.matter b/examples/lighting-app/nxp/zap/lighting-on-off.matter index 4e79aafcef7495..c990ea3bbfbde3 100644 --- a/examples/lighting-app/nxp/zap/lighting-on-off.matter +++ b/examples/lighting-app/nxp/zap/lighting-on-off.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -363,7 +380,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -379,12 +396,42 @@ cluster AccessControl = 31 { 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; @@ -420,17 +467,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -515,7 +586,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1562,6 +1633,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; @@ -1834,7 +1906,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 3; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; diff --git a/examples/lighting-app/nxp/zap/lighting-on-off.zap b/examples/lighting-app/nxp/zap/lighting-on-off.zap index 2e01bf3d298255..941eb33fb2c5d2 100644 --- a/examples/lighting-app/nxp/zap/lighting-on-off.zap +++ b/examples/lighting-app/nxp/zap/lighting-on-off.zap @@ -489,6 +489,22 @@ "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": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, @@ -3815,7 +3831,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/lighting-app/qpg/src/AppTask.cpp b/examples/lighting-app/qpg/src/AppTask.cpp index d870ea24deeb13..90f2e30ecb03c5 100644 --- a/examples/lighting-app/qpg/src/AppTask.cpp +++ b/examples/lighting-app/qpg/src/AppTask.cpp @@ -69,7 +69,8 @@ using namespace ::chip::DeviceLayer; #define APP_TASK_PRIORITY 2 #define APP_EVENT_QUEUE_SIZE 10 #define QPG_LIGHT_ENDPOINT_ID (1) -#define TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS (1 * 3600) // this value must be multiplication of 3600 +#define SECONDS_IN_HOUR (3600) // we better keep this 3600 +#define TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS (1 * SECONDS_IN_HOUR) // increment every hour static uint8_t countdown = 0; @@ -454,10 +455,18 @@ void AppTask::TotalHoursTimerHandler(chip::System::Layer * aLayer, void * aAppSt CHIP_ERROR err; uint32_t totalOperationalHours = 0; - if (ConfigurationMgr().GetTotalOperationalHours(totalOperationalHours) == CHIP_NO_ERROR) + err = ConfigurationMgr().GetTotalOperationalHours(totalOperationalHours); + + if (err == CHIP_NO_ERROR) + { + ConfigurationMgr().StoreTotalOperationalHours(totalOperationalHours + + (TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS / SECONDS_IN_HOUR)); + } + else if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) { + totalOperationalHours = 0; // set this explicitly to 0 for safety ConfigurationMgr().StoreTotalOperationalHours(totalOperationalHours + - (TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS / 3600)); + (TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS / SECONDS_IN_HOUR)); } else { diff --git a/examples/lighting-app/qpg/zap/light.matter b/examples/lighting-app/qpg/zap/light.matter index f2d62f56d5f6c0..58472a11cb7b1e 100644 --- a/examples/lighting-app/qpg/zap/light.matter +++ b/examples/lighting-app/qpg/zap/light.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -363,7 +380,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -379,12 +396,42 @@ cluster AccessControl = 31 { 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; @@ -420,17 +467,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -515,7 +586,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1607,7 +1678,7 @@ cluster UserLabel = 65 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -2321,7 +2392,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 3; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; @@ -2389,7 +2460,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 0x1F; - ram attribute clusterRevision default = 6; + ram attribute clusterRevision default = 7; handle command MoveToHue; handle command MoveHue; diff --git a/examples/lighting-app/qpg/zap/light.zap b/examples/lighting-app/qpg/zap/light.zap index 62d6453e7abf03..6390c7f37267d8 100644 --- a/examples/lighting-app/qpg/zap/light.zap +++ b/examples/lighting-app/qpg/zap/light.zap @@ -17,6 +17,13 @@ } ], "package": [ + { + "pathRelativity": "relativeToZap", + "path": "../../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", + "category": "matter", + "version": "chip-v1" + }, { "pathRelativity": "relativeToZap", "path": "../../../../src/app/zap-templates/zcl/zcl.json", @@ -4980,7 +4987,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -6002,7 +6009,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 0, "maxInterval": 65344, 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 a3d394e217e8ab..a15d472711c218 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -363,7 +380,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -379,12 +396,42 @@ cluster AccessControl = 31 { 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; @@ -420,17 +467,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -515,7 +586,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1557,14 +1628,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + 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; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -1676,7 +1754,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** 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; @@ -1696,7 +1774,7 @@ provisional cluster ScenesManagement = 98 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -2355,7 +2433,7 @@ endpoint 1 { callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 3; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; @@ -2433,7 +2511,7 @@ endpoint 1 { callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0x1F; - ram attribute clusterRevision default = 6; + ram attribute clusterRevision default = 7; handle command MoveToHue; handle command MoveHue; 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 e759d83b2f2276..a3fd5e516aad09 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.zap +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.zap @@ -4289,7 +4289,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5316,7 +5316,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "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 3d2e7083c3d541..1149a126a222d1 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -363,7 +380,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -379,12 +396,42 @@ cluster AccessControl = 31 { 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; @@ -420,17 +467,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -515,7 +586,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1848,14 +1919,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + 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; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -1967,7 +2045,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** 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; @@ -1987,7 +2065,7 @@ provisional cluster ScenesManagement = 98 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -2627,7 +2705,7 @@ endpoint 1 { callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 3; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; @@ -2722,7 +2800,7 @@ endpoint 1 { ram attribute coupleColorTempToLevelMinMireds; persist attribute startUpColorTemperatureMireds; ram attribute featureMap default = 0x1F; - ram attribute clusterRevision default = 6; + ram attribute clusterRevision default = 7; handle command MoveToHue; handle command MoveHue; 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 84dd93b4bc6533..6d438d10e14001 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap @@ -3774,7 +3774,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5027,7 +5027,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/lighting-app/telink/README.md b/examples/lighting-app/telink/README.md index 6c2269007e8ac3..0bf52ea12c28fd 100644 --- a/examples/lighting-app/telink/README.md +++ b/examples/lighting-app/telink/README.md @@ -7,6 +7,17 @@ a reference for creating your own application. ![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) +## Supported devices + +The example supports building and running on the following devices: + +| Board/SoC | Build target | Zephyr Board Info | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| [B91](https://wiki.telink-semi.cn/wiki/Hardware/B91_Generic_Starter_Kit_Hardware_Guide) [TLSR9518ADK80D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series) | `tlsr9518adk80d`, `tlsr9518adk80d-mars`, `tlsr9518adk80d-usb` | [TLSR9518ADK80D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9518adk80d/doc/index.rst) | +| [B92](https://wiki.telink-semi.cn/wiki/Hardware/B92_Generic_Starter_Kit_Hardware_Guide) [TLSR9528A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR952x-Series) | `tlsr9528a`, `tlsr9528a_retention` | [TLSR9528A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9528a/doc/index.rst) | +| [B95](https://wiki.telink-semi.cn/wiki/Hardware/B95_Generic_Starter_Kit_Hardware_Guide) [TLSR9258A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR925x-Series) | `tlsr9258a` | [TLSR9258A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9258a/doc/index.rst) | +| [W91](https://wiki.telink-semi.cn/wiki/Hardware/W91_Generic_Starter_Kit_Hardware_Guide) [TLSR9118BDK40D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR911x-Series) | `tlsr9118bdk40d` | [TLSR9118BDK40D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9118bdk40d/doc/index.rst) | + ## Build and flash 1. Run the Docker container: @@ -15,7 +26,7 @@ a reference for creating your own application. $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}') ``` - Compatible docker image version can be found in next file: + You can find the compatible Docker image version in the file: ```bash $ .github/workflows/examples-telink.yaml @@ -27,8 +38,8 @@ a reference for creating your own application. $ source ./scripts/activate.sh -p all,telink ``` -3. In the example dir run (replace __ with your board name, for - example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`): +3. Build the example (replace __ with your board name, see + [Supported devices](#supported-devices)): ```bash $ west build -b @@ -38,9 +49,12 @@ a reference for creating your own application. MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=4m`: ```bash - $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + $ west build -b -- -DFLASH_SIZE=4m ``` + You can find the target built file called **_zephyr.bin_** under the + **_build/zephyr_** directory. + 4. Flash binary: ``` @@ -59,16 +73,18 @@ To get output from device, connect UART to following pins: | TX | PB2 (pin 16 of J34 connector) | | GND | GND | +Baud rate: 115200 bits/s + ### Buttons The following buttons are available on **tlsr9518adk80d** board: -| Name | Function | Description | -| :------- | :--------------------- | :----------------------------------------------------------------------------------------------------- | -| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and back to uncommissioned state | -| Button 2 | Lighting control | Manually triggers the lighting state | -| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | -| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | +| Name | Function | Description | +| :------- | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and return to a decommissioned state (to activate, push the button 3 times) | +| Button 2 | Lighting control | Manually triggers the lighting state | +| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | +| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | ### LEDs @@ -249,9 +265,9 @@ application of OTA image. The RPCs in `lighting-common/lighting_service/lighting_service.proto` can be used to control various functionalities of the lighting app from a USB-connected host computer. To build the example with the RPC server, run the following -command with _build-target_ replaced with the build target name of the Telink +command with __ replaced with the build target name of the Telink Semiconductor's kit you own: ``` - $ west build -b tlsr9518adk80d -- -DOVERLAY_CONFIG=rpc.overlay + $ west build -b -- -DOVERLAY_CONFIG=rpc.overlay ``` diff --git a/examples/lit-icd-app/linux/main.cpp b/examples/lit-icd-app/linux/main.cpp index 1f4031af407d42..601cc22d3d2af9 100644 --- a/examples/lit-icd-app/linux/main.cpp +++ b/examples/lit-icd-app/linux/main.cpp @@ -19,16 +19,26 @@ #include "AppMain.h" #include +#include "system/SystemClock.h" + using namespace chip; using namespace chip::app; +using namespace chip::System::Clock::Literals; void ApplicationInit() {} void ApplicationShutdown() {} +void notifyIcdActive(System::Layer * layer, void *) +{ + ICDNotifier::GetInstance().NotifyNetworkActivityNotification(); + DeviceLayer::SystemLayer().StartTimer(10000_ms32, notifyIcdActive, nullptr); +} + int main(int argc, char * argv[]) { VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0); + DeviceLayer::SystemLayer().StartTimer(10000_ms32, notifyIcdActive, nullptr); ChipLinuxAppMainLoop(); return 0; } diff --git a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter index 79f26232c3a727..3e156b926f6e0c 100644 --- a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter +++ b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1411,7 +1482,7 @@ cluster BooleanState = 69 { /** Allows servers to ensure that listed clients are notified when a server is available for communication. */ cluster IcdManagement = 70 { - revision 2; + revision 3; enum ClientTypeEnum : enum8 { kPermanent = 0; @@ -1427,6 +1498,7 @@ cluster IcdManagement = 70 { kCheckInProtocolSupport = 0x1; kUserActiveModeTrigger = 0x2; kLongIdleTimeSupport = 0x4; + kDynamicSitLitSupport = 0x8; } bitmap UserActiveModeTriggerBitmap : bitmap32 { @@ -1465,6 +1537,7 @@ cluster IcdManagement = 70 { 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; @@ -1561,6 +1634,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; @@ -1793,12 +1867,13 @@ endpoint 0 { ram attribute userActiveModeTriggerHint default = 0x111D; ram attribute userActiveModeTriggerInstruction default = "Restart the application"; ram attribute operatingMode default = 0; + callback attribute maximumCheckInBackOff; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0x0007; - ram attribute clusterRevision default = 2; + ram attribute clusterRevision default = 3; handle command RegisterClient; handle command RegisterClientResponse; diff --git a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap index cd8e9083ef2f4b..bc32dbce677fb2 100644 --- a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap +++ b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap @@ -702,6 +702,22 @@ "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": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, @@ -3536,6 +3552,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "MaximumCheckInBackOff", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "GeneratedCommandList", "code": 65528, @@ -3626,7 +3658,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/lit-icd-app/nrfconnect/CMakeLists.txt b/examples/lit-icd-app/nrfconnect/CMakeLists.txt index a9b921016670e7..36133c49ec12d1 100644 --- a/examples/lit-icd-app/nrfconnect/CMakeLists.txt +++ b/examples/lit-icd-app/nrfconnect/CMakeLists.txt @@ -21,14 +21,6 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) -# Set Kconfig root files that will be processed as a first Kconfig for used child images. -set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root) -set(multiprotocol_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root) - -if(NOT CONF_FILE STREQUAL "prj_no_dfu.conf") - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static_dfu.yml) -endif() - list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) @@ -40,6 +32,7 @@ target_compile_options(app PRIVATE -Werror -Wno-error=maybe-uninitialized) project(chip-nrfconnect-lit-icd-app-example) +include(${CHIP_ROOT}/config/nrfconnect/app/check-sysbuild-use.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/flashing.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) diff --git a/examples/lit-icd-app/nrfconnect/Kconfig.sysbuild b/examples/lit-icd-app/nrfconnect/Kconfig.sysbuild new file mode 100644 index 00000000000000..8877de44e2d570 --- /dev/null +++ b/examples/lit-icd-app/nrfconnect/Kconfig.sysbuild @@ -0,0 +1,76 @@ +# +# 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. +# + +#### Radio core selection +config NRF_DEFAULT_IPC_RADIO + default y + +# Enable IEEE802.15.4 serialization to network core +config NETCORE_IPC_RADIO_IEEE802154 + default y if SOC_SERIES_NRF53X + +# Enable Bluetooth serialization to network core +config NETCORE_IPC_RADIO_BT_HCI_IPC + default y if SOC_SERIES_NRF53X + +#### Bootloader +choice BOOTLOADER + default BOOTLOADER_MCUBOOT +endchoice + +if BOOTLOADER_MCUBOOT + +#### DFU multi-image support +config DFU_MULTI_IMAGE_PACKAGE_BUILD + default y + +config DFU_MULTI_IMAGE_PACKAGE_APP + default y + +config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY + default y + +#### DFU network core configuration +if SOC_SERIES_NRF53X + +config MCUBOOT_UPDATEABLE_IMAGES + default 2 + +choice MCUBOOT_MODE + default MCUBOOT_MODE_OVERWRITE_ONLY +endchoice + +choice BOOT_SIGNATURE_TYPE + default BOOT_SIGNATURE_TYPE_RSA +endchoice + +config SECURE_BOOT_NETCORE + default y + +config NETCORE_APP_UPDATE + default y + +config DFU_MULTI_IMAGE_PACKAGE_NET + default y + +endif # SOC_SERIES_NRF53X +endif # BOOTLOADER_MCUBOOT + +#### Enable generating factory data +config MATTER_FACTORY_DATA_GENERATE + default y + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/examples/lit-icd-app/nrfconnect/README.md b/examples/lit-icd-app/nrfconnect/README.md index 704950fdcac63e..1ff58274962fd9 100644 --- a/examples/lit-icd-app/nrfconnect/README.md +++ b/examples/lit-icd-app/nrfconnect/README.md @@ -1,5 +1,21 @@ # Matter nRF Connect LIT ICD Example Application +> **Note:** This example is intended only to perform smoke tests of a Matter +> solution integrated with nRF Connect SDK platform. The example quality is not +> production ready and it may contain minor bugs or use not optimal +> configuration. It is not recommended to use this example as a basis for +> creating a market ready product. +> +> For the production ready and optimized Matter samples, see +> [nRF Connect SDK samples](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/matter.html). +> The Matter samples in nRF Connect SDK use various additional software +> components and provide multiple optional features that improve the developer +> and user experience. To read more about it, see +> [Matter support in nRF Connect SDK](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/matter/index.html#ug-matter) +> page. Using Matter samples from nRF Connect SDK allows you to get a full +> Nordic technical support via [DevZone](https://devzone.nordicsemi.com/) +> portal. + The nRF Connect LIT ICD Example allows to test the device that utilizes Long Idle Time feature from the Intermittently Connected Device Management cluster. It uses buttons to change the device states and LEDs to show the state of these @@ -115,8 +131,8 @@ The example supports building and running on the following devices: | Hardware platform | Build target | Platform image | | ----------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | -| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk_nrf52840` |
nRF52840 DKnRF52840 DK
| -| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk_nrf5340_cpuapp` |
nRF5340 DKnRF5340 DK
| +| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk/nrf52840` |
nRF52840 DKnRF52840 DK
| +| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk/nrf5340/cpuapp` |
nRF5340 DKnRF5340 DK
|
@@ -248,14 +264,15 @@ Complete the following steps to build the sample: 2. Run the following command to build the example, with _build-target_ replaced with the build target name of the Nordic Semiconductor's kit you own, for - example `nrf52840dk_nrf52840`: + example `nrf52840dk/nrf52840`: - $ west build -b build-target + $ west build -b build-target --sysbuild You only need to specify the build target on the first build. See [Requirements](#requirements) for the build target names of compatible kits. -The output `zephyr.hex` file will be available in the `build/zephyr/` directory. +The output `zephyr.hex` file will be available in the `build/nrfconnect/zephyr/` +directory. ### Removing build artifacts @@ -270,7 +287,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DCONF_FILE=prj_release.conf + $ west build -b build-target --sysbuild -- -DFILE_SUFFIX=release Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -279,12 +296,6 @@ Semiconductor's kit you own. Support for DFU using Matter OTA is enabled by default. -To completely disable support for DFU, run the following command with -_build-target_ replaced with the build target name of the Nordic Semiconductor -kit you are using (for example `nrf52840dk_nrf52840`): - - $ west build -b build-target -- -DCONF_FILE=prj_no_dfu.conf - > **Note**: > > There are two types of Device Firmware Upgrade modes: single-image DFU and @@ -297,7 +308,7 @@ kit you are using (for example `nrf52840dk_nrf52840`): #### Changing bootloader configuration To change the default MCUboot configuration, edit the `prj.conf` file located in -the `child_image/mcuboot` directory. +the `sysbuild/mcuboot` directory. Make sure to keep the configuration consistent with changes made to the application configuration. This is necessary for the configuration to work, as @@ -314,8 +325,9 @@ purposes. You can change these settings by defining This example uses this option to define using an external flash. To modify the flash settings of your board (that is, your _build-target_, for -example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the -`configuration/build-target/` directory. +example `nrf52840dk/nrf52840`), edit the `pm_static_.yml` file +(for example `pm_static_nrf52840dk_nrf52840.yml`), located in the main +application directory.
@@ -327,7 +339,7 @@ using the menuconfig utility. To open the menuconfig utility, run the following command from the example directory: - $ west build -b build-target -t menuconfig + $ west build -b build-target --sysbuild -t menuconfig Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -357,8 +369,6 @@ depending on the selected board: command-line shell. - release -- Release version of the application - can be used to enable only the necessary application functionalities to optimize its performance. -- no_dfu -- Debug version of the application without Device Firmware Upgrade - feature support. For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) diff --git a/examples/lit-icd-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf b/examples/lit-icd-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf deleted file mode 100644 index 48deaa9fa18135..00000000000000 --- a/examples/lit-icd-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf +++ /dev/null @@ -1,25 +0,0 @@ -# -# 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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/lit-icd-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf b/examples/lit-icd-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf deleted file mode 100644 index 48deaa9fa18135..00000000000000 --- a/examples/lit-icd-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf +++ /dev/null @@ -1,25 +0,0 @@ -# -# 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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/pump-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml b/examples/lit-icd-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml similarity index 100% rename from examples/pump-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml rename to examples/lit-icd-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml diff --git a/examples/pump-controller-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml b/examples/lit-icd-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml similarity index 100% rename from examples/pump-controller-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml rename to examples/lit-icd-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml diff --git a/examples/lit-icd-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml b/examples/lit-icd-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml new file mode 100644 index 00000000000000..10e8680c363a53 --- /dev/null +++ b/examples/lit-icd-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml @@ -0,0 +1,56 @@ +mcuboot: + address: 0x0 + size: 0x8000 + region: flash_primary +mcuboot_pad: + address: 0x8000 + size: 0x200 +app: + address: 0x8200 + size: 0xf2e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x8000 + size: 0xf3000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x8200 + size: 0xf2e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x0 + size: 0xf3000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xf3000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x133000 + size: 0x6CD000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/examples/lit-icd-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml b/examples/lit-icd-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml new file mode 100644 index 00000000000000..10e8680c363a53 --- /dev/null +++ b/examples/lit-icd-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml @@ -0,0 +1,56 @@ +mcuboot: + address: 0x0 + size: 0x8000 + region: flash_primary +mcuboot_pad: + address: 0x8000 + size: 0x200 +app: + address: 0x8200 + size: 0xf2e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x8000 + size: 0xf3000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x8200 + size: 0xf2e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x0 + size: 0xf3000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xf3000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x133000 + size: 0x6CD000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/examples/lit-icd-app/nrfconnect/prj.conf b/examples/lit-icd-app/nrfconnect/prj.conf index 950be7c8c394e4..a21c89fd5c0009 100644 --- a/examples/lit-icd-app/nrfconnect/prj.conf +++ b/examples/lit-icd-app/nrfconnect/prj.conf @@ -23,6 +23,13 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_STD_CPP17=y +# Enable Matter pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/lit-icd-app/nrfconnect/prj_no_dfu.conf b/examples/lit-icd-app/nrfconnect/prj_no_dfu.conf deleted file mode 100644 index 00607e349a31ab..00000000000000 --- a/examples/lit-icd-app/nrfconnect/prj_no_dfu.conf +++ /dev/null @@ -1,48 +0,0 @@ -# -# 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. -# - -# This sample uses Kconfig.defaults to set options common for all -# samples. This file should contain only options specific for this sample -# or overrides of default values. - -# Enable CHIP -CONFIG_CHIP=y -CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" -CONFIG_STD_CPP17=y - -# Add support for LEDs and buttons on Nordic development kits -CONFIG_DK_LIBRARY=y - -# Bluetooth Low Energy configuration -CONFIG_BT_DEVICE_NAME="MatterLIT" - -# Other settings -CONFIG_THREAD_NAME=y -CONFIG_MPU_STACK_GUARD=y -CONFIG_RESET_ON_FATAL_ERROR=n - -# Reduce application size -CONFIG_USE_SEGGER_RTT=n - -# Disable Matter OTA DFU -CONFIG_CHIP_OTA_REQUESTOR=n - -# Disable QSPI NOR -CONFIG_CHIP_QSPI_NOR=n - -# Enable LIT ICD configuration -CONFIG_CHIP_ENABLE_ICD_SUPPORT=y -CONFIG_CHIP_ICD_LIT_SUPPORT=y diff --git a/examples/lit-icd-app/nrfconnect/prj_release.conf b/examples/lit-icd-app/nrfconnect/prj_release.conf index 61b6b3dfc6f8f8..9ae438428f602d 100644 --- a/examples/lit-icd-app/nrfconnect/prj_release.conf +++ b/examples/lit-icd-app/nrfconnect/prj_release.conf @@ -23,6 +23,13 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_STD_CPP17=y +# Enable Matter pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf b/examples/lit-icd-app/nrfconnect/sysbuild.conf similarity index 90% rename from examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf rename to examples/lit-icd-app/nrfconnect/sysbuild.conf index cd9aab4101c6f5..d0c5eee2b93c39 100644 --- a/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf +++ b/examples/lit-icd-app/nrfconnect/sysbuild.conf @@ -1,5 +1,5 @@ # -# 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. @@ -14,4 +14,4 @@ # limitations under the License. # -CONFIG_GPIO=y +SB_CONFIG_MATTER=y diff --git a/examples/lit-icd-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf b/examples/lit-icd-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf new file mode 100644 index 00000000000000..8540585e53358b --- /dev/null +++ b/examples/lit-icd-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf @@ -0,0 +1,58 @@ +# +# 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. +# + +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# 802.15.4 configuration +CONFIG_NRF_802154_SER_RADIO=y +CONFIG_NRF_802154_ENCRYPTION=y +CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=2 + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_DEBUG_INFO=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y +CONFIG_IPC_RADIO_802154=y diff --git a/examples/lit-icd-app/nrfconnect/sysbuild/ipc_radio/prj.conf b/examples/lit-icd-app/nrfconnect/sysbuild/ipc_radio/prj.conf new file mode 100644 index 00000000000000..8906415dda4fc7 --- /dev/null +++ b/examples/lit-icd-app/nrfconnect/sysbuild/ipc_radio/prj.conf @@ -0,0 +1,21 @@ +# +# 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. +# + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=n diff --git a/examples/lit-icd-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf b/examples/lit-icd-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf new file mode 100644 index 00000000000000..7f92a51630cce0 --- /dev/null +++ b/examples/lit-icd-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf @@ -0,0 +1,20 @@ +# +# 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. +# +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=y diff --git a/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/app.overlay b/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/app.overlay new file mode 100644 index 00000000000000..74d3dfbfd22f30 --- /dev/null +++ b/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/app.overlay @@ -0,0 +1,5 @@ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf b/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf new file mode 100644 index 00000000000000..50610217c762b5 --- /dev/null +++ b/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf @@ -0,0 +1,19 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 diff --git a/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000000..2d86fe6442dd39 --- /dev/null +++ b/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -0,0 +1,35 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 + +CONFIG_BOOT_SWAP_USING_MOVE=n +# Multi-image updates do not support image swapping yet. +CONFIG_BOOT_UPGRADE_ONLY=y + +# The network core cannot access external flash directly. The flash simulator must be used to +# provide a memory region that is used to forward the new firmware to the network core. +CONFIG_FLASH_SIMULATOR=y +CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y +CONFIG_FLASH_SIMULATOR_STATS=n + +CONFIG_ZCBOR=y diff --git a/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/prj.conf b/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/prj.conf new file mode 100644 index 00000000000000..3bcb12fe7b8d25 --- /dev/null +++ b/examples/lit-icd-app/nrfconnect/sysbuild/mcuboot/prj.conf @@ -0,0 +1,49 @@ +# +# 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. +# + +CONFIG_MAIN_STACK_SIZE=10240 + +CONFIG_BOOT_SWAP_SAVE_ENCTLV=n +CONFIG_BOOT_BOOTSTRAP=n +CONFIG_PM=n + +CONFIG_FLASH=y +CONFIG_FPROTECT=y + +CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" + +# Use minimal C library instead of the Picolib +CONFIG_MINIMAL_LIBC=y + +# Bootloader size optimization +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_GPIO=n + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +CONFIG_LOG=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_NCS_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/lock-app/infineon/cyw30739/README.md b/examples/lock-app/infineon/cyw30739/README.md index 2b7bd2094154df..0c9b769b665c2a 100644 --- a/examples/lock-app/infineon/cyw30739/README.md +++ b/examples/lock-app/infineon/cyw30739/README.md @@ -12,7 +12,7 @@ An example showing the use of Matter on the Infineon CYW30739 platform. - [Installing ModusToolbox™ Software](#installing-modustoolbox-software) - [ModusToolbox™ tools package](#modustoolbox-tools-package) - [Note for WSL (Windows Subsystem for Linux)](#note-for-wsl-windows-subsystem-for-linux) - - [Checkout Submodules](#checkout-submodules) + - [Checkout Submodules and Bootstrap](#checkout-submodules-and-bootstrap) - [Building](#building) - [Factory Data](#factory-data) - [Commissionable Data](#commissionable-data) @@ -65,7 +65,7 @@ If you are using WSL, please ensure you have installed the ModusToolbox™ Software for Linux. Running Windows tools directly from the WSL command line would cause path resolution failure in the build process. -### Checkout Submodules +### Checkout Submodules and Bootstrap Before building the example, check out the Matter repository and sync submodules using the following command: @@ -73,6 +73,7 @@ using the following command: ```bash $ cd ~/connectedhomeip $ scripts/checkout_submodules.py --platform infineon +$ bash scripts/bootstrap.sh -p all,infineon ``` ## Building diff --git a/examples/lock-app/infineon/psoc6/BUILD.gn b/examples/lock-app/infineon/psoc6/BUILD.gn index 37ee666f5190f5..3c9be12a5417e6 100644 --- a/examples/lock-app/infineon/psoc6/BUILD.gn +++ b/examples/lock-app/infineon/psoc6/BUILD.gn @@ -44,32 +44,38 @@ config("psoc6_ota_config") { ldflags = [ "-T" + rebase_path(linker_script, root_build_dir) ] - ldflags += [ "-Wl,--defsym,MCUBOOT_HEADER_SIZE=0x400,--defsym,MCUBOOT_BOOTLOADER_SIZE=0x18000,--defsym,CY_BOOT_PRIMARY_1_SIZE=0x1C0000" ] + ldflags += [ "-Wl,--undefined=uxTopUsedPriority -Wl,--defsym,MCUBOOT_HEADER_SIZE=0x400,--defsym,FLASH_AREA_IMG_1_PRIMARY_START=0x028000,--defsym,FLASH_AREA_IMG_1_PRIMARY_SIZE=0x1c0000" ] defines = [ "P6_OTA", - "OTA_SUPPORT ", - "OTA_USE_EXTERNAL_FLASH", - "CY_BOOT_USE_EXTERNAL_FLASH", - "MCUBOOT_HEADER_SIZE=0x400", - "MCUBOOT_MAX_IMG_SECTORS=3584", - "CY_BOOT_SCRATCH_SIZE=0x00004000", - "MCUBOOT_BOOTLOADER_SIZE=0x00018000", - "CY_BOOT_BOOTLOADER_SIZE=0x00018000", - "CY_BOOT_PRIMARY_1_START=0x00018000", - "CY_BOOT_PRIMARY_1_SIZE=0x1C0000", - "CY_BOOT_SECONDARY_1_START=0x00000000", - "CY_BOOT_SECONDARY_1_SIZE=0x001C0000", - "CY_FLASH_ERASE_VALUE=0xFF", + "COMPONENT_MCUBOOT", + "CY_BOOTLOADER=MCUBOOT", + "OTA_SUPPORT=1", + "COMPONENT_OTA_PSOC_062", + "PSOC_062_2M", + "OTA_USE_EXTERNAL_FLASH=1", + "ENABLE_OTA_LOGS", + "ENABLE_OTA_BOOTLOADER_ABSTRACTION_LOGS", "MCUBOOT_IMAGE_NUMBER=1", - "MCUBOOT_SLOT_SIZE=0x1C0000", - "MCUBOOT_SCRATCH_SIZE=0x4000", - "MCUBOOT_SECTOR_SIZE = 512", + "MCUBOOT_MAX_IMG_SECTORS=3584", + "FLASH_AREA_BOOTLOADER_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'", + "FLASH_AREA_BOOTLOADER_SIZE=0x028000", + "FLASH_AREA_BOOTLOADER_START=0x000000", + "FLASH_AREA_IMAGE_SCRATCH_DEV_ID='FLASH_DEVICE_EXTERNAL_FLASH(CY_BOOT_EXTERNAL_DEVICE_INDEX)'", + "FLASH_AREA_IMAGE_SCRATCH_SIZE=0x080000", + "FLASH_AREA_IMAGE_SCRATCH_START=0x440000", + "FLASH_AREA_IMAGE_SWAP_STATUS_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'", + "FLASH_AREA_IMAGE_SWAP_STATUS_SIZE=0x006c00", + "FLASH_AREA_IMAGE_SWAP_STATUS_START=0x1e8000", + "FLASH_AREA_IMG_1_PRIMARY_DEV_ID='FLASH_DEVICE_INTERNAL_FLASH'", + "FLASH_AREA_IMG_1_PRIMARY_SIZE=0x1c0000", + "FLASH_AREA_IMG_1_PRIMARY_START=0x028000", + "FLASH_AREA_IMG_1_SECONDARY_DEV_ID='FLASH_DEVICE_EXTERNAL_FLASH(CY_BOOT_EXTERNAL_DEVICE_INDEX)'", + "FLASH_AREA_IMG_1_SECONDARY_SIZE=0x1c0000", + "FLASH_AREA_IMG_1_SECONDARY_START=0x000200", "APP_VERSION_MAJOR=1", "APP_VERSION_MINOR=0", "APP_VERSION_BUILD=0", - "MCUBOOT_OVERWRITE_ONLY", - "CY_ENABLE_XIP_PROGRAM", ] if (build_update_image) { @@ -85,7 +91,7 @@ psoc6_sdk_sources("lock_app_sdk_sources") { defines = [ "BOARD_ID=${psoc6_board}", - "P6_LOG_ENABLED=1", + "PSOC6_LOG_ENABLED=1", "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setup_pin_code}", ] diff --git a/examples/lock-app/infineon/psoc6/include/AppConfig.h b/examples/lock-app/infineon/psoc6/include/AppConfig.h index 41ff70e1f94b71..34355aa262dde9 100644 --- a/examples/lock-app/infineon/psoc6/include/AppConfig.h +++ b/examples/lock-app/infineon/psoc6/include/AppConfig.h @@ -52,14 +52,14 @@ #define THREAD_ACTIVE_POLLING_INTERVAL_MS 100 #define THREAD_INACTIVE_POLLING_INTERVAL_MS 1000 -// P6 Logging +// PSOC6 Logging #ifdef __cplusplus extern "C" { #endif void appError(int err); -void P6Log(const char * aFormat, ...); -#define P6_LOG(...) P6Log(__VA_ARGS__) +void PSOC6Log(const char * aFormat, ...); +#define PSOC6_LOG(...) PSOC6Log(__VA_ARGS__) #ifdef __cplusplus } diff --git a/examples/lock-app/infineon/psoc6/include/AppTask.h b/examples/lock-app/infineon/psoc6/include/AppTask.h index b120a9c9aec325..d72b1c32996269 100644 --- a/examples/lock-app/infineon/psoc6/include/AppTask.h +++ b/examples/lock-app/infineon/psoc6/include/AppTask.h @@ -30,6 +30,10 @@ #include #include +extern "C" { +#include "flash_map_backend.h" +} + // Application-defined error codes in the CHIP_ERROR space. #define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) #define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02) diff --git a/examples/lock-app/infineon/psoc6/include/CHIPProjectConfig.h b/examples/lock-app/infineon/psoc6/include/CHIPProjectConfig.h index b069e13284c07d..e5c8c8ed7e790f 100644 --- a/examples/lock-app/infineon/psoc6/include/CHIPProjectConfig.h +++ b/examples/lock-app/infineon/psoc6/include/CHIPProjectConfig.h @@ -38,10 +38,10 @@ #define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8006 /* The ProductName attribute of the Basic cluster. */ -#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME "P6-CYW43012 Lock" +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME "PSOC6-CYW43012 Lock" /* The HardwareVersionString attribute of the Basic cluster. */ -#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING "P6-43012" +#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING "PSOC6-43012" /* The HardwareVersion attribute of the Basic cluster. */ #define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION 43012 diff --git a/examples/lock-app/infineon/psoc6/src/AppTask.cpp b/examples/lock-app/infineon/psoc6/src/AppTask.cpp index 106da8eecbf69f..54178c21c98f65 100644 --- a/examples/lock-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/lock-app/infineon/psoc6/src/AppTask.cpp @@ -179,7 +179,7 @@ CHIP_ERROR AppTask::StartAppTask() sAppEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent)); if (sAppEventQueue == NULL) { - P6_LOG("Failed to allocate app event queue"); + PSOC6_LOG("Failed to allocate app event queue"); appError(APP_ERROR_EVENT_QUEUE_FAILED); } @@ -193,7 +193,7 @@ void AppTask::lockMgr_Init() CHIP_ERROR err = CHIP_NO_ERROR; NetWorkCommissioningInstInit(); - P6_LOG("Current Software Version: %d", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); + PSOC6_LOG("Current Software Version: %d", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); // Initial lock state chip::app::DataModel::Nullable state; chip::EndpointId endpointId{ 1 }; @@ -258,7 +258,7 @@ void AppTask::lockMgr_Init() .GetLockParam()); if (err != CHIP_NO_ERROR) { - P6_LOG("LockMgr().Init() failed"); + PSOC6_LOG("LockMgr().Init() failed"); appError(err); } @@ -287,10 +287,10 @@ void AppTask::lockMgr_Init() void AppTask::Init() { #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - int rc = boot_set_confirmed(); + int rc = flash_area_boot_set_confirmed(); if (rc != 0) { - P6_LOG("boot_set_confirmed failed"); + PSOC6_LOG("flash_area_boot_set_confirmed failed"); appError(CHIP_ERROR_UNINITIALIZED); } #endif @@ -306,7 +306,7 @@ void AppTask::Init() ); if (sFunctionTimer == NULL) { - P6_LOG("funct timer create failed"); + PSOC6_LOG("funct timer create failed"); appError(APP_ERROR_CREATE_TIMER_FAILED); } @@ -333,7 +333,7 @@ void AppTask::AppTaskMain(void * pvParameter) AppEvent event; sAppTask.Init(); - P6_LOG("App Task started"); + PSOC6_LOG("App Task started"); while (true) { @@ -403,11 +403,11 @@ void AppTask::LockActionEventHandler(AppEvent * event) case AppEvent::kEventType_Button: { - P6_LOG("%s [Action: %d]", __FUNCTION__, event->ButtonEvent.Action); + PSOC6_LOG("%s [Action: %d]", __FUNCTION__, event->ButtonEvent.Action); if (event->ButtonEvent.Action == APP_BUTTON_LONG_PRESS) { - P6_LOG("Sending a lock jammed event"); + PSOC6_LOG("Sending a lock jammed event"); /* Generating Door Lock Jammed event */ DoorLockServer::Instance().SendLockAlarmEvent(1 /* Endpoint Id */, AlarmCodeEnum::kLockJammed); @@ -436,7 +436,7 @@ void AppTask::LockActionEventHandler(AppEvent * event) if (!LockMgr().InitiateAction(actor, action)) { - P6_LOG("Action is already in progress or active."); + PSOC6_LOG("Action is already in progress or active."); } } @@ -499,7 +499,8 @@ void AppTask::FunctionHandler(AppEvent * event) { if (!sAppTask.mFunctionTimerActive && sAppTask.mFunction == Function::kNoneSelected) { - P6_LOG("Factory Reset Triggered. Press button again within %us to cancel.", FACTORY_RESET_CANCEL_WINDOW_TIMEOUT / 1000); + PSOC6_LOG("Factory Reset Triggered. Press button again within %us to cancel.", + FACTORY_RESET_CANCEL_WINDOW_TIMEOUT / 1000); // Start timer for FACTORY_RESET_CANCEL_WINDOW_TIMEOUT to allow user to // cancel, if required. sAppTask.StartTimer(FACTORY_RESET_CANCEL_WINDOW_TIMEOUT); @@ -525,7 +526,7 @@ void AppTask::FunctionHandler(AppEvent * event) // canceled. sAppTask.mFunction = Function::kNoneSelected; - P6_LOG("Factory Reset has been Canceled"); + PSOC6_LOG("Factory Reset has been Canceled"); } } } @@ -534,7 +535,7 @@ void AppTask::CancelTimer() { if (xTimerStop(sFunctionTimer, 0) == pdFAIL) { - P6_LOG("app timer stop() failed"); + PSOC6_LOG("app timer stop() failed"); appError(APP_ERROR_STOP_TIMER_FAILED); } @@ -545,7 +546,7 @@ void AppTask::StartTimer(uint32_t aTimeoutInMs) { if (xTimerIsTimerActive(sFunctionTimer)) { - P6_LOG("app timer already started!"); + PSOC6_LOG("app timer already started!"); CancelTimer(); } @@ -554,7 +555,7 @@ void AppTask::StartTimer(uint32_t aTimeoutInMs) // cannot immediately be sent to the timer command queue. if (xTimerChangePeriod(sFunctionTimer, aTimeoutInMs / portTICK_PERIOD_MS, 100) != pdPASS) { - P6_LOG("app timer start() failed"); + PSOC6_LOG("app timer start() failed"); appError(APP_ERROR_START_TIMER_FAILED); } @@ -567,11 +568,11 @@ void AppTask::ActionInitiated(LockManager::Action_t aAction, int32_t aActor) // and start flashing the LEDs rapidly to indicate action initiation. if (aAction == LockManager::LOCK_ACTION) { - P6_LOG("Lock Action has been initiated"); + PSOC6_LOG("Lock Action has been initiated"); } else if (aAction == LockManager::UNLOCK_ACTION) { - P6_LOG("Unlock Action has been initiated"); + PSOC6_LOG("Unlock Action has been initiated"); } if (aActor == AppEvent::kEventType_Button) @@ -589,13 +590,13 @@ void AppTask::ActionCompleted(LockManager::Action_t aAction) // Turn off the lock LED if in an UNLOCKED state. if (aAction == LockManager::LOCK_ACTION) { - P6_LOG("Lock Action has been completed"); + PSOC6_LOG("Lock Action has been completed"); sLockLED.Set(true); } else if (aAction == LockManager::UNLOCK_ACTION) { - P6_LOG("Unlock Action has been completed"); + PSOC6_LOG("Unlock Action has been completed"); sLockLED.Set(false); } @@ -641,11 +642,11 @@ void AppTask::PostEvent(const AppEvent * event) } if (!status) - P6_LOG("Failed to post event to app task event queue"); + PSOC6_LOG("Failed to post event to app task event queue"); } else { - P6_LOG("Event Queue is NULL should never happen"); + PSOC6_LOG("Event Queue is NULL should never happen"); } } @@ -657,7 +658,7 @@ void AppTask::DispatchEvent(AppEvent * event) } else { - P6_LOG("Event received with no handler. Dropping event."); + PSOC6_LOG("Event received with no handler. Dropping event."); } } @@ -674,7 +675,7 @@ void AppTask::UpdateCluster(intptr_t context) : Protocols::InteractionModel::Status::Failure; if (status != Protocols::InteractionModel::Status::Success) { - P6_LOG("ERR: updating lock state %x", to_underlying(status)); + PSOC6_LOG("ERR: updating lock state %x", to_underlying(status)); } } @@ -705,7 +706,7 @@ void AppTask::InitOTARequestor() gRequestorUser.Init(&gRequestorCore, &gImageProcessor); - P6_LOG("Current Software Version: %u", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); - P6_LOG("Current Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); + PSOC6_LOG("Current Software Version: %u", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); + PSOC6_LOG("Current Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); } #endif diff --git a/examples/lock-app/infineon/psoc6/src/LockManager.cpp b/examples/lock-app/infineon/psoc6/src/LockManager.cpp index 4fed23346571dc..70af147902c8a6 100644 --- a/examples/lock-app/infineon/psoc6/src/LockManager.cpp +++ b/examples/lock-app/infineon/psoc6/src/LockManager.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include LockManager LockManager::sLock; @@ -90,7 +90,7 @@ CHIP_ERROR LockManager::Init(chip::app::DataModel::Nullable(&mLockUsers), - sizeof(EmberAfPluginDoorLockUserInfo) * ArraySize(mLockUsers), outLen); + PSOC6Config::ReadConfigValueBin(PSOC6Config::kConfigKey_LockUser, reinterpret_cast(&mLockUsers), + sizeof(EmberAfPluginDoorLockUserInfo) * ArraySize(mLockUsers), outLen); - P6Config::ReadConfigValueBin(P6Config::kConfigKey_Credential, reinterpret_cast(&mLockCredentials), - sizeof(EmberAfPluginDoorLockCredentialInfo) * kMaxCredentials * kNumCredentialTypes, outLen); + PSOC6Config::ReadConfigValueBin(PSOC6Config::kConfigKey_Credential, reinterpret_cast(&mLockCredentials), + sizeof(EmberAfPluginDoorLockCredentialInfo) * kMaxCredentials * kNumCredentialTypes, outLen); - P6Config::ReadConfigValueBin(P6Config::kConfigKey_LockUserName, reinterpret_cast(mUserNames), sizeof(mUserNames), - outLen); + PSOC6Config::ReadConfigValueBin(PSOC6Config::kConfigKey_LockUserName, reinterpret_cast(mUserNames), + sizeof(mUserNames), outLen); - P6Config::ReadConfigValueBin(P6Config::kConfigKey_CredentialData, reinterpret_cast(mCredentialData), - sizeof(mCredentialData), outLen); + PSOC6Config::ReadConfigValueBin(PSOC6Config::kConfigKey_CredentialData, reinterpret_cast(mCredentialData), + sizeof(mCredentialData), outLen); - P6Config::ReadConfigValueBin(P6Config::kConfigKey_UserCredentials, reinterpret_cast(mCredentials), - sizeof(CredentialStruct) * LockParams.numberOfUsers * kMaxCredentials, outLen); + PSOC6Config::ReadConfigValueBin(PSOC6Config::kConfigKey_UserCredentials, reinterpret_cast(mCredentials), + sizeof(CredentialStruct) * LockParams.numberOfUsers * kMaxCredentials, outLen); - P6Config::ReadConfigValueBin(P6Config::kConfigKey_WeekDaySchedules, reinterpret_cast(mWeekdaySchedule), - sizeof(EmberAfPluginDoorLockWeekDaySchedule) * LockParams.numberOfWeekdaySchedulesPerUser * - LockParams.numberOfUsers, - outLen); + PSOC6Config::ReadConfigValueBin(PSOC6Config::kConfigKey_WeekDaySchedules, reinterpret_cast(mWeekdaySchedule), + sizeof(EmberAfPluginDoorLockWeekDaySchedule) * LockParams.numberOfWeekdaySchedulesPerUser * + LockParams.numberOfUsers, + outLen); - P6Config::ReadConfigValueBin(P6Config::kConfigKey_YearDaySchedules, reinterpret_cast(mYeardaySchedule), - sizeof(EmberAfPluginDoorLockYearDaySchedule) * LockParams.numberOfYeardaySchedulesPerUser * - LockParams.numberOfUsers, - outLen); + PSOC6Config::ReadConfigValueBin(PSOC6Config::kConfigKey_YearDaySchedules, reinterpret_cast(mYeardaySchedule), + sizeof(EmberAfPluginDoorLockYearDaySchedule) * LockParams.numberOfYeardaySchedulesPerUser * + LockParams.numberOfUsers, + outLen); - P6Config::ReadConfigValueBin(P6Config::kConfigKey_HolidaySchedules, reinterpret_cast(&(mHolidaySchedule)), - sizeof(EmberAfPluginDoorLockHolidaySchedule) * LockParams.numberOfHolidaySchedules, outLen); + PSOC6Config::ReadConfigValueBin(PSOC6Config::kConfigKey_HolidaySchedules, reinterpret_cast(&(mHolidaySchedule)), + sizeof(EmberAfPluginDoorLockHolidaySchedule) * LockParams.numberOfHolidaySchedules, outLen); return true; } @@ -228,7 +228,7 @@ void LockManager::StartTimer(uint32_t aTimeoutMs) { if (xTimerIsTimerActive(sLockTimer)) { - P6_LOG("app timer already started!"); + PSOC6_LOG("app timer already started!"); CancelTimer(); } @@ -237,7 +237,7 @@ void LockManager::StartTimer(uint32_t aTimeoutMs) // cannot immediately be sent to the timer command queue. if (xTimerChangePeriod(sLockTimer, (aTimeoutMs / portTICK_PERIOD_MS), 100) != pdPASS) { - P6_LOG("sLockTimer timer start() failed"); + PSOC6_LOG("sLockTimer timer start() failed"); appError(APP_ERROR_START_TIMER_FAILED); } } @@ -246,7 +246,7 @@ void LockManager::CancelTimer(void) { if (xTimerStop(sLockTimer, 0) == pdFAIL) { - P6_LOG("sLockTimer stop() failed"); + PSOC6_LOG("sLockTimer stop() failed"); appError(APP_ERROR_STOP_TIMER_FAILED); } } @@ -393,14 +393,14 @@ bool LockManager::SetUser(chip::EndpointId endpointId, uint16_t userIndex, chip: userInStorage.credentials = chip::Span(mCredentials[userIndex], totalCredentials); // Save user information in NVM flash - P6Config::WriteConfigValueBin(P6Config::kConfigKey_LockUser, reinterpret_cast(&mLockUsers), - sizeof(EmberAfPluginDoorLockUserInfo) * LockParams.numberOfUsers); + PSOC6Config::WriteConfigValueBin(PSOC6Config::kConfigKey_LockUser, reinterpret_cast(&mLockUsers), + sizeof(EmberAfPluginDoorLockUserInfo) * LockParams.numberOfUsers); - P6Config::WriteConfigValueBin(P6Config::kConfigKey_UserCredentials, reinterpret_cast(mCredentials), - sizeof(CredentialStruct) * LockParams.numberOfUsers * kMaxCredentials); + PSOC6Config::WriteConfigValueBin(PSOC6Config::kConfigKey_UserCredentials, reinterpret_cast(mCredentials), + sizeof(CredentialStruct) * LockParams.numberOfUsers * kMaxCredentials); - P6Config::WriteConfigValueBin(P6Config::kConfigKey_LockUserName, reinterpret_cast(mUserNames), - sizeof(mUserNames)); + PSOC6Config::WriteConfigValueBin(PSOC6Config::kConfigKey_LockUserName, reinterpret_cast(mUserNames), + sizeof(mUserNames)); ChipLogProgress(Zcl, "Successfully set the user [mEndpointId=%d,index=%d]", endpointId, userIndex); @@ -481,11 +481,11 @@ bool LockManager::SetCredential(chip::EndpointId endpointId, uint16_t credential chip::ByteSpan{ mCredentialData[to_underlying(credentialType)][credentialIndex], credentialData.size() }; // Save credential information in NVM flash - P6Config::WriteConfigValueBin(P6Config::kConfigKey_Credential, reinterpret_cast(&mLockCredentials), - sizeof(EmberAfPluginDoorLockCredentialInfo) * kMaxCredentials * kNumCredentialTypes); + PSOC6Config::WriteConfigValueBin(PSOC6Config::kConfigKey_Credential, reinterpret_cast(&mLockCredentials), + sizeof(EmberAfPluginDoorLockCredentialInfo) * kMaxCredentials * kNumCredentialTypes); - P6Config::WriteConfigValueBin(P6Config::kConfigKey_CredentialData, reinterpret_cast(&mCredentialData), - sizeof(mCredentialData)); + PSOC6Config::WriteConfigValueBin(PSOC6Config::kConfigKey_CredentialData, reinterpret_cast(&mCredentialData), + sizeof(mCredentialData)); ChipLogProgress(Zcl, "Successfully set the credential [credentialType=%u]", to_underlying(credentialType)); @@ -540,9 +540,9 @@ DlStatus LockManager::SetWeekdaySchedule(chip::EndpointId endpointId, uint8_t we scheduleInStorage.status = status; // Save schedule information in NVM flash - P6Config::WriteConfigValueBin(P6Config::kConfigKey_WeekDaySchedules, reinterpret_cast(mWeekdaySchedule), - sizeof(EmberAfPluginDoorLockWeekDaySchedule) * LockParams.numberOfWeekdaySchedulesPerUser * - LockParams.numberOfUsers); + PSOC6Config::WriteConfigValueBin(PSOC6Config::kConfigKey_WeekDaySchedules, reinterpret_cast(mWeekdaySchedule), + sizeof(EmberAfPluginDoorLockWeekDaySchedule) * LockParams.numberOfWeekdaySchedulesPerUser * + LockParams.numberOfUsers); return DlStatus::kSuccess; } @@ -589,9 +589,9 @@ DlStatus LockManager::SetYeardaySchedule(chip::EndpointId endpointId, uint8_t ye scheduleInStorage.status = status; // Save schedule information in NVM flash - P6Config::WriteConfigValueBin(P6Config::kConfigKey_YearDaySchedules, reinterpret_cast(mYeardaySchedule), - sizeof(EmberAfPluginDoorLockYearDaySchedule) * LockParams.numberOfYeardaySchedulesPerUser * - LockParams.numberOfUsers); + PSOC6Config::WriteConfigValueBin(PSOC6Config::kConfigKey_YearDaySchedules, reinterpret_cast(mYeardaySchedule), + sizeof(EmberAfPluginDoorLockYearDaySchedule) * LockParams.numberOfYeardaySchedulesPerUser * + LockParams.numberOfUsers); return DlStatus::kSuccess; } @@ -633,8 +633,9 @@ DlStatus LockManager::SetHolidaySchedule(chip::EndpointId endpointId, uint8_t ho scheduleInStorage.status = status; // Save schedule information in NVM flash - P6Config::WriteConfigValueBin(P6Config::kConfigKey_HolidaySchedules, reinterpret_cast(&(mHolidaySchedule)), - sizeof(EmberAfPluginDoorLockHolidaySchedule) * LockParams.numberOfHolidaySchedules); + PSOC6Config::WriteConfigValueBin(PSOC6Config::kConfigKey_HolidaySchedules, + reinterpret_cast(&(mHolidaySchedule)), + sizeof(EmberAfPluginDoorLockHolidaySchedule) * LockParams.numberOfHolidaySchedules); return DlStatus::kSuccess; } diff --git a/examples/lock-app/infineon/psoc6/src/main.cpp b/examples/lock-app/infineon/psoc6/src/main.cpp index b14487e4bfe425..701b6eb04368b2 100644 --- a/examples/lock-app/infineon/psoc6/src/main.cpp +++ b/examples/lock-app/infineon/psoc6/src/main.cpp @@ -53,7 +53,7 @@ static void main_task(void * pvParameters); //================================================================================= void appError(int err) { - P6_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); + PSOC6_LOG("!!!!!!!!!!!! App Critical Error: %d !!!!!!!!!!!", err); portDISABLE_INTERRUPTS(); while (true) ; @@ -86,35 +86,35 @@ static void main_task(void * pvParameters) CHIP_ERROR ret = chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init(); if (ret != CHIP_NO_ERROR) { - P6_LOG("PersistedStorage::KeyValueStoreMgrImpl().Init() failed"); + PSOC6_LOG("PersistedStorage::KeyValueStoreMgrImpl().Init() failed"); appError(ret); } ret = PlatformMgr().InitChipStack(); if (ret != CHIP_NO_ERROR) { - P6_LOG("PlatformMgr().InitChipStack() failed"); + PSOC6_LOG("PlatformMgr().InitChipStack() failed"); appError(ret); } - ret = chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName("P6_LOCK"); + ret = chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName("PSOC6_LOCK"); if (ret != CHIP_NO_ERROR) { - P6_LOG("ConnectivityMgr().SetBLEDeviceName() failed"); + PSOC6_LOG("ConnectivityMgr().SetBLEDeviceName() failed"); appError(ret); } - P6_LOG("Starting Platform Manager Event Loop"); + PSOC6_LOG("Starting Platform Manager Event Loop"); ret = PlatformMgr().StartEventLoopTask(); if (ret != CHIP_NO_ERROR) { - P6_LOG("PlatformMgr().StartEventLoopTask() failed"); + PSOC6_LOG("PlatformMgr().StartEventLoopTask() failed"); appError(ret); } ret = GetAppTask().StartAppTask(); if (ret != CHIP_NO_ERROR) { - P6_LOG("GetAppTask().Init() failed"); + PSOC6_LOG("GetAppTask().Init() failed"); appError(ret); } @@ -127,7 +127,7 @@ static void main_task(void * pvParameters) // ================================================================================ int main(void) { - init_p6Platform(); + init_psoc6Platform(); #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR // Clear watchdog timer (started by bootloader) so that it doesn't trigger a reset cyhal_wdt_t wdt_obj; @@ -135,9 +135,9 @@ int main(void) cyhal_wdt_free(&wdt_obj); #endif - P6_LOG("==================================================\r\n"); - P6_LOG("chip-p6-lock-example starting Version %d\r\n", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); - P6_LOG("==================================================\r\n"); + PSOC6_LOG("==================================================\r\n"); + PSOC6_LOG("chip-psoc6-lock-example starting Version %d\r\n", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); + PSOC6_LOG("==================================================\r\n"); /* Start the FreeRTOS scheduler */ vTaskStartScheduler(); @@ -147,5 +147,5 @@ int main(void) PlatformMgr().Shutdown(); // Should never get here. - P6_LOG("vTaskStartScheduler() failed"); + PSOC6_LOG("vTaskStartScheduler() failed"); } diff --git a/examples/lock-app/lock-common/include/LockEndpoint.h b/examples/lock-app/lock-common/include/LockEndpoint.h index bd193d388db02b..aa67a69481f23d 100644 --- a/examples/lock-app/lock-common/include/LockEndpoint.h +++ b/examples/lock-app/lock-common/include/LockEndpoint.h @@ -18,7 +18,9 @@ #pragma once +#include #include +#include #include struct LockUserInfo @@ -38,10 +40,10 @@ struct WeekDaysScheduleInfo; struct YearDayScheduleInfo; struct HolidayScheduleInfo; -static constexpr size_t DOOR_LOCK_CREDENTIAL_INFO_MAX_DATA_SIZE = 20; -static constexpr size_t DOOR_LOCK_CREDENTIAL_INFO_MAX_TYPES = 6; +static constexpr size_t DOOR_LOCK_CREDENTIAL_INFO_MAX_DATA_SIZE = 65; +static constexpr size_t DOOR_LOCK_CREDENTIAL_INFO_MAX_TYPES = 9; -class LockEndpoint +class LockEndpoint : public chip::app::Clusters::DoorLock::Delegate { public: LockEndpoint(chip::EndpointId endpointId, uint16_t numberOfLockUsersSupported, uint16_t numberOfCredentialsSupported, @@ -60,6 +62,7 @@ class LockEndpoint } DoorLockServer::Instance().SetDoorState(endpointId, mDoorState); DoorLockServer::Instance().SetLockState(endpointId, mLockState); + chip::Crypto::DRBG_get_bytes(mAliroReaderGroupSubIdentifier, sizeof(mAliroReaderGroupSubIdentifier)); } inline chip::EndpointId GetEndpointId() const { return mEndpointId; } @@ -100,6 +103,22 @@ class LockEndpoint DlStatus SetSchedule(uint8_t holidayIndex, DlScheduleStatus status, uint32_t localStartTime, uint32_t localEndTime, OperatingModeEnum operatingMode); + // DoorLock::Delegate API. + CHIP_ERROR GetAliroReaderVerificationKey(chip::MutableByteSpan & verificationKey) override; + CHIP_ERROR GetAliroReaderGroupIdentifier(chip::MutableByteSpan & groupIdentifier) override; + CHIP_ERROR GetAliroReaderGroupSubIdentifier(chip::MutableByteSpan & groupSubIdentifier) override; + CHIP_ERROR GetAliroExpeditedTransactionSupportedProtocolVersionAtIndex(size_t index, + chip::MutableByteSpan & protocolVersion) override; + CHIP_ERROR GetAliroGroupResolvingKey(chip::MutableByteSpan & groupResolvingKey) override; + CHIP_ERROR GetAliroSupportedBLEUWBProtocolVersionAtIndex(size_t index, chip::MutableByteSpan & protocolVersion) override; + uint8_t GetAliroBLEAdvertisingVersion() override; + uint16_t GetNumberOfAliroCredentialIssuerKeysSupported() override; + uint16_t GetNumberOfAliroEndpointKeysSupported() override; + CHIP_ERROR SetAliroReaderConfig(const chip::ByteSpan & signingKey, const chip::ByteSpan & verificationKey, + const chip::ByteSpan & groupIdentifier, + const chip::Optional & groupResolvingKey) override; + CHIP_ERROR ClearAliroReaderConfig() override; + private: bool setLockState(const Nullable & fabricIdx, const Nullable & nodeId, DlLockState lockState, const Optional & pin, OperationErrorEnum & err, @@ -130,6 +149,14 @@ class LockEndpoint std::vector> mWeekDaySchedules; std::vector> mYearDaySchedules; std::vector mHolidaySchedules; + + // Actual Aliro state would presumably be stored somewhere else, and persistently; this + // example just stores it in memory for illustration purposes. + uint8_t mAliroReaderVerificationKey[chip::app::Clusters::DoorLock::kAliroReaderVerificationKeySize]; + uint8_t mAliroReaderGroupIdentifier[chip::app::Clusters::DoorLock::kAliroReaderGroupIdentifierSize]; + uint8_t mAliroReaderGroupSubIdentifier[chip::app::Clusters::DoorLock::kAliroReaderGroupSubIdentifierSize]; + uint8_t mAliroGroupResolvingKey[chip::app::Clusters::DoorLock::kAliroGroupResolvingKeySize]; + bool mAliroStateInitialized = false; }; struct LockCredentialInfo diff --git a/examples/lock-app/lock-common/include/LockManager.h b/examples/lock-app/lock-common/include/LockManager.h index 71dcf6f02dc072..fb4299a534622c 100644 --- a/examples/lock-app/lock-common/include/LockManager.h +++ b/examples/lock-app/lock-common/include/LockManager.h @@ -70,7 +70,12 @@ class LockManager private: LockEndpoint * getEndpoint(chip::EndpointId endpointId); - std::vector mEndpoints; + /** + * We store the LockEndpoint instances by pointer, not value, so + * LockEndpoint can have a stable location in memory, which lets it + * implement DoorLock::Delegate. + */ + std::vector> mEndpoints; static LockManager instance; }; diff --git a/examples/lock-app/lock-common/lock-app.matter b/examples/lock-app/lock-common/lock-app.matter index a484b095516dc6..7dca226d8287b5 100644 --- a/examples/lock-app/lock-common/lock-app.matter +++ b/examples/lock-app/lock-common/lock-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1754,7 +1825,7 @@ cluster UserLabel = 65 { /** Allows servers to ensure that listed clients are notified when a server is available for communication. */ cluster IcdManagement = 70 { - revision 2; + revision 3; enum ClientTypeEnum : enum8 { kPermanent = 0; @@ -1770,6 +1841,7 @@ cluster IcdManagement = 70 { kCheckInProtocolSupport = 0x1; kUserActiveModeTrigger = 0x2; kLongIdleTimeSupport = 0x4; + kDynamicSitLitSupport = 0x8; } bitmap UserActiveModeTriggerBitmap : bitmap32 { @@ -1808,6 +1880,7 @@ cluster IcdManagement = 70 { 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; @@ -2530,7 +2603,7 @@ endpoint 0 { callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 0; + ram attribute featureMap default = 1; callback attribute clusterRevision; } @@ -2899,7 +2972,7 @@ endpoint 0 { callback attribute activeModeDuration; callback attribute activeModeThreshold; ram attribute featureMap default = 0x0000; - ram attribute clusterRevision default = 2; + ram attribute clusterRevision default = 3; } } endpoint 1 { diff --git a/examples/lock-app/lock-common/lock-app.zap b/examples/lock-app/lock-common/lock-app.zap index 182645823f1065..8e25d9248c1429 100644 --- a/examples/lock-app/lock-common/lock-app.zap +++ b/examples/lock-app/lock-common/lock-app.zap @@ -401,7 +401,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "1", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -5023,7 +5023,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/lock-app/lock-common/src/LockEndpoint.cpp b/examples/lock-app/lock-common/src/LockEndpoint.cpp index bda27f18ba2c8c..5481d01471cfd0 100644 --- a/examples/lock-app/lock-common/src/LockEndpoint.cpp +++ b/examples/lock-app/lock-common/src/LockEndpoint.cpp @@ -17,10 +17,15 @@ */ #include "LockEndpoint.h" #include +#include #include +#include #include #include +using chip::ByteSpan; +using chip::MutableByteSpan; +using chip::Optional; using chip::to_underlying; using chip::app::DataModel::MakeNullable; @@ -204,7 +209,8 @@ bool LockEndpoint::GetCredential(uint16_t credentialIndex, CredentialTypeEnum cr if (credentialIndex >= mLockCredentials.at(to_underlying(credentialType)).size() || (0 == credentialIndex && CredentialTypeEnum::kProgrammingPIN != credentialType)) { - ChipLogError(Zcl, "Cannot get the credential - index out of range [endpoint=%d,index=%d]", mEndpointId, credentialIndex); + ChipLogError(Zcl, "Cannot get the credential - index out of range [endpoint=%d,index=%d]: %d", mEndpointId, credentialIndex, + static_cast(mLockCredentials.at(to_underlying(credentialType)).size())); return false; } @@ -407,6 +413,149 @@ DlStatus LockEndpoint::SetSchedule(uint8_t holidayIndex, DlScheduleStatus status return DlStatus::kSuccess; } +CHIP_ERROR LockEndpoint::GetAliroReaderVerificationKey(MutableByteSpan & verificationKey) +{ + if (!mAliroStateInitialized) + { + verificationKey.reduce_size(0); + return CHIP_NO_ERROR; + } + + return chip::CopySpanToMutableSpan(ByteSpan(mAliroReaderVerificationKey), verificationKey); +} + +CHIP_ERROR LockEndpoint::GetAliroReaderGroupIdentifier(MutableByteSpan & groupIdentifier) +{ + if (!mAliroStateInitialized) + { + groupIdentifier.reduce_size(0); + return CHIP_NO_ERROR; + } + + return CopySpanToMutableSpan(ByteSpan(mAliroReaderGroupIdentifier), groupIdentifier); +} + +CHIP_ERROR LockEndpoint::GetAliroReaderGroupSubIdentifier(MutableByteSpan & groupSubIdentifier) +{ + return CopySpanToMutableSpan(ByteSpan(mAliroReaderGroupSubIdentifier), groupSubIdentifier); +} + +namespace { + +CHIP_ERROR CopyProtocolVersionIntoSpan(uint16_t protocolVersionValue, MutableByteSpan & protocolVersion) +{ + using namespace chip::app::Clusters::DoorLock; + + static_assert(sizeof(protocolVersionValue) == kAliroProtocolVersionSize); + + if (protocolVersion.size() < kAliroProtocolVersionSize) + { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + // Per Aliro spec, protocol version encoding is big-endian + chip::Encoding::BigEndian::Put16(protocolVersion.data(), protocolVersionValue); + protocolVersion.reduce_size(kAliroProtocolVersionSize); + return CHIP_NO_ERROR; +} + +} // anonymous namespace + +CHIP_ERROR LockEndpoint::GetAliroExpeditedTransactionSupportedProtocolVersionAtIndex(size_t index, + MutableByteSpan & protocolVersion) +{ + // Only claim support for the one known protocol version for now: 0x0100. + constexpr uint16_t knownProtocolVersion = 0x0100; + + if (index > 0) + { + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; + } + + return CopyProtocolVersionIntoSpan(knownProtocolVersion, protocolVersion); +} + +CHIP_ERROR LockEndpoint::GetAliroGroupResolvingKey(MutableByteSpan & groupResolvingKey) +{ + if (!mAliroStateInitialized) + { + groupResolvingKey.reduce_size(0); + return CHIP_NO_ERROR; + } + + return CopySpanToMutableSpan(ByteSpan(mAliroGroupResolvingKey), groupResolvingKey); +} + +CHIP_ERROR LockEndpoint::GetAliroSupportedBLEUWBProtocolVersionAtIndex(size_t index, MutableByteSpan & protocolVersion) +{ + // Only claim support for the one known protocol version for now: 0x0100. + constexpr uint16_t knownProtocolVersion = 0x0100; + + if (index > 0) + { + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; + } + + return CopyProtocolVersionIntoSpan(knownProtocolVersion, protocolVersion); +} + +uint8_t LockEndpoint::GetAliroBLEAdvertisingVersion() +{ + // For now the only define value of the BLE advertising version for Aliro is 0. + return 0; +} + +uint16_t LockEndpoint::GetNumberOfAliroCredentialIssuerKeysSupported() +{ + using namespace chip::app::Clusters::DoorLock; + + // Our vector has an extra entry at index 0 that is not a valid entry, so + // the actual number of credentials supported is one length than the length. + return static_cast(mLockCredentials.at(to_underlying(CredentialTypeEnum::kAliroCredentialIssuerKey)).size() - 1); +} + +uint16_t LockEndpoint::GetNumberOfAliroEndpointKeysSupported() +{ + using namespace chip::app::Clusters::DoorLock; + + // Our vector has an extra entry at index 0 that is not a valid entry, so + // the actual number of credentials supported is one length than the length. + // + // Also, our arrays are the same size, so we just return the size of one of + // the arrays: that is the cap on the total number of endpoint keys + // supported, which can be of either type. + return static_cast(mLockCredentials.at(to_underlying(CredentialTypeEnum::kAliroEvictableEndpointKey)).size() - 1); +} + +CHIP_ERROR LockEndpoint::SetAliroReaderConfig(const ByteSpan & signingKey, const ByteSpan & verificationKey, + const ByteSpan & groupIdentifier, const Optional & groupResolvingKey) +{ + // We ignore the signing key, since we never do anything with it. + + VerifyOrReturnError(verificationKey.size() == sizeof(mAliroReaderVerificationKey), CHIP_ERROR_INVALID_ARGUMENT); + memcpy(mAliroReaderVerificationKey, verificationKey.data(), sizeof(mAliroReaderVerificationKey)); + + VerifyOrReturnError(groupIdentifier.size() == sizeof(mAliroReaderGroupIdentifier), CHIP_ERROR_INVALID_ARGUMENT); + memcpy(mAliroReaderGroupIdentifier, groupIdentifier.data(), sizeof(mAliroReaderGroupIdentifier)); + + if (groupResolvingKey.HasValue()) + { + VerifyOrReturnError(groupResolvingKey.Value().size() == sizeof(mAliroGroupResolvingKey), CHIP_ERROR_INVALID_ARGUMENT); + memcpy(mAliroGroupResolvingKey, groupResolvingKey.Value().data(), sizeof(mAliroGroupResolvingKey)); + } + + mAliroStateInitialized = true; + return CHIP_NO_ERROR; +} + +CHIP_ERROR LockEndpoint::ClearAliroReaderConfig() +{ + // A real implementation would clear out key data from the other parts of + // the application that might use it. + mAliroStateInitialized = false; + return CHIP_NO_ERROR; +} + bool LockEndpoint::setLockState(const Nullable & fabricIdx, const Nullable & nodeId, DlLockState lockState, const Optional & pin, OperationErrorEnum & err, OperationSourceEnum opSource) diff --git a/examples/lock-app/lock-common/src/LockManager.cpp b/examples/lock-app/lock-common/src/LockManager.cpp index 8fd1ef5441b139..8af66051883aa4 100644 --- a/examples/lock-app/lock-common/src/LockManager.cpp +++ b/examples/lock-app/lock-common/src/LockManager.cpp @@ -20,6 +20,7 @@ #include #include +#include using chip::to_underlying; @@ -98,8 +99,9 @@ bool LockManager::InitEndpoint(chip::EndpointId endpointId) numberOfHolidaySchedules = 10; } - mEndpoints.emplace_back(endpointId, numberOfSupportedUsers, numberOfSupportedCredentials, numberOfWeekDaySchedulesPerUser, - numberOfYearDaySchedulesPerUser, numberOfCredentialsSupportedPerUser, numberOfHolidaySchedules); + mEndpoints.emplace_back(std::make_unique(endpointId, numberOfSupportedUsers, numberOfSupportedCredentials, + numberOfWeekDaySchedulesPerUser, numberOfYearDaySchedulesPerUser, + numberOfCredentialsSupportedPerUser, numberOfHolidaySchedules)); ChipLogProgress(Zcl, "Initialized new lock door endpoint " @@ -107,6 +109,7 @@ bool LockManager::InitEndpoint(chip::EndpointId endpointId) "numberOfCredentialsSupportedPerUser=%d,holidaySchedules=%d]", endpointId, numberOfSupportedUsers, numberOfSupportedCredentials, numberOfWeekDaySchedulesPerUser, numberOfYearDaySchedulesPerUser, numberOfCredentialsSupportedPerUser, numberOfHolidaySchedules); + DoorLockServer::Instance().SetDelegate(endpointId, mEndpoints.back().get()); return true; } @@ -303,11 +306,11 @@ DlStatus LockManager::SetSchedule(chip::EndpointId endpointId, uint8_t holidayIn LockEndpoint * LockManager::getEndpoint(chip::EndpointId endpointId) { - for (auto & mEndpoint : mEndpoints) + for (auto & endpoint : mEndpoints) { - if (mEndpoint.GetEndpointId() == endpointId) + if (endpoint->GetEndpointId() == endpointId) { - return &mEndpoint; + return endpoint.get(); } } return nullptr; diff --git a/examples/lock-app/nrfconnect/CMakeLists.txt b/examples/lock-app/nrfconnect/CMakeLists.txt index 38e99561b3bbce..6c92305f378dec 100644 --- a/examples/lock-app/nrfconnect/CMakeLists.txt +++ b/examples/lock-app/nrfconnect/CMakeLists.txt @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -cmake_minimum_required(VERSION 3.13.1) +cmake_minimum_required(VERSION 3.20.0) get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) get_filename_component(NRFCONNECT_COMMON ${CHIP_ROOT}/examples/platform/nrfconnect REALPATH) @@ -21,15 +21,6 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) -# Set Kconfig root files that will be processed as a first Kconfig for used child images. -set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root) -set(multiprotocol_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root) -set(hci_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.hci_rpmsg.root) - -if(NOT CONF_FILE STREQUAL "prj_no_dfu.conf") - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static_dfu.yml) -endif() - list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) @@ -41,6 +32,7 @@ target_compile_options(app PRIVATE -Werror -Wno-error=maybe-uninitialized) project(chip-nrfconnect-lock-example) +include(${CHIP_ROOT}/config/nrfconnect/app/check-sysbuild-use.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/flashing.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) diff --git a/examples/lock-app/nrfconnect/Kconfig.sysbuild b/examples/lock-app/nrfconnect/Kconfig.sysbuild new file mode 100644 index 00000000000000..4a0b8f3656b1eb --- /dev/null +++ b/examples/lock-app/nrfconnect/Kconfig.sysbuild @@ -0,0 +1,76 @@ +# +# 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. +# + +#### Radio core selection +config NRF_DEFAULT_IPC_RADIO + default y + +# Enable IEEE802.15.4 serialization to network core +config NETCORE_IPC_RADIO_IEEE802154 + default y if (SOC_SERIES_NRF53X) && !WIFI_NRF700X + +# Enable Bluetooth serialization to network core +config NETCORE_IPC_RADIO_BT_HCI_IPC + default y if SOC_SERIES_NRF53X + +#### Bootloader +choice BOOTLOADER + default BOOTLOADER_MCUBOOT +endchoice + +if BOOTLOADER_MCUBOOT + +#### DFU multi-image support +config DFU_MULTI_IMAGE_PACKAGE_BUILD + default y + +config DFU_MULTI_IMAGE_PACKAGE_APP + default y + +config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY + default y + +#### DFU network core configuration +if SOC_SERIES_NRF53X + +config MCUBOOT_UPDATEABLE_IMAGES + default 2 + +choice MCUBOOT_MODE + default MCUBOOT_MODE_OVERWRITE_ONLY +endchoice + +choice BOOT_SIGNATURE_TYPE + default BOOT_SIGNATURE_TYPE_RSA +endchoice + +config SECURE_BOOT_NETCORE + default y + +config NETCORE_APP_UPDATE + default y + +config DFU_MULTI_IMAGE_PACKAGE_NET + default y + +endif # SOC_SERIES_NRF53X +endif # BOOTLOADER_MCUBOOT + +#### Enable generating factory data +config MATTER_FACTORY_DATA_GENERATE + default y + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/examples/lock-app/nrfconnect/README.md b/examples/lock-app/nrfconnect/README.md index 654f6988c8056f..14385357bc56df 100644 --- a/examples/lock-app/nrfconnect/README.md +++ b/examples/lock-app/nrfconnect/README.md @@ -1,5 +1,21 @@ # Matter nRF Connect Lock Example Application +> **Note:** This example is intended only to perform smoke tests of a Matter +> solution integrated with nRF Connect SDK platform. The example quality is not +> production ready and it may contain minor bugs or use not optimal +> configuration. It is not recommended to use this example as a basis for +> creating a market ready product. +> +> For the production ready and optimized Matter samples, see +> [nRF Connect SDK samples](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/matter.html). +> The Matter samples in nRF Connect SDK use various additional software +> components and provide multiple optional features that improve the developer +> and user experience. To read more about it, see +> [Matter support in nRF Connect SDK](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/matter/index.html#ug-matter) +> page. Using Matter samples from nRF Connect SDK allows you to get a full +> Nordic technical support via [DevZone](https://devzone.nordicsemi.com/) +> portal. + The nRF Connect Lock Example demonstrates how to remotely control a door lock device with one basic bolt. It uses buttons to test changing the lock and device states and LEDs to show the state of these changes. You can use this example as @@ -148,9 +164,9 @@ The example supports building and running on the following devices: | Hardware platform | Build target | Platform image | | ----------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | -| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk_nrf52840` |
nRF52840 DKnRF52840 DK
| -| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk_nrf5340_cpuapp` |
nRF5340 DKnRF5340 DK
| -| [nRF7002 DK](https://www.nordicsemi.com/Products/Development-hardware/nRF7002-DK) | `nrf7002dk_nrf5340_cpuapp` |
nRF7002 DKnRF7002 DK
| +| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk/nrf52840` |
nRF52840 DKnRF52840 DK
| +| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk/nrf5340/cpuapp` |
nRF5340 DKnRF5340 DK
| +| [nRF7002 DK](https://www.nordicsemi.com/Products/Development-hardware/nRF7002-DK) | `nrf7002dk/nrf5340/cpuapp` |
nRF7002 DKnRF7002 DK
|
@@ -159,9 +175,9 @@ The example supports building and running on the following devices: The development kits for this sample offer the following IPv6 network support for Matter: -- Matter over Thread is supported for `nrf52840dk_nrf52840` and - `nrf5340dk_nrf5340_cpuapp`. -- Matter over Wi-Fi is supported for `nrf7002dk_nrf5340_cpuapp`. +- Matter over Thread is supported for `nrf52840dk/nrf52840` and + `nrf5340dk/nrf5340/cpuapp`. +- Matter over Wi-Fi is supported for `nrf7002dk/nrf5340/cpuapp`. ## Device UI @@ -325,14 +341,15 @@ Complete the following steps to build the sample: 2. Run the following command to build the example, with _build-target_ replaced with the build target name of the Nordic Semiconductor's kit you own, for - example `nrf52840dk_nrf52840`: + example `nrf52840dk/nrf52840`: - $ west build -b build-target + $ west build -b build-target --sysbuild You only need to specify the build target on the first build. See [Requirements](#requirements) for the build target names of compatible kits. -The output `zephyr.hex` file will be available in the `build/zephyr/` directory. +The output `zephyr.hex` file will be available in the `build/nrfconnect/zephyr/` +directory. ### Removing build artifacts @@ -347,7 +364,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DCONF_FILE=prj_release.conf + $ west build -b build-target --sysbuild -- -DFILE_SUFFIX=release Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -358,15 +375,9 @@ Support for DFU using Matter OTA is enabled by default. To enable DFU over Bluetooth LE, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are -using (for example `nrf52840dk_nrf52840`): - - $ west build -b build-target -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y - -To completely disable support for both DFU methods, run the following command -with _build-target_ replaced with the build target name of the Nordic -Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): +using (for example `nrf52840dk/nrf52840`): - $ west build -b build-target -- -DCONF_FILE=prj_no_dfu.conf + $ west build -b build-target --sysbuild -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y > **Note**: > @@ -380,7 +391,7 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): #### Changing bootloader configuration To change the default MCUboot configuration, edit the `prj.conf` file located in -the `child_image/mcuboot` directory. +the `sysbuild/mcuboot` directory. Make sure to keep the configuration consistent with changes made to the application configuration. This is necessary for the configuration to work, as @@ -397,8 +408,9 @@ purposes. You can change these settings by defining This example uses this option to define using an external flash. To modify the flash settings of your board (that is, your _build-target_, for -example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the -`configuration/build-target/` directory. +example `nrf52840dk/nrf52840`), edit the `pm_static_.yml` file +(for example `pm_static_nrf52840dk_nrf52840.yml`), located in the main +application directory.
@@ -410,7 +422,7 @@ using the menuconfig utility. To open the menuconfig utility, run the following command from the example directory: - $ west build -b build-target -t menuconfig + $ west build -b build-target --sysbuild -t menuconfig Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -440,9 +452,6 @@ depending on the selected board: command-line shell. - release -- Release version of the application - can be used to enable only the necessary application functionalities to optimize its performance. -- no_dfu -- Debug version of the application without Device Firmware Upgrade - feature support - can be used only for the nRF52840 DK and nRF5340 DK, as - those platforms have DFU enabled by default. For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) diff --git a/examples/lock-app/nrfconnect/child_image/hci_rpmsg/prj.conf b/examples/lock-app/nrfconnect/child_image/hci_rpmsg/prj.conf deleted file mode 100644 index 1622ffd00dbb91..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/hci_rpmsg/prj.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.hci_rpmsg.defaults to set options common for all -# samples using hci_rpmsg. This file should contain only options specific for this sample -# hci_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.hci_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/lock-app/nrfconnect/child_image/hci_rpmsg/prj_no_dfu.conf b/examples/lock-app/nrfconnect/child_image/hci_rpmsg/prj_no_dfu.conf deleted file mode 100644 index 1622ffd00dbb91..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/hci_rpmsg/prj_no_dfu.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.hci_rpmsg.defaults to set options common for all -# samples using hci_rpmsg. This file should contain only options specific for this sample -# hci_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.hci_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/lock-app/nrfconnect/child_image/hci_rpmsg/prj_release.conf b/examples/lock-app/nrfconnect/child_image/hci_rpmsg/prj_release.conf deleted file mode 100644 index 1622ffd00dbb91..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/hci_rpmsg/prj_release.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.hci_rpmsg.defaults to set options common for all -# samples using hci_rpmsg. This file should contain only options specific for this sample -# hci_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.hci_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay b/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index f18e3e0cc16434..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay b/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf b/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf deleted file mode 100644 index cd9aab4101c6f5..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1,17 +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. -# - -CONFIG_GPIO=y diff --git a/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay b/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.conf b/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.conf deleted file mode 100644 index cd9aab4101c6f5..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.conf +++ /dev/null @@ -1,17 +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. -# - -CONFIG_GPIO=y diff --git a/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.overlay b/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/lock-app/nrfconnect/child_image/mcuboot/prj.conf b/examples/lock-app/nrfconnect/child_image/mcuboot/prj.conf deleted file mode 100644 index 90969a32dbc414..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/mcuboot/prj.conf +++ /dev/null @@ -1,30 +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. -# - -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. - -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" - -# Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_USE_SEGGER_RTT=n -CONFIG_GPIO=n diff --git a/examples/lock-app/nrfconnect/child_image/mcuboot/prj_release.conf b/examples/lock-app/nrfconnect/child_image/mcuboot/prj_release.conf deleted file mode 100644 index 90969a32dbc414..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/mcuboot/prj_release.conf +++ /dev/null @@ -1,30 +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. -# - -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. - -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" - -# Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_USE_SEGGER_RTT=n -CONFIG_GPIO=n diff --git a/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf b/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf b/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf b/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/window-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml b/examples/lock-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml similarity index 100% rename from examples/window-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml rename to examples/lock-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml diff --git a/examples/lock-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml b/examples/lock-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml new file mode 100644 index 00000000000000..ce42b39e55ee87 --- /dev/null +++ b/examples/lock-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml @@ -0,0 +1,42 @@ +mcuboot: + address: 0x0 + size: 0x7000 + region: flash_primary +mcuboot_pad: + address: 0x7000 + size: 0x200 +app: + address: 0x7200 + size: 0xf3e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x7000 + size: 0xf4000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x7200 + size: 0xf3e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_secondary: + address: 0x0 + size: 0xf4000 + device: MX25R64 + region: external_flash +external_flash: + address: 0xf4000 + size: 0x70c000 + device: MX25R64 + region: external_flash diff --git a/examples/lock-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml b/examples/lock-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml new file mode 100644 index 00000000000000..10e8680c363a53 --- /dev/null +++ b/examples/lock-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml @@ -0,0 +1,56 @@ +mcuboot: + address: 0x0 + size: 0x8000 + region: flash_primary +mcuboot_pad: + address: 0x8000 + size: 0x200 +app: + address: 0x8200 + size: 0xf2e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x8000 + size: 0xf3000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x8200 + size: 0xf2e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x0 + size: 0xf3000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xf3000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x133000 + size: 0x6CD000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/examples/lock-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml b/examples/lock-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml new file mode 100644 index 00000000000000..10e8680c363a53 --- /dev/null +++ b/examples/lock-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml @@ -0,0 +1,56 @@ +mcuboot: + address: 0x0 + size: 0x8000 + region: flash_primary +mcuboot_pad: + address: 0x8000 + size: 0x200 +app: + address: 0x8200 + size: 0xf2e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x8000 + size: 0xf3000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x8200 + size: 0xf2e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x0 + size: 0xf3000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xf3000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x133000 + size: 0x6CD000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/examples/lock-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp.yml b/examples/lock-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp.yml new file mode 100644 index 00000000000000..3c56dc0ddb1968 --- /dev/null +++ b/examples/lock-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp.yml @@ -0,0 +1,56 @@ +mcuboot: + address: 0x0 + size: 0xC000 + region: flash_primary +mcuboot_pad: + address: 0xC000 + size: 0x200 +app: + address: 0xC200 + size: 0xeee00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0xC000 + size: 0xef000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0xC200 + size: 0xeee00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x0 + size: 0xef000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xef000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x12f000 + size: 0x6D1000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/examples/lock-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp_release.yml b/examples/lock-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp_release.yml new file mode 100644 index 00000000000000..3c56dc0ddb1968 --- /dev/null +++ b/examples/lock-app/nrfconnect/pm_static_nrf7002dk_nrf5340_cpuapp_release.yml @@ -0,0 +1,56 @@ +mcuboot: + address: 0x0 + size: 0xC000 + region: flash_primary +mcuboot_pad: + address: 0xC000 + size: 0x200 +app: + address: 0xC200 + size: 0xeee00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0xC000 + size: 0xef000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0xC200 + size: 0xeee00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x0 + size: 0xef000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xef000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x12f000 + size: 0x6D1000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/examples/lock-app/nrfconnect/prj.conf b/examples/lock-app/nrfconnect/prj.conf index a12cb1e6594024..564882cf9c455a 100644 --- a/examples/lock-app/nrfconnect/prj.conf +++ b/examples/lock-app/nrfconnect/prj.conf @@ -25,6 +25,10 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 CONFIG_STD_CPP17=y +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/lock-app/nrfconnect/prj_no_dfu.conf b/examples/lock-app/nrfconnect/prj_no_dfu.conf deleted file mode 100644 index 68cd0ea04a0923..00000000000000 --- a/examples/lock-app/nrfconnect/prj_no_dfu.conf +++ /dev/null @@ -1,46 +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. -# - -# This sample uses Kconfig.defaults to set options common for all -# samples. This file should contain only options specific for this sample -# or overrides of default values. - -# Enable CHIP -CONFIG_CHIP=y -CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" -# 32774 == 0x8006 (example lock-app) -CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 -CONFIG_STD_CPP17=y - -# Add support for LEDs and buttons on Nordic development kits -CONFIG_DK_LIBRARY=y - -# Bluetooth Low Energy configuration -CONFIG_BT_DEVICE_NAME="MatterLock" - -# Other settings -CONFIG_THREAD_NAME=y -CONFIG_MPU_STACK_GUARD=y -CONFIG_RESET_ON_FATAL_ERROR=n - -# Reduce application size -CONFIG_USE_SEGGER_RTT=n - -# Disable Matter OTA DFU -CONFIG_CHIP_OTA_REQUESTOR=n - -# Disable QSPI NOR -CONFIG_CHIP_QSPI_NOR=n diff --git a/examples/lock-app/nrfconnect/prj_release.conf b/examples/lock-app/nrfconnect/prj_release.conf index 24fc9cd1cbdef8..6a4580c265b384 100644 --- a/examples/lock-app/nrfconnect/prj_release.conf +++ b/examples/lock-app/nrfconnect/prj_release.conf @@ -25,6 +25,10 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 CONFIG_STD_CPP17=y +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.conf b/examples/lock-app/nrfconnect/sysbuild.conf similarity index 90% rename from examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.conf rename to examples/lock-app/nrfconnect/sysbuild.conf index cd9aab4101c6f5..d0c5eee2b93c39 100644 --- a/examples/light-switch-app/nrfconnect/child_image/mcuboot/boards/nrf7002dk_nrf5340_cpuapp_release.conf +++ b/examples/lock-app/nrfconnect/sysbuild.conf @@ -1,5 +1,5 @@ # -# 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. @@ -14,4 +14,4 @@ # limitations under the License. # -CONFIG_GPIO=y +SB_CONFIG_MATTER=y diff --git a/examples/lock-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf b/examples/lock-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf new file mode 100644 index 00000000000000..8540585e53358b --- /dev/null +++ b/examples/lock-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf @@ -0,0 +1,58 @@ +# +# 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. +# + +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# 802.15.4 configuration +CONFIG_NRF_802154_SER_RADIO=y +CONFIG_NRF_802154_ENCRYPTION=y +CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=2 + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_DEBUG_INFO=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y +CONFIG_IPC_RADIO_802154=y diff --git a/examples/lock-app/nrfconnect/sysbuild/ipc_radio/boards/nrf7002dk_nrf5340_cpunet.conf b/examples/lock-app/nrfconnect/sysbuild/ipc_radio/boards/nrf7002dk_nrf5340_cpunet.conf new file mode 100644 index 00000000000000..694c3b08242f29 --- /dev/null +++ b/examples/lock-app/nrfconnect/sysbuild/ipc_radio/boards/nrf7002dk_nrf5340_cpunet.conf @@ -0,0 +1,52 @@ +# +# 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. +# + +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_DEBUG_INFO=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y diff --git a/examples/lock-app/nrfconnect/sysbuild/ipc_radio/prj.conf b/examples/lock-app/nrfconnect/sysbuild/ipc_radio/prj.conf new file mode 100644 index 00000000000000..8906415dda4fc7 --- /dev/null +++ b/examples/lock-app/nrfconnect/sysbuild/ipc_radio/prj.conf @@ -0,0 +1,21 @@ +# +# 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. +# + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=n diff --git a/examples/lock-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf b/examples/lock-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf new file mode 100644 index 00000000000000..7f92a51630cce0 --- /dev/null +++ b/examples/lock-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf @@ -0,0 +1,20 @@ +# +# 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. +# +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=y diff --git a/examples/lock-app/nrfconnect/sysbuild/mcuboot/app.overlay b/examples/lock-app/nrfconnect/sysbuild/mcuboot/app.overlay new file mode 100644 index 00000000000000..74d3dfbfd22f30 --- /dev/null +++ b/examples/lock-app/nrfconnect/sysbuild/mcuboot/app.overlay @@ -0,0 +1,5 @@ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf b/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf new file mode 100644 index 00000000000000..50610217c762b5 --- /dev/null +++ b/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf @@ -0,0 +1,19 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 diff --git a/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000000..2d86fe6442dd39 --- /dev/null +++ b/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -0,0 +1,35 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 + +CONFIG_BOOT_SWAP_USING_MOVE=n +# Multi-image updates do not support image swapping yet. +CONFIG_BOOT_UPGRADE_ONLY=y + +# The network core cannot access external flash directly. The flash simulator must be used to +# provide a memory region that is used to forward the new firmware to the network core. +CONFIG_FLASH_SIMULATOR=y +CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y +CONFIG_FLASH_SIMULATOR_STATS=n + +CONFIG_ZCBOR=y diff --git a/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf b/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000000..81701b7eb63f70 --- /dev/null +++ b/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf @@ -0,0 +1,40 @@ +# +# 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. +# + +# nRF7002DK uses SPI NOR external flash +CONFIG_GPIO=y +CONFIG_SPI=y +CONFIG_SPI_NOR=y +CONFIG_SPI_NOR_SFDP_DEVICETREE=y +CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 + +CONFIG_MULTITHREADING=y +CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 + +# Multi-image updates do not support image swapping yet. +CONFIG_BOOT_UPGRADE_ONLY=y + +# The network core cannot access external flash directly. The flash simulator must be used to +# provide a memory region that is used to forward the new firmware to the network core. +CONFIG_FLASH_SIMULATOR=y +CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y +CONFIG_FLASH_SIMULATOR_STATS=n + +CONFIG_ZCBOR=y diff --git a/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay b/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/lock-app/nrfconnect/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/lock-app/nrfconnect/sysbuild/mcuboot/prj.conf b/examples/lock-app/nrfconnect/sysbuild/mcuboot/prj.conf new file mode 100644 index 00000000000000..3bcb12fe7b8d25 --- /dev/null +++ b/examples/lock-app/nrfconnect/sysbuild/mcuboot/prj.conf @@ -0,0 +1,49 @@ +# +# 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. +# + +CONFIG_MAIN_STACK_SIZE=10240 + +CONFIG_BOOT_SWAP_SAVE_ENCTLV=n +CONFIG_BOOT_BOOTSTRAP=n +CONFIG_PM=n + +CONFIG_FLASH=y +CONFIG_FPROTECT=y + +CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" + +# Use minimal C library instead of the Picolib +CONFIG_MINIMAL_LIBC=y + +# Bootloader size optimization +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_GPIO=n + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +CONFIG_LOG=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_NCS_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/lock-app/nxp/zap/lock-app.matter b/examples/lock-app/nxp/zap/lock-app.matter index a8c73faab0fc20..2aa70597fd5266 100644 --- a/examples/lock-app/nxp/zap/lock-app.matter +++ b/examples/lock-app/nxp/zap/lock-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1784,6 +1855,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/lock-app/nxp/zap/lock-app.zap b/examples/lock-app/nxp/zap/lock-app.zap index abf9d2e6bf2a6c..70442ac916c7fe 100644 --- a/examples/lock-app/nxp/zap/lock-app.zap +++ b/examples/lock-app/nxp/zap/lock-app.zap @@ -489,6 +489,22 @@ "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": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, diff --git a/examples/lock-app/qpg/src/AppTask.cpp b/examples/lock-app/qpg/src/AppTask.cpp index d2f3298db9b779..8ae517dce2b7ad 100644 --- a/examples/lock-app/qpg/src/AppTask.cpp +++ b/examples/lock-app/qpg/src/AppTask.cpp @@ -64,7 +64,8 @@ using namespace ::chip::DeviceLayer; #define APP_TASK_PRIORITY 2 #define APP_EVENT_QUEUE_SIZE 10 #define QPG_LOCK_ENDPOINT_ID (1) -#define TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS (1 * 3600) // this value must be multiplication of 3600 +#define SECONDS_IN_HOUR (3600) // we better keep this 3600 +#define TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS (1 * SECONDS_IN_HOUR) // increment every hour #define NMBR_OF_RESETS_BLE_ADVERTISING (3) @@ -414,10 +415,18 @@ void AppTask::TotalHoursTimerHandler(chip::System::Layer * aLayer, void * aAppSt CHIP_ERROR err; uint32_t totalOperationalHours = 0; - if (ConfigurationMgr().GetTotalOperationalHours(totalOperationalHours) == CHIP_NO_ERROR) + err = ConfigurationMgr().GetTotalOperationalHours(totalOperationalHours); + + if (err == CHIP_NO_ERROR) + { + ConfigurationMgr().StoreTotalOperationalHours(totalOperationalHours + + (TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS / SECONDS_IN_HOUR)); + } + else if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) { + totalOperationalHours = 0; // set this explicitly to 0 for safety ConfigurationMgr().StoreTotalOperationalHours(totalOperationalHours + - (TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS / 3600)); + (TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS / SECONDS_IN_HOUR)); } else { diff --git a/examples/lock-app/qpg/zap/lock.matter b/examples/lock-app/qpg/zap/lock.matter index a8628316139252..79aab6924fe618 100644 --- a/examples/lock-app/qpg/zap/lock.matter +++ b/examples/lock-app/qpg/zap/lock.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -166,7 +183,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -182,12 +199,42 @@ cluster AccessControl = 31 { 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; @@ -223,17 +270,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -318,7 +389,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1410,7 +1481,7 @@ cluster UserLabel = 65 { /** Allows servers to ensure that listed clients are notified when a server is available for communication. */ cluster IcdManagement = 70 { - revision 2; + revision 3; enum ClientTypeEnum : enum8 { kPermanent = 0; @@ -1426,6 +1497,7 @@ cluster IcdManagement = 70 { kCheckInProtocolSupport = 0x1; kUserActiveModeTrigger = 0x2; kLongIdleTimeSupport = 0x4; + kDynamicSitLitSupport = 0x8; } bitmap UserActiveModeTriggerBitmap : bitmap32 { @@ -1464,6 +1536,7 @@ cluster IcdManagement = 70 { 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; @@ -2491,7 +2564,7 @@ endpoint 0 { callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0x0000; - ram attribute clusterRevision default = 2; + ram attribute clusterRevision default = 3; } } endpoint 1 { diff --git a/examples/lock-app/qpg/zap/lock.zap b/examples/lock-app/qpg/zap/lock.zap index affc31d2d79610..d46b1f63567e2f 100644 --- a/examples/lock-app/qpg/zap/lock.zap +++ b/examples/lock-app/qpg/zap/lock.zap @@ -4289,7 +4289,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/lock-app/telink/README.md b/examples/lock-app/telink/README.md index 8386a524c48d41..8e0d605fd85dc6 100755 --- a/examples/lock-app/telink/README.md +++ b/examples/lock-app/telink/README.md @@ -7,6 +7,17 @@ a reference for creating your own application. ![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) +## Supported devices + +The example supports building and running on the following devices: + +| Board/SoC | Build target | Zephyr Board Info | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| [B91](https://wiki.telink-semi.cn/wiki/Hardware/B91_Generic_Starter_Kit_Hardware_Guide) [TLSR9518ADK80D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series) | `tlsr9518adk80d`, `tlsr9518adk80d-mars`, `tlsr9518adk80d-usb` | [TLSR9518ADK80D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9518adk80d/doc/index.rst) | +| [B92](https://wiki.telink-semi.cn/wiki/Hardware/B92_Generic_Starter_Kit_Hardware_Guide) [TLSR9528A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR952x-Series) | `tlsr9528a`, `tlsr9528a_retention` | [TLSR9528A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9528a/doc/index.rst) | +| [B95](https://wiki.telink-semi.cn/wiki/Hardware/B95_Generic_Starter_Kit_Hardware_Guide) [TLSR9258A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR925x-Series) | `tlsr9258a` | [TLSR9258A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9258a/doc/index.rst) | +| [W91](https://wiki.telink-semi.cn/wiki/Hardware/W91_Generic_Starter_Kit_Hardware_Guide) [TLSR9118BDK40D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR911x-Series) | `tlsr9118bdk40d` | [TLSR9118BDK40D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9118bdk40d/doc/index.rst) | + ## Build and flash 1. Run the Docker container: @@ -15,7 +26,7 @@ a reference for creating your own application. $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}') ``` - Compatible docker image version can be found in next file: + You can find the compatible Docker image version in the file: ```bash $ .github/workflows/examples-telink.yaml @@ -27,8 +38,8 @@ a reference for creating your own application. $ source ./scripts/activate.sh -p all,telink ``` -3. In the example dir run (replace __ with your board name, for - example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`): +3. Build the example (replace __ with your board name, see + [Supported devices](#supported-devices)): ```bash $ west build -b @@ -38,9 +49,12 @@ a reference for creating your own application. MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=4m`: ```bash - $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + $ west build -b -- -DFLASH_SIZE=4m ``` + You can find the target built file called **_zephyr.bin_** under the + **_build/zephyr_** directory. + 4. Flash binary: ``` @@ -59,16 +73,18 @@ To get output from device, connect UART to following pins: | TX | PB2 (pin 16 of J34 connector) | | GND | GND | +Baud rate: 115200 bits/s + ### Buttons The following buttons are available on **tlsr9518adk80d** board: -| Name | Function | Description | -| :------- | :--------------------- | :----------------------------------------------------------------------------------------------------- | -| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and back to uncommissioned state | -| Button 2 | Lock control | Manually triggers the bolt lock state | -| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | -| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | +| Name | Function | Description | +| :------- | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and return to a decommissioned state (to activate, push the button 3 times) | +| Button 2 | Lock control | Manually triggers the bolt lock state | +| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | +| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | ### LEDs diff --git a/examples/log-source-app/linux/main.cpp b/examples/log-source-app/linux/main.cpp index 9443a946e1a871..20ed1c54b5b215 100644 --- a/examples/log-source-app/linux/main.cpp +++ b/examples/log-source-app/linux/main.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -109,7 +110,7 @@ int main(int argc, char * argv[]) // Initialize device attestation config SetDeviceAttestationCredentialsProvider(chip::Credentials::Examples::GetExampleDACProvider()); - chip::app::InteractionModelEngine::GetInstance()->RegisterCommandHandler(&GetLogProvider()); + CommandHandlerInterfaceRegistry::RegisterCommandHandler(&GetLogProvider()); chip::DeviceLayer::PlatformMgr().RunEventLoop(); diff --git a/examples/log-source-app/log-source-common/log-source-app.matter b/examples/log-source-app/log-source-common/log-source-app.matter index de444f53751547..c07f3c8a8ffad9 100644 --- a/examples/log-source-app/log-source-common/log-source-app.matter +++ b/examples/log-source-app/log-source-common/log-source-app.matter @@ -1,12 +1,29 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** 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 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -22,12 +39,42 @@ cluster AccessControl = 31 { 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; @@ -63,17 +110,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster is used to manage global aspects of the Commissioning flow. */ diff --git a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter index 997f99aa2136b6..dd7225e9fa102f 100644 --- a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter +++ b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.zap b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.zap index 03113285ad2567..1df2afdd38fc8a 100644 --- a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.zap +++ b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.zap @@ -19,18 +19,18 @@ "package": [ { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/zcl/zcl.json", - "type": "zcl-properties", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", "category": "matter", - "version": 1, - "description": "Matter SDK ZCL data" + "version": "chip-v1" }, { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", + "path": "../../../src/app/zap-templates/zcl/zcl.json", + "type": "zcl-properties", "category": "matter", - "version": "chip-v1" + "version": 1, + "description": "Matter SDK ZCL data" } ], "endpointTypes": [ diff --git a/examples/network-manager-app/linux/BUILD.gn b/examples/network-manager-app/linux/BUILD.gn index 1dee694c38616e..ea973edfbfd15c 100644 --- a/examples/network-manager-app/linux/BUILD.gn +++ b/examples/network-manager-app/linux/BUILD.gn @@ -15,7 +15,7 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -executable("network-manager-app") { +executable("matter-network-manager-app") { sources = [ "include/CHIPProjectAppConfig.h", "main.cpp", @@ -32,7 +32,7 @@ executable("network-manager-app") { } group("linux") { - deps = [ ":network-manager-app" ] + deps = [ ":matter-network-manager-app" ] } group("default") { diff --git a/examples/network-manager-app/linux/main.cpp b/examples/network-manager-app/linux/main.cpp index ee6763a6d3d47d..84c4a2ce88e9a5 100644 --- a/examples/network-manager-app/linux/main.cpp +++ b/examples/network-manager-app/linux/main.cpp @@ -16,32 +16,48 @@ */ #include +#include #include #include +#include #include +#include + using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; -void ApplicationInit() {} -void ApplicationShutdown() {} - ByteSpan ByteSpanFromCharSpan(CharSpan span) { return ByteSpan(Uint8::from_const_char(span.data()), span.size()); } -int main(int argc, char * argv[]) +std::optional gThreadNetworkDirectoryServer; +void emberAfThreadNetworkDirectoryClusterInitCallback(EndpointId endpoint) +{ + VerifyOrDie(!gThreadNetworkDirectoryServer); + gThreadNetworkDirectoryServer.emplace(endpoint).Init(); +} + +std::optional gWiFiNetworkManagementServer; +void emberAfWiFiNetworkManagementClusterInitCallback(EndpointId endpoint) { - if (ChipLinuxAppInit(argc, argv) != 0) - { - return -1; - } + VerifyOrDie(!gWiFiNetworkManagementServer); + gWiFiNetworkManagementServer.emplace(endpoint).Init(); +} - WiFiNetworkManagementServer::Instance().SetNetworkCredentials(ByteSpanFromCharSpan("MatterAP"_span), - ByteSpanFromCharSpan("Setec Astronomy"_span)); +void ApplicationInit() +{ + gWiFiNetworkManagementServer->SetNetworkCredentials(ByteSpanFromCharSpan("MatterAP"_span), + ByteSpanFromCharSpan("Setec Astronomy"_span)); +} +void ApplicationShutdown() {} + +int main(int argc, char * argv[]) +{ + VerifyOrReturnValue(ChipLinuxAppInit(argc, argv) == 0, -1); ChipLinuxAppMainLoop(); return 0; } diff --git a/examples/network-manager-app/network-manager-common/network-manager-app.matter b/examples/network-manager-app/network-manager-common/network-manager-app.matter index 641d45571e1216..e7f55ebbec3808 100644 --- a/examples/network-manager-app/network-manager-common/network-manager-app.matter +++ b/examples/network-manager-app/network-manager-common/network-manager-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1176,10 +1247,11 @@ cluster GroupKeyManagement = 63 { } /** Functionality to retrieve operational information about a managed Wi-Fi network. */ -cluster WiFiNetworkManagement = 1105 { +provisional cluster WiFiNetworkManagement = 1105 { revision 1; - readonly attribute nullable octet_string<32> ssid = 1; + readonly attribute nullable octet_string<32> ssid = 0; + readonly attribute access(read: manage) nullable int64u passphraseSurrogate = 1; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1192,7 +1264,52 @@ cluster WiFiNetworkManagement = 1105 { } /** Request the current WPA-Personal passphrase or PSK associated with the managed Wi-Fi network. */ - command access(invoke: administer) NetworkPassphraseRequest(): NetworkPassphraseResponse = 0; + command access(invoke: manage) NetworkPassphraseRequest(): NetworkPassphraseResponse = 0; +} + +/** Manages the names and credentials of Thread networks visible to the user. */ +provisional cluster ThreadNetworkDirectory = 1107 { + revision 1; + + struct ThreadNetworkStruct { + octet_string<8> extendedPanID = 0; + char_string<16> networkName = 1; + int16u channel = 2; + int64u activeTimestamp = 3; + } + + attribute access(read: manage, write: manage) nullable octet_string<8> preferredExtendedPanID = 0; + readonly attribute access(read: operate) ThreadNetworkStruct threadNetworks[] = 1; + readonly attribute int8u threadNetworkTableSize = 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 AddNetworkRequest { + octet_string<254> operationalDataset = 0; + } + + request struct RemoveNetworkRequest { + octet_string<8> extendedPanID = 0; + } + + request struct GetOperationalDatasetRequest { + octet_string<8> extendedPanID = 0; + } + + response struct OperationalDatasetResponse = 3 { + octet_string<254> operationalDataset = 0; + } + + /** Adds an entry to the ThreadNetworks list. */ + timed command access(invoke: manage) AddNetwork(AddNetworkRequest): DefaultSuccess = 0; + /** Removes an entry from the ThreadNetworks list. */ + timed command access(invoke: manage) RemoveNetwork(RemoveNetworkRequest): DefaultSuccess = 1; + /** Retrieves a Thread Operational Dataset from the ThreadNetworks list. */ + command GetOperationalDataset(GetOperationalDatasetRequest): OperationalDatasetResponse = 2; } endpoint 0 { @@ -1463,6 +1580,7 @@ endpoint 1 { server cluster WiFiNetworkManagement { callback attribute ssid; + callback attribute passphraseSurrogate; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; @@ -1473,6 +1591,23 @@ endpoint 1 { handle command NetworkPassphraseRequest; handle command NetworkPassphraseResponse; } + + server cluster ThreadNetworkDirectory { + callback attribute preferredExtendedPanID; + callback attribute threadNetworks; + callback attribute threadNetworkTableSize; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + + handle command AddNetwork; + handle command RemoveNetwork; + handle command GetOperationalDataset; + handle command OperationalDatasetResponse; + } } diff --git a/examples/network-manager-app/network-manager-common/network-manager-app.zap b/examples/network-manager-app/network-manager-common/network-manager-app.zap index 2e0180ebc27357..64113c969dd774 100644 --- a/examples/network-manager-app/network-manager-common/network-manager-app.zap +++ b/examples/network-manager-app/network-manager-common/network-manager-app.zap @@ -3238,9 +3238,181 @@ "attributes": [ { "name": "SSID", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PassphraseSurrogate", "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": "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": "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, + "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": "Thread Network Directory", + "code": 1107, + "mfgCode": null, + "define": "THREAD_NETWORK_DIRECTORY_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "AddNetwork", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RemoveNetwork", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "GetOperationalDataset", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "OperationalDatasetResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "PreferredExtendedPanID", + "code": 0, + "mfgCode": null, + "side": "server", "type": "octet_string", "included": 1, "storageOption": "External", @@ -3252,6 +3424,38 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "ThreadNetworks", + "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": "ThreadNetworkTableSize", + "code": 2, + "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": "GeneratedCommandList", "code": 65528, diff --git a/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter index ebb9f79e7b2009..9c1bf10d9330c9 100644 --- a/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter +++ b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** 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; @@ -39,7 +56,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -55,12 +72,42 @@ cluster AccessControl = 31 { 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; @@ -96,17 +143,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** The Access Control Cluster exposes a data model view of a @@ -114,7 +185,7 @@ cluster AccessControl = 31 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -130,12 +201,42 @@ cluster AccessControl = 31 { 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; @@ -171,17 +272,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -266,7 +391,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap b/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap index c98b9e661328e5..b019c91de5ef04 100644 --- a/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap +++ b/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap @@ -19,18 +19,18 @@ "package": [ { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/zcl/zcl.json", - "type": "zcl-properties", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", "category": "matter", - "version": 1, - "description": "Matter SDK ZCL data" + "version": "chip-v1" }, { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", + "path": "../../../src/app/zap-templates/zcl/zcl.json", + "type": "zcl-properties", "category": "matter", - "version": "chip-v1" + "version": 1, + "description": "Matter SDK ZCL data" } ], "endpointTypes": [ diff --git a/examples/ota-requestor-app/ameba/chip_main.cmake b/examples/ota-requestor-app/ameba/chip_main.cmake index cffc1339536d53..1a418260dbb294 100644 --- a/examples/ota-requestor-app/ameba/chip_main.cmake +++ b/examples/ota-requestor-app/ameba/chip_main.cmake @@ -60,7 +60,6 @@ target_include_directories( ${chip_dir}/src/app/server/ ${chip_dir}/src/controller/data_model ${chip_dir}/third_party/nlio/repo/include/ - ${chip_dir}/third_party/nlunit-test/repo/src ${chip_dir}/src/app/clusters/ota-requestor ${chip_dir}/examples/ota-requestor-app/ameba/main/include ${chip_dir}/examples/platform/ameba diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter index 9e0b0c61ea0704..055c88a71666e8 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -238,7 +255,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -254,12 +271,42 @@ cluster AccessControl = 31 { 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; @@ -295,17 +342,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -390,7 +461,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1293,6 +1364,7 @@ cluster UserLabel = 65 { endpoint 0 { device type ma_rootdevice = 22, version 1; + device type ma_otarequestor = 18, version 1; binding cluster OtaSoftwareUpdateProvider; @@ -1301,6 +1373,10 @@ endpoint 0 { callback attribute serverList; callback attribute clientList; callback attribute partsList; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; } @@ -1313,6 +1389,9 @@ endpoint 0 { callback attribute subjectsPerAccessControlEntry; callback attribute targetsPerAccessControlEntry; callback attribute accessControlEntriesPerFabric; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; callback attribute clusterRevision; @@ -1343,6 +1422,10 @@ endpoint 0 { callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 3; } @@ -1355,6 +1438,10 @@ endpoint 0 { ram attribute updatePossible default = 1; ram attribute updateState default = 0; ram attribute updateStateProgress default = 0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -1364,6 +1451,10 @@ endpoint 0 { server cluster LocalizationConfiguration { persist attribute activeLocale default = "en-US"; callback attribute supportedLocales; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; } @@ -1382,6 +1473,10 @@ endpoint 0 { callback attribute regulatoryConfig; callback attribute locationCapability; callback attribute supportsConcurrentConnection; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -1402,6 +1497,10 @@ endpoint 0 { ram attribute lastNetworkingStatus; ram attribute lastNetworkID; ram attribute lastConnectErrorValue; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; ram attribute featureMap default = 2; ram attribute clusterRevision default = 1; @@ -1427,6 +1526,10 @@ endpoint 0 { callback attribute activeRadioFaults; callback attribute activeNetworkFaults; callback attribute testEventTriggersEnabled default = false; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -1439,6 +1542,10 @@ endpoint 0 { callback attribute windowStatus; callback attribute adminFabricIndex; callback attribute adminVendorId; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -1454,6 +1561,10 @@ endpoint 0 { callback attribute commissionedFabrics; callback attribute trustedRootCertificates; callback attribute currentFabricIndex; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -1476,6 +1587,10 @@ endpoint 0 { callback attribute groupTable; callback attribute maxGroupsPerFabric; callback attribute maxGroupKeysPerFabric; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap index 5291880efb89f0..ce4e60fe260d25 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap @@ -19,18 +19,18 @@ "package": [ { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/zcl/zcl.json", - "type": "zcl-properties", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", "category": "matter", - "version": 1, - "description": "Matter SDK ZCL data" + "version": "chip-v1" }, { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", + "path": "../../../src/app/zap-templates/zcl/zcl.json", + "type": "zcl-properties", "category": "matter", - "version": "chip-v1" + "version": 1, + "description": "Matter SDK ZCL data" } ], "endpointTypes": [ @@ -38,12 +38,18 @@ "id": 1, "name": "MA-rootdevice", "deviceTypeRef": { - "code": 22, + "code": 18, "profileId": 259, - "label": "MA-rootdevice", - "name": "MA-rootdevice" + "label": "MA-otarequestor", + "name": "MA-otarequestor" }, "deviceTypes": [ + { + "code": 18, + "profileId": 259, + "label": "MA-otarequestor", + "name": "MA-otarequestor" + }, { "code": 22, "profileId": 259, @@ -52,13 +58,15 @@ } ], "deviceVersions": [ + 1, 1 ], "deviceIdentifiers": [ + 18, 22 ], - "deviceTypeName": "MA-rootdevice", - "deviceTypeCode": 22, + "deviceTypeName": "MA-otarequestor", + "deviceTypeCode": 18, "deviceTypeProfileId": 259, "clusters": [ { @@ -96,7 +104,7 @@ "singleton": 0, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65534, "reportableChange": 0 @@ -112,7 +120,7 @@ "singleton": 0, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65534, "reportableChange": 0 @@ -128,11 +136,75 @@ "singleton": 0, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, @@ -186,7 +258,7 @@ "singleton": 0, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -202,7 +274,7 @@ "singleton": 0, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -255,6 +327,54 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -340,7 +460,7 @@ "singleton": 1, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -356,7 +476,7 @@ "singleton": 1, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -372,7 +492,7 @@ "singleton": 1, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -388,7 +508,7 @@ "singleton": 1, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -404,7 +524,7 @@ "singleton": 1, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -420,7 +540,7 @@ "singleton": 1, "bounded": 0, "defaultValue": "", - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -436,7 +556,7 @@ "singleton": 1, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -452,7 +572,7 @@ "singleton": 1, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -468,7 +588,7 @@ "singleton": 1, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -484,7 +604,7 @@ "singleton": 1, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -500,7 +620,7 @@ "singleton": 1, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 @@ -665,6 +785,70 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, @@ -772,6 +956,22 @@ } ], "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -873,47 +1073,111 @@ "reportableChange": 0 }, { - "name": "FeatureMap", - "code": 65532, + "name": "GeneratedCommandList", + "code": 65528, "mfgCode": null, "side": "server", - "type": "bitmap32", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 }, { - "name": "ClusterRevision", - "code": 65533, + "name": "AcceptedCommandList", + "code": 65529, "mfgCode": null, "side": "server", - "type": "int16u", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 - } - ], - "events": [ + }, { - "name": "StateTransition", - "code": 0, + "name": "EventList", + "code": 65530, "mfgCode": null, "side": "server", - "included": 1 - }, - { + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "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 + } + ], + "events": [ + { + "name": "StateTransition", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { "name": "VersionApplied", "code": 1, "mfgCode": null, @@ -948,7 +1212,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "en-US", - "reportable": 1, + "reportable": 0, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -964,6 +1228,70 @@ "singleton": 0, "bounded": 0, "defaultValue": null, + "reportable": 0, + "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": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1022,7 +1350,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0", - "reportable": 1, + "reportable": 0, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -1231,6 +1559,70 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, @@ -1475,6 +1867,70 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, @@ -1548,39 +2004,103 @@ "code": 0, "mfgCode": null, "side": "server", - "type": "array", + "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": 0, + "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": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "RebootCount", - "code": 1, + "name": "ActiveHardwareFaults", + "code": 5, "mfgCode": null, "side": "server", - "type": "int16u", + "type": "array", "included": 1, "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": null, "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "UpTime", - "code": 2, + "name": "ActiveRadioFaults", + "code": 6, "mfgCode": null, "side": "server", - "type": "int64u", + "type": "array", "included": 1, "storageOption": "External", "singleton": 0, @@ -1592,11 +2112,11 @@ "reportableChange": 0 }, { - "name": "TotalOperationalHours", - "code": 3, + "name": "ActiveNetworkFaults", + "code": 7, "mfgCode": null, "side": "server", - "type": "int32u", + "type": "array", "included": 1, "storageOption": "External", "singleton": 0, @@ -1608,24 +2128,24 @@ "reportableChange": 0 }, { - "name": "BootReason", - "code": 4, + "name": "TestEventTriggersEnabled", + "code": 8, "mfgCode": null, "side": "server", - "type": "BootReasonEnum", + "type": "boolean", "included": 1, "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": null, + "defaultValue": "false", "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 }, { - "name": "ActiveHardwareFaults", - "code": 5, + "name": "GeneratedCommandList", + "code": 65528, "mfgCode": null, "side": "server", "type": "array", @@ -1633,15 +2153,15 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": null, + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 }, { - "name": "ActiveRadioFaults", - "code": 6, + "name": "AcceptedCommandList", + "code": 65529, "mfgCode": null, "side": "server", "type": "array", @@ -1649,15 +2169,15 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": null, + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 }, { - "name": "ActiveNetworkFaults", - "code": 7, + "name": "EventList", + "code": 65530, "mfgCode": null, "side": "server", "type": "array", @@ -1665,23 +2185,23 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": null, + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 }, { - "name": "TestEventTriggersEnabled", - "code": 8, + "name": "AttributeList", + "code": 65531, "mfgCode": null, "side": "server", - "type": "boolean", + "type": "array", "included": 1, "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "false", + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1812,6 +2332,70 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, @@ -2048,6 +2632,70 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, @@ -2204,6 +2852,70 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, diff --git a/examples/ota-requestor-app/telink/README.md b/examples/ota-requestor-app/telink/README.md index c549804e42f627..d8590c6a0cc4d7 100755 --- a/examples/ota-requestor-app/telink/README.md +++ b/examples/ota-requestor-app/telink/README.md @@ -1,5 +1,16 @@ ![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) +## Supported devices + +The example supports building and running on the following devices: + +| Board/SoC | Build target | Zephyr Board Info | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| [B91](https://wiki.telink-semi.cn/wiki/Hardware/B91_Generic_Starter_Kit_Hardware_Guide) [TLSR9518ADK80D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series) | `tlsr9518adk80d`, `tlsr9518adk80d-mars`, `tlsr9518adk80d-usb` | [TLSR9518ADK80D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9518adk80d/doc/index.rst) | +| [B92](https://wiki.telink-semi.cn/wiki/Hardware/B92_Generic_Starter_Kit_Hardware_Guide) [TLSR9528A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR952x-Series) | `tlsr9528a`, `tlsr9528a_retention` | [TLSR9528A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9528a/doc/index.rst) | +| [B95](https://wiki.telink-semi.cn/wiki/Hardware/B95_Generic_Starter_Kit_Hardware_Guide) [TLSR9258A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR925x-Series) | `tlsr9258a` | [TLSR9258A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9258a/doc/index.rst) | +| [W91](https://wiki.telink-semi.cn/wiki/Hardware/W91_Generic_Starter_Kit_Hardware_Guide) [TLSR9118BDK40D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR911x-Series) | `tlsr9118bdk40d` | [TLSR9118BDK40D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9118bdk40d/doc/index.rst) | + ## Build and flash 1. Run the Docker container: @@ -8,7 +19,7 @@ $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}') ``` - Compatible docker image version can be found in next file: + You can find the compatible Docker image version in the file: ```bash $ .github/workflows/examples-telink.yaml @@ -20,8 +31,8 @@ $ source ./scripts/activate.sh -p all,telink ``` -3. In the example dir run (replace __ with your board name, for - example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`): +3. Build the example (replace __ with your board name, see + [Supported devices](#supported-devices)): ```bash $ west build -b @@ -31,9 +42,12 @@ MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=4m`: ```bash - $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + $ west build -b -- -DFLASH_SIZE=4m ``` + You can find the target built file called **_zephyr.bin_** under the + **_build/zephyr_** directory. + 4. Flash binary: ``` @@ -52,16 +66,18 @@ To get output from device, connect UART to following pins: | TX | PB2 (pin 16 of J34 connector) | | GND | GND | +Baud rate: 115200 bits/s + ### Buttons The following buttons are available on **tlsr9518adk80d** board: -| Name | Function | Description | -| :------- | :--------------------- | :----------------------------------------------------------------------------------------------------- | -| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and back to uncommissioned state | -| Button 2 | NA | NA | -| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | -| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | +| Name | Function | Description | +| :------- | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and return to a decommissioned state (to activate, push the button 3 times) | +| Button 2 | NA | NA | +| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | +| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | ### LEDs @@ -99,12 +115,14 @@ be used to specify the the effect. It is able to be in following effects: 2. Pair with device ``` - ${CHIP_TOOL_DIR}/chip-tool pairing code ${NODE_ID_TO_ASSIGN} MT:D8XA0CQM00KA0648G00 + ${CHIP_TOOL_DIR}/chip-tool pairing ble-thread ${NODE_ID} hex:${DATASET} ${PIN_CODE} ${DISCRIMINATOR} ``` - here: + Example: - - \${NODE_ID_TO_ASSIGN} is the node id to assign to the ota requestor + ``` + ./chip-tool pairing ble-thread 1234 hex:0e080000000000010000000300000f35060004001fffe0020811111111222222220708fd61f77bd3df233e051000112233445566778899aabbccddeeff030e4f70656e54687265616444656d6f010212340410445f2b5ca6f2a93a55ce570a70efeecb0c0402a0fff8 20202021 3840 + ``` ### OTA with Linux OTA Provider diff --git a/examples/persistent-storage/esp32/sdkconfig.defaults b/examples/persistent-storage/esp32/sdkconfig.defaults index f9a4c4bbcb05da..45488e615dece7 100644 --- a/examples/persistent-storage/esp32/sdkconfig.defaults +++ b/examples/persistent-storage/esp32/sdkconfig.defaults @@ -32,3 +32,6 @@ CONFIG_DEVICE_PRODUCT_ID=0x8009 # Enable HKDF in mbedtls CONFIG_MBEDTLS_HKDF_C=y + +# Disable CHIP data model +CONFIG_ENABLE_CHIP_DATA_MODEL=n diff --git a/examples/persistent-storage/infineon/psoc6/BUILD.gn b/examples/persistent-storage/infineon/psoc6/BUILD.gn index 6c1b536280e60b..16f9da400fb021 100644 --- a/examples/persistent-storage/infineon/psoc6/BUILD.gn +++ b/examples/persistent-storage/infineon/psoc6/BUILD.gn @@ -39,7 +39,7 @@ psoc6_sdk_sources("persistent_storage_app_sdk_sources") { defines = [ "BOARD_ID=${psoc6_board}", - "P6_LOG_ENABLED=1", + "PSOC6_LOG_ENABLED=1", ] sources = [ "${psoc6_project_dir}/include/CHIPProjectConfig.h" ] diff --git a/examples/persistent-storage/infineon/psoc6/include/AppConfig.h b/examples/persistent-storage/infineon/psoc6/include/AppConfig.h index 4c4efaefa09e8c..e86a19d98eda81 100644 --- a/examples/persistent-storage/infineon/psoc6/include/AppConfig.h +++ b/examples/persistent-storage/infineon/psoc6/include/AppConfig.h @@ -19,14 +19,14 @@ #pragma once -// P6 Logging +// PSOC6 Logging #ifdef __cplusplus extern "C" { #endif void appError(int err); -void P6Log(const char * aFormat, ...); -#define P6_LOG(...) P6Log(__VA_ARGS__) +void PSOC6Log(const char * aFormat, ...); +#define PSOC6_LOG(...) PSOC6Log(__VA_ARGS__) #ifdef __cplusplus } diff --git a/examples/persistent-storage/infineon/psoc6/main.cpp b/examples/persistent-storage/infineon/psoc6/main.cpp index f5acd2c5e74318..c1eec3efc2acc4 100644 --- a/examples/persistent-storage/infineon/psoc6/main.cpp +++ b/examples/persistent-storage/infineon/psoc6/main.cpp @@ -33,12 +33,12 @@ void TestTask(void * pvParameter) err = chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init(); if (err != CHIP_NO_ERROR) { - P6_LOG("PersistedStorage::KeyValueStoreMgrImpl().Init() failed"); + PSOC6_LOG("PersistedStorage::KeyValueStoreMgrImpl().Init() failed"); return; } while (true) { - P6_LOG("Running Tests:"); + PSOC6_LOG("Running Tests:"); chip::RunKvsTest(); vTaskDelay(60000); // Run every minute } @@ -55,17 +55,17 @@ extern "C" void vApplicationDaemonTaskStartupHook() int main(int argc, char * argv[]) { - init_p6Platform(); + init_psoc6Platform(); - P6_LOG("=============================================\n"); - P6_LOG("chip-p6-persistent-storage-example starting\n"); - P6_LOG("=============================================\n"); + PSOC6_LOG("=============================================\n"); + PSOC6_LOG("chip-psoc6-persistent-storage-example starting\n"); + PSOC6_LOG("=============================================\n"); - P6_LOG("Starting FreeRTOS scheduler"); + PSOC6_LOG("Starting FreeRTOS scheduler"); vTaskStartScheduler(); // Should never get here. - P6_LOG("vTaskStartScheduler() failed"); + PSOC6_LOG("vTaskStartScheduler() failed"); return -1; } diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index c4141255ad55f3..3b9a3039f30a7a 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -324,7 +341,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -449,7 +466,7 @@ cluster LevelControl = 8 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -610,7 +627,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -626,12 +643,42 @@ cluster AccessControl = 31 { 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; @@ -667,17 +714,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides a standardized way for a Node (typically a Bridge, but could be any Node) to expose action information. */ @@ -939,7 +1010,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -2320,6 +2391,10 @@ cluster BridgedDeviceBasicInformation = 57 { kFabric = 5; } + bitmap Feature : bitmap32 { + kBridgedICDSupport = 0x100000; + } + struct ProductAppearanceStruct { ProductFinishEnum finish = 0; nullable ColorEnum primaryColor = 1; @@ -2339,6 +2414,10 @@ cluster BridgedDeviceBasicInformation = 57 { boolean reachableNewValue = 0; } + info event ActiveChanged = 128 { + int32u promisedActiveDuration = 0; + } + readonly attribute optional char_string<32> vendorName = 1; readonly attribute optional vendor_id vendorID = 2; readonly attribute optional char_string<32> productName = 3; @@ -2353,7 +2432,7 @@ cluster BridgedDeviceBasicInformation = 57 { readonly attribute optional char_string<64> productLabel = 14; readonly attribute optional char_string<32> serialNumber = 15; readonly attribute boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; @@ -2361,6 +2440,13 @@ cluster BridgedDeviceBasicInformation = 57 { readonly attribute attrib_id attributeList[] = 65531; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; + + request struct KeepActiveRequest { + int32u stayActiveDuration = 0; + } + + /** The server SHALL attempt to keep the devices specified active for StayActiveDuration milliseconds when they are next active. */ + command KeepActive(KeepActiveRequest): DefaultSuccess = 128; } /** This cluster exposes interactions with a switch device, for the purpose of using those interactions by other devices. @@ -3020,14 +3106,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + 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; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -3139,7 +3232,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** 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; @@ -4790,7 +4883,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -4857,7 +4951,6 @@ cluster Thermostat = 513 { kMatterScheduleConfiguration = 0x80; kPresets = 0x100; kSetpoints = 0x200; - kQueuedPresetsSupported = 0x400; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -4917,11 +5010,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -4955,11 +5043,6 @@ cluster Thermostat = 513 { PresetTypeFeaturesBitmap presetTypeFeatures = 2; } - struct QueuedPresetStruct { - nullable octet_string<16> presetHandle = 0; - nullable epoch_s transitionTimestamp = 1; - } - struct ScheduleTypeStruct { SystemModeEnum systemMode = 0; int8u numberOfSchedules = 1; @@ -5032,9 +5115,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; - readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5072,17 +5153,12 @@ cluster Thermostat = 513 { request struct SetActivePresetRequestRequest { octet_string<16> presetHandle = 0; - optional int16u delayMinutes = 1; } request struct StartPresetsSchedulesEditRequestRequest { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -5101,10 +5177,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command is sent to cancel a queued preset. */ - command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for configuring and controlling the functionality of a thermostat. */ @@ -5161,7 +5233,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -5228,7 +5301,6 @@ cluster Thermostat = 513 { kMatterScheduleConfiguration = 0x80; kPresets = 0x100; kSetpoints = 0x200; - kQueuedPresetsSupported = 0x400; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -5288,11 +5360,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -5326,11 +5393,6 @@ cluster Thermostat = 513 { PresetTypeFeaturesBitmap presetTypeFeatures = 2; } - struct QueuedPresetStruct { - nullable octet_string<16> presetHandle = 0; - nullable epoch_s transitionTimestamp = 1; - } - struct ScheduleTypeStruct { SystemModeEnum systemMode = 0; int8u numberOfSchedules = 1; @@ -5403,9 +5465,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; - readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5443,17 +5503,12 @@ cluster Thermostat = 513 { request struct SetActivePresetRequestRequest { octet_string<16> presetHandle = 0; - optional int16u delayMinutes = 1; } request struct StartPresetsSchedulesEditRequestRequest { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -5472,10 +5527,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command is sent to cancel a queued preset. */ - command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for configuring the user interface of a thermostat (which may be remote from the thermostat). */ @@ -5548,7 +5599,7 @@ cluster ThermostatUserInterfaceConfiguration = 516 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -5868,7 +5919,7 @@ cluster ColorControl = 768 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -9080,7 +9131,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 0; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; @@ -9231,7 +9282,7 @@ endpoint 1 { ram attribute coupleColorTempToLevelMinMireds; ram attribute startUpColorTemperatureMireds; ram attribute featureMap default = 0; - ram attribute clusterRevision default = 6; + ram attribute clusterRevision default = 7; handle command MoveToHue; handle command MoveHue; diff --git a/examples/placeholder/linux/apps/app1/config.zap b/examples/placeholder/linux/apps/app1/config.zap index 0f7dff994bd646..090e4f74c60881 100644 --- a/examples/placeholder/linux/apps/app1/config.zap +++ b/examples/placeholder/linux/apps/app1/config.zap @@ -12207,7 +12207,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -12587,7 +12587,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -13838,7 +13838,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -14866,7 +14866,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index e5a389e2e4813d..341c9b5b07d725 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -324,7 +341,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -449,7 +466,7 @@ cluster LevelControl = 8 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -610,7 +627,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -626,12 +643,42 @@ cluster AccessControl = 31 { 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; @@ -667,17 +714,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides a standardized way for a Node (typically a Bridge, but could be any Node) to expose action information. */ @@ -939,7 +1010,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -2277,6 +2348,10 @@ cluster BridgedDeviceBasicInformation = 57 { kFabric = 5; } + bitmap Feature : bitmap32 { + kBridgedICDSupport = 0x100000; + } + struct ProductAppearanceStruct { ProductFinishEnum finish = 0; nullable ColorEnum primaryColor = 1; @@ -2296,6 +2371,10 @@ cluster BridgedDeviceBasicInformation = 57 { boolean reachableNewValue = 0; } + info event ActiveChanged = 128 { + int32u promisedActiveDuration = 0; + } + readonly attribute optional char_string<32> vendorName = 1; readonly attribute optional vendor_id vendorID = 2; readonly attribute optional char_string<32> productName = 3; @@ -2310,7 +2389,7 @@ cluster BridgedDeviceBasicInformation = 57 { readonly attribute optional char_string<64> productLabel = 14; readonly attribute optional char_string<32> serialNumber = 15; readonly attribute boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; @@ -2318,6 +2397,13 @@ cluster BridgedDeviceBasicInformation = 57 { readonly attribute attrib_id attributeList[] = 65531; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; + + request struct KeepActiveRequest { + int32u stayActiveDuration = 0; + } + + /** The server SHALL attempt to keep the devices specified active for StayActiveDuration milliseconds when they are next active. */ + command KeepActive(KeepActiveRequest): DefaultSuccess = 128; } /** This cluster exposes interactions with a switch device, for the purpose of using those interactions by other devices. @@ -2977,14 +3063,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + 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; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -3096,7 +3189,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** 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; @@ -4747,7 +4840,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -4814,7 +4908,6 @@ cluster Thermostat = 513 { kMatterScheduleConfiguration = 0x80; kPresets = 0x100; kSetpoints = 0x200; - kQueuedPresetsSupported = 0x400; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -4874,11 +4967,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -4912,11 +5000,6 @@ cluster Thermostat = 513 { PresetTypeFeaturesBitmap presetTypeFeatures = 2; } - struct QueuedPresetStruct { - nullable octet_string<16> presetHandle = 0; - nullable epoch_s transitionTimestamp = 1; - } - struct ScheduleTypeStruct { SystemModeEnum systemMode = 0; int8u numberOfSchedules = 1; @@ -4989,9 +5072,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; - readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5029,17 +5110,12 @@ cluster Thermostat = 513 { request struct SetActivePresetRequestRequest { octet_string<16> presetHandle = 0; - optional int16u delayMinutes = 1; } request struct StartPresetsSchedulesEditRequestRequest { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -5058,10 +5134,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command is sent to cancel a queued preset. */ - command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for configuring and controlling the functionality of a thermostat. */ @@ -5118,7 +5190,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -5185,7 +5258,6 @@ cluster Thermostat = 513 { kMatterScheduleConfiguration = 0x80; kPresets = 0x100; kSetpoints = 0x200; - kQueuedPresetsSupported = 0x400; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -5245,11 +5317,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -5283,11 +5350,6 @@ cluster Thermostat = 513 { PresetTypeFeaturesBitmap presetTypeFeatures = 2; } - struct QueuedPresetStruct { - nullable octet_string<16> presetHandle = 0; - nullable epoch_s transitionTimestamp = 1; - } - struct ScheduleTypeStruct { SystemModeEnum systemMode = 0; int8u numberOfSchedules = 1; @@ -5360,9 +5422,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; - readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5400,17 +5460,12 @@ cluster Thermostat = 513 { request struct SetActivePresetRequestRequest { octet_string<16> presetHandle = 0; - optional int16u delayMinutes = 1; } request struct StartPresetsSchedulesEditRequestRequest { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -5429,10 +5484,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command is sent to cancel a queued preset. */ - command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for configuring the user interface of a thermostat (which may be remote from the thermostat). */ @@ -5505,7 +5556,7 @@ cluster ThermostatUserInterfaceConfiguration = 516 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -5825,7 +5876,7 @@ cluster ColorControl = 768 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -9040,7 +9091,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 0; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; @@ -9170,7 +9221,7 @@ endpoint 1 { ram attribute coupleColorTempToLevelMinMireds; ram attribute startUpColorTemperatureMireds; ram attribute featureMap default = 0; - ram attribute clusterRevision default = 6; + ram attribute clusterRevision default = 7; handle command MoveToHue; handle command MoveHue; diff --git a/examples/placeholder/linux/apps/app2/config.zap b/examples/placeholder/linux/apps/app2/config.zap index 786ccbbea4ee8d..bcd64d2189d645 100644 --- a/examples/placeholder/linux/apps/app2/config.zap +++ b/examples/placeholder/linux/apps/app2/config.zap @@ -12289,7 +12289,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -12637,7 +12637,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -13598,7 +13598,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -14626,7 +14626,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/platform/esp32/common/Esp32AppServer.cpp b/examples/platform/esp32/common/Esp32AppServer.cpp index 1c30098e9010d5..8ee5d4d7a05a27 100644 --- a/examples/platform/esp32/common/Esp32AppServer.cpp +++ b/examples/platform/esp32/common/Esp32AppServer.cpp @@ -51,19 +51,6 @@ using namespace chip::DeviceLayer; static constexpr char TAG[] = "ESP32Appserver"; namespace { -#if CHIP_DEVICE_CONFIG_ENABLE_WIFI -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD || CHIP_DEVICE_CONFIG_ENABLE_ETHERNET -constexpr chip::EndpointId kNetworkCommissioningEndpointWiFi = 0xFFFE; -#else -constexpr chip::EndpointId kNetworkCommissioningEndpointWiFi = 0; -#endif -app::Clusters::NetworkCommissioning::Instance - sWiFiNetworkCommissioningInstance(kNetworkCommissioningEndpointWiFi, &(NetworkCommissioning::ESPWiFiDriver::GetInstance())); -#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI -#if CHIP_DEVICE_CONFIG_ENABLE_ETHERNET -static app::Clusters::NetworkCommissioning::Instance - sEthernetNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::ESPEthernetDriver::GetInstance())); -#endif #if CONFIG_TEST_EVENT_TRIGGER_ENABLED static uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, @@ -150,14 +137,11 @@ void Esp32AppServer::Init(AppDelegate * sAppDelegate) chip::Server::GetInstance().Init(initParams); #if CHIP_DEVICE_CONFIG_ENABLE_WIFI - sWiFiNetworkCommissioningInstance.Init(); #ifdef CONFIG_ENABLE_CHIP_SHELL chip::Shell::SetWiFiDriver(&(chip::DeviceLayer::NetworkCommissioning::ESPWiFiDriver::GetInstance())); #endif #endif -#if CHIP_DEVICE_CONFIG_ENABLE_ETHERNET - sEthernetNetworkCommissioningInstance.Init(); -#endif + #if CHIP_DEVICE_CONFIG_ENABLE_THREAD if (chip::DeviceLayer::ConnectivityMgr().IsThreadProvisioned() && (chip::Server::GetInstance().GetFabricTable().FabricCount() != 0)) diff --git a/examples/platform/esp32/external_platform/ESP32_custom/BUILD.gn b/examples/platform/esp32/external_platform/ESP32_custom/BUILD.gn index d8d2f92b542ac7..93b00ef8f81617 100644 --- a/examples/platform/esp32/external_platform/ESP32_custom/BUILD.gn +++ b/examples/platform/esp32/external_platform/ESP32_custom/BUILD.gn @@ -29,6 +29,7 @@ declare_args() { chip_bt_bluedroid_enabled = true chip_max_discovered_ip_addresses = 5 chip_enable_route_hook = false + chip_enable_thread_border_router = false } buildconfig_header("custom_buildconfig") { diff --git a/examples/platform/esp32/mode-support/static-supported-modes-manager.cpp b/examples/platform/esp32/mode-support/static-supported-modes-manager.cpp new file mode 100644 index 00000000000000..d06a8b8b7dc809 --- /dev/null +++ b/examples/platform/esp32/mode-support/static-supported-modes-manager.cpp @@ -0,0 +1,223 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "static-supported-modes-manager.h" +#include + +using namespace chip; +using namespace chip::app::Clusters; +using namespace chip::DeviceLayer::Internal; +using namespace chip::app::Clusters::ModeSelect; +using chip::Protocols::InteractionModel::Status; + +using ModeOptionStructType = Structs::ModeOptionStruct::Type; +using SemanticTag = Structs::SemanticTagStruct::Type; + +template +using List = app::DataModel::List; + +SupportedModesManager::ModeOptionsProvider * StaticSupportedModesManager::epModeOptionsProviderList = nullptr; + +const StaticSupportedModesManager StaticSupportedModesManager::instance = StaticSupportedModesManager(); + +int StaticSupportedModesManager::mSize = 0; + +CHIP_ERROR StaticSupportedModesManager::InitEndpointArray(int size) +{ + if (epModeOptionsProviderList != nullptr) + { + ChipLogError(Zcl, "Cannot allocate epModeOptionsProviderList"); + return CHIP_ERROR_INCORRECT_STATE; + } + mSize = size; + epModeOptionsProviderList = new SupportedModesManager::ModeOptionsProvider[mSize]; + if (epModeOptionsProviderList == nullptr) + { + ChipLogError(Zcl, "Failed to allocate memory to epModeOptionsProviderList"); + return CHIP_ERROR_NO_MEMORY; + } + for (int i = 0; i < mSize; i++) + { + epModeOptionsProviderList[i] = ModeOptionsProvider(); + } + return CHIP_NO_ERROR; +} + +SupportedModesManager::ModeOptionsProvider StaticSupportedModesManager::getModeOptionsProvider(EndpointId endpointId) const +{ + if (epModeOptionsProviderList[endpointId].begin() != nullptr && epModeOptionsProviderList[endpointId].end() != nullptr) + { + return ModeOptionsProvider(epModeOptionsProviderList[endpointId].begin(), epModeOptionsProviderList[endpointId].end()); + } + + ModeOptionStructType * modeOptionStructList = nullptr; + SemanticTag * semanticTags = nullptr; + + char keyBuf[ESP32Config::kMaxConfigKeyNameLength]; + uint32_t supportedModeCount = 0; + + VerifyOrReturnValue(ESP32Config::KeyAllocator::SupportedModesCount(keyBuf, sizeof(keyBuf), endpointId) == CHIP_NO_ERROR, + ModeOptionsProvider(nullptr, nullptr)); + ESP32Config::Key countKey(ESP32Config::kConfigNamespace_ChipFactory, keyBuf); + VerifyOrReturnValue(ESP32Config::ReadConfigValue(countKey, supportedModeCount) == CHIP_NO_ERROR, + ModeOptionsProvider(nullptr, nullptr)); + + modeOptionStructList = new ModeOptionStructType[supportedModeCount]; + if (modeOptionStructList == nullptr) + { + return ModeOptionsProvider(nullptr, nullptr); + } + + epModeOptionsProviderList[endpointId] = ModeOptionsProvider(modeOptionStructList, modeOptionStructList + supportedModeCount); + + for (int index = 0; index < supportedModeCount; index++) + { + Structs::ModeOptionStruct::Type option; + uint32_t supportedModeMode = 0; + uint32_t semanticTagCount = 0; + size_t outLen = 0; + + memset(keyBuf, 0, sizeof(char) * ESP32Config::kMaxConfigKeyNameLength); + VerifyOrReturnValue(ESP32Config::KeyAllocator::SupportedModesLabel(keyBuf, sizeof(keyBuf), endpointId, index) == + CHIP_NO_ERROR, + ModeOptionsProvider(nullptr, nullptr), CleanUp(endpointId)); + ESP32Config::Key labelKey(ESP32Config::kConfigNamespace_ChipFactory, keyBuf); + VerifyOrReturnValue(ESP32Config::ReadConfigValueStr(labelKey, nullptr, 0, outLen) == CHIP_NO_ERROR, + ModeOptionsProvider(nullptr, nullptr), CleanUp(endpointId)); + + char * modeLabel = new char[outLen + 1]; + if (modeLabel == nullptr) + { + CleanUp(endpointId); + return ModeOptionsProvider(nullptr, nullptr); + } + + VerifyOrReturnValue(ESP32Config::ReadConfigValueStr(labelKey, modeLabel, outLen + 1, outLen) == CHIP_NO_ERROR, + ModeOptionsProvider(nullptr, nullptr), CleanUp(endpointId)); + + memset(keyBuf, 0, sizeof(char) * ESP32Config::kMaxConfigKeyNameLength); + VerifyOrReturnValue(ESP32Config::KeyAllocator::SupportedModesValue(keyBuf, sizeof(keyBuf), endpointId, index) == + CHIP_NO_ERROR, + ModeOptionsProvider(nullptr, nullptr), CleanUp(endpointId)); + ESP32Config::Key modeKey(ESP32Config::kConfigNamespace_ChipFactory, keyBuf); + VerifyOrReturnValue(ESP32Config::ReadConfigValue(labelKey, supportedModeMode) == CHIP_NO_ERROR, + ModeOptionsProvider(nullptr, nullptr), CleanUp(endpointId)); + + memset(keyBuf, 0, sizeof(char) * ESP32Config::kMaxConfigKeyNameLength); + VerifyOrReturnValue(ESP32Config::KeyAllocator::SemanticTagsCount(keyBuf, sizeof(keyBuf), endpointId, index) == + CHIP_NO_ERROR, + ModeOptionsProvider(nullptr, nullptr), CleanUp(endpointId)); + ESP32Config::Key stCountKey(ESP32Config::kConfigNamespace_ChipFactory, keyBuf); + VerifyOrReturnValue(ESP32Config::ReadConfigValue(stCountKey, semanticTagCount) == CHIP_NO_ERROR, + ModeOptionsProvider(nullptr, nullptr), CleanUp(endpointId)); + + semanticTags = new SemanticTag[semanticTagCount]; + if (semanticTags == nullptr) + { + CleanUp(endpointId); + return ModeOptionsProvider(nullptr, nullptr); + } + for (auto stIndex = 0; stIndex < semanticTagCount; stIndex++) + { + + uint32_t semanticTagValue = 0; + uint32_t semanticTagMfgCode = 0; + SemanticTag tag; + + memset(keyBuf, 0, sizeof(char) * ESP32Config::kMaxConfigKeyNameLength); + VerifyOrReturnValue(ESP32Config::KeyAllocator::SemanticTagValue(keyBuf, sizeof(keyBuf), endpointId, index, stIndex) == + CHIP_NO_ERROR, + ModeOptionsProvider(nullptr, nullptr), CleanUp(endpointId)); + ESP32Config::Key stValueKey(ESP32Config::kConfigNamespace_ChipFactory, keyBuf); + VerifyOrReturnValue(ESP32Config::ReadConfigValue(stValueKey, semanticTagValue) == CHIP_NO_ERROR, + ModeOptionsProvider(nullptr, nullptr), CleanUp(endpointId)); + + memset(keyBuf, 0, sizeof(char) * ESP32Config::kMaxConfigKeyNameLength); + VerifyOrReturnValue(ESP32Config::KeyAllocator::SemanticTagMfgCode(keyBuf, sizeof(keyBuf), endpointId, index, stIndex) == + CHIP_NO_ERROR, + ModeOptionsProvider(nullptr, nullptr), CleanUp(endpointId)); + ESP32Config::Key stMfgCodeKey(ESP32Config::kConfigNamespace_ChipFactory, keyBuf); + VerifyOrReturnValue(ESP32Config::ReadConfigValue(stMfgCodeKey, semanticTagMfgCode) == CHIP_NO_ERROR, + ModeOptionsProvider(nullptr, nullptr), CleanUp(endpointId)); + + tag.value = static_cast(semanticTagValue); + tag.mfgCode = static_cast(semanticTagMfgCode); + semanticTags[stIndex] = tag; + } + + option.label = chip::CharSpan::fromCharString(modeLabel); + option.mode = static_cast(supportedModeMode); + option.semanticTags = DataModel::List(semanticTags, semanticTagCount); + + modeOptionStructList[index] = option; + } + + return ModeOptionsProvider(modeOptionStructList, modeOptionStructList + supportedModeCount); +} + +Status StaticSupportedModesManager::getModeOptionByMode(unsigned short endpointId, unsigned char mode, + const ModeOptionStructType ** dataPtr) const +{ + auto modeOptionsProvider = this->getModeOptionsProvider(endpointId); + if (modeOptionsProvider.begin() == nullptr) + { + return Status::UnsupportedCluster; + } + auto * begin = modeOptionsProvider.begin(); + auto * end = modeOptionsProvider.end(); + + for (auto * it = begin; it != end; ++it) + { + auto & modeOption = *it; + if (modeOption.mode == mode) + { + *dataPtr = &modeOption; + return Status::Success; + } + } + ChipLogProgress(Zcl, "Cannot find the mode %u", mode); + return Status::InvalidCommand; +} + +const ModeSelect::SupportedModesManager * ModeSelect::getSupportedModesManager() +{ + return &StaticSupportedModesManager::getStaticSupportedModesManagerInstance(); +} + +void StaticSupportedModesManager::FreeSupportedModes(EndpointId endpointId) const +{ + if (epModeOptionsProviderList[endpointId].begin() != nullptr) + { + auto * begin = epModeOptionsProviderList[endpointId].begin(); + auto * end = epModeOptionsProviderList[endpointId].end(); + for (auto * it = begin; it != end; ++it) + { + auto & modeOption = *it; + delete[] modeOption.label.data(); + delete[] modeOption.semanticTags.data(); + } + delete[] begin; + } + epModeOptionsProviderList[endpointId] = ModeOptionsProvider(); +} + +void StaticSupportedModesManager::CleanUp(EndpointId endpointId) const +{ + ChipLogError(Zcl, "Supported mode data is in incorrect format"); + FreeSupportedModes(endpointId); +} diff --git a/examples/platform/esp32/mode-support/static-supported-modes-manager.h b/examples/platform/esp32/mode-support/static-supported-modes-manager.h new file mode 100644 index 00000000000000..8d6bb3c665ff0c --- /dev/null +++ b/examples/platform/esp32/mode-support/static-supported-modes-manager.h @@ -0,0 +1,80 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ModeSelect { + +class StaticSupportedModesManager : public chip::app::Clusters::ModeSelect::SupportedModesManager +{ +private: + using ModeOptionStructType = Structs::ModeOptionStruct::Type; + using SemanticTag = Structs::SemanticTagStruct::Type; + static int mSize; + + static ModeOptionsProvider * epModeOptionsProviderList; + + void FreeSupportedModes(EndpointId endpointId) const; + + static const StaticSupportedModesManager instance; + +public: + // InitEndpointArray should be called only once in the application. Memory allocated to the + // epModeOptionsProviderList will be needed for the lifetime of the program, so it's never deallocated. + static CHIP_ERROR InitEndpointArray(int size); + + // DeInitEndpointArray should be called only when application need to reallocate memory of + // epModeOptionsProviderList ( Eg. Bridges ). + static void DeInitEndpointArray() + { + delete[] epModeOptionsProviderList; + epModeOptionsProviderList = nullptr; + mSize = 0; + } + + SupportedModesManager::ModeOptionsProvider getModeOptionsProvider(EndpointId endpointId) const override; + + Protocols::InteractionModel::Status getModeOptionByMode(EndpointId endpointId, uint8_t mode, + const ModeOptionStructType ** dataPtr) const override; + + void CleanUp(EndpointId endpointId) const; + + StaticSupportedModesManager() {} + + ~StaticSupportedModesManager() + { + for (int i = 0; i < mSize; i++) + { + FreeSupportedModes(i); + } + } + + static inline const StaticSupportedModesManager & getStaticSupportedModesManagerInstance() { return instance; } +}; + +const SupportedModesManager * getSupportedModesManager(); + +} // namespace ModeSelect +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/platform/infineon/psoc6/init_psoc6Platform.cpp b/examples/platform/infineon/psoc6/init_psoc6Platform.cpp index 85c8ae5ffa6092..1b236bf73c9ef0 100644 --- a/examples/platform/infineon/psoc6/init_psoc6Platform.cpp +++ b/examples/platform/infineon/psoc6/init_psoc6Platform.cpp @@ -47,7 +47,7 @@ #include #include -void init_p6Platform(void) +void init_psoc6Platform(void) { /* Initialize the board support package */ cybsp_init(); diff --git a/examples/platform/infineon/psoc6/init_psoc6Platform.h b/examples/platform/infineon/psoc6/init_psoc6Platform.h index 68ab7df04cc03e..8b4c075731bec0 100644 --- a/examples/platform/infineon/psoc6/init_psoc6Platform.h +++ b/examples/platform/infineon/psoc6/init_psoc6Platform.h @@ -18,4 +18,4 @@ /*******************************************************************************/ #pragma once -void init_p6Platform(void); +void init_psoc6Platform(void); diff --git a/examples/platform/linux/AppMain.cpp b/examples/platform/linux/AppMain.cpp index b92d76e613e618..307b3428126db2 100644 --- a/examples/platform/linux/AppMain.cpp +++ b/examples/platform/linux/AppMain.cpp @@ -90,6 +90,12 @@ #if CHIP_DEVICE_CONFIG_ENABLE_ENERGY_REPORTING_TRIGGER #include #endif +#if CHIP_DEVICE_CONFIG_ENABLE_WATER_HEATER_MANAGEMENT_TRIGGER +#include +#endif +#if CHIP_DEVICE_CONFIG_ENABLE_DEVICE_ENERGY_MANAGEMENT_TRIGGER +#include +#endif #include #include @@ -361,12 +367,15 @@ int ChipLinuxAppInit(int argc, char * const argv[], OptionSet * customOptions, #if CONFIG_NETWORK_LAYER_BLE RendezvousInformationFlags rendezvousFlags = RendezvousInformationFlag::kBLE; #else // CONFIG_NETWORK_LAYER_BLE - RendezvousInformationFlag rendezvousFlags = RendezvousInformationFlag::kOnNetwork; + RendezvousInformationFlags rendezvousFlags = RendezvousInformationFlag::kOnNetwork; #endif // CONFIG_NETWORK_LAYER_BLE #ifdef CONFIG_RENDEZVOUS_MODE rendezvousFlags = static_cast(CONFIG_RENDEZVOUS_MODE); #endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + rendezvousFlags.Set(RendezvousInformationFlag::kWiFiPAF); +#endif err = Platform::MemoryInit(); SuccessOrExit(err); @@ -465,6 +474,20 @@ int ChipLinuxAppInit(int argc, char * const argv[], OptionSet * customOptions, } } #endif // CHIP_DEVICE_CONFIG_ENABLE_WPA +#if CHIP_DEVICE_CONFIG_ENABLE_WPA && CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + ChipLogProgress(NotSpecified, "WiFi-PAF: initialzing"); + if (LinuxDeviceOptions::GetInstance().mWiFi) + { + if (EnsureWiFiIsStarted()) + { + ChipLogProgress(NotSpecified, "Wi-Fi Management started"); + DeviceLayer::ConnectivityManager::WiFiPAFAdvertiseParam args; + args.enable = LinuxDeviceOptions::GetInstance().mWiFiPAF; + args.ExtCmds = LinuxDeviceOptions::GetInstance().mWiFiPAFExtCmds; + DeviceLayer::ConnectivityMgr().SetWiFiPAFAdvertisingEnabled(args); + } + } +#endif #if CHIP_ENABLE_OPENTHREAD if (LinuxDeviceOptions::GetInstance().mThread) @@ -553,6 +576,14 @@ void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl) static EnergyReportingTestEventTriggerHandler sEnergyReportingTestEventTriggerHandler; sTestEventTriggerDelegate.AddHandler(&sEnergyReportingTestEventTriggerHandler); #endif +#if CHIP_DEVICE_CONFIG_ENABLE_WATER_HEATER_MANAGEMENT_TRIGGER + static WaterHeaterManagementTestEventTriggerHandler sWaterHeaterManagementTestEventTriggerHandler; + sTestEventTriggerDelegate.AddHandler(&sWaterHeaterManagementTestEventTriggerHandler); +#endif +#if CHIP_DEVICE_CONFIG_ENABLE_DEVICE_ENERGY_MANAGEMENT_TRIGGER + static DeviceEnergyManagementTestEventTriggerHandler sDeviceEnergyManagementTestEventTriggerHandler; + sTestEventTriggerDelegate.AddHandler(&sDeviceEnergyManagementTestEventTriggerHandler); +#endif initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; diff --git a/examples/platform/linux/BUILD.gn b/examples/platform/linux/BUILD.gn index 4641eae6446e04..410b1a189245d2 100644 --- a/examples/platform/linux/BUILD.gn +++ b/examples/platform/linux/BUILD.gn @@ -24,6 +24,8 @@ declare_args() { chip_enable_boolean_state_configuration_trigger = false chip_enable_energy_evse_trigger = false chip_enable_energy_reporting_trigger = false + chip_enable_water_heater_management_trigger = false + chip_enable_device_energy_management_trigger = false } config("app-main-config") { @@ -52,6 +54,14 @@ source_set("energy-reporting-test-event-trigger") { sources = [ "${chip_root}/src/app/clusters/electrical-energy-measurement-server/EnergyReportingTestEventTriggerHandler.h" ] } +source_set("water-heater-management-test-event-trigger") { + sources = [ "${chip_root}/src/app/clusters/water-heater-management-server/WaterHeaterManagementTestEventTriggerHandler.h" ] +} + +source_set("device-energy-management-test-event-trigger") { + sources = [ "${chip_root}/src/app/clusters/device-energy-management-server/DeviceEnergyManagementTestEventTriggerHandler.h" ] +} + source_set("app-main") { defines = [ "ENABLE_TRACING=${matter_enable_tracing_support}" ] sources = [ @@ -75,9 +85,13 @@ source_set("app-main") { public_deps = [ ":boolean-state-configuration-test-event-trigger", + ":device-energy-management-test-event-trigger", ":energy-evse-test-event-trigger", ":energy-reporting-test-event-trigger", ":smco-test-event-trigger", + ":water-heater-management-test-event-trigger", + "${chip_root}/src/controller:controller", + "${chip_root}/src/controller:gen_check_chip_controller_headers", "${chip_root}/src/lib", "${chip_root}/src/platform/logging:stdio", ] @@ -117,6 +131,8 @@ source_set("app-main") { "CHIP_DEVICE_CONFIG_ENABLE_BOOLEAN_STATE_CONFIGURATION_TRIGGER=${chip_enable_boolean_state_configuration_trigger}", "CHIP_DEVICE_CONFIG_ENABLE_ENERGY_EVSE_TRIGGER=${chip_enable_energy_evse_trigger}", "CHIP_DEVICE_CONFIG_ENABLE_ENERGY_REPORTING_TRIGGER=${chip_enable_energy_reporting_trigger}", + "CHIP_DEVICE_CONFIG_ENABLE_WATER_HEATER_MANAGEMENT_TRIGGER=${chip_enable_water_heater_management_trigger}", + "CHIP_DEVICE_CONFIG_ENABLE_DEVICE_ENERGY_MANAGEMENT_TRIGGER=${chip_enable_device_energy_management_trigger}", ] public_configs = [ ":app-main-config" ] @@ -133,7 +149,11 @@ source_set("commissioner-main") { defines += [ "ENABLE_CHIP_SHELL" ] } - public_deps = [ "${chip_root}/src/lib" ] + public_deps = [ + "${chip_root}/src/controller:controller", + "${chip_root}/src/controller:gen_check_chip_controller_headers", + "${chip_root}/src/lib", + ] deps = [ "${chip_root}/src/app/server" ] if (chip_enable_transport_trace) { diff --git a/examples/platform/linux/Options.cpp b/examples/platform/linux/Options.cpp index 9d6edc8bc43846..9b83d126c1f495 100644 --- a/examples/platform/linux/Options.cpp +++ b/examples/platform/linux/Options.cpp @@ -106,6 +106,9 @@ enum #if CHIP_WITH_NLFAULTINJECTION kDeviceOption_FaultInjection, #endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + kDeviceOption_WiFi_PAF, +#endif }; constexpr unsigned kAppUsageLength = 64; @@ -117,6 +120,9 @@ OptionDef sDeviceOptionDefs[] = { #if CHIP_DEVICE_CONFIG_ENABLE_WIFI { "wifi", kNoArgument, kDeviceOption_WiFi }, { "wifi-supports-5g", kNoArgument, kDeviceOption_WiFiSupports5g }, +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + { "wifipaf", kArgumentRequired, kDeviceOption_WiFi_PAF }, +#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF #endif // CHIP_DEVICE_CONFIG_ENABLE_WPA #if CHIP_ENABLE_OPENTHREAD { "thread", kNoArgument, kDeviceOption_Thread }, @@ -189,6 +195,12 @@ const char * sDeviceOptionHelp = " --wifi-supports-5g\n" " Indicate that local Wi-Fi hardware should report 5GHz support.\n" #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + "\n" + " --wifipaf freq_list=,... \n" + " Enable Wi-Fi PAF via wpa_supplicant.\n" + " Give an empty string if not setting freq_list: \"\"\n" +#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFIPAFs #if CHIP_ENABLE_OPENTHREAD "\n" " --thread\n" @@ -588,6 +600,13 @@ bool HandleOption(const char * aProgram, OptionSet * aOptions, int aIdentifier, } break; } +#endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + case kDeviceOption_WiFi_PAF: { + LinuxDeviceOptions::GetInstance().mWiFiPAF = true; + LinuxDeviceOptions::GetInstance().mWiFiPAFExtCmds = aValue; + break; + } #endif default: PrintArgError("%s: INTERNAL ERROR: Unhandled option: %s\n", aProgram, aName); diff --git a/examples/platform/linux/Options.h b/examples/platform/linux/Options.h index 51e60f0ab63eca..f921bee4ced554 100644 --- a/examples/platform/linux/Options.h +++ b/examples/platform/linux/Options.h @@ -49,6 +49,10 @@ struct LinuxDeviceOptions bool wifiSupports5g = false; bool mWiFi = false; bool mThread = false; +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + bool mWiFiPAF = false; + const char * mWiFiPAFExtCmds = nullptr; +#endif #if CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE || CHIP_DEVICE_ENABLE_PORT_PARAMS uint16_t securedDevicePort = CHIP_PORT; uint16_t unsecuredCommissionerPort = CHIP_UDC_PORT; diff --git a/examples/platform/linux/RpcClientProcessor.cpp b/examples/platform/linux/RpcClientProcessor.cpp index a2cbe5694f531d..2b2fd661bc2771 100644 --- a/examples/platform/linux/RpcClientProcessor.cpp +++ b/examples/platform/linux/RpcClientProcessor.cpp @@ -33,7 +33,6 @@ namespace { // Constants constexpr size_t kMaxTransmissionUnit = 256; -constexpr uint32_t kDefaultChannelId = 1; const char * kDefaultRpcServerAddress = "127.0.0.1"; // RPC Stream and Channel Setup diff --git a/examples/platform/nxp/rt/rw61x/app/ldscripts/RW610_flash.ld b/examples/platform/nxp/rt/rw61x/app/ldscripts/RW610_flash.ld deleted file mode 100644 index eec10d6fddafde..00000000000000 --- a/examples/platform/nxp/rt/rw61x/app/ldscripts/RW610_flash.ld +++ /dev/null @@ -1,599 +0,0 @@ -/* -** ################################################################### -** Processors: RW610EVA0IK -** RW610EVA0IMP -** RW610HNA0IK -** RW610HNA0IMP -** RW610UKA0IZ -** -** Compiler: GNU C Compiler -** Reference manual: RW61X User manual Rev. 0.95, June 2022 -** Version: rev. 1.0, 2021-03-16 -** Build: b220615 -** -** Abstract: -** Linker file for the GNU C Compiler -** -** Copyright 2016 Freescale Semiconductor, Inc. -** Copyright 2016-2023 NXP -** All rights reserved. -** -** SPDX-License-Identifier: BSD-3-Clause -** -** http: www.nxp.com -** mail: support@nxp.com -** -** ################################################################### -*/ - -/** - * @file - * Linker instructions for RW610 - */ - -/** If OTA is enabled : MCUBoot bootloader resides at the base of the flash and occupies 0x20000 (128 kBytes) - slot 0 : main application partition (active app) - slot0 = header + ivt + m_app_cpu3 + fw_storage (cpu1/cpu2 fw) + trailer - slot 1 : OTA Update storage partition (candidate app) - slot1 = OTA image (the image received is already wrapped with header & trailer) -**/ - -/************************ Flash Layout with OTA enabled ********************* - - 0x0800_0000 FLASH_START - - - - +---------------+ - - - - - - - - - - - - - - - - - - - - - | | - | MCUBoot | - 128k | bootloader | - | | - - - - +---------------+ - - - - - - - - - - - - - - - - - - - - - 4k | Header_slot0 | ' - +---------------+ m_interrupts_start ' - | m_interrupts | ' ' - +---------------+ m_text_start ' ' - | | ' m_app_cpu3 ' - m_app_ | | ' + ' -_stated_ | m_text | ' fw_storage ' ACTIVE_APP (slot 0) - _size | | ' ' (4.4 MB) - | | ' ' - | | ' ' - +---------------+ m_text_end ' ' - 4k | Trailer_slot0 | ' - +---------------+ ' - 4k | padding | ' - - - - +---------------+ - - - - - - - - - - - - - - - - - - - - - | | FW_UPDATE_STORAGE_START ' - | | ' - | | ' - | | ' - | | ' - | OTA | ' - | Update | ' CANDIDATE_APP (slot 1) - | Image | ' (4.4 MB) - | | ' - | | ' - | | ' - | | ' - | | FW_UPDATE_STORAGE_END ' - - - - +---------------+ - - - - - - - - - - - - - - - - - - - - - + + - + + - - - - +---------------+ - - - - - - - - - - - - - - - - - - - - - | | NV_STORAGE_START_ADDRESS - | NVM_region | - | | NV_STORAGE_END_ADDRESS - - - - +---------------+ - - - - - - - - - - - - - - - - - - - - - 4k | FactoryData | - - - - +---------------+ - - - - - - - - - - - - - - - - - - - - - 0x0C00_0000 FLASH_END - -*****************************************************************************/ - -/* Entry Point */ -ENTRY(Reset_Handler) - -HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0; -STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0A00; -M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x00000280 : 0; - -/* -------------------------------------------------------------------------- */ -/* FLEX SPI FLASH */ -/* -------------------------------------------------------------------------- */ - -m_flash_start = 0x08000000; -m_flash_size = 0x04000000; /* 64 MB */ -m_flash_end = m_flash_start + m_flash_size - 1; -m_sector_size = 0x1000; -m_vector_table_size = 0x280; - -m_flash_config_start = 0x08000400; -m_flash_config_size = 0xC00; -m_flash_config_end = m_flash_config_start + m_flash_config_size - 1; - -/* - * If OTA is enabled, we must reserve enough space for MCUboot and the image header. - * Note that MCUboot itself embeds the FlashConfig section. -*/ -m_mcuboot_size = DEFINED(__m_mcuboot_size__) ? __m_mcuboot_size__ : 0; /* 128 kB but 64kB could be enough */ -m_mcuboot_start = m_flash_start; /* The flash config section is comprised */ -m_mcuboot_end = m_mcuboot_start + m_mcuboot_size - 1; -m_mcuboot_img_hdr_sz = ((0x400 + (m_sector_size - 1))/m_sector_size)*m_sector_size; - -/* CPU1/CPU2 fw storage section */ -wifi_fw_size = 0xA0000; /* 640kB */ -ble_fw_size = 0x50000; /* 320kB */ -z154_fw_size = 0x50000; /* 320kB */ -/* fw_storage_size is the maximum possible size of CPU1 + CPU2 binaries. */ -fw_storage_size = (wifi_fw_size + ble_fw_size + z154_fw_size); - - -/* Active application section - * If OTA is enabled, the application starts after mcuboot app + image header. - * We reserve cpu3_app max size plus enough to store CPU1 and CPU2 apps because - * CPU1 and CPU2 binaries are embedded in app core binary. -*/ - -m_app_start = DEFINED(__m_mcuboot_size__) ? m_mcuboot_end + 1 : m_flash_config_end + 1; -m_app_trailer_size = m_sector_size; -m_padding_size = m_sector_size; - -/* Maximum number of sectors per slot */ -m_app_max_sectors = 0x440; /* (4.4MB / m_sector_size) */ - -/* The active image section contains the mcuboot header + m_interrupts + cpu3/cpu2/cpu1 apps + trailer - * The maximum image size available for the application is the (total_slot_size - m_padding_size). - * This is due to the last sector being used by mcuboot to perform the swap-move of the upgrade. -*/ -FW_ACTIVE_APP_START = m_app_start; -FW_ACTIVE_APP_OFFSET = m_app_start - m_flash_start; -FW_ACTIVE_APP_SIZE = m_sector_size * m_app_max_sectors - m_padding_size; -FW_ACTIVE_APP_END = FW_ACTIVE_APP_START + FW_ACTIVE_APP_SIZE - 1; - -/* The size of the stated application includes the sizes of cpu1/cpu2/cpu3 apps. - * Note that an empty sector (padding) must be kept at the end of the active image section, - * this would be used by mcuboot to perform a swap-move operation of the upgrade. - */ -m_app_stated_size = FW_ACTIVE_APP_SIZE - m_mcuboot_img_hdr_sz - m_app_trailer_size; - -m_interrupts_start = DEFINED(__m_mcuboot_size__) ? m_app_start + m_mcuboot_img_hdr_sz : m_app_start; -m_interrupts_end = m_interrupts_start + m_vector_table_size - 1; - -m_text_start = m_interrupts_end + 1; -m_text_size = m_app_stated_size - m_vector_table_size; -m_text_end = m_text_start + m_text_size - 1; - - - -/* Candidate application (OTA Update Image) section - * The size of the candidate image (slot 1) is equal to the active image (slot 0) size -*/ -FW_UPDATE_STORAGE_START = FW_ACTIVE_APP_END + 1 + m_padding_size; -FW_UPDATE_STORAGE_SIZE = FW_ACTIVE_APP_SIZE; -FW_UPDATE_STORAGE_OFFSET = FW_UPDATE_STORAGE_START - m_flash_start; -FW_UPDATE_STORAGE_END = FW_UPDATE_STORAGE_START + FW_UPDATE_STORAGE_SIZE - 1; - -fw_top = FW_UPDATE_STORAGE_END + 1; - -/*** FactoryData space 1 sector is reserved ***/ -__FACTORY_DATA_SIZE = m_sector_size; -__FACTORY_DATA_END = m_flash_end; -__FACTORY_DATA_START = __FACTORY_DATA_END - __FACTORY_DATA_SIZE + 1; -__FACTORY_DATA_START_OFFSET = __FACTORY_DATA_START - m_flash_start; - -/* FileSystem Configuration */ -NV_STORAGE_END_ADDRESS = __FACTORY_DATA_START - 1; -NV_STORAGE_MAX_SECTORS = DEFINED(gNVMSectorCountLink_d) ? gNVMSectorCountLink_d : 16; -NV_STORAGE_SECTOR_SIZE = m_sector_size; -NV_STORAGE_SIZE = NV_STORAGE_SECTOR_SIZE * NV_STORAGE_MAX_SECTORS; -NV_STORAGE_START_ADDRESS = NV_STORAGE_END_ADDRESS - NV_STORAGE_SIZE + 1; -NV_STORAGE_START_ADDRESS_OFFSET = NV_STORAGE_START_ADDRESS - m_flash_start; - -/* -------------------------------------------------------------------------- */ -/* RAM */ -/* -------------------------------------------------------------------------- */ - -m_data_start = 0x20000000; -m_data_size = 0x00130000; -m_data_end = 0x2012FFFF; - -/* -------------------------------------------------------------------------- */ -/* SMU1 - CPU3/CPU1 */ -/* -------------------------------------------------------------------------- */ - -m_sqram_cpu13_mbox_start = 0x41380000; -m_sqram_cpu13_mbox_size = 0x00000488; -m_sqram_cpu13_mbox_end = m_sqram_cpu13_mbox_start + m_sqram_cpu13_mbox_size - 1; - -m_sqram_cpu13_txq_start = m_sqram_cpu13_mbox_end + 1; -m_sqram_cpu13_txq_size = 0x1000; -m_sqram_cpu13_txq_end = m_sqram_cpu13_txq_start + m_sqram_cpu13_txq_size - 1; - -/* -------------------------------------------------------------------------- */ -/* SMU2 - CPU3/CPU2 */ -/* -------------------------------------------------------------------------- */ - -m_sqram_cpu23_mbox_start = 0x443C0000; -m_sqram_cpu23_mbox_size = 0x00000488; -m_sqram_cpu23_mbox_end = m_sqram_cpu23_mbox_start + m_sqram_cpu23_mbox_size - 1; - -m_sqram_cpu23_txq_start = m_sqram_cpu23_mbox_end + 1; -m_sqram_cpu23_txq_size = 0x1080; -m_sqram_cpu23_txq_end = m_sqram_cpu23_txq_start + m_sqram_cpu23_txq_size - 1; - -m_sqram_cpu32_txq_start = m_sqram_cpu23_txq_end + 1; -m_sqram_cpu32_txq_size = 0x1080; -m_sqram_cpu32_txq_end = m_sqram_cpu32_txq_start + m_sqram_cpu32_txq_size - 1; - - -/* Specify the memory areas */ -MEMORY -{ - m_flash_config (RX) : ORIGIN = m_flash_config_start, LENGTH = m_flash_config_size - m_interrupts (RX) : ORIGIN = m_interrupts_start, LENGTH = m_vector_table_size - m_text (RX) : ORIGIN = m_text_start, LENGTH = m_text_size - m_nvm_region (RW) : ORIGIN = NV_STORAGE_START_ADDRESS, LENGTH = NV_STORAGE_SIZE - m_data (RW) : ORIGIN = m_data_start, LENGTH = m_data_size - m_sqram_cpu13_mbox (RW) : ORIGIN = m_sqram_cpu13_mbox_start, LENGTH = m_sqram_cpu13_mbox_size - m_sqram_cpu13_txq (RW) : ORIGIN = m_sqram_cpu13_txq_start, LENGTH = m_sqram_cpu13_txq_size - m_sqram_cpu23_mbox (RW) : ORIGIN = m_sqram_cpu23_mbox_start, LENGTH = m_sqram_cpu23_mbox_size - m_sqram_cpu23_txq (RW) : ORIGIN = m_sqram_cpu23_txq_start, LENGTH = m_sqram_cpu23_txq_size - m_sqram_cpu32_txq (RW) : ORIGIN = m_sqram_cpu32_txq_start, LENGTH = m_sqram_cpu32_txq_size -} - - -/* Define output sections */ -SECTIONS -{ - .flash_config : ALIGN(4) - { - . = ALIGN(4); - __FLASH_BASE = .; - KEEP(* (.flash_conf)) /* flash config section */ - . = ALIGN(4); - } > m_flash_config - - /* The startup code goes first into internal ram */ - .interrupts : - { - . = ALIGN(4); - __VECTOR_TABLE = .; - __Vectors = .; - KEEP(*(.isr_vector)) /* Startup code */ - . = ALIGN(4); - } > m_interrupts - - /* The program code and other data goes into internal ram */ - .text : - { - . = ALIGN(4); - *(.rcs.*) - *(EXCLUDE_FILE( - *port.c.obj - *portasm.c.obj - *queue.c.obj - *timers.c.obj - *tasks.c.obj - *inet_chksum.c.obj - *ip4.c.obj - *pbuf.c.obj - *sys_arch.c.obj - *tcp_out.c.obj - *tcp_in.c.obj - *mlan_11n_rxreorder.c.obj - *mlan_wmm.c.obj - *wifi.c.obj - *wifi-imu.c.obj - *fsl_adapter_rfimu.c.obj - *fsl_cache.c.obj - *fsl_os_abstraction_free_rtos.c.obj - /* Exclude flash and frequently executed functions from XIP */ - *fsl_adapter_flexspi_nor_flash.c.o - *mflash_drv.c.o - *fsl_flexspi.c.o - ) .text*) /* .text* sections (code) */ - /*(EXCLUDE_FILE( - /* Exclude flash and frequently executed functions from XIP * - *fsl_adapter_flexspi_nor_flash.c.o - *mflash_drv.c.o - *fsl_flexspi.c.o - ).rodata*) /* .rodata* sections (constants, strings, etc.) */ - *(.rodata .rodata.* .constdata .constdata.*) - *(.glue_7) /* glue arm to thumb code */ - *(.glue_7t) /* glue thumb to arm code */ - *(.eh_frame) - KEEP (*(.init)) - KEEP (*(.fini)) - . = ALIGN(4); - } > m_text - - ._bt_settings_area : - { - . = ALIGN(4); - _bt_settings_start = .; - KEEP(*(SORT(._bt_settings.static.*))) - _bt_settings_end = .; - . = ALIGN(4); - } > m_text - - ._settings_handler_static : - { - . = ALIGN(4); - _settings_handler_static_list_start = .; - KEEP(*(SORT(._settings_handler_static.static.*))) - _settings_handler_static_list_end = .; - . = ALIGN(4); - } > m_text - - ._bt_conn_cb : - { - . = ALIGN(4); - _bt_conn_cb_list_start = .; - KEEP(*(SORT(._bt_conn_cb.static.*))) - _bt_conn_cb_list_end = .; - . = ALIGN(4); - } > m_text - - ._bt_gatt_service_static : - { - . = ALIGN(4); - _bt_gatt_service_static_list_start = .; - KEEP(*(SORT(._bt_gatt_service_static.static.*))) - _bt_gatt_service_static_list_end = .; - . = ALIGN(4); - } > m_text - - ._bt_l2cap_fixed_chan : - { - . = ALIGN(4); - _bt_l2cap_fixed_chan_list_start = .; - KEEP(*(SORT(._bt_l2cap_fixed_chan.static.*))) - _bt_l2cap_fixed_chan_list_end = .; - . = ALIGN(4); - } > m_text - - ._bt_l2cap_br_fixed_chan : - { - . = ALIGN(4); - _bt_l2cap_br_fixed_chan_list_start = .; - KEEP(*(SORT(._bt_l2cap_br_fixed_chan.static.*))) - _bt_l2cap_br_fixed_chan_list_end = .; - . = ALIGN(4); - } > m_text - - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > m_text - - .ARM : - { - __exidx_start = .; - *(.ARM.exidx*) - __exidx_end = .; - } > m_text - - .ctors : - { - __CTOR_LIST__ = .; - /* gcc uses crtbegin.o to find the start of - the constructors, so we make sure it is - first. Because this is a wildcard, it - doesn't matter if the user does not - actually link against crtbegin.o; the - linker won't look for a file to match a - wildcard. The wildcard also means that it - doesn't matter which directory crtbegin.o - is in. */ - KEEP (*crtbegin.o(.ctors)) - KEEP (*crtbegin?.o(.ctors)) - /* We don't want to include the .ctor section from - from the crtend.o file until after the sorted ctors. - The .ctor section from the crtend file contains the - end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - __CTOR_END__ = .; - } > m_text - - .dtors : - { - __DTOR_LIST__ = .; - KEEP (*crtbegin.o(.dtors)) - KEEP (*crtbegin?.o(.dtors)) - KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - __DTOR_END__ = .; - } > m_text - - .preinit_array : - { - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP (*(.preinit_array*)) - PROVIDE_HIDDEN (__preinit_array_end = .); - } > m_text - - .init_array : - { - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array*)) - PROVIDE_HIDDEN (__init_array_end = .); - } > m_text - - .fini_array : - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(SORT(.fini_array.*))) - KEEP (*(.fini_array*)) - PROVIDE_HIDDEN (__fini_array_end = .); - } > m_text - - __etext = .; /* define a global symbol at end of code */ - __DATA_ROM = .; /* Symbol is used by startup for data initialization */ - - .interrupts_ram : - { - . = ALIGN(4); - __VECTOR_RAM__ = .; - __interrupts_ram_start__ = .; /* Create a global symbol at data start */ - *(.m_interrupts_ram) /* This is a user defined section */ - . += M_VECTOR_RAM_SIZE; - . = ALIGN(4); - __interrupts_ram_end__ = .; /* Define a global symbol at data end */ - } > m_data - - __VECTOR_RAM = DEFINED(__ram_vector_table__) ? __VECTOR_RAM__ : ORIGIN(m_interrupts); - __RAM_VECTOR_TABLE_SIZE_BYTES = DEFINED(__ram_vector_table__) ? (__interrupts_ram_end__ - __interrupts_ram_start__) : 0x0; - - .data : AT(__DATA_ROM) - { - . = ALIGN(4); - __DATA_RAM = .; - __data_start__ = .; /* create a global symbol at data start */ - *(CodeQuickAccess) /* CodeQuickAccess sections */ - *(DataQuickAccess) /* DataQuickAccess sections */ - *(.data) /* .data sections */ - *(.data*) /* .data* sections */ - *port.c.obj(.text*) - *portasm.c.obj(.text*) - *queue.c.obj(.text*) - *timers.c.obj(.text*) - *tasks.c.obj(.text*) - *inet_chksum.c.obj(.text*) - *ip4.c.obj(.text*) - *pbuf.c.obj(.text*) - *sys_arch.c.obj(.text*) - *tcp_out.c.obj(.text*) - *tcp_in.c.obj(.text*) - *mlan_11n_rxreorder.c.obj(.text*) - *mlan_wmm.c.obj(.text*) - *wifi.c.obj(.text*) - *wifi-imu.c.obj(.text*) - *fsl_adapter_rfimu.c.obj(.text*) - *fsl_cache.c.obj(.text*) - *fsl_os_abstraction_free_rtos.c.obj(.text*) - /* Explicit placement of flash and frequently executed functions in RAM */ - *fsl_adapter_flexspi_nor_flash.c.o(.text .text* .rodata .rodata*) - *mflash_drv.c.o(.text* .text* .rodata .rodata*) - *fsl_flexspi.c.o(.text .text* .rodata .rodata*) - KEEP(*(.jcr*)) - . = ALIGN(4); - _k_mem_slab_list_start = .; - KEEP(*(SORT(._k_mem_slab*))) - _k_mem_slab_list_end = .; - . = ALIGN(4); - _net_buf_pool_list = .; - KEEP(*(SORT(._net_buf_pool*))) - . = ALIGN(4); - __data_end__ = .; /* define a global symbol at data end */ - } > m_data - - __DATA_END = __DATA_ROM + (__data_end__ - __data_start__); - - /* Place holder for RAM function. - * By default CodeQuickAccess is placed in .data section, but if there's dedicated mem region - * allocated on code bus (SRAM address starts from 0x0), CodeQuickAccess can be inserted in - * .ram_function and the .ram_function can be located in the code bus region instead of m_data - * to get better performance. Remember to define __STARTUP_INITIALIZE_RAMFUNCTION macro to - * build startup_xx.S to ensure the RAM function copy from flash to RAM. */ - .ram_function : AT(__DATA_END) - { - . = ALIGN(4); - __ram_function_start__ = .; - /* RAM function sections */ - . = ALIGN(4); - __ram_function_end__ = .; - } > m_data - - text_end = ORIGIN(m_text) + LENGTH(m_text); - - ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data") - - _image_size = __DATA_END - __VECTOR_TABLE; - - /* Uninitialized data section */ - .bss : - { - /* This is used by the startup in order to initialize the .bss section */ - . = ALIGN(4); - __START_BSS = .; - __bss_start__ = .; - *(.bss) - *(.bss*) - *(COMMON) - . = ALIGN(4); - __bss_end__ = .; - __END_BSS = .; - } > m_data - - .heap (NOLOAD) : - { - . = ALIGN(8); - __end__ = .; - PROVIDE(end = .); - __HeapBase = .; - KEEP(*(.heap*)) - __HeapLimit = .; - __heap_limit = .; /* Add for _sbrk */ - } > m_data - - .stack : - { - . = ALIGN(8); - __StackLimit = .; - . += STACK_SIZE; - __StackTop = .; - } > m_data - - PROVIDE(__stack = __StackTop); - - .smu_cpu13_mbox (NOLOAD) : - { - . = ALIGN(4); - *(.smu_cpu13_mbox) - KEEP (*(.smu_cpu13_mbox)) - . = ALIGN(4); - } > m_sqram_cpu13_mbox - - .smu_cpu31_txq (NOLOAD) : - { - . = ALIGN(4); - *(.smu_cpu31_txq) - KEEP (*(.smu_cpu31_txq)) - . = ALIGN(4); - } > m_sqram_cpu13_txq - - .smu_cpu23_mbox (NOLOAD) : - { - . = ALIGN(4); - SQRAM_CPU23_MBOX = .; - *(.smu_cpu23_mbox) - KEEP (*(.smu_cpu23_mbox)) - . = ALIGN(4); - } > m_sqram_cpu23_mbox - - .smu_cpu32_txq (NOLOAD) : - { - . = ALIGN(4); - *(.smu_cpu32_txq) - KEEP (*(.smu_cpu32_txq)) - . = ALIGN(4); - } > m_sqram_cpu32_txq - - .NVM : - { - FILL(0xFFFFFFFF); - . = ORIGIN(m_nvm_region) + LENGTH(m_nvm_region) - 1; - BYTE(0xFF); - } > m_nvm_region - - .ARM.attributes 0 : { *(.ARM.attributes) } - - ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap") - - ASSERT( (DEFINED(__m_mcuboot_size__) ? (__m_mcuboot_size__ % m_sector_size) : 0) == 0, "mcuboot size is not aligned on flash sector size") - - ASSERT(NV_STORAGE_START_ADDRESS >= FW_UPDATE_STORAGE_END, "OTA storage section overflowed") -} diff --git a/examples/platform/nxp/rt/rw61x/app/project_include/freeRTOS/FreeRTOSConfig.h b/examples/platform/nxp/rt/rw61x/app/project_include/freeRTOS/FreeRTOSConfig.h deleted file mode 100644 index b61ed92c03d286..00000000000000 --- a/examples/platform/nxp/rt/rw61x/app/project_include/freeRTOS/FreeRTOSConfig.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * FreeRTOS Kernel V10.4.3 - * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS - * - */ - -#ifndef FREERTOS_CONFIG_H -#define FREERTOS_CONFIG_H - -/*----------------------------------------------------------- - * Application specific definitions. - * - * These definitions should be adjusted for your particular hardware and - * application requirements. - * - * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE - * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. - * - * See http://www.freertos.org/a00110.html. - *----------------------------------------------------------*/ - -#define configUSE_PREEMPTION 1 -#define configUSE_IDLE_HOOK 1 -#define configUSE_TICK_HOOK CHIP_DEVICE_CONFIG_ENABLE_WPA -#define configUSE_TICKLESS_IDLE 0 -#define configUSE_DAEMON_TASK_STARTUP_HOOK 0 -#define configCPU_CLOCK_HZ (SystemCoreClock) -#define configTICK_RATE_HZ ((TickType_t) 1000) -#define configMAX_PRIORITIES (10) - -/* stack size increased for NVM/LITTLE_FS save in idle task */ -#define configMINIMAL_STACK_SIZE ((uint16_t) 2048) -#ifndef configTOTAL_HEAP_SIZE -#define configTOTAL_HEAP_SIZE ((size_t) (126 * 1024)) -#endif -#define configAPPLICATION_ALLOCATED_HEAP 1 -#define configSUPPORT_STATIC_ALLOCATION 0 -#define configSUPPORT_DYNAMIC_ALLOCATION 1 -#define configFRTOS_MEMORY_SCHEME 4 -#define configMAX_TASK_NAME_LEN (16) -#define configUSE_TRACE_FACILITY 1 -#define configUSE_16_BIT_TICKS 0 -#define configIDLE_SHOULD_YIELD 1 -#define configUSE_MUTEXES 1 -#define configQUEUE_REGISTRY_SIZE 8 -#define configCHECK_FOR_STACK_OVERFLOW 0 -#define configUSE_RECURSIVE_MUTEXES 1 -#define configUSE_MALLOC_FAILED_HOOK 0 -#define configUSE_APPLICATION_TASK_TAG 0 -#define configUSE_COUNTING_SEMAPHORES 1 -#define configGENERATE_RUN_TIME_STATS 0 -#define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 0 -#define configRECORD_STACK_HIGH_ADDRESS 1 -/* Define to 0 to be able to get task information in MCUXpresso */ -#define configENABLE_BACKWARD_COMPATIBILITY 1 - -/* Co-routine definitions. */ -#define configUSE_CO_ROUTINES 0 -#define configMAX_CO_ROUTINE_PRIORITIES (2) - -/* Software timer definitions. */ -#define configUSE_TIMERS 1 -#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 3) -#define configTIMER_QUEUE_LENGTH 10 - -/* set to fixed value as configMINIMAL_STACK_SIZE was increased */ -#define configTIMER_TASK_STACK_DEPTH (2048) - -/* Set the following definitions to 1 to include the API function, or zero - * to exclude the API function. */ -#define INCLUDE_vTaskPrioritySet 1 -#define INCLUDE_uxTaskPriorityGet 1 -#define INCLUDE_vTaskDelete 1 -#define INCLUDE_vTaskCleanUpResources 0 -#define INCLUDE_vTaskSuspend 1 -#define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelay 1 -#define INCLUDE_xTaskGetSchedulerState 1 -#define INCLUDE_xTimerPendFunctionCall 1 -#define INCLUDE_xSemaphoreGetMutexHolder 1 -#define INCLUDE_uxTaskGetStackHighWaterMark 1 - -/* Tasks.c additions (e.g. Thread Aware Debug capability) */ -#define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 1 - -/* Normal assert() semantics without relying on the provision of an assert.h - * header file. */ -#define configASSERT(x) \ - if ((x) == 0) \ - { \ - taskDISABLE_INTERRUPTS(); \ - for (;;) \ - { \ - ; \ - } \ - } - -/* Map the FreeRTOS printf() to the logging task printf. */ -#define configPRINTF(x) vLoggingPrintf x - -/* Map the logging task's printf to the board specific output function. */ -#define configPRINT_STRING print_string - -/* Sets the length of the buffers into which logging messages are written - so - * also defines the maximum length of each log message. */ -#define configLOGGING_MAX_MESSAGE_LENGTH 256 - -/* Set to 1 to prepend each log message with a message number, the task name, - * and a time stamp. */ -#define configLOGGING_INCLUDE_TIME_AND_TASK_NAME 1 - -#define configPRE_STOP_PROCESSING vMainPreStopProcessing -#define configPOST_STOP_PROCESSING vMainPostStopProcessing - -#ifndef configENABLE_FPU -#define configENABLE_FPU 1 -#endif -#ifndef configENABLE_MPU -#define configENABLE_MPU 0 -#endif -#ifndef configENABLE_TRUSTZONE -#define configENABLE_TRUSTZONE 0 -#endif -#ifndef configRUN_FREERTOS_SECURE_ONLY -#define configRUN_FREERTOS_SECURE_ONLY 1 -#endif - -#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) -/* Clock manager provides in this variable system core clock frequency */ -#include -extern uint32_t SystemCoreClock; -#endif - -/* Interrupt nesting behaviour configuration. Cortex-M specific. */ -#ifdef __NVIC_PRIO_BITS -/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ -#define configPRIO_BITS __NVIC_PRIO_BITS -#else -#define configPRIO_BITS 4 /* 15 priority levels */ -#endif - -/* The lowest interrupt priority that can be used in a call to a "set priority" -function. */ -#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1U << (configPRIO_BITS)) - 1) - -/* The highest interrupt priority that can be used by any interrupt service -routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL -INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER -PRIORITY THAN THIS! (higher priorities are lower numeric values. */ -#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2 - -/* Interrupt priorities used by the kernel port layer itself. These are generic -to all Cortex-M ports, and do not rely on any particular library functions. */ -#define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) -/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! -See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ -#define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) - -/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS -standard names. */ -#define vPortSVCHandler SVC_Handler -#define xPortPendSVHandler PendSV_Handler -#define xPortSysTickHandler SysTick_Handler - -#endif /* FREERTOS_CONFIG_H */ diff --git a/examples/platform/nxp/rt/rw61x/app/project_include/openthread/OpenThreadConfig.h b/examples/platform/nxp/rt/rw61x/app/project_include/openthread/OpenThreadConfig.h deleted file mode 100644 index 2e27c4efb95076..00000000000000 --- a/examples/platform/nxp/rt/rw61x/app/project_include/openthread/OpenThreadConfig.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * - * Copyright (c) 2020 Google LLC. - * Copyright 2023 NXP - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Overrides to default OpenThread configuration. - * - */ - -#pragma once - -// When operating in a less than ideal RF environment, having a more forgiving configuration -// of OpenThread makes thread a great deal more reliable. -#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 120 // default is 28800 -#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 30 // default is 3 -#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 1 // default is 0 -#define OPENTHREAD_CONFIG_MAC_MAX_TX_ATTEMPTS_INDIRECT_POLLS 16 // default is 4 - -// Enable periodic parent search to speed up finding a better parent. -#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 1 // default is 0 -#define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD -45 // default is -65 -#define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1 // default is 0 - -// Use smaller maximum interval to speed up reattaching. -#define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL (60 * 10 * 1000) // default 1200000 ms - -// disable unused features -#define OPENTHREAD_CONFIG_COAP_API_ENABLE 0 -#define OPENTHREAD_CONFIG_JOINER_ENABLE 0 -#define OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE 0 -#define OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE 0 -#define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 0 -#define OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE 0 - -#ifndef OPENTHREAD_CONFIG_COMMISSIONER_ENABLE -#define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 0 -#endif -#ifndef OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE -#define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 0 -#endif - -// Enable usage of external heap allocator for ot -#define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 1 - -// Disable TCP -#define OPENTHREAD_CONFIG_TCP_ENABLE 0 - -#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1 -#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 -#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 - -#ifndef OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE -#define OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE 0 -#endif /* OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE */ - -/* - * "ot-nxp/src/rw/rw612/platform/radio.c" has a dependency on - * "examples/platforms/utils/link_metrics.cpp" which is not built in the Matter build system - * for this reason, currently we are disabling this feature - */ -#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 0 -#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 0 - -// Use the NXP-supplied default platform configuration for remainder -// of OpenThread config options. -// -// NB: This file gets included during the build of OpenThread. Hence -// it cannot use "openthread" in the path to the included file. -// -#include "openthread-core-rw612-config.h" diff --git a/examples/platform/nxp/rt/rw61x/board/board.c b/examples/platform/nxp/rt/rw61x/board/board.c deleted file mode 100644 index 8d378b550477f3..00000000000000 --- a/examples/platform/nxp/rt/rw61x/board/board.c +++ /dev/null @@ -1,395 +0,0 @@ -/* - * Copyright 2021-2023 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "board.h" -#include "fsl_cache.h" -#include "fsl_clock.h" -#include "fsl_common.h" -#include "fsl_debug_console.h" -#include "fsl_flexspi.h" -#include "fsl_io_mux.h" - -/******************************************************************************* - * Definitions - ******************************************************************************/ -#define BOARD_FLEXSPI_DLL_LOCK_RETRY (10) - -/******************************************************************************* - * Variables - ******************************************************************************/ - -/******************************************************************************* - * Prototypes - ******************************************************************************/ - -/******************************************************************************* - * Code - ******************************************************************************/ -/* Initialize debug console. */ -void BOARD_InitDebugConsole(void) -{ - uint32_t uartClkSrcFreq = 0; - - /* attach FRG0 clock to FLEXCOMM3 (debug console) */ - CLOCK_SetFRGClock(BOARD_DEBUG_UART_FRG_CLK); - CLOCK_AttachClk(BOARD_DEBUG_UART_CLK_ATTACH); - - uartClkSrcFreq = BOARD_DEBUG_UART_CLK_FREQ; - DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, uartClkSrcFreq); -} - -static status_t flexspi_hyper_ram_read_id(FLEXSPI_Type * base, uint16_t * buffer) -{ - flexspi_transfer_t flashXfer; - status_t status; - - /* Write data */ - flashXfer.deviceAddress = 0x00; - flashXfer.port = kFLEXSPI_PortB1; - flashXfer.cmdType = kFLEXSPI_Read; - flashXfer.SeqNumber = 1; - flashXfer.seqIndex = 15; - flashXfer.data = (uint32_t *) buffer; - flashXfer.dataSize = 2; - - status = FLEXSPI_TransferBlocking(base, &flashXfer); - - return status; -} - -static status_t flexspi_hyper_ram_read_register(FLEXSPI_Type * base, uint32_t address, uint16_t * buffer) -{ - flexspi_transfer_t flashXfer; - status_t status; - - /* Write data */ - flashXfer.deviceAddress = address; - flashXfer.port = kFLEXSPI_PortB1; - flashXfer.cmdType = kFLEXSPI_Read; - flashXfer.SeqNumber = 1; - flashXfer.seqIndex = 13; - flashXfer.data = (uint32_t *) buffer; - flashXfer.dataSize = 2; - - status = FLEXSPI_TransferBlocking(base, &flashXfer); - - return status; -} - -static status_t flexspi_hyper_ram_write_register(FLEXSPI_Type * base, uint32_t address, uint16_t * buffer) -{ - flexspi_transfer_t flashXfer; - status_t status; - - /* Write data */ - flashXfer.deviceAddress = address; - flashXfer.port = kFLEXSPI_PortB1; - flashXfer.cmdType = kFLEXSPI_Write; - flashXfer.SeqNumber = 1; - flashXfer.seqIndex = 14; - flashXfer.data = (uint32_t *) buffer; - flashXfer.dataSize = 2; - - status = FLEXSPI_TransferBlocking(base, &flashXfer); - - return status; -} - -/* Initialize psram. */ -status_t BOARD_InitPsRam(void) -{ - flexspi_device_config_t deviceconfig = { - .flexspiRootClk = 320000000, /* 320MHZ SPI serial clock, DDR serial clock 160M */ - .isSck2Enabled = false, - .flashSize = 0x1000, /* 32Mb/KByte */ - .addressShift = true, - .CSIntervalUnit = kFLEXSPI_CsIntervalUnit1SckCycle, - .CSInterval = 5, - .CSHoldTime = 2, - .CSSetupTime = 3, - .dataValidTime = 1, - .columnspace = 9 + 5, /* CA:9 + CA_SHIFT:5 */ - .enableWordAddress = false, - .AWRSeqIndex = 12, - .AWRSeqNumber = 1, - .ARDSeqIndex = 11, - .ARDSeqNumber = 1, - .AHBWriteWaitUnit = kFLEXSPI_AhbWriteWaitUnit2AhbCycle, - .AHBWriteWaitInterval = 0, - .enableWriteMask = true, - }; - - uint32_t customLUT[20] = { - /* Read Data */ - [0] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_DDR, kFLEXSPI_4PAD, 0xAA, kFLEXSPI_Command_DDR, kFLEXSPI_4PAD, 0x00), - [1] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_RADDR_DDR, kFLEXSPI_4PAD, 16, kFLEXSPI_Command_CADDR_DDR, kFLEXSPI_4PAD, 16), - [2] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_DUMMY_DDR, kFLEXSPI_4PAD, 28, kFLEXSPI_Command_READ_DDR, kFLEXSPI_4PAD, 0x01), - - /* Write Data */ - [4] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_DDR, kFLEXSPI_4PAD, 0x22, kFLEXSPI_Command_DDR, kFLEXSPI_4PAD, 0x00), - [5] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_RADDR_DDR, kFLEXSPI_4PAD, 16, kFLEXSPI_Command_CADDR_DDR, kFLEXSPI_4PAD, 16), - [6] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_DUMMY_DDR, kFLEXSPI_4PAD, 28, kFLEXSPI_Command_WRITE_DDR, kFLEXSPI_4PAD, 0x01), - - /* Read Register */ - [8] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_DDR, kFLEXSPI_4PAD, 0xCC, kFLEXSPI_Command_DDR, kFLEXSPI_4PAD, 0x00), - [9] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_RADDR_DDR, kFLEXSPI_4PAD, 16, kFLEXSPI_Command_CADDR_DDR, kFLEXSPI_4PAD, 16), - [10] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_DUMMY_DDR, kFLEXSPI_4PAD, 12, kFLEXSPI_Command_READ_DDR, kFLEXSPI_4PAD, 0x01), - - /* Write Register */ - [12] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_DDR, kFLEXSPI_4PAD, 0x66, kFLEXSPI_Command_DDR, kFLEXSPI_4PAD, 0x00), - [13] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_RADDR_DDR, kFLEXSPI_4PAD, 16, kFLEXSPI_Command_CADDR_DDR, kFLEXSPI_4PAD, 16), - [14] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_WRITE_DDR, kFLEXSPI_4PAD, 0x01, kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0x00), - - /* Read ID */ - [16] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_4PAD, 0xE0, kFLEXSPI_Command_RADDR_DDR, kFLEXSPI_4PAD, 16), - [17] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_CADDR_DDR, kFLEXSPI_4PAD, 16, kFLEXSPI_Command_DUMMY_RWDS_DDR, kFLEXSPI_4PAD, 0x08), - [18] = FLEXSPI_LUT_SEQ(kFLEXSPI_Command_READ_DDR, kFLEXSPI_4PAD, 0x01, kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0x00), - }; - - flexspi_config_t config; -#if BOARD_ENABLE_PSRAM_CACHE - cache64_config_t cacheCfg; -#endif - status_t status = kStatus_Success; - - if (!BOARD_IS_XIP()) /* FlexSPI not initialized */ - { - CLOCK_EnableClock(kCLOCK_Flexspi); - RESET_ClearPeripheralReset(kFLEXSPI_RST_SHIFT_RSTn); - BOARD_SetFlexspiClock(FLEXSPI, 5U, 1U); - - /* Get FLEXSPI default settings and configure the flexspi. */ - FLEXSPI_GetDefaultConfig(&config); - - /* Init FLEXSPI. */ - config.rxSampleClock = kFLEXSPI_ReadSampleClkExternalInputFromDqsPad; - config.rxSampleClockPortB = kFLEXSPI_ReadSampleClkExternalInputFromDqsPad; - config.rxSampleClockDiff = true; - /*Set AHB buffer size for reading data through AHB bus. */ - config.ahbConfig.enableAHBPrefetch = true; - config.ahbConfig.enableAHBBufferable = true; - config.ahbConfig.enableAHBCachable = true; - config.ahbConfig.enableReadAddressOpt = true; - for (uint8_t i = 1; i < FSL_FEATURE_FLEXSPI_AHB_BUFFER_COUNT - 1; i++) - { - config.ahbConfig.buffer[i].bufferSize = 0; - } - /* FlexSPI has total 1KB RX buffer. - * Set DMA0 master to use AHB Rx Buffer0. - */ - config.ahbConfig.buffer[0].masterIndex = 10; /* GDMA */ - config.ahbConfig.buffer[0].bufferSize = 512; /* Allocate 512B bytes for DMA0 */ - config.ahbConfig.buffer[0].enablePrefetch = true; - config.ahbConfig.buffer[0].priority = 0; - /* All other masters use last buffer with 512B bytes. */ - config.ahbConfig.buffer[FSL_FEATURE_FLEXSPI_AHB_BUFFER_COUNT - 1].bufferSize = 512; -#if !(defined(FSL_FEATURE_FLEXSPI_HAS_NO_MCR0_COMBINATIONEN) && FSL_FEATURE_FLEXSPI_HAS_NO_MCR0_COMBINATIONEN) - config.enableCombination = false; -#endif - FLEXSPI_Init(BOARD_FLEXSPI_PSRAM, &config); - } - - /* Configure flash settings according to serial flash feature. */ - FLEXSPI_SetFlashConfig(BOARD_FLEXSPI_PSRAM, &deviceconfig, kFLEXSPI_PortB1); - - /* Update bottom LUT table (44-63). */ - FLEXSPI_UpdateLUT(BOARD_FLEXSPI_PSRAM, 44U, customLUT, ARRAY_SIZE(customLUT)); - - /* Do software reset. */ - FLEXSPI_SoftwareReset(BOARD_FLEXSPI_PSRAM); - - /* Read identification: the Manufacturer ID of ISSI's PSRAM(IS66/67WVQ8M4DALL) is 0x03U */ - uint16_t identification = 0x00U; - uint16_t registerVal = 0x00U; - status = flexspi_hyper_ram_read_id(BOARD_FLEXSPI_PSRAM, &identification); - if ((status != kStatus_Success) || (identification & 0x03U) != 0x03U) - { - status = kStatus_Fail; - } - - /* Read configuration register: the default setting is 0xF052(see table 6.1 Configuration Register in - PSRAM's(IS66/67WVQ8M4DALL) datasheet), which Latency code(CR[7:4]) is 0101b, which supported max frequency is - 200MHz.*/ - status = flexspi_hyper_ram_read_register(BOARD_FLEXSPI_PSRAM, 0x04U << 9, ®isterVal); - if ((status != kStatus_Success) || registerVal != 0xF052) - { - status = kStatus_Fail; - } - - /* Initial access latency configuration, which is located in bit3 of CR. */ - registerVal |= 0x01UL << 3; - - /* Write configuration register: */ - status = flexspi_hyper_ram_write_register(BOARD_FLEXSPI_PSRAM, 0x04U << 9, ®isterVal); - if ((status != kStatus_Success) || registerVal != 0xF05A) - { - status = kStatus_Fail; - } - - /* Reset */ - registerVal = 0x00U; - - /* Read configuration register: changes default Variable Latency into Fixed Latency: 0xF05A. - Note: FlexSPI only supports fixed latency mode for ISSI's psram. */ - status = flexspi_hyper_ram_read_register(BOARD_FLEXSPI_PSRAM, 0x04U << 9, ®isterVal); - if ((status != kStatus_Success) || registerVal != 0xF05A) - { - status = kStatus_Fail; - } - -#if BOARD_ENABLE_PSRAM_CACHE - CACHE64_GetDefaultConfig(&cacheCfg); - /* Suppose: - Flash on PC bus starting from 0x08000000, controlled by cache 0. - PSRAM on PS bus starting from 0x28000000, controlled by cache 1. - */ - CACHE64_Init(CACHE64_POLSEL1, &cacheCfg); - CACHE64_EnableWriteBuffer(CACHE64_CTRL1, true); - CACHE64_EnableCache(CACHE64_CTRL1); -#endif - - return status; -} - -void BOARD_InitSleepPinConfig(void) -{ - int32_t i; - - /* Set all non-AON pins output low level in sleep mode. */ - for (i = 0; i < 22; i++) - { - IO_MUX_SetPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow); - } - for (i = 28; i < 64; i++) - { - IO_MUX_SetPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow); - } - - /* Set RF_CNTL 0-3 output low level in sleep mode. */ - for (i = 0; i < 4; i++) - { - IO_MUX_SetRfPinOutLevelInSleep(i, IO_MUX_SleepPinLevelLow); - } -} - -void BOARD_DeinitFlash(FLEXSPI_Type * base) -{ - /* Enable FLEXSPI clock again */ - CLKCTL0->PSCCTL0_SET = CLKCTL0_PSCCTL0_SET_FLEXSPI0_MASK; - - /* Enable FLEXSPI module */ - base->MCR0 &= ~FLEXSPI_MCR0_MDIS_MASK; - - /* Wait until FLEXSPI is not busy */ - while (!((base->STS0 & FLEXSPI_STS0_ARBIDLE_MASK) && (base->STS0 & FLEXSPI_STS0_SEQIDLE_MASK))) - { - } - /* Disable module during the reset procedure */ - base->MCR0 |= FLEXSPI_MCR0_MDIS_MASK; -} - -void BOARD_InitFlash(FLEXSPI_Type * base) -{ - uint32_t status; - uint32_t lastStatus; - uint32_t retry; - - /* Loopback from DQS pad can maximize RD board flash speed. */ - if ((base->MCR0 & FLEXSPI_MCR0_RXCLKSRC_MASK) != FLEXSPI_MCR0_RXCLKSRC(1)) - { - base->MCR0 = (base->MCR0 & ~FLEXSPI_MCR0_RXCLKSRC_MASK) | FLEXSPI_MCR0_RXCLKSRC(1); - } - /* If serial root clock is >= 100 MHz, DLLEN set to 1, OVRDEN set to 0, then SLVDLYTARGET setting of 0x0 is - * recommended. */ - base->DLLCR[0] = 0x1U; - - /* Enable FLEXSPI module */ - base->MCR0 &= ~FLEXSPI_MCR0_MDIS_MASK; - - base->MCR0 |= FLEXSPI_MCR0_SWRESET_MASK; - while (base->MCR0 & FLEXSPI_MCR0_SWRESET_MASK) - { - } - - /* Need to wait DLL locked if DLL enabled */ - if (0U != (base->DLLCR[0] & FLEXSPI_DLLCR_DLLEN_MASK)) - { - lastStatus = base->STS2; - retry = BOARD_FLEXSPI_DLL_LOCK_RETRY; - /* Wait slave delay line locked and slave reference delay line locked. */ - do - { - status = base->STS2; - if ((status & (FLEXSPI_STS2_AREFLOCK_MASK | FLEXSPI_STS2_ASLVLOCK_MASK)) == - (FLEXSPI_STS2_AREFLOCK_MASK | FLEXSPI_STS2_ASLVLOCK_MASK)) - { - /* Locked */ - retry = 100; - break; - } - else if (status == lastStatus) - { - /* Same delay cell number in calibration */ - retry--; - } - else - { - retry = BOARD_FLEXSPI_DLL_LOCK_RETRY; - lastStatus = status; - } - } while (retry > 0); - /* According to ERR011377, need to delay at least 100 NOPs to ensure the DLL is locked. */ - for (; retry > 0U; retry--) - { - __NOP(); - } - } -} - -/* BOARD_SetFlexspiClock run in RAM used to configure FlexSPI clock source and divider when XIP. */ -void BOARD_SetFlexspiClock(FLEXSPI_Type * base, uint32_t src, uint32_t divider) -{ - if ((CLKCTL0->FLEXSPIFCLKSEL != CLKCTL0_FLEXSPIFCLKSEL_SEL(src)) || - ((CLKCTL0->FLEXSPIFCLKDIV & CLKCTL0_FLEXSPIFCLKDIV_DIV_MASK) != (divider - 1))) - { - /* Always deinit FLEXSPI and init FLEXSPI for the flash to make sure the flash works correctly after the - FLEXSPI root clock changed as the default FLEXSPI configuration may does not work for the new root clock - frequency. */ - BOARD_DeinitFlash(base); - - /* Disable clock before changing clock source */ - CLKCTL0->PSCCTL0_CLR = CLKCTL0_PSCCTL0_CLR_FLEXSPI0_MASK; - /* Update flexspi clock. */ - CLKCTL0->FLEXSPIFCLKSEL = CLKCTL0_FLEXSPIFCLKSEL_SEL(src); - CLKCTL0->FLEXSPIFCLKDIV |= CLKCTL0_FLEXSPIFCLKDIV_RESET_MASK; /* Reset the divider counter */ - CLKCTL0->FLEXSPIFCLKDIV = CLKCTL0_FLEXSPIFCLKDIV_DIV(divider - 1); - while ((CLKCTL0->FLEXSPIFCLKDIV) & CLKCTL0_FLEXSPIFCLKDIV_REQFLAG_MASK) - { - } - /* Enable FLEXSPI clock again */ - CLKCTL0->PSCCTL0_SET = CLKCTL0_PSCCTL0_SET_FLEXSPI0_MASK; - - BOARD_InitFlash(base); - } -} - -/* This function is used to change FlexSPI clock to a stable source before clock sources(Such as PLL and Main clock) - * updating in case XIP(execute code on FLEXSPI memory.) */ -void BOARD_FlexspiClockSafeConfig(void) -{ - /* Move FLEXSPI clock source to T3 256m / 2 to avoid instruction/data fetch issue in XIP when - * updating PLL and main clock. - */ - BOARD_SetFlexspiClock(FLEXSPI, 6U, 2U); -} - -void BOARD_CLIAttachClk(void) -{ - /* attach FRG3 clock to FLEXCOMM3 (debug console) */ - CLOCK_SetFRGClock(BOARD_CLI_FRG_CLK); - CLOCK_AttachClk(BOARD_CLI_CLK_ATTACH); -} diff --git a/examples/platform/nxp/rt/rw61x/board/board.h b/examples/platform/nxp/rt/rw61x/board/board.h deleted file mode 100644 index d24ffc3c347dbe..00000000000000 --- a/examples/platform/nxp/rt/rw61x/board/board.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright 2021-2023 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef _BOARD_H_ -#define _BOARD_H_ - -#include "clock_config.h" -#include "fsl_common.h" -#include "fsl_gpio.h" - -/******************************************************************************* - * Definitions - ******************************************************************************/ -/*! @brief The board name */ -#define BOARD_NAME "RD-RW61X-BGA" - -#ifndef DEBUG_CONSOLE_UART_INDEX -#define DEBUG_CONSOLE_UART_INDEX 3 -#endif - -/*! @brief Macro to judge XIP */ -#define BOARD_IS_XIP() \ - ((((uint32_t) BOARD_InitDebugConsole >= 0x08000000U) && ((uint32_t) BOARD_InitDebugConsole < 0x10000000U)) || \ - (((uint32_t) BOARD_InitDebugConsole >= 0x18000000U) && ((uint32_t) BOARD_InitDebugConsole < 0x20000000U))) - -/*! @brief The UART to use for debug messages. */ -#define BOARD_DEBUG_UART_TYPE kSerialPort_Uart -#if DEBUG_CONSOLE_UART_INDEX == 0 -#define BOARD_DEBUG_UART_BASEADDR (uint32_t) FLEXCOMM0 -#define BOARD_DEBUG_UART_INSTANCE 0U -#define BOARD_DEBUG_UART USART0 -#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetFlexCommClkFreq(0) -#define BOARD_DEBUG_UART_FRG_CLK \ - (&(const clock_frg_clk_config_t){ 0, kCLOCK_FrgPllDiv, 255, 0 }) /*!< Select FRG0 mux as frg_pll \ - */ -#define BOARD_DEBUG_UART_CLK_ATTACH kFRG_to_FLEXCOMM0 -#define BOARD_DEBUG_UART_RST kFC0_RST_SHIFT_RSTn -#define BOARD_DEBUG_UART_CLKSRC kCLOCK_Flexcomm0 -#define BOARD_UART_IRQ_HANDLER FLEXCOMM0_IRQHandler -#define BOARD_UART_IRQ FLEXCOMM0_IRQn -#elif DEBUG_CONSOLE_UART_INDEX == 3 -#define BOARD_DEBUG_UART_BASEADDR (uint32_t) FLEXCOMM3 -#define BOARD_DEBUG_UART_INSTANCE 3U -#define BOARD_DEBUG_UART USART3 -#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetFlexCommClkFreq(3) -#define BOARD_DEBUG_UART_FRG_CLK \ - (&(const clock_frg_clk_config_t){ 3, kCLOCK_FrgPllDiv, 255, 0 }) /*!< Select FRG3 mux as frg_pll \ - */ -#define BOARD_DEBUG_UART_CLK_ATTACH kFRG_to_FLEXCOMM3 -#define BOARD_DEBUG_UART_RST kFC3_RST_SHIFT_RSTn -#define BOARD_DEBUG_UART_CLKSRC kCLOCK_Flexcomm3 -#define BOARD_UART_IRQ_HANDLER FLEXCOMM3_IRQHandler -#define BOARD_UART_IRQ FLEXCOMM3_IRQn -#else -#error "UART not supported" -#endif - -#ifndef BOARD_DEBUG_UART_BAUDRATE -#define BOARD_DEBUG_UART_BAUDRATE 115200 -#endif /* BOARD_DEBUG_UART_BAUDRATE */ - -#define BOARD_FLEXSPI_PSRAM FLEXSPI -#ifndef BOARD_ENABLE_PSRAM_CACHE -#define BOARD_ENABLE_PSRAM_CACHE 1 -#endif - -/* Board I2C for codec */ -#define BOARD_CODEC_I2C_BASEADDR I2C2 -#define BOARD_CODEC_I2C_CLOCK_FREQ CLOCK_GetFlexCommClkFreq(2U) -#define BOARD_CODEC_I2C_INSTANCE 2 -#define BOARD_CODEC_I2C_SDA_PORT 0 -#define BOARD_CODEC_I2C_SCL_PORT 0 -#define BOARD_CODEC_I2C_SDA_PIN 16 -#define BOARD_CODEC_I2C_SCL_PIN 17 - -/* Board led color mapping */ -#define LOGIC_LED_ON 1U -#define LOGIC_LED_OFF 0U - -/* A fake led on GPIO header */ -#ifndef BOARD_LED_BLUE_GPIO -#define BOARD_LED_BLUE_GPIO GPIO -#endif -#define BOARD_LED_BLUE_GPIO_PORT 0U -#ifndef BOARD_LED_BLUE_GPIO_PIN -#define BOARD_LED_BLUE_GPIO_PIN 2U -#endif - -#define LED_BLUE_INIT(output) \ - GPIO_PinInit(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, BOARD_LED_BLUE_GPIO_PIN, \ - &(gpio_pin_config_t){ kGPIO_DigitalOutput, (output) }) /*!< Enable target LED_BLUE */ -#define LED_BLUE_ON() \ - GPIO_PortSet(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn on target LED_BLUE */ -#define LED_BLUE_OFF() \ - GPIO_PortClear(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn off target LED_BLUE */ -#define LED_BLUE_TOGGLE() \ - GPIO_PortToggle(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Toggle on target LED_BLUE \ - */ - -/* Board SW PIN */ -#ifndef BOARD_SW1_GPIO -#define BOARD_SW1_GPIO GPIO -#endif -#define BOARD_SW1_GPIO_PORT 0U -#ifndef BOARD_SW1_GPIO_PIN -#define BOARD_SW1_GPIO_PIN 13U -#endif - -#ifndef BOARD_SW2_GPIO -#define BOARD_SW2_GPIO GPIO -#endif -#define BOARD_SW2_GPIO_PORT 0U -#ifndef BOARD_SW2_GPIO_PIN -#define BOARD_SW2_GPIO_PIN 14U -#endif - -#ifndef BOARD_SW3_GPIO -#define BOARD_SW3_GPIO GPIO -#endif -#define BOARD_SW3_GPIO_PORT 0U -#ifndef BOARD_SW3_GPIO_PIN -#define BOARD_SW3_GPIO_PIN 24U -#endif - -#ifndef BOARD_SW4_GPIO -#define BOARD_SW4_GPIO GPIO -#endif -#define BOARD_SW4_GPIO_PORT 0U -#ifndef BOARD_SW4_GPIO_PIN -#define BOARD_SW4_GPIO_PIN 25U -#endif - -#define BOARD_ENET0_PHY_ADDRESS (0x02U) - -/*! @brief The USIM SMARTCARD PHY configuration. */ -#define BOARD_SMARTCARD_MODULE (USIM) /*!< SMARTCARD communicational module instance */ -#define BOARD_SMARTCARD_MODULE_IRQ (USIM_IRQn) /*!< SMARTCARD communicational module IRQ handler */ -#define BOARD_SMARTCARD_CLOCK_MODULE_CLK_FREQ (CLOCK_GetUsimClkFreq()) -#define BOARD_SMARTCARD_CLOCK_VALUE (4000000U) /*!< SMARTCARD clock frequency (4Mhz) */ -#define BOARD_SMARTCARD_IRQ_PORT (0) -#define BOARD_SMARTCARD_IRQ_PIN (19) -#define BOARD_SMARTCARD_TS_TIMER_IRQ (CTIMER0_IRQn) - -/* CLI clock config */ -#define BOARD_CLI_FRG_CLK (&(const clock_frg_clk_config_t){ 3, kCLOCK_FrgPllDiv, 255, 0 }) /*!< Select FRG3 mux as frg_pll */ -#define BOARD_CLI_CLK_ATTACH kFRG_to_FLEXCOMM3 - -#if defined(__cplusplus) -extern "C" { -#endif /* __cplusplus */ - -/******************************************************************************* - * API - ******************************************************************************/ - -void BOARD_InitDebugConsole(void); -status_t BOARD_InitPsRam(void); -void BOARD_InitSleepPinConfig(void); -void BOARD_FlexspiClockSafeConfig(void); -void BOARD_CLIAttachClk(void); -AT_QUICKACCESS_SECTION_CODE(void BOARD_SetFlexspiClock(FLEXSPI_Type * base, uint32_t src, uint32_t divider)); -AT_QUICKACCESS_SECTION_CODE(void BOARD_DeinitFlash(FLEXSPI_Type * base)); -AT_QUICKACCESS_SECTION_CODE(void BOARD_InitFlash(FLEXSPI_Type * base)); - -#if defined(__cplusplus) -} -#endif /* __cplusplus */ - -#endif /* _BOARD_H_ */ diff --git a/examples/platform/nxp/rt/rw61x/board/clock_config.c b/examples/platform/nxp/rt/rw61x/board/clock_config.c deleted file mode 100644 index 5713fa2a9eeb03..00000000000000 --- a/examples/platform/nxp/rt/rw61x/board/clock_config.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright 2021 NXP - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "clock_config.h" -#include "board.h" -#include "fsl_clock.h" -#include "fsl_power.h" - -/******************************************************************************* - * Definitions - ******************************************************************************/ - -/******************************************************************************* - * Variables - ******************************************************************************/ -const clock_avpll_config_t g_avpllConfig_BOARD_BootClockRUN = { .ch1Freq = kCLOCK_AvPllChFreq12p288m, - .ch2Freq = kCLOCK_AvPllChFreq64m, - .enableCali = true }; - -/*FUNCTION********************************************************************** - * - * Function Name : BOARD_FlexspiClockSafeConfig - * Description : FLEXSPI clock source safe configuration weak function. - * Called before clock source(Such as PLL, Main clock) configuration. - * Note : Users need override this function to change FLEXSPI clock source to stable source when executing - * code on FLEXSPI memory(XIP). If XIP, the function should runs in RAM and move the FLEXSPI clock - *source to an stable clock to avoid instruction/data fetch issue during clock updating. - *END**************************************************************************/ -__attribute__((weak)) void BOARD_FlexspiClockSafeConfig(void) {} - -/*FUNCTION********************************************************************** - * - * Function Name : BOARD_SetFlexspiClock - * Description : This function should be overridden if executing code on FLEXSPI memory(XIP). - * To Change FLEXSPI clock, should move to run from RAM and then configure FLEXSPI clock source. - * After the clock is changed and stable, move back to run on FLEXSPI. - * Param base : FLEXSPI peripheral base address. - * Param src : FLEXSPI clock source. - * Param divider : FLEXSPI clock divider. - *END**************************************************************************/ -__attribute__((weak)) void BOARD_SetFlexspiClock(FLEXSPI_Type * base, uint32_t src, uint32_t divider) -{ - CLKCTL0->FLEXSPIFCLKSEL = CLKCTL0_FLEXSPIFCLKSEL_SEL(src); - CLKCTL0->FLEXSPIFCLKDIV |= CLKCTL0_FLEXSPIFCLKDIV_RESET_MASK; /* Reset the divider counter */ - CLKCTL0->FLEXSPIFCLKDIV = CLKCTL0_FLEXSPIFCLKDIV_DIV(divider - 1); - while ((CLKCTL0->FLEXSPIFCLKDIV) & CLKCTL0_FLEXSPIFCLKDIV_REQFLAG_MASK) - { - } -} - -/******************************************************************************* - ************************ BOARD_InitBootClocks function ************************ - ******************************************************************************/ -void BOARD_InitBootClocks(void) -{ - BOARD_BootClockRUN(); -} - -/******************************************************************************* - ********************** Configuration BOARD_BootClockRUN *********************** - ******************************************************************************/ -/******************************************************************************* - * Variables for BOARD_BootClockRUN configuration - ******************************************************************************/ - -/******************************************************************************* - * Code for BOARD_BootClockRUN configuration - ******************************************************************************/ -void BOARD_BootClockRUN(void) -{ - if ((PMU->CAU_SLP_CTRL & PMU_CAU_SLP_CTRL_SOC_SLP_RDY_MASK) == 0U) - { - /* LPOSC not enabled, enable it */ - CLOCK_EnableClock(kCLOCK_RefClkCauSlp); - } - if ((SYSCTL2->SOURCE_CLK_GATE & SYSCTL2_SOURCE_CLK_GATE_REFCLK_SYS_CG_MASK) != 0U) - { - /* REFCLK_SYS not enabled, enable it */ - CLOCK_EnableClock(kCLOCK_RefClkSys); - } - - /* Initialize T3 clocks and t3pll_mci_48_60m_irc configured to 48.3MHz */ - CLOCK_InitT3RefClk(kCLOCK_T3MciIrc48m); - /* Enable FFRO */ - CLOCK_EnableClock(kCLOCK_T3PllMciIrcClk); - /* Enable T3 256M clock and SFRO */ - CLOCK_EnableClock(kCLOCK_T3PllMci256mClk); - - if (BOARD_IS_XIP()) - { - /* Call function BOARD_FlexspiClockSafeConfig() to move FlexSPI clock to a stable clock source to avoid - instruction/data fetch issue when updating PLL and Main clock if XIP(execute code on FLEXSPI memory). */ - BOARD_FlexspiClockSafeConfig(); - } - - /* First let M33 run on SOSC */ - CLOCK_AttachClk(kSYSOSC_to_MAIN_CLK); - CLOCK_SetClkDiv(kCLOCK_DivSysCpuAhbClk, 1); - - /* tcpu_mci_clk configured to 260MHz, tcpu_mci_flexspi_clk 312MHz. */ - CLOCK_InitTcpuRefClk(3120000000UL, kCLOCK_TcpuFlexspiDiv10); - /* Enable tcpu_mci_clk 260MHz. Keep tcpu_mci_flexspi_clk gated. */ - CLOCK_EnableClock(kCLOCK_TcpuMciClk); - - /* tddr_mci_flexspi_clk 320MHz */ - CLOCK_InitTddrRefClk(kCLOCK_TddrFlexspiDiv10); - CLOCK_EnableClock(kCLOCK_TddrMciFlexspiClk); /* 320MHz */ - - /* Enable AUX0 PLL to 260MHz. */ - CLOCK_SetClkDiv(kCLOCK_DivAux0PllClk, 1U); - - /* Init AVPLL and enable both channels. */ - CLOCK_InitAvPll(&g_avpllConfig_BOARD_BootClockRUN); - CLOCK_SetClkDiv(kCLOCK_DivAudioPllClk, 1U); - - /* Configure MainPll to 260MHz, then let CM33 run on Main PLL. */ - CLOCK_SetClkDiv(kCLOCK_DivSysCpuAhbClk, 1U); - CLOCK_SetClkDiv(kCLOCK_DivMainPllClk, 1U); - CLOCK_AttachClk(kMAIN_PLL_to_MAIN_CLK); - - /* Set SYSTICKFCLKDIV divider to value 1 */ - CLOCK_SetClkDiv(kCLOCK_DivSystickClk, 1U); - CLOCK_AttachClk(kSYSTICK_DIV_to_SYSTICK_CLK); - - if (BOARD_IS_XIP()) - { - /* Call function BOARD_SetFlexspiClock() to set clock source to aux0_pll_clk. */ - BOARD_SetFlexspiClock(FLEXSPI, 2U, 2U); - } - - /* Set PLL FRG clock to 20MHz. */ - CLOCK_SetClkDiv(kCLOCK_DivPllFrgClk, 13U); - - /* Measure main_clk on CLKOUT. Set CLKOUTFCLKDIV divider to value 100 */ - CLOCK_AttachClk(kMAIN_CLK_to_CLKOUT); - SOCCTRL->TST_TSTBUS_CTRL2 = - (SOCCTRL->TST_TSTBUS_CTRL2 & ~(SOCCIU_TST_TSTBUS_CTRL2_CLK_OUT_PAGE_SEL_MASK | SOCCIU_TST_TSTBUS_CTRL2_CLK_OUT_SEL_MASK)) | - SOCCIU_TST_TSTBUS_CTRL2_CLK_OUT_PAGE_SEL(3) | SOCCIU_TST_TSTBUS_CTRL2_CLK_OUT_SEL(14); - CLOCK_SetClkDiv(kCLOCK_DivClockOut, 100U); - - /* Set SystemCoreClock variable. */ - SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK; -} - -/******************************************************************************* - ********************** Configuration BOARD_BootClockLPR *********************** - ******************************************************************************/ -/******************************************************************************* - * Variables for BOARD_BootClockLPR configuration - ******************************************************************************/ - -/******************************************************************************* - * Code for BOARD_BootClockLPR configuration - ******************************************************************************/ -void BOARD_BootClockLPR(void) -{ - CLOCK_DisableClock(kCLOCK_Pkc); - CLOCK_DisableClock(kCLOCK_Els); - CLOCK_DisableClock(kCLOCK_ElsApb); - CLOCK_DisableClock(kCLOCK_Otp); - CLOCK_DisableClock(kCLOCK_Wwdt0); - CLOCK_DisableClock(kCLOCK_Flexcomm0); - CLOCK_DisableClock(kCLOCK_Flexcomm2); - CLOCK_DisableClock(kCLOCK_Flexcomm3); - CLOCK_DisableClock(kCLOCK_Crc); - CLOCK_DisableClock(kCLOCK_Itrc); - - RESET_SetPeripheralReset(kPKC_RST_SHIFT_RSTn); - // RESET_SetPeripheralReset(kELS_RST_SHIFT_RSTn); - RESET_SetPeripheralReset(kELS_APB_RST_SHIFT_RSTn); - RESET_SetPeripheralReset(kELS_GDET_REF_RST_SHIFT_RSTn); - RESET_SetPeripheralReset(kOTP_RST_SHIFT_RSTn); - RESET_SetPeripheralReset(kWWDT_RST_SHIFT_RSTn); - RESET_SetPeripheralReset(kFC0_RST_SHIFT_RSTn); - RESET_SetPeripheralReset(kFC2_RST_SHIFT_RSTn); - RESET_SetPeripheralReset(kFC3_RST_SHIFT_RSTn); - RESET_SetPeripheralReset(kCRC_RST_SHIFT_RSTn); - - if ((PMU->CAU_SLP_CTRL & PMU_CAU_SLP_CTRL_SOC_SLP_RDY_MASK) == 0U) - { - /* LPOSC not enabled, enable it */ - CLOCK_EnableClock(kCLOCK_RefClkCauSlp); - } - if ((SYSCTL2->SOURCE_CLK_GATE & SYSCTL2_SOURCE_CLK_GATE_REFCLK_SYS_CG_MASK) != 0U) - { - /* REFCLK_SYS not enabled, enable it */ - CLOCK_EnableClock(kCLOCK_RefClkSys); - } - - if (BOARD_IS_XIP()) - { - /* Initialize T3 clocks and t3pll_mci_48_60m_irc configured to 48.3MHz */ - CLOCK_InitT3RefClk(kCLOCK_T3MciIrc48m); - /* Enable T3 256M clock and SFRO */ - CLOCK_EnableClock(kCLOCK_T3PllMci256mClk); - - /* Call function BOARD_FlexspiClockSafeConfig() to move FlexSPI clock to a stable clock source to avoid - instruction/data fetch issue when updating PLL and Main clock if XIP(execute code on FLEXSPI memory). */ - BOARD_FlexspiClockSafeConfig(); - } - else - { - RESET_ClearPeripheralReset(kFLEXSPI_RST_SHIFT_RSTn); - BOARD_DeinitFlash(FLEXSPI); - CLOCK_AttachClk(kNONE_to_FLEXSPI_CLK); - CLOCK_DisableClock(kCLOCK_Flexspi); - RESET_SetPeripheralReset(kFLEXSPI_RST_SHIFT_RSTn); - } - - /* Deinitialize TDDR clocks */ - CLOCK_DeinitTddrRefClk(); - - /* First let M33 run on SOSC */ - CLOCK_AttachClk(kSYSOSC_to_MAIN_CLK); - CLOCK_SetClkDiv(kCLOCK_DivSysCpuAhbClk, 1); - - /* tcpu_mci_clk configured to 260MHz, tcpu_mci_flexspi_clk 312MHz. */ - CLOCK_InitTcpuRefClk(3120000000UL, kCLOCK_TcpuFlexspiDiv10); - /* Enable tcpu_mci_clk 260MHz. Keep tcpu_mci_flexspi_clk gated. */ - CLOCK_EnableClock(kCLOCK_TcpuMciClk); - - /* Enable AUX0 PLL to 260MHz. */ - CLOCK_SetClkDiv(kCLOCK_DivAux0PllClk, 1U); - - /* Configure MainPll to 260MHz, then let CM33 run on Main PLL. */ - CLOCK_SetClkDiv(kCLOCK_DivSysCpuAhbClk, 1U); - CLOCK_SetClkDiv(kCLOCK_DivMainPllClk, 1U); - CLOCK_AttachClk(kMAIN_PLL_to_MAIN_CLK); - - /* Set SYSTICKFCLKDIV divider to value 1 */ - CLOCK_SetClkDiv(kCLOCK_DivSystickClk, 1U); - CLOCK_AttachClk(kSYSTICK_DIV_to_SYSTICK_CLK); - - if (BOARD_IS_XIP()) - { - /* Call function BOARD_SetFlexspiClock() to set clock source to aux0_pll_clk. */ - BOARD_SetFlexspiClock(FLEXSPI, 2U, 2U); - } - - /* Set PLL FRG clock to 20MHz. */ - CLOCK_SetClkDiv(kCLOCK_DivPllFrgClk, 13U); - - /* Deinitialize T3 clocks */ - CLOCK_DeinitT3RefClk(); - - /* Deinitialize AVPLL clocks */ - CLOCK_DeinitAvPll(); - - /* Set SystemCoreClock variable. */ - SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK; -} diff --git a/examples/platform/nxp/rt/rw61x/board/clock_config.h b/examples/platform/nxp/rt/rw61x/board/clock_config.h deleted file mode 100644 index e5ecfed533844d..00000000000000 --- a/examples/platform/nxp/rt/rw61x/board/clock_config.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2021 NXP - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef _CLOCK_CONFIG_H_ -#define _CLOCK_CONFIG_H_ - -#include "fsl_common.h" - -/******************************************************************************* - * Definitions - ******************************************************************************/ - -/******************************************************************************* - ************************ BOARD_InitBootClocks function ************************ - ******************************************************************************/ - -#if defined(__cplusplus) -extern "C" { -#endif /* __cplusplus*/ - -/*! - * @brief This function executes default configuration of clocks. - * - */ -void BOARD_InitBootClocks(void); - -#if defined(__cplusplus) -} -#endif /* __cplusplus*/ - -/******************************************************************************* - ********************** Configuration BOARD_BootClockRUN *********************** - ******************************************************************************/ -/******************************************************************************* - * Definitions for BOARD_BootClockRUN configuration - ******************************************************************************/ -#define BOARD_BOOTCLOCKRUN_CORE_CLOCK 260000000U /*!< Core clock frequency: 260000000Hz */ - -/******************************************************************************* - * API for BOARD_BootClockRUN configuration - ******************************************************************************/ -#if defined(__cplusplus) -extern "C" { -#endif /* __cplusplus*/ - -/*! - * @brief This function executes configuration of clocks. - * - */ -void BOARD_BootClockRUN(void); - -/*! - * @brief This function executes configuration of clocks for low power run. - * - */ -void BOARD_BootClockLPR(void); - -#if defined(__cplusplus) -} -#endif /* __cplusplus*/ - -#endif /* _CLOCK_CONFIG_H_ */ diff --git a/examples/platform/nxp/rt/rw61x/board/hardware_init.c b/examples/platform/nxp/rt/rw61x/board/hardware_init.c deleted file mode 100644 index 1d7963d6ddb7e1..00000000000000 --- a/examples/platform/nxp/rt/rw61x/board/hardware_init.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2020, 2023 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/*${header:start}*/ -#include "board.h" -#include "clock_config.h" -#include "fsl_device_registers.h" -#include "pin_mux.h" -/*${header:end}*/ - -static gpio_pin_config_t pinConfig = { - kGPIO_DigitalOutput, - 0, -}; - -/*${function:start}*/ -void BOARD_InitHardware(void) -{ - BOARD_InitBootPins(); - BOARD_InitBootClocks(); - BOARD_InitDebugConsole(); - - CLOCK_EnableClock(kCLOCK_Flexspi); - RESET_ClearPeripheralReset(kFLEXSPI_RST_SHIFT_RSTn); - - /* Use aux0_pll_clk / 2 */ - BOARD_SetFlexspiClock(FLEXSPI, 2U, 2U); -} -/*${function:end}*/ diff --git a/examples/platform/nxp/rt/rw61x/board/peripherals.c b/examples/platform/nxp/rt/rw61x/board/peripherals.c deleted file mode 100644 index 5fc55eee46fdc4..00000000000000 --- a/examples/platform/nxp/rt/rw61x/board/peripherals.c +++ /dev/null @@ -1,149 +0,0 @@ -/*********************************************************************************************************************** - * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file - * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. - **********************************************************************************************************************/ - -/* clang-format off */ -/* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* -!!GlobalInfo -product: Peripherals v11.0 -processor: MIMXRT1062xxxxA -package_id: MIMXRT1062DVL6A -mcu_data: ksdk2_0 -processor_version: 11.0.1 -board: MIMXRT1060-EVKB -functionalGroups: -- name: BOARD_InitPeripherals - UUID: 96c1cec6-3bd3-47a2-8301-f38e4b0dd25f - called_from_default_init: true - selectedCore: core0 - * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ - -/* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* -component: -- type: 'system' -- type_id: 'system' -- global_system_definitions: - - user_definitions: 'extern uint32_t NV_STORAGE_START_ADDRESS_OFFSET[];\nextern uint32_t NV_STORAGE_MAX_SECTORS[];\n\n\n#define LITTLEFS_START_ADDR (uint32_t)(NV_STORAGE_START_ADDRESS_OFFSET)\n' - - user_includes: '\n' - * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ - -/* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* -component: -- type: 'uart_cmsis_common' -- type_id: 'uart_cmsis_common_9cb8e302497aa696fdbb5a4fd622c2a8' -- global_USART_CMSIS_common: - - quick_selection: 'default' - * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ - -/* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* -component: -- type: 'gpio_adapter_common' -- type_id: 'gpio_adapter_common_57579b9ac814fe26bf95df0a384c36b6' -- global_gpio_adapter_common: - - quick_selection: 'default' - * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ -/* clang-format on */ - -/*********************************************************************************************************************** - * Included files - **********************************************************************************************************************/ -#include "peripherals.h" - -/*********************************************************************************************************************** - * BOARD_InitPeripherals functional group - **********************************************************************************************************************/ -/*********************************************************************************************************************** - * LittleFS initialization code - **********************************************************************************************************************/ -/* clang-format off */ -/* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* -instance: -- name: 'LittleFS' -- type: 'littlefs' -- mode: 'general' -- custom_name_enabled: 'false' -- type_id: 'littlefs_7e89bf6c938031bfd17176a3aacf1bc3' -- functional_group: 'BOARD_InitPeripherals' -- config_sets: - - general_config: - - moduleInclude: 'fwk_platform_flash.h' - - lfsConfig: - - enableUserContext: 'true' - - userContext: - - contextVar: '(void*)&LittleFS_ctx' - - contextDef: 'extern struct lfs_mflash_ctx LittleFS_ctx;' - - userCallbacks: - - read: 'lfs_mflash_read' - - prog: 'lfs_mflash_prog' - - erase: 'lfs_mflash_erase' - - sync: 'lfs_mflash_sync' - - lock: 'lfs_mutex_lock' - - unlock: 'lfs_mutex_unlock' - - readSize: '16' - - progSize: '256' - - blockSize: '4096' - - firstBlock: '(uint32_t)(NV_STORAGE_START_ADDRESS_OFFSET)' - - blockCount: '(uint32_t)(NV_STORAGE_MAX_SECTORS)' - - blockCycles: '100' - - cacheSize: '256' - - lookaheadSize: '16' - - enableReadBuff: 'false' - - readBuffer: - - customBuffer: 'false' - - enableProgBuff: 'false' - - progBuffer: - - customBuffer: 'false' - - enableLookaheadBuff: 'false' - - lookaheadBuffer: - - customBuffer: 'false' - - enableOptionalSizes: 'false' - - optionalSizes: - - name_max: '255' - - file_max: '0x7FFFFFFF' - - attr_max: '1022' - - metadata_max: '4096' - - initLFS: 'false' - - initConfig: - - lfsObj: 'LittleFS_system' - - mountLFS: 'disable' - * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ -/* clang-format on */ -/* LittleFS context */ -extern struct lfs_mflash_ctx LittleFS_ctx; -const struct lfs_config LittleFS_config = { .context = (void *) &LittleFS_ctx, - .read = lfs_mflash_read, - .prog = lfs_mflash_prog, - .erase = lfs_mflash_erase, - .sync = lfs_mflash_sync, -#ifdef LFS_THREADSAFE - .lock = lfs_mutex_lock, - .unlock = lfs_mutex_unlock, -#endif - .read_size = LITTLEFS_READ_SIZE, - .prog_size = LITTLEFS_PROG_SIZE, - .block_size = LITTLEFS_BLOCK_SIZE, - .block_count = LITTLEFS_BLOCK_COUNT, - .block_cycles = LITTLEFS_BLOCK_CYCLES, - .cache_size = LITTLEFS_CACHE_SIZE, - .lookahead_size = LITTLEFS_LOOKAHEAD_SIZE }; - -/* Empty initialization function (commented out) -static void LittleFS_init(void) { -} */ - -/*********************************************************************************************************************** - * Initialization functions - **********************************************************************************************************************/ -void BOARD_InitPeripherals(void) -{ - /* Initialize components */ -} - -/*********************************************************************************************************************** - * BOARD_InitBootPeripherals function - **********************************************************************************************************************/ -void BOARD_InitBootPeripherals(void) -{ - BOARD_InitPeripherals(); -} diff --git a/examples/platform/nxp/rt/rw61x/board/peripherals.h b/examples/platform/nxp/rt/rw61x/board/peripherals.h deleted file mode 100644 index 6c50bc87364ccf..00000000000000 --- a/examples/platform/nxp/rt/rw61x/board/peripherals.h +++ /dev/null @@ -1,102 +0,0 @@ -/*********************************************************************************************************************** - * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file - * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. - **********************************************************************************************************************/ - -#ifndef _PERIPHERALS_H_ -#define _PERIPHERALS_H_ - -#define CHIP_PLAT_NO_NVM 0 -#define CHIP_PLAT_NVM_FWK 1 -#define CHIP_PLAT_LITTLEFS 2 -#define CHIP_PLAT_KEY_STORAGE 3 - -#ifndef CHIP_PLAT_NVM_SUPPORT -#define CHIP_PLAT_NVM_SUPPORT CHIP_PLAT_NO_NVM -#endif - -/*********************************************************************************************************************** - * Included files - **********************************************************************************************************************/ -#include "fsl_common.h" - -#if (CHIP_PLAT_NVM_SUPPORT == CHIP_PLAT_NVM_FWK || CHIP_PLAT_NVM_SUPPORT == CHIP_PLAT_LITTLEFS) -#include "fwk_platform_flash.h" -#elif (CHIP_PLAT_NVM_SUPPORT == CHIP_PLAT_KEY_STORAGE) -#include "fwk_lfs_mflash.h" -#endif - -#include "lfs.h" - -#if defined(__cplusplus) -extern "C" { -#endif /* __cplusplus */ - -/*********************************************************************************************************************** - * User definitions - **********************************************************************************************************************/ -extern uint32_t NV_STORAGE_START_ADDRESS_OFFSET[]; -extern uint32_t NV_STORAGE_MAX_SECTORS[]; - -#define LITTLEFS_START_ADDR (uint32_t)(NV_STORAGE_START_ADDRESS_OFFSET) - -/*********************************************************************************************************************** - * Definitions - **********************************************************************************************************************/ -/* Definitions for BOARD_InitPeripherals functional group */ -/* Maximum block read size definition */ -#define LITTLEFS_READ_SIZE 16 -/* Maximum block program size definition */ -#define LITTLEFS_PROG_SIZE 256 -/* Erasable block size definition */ -#define LITTLEFS_BLOCK_SIZE 4096 -/* Block count definition */ -#define LITTLEFS_BLOCK_COUNT (uint32_t)(NV_STORAGE_MAX_SECTORS) -/* Block cycles definition */ -#define LITTLEFS_BLOCK_CYCLES 100 -/* Minimum block cache size definition */ -#define LITTLEFS_CACHE_SIZE 256 -/* Minimum lookahead buffer size definition */ -#define LITTLEFS_LOOKAHEAD_SIZE 16 -/* Block starting address definition */ -#define LITTLEFS_START_ADDR (uint32_t)(NV_STORAGE_START_ADDRESS_OFFSET) - -/*********************************************************************************************************************** - * Global variables - **********************************************************************************************************************/ -/* LittleFS configuration */ -extern const struct lfs_config LittleFS_config; - -/*********************************************************************************************************************** - * Callback functions - **********************************************************************************************************************/ -/* LittleFS read a block region callback*/ -extern int lfs_mflash_read(const struct lfs_config *, lfs_block_t, lfs_off_t, void *, lfs_size_t); -/* LittleFS program a block region callback*/ -extern int lfs_mflash_prog(const struct lfs_config *, lfs_block_t, lfs_off_t, const void *, lfs_size_t); -/* LittleFS erase a block callback*/ -extern int lfs_mflash_erase(const struct lfs_config *, lfs_block_t); -/* LittleFS state sync callback*/ -extern int lfs_mflash_sync(const struct lfs_config *); -/* LittleFS state lock callback*/ -extern int lfs_mutex_lock(const struct lfs_config *); -/* LittleFS state unlock callback*/ -extern int lfs_mutex_unlock(const struct lfs_config *); - -/*********************************************************************************************************************** - * Initialization functions - **********************************************************************************************************************/ - -void BOARD_InitPeripherals(void); - -/*********************************************************************************************************************** - * BOARD_InitBootPeripherals function - **********************************************************************************************************************/ - -void BOARD_InitBootPeripherals(void); - -#if defined(__cplusplus) -} -#endif - -#endif /* _PERIPHERALS_H_ */ diff --git a/examples/platform/nxp/rt/rw61x/board/pin_mux.c b/examples/platform/nxp/rt/rw61x/board/pin_mux.c deleted file mode 100644 index 8ab48ff62e8d0f..00000000000000 --- a/examples/platform/nxp/rt/rw61x/board/pin_mux.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2021, 2023 NXP. - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "pin_mux.h" -#include "fsl_common.h" -#include "fsl_io_mux.h" - -/* FUNCTION ************************************************************************************************************ - * - * Function Name : BOARD_InitBootPins - * Description : Calls initialization functions. - * - * END ****************************************************************************************************************/ -void BOARD_InitBootPins(void) -{ - BOARD_InitPins(); -} - -/* FUNCTION ************************************************************************************************************ - * - * Function Name : BOARD_InitPins - * Description : Configures pin routing and optionally pin electrical features. - * - * END ****************************************************************************************************************/ -void BOARD_InitPins(void) -{ /*!< Function assigned for the core: Cortex-M33[cm33] */ - IO_MUX_SetPinMux(IO_MUX_FC3_USART_DATA); - IO_MUX_SetPinMux(IO_MUX_GPIO25); - /* FLEXCOMM0 TX for logging*/ - IO_MUX_SetPinMux(IO_MUX_FC0_USART_DATA); -} - -/*********************************************************************************************************************** - * EOF - **********************************************************************************************************************/ diff --git a/examples/platform/nxp/rt/rw61x/board/pin_mux.h b/examples/platform/nxp/rt/rw61x/board/pin_mux.h deleted file mode 100644 index d01bc202b03184..00000000000000 --- a/examples/platform/nxp/rt/rw61x/board/pin_mux.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2021 NXP. - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef _PIN_MUX_H_ -#define _PIN_MUX_H_ - -/*********************************************************************************************************************** - * Definitions - **********************************************************************************************************************/ - -/*! - * @addtogroup pin_mux - * @{ - */ - -/*********************************************************************************************************************** - * API - **********************************************************************************************************************/ - -#if defined(__cplusplus) -extern "C" { -#endif - -/*! - * @brief Calls initialization functions. - * - */ -void BOARD_InitBootPins(void); - -/*! - * @brief Configures pin routing and optionally pin electrical features. - * - */ -void BOARD_InitPins(void); /*!< Function assigned for the core: Cortex-M4[cm4] */ - -#if defined(__cplusplus) -} -#endif - -/*! - * @} - */ -#endif /* _PIN_MUX_H_ */ - -/*********************************************************************************************************************** - * EOF - **********************************************************************************************************************/ diff --git a/examples/platform/silabs/BaseApplication.cpp b/examples/platform/silabs/BaseApplication.cpp index fd22a7ea3a48fc..beda9d3a6981f1 100644 --- a/examples/platform/silabs/BaseApplication.cpp +++ b/examples/platform/silabs/BaseApplication.cpp @@ -51,6 +51,7 @@ #if CHIP_ENABLE_OPENTHREAD #include #include +#include #include #endif // CHIP_ENABLE_OPENTHREAD @@ -115,9 +116,10 @@ app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::SlWiFiDriver::GetInstance())); #endif /* SL_WIFI */ +bool sIsEnabled = false; +bool sIsAttached = false; + #if !(defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && CHIP_CONFIG_ENABLE_ICD_SERVER) -bool sIsEnabled = false; -bool sIsAttached = false; bool sHaveBLEConnections = false; #endif // CHIP_CONFIG_ENABLE_ICD_SERVER @@ -156,42 +158,27 @@ Identify gIdentify = { }; #endif // MATTER_DM_PLUGIN_IDENTIFY_SERVER + } // namespace -bool BaseApplication::sIsProvisioned = false; -bool BaseApplication::sIsFactoryResetTriggered = false; -LEDWidget * BaseApplication::sAppActionLed = nullptr; -#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 +bool BaseApplication::sIsProvisioned = false; +bool BaseApplication::sIsFactoryResetTriggered = false; +LEDWidget * BaseApplication::sAppActionLed = nullptr; BaseApplicationDelegate BaseApplication::sAppDelegate = BaseApplicationDelegate(); -#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 -#ifdef DIC_ENABLE -namespace { -void AppSpecificConnectivityEventCallback(const ChipDeviceEvent * event, intptr_t arg) -{ - SILABS_LOG("AppSpecificConnectivityEventCallback: call back for IPV4"); - if ((event->Type == DeviceEventType::kInternetConnectivityChange) && - (event->InternetConnectivityChange.IPv4 == kConnectivity_Established)) - { - SILABS_LOG("Got IPv4 Address! Starting DIC module\n"); - if (DIC_OK != dic_init(dic::control::subscribeCB)) - SILABS_LOG("Failed to initialize DIC module\n"); - } -} -} // namespace -#endif // DIC_ENABLE - -#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 void BaseApplicationDelegate::OnCommissioningSessionStarted() { isComissioningStarted = true; } + void BaseApplicationDelegate::OnCommissioningSessionStopped() { isComissioningStarted = false; } + void BaseApplicationDelegate::OnCommissioningWindowClosed() { +#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 if (!BaseApplication::GetProvisionStatus() && !isComissioningStarted) { int32_t status = wfx_power_save(RSI_SLEEP_MODE_8, STANDBY_POWER_SAVE_WITH_RAM_RETENTION); @@ -200,8 +187,27 @@ void BaseApplicationDelegate::OnCommissioningWindowClosed() ChipLogError(DeviceLayer, "Failed to enable the TA Deep Sleep"); } } -} #endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 +} + +void BaseApplicationDelegate::OnFabricCommitted(const FabricTable & fabricTable, FabricIndex fabricIndex) +{ + // If we commissioned our first fabric, Update the commissioned status of the App + if (fabricTable.FabricCount() == 1) + { + BaseApplication::UpdateCommissioningStatus(true); + } +} + +void BaseApplicationDelegate::OnFabricRemoved(const FabricTable & fabricTable, FabricIndex fabricIndex) +{ + if (fabricTable.FabricCount() == 0) + { + BaseApplication::UpdateCommissioningStatus(false); + + BaseApplication::DoProvisioningReset(); + } +} /********************************************************** * AppTask Definitions @@ -275,10 +281,6 @@ CHIP_ERROR BaseApplication::Init() SILABS_LOG("Current Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); SILABS_LOG("Current Software Version: %d", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); -#ifdef DIC_ENABLE - chip::DeviceLayer::PlatformMgr().AddEventHandler(AppSpecificConnectivityEventCallback, reinterpret_cast(nullptr)); -#endif // DIC_ENABLE - ConfigurationMgr().LogDeviceConfig(); OutputQrCode(true /*refreshLCD at init*/); @@ -298,6 +300,8 @@ CHIP_ERROR BaseApplication::Init() #if CHIP_ENABLE_OPENTHREAD BaseApplication::sIsProvisioned = ConnectivityMgr().IsThreadProvisioned(); #endif + + err = chip::Server::GetInstance().GetFabricTable().AddFabricDelegate(&sAppDelegate); return err; } @@ -411,6 +415,23 @@ bool BaseApplication::ActivateStatusLedPatterns() return isPatternSet; } +void BaseApplication::UpdateCommissioningStatus(bool newState) +{ +#ifdef SL_WIFI + BaseApplication::sIsProvisioned = ConnectivityMgr().IsWiFiStationProvisioned(); + sIsEnabled = ConnectivityMgr().IsWiFiStationEnabled(); + sIsAttached = ConnectivityMgr().IsWiFiStationConnected(); +#endif /* SL_WIFI */ +#if CHIP_ENABLE_OPENTHREAD + // TODO: This is a temporary solution until we can read Thread provisioning status from RAM instead of NVM. + BaseApplication::sIsProvisioned = newState; + sIsEnabled = ConnectivityMgr().IsThreadEnabled(); + sIsAttached = ConnectivityMgr().IsThreadAttached(); +#endif /* CHIP_ENABLE_OPENTHREAD */ + + ActivateStatusLedPatterns(); +} + // TODO Move State Monitoring elsewhere void BaseApplication::LightEventHandler() { @@ -689,14 +710,25 @@ SilabsLCD & BaseApplication::GetLCD(void) return slLCD; } -void BaseApplication::UpdateLCDStatusScreen(void) +void BaseApplication::UpdateLCDStatusScreen(bool withChipStackLock) { SilabsLCD::DisplayStatus_t status; bool enabled, attached; - chip::DeviceLayer::PlatformMgr().LockChipStack(); + if (withChipStackLock) + { + chip::DeviceLayer::PlatformMgr().LockChipStack(); + } #ifdef SL_WIFI enabled = ConnectivityMgr().IsWiFiStationEnabled(); attached = ConnectivityMgr().IsWiFiStationConnected(); + chip::DeviceLayer::NetworkCommissioning::Network network; + memset(reinterpret_cast(&network), 0, sizeof(network)); + chip::DeviceLayer::NetworkCommissioning::GetConnectedNetwork(network); + if (network.networkIDLen) + { + chip::Platform::CopyString(status.networkName, sizeof(status.networkName), + reinterpret_cast(network.networkID)); + } #endif /* SL_WIFI */ #if CHIP_ENABLE_OPENTHREAD enabled = ConnectivityMgr().IsThreadEnabled(); @@ -710,7 +742,10 @@ void BaseApplication::UpdateLCDStatusScreen(void) ? SilabsLCD::ICDMode_e::SIT : SilabsLCD::ICDMode_e::LIT; #endif - chip::DeviceLayer::PlatformMgr().UnlockChipStack(); + if (withChipStackLock) + { + chip::DeviceLayer::PlatformMgr().UnlockChipStack(); + } slLCD.SetStatus(status); } #endif @@ -750,16 +785,64 @@ void BaseApplication::ScheduleFactoryReset() { Provision::Manager::GetInstance().SetProvisionRequired(true); } - PlatformMgr().HandleServerShuttingDown(); + PlatformMgr().HandleServerShuttingDown(); // HandleServerShuttingDown calls OnShutdown() which is only implemented for the + // basic information cluster it seems. And triggers and Event flush, which is not + // relevant when there are no fabrics left ConfigurationMgr().InitiateFactoryReset(); }); } +void BaseApplication::DoProvisioningReset() +{ + PlatformMgr().ScheduleWork([](intptr_t) { +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD + ConfigurationManagerImpl::GetDefaultInstance().ClearThreadStack(); + ThreadStackMgrImpl().FactoryResetThreadStack(); + ThreadStackMgr().InitThreadStack(); +#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD + +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION + ChipLogProgress(DeviceLayer, "Clearing WiFi provision"); + chip::DeviceLayer::ConnectivityMgr().ClearWiFiStationProvision(); +#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION + + CHIP_ERROR err = Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow(); + if (err != CHIP_NO_ERROR) + { + SILABS_LOG("Failed to open the Basic Commissioning Window"); + } + }); +} + void BaseApplication::OnPlatformEvent(const ChipDeviceEvent * event, intptr_t) { - if (event->Type == DeviceEventType::kServiceProvisioningChange) + switch (event->Type) { + case DeviceEventType::kServiceProvisioningChange: + // Note: This is only called on Attach, we need to add a method to detect Thread Network Detach BaseApplication::sIsProvisioned = event->ServiceProvisioningChange.IsServiceProvisioned; + break; + case DeviceEventType::kInternetConnectivityChange: +#ifdef DIC_ENABLE + VerifyOrReturn(event->InternetConnectivityChange.IPv4 == kConnectivity_Established); + if (DIC_OK != dic_init(dic::control::subscribeCB)) + { + SILABS_LOG("Failed to initialize DIC module\n"); + } +#endif // DIC_ENABLE + break; + case DeviceEventType::kWiFiConnectivityChange: +#ifdef DISPLAY_ENABLED + SilabsLCD::Screen_e screen; + AppTask::GetLCD().GetScreen(screen); + // Update the LCD screen with SSID and connected state + VerifyOrReturn(screen == SilabsLCD::Screen_e::StatusScreen); + BaseApplication::UpdateLCDStatusScreen(false); + AppTask::GetLCD().SetScreen(screen); +#endif // DISPLAY_ENABLED + break; + default: + break; } } diff --git a/examples/platform/silabs/BaseApplication.h b/examples/platform/silabs/BaseApplication.h index 8a231aa6c51513..9052e9355aab90 100644 --- a/examples/platform/silabs/BaseApplication.h +++ b/examples/platform/silabs/BaseApplication.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -62,16 +63,19 @@ #define APP_ERROR_START_TIMER_FAILED CHIP_APPLICATION_ERROR(0x05) #define APP_ERROR_STOP_TIMER_FAILED CHIP_APPLICATION_ERROR(0x06) -#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 -class BaseApplicationDelegate : public AppDelegate +class BaseApplicationDelegate : public AppDelegate, public chip::FabricTable::Delegate { private: + // AppDelegate bool isComissioningStarted; void OnCommissioningSessionStarted() override; void OnCommissioningSessionStopped() override; void OnCommissioningWindowClosed() override; + + // FabricTable::Delegate + void OnFabricCommitted(const chip::FabricTable & fabricTable, chip::FabricIndex fabricIndex) override; + void OnFabricRemoved(const chip::FabricTable & fabricTable, chip::FabricIndex fabricIndex) override; }; -#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 /********************************************************** * BaseApplication Declaration @@ -86,9 +90,7 @@ class BaseApplication static bool sIsProvisioned; static bool sIsFactoryResetTriggered; static LEDWidget * sAppActionLed; -#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 static BaseApplicationDelegate sAppDelegate; -#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 /** * @brief Create AppTask task and Event Queue @@ -130,7 +132,7 @@ class BaseApplication */ static SilabsLCD & GetLCD(void); - static void UpdateLCDStatusScreen(void); + static void UpdateLCDStatusScreen(bool withChipStackLock = true); #endif /** @@ -156,6 +158,18 @@ class BaseApplication static void OnTriggerIdentifyEffect(Identify * identify); #endif + /** + * @brief Updates the static boolean isCommissioned to the desired state + * + */ + static void UpdateCommissioningStatus(bool newState); + + /** + * @brief Called when the last Fabric is removed, clears all Fabric related data, including Thread and Wifi provision. + * @note This function preserves some NVM3 data that is not Fabric scoped, like Attribute Value or Boot Count. + */ + static void DoProvisioningReset(); + protected: CHIP_ERROR Init(); diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp index 0f25e2e25a40ed..1aabd29bb75ab6 100644 --- a/examples/platform/silabs/MatterConfig.cpp +++ b/examples/platform/silabs/MatterConfig.cpp @@ -222,9 +222,12 @@ void SilabsMatterConfig::ConnectivityEventCallback(const ChipDeviceEvent * event CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) { CHIP_ERROR err; - +#ifdef SL_WIFI + // Because OpenThread needs to use memory allocation during its Key operations, we initialize the memory management for thread + // and set the allocation functions inside sl_ot_create_instance, which is called by sl_system_init in the OpenThread stack + // initialization. mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree); - +#endif SILABS_LOG("=================================================="); SILABS_LOG("%s starting", appName); SILABS_LOG("=================================================="); @@ -241,11 +244,11 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) // Init Matter Stack //============================================== SILABS_LOG("Init CHIP Stack"); - // Init Chip memory management before the stack - ReturnErrorOnFailure(chip::Platform::MemoryInit()); -// WiFi needs to be initialized after Memory Init for some reason #ifdef SL_WIFI + // Init Chip memory management before the stack + // See comment above about OpenThread memory allocation as to why this is WIFI only here. + ReturnErrorOnFailure(chip::Platform::MemoryInit()); ReturnErrorOnFailure(InitWiFi()); #endif @@ -304,9 +307,7 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) initParams.endpointNativeParams = static_cast(&nativeParams); #endif -#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 initParams.appDelegate = &BaseApplication::sAppDelegate; -#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 // Init Matter Server and Start Event Loop err = chip::Server::GetInstance().Init(initParams); diff --git a/examples/platform/silabs/SiWx917/BUILD.gn b/examples/platform/silabs/SiWx917/BUILD.gn index 0a0e52c6049dea..8acee7c3b9cfcd 100644 --- a/examples/platform/silabs/SiWx917/BUILD.gn +++ b/examples/platform/silabs/SiWx917/BUILD.gn @@ -115,7 +115,12 @@ source_set("siwx917-matter-shell") { config("siwx917-common-config") { defines = [ "OTA_PERIODIC_TIMEOUT=${ota_periodic_query_timeout_sec}" ] - libs = [ "${sdk_support_root}/matter/provision/lib/libProvision_si917.a" ] + if (sl_si91x_crypto_flavor == "psa") { + libs = + [ "${sdk_support_root}/matter/provision/lib/libProvisionPSA_si917.a" ] + } else { + libs = [ "${sdk_support_root}/matter/provision/lib/libProvision_si917.a" ] + } if (!disable_lcd) { include_dirs = [ "${silabs_common_plat_dir}/display" ] diff --git a/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp b/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp index 5253b3b2ec5062..59bf52bbc0f30f 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp +++ b/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp @@ -19,9 +19,10 @@ #include #include -#include "silabs_utils.h" #include "sl_status.h" #include +#include +#include #include "FreeRTOS.h" #include "event_groups.h" @@ -132,14 +133,14 @@ static void CancelDHCPTimer() // Check if timer started if (!osTimerIsRunning(sDHCPTimer)) { - SILABS_LOG("CancelDHCPTimer: timer not running"); + ChipLogDetail(DeviceLayer, "CancelDHCPTimer: timer not running"); return; } status = osTimerStop(sDHCPTimer); if (status != osOK) { - SILABS_LOG("CancelDHCPTimer: failed to stop timer with status: %d", status); + ChipLogError(DeviceLayer, "CancelDHCPTimer: failed to stop timer: %d", status); } } @@ -153,7 +154,7 @@ static void StartDHCPTimer(uint32_t timeout) status = osTimerStart(sDHCPTimer, pdMS_TO_TICKS(timeout)); if (status != osOK) { - SILABS_LOG("StartDHCPTimer: failed to start timer with status: %d", status); + ChipLogError(DeviceLayer, "StartDHCPTimer: failed to start timer: %d", status); } } @@ -171,7 +172,7 @@ int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t * ap) int32_t rssi = 0; ap->security = wfx_rsi.sec.security; ap->chan = wfx_rsi.ap_chan; - memcpy(&ap->bssid[0], &wfx_rsi.ap_mac.octet[0], BSSID_MAX_STR_LEN); + 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; @@ -246,7 +247,7 @@ sl_status_t join_callback_handler(sl_wifi_event_t event, char * result, uint32_t if (SL_WIFI_CHECK_IF_EVENT_FAILED(event)) { callback_status = *(sl_status_t *) result; - SILABS_LOG("join_callback_handler: failed: 0x%X", callback_status); + ChipLogError(DeviceLayer, "join_callback_handler: failed: 0x%lx", static_cast(callback_status)); wfx_rsi.dev_state &= ~(WFX_RSI_ST_STA_CONNECTED); wfx_retry_interval_handler(is_wifi_disconnection_event, wfx_rsi.join_retries++); if (is_wifi_disconnection_event || wfx_rsi.join_retries <= WFX_RSI_CONFIG_MAX_JOIN) @@ -259,8 +260,8 @@ sl_status_t join_callback_handler(sl_wifi_event_t event, char * result, uint32_t /* * Join was complete - Do the DHCP */ - memset(&temp_reset, 0, sizeof(wfx_wifi_scan_ext_t)); - SILABS_LOG("join_callback_handler: success"); + ChipLogDetail(DeviceLayer, "join_callback_handler: success"); + memset(&temp_reset, 0, sizeof(temp_reset)); WfxEvent.eventType = WFX_EVT_STA_CONN; WfxPostEvent(&WfxEvent); @@ -329,14 +330,14 @@ int32_t wfx_rsi_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_ status = rsi_bt_power_save_profile(sl_si91x_ble_state, 0); if (status != RSI_SUCCESS) { - SILABS_LOG("BT Powersave Config Failed, Error Code : 0x%lX", status); + 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) { - SILABS_LOG("Powersave Config Failed, Error Code : 0x%lX", status); + ChipLogError(DeviceLayer, "sl_wifi_set_performance_profile failed: 0x%lx", static_cast(status)); return status; } if (sl_si91x_wifi_state == HIGH_PERFORMANCE) @@ -361,34 +362,23 @@ int32_t wfx_rsi_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_ *****************************************************************************************/ int32_t wfx_wifi_rsi_init(void) { - SILABS_LOG("wfx_wifi_rsi_init started"); + ChipLogDetail(DeviceLayer, "wfx_wifi_rsi_init started"); sl_status_t status; status = sl_wifi_init(&config, NULL, sl_wifi_default_event_handler); - if (status != SL_STATUS_OK) - { - return status; - } + VerifyOrReturnError(status == SL_STATUS_OK, status); // Create Sempaphore for scan sScanSemaphore = osSemaphoreNew(1, 0, NULL); - if (sScanSemaphore == NULL) - { - return SL_STATUS_ALLOCATION_FAILED; - } + VerifyOrReturnError(sScanSemaphore != NULL, SL_STATUS_ALLOCATION_FAILED); + // Create the message queue sWifiEventQueue = osMessageQueueNew(WFX_QUEUE_SIZE, sizeof(WfxEvent_t), NULL); - if (sWifiEventQueue == NULL) - { - return SL_STATUS_ALLOCATION_FAILED; - } + VerifyOrReturnError(sWifiEventQueue != NULL, SL_STATUS_ALLOCATION_FAILED); // Create timer for DHCP polling // TODO: Use LWIP timer instead of creating a new one here sDHCPTimer = osTimerNew(DHCPTimerEventHandler, osTimerPeriodic, NULL, NULL); - if (sDHCPTimer == NULL) - { - return SL_STATUS_ALLOCATION_FAILED; - } + VerifyOrReturnError(sDHCPTimer != NULL, SL_STATUS_ALLOCATION_FAILED); return status; } @@ -403,9 +393,9 @@ int32_t wfx_wifi_rsi_init(void) *****************************************************************************************/ static void sl_print_firmware_version(sl_wifi_firmware_version_t * firmware_version) { - SILABS_LOG("Firmware version is: %x%x.%d.%d.%d.%d.%d.%d", firmware_version->chip_id, firmware_version->rom_id, - firmware_version->major, firmware_version->minor, firmware_version->security_version, firmware_version->patch_num, - firmware_version->customer_id, firmware_version->build_num); + ChipLogDetail(DeviceLayer, "Firmware version is: %x%x.%d.%d.%d.%d.%d.%d", firmware_version->chip_id, firmware_version->rom_id, + firmware_version->major, firmware_version->minor, firmware_version->security_version, firmware_version->patch_num, + firmware_version->customer_id, firmware_version->build_num); } /************************************************************************************* @@ -424,7 +414,7 @@ static sl_status_t wfx_rsi_init(void) status = wfx_wifi_rsi_init(); if (status != SL_STATUS_OK) { - SILABS_LOG("wfx_rsi_init failed %x", status); + ChipLogError(DeviceLayer, "wfx_rsi_init failed: 0x%lx", static_cast(status)); return status; } #else // For SoC @@ -433,7 +423,7 @@ static sl_status_t wfx_rsi_init(void) status = sl_si91x_m4_ta_secure_handshake(SL_SI91X_ENABLE_XTAL, 1, &xtal_enable, 0, NULL); if (status != SL_STATUS_OK) { - SILABS_LOG("Failed to bring m4_ta_secure_handshake: 0x%lx\r\n", status); + ChipLogError(DeviceLayer, "sl_si91x_m4_ta_secure_handshake failed: 0x%lx", static_cast(status)); return status; } #endif /* CHIP_CONFIG_ENABLE_ICD_SERVER */ @@ -443,8 +433,7 @@ static sl_status_t wfx_rsi_init(void) status = sl_wifi_get_firmware_version(&version); if (status != SL_STATUS_OK) { - SILABS_LOG("Get fw version failed:"); - sl_print_firmware_version(&version); + ChipLogError(DeviceLayer, "sl_wifi_get_firmware_version failed: 0x%lx", static_cast(status)); return status; } sl_print_firmware_version(&version); @@ -452,7 +441,7 @@ static sl_status_t wfx_rsi_init(void) status = sl_wifi_get_mac_address(SL_WIFI_CLIENT_INTERFACE, (sl_mac_address_t *) &wfx_rsi.sta_mac.octet[0]); if (status != SL_STATUS_OK) { - SILABS_LOG("sl_wifi_get_mac_address failed: %x", status); + ChipLogDetail(DeviceLayer, "sl_wifi_get_mac_address failed: 0x%lx", static_cast(status)); return status; } @@ -463,7 +452,7 @@ static sl_status_t wfx_rsi_init(void) status = sl_si91x_trng_entropy(); if (status != SL_STATUS_OK) { - SILABS_LOG("TRNG Entropy Failed"); + ChipLogError(DeviceLayer, "sl_si91x_trng_entropy failed: 0x%lx", static_cast(status)); return status; } @@ -471,7 +460,7 @@ static sl_status_t wfx_rsi_init(void) status = sl_si91x_trng_program_key((uint32_t *) trngKey, TRNG_KEY_SIZE); if (status != SL_STATUS_OK) { - SILABS_LOG("TRNG Key Programming Failed"); + ChipLogError(DeviceLayer, "sl_si91x_trng_program_key failed: 0x%lx", static_cast(status)); return status; } #endif // SL_MBEDTLS_USE_TINYCRYPT @@ -492,7 +481,7 @@ static sl_status_t wfx_rsi_init(void) *****************************************************************************************/ void wfx_show_err(char * msg) { - SILABS_LOG("wfx_show_err: message: %d", msg); + ChipLogError(DeviceLayer, "wfx_show_err: message: %s", msg); } sl_status_t scan_callback_handler(sl_wifi_event_t event, sl_wifi_scan_result_t * scan_result, uint32_t result_length, void * arg) @@ -500,12 +489,12 @@ sl_status_t scan_callback_handler(sl_wifi_event_t event, sl_wifi_scan_result_t * if (SL_WIFI_CHECK_IF_EVENT_FAILED(event)) { callback_status = *(sl_status_t *) scan_result; - SILABS_LOG("scan_callback_handler: failed: 0x%X", callback_status); + ChipLogError(DeviceLayer, "scan_callback_handler: failed: 0x%lx", static_cast(callback_status)); scan_results_complete = true; #if WIFI_ENABLE_SECURITY_WPA3_TRANSITION wfx_rsi.sec.security = WFX_SEC_WPA3; #else - wfx_rsi.sec.security = WFX_SEC_WPA2; + wfx_rsi.sec.security = WFX_SEC_WPA2; #endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ osSemaphoreRelease(sScanSemaphore); @@ -513,7 +502,7 @@ sl_status_t scan_callback_handler(sl_wifi_event_t event, sl_wifi_scan_result_t * } wfx_rsi.sec.security = WFX_SEC_UNSPECIFIED; wfx_rsi.ap_chan = scan_result->scan_info[0].rf_channel; - memcpy(&wfx_rsi.ap_mac.octet, scan_result->scan_info[0].bssid, BSSID_MAX_STR_LEN); + memcpy(&wfx_rsi.ap_mac.octet, scan_result->scan_info[0].bssid, BSSID_LEN); switch (scan_result->scan_info[0].security_mode) { case SL_WIFI_OPEN: @@ -536,7 +525,7 @@ sl_status_t scan_callback_handler(sl_wifi_event_t event, sl_wifi_scan_result_t * case SL_WIFI_WPA3: wfx_rsi.sec.security = WFX_SEC_WPA3; #else - wfx_rsi.sec.security = WFX_SEC_WPA2; + wfx_rsi.sec.security = WFX_SEC_WPA2; #endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ break; default: @@ -549,44 +538,48 @@ sl_status_t scan_callback_handler(sl_wifi_event_t event, sl_wifi_scan_result_t * osSemaphoreRelease(sScanSemaphore); return SL_STATUS_OK; } + sl_status_t show_scan_results(sl_wifi_scan_result_t * scan_result) { SL_WIFI_ARGS_CHECK_NULL_POINTER(scan_result); - int x; - wfx_wifi_scan_result_t ap; - for (x = 0; x < (int) scan_result->scan_count; x++) + VerifyOrReturnError(wfx_rsi.scan_cb != NULL, SL_STATUS_INVALID_HANDLE); + + wfx_wifi_scan_result_t cur_scan_result; + for (int idx = 0; idx < (int) scan_result->scan_count; idx++) { - strcpy(&ap.ssid[0], (char *) &scan_result->scan_info[x].ssid); - if (wfx_rsi.scan_ssid) + memset(&cur_scan_result, 0, sizeof(cur_scan_result)); + strncpy(cur_scan_result.ssid, (char *) &scan_result->scan_info[idx].ssid, WFX_MAX_SSID_LENGTH); + + // if user has provided ssid, then check if the current scan result ssid matches the user provided ssid + if (wfx_rsi.scan_ssid != NULL && strcmp(wfx_rsi.scan_ssid, cur_scan_result.ssid) != CMP_SUCCESS) { - SILABS_LOG("SCAN SSID: %s , ap scan: %s", wfx_rsi.scan_ssid, ap.ssid); - if (strcmp(wfx_rsi.scan_ssid, ap.ssid) == CMP_SUCCESS) - { - ap.security = static_cast(scan_result->scan_info[x].security_mode); - ap.rssi = (-1) * scan_result->scan_info[x].rssi_val; - memcpy(&ap.bssid[0], &scan_result->scan_info[x].bssid[0], BSSID_MAX_STR_LEN); - (*wfx_rsi.scan_cb)(&ap); - break; - } + continue; } - else + 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 == NULL) { - ap.security = static_cast(scan_result->scan_info[x].security_mode); - ap.rssi = (-1) * scan_result->scan_info[x].rssi_val; - memcpy(&ap.bssid[0], &scan_result->scan_info[x].bssid[0], BSSID_MAX_STR_LEN); - (*wfx_rsi.scan_cb)(&ap); + continue; } + break; } + + // cleanup and return wfx_rsi.dev_state &= ~WFX_RSI_ST_SCANSTARTED; - (*wfx_rsi.scan_cb)((wfx_wifi_scan_result_t *) 0); - wfx_rsi.scan_cb = (void (*)(wfx_wifi_scan_result_t *)) 0; + wfx_rsi.scan_cb((wfx_wifi_scan_result_t *) 0); + wfx_rsi.scan_cb = NULL; if (wfx_rsi.scan_ssid) { vPortFree(wfx_rsi.scan_ssid); - wfx_rsi.scan_ssid = (char *) 0; + wfx_rsi.scan_ssid = NULL; } return SL_STATUS_OK; } + sl_status_t bg_scan_callback_handler(sl_wifi_event_t event, sl_wifi_scan_result_t * result, uint32_t result_length, void * arg) { callback_status = show_scan_results(result); @@ -605,16 +598,18 @@ sl_status_t bg_scan_callback_handler(sl_wifi_event_t event, sl_wifi_scan_result_ static void wfx_rsi_save_ap_info() // translation { sl_status_t status = SL_STATUS_OK; -#ifndef EXP_BOARD // TODO: this changes will be reverted back after the SDK team fix the scan API +#ifndef EXP_BOARD + // 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; #endif sl_wifi_ssid_t ssid_arg; - ssid_arg.length = strlen(wfx_rsi.sec.ssid); - memcpy(ssid_arg.value, (int8_t *) &wfx_rsi.sec.ssid[0], ssid_arg.length); + memset(&ssid_arg, 0, sizeof(ssid_arg)); + ssid_arg.length = strnlen(wfx_rsi.sec.ssid, WFX_MAX_SSID_LENGTH); + strncpy((char *) &ssid_arg.value[0], wfx_rsi.sec.ssid, WFX_MAX_SSID_LENGTH); sl_wifi_set_scan_callback(scan_callback_handler, NULL); scan_results_complete = false; #ifndef EXP_BOARD - // TODO: this changes will be reverted back after the SDK team fix the scan API + // TODO: this changes will be reverted back after the Silabs WiFi SDK team fix the scan API status = sl_wifi_start_scan(SL_WIFI_CLIENT_2_4GHZ_INTERFACE, &ssid_arg, &wifi_scan_configuration); #endif if (SL_STATUS_IN_PROGRESS == status) @@ -632,115 +627,81 @@ static void wfx_rsi_save_ap_info() // translation **********************************************************************************************/ static sl_status_t wfx_rsi_do_join(void) { + ReturnErrorCodeIf((wfx_rsi.dev_state & (WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED)), SL_STATUS_IN_PROGRESS); sl_status_t status = SL_STATUS_OK; - sl_wifi_security_t connect_security_mode; + sl_wifi_client_configuration_t ap; + memset(&ap, 0, sizeof(ap)); WfxEvent_t event; switch (wfx_rsi.sec.security) { case WFX_SEC_WEP: - connect_security_mode = SL_WIFI_WEP; + ap.security = SL_WIFI_WEP; break; case WFX_SEC_WPA: - connect_security_mode = SL_WIFI_WPA_WPA2_MIXED; + ap.security = SL_WIFI_WPA_WPA2_MIXED; break; case WFX_SEC_WPA2: #if WIFI_ENABLE_SECURITY_WPA3_TRANSITION - connect_security_mode = SL_WIFI_WPA3_TRANSITION; + ap.security = SL_WIFI_WPA3_TRANSITION; break; case WFX_SEC_WPA3: - connect_security_mode = SL_WIFI_WPA3_TRANSITION; + ap.security = SL_WIFI_WPA3_TRANSITION; #else - connect_security_mode = SL_WIFI_WPA_WPA2_MIXED; + ap.security = SL_WIFI_WPA_WPA2_MIXED; #endif // WIFI_ENABLE_SECURITY_WPA3_TRANSITION break; case WFX_SEC_NONE: - connect_security_mode = SL_WIFI_OPEN; + ap.security = SL_WIFI_OPEN; break; default: - SILABS_LOG("error: unknown security type."); + ChipLogError(DeviceLayer, "wfx_rsi_do_join: unknown security type."); return status; } - - if (wfx_rsi.dev_state & (WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED)) - { - SILABS_LOG("%s: not joining - already in progress", __func__); - } - else - { - SILABS_LOG("%s: WLAN: connecting to %s, sec=%d", __func__, &wfx_rsi.sec.ssid[0], wfx_rsi.sec.security); - - /* - * Join the network - */ - /* 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; - - sl_wifi_set_join_callback(join_callback_handler, NULL); + /* + * Join the network + */ + wfx_rsi.dev_state |= WFX_RSI_ST_STA_CONNECTING; + status = sl_wifi_set_join_callback(join_callback_handler, NULL); + VerifyOrReturnError(status == SL_STATUS_OK, status); #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); - - sl_wifi_advanced_client_configuration_t client_config = { .max_retry_attempts = 5 }; - sl_wifi_set_advanced_client_configuration(SL_WIFI_CLIENT_INTERFACE, &client_config); + // 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 - /* Try to connect Wifi with given Credentials - * untill there is a success or maximum number of tries allowed - */ - - /* Call rsi connect call with given ssid and password - * And check there is a success - */ - sl_wifi_credential_t cred; - memset(&cred, 0, sizeof(sl_wifi_credential_t)); - cred.type = SL_WIFI_PSK_CREDENTIAL; - memcpy(cred.psk.value, &wfx_rsi.sec.passkey[0], strlen(wfx_rsi.sec.passkey)); - sl_net_credential_id_t id = SL_NET_DEFAULT_WIFI_CLIENT_CREDENTIAL_ID; - status = sl_net_set_credential(id, SL_NET_WIFI_PSK, &wfx_rsi.sec.passkey[0], strlen(wfx_rsi.sec.passkey)); - if (SL_STATUS_OK != status) - { - SILABS_LOG("wfx_rsi_do_join: RSI callback register join failed with status: %02x", status); - return status; - } - - sl_wifi_client_configuration_t ap = { 0 }; - uint32_t timeout_ms = 0; - - ap.ssid.length = strlen(wfx_rsi.sec.ssid); - memcpy(ap.ssid.value, (int8_t *) &wfx_rsi.sec.ssid[0], ap.ssid.length); - ap.security = connect_security_mode; - ap.encryption = SL_WIFI_NO_ENCRYPTION; - ap.credential_id = id; - if ((status = sl_wifi_connect(SL_WIFI_CLIENT_INTERFACE, &ap, timeout_ms)) == SL_STATUS_IN_PROGRESS) - { - callback_status = SL_STATUS_IN_PROGRESS; - while (callback_status == SL_STATUS_IN_PROGRESS) - { - osThreadYield(); - } - status = callback_status; - } - else - { - if (is_wifi_disconnection_event || wfx_rsi.join_retries <= WFX_RSI_CONFIG_MAX_JOIN) - { - SILABS_LOG("wfx_rsi_do_join: Wifi connect failed with status: %x", status); - SILABS_LOG("wfx_rsi_do_join: starting JOIN to %s after %d tries\n", (char *) &wfx_rsi.sec.ssid[0], - wfx_rsi.join_retries); - wfx_rsi.join_retries += 1; - wfx_rsi.dev_state &= ~(WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED); - wfx_retry_interval_handler(is_wifi_disconnection_event, wfx_rsi.join_retries); - if (is_wifi_disconnection_event || wfx_rsi.join_retries <= MAX_JOIN_RETRIES_COUNT) - { - event.eventType = WFX_EVT_STA_START_JOIN; - WfxPostEvent(&event); - } - } - } - } + size_t psk_length = strlen(wfx_rsi.sec.passkey); + VerifyOrReturnError(psk_length <= SL_WIFI_MAX_PSK_LENGTH, SL_STATUS_SI91X_INVALID_PSK_LENGTH); + sl_net_credential_id_t id = SL_NET_DEFAULT_WIFI_CLIENT_CREDENTIAL_ID; + status = sl_net_set_credential(id, SL_NET_WIFI_PSK, &wfx_rsi.sec.passkey[0], psk_length); + VerifyOrReturnError(status == SL_STATUS_OK, status); + + uint32_t timeout_ms = 0; + ap.ssid.length = strnlen(wfx_rsi.sec.ssid, WFX_MAX_SSID_LENGTH); + ap.encryption = SL_WIFI_NO_ENCRYPTION; + ap.credential_id = id; + memset(&ap.ssid.value, 0, (sizeof(ap.ssid.value) / sizeof(ap.ssid.value[0]))); + strncpy((char *) &ap.ssid.value[0], wfx_rsi.sec.ssid, WFX_MAX_SSID_LENGTH); + ChipLogDetail(DeviceLayer, "wfx_rsi_do_join: SSID: %s, SECURITY: %d(%d)", ap.ssid.value, ap.security, wfx_rsi.sec.security); + status = sl_wifi_connect(SL_WIFI_CLIENT_INTERFACE, &ap, timeout_ms); + // sl_wifi_connect returns SL_STATUS_IN_PROGRESS if join is in progress + // after the initial scan is done, the scan does not check for SSID + ReturnErrorCodeIf((status == SL_STATUS_OK || status == SL_STATUS_IN_PROGRESS), status); + + // failure only happens when the firmware returns an error + ChipLogError(DeviceLayer, "wfx_rsi_do_join: sl_wifi_connect failed: 0x%lx", static_cast(status)); + VerifyOrReturnError((is_wifi_disconnection_event || wfx_rsi.join_retries <= MAX_JOIN_RETRIES_COUNT), status); + + wfx_rsi.dev_state &= ~(WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED); + ChipLogProgress(DeviceLayer, "wfx_rsi_do_join: retry attempt %d", wfx_rsi.join_retries); + wfx_retry_interval_handler(is_wifi_disconnection_event, wfx_rsi.join_retries); + wfx_rsi.join_retries++; + event.eventType = WFX_EVT_STA_START_JOIN; + WfxPostEvent(&event); return status; } @@ -765,7 +726,7 @@ void HandleDHCPPolling() if (sta_netif == NULL) { // TODO: Notify the application that the interface is not set up or Chipdie here because we are in an unkonwn state - SILABS_LOG("HandleDHCPPolling: failed to get STA netif"); + ChipLogError(DeviceLayer, "HandleDHCPPolling: failed to get STA netif"); return; } #if (CHIP_DEVICE_CONFIG_ENABLE_IPV4) @@ -787,6 +748,9 @@ void HandleDHCPPolling() */ 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)) != NULL); + ChipLogProgress(DeviceLayer, "SLAAC OK: linklocal addr: %s", addrStr); wfx_ipv6_notify(GET_IPV6_SUCCESS); hasNotifiedIPV6 = true; event.eventType = WFX_EVT_STA_DHCP_DONE; @@ -801,7 +765,7 @@ void WfxPostEvent(WfxEvent_t * event) if (status != osOK) { - SILABS_LOG("WfxPostEvent: failed to post event with status: %d", status); + ChipLogError(DeviceLayer, "WfxPostEvent: failed to post event: 0x%lx", static_cast(status)); // TODO: Handle error, requeue event depending on queue size or notify relevant task, Chipdie, etc. } } @@ -829,7 +793,7 @@ void ProcessEvent(WfxEvent_t inEvent) switch (inEvent.eventType) { case WFX_EVT_STA_CONN: - SILABS_LOG("%s: starting LwIP STA", __func__); + ChipLogDetail(DeviceLayer, "WFX_EVT_STA_CONN"); wfx_rsi.dev_state |= WFX_RSI_ST_STA_CONNECTED; ResetDHCPNotificationFlags(); wfx_lwip_set_sta_link_up(); @@ -840,10 +804,10 @@ void ProcessEvent(WfxEvent_t inEvent) // is independant of IP connectivity. break; case WFX_EVT_STA_DISCONN: + ChipLogDetail(DeviceLayer, "WFX_EVT_STA_DISCONN"); // TODO: This event is not being posted anywhere, seems to be a dead code or we are missing something wfx_rsi.dev_state &= ~(WFX_RSI_ST_STA_READY | WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED | WFX_RSI_ST_STA_DHCP_DONE); - SILABS_LOG("%s: disconnect notify", __func__); /* TODO: Implement disconnect notify */ ResetDHCPNotificationFlags(); wfx_lwip_set_sta_link_down(); // Internally dhcpclient_poll(netif) -> @@ -863,9 +827,9 @@ void ProcessEvent(WfxEvent_t inEvent) #ifdef SL_WFX_CONFIG_SCAN if (!(wfx_rsi.dev_state & WFX_RSI_ST_SCANSTARTED)) { - SILABS_LOG("%s: start SSID scan", __func__); + ChipLogDetail(DeviceLayer, "WFX_EVT_SCAN"); sl_wifi_scan_configuration_t wifi_scan_configuration; - memset(&wifi_scan_configuration, 0, sizeof(sl_wifi_scan_configuration_t)); + memset(&wifi_scan_configuration, 0, sizeof(wifi_scan_configuration)); // TODO: Add scan logic sl_wifi_advanced_scan_configuration_t advanced_scan_configuration = { 0 }; @@ -879,7 +843,7 @@ void ProcessEvent(WfxEvent_t inEvent) if (SL_STATUS_OK != status) { // TODO: Seems like Chipdie should be called here, the device should be initialized here - SILABS_LOG("Failed to set advanced scan configuration with status: %d", status); + ChipLogError(DeviceLayer, "sl_wifi_set_advanced_scan_configuration failed: 0x%lx", static_cast(status)); return; } @@ -942,13 +906,13 @@ void wfx_rsi_task(void * arg) WfxEvent_t wfxEvent; if (status != RSI_SUCCESS) { - SILABS_LOG("wfx_rsi_task: error: wfx_rsi_init with status: %02x", status); + ChipLogError(DeviceLayer, "wfx_rsi_task: wfx_rsi_init failed: 0x%lx", static_cast(status)); return; } wfx_lwip_start(); wfx_started_notify(); - SILABS_LOG("wfx_rsi_task: starting event loop"); + ChipLogDetail(DeviceLayer, "wfx_rsi_task: starting event loop"); for (;;) { status = osMessageQueueGet(sWifiEventQueue, &wfxEvent, NULL, osWaitForever); @@ -958,8 +922,7 @@ void wfx_rsi_task(void * arg) } else { - // TODO: Everywhere in this file(and related) SILABS_LOG ---> Chiplog - SILABS_LOG("Failed to get event with status: %x", status); + ChipLogError(DeviceLayer, "wfx_rsi_task: get event failed: 0x%lx", static_cast(status)); } } } @@ -982,8 +945,8 @@ void wfx_dhcp_got_ipv4(uint32_t ip) 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; - SILABS_LOG("%s: DHCP OK: IP=%d.%d.%d.%d", __func__, wfx_rsi.ip4_addr[0], wfx_rsi.ip4_addr[1], wfx_rsi.ip4_addr[2], - wfx_rsi.ip4_addr[3]); + 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 |= WFX_RSI_ST_STA_DHCP_DONE; wfx_ip_changed_notify(IP_STATUS_SUCCESS); diff --git a/examples/platform/silabs/display/lcd.cpp b/examples/platform/silabs/display/lcd.cpp index 80cd5a1774bbad..434dedf4f21b76 100644 --- a/examples/platform/silabs/display/lcd.cpp +++ b/examples/platform/silabs/display/lcd.cpp @@ -203,6 +203,11 @@ void SilabsLCD::SetCustomUI(customUICB cb) customUI = cb; } +void SilabsLCD::GetScreen(Screen_e & screen) +{ + screen = static_cast(mCurrentScreen); +} + void SilabsLCD::SetScreen(Screen_e screen) { if (screen >= InvalidScreen) @@ -226,6 +231,7 @@ void SilabsLCD::SetScreen(Screen_e screen) default: break; } + mCurrentScreen = screen; } void SilabsLCD::CycleScreens(void) diff --git a/examples/platform/silabs/display/lcd.h b/examples/platform/silabs/display/lcd.h index 703e72ab6ea61f..b62664c9b47346 100644 --- a/examples/platform/silabs/display/lcd.h +++ b/examples/platform/silabs/display/lcd.h @@ -26,8 +26,7 @@ #endif // QR_CODE_ENABLED #include "demo-ui.h" - -#define MAX_STR_LEN 48 +#include class SilabsLCD { @@ -52,11 +51,11 @@ class SilabsLCD typedef struct dStatus { - uint8_t nbFabric = 0; - bool connected = false; - char networkName[50] = { "TODO" }; - bool advertising = false; - ICDMode_e icdMode = NotICD; + uint8_t nbFabric = 0; + bool connected = false; + char networkName[chip::DeviceLayer::Internal::kMaxWiFiSSIDLength] = { 0 }; + bool advertising = false; + ICDMode_e icdMode = NotICD; } DisplayStatus_t; typedef void (*customUICB)(GLIB_Context_t * context); @@ -68,6 +67,7 @@ class SilabsLCD void WriteDemoUI(bool state); void SetCustomUI(customUICB cb); + void GetScreen(Screen_e & screen); void SetScreen(Screen_e screen); void CycleScreens(void); void SetStatus(DisplayStatus_t & status); diff --git a/examples/platform/silabs/efr32/rs911x/rsi_if.c b/examples/platform/silabs/efr32/rs911x/rsi_if.c index 3596b098b7a1ca..a08e2a2f292de1 100644 --- a/examples/platform/silabs/efr32/rs911x/rsi_if.c +++ b/examples/platform/silabs/efr32/rs911x/rsi_if.c @@ -142,7 +142,7 @@ int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t * ap) uint8_t rssi; ap->security = wfx_rsi.sec.security; ap->chan = wfx_rsi.ap_chan; - memcpy(&ap->bssid[0], &wfx_rsi.ap_mac.octet[0], BSSID_MAX_STR_LEN); + memcpy(&ap->bssid[0], &wfx_rsi.ap_mac.octet[0], BSSID_LEN); status = rsi_wlan_get(RSI_RSSI, &rssi, sizeof(rssi)); if (status == RSI_SUCCESS) { @@ -493,7 +493,7 @@ static void wfx_rsi_save_ap_info() // translation } wfx_rsi.sec.security = WFX_SEC_UNSPECIFIED; wfx_rsi.ap_chan = rsp.scan_info->rf_channel; - memcpy(&wfx_rsi.ap_mac.octet[0], &rsp.scan_info->bssid[0], BSSID_MAX_STR_LEN); + memcpy(&wfx_rsi.ap_mac.octet[0], &rsp.scan_info->bssid[0], BSSID_LEN); switch (rsp.scan_info->security_mode) { @@ -753,9 +753,9 @@ void ProcessEvent(WfxEvent_t inEvent) strncpy(ap.ssid, (char *) scan->ssid, MIN(sizeof(ap.ssid), sizeof(scan->ssid))); ap.security = scan->security_mode; ap.rssi = (-1) * scan->rssi_val; - configASSERT(sizeof(ap.bssid) >= BSSID_MAX_STR_LEN); - configASSERT(sizeof(scan->bssid) >= BSSID_MAX_STR_LEN); - memcpy(ap.bssid, scan->bssid, BSSID_MAX_STR_LEN); + configASSERT(sizeof(ap.bssid) >= BSSID_LEN); + configASSERT(sizeof(scan->bssid) >= BSSID_LEN); + memcpy(ap.bssid, scan->bssid, BSSID_LEN); (*wfx_rsi.scan_cb)(&ap); if (wfx_rsi.scan_ssid) diff --git a/examples/platform/silabs/efr32/uart.cpp b/examples/platform/silabs/efr32/uart.cpp index 5feaaa66d86923..80d2dbba63b3a8 100644 --- a/examples/platform/silabs/efr32/uart.cpp +++ b/examples/platform/silabs/efr32/uart.cpp @@ -361,6 +361,12 @@ int16_t uartConsoleWrite(const char * Buf, uint16_t BufLength) return UART_CONSOLE_ERR; } + if (NULL == sUartTxQueue) + { + // This is to prevent the first prompt from OTCLI to be rejected and to break the OTCli output + uartConsoleInit(); + } + #ifdef PW_RPC_ENABLED // Pigweed Logger is already thread safe. UARTDRV_ForceTransmit(vcom_handle, (uint8_t *) Buf, BufLength); diff --git a/examples/platform/silabs/efr32/wf200/host_if.cpp b/examples/platform/silabs/efr32/wf200/host_if.cpp index 041a1778421ed3..ac3ad07773d9d3 100644 --- a/examples/platform/silabs/efr32/wf200/host_if.cpp +++ b/examples/platform/silabs/efr32/wf200/host_if.cpp @@ -335,7 +335,7 @@ static void sl_wfx_scan_result_callback(sl_wfx_scan_result_ind_body_t * scan_res } ap->scan.chan = scan_result->channel; ap->scan.rssi = scan_result->rcpi; - memcpy(&ap->scan.bssid[0], &scan_result->mac[0], BSSID_MAX_STR_LEN); + memcpy(&ap->scan.bssid[0], &scan_result->mac[0], BSSID_LEN); scan_count++; } } diff --git a/examples/platform/silabs/ldscripts/efr32mg26.ld b/examples/platform/silabs/ldscripts/efr32mg26.ld new file mode 100644 index 00000000000000..2476e4dce37274 --- /dev/null +++ b/examples/platform/silabs/ldscripts/efr32mg26.ld @@ -0,0 +1,245 @@ +/***************************************************************************//** + * GCC Linker script for Silicon Labs devices + ******************************************************************************* + * # License + * Copyright 2020 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + + MEMORY + { + FLASH (rx) : ORIGIN = 0x8006000, LENGTH = 0x318000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x80000 + } + +ENTRY(Reset_Handler) + +SECTIONS +{ + + .vectors : + { + linker_vectors_begin = .; + KEEP(*(.vectors)) + linker_vectors_end = .; + + __Vectors_End = .; + __Vectors_Size = __Vectors_End - __Vectors; + __lma_ramfuncs_start__ = .; + } > FLASH + + .stack (NOLOAD): + { + . = ALIGN(8); + __StackLimit = .; + KEEP(*(.stack*)) + . = ALIGN(4); + __StackTop = .; + PROVIDE(__stack = __StackTop); + } > RAM + + + .noinit (NOLOAD): + { + *(.noinit*); + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(SORT_BY_ALIGNMENT(.bss*)) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + text_application_ram : + { + . = ALIGN(4); + __vma_ramfuncs_start__ = .; + __text_application_ram_start__ = .; + + *(text_application_ram) + + . = ALIGN(4); + __vma_ramfuncs_end__ = .; + __text_application_ram_end__ = .; + } > RAM AT > FLASH + + .rodata : + { + __lma_ramfuncs_end__ = .; + __rodata_start__ = .; + __rodata_end__ = .; + } > FLASH + + .text : + { + linker_code_begin = .; + *(SORT_BY_ALIGNMENT(.text*)) + *(SORT_BY_ALIGNMENT(text_*)) + . = ALIGN(32); + linker_code_end = .; + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + *(.eh_frame*) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + + LONG (__etext) + LONG (__data_start__) + LONG ((__data_end__ - __data_start__) / 4) + + /* Add each additional data section here */ + /* + LONG (__etext2) + LONG (__data2_start__) + LONG ((__data2_end__ - __data2_start__) / 4) + */ + + __copy_table_end__ = .; + } > FLASH + + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + /* Add each additional bss section here */ + /* + LONG (__bss2_start__) + LONG ((__bss2_end__ - __bss2_start__) / 4) + */ + + __zero_table_end__ = .; + __etext = .; + } > FLASH + + .data : + { + . = ALIGN(4); + __data_start__ = .; + *(vtable) + *(SORT_BY_ALIGNMENT(.data*)) + . = ALIGN(4); + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM AT > FLASH + .memory_manager_heap (NOLOAD): + { + . = ALIGN(8); + __HeapBase = .; + __end__ = .; + end = __end__; + _end = __end__; + KEEP(*(.memory_manager_heap*)) + __HeapLimit = ORIGIN(RAM) + LENGTH(RAM); + } > RAM + + __heap_size = __HeapLimit - __HeapBase; + __ram_end__ = 0x20000000 + 0x80000; + __main_flash_end__ = 0x8006000 + 0x318000; + + /* This is where we handle flash storage blocks. We use dummy sections for finding the configured + * block sizes and then "place" them at the end of flash when the size is known. */ + .internal_storage (DSECT) : { + KEEP(*(.internal_storage*)) + } > FLASH + + + .nvm (DSECT) : { + KEEP(*(.simee*)) + } > FLASH + + __ramfuncs_start__ = __vma_ramfuncs_start__; + __ramfuncs_end__ = __vma_ramfuncs_end__; + + linker_nvm_end = __main_flash_end__; + linker_nvm_begin = linker_nvm_end - SIZEOF(.nvm); + linker_storage_end = linker_nvm_begin; + __nvm3Base = linker_nvm_begin; + + linker_storage_begin = linker_storage_end - SIZEOF(.internal_storage); + ASSERT((linker_storage_begin >= (__etext + SIZEOF(.data))), "FLASH memory overflowed !") + + + app_flash_end = 0x8006000 + 0x318000; + ASSERT( (linker_nvm_begin + SIZEOF(.nvm)) <= app_flash_end, "NVM3 is excessing the flash size !") +} diff --git a/examples/platform/silabs/matter-platform.slcp b/examples/platform/silabs/matter-platform.slcp index c8075656e9f74d..bfde28d9f721f9 100644 --- a/examples/platform/silabs/matter-platform.slcp +++ b/examples/platform/silabs/matter-platform.slcp @@ -72,6 +72,9 @@ component: - {id: mbedtls_platform_dynamic_memory_allocation_config_init_runtime } - {id: mbedtls_base64} - {id: ot_psa_crypto} +- {id: ot_platform_abstraction} +- {id: ot_rtos_wrappers_real} +- {id: sl_ot_custom_cli} # Necessary componenets for ot coap cert lib # - {id: mbedtls_dtls} # Requried by COAP lib # - {id: mbedtls_tls_server} # Requried by COAP lib @@ -86,6 +89,10 @@ config_file: directory: btconf configuration: +- name: SL_OPENTHREAD_ENABLE_APP_TASK + value: 0 +- name: SL_OPENTHREAD_ENABLE_CLI_TASK + value: 0 - {name: SL_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED, value: '0'} - {name: SL_MBEDTLS_KEY_EXCHANGE_PSK_ENABLED, value: '1'} - condition: [uartdrv_usart] diff --git a/examples/platform/silabs/provision/ProvisionStorageDefault.cpp b/examples/platform/silabs/provision/ProvisionStorageDefault.cpp index 661189ef9060ac..09f103592d2470 100644 --- a/examples/platform/silabs/provision/ProvisionStorageDefault.cpp +++ b/examples/platform/silabs/provision/ProvisionStorageDefault.cpp @@ -17,7 +17,6 @@ #include "AttestationKey.h" #include "ProvisionStorage.h" #include -#include #include #include #include @@ -26,15 +25,20 @@ #include #include #include +#include #include -#include #include #ifdef SLI_SI91X_MCU_INTERFACE #include +#else +#include +#include #endif #ifdef SL_PROVISION_GENERATOR extern void setNvm3End(uint32_t addr); +#elif !SL_MATTER_GN_BUILD +#include #endif extern uint8_t linker_nvm_end[]; @@ -535,7 +539,7 @@ CHIP_ERROR Storage::GetDeviceAttestationCert(MutableByteSpan & value) return err; } -#ifdef SLI_SI91X_MCU_INTERFACE +#if defined(SLI_SI91X_MCU_INTERFACE) && defined(SL_MBEDTLS_USE_TINYCRYPT) CHIP_ERROR Storage::SetDeviceAttestationKey(const ByteSpan & value) { return SilabsConfig::WriteConfigValueBin(SilabsConfig::kConfigKey_Creds_KeyId, value.data(), value.size()); @@ -573,7 +577,7 @@ CHIP_ERROR Storage::SignWithDeviceAttestationKey(const ByteSpan & message, Mutab } } -#else // SLI_SI91X_MCU_INTERFACEX_MCU_INTERFACEX_MCU_INTERFACE +#else CHIP_ERROR Storage::SetDeviceAttestationKey(const ByteSpan & value) { @@ -696,15 +700,6 @@ CHIP_ERROR Storage::GetTestEventTriggerKey(MutableByteSpan & keySpan) } // namespace Provision -void MigrateUint32(uint32_t old_key, uint32_t new_key) -{ - uint32_t value = 0; - if (SilabsConfig::ConfigValueExists(old_key) && (CHIP_NO_ERROR == SilabsConfig::ReadConfigValue(old_key, value))) - { - SilabsConfig::WriteConfigValue(new_key, value); - } -} - void MigrateDacProvider(void) { constexpr uint32_t kOldKey_Creds_KeyId = SilabsConfigKey(SilabsConfig::kMatterConfig_KeyBase, 0x21); @@ -716,14 +711,14 @@ void MigrateDacProvider(void) constexpr uint32_t kOldKey_Creds_CD_Offset = SilabsConfigKey(SilabsConfig::kMatterConfig_KeyBase, 0x27); constexpr uint32_t kOldKey_Creds_CD_Size = SilabsConfigKey(SilabsConfig::kMatterConfig_KeyBase, 0x28); - MigrateUint32(kOldKey_Creds_KeyId, SilabsConfig::kConfigKey_Creds_KeyId); - MigrateUint32(kOldKey_Creds_Base_Addr, SilabsConfig::kConfigKey_Creds_Base_Addr); - MigrateUint32(kOldKey_Creds_DAC_Offset, SilabsConfig::kConfigKey_Creds_DAC_Offset); - MigrateUint32(kOldKey_Creds_DAC_Size, SilabsConfig::kConfigKey_Creds_DAC_Size); - MigrateUint32(kOldKey_Creds_PAI_Offset, SilabsConfig::kConfigKey_Creds_PAI_Offset); - MigrateUint32(kOldKey_Creds_PAI_Size, SilabsConfig::kConfigKey_Creds_PAI_Size); - MigrateUint32(kOldKey_Creds_CD_Offset, SilabsConfig::kConfigKey_Creds_CD_Offset); - MigrateUint32(kOldKey_Creds_CD_Size, SilabsConfig::kConfigKey_Creds_CD_Size); + MigrationManager::MigrateUint32(kOldKey_Creds_KeyId, SilabsConfig::kConfigKey_Creds_KeyId); + MigrationManager::MigrateUint32(kOldKey_Creds_Base_Addr, SilabsConfig::kConfigKey_Creds_Base_Addr); + MigrationManager::MigrateUint32(kOldKey_Creds_DAC_Offset, SilabsConfig::kConfigKey_Creds_DAC_Offset); + MigrationManager::MigrateUint32(kOldKey_Creds_DAC_Size, SilabsConfig::kConfigKey_Creds_DAC_Size); + MigrationManager::MigrateUint32(kOldKey_Creds_PAI_Offset, SilabsConfig::kConfigKey_Creds_PAI_Offset); + MigrationManager::MigrateUint32(kOldKey_Creds_PAI_Size, SilabsConfig::kConfigKey_Creds_PAI_Size); + MigrationManager::MigrateUint32(kOldKey_Creds_CD_Offset, SilabsConfig::kConfigKey_Creds_CD_Offset); + MigrationManager::MigrateUint32(kOldKey_Creds_CD_Size, SilabsConfig::kConfigKey_Creds_CD_Size); } } // namespace Silabs diff --git a/examples/pump-app/nrfconnect/CMakeLists.txt b/examples/pump-app/nrfconnect/CMakeLists.txt index 7682c0ca663ffd..b599faaa1dd863 100644 --- a/examples/pump-app/nrfconnect/CMakeLists.txt +++ b/examples/pump-app/nrfconnect/CMakeLists.txt @@ -21,14 +21,6 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) -# Set Kconfig root files that will be processed as a first Kconfig for used child images. -set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root) -set(multiprotocol_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root) - -if(NOT CONF_FILE STREQUAL "prj_no_dfu.conf") - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static_dfu.yml) -endif() - list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) @@ -40,6 +32,7 @@ target_compile_options(app PRIVATE -Werror -Wno-error=maybe-uninitialized) project(chip-nrfconnect-pump-example) +include(${CHIP_ROOT}/config/nrfconnect/app/check-sysbuild-use.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/flashing.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) diff --git a/examples/pump-app/nrfconnect/Kconfig.sysbuild b/examples/pump-app/nrfconnect/Kconfig.sysbuild new file mode 100644 index 00000000000000..8877de44e2d570 --- /dev/null +++ b/examples/pump-app/nrfconnect/Kconfig.sysbuild @@ -0,0 +1,76 @@ +# +# 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. +# + +#### Radio core selection +config NRF_DEFAULT_IPC_RADIO + default y + +# Enable IEEE802.15.4 serialization to network core +config NETCORE_IPC_RADIO_IEEE802154 + default y if SOC_SERIES_NRF53X + +# Enable Bluetooth serialization to network core +config NETCORE_IPC_RADIO_BT_HCI_IPC + default y if SOC_SERIES_NRF53X + +#### Bootloader +choice BOOTLOADER + default BOOTLOADER_MCUBOOT +endchoice + +if BOOTLOADER_MCUBOOT + +#### DFU multi-image support +config DFU_MULTI_IMAGE_PACKAGE_BUILD + default y + +config DFU_MULTI_IMAGE_PACKAGE_APP + default y + +config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY + default y + +#### DFU network core configuration +if SOC_SERIES_NRF53X + +config MCUBOOT_UPDATEABLE_IMAGES + default 2 + +choice MCUBOOT_MODE + default MCUBOOT_MODE_OVERWRITE_ONLY +endchoice + +choice BOOT_SIGNATURE_TYPE + default BOOT_SIGNATURE_TYPE_RSA +endchoice + +config SECURE_BOOT_NETCORE + default y + +config NETCORE_APP_UPDATE + default y + +config DFU_MULTI_IMAGE_PACKAGE_NET + default y + +endif # SOC_SERIES_NRF53X +endif # BOOTLOADER_MCUBOOT + +#### Enable generating factory data +config MATTER_FACTORY_DATA_GENERATE + default y + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/examples/pump-app/nrfconnect/README.md b/examples/pump-app/nrfconnect/README.md index 50e8a1b0e6d0a0..16fbc2f0143c2c 100644 --- a/examples/pump-app/nrfconnect/README.md +++ b/examples/pump-app/nrfconnect/README.md @@ -1,5 +1,21 @@ # Matter nRF Connect Pump Example Application +> **Note:** This example is intended only to perform smoke tests of a Matter +> solution integrated with nRF Connect SDK platform. The example quality is not +> production ready and it may contain minor bugs or use not optimal +> configuration. It is not recommended to use this example as a basis for +> creating a market ready product. +> +> For the production ready and optimized Matter samples, see +> [nRF Connect SDK samples](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/matter.html). +> The Matter samples in nRF Connect SDK use various additional software +> components and provide multiple optional features that improve the developer +> and user experience. To read more about it, see +> [Matter support in nRF Connect SDK](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/matter/index.html#ug-matter) +> page. Using Matter samples from nRF Connect SDK allows you to get a full +> Nordic technical support via [DevZone](https://devzone.nordicsemi.com/) +> portal. + The nRF Connect Pump Example demonstrates how to remotely control a pump device with basic start/stop functionality. It uses buttons to test changing the pump state and device states and LEDs to show the state of these changes. This @@ -139,8 +155,8 @@ The example supports building and running on the following devices: | Hardware platform | Build target | Platform image | | ----------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | -| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk_nrf52840` |
nRF52840 DKnRF52840 DK
| -| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk_nrf5340_cpuapp` |
nRF5340 DKnRF5340 DK
| +| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk/nrf52840` |
nRF52840 DKnRF52840 DK
| +| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk/nrf5340/cpuapp` |
nRF5340 DKnRF5340 DK
|
@@ -283,14 +299,15 @@ Complete the following steps to build the sample: 2. Run the following command to build the example, with _build-target_ replaced with the build target name of the Nordic Semiconductor's kit you own, for - example `nrf52840dk_nrf52840`: + example `nrf52840dk/nrf52840`: - $ west build -b build-target + $ west build -b build-target --sysbuild You only need to specify the build target on the first build. See [Requirements](#requirements) for the build target names of compatible kits. -The output `zephyr.hex` file will be available in the `build/zephyr/` directory. +The output `zephyr.hex` file will be available in the `build/nrfconnect/zephyr/` +directory. ### Removing build artifacts @@ -305,7 +322,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DCONF_FILE=prj_release.conf + $ west build -b build-target --sysbuild -- -DFILE_SUFFIX=release Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -316,15 +333,9 @@ Support for DFU using Matter OTA is enabled by default. To enable DFU over Bluetooth LE, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are -using (for example `nrf52840dk_nrf52840`): - - $ west build -b build-target -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y - -To completely disable support for both DFU methods, run the following command -with _build-target_ replaced with the build target name of the Nordic -Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): +using (for example `nrf52840dk/nrf52840`): - $ west build -b build-target -- -DCONF_FILE=prj_no_dfu.conf + $ west build -b build-target --sysbuild -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y > **Note**: > @@ -341,7 +352,7 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): #### Changing bootloader configuration To change the default MCUboot configuration, edit the `prj.conf` file located in -the `child_image/mcuboot` directory. +the `sysbuild/mcuboot` directory. Make sure to keep the configuration consistent with changes made to the application configuration. This is necessary for the configuration to work, as @@ -358,8 +369,9 @@ purposes. You can change these settings by defining This example uses this option to define using an external flash. To modify the flash settings of your board (that is, your _build-target_, for -example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the -`configuration/build-target/` directory. +example `nrf52840dk/nrf52840`), edit the `pm_static_.yml` file +(for example `pm_static_nrf52840dk_nrf52840.yml`), located in the main +application directory.
@@ -371,7 +383,7 @@ using the menuconfig utility. To open the menuconfig utility, run the following command from the example directory: - $ west build -b build-target -t menuconfig + $ west build -b build-target --sysbuild -t menuconfig Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -401,9 +413,6 @@ depending on the selected board: command-line shell. - release -- Release version of the application - can be used to enable only the necessary application functionalities to optimize its performance. -- no_dfu -- Debug version of the application without Device Firmware Upgrade - feature support - can be used only for the nRF52840 DK and nRF5340 DK, as - those platforms have DFU enabled by default. For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) diff --git a/examples/pump-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/pump-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/pump-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/pump-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay b/examples/pump-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/pump-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/pump-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/pump-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index f18e3e0cc16434..00000000000000 --- a/examples/pump-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/pump-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay b/examples/pump-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/pump-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/pump-app/nrfconnect/child_image/mcuboot/prj.conf b/examples/pump-app/nrfconnect/child_image/mcuboot/prj.conf deleted file mode 100644 index 287c7829c6a5cf..00000000000000 --- a/examples/pump-app/nrfconnect/child_image/mcuboot/prj.conf +++ /dev/null @@ -1,30 +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. -# - -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. - -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" - -# Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. -CONFIG_GPIO=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_USE_SEGGER_RTT=n diff --git a/examples/pump-app/nrfconnect/child_image/mcuboot/prj_release.conf b/examples/pump-app/nrfconnect/child_image/mcuboot/prj_release.conf deleted file mode 100644 index 287c7829c6a5cf..00000000000000 --- a/examples/pump-app/nrfconnect/child_image/mcuboot/prj_release.conf +++ /dev/null @@ -1,30 +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. -# - -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. - -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" - -# Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. -CONFIG_GPIO=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_USE_SEGGER_RTT=n diff --git a/examples/pump-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf b/examples/pump-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/pump-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/pump-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf b/examples/pump-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/pump-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/pump-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf b/examples/pump-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/pump-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/pump-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml b/examples/pump-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml new file mode 100644 index 00000000000000..ce42b39e55ee87 --- /dev/null +++ b/examples/pump-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml @@ -0,0 +1,42 @@ +mcuboot: + address: 0x0 + size: 0x7000 + region: flash_primary +mcuboot_pad: + address: 0x7000 + size: 0x200 +app: + address: 0x7200 + size: 0xf3e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x7000 + size: 0xf4000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x7200 + size: 0xf3e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_secondary: + address: 0x0 + size: 0xf4000 + device: MX25R64 + region: external_flash +external_flash: + address: 0xf4000 + size: 0x70c000 + device: MX25R64 + region: external_flash diff --git a/examples/pump-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml b/examples/pump-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml new file mode 100644 index 00000000000000..ce42b39e55ee87 --- /dev/null +++ b/examples/pump-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml @@ -0,0 +1,42 @@ +mcuboot: + address: 0x0 + size: 0x7000 + region: flash_primary +mcuboot_pad: + address: 0x7000 + size: 0x200 +app: + address: 0x7200 + size: 0xf3e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x7000 + size: 0xf4000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x7200 + size: 0xf3e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_secondary: + address: 0x0 + size: 0xf4000 + device: MX25R64 + region: external_flash +external_flash: + address: 0xf4000 + size: 0x70c000 + device: MX25R64 + region: external_flash diff --git a/examples/pump-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml b/examples/pump-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml new file mode 100644 index 00000000000000..10e8680c363a53 --- /dev/null +++ b/examples/pump-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml @@ -0,0 +1,56 @@ +mcuboot: + address: 0x0 + size: 0x8000 + region: flash_primary +mcuboot_pad: + address: 0x8000 + size: 0x200 +app: + address: 0x8200 + size: 0xf2e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x8000 + size: 0xf3000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x8200 + size: 0xf2e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x0 + size: 0xf3000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xf3000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x133000 + size: 0x6CD000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/examples/pump-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml b/examples/pump-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml new file mode 100644 index 00000000000000..10e8680c363a53 --- /dev/null +++ b/examples/pump-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml @@ -0,0 +1,56 @@ +mcuboot: + address: 0x0 + size: 0x8000 + region: flash_primary +mcuboot_pad: + address: 0x8000 + size: 0x200 +app: + address: 0x8200 + size: 0xf2e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x8000 + size: 0xf3000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x8200 + size: 0xf2e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x0 + size: 0xf3000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xf3000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x133000 + size: 0x6CD000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/examples/pump-app/nrfconnect/prj.conf b/examples/pump-app/nrfconnect/prj.conf index 8940955d52b403..91a87e89d916e6 100644 --- a/examples/pump-app/nrfconnect/prj.conf +++ b/examples/pump-app/nrfconnect/prj.conf @@ -25,6 +25,13 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 CONFIG_STD_CPP17=y +# Enable Matter pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/pump-app/nrfconnect/prj_no_dfu.conf b/examples/pump-app/nrfconnect/prj_no_dfu.conf deleted file mode 100644 index 21cd8222c2c2e2..00000000000000 --- a/examples/pump-app/nrfconnect/prj_no_dfu.conf +++ /dev/null @@ -1,46 +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. -# - -# This sample uses Kconfig.defaults to set options common for all -# samples. This file should contain only options specific for this sample -# or overrides of default values. - -# Enable CHIP -CONFIG_CHIP=y -CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" -# 32784 == 0x8010 (example pump-app) -CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 -CONFIG_STD_CPP17=y - -# Add support for LEDs and buttons on Nordic development kits -CONFIG_DK_LIBRARY=y - -# Bluetooth Low Energy configuration -CONFIG_BT_DEVICE_NAME="MatterPump" - -# Other settings -CONFIG_THREAD_NAME=y -CONFIG_MPU_STACK_GUARD=y -CONFIG_RESET_ON_FATAL_ERROR=n - -# Reduce application size -CONFIG_USE_SEGGER_RTT=n - -# Disable Matter OTA DFU -CONFIG_CHIP_OTA_REQUESTOR=n - -# Disable QSPI NOR -CONFIG_CHIP_QSPI_NOR=n diff --git a/examples/pump-app/nrfconnect/prj_release.conf b/examples/pump-app/nrfconnect/prj_release.conf index ac2b6e09ade94d..8bf281aec7df38 100644 --- a/examples/pump-app/nrfconnect/prj_release.conf +++ b/examples/pump-app/nrfconnect/prj_release.conf @@ -25,6 +25,13 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 CONFIG_STD_CPP17=y +# Enable Matter pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/pump-app/nrfconnect/sysbuild.conf b/examples/pump-app/nrfconnect/sysbuild.conf new file mode 100644 index 00000000000000..d0c5eee2b93c39 --- /dev/null +++ b/examples/pump-app/nrfconnect/sysbuild.conf @@ -0,0 +1,17 @@ +# +# 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. +# + +SB_CONFIG_MATTER=y diff --git a/examples/pump-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf b/examples/pump-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf new file mode 100644 index 00000000000000..8540585e53358b --- /dev/null +++ b/examples/pump-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf @@ -0,0 +1,58 @@ +# +# 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. +# + +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# 802.15.4 configuration +CONFIG_NRF_802154_SER_RADIO=y +CONFIG_NRF_802154_ENCRYPTION=y +CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=2 + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_DEBUG_INFO=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y +CONFIG_IPC_RADIO_802154=y diff --git a/examples/pump-app/nrfconnect/sysbuild/ipc_radio/prj.conf b/examples/pump-app/nrfconnect/sysbuild/ipc_radio/prj.conf new file mode 100644 index 00000000000000..8906415dda4fc7 --- /dev/null +++ b/examples/pump-app/nrfconnect/sysbuild/ipc_radio/prj.conf @@ -0,0 +1,21 @@ +# +# 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. +# + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=n diff --git a/examples/pump-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf b/examples/pump-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf new file mode 100644 index 00000000000000..7f92a51630cce0 --- /dev/null +++ b/examples/pump-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf @@ -0,0 +1,20 @@ +# +# 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. +# +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=y diff --git a/examples/pump-app/nrfconnect/sysbuild/mcuboot/app.overlay b/examples/pump-app/nrfconnect/sysbuild/mcuboot/app.overlay new file mode 100644 index 00000000000000..74d3dfbfd22f30 --- /dev/null +++ b/examples/pump-app/nrfconnect/sysbuild/mcuboot/app.overlay @@ -0,0 +1,5 @@ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/examples/pump-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf b/examples/pump-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf new file mode 100644 index 00000000000000..50610217c762b5 --- /dev/null +++ b/examples/pump-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf @@ -0,0 +1,19 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 diff --git a/examples/pump-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/pump-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/pump-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/pump-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/pump-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000000..2d86fe6442dd39 --- /dev/null +++ b/examples/pump-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -0,0 +1,35 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 + +CONFIG_BOOT_SWAP_USING_MOVE=n +# Multi-image updates do not support image swapping yet. +CONFIG_BOOT_UPGRADE_ONLY=y + +# The network core cannot access external flash directly. The flash simulator must be used to +# provide a memory region that is used to forward the new firmware to the network core. +CONFIG_FLASH_SIMULATOR=y +CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y +CONFIG_FLASH_SIMULATOR_STATS=n + +CONFIG_ZCBOR=y diff --git a/examples/pump-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/pump-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/pump-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/pump-app/nrfconnect/sysbuild/mcuboot/prj.conf b/examples/pump-app/nrfconnect/sysbuild/mcuboot/prj.conf new file mode 100644 index 00000000000000..3bcb12fe7b8d25 --- /dev/null +++ b/examples/pump-app/nrfconnect/sysbuild/mcuboot/prj.conf @@ -0,0 +1,49 @@ +# +# 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. +# + +CONFIG_MAIN_STACK_SIZE=10240 + +CONFIG_BOOT_SWAP_SAVE_ENCTLV=n +CONFIG_BOOT_BOOTSTRAP=n +CONFIG_PM=n + +CONFIG_FLASH=y +CONFIG_FPROTECT=y + +CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" + +# Use minimal C library instead of the Picolib +CONFIG_MINIMAL_LIBC=y + +# Bootloader size optimization +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_GPIO=n + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +CONFIG_LOG=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_NCS_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/pump-app/pump-common/pump-app.matter b/examples/pump-app/pump-common/pump-app.matter index fa81bdc7452213..e915a40a037fe9 100644 --- a/examples/pump-app/pump-common/pump-app.matter +++ b/examples/pump-app/pump-common/pump-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -125,7 +142,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -307,7 +324,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -323,12 +340,42 @@ cluster AccessControl = 31 { 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; @@ -364,17 +411,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -459,7 +530,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1721,6 +1792,7 @@ endpoint 0 { callback attribute productURL; callback attribute productLabel; callback attribute serialNumber; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; @@ -1938,7 +2010,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 1; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; diff --git a/examples/pump-app/pump-common/pump-app.zap b/examples/pump-app/pump-common/pump-app.zap index cf2045a9d88ca9..17e0732704d2af 100644 --- a/examples/pump-app/pump-common/pump-app.zap +++ b/examples/pump-app/pump-common/pump-app.zap @@ -665,6 +665,22 @@ "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": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, @@ -3327,7 +3343,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/pump-app/silabs/data_model/pump-thread-app.matter b/examples/pump-app/silabs/data_model/pump-thread-app.matter index 42f463b17e256e..6b6f7894e5268b 100644 --- a/examples/pump-app/silabs/data_model/pump-thread-app.matter +++ b/examples/pump-app/silabs/data_model/pump-thread-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -125,7 +142,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -307,7 +324,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -323,12 +340,42 @@ cluster AccessControl = 31 { 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; @@ -364,17 +411,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -459,7 +530,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1721,6 +1792,7 @@ endpoint 0 { callback attribute productURL; callback attribute productLabel; callback attribute serialNumber; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; @@ -1938,7 +2010,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 1; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; diff --git a/examples/pump-app/silabs/data_model/pump-thread-app.zap b/examples/pump-app/silabs/data_model/pump-thread-app.zap index 411699e5e59f33..d977c40da06770 100644 --- a/examples/pump-app/silabs/data_model/pump-thread-app.zap +++ b/examples/pump-app/silabs/data_model/pump-thread-app.zap @@ -665,6 +665,22 @@ "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": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, @@ -3327,7 +3343,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/pump-app/silabs/data_model/pump-wifi-app.matter b/examples/pump-app/silabs/data_model/pump-wifi-app.matter index 42f463b17e256e..6b6f7894e5268b 100644 --- a/examples/pump-app/silabs/data_model/pump-wifi-app.matter +++ b/examples/pump-app/silabs/data_model/pump-wifi-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -125,7 +142,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -307,7 +324,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -323,12 +340,42 @@ cluster AccessControl = 31 { 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; @@ -364,17 +411,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -459,7 +530,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1721,6 +1792,7 @@ endpoint 0 { callback attribute productURL; callback attribute productLabel; callback attribute serialNumber; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; @@ -1938,7 +2010,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 1; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; diff --git a/examples/pump-app/silabs/data_model/pump-wifi-app.zap b/examples/pump-app/silabs/data_model/pump-wifi-app.zap index 411699e5e59f33..d977c40da06770 100644 --- a/examples/pump-app/silabs/data_model/pump-wifi-app.zap +++ b/examples/pump-app/silabs/data_model/pump-wifi-app.zap @@ -665,6 +665,22 @@ "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": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, @@ -3327,7 +3343,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/pump-app/telink/README.md b/examples/pump-app/telink/README.md index 885cf7230856bc..2a89b7514b1c98 100755 --- a/examples/pump-app/telink/README.md +++ b/examples/pump-app/telink/README.md @@ -8,6 +8,17 @@ reference for creating your own pump application. ![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) +## Supported devices + +The example supports building and running on the following devices: + +| Board/SoC | Build target | Zephyr Board Info | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| [B91](https://wiki.telink-semi.cn/wiki/Hardware/B91_Generic_Starter_Kit_Hardware_Guide) [TLSR9518ADK80D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series) | `tlsr9518adk80d`, `tlsr9518adk80d-mars`, `tlsr9518adk80d-usb` | [TLSR9518ADK80D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9518adk80d/doc/index.rst) | +| [B92](https://wiki.telink-semi.cn/wiki/Hardware/B92_Generic_Starter_Kit_Hardware_Guide) [TLSR9528A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR952x-Series) | `tlsr9528a`, `tlsr9528a_retention` | [TLSR9528A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9528a/doc/index.rst) | +| [B95](https://wiki.telink-semi.cn/wiki/Hardware/B95_Generic_Starter_Kit_Hardware_Guide) [TLSR9258A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR925x-Series) | `tlsr9258a` | [TLSR9258A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9258a/doc/index.rst) | +| [W91](https://wiki.telink-semi.cn/wiki/Hardware/W91_Generic_Starter_Kit_Hardware_Guide) [TLSR9118BDK40D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR911x-Series) | `tlsr9118bdk40d` | [TLSR9118BDK40D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9118bdk40d/doc/index.rst) | + ## Build and flash 1. Run the Docker container: @@ -16,7 +27,7 @@ reference for creating your own pump application. $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}') ``` - Compatible docker image version can be found in next file: + You can find the compatible Docker image version in the file: ```bash $ .github/workflows/examples-telink.yaml @@ -28,8 +39,8 @@ reference for creating your own pump application. $ source ./scripts/activate.sh -p all,telink ``` -3. In the example dir run (replace __ with your board name, for - example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`): +3. Build the example (replace __ with your board name, see + [Supported devices](#supported-devices)): ```bash $ west build -b @@ -39,9 +50,12 @@ reference for creating your own pump application. MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=4m`: ```bash - $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + $ west build -b -- -DFLASH_SIZE=4m ``` + You can find the target built file called **_zephyr.bin_** under the + **_build/zephyr_** directory. + 4. Flash binary: ``` @@ -60,16 +74,18 @@ To get output from device, connect UART to following pins: | TX | PB2 (pin 16 of J34 connector) | | GND | GND | +Baud rate: 115200 bits/s + ### Buttons The following buttons are available on **tlsr9518adk80d** board: -| Name | Function | Description | -| :------- | :--------------------- | :----------------------------------------------------------------------------------------------------- | -| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and back to uncommissioned state | -| Button 2 | Lock control | Manually triggers the bolt lock state | -| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | -| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | +| Name | Function | Description | +| :------- | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and return to a decommissioned state (to activate, push the button 3 times) | +| Button 2 | Lock control | Manually triggers the bolt lock state | +| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | +| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | ### LEDs diff --git a/examples/pump-controller-app/nrfconnect/CMakeLists.txt b/examples/pump-controller-app/nrfconnect/CMakeLists.txt index 52ece075e286ee..98d43aefafeb71 100644 --- a/examples/pump-controller-app/nrfconnect/CMakeLists.txt +++ b/examples/pump-controller-app/nrfconnect/CMakeLists.txt @@ -21,14 +21,6 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) -# Set Kconfig root files that will be processed as a first Kconfig for used child images. -set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root) -set(multiprotocol_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root) - -if(NOT CONF_FILE STREQUAL "prj_no_dfu.conf") - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static_dfu.yml) -endif() - list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) @@ -40,6 +32,7 @@ target_compile_options(app PRIVATE -Werror -Wno-error=maybe-uninitialized) project(chip-nrfconnect-pump-controller-example) +include(${CHIP_ROOT}/config/nrfconnect/app/check-sysbuild-use.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/flashing.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) diff --git a/examples/pump-controller-app/nrfconnect/Kconfig.sysbuild b/examples/pump-controller-app/nrfconnect/Kconfig.sysbuild new file mode 100644 index 00000000000000..8877de44e2d570 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/Kconfig.sysbuild @@ -0,0 +1,76 @@ +# +# 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. +# + +#### Radio core selection +config NRF_DEFAULT_IPC_RADIO + default y + +# Enable IEEE802.15.4 serialization to network core +config NETCORE_IPC_RADIO_IEEE802154 + default y if SOC_SERIES_NRF53X + +# Enable Bluetooth serialization to network core +config NETCORE_IPC_RADIO_BT_HCI_IPC + default y if SOC_SERIES_NRF53X + +#### Bootloader +choice BOOTLOADER + default BOOTLOADER_MCUBOOT +endchoice + +if BOOTLOADER_MCUBOOT + +#### DFU multi-image support +config DFU_MULTI_IMAGE_PACKAGE_BUILD + default y + +config DFU_MULTI_IMAGE_PACKAGE_APP + default y + +config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY + default y + +#### DFU network core configuration +if SOC_SERIES_NRF53X + +config MCUBOOT_UPDATEABLE_IMAGES + default 2 + +choice MCUBOOT_MODE + default MCUBOOT_MODE_OVERWRITE_ONLY +endchoice + +choice BOOT_SIGNATURE_TYPE + default BOOT_SIGNATURE_TYPE_RSA +endchoice + +config SECURE_BOOT_NETCORE + default y + +config NETCORE_APP_UPDATE + default y + +config DFU_MULTI_IMAGE_PACKAGE_NET + default y + +endif # SOC_SERIES_NRF53X +endif # BOOTLOADER_MCUBOOT + +#### Enable generating factory data +config MATTER_FACTORY_DATA_GENERATE + default y + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/examples/pump-controller-app/nrfconnect/README.md b/examples/pump-controller-app/nrfconnect/README.md index 948aa20f54d0d8..64f37c4bb6a7aa 100644 --- a/examples/pump-controller-app/nrfconnect/README.md +++ b/examples/pump-controller-app/nrfconnect/README.md @@ -1,5 +1,21 @@ # Matter nRF Connect Pump Example Application +> **Note:** This example is intended only to perform smoke tests of a Matter +> solution integrated with nRF Connect SDK platform. The example quality is not +> production ready and it may contain minor bugs or use not optimal +> configuration. It is not recommended to use this example as a basis for +> creating a market ready product. +> +> For the production ready and optimized Matter samples, see +> [nRF Connect SDK samples](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/matter.html). +> The Matter samples in nRF Connect SDK use various additional software +> components and provide multiple optional features that improve the developer +> and user experience. To read more about it, see +> [Matter support in nRF Connect SDK](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/matter/index.html#ug-matter) +> page. Using Matter samples from nRF Connect SDK allows you to get a full +> Nordic technical support via [DevZone](https://devzone.nordicsemi.com/) +> portal. + The nRF Connect Pump Controller Example demonstrates how to implement a pump controller client device with basic start/stop functionality. It uses buttons to test changing the pump state and device states and LEDs to show the state of @@ -140,8 +156,8 @@ The example supports building and running on the following devices: | Hardware platform | Build target | Platform image | | ----------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | -| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk_nrf52840` |
nRF52840 DKnRF52840 DK
| -| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk_nrf5340_cpuapp` |
nRF5340 DKnRF5340 DK
| +| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk/nrf52840` |
nRF52840 DKnRF52840 DK
| +| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk/nrf5340/cpuapp` |
nRF5340 DKnRF5340 DK
|
@@ -283,14 +299,15 @@ Complete the following steps to build the sample: 2. Run the following command to build the example, with _build-target_ replaced with the build target name of the Nordic Semiconductor's kit you own, for - example `nrf52840dk_nrf52840`: + example `nrf52840dk/nrf52840`: - $ west build -b build-target + $ west build -b build-target --sysbuild You only need to specify the build target on the first build. See [Requirements](#requirements) for the build target names of compatible kits. -The output `zephyr.hex` file will be available in the `build/zephyr/` directory. +The output `zephyr.hex` file will be available in the `build/nrfconnect/zephyr/` +directory. ### Removing build artifacts @@ -305,7 +322,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DCONF_FILE=prj_release.conf + $ west build -b build-target --sysbuild -- -DFILE_SUFFIX=release Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -316,15 +333,9 @@ Support for DFU using Matter OTA is enabled by default. To enable DFU over Bluetooth LE, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are -using (for example `nrf52840dk_nrf52840`): - - $ west build -b build-target -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y - -To completely disable support for both DFU methods, run the following command -with _build-target_ replaced with the build target name of the Nordic -Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): +using (for example `nrf52840dk/nrf52840`): - $ west build -b build-target -- -DCONF_FILE=prj_no_dfu.conf + $ west build -b build-target --sysbuild -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y > **Note**: > @@ -341,7 +352,7 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): #### Changing bootloader configuration To change the default MCUboot configuration, edit the `prj.conf` file located in -the `child_image/mcuboot` directory. +the `sysbuild/mcuboot` directory. Make sure to keep the configuration consistent with changes made to the application configuration. This is necessary for the configuration to work, as @@ -358,8 +369,9 @@ purposes. You can change these settings by defining This example uses this option to define using an external flash. To modify the flash settings of your board (that is, your _build-target_, for -example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the -`configuration/build-target/` directory. +example `nrf52840dk/nrf52840`), edit the `pm_static_.yml` file +(for example `pm_static_nrf52840dk_nrf52840.yml`), located in the main +application directory.
@@ -371,7 +383,7 @@ using the menuconfig utility. To open the menuconfig utility, run the following command from the example directory: - $ west build -b build-target -t menuconfig + $ west build -b build-target --sysbuild -t menuconfig Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -401,9 +413,6 @@ depending on the selected board: command-line shell. - release -- Release version of the application - can be used to enable only the necessary application functionalities to optimize its performance. -- no_dfu -- Debug version of the application without Device Firmware Upgrade - feature support - can be used only for the nRF52840 DK and nRF5340 DK, as - those platforms have DFU enabled by default. For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) diff --git a/examples/pump-controller-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/pump-controller-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/pump-controller-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/pump-controller-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay b/examples/pump-controller-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/pump-controller-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/pump-controller-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/pump-controller-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index f18e3e0cc16434..00000000000000 --- a/examples/pump-controller-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/pump-controller-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay b/examples/pump-controller-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/pump-controller-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/pump-controller-app/nrfconnect/child_image/mcuboot/prj.conf b/examples/pump-controller-app/nrfconnect/child_image/mcuboot/prj.conf deleted file mode 100644 index 287c7829c6a5cf..00000000000000 --- a/examples/pump-controller-app/nrfconnect/child_image/mcuboot/prj.conf +++ /dev/null @@ -1,30 +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. -# - -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. - -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" - -# Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. -CONFIG_GPIO=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_USE_SEGGER_RTT=n diff --git a/examples/pump-controller-app/nrfconnect/child_image/mcuboot/prj_release.conf b/examples/pump-controller-app/nrfconnect/child_image/mcuboot/prj_release.conf deleted file mode 100644 index 287c7829c6a5cf..00000000000000 --- a/examples/pump-controller-app/nrfconnect/child_image/mcuboot/prj_release.conf +++ /dev/null @@ -1,30 +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. -# - -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. - -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" - -# Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. -CONFIG_GPIO=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_USE_SEGGER_RTT=n diff --git a/examples/pump-controller-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf b/examples/pump-controller-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/pump-controller-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/pump-controller-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf b/examples/pump-controller-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/pump-controller-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/pump-controller-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf b/examples/pump-controller-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/pump-controller-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/pump-controller-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml b/examples/pump-controller-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml new file mode 100644 index 00000000000000..ce42b39e55ee87 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml @@ -0,0 +1,42 @@ +mcuboot: + address: 0x0 + size: 0x7000 + region: flash_primary +mcuboot_pad: + address: 0x7000 + size: 0x200 +app: + address: 0x7200 + size: 0xf3e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x7000 + size: 0xf4000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x7200 + size: 0xf3e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_secondary: + address: 0x0 + size: 0xf4000 + device: MX25R64 + region: external_flash +external_flash: + address: 0xf4000 + size: 0x70c000 + device: MX25R64 + region: external_flash diff --git a/examples/pump-controller-app/nrfconnect/pm_static_nrf52840dk_nrf52840_relese.yml b/examples/pump-controller-app/nrfconnect/pm_static_nrf52840dk_nrf52840_relese.yml new file mode 100644 index 00000000000000..ce42b39e55ee87 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/pm_static_nrf52840dk_nrf52840_relese.yml @@ -0,0 +1,42 @@ +mcuboot: + address: 0x0 + size: 0x7000 + region: flash_primary +mcuboot_pad: + address: 0x7000 + size: 0x200 +app: + address: 0x7200 + size: 0xf3e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x7000 + size: 0xf4000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x7200 + size: 0xf3e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_secondary: + address: 0x0 + size: 0xf4000 + device: MX25R64 + region: external_flash +external_flash: + address: 0xf4000 + size: 0x70c000 + device: MX25R64 + region: external_flash diff --git a/examples/pump-controller-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml b/examples/pump-controller-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml new file mode 100644 index 00000000000000..10e8680c363a53 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml @@ -0,0 +1,56 @@ +mcuboot: + address: 0x0 + size: 0x8000 + region: flash_primary +mcuboot_pad: + address: 0x8000 + size: 0x200 +app: + address: 0x8200 + size: 0xf2e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x8000 + size: 0xf3000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x8200 + size: 0xf2e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x0 + size: 0xf3000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xf3000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x133000 + size: 0x6CD000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/examples/pump-controller-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml b/examples/pump-controller-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml new file mode 100644 index 00000000000000..10e8680c363a53 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml @@ -0,0 +1,56 @@ +mcuboot: + address: 0x0 + size: 0x8000 + region: flash_primary +mcuboot_pad: + address: 0x8000 + size: 0x200 +app: + address: 0x8200 + size: 0xf2e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x8000 + size: 0xf3000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x8200 + size: 0xf2e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x0 + size: 0xf3000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xf3000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x133000 + size: 0x6CD000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/examples/pump-controller-app/nrfconnect/prj.conf b/examples/pump-controller-app/nrfconnect/prj.conf index 857ad459b83707..4a134922c5f074 100644 --- a/examples/pump-controller-app/nrfconnect/prj.conf +++ b/examples/pump-controller-app/nrfconnect/prj.conf @@ -25,6 +25,13 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32785 CONFIG_STD_CPP17=y +# Enable Matter pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/pump-controller-app/nrfconnect/prj_no_dfu.conf b/examples/pump-controller-app/nrfconnect/prj_no_dfu.conf deleted file mode 100644 index f4b60e647953ae..00000000000000 --- a/examples/pump-controller-app/nrfconnect/prj_no_dfu.conf +++ /dev/null @@ -1,47 +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. -# - -# This sample uses Kconfig.defaults to set options common for all -# samples. This file should contain only options specific for this sample -# or overrides of default values. - -# Enable CHIP -CONFIG_CHIP=y -CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" -# 32785 == 0x8011 (example pump-controller-app) -CONFIG_CHIP_DEVICE_PRODUCT_ID=32785 - -CONFIG_STD_CPP17=y - -# Add support for LEDs and buttons on Nordic development kits -CONFIG_DK_LIBRARY=y - -# Bluetooth Low Energy configuration -CONFIG_BT_DEVICE_NAME="MatterPumpCtrl" - -# Other settings -CONFIG_THREAD_NAME=y -CONFIG_MPU_STACK_GUARD=y -CONFIG_RESET_ON_FATAL_ERROR=n - -# Reduce application size -CONFIG_USE_SEGGER_RTT=n - -# Disable Matter OTA DFU -CONFIG_CHIP_OTA_REQUESTOR=n - -# Disable QSPI NOR -CONFIG_CHIP_QSPI_NOR=n diff --git a/examples/pump-controller-app/nrfconnect/prj_release.conf b/examples/pump-controller-app/nrfconnect/prj_release.conf index 6826b31ca3679b..57dc76f55bd5d8 100644 --- a/examples/pump-controller-app/nrfconnect/prj_release.conf +++ b/examples/pump-controller-app/nrfconnect/prj_release.conf @@ -26,6 +26,13 @@ CONFIG_CHIP_DEVICE_PRODUCT_ID=32785 CONFIG_STD_CPP17=y +# Enable Matter pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/pump-controller-app/nrfconnect/sysbuild.conf b/examples/pump-controller-app/nrfconnect/sysbuild.conf new file mode 100644 index 00000000000000..d0c5eee2b93c39 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/sysbuild.conf @@ -0,0 +1,17 @@ +# +# 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. +# + +SB_CONFIG_MATTER=y diff --git a/examples/pump-controller-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf b/examples/pump-controller-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf new file mode 100644 index 00000000000000..8540585e53358b --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf @@ -0,0 +1,58 @@ +# +# 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. +# + +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# 802.15.4 configuration +CONFIG_NRF_802154_SER_RADIO=y +CONFIG_NRF_802154_ENCRYPTION=y +CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=2 + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_DEBUG_INFO=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y +CONFIG_IPC_RADIO_802154=y diff --git a/examples/pump-controller-app/nrfconnect/sysbuild/ipc_radio/prj.conf b/examples/pump-controller-app/nrfconnect/sysbuild/ipc_radio/prj.conf new file mode 100644 index 00000000000000..8906415dda4fc7 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/sysbuild/ipc_radio/prj.conf @@ -0,0 +1,21 @@ +# +# 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. +# + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=n diff --git a/examples/pump-controller-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf b/examples/pump-controller-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf new file mode 100644 index 00000000000000..7f92a51630cce0 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf @@ -0,0 +1,20 @@ +# +# 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. +# +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=y diff --git a/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/app.overlay b/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/app.overlay new file mode 100644 index 00000000000000..74d3dfbfd22f30 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/app.overlay @@ -0,0 +1,5 @@ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf b/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf new file mode 100644 index 00000000000000..50610217c762b5 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf @@ -0,0 +1,19 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 diff --git a/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000000..2d86fe6442dd39 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -0,0 +1,35 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 + +CONFIG_BOOT_SWAP_USING_MOVE=n +# Multi-image updates do not support image swapping yet. +CONFIG_BOOT_UPGRADE_ONLY=y + +# The network core cannot access external flash directly. The flash simulator must be used to +# provide a memory region that is used to forward the new firmware to the network core. +CONFIG_FLASH_SIMULATOR=y +CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y +CONFIG_FLASH_SIMULATOR_STATS=n + +CONFIG_ZCBOR=y diff --git a/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/prj.conf b/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/prj.conf new file mode 100644 index 00000000000000..3bcb12fe7b8d25 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/sysbuild/mcuboot/prj.conf @@ -0,0 +1,49 @@ +# +# 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. +# + +CONFIG_MAIN_STACK_SIZE=10240 + +CONFIG_BOOT_SWAP_SAVE_ENCTLV=n +CONFIG_BOOT_BOOTSTRAP=n +CONFIG_PM=n + +CONFIG_FLASH=y +CONFIG_FPROTECT=y + +CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" + +# Use minimal C library instead of the Picolib +CONFIG_MINIMAL_LIBC=y + +# Bootloader size optimization +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_GPIO=n + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +CONFIG_LOG=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_NCS_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter index 57e2e9846e2c6d..26ab0343d20e45 100644 --- a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter +++ b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -182,7 +199,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -198,12 +215,42 @@ cluster AccessControl = 31 { 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; @@ -239,17 +286,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -334,7 +405,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1536,6 +1607,7 @@ endpoint 0 { callback attribute productURL; callback attribute productLabel; callback attribute serialNumber; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap b/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap index 7b71c3e3116090..040218e9083e23 100644 --- a/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap +++ b/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap @@ -665,6 +665,22 @@ "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": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, diff --git a/examples/pump-controller-app/telink/README.md b/examples/pump-controller-app/telink/README.md index a49b0999ddebac..529cc37e002bf5 100755 --- a/examples/pump-controller-app/telink/README.md +++ b/examples/pump-controller-app/telink/README.md @@ -9,6 +9,17 @@ your own pump application. ![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) +## Supported devices + +The example supports building and running on the following devices: + +| Board/SoC | Build target | Zephyr Board Info | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| [B91](https://wiki.telink-semi.cn/wiki/Hardware/B91_Generic_Starter_Kit_Hardware_Guide) [TLSR9518ADK80D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series) | `tlsr9518adk80d`, `tlsr9518adk80d-mars`, `tlsr9518adk80d-usb` | [TLSR9518ADK80D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9518adk80d/doc/index.rst) | +| [B92](https://wiki.telink-semi.cn/wiki/Hardware/B92_Generic_Starter_Kit_Hardware_Guide) [TLSR9528A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR952x-Series) | `tlsr9528a`, `tlsr9528a_retention` | [TLSR9528A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9528a/doc/index.rst) | +| [B95](https://wiki.telink-semi.cn/wiki/Hardware/B95_Generic_Starter_Kit_Hardware_Guide) [TLSR9258A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR925x-Series) | `tlsr9258a` | [TLSR9258A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9258a/doc/index.rst) | +| [W91](https://wiki.telink-semi.cn/wiki/Hardware/W91_Generic_Starter_Kit_Hardware_Guide) [TLSR9118BDK40D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR911x-Series) | `tlsr9118bdk40d` | [TLSR9118BDK40D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9118bdk40d/doc/index.rst) | + ## Build and flash 1. Run the Docker container: @@ -17,7 +28,7 @@ your own pump application. $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}') ``` - Compatible docker image version can be found in next file: + You can find the compatible Docker image version in the file: ```bash $ .github/workflows/examples-telink.yaml @@ -29,8 +40,8 @@ your own pump application. $ source ./scripts/activate.sh -p all,telink ``` -3. In the example dir run (replace __ with your board name, for - example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`): +3. Build the example (replace __ with your board name, see + [Supported devices](#supported-devices)): ```bash $ west build -b @@ -40,9 +51,12 @@ your own pump application. MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=4m`: ```bash - $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + $ west build -b -- -DFLASH_SIZE=4m ``` + You can find the target built file called **_zephyr.bin_** under the + **_build/zephyr_** directory. + 4. Flash binary: ``` @@ -61,16 +75,18 @@ To get output from device, connect UART to following pins: | TX | PB2 (pin 16 of J34 connector) | | GND | GND | +Baud rate: 115200 bits/s + ### Buttons The following buttons are available on **tlsr9518adk80d** board: -| Name | Function | Description | -| :------- | :--------------------- | :----------------------------------------------------------------------------------------------------- | -| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and back to uncommissioned state | -| Button 2 | Lock control | Manually triggers the bolt lock state | -| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | -| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | +| Name | Function | Description | +| :------- | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and return to a decommissioned state (to activate, push the button 3 times) | +| Button 2 | Lock control | Manually triggers the bolt lock state | +| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | +| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | ### LEDs diff --git a/examples/refrigerator-app/refrigerator-common/refrigerator-app.matter b/examples/refrigerator-app/refrigerator-common/refrigerator-app.matter index 46545497d2a146..60a01eae22c315 100644 --- a/examples/refrigerator-app/refrigerator-common/refrigerator-app.matter +++ b/examples/refrigerator-app/refrigerator-common/refrigerator-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** 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; @@ -39,7 +56,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -55,12 +72,42 @@ cluster AccessControl = 31 { 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; @@ -96,17 +143,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -191,7 +262,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/rvc-app/rvc-common/rvc-app.matter b/examples/rvc-app/rvc-common/rvc-app.matter index 20faad7d18d333..fda431160c3622 100644 --- a/examples/rvc-app/rvc-common/rvc-app.matter +++ b/examples/rvc-app/rvc-common/rvc-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -89,7 +106,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -105,12 +122,42 @@ cluster AccessControl = 31 { 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; @@ -146,17 +193,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -241,7 +312,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/shell/esp32/sdkconfig.defaults b/examples/shell/esp32/sdkconfig.defaults index a77fbf41167c0c..efd5d235a1cf54 100644 --- a/examples/shell/esp32/sdkconfig.defaults +++ b/examples/shell/esp32/sdkconfig.defaults @@ -41,3 +41,6 @@ CONFIG_ENABLE_CHIP_SHELL=y # Enable HKDF in mbedtls CONFIG_MBEDTLS_HKDF_C=y + +# Disable CHIP data model +CONFIG_ENABLE_CHIP_DATA_MODEL=n diff --git a/examples/shell/nrfconnect/README.md b/examples/shell/nrfconnect/README.md index f0abf5e312462c..551e0d67c052a1 100644 --- a/examples/shell/nrfconnect/README.md +++ b/examples/shell/nrfconnect/README.md @@ -1,5 +1,21 @@ # Matter nRF Connect SDK Shell Application +> **Note:** This example is intended only to perform smoke tests of a Matter +> solution integrated with nRF Connect SDK platform. The example quality is not +> production ready and it may contain minor bugs or use not optimal +> configuration. It is not recommended to use this example as a basis for +> creating a market ready product. +> +> For the production ready and optimized Matter samples, see +> [nRF Connect SDK samples](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/matter.html). +> The Matter samples in nRF Connect SDK use various additional software +> components and provide multiple optional features that improve the developer +> and user experience. To read more about it, see +> [Matter support in nRF Connect SDK](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/matter/index.html#ug-matter) +> page. Using Matter samples from nRF Connect SDK allows you to get a full +> Nordic technical support via [DevZone](https://devzone.nordicsemi.com/) +> portal. + A [Matter shell](../README.md) project for the Nordic nRF52840 and nRF5340 development kits, built using the nRF Connect SDK. diff --git a/examples/shell/nrfconnect/sysbuild.conf b/examples/shell/nrfconnect/sysbuild.conf new file mode 100644 index 00000000000000..e63a92c6b2bbab --- /dev/null +++ b/examples/shell/nrfconnect/sysbuild.conf @@ -0,0 +1,18 @@ +# +# 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. +# + +SB_CONFIG_MATTER=y +SB_CONFIG_MATTER_OTA=n diff --git a/examples/shell/shell_common/BUILD.gn b/examples/shell/shell_common/BUILD.gn index cb098a64598a1b..470f81b5d2459a 100644 --- a/examples/shell/shell_common/BUILD.gn +++ b/examples/shell/shell_common/BUILD.gn @@ -70,16 +70,21 @@ static_library("shell_common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp", ] include_dirs = [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include", "${chip_root}/examples/energy-management-app/energy-management-common/include", + "${chip_root}/src/app/clusters/device-energy-management-server", ] public_deps += diff --git a/examples/shell/telink/README.md b/examples/shell/telink/README.md index 0d445a3838ec3a..14e8bedb1c3bf0 100755 --- a/examples/shell/telink/README.md +++ b/examples/shell/telink/README.md @@ -4,6 +4,17 @@ You can use this example as a reference for creating your own application. ![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) +## Supported devices + +The example supports building and running on the following devices: + +| Board/SoC | Build target | Zephyr Board Info | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| [B91](https://wiki.telink-semi.cn/wiki/Hardware/B91_Generic_Starter_Kit_Hardware_Guide) [TLSR9518ADK80D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series) | `tlsr9518adk80d`, `tlsr9518adk80d-mars`, `tlsr9518adk80d-usb` | [TLSR9518ADK80D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9518adk80d/doc/index.rst) | +| [B92](https://wiki.telink-semi.cn/wiki/Hardware/B92_Generic_Starter_Kit_Hardware_Guide) [TLSR9528A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR952x-Series) | `tlsr9528a`, `tlsr9528a_retention` | [TLSR9528A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9528a/doc/index.rst) | +| [B95](https://wiki.telink-semi.cn/wiki/Hardware/B95_Generic_Starter_Kit_Hardware_Guide) [TLSR9258A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR925x-Series) | `tlsr9258a` | [TLSR9258A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9258a/doc/index.rst) | +| [W91](https://wiki.telink-semi.cn/wiki/Hardware/W91_Generic_Starter_Kit_Hardware_Guide) [TLSR9118BDK40D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR911x-Series) | `tlsr9118bdk40d` | [TLSR9118BDK40D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9118bdk40d/doc/index.rst) | + ## Build and flash 1. Run the Docker container: @@ -12,7 +23,7 @@ You can use this example as a reference for creating your own application. $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}') ``` - Compatible docker image version can be found in next file: + You can find the compatible Docker image version in the file: ```bash $ .github/workflows/examples-telink.yaml @@ -24,8 +35,8 @@ You can use this example as a reference for creating your own application. $ source ./scripts/activate.sh -p all,telink ``` -3. In the example dir run (replace __ with your board name, for - example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`): +3. Build the example (replace __ with your board name, see + [Supported devices](#supported-devices)): ```bash $ west build -b @@ -35,9 +46,12 @@ You can use this example as a reference for creating your own application. MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=4m`: ```bash - $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + $ west build -b -- -DFLASH_SIZE=4m ``` + You can find the target built file called **_zephyr.bin_** under the + **_build/zephyr_** directory. + 4. Flash binary: ``` @@ -55,3 +69,5 @@ To get output from device, connect UART to following pins: | RX | PB3 (pin 17 of J34 connector) | | TX | PB2 (pin 16 of J34 connector) | | GND | GND | + +Baud rate: 115200 bits/s diff --git a/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp b/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp index c9b4a3ab7281f1..dc99728ccf90d5 100644 --- a/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp +++ b/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp @@ -78,7 +78,10 @@ CHIP_ERROR AppTask::Init() } // Register Smoke & Co Test Event Trigger - Server::GetInstance().GetTestEventTriggerDelegate()->AddHandler(&AlarmMgr()); + if (Server::GetInstance().GetTestEventTriggerDelegate() != nullptr) + { + Server::GetInstance().GetTestEventTriggerDelegate()->AddHandler(&AlarmMgr()); + } sAlarmLED.Init(LIGHT_LED); sAlarmLED.Set(false); diff --git a/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter b/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter index 9ed425b817255d..346e958ac22fbc 100644 --- a/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter +++ b/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -166,7 +183,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -182,12 +199,42 @@ cluster AccessControl = 31 { 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; @@ -223,17 +270,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -318,7 +389,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1730,7 +1801,7 @@ cluster UserLabel = 65 { /** Allows servers to ensure that listed clients are notified when a server is available for communication. */ cluster IcdManagement = 70 { - revision 2; + revision 3; enum ClientTypeEnum : enum8 { kPermanent = 0; @@ -1746,6 +1817,7 @@ cluster IcdManagement = 70 { kCheckInProtocolSupport = 0x1; kUserActiveModeTrigger = 0x2; kLongIdleTimeSupport = 0x4; + kDynamicSitLitSupport = 0x8; } bitmap UserActiveModeTriggerBitmap : bitmap32 { @@ -1784,6 +1856,7 @@ cluster IcdManagement = 70 { 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; @@ -2233,7 +2306,7 @@ endpoint 0 { callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 1; - ram attribute clusterRevision default = 2; + ram attribute clusterRevision default = 3; handle command RegisterClient; handle command RegisterClientResponse; diff --git a/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.zap b/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.zap index 4ba684c480c6a5..f63c63c5d33bce 100644 --- a/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.zap +++ b/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.zap @@ -3715,7 +3715,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/smoke-co-alarm-app/telink/README.md b/examples/smoke-co-alarm-app/telink/README.md index 97a00f8d53a8ad..da8a084f4dfa4f 100755 --- a/examples/smoke-co-alarm-app/telink/README.md +++ b/examples/smoke-co-alarm-app/telink/README.md @@ -4,6 +4,17 @@ You can use this example as a reference for creating your own application. ![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) +## Supported devices + +The example supports building and running on the following devices: + +| Board/SoC | Build target | Zephyr Board Info | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| [B91](https://wiki.telink-semi.cn/wiki/Hardware/B91_Generic_Starter_Kit_Hardware_Guide) [TLSR9518ADK80D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series) | `tlsr9518adk80d`, `tlsr9518adk80d-mars`, `tlsr9518adk80d-usb` | [TLSR9518ADK80D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9518adk80d/doc/index.rst) | +| [B92](https://wiki.telink-semi.cn/wiki/Hardware/B92_Generic_Starter_Kit_Hardware_Guide) [TLSR9528A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR952x-Series) | `tlsr9528a`, `tlsr9528a_retention` | [TLSR9528A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9528a/doc/index.rst) | +| [B95](https://wiki.telink-semi.cn/wiki/Hardware/B95_Generic_Starter_Kit_Hardware_Guide) [TLSR9258A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR925x-Series) | `tlsr9258a` | [TLSR9258A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9258a/doc/index.rst) | +| [W91](https://wiki.telink-semi.cn/wiki/Hardware/W91_Generic_Starter_Kit_Hardware_Guide) [TLSR9118BDK40D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR911x-Series) | `tlsr9118bdk40d` | [TLSR9118BDK40D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9118bdk40d/doc/index.rst) | + ## Build and flash 1. Run the Docker container: @@ -12,7 +23,7 @@ You can use this example as a reference for creating your own application. $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}') ``` - Compatible docker image version can be found in next file: + You can find the compatible Docker image version in the file: ```bash $ .github/workflows/examples-telink.yaml @@ -24,8 +35,8 @@ You can use this example as a reference for creating your own application. $ source ./scripts/activate.sh -p all,telink ``` -3. In the example dir run (replace __ with your board name, for - example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`): +3. Build the example (replace __ with your board name, see + [Supported devices](#supported-devices)): ```bash $ west build -b @@ -35,9 +46,12 @@ You can use this example as a reference for creating your own application. MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=4m`: ```bash - $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + $ west build -b -- -DFLASH_SIZE=4m ``` + You can find the target built file called **_zephyr.bin_** under the + **_build/zephyr_** directory. + 4. Flash binary: ``` @@ -56,16 +70,18 @@ To get output from device, connect UART to following pins: | TX | PB2 (pin 16 of J34 connector) | | GND | GND | +Baud rate: 115200 bits/s + ### Buttons The following buttons are available on **tlsr9518adk80d** board: -| Name | Function | Description | -| :------- | :--------------------- | :----------------------------------------------------------------------------------------------------- | -| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and back to uncommissioned state | -| Button 2 | Self test | Start self testing | -| Button 3 | NA | NA | -| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | +| Name | Function | Description | +| :------- | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and return to a decommissioned state (to activate, push the button 3 times) | +| Button 2 | Self test | Start self testing | +| Button 3 | NA | NA | +| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | ### LEDs diff --git a/examples/temperature-measurement-app/telink/README.md b/examples/temperature-measurement-app/telink/README.md index c78bd36ea8e4a6..04668c02cb0fc8 100644 --- a/examples/temperature-measurement-app/telink/README.md +++ b/examples/temperature-measurement-app/telink/README.md @@ -8,6 +8,17 @@ creating your own application. ![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) +## Supported devices + +The example supports building and running on the following devices: + +| Board/SoC | Build target | Zephyr Board Info | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| [B91](https://wiki.telink-semi.cn/wiki/Hardware/B91_Generic_Starter_Kit_Hardware_Guide) [TLSR9518ADK80D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series) | `tlsr9518adk80d`, `tlsr9518adk80d-mars`, `tlsr9518adk80d-usb` | [TLSR9518ADK80D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9518adk80d/doc/index.rst) | +| [B92](https://wiki.telink-semi.cn/wiki/Hardware/B92_Generic_Starter_Kit_Hardware_Guide) [TLSR9528A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR952x-Series) | `tlsr9528a`, `tlsr9528a_retention` | [TLSR9528A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9528a/doc/index.rst) | +| [B95](https://wiki.telink-semi.cn/wiki/Hardware/B95_Generic_Starter_Kit_Hardware_Guide) [TLSR9258A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR925x-Series) | `tlsr9258a` | [TLSR9258A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9258a/doc/index.rst) | +| [W91](https://wiki.telink-semi.cn/wiki/Hardware/W91_Generic_Starter_Kit_Hardware_Guide) [TLSR9118BDK40D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR911x-Series) | `tlsr9118bdk40d` | [TLSR9118BDK40D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9118bdk40d/doc/index.rst) | + ## Build and flash 1. Run the Docker container: @@ -16,7 +27,7 @@ creating your own application. $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}') ``` - Compatible docker image version can be found in next file: + You can find the compatible Docker image version in the file: ```bash $ .github/workflows/examples-telink.yaml @@ -28,8 +39,8 @@ creating your own application. $ source ./scripts/activate.sh -p all,telink ``` -3. In the example dir run (replace __ with your board name, for - example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`): +3. Build the example (replace __ with your board name, see + [Supported devices](#supported-devices)): ```bash $ west build -b @@ -39,9 +50,12 @@ creating your own application. MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=4m`: ```bash - $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + $ west build -b -- -DFLASH_SIZE=4m ``` + You can find the target built file called **_zephyr.bin_** under the + **_build/zephyr_** directory. + 4. Flash binary: ``` @@ -60,16 +74,18 @@ To get output from device, connect UART to following pins: | TX | PB2 (pin 16 of J34 connector) | | GND | GND | +Baud rate: 115200 bits/s + ### Buttons The following buttons are available on **tlsr9518adk80d** board: -| Name | Function | Description | -| :------- | :--------------------- | :----------------------------------------------------------------------------------------------------- | -| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and back to uncommissioned state | -| Button 2 | NA | NA | -| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | -| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | +| Name | Function | Description | +| :------- | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and return to a decommissioned state (to activate, push the button 3 times) | +| Button 2 | NA | NA | +| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | +| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | ### LEDs diff --git a/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter b/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter index 6c95f5022ef2c8..ccf965c8dd2339 100644 --- a/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter +++ b/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** 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; @@ -39,7 +56,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -55,12 +72,42 @@ cluster AccessControl = 31 { 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; @@ -96,17 +143,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -191,7 +262,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/thermostat/infineon/cyw30739/README.md b/examples/thermostat/infineon/cyw30739/README.md index 6d37d24eb920ef..0b94884fe134a4 100644 --- a/examples/thermostat/infineon/cyw30739/README.md +++ b/examples/thermostat/infineon/cyw30739/README.md @@ -12,7 +12,7 @@ An example showing the use of Matter on the Infineon CYW30739 platform. - [Installing ModusToolbox™ Software](#installing-modustoolbox-software) - [ModusToolbox™ tools package](#modustoolbox-tools-package) - [Note for WSL (Windows Subsystem for Linux)](#note-for-wsl-windows-subsystem-for-linux) - - [Checkout Submodules](#checkout-submodules) + - [Checkout Submodules and Bootstrap](#checkout-submodules-and-bootstrap) - [Building](#building) - [Factory Data](#factory-data) - [Commissionable Data](#commissionable-data) @@ -65,7 +65,7 @@ If you are using WSL, please ensure you have installed the ModusToolbox™ Software for Linux. Running Windows tools directly from the WSL command line would cause path resolution failure in the build process. -### Checkout Submodules +### Checkout Submodules and Bootstrap Before building the example, check out the Matter repository and sync submodules using the following command: @@ -73,6 +73,7 @@ using the following command: ```bash $ cd ~/connectedhomeip $ scripts/checkout_submodules.py --platform infineon +$ bash scripts/bootstrap.sh -p all,infineon ``` ## Building diff --git a/examples/thermostat/linux/BUILD.gn b/examples/thermostat/linux/BUILD.gn index 89d24bff8a0835..71c0eccfcfae50 100644 --- a/examples/thermostat/linux/BUILD.gn +++ b/examples/thermostat/linux/BUILD.gn @@ -20,6 +20,8 @@ executable("thermostat-app") { "include/low-power/LowPowerManager.cpp", "include/low-power/LowPowerManager.h", "main.cpp", + "thermostat-delegate-impl.cpp", + "thermostat-manager.cpp", ] deps = [ @@ -28,6 +30,8 @@ executable("thermostat-app") { "${chip_root}/src/lib", ] + include_dirs = [ "include" ] + cflags = [ "-Wconversion" ] output_dir = root_out_dir diff --git a/examples/thermostat/linux/include/thermostat-delegate-impl.h b/examples/thermostat/linux/include/thermostat-delegate-impl.h new file mode 100644 index 00000000000000..c4daef5fde1d6a --- /dev/null +++ b/examples/thermostat/linux/include/thermostat-delegate-impl.h @@ -0,0 +1,100 @@ +/* + * + * 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 chip { +namespace app { +namespace Clusters { +namespace Thermostat { + +/** + * The ThermostatDelegate class serves as the instance delegate for storing Presets related information and providing it to the + * Thermostat server code. It also manages the presets attribute and provides methods to write to presets, edit presets, maintain a + * pending presets list and either commit the presets when requested or discard the changes. It also provides APIs to get and set + * the attribute values. + * + */ + +static constexpr uint8_t kMaxNumberOfPresetTypes = 6; + +// TODO: #34556 Support multiple presets of each type. +// We will support only one preset of each preset type. +static constexpr uint8_t kMaxNumberOfPresetsOfEachType = 1; + +class ThermostatDelegate : public Delegate +{ +public: + static inline ThermostatDelegate & GetInstance() { return sInstance; } + + CHIP_ERROR GetPresetTypeAtIndex(size_t index, Structs::PresetTypeStruct::Type & presetType) override; + + uint8_t GetNumberOfPresets() override; + + CHIP_ERROR GetPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) override; + + CHIP_ERROR GetActivePresetHandle(MutableByteSpan & activePresetHandle) override; + + CHIP_ERROR SetActivePresetHandle(const DataModel::Nullable & newActivePresetHandle) override; + + CHIP_ERROR AppendToPendingPresetList(const Structs::PresetStruct::Type & preset) override; + + CHIP_ERROR GetPendingPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) override; + + CHIP_ERROR ApplyPendingPresets() override; + + void ClearPendingPresetList() override; + +private: + static ThermostatDelegate sInstance; + + ThermostatDelegate(); + ~ThermostatDelegate() = default; + + ThermostatDelegate(const ThermostatDelegate &) = delete; + ThermostatDelegate & operator=(const ThermostatDelegate &) = delete; + + /** + * @brief Initializes the preset types array with all preset types corresponding to PresetScenarioEnum. + */ + void InitializePresetTypes(); + + /** + * @brief Initializes the presets array with some sample presets for testing. + */ + void InitializePresets(); + + uint8_t mNumberOfPresets; + + Structs::PresetTypeStruct::Type mPresetTypes[kMaxNumberOfPresetTypes]; + PresetStructWithOwnedMembers mPresets[kMaxNumberOfPresetTypes * kMaxNumberOfPresetsOfEachType]; + PresetStructWithOwnedMembers mPendingPresets[kMaxNumberOfPresetTypes * kMaxNumberOfPresetsOfEachType]; + + uint8_t mNextFreeIndexInPendingPresetsList; + uint8_t mNextFreeIndexInPresetsList; + + uint8_t mActivePresetHandleData[kPresetHandleSize]; + size_t mActivePresetHandleDataSize; +}; + +} // namespace Thermostat +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/thermostat/linux/include/thermostat-manager.h b/examples/thermostat/linux/include/thermostat-manager.h new file mode 100644 index 00000000000000..274f66c66917cf --- /dev/null +++ b/examples/thermostat/linux/include/thermostat-manager.h @@ -0,0 +1,73 @@ +/* + * + * 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 + +class ThermostatManager +{ +public: + CHIP_ERROR Init(); + + /// @brief Callback called when any attribute changed on the device + void AttributeChangeHandler(chip::EndpointId endpointId, chip::ClusterId clusterId, chip::AttributeId attributeId, + uint8_t * value, uint16_t size); + + chip::app::Clusters::Thermostat::SystemModeEnum GetSystemMode(); + chip::app::Clusters::Thermostat::ThermostatRunningModeEnum GetRunningMode(); + int16_t GetCurrentTemperature(); + int16_t GetCurrentHeatingSetPoint(); + int16_t GetCurrentCoolingSetPoint(); + uint8_t GetNumberOfPresets(); + CHIP_ERROR SetSystemMode(chip::app::Clusters::Thermostat::SystemModeEnum systemMode); + CHIP_ERROR SetRunningMode(chip::app::Clusters::Thermostat::ThermostatRunningModeEnum runningMode); + CHIP_ERROR SetCurrentTemperature(int16_t temperature); + CHIP_ERROR SetCurrentHeatingSetPoint(int16_t heatingSetpoint); + CHIP_ERROR SetCurrentCoolingSetPoint(int16_t coolingSetpoint); + +private: + friend ThermostatManager & ThermostatMgr(); + + chip::app::Clusters::Thermostat::SystemModeEnum mSystemMode; + chip::app::Clusters::Thermostat::ThermostatRunningModeEnum mRunningMode; + int16_t mLocalTemperature; + int16_t mOccupiedCoolingSetpoint; + int16_t mOccupiedHeatingSetpoint; + uint8_t mOccupiedSetback; + + static ThermostatManager sThermostatMgr; + + /// @brief attribute handler for the thermostat endpoint + void ThermostatEndpointAttributeChangeHandler(chip::ClusterId clusterId, chip::AttributeId attributeId, uint8_t * value, + uint16_t size); + void ThermostatClusterAttributeChangeHandler(chip::AttributeId attributeId, uint8_t * value, uint16_t size); + void LocalTemperatureMeasurementEndpointAttributeChangeHandler(chip::ClusterId clusterId, chip::AttributeId attributeId, + uint8_t * value, uint16_t size); + void LocalTemperatureMeasurementClusterAttributeChangeHandler(chip::AttributeId attributeId, uint8_t * value, uint16_t size); + + /// @brief Main method that evaluates the current thermostat state and updates attributes + void EvalThermostatState(); + void UpdateRunningModeForHeating(); + void UpdateRunningModeForCooling(); +}; + +inline ThermostatManager & ThermostatMgr() +{ + return ThermostatManager::sThermostatMgr; +} diff --git a/examples/thermostat/linux/main.cpp b/examples/thermostat/linux/main.cpp index b9f82696e8ce79..2279f02bef3963 100644 --- a/examples/thermostat/linux/main.cpp +++ b/examples/thermostat/linux/main.cpp @@ -22,6 +22,8 @@ #include #include +#include "thermostat-manager.h" + using namespace chip; using namespace chip::app; // using namespace chip::app::Clusters; @@ -74,7 +76,19 @@ void ApplicationShutdown() {} int main(int argc, char * argv[]) { - VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0); + if (ChipLinuxAppInit(argc, argv) != 0) + { + return -1; + } + ChipLogProgress(Zcl, "Starting Thermostat Manager"); + CHIP_ERROR err = ThermostatManager().Init(); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Failed to initialize thermostat manager: %" CHIP_ERROR_FORMAT, err.Format()); + chip::DeviceLayer::PlatformMgr().Shutdown(); + return -1; + } ChipLinuxAppMainLoop(); return 0; } diff --git a/examples/thermostat/linux/thermostat-delegate-impl.cpp b/examples/thermostat/linux/thermostat-delegate-impl.cpp new file mode 100644 index 00000000000000..491e44a311c3e8 --- /dev/null +++ b/examples/thermostat/linux/thermostat-delegate-impl.cpp @@ -0,0 +1,234 @@ +/* + * + * 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/thermostat-delegate-impl.h" + +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters::Thermostat; +using namespace chip::app::Clusters::Thermostat::Structs; + +ThermostatDelegate ThermostatDelegate::sInstance; + +namespace { + +/** + * @brief Checks if the presets are matching i.e the presetHandles are the same. + * + * @param[in] preset The preset to check. + * @param[in] presetToMatch The preset to match with. + * + * @return true If the presets match, false otherwise. If both preset handles are null, returns false + */ +bool PresetHandlesExistAndMatch(const PresetStructWithOwnedMembers & preset, const PresetStructWithOwnedMembers & presetToMatch) +{ + return !preset.GetPresetHandle().IsNull() && !presetToMatch.GetPresetHandle().IsNull() && + preset.GetPresetHandle().Value().data_equal(presetToMatch.GetPresetHandle().Value()); +} + +} // anonymous namespace + +ThermostatDelegate::ThermostatDelegate() +{ + mNumberOfPresets = kMaxNumberOfPresetTypes * kMaxNumberOfPresetsOfEachType; + mNextFreeIndexInPresetsList = 0; + mNextFreeIndexInPendingPresetsList = 0; + + InitializePresetTypes(); + InitializePresets(); + + memset(mActivePresetHandleData, 0, sizeof(mActivePresetHandleData)); + mActivePresetHandleDataSize = 0; +} + +void ThermostatDelegate::InitializePresetTypes() +{ + PresetScenarioEnum presetScenarioEnumArray[kMaxNumberOfPresetTypes] = { + PresetScenarioEnum::kOccupied, PresetScenarioEnum::kUnoccupied, PresetScenarioEnum::kSleep, + PresetScenarioEnum::kWake, PresetScenarioEnum::kVacation, PresetScenarioEnum::kGoingToSleep + }; + static_assert(ArraySize(presetScenarioEnumArray) <= ArraySize(mPresetTypes)); + + uint8_t index = 0; + for (PresetScenarioEnum presetScenario : presetScenarioEnumArray) + { + mPresetTypes[index].presetScenario = presetScenario; + mPresetTypes[index].numberOfPresets = kMaxNumberOfPresetsOfEachType; + mPresetTypes[index].presetTypeFeatures = + (presetScenario == PresetScenarioEnum::kOccupied || presetScenario == PresetScenarioEnum::kUnoccupied) + ? PresetTypeFeaturesBitmap::kAutomatic + : PresetTypeFeaturesBitmap::kSupportsNames; + index++; + } +} + +void ThermostatDelegate::InitializePresets() +{ + // Initialize the presets with 2 built in presets - occupied and unoccupied. + PresetScenarioEnum presetScenarioEnumArray[2] = { PresetScenarioEnum::kOccupied, PresetScenarioEnum::kUnoccupied }; + static_assert(ArraySize(presetScenarioEnumArray) <= ArraySize(mPresets)); + + uint8_t index = 0; + for (PresetScenarioEnum presetScenario : presetScenarioEnumArray) + { + mPresets[index].SetPresetScenario(presetScenario); + + // Set the preset handle to the preset scenario value as a unique id. + const uint8_t handle[] = { static_cast(presetScenario) }; + mPresets[index].SetPresetHandle(DataModel::MakeNullable(ByteSpan(handle))); + mPresets[index].SetName(NullOptional); + int16_t coolingSetpointValue = static_cast(2500 + (index * 100)); + mPresets[index].SetCoolingSetpoint(MakeOptional(coolingSetpointValue)); + + int16_t heatingSetpointValue = static_cast(2100 - (index * 100)); + mPresets[index].SetHeatingSetpoint(MakeOptional(heatingSetpointValue)); + mPresets[index].SetBuiltIn(DataModel::MakeNullable(true)); + index++; + } + + // Set the value of the next free index in the presets list. + mNextFreeIndexInPresetsList = index; +} + +CHIP_ERROR ThermostatDelegate::GetPresetTypeAtIndex(size_t index, PresetTypeStruct::Type & presetType) +{ + if (index < ArraySize(mPresetTypes)) + { + presetType = mPresetTypes[index]; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +uint8_t ThermostatDelegate::GetNumberOfPresets() +{ + return mNumberOfPresets; +} + +CHIP_ERROR ThermostatDelegate::GetPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) +{ + if (index < mNextFreeIndexInPresetsList) + { + preset = mPresets[index]; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR ThermostatDelegate::GetActivePresetHandle(MutableByteSpan & activePresetHandle) +{ + return CopySpanToMutableSpan(ByteSpan(mActivePresetHandleData, mActivePresetHandleDataSize), activePresetHandle); +} + +CHIP_ERROR ThermostatDelegate::SetActivePresetHandle(const DataModel::Nullable & newActivePresetHandle) +{ + if (!newActivePresetHandle.IsNull()) + { + size_t newActivePresetHandleSize = newActivePresetHandle.Value().size(); + if (newActivePresetHandleSize > sizeof(mActivePresetHandleData)) + { + ChipLogError(NotSpecified, + "Failed to set ActivePresetHandle. newActivePresetHandle size %u is larger than preset handle size %u", + static_cast(newActivePresetHandleSize), static_cast(kPresetHandleSize)); + return CHIP_ERROR_NO_MEMORY; + } + memcpy(mActivePresetHandleData, newActivePresetHandle.Value().data(), newActivePresetHandleSize); + mActivePresetHandleDataSize = newActivePresetHandleSize; + ChipLogDetail(NotSpecified, "Set ActivePresetHandle to "); + ChipLogByteSpan(NotSpecified, newActivePresetHandle.Value()); + } + else + { + memset(mActivePresetHandleData, 0, sizeof(mActivePresetHandleData)); + mActivePresetHandleDataSize = 0; + ChipLogDetail(NotSpecified, "Clear ActivePresetHandle"); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ThermostatDelegate::AppendToPendingPresetList(const PresetStruct::Type & preset) +{ + if (mNextFreeIndexInPendingPresetsList < ArraySize(mPendingPresets)) + { + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetPresetScenario(preset.presetScenario); + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetPresetHandle(preset.presetHandle); + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetName(preset.name); + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetCoolingSetpoint(preset.coolingSetpoint); + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetHeatingSetpoint(preset.heatingSetpoint); + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetBuiltIn(preset.builtIn); + mNextFreeIndexInPendingPresetsList++; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_WRITE_FAILED; +} + +CHIP_ERROR ThermostatDelegate::GetPendingPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) +{ + if (index < mNextFreeIndexInPendingPresetsList) + { + preset = mPendingPresets[index]; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR ThermostatDelegate::ApplyPendingPresets() +{ + + // TODO: #34546 - Need to support deletion of presets that are removed from Presets. + for (uint8_t indexInPendingPresets = 0; indexInPendingPresets < mNextFreeIndexInPendingPresetsList; indexInPendingPresets++) + { + const PresetStructWithOwnedMembers & pendingPreset = mPendingPresets[indexInPendingPresets]; + + bool found = false; + for (uint8_t indexInPresets = 0; indexInPresets < mNextFreeIndexInPresetsList; indexInPresets++) + { + if (PresetHandlesExistAndMatch(mPresets[indexInPresets], pendingPreset)) + { + found = true; + + // Replace the preset with the pending preset + mPresets[indexInPresets] = pendingPreset; + } + } + + // If pending preset was not found in the Presets list, append to the Presets list. + if (!found) + { + + mPresets[mNextFreeIndexInPresetsList] = pendingPreset; + + // TODO: #34556 Since we support only one preset of each type, using the octet string containing the preset scenario + // suffices as the unique preset handle. Need to fix this to actually provide unique handles once multiple presets of + // each type are supported. + const uint8_t handle[] = { static_cast(pendingPreset.GetPresetScenario()) }; + mPresets[mNextFreeIndexInPresetsList].SetPresetHandle(DataModel::MakeNullable(ByteSpan(handle))); + mNextFreeIndexInPresetsList++; + } + } + return CHIP_NO_ERROR; +} + +void ThermostatDelegate::ClearPendingPresetList() +{ + mNextFreeIndexInPendingPresetsList = 0; +} diff --git a/examples/thermostat/linux/thermostat-manager.cpp b/examples/thermostat/linux/thermostat-manager.cpp new file mode 100644 index 00000000000000..e96f04a78d49e9 --- /dev/null +++ b/examples/thermostat/linux/thermostat-manager.cpp @@ -0,0 +1,515 @@ +/* + * + * 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. + */ + +/********************************************************** + * Includes + *********************************************************/ + +#include "include/thermostat-manager.h" +#include "include/thermostat-delegate-impl.h" + +#include +#include +#include +#include + +/********************************************************** + * Defines and Constants + *********************************************************/ + +using namespace chip; +using namespace chip::app; +using namespace chip::app::DataModel; +using namespace chip::Controller; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::Thermostat; +using namespace chip::app::Clusters::Thermostat::Structs; +using namespace chip::app::Clusters::Thermostat::Attributes; +using namespace chip::app::Clusters::TemperatureMeasurement; +using namespace chip::app::Clusters::TemperatureMeasurement::Attributes; +using namespace Protocols::InteractionModel; + +using namespace chip::DeviceLayer; + +static constexpr EndpointId kThermostatEndpoint = 1; + +static constexpr uint16_t kMaxIntervalCeilingSeconds = 3600; + +static const char * SystemModeString(SystemModeEnum systemMode); +static const char * RunningModeString(ThermostatRunningModeEnum runningMode); + +/********************************************************** + * Variable declarations + *********************************************************/ + +ThermostatManager ThermostatManager::sThermostatMgr; + +namespace { + +CHIP_ERROR ChipErrorFromStatusCode(Status status) +{ + StatusIB statusIB(status); + return statusIB.ToChipError(); +} + +template +static void OnAttributeChangeReported(const ConcreteDataAttributePath & path, const DecodableAttributeType & value); + +template <> +void OnAttributeChangeReported(const ConcreteDataAttributePath & path, + const MeasuredValue::TypeInfo::DecodableType & value) +{ + ClusterId clusterId = path.mClusterId; + if (clusterId != TemperatureMeasurement::Id) + { + ChipLogError(AppServer, + "Attribute change reported for TemperatureMeasurement cluster on incorrect cluster id " ChipLogFormatMEI, + ChipLogValueMEI(clusterId)); + return; + } + + AttributeId attributeId = path.mAttributeId; + if (attributeId != MeasuredValue::Id) + { + ChipLogError(AppServer, + "Attribute change reported for TemperatureMeasurement cluster for incorrect attribute" ChipLogFormatMEI, + ChipLogValueMEI(attributeId)); + return; + } + + if (!value.IsNull()) + { + ChipLogDetail(AppServer, "Attribute change reported for TemperatureMeasurement cluster - MeasuredValue is %d", + value.Value()); + } +} + +static void OnError(const ConcreteDataAttributePath * path, ChipError err) +{ + ChipLogError(AppServer, + "Subscribing to cluster Id " ChipLogFormatMEI " and attribute Id " ChipLogFormatMEI + " failed with error %" CHIP_ERROR_FORMAT, + ChipLogValueMEI(path->mClusterId), ChipLogValueMEI(path->mAttributeId), err.Format()); +} + +static void OnSubscriptionEstablished(const ReadClient & client, unsigned int value) +{ + ChipLogDetail(AppServer, "OnSubscriptionEstablished with subscription Id: %d", value); +} + +template +void SubscribeToAttribute(ClusterId clusterId, AttributeId attributeId, const EmberBindingTableEntry & binding, + OperationalDeviceProxy * peer_device) +{ + VerifyOrReturn(peer_device->GetSecureSession().HasValue(), + ChipLogError(AppServer, "SubscribeToAttribute failed. Secure session is null")); + + SubscribeAttribute( + peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, clusterId, attributeId, + &OnAttributeChangeReported, &OnError, 0, kMaxIntervalCeilingSeconds, &OnSubscriptionEstablished, + nullptr, true /* fabricFiltered */, false /* keepExistingSubscription */); +} + +static void ThermostatBoundDeviceChangedHandler(const EmberBindingTableEntry & binding, OperationalDeviceProxy * peer_device, + void * context) +{ + VerifyOrReturn(binding.clusterId.has_value(), ChipLogError(AppServer, "Cluster Id is null")); + ClusterId clusterId = binding.clusterId.value(); + + switch (clusterId) + { + case TemperatureMeasurement::Id: + + // Subscribe to the MeasuredValue attribute + SubscribeToAttribute(clusterId, MeasuredValue::Id, binding, peer_device); + break; + default: + ChipLogError(AppServer, "Unsupported Cluster Id"); + break; + } +} + +void NotifyBoundClusterChangedForAllClusters() +{ + BindingManager::GetInstance().NotifyBoundClusterChanged(kThermostatEndpoint, TemperatureMeasurement::Id, nullptr); +} + +static void OnPlatformChipDeviceEvent(const DeviceLayer::ChipDeviceEvent * event, intptr_t arg) +{ + if (event->Type == DeviceLayer::DeviceEventType::kBindingsChangedViaCluster) + { + NotifyBoundClusterChangedForAllClusters(); + } +} + +void InitBindingManager(intptr_t context) +{ + auto & server = Server::GetInstance(); + CHIP_ERROR error = BindingManager::GetInstance().Init( + { &server.GetFabricTable(), server.GetCASESessionManager(), &server.GetPersistentStorage() }); + + if (error != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Failed to init binding manager"); + } + + BindingManager::GetInstance().RegisterBoundDeviceChangedHandler(ThermostatBoundDeviceChangedHandler); + NotifyBoundClusterChangedForAllClusters(); +} + +} // anonymous namespace + +CHIP_ERROR ThermostatManager::Init() +{ + // Init binding manager + + DeviceLayer::PlatformMgr().AddEventHandler(OnPlatformChipDeviceEvent, reinterpret_cast(this)); + DeviceLayer::PlatformMgr().ScheduleWork(InitBindingManager); + + mLocalTemperature = GetCurrentTemperature(); + mSystemMode = GetSystemMode(); + mRunningMode = GetRunningMode(); + mOccupiedCoolingSetpoint = GetCurrentCoolingSetPoint(); + mOccupiedHeatingSetpoint = GetCurrentHeatingSetPoint(); + // TODO: Gotta expose this properly on attribute + mOccupiedSetback = 5; // 0.5 C + + ChipLogError(AppServer, + "Initialized a thermostat with \n " + "mSystemMode: %u (%s) \n mRunningMode: %u (%s) \n mLocalTemperature: %d \n mOccupiedHeatingSetpoint: %d \n " + "mOccupiedCoolingSetpoint: %d" + "NumberOfPresets: %d", + to_underlying(mSystemMode), SystemModeString(mSystemMode), to_underlying(mRunningMode), + RunningModeString(mRunningMode), mLocalTemperature, mOccupiedHeatingSetpoint, mOccupiedCoolingSetpoint, + GetNumberOfPresets()); + + // TODO: Should this be called later? + EvalThermostatState(); + + return CHIP_NO_ERROR; +} + +void ThermostatManager::AttributeChangeHandler(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t * value, + uint16_t size) +{ + switch (endpointId) + { + case kThermostatEndpoint: + ThermostatEndpointAttributeChangeHandler(clusterId, attributeId, value, size); + break; + + default: + ChipLogError(AppServer, "Attribute change reported for Thermostat on incorrect endpoint. Ignoring."); + break; + } +} + +void ThermostatManager::ThermostatEndpointAttributeChangeHandler(ClusterId clusterId, AttributeId attributeId, uint8_t * value, + uint16_t size) +{ + switch (clusterId) + { + case Thermostat::Id: + ThermostatClusterAttributeChangeHandler(attributeId, value, size); + break; + + default: + ChipLogError(AppServer, + "Attribute change reported for Thermostat on incorrect cluster for the thermostat endpoint. Ignoring."); + break; + } +} + +void ThermostatManager::ThermostatClusterAttributeChangeHandler(AttributeId attributeId, uint8_t * value, uint16_t size) +{ + switch (attributeId) + { + case LocalTemperature::Id: { + memcpy(&mLocalTemperature, value, size); + ChipLogError(AppServer, "Local temperature changed to %d", mLocalTemperature); + EvalThermostatState(); + } + break; + + case OccupiedCoolingSetpoint::Id: { + memcpy(&mOccupiedCoolingSetpoint, value, size); + ChipLogError(AppServer, "Cooling temperature changed to %d", mOccupiedCoolingSetpoint); + EvalThermostatState(); + } + break; + + case OccupiedHeatingSetpoint::Id: { + memcpy(&mOccupiedHeatingSetpoint, value, size); + ChipLogError(AppServer, "Heating temperature changed to %d", mOccupiedHeatingSetpoint); + EvalThermostatState(); + } + break; + + case SystemMode::Id: { + mSystemMode = static_cast(*value); + ChipLogError(AppServer, "System mode changed to %u (%s)", *value, SystemModeString(mSystemMode)); + EvalThermostatState(); + } + break; + + case ThermostatRunningMode::Id: { + mRunningMode = static_cast(*value); + ChipLogError(AppServer, "Running mode changed to %u (%s)", *value, RunningModeString(mRunningMode)); + } + break; + + default: { + ChipLogError(AppServer, "Unhandled thermostat attribute %x", attributeId); + return; + } + break; + } +} + +SystemModeEnum ThermostatManager::GetSystemMode() +{ + SystemModeEnum systemMode; + SystemMode::Get(kThermostatEndpoint, &systemMode); + return systemMode; +} + +ThermostatRunningModeEnum ThermostatManager::GetRunningMode() +{ + ThermostatRunningModeEnum runningMode; + ThermostatRunningMode::Get(kThermostatEndpoint, &runningMode); + return runningMode; +} + +int16_t ThermostatManager::GetCurrentTemperature() +{ + DataModel::Nullable currentTemperature; + currentTemperature.SetNull(); + LocalTemperature::Get(kThermostatEndpoint, currentTemperature); + return currentTemperature.ValueOr(0); +} + +int16_t ThermostatManager::GetCurrentHeatingSetPoint() +{ + int16_t heatingSetpoint; + OccupiedHeatingSetpoint::Get(kThermostatEndpoint, &heatingSetpoint); + return heatingSetpoint; +} + +int16_t ThermostatManager::GetCurrentCoolingSetPoint() +{ + int16_t coolingSetpoint; + OccupiedCoolingSetpoint::Get(kThermostatEndpoint, &coolingSetpoint); + return coolingSetpoint; +} + +uint8_t ThermostatManager::GetNumberOfPresets() +{ + return ThermostatDelegate::GetInstance().GetNumberOfPresets(); +} + +CHIP_ERROR ThermostatManager::SetSystemMode(SystemModeEnum systemMode) +{ + uint8_t systemModeValue = to_underlying(systemMode); + if (mSystemMode == systemMode) + { + ChipLogDetail(AppServer, "Already in system mode: %u (%s)", systemModeValue, SystemModeString(systemMode)); + return CHIP_NO_ERROR; + } + + ChipLogError(AppServer, "Setting system mode: %u (%s)", systemModeValue, SystemModeString(systemMode)); + return ChipErrorFromStatusCode(SystemMode::Set(kThermostatEndpoint, systemMode)); +} + +CHIP_ERROR ThermostatManager::SetRunningMode(ThermostatRunningModeEnum runningMode) +{ + uint8_t runningModeValue = to_underlying(runningMode); + if (mRunningMode == runningMode) + { + ChipLogDetail(AppServer, "Already in running mode: %u (%s)", runningModeValue, RunningModeString(runningMode)); + return CHIP_NO_ERROR; + } + + ChipLogError(AppServer, "Setting running mode: %u (%s)", runningModeValue, RunningModeString(runningMode)); + return ChipErrorFromStatusCode(ThermostatRunningMode::Set(kThermostatEndpoint, runningMode)); +} + +CHIP_ERROR ThermostatManager::SetCurrentTemperature(int16_t temperature) +{ + return ChipErrorFromStatusCode(LocalTemperature::Set(kThermostatEndpoint, temperature)); +} + +CHIP_ERROR ThermostatManager::SetCurrentHeatingSetPoint(int16_t heatingSetpoint) +{ + return ChipErrorFromStatusCode(OccupiedHeatingSetpoint::Set(kThermostatEndpoint, heatingSetpoint)); +} + +CHIP_ERROR ThermostatManager::SetCurrentCoolingSetPoint(int16_t coolingSetpoint) +{ + return ChipErrorFromStatusCode(OccupiedCoolingSetpoint::Set(kThermostatEndpoint, coolingSetpoint)); +} + +void ThermostatManager::EvalThermostatState() +{ + ChipLogError(AppServer, + "Eval Thermostat Running Mode \n " + "mSystemMode: %u (%s) \n mRunningMode: %u (%s) \n mLocalTemperature: %d \n mOccupiedHeatingSetpoint: %d \n " + "mOccupiedCoolingSetpoint: %d", + to_underlying(mSystemMode), SystemModeString(mSystemMode), to_underlying(mRunningMode), + RunningModeString(mRunningMode), mLocalTemperature, mOccupiedHeatingSetpoint, mOccupiedCoolingSetpoint); + + switch (mSystemMode) + { + case SystemModeEnum::kOff: { + SetRunningMode(ThermostatRunningModeEnum::kOff); + break; + } + case SystemModeEnum::kHeat: { + UpdateRunningModeForHeating(); + break; + } + case SystemModeEnum::kCool: { + UpdateRunningModeForCooling(); + break; + } + case SystemModeEnum::kAuto: { + UpdateRunningModeForHeating(); + UpdateRunningModeForCooling(); + break; + } + default: + break; + } +} + +void ThermostatManager::UpdateRunningModeForHeating() +{ + const int16_t heatingOnThreshold = mOccupiedHeatingSetpoint - static_cast(mOccupiedSetback * 10); + const int16_t heatingOffThreshold = mOccupiedHeatingSetpoint + static_cast(mOccupiedSetback * 10); + + if (mRunningMode == ThermostatRunningModeEnum::kHeat) + { + if (mLocalTemperature >= heatingOffThreshold) + { + ChipLogDetail(AppServer, "Eval Heat - Turning off"); + SetRunningMode(ThermostatRunningModeEnum::kOff); + } + else + { + ChipLogDetail(AppServer, "Eval Heat - Keep Heating"); + } + } + else + { + if (mLocalTemperature <= heatingOnThreshold) + { + ChipLogDetail(AppServer, "Eval Heat - Turn on"); + SetRunningMode(ThermostatRunningModeEnum::kHeat); + } + else + { + ChipLogDetail(AppServer, "Eval Heat - Nothing to do"); + } + } +} + +void ThermostatManager::UpdateRunningModeForCooling() +{ + const int16_t coolingOffThreshold = mOccupiedCoolingSetpoint - static_cast(mOccupiedSetback * 10); + const int16_t coolingOnThreshold = mOccupiedCoolingSetpoint + static_cast(mOccupiedSetback * 10); + + if (mRunningMode == ThermostatRunningModeEnum::kCool) + { + if (mLocalTemperature <= coolingOffThreshold) + { + ChipLogDetail(AppServer, "Eval Cool - Turning off"); + SetRunningMode(ThermostatRunningModeEnum::kOff); + } + else + { + ChipLogDetail(AppServer, "Eval Cool - Keep Cooling"); + } + } + else + { + if (mLocalTemperature >= coolingOnThreshold) + { + ChipLogDetail(AppServer, "Eval Cool - Turn on"); + SetRunningMode(ThermostatRunningModeEnum::kCool); + } + else + { + ChipLogDetail(AppServer, "Eval Cool - Nothing to do"); + } + } +} + +static const char * SystemModeString(SystemModeEnum systemMode) +{ + switch (systemMode) + { + case SystemModeEnum::kOff: + return "Off"; + case SystemModeEnum::kAuto: + return "Auto"; + case SystemModeEnum::kCool: + return "Cool"; + case SystemModeEnum::kHeat: + return "Heat"; + default: + return "Unknown"; + } +} + +static const char * RunningModeString(ThermostatRunningModeEnum runningMode) +{ + switch (runningMode) + { + case ThermostatRunningModeEnum::kOff: + return "Off"; + case ThermostatRunningModeEnum::kCool: + return "Cool"; + case ThermostatRunningModeEnum::kHeat: + return "Heat"; + default: + return "Unknown"; + } +} + +void MatterPostAttributeChangeCallback(const ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, uint8_t * value) +{ + ClusterId clusterId = attributePath.mClusterId; + AttributeId attributeId = attributePath.mAttributeId; + ChipLogProgress(AppServer, "Cluster callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); + + ChipLogProgress(AppServer, + "Attribute ID changed: " ChipLogFormatMEI " Endpoint: %d ClusterId: " ChipLogFormatMEI + " Type: %u Value: %u, length %u", + ChipLogValueMEI(attributeId), attributePath.mEndpointId, ChipLogValueMEI(clusterId), type, *value, size); + + ThermostatMgr().AttributeChangeHandler(attributePath.mEndpointId, clusterId, attributeId, value, size); +} + +void emberAfThermostatClusterInitCallback(EndpointId endpoint) +{ + // Register the delegate for the Thermostat + auto & delegate = ThermostatDelegate::GetInstance(); + + // Set the default delegate for endpoint kThermostatEndpoint. + VerifyOrDie(endpoint == kThermostatEndpoint); + SetDefaultDelegate(endpoint, &delegate); +} diff --git a/examples/thermostat/nxp/rt/rw61x/BUILD.gn b/examples/thermostat/nxp/rt/rw61x/BUILD.gn index 3b7b8d181e3939..409fa9efbbce0a 100644 --- a/examples/thermostat/nxp/rt/rw61x/BUILD.gn +++ b/examples/thermostat/nxp/rt/rw61x/BUILD.gn @@ -49,7 +49,8 @@ declare_args() { setup_discriminator = 3840 } -example_platform_dir = "${chip_root}/examples/platform/nxp/${nxp_platform}" +example_platform_dir = + "${nxp_sdk_matter_support_root}/examples/platform/${nxp_platform}" common_example_dir = "${chip_root}/examples/platform/nxp/common" if (tcp_download == true && wifi_connect == true) { diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter index 0d702b5e3e291d..3cf062b03c6d2e 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -237,7 +254,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -253,12 +270,42 @@ cluster AccessControl = 31 { 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; @@ -294,17 +341,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -389,7 +460,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1753,14 +1824,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + 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; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -1872,7 +1950,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** 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; @@ -1944,7 +2022,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -2011,7 +2090,6 @@ cluster Thermostat = 513 { kMatterScheduleConfiguration = 0x80; kPresets = 0x100; kSetpoints = 0x200; - kQueuedPresetsSupported = 0x400; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -2071,11 +2149,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -2109,11 +2182,6 @@ cluster Thermostat = 513 { PresetTypeFeaturesBitmap presetTypeFeatures = 2; } - struct QueuedPresetStruct { - nullable octet_string<16> presetHandle = 0; - nullable epoch_s transitionTimestamp = 1; - } - struct ScheduleTypeStruct { SystemModeEnum systemMode = 0; int8u numberOfSchedules = 1; @@ -2186,9 +2254,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; - readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -2226,17 +2292,12 @@ cluster Thermostat = 513 { request struct SetActivePresetRequestRequest { octet_string<16> presetHandle = 0; - optional int16u delayMinutes = 1; } request struct StartPresetsSchedulesEditRequestRequest { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -2255,10 +2316,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command is sent to cancel a queued preset. */ - command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } endpoint 0 { diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.zap b/examples/thermostat/nxp/zap/thermostat_matter_thread.zap index 489e9e00ab44bf..8824bce22564b9 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.zap +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.zap @@ -17,13 +17,6 @@ } ], "package": [ - { - "pathRelativity": "relativeToZap", - "path": "../../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", - "category": "matter", - "version": "chip-v1" - }, { "pathRelativity": "relativeToZap", "path": "../../../../src/app/zap-templates/zcl/zcl.json", @@ -31,6 +24,13 @@ "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": [ diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter index 3db5e3fc306e4c..f3065011d62972 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -237,7 +254,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -253,12 +270,42 @@ cluster AccessControl = 31 { 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; @@ -294,17 +341,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -389,7 +460,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1664,14 +1735,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + 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; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -1783,7 +1861,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** 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; @@ -1855,7 +1933,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -1922,7 +2001,6 @@ cluster Thermostat = 513 { kMatterScheduleConfiguration = 0x80; kPresets = 0x100; kSetpoints = 0x200; - kQueuedPresetsSupported = 0x400; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -1982,11 +2060,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -2020,11 +2093,6 @@ cluster Thermostat = 513 { PresetTypeFeaturesBitmap presetTypeFeatures = 2; } - struct QueuedPresetStruct { - nullable octet_string<16> presetHandle = 0; - nullable epoch_s transitionTimestamp = 1; - } - struct ScheduleTypeStruct { SystemModeEnum systemMode = 0; int8u numberOfSchedules = 1; @@ -2097,9 +2165,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; - readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -2137,17 +2203,12 @@ cluster Thermostat = 513 { request struct SetActivePresetRequestRequest { octet_string<16> presetHandle = 0; - optional int16u delayMinutes = 1; } request struct StartPresetsSchedulesEditRequestRequest { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -2166,10 +2227,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command is sent to cancel a queued preset. */ - command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } endpoint 0 { diff --git a/examples/thermostat/nxp/zephyr/.gitignore b/examples/thermostat/nxp/zephyr/.gitignore new file mode 100644 index 00000000000000..84c048a73cc2e5 --- /dev/null +++ b/examples/thermostat/nxp/zephyr/.gitignore @@ -0,0 +1 @@ +/build/ diff --git a/examples/thermostat/nxp/zephyr/CMakeLists.txt b/examples/thermostat/nxp/zephyr/CMakeLists.txt new file mode 100644 index 00000000000000..2b0fb87a55e7f9 --- /dev/null +++ b/examples/thermostat/nxp/zephyr/CMakeLists.txt @@ -0,0 +1,104 @@ +# +# Copyright (c) 2023-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. +# +cmake_minimum_required(VERSION 3.13.1) + +get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) +get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) +get_filename_component(ALL_CLUSTERS_COMMON_DIR ${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common REALPATH) +get_filename_component(THERMOSTAT_NXP_COMMON_DIR ${CHIP_ROOT}/examples/thermostat/nxp/common REALPATH) +get_filename_component(EXAMPLE_PLATFORM_NXP_COMMON_DIR ${CHIP_ROOT}/examples/platform/nxp/common REALPATH) +get_filename_component(EXAMPLE_PLATFORM_NXP_ZEPHYR_DIR ${CHIP_ROOT}/examples/platform/nxp/zephyr REALPATH) + +# Perform common operations like detecting extra overlays in the platform folder for the target board +# This must be called before find_package(Zephyr) +include(${CHIP_ROOT}/config/nxp/app/pre-zephyr.cmake) + +list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nxp/chip-module) +find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) + +# -Wmaybe-uninitialized has too many false positives, including on std::optional +# and chip::Optional. Make it nonfatal. +# +# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635 +target_compile_options(app PRIVATE -Werror -Wno-error=maybe-uninitialized) +target_compile_options(app PRIVATE -Werror PRIVATE -Wno-error=format) + +project(chip-nxp-all-clusters-app-example) + +include(${CHIP_ROOT}/config/nxp/app/enable-gnu-std.cmake) +include(${CHIP_ROOT}/src/app/chip_data_model.cmake) + +target_include_directories(app + PRIVATE + ${THERMOSTAT_NXP_COMMON_DIR}/main/include + ${ALL_CLUSTERS_COMMON_DIR}/include + ${GEN_DIR}/app-common + ${GEN_DIR}/all-clusters-app + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_manager/include + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/icd/include + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_callbacks/include + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/factory_data/include + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/app_task/include +) + +target_sources(app + PRIVATE + main/main.cpp + ${THERMOSTAT_NXP_COMMON_DIR}/main/AppTask.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_manager/source/CHIPDeviceManager.cpp + ${THERMOSTAT_NXP_COMMON_DIR}/main/DeviceCallbacks.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_callbacks/source/CommonDeviceCallbacks.cpp + ${THERMOSTAT_NXP_COMMON_DIR}/main/ZclCallbacks.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/binding-handler.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/app_task/source/AppTaskBase.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/app_task/source/AppTaskZephyr.cpp + ${EXAMPLE_PLATFORM_NXP_ZEPHYR_DIR}/factory_data/source/AppFactoryDataExample.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/icd/source/ICDUtil.cpp +) + +target_compile_definitions(app PUBLIC + "EXTERNAL_FACTORY_DATA_PROVIDER_IMPL_HEADER=\"platform/nxp/zephyr/FactoryDataProviderImpl.h\"" +) + +if(CONFIG_CHIP_OTA_REQUESTOR) + target_sources(app PRIVATE + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/ota_requestor/source/OTARequestorInitiatorCommon.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/ota_requestor/source/OTARequestorInitiatorZephyr.cpp + ) + target_include_directories(app PRIVATE + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/ota_requestor/include/ + ) +endif() + +chip_configure_data_model(app + INCLUDE_SERVER + ZAP_FILE ${ALL_CLUSTERS_COMMON_DIR}/../../thermostat/nxp/zap/thermostat_matter_wifi.zap +) + +if(CONFIG_CHIP_LIB_SHELL) + target_compile_definitions(app PRIVATE ENABLE_CHIP_SHELL) + target_include_directories(app PRIVATE + ${CHIP_ROOT}/examples/shell/shell_common/include + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/matter_cli/include + ) + target_sources(app PRIVATE + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/matter_cli/source/AppCLIBase.cpp + ${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/matter_cli/source/AppCLIZephyr.cpp + ${CHIP_ROOT}/examples/shell/shell_common/cmd_misc.cpp + ${CHIP_ROOT}/examples/shell/shell_common/cmd_otcli.cpp + ${CHIP_ROOT}/examples/shell/shell_common/cmd_server.cpp + ) +endif() diff --git a/examples/thermostat/nxp/zephyr/Kconfig b/examples/thermostat/nxp/zephyr/Kconfig new file mode 100644 index 00000000000000..72e90f047d1e38 --- /dev/null +++ b/examples/thermostat/nxp/zephyr/Kconfig @@ -0,0 +1,20 @@ +# +# 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. +# +mainmenu "Matter NXP Thermostat Example Application" + +rsource "../../../../config/nxp/chip-module/Kconfig.features" +rsource "../../../../config/nxp/chip-module/Kconfig.defaults" +source "Kconfig.zephyr" diff --git a/examples/thermostat/nxp/zephyr/README.md b/examples/thermostat/nxp/zephyr/README.md new file mode 100644 index 00000000000000..84d3fb9e59cf01 --- /dev/null +++ b/examples/thermostat/nxp/zephyr/README.md @@ -0,0 +1,4 @@ +# CHIP NXP Zephyr Thermostat Application + +All instructions describing how to use a Matter application on NXP Zephyr can be +found in [README.md](../../../all-clusters-app/nxp/zephyr/README.md) root readme diff --git a/examples/thermostat/nxp/zephyr/boards/rd_rw612_bga.overlay b/examples/thermostat/nxp/zephyr/boards/rd_rw612_bga.overlay new file mode 100644 index 00000000000000..86bb20739527cd --- /dev/null +++ b/examples/thermostat/nxp/zephyr/boards/rd_rw612_bga.overlay @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023-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. + */ + +/ { + chosen { + zephyr,console = &flexcomm0; + zephyr,shell-uart = &flexcomm3; + }; +}; + +&flexcomm0 { + compatible = "nxp,lpc-usart"; + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&pinmux_flexcomm0_usart>; + pinctrl-names = "default"; +}; + +&flexcomm3 { + compatible = "nxp,lpc-usart"; + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&pinmux_flexcomm3_usart>; + pinctrl-names = "default"; +}; diff --git a/examples/all-clusters-app/nrfconnect/child_image/hci_rpmsg/prj_release.conf b/examples/thermostat/nxp/zephyr/boards/rd_rw612_bga_fdata.conf similarity index 57% rename from examples/all-clusters-app/nrfconnect/child_image/hci_rpmsg/prj_release.conf rename to examples/thermostat/nxp/zephyr/boards/rd_rw612_bga_fdata.conf index 1622ffd00dbb91..73d139c3948d95 100644 --- a/examples/all-clusters-app/nrfconnect/child_image/hci_rpmsg/prj_release.conf +++ b/examples/thermostat/nxp/zephyr/boards/rd_rw612_bga_fdata.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2022 Project CHIP Authors +# Copyright (c) 2023-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. @@ -14,12 +14,10 @@ # limitations under the License. # -# This target uses Kconfig.hci_rpmsg.defaults to set options common for all -# samples using hci_rpmsg. This file should contain only options specific for this sample -# hci_rpmsg configuration or overrides of default values. +CONFIG_SETTINGS_NVS_SECTOR_COUNT=16 -# Disable not used modules that cannot be set in Kconfig.hci_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n +# 0xA226 +CONFIG_CHIP_DEVICE_PRODUCT_ID=41510 +CONFIG_CHIP_DEVICE_PRODUCT_URL="https://www.nxp.com/products/wireless-connectivity/wi-fi-plus-bluetooth-plus-802-15-4/wireless-mcu-with-integrated-tri-radio-1x1-wi-fi-6-plus-bluetooth-low-energy-5-3-802-15-4:RW612" +CONFIG_CHIP_DEVICE_PRODUCT_LABEL="RW612" +CONFIG_CHIP_DEVICE_PART_NUMBER="RW612" diff --git a/examples/thermostat/nxp/zephyr/main/include/CHIPProjectConfig.h b/examples/thermostat/nxp/zephyr/main/include/CHIPProjectConfig.h new file mode 100644 index 00000000000000..84c57df1ea140d --- /dev/null +++ b/examples/thermostat/nxp/zephyr/main/include/CHIPProjectConfig.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2023-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. + */ + +/** + * @file + * Example project configuration file for CHIP. + * + * This is a place to put application or project-specific overrides + * to the default configuration values for general CHIP features. + * + */ + +#pragma once + +// Use a default pairing code if one hasn't been provisioned in flash. +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR CONFIG_CHIP_DEVICE_DISCRIMINATOR + +// All clusters app has 3 group endpoints. This needs to defined here so that +// CHIP_CONFIG_MAX_GROUPS_PER_FABRIC is properly configured. +#define CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC 3 diff --git a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay b/examples/thermostat/nxp/zephyr/main/main.cpp similarity index 54% rename from examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay rename to examples/thermostat/nxp/zephyr/main/main.cpp index 0728eff3db8377..9be47dfe0a95d8 100644 --- a/examples/all-clusters-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay +++ b/examples/thermostat/nxp/zephyr/main/main.cpp @@ -1,5 +1,6 @@ /* - * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2023-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. @@ -14,8 +15,23 @@ * limitations under the License. */ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; +#include "AppTask.h" + +#include + +LOG_MODULE_REGISTER(app, CONFIG_CHIP_APP_LOG_LEVEL); + +using namespace ::chip; + +int main() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + if (err == CHIP_NO_ERROR) + { + err = chip::NXP::App::GetAppTask().Start(); + } + + LOG_ERR("Exited with code %" CHIP_ERROR_FORMAT, err.Format()); + return err == CHIP_NO_ERROR ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/examples/thermostat/nxp/zephyr/prj.conf b/examples/thermostat/nxp/zephyr/prj.conf new file mode 100644 index 00000000000000..8bb5bd9f275756 --- /dev/null +++ b/examples/thermostat/nxp/zephyr/prj.conf @@ -0,0 +1,59 @@ +# +# Copyright (c) 2023-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. +# + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Enable CHIP +CONFIG_CHIP=y +CONFIG_STD_CPP17=y +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y +# CHIP PID: 32769 == 0x8001 (all-clusters-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 +CONFIG_CHIP_DEVICE_PRODUCT_NAME="Thermostat" +CONFIG_CHIP_DEVICE_DISCRIMINATOR=0x800 + +# Enable MbedTLS PSA - heavily experimental, not thread safe yet +# CONFIG_CHIP_CRYPTO_PSA=y + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="Thermostat" + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y + +CONFIG_DEBUG=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_THREAD_INFO=y +# use this config if stepping during debug session is not consistent +# CONFIG_NO_OPTIMIZATIONS=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_ASSERT=y +# by default west will generate the full assembly output, which can take several minutes when binaries are large +CONFIG_OUTPUT_DISASSEMBLY=n +# embedded thread analyzer with thread statistics (stack usage, cpu usage...) +# CONFIG_THREAD_ANALYZER=y +# CONFIG_THREAD_ANALYZER_USE_PRINTK=y +# CONFIG_THREAD_ANALYZER_AUTO=y + +# enable Matter CLI +CONFIG_CHIP_LIB_SHELL=y +# enable NET commands if desired +#CONFIG_NET_SHELL=y +CONFIG_CHIP_STATISTICS=y diff --git a/examples/thermostat/nxp/zephyr/prj_fdata.conf b/examples/thermostat/nxp/zephyr/prj_fdata.conf new file mode 100644 index 00000000000000..ee559b42ed9a71 --- /dev/null +++ b/examples/thermostat/nxp/zephyr/prj_fdata.conf @@ -0,0 +1,80 @@ +# +# Copyright (c) 2023-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. +# + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Enable CHIP +CONFIG_CHIP=y +CONFIG_STD_CPP17=y +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable MbedTLS PSA - heavily experimental, not thread safe yet +# CONFIG_CHIP_CRYPTO_PSA=y + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="Thermostat" + +# enable Matter CLI +CONFIG_CHIP_LIB_SHELL=y +CONFIG_CHIP_STATISTICS=y + +# Factory data configuration +CONFIG_CHIP_DEVICE_VENDOR_ID=4151 +CONFIG_CHIP_DEVICE_DISCRIMINATOR=0xA00 +CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE=14014 +CONFIG_CHIP_DEVICE_PRODUCT_NAME="Thermostat" +CONFIG_CHIP_DEVICE_TYPE=769 +CONFIG_CHIP_DEVICE_MANUFACTURING_DATE="2023-01-01" +CONFIG_CHIP_DEVICE_SERIAL_NUMBER="12345678" +CONFIG_CHIP_DEVICE_PRODUCT_COLOR="Green" +CONFIG_CHIP_DEVICE_PRODUCT_FINISH="Matte" + +# Use factory data provider for device info +CONFIG_CHIP_FACTORY_DATA=y +# Generate factor data raw binary during the build process +# CONFIG_CHIP_FACTORY_DATA_BUILD=y +# Generate test certificates for factory data during the build process +# CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_GENERATED=y +# Spake2p verifier will be generated during factory data generation +# CONFIG_CHIP_FACTORY_DATA_GENERATE_SPAKE2_VERIFIER=y + +# Example of using pre-generated certificates +# CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_USER=y +# CONFIG_CHIP_FACTORY_DATA_USER_CERTS_CD_CERT="/Chip-Test-CD-1037-A226.der" +# CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_CERT="/Chip-DAC-NXP-1037-A226-Cert.der" +# CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_KEY="/Chip-DAC-NXP-1037-A226-Key.der" +# CONFIG_CHIP_FACTORY_DATA_USER_CERTS_PAI_CERT="/Chip-PAI-NXP-1037-A226-Cert.der" + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y + +CONFIG_DEBUG=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_THREAD_INFO=y +# use this config if stepping during debug session is not consistent +# CONFIG_NO_OPTIMIZATIONS=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_ASSERT=y +# by default west will generate the full assembly output, which can take several minutes when binaries are large +CONFIG_OUTPUT_DISASSEMBLY=n +# embedded thread analyzer with thread statistics (stack usage, cpu usage...) +# CONFIG_THREAD_ANALYZER=y +# CONFIG_THREAD_ANALYZER_USE_PRINTK=y +# CONFIG_THREAD_ANALYZER_AUTO=y diff --git a/examples/thermostat/nxp/zephyr/prj_ota.conf b/examples/thermostat/nxp/zephyr/prj_ota.conf new file mode 100644 index 00000000000000..bdc65e94fabf70 --- /dev/null +++ b/examples/thermostat/nxp/zephyr/prj_ota.conf @@ -0,0 +1,31 @@ +# +# 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. +# + +# Options needed for OTA are located on this file +# This file should contain only options specific for this sample +# or overrides the default ones. + +CONFIG_CHIP_OTA_REQUESTOR=y + +# To generate an OTA image based on the application +CONFIG_CHIP_OTA_IMAGE_BUILD=y + +# By default, MCUBOOT bootloader uses a signature key provided in their repository. +# Change the key to the appropriate one. +# Note: You need to use the same signature key used by MCUBOOT, i.e BOOT_SIGNATURE_KEY_FILE. +# Default CONFIG_BOOT_SIGNATURE_KEY_FILE is defined in config/nxp/app/bootloader.conf +CONFIG_MCUBOOT_SIGNATURE_KEY_FILE="./bootloader/mcuboot/root-rsa-2048.pem" diff --git a/examples/thermostat/nxp/zephyr/third_party/connectedhomeip b/examples/thermostat/nxp/zephyr/third_party/connectedhomeip new file mode 120000 index 00000000000000..3efed95be5dbe9 --- /dev/null +++ b/examples/thermostat/nxp/zephyr/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../../../ \ No newline at end of file diff --git a/examples/thermostat/qpg/include/AppTask.h b/examples/thermostat/qpg/include/AppTask.h index 557f83d08636c9..2d2caac653aabc 100644 --- a/examples/thermostat/qpg/include/AppTask.h +++ b/examples/thermostat/qpg/include/AppTask.h @@ -61,6 +61,7 @@ class AppTask static void FunctionTimerEventHandler(AppEvent * aEvent); static void FunctionHandler(AppEvent * aEvent); static void TimerEventHandler(chip::System::Layer * aLayer, void * aAppState); + static void TotalHoursTimerHandler(chip::System::Layer * aLayer, void * aAppState); static void MatterEventHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg); static void UpdateLEDs(void); diff --git a/examples/thermostat/qpg/src/AppTask.cpp b/examples/thermostat/qpg/src/AppTask.cpp index 5bd1e9cc29ad9a..306661766a4af4 100644 --- a/examples/thermostat/qpg/src/AppTask.cpp +++ b/examples/thermostat/qpg/src/AppTask.cpp @@ -54,6 +54,8 @@ using namespace ::chip::DeviceLayer; #define APP_TASK_STACK_SIZE (2 * 1024) #define APP_TASK_PRIORITY 2 #define APP_EVENT_QUEUE_SIZE 10 +#define SECONDS_IN_HOUR (3600) // we better keep this 3600 +#define TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS (1 * SECONDS_IN_HOUR) // increment every hour namespace { TaskHandle_t sAppTaskHandle; @@ -233,6 +235,14 @@ CHIP_ERROR AppTask::Init() sIsBLEAdvertisingEnabled = ConnectivityMgr().IsBLEAdvertisingEnabled(); UpdateLEDs(); + err = chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds32(TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS), + TotalHoursTimerHandler, this); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "StartTimer failed %s: ", chip::ErrorStr(err)); + } + return err; } @@ -312,6 +322,40 @@ void AppTask::TimerEventHandler(chip::System::Layer * aLayer, void * aAppState) sAppTask.PostEvent(&event); } +void AppTask::TotalHoursTimerHandler(chip::System::Layer * aLayer, void * aAppState) +{ + ChipLogProgress(NotSpecified, "HourlyTimer"); + + CHIP_ERROR err; + uint32_t totalOperationalHours = 0; + + err = ConfigurationMgr().GetTotalOperationalHours(totalOperationalHours); + + if (err == CHIP_NO_ERROR) + { + ConfigurationMgr().StoreTotalOperationalHours(totalOperationalHours + + (TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS / SECONDS_IN_HOUR)); + } + else if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) + { + totalOperationalHours = 0; // set this explicitly to 0 for safety + ConfigurationMgr().StoreTotalOperationalHours(totalOperationalHours + + (TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS / SECONDS_IN_HOUR)); + } + else + { + ChipLogError(DeviceLayer, "Failed to get total operational hours of the Node"); + } + + err = chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds32(TOTAL_OPERATIONAL_HOURS_SAVE_INTERVAL_SECONDS), + TotalHoursTimerHandler, nullptr); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "StartTimer failed %s: ", chip::ErrorStr(err)); + } +} + void AppTask::FunctionTimerEventHandler(AppEvent * aEvent) { if (aEvent->Type != AppEvent::kEventType_Timer) diff --git a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter index ff8ca04ecd4a89..a51d01dc8b2633 100644 --- a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter +++ b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -237,7 +254,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -253,12 +270,42 @@ cluster AccessControl = 31 { 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; @@ -294,17 +341,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -389,7 +460,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1559,7 +1630,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -1626,7 +1698,6 @@ cluster Thermostat = 513 { kMatterScheduleConfiguration = 0x80; kPresets = 0x100; kSetpoints = 0x200; - kQueuedPresetsSupported = 0x400; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -1686,11 +1757,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -1724,11 +1790,6 @@ cluster Thermostat = 513 { PresetTypeFeaturesBitmap presetTypeFeatures = 2; } - struct QueuedPresetStruct { - nullable octet_string<16> presetHandle = 0; - nullable epoch_s transitionTimestamp = 1; - } - struct ScheduleTypeStruct { SystemModeEnum systemMode = 0; int8u numberOfSchedules = 1; @@ -1801,9 +1862,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; - readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1841,17 +1900,12 @@ cluster Thermostat = 513 { request struct SetActivePresetRequestRequest { octet_string<16> presetHandle = 0; - optional int16u delayMinutes = 1; } request struct StartPresetsSchedulesEditRequestRequest { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -1870,10 +1924,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command is sent to cancel a queued preset. */ - command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for configuring the user interface of a thermostat (which may be remote from the thermostat). */ diff --git a/examples/thermostat/telink/README.md b/examples/thermostat/telink/README.md index 604a917ff18ce9..1d6c66bb74cd7f 100755 --- a/examples/thermostat/telink/README.md +++ b/examples/thermostat/telink/README.md @@ -4,6 +4,17 @@ You can use this example as a reference for creating your own application. ![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) +## Supported devices + +The example supports building and running on the following devices: + +| Board/SoC | Build target | Zephyr Board Info | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| [B91](https://wiki.telink-semi.cn/wiki/Hardware/B91_Generic_Starter_Kit_Hardware_Guide) [TLSR9518ADK80D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series) | `tlsr9518adk80d`, `tlsr9518adk80d-mars`, `tlsr9518adk80d-usb` | [TLSR9518ADK80D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9518adk80d/doc/index.rst) | +| [B92](https://wiki.telink-semi.cn/wiki/Hardware/B92_Generic_Starter_Kit_Hardware_Guide) [TLSR9528A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR952x-Series) | `tlsr9528a`, `tlsr9528a_retention` | [TLSR9528A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9528a/doc/index.rst) | +| [B95](https://wiki.telink-semi.cn/wiki/Hardware/B95_Generic_Starter_Kit_Hardware_Guide) [TLSR9258A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR925x-Series) | `tlsr9258a` | [TLSR9258A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9258a/doc/index.rst) | +| [W91](https://wiki.telink-semi.cn/wiki/Hardware/W91_Generic_Starter_Kit_Hardware_Guide) [TLSR9118BDK40D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR911x-Series) | `tlsr9118bdk40d` | [TLSR9118BDK40D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9118bdk40d/doc/index.rst) | + ## Build and flash 1. Run the Docker container: @@ -12,7 +23,7 @@ You can use this example as a reference for creating your own application. $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}') ``` - Compatible docker image version can be found in next file: + You can find the compatible Docker image version in the file: ```bash $ .github/workflows/examples-telink.yaml @@ -24,8 +35,8 @@ You can use this example as a reference for creating your own application. $ source ./scripts/activate.sh -p all,telink ``` -3. In the example dir run (replace __ with your board name, for - example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`): +3. Build the example (replace __ with your board name, see + [Supported devices](#supported-devices)): ```bash $ west build -b @@ -35,9 +46,12 @@ You can use this example as a reference for creating your own application. MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=4m`: ```bash - $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + $ west build -b -- -DFLASH_SIZE=4m ``` + You can find the target built file called **_zephyr.bin_** under the + **_build/zephyr_** directory. + 4. Flash binary: ``` @@ -56,16 +70,18 @@ To get output from device, connect UART to following pins: | TX | PB2 (pin 16 of J34 connector) | | GND | GND | +Baud rate: 115200 bits/s + ### Buttons The following buttons are available on **tlsr9518adk80d** board: -| Name | Function | Description | -| :------- | :--------------------- | :----------------------------------------------------------------------------------------------------- | -| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and back to uncommissioned state | -| Button 2 | NA | NA | -| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | -| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | +| Name | Function | Description | +| :------- | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and return to a decommissioned state (to activate, push the button 3 times) | +| Button 2 | NA | NA | +| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | +| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | ### LEDs diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter index 039eda02a21854..e63ebeba6df9ae 100644 --- a/examples/thermostat/thermostat-common/thermostat.matter +++ b/examples/thermostat/thermostat-common/thermostat.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -237,7 +254,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -253,12 +270,42 @@ cluster AccessControl = 31 { 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; @@ -294,17 +341,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -389,7 +460,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1739,7 +1810,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -1806,7 +1878,6 @@ cluster Thermostat = 513 { kMatterScheduleConfiguration = 0x80; kPresets = 0x100; kSetpoints = 0x200; - kQueuedPresetsSupported = 0x400; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -1866,11 +1937,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -1904,11 +1970,6 @@ cluster Thermostat = 513 { PresetTypeFeaturesBitmap presetTypeFeatures = 2; } - struct QueuedPresetStruct { - nullable octet_string<16> presetHandle = 0; - nullable epoch_s transitionTimestamp = 1; - } - struct ScheduleTypeStruct { SystemModeEnum systemMode = 0; int8u numberOfSchedules = 1; @@ -1981,9 +2042,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; - readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -2021,17 +2080,12 @@ cluster Thermostat = 513 { request struct SetActivePresetRequestRequest { octet_string<16> presetHandle = 0; - optional int16u delayMinutes = 1; } request struct StartPresetsSchedulesEditRequestRequest { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -2050,10 +2104,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command is sent to cancel a queued preset. */ - command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for configuring the user interface of a thermostat (which may be remote from the thermostat). */ @@ -2498,13 +2548,22 @@ endpoint 1 { ram attribute minSetpointDeadBand default = 0x19; ram attribute controlSequenceOfOperation default = 0x04; persist attribute systemMode default = 0x01; + callback attribute presetTypes; + ram attribute numberOfPresets default = 0; + ram attribute activePresetHandle; + callback attribute presets; + ram attribute presetsSchedulesEditable; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute attributeList; - ram attribute featureMap default = 0x23; + ram attribute featureMap default = 0x123; ram attribute clusterRevision default = 6; handle command SetpointRaiseLower; + handle command SetActivePresetRequest; + handle command StartPresetsSchedulesEditRequest; + handle command CancelPresetsSchedulesEditRequest; + handle command CommitPresetsSchedulesRequest; } server cluster ThermostatUserInterfaceConfiguration { diff --git a/examples/thermostat/thermostat-common/thermostat.zap b/examples/thermostat/thermostat-common/thermostat.zap index 288a84a921636c..483b79d7d434f5 100644 --- a/examples/thermostat/thermostat-common/thermostat.zap +++ b/examples/thermostat/thermostat-common/thermostat.zap @@ -4659,6 +4659,38 @@ "source": "client", "isIncoming": 1, "isEnabled": 1 + }, + { + "name": "SetActivePresetRequest", + "code": 6, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "StartPresetsSchedulesEditRequest", + "code": 7, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CancelPresetsSchedulesEditRequest", + "code": 8, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CommitPresetsSchedulesRequest", + "code": 9, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 } ], "attributes": [ @@ -4886,6 +4918,86 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "PresetTypes", + "code": 72, + "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": "NumberOfPresets", + "code": 74, + "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": "ActivePresetHandle", + "code": 78, + "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": "Presets", + "code": 80, + "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": "PresetsSchedulesEditable", + "code": 82, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "GeneratedCommandList", "code": 65528, @@ -4944,7 +5056,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x23", + "defaultValue": "0x123", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/tv-app/android/App/content-app/src/main/AndroidManifest.xml b/examples/tv-app/android/App/content-app/src/main/AndroidManifest.xml index 61d036e0a90ef4..fff52c4b59db7e 100644 --- a/examples/tv-app/android/App/content-app/src/main/AndroidManifest.xml +++ b/examples/tv-app/android/App/content-app/src/main/AndroidManifest.xml @@ -19,7 +19,7 @@ - + diff --git a/examples/tv-app/android/App/platform-app/src/main/AndroidManifest.xml b/examples/tv-app/android/App/platform-app/src/main/AndroidManifest.xml index b6e00cd75d0365..476faa2030c7a2 100644 --- a/examples/tv-app/android/App/platform-app/src/main/AndroidManifest.xml +++ b/examples/tv-app/android/App/platform-app/src/main/AndroidManifest.xml @@ -26,6 +26,9 @@ tools:ignore="QueryAllPackagesPermission" /> + + + tasks = activityManager.getRunningTasks(1); + if (tasks != null && !tasks.isEmpty()) { + ActivityManager.RunningTaskInfo taskInfo = tasks.get(0); + String packageName = + taskInfo.topActivity != null ? taskInfo.topActivity.getPackageName() : ""; + return packageName.equals(contentAppPackageName); + } + return false; + } + public String sendCommand(int endpointId, long clusterId, long commandId, String commandPayload) { Log.d(TAG, "Received a command for endpointId " + endpointId + ". Message " + commandPayload); @@ -26,6 +55,17 @@ public String sendCommand(int endpointId, long clusterId, long commandId, String ContentAppDiscoveryService.getReceiverInstance().getDiscoveredContentApps().values(), endpointId); if (discoveredApp != null) { + // Intercept NavigateTarget and LaunchContent commands and launch content app if necessary + if (isForegroundCommand(clusterId, commandId)) { + // Check if contentapp main/launch activity is already in foreground before launching. + if (!isAppInForeground(discoveredApp.getAppName())) { + Intent launchIntent = + context.getPackageManager().getLaunchIntentForPackage(discoveredApp.getAppName()); + if (launchIntent != null) { + context.startActivity(launchIntent); + } + } + } Log.d(TAG, "Sending a command for endpointId " + endpointId + ". Message " + commandPayload); return ContentAppAgentService.sendCommand( context, discoveredApp.getAppName(), clusterId, commandId, commandPayload); diff --git a/examples/tv-app/android/App/platform-app/src/main/java/com/matter/tv/server/model/ContentApp.java b/examples/tv-app/android/App/platform-app/src/main/java/com/matter/tv/server/model/ContentApp.java index e30a75a00d98b2..0cd12b404d6fcf 100644 --- a/examples/tv-app/android/App/platform-app/src/main/java/com/matter/tv/server/model/ContentApp.java +++ b/examples/tv-app/android/App/platform-app/src/main/java/com/matter/tv/server/model/ContentApp.java @@ -25,6 +25,7 @@ public ContentApp( this.vendorId = vendorId; this.productId = productId; this.version = version; + this.supportedClusters = Collections.EMPTY_SET; } public ContentApp( @@ -67,9 +68,7 @@ public void setEndpointId(int endpoint) { } public Set getSupportedClusters() { - return supportedClusters != null - ? Collections.unmodifiableSet(supportedClusters) - : Collections.EMPTY_SET; + return Collections.unmodifiableSet(supportedClusters); } public String getVersion() { diff --git a/examples/tv-app/android/App/platform-app/src/main/java/com/matter/tv/server/utils/EndpointsDataStore.java b/examples/tv-app/android/App/platform-app/src/main/java/com/matter/tv/server/utils/EndpointsDataStore.java index f587905fb09145..227ea9326be538 100644 --- a/examples/tv-app/android/App/platform-app/src/main/java/com/matter/tv/server/utils/EndpointsDataStore.java +++ b/examples/tv-app/android/App/platform-app/src/main/java/com/matter/tv/server/utils/EndpointsDataStore.java @@ -4,13 +4,18 @@ import android.content.SharedPreferences; import android.util.JsonReader; import android.util.JsonWriter; +import com.matter.tv.app.api.SupportedCluster; import com.matter.tv.server.model.ContentApp; import java.io.IOException; import java.io.StringReader; import java.io.StringWriter; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; +import java.util.List; import java.util.Map; +import java.util.Set; public class EndpointsDataStore { @@ -21,6 +26,11 @@ public class EndpointsDataStore { private static final String KEY_PRODUCTID = "PID"; private static final String KEY_VERSION = "VER"; private static final String KEY_ENDPOINTID = "EPID"; + private static final String KEY_SUPPORTED_CLUSTERS = "supportedClusters"; + private static final String KEY_CLUSTER_IDENTIFIER = "clusterIdentifier"; + private static final String KEY_FEATURES = "features"; + private static final String KEY_OPTIONAL_COMMAND_IDENTIFIERS = "optionalCommandIdentifiers"; + private static final String KEY_OPTIONAL_ATTRIBUTES_IDENTIFIERS = "optionalAttributesIdentifiers"; private static EndpointsDataStore instance; private final SharedPreferences discoveredEndpoints; Map persistedContentApps = new HashMap<>(); @@ -57,19 +67,20 @@ private String serializeContentApp(ContentApp app) { StringWriter stringWriter = new StringWriter(); JsonWriter jsonWriter = new JsonWriter(stringWriter); try { - jsonWriter - .beginObject() - .name(KEY_VENDORID) - .value(app.getVendorId()) - .name(KEY_VENDORNAME) - .value(app.getVendorName()) - .name(KEY_PRODUCTID) - .value(app.getProductId()) - .name(KEY_VERSION) - .value(app.getVersion()) - .name(KEY_ENDPOINTID) - .value(app.getEndpointId()) - .endObject(); + jsonWriter.beginObject(); + jsonWriter.name(KEY_VENDORID); + jsonWriter.value(app.getVendorId()); + jsonWriter.name(KEY_VENDORNAME); + jsonWriter.value(app.getVendorName()); + jsonWriter.name(KEY_PRODUCTID); + jsonWriter.value(app.getProductId()); + jsonWriter.name(KEY_VERSION); + jsonWriter.value(app.getVersion()); + jsonWriter.name(KEY_ENDPOINTID); + jsonWriter.value(app.getEndpointId()); + jsonWriter.name(KEY_SUPPORTED_CLUSTERS); + serializeSupportedClusters(jsonWriter, app.getSupportedClusters()); + jsonWriter.endObject(); jsonWriter.flush(); jsonWriter.close(); } catch (IOException e) { @@ -88,6 +99,7 @@ private ContentApp deserializeContentApp(String appName, String appMetadata) { int vendorId = 0; int productId = 0; int endpoint = ContentApp.INVALID_ENDPOINTID; + Set supportedClusters = new HashSet<>(); while (jsonReader.hasNext()) { String name = jsonReader.nextName(); switch (name) { @@ -106,9 +118,12 @@ private ContentApp deserializeContentApp(String appName, String appMetadata) { case KEY_ENDPOINTID: endpoint = jsonReader.nextInt(); break; + case KEY_SUPPORTED_CLUSTERS: + supportedClusters = deserializeSupportedClusters(jsonReader); + break; } } - app = new ContentApp(appName, vendorName, vendorId, productId, version); + app = new ContentApp(appName, vendorName, vendorId, productId, version, supportedClusters); jsonReader.endObject(); jsonReader.close(); } catch (IOException e) { @@ -116,4 +131,86 @@ private ContentApp deserializeContentApp(String appName, String appMetadata) { } return app; } + + private void serializeSupportedClusters( + JsonWriter jsonWriter, Set supportedClusters) throws IOException { + if (supportedClusters != null) { + jsonWriter.beginArray(); + for (SupportedCluster supportedCluster : supportedClusters) { + if (supportedCluster != null) { + serializeSupportedCluster(jsonWriter, supportedCluster); + } + } + jsonWriter.endArray(); + } + } + + private Set deserializeSupportedClusters(JsonReader jsonReader) + throws IOException { + Set supportedClusters = new HashSet<>(); + jsonReader.beginArray(); + while (jsonReader.hasNext()) { + supportedClusters.add(deserializeSupportedCluster(jsonReader)); + } + jsonReader.endArray(); + return supportedClusters; + } + + private void serializeSupportedCluster(JsonWriter jsonWriter, SupportedCluster supportedCluster) + throws IOException { + jsonWriter.beginObject(); + jsonWriter.name(KEY_CLUSTER_IDENTIFIER); + jsonWriter.value(supportedCluster.clusterIdentifier); + jsonWriter.name(KEY_FEATURES); + jsonWriter.value(supportedCluster.features); + jsonWriter.name(KEY_OPTIONAL_COMMAND_IDENTIFIERS); + serializeIntArray(jsonWriter, supportedCluster.optionalCommandIdentifiers); + jsonWriter.name(KEY_OPTIONAL_ATTRIBUTES_IDENTIFIERS); + serializeIntArray(jsonWriter, supportedCluster.optionalAttributesIdentifiers); + jsonWriter.endObject(); + } + + private SupportedCluster deserializeSupportedCluster(JsonReader jsonReader) throws IOException { + SupportedCluster supportedCluster = new SupportedCluster(); + jsonReader.beginObject(); + while (jsonReader.hasNext()) { + String name = jsonReader.nextName(); + switch (name) { + case KEY_CLUSTER_IDENTIFIER: + supportedCluster.clusterIdentifier = jsonReader.nextInt(); + break; + case KEY_FEATURES: + supportedCluster.features = jsonReader.nextInt(); + break; + case KEY_OPTIONAL_COMMAND_IDENTIFIERS: + supportedCluster.optionalCommandIdentifiers = deserializeIntArray(jsonReader); + break; + case KEY_OPTIONAL_ATTRIBUTES_IDENTIFIERS: + supportedCluster.optionalAttributesIdentifiers = deserializeIntArray(jsonReader); + break; + } + } + jsonReader.endObject(); + return supportedCluster; + } + + private void serializeIntArray(JsonWriter jsonWriter, int[] array) throws IOException { + jsonWriter.beginArray(); + if (array != null) { + for (int value : array) { + jsonWriter.value(value); + } + } + jsonWriter.endArray(); + } + + private int[] deserializeIntArray(JsonReader jsonReader) throws IOException { + List dynamicArray = new ArrayList<>(); + jsonReader.beginArray(); + while (jsonReader.hasNext()) { + dynamicArray.add(jsonReader.nextInt()); + } + jsonReader.endArray(); + return dynamicArray.stream().mapToInt(Integer::intValue).toArray(); + } } diff --git a/examples/tv-app/android/java/AppImpl.cpp b/examples/tv-app/android/java/AppImpl.cpp index 4dfabd03f12ec6..d04964ee5eb747 100644 --- a/examples/tv-app/android/java/AppImpl.cpp +++ b/examples/tv-app/android/java/AppImpl.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -355,6 +355,87 @@ ContentApp * ContentAppFactoryImpl::LoadContentApp(const CatalogVendorApp & vend return nullptr; } +class DevicePairedCommand : public Controller::DevicePairingDelegate +{ +public: + struct CallbackContext + { + uint16_t vendorId; + uint16_t productId; + chip::NodeId nodeId; + + CallbackContext(uint16_t vId, uint16_t pId, chip::NodeId nId) : vendorId(vId), productId(pId), nodeId(nId) {} + }; + DevicePairedCommand(uint16_t vendorId, uint16_t productId, chip::NodeId nodeId) : + mOnDeviceConnectedCallback(OnDeviceConnectedFn, this), mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureFn, this) + { + mContext = std::make_shared(vendorId, productId, nodeId); + } + + static void OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr, + const chip::SessionHandle & sessionHandle) + { + auto * pairingCommand = static_cast(context); + auto cbContext = pairingCommand->mContext; + + if (pairingCommand) + { + ChipLogProgress(DeviceLayer, + "OnDeviceConnectedFn - Updating ACL for node id: " ChipLogFormatX64 + " and vendor id: %d and product id: %d", + ChipLogValueX64(cbContext->nodeId), cbContext->vendorId, cbContext->productId); + + GetCommissionerDiscoveryController()->CommissioningSucceeded(cbContext->vendorId, cbContext->productId, + cbContext->nodeId, exchangeMgr, sessionHandle); + } + } + + static void OnDeviceConnectionFailureFn(void * context, const ScopedNodeId & peerId, CHIP_ERROR error) + { + auto * pairingCommand = static_cast(context); + auto cbContext = pairingCommand->mContext; + + if (pairingCommand) + { + ChipLogProgress(DeviceLayer, + "OnDeviceConnectionFailureFn - Not updating ACL for node id: " ChipLogFormatX64 + " and vendor id: %d and product id: %d", + ChipLogValueX64(cbContext->nodeId), cbContext->vendorId, cbContext->productId); + // TODO: Remove Node Id + } + } + + chip::Callback::Callback mOnDeviceConnectedCallback; + chip::Callback::Callback mOnDeviceConnectionFailureCallback; + std::shared_ptr mContext; +}; + +void refreshConnectedClientsAcl(uint16_t vendorId, uint16_t productId, ContentAppImpl * app) +{ + + std::set nodeIds = ContentAppPlatform::GetInstance().GetNodeIdsForContentApp(vendorId, productId); + + for (const auto & allowedVendor : app->GetApplicationBasicDelegate()->GetAllowedVendorList()) + { + std::set tempNodeIds = ContentAppPlatform::GetInstance().GetNodeIdsForAllowVendorId(allowedVendor); + + nodeIds.insert(tempNodeIds.begin(), tempNodeIds.end()); + } + + for (const auto & nodeId : nodeIds) + { + + ChipLogProgress(DeviceLayer, + "Creating Pairing Command with node id: " ChipLogFormatX64 " and vendor id: %d and product id: %d", + ChipLogValueX64(nodeId), vendorId, productId); + + std::shared_ptr pairingCommand = std::make_shared(vendorId, productId, nodeId); + + GetDeviceCommissioner()->GetConnectedDevice(nodeId, &pairingCommand->mOnDeviceConnectedCallback, + &pairingCommand->mOnDeviceConnectionFailureCallback); + } +} + EndpointId ContentAppFactoryImpl::AddContentApp(const char * szVendorName, uint16_t vendorId, const char * szApplicationName, uint16_t productId, const char * szApplicationVersion, std::vector supportedClusters, jobject manager) @@ -369,6 +450,9 @@ EndpointId ContentAppFactoryImpl::AddContentApp(const char * szVendorName, uint1 app->GetEndpointId()); mContentApps.push_back(app); mDataVersions.push_back(dataVersionBuf); + + refreshConnectedClientsAcl(vendorId, productId, app); + return epId; } @@ -387,6 +471,9 @@ EndpointId ContentAppFactoryImpl::AddContentApp(const char * szVendorName, uint1 app->GetEndpointId()); mContentApps.push_back(app); mDataVersions.push_back(dataVersionBuf); + + refreshConnectedClientsAcl(vendorId, productId, app); + return epId; } @@ -485,7 +572,7 @@ CHIP_ERROR InitVideoPlayerPlatform(jobject contentAppEndpointManager) { ContentAppCommandDelegate * delegate = new ContentAppCommandDelegate(contentAppEndpointManager, contentAppClusters[i].clusterId); - chip::app::InteractionModelEngine::GetInstance()->RegisterCommandHandler(delegate); + chip::app::CommandHandlerInterfaceRegistry::RegisterCommandHandler(delegate); ChipLogProgress(AppServer, "Registered command handler delegate for cluster %d", contentAppClusters[i].clusterId); } diff --git a/examples/tv-app/android/java/TVApp-JNI.cpp b/examples/tv-app/android/java/TVApp-JNI.cpp index 04b5f4199edcaa..65a0a4409e9b8f 100644 --- a/examples/tv-app/android/java/TVApp-JNI.cpp +++ b/examples/tv-app/android/java/TVApp-JNI.cpp @@ -258,6 +258,8 @@ class MyPostCommissioningListener : public PostCommissioningListener // read current binding list chip::Controller::ClusterBase cluster(exchangeMgr, sessionHandle, kTargetBindingClusterEndpointId); + ContentAppPlatform::GetInstance().StoreNodeIdForContentApp(vendorId, productId, nodeId); + cacheContext(vendorId, productId, nodeId, exchangeMgr, sessionHandle); CHIP_ERROR err = diff --git a/examples/tv-app/linux/args.gni b/examples/tv-app/linux/args.gni index 4861f23ac068dc..229668377ef8da 100644 --- a/examples/tv-app/linux/args.gni +++ b/examples/tv-app/linux/args.gni @@ -31,6 +31,8 @@ chip_enable_additional_data_advertising = true chip_enable_rotating_device_id = true matter_enable_tracing_support = true +matter_log_json_payload_hex = true +matter_log_json_payload_decode_full = true # Thread devices do not support WakeOnLan because their mac address is >48bit chip_enable_openthread = false diff --git a/examples/tv-app/linux/main.cpp b/examples/tv-app/linux/main.cpp index 29fdd69cb36792..c2055e0abd03f3 100644 --- a/examples/tv-app/linux/main.cpp +++ b/examples/tv-app/linux/main.cpp @@ -45,6 +45,31 @@ void ApplicationInit() ChipLogDetail(DeviceLayer, "TV Linux App: Warning - Fixed Content App Endpoint Not Disabled"); // Can't disable this without breaking CI unit tests that act upon account login cluster (only available on ep3) // emberAfEndpointEnableDisable(3, false); + +#if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED + // Install Content Apps + ContentAppFactoryImpl * factory = GetContentAppFactoryImpl(); + + // Content App 1 + constexpr uint16_t kApp1VendorId = 65521; + constexpr uint16_t kApp1ProductId = 32769; + factory->InstallContentApp(kApp1VendorId, kApp1ProductId); + + // Content App 2 + constexpr uint16_t kApp2VendorId = 1; + constexpr uint16_t kApp2ProductId = 11; + factory->InstallContentApp(kApp2VendorId, kApp2ProductId); + + // Content App 3 + constexpr uint16_t kApp3VendorId = 9050; + constexpr uint16_t kApp3ProductId = 22; + factory->InstallContentApp(kApp3VendorId, kApp3ProductId); + + // Content App 4 + constexpr uint16_t kApp4VendorId = 1111; + constexpr uint16_t kApp4ProductId = 22; + factory->InstallContentApp(kApp4VendorId, kApp4ProductId); +#endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED } void ApplicationShutdown() {} diff --git a/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp b/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp index b39e84ad40f89a..5125ebbbbd7ecd 100644 --- a/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp +++ b/examples/tv-app/tv-common/shell/AppTvShellCommands.cpp @@ -209,6 +209,10 @@ static CHIP_ERROR PrintAllCommands() #if CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE streamer_printf(sout, " print-app-access Print all ACLs for app platform fabric. Usage: app print-app-access\r\n"); streamer_printf(sout, " remove-app-access Remove all ACLs for app platform fabric. Usage: app remove-app-access\r\n"); + streamer_printf( + sout, + " print-installed-apps Print all installed content apps with their endpoints. Usage: app print-installed-apps\r\n"); + streamer_printf(sout, " commission Commission given udc-entry using given pincode from corresponding app. Usage: " "app commission 0\r\n"); @@ -436,6 +440,13 @@ static CHIP_ERROR AppPlatformHandler(int argc, char ** argv) Access::GetAccessControl().DeleteAllEntriesForFabric(GetDeviceCommissioner()->GetFabricIndex()); return CHIP_NO_ERROR; } + else if (strcmp(argv[0], "print-installed-apps") == 0) + { + ContentAppFactoryImpl * factory = GetContentAppFactoryImpl(); + factory->LogInstalledApps(); + + return CHIP_NO_ERROR; + } else if (strcmp(argv[0], "commission") == 0) { if (argc < 2) diff --git a/examples/tv-app/tv-common/src/AppTv.cpp b/examples/tv-app/tv-common/src/AppTv.cpp index 03422c3fa462e7..8d81d9cf6c2c5c 100644 --- a/examples/tv-app/tv-common/src/AppTv.cpp +++ b/examples/tv-app/tv-common/src/AppTv.cpp @@ -164,6 +164,8 @@ class MyPostCommissioningListener : public PostCommissioningListener // read current binding list chip::Controller::ClusterBase cluster(exchangeMgr, sessionHandle, kTargetBindingClusterEndpointId); + ContentAppPlatform::GetInstance().StoreNodeIdForContentApp(vendorId, productId, nodeId); + cacheContext(vendorId, productId, nodeId, exchangeMgr, sessionHandle); CHIP_ERROR err = @@ -565,6 +567,63 @@ void ContentAppFactoryImpl::AddAdminVendorId(uint16_t vendorId) mAdminVendorIds.push_back(vendorId); } +#if CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE +class DevicePairedCommand : public Controller::DevicePairingDelegate +{ +public: + struct CallbackContext + { + uint16_t vendorId; + uint16_t productId; + chip::NodeId nodeId; + + CallbackContext(uint16_t vId, uint16_t pId, chip::NodeId nId) : vendorId(vId), productId(pId), nodeId(nId) {} + }; + DevicePairedCommand(uint16_t vendorId, uint16_t productId, chip::NodeId nodeId) : + mOnDeviceConnectedCallback(OnDeviceConnectedFn, this), mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureFn, this) + { + mContext = std::make_shared(vendorId, productId, nodeId); + } + + static void OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr, + const chip::SessionHandle & sessionHandle) + { + auto * pairingCommand = static_cast(context); + auto cbContext = pairingCommand->mContext; + + if (pairingCommand) + { + ChipLogProgress(DeviceLayer, + "OnDeviceConnectedFn - Updating ACL for node id: " ChipLogFormatX64 + " and vendor id: %d and product id: %d", + ChipLogValueX64(cbContext->nodeId), cbContext->vendorId, cbContext->productId); + + GetCommissionerDiscoveryController()->CommissioningSucceeded(cbContext->vendorId, cbContext->productId, + cbContext->nodeId, exchangeMgr, sessionHandle); + } + } + + static void OnDeviceConnectionFailureFn(void * context, const ScopedNodeId & peerId, CHIP_ERROR error) + { + auto * pairingCommand = static_cast(context); + auto cbContext = pairingCommand->mContext; + + if (pairingCommand) + { + ChipLogProgress(DeviceLayer, + "OnDeviceConnectionFailureFn - Not updating ACL for node id: " ChipLogFormatX64 + " and vendor id: %d and product id: %d", + ChipLogValueX64(cbContext->nodeId), cbContext->vendorId, cbContext->productId); + // TODO: Remove Node Id + } + } + + chip::Callback::Callback mOnDeviceConnectedCallback; + chip::Callback::Callback mOnDeviceConnectionFailureCallback; + std::shared_ptr mContext; +}; +#endif // CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE + void ContentAppFactoryImpl::InstallContentApp(uint16_t vendorId, uint16_t productId) { auto make_default_supported_clusters = []() { @@ -605,6 +664,46 @@ void ContentAppFactoryImpl::InstallContentApp(uint16_t vendorId, uint16_t produc make_default_supported_clusters()); mContentApps.emplace_back(std::move(ptr)); } + +#if CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE + // Get the list of node ids + std::set nodeIds = ContentAppPlatform::GetInstance().GetNodeIdsForContentApp(vendorId, productId); + + // update ACLs + for (auto & contentApp : mContentApps) + { + auto app = contentApp.get(); + + if (app->MatchesPidVid(productId, vendorId)) + { + CatalogVendorApp vendorApp = app->GetApplicationBasicDelegate()->GetCatalogVendorApp(); + + GetContentAppFactoryImpl()->LoadContentApp(vendorApp); + } + + // update the list of node ids with content apps allowed vendor list + for (const auto & allowedVendor : app->GetApplicationBasicDelegate()->GetAllowedVendorList()) + { + std::set tempNodeIds = ContentAppPlatform::GetInstance().GetNodeIdsForAllowVendorId(allowedVendor); + + nodeIds.insert(tempNodeIds.begin(), tempNodeIds.end()); + } + } + + // refresh ACLs + for (const auto & nodeId : nodeIds) + { + + ChipLogProgress(DeviceLayer, + "Creating Pairing Command with node id: " ChipLogFormatX64 " and vendor id: %d and product id: %d", + ChipLogValueX64(nodeId), vendorId, productId); + + std::shared_ptr pairingCommand = std::make_shared(vendorId, productId, nodeId); + + GetDeviceCommissioner()->GetConnectedDevice(nodeId, &pairingCommand->mOnDeviceConnectedCallback, + &pairingCommand->mOnDeviceConnectionFailureCallback); + } +#endif // CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE } bool ContentAppFactoryImpl::UninstallContentApp(uint16_t vendorId, uint16_t productId) @@ -625,8 +724,9 @@ bool ContentAppFactoryImpl::UninstallContentApp(uint16_t vendorId, uint16_t prod ChipLogProgress(DeviceLayer, "Found an app vid=%d pid=%d. Uninstalling it.", app->GetApplicationBasicDelegate()->HandleGetVendorId(), app->GetApplicationBasicDelegate()->HandleGetProductId()); + EndpointId removedEndpointID = ContentAppPlatform::GetInstance().RemoveContentApp(app); + ChipLogProgress(DeviceLayer, "Removed content app at endpoint id: %d", removedEndpointID); mContentApps.erase(mContentApps.begin() + index); - // TODO: call ContentAppPlatform->RemoveContentApp(ids...) return true; } @@ -701,22 +801,8 @@ std::list ContentAppFactoryImpl::GetAllowedClusterListForStaticEndpoi CHIP_ERROR AppTvInit() { #if CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED - // test data for apps - constexpr uint16_t kApp1VendorId = 1; - constexpr uint16_t kApp1ProductId = 11; - constexpr uint16_t kApp2VendorId = 65521; - constexpr uint16_t kApp2ProductId = 32769; - constexpr uint16_t kApp3VendorId = 9050; - constexpr uint16_t kApp3ProductId = 22; - constexpr uint16_t kApp4VendorId = 1111; - constexpr uint16_t kApp4ProductId = 22; - ContentAppPlatform::GetInstance().SetupAppPlatform(); ContentAppPlatform::GetInstance().SetContentAppFactory(&gFactory); - gFactory.InstallContentApp(kApp1VendorId, kApp1ProductId); - gFactory.InstallContentApp(kApp2VendorId, kApp2ProductId); - gFactory.InstallContentApp(kApp3VendorId, kApp3ProductId); - gFactory.InstallContentApp(kApp4VendorId, kApp4ProductId); uint16_t value; if (DeviceLayer::GetDeviceInstanceInfoProvider()->GetVendorId(value) != CHIP_NO_ERROR) { diff --git a/examples/tv-app/tv-common/tv-app.matter b/examples/tv-app/tv-common/tv-app.matter index e7ed8d2996728e..ffc1c6a8ebaaf6 100644 --- a/examples/tv-app/tv-common/tv-app.matter +++ b/examples/tv-app/tv-common/tv-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for switching devices between 'On' and 'Off' states. */ cluster OnOff = 6 { revision 6; @@ -75,7 +92,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -278,7 +295,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -294,12 +311,42 @@ cluster AccessControl = 31 { 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; @@ -335,17 +382,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -430,7 +501,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -3750,7 +3821,7 @@ endpoint 2 { ram attribute defaultMoveRate; persist attribute startUpCurrentLevel default = 255; ram attribute featureMap default = 1; - ram attribute clusterRevision default = 5; + ram attribute clusterRevision default = 6; handle command MoveToLevel; handle command Move; diff --git a/examples/tv-app/tv-common/tv-app.zap b/examples/tv-app/tv-common/tv-app.zap index 8e5028b4ed8d25..9acccceace7c4d 100644 --- a/examples/tv-app/tv-common/tv-app.zap +++ b/examples/tv-app/tv-common/tv-app.zap @@ -6915,7 +6915,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/tv-casting-app/linux/args.gni b/examples/tv-casting-app/linux/args.gni index 549819b797f6c7..94ae0a5ed0f66a 100644 --- a/examples/tv-casting-app/linux/args.gni +++ b/examples/tv-casting-app/linux/args.gni @@ -35,3 +35,5 @@ chip_max_discovered_ip_addresses = 20 enable_rtti = true matter_enable_tracing_support = true +matter_log_json_payload_hex = true +matter_log_json_payload_decode_full = true diff --git a/examples/tv-casting-app/linux/simple-app-helper.cpp b/examples/tv-casting-app/linux/simple-app-helper.cpp index 3cf13fac8606f2..ac60b7fb4740f4 100644 --- a/examples/tv-casting-app/linux/simple-app-helper.cpp +++ b/examples/tv-casting-app/linux/simple-app-helper.cpp @@ -41,6 +41,7 @@ bool gCommissionerGeneratedPasscodeFlowRunning = false; DiscoveryDelegateImpl * DiscoveryDelegateImpl::_discoveryDelegateImpl = nullptr; bool gAwaitingCommissionerPasscodeInput = false; +LinuxCommissionableDataProvider gSimpleAppCommissionableDataProvider; std::shared_ptr targetCastingPlayer; DiscoveryDelegateImpl * DiscoveryDelegateImpl::GetInstance() @@ -470,9 +471,8 @@ CHIP_ERROR CommandHandler(int argc, char ** argv) // Commissioner-generated passcode, and then update the CastigApp's AppParameters to update the commissioning session's // passcode. LinuxDeviceOptions::GetInstance().payload.setUpPINCode = userEnteredPasscode; - LinuxCommissionableDataProvider gCommissionableDataProvider; - CHIP_ERROR err = CHIP_NO_ERROR; - err = InitCommissionableDataProvider(gCommissionableDataProvider, LinuxDeviceOptions::GetInstance()); + CHIP_ERROR err = CHIP_NO_ERROR; + err = InitCommissionableDataProvider(gSimpleAppCommissionableDataProvider, LinuxDeviceOptions::GetInstance()); if (err != CHIP_NO_ERROR) { ChipLogError(AppServer, @@ -482,7 +482,8 @@ CHIP_ERROR CommandHandler(int argc, char ** argv) } // Update the CommissionableDataProvider stored in this CastingApp's AppParameters and the CommissionableDataProvider to // be used for the commissioning session. - err = matter::casting::core::CastingApp::GetInstance()->UpdateCommissionableDataProvider(&gCommissionableDataProvider); + err = matter::casting::core::CastingApp::GetInstance()->UpdateCommissionableDataProvider( + &gSimpleAppCommissionableDataProvider); if (err != CHIP_NO_ERROR) { ChipLogError(AppServer, diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter index d4064ec1dccc64..06fba3e02f952a 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -202,7 +219,7 @@ cluster OnOff = 6 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -438,7 +455,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -454,12 +471,42 @@ cluster AccessControl = 31 { 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; @@ -495,17 +542,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -590,7 +661,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap b/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap index c9cc4c8e9eb598..4f234c23f8eadb 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap @@ -19,18 +19,18 @@ "package": [ { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/zcl/zcl.json", - "type": "zcl-properties", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", "category": "matter", - "version": 1, - "description": "Matter SDK ZCL data" + "version": "chip-v1" }, { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", + "path": "../../../src/app/zap-templates/zcl/zcl.json", + "type": "zcl-properties", "category": "matter", - "version": "chip-v1" + "version": 1, + "description": "Matter SDK ZCL data" } ], "endpointTypes": [ @@ -3127,7 +3127,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter b/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter index 0de556963e6953..0a5e801e302ad2 100644 --- a/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter +++ b/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -259,7 +276,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -275,12 +292,42 @@ cluster AccessControl = 31 { 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; @@ -316,17 +363,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -411,7 +482,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1900,14 +1971,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + 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; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -2019,7 +2097,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** 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; @@ -2843,7 +2921,7 @@ cluster WindowCovering = 258 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -3714,7 +3792,7 @@ endpoint 1 { callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 1; - ram attribute clusterRevision default = 6; + ram attribute clusterRevision default = 7; handle command MoveToHue; handle command MoveToSaturation; diff --git a/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap b/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap index 93728b6f5fed7e..5fdeb3f38b60a8 100644 --- a/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap +++ b/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap @@ -6581,7 +6581,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/window-app/common/window-app.matter b/examples/window-app/common/window-app.matter index f39cb7187446bc..ca06461be78396 100644 --- a/examples/window-app/common/window-app.matter +++ b/examples/window-app/common/window-app.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -166,7 +183,7 @@ cluster Descriptor = 29 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -182,12 +199,42 @@ cluster AccessControl = 31 { 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; @@ -223,17 +270,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides attributes and events for determining basic information about Nodes, which supports both @@ -318,7 +389,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1828,7 +1899,7 @@ cluster UserLabel = 65 { /** Allows servers to ensure that listed clients are notified when a server is available for communication. */ cluster IcdManagement = 70 { - revision 2; + revision 3; enum ClientTypeEnum : enum8 { kPermanent = 0; @@ -1844,6 +1915,7 @@ cluster IcdManagement = 70 { kCheckInProtocolSupport = 0x1; kUserActiveModeTrigger = 0x2; kLongIdleTimeSupport = 0x4; + kDynamicSitLitSupport = 0x8; } bitmap UserActiveModeTriggerBitmap : bitmap32 { @@ -1882,6 +1954,7 @@ cluster IcdManagement = 70 { 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; @@ -2481,7 +2554,7 @@ endpoint 0 { callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0x0000; - ram attribute clusterRevision default = 2; + ram attribute clusterRevision default = 3; } } endpoint 1 { diff --git a/examples/window-app/common/window-app.zap b/examples/window-app/common/window-app.zap index 5f689678cb9415..ae2f7195f18070 100644 --- a/examples/window-app/common/window-app.zap +++ b/examples/window-app/common/window-app.zap @@ -19,18 +19,18 @@ "package": [ { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/zcl/zcl.json", - "type": "zcl-properties", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", "category": "matter", - "version": 1, - "description": "Matter SDK ZCL data" + "version": "chip-v1" }, { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", + "path": "../../../src/app/zap-templates/zcl/zcl.json", + "type": "zcl-properties", "category": "matter", - "version": "chip-v1" + "version": 1, + "description": "Matter SDK ZCL data" } ], "endpointTypes": [ @@ -5205,7 +5205,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/window-app/nrfconnect/CMakeLists.txt b/examples/window-app/nrfconnect/CMakeLists.txt index 21eee307f1f388..e6f7ebca632047 100644 --- a/examples/window-app/nrfconnect/CMakeLists.txt +++ b/examples/window-app/nrfconnect/CMakeLists.txt @@ -23,14 +23,6 @@ get_filename_component(WIN_APP_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../common/ include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) -# Set Kconfig root files that will be processed as a first Kconfig for used child images. -set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root) -set(multiprotocol_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root) - -if(NOT CONF_FILE STREQUAL "prj_no_dfu.conf") - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static_dfu.yml) -endif() - list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) @@ -42,6 +34,7 @@ target_compile_options(app PRIVATE -Werror -Wno-error=maybe-uninitialized) project(chip-nrfconnect-window-app-example) +include(${CHIP_ROOT}/config/nrfconnect/app/check-sysbuild-use.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/enable-gnu-std.cmake) include(${CHIP_ROOT}/config/nrfconnect/app/flashing.cmake) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) diff --git a/examples/window-app/nrfconnect/Kconfig.sysbuild b/examples/window-app/nrfconnect/Kconfig.sysbuild new file mode 100644 index 00000000000000..8877de44e2d570 --- /dev/null +++ b/examples/window-app/nrfconnect/Kconfig.sysbuild @@ -0,0 +1,76 @@ +# +# 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. +# + +#### Radio core selection +config NRF_DEFAULT_IPC_RADIO + default y + +# Enable IEEE802.15.4 serialization to network core +config NETCORE_IPC_RADIO_IEEE802154 + default y if SOC_SERIES_NRF53X + +# Enable Bluetooth serialization to network core +config NETCORE_IPC_RADIO_BT_HCI_IPC + default y if SOC_SERIES_NRF53X + +#### Bootloader +choice BOOTLOADER + default BOOTLOADER_MCUBOOT +endchoice + +if BOOTLOADER_MCUBOOT + +#### DFU multi-image support +config DFU_MULTI_IMAGE_PACKAGE_BUILD + default y + +config DFU_MULTI_IMAGE_PACKAGE_APP + default y + +config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY + default y + +#### DFU network core configuration +if SOC_SERIES_NRF53X + +config MCUBOOT_UPDATEABLE_IMAGES + default 2 + +choice MCUBOOT_MODE + default MCUBOOT_MODE_OVERWRITE_ONLY +endchoice + +choice BOOT_SIGNATURE_TYPE + default BOOT_SIGNATURE_TYPE_RSA +endchoice + +config SECURE_BOOT_NETCORE + default y + +config NETCORE_APP_UPDATE + default y + +config DFU_MULTI_IMAGE_PACKAGE_NET + default y + +endif # SOC_SERIES_NRF53X +endif # BOOTLOADER_MCUBOOT + +#### Enable generating factory data +config MATTER_FACTORY_DATA_GENERATE + default y + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/examples/window-app/nrfconnect/README.md b/examples/window-app/nrfconnect/README.md index b61f05dddfb15e..964af0c265cb7e 100644 --- a/examples/window-app/nrfconnect/README.md +++ b/examples/window-app/nrfconnect/README.md @@ -1,5 +1,21 @@ # Matter nRF Connect Window Covering Example Application +> **Note:** This example is intended only to perform smoke tests of a Matter +> solution integrated with nRF Connect SDK platform. The example quality is not +> production ready and it may contain minor bugs or use not optimal +> configuration. It is not recommended to use this example as a basis for +> creating a market ready product. +> +> For the production ready and optimized Matter samples, see +> [nRF Connect SDK samples](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/matter.html). +> The Matter samples in nRF Connect SDK use various additional software +> components and provide multiple optional features that improve the developer +> and user experience. To read more about it, see +> [Matter support in nRF Connect SDK](https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/matter/index.html#ug-matter) +> page. Using Matter samples from nRF Connect SDK allows you to get a full +> Nordic technical support via [DevZone](https://devzone.nordicsemi.com/) +> portal. + The nRF Connect Window Covering Example demonstrates how to remotely control a window shutter device. It uses buttons to test changing cover position and device states and LEDs to show the state of these changes. You can use this @@ -131,8 +147,8 @@ The example supports building and running on the following devices: | Hardware platform | Build target | Platform image | | ----------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | -| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk_nrf52840` |
nRF52840 DKnRF52840 DK
| -| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk_nrf5340_cpuapp` |
nRF5340 DKnRF5340 DK
| +| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk/nrf52840` |
nRF52840 DKnRF52840 DK
| +| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk/nrf5340/cpuapp` |
nRF5340 DKnRF5340 DK
|
@@ -299,14 +315,15 @@ Complete the following steps to build the sample: 2. Run the following command to build the example, with _build-target_ replaced with the build target name of the Nordic Semiconductor's kit you own, for - example `nrf52840dk_nrf52840`: + example `nrf52840dk/nrf52840`: - $ west build -b build-target + $ west build -b build-target --sysbuild You only need to specify the build target on the first build. See [Requirements](#requirements) for the build target names of compatible kits. -The output `zephyr.hex` file will be available in the `build/zephyr/` directory. +The output `zephyr.hex` file will be available in the `build/nrfconnect/zephyr/` +directory. ### Removing build artifacts @@ -321,7 +338,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DCONF_FILE=prj_release.conf + $ west build -b build-target --sysbuild -- -DFILE_SUFFIX=release Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -332,18 +349,12 @@ Support for DFU using Matter OTA is enabled by default. To enable DFU over Bluetooth LE, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are -using (for example `nrf52840dk_nrf52840`): +using (for example `nrf52840dk/nrf52840`): ``` - $ west build -b build-target -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y + $ west build -b build-target --sysbuild -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y ``` -To completely disable support for DFU, run the following command with -_build-target_ replaced with the build target name of the Nordic Semiconductor -kit you are using (for example `nrf52840dk_nrf52840`): - - $ west build -b build-target -- -DCONF_FILE=prj_no_dfu.conf - > **Note**: > > There are two types of Device Firmware Upgrade modes: single-image DFU and @@ -356,7 +367,7 @@ kit you are using (for example `nrf52840dk_nrf52840`): #### Changing bootloader configuration To change the default MCUboot configuration, edit the `prj.conf` file located in -the `child_image/mcuboot` directory. +the `sysbuild/mcuboot` directory. Make sure to keep the configuration consistent with changes made to the application configuration. This is necessary for the configuration to work, as @@ -373,8 +384,9 @@ purposes. You can change these settings by defining This example uses this option to define using an external flash. To modify the flash settings of your board (that is, your _build-target_, for -example `nrf52840dk_nrf52840`), edit the `pm_static_dfu.yml` file located in the -`configuration/build-target/` directory. +example `nrf52840dk/nrf52840`), edit the `pm_static_.yml` file +(for example `pm_static_nrf52840dk_nrf52840.yml`), located in the main +application directory.
@@ -386,7 +398,7 @@ using the menuconfig utility. To open the menuconfig utility, run the following command from the example directory: - $ west build -b build-target -t menuconfig + $ west build -b build-target --sysbuild -t menuconfig Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -416,9 +428,6 @@ depending on the selected board: command-line shell. - release — Release version of the application - can be used to enable only the necessary application functionalities to optimize its performance. -- no_dfu — Debug version of the application without Device Firmware - Upgrade feature support - can be used only for the nRF52840 DK and nRF5340 - DK, as those platforms have DFU enabled by default. For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) diff --git a/examples/window-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/window-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/window-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/window-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay b/examples/window-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/window-app/nrfconnect/child_image/mcuboot/boards/nrf52840dk_nrf52840_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/window-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/window-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index f18e3e0cc16434..00000000000000 --- a/examples/window-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/window-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay b/examples/window-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay deleted file mode 100644 index 0728eff3db8377..00000000000000 --- a/examples/window-app/nrfconnect/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp_release.overlay +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; -}; diff --git a/examples/window-app/nrfconnect/child_image/mcuboot/prj.conf b/examples/window-app/nrfconnect/child_image/mcuboot/prj.conf deleted file mode 100644 index 287c7829c6a5cf..00000000000000 --- a/examples/window-app/nrfconnect/child_image/mcuboot/prj.conf +++ /dev/null @@ -1,30 +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. -# - -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. - -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" - -# Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. -CONFIG_GPIO=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_USE_SEGGER_RTT=n diff --git a/examples/window-app/nrfconnect/child_image/mcuboot/prj_release.conf b/examples/window-app/nrfconnect/child_image/mcuboot/prj_release.conf deleted file mode 100644 index 287c7829c6a5cf..00000000000000 --- a/examples/window-app/nrfconnect/child_image/mcuboot/prj_release.conf +++ /dev/null @@ -1,30 +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. -# - -# This target uses Kconfig.mcuboot.defaults to set options common for all -# samples using mcuboot. This file should contain only options specific for this sample -# mcuboot configuration or overrides of default values. - -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" - -# Bootloader size optimization -# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding -# in board files. -CONFIG_GPIO=n -CONFIG_CONSOLE=n -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n -CONFIG_USE_SEGGER_RTT=n diff --git a/examples/window-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf b/examples/window-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/window-app/nrfconnect/child_image/multiprotocol_rpmsg/prj.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/window-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf b/examples/window-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/window-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_no_dfu.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/window-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf b/examples/window-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf deleted file mode 100644 index f43614c64500d7..00000000000000 --- a/examples/window-app/nrfconnect/child_image/multiprotocol_rpmsg/prj_release.conf +++ /dev/null @@ -1,25 +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. -# - -# This target uses Kconfig.multiprotocol_rpmsg.defaults to set options common for all -# samples using multiprotocol_rpmsg. This file should contain only options specific for this sample -# multiprotocol_rpmsg configuration or overrides of default values. - -# Disable not used modules that cannot be set in Kconfig.multiprotocol_rpmsg.defaults due to overriding -# in board files. - -CONFIG_SERIAL=n -CONFIG_UART_CONSOLE=n diff --git a/examples/window-app/nrfconnect/main/WindowCovering.cpp b/examples/window-app/nrfconnect/main/WindowCovering.cpp index f0cf55b775b0a8..cbeb50afec605d 100644 --- a/examples/window-app/nrfconnect/main/WindowCovering.cpp +++ b/examples/window-app/nrfconnect/main/WindowCovering.cpp @@ -59,9 +59,9 @@ void WindowCovering::DriveCurrentLiftPosition(intptr_t) NPercent100ths positionToSet{}; VerifyOrReturn(Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), current) == - Protocols::InteractionModel::Status::Success); + chip::Protocols::InteractionModel::Status::Success); VerifyOrReturn(Attributes::TargetPositionLiftPercent100ths::Get(Endpoint(), target) == - Protocols::InteractionModel::Status::Success); + chip::Protocols::InteractionModel::Status::Success); OperationalState state = ComputeOperationalState(target, current); UpdateOperationalStatus(MoveType::LIFT, state); @@ -87,7 +87,7 @@ void WindowCovering::DriveCurrentLiftPosition(intptr_t) Instance().mInLiftMove = false; VerifyOrReturn(Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), current) == - Protocols::InteractionModel::Status::Success); + chip::Protocols::InteractionModel::Status::Success); if (!TargetCompleted(MoveType::LIFT, current, target)) { @@ -103,7 +103,7 @@ void WindowCovering::DriveCurrentLiftPosition(intptr_t) chip::Percent100ths WindowCovering::CalculateNextPosition(MoveType aMoveType) { - Protocols::InteractionModel::Status status{}; + chip::Protocols::InteractionModel::Status status{}; chip::Percent100ths percent100ths{}; NPercent100ths current{}; OperationalState opState{}; @@ -119,7 +119,7 @@ chip::Percent100ths WindowCovering::CalculateNextPosition(MoveType aMoveType) opState = OperationalStateGet(Endpoint(), OperationalStatus::kTilt); } - if ((status == Protocols::InteractionModel::Status::Success) && !current.IsNull()) + if ((status == chip::Protocols::InteractionModel::Status::Success) && !current.IsNull()) { static constexpr auto sPercentDelta{ WC_PERCENT100THS_MAX_CLOSED / 20 }; percent100ths = ComputePercent100thsStep(opState, current.Value(), sPercentDelta); @@ -171,9 +171,9 @@ void WindowCovering::DriveCurrentTiltPosition(intptr_t) NPercent100ths positionToSet{}; VerifyOrReturn(Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), current) == - Protocols::InteractionModel::Status::Success); + chip::Protocols::InteractionModel::Status::Success); VerifyOrReturn(Attributes::TargetPositionTiltPercent100ths::Get(Endpoint(), target) == - Protocols::InteractionModel::Status::Success); + chip::Protocols::InteractionModel::Status::Success); OperationalState state = ComputeOperationalState(target, current); UpdateOperationalStatus(MoveType::TILT, state); @@ -199,7 +199,7 @@ void WindowCovering::DriveCurrentTiltPosition(intptr_t) Instance().mInTiltMove = false; VerifyOrReturn(Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), current) == - Protocols::InteractionModel::Status::Success); + chip::Protocols::InteractionModel::Status::Success); if (!TargetCompleted(MoveType::TILT, current, target)) { @@ -261,7 +261,7 @@ void WindowCovering::UpdateOperationalStatus(MoveType aMoveType, OperationalStat void WindowCovering::SetTargetPosition(OperationalState aDirection, chip::Percent100ths aPosition) { - Protocols::InteractionModel::Status status{}; + chip::Protocols::InteractionModel::Status status{}; if (Instance().mCurrentUIMoveType == MoveType::LIFT) { status = Attributes::TargetPositionLiftPercent100ths::Set(Endpoint(), aPosition); @@ -271,7 +271,7 @@ void WindowCovering::SetTargetPosition(OperationalState aDirection, chip::Percen status = Attributes::TargetPositionTiltPercent100ths::Set(Endpoint(), aPosition); } - if (status != Protocols::InteractionModel::Status::Success) + if (status != chip::Protocols::InteractionModel::Status::Success) { LOG_ERR("Cannot set the target position. Error: %d", static_cast(status)); } @@ -279,13 +279,13 @@ void WindowCovering::SetTargetPosition(OperationalState aDirection, chip::Percen void WindowCovering::PositionLEDUpdate(MoveType aMoveType) { - Protocols::InteractionModel::Status status{}; + chip::Protocols::InteractionModel::Status status{}; NPercent100ths currentPosition{}; if (aMoveType == MoveType::LIFT) { status = Attributes::CurrentPositionLiftPercent100ths::Get(Endpoint(), currentPosition); - if (Protocols::InteractionModel::Status::Success == status && !currentPosition.IsNull()) + if (chip::Protocols::InteractionModel::Status::Success == status && !currentPosition.IsNull()) { Instance().SetBrightness(MoveType::LIFT, currentPosition.Value()); } @@ -293,7 +293,7 @@ void WindowCovering::PositionLEDUpdate(MoveType aMoveType) else if (aMoveType == MoveType::TILT) { status = Attributes::CurrentPositionTiltPercent100ths::Get(Endpoint(), currentPosition); - if (Protocols::InteractionModel::Status::Success == status && !currentPosition.IsNull()) + if (chip::Protocols::InteractionModel::Status::Success == status && !currentPosition.IsNull()) { Instance().SetBrightness(MoveType::TILT, currentPosition.Value()); } diff --git a/examples/window-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml b/examples/window-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml new file mode 100644 index 00000000000000..ce42b39e55ee87 --- /dev/null +++ b/examples/window-app/nrfconnect/pm_static_nrf52840dk_nrf52840.yml @@ -0,0 +1,42 @@ +mcuboot: + address: 0x0 + size: 0x7000 + region: flash_primary +mcuboot_pad: + address: 0x7000 + size: 0x200 +app: + address: 0x7200 + size: 0xf3e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x7000 + size: 0xf4000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x7200 + size: 0xf3e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_secondary: + address: 0x0 + size: 0xf4000 + device: MX25R64 + region: external_flash +external_flash: + address: 0xf4000 + size: 0x70c000 + device: MX25R64 + region: external_flash diff --git a/examples/window-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml b/examples/window-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml new file mode 100644 index 00000000000000..ce42b39e55ee87 --- /dev/null +++ b/examples/window-app/nrfconnect/pm_static_nrf52840dk_nrf52840_release.yml @@ -0,0 +1,42 @@ +mcuboot: + address: 0x0 + size: 0x7000 + region: flash_primary +mcuboot_pad: + address: 0x7000 + size: 0x200 +app: + address: 0x7200 + size: 0xf3e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x7000 + size: 0xf4000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x7200 + size: 0xf3e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_secondary: + address: 0x0 + size: 0xf4000 + device: MX25R64 + region: external_flash +external_flash: + address: 0xf4000 + size: 0x70c000 + device: MX25R64 + region: external_flash diff --git a/examples/window-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml b/examples/window-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml new file mode 100644 index 00000000000000..10e8680c363a53 --- /dev/null +++ b/examples/window-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp.yml @@ -0,0 +1,56 @@ +mcuboot: + address: 0x0 + size: 0x8000 + region: flash_primary +mcuboot_pad: + address: 0x8000 + size: 0x200 +app: + address: 0x8200 + size: 0xf2e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x8000 + size: 0xf3000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x8200 + size: 0xf2e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x0 + size: 0xf3000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xf3000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x133000 + size: 0x6CD000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/examples/window-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml b/examples/window-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml new file mode 100644 index 00000000000000..10e8680c363a53 --- /dev/null +++ b/examples/window-app/nrfconnect/pm_static_nrf5340dk_nrf5340_cpuapp_release.yml @@ -0,0 +1,56 @@ +mcuboot: + address: 0x0 + size: 0x8000 + region: flash_primary +mcuboot_pad: + address: 0x8000 + size: 0x200 +app: + address: 0x8200 + size: 0xf2e00 +mcuboot_primary: + orig_span: &id001 + - mcuboot_pad + - app + span: *id001 + address: 0x8000 + size: 0xf3000 + region: flash_primary +mcuboot_primary_app: + orig_span: &id002 + - app + span: *id002 + address: 0x8200 + size: 0xf2e00 +factory_data: + address: 0xfb000 + size: 0x1000 + region: flash_primary +settings_storage: + address: 0xfc000 + size: 0x4000 + region: flash_primary +mcuboot_primary_1: + address: 0x0 + size: 0x40000 + device: flash_ctrl + region: ram_flash +mcuboot_secondary: + address: 0x0 + size: 0xf3000 + device: MX25R64 + region: external_flash +mcuboot_secondary_1: + address: 0xf3000 + size: 0x40000 + device: MX25R64 + region: external_flash +external_flash: + address: 0x133000 + size: 0x6CD000 + device: MX25R64 + region: external_flash +pcd_sram: + address: 0x20000000 + size: 0x2000 + region: sram_primary diff --git a/examples/window-app/nrfconnect/prj.conf b/examples/window-app/nrfconnect/prj.conf index 392e84ee268a54..64d257fe211082 100644 --- a/examples/window-app/nrfconnect/prj.conf +++ b/examples/window-app/nrfconnect/prj.conf @@ -21,6 +21,13 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 CONFIG_STD_CPP17=y +# Enable Matter pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/window-app/nrfconnect/prj_no_dfu.conf b/examples/window-app/nrfconnect/prj_no_dfu.conf deleted file mode 100644 index 570011cc9ef6da..00000000000000 --- a/examples/window-app/nrfconnect/prj_no_dfu.conf +++ /dev/null @@ -1,62 +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. -# - -# This sample uses Kconfig.defaults to set options common for all -# samples. This file should contain only options specific for this sample -# or overrides of default values. - -# Enable CHIP -CONFIG_CHIP=y -CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" -# 32784 == 0x8010 (example window-app) -CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 -CONFIG_STD_CPP17=y - -# Add support for LEDs and buttons on Nordic development kits -CONFIG_DK_LIBRARY=y -CONFIG_PWM=y - -# PWM support -CONFIG_PWM=y - -# OpenThread configs -CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y -CONFIG_OPENTHREAD_MTD=y -CONFIG_OPENTHREAD_FTD=n -CONFIG_CHIP_ENABLE_ICD_SUPPORT=y -CONFIG_CHIP_THREAD_SSED=y -CONFIG_CHIP_ICD_SLOW_POLL_INTERVAL=500 -CONFIG_CHIP_ICD_FAST_POLLING_INTERVAL=500 - -# Bluetooth Low Energy configuration -CONFIG_BT_DEVICE_NAME="MatterWinCov" - -# Stack size settings -CONFIG_IEEE802154_NRF5_RX_STACK_SIZE=1024 - -# Other settings -CONFIG_THREAD_NAME=y -CONFIG_MPU_STACK_GUARD=y -CONFIG_RESET_ON_FATAL_ERROR=n - -# Reduce application size -CONFIG_USE_SEGGER_RTT=n - -# Disable Matter OTA DFU -CONFIG_CHIP_OTA_REQUESTOR=n - -# Disable QSPI NOR -CONFIG_CHIP_QSPI_NOR=n diff --git a/examples/window-app/nrfconnect/prj_release.conf b/examples/window-app/nrfconnect/prj_release.conf index e7859efaa81de6..b15a68ea3caa8b 100644 --- a/examples/window-app/nrfconnect/prj_release.conf +++ b/examples/window-app/nrfconnect/prj_release.conf @@ -25,6 +25,13 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 CONFIG_STD_CPP17=y +# Enable Matter pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Enable Matter extended announcement and increase duration to 1 hour. +CONFIG_CHIP_BLE_EXT_ADVERTISING=y +CONFIG_CHIP_BLE_ADVERTISING_DURATION=60 + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y CONFIG_PWM=y diff --git a/examples/window-app/nrfconnect/sysbuild.conf b/examples/window-app/nrfconnect/sysbuild.conf new file mode 100644 index 00000000000000..d0c5eee2b93c39 --- /dev/null +++ b/examples/window-app/nrfconnect/sysbuild.conf @@ -0,0 +1,17 @@ +# +# 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. +# + +SB_CONFIG_MATTER=y diff --git a/examples/window-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf b/examples/window-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf new file mode 100644 index 00000000000000..8540585e53358b --- /dev/null +++ b/examples/window-app/nrfconnect/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf @@ -0,0 +1,58 @@ +# +# 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. +# + +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# 802.15.4 configuration +CONFIG_NRF_802154_SER_RADIO=y +CONFIG_NRF_802154_ENCRYPTION=y +CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=2 + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_DEBUG_INFO=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y +CONFIG_IPC_RADIO_802154=y diff --git a/examples/window-app/nrfconnect/sysbuild/ipc_radio/prj.conf b/examples/window-app/nrfconnect/sysbuild/ipc_radio/prj.conf new file mode 100644 index 00000000000000..8906415dda4fc7 --- /dev/null +++ b/examples/window-app/nrfconnect/sysbuild/ipc_radio/prj.conf @@ -0,0 +1,21 @@ +# +# 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. +# + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=n diff --git a/examples/window-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf b/examples/window-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf new file mode 100644 index 00000000000000..7f92a51630cce0 --- /dev/null +++ b/examples/window-app/nrfconnect/sysbuild/ipc_radio/prj_release.conf @@ -0,0 +1,20 @@ +# +# 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. +# +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=y diff --git a/examples/window-app/nrfconnect/sysbuild/mcuboot/app.overlay b/examples/window-app/nrfconnect/sysbuild/mcuboot/app.overlay new file mode 100644 index 00000000000000..74d3dfbfd22f30 --- /dev/null +++ b/examples/window-app/nrfconnect/sysbuild/mcuboot/app.overlay @@ -0,0 +1,5 @@ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/examples/window-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf b/examples/window-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf new file mode 100644 index 00000000000000..50610217c762b5 --- /dev/null +++ b/examples/window-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf @@ -0,0 +1,19 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 diff --git a/examples/window-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay b/examples/window-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/window-app/nrfconnect/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/window-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/window-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf new file mode 100644 index 00000000000000..2d86fe6442dd39 --- /dev/null +++ b/examples/window-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -0,0 +1,35 @@ +# +# 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. +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 + +CONFIG_BOOT_SWAP_USING_MOVE=n +# Multi-image updates do not support image swapping yet. +CONFIG_BOOT_UPGRADE_ONLY=y + +# The network core cannot access external flash directly. The flash simulator must be used to +# provide a memory region that is used to forward the new firmware to the network core. +CONFIG_FLASH_SIMULATOR=y +CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y +CONFIG_FLASH_SIMULATOR_STATS=n + +CONFIG_ZCBOR=y diff --git a/examples/window-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/window-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 00000000000000..054f04712058a3 --- /dev/null +++ b/examples/window-app/nrfconnect/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -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. + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/examples/window-app/nrfconnect/sysbuild/mcuboot/prj.conf b/examples/window-app/nrfconnect/sysbuild/mcuboot/prj.conf new file mode 100644 index 00000000000000..3bcb12fe7b8d25 --- /dev/null +++ b/examples/window-app/nrfconnect/sysbuild/mcuboot/prj.conf @@ -0,0 +1,49 @@ +# +# 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. +# + +CONFIG_MAIN_STACK_SIZE=10240 + +CONFIG_BOOT_SWAP_SAVE_ENCTLV=n +CONFIG_BOOT_BOOTSTRAP=n +CONFIG_PM=n + +CONFIG_FLASH=y +CONFIG_FPROTECT=y + +CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" + +# Use minimal C library instead of the Picolib +CONFIG_MINIMAL_LIBC=y + +# Bootloader size optimization +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_GPIO=n + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +CONFIG_LOG=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_NCS_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/window-app/telink/README.md b/examples/window-app/telink/README.md index 9d35cbc2d5a360..ee788a7b018f13 100644 --- a/examples/window-app/telink/README.md +++ b/examples/window-app/telink/README.md @@ -7,6 +7,17 @@ for creating your own application. ![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) +## Supported devices + +The example supports building and running on the following devices: + +| Board/SoC | Build target | Zephyr Board Info | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| [B91](https://wiki.telink-semi.cn/wiki/Hardware/B91_Generic_Starter_Kit_Hardware_Guide) [TLSR9518ADK80D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR951x-Series) | `tlsr9518adk80d`, `tlsr9518adk80d-mars`, `tlsr9518adk80d-usb` | [TLSR9518ADK80D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9518adk80d/doc/index.rst) | +| [B92](https://wiki.telink-semi.cn/wiki/Hardware/B92_Generic_Starter_Kit_Hardware_Guide) [TLSR9528A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR952x-Series) | `tlsr9528a`, `tlsr9528a_retention` | [TLSR9528A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9528a/doc/index.rst) | +| [B95](https://wiki.telink-semi.cn/wiki/Hardware/B95_Generic_Starter_Kit_Hardware_Guide) [TLSR9258A](https://wiki.telink-semi.cn/wiki/chip-series/TLSR925x-Series) | `tlsr9258a` | [TLSR9258A](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9258a/doc/index.rst) | +| [W91](https://wiki.telink-semi.cn/wiki/Hardware/W91_Generic_Starter_Kit_Hardware_Guide) [TLSR9118BDK40D](https://wiki.telink-semi.cn/wiki/chip-series/TLSR911x-Series) | `tlsr9118bdk40d` | [TLSR9118BDK40D](https://github.com/telink-semi/zephyr/blob/develop/boards/riscv/tlsr9118bdk40d/doc/index.rst) | + ## Build and flash 1. Run the Docker container: @@ -15,7 +26,7 @@ for creating your own application. $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}') ``` - Compatible docker image version can be found in next file: + You can find the compatible Docker image version in the file: ```bash $ .github/workflows/examples-telink.yaml @@ -27,8 +38,8 @@ for creating your own application. $ source ./scripts/activate.sh -p all,telink ``` -3. In the example dir run (replace __ with your board name, for - example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`): +3. Build the example (replace __ with your board name, see + [Supported devices](#supported-devices)): ```bash $ west build -b @@ -38,9 +49,12 @@ for creating your own application. MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=4m`: ```bash - $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + $ west build -b -- -DFLASH_SIZE=4m ``` + You can find the target built file called **_zephyr.bin_** under the + **_build/zephyr_** directory. + 4. Flash binary: ``` @@ -59,16 +73,18 @@ To get output from device, connect UART to following pins: | TX | PB2 (pin 16 of J34 connector) | | GND | GND | +Baud rate: 115200 bits/s + ### Buttons The following buttons are available on **tlsr9518adk80d** board: -| Name | Function | Description | -| :------- | :-------------------------------- | :------------------------------------------------------------------------------------------------------------------- | -| Button 1 | Factory reset | Triple press performs factory reset to forget currently commissioned Thread network and back to uncommissioned state | -| Button 2 | Open and Toggle Move Type control | Manually triggers the Open state by one press and double press triggers the Lift-Tilt move type | -| Button 3 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | -| Button 4 | Close control | Manually triggers the Close state by one press | +| Name | Function | Description | +| :------- | :-------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and return to a decommissioned state (to activate, push the button 3 times) | +| Button 2 | Open and Toggle Move Type control | Manually triggers the Open state by one press and double press triggers the Lift-Tilt move type | +| Button 3 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | +| Button 4 | Close control | Manually triggers the Close state by one press | ### LEDs @@ -254,9 +270,9 @@ application of OTA image. The RPCs in `lighting-common/lighting_service/lighting_service.proto` can be used to control various functionalities of the lighting app from a USB-connected host computer. To build the example with the RPC server, run the following -command with _build-target_ replaced with the build target name of the Nordic +command with __ replaced with the build target name of the Telink Semiconductor's kit you own: ``` - $ west build -b tlsr9518adk80d -- -DOVERLAY_CONFIG=rpc.overlay + $ west build -b -- -DOVERLAY_CONFIG=rpc.overlay ``` diff --git a/integrations/cloudbuild/chef.yaml b/integrations/cloudbuild/chef.yaml index 2795c6b5095cd5..0c4035fcb60973 100644 --- a/integrations/cloudbuild/chef.yaml +++ b/integrations/cloudbuild/chef.yaml @@ -1,5 +1,5 @@ steps: - - name: "ghcr.io/project-chip/chip-build-vscode:54" + - name: "ghcr.io/project-chip/chip-build-vscode:66" entrypoint: "bash" args: - "-c" @@ -7,7 +7,7 @@ steps: git config --global --add safe.directory "*" python scripts/checkout_submodules.py --shallow --recursive --platform esp32 nrfconnect silabs linux android id: Submodules - - name: "ghcr.io/project-chip/chip-build-vscode:54" + - name: "ghcr.io/project-chip/chip-build-vscode:66" # NOTE: silabs boostrap is NOT done with the rest as it requests a conflicting # jinja2 version (asks for 3.1.3 when constraints.txt asks for 3.0.3) env: @@ -23,7 +23,7 @@ steps: - name: pwenv path: /pwenv timeout: 900s - - name: "ghcr.io/project-chip/chip-build-vscode:54" + - name: "ghcr.io/project-chip/chip-build-vscode:66" env: - PW_ENVIRONMENT_ROOT=/pwenv args: @@ -38,7 +38,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:54" + - name: "ghcr.io/project-chip/chip-build-vscode:66" env: - PW_ENVIRONMENT_ROOT=/pwenv args: diff --git a/integrations/cloudbuild/smoke-test.yaml b/integrations/cloudbuild/smoke-test.yaml index 77e5647aab9e53..ef69af5db73481 100644 --- a/integrations/cloudbuild/smoke-test.yaml +++ b/integrations/cloudbuild/smoke-test.yaml @@ -1,5 +1,5 @@ steps: - - name: "ghcr.io/project-chip/chip-build-vscode:54" + - name: "ghcr.io/project-chip/chip-build-vscode:66" entrypoint: "bash" args: - "-c" @@ -7,7 +7,7 @@ steps: git config --global --add safe.directory "*" python scripts/checkout_submodules.py --shallow --recursive --platform esp32 nrfconnect silabs linux android id: Submodules - - name: "ghcr.io/project-chip/chip-build-vscode:54" + - name: "ghcr.io/project-chip/chip-build-vscode:66" # NOTE: silabs boostrap is NOT done with the rest as it requests a conflicting # jinja2 version (asks for 3.1.3 when constraints.txt asks for 3.0.3) env: @@ -24,7 +24,7 @@ steps: path: /pwenv timeout: 900s - - name: "ghcr.io/project-chip/chip-build-vscode:54" + - name: "ghcr.io/project-chip/chip-build-vscode:66" id: ESP32 env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -45,7 +45,7 @@ steps: volumes: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:54" + - name: "ghcr.io/project-chip/chip-build-vscode:66" id: NRFConnect env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -66,7 +66,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:54" + - name: "ghcr.io/project-chip/chip-build-vscode:66" id: EFR32 env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -75,7 +75,7 @@ steps: ./scripts/build/build_examples.py --enable-flashbundle --target efr32-brd4187c-light --target efr32-brd4187c-light-rpc - --target efr32-brd4187cbrd4187c-lock-openthread-mtd + --target efr32-brd4187c-lock-openthread-mtd --target efr32-brd4187c-lock-rpc-openthread-mtd --target efr32-brd4187c-unit-test build @@ -88,7 +88,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:54" + - name: "ghcr.io/project-chip/chip-build-vscode:66" id: Linux env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -141,7 +141,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:54" + - name: "ghcr.io/project-chip/chip-build-vscode:66" id: Android env: - PW_ENVIRONMENT_ROOT=/pwenv diff --git a/integrations/docker/images/base/chip-build/version b/integrations/docker/images/base/chip-build/version index d9a04eb8c7a142..9f538399a5cf06 100644 --- a/integrations/docker/images/base/chip-build/version +++ b/integrations/docker/images/base/chip-build/version @@ -1 +1 @@ -62 : Fix ESP32 qemu build +67 : [ESP32] Update esp-idf to v5.3 diff --git a/integrations/docker/images/chip-cert-bins/Dockerfile b/integrations/docker/images/chip-cert-bins/Dockerfile index 5fe42c49dba935..60b0e00863d403 100644 --- a/integrations/docker/images/chip-cert-bins/Dockerfile +++ b/integrations/docker/images/chip-cert-bins/Dockerfile @@ -1,6 +1,6 @@ # Stage 1: Setup dependencies (based on chip-build). -FROM ubuntu:24.04 as chip-build-cert -LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip +FROM ubuntu:24.04 AS chip-build-cert +LABEL org.opencontainers.image.source=https://github.com/project-chip/connectedhomeip ARG TARGETPLATFORM # COMMITHASH defines the target commit to build from. May be passed in using --build-arg. ARG COMMITHASH=c1ec2d777456924dcaa59b53351b00d73caf378f @@ -123,11 +123,11 @@ RUN set -x \ software-properties-common \ && add-apt-repository universe \ && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ - && python3 get-pip.py \ + && python3 get-pip.py --break-system-packages \ && : # last line RUN set -x \ - && pip3 install attrs coloredlogs PyGithub pygit future portpicker mobly click cxxfilt ghapi pandas tabulate \ + && pip3 install attrs coloredlogs PyGithub pygit future portpicker mobly click cxxfilt ghapi pandas tabulate --break-system-packages \ && : # last line # build and install gn @@ -162,7 +162,7 @@ RUN ./scripts/checkout_submodules.py --allow-changing-global-git-config --shallo RUN bash scripts/bootstrap.sh # Stage 2: Build. -FROM chip-build-cert as chip-build-cert-bins +FROM chip-build-cert AS chip-build-cert-bins SHELL ["/bin/bash", "-c"] @@ -260,7 +260,7 @@ RUN case ${TARGETPLATFORM} in \ RUN source scripts/activate.sh && scripts/build_python.sh -m platform -d true -i out/python_env # Stage 3: Copy relevant cert bins to a minimal image to reduce size. -FROM ubuntu:22.04 +FROM ubuntu:24.04 ENV TZ=Etc/UTC RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt-get update -y diff --git a/integrations/docker/images/stage-2/chip-build-esp32/Dockerfile b/integrations/docker/images/stage-2/chip-build-esp32/Dockerfile index 2e41b6b3466e27..b50189201598e1 100644 --- a/integrations/docker/images/stage-2/chip-build-esp32/Dockerfile +++ b/integrations/docker/images/stage-2/chip-build-esp32/Dockerfile @@ -12,7 +12,7 @@ RUN set -x \ && : # last line RUN set -x \ - && git clone --recursive -b v5.1.2 --depth 1 --shallow-submodule https://github.com/espressif/esp-idf.git /tmp/esp-idf \ + && git clone --recursive -b v5.3 --depth 1 --shallow-submodule https://github.com/espressif/esp-idf.git /tmp/esp-idf \ && : # last line FROM ghcr.io/project-chip/chip-build:${VERSION} diff --git a/integrations/docker/images/stage-2/chip-build-nrf-platform/Dockerfile b/integrations/docker/images/stage-2/chip-build-nrf-platform/Dockerfile index 0ec2b78bca1782..57635bdfee1822 100644 --- a/integrations/docker/images/stage-2/chip-build-nrf-platform/Dockerfile +++ b/integrations/docker/images/stage-2/chip-build-nrf-platform/Dockerfile @@ -7,7 +7,7 @@ ARG VERSION=1 FROM ghcr.io/project-chip/chip-build:${VERSION} as build LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip # Compatible Nordic Connect SDK revision. -ARG NCS_REVISION=v2.6.0 +ARG NCS_REVISION=v2.7.0 # Requirements to clone SDKs in temporary container RUN set -x \ diff --git a/integrations/docker/images/stage-2/chip-build-nxp-zephyr/Dockerfile b/integrations/docker/images/stage-2/chip-build-nxp-zephyr/Dockerfile new file mode 100644 index 00000000000000..334ae622c88e08 --- /dev/null +++ b/integrations/docker/images/stage-2/chip-build-nxp-zephyr/Dockerfile @@ -0,0 +1,32 @@ +ARG VERSION=1 +FROM ghcr.io/project-chip/chip-build:${VERSION} AS build +LABEL org.opencontainers.image.source=https://github.com/project-chip/connectedhomeip + +RUN set -x \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \ + xz-utils \ + && : # last line + +WORKDIR /opt/nxp-zephyr +RUN set -x \ + && wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.5/zephyr-sdk-0.16.5_linux-x86_64_minimal.tar.xz \ + && tar xvf zephyr-sdk-0.16.5_linux-x86_64_minimal.tar.xz \ + && rm -rf zephyr-sdk-0.16.5_linux-x86_64_minimal.tar.xz \ + && zephyr-sdk-0.16.5/setup.sh -t arm-zephyr-eabi \ + && pip3 install --break-system-packages -U --no-cache-dir west \ + && west init zephyrproject -m https://github.com/nxp-zephyr-ear/zephyr.git --mr zephyr_rw61x_v3.6_RFP \ + && cd zephyrproject/zephyr \ + && west update -o=--depth=1 -n \ + && west zephyr-export \ + && : # last line + +FROM ghcr.io/project-chip/chip-build:${VERSION} + +COPY --from=build /opt/nxp-zephyr/zephyr-sdk-0.16.5/ /opt/nxp-zephyr/zephyr-sdk-0.16.5/ +COPY --from=build /opt/nxp-zephyr/zephyrproject/ /opt/nxp-zephyr/zephyrproject/ + +WORKDIR /opt/nxp-zephyr + +ENV ZEPHYR_NXP_BASE=/opt/nxp-zephyr/zephyrproject/zephyr +ENV ZEPHYR_NXP_SDK_INSTALL_DIR=/opt/nxp-zephyr/zephyr-sdk-0.16.5 diff --git a/integrations/docker/images/stage-2/chip-build-nxp-zephyr/build.sh b/integrations/docker/images/stage-2/chip-build-nxp-zephyr/build.sh new file mode 120000 index 00000000000000..46b20313461454 --- /dev/null +++ b/integrations/docker/images/stage-2/chip-build-nxp-zephyr/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/integrations/docker/images/stage-2/chip-build-nxp-zephyr/run.sh b/integrations/docker/images/stage-2/chip-build-nxp-zephyr/run.sh new file mode 120000 index 00000000000000..9bbfad86d46e50 --- /dev/null +++ b/integrations/docker/images/stage-2/chip-build-nxp-zephyr/run.sh @@ -0,0 +1 @@ +../../../run.sh \ No newline at end of file diff --git a/integrations/docker/images/stage-2/chip-build-nxp-zephyr/version b/integrations/docker/images/stage-2/chip-build-nxp-zephyr/version new file mode 120000 index 00000000000000..a40ba48b0188a8 --- /dev/null +++ b/integrations/docker/images/stage-2/chip-build-nxp-zephyr/version @@ -0,0 +1 @@ +../../base/chip-build/version \ No newline at end of file diff --git a/integrations/docker/images/stage-2/chip-build-telink/Dockerfile b/integrations/docker/images/stage-2/chip-build-telink/Dockerfile index 66d5eccdc0d3a1..bea580245e8639 100644 --- a/integrations/docker/images/stage-2/chip-build-telink/Dockerfile +++ b/integrations/docker/images/stage-2/chip-build-telink/Dockerfile @@ -18,7 +18,7 @@ RUN set -x \ && : # last line # Setup Zephyr -ARG ZEPHYR_REVISION=ab81a585fca6a83b30e1f4e58a021113d6a3acb8 +ARG ZEPHYR_REVISION=ef7bfc2214602ecf237332b71e6a2bdd69205fbd WORKDIR /opt/telink/zephyrproject RUN set -x \ && python3 -m pip install --break-system-packages -U --no-cache-dir west \ diff --git a/integrations/docker/images/vscode/chip-build-vscode/Dockerfile b/integrations/docker/images/vscode/chip-build-vscode/Dockerfile index e4c4ace95a1341..df6018847acb59 100644 --- a/integrations/docker/images/vscode/chip-build-vscode/Dockerfile +++ b/integrations/docker/images/vscode/chip-build-vscode/Dockerfile @@ -11,6 +11,7 @@ FROM ghcr.io/project-chip/chip-build-crosscompile:${VERSION} AS crosscompile FROM ghcr.io/project-chip/chip-build-ameba:${VERSION} AS ameba FROM ghcr.io/project-chip/chip-build-k32w:${VERSION} AS k32w FROM ghcr.io/project-chip/chip-build-rw61x:${VERSION} AS rw61x +FROM ghcr.io/project-chip/chip-build-nxp-zephyr:${VERSION} AS nxpzephyr FROM ghcr.io/project-chip/chip-build-imx:${VERSION} AS imx FROM ghcr.io/project-chip/chip-build-ti:${VERSION} AS ti FROM ghcr.io/project-chip/chip-build-openiotsdk:${VERSION} AS openiotsdk @@ -50,6 +51,9 @@ COPY --from=k32w /opt/sdk /opt/k32w COPY --from=rw61x /opt/sdk /opt/nxp-sdk +COPY --from=nxpzephyr /opt/nxp-zephyr/zephyr-sdk-0.16.5/ /opt/nxp-zephyr/zephyr-sdk-0.16.5/ +COPY --from=nxpzephyr /opt/nxp-zephyr/zephyrproject/ /opt/nxp-zephyr/zephyrproject/ + COPY --from=imx /opt/fsl-imx-xwayland /opt/fsl-imx-xwayland COPY --from=ti /opt/ti/sysconfig_1.18.1 /opt/ti/sysconfig_1.18.1 @@ -138,6 +142,8 @@ ENV TI_SYSCONFIG_ROOT=/opt/ti/sysconfig_1.18.1 ENV ZEPHYR_BASE=/opt/NordicSemiconductor/nrfconnect/zephyr ENV ZEPHYR_SDK_INSTALL_DIR=/opt/NordicSemiconductor/nRF5_tools/zephyr-sdk-0.16.5 ENV ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb +ENV ZEPHYR_NXP_BASE=/opt/nxp-zephyr/zephyrproject/zephyr +ENV ZEPHYR_NXP_SDK_INSTALL_DIR=/opt/nxp-zephyr/zephyr-sdk-0.16.5 ENV TIZEN_VERSION 7.0 ENV TIZEN_SDK_ROOT /opt/tizen-sdk diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 0a72b3733a96d1..2c5f84ca30ad37 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -28,7 +28,7 @@ from builders.mw320 import MW320App, MW320Builder from builders.nrf import NrfApp, NrfBoard, NrfConnectBuilder from builders.nuttx import NuttXApp, NuttXBoard, NuttXBuilder -from builders.nxp import NxpApp, NxpBoard, NxpBuilder +from builders.nxp import NxpApp, NxpBoard, NxpBuilder, NxpOsUsed from builders.openiotsdk import OpenIotSdkApp, OpenIotSdkBuilder, OpenIotSdkCryptoBackend from builders.qpg import QpgApp, QpgBoard, QpgBuilder from builders.rw61x import RW61XApp, RW61XBuilder @@ -499,13 +499,23 @@ def BuildNxpTarget(): # boards target.AppendFixedTargets([ TargetPart('k32w0', board=NxpBoard.K32W0), - TargetPart('k32w1', board=NxpBoard.K32W1) + TargetPart('k32w1', board=NxpBoard.K32W1), + TargetPart('rw61x', board=NxpBoard.RW61X) + ]) + + # OS + target.AppendFixedTargets([ + TargetPart('zephyr', os_env=NxpOsUsed.ZEPHYR).OnlyIfRe('rw61x'), + TargetPart('freertos', os_env=NxpOsUsed.FREERTOS).ExceptIfRe('rw61x'), ]) # apps target.AppendFixedTargets([ TargetPart('lighting', app=NxpApp.LIGHTING).OnlyIfRe('(k32w0|k32w1)'), - TargetPart('contact-sensor', app=NxpApp.CONTACT).OnlyIfRe('(k32w0|k32w1)') + TargetPart('contact-sensor', app=NxpApp.CONTACT).OnlyIfRe('(k32w0|k32w1)'), + TargetPart('all-clusters', app=NxpApp.ALLCLUSTERS).OnlyIfRe('rw61x'), + TargetPart('laundry-washer', app=NxpApp.LAUNDRYWASHER).OnlyIfRe('rw61x'), + TargetPart('thermostat', app=NxpApp.THERMOSTAT).OnlyIfRe('rw61x') ]) target.AppendModifier(name="factory", enable_factory_data=True) @@ -513,8 +523,8 @@ def BuildNxpTarget(): target.AppendModifier(name="lit", enable_lit=True).OnlyIfRe('contact-sensor') target.AppendModifier(name="fro32k", use_fro32k=True).OnlyIfRe('k32w0') target.AppendModifier(name="smu2", smu2=True).OnlyIfRe('k32w1-lighting') - target.AppendModifier(name="dac-conversion", convert_dac_pk=True).OnlyIfRe('factory').ExceptIfRe('k32w0') - target.AppendModifier(name="rotating-id", enable_rotating_id=True) + target.AppendModifier(name="dac-conversion", convert_dac_pk=True).OnlyIfRe('factory').ExceptIfRe('(k32w0|rw61x)') + target.AppendModifier(name="rotating-id", enable_rotating_id=True).ExceptIfRe('rw61x') target.AppendModifier(name="sw-v2", has_sw_version_2=True) return target @@ -774,6 +784,7 @@ def BuildTelinkTarget(): target.AppendModifier('factory-data', enable_factory_data=True) target.AppendModifier('4mb', enable_4mb_flash=True) target.AppendModifier('mars', mars_board_config=True) + target.AppendModifier('usb', usb_board_config=True) return target diff --git a/scripts/build/builders/host.py b/scripts/build/builders/host.py index 79d6b849a32aeb..4ea5a9aae0f836 100644 --- a/scripts/build/builders/host.py +++ b/scripts/build/builders/host.py @@ -256,6 +256,9 @@ def OutputNames(self): elif self == HostApp.LIT_ICD: yield 'lit-icd-app' yield 'lit-icd-app.map' + elif self == HostApp.NETWORK_MANAGER: + yield 'matter-network-manager-app' + yield 'matter-network-manager-app.map' elif self == HostApp.ENERGY_MANAGEMENT: yield 'chip-energy-management-app' yield 'chip-energy-management-app.map' @@ -454,6 +457,10 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, if self.app == HostApp.SIMULATED_APP2: self.extra_gn_options.append('chip_tests_zap_config="app2"') + if self.app in {HostApp.JAVA_MATTER_CONTROLLER, HostApp.KOTLIN_MATTER_CONTROLLER}: + # TODO: controllers depending on a datamodel is odd. For now fix compile dependencies on ember. + self.extra_gn_options.append('chip_use_data_model_interface="disabled"') + if self.app == HostApp.TESTS and fuzzing_type != HostFuzzingType.NONE: self.build_command = 'fuzz_tests' diff --git a/scripts/build/builders/nrf.py b/scripts/build/builders/nrf.py index d584490589c662..f9c801da0b5dd1 100644 --- a/scripts/build/builders/nrf.py +++ b/scripts/build/builders/nrf.py @@ -184,10 +184,6 @@ def generate(self): if self.enable_rpcs: flags.append("-DOVERLAY_CONFIG=rpc.overlay") - if (self.board == NrfBoard.NRF52840DONGLE and - self.app != NrfApp.ALL_CLUSTERS and self.app != NrfApp.ALL_CLUSTERS_MINIMAL): - flags.append("-DCONF_FILE=prj_no_dfu.conf") - if self.options.pregen_dir: flags.append(f"-DCHIP_CODEGEN_PREGEN_DIR={shlex.quote(self.options.pregen_dir)}") @@ -201,7 +197,7 @@ def generate(self): export ZEPHYR_SDK_INSTALL_DIR={zephyr_sdk_dir};''' cmd += ''' -west build --cmake-only -d {outdir} -b {board} {sourcedir}{build_flags} +west build --cmake-only -d {outdir} -b {board} --sysbuild {sourcedir}{build_flags} '''.format( outdir=shlex.quote(self.output_dir), board=self.board.GnArgName(), @@ -228,21 +224,21 @@ def _build(self): def _bundle(self): logging.info(f'Generating flashbundle at {self.output_dir}') - self._Execute(['ninja', '-C', self.output_dir, 'flashing_script'], + self._Execute(['ninja', '-C', os.path.join(self.output_dir, 'nrfconnect'), 'flashing_script'], title='Generating flashable files of ' + self.identifier) def build_outputs(self): yield BuilderOutput( - os.path.join(self.output_dir, 'zephyr', 'zephyr.elf'), + os.path.join(self.output_dir, 'nrfconnect', 'zephyr', 'zephyr.elf'), '%s.elf' % self.app.AppNamePrefix()) if self.options.enable_link_map_file: yield BuilderOutput( - os.path.join(self.output_dir, 'zephyr', 'zephyr.map'), + os.path.join(self.output_dir, 'nrfconnect', 'zephyr', 'zephyr.map'), '%s.map' % self.app.AppNamePrefix()) def bundle_outputs(self): if self.app == NrfApp.UNIT_TESTS: return - with open(os.path.join(self.output_dir, self.app.FlashBundleName())) as f: + with open(os.path.join(self.output_dir, 'nrfconnect', self.app.FlashBundleName())) as f: for line in filter(None, [x.strip() for x in f.readlines()]): - yield BuilderOutput(os.path.join(self.output_dir, line), line) + yield BuilderOutput(os.path.join(self.output_dir, 'nrfconnect', line), line) diff --git a/scripts/build/builders/nxp.py b/scripts/build/builders/nxp.py index 4bd4f0ae451875..74f40eaa0a36aa 100644 --- a/scripts/build/builders/nxp.py +++ b/scripts/build/builders/nxp.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Project CHIP Authors +# Copyright (c) 2021-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. @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import logging import os from enum import Enum, auto @@ -19,15 +20,31 @@ from .gn import GnBuilder +class NxpOsUsed(Enum): + FREERTOS = auto() + ZEPHYR = auto() + + def OsEnv(self): + if self == NxpOsUsed.ZEPHYR: + return 'zephyr' + elif self == NxpOsUsed.FREERTOS: + return 'freertos' + else: + raise Exception('Unknown OS type: %r' % self) + + class NxpBoard(Enum): K32W0 = auto() K32W1 = auto() + RW61X = auto() def Name(self): if self == NxpBoard.K32W0: return 'k32w0x' elif self == NxpBoard.K32W1: return 'k32w1' + elif self == NxpBoard.RW61X: + return 'rd_rw612_bga' else: raise Exception('Unknown board type: %r' % self) @@ -36,6 +53,8 @@ def FolderName(self): return 'k32w/k32w0' elif self == NxpBoard.K32W1: return 'k32w/k32w1' + elif self == NxpBoard.RW61X: + return 'zephyr' else: raise Exception('Unknown board type: %r' % self) @@ -43,12 +62,21 @@ def FolderName(self): class NxpApp(Enum): LIGHTING = auto() CONTACT = auto() + ALLCLUSTERS = auto() + LAUNDRYWASHER = auto() + THERMOSTAT = auto() def ExampleName(self): if self == NxpApp.LIGHTING: return 'lighting-app' elif self == NxpApp.CONTACT: return "contact-sensor-app" + elif self == NxpApp.ALLCLUSTERS: + return "all-clusters-app" + elif self == NxpApp.LAUNDRYWASHER: + return "laundry-washer-app" + elif self == NxpApp.THERMOSTAT: + return "thermostat" else: raise Exception('Unknown app type: %r' % self) @@ -57,6 +85,12 @@ def NameSuffix(self): return 'light-example' elif self == NxpApp.CONTACT: return 'contact-example' + elif self == NxpApp.ALLCLUSTERS: + return "all-cluster-example" + elif self == NxpApp.LAUNDRYWASHER: + return "laundry-washer-example" + elif self == NxpApp.THERMOSTAT: + return "thermostat-example" else: raise Exception('Unknown app type: %r' % self) @@ -71,6 +105,7 @@ def __init__(self, runner, app: NxpApp = NxpApp.LIGHTING, board: NxpBoard = NxpBoard.K32W0, + os_env: NxpOsUsed = NxpOsUsed.FREERTOS, low_power: bool = False, smu2: bool = False, enable_factory_data: bool = False, @@ -85,6 +120,7 @@ def __init__(self, self.code_root = root self.app = app self.board = board + self.os_env = os_env self.low_power = low_power self.smu2 = smu2 self.enable_factory_data = enable_factory_data @@ -125,15 +161,54 @@ def GnBuildArgs(self): return args + def WestBuildArgs(self): + args = [] + if self.enable_factory_data: + args.append('-DFILE_SUFFIX=fdata') + + if self.has_sw_version_2: + args.append('-DCONFIG_CHIP_DEVICE_SOFTWARE_VERSION=2') + + build_args = " -- " + " ".join(args) if len(args) > 0 else "" + return build_args + def generate(self): - super(NxpBuilder, self).generate() + if self.os_env == NxpOsUsed.ZEPHYR: + if 'ZEPHYR_NXP_SDK_INSTALL_DIR' in os.environ: + cmd = 'export ZEPHYR_SDK_INSTALL_DIR="$ZEPHYR_NXP_SDK_INSTALL_DIR"\n' + else: + raise Exception("ZEPHYR_SDK_INSTALL_DIR need to be set") + if 'ZEPHYR_NXP_BASE' in os.environ: + cmd += 'export ZEPHYR_BASE="$ZEPHYR_NXP_BASE"\n' + else: + raise Exception("ZEPHYR_NXP_BASE need to be set") + build_args = self.WestBuildArgs() + cmd += ''' + west build -p --cmake-only -b {board_name} -d {out_folder} {example_folder} {build_args} + '''.format( + board_name=self.board.Name(), + out_folder=self.output_dir, + example_folder=self.app.BuildRoot(self.code_root, self.board), + build_args=build_args).strip() + self._Execute(['bash', '-c', cmd], title='Generating ' + self.identifier) + else: + super(NxpBuilder, self).generate() def build_outputs(self): name = 'chip-%s-%s' % (self.board.Name(), self.app.NameSuffix()) - yield BuilderOutput( - os.path.join(self.output_dir, name), - f'{name}.elf') - if self.options.enable_link_map_file: + if self.os_env == NxpOsUsed.ZEPHYR: + yield BuilderOutput( + os.path.join(self.output_dir, 'zephyr', 'zephyr.elf'), + f'{name}.elf') + if self.options.enable_link_map_file: + yield BuilderOutput( + os.path.join(self.output_dir, 'zephyr', 'zephyr.map'), + f'{name}.map') + else: yield BuilderOutput( - os.path.join(self.output_dir, f'{name}.map'), - f'{name}.map') + os.path.join(self.output_dir, name), + f'{name}.elf') + if self.options.enable_link_map_file: + yield BuilderOutput( + os.path.join(self.output_dir, f'{name}.map'), + f'{name}.map') diff --git a/scripts/build/builders/telink.py b/scripts/build/builders/telink.py index c53e0b6321cd76..b9cd709ba6b44c 100644 --- a/scripts/build/builders/telink.py +++ b/scripts/build/builders/telink.py @@ -151,7 +151,8 @@ def __init__(self, enable_rpcs: bool = False, enable_factory_data: bool = False, enable_4mb_flash: bool = False, - mars_board_config: bool = False): + mars_board_config: bool = False, + usb_board_config: bool = False): super(TelinkBuilder, self).__init__(root, runner) self.app = app self.board = board @@ -162,6 +163,7 @@ def __init__(self, self.enable_factory_data = enable_factory_data self.enable_4mb_flash = enable_4mb_flash self.mars_board_config = mars_board_config + self.usb_board_config = usb_board_config def get_cmd_prefixes(self): if not self._runner.dry_run: @@ -203,6 +205,9 @@ def generate(self): if self.mars_board_config: flags.append("-DTLNK_MARS_BOARD=y") + if self.usb_board_config: + flags.append("-DTLNK_USB_DONGLE=y") + if self.options.pregen_dir: flags.append(f"-DCHIP_CODEGEN_PREGEN_DIR={shlex.quote(self.options.pregen_dir)}") diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt index 7714bddaae42e3..d391093a153fcf 100644 --- a/scripts/build/testdata/all_targets_linux_x64.txt +++ b/scripts/build/testdata/all_targets_linux_x64.txt @@ -14,7 +14,7 @@ linux-x64-efr32-test-runner[-clang] imx-{chip-tool,lighting-app,thermostat,all-clusters-app,all-clusters-minimal-app,ota-provider-app}[-release] infineon-psoc6-{lock,light,all-clusters,all-clusters-minimal}[-ota][-updateimage][-trustm] rw61x-{all-clusters-app,thermostat,laundry-washer}[-ota][-wifi][-thread][-factory-data][-matter-shell] -nxp-{k32w0,k32w1}-{lighting,contact-sensor}[-factory][-low-power][-lit][-fro32k][-smu2][-dac-conversion][-rotating-id][-sw-v2] +nxp-{k32w0,k32w1,rw61x}-{zephyr,freertos}-{lighting,contact-sensor,all-clusters,laundry-washer,thermostat}[-factory][-low-power][-lit][-fro32k][-smu2][-dac-conversion][-rotating-id][-sw-v2] mbed-cy8cproto_062_4343w-{lock,light,all-clusters,all-clusters-minimal,pigweed,ota-requestor,shell}[-release][-develop][-debug] mw320-all-clusters-app nrf-{nrf5340dk,nrf52840dk,nrf52840dongle}-{all-clusters,all-clusters-minimal,lock,light,light-switch,shell,pump,pump-controller,window-covering}[-rpc] @@ -23,5 +23,5 @@ nuttx-x64-light qpg-qpg6105-{lock,light,shell,persistent-storage,light-switch,thermostat}[-updateimage] stm32-stm32wb5mm-dk-light tizen-arm-{all-clusters,all-clusters-minimal,chip-tool,light,tests}[-no-ble][-no-thread][-no-wifi][-asan][-ubsan][-with-ui] -telink-{tlsr9118bdk40d,tlsr9518adk80d,tlsr9528a,tlsr9528a_retention,tlsr9258a,tlsr9258a_retention}-{air-quality-sensor,all-clusters,all-clusters-minimal,bridge,contact-sensor,light,light-switch,lock,ota-requestor,pump,pump-controller,shell,smoke-co-alarm,temperature-measurement,thermostat,window-covering}[-ota][-dfu][-shell][-rpc][-factory-data][-4mb][-mars] +telink-{tlsr9118bdk40d,tlsr9518adk80d,tlsr9528a,tlsr9528a_retention,tlsr9258a,tlsr9258a_retention}-{air-quality-sensor,all-clusters,all-clusters-minimal,bridge,contact-sensor,light,light-switch,lock,ota-requestor,pump,pump-controller,shell,smoke-co-alarm,temperature-measurement,thermostat,window-covering}[-ota][-dfu][-shell][-rpc][-factory-data][-4mb][-mars][-usb] openiotsdk-{shell,lock}[-mbedtls][-psa] diff --git a/scripts/build/testdata/dry_run_nrf-nrf52840dk-pump.txt b/scripts/build/testdata/dry_run_nrf-nrf52840dk-pump.txt index 500826f734eee9..91865370312d97 100644 --- a/scripts/build/testdata/dry_run_nrf-nrf52840dk-pump.txt +++ b/scripts/build/testdata/dry_run_nrf-nrf52840dk-pump.txt @@ -4,7 +4,7 @@ cd "{root}" # Generating nrf-nrf52840dk-pump bash -c 'source "$ZEPHYR_BASE/zephyr-env.sh"; export ZEPHYR_TOOLCHAIN_VARIANT=zephyr; -west build --cmake-only -d {out}/nrf-nrf52840dk-pump -b nrf52840dk_nrf52840 {root}/examples/pump-app/nrfconnect' +west build --cmake-only -d {out}/nrf-nrf52840dk-pump -b nrf52840dk_nrf52840 --sysbuild {root}/examples/pump-app/nrfconnect' # Building nrf-nrf52840dk-pump ninja -C {out}/nrf-nrf52840dk-pump diff --git a/scripts/build_python.sh b/scripts/build_python.sh index a946bb1b8f518b..e70b220130935d 100755 --- a/scripts/build_python.sh +++ b/scripts/build_python.sh @@ -212,6 +212,9 @@ else WHEEL=("$OUTPUT_ROOT"/controller/python/chip*.whl) fi +# Add the matter_testing_infrastructure wheel +WHEEL+=("$OUTPUT_ROOT"/python/obj/src/python_testing/matter_testing_infrastructure/metadata_parser._build_wheel/metadata_parser-*.whl) + if [ -n "$extra_packages" ]; then WHEEL+=("$extra_packages") fi diff --git a/scripts/examples/gn_psoc6_example.sh b/scripts/examples/gn_psoc6_example.sh index 04f47e6b2f0b5a..e3ae875b8e27a4 100755 --- a/scripts/examples/gn_psoc6_example.sh +++ b/scripts/examples/gn_psoc6_example.sh @@ -17,7 +17,7 @@ # set -e -# Build script for GN P6 examples GitHub workflow. +# Build script for GN PSOC6 examples GitHub workflow. source "$(dirname "$0")/../../scripts/activate.sh" # Install required software diff --git a/scripts/examples/nrfconnect_example.sh b/scripts/examples/nrfconnect_example.sh index 0a7c46d7e9baef..67223afb2a092e 100755 --- a/scripts/examples/nrfconnect_example.sh +++ b/scripts/examples/nrfconnect_example.sh @@ -51,4 +51,4 @@ fi export CCACHE_BASEDIR="$PWD/$APP/nrfconnect" env -west build -p auto -b "$BOARD" -d "$APP/nrfconnect/build" "$APP/nrfconnect" -- "${COMMON_CI_FLAGS[@]}" "$@" +west build -p auto -b "$BOARD" -d "$APP/nrfconnect/build" "$APP/nrfconnect" --sysbuild -- "${COMMON_CI_FLAGS[@]}" "$@" diff --git a/scripts/examples/tests/expected_test_cmakelists.txt b/scripts/examples/tests/expected_test_cmakelists.txt index e8e2d3f2737bfb..cf615cd42e0005 100644 --- a/scripts/examples/tests/expected_test_cmakelists.txt +++ b/scripts/examples/tests/expected_test_cmakelists.txt @@ -70,8 +70,7 @@ set_property(TARGET "${target}" APPEND PROPERTY INCLUDE_DIRECTORIES "//TEST_ROOT_PATH/config/standalone/" "//TEST_ROOT_PATH/third_party/nlassert/repo/include/" "//TEST_ROOT_PATH/third_party/nlio/repo/include/" - "//TEST_ROOT_PATH/third_party/nlfaultinjection/include/" - "//TEST_ROOT_PATH/third_party/nlunit-test/repo/src/") + "//TEST_ROOT_PATH/third_party/nlfaultinjection/include/") set_target_properties("${target}" PROPERTIES COMPILE_DEFINITIONS "CHIP_HAVE_CONFIG_H=1;") set_target_properties("${target}" PROPERTIES COMPILE_FLAGS "-O0 -std=gnu++14 -fno-rtti ") set_target_properties("${target}" PROPERTIES LINK_FLAGS "-O0 ") diff --git a/scripts/examples/tests/test_project.json b/scripts/examples/tests/test_project.json index d15f2abd9e2ce8..2f13899deed5ca 100644 --- a/scripts/examples/tests/test_project.json +++ b/scripts/examples/tests/test_project.json @@ -88,8 +88,7 @@ "//config/standalone/", "//third_party/nlassert/repo/include/", "//third_party/nlio/repo/include/", - "//third_party/nlfaultinjection/include/", - "//third_party/nlunit-test/repo/src/" + "//third_party/nlfaultinjection/include/" ], "ldflags": ["-march=armv8-a", "-O0"], "libs": ["log"], diff --git a/scripts/flashing/psoc6_firmware_utils.py b/scripts/flashing/psoc6_firmware_utils.py index aeef78030a1d74..3e3639b49d3f47 100755 --- a/scripts/flashing/psoc6_firmware_utils.py +++ b/scripts/flashing/psoc6_firmware_utils.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright (c) 2021 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. @@ -42,38 +42,24 @@ --skip_reset, --skip-reset Do not reset device after flashing """ - +import os +import platform as plt +import subprocess import sys -from shutil import which import firmware_utils # Additional options that can be use to configure an `Flasher` # object (as dictionary keys) and/or passed as command line options. -P6_OPTIONS = { +PSOC6_OPTIONS = { # Configuration options define properties used in flashing operations. 'configuration': { - 'make': { - 'help': 'File name of the make executable', + 'openocd': { + 'help': 'File name of the hex image', 'default': None, 'argparse': { 'metavar': 'FILE', }, - 'command': [ - "make", - "-C", - {'option': 'sdk_path'}, - ['TARGET={device}'], - ['CY_OPENOCD_PROGRAM_IMG=../../../../{application}'], - {'option': 'mtb_target'} - ], - 'verify': ['{make}', '--version'], - 'error': - """\ - Unable to execute {make}. - - Please ensure that make is installed. - """, }, 'device': { 'help': 'Device family or platform to target', @@ -94,31 +80,100 @@ }, } +# Global variables +FW_LOADER = "fw-loader" +KIT_PROG_STR = "KitProg3 CMSIS-DAP" + +# General utility functions + + +def _get_board_serial_number(tools_path): + """Obtains the MCU serial number""" + board_ser_num = None + # if system is windows, add the .exe extension + exe = FW_LOADER + (".exe" if plt.system() == "Windows" else "") + fw_loader_exe = os.path.join(tools_path, FW_LOADER, "bin", exe) + try: + # runs fw-loader --device-list to get the connected device info + output = subprocess.run([fw_loader_exe, "--device-list"], check=True, capture_output=True).stdout.decode().split("\n") + except subprocess.SubprocessError: + # Do not error here, during matter build this code is interpreted by the python wrapper + # If a device is not connected in the build stage it will complain and generate an error + return None + for line in output: + # look for a line like: Info: Connected - KitProg3 CMSIS-DAP BULK-0F03131601051400 + if KIT_PROG_STR in line: + board_ser_num = line.split("-")[-1].strip() + break + if board_ser_num is None: + raise Exception("Could not detect CMSIS DAP device.") + return board_ser_num + + +def _find_tools_path(): + """Obtains the path to the latest ModusToolbox tools package""" + tools_version = "" + tools_path = os.environ.get("CY_TOOLS_PATHS", None) + # If `CY_TOOLS_PATHS` env variable is set, return that value + if tools_path is not None: + return tools_path + path_to_search = "/Applications/ModusToolbox/" if plt.system() == "Darwin" else os.path.join(os.path.expanduser("~"), "ModusToolbox") + if not os.path.exists(path_to_search): + raise Exception( + "Could not find ModusToolbox installation. Please install ModusToolbox and export CY_TOOLS_PATHS=") + dirs = os.listdir(path_to_search) + for directory in dirs: + # find the latest version of ModusToolbox that is installed + if directory.startswith("tools_"): + if directory > tools_version: + tools_version = directory + return os.path.join(path_to_search, tools_version) + class Flasher(firmware_utils.Flasher): """Manage PSoC6 flashing.""" def __init__(self, **options): super().__init__(platform='PSOC6', module=__name__, **options) - self.define_options(P6_OPTIONS) + self.define_options(PSOC6_OPTIONS) - def erase(self): + def verify(self, image): raise NotImplementedError() - def verify(self, image): + def reset(self): raise NotImplementedError() + def erase(self): + tools_path = _find_tools_path() + open_ocd_dir = os.path.join(tools_path, "openocd", "bin", "openocd") + return self.run_tool( + 'openocd', + [ + "-s", f"{open_ocd_dir}/scripts", + "-c", "source [find interface/kitprog3.cfg]", + "-c", "source [find target/psoc6_2m.cfg]", + "-c", "init; reset init", + "-c", "flash erase_sector 0 0 last; shutdown", + ], + name='Erase device') + def flash(self, image): """Flash image.""" + tools_path = _find_tools_path() + ser_num = _get_board_serial_number(tools_path) + open_ocd_dir = os.path.join(tools_path, "openocd", "bin", "openocd") return self.run_tool( - 'make', - [], - options={"mtb_target": "qprogram", "application": image}, + 'openocd', + [ + "-s", f"{open_ocd_dir}/scripts", + "-c", "source [find interface/kitprog3.cfg]", + "-c", "source [find target/psoc6_2m.cfg]", + "-c", f"adapter serial {ser_num}", + "-c", "init; reset init", + "-c", f"program {image} verify reset exit", + ], name='Flash') - def reset(self): - raise NotImplementedError() - def actions(self): """Perform actions on the device according to self.option.""" self.log(3, 'Options:', self.option) @@ -126,26 +181,27 @@ def actions(self): if self.option.erase: if self.erase().err: return self - - if self.option.application: + elif self.option.reset: + if self.reset().err: + return self + elif self.option.application: application = self.option.application if self.flash(application).err: return self if self.option.verify_application: if self.verify(application).err: return self - - if self.option.reset: - if self.reset().err: - return self - return self def locate_tool(self, tool): - if tool == "make": - return which("make") - else: - return tool + """Gets the path to infineon shipped openocd asset""" + tools_path = _find_tools_path() + if tools_path is None: + raise Exception( + "CY_TOOLS_PATHS environment variable is not set. Please set it to the location of your ModusToolbox tools directory.") + if tool != "openocd": + raise Exception(f"Tool '{tool}' is not supported for flashing PSoC6. Please use openocd.") + return os.path.join(tools_path, "openocd", "bin", "openocd") if __name__ == '__main__': diff --git a/scripts/helpers/restyle-diff.sh b/scripts/helpers/restyle-diff.sh index 21c01011a7c60c..5cc9ffa6b081fc 100755 --- a/scripts/helpers/restyle-diff.sh +++ b/scripts/helpers/restyle-diff.sh @@ -21,9 +21,10 @@ # you've written is kosher to CI # # Usage: -# restyle-diff.sh [ref] +# restyle-diff.sh [-d] [ref] # # if unspecified, ref defaults to upstream/master (or master) +# -d sets container's log level to DEBUG, if unspecified the default log level will remain (info level) # here=${0%/*} @@ -33,20 +34,55 @@ set -e CHIP_ROOT=$(cd "$here/../.." && pwd) cd "$CHIP_ROOT" -restyle-paths() { - if hash restyle-path 2>/dev/null; then - echo "$@" | xargs restyle-path +docker_run() { + if [ -t 0 ]; then + exec docker run --tty "$@" + else - url=https://github.com/restyled-io/restyler/raw/main/bin/restyle-path - echo "$@" | xargs sh <(curl --location --proto "=https" --tlsv1.2 "$url" -sSf) + exec docker run "$@" + fi } -ref="$1" +restyle-paths() { + + image=restyled/restyler:edge + + for path in "$@"; do + ( + docker_run --tty --interactive --rm \ + --env LOG_LEVEL \ + --env LOG_DESTINATION \ + --env LOG_FORMAT \ + --env LOG_COLOR \ + --env HOST_DIRECTORY="$PWD" \ + --env UNRESTRICTED=1 \ + --volume "$PWD":/code \ + --volume /tmp:/tmp \ + --volume /var/run/docker.sock:/var/run/docker.sock \ + --entrypoint restyle-path \ + "$image" "$path" + ) + done +} + +while [[ $# -gt 0 ]]; do + case "$1" in + -d) + export LOG_LEVEL="DEBUG" + shift + ;; + *) + ref="$1" + shift + ;; + esac +done + if [[ -z "$ref" ]]; then ref="master" git remote | grep -qxF upstream && ref="upstream/master" fi -declare -a paths=("$(git diff --ignore-submodules --name-only --merge-base "$ref")") +mapfile -t paths < <(git diff --ignore-submodules --name-only --merge-base "$ref") restyle-paths "${paths[@]}" diff --git a/scripts/py_matter_idl/matter_idl/backwards_compatibility.py b/scripts/py_matter_idl/matter_idl/backwards_compatibility.py index 04377100312756..f7db4edf934310 100644 --- a/scripts/py_matter_idl/matter_idl/backwards_compatibility.py +++ b/scripts/py_matter_idl/matter_idl/backwards_compatibility.py @@ -54,9 +54,9 @@ def attribute_name(attribute: Attribute) -> str: def not_stable(maturity: ApiMaturity): """Determine if the given api maturity allows binary/api changes or not.""" - # TODO: internal and deprecated not currently widely used, - # so we enforce stability on them for now. - return maturity == ApiMaturity.PROVISIONAL + # NOTE: deprecated are not to be used, so we expect no changes. They were + # probably "stable" at some point + return (maturity == ApiMaturity.PROVISIONAL) or (maturity == ApiMaturity.INTERNAL) class CompatibilityChecker: @@ -318,6 +318,12 @@ def check(self): self._check_cluster_list_compatible( self._original_idl.clusters, self._updated_idl.clusters) + self._check_enum_list_compatible( + "", self._original_idl.global_enums, self._updated_idl.global_enums) + self._check_bitmap_list_compatible( + "", self._original_idl.global_bitmaps, self._updated_idl.global_bitmaps) + self._check_struct_list_compatible( + "", self._original_idl.global_structs, self._updated_idl.global_structs) return self.compatible diff --git a/scripts/py_matter_idl/matter_idl/generators/idl/MatterIdl.jinja b/scripts/py_matter_idl/matter_idl/generators/idl/MatterIdl.jinja index 38553bb0b7f3ee..0e132e581b7712 100644 --- a/scripts/py_matter_idl/matter_idl/generators/idl/MatterIdl.jinja +++ b/scripts/py_matter_idl/matter_idl/generators/idl/MatterIdl.jinja @@ -18,27 +18,79 @@ {% macro render_struct(s) -%}{# Macro for the output of a complete struct #} - {%- if s.tag %}{{s.tag | idltxt}} {% endif -%} - {% if s.qualities %}{{s.qualities | idltxt}} {% endif -%} - struct {{s.name}} {##} - {%- if s.code is not none %}= {{s.code}} {% endif -%} - { - {% for field in s.fields %} - {{render_field(field)}} - {% endfor %} - } +{%- if s.tag %}{{s.tag | idltxt}} {% endif -%} +{% if s.qualities %}{{s.qualities | idltxt}} {% endif -%} +struct {{s.name}} {##} +{%- if s.code is not none %}= {{s.code}} {% endif -%} +{ + {% for field in s.fields %} + {{render_field(field)}} + {% endfor %} +} {%- endmacro -%} // This IDL was auto-generated from a parsed data structure -{% for cluster in idl.clusters %} +{% for enum in idl.global_enums %} +enum {{enum.name}} : {{ enum.base_type}} { + {% for entry in enum.entries %} + {{entry.name}} = {{entry.code}}; + {% endfor %} +} + +{% endfor %} + +{%- for bitmap in idl.global_bitmaps %} +bitmap {{bitmap.name}} : {{ bitmap.base_type}} { + {% for entry in bitmap.entries %} + {{entry.name}} = 0x{{"%X" | format(entry.code)}}; + {% endfor %} +} + +{% endfor %} + +{%- for s in idl.global_structs %} +{{render_struct(s)}} + +{% endfor %} + +{%- for cluster in idl.clusters %} {% if cluster.description %}/** {{cluster.description}} */ {% endif %} {{cluster.api_maturity | idltxt}}cluster {{cluster.name}} = {{cluster.code}} { revision {{cluster.revision}}; - {% for enum in cluster.enums %} + {% for enum in cluster.enums | selectattr("is_global")%} + /* GLOBAL: + enum {{enum.name}} : {{ enum.base_type}} { + {% for entry in enum.entries %} + {{entry.name}} = {{entry.code}}; + {% endfor %} + } + */ + + {% endfor %} + + {%- for bitmap in cluster.bitmaps | selectattr("is_global")%} + /* GLOBAL: + bitmap {{bitmap.name}} : {{ bitmap.base_type}} { + {% for entry in bitmap.entries %} + {{entry.name}} = 0x{{"%X" | format(entry.code)}}; + {% endfor %} + } + */ + + {% endfor %} + + {%- for s in cluster.structs | selectattr("is_global") %} + /* GLOBAL: + {{render_struct(s) | indent(2)}} + */ + + {% endfor %} + + {%- for enum in cluster.enums | rejectattr("is_global")%} enum {{enum.name}} : {{ enum.base_type}} { {% for entry in enum.entries %} {{entry.name}} = {{entry.code}}; @@ -47,7 +99,7 @@ {% endfor %} - {%- for bitmap in cluster.bitmaps %} + {%- for bitmap in cluster.bitmaps | rejectattr("is_global")%} bitmap {{bitmap.name}} : {{ bitmap.base_type}} { {% for entry in bitmap.entries %} {{entry.name}} = 0x{{"%X" | format(entry.code)}}; @@ -56,8 +108,8 @@ {% endfor %} - {%- for s in cluster.structs | rejectattr("tag") %} - {{render_struct(s)}} + {%- for s in cluster.structs | rejectattr("tag") | rejectattr("is_global") %} + {{render_struct(s) | indent(2)}} {% endfor %} @@ -77,7 +129,7 @@ {%- for s in cluster.structs | selectattr("tag") %} - {{render_struct(s)}} + {{render_struct(s) | indent(2)}} {% endfor %} {%- for c in cluster.commands %} diff --git a/scripts/py_matter_idl/matter_idl/matter_grammar.lark b/scripts/py_matter_idl/matter_idl/matter_grammar.lark index a2838e1fa8eb18..4013c51bb52a59 100644 --- a/scripts/py_matter_idl/matter_idl/matter_grammar.lark +++ b/scripts/py_matter_idl/matter_idl/matter_grammar.lark @@ -116,7 +116,7 @@ POSITIVE_INTEGER: /\d+/ HEX_INTEGER: /0x[A-Fa-f0-9]+/ ID: /[a-zA-Z_][a-zA-Z0-9_]*/ -idl: (cluster|endpoint)* +idl: (struct|enum|bitmap|cluster|endpoint)* %import common.ESCAPED_STRING %import common.WS diff --git a/scripts/py_matter_idl/matter_idl/matter_idl_parser.py b/scripts/py_matter_idl/matter_idl/matter_idl_parser.py index e33c0c7e872502..e071d008d1d726 100755 --- a/scripts/py_matter_idl/matter_idl/matter_idl_parser.py +++ b/scripts/py_matter_idl/matter_idl/matter_idl_parser.py @@ -1,8 +1,9 @@ #!/usr/bin/env python +import dataclasses import functools import logging -from typing import Dict, Optional +from typing import Dict, Optional, Set from lark import Lark from lark.lexer import Token @@ -504,15 +505,25 @@ def idl(self, items): clusters = [] endpoints = [] + global_bitmaps = [] + global_enums = [] + global_structs = [] + for item in items: if isinstance(item, Cluster): clusters.append(item) elif isinstance(item, Endpoint): endpoints.append(item) + elif isinstance(item, Enum): + global_enums.append(dataclasses.replace(item, is_global=True)) + elif isinstance(item, Bitmap): + global_bitmaps.append(dataclasses.replace(item, is_global=True)) + elif isinstance(item, Struct): + global_structs.append(dataclasses.replace(item, is_global=True)) else: raise Exception("UNKNOWN idl content item: %r" % item) - return Idl(clusters=clusters, endpoints=endpoints) + return Idl(clusters=clusters, endpoints=endpoints, global_bitmaps=global_bitmaps, global_enums=global_enums, global_structs=global_structs) def prefix_doc_comment(self): print("TODO: prefix") @@ -524,9 +535,92 @@ def c_comment(self, token: Token): self.doc_comments.append(PrefixCppDocComment(token)) +def _referenced_type_names(cluster: Cluster) -> Set[str]: + """ + Return the names of all data types referenced by the given cluster. + """ + types = set() + for s in cluster.structs: + for f in s.fields: + types.add(f.data_type.name) + + for e in cluster.events: + for f in e.fields: + types.add(f.data_type.name) + + for a in cluster.attributes: + types.add(a.definition.data_type.name) + + return types + + +class GlobalMapping: + """ + Maintains global type mapping from an IDL + """ + + def __init__(self, idl: Idl): + self.bitmap_map = {b.name: b for b in idl.global_bitmaps} + self.enum_map = {e.name: e for e in idl.global_enums} + self.struct_map = {s.name: s for s in idl.global_structs} + + self.global_types = set(self.bitmap_map.keys()).union(set(self.enum_map.keys())).union(set(self.struct_map.keys())) + + # Spec does not enforce unique naming in bitmap/enum/struct, however in practice + # if we have both enum Foo and bitmap Foo for example, it would be impossible + # to disambiguate `attribute Foo foo = 1` for the actual type we want. + # + # As a result, we do not try to namespace this and just error out + if len(self.global_types) != len(self.bitmap_map) + len(self.enum_map) + len(self.struct_map): + raise ValueError("Global type names are not unique.") + + def merge_global_types_into_cluster(self, cluster: Cluster) -> Cluster: + """ + Merges all referenced global types (bitmaps/enums/structs) into the cluster types. + This happens recursively. + """ + global_types_added = set() + + changed = True + while changed: + changed = False + for type_name in _referenced_type_names(cluster): + if type_name not in self.global_types: + continue # not a global type name + + if type_name in global_types_added: + continue # already added + + # check if this is a global type + if type_name in self.bitmap_map: + global_types_added.add(type_name) + changed = True + cluster.bitmaps.append(self.bitmap_map[type_name]) + elif type_name in self.enum_map: + global_types_added.add(type_name) + changed = True + cluster.enums.append(self.enum_map[type_name]) + elif type_name in self.struct_map: + global_types_added.add(type_name) + changed = True + cluster.structs.append(self.struct_map[type_name]) + + return cluster + + +def _merge_global_types_into_clusters(idl: Idl) -> Idl: + """ + Adds bitmaps/enums/structs from idl.global_* into clusters as long as + clusters reference those type names + """ + mapping = GlobalMapping(idl) + return dataclasses.replace(idl, clusters=[mapping.merge_global_types_into_cluster(cluster) for cluster in idl.clusters]) + + class ParserWithLines: - def __init__(self, skip_meta: bool): + def __init__(self, skip_meta: bool, merge_globals: bool): self.transformer = MatterIdlTransformer(skip_meta) + self.merge_globals = merge_globals # NOTE: LALR parser is fast. While Earley could parse more ambigous grammars, # earley is much slower: @@ -572,14 +666,28 @@ def parse(self, file: str, file_name: Optional[str] = None): for comment in self.transformer.doc_comments: comment.appply_to_idl(idl, file) + if self.merge_globals: + idl = _merge_global_types_into_clusters(idl) + return idl -def CreateParser(skip_meta: bool = False): +def CreateParser(skip_meta: bool = False, merge_globals=True): """ Generates a parser that will process a ".matter" file into a IDL + + Arguments: + skip_meta - do not add metadata (line position) for items. Metadata is + useful for error reporting, however it does not work well + for unit test comparisons + + merge_globals - places global items (enums/bitmaps/structs) into any + clusters that reference them, so that cluster types + are self-sufficient. Useful as a backwards-compatible + code generation if global definitions are not supported. + """ - return ParserWithLines(skip_meta) + return ParserWithLines(skip_meta, merge_globals) if __name__ == '__main__': diff --git a/scripts/py_matter_idl/matter_idl/matter_idl_types.py b/scripts/py_matter_idl/matter_idl/matter_idl_types.py index 3515e5e655bc7a..d4a2195457ed60 100644 --- a/scripts/py_matter_idl/matter_idl/matter_idl_types.py +++ b/scripts/py_matter_idl/matter_idl/matter_idl_types.py @@ -162,6 +162,7 @@ class Struct: code: Optional[int] = None # for responses only qualities: StructQuality = StructQuality.NONE api_maturity: ApiMaturity = ApiMaturity.STABLE + is_global: bool = False @dataclass @@ -193,6 +194,7 @@ class Enum: base_type: str entries: List[ConstantEntry] api_maturity: ApiMaturity = ApiMaturity.STABLE + is_global: bool = False @dataclass @@ -201,6 +203,7 @@ class Bitmap: base_type: str entries: List[ConstantEntry] api_maturity: ApiMaturity = ApiMaturity.STABLE + is_global: bool = False @dataclass @@ -290,5 +293,10 @@ class Idl: clusters: List[Cluster] = field(default_factory=list) endpoints: List[Endpoint] = field(default_factory=list) + # Global types + global_bitmaps: List[Bitmap] = field(default_factory=list) + global_enums: List[Enum] = field(default_factory=list) + global_structs: List[Struct] = field(default_factory=list) + # IDL file name is available only if parsing provides a file name parse_file_name: Optional[str] = field(default=None) diff --git a/scripts/py_matter_idl/matter_idl/test_backwards_compatibility.py b/scripts/py_matter_idl/matter_idl/test_backwards_compatibility.py index e94e79abd5fce5..43a273fa1fff3f 100755 --- a/scripts/py_matter_idl/matter_idl/test_backwards_compatibility.py +++ b/scripts/py_matter_idl/matter_idl/test_backwards_compatibility.py @@ -90,6 +90,83 @@ def ValidateUpdate(self, name: str, old: str, new: str, flags: Compatibility): with self.subTest(direction="OLD-to-OLD"): self._AssumeCompatiblity(old, old, old_idl, old_idl, True) + def test_global_enums_delete(self): + self.ValidateUpdate( + "delete a top level enum", + "enum A: ENUM8{} enum B: ENUM8{}", + "enum A: ENUM8{}", + Compatibility.FORWARD_FAIL) + + def test_global_enums_change(self): + self.ValidateUpdate( + "change an enum type", + "enum A: ENUM8{}", + "enum A: ENUM16{}", + Compatibility.FORWARD_FAIL | Compatibility.BACKWARD_FAIL) + + def test_global_enums_add_remove(self): + self.ValidateUpdate( + "Adding enum values is ok, removing values is not", + "enum A: ENUM8 {A = 1; B = 2;}", + "enum A: ENUM8 {A = 1; }", + Compatibility.FORWARD_FAIL) + + def test_global_enums_code(self): + self.ValidateUpdate( + "Switching enum codes is never ok", + "enum A: ENUM8 {A = 1; B = 2; }", + "enum A: ENUM8 {A = 1; B = 3; }", + Compatibility.FORWARD_FAIL | Compatibility.BACKWARD_FAIL) + + def test_global_bitmaps_delete(self): + self.ValidateUpdate( + "Deleting a global bitmap", + "bitmap A: BITMAP8{} bitmap B: BITMAP8{}", + "bitmap A: BITMAP8{} ", + Compatibility.FORWARD_FAIL) + + def test_global_bitmaps_type(self): + self.ValidateUpdate( + "Changing a bitmap type is never ok", + " bitmap A: BITMAP8{}", + " bitmap A: BITMAP16{}", + Compatibility.FORWARD_FAIL | Compatibility.BACKWARD_FAIL) + + def test_global_bitmap_values(self): + self.ValidateUpdate( + "Adding bitmap values is ok, removing values is not", + " bitmap A: BITMAP8 { kA = 0x01; kB = 0x02; } ", + " bitmap A: BITMAP8 { kA = 0x01; } ", + Compatibility.FORWARD_FAIL) + + def test_global_struct_removal(self): + self.ValidateUpdate( + "Structure removal is not ok, but adding is ok", + "struct Foo {} struct Bar {} ", + "struct Foo {} ", + Compatibility.FORWARD_FAIL) + + def test_global_struct_content_type_change(self): + self.ValidateUpdate( + "Changing structure data types is never ok", + "struct Foo { int32u x = 1; }", + "struct Foo { int64u x = 1; }", + Compatibility.FORWARD_FAIL | Compatibility.BACKWARD_FAIL) + + def test_global_struct_content_rename_reorder(self): + self.ValidateUpdate( + "Structure content renames and reorder is ok.", + "struct Foo { int32u x = 1; int8u y = 2; }", + "struct Foo { int8u a = 2; int32u y = 1; }", + Compatibility.ALL_OK) + + def test_global_struct_content_add_remove(self): + self.ValidateUpdate( + "Structure content change is not ok.", + "struct Foo { int32u x = 1; }", + "struct Foo { int32u x = 1; int8u y = 2; }", + Compatibility.FORWARD_FAIL | Compatibility.BACKWARD_FAIL) + def test_basic_clusters_enum(self): self.ValidateUpdate( "Adding an enum is ok. Also validates code formatting", @@ -111,6 +188,13 @@ def test_provisional_cluster(self): "provisional server cluster A = 16 { enum X : ENUM8 { A = 1; B = 3; } info event A = 2 { int16u x = 1;} }", Compatibility.ALL_OK) + def test_internal_cluster(self): + self.ValidateUpdate( + "Internal cluster changes are ok.", + "internal server cluster A = 16 { enum X : ENUM8 { A = 1; B = 2; } info event A = 1 { int8u x = 1;} }", + "internal server cluster A = 16 { enum X : ENUM8 { A = 1; B = 3; } info event A = 2 { int16u x = 1;} }", + Compatibility.ALL_OK) + def test_clusters_enum_code(self): self.ValidateUpdate( "Adding an enum is ok. Also validates code formatting", diff --git a/scripts/py_matter_idl/matter_idl/test_data_model_xml.py b/scripts/py_matter_idl/matter_idl/test_data_model_xml.py index 6bdb530f7cc9fc..7a606cc2ec9c6e 100755 --- a/scripts/py_matter_idl/matter_idl/test_data_model_xml.py +++ b/scripts/py_matter_idl/matter_idl/test_data_model_xml.py @@ -94,6 +94,7 @@ def assertIdlEqual(self, a: Idl, b: Idl): tofile='expected.matter', ) self.assertEqual(a, b, '\n' + ''.join(delta)) + self.fail("IDLs are not equal (above delta should have failed)") def testBasicInput(self): diff --git a/scripts/py_matter_idl/matter_idl/test_idl_generator.py b/scripts/py_matter_idl/matter_idl/test_idl_generator.py index 9f40b111bff96f..b030f8b8387a88 100755 --- a/scripts/py_matter_idl/matter_idl/test_idl_generator.py +++ b/scripts/py_matter_idl/matter_idl/test_idl_generator.py @@ -55,8 +55,8 @@ def ReadMatterIdl(repo_path: str) -> str: return stream.read() -def ParseMatterIdl(repo_path: str, skip_meta: bool) -> Idl: - return CreateParser(skip_meta=skip_meta).parse(ReadMatterIdl(repo_path)) +def ParseMatterIdl(repo_path: str, skip_meta: bool, merge_globals: bool) -> Idl: + return CreateParser(skip_meta=skip_meta, merge_globals=merge_globals).parse(ReadMatterIdl(repo_path)) def RenderAsIdlTxt(idl: Idl) -> str: @@ -106,8 +106,10 @@ def test_client_clusters(self): # Files MUST be identical except the header comments which are different original = SkipLeadingComments(ReadMatterIdl(path), also_strip=[ " // NOTE: Default/not specifically set"]) + # Do not merge globals because ZAP generated matter files do not contain + # the merge global data (will not render global reference comments). generated = SkipLeadingComments(RenderAsIdlTxt( - ParseMatterIdl(path, skip_meta=False))) + ParseMatterIdl(path, skip_meta=False, merge_globals=False))) self.assertTextEqual(original, generated) @@ -126,9 +128,9 @@ def test_app_rendering(self): ] for path in test_paths: - idl = ParseMatterIdl(path, skip_meta=True) + idl = ParseMatterIdl(path, skip_meta=True, merge_globals=True) txt = RenderAsIdlTxt(idl) - idl2 = CreateParser(skip_meta=True).parse(txt) + idl2 = CreateParser(skip_meta=True, merge_globals=True).parse(txt) # checks that data types and content is the same self.assertEqual(idl, idl2) diff --git a/scripts/py_matter_idl/matter_idl/test_matter_idl_parser.py b/scripts/py_matter_idl/matter_idl/test_matter_idl_parser.py index e5de70e940eb19..ab79c279b0697f 100755 --- a/scripts/py_matter_idl/matter_idl/test_matter_idl_parser.py +++ b/scripts/py_matter_idl/matter_idl/test_matter_idl_parser.py @@ -14,6 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from difflib import unified_diff + try: from matter_idl.matter_idl_parser import CreateParser except ModuleNotFoundError: @@ -25,19 +27,62 @@ from matter_idl.matter_idl_parser import CreateParser import unittest +from typing import Optional +from matter_idl.generators import GeneratorStorage +from matter_idl.generators.idl import IdlGenerator from matter_idl.matter_idl_types import (AccessPrivilege, ApiMaturity, Attribute, AttributeInstantiation, AttributeQuality, AttributeStorage, Bitmap, Cluster, Command, CommandInstantiation, CommandQuality, ConstantEntry, DataType, DeviceType, Endpoint, Enum, Event, EventPriority, EventQuality, Field, FieldQuality, Idl, ParseMetaData, ServerClusterInstantiation, Struct, StructTag) -def parseText(txt, skip_meta=True): - return CreateParser(skip_meta=skip_meta).parse(txt) +class GeneratorContentStorage(GeneratorStorage): + def __init__(self): + super().__init__() + self.content: Optional[str] = None + + def get_existing_data(self, relative_path: str): + # Force re-generation each time + return None + + def write_new_data(self, relative_path: str, content: str): + if self.content: + raise Exception( + "Unexpected extra data: single file generation expected") + self.content = content + + +def RenderAsIdlTxt(idl: Idl) -> str: + storage = GeneratorContentStorage() + IdlGenerator(storage=storage, idl=idl).render(dry_run=False) + return storage.content or "" + + +def parseText(txt, skip_meta=True, merge_globals=True): + return CreateParser(skip_meta=skip_meta, merge_globals=merge_globals).parse(txt) class TestParser(unittest.TestCase): + def assertIdlEqual(self, a: Idl, b: Idl): + if a == b: + # seems the same. This will just pass + self.assertEqual(a, b) + return + + # Not the same. Try to make a human readable diff: + a_txt = RenderAsIdlTxt(a) + b_txt = RenderAsIdlTxt(b) + + delta = unified_diff(a_txt.splitlines(keepends=True), + b_txt.splitlines(keepends=True), + fromfile='actual.matter', + tofile='expected.matter', + ) + self.assertEqual(a, b, '\n' + ''.join(delta)) + self.fail("IDLs are not equal (above delta should have failed)") + def test_skips_comments(self): actual = parseText(""" // this is a single line comment @@ -49,7 +94,7 @@ def test_skips_comments(self): """) expected = Idl() - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_cluster_attribute(self): actual = parseText(""" @@ -75,7 +120,7 @@ def test_cluster_attribute(self): data_type=DataType(name="int8s"), code=0xAB, name="isNullable", qualities=FieldQuality.NULLABLE)), ] )]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_doc_comments(self): actual = parseText(""" @@ -96,12 +141,12 @@ def test_doc_comments(self): # meta_data may not match but is required for doc comments. Clean it up # Metadata parsing varies line/column, so only check doc comments - self.assertEqual( + self.assertIdlEqual( actual.clusters[0].description, "Documentation for MyCluster") - self.assertEqual( + self.assertIdlEqual( actual.clusters[1].description, "Documentation for MyCluster #2") self.assertIsNone(actual.clusters[1].commands[0].description) - self.assertEqual( + self.assertIdlEqual( actual.clusters[1].commands[1].description, "Some command doc comment") def test_sized_attribute(self): @@ -122,7 +167,7 @@ def test_sized_attribute(self): data_type=DataType(name="octet_string", max_length=33), code=2, name="attr2", is_list=True)), ] )]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_timed_attributes(self): actual = parseText(""" @@ -148,7 +193,7 @@ def test_timed_attributes(self): data_type=DataType(name="octet_string", max_length=44), code=4, name="attr4", is_list=True)), ] )]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_attribute_access(self): actual = parseText(""" @@ -190,7 +235,7 @@ def test_attribute_access(self): ), ] )]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_cluster_commands(self): actual = parseText(""" @@ -232,7 +277,7 @@ def test_cluster_commands(self): qualities=CommandQuality.TIMED_INVOKE | CommandQuality.FABRIC_SCOPED), ], )]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_cluster_command_access(self): actual = parseText(""" @@ -268,7 +313,7 @@ def test_cluster_command_access(self): ), ], )]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_cluster_enum(self): actual = parseText(""" @@ -289,7 +334,7 @@ def test_cluster_enum(self): ConstantEntry(name="B", code=0x234), ])], )]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_event_field_api_maturity(self): actual = parseText(""" @@ -316,7 +361,7 @@ def test_event_field_api_maturity(self): ]), ], )]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_enum_constant_maturity(self): actual = parseText(""" @@ -341,7 +386,7 @@ def test_enum_constant_maturity(self): name="kInternal", code=0x345, api_maturity=ApiMaturity.INTERNAL), ])], )]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_bitmap_constant_maturity(self): actual = parseText(""" @@ -366,7 +411,7 @@ def test_bitmap_constant_maturity(self): name="kProvisional", code=0x4, api_maturity=ApiMaturity.PROVISIONAL), ])], )]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_struct_field_api_maturity(self): actual = parseText(""" @@ -393,7 +438,7 @@ def test_struct_field_api_maturity(self): ]), ], )]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_cluster_entry_maturity(self): actual = parseText(""" @@ -510,7 +555,7 @@ def test_cluster_entry_maturity(self): data_type=DataType(name="int32u"), code=31, name="rwForcedStable", is_list=True), api_maturity=ApiMaturity.STABLE), ] )]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_cluster_bitmap(self): actual = parseText(""" @@ -531,7 +576,7 @@ def test_cluster_bitmap(self): ConstantEntry(name="kSecond", code=0x2), ])], )]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_cluster_events(self): actual = parseText(""" @@ -556,7 +601,7 @@ def test_cluster_events(self): Event(priority=EventPriority.DEBUG, name="GoodBye", code=2, fields=[]), ])]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_cluster_event_acl(self): actual = parseText(""" @@ -577,7 +622,7 @@ def test_cluster_event_acl(self): Event(priority=EventPriority.DEBUG, readacl=AccessPrivilege.ADMINISTER, name="AdminEvent", code=3, fields=[]), ])]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_fabric_sensitive_event(self): actual = parseText(""" @@ -598,7 +643,7 @@ def test_fabric_sensitive_event(self): Event(priority=EventPriority.DEBUG, readacl=AccessPrivilege.ADMINISTER, name="AdminEvent", code=3, fields=[], qualities=EventQuality.FABRIC_SENSITIVE), ])]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_parsing_metadata_for_cluster(self): actual = CreateParser(skip_meta=False).parse(""" @@ -614,7 +659,7 @@ def test_parsing_metadata_for_cluster(self): Cluster(parse_meta=ParseMetaData(line=5, column=4, start_pos=87), name="B", code=2), ]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_multiple_clusters(self): actual = parseText(""" @@ -628,7 +673,7 @@ def test_multiple_clusters(self): Cluster(name="B", code=2), Cluster(name="C", code=3), ]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_endpoints(self): actual = parseText(""" @@ -658,7 +703,7 @@ def test_endpoints(self): ], client_bindings=["Bar", "Test"],) ]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_cluster_instantiation(self): actual = parseText(""" @@ -693,7 +738,7 @@ def test_cluster_instantiation(self): ], client_bindings=[],) ]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_multi_endpoints(self): actual = parseText(""" @@ -709,7 +754,7 @@ def test_multi_endpoints(self): Endpoint(number=10), Endpoint(number=100), ]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_cluster_api_maturity(self): actual = parseText(""" @@ -723,7 +768,171 @@ def test_cluster_api_maturity(self): Cluster(name="B", code=2, api_maturity=ApiMaturity.INTERNAL), Cluster(name="C", code=3), ]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) + + def test_just_globals(self): + actual = parseText(""" + enum TestEnum : ENUM16 { A = 0x123; B = 0x234; } + bitmap TestBitmap : BITMAP32 { + kStable = 0x1; + internal kInternal = 0x2; + provisional kProvisional = 0x4; + } + struct TestStruct { + nullable int16u someStableMember = 0; + provisional nullable int16u someProvisionalMember = 1; + internal nullable int16u someInternalMember = 2; + } + """) + + expected = Idl( + global_enums=[ + Enum(name="TestEnum", base_type="ENUM16", + entries=[ + ConstantEntry(name="A", code=0x123), + ConstantEntry(name="B", code=0x234), + ], + is_global=True, + )], + global_bitmaps=[ + Bitmap(name="TestBitmap", base_type="BITMAP32", + entries=[ + ConstantEntry(name="kStable", code=0x1), + ConstantEntry( + name="kInternal", code=0x2, api_maturity=ApiMaturity.INTERNAL), + ConstantEntry( + name="kProvisional", code=0x4, api_maturity=ApiMaturity.PROVISIONAL), + ], + is_global=True, + )], + global_structs=[ + Struct(name="TestStruct", fields=[ + Field(name="someStableMember", code=0, data_type=DataType( + name="int16u"), qualities=FieldQuality.NULLABLE), + Field(name="someProvisionalMember", code=1, data_type=DataType( + name="int16u"), qualities=FieldQuality.NULLABLE, api_maturity=ApiMaturity.PROVISIONAL), + Field(name="someInternalMember", code=2, data_type=DataType( + name="int16u"), qualities=FieldQuality.NULLABLE, api_maturity=ApiMaturity.INTERNAL), + + ], + is_global=True, + )], + ) + self.assertIdlEqual(actual, expected) + + def test_cluster_reference_globals(self): + actual = parseText(""" + enum TestEnum : ENUM16 {} + bitmap TestBitmap : BITMAP32 {} + struct TestStruct {} + + server cluster Foo = 1 { + info event BitmapEvent = 0 { + TestBitmap someBitmap = 0; + } + struct MyStruct { + nullable TestStruct subStruct = 0; + } + readonly attribute TestEnum enumAttribute = 1; + } + """) + + global_enum = Enum(name="TestEnum", base_type="ENUM16", entries=[], is_global=True) + global_bitmap = Bitmap(name="TestBitmap", base_type="BITMAP32", entries=[], is_global=True) + global_struct = Struct(name="TestStruct", fields=[], is_global=True) + expected = Idl( + global_enums=[global_enum], + global_bitmaps=[global_bitmap], + global_structs=[global_struct], + clusters=[ + Cluster( + name="Foo", + code=1, + enums=[global_enum], + bitmaps=[global_bitmap], + events=[ + Event(priority=EventPriority.INFO, + name="BitmapEvent", code=0, fields=[ + Field(data_type=DataType(name="TestBitmap"), + code=0, name="someBitmap"), + ]), + ], + structs=[ + Struct(name="MyStruct", fields=[ + Field(name="subStruct", code=0, data_type=DataType(name="TestStruct"), qualities=FieldQuality.NULLABLE), ], + ), + global_struct, + ], + attributes=[ + Attribute(qualities=AttributeQuality.READABLE, definition=Field( + data_type=DataType(name="TestEnum"), code=1, name="enumAttribute")), + ], + ) + ], + ) + self.assertIdlEqual(actual, expected) + + def test_cluster_reference_globals_recursive(self): + actual = parseText(""" + enum TestEnum : ENUM16 {} + bitmap TestBitmap : BITMAP32 {} + + struct TestStruct1 { + TestEnum enumField = 0; + } + + struct TestStruct2 { + TestStruct1 substruct = 0; + } + + struct TestStruct3 { + TestStruct2 substruct = 0; + TestBitmap bmp = 1; + } + + server cluster Foo = 1 { + attribute TestStruct3 structAttr = 1; + } + """) + + global_enum = Enum(name="TestEnum", base_type="ENUM16", entries=[], is_global=True) + global_bitmap = Bitmap(name="TestBitmap", base_type="BITMAP32", entries=[], is_global=True) + global_struct1 = Struct(name="TestStruct1", fields=[ + Field(name="enumField", code=0, data_type=DataType(name="TestEnum")), + + ], is_global=True) + global_struct2 = Struct(name="TestStruct2", fields=[ + Field(name="substruct", code=0, data_type=DataType(name="TestStruct1")), + + ], is_global=True) + global_struct3 = Struct(name="TestStruct3", fields=[ + Field(name="substruct", code=0, data_type=DataType(name="TestStruct2")), + Field(name="bmp", code=1, data_type=DataType(name="TestBitmap")), + ], is_global=True) + expected = Idl( + global_enums=[global_enum], + global_bitmaps=[global_bitmap], + global_structs=[global_struct1, global_struct2, global_struct3], + clusters=[ + Cluster( + name="Foo", + code=1, + enums=[global_enum], + bitmaps=[global_bitmap], + structs=[ + global_struct3, + global_struct2, + global_struct1, + ], + attributes=[ + Attribute( + qualities=AttributeQuality.READABLE | AttributeQuality.WRITABLE, + definition=Field(data_type=DataType(name="TestStruct3"), code=1, name="structAttr")), + ], + ) + ], + ) + self.assertIdlEqual(actual, expected) def test_emits_events(self): actual = parseText(""" @@ -753,7 +962,7 @@ def test_emits_events(self): ]) ]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_revision(self): actual = parseText(""" @@ -769,7 +978,7 @@ def test_revision(self): Cluster(name="C", code=3, revision=2), Cluster(name="D", code=4, revision=123), ]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) def test_handle_commands(self): actual = parseText(""" @@ -801,7 +1010,7 @@ def test_handle_commands(self): ]) ]) - self.assertEqual(actual, expected) + self.assertIdlEqual(actual, expected) if __name__ == '__main__': diff --git a/scripts/py_matter_idl/matter_idl/test_zapxml.py b/scripts/py_matter_idl/matter_idl/test_zapxml.py index 6e6cd3d8761ca9..5ea15e27e8f9c2 100755 --- a/scripts/py_matter_idl/matter_idl/test_zapxml.py +++ b/scripts/py_matter_idl/matter_idl/test_zapxml.py @@ -234,6 +234,36 @@ def testFabricScopedAndSensitive(self): qualities=StructQuality.FABRIC_SCOPED)], )])) + def testGlobalEnum(self): + idl = XmlToIdl(''' + + + + + + + + + + + ''') + e1 = Enum( + name='One', + base_type="ENUM8", + entries=[ + ConstantEntry(name="Three", code=3), + ] + ) + e2 = Enum( + name='Two', + base_type="ENUM8", + entries=[ + ConstantEntry(name="Big", code=100), + ConstantEntry(name="Bigger", code=2000), + ] + ) + self.assertEqual(idl, Idl(global_enums=[e1, e2])) + def testEnum(self): idl = XmlToIdl(''' @@ -308,6 +338,28 @@ def testFeatures(self): Cluster(name='TestFeatures', code=20, bitmaps=[bitmap]) ])), + def testGlobalStruct(self): + idl = XmlToIdl(''' + + + + + + + + ''') + struct = Struct( + name='SomeStruct', + qualities=StructQuality.FABRIC_SCOPED, + fields=[ + Field(data_type=DataType(name='int16u'), + code=0, name='FirstMember'), + Field(data_type=DataType(name='int32u'), + code=1, name='SecondMember') + ] + ) + self.assertEqual(idl, Idl(global_structs=[struct])) + def testStruct(self): idl = XmlToIdl(''' diff --git a/scripts/py_matter_idl/matter_idl/zapxml/handlers/handlers.py b/scripts/py_matter_idl/matter_idl/zapxml/handlers/handlers.py index 866ce71f914214..cc5ccd9483091d 100644 --- a/scripts/py_matter_idl/matter_idl/zapxml/handlers/handlers.py +++ b/scripts/py_matter_idl/matter_idl/zapxml/handlers/handlers.py @@ -225,7 +225,7 @@ def FinalizeProcessing(self, idl: Idl): # - inside a cluster if a code exists # - inside top level if no codes were associated if not self._cluster_codes: - LOGGER.error('Struct %s has no cluster codes' % self._struct.name) + idl.global_structs.append(self._struct) return for code in self._cluster_codes: @@ -270,9 +270,9 @@ def GetNextProcessor(self, name, attrs): def FinalizeProcessing(self, idl: Idl): if not self._cluster_codes: - LOGGER.error("Found enum without a cluster code: %s" % - (self._enum.name)) + idl.global_enums.append(self._enum) return + found = set() for c in idl.clusters: if c.code in self._cluster_codes: @@ -313,14 +313,11 @@ def GetNextProcessor(self, name, attrs): return BaseHandler(self.context) def FinalizeProcessing(self, idl: Idl): - # We have two choices of adding an enum: + # We have two choices of adding a bitmap: # - inside a cluster if a code exists # - inside top level if a code does not exist if not self._cluster_codes: - # Log only instead of critical, as not our XML is well formed. - # For example at the time of writing this, SwitchFeature in switch-cluster.xml - # did not have a code associated with it. - LOGGER.error("Bitmap %r has no cluster codes" % self._bitmap) + idl.global_bitmaps.append(self._bitmap) return for code in self._cluster_codes: diff --git a/scripts/py_matter_yamltests/matter_yamltests/definitions.py b/scripts/py_matter_yamltests/matter_yamltests/definitions.py index 1e4b3635200bb8..bc77e913dd4cbc 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/definitions.py +++ b/scripts/py_matter_yamltests/matter_yamltests/definitions.py @@ -88,6 +88,10 @@ def __init__(self, sources: List[ParseSource]): self.__responses_by_id[code][struct.code] = struct self.__responses_by_name[name][struct.name] = struct.code + self.__global_bitmaps: dict[str, Bitmap] = {b.name: b for b in idl.global_bitmaps} + self.__global_enums: dict[str, Bitmap] = {e.name: e for e in idl.global_enums} + self.__global_structs: dict[str, Bitmap] = {s.name: s for s in idl.global_structs} + def get_cluster_names(self) -> List[str]: return [name for name, _ in self.__clusters_by_name.items()] @@ -257,9 +261,26 @@ def __get_targets_by_cluster_name(self, cluster_name: str, target_type: _ItemTyp _ItemType.Struct: self.__structs_by_name, } + global_target_mapping = { + _ItemType.Request: None, + _ItemType.Response: None, + _ItemType.Attribute: None, + _ItemType.Event: None, + _ItemType.Bitmap: self.__global_bitmaps, + _ItemType.Enum: self.__global_enums, + _ItemType.Struct: self.__global_structs, + } + # The idl parser remove spaces cluster_name = cluster_name.replace(' ', '') - return target_mapping[target_type].get(cluster_name) + global_target = global_target_mapping[target_type] + target = target_mapping[target_type].get(cluster_name) + + if target is None: + return global_target + if global_target is None: + return target + return target | global_target def SpecDefinitionsFromPaths(paths: str, pseudo_clusters: Optional[PseudoClusters] = PseudoClusters([])): diff --git a/scripts/py_matter_yamltests/matter_yamltests/hooks.py b/scripts/py_matter_yamltests/matter_yamltests/hooks.py index 3d25cfff9c06c1..78905826f55757 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/hooks.py +++ b/scripts/py_matter_yamltests/matter_yamltests/hooks.py @@ -227,6 +227,12 @@ def show_prompt(self, """ pass + def test_skipped(self, filename: str, name: str): + """ + This method is called when the test script determines that the test is not applicable for the DUT. + """ + pass + class WebSocketRunnerHooks(): def connecting(self, url: str): diff --git a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/discovery_commands.py b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/discovery_commands.py index 17fa4f31e96a48..5cfcb6087cbddb 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/discovery_commands.py +++ b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/discovery_commands.py @@ -68,7 +68,8 @@ - + + diff --git a/scripts/py_matter_yamltests/test_spec_definitions.py b/scripts/py_matter_yamltests/test_spec_definitions.py index a1cce4833ac075..4dd776bf520bcb 100644 --- a/scripts/py_matter_yamltests/test_spec_definitions.py +++ b/scripts/py_matter_yamltests/test_spec_definitions.py @@ -102,6 +102,10 @@ source_bitmap = ''' + + + + @@ -126,6 +130,10 @@ source_enum = ''' + + + + @@ -150,6 +158,10 @@ source_struct = ''' + + + + @@ -310,10 +322,16 @@ def test_get_bitmap_by_name(self): [ParseSource(source=io.StringIO(source_bitmap), name='source_bitmap')]) self.assertIsNone(definitions.get_bitmap_by_name( 'WrongName', 'TestBitmap')) + self.assertIsNone(definitions.get_bitmap_by_name( + 'TestWrong', 'TestBitmap')) self.assertIsNone(definitions.get_bitmap_by_name( 'Test', 'TestWrongBitmap')) self.assertIsInstance(definitions.get_bitmap_by_name( 'Test', 'TestBitmap'), Bitmap) + self.assertIsInstance(definitions.get_bitmap_by_name( + 'Test', 'TestGlobalBitmap'), Bitmap) + self.assertIsInstance(definitions.get_bitmap_by_name( + 'TestWrong', 'TestGlobalBitmap'), Bitmap) self.assertIsNone(definitions.get_bitmap_by_name('test', 'TestBitmap')) self.assertIsNone(definitions.get_bitmap_by_name('Test', 'testbitmap')) @@ -322,10 +340,16 @@ def test_get_enum_by_name(self): [ParseSource(source=io.StringIO(source_enum), name='source_enum')]) self.assertIsNone(definitions.get_enum_by_name( 'WrongName', 'TestEnum')) + self.assertIsNone(definitions.get_enum_by_name( + 'TestWrong', 'TestEnum')) self.assertIsNone(definitions.get_enum_by_name( 'Test', 'TestWrongEnum')) self.assertIsInstance( definitions.get_enum_by_name('Test', 'TestEnum'), Enum) + self.assertIsInstance( + definitions.get_enum_by_name('Test', 'TestGlobalEnum'), Enum) + self.assertIsInstance( + definitions.get_enum_by_name('TestWrong', 'TestGlobalEnum'), Enum) self.assertIsNone(definitions.get_enum_by_name('test', 'TestEnum')) self.assertIsNone(definitions.get_enum_by_name('Test', 'testenum')) @@ -334,10 +358,16 @@ def test_get_struct_by_name(self): [ParseSource(source=io.StringIO(source_struct), name='source_struct')]) self.assertIsNone(definitions.get_struct_by_name( 'WrongName', 'TestStruct')) + self.assertIsNone(definitions.get_struct_by_name( + 'TestWrong', 'TestStruct')) self.assertIsNone(definitions.get_struct_by_name( 'Test', 'TestWrongStruct')) self.assertIsInstance(definitions.get_struct_by_name( 'Test', 'TestStruct'), Struct) + self.assertIsInstance(definitions.get_struct_by_name( + 'Test', 'TestGlobalStruct'), Struct) + self.assertIsInstance(definitions.get_struct_by_name( + 'TestWrong', 'TestGlobalStruct'), Struct) self.assertIsNone(definitions.get_struct_by_name('test', 'TestStruct')) self.assertIsNone(definitions.get_struct_by_name('Test', 'teststruct')) @@ -365,16 +395,22 @@ def test_get_type_by_name(self): [ParseSource(source=io.StringIO(source_bitmap), name='source_bitmap')]) self.assertIsInstance(definitions.get_type_by_name( 'Test', 'TestBitmap'), Bitmap) + self.assertIsInstance(definitions.get_type_by_name( + 'Test', 'TestGlobalBitmap'), Bitmap) definitions = SpecDefinitions( [ParseSource(source=io.StringIO(source_enum), name='source_enum')]) self.assertIsInstance( definitions.get_type_by_name('Test', 'TestEnum'), Enum) + self.assertIsInstance( + definitions.get_type_by_name('Test', 'TestGlobalEnum'), Enum) definitions = SpecDefinitions( [ParseSource(source=io.StringIO(source_struct), name='source_struct')]) self.assertIsInstance(definitions.get_type_by_name( 'Test', 'TestStruct'), Struct) + self.assertIsInstance(definitions.get_type_by_name( + 'Test', 'TestGlobalStruct'), Struct) def test_struct_is_fabric_scoped(self): definitions = SpecDefinitions( diff --git a/scripts/rules.matterlint b/scripts/rules.matterlint index 335e37436be00c..43b9b5887582b4 100644 --- a/scripts/rules.matterlint +++ b/scripts/rules.matterlint @@ -19,6 +19,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/chip-ota.xml"; load "../src/app/zap-templates/zcl/data-model/chip/chip-types.xml"; load "../src/app/zap-templates/zcl/data-model/chip/clusters-extensions.xml"; load "../src/app/zap-templates/zcl/data-model/chip/color-control-cluster.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/commissioner-control-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/concentration-measurement-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/content-launch-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/content-app-observer-cluster.xml"; @@ -33,6 +34,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/measurement-and-sensing.xml"; load "../src/app/zap-templates/zcl/data-model/chip/microwave-oven-mode-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/ecosystem-information-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/energy-evse-mode-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/ethernet-network-diagnostics-cluster.xml"; @@ -93,6 +95,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/thermostat-user-interface-con load "../src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/thread-border-router-management-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/thread-network-diagnostics-cluster.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/thread-network-directory-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/time-format-localization-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/time-synchronization-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/timer-cluster.xml"; @@ -100,6 +103,8 @@ load "../src/app/zap-templates/zcl/data-model/chip/unit-localization-cluster.xml load "../src/app/zap-templates/zcl/data-model/chip/user-label-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/wake-on-lan-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/washer-controls-cluster.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/water-heater-management-cluster.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/water-heater-mode-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/wifi-network-management-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/window-covering.xml"; diff --git a/scripts/setup/constraints.txt b/scripts/setup/constraints.txt index 49aff90df0715c..a5af1b462fb335 100644 --- a/scripts/setup/constraints.txt +++ b/scripts/setup/constraints.txt @@ -128,7 +128,7 @@ mobly==1.12.1 # via -r requirements.all.txt msgpack==1.0.4 # via cachecontrol -mypy==0.971 +mypy==1.10.1 # via -r requirements.all.txt mypy-extensions==1.0.0 # via mypy @@ -261,7 +261,7 @@ types-protobuf==4.24.0.2 # via # -r requirements.all.txt # mypy-protobuf -typing-extensions==4.5.0 +typing-extensions==4.6.0 # via mypy urllib3==1.26.14 # via requests diff --git a/scripts/setup/nxp/update_nxp_sdk.py b/scripts/setup/nxp/update_nxp_sdk.py new file mode 100755 index 00000000000000..da948306f887d7 --- /dev/null +++ b/scripts/setup/nxp/update_nxp_sdk.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python3 +# +# 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 argparse +import logging +import os +import shutil +import subprocess +import sys +from dataclasses import dataclass + +CHIP_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../..')) + + +@dataclass(init=False) +class NxpSdk: + sdk_name: str + sdk_target_location: str + sdk_manifest_path: str + + def __init__(self, name, sdk_target_location): + self.sdk_name = name + self.sdk_target_location = sdk_target_location + self.sdk_manifest_path = os.path.abspath(os.path.join(sdk_target_location, 'manifest')) + + +def NxpSdk_k32w0(): + rel_path_k32w0 = 'third_party/nxp/nxp_matter_support/github_sdk/k32w0' + sdk = NxpSdk('k32w0', os.path.abspath(os.path.join(CHIP_ROOT, rel_path_k32w0))) + return sdk + + +ALL_PLATFORM_SDK = [ + NxpSdk_k32w0(), +] + +ALL_PLATFORM_NAME = [p.sdk_name for p in ALL_PLATFORM_SDK] + + +def clean_sdk_local_changes(sdk_location): + logging.warning("SDK will be cleaned all local modification(s) will be lost") + # Cleaning all local modifications + git_clean_command = "git reset --hard && git clean -xdf" + command = ['west', 'forall', '-c', git_clean_command, '-a'] + subprocess.run(command, cwd=sdk_location, check=True) + + +def init_nxp_sdk_version(nxp_sdk, force): + print("Init SDK in: " + nxp_sdk.sdk_target_location) + west_path = os.path.join(nxp_sdk.sdk_target_location, '.west') + if os.path.exists(west_path): + if not force: + logging.error("SDK is already initialized, use --force to force init") + sys.exit(1) + shutil.rmtree(west_path) + + command = ['west', 'init', '-l', nxp_sdk.sdk_manifest_path, '--mf', 'west.yml'] + subprocess.run(command, check=True) + update_nxp_sdk_version(nxp_sdk, force) + + +def update_nxp_sdk_version(nxp_sdk, force): + print("Update SDK in " + nxp_sdk.sdk_target_location) + if not os.path.exists(os.path.join(nxp_sdk.sdk_target_location, '.west')): + logging.error("--update-only error SDK is not initialized") + sys.exit(1) + command = ['west', 'update', '--fetch', 'smart'] + try: + subprocess.run(command, cwd=nxp_sdk.sdk_target_location, check=True) + except (RuntimeError, subprocess.CalledProcessError) as exception: + if force: + if nxp_sdk.sdk_name == 'k32w0': + logging.error('Force update not yet supported for %s platform', nxp_sdk.sdk_name) + else: + # In case of force update option and in case of update failure: + # 1. try to clean all local modications if any + # 2. Retry the west update command. It should be successfull now as all local modifications have been cleaned + clean_sdk_local_changes(nxp_sdk.sdk_target_location) + subprocess.run(command, cwd=nxp_sdk.sdk_target_location, check=True) + else: + logging.exception( + 'Error SDK cannot be updated, local changes should be cleaned manually or use --force to force update %s', exception) + + +def main(): + + parser = argparse.ArgumentParser(description='Checkout or update relevant NXP SDK') + parser.add_argument( + "--update-only", help="Update NXP SDK to the correct version. Would fail if the SDK does not exist", action="store_true") + parser.add_argument('--platform', nargs='+', choices=ALL_PLATFORM_NAME, default=ALL_PLATFORM_NAME, + help='Allows to select which SDK for a particular NXP platform to initialize') + parser.add_argument('--force', action='store_true', + help='Force SDK initialization, hard clean will be done in case of failure - WARNING -- All local SDK modification(s) will be lost') + + args = parser.parse_args() + + for current_plat in args.platform: + nxp_sdk = [p for p in ALL_PLATFORM_SDK if p.sdk_name == current_plat][0] + if args.update_only: + update_nxp_sdk_version(nxp_sdk, args.force) + else: + init_nxp_sdk_version(nxp_sdk, args.force) + + +if __name__ == '__main__': + main() diff --git a/scripts/setup/requirements.all.txt b/scripts/setup/requirements.all.txt index 3266eaf8504572..346abfa3936888 100644 --- a/scripts/setup/requirements.all.txt +++ b/scripts/setup/requirements.all.txt @@ -38,7 +38,7 @@ appdirs coloredlogs watchdog build==0.8.0 -mypy==0.971 +mypy==1.10.1 mypy-protobuf==3.5.0 protobuf==4.24.4 types-protobuf==4.24.0.2 @@ -50,4 +50,3 @@ colorama # update tornado for pw_watch tornado - diff --git a/scripts/setup/requirements.build.txt b/scripts/setup/requirements.build.txt index 82fe4cc08cea50..c9e8bad323bd85 100644 --- a/scripts/setup/requirements.build.txt +++ b/scripts/setup/requirements.build.txt @@ -1,8 +1,9 @@ # Minimal requirements for building stand-alone CHIP applications. # # The list of Python packages required to perform a minimal CHIP -# application build should be kept as small as possible. Ideally, -# core build scripts should depend only on the standard library. +# application build should be kept as small as possible. + +# Ideally, core build scripts should depend only on the standard library. # scripts/build click diff --git a/scripts/setup/requirements.infineon.txt b/scripts/setup/requirements.infineon.txt index 0a79ce1f3bfa63..97b60983b72f32 100644 --- a/scripts/setup/requirements.infineon.txt +++ b/scripts/setup/requirements.infineon.txt @@ -1,2 +1,4 @@ +ecdsa +intelhex leb128 zcbor diff --git a/scripts/setup/requirements.nrfconnect.txt b/scripts/setup/requirements.nrfconnect.txt index e2ada120811850..6785f2114a10e7 100644 --- a/scripts/setup/requirements.nrfconnect.txt +++ b/scripts/setup/requirements.nrfconnect.txt @@ -5,3 +5,4 @@ cbor2>=5.4.3 ecdsa>=0.18.0 qrcode==7.4.2 python_stdnum==1.18 +typing-extensions>=4.6.0 diff --git a/scripts/setup/zap.json b/scripts/setup/zap.json index c3e65c8bab9752..c80affb2587550 100644 --- a/scripts/setup/zap.json +++ b/scripts/setup/zap.json @@ -8,13 +8,13 @@ "mac-amd64", "windows-amd64" ], - "tags": ["version:2@v2024.06.10-nightly.1"] + "tags": ["version:2@v2024.07.26-nightly.1"] }, { "_comment": "Always get the amd64 version on mac until usable arm64 zap build is available", "path": "fuchsia/third_party/zap/mac-amd64", "platforms": ["mac-arm64"], - "tags": ["version:2@v2024.06.10-nightly.1"] + "tags": ["version:2@v2024.07.26-nightly.1"] } ] } diff --git a/scripts/setup/zap.version b/scripts/setup/zap.version index 8b3c20afc891f6..853cddc8622b96 100644 --- a/scripts/setup/zap.version +++ b/scripts/setup/zap.version @@ -1 +1 @@ -v2024.06.10-nightly +v2024.07.26-nightly diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py index 0bd954a6241c72..9d887a56580713 100644 --- a/scripts/tests/chiptest/__init__.py +++ b/scripts/tests/chiptest/__init__.py @@ -188,6 +188,7 @@ def _GetDarwinFrameworkToolUnsupportedTests() -> Set[str]: "TestIcdManagementCluster", # darwin-framework-tool does not support ICD registration "TestUnitTestingClusterMei", # darwin-framework-tool does not currently support reading or subscribing to Events "TestReadNoneSubscribeNone", # darwin-framework-tool does not supports those commands. + "TestDiagnosticLogsDownloadCommand", # test is flaky in darwin. Please see #32636 "Test_TC_ACE_1_6", # darwin-framework-tool does not support group commands. "Test_TC_ACL_2_5", # darwin-framework-tool does not currently support reading or subscribing to Events @@ -226,50 +227,17 @@ def _GetChipReplUnsupportedTests() -> Set[str]: return { "Test_AddNewFabricFromExistingFabric.yaml", # chip-repl does not support GetCommissionerRootCertificate and IssueNocChain command "Test_TC_OPCREDS_3_7.yaml", # chip-repl does not support GetCommissionerRootCertificate and IssueNocChain command - "TestEqualities.yaml", # chip-repl does not support pseudo-cluster commands that return a value "TestExampleCluster.yaml", # chip-repl does not load custom pseudo clusters "TestAttributesById.yaml", # chip-repl does not support AnyCommands (06/06/2023) "TestCommandsById.yaml", # chip-repl does not support AnyCommands (06/06/2023) "TestEventsById.yaml", # chip-repl does not support AnyCommands (06/06/2023) "TestReadNoneSubscribeNone.yaml", # chip-repl does not support AnyCommands (07/27/2023) - "Test_TC_DRLK_2_8.yaml", # Test fails only in chip-repl: Refer--> https://github.com/project-chip/connectedhomeip/pull/27011#issuecomment-1593339855 - "Test_TC_ACE_1_6.yaml", # Test fails only in chip-repl: Refer--> https://github.com/project-chip/connectedhomeip/pull/27910#issuecomment-1632485584 "Test_TC_IDM_1_2.yaml", # chip-repl does not support AnyCommands (19/07/2023) - "TestGroupKeyManagementCluster.yaml", # chip-repl does not support EqualityCommands (2023-08-04) "TestIcdManagementCluster.yaml", # TODO(#30430): add ICD registration support in chip-repl "Test_TC_ICDM_3_4.yaml", # chip-repl does not support ICD registration - "Test_TC_S_2_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_MOD_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_MOD_3_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_MOD_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_MOD_3_4.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_BRBINFO_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_DGGEN_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_DGGEN_2_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_LWM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_LWM_3_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_LWM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_OTCCM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_OTCCM_3_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_OTCCM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_G_2_4.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_RVCRUNM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_RVCCLEANM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_TCCM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_TCCM_3_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_TCCM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_TCTL_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster # chip-repl and chip-tool disagree on what the YAML here should look like: https://github.com/project-chip/connectedhomeip/issues/29110 "TestClusterMultiFabric.yaml", - "Test_TC_ACL_2_5.yaml", # chip-repl does not support LastReceivedEventNumber : https://github.com/project-chip/connectedhomeip/issues/28884 - "Test_TC_ACL_2_6.yaml", # chip-repl does not support LastReceivedEventNumber : https://github.com/project-chip/connectedhomeip/issues/28884 - "Test_TC_RVCCLEANM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_BINFO_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster "TestDiagnosticLogs.yaml", # chip-repl does not implement a BDXTransferServerDelegate - "Test_TC_EEVSEM_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_EEVSEM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_EEVSEM_3_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_EEVSEM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster "TestDiagnosticLogsDownloadCommand.yaml", # chip-repl does not implement the bdx download command } @@ -308,6 +276,8 @@ def target_for_name(name: str): return TestTarget.TV if name.startswith("DL_") or name.startswith("Test_TC_DRLK_"): return TestTarget.LOCK + if name.startswith("TestFabricSync"): + return TestTarget.FABRIC_SYNC if name.startswith("OTA_"): return TestTarget.OTA if name.startswith("Test_TC_BRBINFO_") or name.startswith("Test_TC_ACT_"): @@ -318,6 +288,8 @@ def target_for_name(name: str): return TestTarget.MWO if name.startswith("Test_TC_RVCRUNM_") or name.startswith("Test_TC_RVCCLEANM_") or name.startswith("Test_TC_RVCOPSTATE_"): return TestTarget.RVC + if name.startswith("Test_TC_THNETDIR_") or name.startswith("Test_TC_WIFINM_"): + return TestTarget.NETWORK_MANAGER return TestTarget.ALL_CLUSTERS diff --git a/scripts/tests/chiptest/linux.py b/scripts/tests/chiptest/linux.py index 3dbd851be26b47..bf3e140981d3a7 100644 --- a/scripts/tests/chiptest/linux.py +++ b/scripts/tests/chiptest/linux.py @@ -178,12 +178,14 @@ def PathsWithNetworkNamespaces(paths: ApplicationPaths) -> ApplicationPaths: chip_tool='ip netns exec tool'.split() + paths.chip_tool, all_clusters_app='ip netns exec app'.split() + paths.all_clusters_app, lock_app='ip netns exec app'.split() + paths.lock_app, + fabric_bridge_app='ip netns exec app'.split() + paths.fabric_bridge_app, ota_provider_app='ip netns exec app'.split() + paths.ota_provider_app, ota_requestor_app='ip netns exec app'.split() + paths.ota_requestor_app, tv_app='ip netns exec app'.split() + paths.tv_app, lit_icd_app='ip netns exec app'.split() + paths.lit_icd_app, microwave_oven_app='ip netns exec app'.split() + paths.microwave_oven_app, rvc_app='ip netns exec app'.split() + paths.rvc_app, + network_manager_app='ip netns exec app'.split() + paths.network_manager_app, bridge_app='ip netns exec app'.split() + paths.bridge_app, chip_repl_yaml_tester_cmd='ip netns exec tool'.split() + paths.chip_repl_yaml_tester_cmd, chip_tool_with_python_cmd='ip netns exec tool'.split() + paths.chip_tool_with_python_cmd, diff --git a/scripts/tests/chiptest/test_definition.py b/scripts/tests/chiptest/test_definition.py index 970c098f1354bb..484f247f70b1b2 100644 --- a/scripts/tests/chiptest/test_definition.py +++ b/scripts/tests/chiptest/test_definition.py @@ -175,8 +175,10 @@ class TestTarget(Enum): OTA = auto() BRIDGE = auto() LIT_ICD = auto() + FABRIC_SYNC = auto() MWO = auto() RVC = auto() + NETWORK_MANAGER = auto() @dataclass @@ -184,6 +186,7 @@ class ApplicationPaths: chip_tool: typing.List[str] all_clusters_app: typing.List[str] lock_app: typing.List[str] + fabric_bridge_app: typing.List[str] ota_provider_app: typing.List[str] ota_requestor_app: typing.List[str] tv_app: typing.List[str] @@ -193,10 +196,14 @@ class ApplicationPaths: chip_repl_yaml_tester_cmd: typing.List[str] chip_tool_with_python_cmd: typing.List[str] rvc_app: typing.List[str] + network_manager_app: typing.List[str] def items(self): - return [self.chip_tool, self.all_clusters_app, self.lock_app, self.ota_provider_app, self.ota_requestor_app, - self.tv_app, self.bridge_app, self.lit_icd_app, self.microwave_oven_app, self.chip_repl_yaml_tester_cmd, self.chip_tool_with_python_cmd, self.rvc_app] + return [self.chip_tool, self.all_clusters_app, self.lock_app, + self.fabric_bridge_app, self.ota_provider_app, self.ota_requestor_app, + self.tv_app, self.bridge_app, self.lit_icd_app, + self.microwave_oven_app, self.chip_repl_yaml_tester_cmd, + self.chip_tool_with_python_cmd, self.rvc_app, self.network_manager_app] @dataclass @@ -299,6 +306,8 @@ def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str, target_app = paths.tv_app elif self.target == TestTarget.LOCK: target_app = paths.lock_app + elif self.target == TestTarget.FABRIC_SYNC: + target_app = paths.fabric_bridge_app elif self.target == TestTarget.OTA: target_app = paths.ota_requestor_app elif self.target == TestTarget.BRIDGE: @@ -309,6 +318,8 @@ def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str, target_app = paths.microwave_oven_app elif self.target == TestTarget.RVC: target_app = paths.rvc_app + elif self.target == TestTarget.NETWORK_MANAGER: + target_app = paths.network_manager_app else: raise Exception("Unknown test target - " "don't know which application to run") diff --git a/scripts/tests/cirque_tests.sh b/scripts/tests/cirque_tests.sh index b6fa0eb7f64e56..a8be290f6c7e2c 100755 --- a/scripts/tests/cirque_tests.sh +++ b/scripts/tests/cirque_tests.sh @@ -44,6 +44,7 @@ CIRQUE_TESTS=( "MobileDeviceTest" "CommissioningTest" "InteractionModelTest" + "IcdWaitForActiveTest" "SplitCommissioningTest" "CommissioningFailureTest" "CommissioningFailureOnReportTest" diff --git a/scripts/tests/linux/log_line_processing.py b/scripts/tests/linux/log_line_processing.py new file mode 100644 index 00000000000000..e7624c12d5f2f2 --- /dev/null +++ b/scripts/tests/linux/log_line_processing.py @@ -0,0 +1,130 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging +import queue +import select +import subprocess +import threading +import time +from typing import List + + +class ProcessOutputCapture: + """ + Captures stdout from a process and redirects such stdout to a given file. + + The capture serves several purposes as opposed to just reading stdout: + - as data is received, it will get written to a separate file + - data is accumulated in memory for later processing (does not starve/block + the process stdout) + - provides read timeouts for incoming data + + Use as part of a resource management block like: + + with ProcessOutputCapture("test.sh", "logs.txt") as p: + p.send_to_program("input\n") + + while True: + l = p.next_output_line(timeout_sec = 1) + if not l: + break + """ + + def __init__(self, command: List[str], output_path: str): + # in/out/err are pipes + self.command = command + self.output_path = output_path + self.output_lines = queue.Queue() + self.process = None + self.io_thread = None + self.done = False + + def _io_thread(self): + """Reads process lines and writes them to an output file. + + It also sends the output lines to `self.output_lines` for later + reading + """ + out_wait = select.poll() + out_wait.register(self.process.stdout, select.POLLIN | select.POLLHUP) + + err_wait = select.poll() + err_wait.register(self.process.stderr, select.POLLIN | select.POLLHUP) + + with open(self.output_path, "wt") as f: + f.write("PROCESS START: %s\n" % time.ctime()) + while not self.done: + changes = out_wait.poll(0.1) + if changes: + out_line = self.process.stdout.readline() + if not out_line: + # stdout closed (otherwise readline should have at least \n) + continue + f.write(out_line) + self.output_lines.put(out_line) + + changes = err_wait.poll(0) + if changes: + err_line = self.process.stderr.readline() + if not err_line: + # stderr closed (otherwise readline should have at least \n) + continue + f.write(f"!!STDERR!! : {err_line}") + f.write("PROCESS END: %s\n" % time.ctime()) + + def __enter__(self): + self.done = False + self.process = subprocess.Popen( + self.command, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + text=True, + ) + self.io_thread = threading.Thread(target=self._io_thread) + self.io_thread.start() + return self + + def __exit__(self, exception_type, exception_value, traceback): + self.done = True + if self.process: + self.process.terminate() + self.process.wait() + + if self.io_thread: + self.io_thread.join() + + if exception_value: + # When we fail because of an exception, report the entire log content + logging.error(f"-------- START: LOG DUMP FOR {self.command!r} -----") + with open(self.output_path, "rt") as f: + for output_line in f.readlines(): + logging.error(output_line.strip()) + logging.error(f"-------- END: LOG DUMP FOR {self.command!r} -----") + + def next_output_line(self, timeout_sec=None): + """Fetch an item from the output queue, potentially with a timeout.""" + try: + return self.output_lines.get(timeout=timeout_sec) + except queue.Empty: + return None + + def send_to_program(self, input_cmd): + """Sends the given input command string to the program. + + NOTE: remember to append a `\n` for terminal applications + """ + self.process.stdin.write(input_cmd) + self.process.stdin.flush() diff --git a/scripts/tests/linux/tv_casting_test_sequences.py b/scripts/tests/linux/tv_casting_test_sequences.py index 3ed249ae28532f..fe1b0ab17f3263 100644 --- a/scripts/tests/linux/tv_casting_test_sequences.py +++ b/scripts/tests/linux/tv_casting_test_sequences.py @@ -67,9 +67,13 @@ # Values that identify the Linux tv-app and are noted in the 'Device Configuration' in the Linux tv-app output # as well as under the 'Discovered Commissioner' details in the Linux tv-casting-app output. -VENDOR_ID = 0xFFF1 # Spec 7.20.2.1 MEI code: test vendor IDs are 0xFFF1 to 0xFFF4 -PRODUCT_ID = 0x8001 # Test product id -DEVICE_TYPE_CASTING_VIDEO_PLAYER = 0x23 # Device type library 10.3: Casting Video Player +VENDOR_ID = 0xFFF1 # 0xFFF1 = 65521; Spec 7.20.2.1 MEI code: test vendor IDs are 0xFFF1 to 0xFFF4 +PRODUCT_ID = 0x8001 # 0x8001 = 32769 = Test product id +DEVICE_TYPE_CASTING_VIDEO_PLAYER = 0x23 # 0x23 = 35 = Device type library 10.3: Casting Video Player + +# 0x457 = 1111 = Target Content Application Vendor ID for the commissioner generated passcode flow +COMMISSIONER_GENERATED_PASSCODE_VENDOR_ID = 0x457 +COMMISSIONER_GENERATED_PASSCODE = '0x00BC_614E' # 0x00BC_614E = 12345678 = Default commissioner generated passcode # Value to verify the subscription state against in the Linux tv-casting-app output. ATTRIBUTE_CURRENT_PLAYBACK_STATE = 0x0000_0000 # Application Cluster Spec 6.10.6 Attribute ID: Current State of Playback @@ -94,7 +98,7 @@ Step(app=App.TV_CASTING_APP, output_msg=['Discovered CastingPlayer #0', f'Product ID: {PRODUCT_ID}', f'Vendor ID: {VENDOR_ID}', f'Device Type: {DEVICE_TYPE_CASTING_VIDEO_PLAYER}', 'Supports Commissioner Generated Passcode: true']), - # Send `cast request {valid_discovered_commissioner_number}\n` command to the tv-casting-app subprocess. + # Send `cast request {valid_discovered_castingplayer_number}\n` command to the tv-casting-app subprocess. Step(app=App.TV_CASTING_APP, input_cmd='cast request 0\n'), # Validate that the tv-casting-app begins the commissioning process. @@ -112,7 +116,7 @@ # Validate that we received the instructions on the tv-app output for sending the `controller ux ok` command. Step(app=App.TV_APP, output_msg=['Via Shell Enter: controller ux ok|cancel']), - # Send `controller ux ok` command to the tv-app subprocess. + # Send `controller ux ok\n` command to the tv-app subprocess. Step(app=App.TV_APP, input_cmd='controller ux ok\n'), # Validate that pairing succeeded between the tv-casting-app and the tv-app. @@ -140,6 +144,110 @@ # Signal to stop the tv-casting-app as we finished validation. Step(app=App.TV_CASTING_APP, input_cmd=STOP_APP), + # Signal to stop the tv-app as we finished validation. + Step(app=App.TV_APP, input_cmd=STOP_APP) + ] + ), + Sequence( + name='commissioner_generated_passcode_test', + steps=[ + # Signal to start the tv-app. + Step(app=App.TV_APP, input_cmd=START_APP), + + # Validate that the tv-app is up and running. + Step(app=App.TV_APP, timeout_sec=APP_MAX_START_WAIT_SEC, output_msg=['Started commissioner']), + + # Signal to start the tv-casting-app. + Step(app=App.TV_CASTING_APP, input_cmd=START_APP), + + # Validate that the server is properly initialized in the tv-casting-app output. + Step(app=App.TV_CASTING_APP, timeout_sec=APP_MAX_START_WAIT_SEC, output_msg=['Server initialization complete']), + + # Validate that there is a valid discovered casting player with {PRODUCT_ID}, {VENDOR_ID}, {DEVICE_TYPE_CASTING_VIDEO_PLAYER}, and the + # `Commissioner Generated Passcode` flag is set to true in the tv-casting-app output. + Step(app=App.TV_CASTING_APP, output_msg=['Discovered CastingPlayer #0', f'Product ID: {PRODUCT_ID}', f'Vendor ID: {VENDOR_ID}', + f'Device Type: {DEVICE_TYPE_CASTING_VIDEO_PLAYER}', 'Supports Commissioner Generated Passcode: true']), + + # Send `cast request {valid_discovered_castingplayer_number} commissioner-generated-passcode\n` command to the tv-casting-app subprocess. + Step(app=App.TV_CASTING_APP, input_cmd='cast request 0 commissioner-generated-passcode\n'), + + # Validate that the tv-casting-app begins the commissioning process. + Step(app=App.TV_CASTING_APP, output_msg=[ + 'CastingPlayer::VerifyOrEstablishConnection() calling OpenBasicCommissioningWindow()']), + + # Validate that the `IdentificationDeclaration` message sent from the tv-casting-app to the tv-app will contain the following entries: + # mCommissionerPasscode: true -> This flag instructs the commissioner to use the commissioner-generated-passcode flow for commissioning. + # mCommissionerPasscodeReady: false -> This flag indicates that the commissionee has not obtained the commissioner passcode from the user and + # thus is not ready for commissioning. + # Vendor ID: {COMMISSIONER_GENERATED_PASSCODE_VENDOR_ID} -> The initial VENDOR_ID of the casting player will be overridden to {COMMISSIONER_GENERATED_PASSCODE_VENDOR_ID}. + # Otherwise we will enter the commissionee-generated-passcode flow. + Step(app=App.TV_CASTING_APP, output_msg=['IdentificationDeclarationOptions::LogDetail()', 'IdentificationDeclarationOptions::mCommissionerPasscode: true', + 'IdentificationDeclarationOptions::mCommissionerPasscodeReady: false', 'IdentificationDeclarationOptions::TargetAppInfos list:', f'TargetAppInfo 1, Vendor ID: {COMMISSIONER_GENERATED_PASSCODE_VENDOR_ID}']), + + # Validate that we received the cast request from the tv-casting-app on the tv-app output. + Step(app=App.TV_APP, + output_msg=['------PROMPT USER: Test TV casting app is requesting permission to cast to this TV, approve?']), + + # Validate that we received the instructions on the tv-app output for sending the `controller ux ok` command. + Step(app=App.TV_APP, output_msg=['Via Shell Enter: controller ux ok|cancel']), + + # Send `controller ux ok` command to the tv-app subprocess. + Step(app=App.TV_APP, input_cmd='controller ux ok\n'), + + # Validate that the tv-app sent a message to the tv-casting-app indicating that the tv-app is now displaying the passcode to the user. + Step(app=App.TV_APP, output_msg=['Commissioner Declaration Start', + 'commissioner passcode: true', 'Commissioner Declaration End']), + + # Validate that we received the cast request with the casting passcode on the tv-app output. + Step(app=App.TV_APP, output_msg=[ + f'------PROMPT USER: Test TV casting app is requesting permission to cast to this TV. Casting passcode: [{COMMISSIONER_GENERATED_PASSCODE}].']), + + # Validate that the tv-casting-app received the message from the tv-app indicating that the tv-app is now displaying the passcode to the user. + Step(app=App.TV_CASTING_APP, output_msg=['Commissioner Declaration Start', + 'commissioner passcode: true', 'Commissioner Declaration End']), + + # Validate that the user is prompted to input passcode from the tv-app on the tv-casting-app output. + Step(app=App.TV_CASTING_APP, output_msg=['Awaiting user input', 'Input the Commissioner-Generated passcode displayed on the CastingPlayer UX.', + f'cast setcommissionerpasscode {int(COMMISSIONER_GENERATED_PASSCODE, 16)}', 'Awaiting user input']), + + # Send `cast setcommissionerpasscode {COMMISSIONER_GENERATED_PASSCODE}\n` to the tv-casting-app subprocess. + Step(app=App.TV_CASTING_APP, input_cmd=f'cast setcommissionerpasscode {int(COMMISSIONER_GENERATED_PASSCODE, 16)}\n'), + + # Validate the commissioner passcode that the user entered on the tv-casting-app output. + Step(app=App.TV_CASTING_APP, output_msg=[ + f'CommandHandler() setcommissionerpasscode user-entered passcode: {int(COMMISSIONER_GENERATED_PASSCODE, 16)}']), + + # Validate that the `IdentificationDeclaration` message sent from the tv-casting-app to the tv-app will contain the following entries: + # mCommissionerPasscode: true -> This flag instructs the commissioner to use the commissioner-generated-passcode flow for commissioning. + # mCommissionerPasscodeReady: true -> This flag indicates that the commissionee has obtained the commissioner passcode from the user and + # thus is ready for commissioning. + # Vendor ID: {COMMISSIONER_GENERATED_PASSCODE_VENDOR_ID} -> The initial VENDOR_ID of the casting player will be overridden to {COMMISSIONER_GENERATED_PASSCODE_VENDOR_ID}. + # Otherwise we will enter the commissionee-generated-passcode flow. + Step(app=App.TV_CASTING_APP, output_msg=['IdentificationDeclarationOptions::LogDetail()', 'IdentificationDeclarationOptions::mCommissionerPasscode: true', + 'IdentificationDeclarationOptions::mCommissionerPasscodeReady: true', 'IdentificationDeclarationOptions::TargetAppInfos list:', f'TargetAppInfo 1, Vendor ID: {COMMISSIONER_GENERATED_PASSCODE_VENDOR_ID}']), + + # Validate that pairing succeeded between the tv-casting-app and the tv-app. + Step(app=App.TV_APP, output_msg=['Secure Pairing Success']), + + # Validate that the connection succeeded in the tv-casting-app output. + Step(app=App.TV_CASTING_APP, output_msg=['Successfully connected to CastingPlayer']), + + # Validate that commissioning succeeded in the tv-app output. + Step(app=App.TV_APP, output_msg=['------PROMPT USER: commissioning success']), + + # Validate that we are able to subscribe to the media playback cluster by reading the CurrentState value and that it matches {ATTRIBUTE_CURRENT_PLAYBACK_STATE}. + Step(app=App.TV_CASTING_APP, output_msg=[f'Read CurrentState value: {ATTRIBUTE_CURRENT_PLAYBACK_STATE}']), + + # Validate the LaunchURL in the tv-app output. + Step(app=App.TV_APP, + output_msg=['ContentLauncherManager::HandleLaunchUrl TEST CASE ContentURL=https://www.test.com/videoid DisplayString=Test video']), + + # Validate the LaunchURL in the tv-casting-app output. + Step(app=App.TV_CASTING_APP, output_msg=['LaunchURL Success with response.data: exampleData']), + + # Signal to stop the tv-casting-app as we finished validation. + Step(app=App.TV_CASTING_APP, input_cmd=STOP_APP), + # Signal to stop the tv-app as we finished validation. Step(app=App.TV_APP, input_cmd=STOP_APP) ] diff --git a/scripts/tests/run_python_test.py b/scripts/tests/run_python_test.py index 7d7500c10f5a11..61ec274bfc1c64 100755 --- a/scripts/tests/run_python_test.py +++ b/scripts/tests/run_python_test.py @@ -32,7 +32,7 @@ import click import coloredlogs from colorama import Fore, Style -from py.metadata import Metadata, MetadataReader +from metadata_parser.metadata import Metadata, MetadataReader DEFAULT_CHIP_ROOT = os.path.abspath( os.path.join(os.path.dirname(__file__), '..', '..')) @@ -169,7 +169,8 @@ def main_impl(app: str, factoryreset: bool, factoryreset_app_only: bool, app_arg app_args = [app] + shlex.split(app_args) logging.info(f"Execute: {app_args}") app_process = subprocess.Popen( - app_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0) + app_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, bufsize=0) + app_process.stdin.close() app_pid = app_process.pid DumpProgramOutputToQueue( log_cooking_threads, Fore.GREEN + "APP " + Style.RESET_ALL, app_process, stream_output, log_queue) @@ -192,7 +193,8 @@ def main_impl(app: str, factoryreset: bool, factoryreset_app_only: bool, app_arg logging.info(f"Execute: {final_script_command}") test_script_process = subprocess.Popen( - final_script_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + final_script_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) + test_script_process.stdin.close() DumpProgramOutputToQueue(log_cooking_threads, Fore.GREEN + "TEST" + Style.RESET_ALL, test_script_process, stream_output, log_queue) diff --git a/scripts/tests/run_test_suite.py b/scripts/tests/run_test_suite.py index c22b4abff92f09..41b7b540a6dd50 100755 --- a/scripts/tests/run_test_suite.py +++ b/scripts/tests/run_test_suite.py @@ -239,6 +239,9 @@ def cmd_list(context): @click.option( '--lock-app', help='what lock app to use') +@click.option( + '--fabric-bridge-app', + help='what fabric bridge app to use') @click.option( '--ota-provider-app', help='what ota provider app to use') @@ -260,6 +263,9 @@ def cmd_list(context): @click.option( '--rvc-app', help='what rvc app to use') +@click.option( + '--network-manager-app', + help='what network-manager app to use') @click.option( '--chip-repl-yaml-tester', help='what python script to use for running yaml tests using chip-repl as controller') @@ -291,7 +297,8 @@ def cmd_list(context): help='Number of tests that are expected to fail in each iteration. Overall test will pass if the number of failures matches this. Nonzero values require --keep-going') @click.pass_context def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, ota_requestor_app, - tv_app, bridge_app, lit_icd_app, microwave_oven_app, rvc_app, chip_repl_yaml_tester, chip_tool_with_python, pics_file, keep_going, test_timeout_seconds, expected_failures): + fabric_bridge_app, tv_app, bridge_app, lit_icd_app, microwave_oven_app, rvc_app, network_manager_app, chip_repl_yaml_tester, + chip_tool_with_python, pics_file, keep_going, test_timeout_seconds, expected_failures): if expected_failures != 0 and not keep_going: logging.exception(f"'--expected-failures {expected_failures}' used without '--keep-going'") sys.exit(2) @@ -306,6 +313,9 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o if lock_app is None: lock_app = paths_finder.get('chip-lock-app') + if fabric_bridge_app is None: + fabric_bridge_app = paths_finder.get('fabric-bridge-app') + if ota_provider_app is None: ota_provider_app = paths_finder.get('chip-ota-provider-app') @@ -327,6 +337,9 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o if rvc_app is None: rvc_app = paths_finder.get('chip-rvc-app') + if network_manager_app is None: + network_manager_app = paths_finder.get('matter-network-manager-app') + if chip_repl_yaml_tester is None: chip_repl_yaml_tester = paths_finder.get('yamltest_with_chip_repl_tester.py') @@ -341,6 +354,7 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o chip_tool=[context.obj.chip_tool], all_clusters_app=[all_clusters_app], lock_app=[lock_app], + fabric_bridge_app=[fabric_bridge_app], ota_provider_app=[ota_provider_app], ota_requestor_app=[ota_requestor_app], tv_app=[tv_app], @@ -348,6 +362,7 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, o lit_icd_app=[lit_icd_app], microwave_oven_app=[microwave_oven_app], rvc_app=[rvc_app], + network_manager_app=[network_manager_app], chip_repl_yaml_tester_cmd=['python3'] + [chip_repl_yaml_tester], chip_tool_with_python_cmd=['python3'] + [chip_tool_with_python], ) diff --git a/scripts/tests/run_tv_casting_test.py b/scripts/tests/run_tv_casting_test.py old mode 100644 new mode 100755 index 13b003eed67e66..7b530c7a4a1780 --- a/scripts/tests/run_tv_casting_test.py +++ b/scripts/tests/run_tv_casting_test.py @@ -18,13 +18,14 @@ import logging import os import signal -import subprocess import sys import tempfile import time -from typing import List, TextIO, Tuple +from dataclasses import dataclass +from typing import List, Optional import click +from linux.log_line_processing import ProcessOutputCapture from linux.tv_casting_test_sequence_utils import App, Sequence, Step from linux.tv_casting_test_sequences import START_APP, STOP_APP @@ -35,108 +36,99 @@ a deterministic order. If these lines are not found, it indicates an issue with the casting experience. """ -# Configure logging format. -logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') -# File names of logs for the Linux tv-casting-app and the Linux tv-app. -LINUX_TV_APP_LOGS = 'Linux-tv-app-logs.txt' -LINUX_TV_CASTING_APP_LOGS = 'Linux-tv-casting-app-logs.txt' +@dataclass +class RunningProcesses: + tv_casting: ProcessOutputCapture = None + tv_app: ProcessOutputCapture = None -class ProcessManager: - """A context manager for managing subprocesses. +# Configure logging format. +logging.basicConfig(level=logging.INFO, format="%(levelname)s - %(message)s") + +# File names of logs for the Linux tv-casting-app and the Linux tv-app. +LINUX_TV_APP_LOGS = "Linux-tv-app-logs.txt" +LINUX_TV_CASTING_APP_LOGS = "Linux-tv-casting-app-logs.txt" - This class provides a context manager for safely starting and stopping a subprocess. - """ - def __init__(self, command: List[str], stdin, stdout, stderr): - self.command = command - self.stdin = stdin - self.stdout = stdout - self.stderr = stderr +class TestStepException(Exception): + """Thrown when a test fails, contains information about the test step that faied""" - def __enter__(self): - self.process = subprocess.Popen(self.command, stdin=self.stdin, stdout=self.stdout, stderr=self.stderr, text=True) - return self.process + def __init__(self, message, sequence_name: str, step: Optional[Step]): + super().__init__(message) + self.sequence_name = sequence_name + self.step = step - def __exit__(self, exception_type, exception_value, traceback): - self.process.terminate() - self.process.wait() + logging.error("EXCEPTION at %s/%r: %s", sequence_name, step, message) def remove_cached_files(cached_file_pattern: str): """Remove any cached files that match the provided pattern.""" - cached_files = glob.glob(cached_file_pattern) # Returns a list of paths that match the pattern. + cached_files = glob.glob( + cached_file_pattern + ) # Returns a list of paths that match the pattern. for cached_file in cached_files: try: os.remove(cached_file) except OSError as e: - logging.error(f'Failed to remove cached file `{cached_file}` with error: `{e.strerror}`') + logging.error( + f"Failed to remove cached file `{cached_file}` with error: `{e.strerror}`" + ) raise # Re-raise the OSError to propagate it up. -def dump_temporary_logs_to_console(log_file_path: str): - """Dump log file to the console; log file will be removed once the function exits.""" - """Write the entire content of `log_file_path` to the console.""" - print(f'\nDumping logs from: {log_file_path}') - - with open(log_file_path, 'r') as file: - for line in file: - print(line.rstrip()) - - -def handle_casting_failure(test_sequence_name: str, log_file_paths: List[str]): - """Log failure of validation of test sequence as error, dump log files to console, exit on error.""" - logging.error(f'{test_sequence_name} - Validation of test sequence failed.') - - for log_file_path in log_file_paths: - try: - dump_temporary_logs_to_console(log_file_path) - except Exception as e: - logging.exception(f'{test_sequence_name} - Failed to dump {log_file_path}: {e}') +def stop_app(test_sequence_name: str, app_name: str, app: ProcessOutputCapture): + """Stop the given `app` subprocess.""" - sys.exit(1) + app.process.terminate() + app_exit_code = app.process.wait() + if app.process.poll() is None: + raise TestStepException( + f"{test_sequence_name}: Failed to stop running {app_name}. Process is still running.", + test_sequence_name, + None, + ) -def stop_app(test_sequence_name: str, app_name: str, app: subprocess.Popen) -> bool: - """Stop the given `app` subprocess.""" + if app_exit_code >= 0: + raise TestStepException( + f"{test_sequence_name}: {app_name} exited with unexpected exit code {app_exit_code}.", + test_sequence_name, + None, + ) - app.terminate() - app_exit_code = app.wait() - - if app.poll() is None: - logging.error(f'{test_sequence_name}: Failed to stop running {app_name}. Process is still running.') - else: - if app_exit_code < 0: - signal_number = -app_exit_code - if signal_number == signal.SIGTERM.value: - logging.info(f'{test_sequence_name}: {app_name} stopped by {signal_number} (SIGTERM) signal.') - return True - else: - logging.error( - f'{test_sequence_name}: {app_name} stopped by signal {signal_number} instead of {signal.SIGTERM.value} (SIGTERM).') - else: - logging.error(f'{test_sequence_name}: {app_name} exited with unexpected exit code {app_exit_code}.') + signal_number = -app_exit_code + if signal_number != signal.SIGTERM.value: + raise TestStepException( + f"{test_sequence_name}: {app_name} stopped by signal {signal_number} instead of {signal.SIGTERM.value} (SIGTERM).", + test_sequence_name, + None, + ) - return False + logging.info( + f"{test_sequence_name}: {app_name} stopped by {signal_number} (SIGTERM) signal." + ) def parse_output_msg_in_subprocess( - tv_casting_app_info: Tuple[subprocess.Popen, TextIO], - tv_app_info: Tuple[subprocess.Popen, TextIO], - log_paths: List[str], - test_sequence_name: str, - test_sequence_step: Step -) -> bool: + processes: RunningProcesses, test_sequence_name: str, test_sequence_step: Step +): """Parse the output of a given `app` subprocess and validate its output against the expected `output_msg` in the given `Step`.""" if not test_sequence_step.output_msg: - logging.error(f'{test_sequence_name} - No output message provided in the test sequence step.') - return False - - app_subprocess, app_log_file = (tv_casting_app_info if test_sequence_step.app == App.TV_CASTING_APP else tv_app_info) + raise TestStepException( + f"{test_sequence_name} - No output message provided in the test sequence step.", + test_sequence_name, + test_sequence_step, + ) + + app_subprocess = ( + processes.tv_casting + if test_sequence_step.app == App.TV_CASTING_APP + else processes.tv_app + ) start_wait_time = time.time() msg_block = [] @@ -144,115 +136,106 @@ def parse_output_msg_in_subprocess( current_index = 0 while current_index < len(test_sequence_step.output_msg): # Check if we exceeded the maximum wait time to parse for the output string(s). - if time.time() - start_wait_time > test_sequence_step.timeout_sec: - logging.error( - f'{test_sequence_name} - Did not find the expected output string(s) in the {test_sequence_step.app.value} subprocess within the timeout: {test_sequence_step.output_msg}') - return False - - output_line = app_subprocess.stdout.readline() + max_wait_time = start_wait_time + test_sequence_step.timeout_sec - time.time() + if max_wait_time < 0: + raise TestStepException( + f"{test_sequence_name} - Did not find the expected output string(s) in the {test_sequence_step.app.value} subprocess within the timeout: {test_sequence_step.output_msg}", + test_sequence_name, + test_sequence_step, + ) + output_line = app_subprocess.next_output_line(max_wait_time) if output_line: - app_log_file.write(output_line) - app_log_file.flush() - - if (test_sequence_step.output_msg[current_index] in output_line): - msg_block.append(output_line.rstrip('\n')) + if test_sequence_step.output_msg[current_index] in output_line: + msg_block.append(output_line.rstrip("\n")) current_index += 1 elif msg_block: - msg_block.append(output_line.rstrip('\n')) - if (test_sequence_step.output_msg[0] in output_line): + msg_block.append(output_line.rstrip("\n")) + if test_sequence_step.output_msg[0] in output_line: msg_block.clear() - msg_block.append(output_line.rstrip('\n')) + msg_block.append(output_line.rstrip("\n")) current_index = 1 # Sanity check that `Discovered Commissioner #0` is the valid commissioner. - elif 'Discovered Commissioner #' in output_line: - logging.error(f'{test_sequence_name} - The valid discovered commissioner should be `Discovered Commissioner #0`.') - handle_casting_failure(test_sequence_name, log_paths) + elif "Discovered Commissioner #" in output_line: + raise TestStepException( + f"{test_sequence_name} - The valid discovered commissioner should be `Discovered Commissioner #0`.", + test_sequence_name, + test_sequence_step, + ) if current_index == len(test_sequence_step.output_msg): - logging.info(f'{test_sequence_name} - Found the expected output string(s) in the {test_sequence_step.app.value} subprocess:') + logging.info( + f"{test_sequence_name} - Found the expected output string(s) in the {test_sequence_step.app.value} subprocess:" + ) for line in msg_block: - logging.info(f'{test_sequence_name} - {line}') + logging.info(f"{test_sequence_name} - {line}") + + # successful completion + return - return True + raise TestStepException("Unexpected exit", test_sequence_name, test_sequence_step) def send_input_cmd_to_subprocess( - tv_casting_app_info: Tuple[subprocess.Popen, TextIO], - tv_app_info: Tuple[subprocess.Popen, TextIO], + processes: RunningProcesses, test_sequence_name: str, - test_sequence_step: Step -) -> bool: + test_sequence_step: Step, +): """Send a given input command (`input_cmd`) from the `Step` to its given `app` subprocess.""" if not test_sequence_step.input_cmd: - logging.error(f'{test_sequence_name} - No input command provided in the test sequence step.') - return False - - app_subprocess, app_log_file = (tv_casting_app_info if test_sequence_step.app == App.TV_CASTING_APP else tv_app_info) + raise TestStepException( + f"{test_sequence_name} - No input command provided in the test sequence step.", + test_sequence_step, + test_sequence_step, + ) + + app_subprocess = ( + processes.tv_casting + if test_sequence_step.app == App.TV_CASTING_APP + else processes.tv_app + ) app_name = test_sequence_step.app.value input_cmd = test_sequence_step.input_cmd - app_subprocess.stdin.write(input_cmd) - app_subprocess.stdin.flush() - - input_cmd = input_cmd.rstrip('\n') - logging.info(f'{test_sequence_name} - Sent `{input_cmd}` to the {app_name} subprocess.') - - return True + app_subprocess.send_to_program(input_cmd) - -def handle_output_msg( - tv_casting_app_info: Tuple[subprocess.Popen, TextIO], - tv_app_info: Tuple[subprocess.Popen, TextIO], - log_paths: List[str], - test_sequence_name: str, - test_sequence_step: Step -): - """Handle the output message (`output_msg`) from a test sequence step.""" - - if not parse_output_msg_in_subprocess(tv_casting_app_info, tv_app_info, log_paths, test_sequence_name, test_sequence_step): - handle_casting_failure(test_sequence_name, log_paths) + input_cmd = input_cmd.rstrip("\n") + logging.info( + f"{test_sequence_name} - Sent `{input_cmd}` to the {app_name} subprocess." + ) def handle_input_cmd( - tv_casting_app_info: Tuple[subprocess.Popen, TextIO], - tv_app_info: Tuple[subprocess.Popen, TextIO], - log_paths: List[str], - test_sequence_name: str, - test_sequence_step: Step + processes: RunningProcesses, test_sequence_name: str, test_sequence_step: Step ): """Handle the input command (`input_cmd`) from a test sequence step.""" - - tv_casting_app_process, tv_casting_app_log_file = tv_casting_app_info - tv_app_process, tv_app_log_file = tv_app_info - if test_sequence_step.input_cmd == STOP_APP: if test_sequence_step.app == App.TV_CASTING_APP: - # Stop the tv-casting-app subprocess. - if not stop_app(test_sequence_name, test_sequence_step.app.value, tv_casting_app_process): - handle_casting_failure(test_sequence_name, log_paths) + stop_app( + test_sequence_name, test_sequence_step.app.value, processes.tv_casting + ) elif test_sequence_step.app == App.TV_APP: - # Stop the tv-app subprocess. - if not stop_app(test_sequence_name, test_sequence_step.app.value, tv_app_process): - handle_casting_failure(test_sequence_name, log_paths) - else: - if not send_input_cmd_to_subprocess(tv_casting_app_info, tv_app_info, test_sequence_name, test_sequence_step): - handle_casting_failure(test_sequence_name, log_paths) + stop_app(test_sequence_name, test_sequence_step.app.value, processes.tv_app) + else: + raise TestStepException( + "Unknown stop app", test_sequence_name, test_sequence_step + ) + return + + send_input_cmd_to_subprocess(processes, test_sequence_name, test_sequence_step) def run_test_sequence_steps( current_index: int, test_sequence_name: str, test_sequence_steps: List[Step], - tv_casting_app_info: Tuple[subprocess.Popen, TextIO], - tv_app_info: Tuple[subprocess.Popen, TextIO], - log_paths: List[str] + processes: RunningProcesses, ): """Run through the test steps from a test sequence starting from the current index and perform actions based on the presence of `output_msg` or `input_cmd`.""" if test_sequence_steps is None: - logging.error('No test sequence steps provided.') + logging.error("No test sequence steps provided.") while current_index < len(test_sequence_steps): # Current step in the list of steps. @@ -260,101 +243,190 @@ def run_test_sequence_steps( # A test sequence step contains either an output_msg or input_cmd entry. if test_sequence_step.output_msg: - handle_output_msg(tv_casting_app_info, tv_app_info, log_paths, test_sequence_name, test_sequence_step) + parse_output_msg_in_subprocess( + processes, + test_sequence_name, + test_sequence_step, + ) elif test_sequence_step.input_cmd: - handle_input_cmd(tv_casting_app_info, tv_app_info, log_paths, test_sequence_name, test_sequence_step) + handle_input_cmd( + processes, + test_sequence_name, + test_sequence_step, + ) current_index += 1 +def cmd_execute_list(app_path): + """Returns the list suitable to pass to a ProcessOutputCapture/subprocess.run for execution.""" + cmd = [] + + # On Unix-like systems, use stdbuf to disable stdout buffering. + # Configure command options to disable stdout buffering during tests. + if sys.platform == "darwin" or sys.platform == "linux": + cmd = ["stdbuf", "-o0", "-i0"] + + cmd.append(app_path) + + # Our applications support better debugging logs. Enable them + cmd.append("--trace-to") + cmd.append("json:log") + + return cmd + + @click.command() -@click.option('--tv-app-rel-path', type=str, default='out/tv-app/chip-tv-app', help='Path to the Linux tv-app executable.') -@click.option('--tv-casting-app-rel-path', type=str, default='out/tv-casting-app/chip-tv-casting-app', help='Path to the Linux tv-casting-app executable.') -def test_casting_fn(tv_app_rel_path, tv_casting_app_rel_path): +@click.option( + "--tv-app-rel-path", + type=str, + default="out/tv-app/chip-tv-app", + help="Path to the Linux tv-app executable.", +) +@click.option( + "--tv-casting-app-rel-path", + type=str, + default="out/tv-casting-app/chip-tv-casting-app", + help="Path to the Linux tv-casting-app executable.", +) +@click.option( + "--commissioner-generated-passcode", + type=bool, + default=False, + help="Enable the commissioner generated passcode test flow.", +) +@click.option( + "--log-directory", + type=str, + default=None, + help="Where to place output logs", +) +def test_casting_fn( + tv_app_rel_path, tv_casting_app_rel_path, commissioner_generated_passcode, log_directory +): """Test if the casting experience between the Linux tv-casting-app and the Linux tv-app continues to work. - Default paths for the executables are provided but can be overridden via command line arguments. - For example: python3 run_tv_casting_test.py --tv-app-rel-path=path/to/tv-app - --tv-casting-app-rel-path=path/to/tv-casting-app - """ + By default, it uses the provided executable paths and the commissionee generated passcode flow as the test sequence. - # Store the log files to a temporary directory. - with tempfile.TemporaryDirectory() as temp_dir: - linux_tv_app_log_path = os.path.join(temp_dir, LINUX_TV_APP_LOGS) - linux_tv_casting_app_log_path = os.path.join(temp_dir, LINUX_TV_CASTING_APP_LOGS) + Example usages: + 1. Use default paths and test sequence: + python3 run_tv_casting_test.py - with open(linux_tv_app_log_path, 'w') as linux_tv_app_log_file, open(linux_tv_casting_app_log_path, 'w') as linux_tv_casting_app_log_file: + 2. Use custom executable paths and default test sequence: + python3 run_tv_casting_test.py --tv-app-rel-path=path/to/tv-app --tv-casting-app-rel-path=path/to/tv-casting-app - # Get all the test sequences. - test_sequences = Sequence.get_test_sequences() + 3. Use default paths and a test sequence that is not the default test sequence (replace `test-sequence-name` with the actual name of the test sequence): + python3 run_tv_casting_test.py --test-sequence-name=True - # Get the test sequence of interest. - test_sequence = Sequence.get_test_sequence_by_name(test_sequences, 'commissionee_generated_passcode_test') + 4. Use custom executable paths and a test sequence that is not the default test sequence (replace `test-sequence-name` with the actual name of the test sequence): + python3 run_tv_casting_test.py --tv-app-rel-path=path/to/tv-app --tv-casting-app-rel-path=path/to/tv-casting-app --test-sequence-name=True - if not test_sequence: - logging.error('No test sequence found by the test sequence name provided.') - handle_casting_failure(None, []) + Note: In order to enable a new test sequence, we also need to define a @click.option() entry for the test sequence. + """ - # At this point, we have retrieved the test sequence of interest. - test_sequence_name = test_sequence.name - test_sequence_steps = test_sequence.steps + # Store the log files to a temporary directory. + with tempfile.TemporaryDirectory() as temp_dir: + if log_directory: + linux_tv_app_log_path = os.path.join(log_directory, LINUX_TV_APP_LOGS) + linux_tv_casting_app_log_path = os.path.join( + log_directory, LINUX_TV_CASTING_APP_LOGS + ) + else: + linux_tv_app_log_path = os.path.join(temp_dir, LINUX_TV_APP_LOGS) + linux_tv_casting_app_log_path = os.path.join( + temp_dir, LINUX_TV_CASTING_APP_LOGS + ) + + # Get all the test sequences. + test_sequences = Sequence.get_test_sequences() + + # Get the test sequence that we are interested in validating. + test_sequence_name = "commissionee_generated_passcode_test" + if commissioner_generated_passcode: + test_sequence_name = "commissioner_generated_passcode_test" + test_sequence = Sequence.get_test_sequence_by_name( + test_sequences, test_sequence_name + ) + + if not test_sequence: + raise TestStepException( + "No test sequence found by the test sequence name provided.", + test_sequence_name, + None, + ) + + # At this point, we have retrieved the test sequence of interest. + test_sequence_steps = test_sequence.steps + + current_index = 0 + if test_sequence_steps[current_index].input_cmd != START_APP: + raise ValueError( + f"{test_sequence_name}: The first step in the test sequence must contain `START_APP` as `input_cmd` to indicate starting the tv-app." + ) + elif test_sequence_steps[current_index].app != App.TV_APP: + raise ValueError( + f"{test_sequence_name}: The first step in the test sequence must be to start up the tv-app." + ) + current_index += 1 - # Configure command options to disable stdout buffering during tests. - disable_stdout_buffering_cmd = [] - # On Unix-like systems, use stdbuf to disable stdout buffering. - if sys.platform == 'darwin' or sys.platform == 'linux': - disable_stdout_buffering_cmd = ['stdbuf', '-o0', '-i0'] + tv_app_abs_path = os.path.abspath(tv_app_rel_path) + # Run the Linux tv-app subprocess. + with ProcessOutputCapture( + cmd_execute_list(tv_app_abs_path), linux_tv_app_log_path + ) as tv_app_process: + # Verify that the tv-app is up and running. + parse_output_msg_in_subprocess( + RunningProcesses(tv_app=tv_app_process), + test_sequence_name, + test_sequence_steps[current_index], + ) + current_index += 1 - current_index = 0 if test_sequence_steps[current_index].input_cmd != START_APP: raise ValueError( - f'{test_sequence_name}: The first step in the test sequence must contain `START_APP` as `input_cmd` to indicate starting the tv-app.') - elif test_sequence_steps[current_index].app != App.TV_APP: - raise ValueError(f'{test_sequence_name}: The first step in the test sequence must be to start up the tv-app.') + f"{test_sequence_name}: The third step in the test sequence must contain `START_APP` as `input_cmd` to indicate starting the tv-casting-app." + ) + elif test_sequence_steps[current_index].app != App.TV_CASTING_APP: + raise ValueError( + f"{test_sequence_name}: The third step in the test sequence must be to start up the tv-casting-app." + ) current_index += 1 - tv_app_abs_path = os.path.abspath(tv_app_rel_path) - # Run the Linux tv-app subprocess. - with ProcessManager(disable_stdout_buffering_cmd + [tv_app_abs_path], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as tv_app_process: - tv_app_info = (tv_app_process, linux_tv_app_log_file) - - # Verify that the tv-app is up and running. - handle_output_msg(None, tv_app_info, [linux_tv_app_log_path], - test_sequence_name, test_sequence_steps[current_index]) + tv_casting_app_abs_path = os.path.abspath(tv_casting_app_rel_path) + # Run the Linux tv-casting-app subprocess. + with ProcessOutputCapture( + cmd_execute_list(tv_casting_app_abs_path), linux_tv_casting_app_log_path + ) as tv_casting_app_process: + processes = RunningProcesses( + tv_casting=tv_casting_app_process, tv_app=tv_app_process + ) + + # Verify that the server initialization is completed in the tv-casting-app output. + parse_output_msg_in_subprocess( + processes, + test_sequence_name, + test_sequence_steps[current_index], + ) current_index += 1 - if test_sequence_steps[current_index].input_cmd != START_APP: - raise ValueError( - f'{test_sequence_name}: The third step in the test sequence must contain `START_APP` as `input_cmd` to indicate starting the tv-casting-app.') - elif test_sequence_steps[current_index].app != App.TV_CASTING_APP: - raise ValueError( - f'{test_sequence_name}: The third step in the test sequence must be to start up the tv-casting-app.') - current_index += 1 - - tv_casting_app_abs_path = os.path.abspath(tv_casting_app_rel_path) - # Run the Linux tv-casting-app subprocess. - with ProcessManager(disable_stdout_buffering_cmd + [tv_casting_app_abs_path], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as tv_casting_app_process: - log_paths = [linux_tv_app_log_path, linux_tv_casting_app_log_path] - tv_casting_app_info = (tv_casting_app_process, linux_tv_casting_app_log_file) - - # Verify that the server initialization is completed in the tv-casting-app output. - handle_output_msg(tv_casting_app_info, tv_app_info, log_paths, - test_sequence_name, test_sequence_steps[current_index]) - current_index += 1 - - run_test_sequence_steps(current_index, test_sequence_name, test_sequence_steps, - tv_casting_app_info, tv_app_info, log_paths) + run_test_sequence_steps( + current_index, + test_sequence_name, + test_sequence_steps, + processes, + ) -if __name__ == '__main__': +if __name__ == "__main__": # Start with a clean slate by removing any previously cached entries. try: - cached_file_pattern = '/tmp/chip_*' + cached_file_pattern = "/tmp/chip_*" remove_cached_files(cached_file_pattern) except OSError: logging.error( - f'Error while removing cached files with file pattern: {cached_file_pattern}') + f"Error while removing cached files with file pattern: {cached_file_pattern}" + ) sys.exit(1) # Test casting (discovery and commissioning) between the Linux tv-casting-app and the tv-app. diff --git a/scripts/tools/check_includes_config.py b/scripts/tools/check_includes_config.py index 20c853b9906df8..8790faf1666b08 100644 --- a/scripts/tools/check_includes_config.py +++ b/scripts/tools/check_includes_config.py @@ -128,6 +128,8 @@ 'src/app/clusters/application-launcher-server/application-launcher-server.cpp': {'string'}, 'src/app/clusters/application-launcher-server/application-launcher-delegate.h': {'list'}, 'src/app/clusters/audio-output-server/audio-output-delegate.h': {'list'}, + # EcosystemInformationCluster is for Fabric Sync and is intended to run on device that are capable of handling these types. + 'src/app/clusters/ecosystem-information-server/ecosystem-information-server.h': {'map', 'string', 'vector'}, 'src/app/clusters/channel-server/channel-delegate.h': {'list'}, 'src/app/clusters/content-launch-server/content-launch-delegate.h': {'list'}, 'src/app/clusters/content-launch-server/content-launch-server.cpp': {'list'}, @@ -137,6 +139,7 @@ 'src/credentials/attestation_verifier/FileAttestationTrustStore.h': {'vector'}, 'src/credentials/attestation_verifier/FileAttestationTrustStore.cpp': {'string'}, + 'src/credentials/attestation_verifier/TestDACRevocationDelegateImpl.cpp': {'fstream'}, 'src/setup_payload/AdditionalDataPayload.h': {'string'}, 'src/setup_payload/AdditionalDataPayloadParser.cpp': {'vector', 'string'}, diff --git a/scripts/tools/generate_esp32_chip_factory_bin.py b/scripts/tools/generate_esp32_chip_factory_bin.py index b641ef05b6cd88..b19748ca31b197 100755 --- a/scripts/tools/generate_esp32_chip_factory_bin.py +++ b/scripts/tools/generate_esp32_chip_factory_bin.py @@ -21,6 +21,7 @@ import logging import os import sys +from enum import Enum from types import SimpleNamespace import cryptography.x509 @@ -45,6 +46,40 @@ INVALID_PASSCODES = [00000000, 11111111, 22222222, 33333333, 44444444, 55555555, 66666666, 77777777, 88888888, 99999999, 12345678, 87654321] + +class Product_Finish_Enum(Enum): + other = 0 + matte = 1 + satin = 2 + polished = 3 + rugged = 4 + fabric = 5 + + +class Product_Color_Enum(Enum): + black = 0 + navy = 1 + green = 2 + teal = 3 + maroon = 4 + purple = 5 + olive = 6 + gray = 7 + blue = 8 + lime = 9 + aqua = 10 + red = 11 + fuchsia = 12 + yellow = 13 + white = 14 + nickel = 15 + chrome = 16 + brass = 17 + copper = 18 + silver = 19 + gold = 20 + + TOOLS = {} FACTORY_PARTITION_CSV = 'nvs_partition.csv' @@ -149,6 +184,31 @@ 'encoding': 'hex2bin', 'value': None, }, + 'product-finish': { + 'type': 'data', + 'encoding': 'u32', + 'value': None, + }, + 'product-color': { + 'type': 'data', + 'encoding': 'u32', + 'value': None, + }, + 'part-number': { + 'type': 'data', + 'encoding': 'string', + 'value': None, + }, + 'product-label': { + 'type': 'data', + 'encoding': 'string', + 'value': None, + }, + 'product-url': { + 'type': 'data', + 'encoding': 'string', + 'value': None, + }, } @@ -159,6 +219,39 @@ def ishex(s): except ValueError: return False +# get_supported_modes_dict() converts the list of strings to per endpoint dictionaries. +# example with semantic tags +# input : ['0/label1/1/"1\0x8000, 2\0x8000" 1/label2/1/"1\0x8000, 2\0x8000"'] +# output : {'1': [{'Label': 'label1', 'Mode': 0, 'Semantic_Tag': [{'value': 1, 'mfgCode': 32768}, {'value': 2, 'mfgCode': 32768}]}, {'Label': 'label2', 'Mode': 1, 'Semantic_Tag': [{'value': 1, 'mfgCode': 32768}, {'value': 2, 'mfgCode': 32768}]}]} + +# example without semantic tags +# input : ['0/label1/1 1/label2/1'] +# output : {'1': [{'Label': 'label1', 'Mode': 0, 'Semantic_Tag': []}, {'Label': 'label2', 'Mode': 1, 'Semantic_Tag': []}]} + + +def get_supported_modes_dict(supported_modes): + output_dict = {} + + for mode_str in supported_modes: + mode_label_strs = mode_str.split('/') + mode = mode_label_strs[0] + label = mode_label_strs[1] + ep = mode_label_strs[2] + + semantic_tags = '' + if (len(mode_label_strs) == 4): + semantic_tag_strs = mode_label_strs[3].split(', ') + semantic_tags = [{"value": int(v.split('\\')[0]), "mfgCode": int(v.split('\\')[1], 16)} for v in semantic_tag_strs] + + mode_dict = {"Label": label, "Mode": int(mode), "Semantic_Tag": semantic_tags} + + if ep in output_dict: + output_dict[ep].append(mode_dict) + else: + output_dict[ep] = [mode_dict] + + return output_dict + def check_str_range(s, min_len, max_len, name): if s and ((len(s) < min_len) or (len(s) > max_len)): @@ -268,6 +361,70 @@ def populate_factory_data(args, spake2p_params): FACTORY_DATA['hardware-ver']['value'] = args.hw_ver if args.hw_ver_str: FACTORY_DATA['hw-ver-str']['value'] = args.hw_ver_str + if args.product_finish: + FACTORY_DATA['product-finish']['value'] = Product_Finish_Enum[args.product_finish].value + if args.product_color: + FACTORY_DATA['product-color']['value'] = Product_Color_Enum[args.product_color].value + if args.part_number: + FACTORY_DATA['part-number']['value'] = args.part_number + if args.product_url: + FACTORY_DATA['product-url']['value'] = args.product_url + if args.product_label: + FACTORY_DATA['product-label']['value'] = args.product_label + + # SupportedModes are stored as multiple entries + # - sm-sz/ : number of supported modes for the endpoint + # - sm-label// : supported modes label key for the endpoint and index + # - sm-mode// : supported modes mode key for the endpoint and index + # - sm-st-sz// : supported modes SemanticTag key for the endpoint and index + # - st-v/// : semantic tag value key for the endpoint and index and ind + # - st-mfg/// : semantic tag mfg code key for the endpoint and index and ind + if (args.supported_modes is not None): + dictionary = get_supported_modes_dict(args.supported_modes) + for ep in dictionary.keys(): + _sz = { + 'type': 'data', + 'encoding': 'u32', + 'value': len(dictionary[ep]) + } + FACTORY_DATA.update({'sm-sz/{:x}'.format(int(ep)): _sz}) + for i in range(len(dictionary[ep])): + item = dictionary[ep][i] + _label = { + 'type': 'data', + 'encoding': 'string', + 'value': item["Label"] + } + _mode = { + 'type': 'data', + 'encoding': 'u32', + 'value': item["Mode"] + } + _st_sz = { + 'type': 'data', + 'encoding': 'u32', + 'value': len(item["Semantic_Tag"]) + } + FACTORY_DATA.update({'sm-label/{:x}/{:x}'.format(int(ep), i): _label}) + FACTORY_DATA.update({'sm-mode/{:x}/{:x}'.format(int(ep), i): _mode}) + FACTORY_DATA.update({'sm-st-sz/{:x}/{:x}'.format(int(ep), i): _st_sz}) + + for j in range(len(item["Semantic_Tag"])): + entry = item["Semantic_Tag"][j] + + _value = { + 'type': 'data', + 'encoding': 'u32', + 'value': entry["value"] + } + _mfg_code = { + 'type': 'data', + 'encoding': 'u32', + 'value': entry["mfgCode"] + } + + FACTORY_DATA.update({'st-v/{:x}/{:x}/{:x}'.format(int(ep), i, j): _value}) + FACTORY_DATA.update({'st-mfg/{:x}/{:x}/{:x}'.format(int(ep), i, j): _mfg_code}) def gen_raw_ec_keypair_from_der(key_file, pubkey_raw_file, privkey_raw_file): @@ -381,6 +538,21 @@ def any_base_int(s): return int(s, 0) help=('128-bit unique identifier for generating rotating device identifier, ' 'provide 32-byte hex string, e.g. "1234567890abcdef1234567890abcdef"')) + parser.add_argument('--supported-modes', type=str, nargs='+', required=False, + help='List of supported modes, eg: mode1/label1/ep/"tagValue1\\mfgCode, tagValue2\\mfgCode" mode2/label2/ep/"tagValue1\\mfgCode, tagValue2\\mfgCode" mode3/label3/ep/"tagValue1\\mfgCode, tagValue2\\mfgCode"') + + product_finish_choices = [finish.name for finish in Product_Finish_Enum] + parser.add_argument("--product-finish", type=str, choices=product_finish_choices, + help='Product finishes choices for product appearance') + + product_color_choices = [color.name for color in Product_Color_Enum] + parser.add_argument("--product-color", type=str, choices=product_color_choices, + help='Product colors choices for product appearance') + + parser.add_argument("--part-number", type=str, help='human readable product number') + parser.add_argument("--product-label", type=str, help='human readable product label') + parser.add_argument("--product-url", type=str, help='link to product specific web page') + parser.add_argument('-s', '--size', type=any_base_int, default=0x6000, help='The size of the partition.bin, default: 0x6000') parser.add_argument('--target', default='esp32', diff --git a/scripts/tools/memory/platform/p6.cfg b/scripts/tools/memory/platform/psoc6.cfg similarity index 76% rename from scripts/tools/memory/platform/p6.cfg rename to scripts/tools/memory/platform/psoc6.cfg index 7b6184d378e4f6..ea67d5c7e2f622 100644 --- a/scripts/tools/memory/platform/p6.cfg +++ b/scripts/tools/memory/platform/psoc6.cfg @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Memory tools default configuation for Infineon P6. +# Memory tools default configuation for Infineon PSOC6. { 'section': { @@ -30,17 +30,13 @@ # 'end': [], # } # }, - 'region': { - # Regions are sets of sections that can be used for aggregate reports. - 'sections': { - 'FLASH': [ - '.text', - '.rodata', - ], - 'RAM': [ - '.bss', - '.data', - ], - } - }, +# 'region': { +# # Regions are sets of sections that can be used for aggregate reports. +# 'sections': { +# 'FLASH': [ +# ], +# 'RAM': [ +# ] +# } +# }, } diff --git a/scripts/tools/zap/tests/inputs/all-clusters-app.zap b/scripts/tools/zap/tests/inputs/all-clusters-app.zap index 825cf1cd6242c0..570e1711e53d6b 100644 --- a/scripts/tools/zap/tests/inputs/all-clusters-app.zap +++ b/scripts/tools/zap/tests/inputs/all-clusters-app.zap @@ -19,18 +19,18 @@ "package": [ { "pathRelativity": "relativeToZap", - "path": "../../../../../src/app/zap-templates/zcl/zcl-with-test-extensions.json", - "type": "zcl-properties", + "path": "../../../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", "category": "matter", - "version": 1, - "description": "Matter SDK ZCL data with some extensions" + "version": "chip-v1" }, { "pathRelativity": "relativeToZap", - "path": "../../../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", + "path": "../../../../../src/app/zap-templates/zcl/zcl-with-test-extensions.json", + "type": "zcl-properties", "category": "matter", - "version": "chip-v1" + "version": 1, + "description": "Matter SDK ZCL data with some extensions" } ], "endpointTypes": [ @@ -7303,7 +7303,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -17807,7 +17807,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/scripts/tools/zap/tests/inputs/lighting-app.zap b/scripts/tools/zap/tests/inputs/lighting-app.zap index 53b5cb008a201b..9935fea81069d3 100644 --- a/scripts/tools/zap/tests/inputs/lighting-app.zap +++ b/scripts/tools/zap/tests/inputs/lighting-app.zap @@ -4922,7 +4922,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -5813,7 +5813,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/access.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/access.h index 282335c5b25384..9b4ddb220986ad 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/access.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/access.h @@ -33,9 +33,6 @@ /* Cluster: Level Control, Attribute: StartUpCurrentLevel, Privilege: view */ \ 0x0000001F, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ 0x0000001F, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ - /* Cluster: Access Control, Attribute: SubjectsPerAccessControlEntry, Privilege: view */ \ - /* Cluster: Access Control, Attribute: TargetsPerAccessControlEntry, Privilege: view */ \ - /* Cluster: Access Control, Attribute: AccessControlEntriesPerFabric, Privilege: view */ \ /* Cluster: Basic Information, Attribute: NodeLabel, Privilege: view */ \ /* Cluster: Basic Information, Attribute: Location, Privilege: view */ \ /* Cluster: Basic Information, Attribute: LocalConfigDisabled, Privilege: view */ \ @@ -79,9 +76,6 @@ /* Cluster: Level Control, Attribute: StartUpCurrentLevel, Privilege: view */ \ 0x00000000, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ 0x00000001, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ - /* Cluster: Access Control, Attribute: SubjectsPerAccessControlEntry, Privilege: view */ \ - /* Cluster: Access Control, Attribute: TargetsPerAccessControlEntry, Privilege: view */ \ - /* Cluster: Access Control, Attribute: AccessControlEntriesPerFabric, Privilege: view */ \ /* Cluster: Basic Information, Attribute: NodeLabel, Privilege: view */ \ /* Cluster: Basic Information, Attribute: Location, Privilege: view */ \ /* Cluster: Basic Information, Attribute: LocalConfigDisabled, Privilege: view */ \ @@ -125,9 +119,6 @@ /* Cluster: Level Control, Attribute: StartUpCurrentLevel, Privilege: view */ \ chip::Access::Privilege::kAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ chip::Access::Privilege::kAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ - /* Cluster: Access Control, Attribute: SubjectsPerAccessControlEntry, Privilege: view */ \ - /* Cluster: Access Control, Attribute: TargetsPerAccessControlEntry, Privilege: view */ \ - /* Cluster: Access Control, Attribute: AccessControlEntriesPerFabric, Privilege: view */ \ /* Cluster: Basic Information, Attribute: NodeLabel, Privilege: view */ \ /* Cluster: Basic Information, Attribute: Location, Privilege: view */ \ /* Cluster: Basic Information, Attribute: LocalConfigDisabled, Privilege: view */ \ @@ -517,18 +508,24 @@ #define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ 0x0000001F, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ 0x0000001F, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ + 0x0000001F, /* Cluster: Access Control, Event: AccessRestrictionEntryChanged, Privilege: administer */ \ + 0x0000001F, /* Cluster: Access Control, Event: FabricRestrictionReviewUpdate, Privilege: administer */ \ } // Parallel array data (cluster, *event*, privilege) for read event #define GENERATED_ACCESS_READ_EVENT__EVENT { \ 0x00000000, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ 0x00000001, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ + 0x00000002, /* Cluster: Access Control, Event: AccessRestrictionEntryChanged, Privilege: administer */ \ + 0x00000003, /* Cluster: Access Control, Event: FabricRestrictionReviewUpdate, Privilege: administer */ \ } // Parallel array data (cluster, event, *privilege*) for read event #define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ chip::Access::Privilege::kAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ chip::Access::Privilege::kAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ + chip::Access::Privilege::kAdminister, /* Cluster: Access Control, Event: AccessRestrictionEntryChanged, Privilege: administer */ \ + chip::Access::Privilege::kAdminister, /* Cluster: Access Control, Event: FabricRestrictionReviewUpdate, Privilege: administer */ \ } //////////////////////////////////////////////////////////////////////////////// diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h index 8289394bce6d89..c60950077fb372 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h @@ -261,7 +261,7 @@ #define GENERATED_DEFAULTS_COUNT (30) // This is an array of EmberAfAttributeMinMaxValue structures. -#define GENERATED_MIN_MAX_DEFAULT_COUNT 48 +#define GENERATED_MIN_MAX_DEFAULT_COUNT 50 #define GENERATED_MIN_MAX_DEFAULTS \ { \ \ @@ -275,7 +275,8 @@ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x2 }, /* switch actions */ \ \ /* Endpoint: 1, Cluster: Level Control (server) */ \ - { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x3 }, /* Options */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x3 }, /* Options */ \ + { (uint16_t) 0x32, (uint16_t) 0x1, (uint16_t) 0xFF }, /* DefaultMoveRate */ \ \ /* Endpoint: 1, Cluster: Binary Input (Basic) (server) */ \ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x1 }, /* out of service */ \ @@ -289,6 +290,9 @@ /* Endpoint: 1, Cluster: Valve Configuration and Control (server) */ \ { (uint16_t) 0x64, (uint16_t) 0x1, (uint16_t) 0x64 }, /* DefaultOpenLevel */ \ \ + /* Endpoint: 1, Cluster: Energy EVSE (server) */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0xFFFE }, /* ApproximateEVEfficiency */ \ + \ /* Endpoint: 1, Cluster: Window Covering (server) */ \ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0xF }, /* Mode */ \ \ @@ -351,7 +355,7 @@ } // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 1057 +#define GENERATED_ATTRIBUTE_COUNT 1055 #define GENERATED_ATTRIBUTES \ { \ \ @@ -825,16 +829,16 @@ ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* OnTransitionTime */ \ { ZAP_EMPTY_DEFAULT(), 0x00000013, 2, ZAP_TYPE(INT16U), \ ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* OffTransitionTime */ \ - { ZAP_SIMPLE_DEFAULT(50), 0x00000014, 1, ZAP_TYPE(INT8U), \ - ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* DefaultMoveRate */ \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(4), 0x00000014, 1, ZAP_TYPE(INT8U), \ + ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* DefaultMoveRate */ \ { ZAP_SIMPLE_DEFAULT(255), 0x00004000, 1, ZAP_TYPE(INT8U), \ ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \ ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* StartUpCurrentLevel */ \ { ZAP_SIMPLE_DEFAULT(3), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ - { ZAP_SIMPLE_DEFAULT(5), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ + { ZAP_SIMPLE_DEFAULT(6), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Binary Input (Basic) (server) */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(4), 0x00000051, 1, ZAP_TYPE(BOOLEAN), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(5), 0x00000051, 1, ZAP_TYPE(BOOLEAN), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* out of service */ \ { ZAP_EMPTY_DEFAULT(), 0x00000055, 1, ZAP_TYPE(BOOLEAN), ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* present value */ \ { ZAP_SIMPLE_DEFAULT(0x00), 0x0000006F, 1, ZAP_TYPE(BITMAP8), 0 }, /* status flags */ \ @@ -962,7 +966,7 @@ \ /* Endpoint: 1, Cluster: Laundry Washer Controls (server) */ \ { ZAP_EMPTY_DEFAULT(), 0x00000000, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* SpinSpeeds */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(5), 0x00000001, 1, ZAP_TYPE(INT8U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(6), 0x00000001, 1, ZAP_TYPE(INT8U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* SpinSpeedCurrent */ \ { ZAP_EMPTY_DEFAULT(), 0x00000002, 1, ZAP_TYPE(ENUM8), ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* NumberOfRinses */ \ { ZAP_EMPTY_DEFAULT(), 0x00000003, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* SupportedRinses */ \ @@ -1023,7 +1027,7 @@ { ZAP_SIMPLE_DEFAULT(0), 0x00000008, 1, ZAP_TYPE(ENUM8), 0 }, /* InterconnectSmokeAlarm */ \ { ZAP_SIMPLE_DEFAULT(0), 0x00000009, 1, ZAP_TYPE(ENUM8), 0 }, /* InterconnectCOAlarm */ \ { ZAP_SIMPLE_DEFAULT(0), 0x0000000A, 1, ZAP_TYPE(ENUM8), 0 }, /* ContaminationState */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(6), 0x0000000B, 1, ZAP_TYPE(ENUM8), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(7), 0x0000000B, 1, ZAP_TYPE(ENUM8), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* SmokeSensitivityLevel */ \ { ZAP_SIMPLE_DEFAULT(0), 0x0000000C, 4, ZAP_TYPE(EPOCH_S), 0 }, /* ExpiryDate */ \ { ZAP_SIMPLE_DEFAULT(3), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ @@ -1135,7 +1139,7 @@ { ZAP_SIMPLE_DEFAULT(0xFF), 0x00000005, 1, ZAP_TYPE(ENUM8), ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* TargetState */ \ { ZAP_SIMPLE_DEFAULT(0xFF), 0x00000006, 1, ZAP_TYPE(PERCENT), ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* CurrentLevel */ \ { ZAP_SIMPLE_DEFAULT(0xFF), 0x00000007, 1, ZAP_TYPE(PERCENT), ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* TargetLevel */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(7), 0x00000008, 1, ZAP_TYPE(PERCENT), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(8), 0x00000008, 1, ZAP_TYPE(PERCENT), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* DefaultOpenLevel */ \ { ZAP_SIMPLE_DEFAULT(0), 0x00000009, 2, ZAP_TYPE(BITMAP16), 0 }, /* ValveFault */ \ { ZAP_SIMPLE_DEFAULT(1), 0x0000000A, 1, ZAP_TYPE(INT8U), 0 }, /* LevelStep */ \ @@ -1235,8 +1239,8 @@ ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* NextChargeRequiredEnergy */ \ { ZAP_EMPTY_DEFAULT(), 0x00000026, 1, ZAP_TYPE(PERCENT), \ ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* NextChargeTargetSoC */ \ - { ZAP_EMPTY_DEFAULT(), 0x00000027, 2, ZAP_TYPE(INT16U), \ - ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(9), 0x00000027, 2, ZAP_TYPE(INT16U), \ + ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \ ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* ApproximateEVEfficiency */ \ { ZAP_EMPTY_DEFAULT(), 0x00000040, 4, ZAP_TYPE(INT32U), \ ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* SessionID */ \ @@ -1312,7 +1316,7 @@ ZAP_ATTRIBUTE_MASK(TOKENIZE) }, /* InstalledOpenLimitTilt */ \ { ZAP_SIMPLE_DEFAULT(0xFFFF), 0x00000013, 2, ZAP_TYPE(INT16U), \ ZAP_ATTRIBUTE_MASK(TOKENIZE) }, /* InstalledClosedLimitTilt */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(8), 0x00000017, 1, ZAP_TYPE(BITMAP8), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(10), 0x00000017, 1, ZAP_TYPE(BITMAP8), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* Mode */ \ { ZAP_SIMPLE_DEFAULT(0x00), 0x0000001A, 2, ZAP_TYPE(BITMAP16), 0 }, /* SafetyStatus */ \ { ZAP_SIMPLE_DEFAULT(0x17), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ @@ -1350,9 +1354,9 @@ { ZAP_EMPTY_DEFAULT(), 0x00000016, 3, ZAP_TYPE(INT24U), ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* Power */ \ { ZAP_SIMPLE_DEFAULT(0x00000000), 0x00000017, 4, ZAP_TYPE(INT32U), \ ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* LifetimeEnergyConsumed */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(9), 0x00000020, 1, ZAP_TYPE(ENUM8), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(11), 0x00000020, 1, ZAP_TYPE(ENUM8), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* OperationMode */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(10), 0x00000021, 1, ZAP_TYPE(ENUM8), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(12), 0x00000021, 1, ZAP_TYPE(ENUM8), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* ControlMode */ \ { ZAP_SIMPLE_DEFAULT(0x1F), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ { ZAP_SIMPLE_DEFAULT(4), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ @@ -1363,23 +1367,23 @@ { ZAP_SIMPLE_DEFAULT(0x0BB8), 0x00000004, 2, ZAP_TYPE(TEMPERATURE), 0 }, /* AbsMaxHeatSetpointLimit */ \ { ZAP_SIMPLE_DEFAULT(0x0640), 0x00000005, 2, ZAP_TYPE(TEMPERATURE), 0 }, /* AbsMinCoolSetpointLimit */ \ { ZAP_SIMPLE_DEFAULT(0x0C80), 0x00000006, 2, ZAP_TYPE(TEMPERATURE), 0 }, /* AbsMaxCoolSetpointLimit */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(11), 0x00000011, 2, ZAP_TYPE(INT16S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(13), 0x00000011, 2, ZAP_TYPE(INT16S), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* OccupiedCoolingSetpoint */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(12), 0x00000012, 2, ZAP_TYPE(INT16S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(14), 0x00000012, 2, ZAP_TYPE(INT16S), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* OccupiedHeatingSetpoint */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(13), 0x00000015, 2, ZAP_TYPE(INT16S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(15), 0x00000015, 2, ZAP_TYPE(INT16S), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* MinHeatSetpointLimit */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(14), 0x00000016, 2, ZAP_TYPE(INT16S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(16), 0x00000016, 2, ZAP_TYPE(INT16S), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* MaxHeatSetpointLimit */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(15), 0x00000017, 2, ZAP_TYPE(INT16S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(17), 0x00000017, 2, ZAP_TYPE(INT16S), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* MinCoolSetpointLimit */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(16), 0x00000018, 2, ZAP_TYPE(INT16S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(18), 0x00000018, 2, ZAP_TYPE(INT16S), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* MaxCoolSetpointLimit */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(17), 0x00000019, 1, ZAP_TYPE(INT8S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(19), 0x00000019, 1, ZAP_TYPE(INT8S), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* MinSetpointDeadBand */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(18), 0x0000001B, 1, ZAP_TYPE(ENUM8), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(20), 0x0000001B, 1, ZAP_TYPE(ENUM8), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* ControlSequenceOfOperation */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(19), 0x0000001C, 1, ZAP_TYPE(ENUM8), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(21), 0x0000001C, 1, ZAP_TYPE(ENUM8), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* SystemMode */ \ { ZAP_EMPTY_DEFAULT(), 0x00000048, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* PresetTypes */ \ { ZAP_EMPTY_DEFAULT(), 0x00000049, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* ScheduleTypes */ \ @@ -1396,23 +1400,20 @@ { ZAP_EMPTY_DEFAULT(), 0x00000051, 0, ZAP_TYPE(ARRAY), \ ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* Schedules */ \ { ZAP_EMPTY_DEFAULT(), 0x00000052, 1, ZAP_TYPE(BOOLEAN), 0 }, /* PresetsSchedulesEditable */ \ - { ZAP_SIMPLE_DEFAULT(0), 0x00000053, 1, ZAP_TYPE(BITMAP8), 0 }, /* TemperatureSetpointHoldPolicy */ \ - { ZAP_EMPTY_DEFAULT(), 0x00000054, 4, ZAP_TYPE(EPOCH_S), \ - ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* SetpointHoldExpiryTimestamp */ \ - { ZAP_EMPTY_DEFAULT(), 0x00000055, 0, ZAP_TYPE(STRUCT), \ - ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* QueuedPreset */ \ - { ZAP_SIMPLE_DEFAULT(0x0023), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ - { ZAP_SIMPLE_DEFAULT(6), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ + { ZAP_SIMPLE_DEFAULT(0), 0x00000053, 4, ZAP_TYPE(EPOCH_S), \ + ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* SetpointHoldExpiryTimestamp */ \ + { ZAP_SIMPLE_DEFAULT(0x0023), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ + { ZAP_SIMPLE_DEFAULT(6), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Fan Control (server) */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(20), 0x00000000, 1, ZAP_TYPE(ENUM8), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(22), 0x00000000, 1, ZAP_TYPE(ENUM8), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* FanMode */ \ { ZAP_SIMPLE_DEFAULT(0x02), 0x00000001, 1, ZAP_TYPE(ENUM8), 0 }, /* FanModeSequence */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(21), 0x00000002, 1, ZAP_TYPE(PERCENT), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(23), 0x00000002, 1, ZAP_TYPE(PERCENT), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* PercentSetting */ \ { ZAP_SIMPLE_DEFAULT(0x00), 0x00000003, 1, ZAP_TYPE(PERCENT), 0 }, /* PercentCurrent */ \ { ZAP_SIMPLE_DEFAULT(100), 0x00000004, 1, ZAP_TYPE(INT8U), 0 }, /* SpeedMax */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(22), 0x00000005, 1, ZAP_TYPE(INT8U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(24), 0x00000005, 1, ZAP_TYPE(INT8U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* SpeedSetting */ \ { ZAP_SIMPLE_DEFAULT(0x00), 0x00000006, 1, ZAP_TYPE(INT8U), 0 }, /* SpeedCurrent */ \ { ZAP_SIMPLE_DEFAULT(0x03), 0x00000007, 1, ZAP_TYPE(BITMAP8), 0 }, /* RockSupport */ \ @@ -1424,11 +1425,11 @@ { ZAP_SIMPLE_DEFAULT(4), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Thermostat User Interface Configuration (server) */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(23), 0x00000000, 1, ZAP_TYPE(ENUM8), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(25), 0x00000000, 1, ZAP_TYPE(ENUM8), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* TemperatureDisplayMode */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(24), 0x00000001, 1, ZAP_TYPE(ENUM8), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(26), 0x00000001, 1, ZAP_TYPE(ENUM8), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* KeypadLockout */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(25), 0x00000002, 1, ZAP_TYPE(ENUM8), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(27), 0x00000002, 1, ZAP_TYPE(ENUM8), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* ScheduleProgrammingVisibility */ \ { ZAP_SIMPLE_DEFAULT(0), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ { ZAP_SIMPLE_DEFAULT(2), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ @@ -1464,25 +1465,25 @@ { ZAP_EMPTY_DEFAULT(), 0x00000028, 2, ZAP_TYPE(INT16U), 0 }, /* Primary6X */ \ { ZAP_EMPTY_DEFAULT(), 0x00000029, 2, ZAP_TYPE(INT16U), 0 }, /* Primary6Y */ \ { ZAP_EMPTY_DEFAULT(), 0x0000002A, 1, ZAP_TYPE(INT8U), ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* Primary6Intensity */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(26), 0x00000030, 2, ZAP_TYPE(INT16U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(28), 0x00000030, 2, ZAP_TYPE(INT16U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* WhitePointX */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(27), 0x00000031, 2, ZAP_TYPE(INT16U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(29), 0x00000031, 2, ZAP_TYPE(INT16U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* WhitePointY */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(28), 0x00000032, 2, ZAP_TYPE(INT16U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(30), 0x00000032, 2, ZAP_TYPE(INT16U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* ColorPointRX */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(29), 0x00000033, 2, ZAP_TYPE(INT16U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(31), 0x00000033, 2, ZAP_TYPE(INT16U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* ColorPointRY */ \ { ZAP_EMPTY_DEFAULT(), 0x00000034, 1, ZAP_TYPE(INT8U), \ ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* ColorPointRIntensity */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(30), 0x00000036, 2, ZAP_TYPE(INT16U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(32), 0x00000036, 2, ZAP_TYPE(INT16U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* ColorPointGX */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(31), 0x00000037, 2, ZAP_TYPE(INT16U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(33), 0x00000037, 2, ZAP_TYPE(INT16U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* ColorPointGY */ \ { ZAP_EMPTY_DEFAULT(), 0x00000038, 1, ZAP_TYPE(INT8U), \ ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* ColorPointGIntensity */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(32), 0x0000003A, 2, ZAP_TYPE(INT16U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(34), 0x0000003A, 2, ZAP_TYPE(INT16U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* ColorPointBX */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(33), 0x0000003B, 2, ZAP_TYPE(INT16U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(35), 0x0000003B, 2, ZAP_TYPE(INT16U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* ColorPointBY */ \ { ZAP_EMPTY_DEFAULT(), 0x0000003C, 1, ZAP_TYPE(INT8U), \ ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* ColorPointBIntensity */ \ @@ -1498,23 +1499,23 @@ { ZAP_SIMPLE_DEFAULT(0x0000), 0x0000400B, 2, ZAP_TYPE(INT16U), 0 }, /* ColorTempPhysicalMinMireds */ \ { ZAP_SIMPLE_DEFAULT(0xFEFF), 0x0000400C, 2, ZAP_TYPE(INT16U), 0 }, /* ColorTempPhysicalMaxMireds */ \ { ZAP_EMPTY_DEFAULT(), 0x0000400D, 2, ZAP_TYPE(INT16U), 0 }, /* CoupleColorTempToLevelMinMireds */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(34), 0x00004010, 2, ZAP_TYPE(INT16U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(36), 0x00004010, 2, ZAP_TYPE(INT16U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \ ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* StartUpColorTemperatureMireds */ \ { ZAP_SIMPLE_DEFAULT(0x1F), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ - { ZAP_SIMPLE_DEFAULT(6), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ + { ZAP_SIMPLE_DEFAULT(7), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Ballast Configuration (server) */ \ { ZAP_SIMPLE_DEFAULT(0x01), 0x00000000, 1, ZAP_TYPE(INT8U), 0 }, /* PhysicalMinLevel */ \ { ZAP_SIMPLE_DEFAULT(0xFE), 0x00000001, 1, ZAP_TYPE(INT8U), 0 }, /* PhysicalMaxLevel */ \ { ZAP_SIMPLE_DEFAULT(0x00), 0x00000002, 1, ZAP_TYPE(BITMAP8), 0 }, /* BallastStatus */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(35), 0x00000010, 1, ZAP_TYPE(INT8U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(37), 0x00000010, 1, ZAP_TYPE(INT8U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* MinLevel */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(36), 0x00000011, 1, ZAP_TYPE(INT8U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(38), 0x00000011, 1, ZAP_TYPE(INT8U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* MaxLevel */ \ { ZAP_EMPTY_DEFAULT(), 0x00000014, 1, ZAP_TYPE(INT8U), \ ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* IntrinsicBallastFactor */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(37), 0x00000015, 1, ZAP_TYPE(INT8U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(39), 0x00000015, 1, ZAP_TYPE(INT8U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \ ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* BallastFactorAdjustment */ \ { ZAP_EMPTY_DEFAULT(), 0x00000020, 1, ZAP_TYPE(INT8U), 0 }, /* LampQuantity */ \ @@ -1524,7 +1525,7 @@ ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* LampRatedHours */ \ { ZAP_SIMPLE_DEFAULT(0x000000), 0x00000033, 3, ZAP_TYPE(INT24U), \ ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* LampBurnHours */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(38), 0x00000034, 1, ZAP_TYPE(BITMAP8), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(40), 0x00000034, 1, ZAP_TYPE(BITMAP8), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* LampAlarmMode */ \ { ZAP_SIMPLE_DEFAULT(0xFFFFFF), 0x00000035, 3, ZAP_TYPE(INT24U), \ ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* LampBurnHoursTripPoint */ \ @@ -1871,13 +1872,13 @@ { ZAP_EMPTY_DEFAULT(), 0x00000024, 1, ZAP_TYPE(ENUM8), ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* enum_attr */ \ { ZAP_EMPTY_DEFAULT(), 0x00000025, 0, ZAP_TYPE(STRUCT), \ ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* struct_attr */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(39), 0x00000026, 1, ZAP_TYPE(INT8U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(41), 0x00000026, 1, ZAP_TYPE(INT8U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* range_restricted_int8u */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(40), 0x00000027, 1, ZAP_TYPE(INT8S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(42), 0x00000027, 1, ZAP_TYPE(INT8S), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* range_restricted_int8s */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(41), 0x00000028, 2, ZAP_TYPE(INT16U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(43), 0x00000028, 2, ZAP_TYPE(INT16U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* range_restricted_int16u */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(42), 0x00000029, 2, ZAP_TYPE(INT16S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(44), 0x00000029, 2, ZAP_TYPE(INT16S), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* range_restricted_int16s */ \ { ZAP_EMPTY_DEFAULT(), 0x0000002A, 0, ZAP_TYPE(ARRAY), \ ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* list_long_octet_string */ \ @@ -1948,16 +1949,16 @@ { ZAP_EMPTY_DEFAULT(), 0x00004025, 0, ZAP_TYPE(STRUCT), \ ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \ ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* nullable_struct */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(43), 0x00004026, 1, ZAP_TYPE(INT8U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(45), 0x00004026, 1, ZAP_TYPE(INT8U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \ ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* nullable_range_restricted_int8u */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(44), 0x00004027, 1, ZAP_TYPE(INT8S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(46), 0x00004027, 1, ZAP_TYPE(INT8S), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \ ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* nullable_range_restricted_int8s */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(45), 0x00004028, 2, ZAP_TYPE(INT16U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(47), 0x00004028, 2, ZAP_TYPE(INT16U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \ ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* nullable_range_restricted_int16u */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(46), 0x00004029, 2, ZAP_TYPE(INT16S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(48), 0x00004029, 2, ZAP_TYPE(INT16S), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \ ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* nullable_range_restricted_int16s */ \ { ZAP_EMPTY_DEFAULT(), 0x0000402A, 1, ZAP_TYPE(INT8U), \ @@ -1982,7 +1983,7 @@ { ZAP_SIMPLE_DEFAULT(1), 0x00004000, 1, ZAP_TYPE(BOOLEAN), 0 }, /* GlobalSceneControl */ \ { ZAP_SIMPLE_DEFAULT(0), 0x00004001, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* OnTime */ \ { ZAP_SIMPLE_DEFAULT(0), 0x00004002, 2, ZAP_TYPE(INT16U), ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* OffWaitTime */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(47), 0x00004003, 1, ZAP_TYPE(ENUM8), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(49), 0x00004003, 1, ZAP_TYPE(ENUM8), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* StartUpOnOff */ \ { ZAP_SIMPLE_DEFAULT(0x0001), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ { ZAP_SIMPLE_DEFAULT(6), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ @@ -3747,8 +3748,8 @@ /* Endpoint: 1, Cluster: Thermostat (server) */ \ .clusterId = 0x00000201, \ .attributes = ZAP_ATTRIBUTE_INDEX(616), \ - .attributeCount = 29, \ - .clusterSize = 74, \ + .attributeCount = 27, \ + .clusterSize = 73, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayThermostatServer, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 241 ), \ @@ -3759,7 +3760,7 @@ { \ /* Endpoint: 1, Cluster: Fan Control (server) */ \ .clusterId = 0x00000202, \ - .attributes = ZAP_ATTRIBUTE_INDEX(645), \ + .attributes = ZAP_ATTRIBUTE_INDEX(643), \ .attributeCount = 14, \ .clusterSize = 18, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -3772,7 +3773,7 @@ { \ /* Endpoint: 1, Cluster: Thermostat User Interface Configuration (server) */ \ .clusterId = 0x00000204, \ - .attributes = ZAP_ATTRIBUTE_INDEX(659), \ + .attributes = ZAP_ATTRIBUTE_INDEX(657), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -3785,7 +3786,7 @@ { \ /* Endpoint: 1, Cluster: Color Control (server) */ \ .clusterId = 0x00000300, \ - .attributes = ZAP_ATTRIBUTE_INDEX(664), \ + .attributes = ZAP_ATTRIBUTE_INDEX(662), \ .attributeCount = 54, \ .clusterSize = 345, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION), \ @@ -3798,7 +3799,7 @@ { \ /* Endpoint: 1, Cluster: Ballast Configuration (server) */ \ .clusterId = 0x00000301, \ - .attributes = ZAP_ATTRIBUTE_INDEX(718), \ + .attributes = ZAP_ATTRIBUTE_INDEX(716), \ .attributeCount = 16, \ .clusterSize = 58, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3811,7 +3812,7 @@ { \ /* Endpoint: 1, Cluster: Illuminance Measurement (server) */ \ .clusterId = 0x00000400, \ - .attributes = ZAP_ATTRIBUTE_INDEX(734), \ + .attributes = ZAP_ATTRIBUTE_INDEX(732), \ .attributeCount = 7, \ .clusterSize = 15, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3824,7 +3825,7 @@ { \ /* Endpoint: 1, Cluster: Temperature Measurement (server) */ \ .clusterId = 0x00000402, \ - .attributes = ZAP_ATTRIBUTE_INDEX(741), \ + .attributes = ZAP_ATTRIBUTE_INDEX(739), \ .attributeCount = 6, \ .clusterSize = 14, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3837,7 +3838,7 @@ { \ /* Endpoint: 1, Cluster: Pressure Measurement (server) */ \ .clusterId = 0x00000403, \ - .attributes = ZAP_ATTRIBUTE_INDEX(747), \ + .attributes = ZAP_ATTRIBUTE_INDEX(745), \ .attributeCount = 5, \ .clusterSize = 12, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3850,7 +3851,7 @@ { \ /* Endpoint: 1, Cluster: Flow Measurement (server) */ \ .clusterId = 0x00000404, \ - .attributes = ZAP_ATTRIBUTE_INDEX(752), \ + .attributes = ZAP_ATTRIBUTE_INDEX(750), \ .attributeCount = 6, \ .clusterSize = 14, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3863,7 +3864,7 @@ { \ /* Endpoint: 1, Cluster: Relative Humidity Measurement (server) */ \ .clusterId = 0x00000405, \ - .attributes = ZAP_ATTRIBUTE_INDEX(758), \ + .attributes = ZAP_ATTRIBUTE_INDEX(756), \ .attributeCount = 6, \ .clusterSize = 14, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3876,7 +3877,7 @@ { \ /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ .clusterId = 0x00000406, \ - .attributes = ZAP_ATTRIBUTE_INDEX(764), \ + .attributes = ZAP_ATTRIBUTE_INDEX(762), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -3889,7 +3890,7 @@ { \ /* Endpoint: 1, Cluster: Carbon Monoxide Concentration Measurement (server) */ \ .clusterId = 0x0000040C, \ - .attributes = ZAP_ATTRIBUTE_INDEX(769), \ + .attributes = ZAP_ATTRIBUTE_INDEX(767), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3902,7 +3903,7 @@ { \ /* Endpoint: 1, Cluster: Carbon Dioxide Concentration Measurement (server) */ \ .clusterId = 0x0000040D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(782), \ + .attributes = ZAP_ATTRIBUTE_INDEX(780), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3915,7 +3916,7 @@ { \ /* Endpoint: 1, Cluster: Nitrogen Dioxide Concentration Measurement (server) */ \ .clusterId = 0x00000413, \ - .attributes = ZAP_ATTRIBUTE_INDEX(795), \ + .attributes = ZAP_ATTRIBUTE_INDEX(793), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3928,7 +3929,7 @@ { \ /* Endpoint: 1, Cluster: Ozone Concentration Measurement (server) */ \ .clusterId = 0x00000415, \ - .attributes = ZAP_ATTRIBUTE_INDEX(808), \ + .attributes = ZAP_ATTRIBUTE_INDEX(806), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3941,7 +3942,7 @@ { \ /* Endpoint: 1, Cluster: PM2.5 Concentration Measurement (server) */ \ .clusterId = 0x0000042A, \ - .attributes = ZAP_ATTRIBUTE_INDEX(821), \ + .attributes = ZAP_ATTRIBUTE_INDEX(819), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3954,7 +3955,7 @@ { \ /* Endpoint: 1, Cluster: Formaldehyde Concentration Measurement (server) */ \ .clusterId = 0x0000042B, \ - .attributes = ZAP_ATTRIBUTE_INDEX(834), \ + .attributes = ZAP_ATTRIBUTE_INDEX(832), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3967,7 +3968,7 @@ { \ /* Endpoint: 1, Cluster: PM1 Concentration Measurement (server) */ \ .clusterId = 0x0000042C, \ - .attributes = ZAP_ATTRIBUTE_INDEX(847), \ + .attributes = ZAP_ATTRIBUTE_INDEX(845), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3980,7 +3981,7 @@ { \ /* Endpoint: 1, Cluster: PM10 Concentration Measurement (server) */ \ .clusterId = 0x0000042D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(860), \ + .attributes = ZAP_ATTRIBUTE_INDEX(858), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3993,7 +3994,7 @@ { \ /* Endpoint: 1, Cluster: Total Volatile Organic Compounds Concentration Measurement (server) */ \ .clusterId = 0x0000042E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(873), \ + .attributes = ZAP_ATTRIBUTE_INDEX(871), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4006,7 +4007,7 @@ { \ /* Endpoint: 1, Cluster: Radon Concentration Measurement (server) */ \ .clusterId = 0x0000042F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(886), \ + .attributes = ZAP_ATTRIBUTE_INDEX(884), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4019,7 +4020,7 @@ { \ /* Endpoint: 1, Cluster: Wake on LAN (server) */ \ .clusterId = 0x00000503, \ - .attributes = ZAP_ATTRIBUTE_INDEX(899), \ + .attributes = ZAP_ATTRIBUTE_INDEX(897), \ .attributeCount = 3, \ .clusterSize = 19, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4032,7 +4033,7 @@ { \ /* Endpoint: 1, Cluster: Low Power (server) */ \ .clusterId = 0x00000508, \ - .attributes = ZAP_ATTRIBUTE_INDEX(902), \ + .attributes = ZAP_ATTRIBUTE_INDEX(900), \ .attributeCount = 2, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4045,7 +4046,7 @@ { \ /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ .clusterId = 0x00000B04, \ - .attributes = ZAP_ATTRIBUTE_INDEX(904), \ + .attributes = ZAP_ATTRIBUTE_INDEX(902), \ .attributeCount = 13, \ .clusterSize = 32, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4058,7 +4059,7 @@ { \ /* Endpoint: 1, Cluster: Unit Testing (server) */ \ .clusterId = 0xFFF1FC05, \ - .attributes = ZAP_ATTRIBUTE_INDEX(917), \ + .attributes = ZAP_ATTRIBUTE_INDEX(915), \ .attributeCount = 84, \ .clusterSize = 2290, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4071,7 +4072,7 @@ { \ /* Endpoint: 2, Cluster: Identify (server) */ \ .clusterId = 0x00000003, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1001), \ + .attributes = ZAP_ATTRIBUTE_INDEX(999), \ .attributeCount = 4, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ @@ -4084,7 +4085,7 @@ { \ /* Endpoint: 2, Cluster: Groups (server) */ \ .clusterId = 0x00000004, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1005), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1003), \ .attributeCount = 3, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -4097,7 +4098,7 @@ { \ /* Endpoint: 2, Cluster: On/Off (server) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1008), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1006), \ .attributeCount = 7, \ .clusterSize = 13, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION), \ @@ -4110,7 +4111,7 @@ { \ /* Endpoint: 2, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1015), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1013), \ .attributeCount = 7, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4123,7 +4124,7 @@ { \ /* Endpoint: 2, Cluster: Power Source (server) */ \ .clusterId = 0x0000002F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1022), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1020), \ .attributeCount = 9, \ .clusterSize = 72, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4136,7 +4137,7 @@ { \ /* Endpoint: 2, Cluster: Scenes Management (server) */ \ .clusterId = 0x00000062, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1031), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1029), \ .attributeCount = 5, \ .clusterSize = 16, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION), \ @@ -4149,7 +4150,7 @@ { \ /* Endpoint: 2, Cluster: Occupancy Sensing (server) */ \ .clusterId = 0x00000406, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1036), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1034), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -4162,7 +4163,7 @@ { \ /* Endpoint: 65534, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1041), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1039), \ .attributeCount = 6, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4175,7 +4176,7 @@ { \ /* Endpoint: 65534, Cluster: Network Commissioning (server) */ \ .clusterId = 0x00000031, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1047), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1045), \ .attributeCount = 10, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4194,7 +4195,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 29, 349 }, { ZAP_CLUSTER_INDEX(29), 74, 3523 }, { ZAP_CLUSTER_INDEX(103), 7, 126 }, \ + { ZAP_CLUSTER_INDEX(0), 29, 349 }, { ZAP_CLUSTER_INDEX(29), 74, 3522 }, { ZAP_CLUSTER_INDEX(103), 7, 126 }, \ { ZAP_CLUSTER_INDEX(110), 2, 0 }, \ } @@ -4207,7 +4208,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #define ATTRIBUTE_SINGLETONS_SIZE (36) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (3998) +#define ATTRIBUTE_MAX_SIZE (3997) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (4) diff --git a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/access.h b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/access.h index 5bb357928377a2..45b93e99bae3c8 100644 --- a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/access.h +++ b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/access.h @@ -33,9 +33,6 @@ /* Cluster: Level Control, Attribute: StartUpCurrentLevel, Privilege: view */ \ 0x0000001F, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ 0x0000001F, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ - /* Cluster: Access Control, Attribute: SubjectsPerAccessControlEntry, Privilege: view */ \ - /* Cluster: Access Control, Attribute: TargetsPerAccessControlEntry, Privilege: view */ \ - /* Cluster: Access Control, Attribute: AccessControlEntriesPerFabric, Privilege: view */ \ /* Cluster: Basic Information, Attribute: NodeLabel, Privilege: view */ \ /* Cluster: Basic Information, Attribute: Location, Privilege: view */ \ /* Cluster: Basic Information, Attribute: LocalConfigDisabled, Privilege: view */ \ @@ -59,9 +56,6 @@ /* Cluster: Level Control, Attribute: StartUpCurrentLevel, Privilege: view */ \ 0x00000000, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ 0x00000001, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ - /* Cluster: Access Control, Attribute: SubjectsPerAccessControlEntry, Privilege: view */ \ - /* Cluster: Access Control, Attribute: TargetsPerAccessControlEntry, Privilege: view */ \ - /* Cluster: Access Control, Attribute: AccessControlEntriesPerFabric, Privilege: view */ \ /* Cluster: Basic Information, Attribute: NodeLabel, Privilege: view */ \ /* Cluster: Basic Information, Attribute: Location, Privilege: view */ \ /* Cluster: Basic Information, Attribute: LocalConfigDisabled, Privilege: view */ \ @@ -85,9 +79,6 @@ /* Cluster: Level Control, Attribute: StartUpCurrentLevel, Privilege: view */ \ chip::Access::Privilege::kAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ chip::Access::Privilege::kAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ - /* Cluster: Access Control, Attribute: SubjectsPerAccessControlEntry, Privilege: view */ \ - /* Cluster: Access Control, Attribute: TargetsPerAccessControlEntry, Privilege: view */ \ - /* Cluster: Access Control, Attribute: AccessControlEntriesPerFabric, Privilege: view */ \ /* Cluster: Basic Information, Attribute: NodeLabel, Privilege: view */ \ /* Cluster: Basic Information, Attribute: Location, Privilege: view */ \ /* Cluster: Basic Information, Attribute: LocalConfigDisabled, Privilege: view */ \ @@ -301,18 +292,24 @@ #define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ 0x0000001F, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ 0x0000001F, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ + 0x0000001F, /* Cluster: Access Control, Event: AccessRestrictionEntryChanged, Privilege: administer */ \ + 0x0000001F, /* Cluster: Access Control, Event: FabricRestrictionReviewUpdate, Privilege: administer */ \ } // Parallel array data (cluster, *event*, privilege) for read event #define GENERATED_ACCESS_READ_EVENT__EVENT { \ 0x00000000, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ 0x00000001, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ + 0x00000002, /* Cluster: Access Control, Event: AccessRestrictionEntryChanged, Privilege: administer */ \ + 0x00000003, /* Cluster: Access Control, Event: FabricRestrictionReviewUpdate, Privilege: administer */ \ } // Parallel array data (cluster, event, *privilege*) for read event #define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ chip::Access::Privilege::kAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ chip::Access::Privilege::kAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ + chip::Access::Privilege::kAdminister, /* Cluster: Access Control, Event: AccessRestrictionEntryChanged, Privilege: administer */ \ + chip::Access::Privilege::kAdminister, /* Cluster: Access Control, Event: FabricRestrictionReviewUpdate, Privilege: administer */ \ } //////////////////////////////////////////////////////////////////////////////// diff --git a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/endpoint_config.h index 3f42a085adb376..ab7e45dab37b66 100644 --- a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/endpoint_config.h +++ b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/endpoint_config.h @@ -71,7 +71,7 @@ #define GENERATED_DEFAULTS_COUNT (3) // This is an array of EmberAfAttributeMinMaxValue structures. -#define GENERATED_MIN_MAX_DEFAULT_COUNT 3 +#define GENERATED_MIN_MAX_DEFAULT_COUNT 4 #define GENERATED_MIN_MAX_DEFAULTS \ { \ \ @@ -79,7 +79,8 @@ { (uint16_t) 0xFF, (uint16_t) 0x0, (uint16_t) 0x2 }, /* StartUpOnOff */ \ \ /* Endpoint: 1, Cluster: Level Control (server) */ \ - { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x3 }, /* Options */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x3 }, /* Options */ \ + { (uint16_t) 0x32, (uint16_t) 0x1, (uint16_t) 0xFF }, /* DefaultMoveRate */ \ \ /* Endpoint: 1, Cluster: Color Control (server) */ \ { \ @@ -481,13 +482,13 @@ ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* OnTransitionTime */ \ { ZAP_EMPTY_DEFAULT(), 0x00000013, 2, ZAP_TYPE(INT16U), \ ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* OffTransitionTime */ \ - { ZAP_SIMPLE_DEFAULT(50), 0x00000014, 1, ZAP_TYPE(INT8U), \ - ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* DefaultMoveRate */ \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(2), 0x00000014, 1, ZAP_TYPE(INT8U), \ + ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* DefaultMoveRate */ \ { ZAP_SIMPLE_DEFAULT(255), 0x00004000, 1, ZAP_TYPE(INT8U), \ ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \ ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* StartUpCurrentLevel */ \ { ZAP_SIMPLE_DEFAULT(3), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ - { ZAP_SIMPLE_DEFAULT(5), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ + { ZAP_SIMPLE_DEFAULT(6), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Descriptor (server) */ \ { ZAP_EMPTY_DEFAULT(), 0x00000000, 0, ZAP_TYPE(ARRAY), ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) }, /* DeviceTypeList */ \ @@ -528,11 +529,11 @@ { ZAP_SIMPLE_DEFAULT(0x0000), 0x0000400B, 2, ZAP_TYPE(INT16U), 0 }, /* ColorTempPhysicalMinMireds */ \ { ZAP_SIMPLE_DEFAULT(0xFEFF), 0x0000400C, 2, ZAP_TYPE(INT16U), 0 }, /* ColorTempPhysicalMaxMireds */ \ { ZAP_EMPTY_DEFAULT(), 0x0000400D, 2, ZAP_TYPE(INT16U), 0 }, /* CoupleColorTempToLevelMinMireds */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(2), 0x00004010, 2, ZAP_TYPE(INT16U), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(3), 0x00004010, 2, ZAP_TYPE(INT16U), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \ ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* StartUpColorTemperatureMireds */ \ { ZAP_SIMPLE_DEFAULT(0x1F), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ - { ZAP_SIMPLE_DEFAULT(6), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ + { ZAP_SIMPLE_DEFAULT(7), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ { ZAP_EMPTY_DEFAULT(), 0x00000000, 1, ZAP_TYPE(BITMAP8), 0 }, /* Occupancy */ \ diff --git a/scripts/tools/zap/zap_execution.py b/scripts/tools/zap/zap_execution.py index 80def9602dce77..5d035fd22843ce 100644 --- a/scripts/tools/zap/zap_execution.py +++ b/scripts/tools/zap/zap_execution.py @@ -23,7 +23,7 @@ # Use scripts/tools/zap/version_update.py to manage ZAP versioning as many # files may need updating for versions # -MIN_ZAP_VERSION = '2024.6.6' +MIN_ZAP_VERSION = '2024.7.26' class ZapTool: diff --git a/scripts/tools/zap_regen_all.py b/scripts/tools/zap_regen_all.py index dce4f719a19829..afe931fd8609a6 100755 --- a/scripts/tools/zap_regen_all.py +++ b/scripts/tools/zap_regen_all.py @@ -350,7 +350,8 @@ def setupArgumentsParser(): parser.add_argument('--parallel', action='store_true') parser.add_argument('--no-parallel', action='store_false', dest='parallel') - parser.set_defaults(parallel=True) + parser.add_argument('--no-rerun-in-env', action='store_false', dest='rerun_in_env') + parser.set_defaults(parallel=True, rerun_in_env=True) args = parser.parse_args() @@ -495,6 +496,26 @@ def main(): level=logging.INFO, format='%(asctime)s %(name)s %(levelname)-7s %(message)s' ) + + # The scripts executed by this generally MUST be within a bootstrapped environment because + # we need: + # - zap-cli in PATH + # - scripts/codegen.py uses click (can be in current pyenv, but guaranteed in bootstrap) + # - formatting is using bootstrapped clang-format + # Figure out if bootstrapped. For now assume `PW_ROOT` is such a marker in the environment + if "PW_ROOT" not in os.environ: + logging.error("Script MUST be run in a bootstrapped environment.") + + # using the `--no-rerun-in-env` to avoid recursive infinite calls + if '--no-rerun-in-env' not in sys.argv: + import shlex + logging.info("Will re-try running in a build environment....") + + what_to_run = sys.argv + ['--no-rerun-in-env'] + launcher = os.path.join(CHIP_ROOT_DIR, 'scripts', 'run_in_build_env.sh') + os.execv(launcher, [launcher, shlex.join(what_to_run)]) + sys.exit(1) + checkPythonVersion() os.chdir(CHIP_ROOT_DIR) args = setupArgumentsParser() diff --git a/src/BUILD.gn b/src/BUILD.gn index e2557535d9d72d..c162a61f0620fa 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -50,6 +50,8 @@ if (chip_build_tests) { chip_test_group("tests") { deps = [] tests = [ + "${chip_root}/src/app/data-model/tests", + "${chip_root}/src/app/cluster-building-blocks/tests", "${chip_root}/src/app/data-model-interface/tests", "${chip_root}/src/access/tests", "${chip_root}/src/crypto/tests", @@ -153,6 +155,15 @@ if (chip_build_tests) { } } + chip_test_group("example_tests") { + deps = [] + tests = [] + if (chip_device_platform != "esp32" && chip_device_platform != "efr32" && + current_os != "android") { + tests += [ "${chip_root}/examples/energy-management-app/energy-management-common/tests" ] + } + } + chip_test_group("fake_platform_tests") { tests = [ "${chip_root}/src/lib/dnssd/platform/tests" ] } diff --git a/src/access/tests/BUILD.gn b/src/access/tests/BUILD.gn index 702aade7f8c5e2..d8b43e6a17a01d 100644 --- a/src/access/tests/BUILD.gn +++ b/src/access/tests/BUILD.gn @@ -25,6 +25,7 @@ chip_test_suite("tests") { cflags = [ "-Wconversion" ] public_deps = [ "${chip_root}/src/access", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/support:test_utils", "${dir_pw_unit_test}", ] diff --git a/src/access/tests/TestAccessControl.cpp b/src/access/tests/TestAccessControl.cpp index 16f30284fbc4d1..400ea04b76e535 100644 --- a/src/access/tests/TestAccessControl.cpp +++ b/src/access/tests/TestAccessControl.cpp @@ -19,9 +19,10 @@ #include "access/AccessControl.h" #include "access/examples/ExampleAccessControlDelegate.h" -#include +#include -#include +#include +#include namespace chip { namespace Access { diff --git a/src/app/AttributeAccessInterface.h b/src/app/AttributeAccessInterface.h index f92b5987684039..50e0812fb61c1a 100644 --- a/src/app/AttributeAccessInterface.h +++ b/src/app/AttributeAccessInterface.h @@ -149,6 +149,9 @@ class AttributeAccessInterface (!mEndpointId.HasValue() || !aOther.mEndpointId.HasValue() || mEndpointId.Value() == aOther.mEndpointId.Value()); } +protected: + Optional GetEndpointId() { return mEndpointId; } + private: Optional mEndpointId; ClusterId mClusterId; diff --git a/src/app/AttributePathExpandIterator-Checked.cpp b/src/app/AttributePathExpandIterator-Checked.cpp new file mode 100644 index 00000000000000..3d0d660edcf1eb --- /dev/null +++ b/src/app/AttributePathExpandIterator-Checked.cpp @@ -0,0 +1,99 @@ +/* + * 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 "lib/support/logging/TextOnlyLogging.h" +#include + +namespace chip { +namespace app { +AttributePathExpandIteratorChecked::AttributePathExpandIteratorChecked(InteractionModel::DataModel * dataModel, + SingleLinkedListNode * attributePath) : + mDataModelIterator(dataModel, attributePath), + mEmberIterator(dataModel, attributePath) +{ + CheckOutputsIdentical("Constructor"); +} + +bool AttributePathExpandIteratorChecked::Next() +{ + bool dmResult = mDataModelIterator.Next(); + bool emResult = mEmberIterator.Next(); + + CheckOutputsIdentical("Next"); + + VerifyOrDie(dmResult == emResult); + + return emResult; +} + +bool AttributePathExpandIteratorChecked::Get(ConcreteAttributePath & aPath) +{ + CheckOutputsIdentical("Get"); + return mEmberIterator.Get(aPath); +} + +void AttributePathExpandIteratorChecked::ResetCurrentCluster() +{ + mDataModelIterator.ResetCurrentCluster(); + mEmberIterator.ResetCurrentCluster(); + + CheckOutputsIdentical("ResetCurrentCluster"); +} + +void AttributePathExpandIteratorChecked::ResetTo(SingleLinkedListNode * paths) + +{ + mDataModelIterator.ResetTo(paths); + mEmberIterator.ResetTo(paths); + CheckOutputsIdentical("ResetTo"); +} + +void AttributePathExpandIteratorChecked::CheckOutputsIdentical(const char * msg) +{ + ConcreteAttributePath dmPath; + ConcreteAttributePath emPath; + + bool dmResult = mDataModelIterator.Get(dmPath); + bool emResult = mEmberIterator.Get(emPath); + + if (dmResult == emResult) + { + // We check for: + // - either failed result (in which case path should not matter) + // - or exact match of paths on success + // + // NOTE: extra logic because mExpanded is NOT considered in operator== (ugly...) + if ((dmResult == false) || ((dmPath == emPath) && (dmPath.mExpanded == emPath.mExpanded))) + { + // outputs are identical. All is good + return; + } + } + + ChipLogProgress(Test, "Different paths in DM vs EMBER (%d and %d) in %s", dmResult, emResult, msg); + ChipLogProgress(Test, " DM PATH: 0x%X/" ChipLogFormatMEI "/" ChipLogFormatMEI " (%s)", dmPath.mEndpointId, + ChipLogValueMEI(dmPath.mClusterId), ChipLogValueMEI(dmPath.mAttributeId), + dmPath.mExpanded ? "EXPANDED" : "NOT expanded"); + ChipLogProgress(Test, " EMBER PATH: 0x%X/" ChipLogFormatMEI "/" ChipLogFormatMEI " (%s)", emPath.mEndpointId, + ChipLogValueMEI(emPath.mClusterId), ChipLogValueMEI(emPath.mAttributeId), + emPath.mExpanded ? "EXPANDED" : "NOT expanded"); + + chipDie(); +} + +} // namespace app +} // namespace chip diff --git a/src/app/AttributePathExpandIterator-Checked.h b/src/app/AttributePathExpandIterator-Checked.h new file mode 100644 index 00000000000000..e1611b3288ee18 --- /dev/null +++ b/src/app/AttributePathExpandIterator-Checked.h @@ -0,0 +1,45 @@ +/* + * 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 { + +class AttributePathExpandIteratorChecked +{ +public: + AttributePathExpandIteratorChecked(InteractionModel::DataModel * dataModel, + SingleLinkedListNode * attributePath); + + bool Next(); + bool Get(ConcreteAttributePath & aPath); + void ResetCurrentCluster(); + void ResetTo(SingleLinkedListNode * paths); + +private: + AttributePathExpandIteratorDataModel mDataModelIterator; + AttributePathExpandIteratorEmber mEmberIterator; + + void CheckOutputsIdentical(const char * msg); +}; + +} // namespace app +} // namespace chip diff --git a/src/app/AttributePathExpandIterator-DataModel.cpp b/src/app/AttributePathExpandIterator-DataModel.cpp new file mode 100644 index 00000000000000..92af8b50ca6730 --- /dev/null +++ b/src/app/AttributePathExpandIterator-DataModel.cpp @@ -0,0 +1,242 @@ +/* + * 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 "lib/support/CodeUtils.h" +#include +#include + +using namespace chip::app::InteractionModel; + +namespace chip { +namespace app { + +AttributePathExpandIteratorDataModel::AttributePathExpandIteratorDataModel( + InteractionModel::DataModel * dataModel, SingleLinkedListNode * attributePath) : + mDataModel(dataModel), + mpAttributePath(attributePath), mOutputPath(kInvalidEndpointId, kInvalidClusterId, kInvalidAttributeId) + +{ + mOutputPath.mExpanded = true; // this is reset in 'next' if needed + + // Make the iterator ready to emit the first valid path in the list. + // TODO: the bool return value here is completely unchecked + Next(); +} + +bool AttributePathExpandIteratorDataModel::IsValidAttributeId(AttributeId attributeId) +{ + switch (attributeId) + { + case Clusters::Globals::Attributes::GeneratedCommandList::Id: + case Clusters::Globals::Attributes::AcceptedCommandList::Id: +#if CHIP_CONFIG_ENABLE_EVENTLIST_ATTRIBUTE + case Clusters::Globals::Attributes::EventList::Id: +#endif // CHIP_CONFIG_ENABLE_EVENTLIST_ATTRIBUTE + case Clusters::Globals::Attributes::AttributeList::Id: + return true; + default: + break; + } + + const ConcreteAttributePath attributePath(mOutputPath.mEndpointId, mOutputPath.mClusterId, attributeId); + return mDataModel->GetAttributeInfo(attributePath).has_value(); +} + +std::optional AttributePathExpandIteratorDataModel::NextAttributeId() +{ + if (mOutputPath.mAttributeId == kInvalidAttributeId) + { + if (mpAttributePath->mValue.HasWildcardAttributeId()) + { + AttributeEntry entry = mDataModel->FirstAttribute(mOutputPath); + return entry.IsValid() // + ? entry.path.mAttributeId // + : Clusters::Globals::Attributes::GeneratedCommandList::Id; // + } + + // We allow fixed attribute IDs if and only if they are valid: + // - they may be GLOBAL attributes OR + // - they are valid attributes for this cluster + if (IsValidAttributeId(mpAttributePath->mValue.mAttributeId)) + { + return mpAttributePath->mValue.mAttributeId; + } + + return std::nullopt; + } + + // advance the existing attribute id if it can be advanced + VerifyOrReturnValue(mpAttributePath->mValue.HasWildcardAttributeId(), std::nullopt); + + // Ensure (including ordering) that GlobalAttributesNotInMetadata is reported as needed + for (unsigned i = 0; i < ArraySize(GlobalAttributesNotInMetadata); i++) + { + if (GlobalAttributesNotInMetadata[i] != mOutputPath.mAttributeId) + { + continue; + } + + unsigned nextAttributeIndex = i + 1; + if (nextAttributeIndex < ArraySize(GlobalAttributesNotInMetadata)) + { + return GlobalAttributesNotInMetadata[nextAttributeIndex]; + } + + // reached the end of global attributes + return std::nullopt; + } + + AttributeEntry entry = mDataModel->NextAttribute(mOutputPath); + if (entry.IsValid()) + { + return entry.path.mAttributeId; + } + + // Finished the data model, start with global attributes + static_assert(ArraySize(GlobalAttributesNotInMetadata) > 0); + return GlobalAttributesNotInMetadata[0]; +} + +std::optional AttributePathExpandIteratorDataModel::NextClusterId() +{ + + if (mOutputPath.mClusterId == kInvalidClusterId) + { + if (mpAttributePath->mValue.HasWildcardClusterId()) + { + ClusterEntry entry = mDataModel->FirstCluster(mOutputPath.mEndpointId); + return entry.IsValid() ? std::make_optional(entry.path.mClusterId) : std::nullopt; + } + + // only return a cluster if it is valid + const ConcreteClusterPath clusterPath(mOutputPath.mEndpointId, mpAttributePath->mValue.mClusterId); + if (!mDataModel->GetClusterInfo(clusterPath).has_value()) + { + return std::nullopt; + } + + return mpAttributePath->mValue.mClusterId; + } + + VerifyOrReturnValue(mpAttributePath->mValue.HasWildcardClusterId(), std::nullopt); + + ClusterEntry entry = mDataModel->NextCluster(mOutputPath); + return entry.IsValid() ? std::make_optional(entry.path.mClusterId) : std::nullopt; +} + +std::optional AttributePathExpandIteratorDataModel::NextEndpointId() +{ + if (mOutputPath.mEndpointId == kInvalidEndpointId) + { + if (mpAttributePath->mValue.HasWildcardEndpointId()) + { + EndpointId id = mDataModel->FirstEndpoint(); + return (id != kInvalidEndpointId) ? std::make_optional(id) : std::nullopt; + } + + return mpAttributePath->mValue.mEndpointId; + } + + VerifyOrReturnValue(mpAttributePath->mValue.HasWildcardEndpointId(), std::nullopt); + + EndpointId id = mDataModel->NextEndpoint(mOutputPath.mEndpointId); + return (id != kInvalidEndpointId) ? std::make_optional(id) : std::nullopt; +} + +void AttributePathExpandIteratorDataModel::ResetCurrentCluster() +{ + // If this is a null iterator, or the attribute id of current cluster info is not a wildcard attribute id, then this function + // will do nothing, since we won't be expanding the wildcard attribute ids under a cluster. + VerifyOrReturn(mpAttributePath != nullptr && mpAttributePath->mValue.HasWildcardAttributeId()); + + // Reset path expansion to ask for the first attribute of the current cluster + mOutputPath.mAttributeId = kInvalidAttributeId; + mOutputPath.mExpanded = true; // we know this is a wildcard attribute + Next(); +} + +bool AttributePathExpandIteratorDataModel::AdvanceOutputPath() +{ + if (!mpAttributePath->mValue.IsWildcardPath()) + { + if (mOutputPath.mEndpointId != kInvalidEndpointId) + { + return false; // cannot expand non-wildcard path + } + + mOutputPath.mEndpointId = mpAttributePath->mValue.mEndpointId; + mOutputPath.mClusterId = mpAttributePath->mValue.mClusterId; + mOutputPath.mAttributeId = mpAttributePath->mValue.mAttributeId; + mOutputPath.mExpanded = false; + return true; + } + + while (true) + { + if (mOutputPath.mClusterId != kInvalidClusterId) + { + + std::optional nextAttribute = NextAttributeId(); + if (nextAttribute.has_value()) + { + mOutputPath.mAttributeId = *nextAttribute; + return true; + } + } + + // no valid attribute, try to advance the cluster, see if a suitable one exists + if (mOutputPath.mEndpointId != kInvalidEndpointId) + { + std::optional nextCluster = NextClusterId(); + if (nextCluster.has_value()) + { + mOutputPath.mClusterId = *nextCluster; + mOutputPath.mAttributeId = kInvalidAttributeId; // restarts attributes + continue; + } + } + + // no valid cluster, try advance the endpoint, see if a suitable on exists + std::optional nextEndpoint = NextEndpointId(); + if (nextEndpoint.has_value()) + { + mOutputPath.mEndpointId = *nextEndpoint; + mOutputPath.mClusterId = kInvalidClusterId; // restarts clusters + continue; + } + return false; + } +} + +bool AttributePathExpandIteratorDataModel::Next() +{ + while (mpAttributePath != nullptr) + { + if (AdvanceOutputPath()) + { + return true; + } + mpAttributePath = mpAttributePath->mpNext; + mOutputPath = ConcreteReadAttributePath(kInvalidEndpointId, kInvalidClusterId, kInvalidAttributeId); + mOutputPath.mExpanded = true; // this is reset to false on advancement if needed + } + + mOutputPath = ConcreteReadAttributePath(); + return false; +} + +} // namespace app +} // namespace chip diff --git a/src/app/AttributePathExpandIterator-DataModel.h b/src/app/AttributePathExpandIterator-DataModel.h new file mode 100644 index 00000000000000..546151c7dd2806 --- /dev/null +++ b/src/app/AttributePathExpandIterator-DataModel.h @@ -0,0 +1,129 @@ +/* + * 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 + +namespace chip { +namespace app { + +/** + * AttributePathExpandIteratorDataModel is used to iterate over a linked list of AttributePathParams-s. + * The AttributePathExpandIteratorDataModel is copiable, however, the given cluster info must be valid when calling Next(). + * + * AttributePathExpandIteratorDataModel will expand attribute paths with wildcards, and only emit existing paths for + * AttributePathParams with wildcards. For AttributePathParams with a concrete path (i.e. does not contain wildcards), + * AttributePathExpandIteratorDataModel will emit them as-is. + * + * The typical use of AttributePathExpandIteratorDataModel may look like: + * ConcreteAttributePath path; + * for (AttributePathExpandIteratorDataModel iterator(AttributePathParams); iterator.Get(path); iterator.Next()) {...} + * + * The iterator does not copy the given AttributePathParams, The given AttributePathParams must be valid when using the iterator. + * If the set of endpoints, clusters, or attributes that are supported changes, AttributePathExpandIteratorDataModel must be + * reinitialized. + * + * A initialized iterator will return the first valid path, no need to call Next() before calling Get() for the first time. + * + * Note: The Next() and Get() are two separate operations by design since a possible call of this iterator might be: + * - Get() + * - Chunk full, return + * - In a new chunk, Get() + * + * TODO: The AttributePathParams may support a group id, the iterator should be able to call group data provider to expand the group + * id. + */ +class AttributePathExpandIteratorDataModel +{ +public: + AttributePathExpandIteratorDataModel(InteractionModel::DataModel * dataModel, + SingleLinkedListNode * attributePath); + + /** + * Proceed the iterator to the next attribute path in the given cluster info. + * + * Returns false if AttributePathExpandIteratorDataModeDataModel has exhausted all paths in the given AttributePathParams list. + */ + bool Next(); + + /** + * Fills the aPath with the path the iterator currently points to. + * Returns false if the iterator is not pointing to a valid path (i.e. it has exhausted the cluster info). + */ + bool Get(ConcreteAttributePath & aPath) + { + aPath = mOutputPath; + return (mpAttributePath != nullptr); + } + + /** + * Reset the iterator to the beginning of current cluster if we are in the middle of expanding a wildcard attribute id for some + * cluster. + * + * When attributes are changed in the middle of expanding a wildcard attribute, we need to reset the iterator, to provide the + * client with a consistent state of the cluster. + */ + void ResetCurrentCluster(); + + /** Start iterating over the given `paths` */ + inline void ResetTo(SingleLinkedListNode * paths) + { + *this = AttributePathExpandIteratorDataModel(mDataModel, paths); + } + +private: + InteractionModel::DataModel * mDataModel; + SingleLinkedListNode * mpAttributePath; + ConcreteAttributePath mOutputPath; + + /// Move to the next endpoint/cluster/attribute triplet that is valid given + /// the current mOutputPath and mpAttributePath + /// + /// returns true if such a next value was found. + bool AdvanceOutputPath(); + + /// Get the next attribute ID in mOutputPath(endpoint/cluster) if one is available. + /// Will start from the beginning if current mOutputPath.mAttributeId is kInvalidAttributeId + /// + /// Respects path expansion/values in mpAttributePath + /// + /// Handles Global attributes (which are returned at the end) + std::optional NextAttributeId(); + + /// Get the next cluster ID in mOutputPath(endpoint) if one is available. + /// Will start from the beginning if current mOutputPath.mClusterId is kInvalidClusterId + /// + /// Respects path expansion/values in mpAttributePath + std::optional NextClusterId(); + + /// Get the next endpoint ID in mOutputPath if one is available. + /// Will start from the beginning if current mOutputPath.mEndpointId is kInvalidEndpointId + /// + /// Respects path expansion/values in mpAttributePath + std::optional NextEndpointId(); + + /// Checks if the given attributeId is valid for the current mOutputPath(endpoint/cluster) + /// + /// Meaning that it is known to the data model OR it is a always-there global attribute. + bool IsValidAttributeId(AttributeId attributeId); +}; + +} // namespace app +} // namespace chip diff --git a/src/app/AttributePathExpandIterator.cpp b/src/app/AttributePathExpandIterator-Ember.cpp similarity index 92% rename from src/app/AttributePathExpandIterator.cpp rename to src/app/AttributePathExpandIterator-Ember.cpp index 9be7ab495a4267..abaa621cb736ca 100644 --- a/src/app/AttributePathExpandIterator.cpp +++ b/src/app/AttributePathExpandIterator-Ember.cpp @@ -16,7 +16,7 @@ * limitations under the License. */ -#include +#include #include #include @@ -53,9 +53,10 @@ extern bool emberAfEndpointIndexIsEnabled(uint16_t index); namespace chip { namespace app { -AttributePathExpandIterator::AttributePathExpandIterator(SingleLinkedListNode * aAttributePath) +AttributePathExpandIteratorEmber::AttributePathExpandIteratorEmber(InteractionModel::DataModel *, + SingleLinkedListNode * aAttributePath) : + mpAttributePath(aAttributePath) { - mpAttributePath = aAttributePath; // Reset iterator state mEndpointIndex = UINT16_MAX; @@ -72,7 +73,7 @@ AttributePathExpandIterator::AttributePathExpandIterator(SingleLinkedListNodempNext, mEndpointIndex = UINT16_MAX)) { diff --git a/src/app/AttributePathExpandIterator-Ember.h b/src/app/AttributePathExpandIterator-Ember.h new file mode 100644 index 00000000000000..ef359fc21b60fa --- /dev/null +++ b/src/app/AttributePathExpandIterator-Ember.h @@ -0,0 +1,136 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Defines an iterator for iterating all possible paths from a list of AttributePathParams-s according to spec section 8.9.2.2 + * (Valid Attribute Paths) + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace chip { +namespace app { + +/** + * AttributePathExpandIteratorEmber is used to iterate over a linked list of AttributePathParams-s. + * The AttributePathExpandIteratorEmber is copiable, however, the given cluster info must be valid when calling Next(). + * + * AttributePathExpandIteratorEmber will expand attribute paths with wildcards, and only emit existing paths for AttributePathParams + * with wildcards. For AttributePathParams with a concrete path (i.e. does not contain wildcards), AttributePathExpandIteratorEmber + * will emit them as-is. + * + * The typical use of AttributePathExpandIteratorEmber may look like: + * ConcreteAttributePath path; + * for (AttributePathExpandIteratorEmber iterator(AttributePathParams); iterator.Get(path); iterator.Next()) {...} + * + * The iterator does not copy the given AttributePathParams, The given AttributePathParams must be valid when using the iterator. + * If the set of endpoints, clusters, or attributes that are supported changes, AttributePathExpandIteratorEmber must be + * reinitialized. + * + * A initialized iterator will return the first valid path, no need to call Next() before calling Get() for the first time. + * + * Note: The Next() and Get() are two separate operations by design since a possible call of this iterator might be: + * - Get() + * - Chunk full, return + * - In a new chunk, Get() + * + * TODO: The AttributePathParams may support a group id, the iterator should be able to call group data provider to expand the group + * id. + */ +class AttributePathExpandIteratorEmber +{ +public: + AttributePathExpandIteratorEmber(InteractionModel::DataModel *, // datamodel is NOT used by this class + SingleLinkedListNode * aAttributePath); + + /** + * Proceed the iterator to the next attribute path in the given cluster info. + * + * Returns false if AttributePathExpandIteratorEmber has exhausted all paths in the given AttributePathParams list. + */ + bool Next(); + + /** + * Fills the aPath with the path the iterator currently points to. + * Returns false if the iterator is not pointing to a valid path (i.e. it has exhausted the cluster info). + */ + bool Get(ConcreteAttributePath & aPath) + { + aPath = mOutputPath; + return (mpAttributePath != nullptr); // still handling some path + } + + /** + * Reset the iterator to the beginning of current cluster if we are in the middle of expanding a wildcard attribute id for some + * cluster. + * + * When attributes are changed in the middle of expanding a wildcard attribute, we need to reset the iterator, to provide the + * client with a consistent state of the cluster. + */ + void ResetCurrentCluster(); + + /** Start iterating over the given `paths` */ + inline void ResetTo(SingleLinkedListNode * paths) + { + *this = AttributePathExpandIteratorEmber(nullptr /* data model is not used */, paths); + } + +private: + SingleLinkedListNode * mpAttributePath; + + ConcreteAttributePath mOutputPath; + + uint16_t mEndpointIndex, mEndEndpointIndex; + uint16_t mAttributeIndex, mEndAttributeIndex; + + // Note: should use decltype(EmberAfEndpointType::clusterCount) here, but af-types is including app specific generated files. + uint8_t mClusterIndex, mEndClusterIndex; + // For dealing with global attributes that are not part of the attribute + // metadata. + uint8_t mGlobalAttributeIndex, mGlobalAttributeEndIndex; + + /** + * Prepare*IndexRange will update mBegin*Index and mEnd*Index variables. + * If AttributePathParams contains a wildcard field, it will set mBegin*Index to 0 and mEnd*Index to count. + * Or it will set mBegin*Index to the index of the Endpoint/Cluster/Attribute, and mEnd*Index to mBegin*Index + 1. + * + * If the Endpoint/Cluster/Attribute does not exist, mBegin*Index will be UINT*_MAX, and mEnd*Inde will be 0. + * + * The index can be used with emberAfEndpointFromIndex, emberAfGetNthClusterId and emberAfGetServerAttributeIdByIndex. + */ + void PrepareEndpointIndexRange(const AttributePathParams & aAttributePath); + void PrepareClusterIndexRange(const AttributePathParams & aAttributePath, EndpointId aEndpointId); + void PrepareAttributeIndexRange(const AttributePathParams & aAttributePath, EndpointId aEndpointId, ClusterId aClusterId); +}; +} // namespace app +} // namespace chip diff --git a/src/app/AttributePathExpandIterator.h b/src/app/AttributePathExpandIterator.h index f11e6793822f84..fae69fe7995d4e 100644 --- a/src/app/AttributePathExpandIterator.h +++ b/src/app/AttributePathExpandIterator.h @@ -15,121 +15,32 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/** - * @file - * Defines an iterator for iterating all possible paths from a list of AttributePathParams-s according to spec section 8.9.2.2 - * (Valid Attribute Paths) - */ - #pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include + +#if CHIP_CONFIG_USE_EMBER_DATA_MODEL && CHIP_CONFIG_USE_DATA_MODEL_INTERFACE +#include +#else +#if CHIP_CONFIG_USE_DATA_MODEL_INTERFACE +#include +#else +#include +#endif // CHIP_CONFIG_USE_DATA_MODEL_INTERFACE +#endif // CHIP_CONFIG_USE_EMBER_DATA_MODEL && CHIP_CONFIG_USE_DATA_MODEL_INTERFACE namespace chip { namespace app { -/** - * AttributePathExpandIterator is used to iterate over a linked list of AttributePathParams-s. - * The AttributePathExpandIterator is copiable, however, the given cluster info must be valid when calling Next(). - * - * AttributePathExpandIterator will expand attribute paths with wildcards, and only emit existing paths for AttributePathParams with - * wildcards. For AttributePathParams with a concrete path (i.e. does not contain wildcards), AttributePathExpandIterator will emit - * them as-is. - * - * The typical use of AttributePathExpandIterator may look like: - * ConcreteAttributePath path; - * for (AttributePathExpandIterator iterator(AttributePathParams); iterator.Get(path); iterator.Next()) {...} - * - * The iterator does not copy the given AttributePathParams, The given AttributePathParams must be valid when using the iterator. - * If the set of endpoints, clusters, or attributes that are supported changes, AttributePathExpandIterator must be reinitialized. - * - * A initialized iterator will return the first valid path, no need to call Next() before calling Get() for the first time. - * - * Note: The Next() and Get() are two separate operations by design since a possible call of this iterator might be: - * - Get() - * - Chunk full, return - * - In a new chunk, Get() - * - * TODO: The AttributePathParams may support a group id, the iterator should be able to call group data provider to expand the group - * id. - */ -class AttributePathExpandIterator -{ -public: - AttributePathExpandIterator(SingleLinkedListNode * aAttributePath); - - /** - * Proceed the iterator to the next attribute path in the given cluster info. - * - * Returns false if AttributePathExpandIterator has exhausted all paths in the given AttributePathParams list. - */ - bool Next(); - - /** - * Fills the aPath with the path the iterator currently points to. - * Returns false if the iterator is not pointing to a valid path (i.e. it has exhausted the cluster info). - */ - bool Get(ConcreteAttributePath & aPath) - { - aPath = mOutputPath; - return Valid(); - } - - /** - * Reset the iterator to the beginning of current cluster if we are in the middle of expanding a wildcard attribute id for some - * cluster. - * - * When attributes are changed in the middle of expanding a wildcard attribute, we need to reset the iterator, to provide the - * client with a consistent state of the cluster. - */ - void ResetCurrentCluster(); - - /** - * Returns if the iterator is valid (not exhausted). An iterator is exhausted if and only if: - * - Next() is called after iterating last path. - * - Iterator is initialized with a null AttributePathParams. - */ - inline bool Valid() const { return mpAttributePath != nullptr; } - -private: - SingleLinkedListNode * mpAttributePath; - - ConcreteAttributePath mOutputPath; - - uint16_t mEndpointIndex, mEndEndpointIndex; - uint16_t mAttributeIndex, mEndAttributeIndex; - - // Note: should use decltype(EmberAfEndpointType::clusterCount) here, but af-types is including app specific generated files. - uint8_t mClusterIndex, mEndClusterIndex; - // For dealing with global attributes that are not part of the attribute - // metadata. - uint8_t mGlobalAttributeIndex, mGlobalAttributeEndIndex; +#if CHIP_CONFIG_USE_EMBER_DATA_MODEL && CHIP_CONFIG_USE_DATA_MODEL_INTERFACE +using AttributePathExpandIterator = ::chip::app::AttributePathExpandIteratorChecked; +#else +#if CHIP_CONFIG_USE_DATA_MODEL_INTERFACE +using AttributePathExpandIterator = ::chip::app::AttributePathExpandIteratorDataModel; +#else +using AttributePathExpandIterator = ::chip::app::AttributePathExpandIteratorEmber; +#endif // CHIP_CONFIG_USE_DATA_MODEL_INTERFACE +#endif // CHIP_CONFIG_USE_EMBER_DATA_MODEL && CHIP_CONFIG_USE_DATA_MODEL_INTERFACE - /** - * Prepare*IndexRange will update mBegin*Index and mEnd*Index variables. - * If AttributePathParams contains a wildcard field, it will set mBegin*Index to 0 and mEnd*Index to count. - * Or it will set mBegin*Index to the index of the Endpoint/Cluster/Attribute, and mEnd*Index to mBegin*Index + 1. - * - * If the Endpoint/Cluster/Attribute does not exist, mBegin*Index will be UINT*_MAX, and mEnd*Inde will be 0. - * - * The index can be used with emberAfEndpointFromIndex, emberAfGetNthClusterId and emberAfGetServerAttributeIdByIndex. - */ - void PrepareEndpointIndexRange(const AttributePathParams & aAttributePath); - void PrepareClusterIndexRange(const AttributePathParams & aAttributePath, EndpointId aEndpointId); - void PrepareAttributeIndexRange(const AttributePathParams & aAttributePath, EndpointId aEndpointId, ClusterId aClusterId); -}; } // namespace app } // namespace chip diff --git a/src/app/AttributeValueEncoder.h b/src/app/AttributeValueEncoder.h index 5c196f91f2e426..89436789f91a84 100644 --- a/src/app/AttributeValueEncoder.h +++ b/src/app/AttributeValueEncoder.h @@ -162,6 +162,7 @@ class AttributeValueEncoder private: // We made EncodeListItem() private, and ListEncoderHelper will expose it by Encode() friend class ListEncodeHelper; + friend class TestOnlyAttributeValueEncoderAccessor; template CHIP_ERROR EncodeListItem(Ts &&... aArgs) diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index 55bc5f305ddd99..8e6ca6dadc569b 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -80,6 +80,27 @@ buildconfig_header("app_buildconfig") { "CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP=${chip_enable_busy_handling_for_operational_session_setup}", ] + if (chip_use_data_model_interface == "disabled") { + defines += [ + "CHIP_CONFIG_USE_DATA_MODEL_INTERFACE=0", + "CHIP_CONFIG_USE_EMBER_DATA_MODEL=1", + ] + } else if (chip_use_data_model_interface == "check") { + defines += [ + "CHIP_CONFIG_USE_DATA_MODEL_INTERFACE=1", + "CHIP_CONFIG_USE_EMBER_DATA_MODEL=1", + ] + } else { + # only one of disabled/check/enabled must be used + assert(chip_use_data_model_interface == "enabled", + "chip_use_data_model_interface must use a supported value") + + defines += [ + "CHIP_CONFIG_USE_DATA_MODEL_INTERFACE=1", + "CHIP_CONFIG_USE_EMBER_DATA_MODEL=0", + ] + } + visibility = [ ":app_config" ] } @@ -188,6 +209,7 @@ static_library("interaction-model") { "WriteClient.h", "reporting/Engine.cpp", "reporting/Engine.h", + "reporting/Read.h", "reporting/ReportScheduler.h", "reporting/ReportSchedulerImpl.cpp", "reporting/ReportSchedulerImpl.h", @@ -207,11 +229,13 @@ static_library("interaction-model") { public_deps = [ ":app_config", - ":command-handler", + ":command-handler-impl", ":constants", ":paths", ":subscription-info-provider", "${chip_root}/src/app/MessageDef", + "${chip_root}/src/app/codegen-data-model:instance-header", + "${chip_root}/src/app/data-model-interface", "${chip_root}/src/app/icd/server:icd-server-config", "${chip_root}/src/app/icd/server:manager", "${chip_root}/src/app/icd/server:observer", @@ -227,6 +251,29 @@ static_library("interaction-model") { public_configs = [ "${chip_root}/src:includes" ] + if (chip_use_data_model_interface == "disabled") { + sources += [ + "reporting/Read-Ember.cpp", + "reporting/Read-Ember.h", + ] + } else if (chip_use_data_model_interface == "check") { + sources += [ + "reporting/Read-Checked.cpp", + "reporting/Read-Checked.h", + "reporting/Read-DataModel.cpp", + "reporting/Read-DataModel.h", + "reporting/Read-Ember.cpp", + "reporting/Read-Ember.h", + ] + public_deps += [ "${chip_root}/src/app/data-model-interface" ] + } else { # enabled + sources += [ + "reporting/Read-DataModel.cpp", + "reporting/Read-DataModel.h", + ] + public_deps += [ "${chip_root}/src/app/data-model-interface" ] + } + if (chip_enable_read_client) { sources += [ "ReadClient.cpp" ] } @@ -333,16 +380,35 @@ source_set("status-response") { ] } -source_set("command-handler") { +source_set("command-handler-interface") { sources = [ "CommandHandler.cpp", "CommandHandler.h", "CommandHandlerExchangeInterface.h", + "CommandHandlerInterface.h", + "CommandHandlerInterfaceRegistry.cpp", + "CommandHandlerInterfaceRegistry.h", + ] + + public_deps = [ + ":paths", + "${chip_root}/src/access:types", + "${chip_root}/src/app/data-model", + "${chip_root}/src/lib/core", + "${chip_root}/src/lib/support", + "${chip_root}/src/messaging", + "${chip_root}/src/protocols/interaction_model", + ] +} + +source_set("command-handler-impl") { + sources = [ "CommandHandlerImpl.cpp", "CommandHandlerImpl.h", ] public_deps = [ + ":command-handler-interface", ":paths", ":required-privileges", ":status-response", @@ -361,7 +427,6 @@ static_library("app") { output_name = "libCHIPDataModel" sources = [ - "AttributePathExpandIterator.cpp", "AttributePathExpandIterator.h", "AttributePersistenceProvider.h", "ChunkedWriteCallback.cpp", @@ -410,6 +475,32 @@ static_library("app") { "${chip_root}/src/system", ] + if (chip_use_data_model_interface == "disabled") { + sources += [ + "AttributePathExpandIterator-Ember.cpp", + "AttributePathExpandIterator-Ember.h", + "AttributePathExpandIterator.h", + ] + } else if (chip_use_data_model_interface == "check") { + sources += [ + "AttributePathExpandIterator-Checked.cpp", + "AttributePathExpandIterator-Checked.h", + "AttributePathExpandIterator-DataModel.cpp", + "AttributePathExpandIterator-DataModel.h", + "AttributePathExpandIterator-Ember.cpp", + "AttributePathExpandIterator-Ember.h", + "AttributePathExpandIterator.h", + ] + public_deps += [ "${chip_root}/src/app/data-model-interface" ] + } else { # enabled + sources += [ + "AttributePathExpandIterator-DataModel.cpp", + "AttributePathExpandIterator-DataModel.h", + "AttributePathExpandIterator.h", + ] + public_deps += [ "${chip_root}/src/app/data-model-interface" ] + } + if (chip_enable_read_client) { sources += [ "BufferedReadCallback.cpp", diff --git a/src/app/ClusterStateCache.cpp b/src/app/ClusterStateCache.cpp index e3dd3dd8d84ca4..65ab12095bfeba 100644 --- a/src/app/ClusterStateCache.cpp +++ b/src/app/ClusterStateCache.cpp @@ -648,6 +648,47 @@ CHIP_ERROR ClusterStateCacheT::OnUpdateDataVersionFilterLi return err; } +template +void ClusterStateCacheT::ClearAttributes(EndpointId endpointId) +{ + mCache.erase(endpointId); +} + +template +void ClusterStateCacheT::ClearAttributes(const ConcreteClusterPath & cluster) +{ + // Can't use GetEndpointState here, since that only handles const things. + auto endpointIter = mCache.find(cluster.mEndpointId); + if (endpointIter == mCache.end()) + { + return; + } + + auto & endpointState = endpointIter->second; + endpointState.erase(cluster.mClusterId); +} + +template +void ClusterStateCacheT::ClearAttribute(const ConcreteAttributePath & attribute) +{ + // Can't use GetClusterState here, since that only handles const things. + auto endpointIter = mCache.find(attribute.mEndpointId); + if (endpointIter == mCache.end()) + { + return; + } + + auto & endpointState = endpointIter->second; + auto clusterIter = endpointState.find(attribute.mClusterId); + if (clusterIter == endpointState.end()) + { + return; + } + + auto & clusterState = clusterIter->second; + clusterState.mAttributes.erase(attribute.mAttributeId); +} + template CHIP_ERROR ClusterStateCacheT::GetLastReportDataPath(ConcreteClusterPath & aPath) { diff --git a/src/app/ClusterStateCache.h b/src/app/ClusterStateCache.h index 948a4dba8794b0..e17596e3bf515e 100644 --- a/src/app/ClusterStateCache.h +++ b/src/app/ClusterStateCache.h @@ -504,6 +504,22 @@ class ClusterStateCacheT : protected ReadClient::Callback } } + /* + * Clear out all the attribute data and DataVersions stored for a given endpoint. + */ + void ClearAttributes(EndpointId endpoint); + + /* + * Clear out all the attribute data and the DataVersion stored for a given cluster. + */ + void ClearAttributes(const ConcreteClusterPath & cluster); + + /* + * Clear out the data (or size, if not storing data) stored for an + * attribute. + */ + void ClearAttribute(const ConcreteAttributePath & attribute); + /* * Clear out the event data and status caches. * diff --git a/src/app/CommandHandlerImpl.cpp b/src/app/CommandHandlerImpl.cpp index 8c2572db590c17..b1843d23e8b0cd 100644 --- a/src/app/CommandHandlerImpl.cpp +++ b/src/app/CommandHandlerImpl.cpp @@ -323,6 +323,7 @@ void CommandHandlerImpl::InvalidateHandles() { handle->Invalidate(); } + mpHandleList.Clear(); } void CommandHandlerImpl::IncrementHoldOff(Handle * apHandle) diff --git a/src/app/CommandHandlerInterface.h b/src/app/CommandHandlerInterface.h index d36a41e37f076c..4146556779756c 100644 --- a/src/app/CommandHandlerInterface.h +++ b/src/app/CommandHandlerInterface.h @@ -23,10 +23,8 @@ #include #include #include // So we can encode lists -#include #include #include -#include namespace chip { namespace app { @@ -226,6 +224,8 @@ class CommandHandlerInterface } } + Optional GetEndpointId() { return mEndpointId; } + private: Optional mEndpointId; ClusterId mClusterId; diff --git a/src/app/CommandHandlerInterfaceRegistry.cpp b/src/app/CommandHandlerInterfaceRegistry.cpp new file mode 100644 index 00000000000000..74ea7d48d04955 --- /dev/null +++ b/src/app/CommandHandlerInterfaceRegistry.cpp @@ -0,0 +1,139 @@ +/** + * 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 + +using namespace chip::app; + +namespace { + +CommandHandlerInterface * gCommandHandlerList = nullptr; + +} + +namespace chip { +namespace app { +namespace CommandHandlerInterfaceRegistry { + +void UnregisterAllHandlers() +{ + + CommandHandlerInterface * handlerIter = gCommandHandlerList; + + // + // Walk our list of command handlers and de-register them, before finally + // nulling out the list entirely. + // + while (handlerIter) + { + CommandHandlerInterface * nextHandler = handlerIter->GetNext(); + handlerIter->SetNext(nullptr); + handlerIter = nextHandler; + } + + gCommandHandlerList = nullptr; +} + +CHIP_ERROR RegisterCommandHandler(CommandHandlerInterface * handler) +{ + VerifyOrReturnError(handler != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + + for (auto * cur = gCommandHandlerList; cur; cur = cur->GetNext()) + { + if (cur->Matches(*handler)) + { + ChipLogError(InteractionModel, "Duplicate command handler registration failed"); + return CHIP_ERROR_INCORRECT_STATE; + } + } + + handler->SetNext(gCommandHandlerList); + gCommandHandlerList = handler; + + return CHIP_NO_ERROR; +} + +void UnregisterAllCommandHandlersForEndpoint(EndpointId endpointId) +{ + + CommandHandlerInterface * prev = nullptr; + + for (auto * cur = gCommandHandlerList; cur; cur = cur->GetNext()) + { + if (cur->MatchesEndpoint(endpointId)) + { + if (prev == nullptr) + { + gCommandHandlerList = cur->GetNext(); + } + else + { + prev->SetNext(cur->GetNext()); + } + + cur->SetNext(nullptr); + } + else + { + prev = cur; + } + } +} + +CHIP_ERROR UnregisterCommandHandler(CommandHandlerInterface * handler) +{ + VerifyOrReturnError(handler != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + CommandHandlerInterface * prev = nullptr; + + for (auto * cur = gCommandHandlerList; cur; cur = cur->GetNext()) + { + if (cur->Matches(*handler)) + { + if (prev == nullptr) + { + gCommandHandlerList = cur->GetNext(); + } + else + { + prev->SetNext(cur->GetNext()); + } + + cur->SetNext(nullptr); + + return CHIP_NO_ERROR; + } + + prev = cur; + } + + return CHIP_ERROR_KEY_NOT_FOUND; +} + +CommandHandlerInterface * GetCommandHandler(EndpointId endpointId, ClusterId clusterId) +{ + for (auto * cur = gCommandHandlerList; cur; cur = cur->GetNext()) + { + if (cur->Matches(endpointId, clusterId)) + { + return cur; + } + } + + return nullptr; +} + +} // namespace CommandHandlerInterfaceRegistry +} // namespace app +} // namespace chip diff --git a/src/app/CommandHandlerInterfaceRegistry.h b/src/app/CommandHandlerInterfaceRegistry.h new file mode 100644 index 00000000000000..14e00335fd859d --- /dev/null +++ b/src/app/CommandHandlerInterfaceRegistry.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, + * 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 chip { +namespace app { +namespace CommandHandlerInterfaceRegistry { + +/// Remove the entire linked list of handlers +void UnregisterAllHandlers(); + +/// Add a new handler to the list of registered command handlers +/// +/// At most one command handler can exist for a given endpoint/cluster combination. Trying +/// to register conflicting handlers will result in a `CHIP_ERROR_INCORRECT_STATE` error. +CHIP_ERROR RegisterCommandHandler(CommandHandlerInterface * handler); + +/// Unregister all commandHandlers that `MatchesEndpoint` for the given endpointId. +void UnregisterAllCommandHandlersForEndpoint(EndpointId endpointId); + +/// Unregister a single handler. +/// +/// If the handler is not registered, a `CHIP_ERROR_KEY_NOT_FOUND` is returned. +CHIP_ERROR UnregisterCommandHandler(CommandHandlerInterface * handler); + +/// Find the command handler for the given endpoint/cluster combination or return +/// nullptr if no such command handler exists. +CommandHandlerInterface * GetCommandHandler(EndpointId endpointId, ClusterId clusterId); + +} // namespace CommandHandlerInterfaceRegistry +} // namespace app +} // namespace chip diff --git a/src/app/DefaultAttributePersistenceProvider.cpp b/src/app/DefaultAttributePersistenceProvider.cpp index 5bef4c11fb8c1a..6e7120999fe519 100644 --- a/src/app/DefaultAttributePersistenceProvider.cpp +++ b/src/app/DefaultAttributePersistenceProvider.cpp @@ -37,34 +37,40 @@ CHIP_ERROR DefaultAttributePersistenceProvider::InternalWriteValue(const Storage return mStorage->SyncSetKeyValue(aKey.KeyName(), aValue.data(), static_cast(aValue.size())); } -CHIP_ERROR DefaultAttributePersistenceProvider::InternalReadValue(const StorageKeyName & aKey, EmberAfAttributeType aType, - size_t aSize, MutableByteSpan & aValue) +CHIP_ERROR DefaultAttributePersistenceProvider::InternalReadValue(const StorageKeyName & aKey, MutableByteSpan & aValue) { VerifyOrReturnError(mStorage != nullptr, CHIP_ERROR_INCORRECT_STATE); uint16_t size = static_cast(min(aValue.size(), static_cast(UINT16_MAX))); ReturnErrorOnFailure(mStorage->SyncGetKeyValue(aKey.KeyName(), aValue.data(), size)); - EmberAfAttributeType type = aType; - if (emberAfIsStringAttributeType(type)) + aValue.reduce_size(size); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DefaultAttributePersistenceProvider::InternalReadValue(const StorageKeyName & aKey, EmberAfAttributeType aType, + size_t aExpectedSize, MutableByteSpan & aValue) +{ + ReturnErrorOnFailure(InternalReadValue(aKey, aValue)); + size_t size = aValue.size(); + if (emberAfIsStringAttributeType(aType)) { // Ensure that we've read enough bytes that we are not ending up with // un-initialized memory. Should have read length + 1 (for the length // byte). - VerifyOrReturnError(size >= emberAfStringLength(aValue.data()) + 1, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(size >= 1 && size - 1 >= emberAfStringLength(aValue.data()), CHIP_ERROR_INCORRECT_STATE); } - else if (emberAfIsLongStringAttributeType(type)) + else if (emberAfIsLongStringAttributeType(aType)) { // Ensure that we've read enough bytes that we are not ending up with // un-initialized memory. Should have read length + 2 (for the length // bytes). - VerifyOrReturnError(size >= emberAfLongStringLength(aValue.data()) + 2, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(size >= 2 && size - 2 >= emberAfLongStringLength(aValue.data()), CHIP_ERROR_INCORRECT_STATE); } else { // Ensure we got the expected number of bytes for all other types. - VerifyOrReturnError(size == aSize, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(size == aExpectedSize, CHIP_ERROR_INVALID_ARGUMENT); } - aValue.reduce_size(size); return CHIP_NO_ERROR; } @@ -90,8 +96,7 @@ CHIP_ERROR DefaultAttributePersistenceProvider::SafeWriteValue(const ConcreteAtt CHIP_ERROR DefaultAttributePersistenceProvider::SafeReadValue(const ConcreteAttributePath & aPath, MutableByteSpan & aValue) { return InternalReadValue( - DefaultStorageKeyAllocator::SafeAttributeValue(aPath.mEndpointId, aPath.mClusterId, aPath.mAttributeId), 0x20, - aValue.size(), aValue); + DefaultStorageKeyAllocator::SafeAttributeValue(aPath.mEndpointId, aPath.mClusterId, aPath.mAttributeId), aValue); } namespace { diff --git a/src/app/DefaultAttributePersistenceProvider.h b/src/app/DefaultAttributePersistenceProvider.h index 4db77e8919222c..3e18808f366d37 100644 --- a/src/app/DefaultAttributePersistenceProvider.h +++ b/src/app/DefaultAttributePersistenceProvider.h @@ -63,7 +63,9 @@ class DefaultAttributePersistenceProvider : public AttributePersistenceProvider, private: CHIP_ERROR InternalWriteValue(const StorageKeyName & aKey, const ByteSpan & aValue); - CHIP_ERROR InternalReadValue(const StorageKeyName & aKey, EmberAfAttributeType aType, size_t aSize, MutableByteSpan & aValue); + CHIP_ERROR InternalReadValue(const StorageKeyName & aKey, MutableByteSpan & aValue); + CHIP_ERROR InternalReadValue(const StorageKeyName & aKey, EmberAfAttributeType aType, size_t aExpectedSize, + MutableByteSpan & aValue); }; } // namespace app diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index 132e8cdf108a72..dcdbd3f10d2f85 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -27,9 +27,10 @@ #include -#include "access/RequestPath.h" -#include "access/SubjectDescriptor.h" +#include +#include #include +#include #include #include #include @@ -41,6 +42,10 @@ #include #include +#if CHIP_CONFIG_USE_DATA_MODEL_INTERFACE +#include +#endif + namespace chip { namespace app { @@ -88,6 +93,15 @@ CHIP_ERROR InteractionModelEngine::Init(Messaging::ExchangeManager * apExchangeM StatusIB::RegisterErrorFormatter(); +#if CHIP_CONFIG_USE_EMBER_DATA_MODEL && CHIP_CONFIG_USE_DATA_MODEL_INTERFACE + ChipLogError(InteractionModel, "WARNING ┌────────────────────────────────────────────────────"); + ChipLogError(InteractionModel, "WARNING │ Interaction Model Engine running in 'Checked' mode."); + ChipLogError(InteractionModel, "WARNING │ This executes BOTH ember and data-model code paths."); + ChipLogError(InteractionModel, "WARNING │ which is inefficient and consumes more flash space."); + ChipLogError(InteractionModel, "WARNING │ This should be done for testing only."); + ChipLogError(InteractionModel, "WARNING └────────────────────────────────────────────────────"); +#endif + return CHIP_NO_ERROR; } @@ -95,20 +109,9 @@ void InteractionModelEngine::Shutdown() { mpExchangeMgr->GetSessionManager()->SystemLayer()->CancelTimer(ResumeSubscriptionsTimerCallback, this); - CommandHandlerInterface * handlerIter = mCommandHandlerList; - - // - // Walk our list of command handlers and de-register them, before finally - // nulling out the list entirely. - // - while (handlerIter) - { - CommandHandlerInterface * nextHandler = handlerIter->GetNext(); - handlerIter->SetNext(nullptr); - handlerIter = nextHandler; - } - - mCommandHandlerList = nullptr; + // TODO: individual object clears the entire command handler interface registry. + // This may not be expected. + CommandHandlerInterfaceRegistry::UnregisterAllHandlers(); mCommandResponderObjs.ReleaseAll(); @@ -482,7 +485,7 @@ CHIP_ERROR InteractionModelEngine::ParseAttributePaths(const Access::SubjectDesc if (paramsList.mValue.IsWildcardPath()) { - AttributePathExpandIterator pathIterator(¶msList); + AttributePathExpandIterator pathIterator(GetDataModel(), ¶msList); ConcreteAttributePath readPath; // The definition of "valid path" is "path exists and ACL allows access". The "path exists" part is handled by @@ -845,7 +848,8 @@ Protocols::InteractionModel::Status InteractionModelEngine::OnReadInitialRequest // We have already reserved enough resources for read requests, and have granted enough resources for current subscriptions, so // we should be able to allocate resources requested by this request. - ReadHandler * handler = mReadHandlers.CreateObject(*this, apExchangeContext, aInteractionType, mReportScheduler); + ReadHandler * handler = + mReadHandlers.CreateObject(*this, apExchangeContext, aInteractionType, mReportScheduler, GetDataModel()); if (handler == nullptr) { ChipLogProgress(InteractionModel, "no resource for %s interaction", @@ -1677,7 +1681,8 @@ CHIP_ERROR InteractionModelEngine::PushFront(SingleLinkedListNode *& aObjectL void InteractionModelEngine::DispatchCommand(CommandHandlerImpl & apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & apPayload) { - CommandHandlerInterface * handler = FindCommandHandler(aCommandPath.mEndpointId, aCommandPath.mClusterId); + CommandHandlerInterface * handler = + CommandHandlerInterfaceRegistry::GetCommandHandler(aCommandPath.mEndpointId, aCommandPath.mClusterId); if (handler) { @@ -1701,91 +1706,23 @@ Protocols::InteractionModel::Status InteractionModelEngine::CommandExists(const return ServerClusterCommandExists(aCommandPath); } -CHIP_ERROR InteractionModelEngine::RegisterCommandHandler(CommandHandlerInterface * handler) -{ - VerifyOrReturnError(handler != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - - for (auto * cur = mCommandHandlerList; cur; cur = cur->GetNext()) - { - if (cur->Matches(*handler)) - { - ChipLogError(InteractionModel, "Duplicate command handler registration failed"); - return CHIP_ERROR_INCORRECT_STATE; - } - } - - handler->SetNext(mCommandHandlerList); - mCommandHandlerList = handler; - - return CHIP_NO_ERROR; -} - -void InteractionModelEngine::UnregisterCommandHandlers(EndpointId endpointId) -{ - CommandHandlerInterface * prev = nullptr; - - for (auto * cur = mCommandHandlerList; cur; cur = cur->GetNext()) - { - if (cur->MatchesEndpoint(endpointId)) - { - if (prev == nullptr) - { - mCommandHandlerList = cur->GetNext(); - } - else - { - prev->SetNext(cur->GetNext()); - } - - cur->SetNext(nullptr); - } - else - { - prev = cur; - } - } -} - -CHIP_ERROR InteractionModelEngine::UnregisterCommandHandler(CommandHandlerInterface * handler) +InteractionModel::DataModel * InteractionModelEngine::SetDataModel(InteractionModel::DataModel * model) { - VerifyOrReturnError(handler != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - CommandHandlerInterface * prev = nullptr; - - for (auto * cur = mCommandHandlerList; cur; cur = cur->GetNext()) - { - if (cur->Matches(*handler)) - { - if (prev == nullptr) - { - mCommandHandlerList = cur->GetNext(); - } - else - { - prev->SetNext(cur->GetNext()); - } + // Alternting data model should not be done while IM is actively handling requests. + VerifyOrDie(mReadHandlers.begin() == mReadHandlers.end()); - cur->SetNext(nullptr); - - return CHIP_NO_ERROR; - } - - prev = cur; - } - - return CHIP_ERROR_KEY_NOT_FOUND; + InteractionModel::DataModel * oldModel = GetDataModel(); + mDataModel = model; + return oldModel; } -CommandHandlerInterface * InteractionModelEngine::FindCommandHandler(EndpointId endpointId, ClusterId clusterId) +InteractionModel::DataModel * InteractionModelEngine::GetDataModel() const { - for (auto * cur = mCommandHandlerList; cur; cur = cur->GetNext()) - { - if (cur->Matches(endpointId, clusterId)) - { - return cur; - } - } - - return nullptr; +#if CHIP_CONFIG_USE_DATA_MODEL_INTERFACE + // TODO: this should be temporary, we should fully inject the data model + VerifyOrReturnValue(mDataModel != nullptr, CodegenDataModelInstance()); +#endif + return mDataModel; } void InteractionModelEngine::OnTimedInteractionFailed(TimedHandler * apTimedHandler) diff --git a/src/app/InteractionModelEngine.h b/src/app/InteractionModelEngine.h index 69c565254f96f0..9d420f7f654176 100644 --- a/src/app/InteractionModelEngine.h +++ b/src/app/InteractionModelEngine.h @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -50,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -125,10 +125,6 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, * @param[in] apFabricTable A pointer to the FabricTable object. * @param[in] apCASESessionMgr An optional pointer to a CASESessionManager (used for re-subscriptions). * - * @retval #CHIP_ERROR_INCORRECT_STATE If the state is not equal to - * kState_NotInitialized. - * @retval #CHIP_NO_ERROR On success. - * */ CHIP_ERROR Init(Messaging::ExchangeManager * apExchangeMgr, FabricTable * apFabricTable, reporting::ReportScheduler * reportScheduler, CASESessionManager * apCASESessionMgr = nullptr, @@ -215,11 +211,6 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, CHIP_ERROR PushFrontDataVersionFilterList(SingleLinkedListNode *& aDataVersionFilterList, DataVersionFilter & aDataVersionFilter); - CHIP_ERROR RegisterCommandHandler(CommandHandlerInterface * handler); - CHIP_ERROR UnregisterCommandHandler(CommandHandlerInterface * handler); - CommandHandlerInterface * FindCommandHandler(EndpointId endpointId, ClusterId clusterId); - void UnregisterCommandHandlers(EndpointId endpointId); - /* * Register an application callback to be notified of notable events when handling reads/subscribes. */ @@ -411,6 +402,15 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, } #endif + InteractionModel::DataModel * GetDataModel() const; + + // MUST NOT be used while the interaction model engine is running as interaction + // model functionality (e.g. active reads/writes/subscriptions) rely on data model + // state + // + // Returns the old data model value. + InteractionModel::DataModel * SetDataModel(InteractionModel::DataModel * model); + private: friend class reporting::Engine; friend class TestCommandInteraction; @@ -450,9 +450,9 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, * * */ - static CHIP_ERROR ParseAttributePaths(const Access::SubjectDescriptor & aSubjectDescriptor, - AttributePathIBs::Parser & aAttributePathListParser, bool & aHasValidAttributePath, - size_t & aRequestedAttributePathCount); + CHIP_ERROR ParseAttributePaths(const Access::SubjectDescriptor & aSubjectDescriptor, + AttributePathIBs::Parser & aAttributePathListParser, bool & aHasValidAttributePath, + size_t & aRequestedAttributePathCount); /** * This parses the event path list to ensure it is well formed. If so, for each path in the list, it will expand to a list @@ -614,8 +614,6 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, Messaging::ExchangeManager * mpExchangeMgr = nullptr; - CommandHandlerInterface * mCommandHandlerList = nullptr; - #if CHIP_CONFIG_ENABLE_ICD_SERVER ICDManager * mICDManager = nullptr; #endif // CHIP_CONFIG_ENABLE_ICD_SERVER @@ -699,6 +697,8 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, CASESessionManager * mpCASESessionMgr = nullptr; SubscriptionResumptionStorage * mpSubscriptionResumptionStorage = nullptr; + + InteractionModel::DataModel * mDataModel = nullptr; }; } // namespace app diff --git a/src/app/OperationalSessionSetup.cpp b/src/app/OperationalSessionSetup.cpp index 5b2f00ed0a3798..156003dec8ffd5 100644 --- a/src/app/OperationalSessionSetup.cpp +++ b/src/app/OperationalSessionSetup.cpp @@ -197,8 +197,10 @@ void OperationalSessionSetup::Connect(Callback::Callback * on Connect(onConnection, nullptr, onSetupFailure, transportPayloadCapability); } -void OperationalSessionSetup::UpdateDeviceData(const Transport::PeerAddress & addr, const ReliableMessageProtocolConfig & config) +void OperationalSessionSetup::UpdateDeviceData(const ResolveResult & result) { + auto & config = result.mrpRemoteConfig; + auto addr = result.address; #if CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES // Make sure to clear out our reason for trying the next result first thing, // so it does not stick around in various error cases. @@ -248,7 +250,7 @@ void OperationalSessionSetup::UpdateDeviceData(const Transport::PeerAddress & ad return; } - CHIP_ERROR err = EstablishConnection(config); + CHIP_ERROR err = EstablishConnection(result); LogErrorOnFailure(err); if (err == CHIP_NO_ERROR) { @@ -292,15 +294,26 @@ void OperationalSessionSetup::UpdateDeviceData(const Transport::PeerAddress & ad // Do not touch `this` instance anymore; it has been destroyed in DequeueConnectionCallbacks. } -CHIP_ERROR OperationalSessionSetup::EstablishConnection(const ReliableMessageProtocolConfig & config) +CHIP_ERROR OperationalSessionSetup::EstablishConnection(const ResolveResult & result) { + auto & config = result.mrpRemoteConfig; #if INET_CONFIG_ENABLE_TCP_ENDPOINT - // TODO: Combine LargePayload flag with DNS-SD advertisements from peer. - // Issue #32348. if (mTransportPayloadCapability == TransportPayloadCapability::kLargePayload) { - // Set the transport type for carrying large payloads - mDeviceAddress.SetTransportType(chip::Transport::Type::kTcp); + if (result.supportsTcpServer) + { + // Set the transport type for carrying large payloads + mDeviceAddress.SetTransportType(chip::Transport::Type::kTcp); + } + else + { + // we should not set the large payload while the TCP support is not enabled + ChipLogError( + Discovery, + "LargePayload session requested but peer does not support TCP server, PeerNodeId=" ChipLogFormatScopedNodeId, + ChipLogValueScopedNodeId(mPeerId)); + return CHIP_ERROR_INTERNAL; + } } #endif @@ -627,7 +640,7 @@ void OperationalSessionSetup::PerformAddressUpdate() void OperationalSessionSetup::OnNodeAddressResolved(const PeerId & peerId, const ResolveResult & result) { - UpdateDeviceData(result.address, result.mrpRemoteConfig); + UpdateDeviceData(result); } void OperationalSessionSetup::OnNodeAddressResolutionFailed(const PeerId & peerId, CHIP_ERROR reason) diff --git a/src/app/OperationalSessionSetup.h b/src/app/OperationalSessionSetup.h index 508c778923fd49..343ce77b2ba37f 100644 --- a/src/app/OperationalSessionSetup.h +++ b/src/app/OperationalSessionSetup.h @@ -347,7 +347,7 @@ class DLL_EXPORT OperationalSessionSetup : public SessionEstablishmentDelegate, void MoveToState(State aTargetState); - CHIP_ERROR EstablishConnection(const ReliableMessageProtocolConfig & config); + CHIP_ERROR EstablishConnection(const AddressResolve::ResolveResult & result); /* * This checks to see if an existing CASE session exists to the peer within the SessionManager @@ -419,7 +419,7 @@ class DLL_EXPORT OperationalSessionSetup : public SessionEstablishmentDelegate, /** * This function will set new IP address, port and MRP retransmission intervals of the device. */ - void UpdateDeviceData(const Transport::PeerAddress & addr, const ReliableMessageProtocolConfig & config); + void UpdateDeviceData(const AddressResolve::ResolveResult & result); #if CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES /** diff --git a/src/app/ReadClient.cpp b/src/app/ReadClient.cpp index 470c875fbaac30..51adf6e8ddc143 100644 --- a/src/app/ReadClient.cpp +++ b/src/app/ReadClient.cpp @@ -403,6 +403,11 @@ CHIP_ERROR ReadClient::BuildDataVersionFilterList(DataVersionFilterIBs::Builder const Span & aDataVersionFilters, bool & aEncodedDataVersionList) { +#if CHIP_PROGRESS_LOGGING + size_t encodedFilterCount = 0; + size_t irrelevantFilterCount = 0; + size_t skippedFilterCount = 0; +#endif for (auto & filter : aDataVersionFilters) { VerifyOrReturnError(filter.IsValidDataVersionFilter(), CHIP_ERROR_INVALID_ARGUMENT); @@ -420,6 +425,9 @@ CHIP_ERROR ReadClient::BuildDataVersionFilterList(DataVersionFilterIBs::Builder if (!intersected) { +#if CHIP_PROGRESS_LOGGING + ++irrelevantFilterCount; +#endif continue; } @@ -428,19 +436,31 @@ CHIP_ERROR ReadClient::BuildDataVersionFilterList(DataVersionFilterIBs::Builder CHIP_ERROR err = EncodeDataVersionFilter(aDataVersionFilterIBsBuilder, filter); if (err == CHIP_NO_ERROR) { +#if CHIP_PROGRESS_LOGGING + ++encodedFilterCount; +#endif aEncodedDataVersionList = true; } else if (err == CHIP_ERROR_NO_MEMORY || err == CHIP_ERROR_BUFFER_TOO_SMALL) { // Packet is full, ignore the rest of the list aDataVersionFilterIBsBuilder.Rollback(backup); - return CHIP_NO_ERROR; +#if CHIP_PROGRESS_LOGGING + ssize_t nonSkippedFilterCount = &filter - aDataVersionFilters.data(); + skippedFilterCount = aDataVersionFilters.size() - static_cast(nonSkippedFilterCount); +#endif // CHIP_PROGRESS_LOGGING + break; } else { return err; } } + + ChipLogProgress(DataManagement, + "%lu data version filters provided, %lu not relevant, %lu encoded, %lu skipped due to lack of space", + static_cast(aDataVersionFilters.size()), static_cast(irrelevantFilterCount), + static_cast(encodedFilterCount), static_cast(skippedFilterCount)); return CHIP_NO_ERROR; } diff --git a/src/app/ReadHandler.cpp b/src/app/ReadHandler.cpp index 487acd27ed883e..3e182bb9428a5f 100644 --- a/src/app/ReadHandler.cpp +++ b/src/app/ReadHandler.cpp @@ -22,6 +22,7 @@ * */ +#include "data-model-interface/DataModel.h" #include #include #include @@ -53,9 +54,9 @@ uint16_t ReadHandler::GetPublisherSelectedIntervalLimit() } ReadHandler::ReadHandler(ManagementCallback & apCallback, Messaging::ExchangeContext * apExchangeContext, - InteractionType aInteractionType, Observer * observer) : - mExchangeCtx(*this), - mManagementCallback(apCallback) + InteractionType aInteractionType, Observer * observer, InteractionModel::DataModel * apDataModel) : + mAttributePathExpandIterator(apDataModel, nullptr), + mExchangeCtx(*this), mManagementCallback(apCallback) { VerifyOrDie(apExchangeContext != nullptr); @@ -79,8 +80,8 @@ ReadHandler::ReadHandler(ManagementCallback & apCallback, Messaging::ExchangeCon } #if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS -ReadHandler::ReadHandler(ManagementCallback & apCallback, Observer * observer) : - mExchangeCtx(*this), mManagementCallback(apCallback) +ReadHandler::ReadHandler(ManagementCallback & apCallback, Observer * observer, InteractionModel::DataModel * apDataModel) : + mAttributePathExpandIterator(apDataModel, nullptr), mExchangeCtx(*this), mManagementCallback(apCallback) { mInteractionType = InteractionType::Subscribe; mFlags.ClearAll(); @@ -509,8 +510,8 @@ CHIP_ERROR ReadHandler::ProcessAttributePaths(AttributePathIBs::Parser & aAttrib if (CHIP_END_OF_TLV == err) { mManagementCallback.GetInteractionModelEngine()->RemoveDuplicateConcreteAttributePath(mpAttributePathList); - mAttributePathExpandIterator = AttributePathExpandIterator(mpAttributePathList); - err = CHIP_NO_ERROR; + mAttributePathExpandIterator.ResetTo(mpAttributePathList); + err = CHIP_NO_ERROR; } return err; } @@ -850,7 +851,7 @@ void ReadHandler::PersistSubscription() void ReadHandler::ResetPathIterator() { - mAttributePathExpandIterator = AttributePathExpandIterator(mpAttributePathList); + mAttributePathExpandIterator.ResetTo(mpAttributePathList); mAttributeEncoderState.Reset(); } diff --git a/src/app/ReadHandler.h b/src/app/ReadHandler.h index c973432953275b..0f6b3fada87572 100644 --- a/src/app/ReadHandler.h +++ b/src/app/ReadHandler.h @@ -212,7 +212,7 @@ class ReadHandler : public Messaging::ExchangeDelegate * */ ReadHandler(ManagementCallback & apCallback, Messaging::ExchangeContext * apExchangeContext, InteractionType aInteractionType, - Observer * observer); + Observer * observer, InteractionModel::DataModel * apDataModel); #if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS /** @@ -222,7 +222,7 @@ class ReadHandler : public Messaging::ExchangeDelegate * The callback passed in has to outlive this handler object. * */ - ReadHandler(ManagementCallback & apCallback, Observer * observer); + ReadHandler(ManagementCallback & apCallback, Observer * observer, InteractionModel::DataModel * apDataModel); #endif const SingleLinkedListNode * GetAttributePathList() const { return mpAttributePathList; } @@ -500,7 +500,7 @@ class ReadHandler : public Messaging::ExchangeDelegate /// @param aFlag Flag to clear void ClearStateFlag(ReadHandlerFlags aFlag); - AttributePathExpandIterator mAttributePathExpandIterator = AttributePathExpandIterator(nullptr); + AttributePathExpandIterator mAttributePathExpandIterator; // The current generation of the reporting engine dirty set the last time we were notified that a path we're interested in was // marked dirty. @@ -582,5 +582,6 @@ class ReadHandler : public Messaging::ExchangeDelegate // TODO (#27675): Merge all observers into one and that one will dispatch the callbacks to the right place. Observer * mObserver = nullptr; }; + } // namespace app } // namespace chip diff --git a/src/app/SafeAttributePersistenceProvider.h b/src/app/SafeAttributePersistenceProvider.h index ed02d6039043ad..8d11d95d47b02d 100644 --- a/src/app/SafeAttributePersistenceProvider.h +++ b/src/app/SafeAttributePersistenceProvider.h @@ -40,8 +40,8 @@ class SafeAttributePersistenceProvider // The following API provides helper functions to simplify the access of commonly used types. // The API may not be complete. - // Currently implemented write and read types are: uint8_t, uint16_t, uint32_t, unit64_t and - // their nullable varieties, and bool. + // Currently implemented write and read types are: bool, uint8_t, uint16_t, uint32_t, unit64_t and + // their nullable varieties, as well as ByteSpans. /** * Write an attribute value of type intX, uintX or bool to non-volatile memory. @@ -50,7 +50,7 @@ class SafeAttributePersistenceProvider * @param [in] aValue the data to write. */ template ::value, bool> = true> - CHIP_ERROR WriteScalarValue(const ConcreteAttributePath & aPath, T & aValue) + CHIP_ERROR WriteScalarValue(const ConcreteAttributePath & aPath, T aValue) { uint8_t value[sizeof(T)]; auto w = Encoding::LittleEndian::BufferWriter(value, sizeof(T)); @@ -71,18 +71,16 @@ class SafeAttributePersistenceProvider * * @param [in] aPath the attribute path for the data being persisted. * @param [in,out] aValue where to place the data. + * + * @retval CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND if no stored value exists for the attribute */ template ::value, bool> = true> CHIP_ERROR ReadScalarValue(const ConcreteAttributePath & aPath, T & aValue) { uint8_t attrData[sizeof(T)]; MutableByteSpan tempVal(attrData); - auto err = SafeReadValue(aPath, tempVal); - if (err != CHIP_NO_ERROR) - { - return err; - } - + ReturnErrorOnFailure(SafeReadValue(aPath, tempVal)); + VerifyOrReturnError(tempVal.size() == sizeof(T), CHIP_ERROR_INCORRECT_STATE); Encoding::LittleEndian::Reader r(tempVal.data(), tempVal.size()); r.RawReadLowLevelBeCareful(&aValue); return r.StatusCode(); @@ -95,7 +93,7 @@ class SafeAttributePersistenceProvider * @param [in] aValue the data to write. */ template ::value, bool> = true> - CHIP_ERROR WriteScalarValue(const ConcreteAttributePath & aPath, DataModel::Nullable & aValue) + CHIP_ERROR WriteScalarValue(const ConcreteAttributePath & aPath, const DataModel::Nullable & aValue) { typename NumericAttributeTraits::StorageType storageValue; if (aValue.IsNull()) @@ -114,16 +112,14 @@ class SafeAttributePersistenceProvider * * @param [in] aPath the attribute path for the data being persisted. * @param [in,out] aValue where to place the data. + * + * @retval CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND if no stored value exists for the attribute */ template ::value, bool> = true> CHIP_ERROR ReadScalarValue(const ConcreteAttributePath & aPath, DataModel::Nullable & aValue) { typename NumericAttributeTraits::StorageType storageValue; - CHIP_ERROR err = ReadScalarValue(aPath, storageValue); - if (err != CHIP_NO_ERROR) - { - return err; - } + ReturnErrorOnFailure(ReadScalarValue(aPath, storageValue)); if (NumericAttributeTraits::IsNullValue(storageValue)) { @@ -137,25 +133,25 @@ class SafeAttributePersistenceProvider return CHIP_NO_ERROR; } -protected: /** * Write an attribute value from the attribute store (i.e. not a struct or * list) to non-volatile memory. * * @param [in] aPath the attribute path for the data being written. - * @param [in] aValue the data to write. The value should be stored as-is. + * @param [in] aValue the data to write. The value will be stored as-is. */ virtual CHIP_ERROR SafeWriteValue(const ConcreteAttributePath & aPath, const ByteSpan & aValue) = 0; /** - * Read an attribute value from non-volatile memory. - * It can be assumed that this method will never be called upon to read - * an attribute of type string or long-string. + * Read an attribute value as a raw sequence of bytes from non-volatile memory. * * @param [in] aPath the attribute path for the data being persisted. * @param [in,out] aValue where to place the data. The size of the buffer - * will be equal to `aValue.size()`. The callee is expected to adjust - * aValue's size to the actual number of bytes read. + * will be equal to `aValue.size()`. On success aValue.size() + * will be the actual number of bytes read. + * + * @retval CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND if no stored value exists for the attribute + * @retval CHIP_ERROR_BUFFER_TOO_SMALL aValue.size() is too small to hold the value. */ virtual CHIP_ERROR SafeReadValue(const ConcreteAttributePath & aPath, MutableByteSpan & aValue) = 0; }; diff --git a/src/app/SubscriptionResumptionSessionEstablisher.cpp b/src/app/SubscriptionResumptionSessionEstablisher.cpp index 6e016684410fc8..11da3c3d496f92 100644 --- a/src/app/SubscriptionResumptionSessionEstablisher.cpp +++ b/src/app/SubscriptionResumptionSessionEstablisher.cpp @@ -17,6 +17,7 @@ #include #include +#include namespace chip { namespace app { @@ -103,7 +104,8 @@ void SubscriptionResumptionSessionEstablisher::HandleDeviceConnected(void * cont ChipLogProgress(InteractionModel, "no resource for subscription resumption"); return; } - ReadHandler * readHandler = imEngine->mReadHandlers.CreateObject(*imEngine, imEngine->GetReportScheduler()); + ReadHandler * readHandler = + imEngine->mReadHandlers.CreateObject(*imEngine, imEngine->GetReportScheduler(), imEngine->GetDataModel()); if (readHandler == nullptr) { // TODO - Should we keep the subscription here? diff --git a/src/app/TimedHandler.cpp b/src/app/TimedHandler.cpp index 8df0246ba26728..f3431a9ee03fa2 100644 --- a/src/app/TimedHandler.cpp +++ b/src/app/TimedHandler.cpp @@ -66,10 +66,9 @@ CHIP_ERROR TimedHandler::OnMessageReceived(Messaging::ExchangeContext * aExchang ChipLogValueX64(now.count()), this, ChipLogValueExchange(aExchangeContext)); if (now > mTimeLimit) { - // Time is up. Spec says to send UNSUPPORTED_ACCESS. ChipLogError(DataManagement, "Timeout expired: handler %p exchange " ChipLogFormatExchange, this, ChipLogValueExchange(aExchangeContext)); - return StatusResponse::Send(Status::UnsupportedAccess, aExchangeContext, /* aExpectResponse = */ false); + return StatusResponse::Send(Status::Timeout, aExchangeContext, /* aExpectResponse = */ false); } if (aPayloadHeader.HasMessageType(MsgType::InvokeCommandRequest)) diff --git a/src/app/WriteClient.h b/src/app/WriteClient.h index b67bf4ea0b8c84..b4d803981be3d8 100644 --- a/src/app/WriteClient.h +++ b/src/app/WriteClient.h @@ -178,7 +178,7 @@ class WriteClient : public Messaging::ExchangeDelegate ReturnErrorOnFailure(EncodeSingleAttributeDataIB(path, DataModel::List())); path.mListOp = ConcreteDataAttributePath::ListOperation::AppendItem; - for (ListIndex i = 0; i < value.size(); i++) + for (size_t i = 0; i < value.size(); i++) { ReturnErrorOnFailure(EncodeSingleAttributeDataIB(path, value.data()[i])); } diff --git a/src/app/WriteHandler.cpp b/src/app/WriteHandler.cpp index aadb59ae864176..d19d3ae3b37d0a 100644 --- a/src/app/WriteHandler.cpp +++ b/src/app/WriteHandler.cpp @@ -587,8 +587,8 @@ Status WriteHandler::ProcessWriteRequest(System::PacketBufferHandle && aPayload, if (mIsTimedRequest != aIsTimedWrite) { // The message thinks it should be part of a timed interaction but it's - // not, or vice versa. Spec says to Respond with UNSUPPORTED_ACCESS. - status = Status::UnsupportedAccess; + // not, or vice versa. + status = Status::TimedRequestMismatch; goto exit; } diff --git a/src/app/app-platform/ContentAppPlatform.cpp b/src/app/app-platform/ContentAppPlatform.cpp index fb2d6ab39a1b5f..214af261e26e54 100644 --- a/src/app/app-platform/ContentAppPlatform.cpp +++ b/src/app/app-platform/ContentAppPlatform.cpp @@ -387,6 +387,57 @@ ContentApp * ContentAppPlatform::GetContentApp(EndpointId id) return nullptr; } +// create a string key from vendorId and productId +std::string createKey(uint16_t vendorId, uint16_t productId) +{ + return std::to_string(vendorId) + ":" + std::to_string(productId); +} + +void ContentAppPlatform::StoreNodeIdForContentApp(uint16_t vendorId, uint16_t productId, NodeId nodeId) +{ + std::string key = createKey(vendorId, productId); + + ChipLogProgress(DeviceLayer, "Stored node id: " ChipLogFormatX64 " for key: %s", ChipLogValueX64(nodeId), key.c_str()); + + mConnectedContentAppNodeIds[key].insert(nodeId); +} + +std::set ContentAppPlatform::GetNodeIdsForContentApp(uint16_t vendorId, uint16_t productId) +{ + std::string key = createKey(vendorId, productId); + + ChipLogProgress(DeviceLayer, "Retrieving node id for key: %s", key.c_str()); + + auto it = mConnectedContentAppNodeIds.find(key); + if (it != mConnectedContentAppNodeIds.end()) + { + ChipLogProgress(DeviceLayer, "Found node id"); + return it->second; + } + + ChipLogProgress(DeviceLayer, "Didn't find node id"); + // If key not found, return an empty set + return {}; +} + +std::set ContentAppPlatform::GetNodeIdsForAllowVendorId(uint16_t vendorId) +{ + std::set result; + std::string vendorPrefix = std::to_string(vendorId) + ":"; + + for (const auto & pair : mConnectedContentAppNodeIds) + { + const std::string & key = pair.first; + if (key.find(vendorPrefix) == 0) + { // Check if the key starts with the vendor prefix + const std::set & nodeIds = pair.second; + result.insert(nodeIds.begin(), nodeIds.end()); + } + } + + return result; +} + void ContentAppPlatform::SetCurrentApp(ContentApp * app) { if (!HasCurrentApp()) diff --git a/src/app/app-platform/ContentAppPlatform.h b/src/app/app-platform/ContentAppPlatform.h index 16a47c26a3b991..45615d09ed8ddf 100644 --- a/src/app/app-platform/ContentAppPlatform.h +++ b/src/app/app-platform/ContentAppPlatform.h @@ -161,6 +161,18 @@ class DLL_EXPORT ContentAppPlatform bool HasTargetContentApp(uint16_t vendorId, uint16_t productId, CharSpan rotatingId, Protocols::UserDirectedCommissioning::TargetAppInfo & info, uint32_t & passcode); + // returns set of connected nodes for a given content app + std::set GetNodeIdsForContentApp(uint16_t vendorId, uint16_t productId); + + // returns set of connected nodes for a given allowed vendor id + std::set GetNodeIdsForAllowVendorId(uint16_t vendorId); + + // store node id for content app after commissioning + // node id can be used later on to update ACL + // in case app is not installed + // Note: This is in memory storing, the values are deleted after reboot + void StoreNodeIdForContentApp(uint16_t vendorId, uint16_t productId, NodeId nodeId); + /** * @brief * Add ACLs on this device for the given client, @@ -201,6 +213,8 @@ class DLL_EXPORT ContentAppPlatform EndpointId mCurrentEndpointId; EndpointId mFirstDynamicEndpointId; ContentApp * mContentApps[CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT]; + // key is string -> vendorId:producTid + std::map> mConnectedContentAppNodeIds; private: void IncrementCurrentEndpointID(); diff --git a/src/app/chip_data_model.cmake b/src/app/chip_data_model.cmake index 2d4149b66f6a8a..eac3b492c0eeff 100644 --- a/src/app/chip_data_model.cmake +++ b/src/app/chip_data_model.cmake @@ -17,6 +17,7 @@ set(CHIP_APP_BASE_DIR ${CMAKE_CURRENT_LIST_DIR}) include("${CHIP_ROOT}/build/chip/chip_codegen.cmake") +include("${CHIP_ROOT}/src/app/codegen-data-model/model.cmake") # Configure ${APP_TARGET} with source files associated with ${CLUSTER} cluster # @@ -132,6 +133,8 @@ function(chip_configure_data_model APP_TARGET) target_include_directories(${APP_TARGET} ${SCOPE} "${APP_TEMPLATES_GEN_DIR}") add_dependencies(${APP_TARGET} ${APP_TARGET}-zapgen) + # TODO: source for codedgen_data_model ??? + target_sources(${APP_TARGET} ${SCOPE} ${CHIP_APP_BASE_DIR}/../../zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp ${CHIP_APP_BASE_DIR}/../../zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -149,6 +152,7 @@ function(chip_configure_data_model APP_TARGET) ${CHIP_APP_BASE_DIR}/util/generic-callback-stubs.cpp ${CHIP_APP_BASE_DIR}/util/privilege-storage.cpp ${CHIP_APP_BASE_DIR}/util/util.cpp + ${CODEGEN_DATA_MODEL_SOURCES} ${APP_GEN_FILES} ${APP_TEMPLATES_GEN_FILES} ) diff --git a/src/app/chip_data_model.gni b/src/app/chip_data_model.gni index a68d193d241541..ae7bb84948b3be 100644 --- a/src/app/chip_data_model.gni +++ b/src/app/chip_data_model.gni @@ -15,6 +15,7 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") import("${chip_root}/build/chip/chip_codegen.gni") +import("${chip_root}/src/app/codegen-data-model/model.gni") import("${chip_root}/src/app/common_flags.gni") import("${chip_root}/src/platform/python.gni") @@ -201,6 +202,7 @@ template("chip_data_model") { "${_app_root}/util/privilege-storage.cpp", "${chip_root}/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp", ] + sources += codegen_data_model_SOURCES if (!chip_build_controller_dynamic_server) { sources += [ @@ -384,12 +386,46 @@ template("chip_data_model") { "${_app_root}/clusters/${cluster}/${cluster}.h", "${_app_root}/clusters/${cluster}/EnergyReportingTestEventTriggerHandler.h", ] + } else if (cluster == "device-energy-management-server") { + sources += [ + "${_app_root}/clusters/${cluster}/${cluster}.cpp", + "${_app_root}/clusters/${cluster}/${cluster}.h", + "${_app_root}/clusters/${cluster}/DeviceEnergyManagementTestEventTriggerHandler.h", + ] } else if (cluster == "thread-network-diagnostics-server") { sources += [ "${_app_root}/clusters/${cluster}/${cluster}.cpp", "${_app_root}/clusters/${cluster}/thread-network-diagnostics-provider.cpp", "${_app_root}/clusters/${cluster}/thread-network-diagnostics-provider.h", ] + } else if (cluster == "thread-border-router-management-server") { + sources += [ + "${_app_root}/clusters/${cluster}/thread-border-router-management-server.cpp", + "${_app_root}/clusters/${cluster}/thread-border-router-management-server.h", + "${_app_root}/clusters/${cluster}/thread-br-delegate.h", + ] + } else if (cluster == "water-heater-management-server") { + sources += [ + "${_app_root}/clusters/${cluster}/${cluster}.cpp", + "${_app_root}/clusters/${cluster}/${cluster}.h", + "${_app_root}/clusters/${cluster}/WaterHeaterManagementTestEventTriggerHandler.h", + ] + } else if (cluster == "thread-network-directory-server") { + sources += [ + "${_app_root}/clusters/${cluster}/${cluster}.cpp", + "${_app_root}/clusters/${cluster}/${cluster}.h", + "${_app_root}/clusters/${cluster}/DefaultThreadNetworkDirectoryStorage.cpp", + "${_app_root}/clusters/${cluster}/DefaultThreadNetworkDirectoryStorage.h", + "${_app_root}/clusters/${cluster}/ThreadNetworkDirectoryStorage.h", + ] + } else if (cluster == "thermostat-server") { + sources += [ + "${_app_root}/clusters/${cluster}/${cluster}.cpp", + "${_app_root}/clusters/${cluster}/${cluster}.h", + "${_app_root}/clusters/${cluster}/PresetStructWithOwnedMembers.cpp", + "${_app_root}/clusters/${cluster}/PresetStructWithOwnedMembers.h", + "${_app_root}/clusters/${cluster}/thermostat-delegate.h", + ] } else { sources += [ "${_app_root}/clusters/${cluster}/${cluster}.cpp" ] } @@ -404,6 +440,7 @@ template("chip_data_model") { ":${_data_model_name}_zapgen", "${chip_root}/src/access", "${chip_root}/src/app", + "${chip_root}/src/app/cluster-building-blocks", "${chip_root}/src/app/common:attribute-type", "${chip_root}/src/app/common:cluster-objects", "${chip_root}/src/app/common:enums", @@ -413,6 +450,7 @@ template("chip_data_model") { "${chip_root}/src/lib/support", "${chip_root}/src/protocols/secure_channel", ] + public_deps += codegen_data_model_PUBLIC_DEPS if (is_server) { public_deps += [ "${chip_root}/src/app/server" ] diff --git a/third_party/nxp/k32w0_sdk/nxp_arm.gni b/src/app/cluster-building-blocks/BUILD.gn similarity index 64% rename from third_party/nxp/k32w0_sdk/nxp_arm.gni rename to src/app/cluster-building-blocks/BUILD.gn index 5afd55a8b3129f..dedce36ea43e6b 100644 --- a/third_party/nxp/k32w0_sdk/nxp_arm.gni +++ b/src/app/cluster-building-blocks/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023 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. @@ -11,12 +11,14 @@ # 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/nxp_sdk.gni") -import("${nxp_sdk_build_root}/nxp_sdk.gni") +source_set("cluster-building-blocks") { + sources = [ "QuieterReporting.h" ] -assert(nxp_platform == "k32w/k32w0", "${nxp_platform} must be k32w/k32w0.") - -arm_float_abi = "soft" -arm_cpu = "cortex-m4" -arm_arch = "armv7e-m" + public_deps = [ + "${chip_root}/src/app/data-model:nullable", + "${chip_root}/src/lib/support:support", + "${chip_root}/src/system", + ] +} diff --git a/src/app/cluster-building-blocks/QuieterReporting.h b/src/app/cluster-building-blocks/QuieterReporting.h new file mode 100644 index 00000000000000..e64d56cd2b1c72 --- /dev/null +++ b/src/app/cluster-building-blocks/QuieterReporting.h @@ -0,0 +1,239 @@ +/* + * + * 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 +#include + +namespace chip { +namespace app { + +enum class QuieterReportingPolicyEnum +{ + kMarkDirtyOnChangeToFromZero = (1u << 0), + kMarkDirtyOnDecrement = (1u << 1), + kMarkDirtyOnIncrement = (1u << 2), +}; + +enum class AttributeDirtyState +{ + kNoReportNeeded = 0, + kMustReport = 1, +}; + +using QuieterReportingPolicyFlags = BitFlags; + +namespace detail { + +using Timestamp = System::Clock::Milliseconds64; +template +using Nullable = DataModel::Nullable; + +/** + * This class helps track reporting state of an attribute to properly keep track of whether + * it needs to be marked as dirty or not for purposes of reporting using + * "7.7.9 Quieter Reporting Quality" (Q quality) + * + * The class can be configured via `policy()` to have some/all of the common reasons + * for reporting (e.g. increment only, decrement only, change to/from zero). + * + * Changes of null to non-null or non-null to null are always considered dirty. + * + * It is possible to force mark the attribute as dirty (see `ForceDirty()`) such as + * for conditions like "When there is any increase or decrease in the estimated time + * remaining that was due to progressing insight of the server's control logic". + * + * Class maintains a `current value` and a timestamped `dirty` state. The `SetValue()` + * method must be used to update the `current value` and will return AttributeDirtyState::kMustReport + * if the attribute should be marked dirty/ + * + * - `SetValue()` has internal rules for null/non-null changes and policy-based rules + * - `SetValue()` with a `SufficientChangePredicate` uses the internal rules in addition to + * the predicate to determine dirty state + * + * See [QuieterReportingPolicyEnum] for policy flags on when a value is considered dirty + * beyond non/non-null changes. + * + * Common quieter reporting usecases that can be supported by this class are: + * - If attribute has changed due to a change in the X or Y attributes + * - Use SufficientChangePredicate version + * - When it changes from 0 to any other value and vice versa + * - Use `kMarkDirtyOnChangeToFromZero` internal policy. + * - When it changes from null to any other value and vice versa + * - Built-in rule. + * - When it increases + * - Use `kMarkDirtyOnIncrement` internal policy. + * - When it decreases + * - Use `kMarkDirtyOnDecrement` internal policy. + * - When there is any increase or decrease in the estimated time remaining that was + * due to progressing insight of the server's control logic + * - Use SufficientChangePredicate version with an always-true predicate. + * - When it changes at a rate significantly different from one unit per second. + * - Use SufficientChangePredicate version. + * Example usage in-situ: + * + * Class has: + * QuieterReportingAttribute mAttrib; + * + * Code at time of setting new value has: + * + * uint8_t newValue = driver.GetNewValue(); + * auto now = SystemClock().GetMonotonicTimestamp(); + * if (mAttrib.SetValue(newValue, now) == AttributeDirtyState::kMustReport) + * { + * MatterReportingAttributeChangeCallback(path_for_attribute); + * } + * + * @tparam T - the type of underlying numerical value that will be held by the class. + */ +template ::value, bool> = true> +class QuieterReportingAttribute +{ +public: + explicit QuieterReportingAttribute(const Nullable & initialValue) : mValue(initialValue), mLastDirtyValue(initialValue) {} + // constructor that works with arrays of QuieterReportingAttribute + explicit QuieterReportingAttribute() : mValue(DataModel::NullNullable), mLastDirtyValue(DataModel::NullNullable) {} + + struct SufficientChangePredicateCandidate + { + // Timestamp of last time attribute was marked dirty. + Timestamp lastDirtyTimestamp; + // New (`now`) timestamp passed in `SetValue()`. + Timestamp nowTimestamp; + // Value last marked as dirty. + const Nullable & lastDirtyValue; + // New value passed in `SetValue()`, to compare against lastDirtyValue for sufficient change if needed. + const Nullable & newValue; + }; + + using SufficientChangePredicate = std::function; + + /** + * @brief Factory to generate a functor for "attribute was last reported" at least `minimumDurationMillis` ago. + * + * @param minimumDurationMillis - number of millis needed since last marked as dirty before we mark dirty again. + * @return a functor usable for the `changedPredicate` arg of `SetValue()` + */ + static SufficientChangePredicate + GetPredicateForSufficientTimeSinceLastDirty(System::Clock::Milliseconds64 minimumDurationMillis) + { + return [minimumDurationMillis](const SufficientChangePredicateCandidate & candidate) -> bool { + return (candidate.lastDirtyValue != candidate.newValue) && + ((candidate.nowTimestamp - candidate.lastDirtyTimestamp) >= minimumDurationMillis); + }; + } + + Nullable value() const { return mValue; } + QuieterReportingPolicyFlags & policy() { return mPolicyFlags; } + const QuieterReportingPolicyFlags & policy() const { return mPolicyFlags; } + + /** + * Set the updated value of the attribute, computing whether it needs to be reported according to `changedPredicate` and + * policies. + * + * - Any change of nullability between `newValue` and the old value will be considered dirty. + * - The policies from `QuieterReportingPolicyEnum` and set via `SetPolicy()` are self-explanatory by name. + * - The changedPredicate will be called with last dirty and new and may override + * the dirty state altogether when it returns true. Use sparingly and default to a functor returning false. + * The changedPredicate is only called on change. + * + * Internal recording will be done about last dirty value and last dirty timestamp based on the policies having applied. + * + * @param newValue - new value to set for the attribute + * @param now - system monotonic timestamp at the time of the call + * @param changedPredicate - functor to possibly override dirty state + * @return AttributeDirtyState::kMustReport if attribute must be marked dirty right away, or + * AttributeDirtyState::kNoReportNeeded otherwise. + */ + AttributeDirtyState SetValue(const DataModel::Nullable & newValue, Timestamp now, SufficientChangePredicate changedPredicate) + { + bool isChangeOfNull = newValue.IsNull() != mValue.IsNull(); + bool areBothValuesNonNull = !newValue.IsNull() && !mValue.IsNull(); + bool areBothValuesDifferent = areBothValuesNonNull && (newValue.Value() != mValue.Value()); + + bool changeToFromZero = areBothValuesNonNull && areBothValuesDifferent && (newValue.Value() == 0 || mValue.Value() == 0); + bool isIncrement = areBothValuesNonNull && (newValue.Value() > mValue.Value()); + bool isDecrement = areBothValuesNonNull && (newValue.Value() < mValue.Value()); + + bool isNewlyDirty = isChangeOfNull; + isNewlyDirty = + isNewlyDirty || (mPolicyFlags.Has(QuieterReportingPolicyEnum::kMarkDirtyOnChangeToFromZero) && changeToFromZero); + isNewlyDirty = isNewlyDirty || (mPolicyFlags.Has(QuieterReportingPolicyEnum::kMarkDirtyOnDecrement) && isDecrement); + isNewlyDirty = isNewlyDirty || (mPolicyFlags.Has(QuieterReportingPolicyEnum::kMarkDirtyOnIncrement) && isIncrement); + + // Only execute predicate on value change from last marked dirty. + if (newValue != mLastDirtyValue) + { + SufficientChangePredicateCandidate candidate{ + mLastDirtyTimestampMillis, // lastDirtyTimestamp + now, // nowTimestamp + mLastDirtyValue, // lastDirtyValue + newValue // newValue + }; + isNewlyDirty = isNewlyDirty || changedPredicate(candidate); + } + + mValue = newValue; + + if (isNewlyDirty) + { + mLastDirtyValue = newValue; + mLastDirtyTimestampMillis = now; + } + + return isNewlyDirty ? AttributeDirtyState::kMustReport : AttributeDirtyState::kNoReportNeeded; + } + + /** + * Same as the other `SetValue`, but assumes a changedPredicate that never overrides to dirty. + * + * This is the easy/common case. + * + * @param newValue - new value to set for the attribute + * @param now - system monotonic timestamp at the time of the call + * @return AttributeDirtyState::kMustReport if attribute must be marked dirty right away, or + * AttributeDirtyState::kNoReportNeeded otherwise. + */ + AttributeDirtyState SetValue(const DataModel::Nullable & newValue, Timestamp now) + { + return SetValue(newValue, now, [](const SufficientChangePredicateCandidate &) -> bool { return false; }); + } + +protected: + // Current value of the attribute. + DataModel::Nullable mValue; + // Last value that was marked as dirty (to use in comparisons for change, e.g. by SufficientChangePredicate). + DataModel::Nullable mLastDirtyValue; + // Enabled internal change detection policies. + QuieterReportingPolicyFlags mPolicyFlags{ 0 }; + // Timestamp associated with the last time the attribute was marked dirty (to use in comparisons for change). + chip::System::Clock::Timestamp mLastDirtyTimestampMillis{}; +}; + +} // namespace detail + +using detail::QuieterReportingAttribute; + +} // namespace app +} // namespace chip diff --git a/src/app/cluster-building-blocks/tests/BUILD.gn b/src/app/cluster-building-blocks/tests/BUILD.gn new file mode 100644 index 00000000000000..3ac4e07f234ba3 --- /dev/null +++ b/src/app/cluster-building-blocks/tests/BUILD.gn @@ -0,0 +1,31 @@ +# 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}/build/chip/chip_test_suite.gni") + +chip_test_suite("tests") { + output_name = "libAppClusterBuildingBlockTests" + + test_sources = [ "TestQuieterReporting.cpp" ] + + public_deps = [ + "${chip_root}/src/app/cluster-building-blocks", + "${chip_root}/src/app/data-model:nullable", + "${chip_root}/src/lib/core:error", + "${chip_root}/src/lib/core:string-builder-adapters", + "${chip_root}/src/lib/support/tests:pw-test-macros", + "${chip_root}/src/system", + ] +} diff --git a/src/app/cluster-building-blocks/tests/TestQuieterReporting.cpp b/src/app/cluster-building-blocks/tests/TestQuieterReporting.cpp new file mode 100644 index 00000000000000..ad7800d556afa4 --- /dev/null +++ b/src/app/cluster-building-blocks/tests/TestQuieterReporting.cpp @@ -0,0 +1,272 @@ +/* + * + * 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 +#include +#include + +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::DataModel; +using namespace chip::System::Clock; +using namespace chip::System::Clock::Literals; + +class FakeClock +{ +public: + FakeClock() = default; + + Timestamp Advance(Milliseconds64 numMillis) + { + mCurrentTimestamp += numMillis; + return mCurrentTimestamp; + } + + void SetMonotonic(Timestamp now) { mCurrentTimestamp = now; } + + Timestamp now() const { return mCurrentTimestamp; } + +private: + Timestamp mCurrentTimestamp{}; +}; + +TEST(TestQuieterReporting, ChangeToFromZeroPolicyWorks) +{ + FakeClock fakeClock; + fakeClock.SetMonotonic(100_ms); + + QuieterReportingAttribute attribute{ MakeNullable(10) }; + EXPECT_FALSE(attribute.value().IsNull()); + EXPECT_EQ(attribute.policy(), QuieterReportingPolicyFlags{}); + + auto now = fakeClock.now(); + + attribute.policy().Set(QuieterReportingPolicyEnum::kMarkDirtyOnChangeToFromZero); + EXPECT_TRUE(attribute.policy().HasOnly(QuieterReportingPolicyEnum::kMarkDirtyOnChangeToFromZero)); + + // 10 --> 11, expect not marked dirty yet. + EXPECT_EQ(attribute.SetValue(11, now), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 11); + + // 11 --> 0, expect marked dirty. + EXPECT_EQ(attribute.SetValue(0, now), AttributeDirtyState::kMustReport); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 0); + + // 0 --> 0, expect NOT marked dirty. + EXPECT_EQ(attribute.SetValue(0, now), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 0); + + // 0 --> 11, expect marked dirty. + EXPECT_EQ(attribute.SetValue(11, now), AttributeDirtyState::kMustReport); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 11); + + // 11 --> 12, expect not marked dirty. + EXPECT_EQ(attribute.SetValue(12, now), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 12); + + // Reset policy, expect 12 --> 0 does not mark dirty due to no longer having the policy that causes it. + attribute.policy().ClearAll(); + EXPECT_FALSE(attribute.policy().HasAny()); + + EXPECT_EQ(attribute.SetValue(0, now), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 0); +} + +TEST(TestQuieterReporting, ChangeOnIncrementPolicyWorks) +{ + FakeClock fakeClock; + fakeClock.SetMonotonic(100_ms); + + QuieterReportingAttribute attribute{ MakeNullable(10) }; + + // Always start not dirty (because first sub priming always just read value anyway). + ASSERT_EQ(attribute.value().Value(), 10); + + auto now = fakeClock.now(); + + attribute.policy().Set(QuieterReportingPolicyEnum::kMarkDirtyOnIncrement); + EXPECT_TRUE(attribute.policy().HasOnly(QuieterReportingPolicyEnum::kMarkDirtyOnIncrement)); + + // 10 --> 9, expect not marked dirty yet. + EXPECT_EQ(attribute.SetValue(9, now), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 9); + + // 9 --> 10, expect marked dirty. + EXPECT_EQ(attribute.SetValue(10, now), AttributeDirtyState::kMustReport); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 10); + + // 10 --> 11, expect marked dirty. + EXPECT_EQ(attribute.SetValue(11, now), AttributeDirtyState::kMustReport); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 11); + + // 11 --> 11, expect marked not dirty. + EXPECT_EQ(attribute.SetValue(11, now), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 11); + + // 11 --> null, expect marked dirty (null change always marks dirty) + EXPECT_EQ(attribute.SetValue(NullNullable, now), AttributeDirtyState::kMustReport); + EXPECT_TRUE(attribute.value().IsNull()); + + // null --> null, not dirty (no change) + EXPECT_EQ(attribute.SetValue(NullNullable, now), AttributeDirtyState::kNoReportNeeded); + EXPECT_TRUE(attribute.value().IsNull()); + + // null --> 11, expect marked dirty (null change always marks dirty). + EXPECT_EQ(attribute.SetValue(11, now), AttributeDirtyState::kMustReport); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 11); + + // Reset policy, expect 11 --> 12 does not mark dirty due to no longer having the policy that causes it. + attribute.policy().ClearAll(); + EXPECT_FALSE(attribute.policy().HasAny()); + + EXPECT_EQ(attribute.SetValue(12, now), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 12); +} + +TEST(TestQuieterReporting, ChangeOnDecrementPolicyWorks) +{ + FakeClock fakeClock; + fakeClock.SetMonotonic(100_ms); + + QuieterReportingAttribute attribute{ MakeNullable(9) }; + + // Always start not dirty (because first sub priming always just read value anyway). + ASSERT_EQ(attribute.value().Value(), 9); + + auto now = fakeClock.now(); + + attribute.policy().Set(QuieterReportingPolicyEnum::kMarkDirtyOnDecrement); + EXPECT_TRUE(attribute.policy().HasOnly(QuieterReportingPolicyEnum::kMarkDirtyOnDecrement)); + + // 9 --> 10, expect not marked dirty yet. + EXPECT_EQ(attribute.SetValue(10, now), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 10); + + // 10 --> 9, expect marked dirty. + EXPECT_EQ(attribute.SetValue(9, now), AttributeDirtyState::kMustReport); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 9); + + // 9 --> 8, expect marked dirty. + EXPECT_EQ(attribute.SetValue(8, now), AttributeDirtyState::kMustReport); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 8); + + // Second call in a row always false. + + // 8 --> 8, expect not marked dirty. + EXPECT_EQ(attribute.SetValue(8, now), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 8); + + // 8 --> null, expect marked dirty (null change always marks dirty) + EXPECT_EQ(attribute.SetValue(NullNullable, now), AttributeDirtyState::kMustReport); + EXPECT_TRUE(attribute.value().IsNull()); + + // null --> null, not dirty (no change) + EXPECT_EQ(attribute.SetValue(NullNullable, now), AttributeDirtyState::kNoReportNeeded); + EXPECT_TRUE(attribute.value().IsNull()); + + // null --> 11, expect marked dirty (null change always marks dirty). + EXPECT_EQ(attribute.SetValue(11, now), AttributeDirtyState::kMustReport); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 11); + + // Reset policy, expect 11 --> 10 does not mark dirty due to no longer having the policy that causes it. + attribute.policy().ClearAll(); + EXPECT_FALSE(attribute.policy().HasAny()); + + EXPECT_EQ(attribute.SetValue(10, now), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 10); +} + +TEST(TestQuieterReporting, SufficientChangePredicateWorks) +{ + FakeClock fakeClock; + fakeClock.SetMonotonic(100_ms); + + QuieterReportingAttribute attribute{ MakeNullable(9) }; + + // Always start not dirty (because first sub priming always just read value anyway). + ASSERT_EQ(attribute.value().Value(), 9); + + auto now = fakeClock.now(); + + EXPECT_EQ(attribute.SetValue(10, now), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 10); + + auto predicate = attribute.GetPredicateForSufficientTimeSinceLastDirty(1000_ms); + + now = fakeClock.Advance(100_ms); + + // Last dirty value is 10. This won't mark dirty again due to predicate mismatch. + EXPECT_EQ(attribute.SetValue(11, now, predicate), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 11); + + now = fakeClock.Advance(900_ms); + // Last dirty value is 10 still. This will mark dirty because both enough time has passed + // and value is different from the last dirty value. + EXPECT_EQ(attribute.SetValue(11, now, predicate), AttributeDirtyState::kMustReport); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 11); + + // Last dirty value is 11. Since there has not been a value change, no amount of time will + // mark dirty. + now = fakeClock.Advance(1000_ms); + EXPECT_EQ(attribute.SetValue(11, now, predicate), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 11); + + now = fakeClock.Advance(1000_ms); + EXPECT_EQ(attribute.SetValue(11, now, predicate), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 11); + + // Change the value to a value that marks dirty. + now = fakeClock.Advance(1_ms); + EXPECT_EQ(attribute.SetValue(12, now, predicate), AttributeDirtyState::kMustReport); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 12); + + // Wait a small delay and change again. Will not mark dirty due to too little time. + now = fakeClock.Advance(1_ms); + EXPECT_EQ(attribute.SetValue(13, now, predicate), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 13); + + now = fakeClock.Advance(1_ms); + EXPECT_EQ(attribute.SetValue(14, now, predicate), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 14); + + // Forcing dirty can NOT done with a force-true predicate. + decltype(attribute)::SufficientChangePredicate forceTruePredicate{ + [](const decltype(attribute)::SufficientChangePredicateCandidate &) -> bool { return true; } + }; + now = fakeClock.Advance(1_ms); + EXPECT_EQ(attribute.SetValue(12, now, forceTruePredicate), AttributeDirtyState::kNoReportNeeded); + EXPECT_EQ(attribute.value().ValueOr(INT_MAX), 12); + + // Change to a value that marks dirty no matter what (e.g. null). Should be dirty even + // before delay. + now = fakeClock.Advance(1_ms); + EXPECT_EQ(attribute.SetValue(NullNullable, now, predicate), AttributeDirtyState::kMustReport); + EXPECT_TRUE(attribute.value().IsNull()); + + // Null --> Null should not lead to dirty. + now = fakeClock.Advance(1000_ms); + EXPECT_EQ(attribute.SetValue(NullNullable, now, predicate), AttributeDirtyState::kNoReportNeeded); + EXPECT_TRUE(attribute.value().IsNull()); +} diff --git a/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp b/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp index 83a0b04281b1ad..a7b3eaed75fd7d 100644 --- a/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp +++ b/src/app/clusters/administrator-commissioning-server/administrator-commissioning-server.cpp @@ -91,8 +91,8 @@ bool emberAfAdministratorCommissioningClusterOpenCommissioningWindowCallback( auto & iterations = commandData.iterations; auto & salt = commandData.salt; - Optional status = Optional::Missing(); - InteractionModel::Status globalStatus = InteractionModel::Status::Success; + Optional status = Optional::Missing(); + Status globalStatus = Status::Success; Spake2pVerifier verifier; ChipLogProgress(Zcl, "Received command to open commissioning window"); @@ -110,11 +110,9 @@ bool emberAfAdministratorCommissioningClusterOpenCommissioningWindowCallback( VerifyOrExit(iterations <= kSpake2p_Max_PBKDF_Iterations, status.Emplace(StatusCode::kPAKEParameterError)); VerifyOrExit(salt.size() >= kSpake2p_Min_PBKDF_Salt_Length, status.Emplace(StatusCode::kPAKEParameterError)); VerifyOrExit(salt.size() <= kSpake2p_Max_PBKDF_Salt_Length, status.Emplace(StatusCode::kPAKEParameterError)); - VerifyOrExit(commissioningTimeout <= commissionMgr.MaxCommissioningTimeout(), - globalStatus = InteractionModel::Status::InvalidCommand); - VerifyOrExit(commissioningTimeout >= commissionMgr.MinCommissioningTimeout(), - globalStatus = InteractionModel::Status::InvalidCommand); - VerifyOrExit(discriminator <= kMaxDiscriminatorValue, globalStatus = InteractionModel::Status::InvalidCommand); + VerifyOrExit(commissioningTimeout <= commissionMgr.MaxCommissioningTimeout(), globalStatus = Status::InvalidCommand); + VerifyOrExit(commissioningTimeout >= commissionMgr.MinCommissioningTimeout(), globalStatus = Status::InvalidCommand); + VerifyOrExit(discriminator <= kMaxDiscriminatorValue, globalStatus = Status::InvalidCommand); VerifyOrExit(verifier.Deserialize(pakeVerifier) == CHIP_NO_ERROR, status.Emplace(StatusCode::kPAKEParameterError)); VerifyOrExit(commissionMgr.OpenEnhancedCommissioningWindow(commissioningTimeout, discriminator, verifier, iterations, salt, @@ -130,7 +128,7 @@ bool emberAfAdministratorCommissioningClusterOpenCommissioningWindowCallback( } else { - if (globalStatus != InteractionModel::Status::Success) + if (globalStatus != Status::Success) { ChipLogError(Zcl, "Failed to open commissioning window. Global status " ChipLogFormatIMStatus, ChipLogValueIMStatus(globalStatus)); @@ -147,8 +145,8 @@ bool emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallbac MATTER_TRACE_SCOPE("OpenBasicCommissioningWindow", "AdministratorCommissioning"); auto commissioningTimeout = System::Clock::Seconds16(commandData.commissioningTimeout); - Optional status = Optional::Missing(); - InteractionModel::Status globalStatus = InteractionModel::Status::Success; + Optional status = Optional::Missing(); + Status globalStatus = Status::Success; ChipLogProgress(Zcl, "Received command to open basic commissioning window"); FabricIndex fabricIndex = commandObj->GetAccessingFabricIndex(); @@ -160,10 +158,8 @@ bool emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallbac VerifyOrExit(!commissionMgr.IsCommissioningWindowOpen(), status.Emplace(StatusCode::kBusy)); VerifyOrExit(failSafeContext.IsFailSafeFullyDisarmed(), status.Emplace(StatusCode::kBusy)); - VerifyOrExit(commissioningTimeout <= commissionMgr.MaxCommissioningTimeout(), - globalStatus = InteractionModel::Status::InvalidCommand); - VerifyOrExit(commissioningTimeout >= commissionMgr.MinCommissioningTimeout(), - globalStatus = InteractionModel::Status::InvalidCommand); + VerifyOrExit(commissioningTimeout <= commissionMgr.MaxCommissioningTimeout(), globalStatus = Status::InvalidCommand); + VerifyOrExit(commissioningTimeout >= commissionMgr.MinCommissioningTimeout(), globalStatus = Status::InvalidCommand); VerifyOrExit(commissionMgr.OpenBasicCommissioningWindowForAdministratorCommissioningCluster( commissioningTimeout, fabricIndex, fabricInfo->GetVendorId()) == CHIP_NO_ERROR, status.Emplace(StatusCode::kPAKEParameterError)); @@ -177,7 +173,7 @@ bool emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallbac } else { - if (globalStatus != InteractionModel::Status::Success) + if (globalStatus != Status::Success) { ChipLogError(Zcl, "Failed to open commissioning window. Global status " ChipLogFormatIMStatus, ChipLogValueIMStatus(globalStatus)); diff --git a/src/app/clusters/color-control-server/color-control-server.cpp b/src/app/clusters/color-control-server/color-control-server.cpp index 558703a8f12fce..c4de9f9d9461ef 100644 --- a/src/app/clusters/color-control-server/color-control-server.cpp +++ b/src/app/clusters/color-control-server/color-control-server.cpp @@ -30,6 +30,7 @@ #endif using namespace chip; +using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::ColorControl; using chip::Protocols::InteractionModel::Status; @@ -99,7 +100,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl /// @return CHIP_NO_ERROR if successfully serialized the data, CHIP_ERROR_INVALID_ARGUMENT otherwise CHIP_ERROR SerializeSave(EndpointId endpoint, ClusterId cluster, MutableByteSpan & serializedBytes) override { - using AttributeValuePair = ScenesManagement::Structs::AttributeValuePair::Type; + using AttributeValuePair = ScenesManagement::Structs::AttributeValuePairStruct::Type; AttributeValuePair pairs[kColorControlScenableAttributesCount]; @@ -112,21 +113,21 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl { xValue = 0x616B; // Default X value according to spec } - AddAttributeValuePair(pairs, Attributes::CurrentX::Id, xValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::CurrentX::Id, xValue, attributeCount); uint16_t yValue; if (Status::Success != Attributes::CurrentY::Get(endpoint, &yValue)) { yValue = 0x607D; // Default Y value according to spec } - AddAttributeValuePair(pairs, Attributes::CurrentY::Id, yValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::CurrentY::Id, yValue, attributeCount); } if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kEnhancedHue)) { uint16_t hueValue = 0x0000; Attributes::EnhancedCurrentHue::Get(endpoint, &hueValue); - AddAttributeValuePair(pairs, Attributes::EnhancedCurrentHue::Id, hueValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::EnhancedCurrentHue::Id, hueValue, attributeCount); } if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kHueAndSaturation)) @@ -136,7 +137,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl { saturationValue = 0x00; } - AddAttributeValuePair(pairs, Attributes::CurrentSaturation::Id, saturationValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::CurrentSaturation::Id, saturationValue, attributeCount); } if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kColorLoop)) @@ -146,21 +147,21 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl { loopActiveValue = 0x00; } - AddAttributeValuePair(pairs, Attributes::ColorLoopActive::Id, loopActiveValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::ColorLoopActive::Id, loopActiveValue, attributeCount); uint8_t loopDirectionValue; if (Status::Success != Attributes::ColorLoopDirection::Get(endpoint, &loopDirectionValue)) { loopDirectionValue = 0x00; } - AddAttributeValuePair(pairs, Attributes::ColorLoopDirection::Id, loopDirectionValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::ColorLoopDirection::Id, loopDirectionValue, attributeCount); uint16_t loopTimeValue; if (Status::Success != Attributes::ColorLoopTime::Get(endpoint, &loopTimeValue)) { loopTimeValue = 0x0019; // Default loop time value according to spec } - AddAttributeValuePair(pairs, Attributes::ColorLoopTime::Id, loopTimeValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::ColorLoopTime::Id, loopTimeValue, attributeCount); } if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kColorTemperature)) @@ -170,7 +171,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl { temperatureValue = 0x00FA; // Default temperature value according to spec } - AddAttributeValuePair(pairs, Attributes::ColorTemperatureMireds::Id, temperatureValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::ColorTemperatureMireds::Id, temperatureValue, attributeCount); } uint8_t modeValue; @@ -178,7 +179,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl { modeValue = ColorControl::EnhancedColorMode::kCurrentXAndCurrentY; // Default mode value according to spec } - AddAttributeValuePair(pairs, Attributes::EnhancedColorMode::Id, modeValue, attributeCount); + AddAttributeValuePair(pairs, Attributes::EnhancedColorMode::Id, modeValue, attributeCount); app::DataModel::List attributeValueList(pairs, attributeCount); @@ -194,7 +195,7 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl CHIP_ERROR ApplyScene(EndpointId endpoint, ClusterId cluster, const ByteSpan & serializedBytes, scenes::TransitionTimeMs timeMs) override { - app::DataModel::DecodableList attributeValueList; + app::DataModel::DecodableList attributeValueList; ReturnErrorOnFailure(DecodeAttributeValueList(serializedBytes, attributeValueList)); @@ -204,22 +205,24 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl // The color control cluster should have a maximum of 9 scenable attributes ReturnErrorOnFailure(attributeValueList.ComputeSize(&attributeCount)); VerifyOrReturnError(attributeCount <= kColorControlScenableAttributesCount, CHIP_ERROR_BUFFER_TOO_SMALL); + + uint16_t epIndex = ColorControlServer::Instance().getEndpointIndex(endpoint); // Retrieve the buffers for different modes #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_HSV ColorControlServer::ColorHueTransitionState * colorHueTransitionState = - ColorControlServer::Instance().getColorHueTransitionState(endpoint); + ColorControlServer::Instance().getColorHueTransitionStateByIndex(epIndex); ColorControlServer::Color16uTransitionState * colorSaturationTransitionState = - ColorControlServer::Instance().getSaturationTransitionState(endpoint); + ColorControlServer::Instance().getSaturationTransitionStateByIndex(epIndex); #endif #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_XY ColorControlServer::Color16uTransitionState * colorXTransitionState = - ColorControlServer::Instance().getXTransitionState(endpoint); + ColorControlServer::Instance().getXTransitionStateByIndex(epIndex); ColorControlServer::Color16uTransitionState * colorYTransitionState = - ColorControlServer::Instance().getYTransitionState(endpoint); + ColorControlServer::Instance().getYTransitionStateByIndex(epIndex); #endif #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_TEMP ColorControlServer::Color16uTransitionState * colorTempTransitionState = - ColorControlServer::Instance().getTempTransitionState(endpoint); + ColorControlServer::Instance().getTempTransitionStateByIndex(epIndex); #endif // Initialize action attributes to default values in case they are not in the scene @@ -237,52 +240,60 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl case Attributes::CurrentX::Id: if (SupportsColorMode(endpoint, ColorControl::EnhancedColorMode::kCurrentXAndCurrentY)) { - if (decodePair.attributeValue) - colorXTransitionState->finalValue = - std::min(static_cast(decodePair.attributeValue), colorXTransitionState->highLimit); + VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + colorXTransitionState->finalValue = + std::min(decodePair.valueUnsigned16.Value(), colorXTransitionState->highLimit); } break; case Attributes::CurrentY::Id: if (SupportsColorMode(endpoint, ColorControl::EnhancedColorMode::kCurrentXAndCurrentY)) { + VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); colorYTransitionState->finalValue = - std::min(static_cast(decodePair.attributeValue), colorYTransitionState->highLimit); + std::min(decodePair.valueUnsigned16.Value(), colorYTransitionState->highLimit); } break; case Attributes::EnhancedCurrentHue::Id: if (SupportsColorMode(endpoint, ColorControl::EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation)) { - colorHueTransitionState->finalEnhancedHue = static_cast(decodePair.attributeValue); + VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + colorHueTransitionState->finalEnhancedHue = decodePair.valueUnsigned16.Value(); } break; case Attributes::CurrentSaturation::Id: if (SupportsColorMode(endpoint, ColorControl::EnhancedColorMode::kCurrentHueAndCurrentSaturation)) { - colorSaturationTransitionState->finalValue = - std::min(static_cast(decodePair.attributeValue), colorSaturationTransitionState->highLimit); + VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + colorSaturationTransitionState->finalValue = std::min(static_cast(decodePair.valueUnsigned8.Value()), + colorSaturationTransitionState->highLimit); } break; case Attributes::ColorLoopActive::Id: - loopActiveValue = static_cast(decodePair.attributeValue); + VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + loopActiveValue = decodePair.valueUnsigned8.Value(); break; case Attributes::ColorLoopDirection::Id: - loopDirectionValue = static_cast(decodePair.attributeValue); + VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + loopDirectionValue = decodePair.valueUnsigned8.Value(); break; case Attributes::ColorLoopTime::Id: - loopTimeValue = static_cast(decodePair.attributeValue); + VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + loopTimeValue = decodePair.valueUnsigned16.Value(); break; case Attributes::ColorTemperatureMireds::Id: if (SupportsColorMode(endpoint, ColorControl::EnhancedColorMode::kColorTemperature)) { + VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); colorTempTransitionState->finalValue = - std::min(static_cast(decodePair.attributeValue), colorTempTransitionState->highLimit); + std::min(decodePair.valueUnsigned16.Value(), colorTempTransitionState->highLimit); } break; case Attributes::EnhancedColorMode::Id: - if (decodePair.attributeValue <= + VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + if (decodePair.valueUnsigned8.Value() <= static_cast(ColorControl::EnhancedColorMode::kEnhancedCurrentHueAndCurrentSaturation)) { - targetColorMode = static_cast(decodePair.attributeValue); + targetColorMode = decodePair.valueUnsigned8.Value(); } break; default: @@ -371,11 +382,28 @@ class DefaultColorControlSceneHandler : public scenes::DefaultSceneHandlerImpl } } - void AddAttributeValuePair(ScenesManagement::Structs::AttributeValuePair::Type * pairs, AttributeId id, uint32_t value, + /// AddAttributeValuePair + /// @brief Helper function to add an attribute value pair to the attribute value pair array in the color control SceneHandler + /// @param pairs list of attribute value pairs + /// @param id attribute id + /// @param value attribute value + /// @param attributeCount number of attributes in the list, incremented by this function, used to keep track of how many + /// attributes from the array are being used for the list to encode + template + void AddAttributeValuePair(ScenesManagement::Structs::AttributeValuePairStruct::Type * pairs, AttributeId id, Type value, size_t & attributeCount) { - pairs[attributeCount].attributeID = id; - pairs[attributeCount].attributeValue = value; + static_assert((std::is_same_v) || (std::is_same_v), "Type must be uint8_t or uint16_t"); + + pairs[attributeCount].attributeID = id; + if constexpr ((std::is_same_v) ) + { + pairs[attributeCount].valueUnsigned8.SetValue(value); + } + else if constexpr ((std::is_same_v) ) + { + pairs[attributeCount].valueUnsigned16.SetValue(value); + } attributeCount++; } }; @@ -431,6 +459,11 @@ ColorControlServer & ColorControlServer::Instance() return instance; } +uint16_t ColorControlServer::getEndpointIndex(EndpointId endpoint) +{ + return emberAfGetClusterServerEndpointIndex(endpoint, ColorControl::Id, MATTER_DM_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); +} + #ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT chip::scenes::SceneHandler * ColorControlServer::GetSceneHandler() { @@ -466,7 +499,19 @@ bool ColorControlServer::stopMoveStepCommand(app::CommandHandler * commandObj, c EndpointId endpoint = commandPath.mEndpointId; Status status = Status::Success; - if (shouldExecuteIfOff(endpoint, optionsMask, optionsOverride)) + // StopMoveStep command has no effect on an active color loop. + // Fetch if it is supported and active. + uint8_t isColorLoopActive = 0; + if (ColorControlServer::Instance().HasFeature(endpoint, ColorControlServer::Feature::kColorLoop)) + { + // In case of get failure, isColorLoopActive will remain at the init value 0 (not active) + if (Attributes::ColorLoopActive::Get(endpoint, &isColorLoopActive) != Status::Success) + { + ChipLogError(Zcl, "Failed to retrieve ColorLoopActive value"); + } + } + + if (shouldExecuteIfOff(endpoint, optionsMask, optionsOverride) && !isColorLoopActive) { status = stopAllColorTransitions(endpoint); @@ -476,8 +521,9 @@ bool ColorControlServer::stopMoveStepCommand(app::CommandHandler * commandObj, c // Init both transition states on stop command to prevent that. if (status == Status::Success) { - ColorHueTransitionState * hueState = getColorHueTransitionState(endpoint); - Color16uTransitionState * saturationState = getSaturationTransitionState(endpoint); + uint16_t epIndex = getEndpointIndex(endpoint); + ColorHueTransitionState * hueState = getColorHueTransitionStateByIndex(epIndex); + Color16uTransitionState * saturationState = getSaturationTransitionStateByIndex(epIndex); initHueTransitionState(endpoint, hueState, false /*isEnhancedHue don't care*/); initSaturationTransitionState(endpoint, saturationState); } @@ -665,8 +711,7 @@ uint16_t ColorControlServer::computeTransitionTimeFromStateAndRate(ColorControlS */ EmberEventControl * ColorControlServer::getEventControl(EndpointId endpoint) { - uint16_t index = - emberAfGetClusterServerEndpointIndex(endpoint, ColorControl::Id, MATTER_DM_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); + uint16_t index = getEndpointIndex(endpoint); EmberEventControl * event = nullptr; if (index < ArraySize(eventControls)) @@ -788,15 +833,13 @@ bool ColorControlServer::computeNewColor16uValue(ColorControlServer::Color16uTra #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_HSV /** - * @brief Returns ColorHueTransititionState associated to an endpoint + * @brief Returns ColorHueTransititionState associated to an endpoint index * * @param[in] endpoint * @return ColorControlServer::ColorHueTransitionState* */ -ColorControlServer::ColorHueTransitionState * ColorControlServer::getColorHueTransitionState(EndpointId endpoint) +ColorControlServer::ColorHueTransitionState * ColorControlServer::getColorHueTransitionStateByIndex(uint16_t index) { - uint16_t index = - emberAfGetClusterServerEndpointIndex(endpoint, ColorControl::Id, MATTER_DM_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); ColorHueTransitionState * state = nullptr; if (index < ArraySize(colorHueTransitionStates)) @@ -807,15 +850,24 @@ ColorControlServer::ColorHueTransitionState * ColorControlServer::getColorHueTra } /** - * @brief Returns Color16uTransitionState for saturation associated to an endpoint + * @brief Returns ColorHueTransititionState associated to an endpoint + * + * @param[in] endpoint + * @return ColorControlServer::ColorHueTransitionState* + */ +ColorControlServer::ColorHueTransitionState * ColorControlServer::getColorHueTransitionState(EndpointId endpoint) +{ + return getColorHueTransitionStateByIndex(getEndpointIndex(endpoint)); +} + +/** + * @brief Returns the saturation Color16uTransitionState associated to an endpoint index * * @param[in] endpoint * @return ColorControlServer::Color16uTransitionState* */ -ColorControlServer::Color16uTransitionState * ColorControlServer::getSaturationTransitionState(EndpointId endpoint) +ColorControlServer::Color16uTransitionState * ColorControlServer::getSaturationTransitionStateByIndex(uint16_t index) { - uint16_t index = - emberAfGetClusterServerEndpointIndex(endpoint, ColorControl::Id, MATTER_DM_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); Color16uTransitionState * state = nullptr; if (index < ArraySize(colorSatTransitionStates)) @@ -825,6 +877,17 @@ ColorControlServer::Color16uTransitionState * ColorControlServer::getSaturationT return state; } +/** + * @brief Returns the saturation Color16uTransitionState associated to an endpoint + * + * @param[in] endpoint + * @return ColorControlServer::Color16uTransitionState* + */ +ColorControlServer::Color16uTransitionState * ColorControlServer::getSaturationTransitionState(EndpointId endpoint) +{ + return getSaturationTransitionStateByIndex(getEndpointIndex(endpoint)); +} + /** * @brief Returns current saturation for a specified endpoint * @@ -996,9 +1059,10 @@ void ColorControlServer::startColorLoop(EndpointId endpoint, uint8_t startFromSt colorHueTransitionState->stepsRemaining = static_cast(time * TRANSITION_STEPS_PER_1S); colorHueTransitionState->stepsTotal = static_cast(time * TRANSITION_STEPS_PER_1S); colorHueTransitionState->timeRemaining = MAX_INT16U_VALUE; + colorHueTransitionState->transitionTime = MAX_INT16U_VALUE; colorHueTransitionState->endpoint = endpoint; - Attributes::RemainingTime::Set(endpoint, MAX_INT16U_VALUE); + SetQuietReportRemainingTime(endpoint, MAX_INT16U_VALUE); scheduleTimerCallbackMs(configureHSVEventControl(endpoint), TRANSITION_UPDATE_TIME_MS.count()); } @@ -1042,13 +1106,14 @@ void ColorControlServer::initSaturationTransitionState(chip::EndpointId endpoint void ColorControlServer::SetHSVRemainingTime(chip::EndpointId endpoint) { - ColorHueTransitionState * hueTransitionState = getColorHueTransitionState(endpoint); - Color16uTransitionState * saturationTransitionState = getSaturationTransitionState(endpoint); + uint16_t epIndex = getEndpointIndex(endpoint); + ColorHueTransitionState * hueTransitionState = getColorHueTransitionStateByIndex(epIndex); + Color16uTransitionState * saturationTransitionState = getSaturationTransitionStateByIndex(epIndex); // When the hue transition is loop, RemainingTime stays at MAX_INT16 if (hueTransitionState->repeat == false) { - Attributes::RemainingTime::Set(endpoint, max(hueTransitionState->timeRemaining, saturationTransitionState->timeRemaining)); + SetQuietReportRemainingTime(endpoint, max(hueTransitionState->timeRemaining, saturationTransitionState->timeRemaining)); } } @@ -1140,7 +1205,7 @@ bool ColorControlServer::computeNewHueValue(ColorControlServer::ColorHueTransiti return true; } - // Check if we are in a color loop. If not, we are in a moveHue + // Check if we are in a color loop. If not, we are in a moveHue uint8_t isColorLoop = 0; Attributes::ColorLoopActive::Get(p->endpoint, &isColorLoop); @@ -1240,6 +1305,7 @@ Status ColorControlServer::moveToSaturation(uint8_t saturation, uint16_t transit colorSaturationTransitionState->stepsRemaining = max(transitionTime, 1); colorSaturationTransitionState->stepsTotal = colorSaturationTransitionState->stepsRemaining; colorSaturationTransitionState->timeRemaining = transitionTime; + colorSaturationTransitionState->transitionTime = transitionTime; colorSaturationTransitionState->endpoint = endpoint; colorSaturationTransitionState->lowLimit = MIN_SATURATION_VALUE; colorSaturationTransitionState->highLimit = MAX_SATURATION_VALUE; @@ -1271,8 +1337,9 @@ Status ColorControlServer::moveToHueAndSaturation(uint16_t hue, uint8_t saturati uint16_t halfWay = isEnhanced ? HALF_MAX_UINT16T : HALF_MAX_UINT8T; bool moveUp; - Color16uTransitionState * colorSaturationTransitionState = getSaturationTransitionState(endpoint); - ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionState(endpoint); + uint16_t epIndex = getEndpointIndex(endpoint); + Color16uTransitionState * colorSaturationTransitionState = getSaturationTransitionStateByIndex(epIndex); + ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionStateByIndex(epIndex); VerifyOrReturnError(nullptr != colorSaturationTransitionState, Status::UnsupportedEndpoint); VerifyOrReturnError(nullptr != colorHueTransitionState, Status::UnsupportedEndpoint); @@ -1318,6 +1385,7 @@ Status ColorControlServer::moveToHueAndSaturation(uint16_t hue, uint8_t saturati colorHueTransitionState->stepsRemaining = max(transitionTime, 1); colorHueTransitionState->stepsTotal = colorHueTransitionState->stepsRemaining; colorHueTransitionState->timeRemaining = transitionTime; + colorHueTransitionState->transitionTime = transitionTime; colorHueTransitionState->endpoint = endpoint; colorHueTransitionState->repeat = false; @@ -1326,6 +1394,7 @@ Status ColorControlServer::moveToHueAndSaturation(uint16_t hue, uint8_t saturati colorSaturationTransitionState->stepsRemaining = colorHueTransitionState->stepsRemaining; colorSaturationTransitionState->stepsTotal = colorHueTransitionState->stepsRemaining; colorSaturationTransitionState->timeRemaining = transitionTime; + colorSaturationTransitionState->transitionTime = transitionTime; colorSaturationTransitionState->endpoint = endpoint; colorSaturationTransitionState->lowLimit = MIN_SATURATION_VALUE; colorSaturationTransitionState->highLimit = MAX_SATURATION_VALUE; @@ -1356,13 +1425,16 @@ bool ColorControlServer::moveHueCommand(app::CommandHandler * commandObj, const bool isEnhanced) { MATTER_TRACE_SCOPE("moveHue", "ColorControl"); - EndpointId endpoint = commandPath.mEndpointId; - Status status = Status::Success; - ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionState(endpoint); + EndpointId endpoint = commandPath.mEndpointId; + Status status = Status::Success; + + uint16_t epIndex = getEndpointIndex(endpoint); + ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionStateByIndex(epIndex); VerifyOrExit(colorHueTransitionState != nullptr, status = Status::UnsupportedEndpoint); - // check moveMode before any operation is done on the transition states + // check moveMode and rate before any operation is done on the transition states + // rate value is ignored if the MoveMode is stop if (moveMode == HueMoveMode::kUnknownEnumValue || (rate == 0 && moveMode != HueMoveMode::kStop)) { commandObj->AddStatus(commandPath, Status::InvalidCommand); @@ -1383,7 +1455,7 @@ bool ColorControlServer::moveHueCommand(app::CommandHandler * commandObj, const if (moveMode == HueMoveMode::kStop) { // Per spec any saturation transition must also be cancelled. - Color16uTransitionState * saturationState = getSaturationTransitionState(endpoint); + Color16uTransitionState * saturationState = getSaturationTransitionStateByIndex(epIndex); initSaturationTransitionState(endpoint, saturationState); commandObj->AddStatus(commandPath, Status::Success); return true; @@ -1429,11 +1501,12 @@ bool ColorControlServer::moveHueCommand(app::CommandHandler * commandObj, const colorHueTransitionState->stepsRemaining = TRANSITION_STEPS_PER_1S; colorHueTransitionState->stepsTotal = TRANSITION_STEPS_PER_1S; colorHueTransitionState->timeRemaining = MAX_INT16U_VALUE; + colorHueTransitionState->transitionTime = MAX_INT16U_VALUE; colorHueTransitionState->endpoint = endpoint; colorHueTransitionState->repeat = true; // hue movement can last forever. Indicate this with a remaining time of maxint - Attributes::RemainingTime::Set(endpoint, MAX_INT16U_VALUE); + SetQuietReportRemainingTime(endpoint, MAX_INT16U_VALUE); // kick off the state machine: scheduleTimerCallbackMs(configureHSVEventControl(endpoint), TRANSITION_UPDATE_TIME_MS.count()); @@ -1562,6 +1635,7 @@ bool ColorControlServer::moveToHueCommand(app::CommandHandler * commandObj, cons colorHueTransitionState->stepsRemaining = max(transitionTime, 1); colorHueTransitionState->stepsTotal = colorHueTransitionState->stepsRemaining; colorHueTransitionState->timeRemaining = transitionTime; + colorHueTransitionState->transitionTime = transitionTime; colorHueTransitionState->endpoint = endpoint; colorHueTransitionState->up = (direction == HueDirection::kUp); colorHueTransitionState->repeat = false; @@ -1644,8 +1718,8 @@ bool ColorControlServer::stepHueCommand(app::CommandHandler * commandObj, const ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionState(endpoint); VerifyOrExit(colorHueTransitionState != nullptr, status = Status::UnsupportedEndpoint); - // Confirm validity of the step mode received - if (stepMode == HueStepMode::kUnknownEnumValue) + // Confirm validity of the step mode and step size received + if (stepMode == HueStepMode::kUnknownEnumValue || stepSize == 0) { commandObj->AddStatus(commandPath, Status::InvalidCommand); return true; @@ -1704,6 +1778,7 @@ bool ColorControlServer::stepHueCommand(app::CommandHandler * commandObj, const colorHueTransitionState->stepsRemaining = max(transitionTime, 1); colorHueTransitionState->stepsTotal = colorHueTransitionState->stepsRemaining; colorHueTransitionState->timeRemaining = transitionTime; + colorHueTransitionState->transitionTime = transitionTime; colorHueTransitionState->endpoint = endpoint; colorHueTransitionState->repeat = false; @@ -1728,10 +1803,12 @@ bool ColorControlServer::moveSaturationCommand(app::CommandHandler * commandObj, EndpointId endpoint = commandPath.mEndpointId; Status status = Status::Success; - Color16uTransitionState * colorSaturationTransitionState = getSaturationTransitionState(endpoint); + uint16_t epIndex = getEndpointIndex(endpoint); + Color16uTransitionState * colorSaturationTransitionState = getSaturationTransitionStateByIndex(epIndex); VerifyOrExit(colorSaturationTransitionState != nullptr, status = Status::UnsupportedEndpoint); - // check moveMode before any operation is done on the transition states + // check moveMode and rate before any operation is done on the transition states + // rate value is ignored if the MoveMode is stop if (moveMode == SaturationMoveMode::kUnknownEnumValue || (rate == 0 && moveMode != SaturationMoveMode::kStop)) { commandObj->AddStatus(commandPath, Status::InvalidCommand); @@ -1755,7 +1832,7 @@ bool ColorControlServer::moveSaturationCommand(app::CommandHandler * commandObj, if (moveMode == SaturationMoveMode::kStop) { // Per spec any hue transition must also be cancelled. - ColorHueTransitionState * hueState = getColorHueTransitionState(endpoint); + ColorHueTransitionState * hueState = getColorHueTransitionStateByIndex(epIndex); initHueTransitionState(endpoint, hueState, false /*isEnhancedHue don't care*/); commandObj->AddStatus(commandPath, Status::Success); return true; @@ -1778,6 +1855,7 @@ bool ColorControlServer::moveSaturationCommand(app::CommandHandler * commandObj, colorSaturationTransitionState->stepsRemaining = transitionTime; colorSaturationTransitionState->stepsTotal = transitionTime; colorSaturationTransitionState->timeRemaining = transitionTime; + colorSaturationTransitionState->transitionTime = transitionTime; colorSaturationTransitionState->endpoint = endpoint; colorSaturationTransitionState->lowLimit = MIN_SATURATION_VALUE; colorSaturationTransitionState->highLimit = MAX_SATURATION_VALUE; @@ -1842,8 +1920,8 @@ bool ColorControlServer::stepSaturationCommand(app::CommandHandler * commandObj, Color16uTransitionState * colorSaturationTransitionState = getSaturationTransitionState(endpoint); VerifyOrExit(colorSaturationTransitionState != nullptr, status = Status::UnsupportedEndpoint); - // Confirm validity of the step mode received - if (stepMode == SaturationStepMode::kUnknownEnumValue) + // Confirm validity of the step mode and step size received + if (stepMode == SaturationStepMode::kUnknownEnumValue || stepSize == 0) { commandObj->AddStatus(commandPath, Status::InvalidCommand); return true; @@ -1876,6 +1954,7 @@ bool ColorControlServer::stepSaturationCommand(app::CommandHandler * commandObj, colorSaturationTransitionState->stepsRemaining = max(transitionTime, 1); colorSaturationTransitionState->stepsTotal = colorSaturationTransitionState->stepsRemaining; colorSaturationTransitionState->timeRemaining = transitionTime; + colorSaturationTransitionState->transitionTime = transitionTime; colorSaturationTransitionState->endpoint = endpoint; colorSaturationTransitionState->lowLimit = MIN_SATURATION_VALUE; colorSaturationTransitionState->highLimit = MAX_SATURATION_VALUE; @@ -1906,7 +1985,8 @@ bool ColorControlServer::colorLoopCommand(app::CommandHandler * commandObj, cons uint8_t isColorLoopActive = 0; uint8_t deactiveColorLoop = 0; - ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionState(endpoint); + uint16_t epIndex = getEndpointIndex(endpoint); + ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionStateByIndex(epIndex); VerifyOrExit(colorHueTransitionState != nullptr, status = Status::UnsupportedEndpoint); // Validate the action and direction parameters of the command @@ -1922,7 +2002,11 @@ bool ColorControlServer::colorLoopCommand(app::CommandHandler * commandObj, cons return true; } - Attributes::ColorLoopActive::Get(endpoint, &isColorLoopActive); + // In case of get failure, isColorLoopActive will remain at the init value 0 (not active) + if (Attributes::ColorLoopActive::Get(endpoint, &isColorLoopActive) != Status::Success) + { + ChipLogError(Zcl, "Failed to retrieve ColorLoopActive value"); + } deactiveColorLoop = updateFlags.Has(ColorLoopUpdateFlags::kUpdateAction) && (action == ColorLoopAction::kDeactivate); @@ -1987,7 +2071,9 @@ bool ColorControlServer::colorLoopCommand(app::CommandHandler * commandObj, cons uint16_t storedEnhancedHue = 0; Attributes::ColorLoopStoredEnhancedHue::Get(endpoint, &storedEnhancedHue); - Attributes::EnhancedCurrentHue::Set(endpoint, storedEnhancedHue); + MarkAttributeDirty markDirty = + SetQuietReportAttribute(quietEnhancedHue[epIndex], storedEnhancedHue, true /*isStartOrEndOfTransition*/, 0); + Attributes::EnhancedCurrentHue::Set(endpoint, quietEnhancedHue[epIndex].value().Value(), markDirty); } else { @@ -2020,13 +2106,18 @@ bool ColorControlServer::colorLoopCommand(app::CommandHandler * commandObj, cons void ColorControlServer::updateHueSatCommand(EndpointId endpoint) { MATTER_TRACE_SCOPE("updateHueSat", "ColorControl"); - ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionState(endpoint); - Color16uTransitionState * colorSaturationTransitionState = getSaturationTransitionState(endpoint); + uint16_t epIndex = getEndpointIndex(endpoint); + ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionStateByIndex(epIndex); + Color16uTransitionState * colorSaturationTransitionState = getSaturationTransitionStateByIndex(epIndex); uint8_t previousHue = colorHueTransitionState->currentHue; uint16_t previousSaturation = colorSaturationTransitionState->currentValue; uint16_t previousEnhancedhue = colorHueTransitionState->currentEnhancedHue; + bool isHueTansitionStart = (colorHueTransitionState->stepsRemaining == colorHueTransitionState->stepsTotal); + bool isSaturationTransitionStart = + (colorSaturationTransitionState->stepsRemaining == colorSaturationTransitionState->stepsTotal); + bool isHueTansitionDone = computeNewHueValue(colorHueTransitionState); bool isSaturationTransitionDone = computeNewColor16uValue(colorSaturationTransitionState); @@ -2041,32 +2132,43 @@ void ColorControlServer::updateHueSatCommand(EndpointId endpoint) scheduleTimerCallbackMs(configureHSVEventControl(endpoint), TRANSITION_UPDATE_TIME_MS.count()); } + uint8_t currentHue; + MarkAttributeDirty markDirty; if (colorHueTransitionState->isEnhancedHue) { + markDirty = SetQuietReportAttribute(quietEnhancedHue[epIndex], colorHueTransitionState->currentEnhancedHue, + (isHueTansitionStart || isHueTansitionDone), colorHueTransitionState->transitionTime); + Attributes::EnhancedCurrentHue::Set(endpoint, quietEnhancedHue[epIndex].value().Value(), markDirty); + currentHue = static_cast(colorHueTransitionState->currentEnhancedHue >> 8); + if (previousEnhancedhue != colorHueTransitionState->currentEnhancedHue) { - Attributes::EnhancedCurrentHue::Set(endpoint, colorHueTransitionState->currentEnhancedHue); - Attributes::CurrentHue::Set(endpoint, static_cast(colorHueTransitionState->currentEnhancedHue >> 8)); - ChipLogProgress(Zcl, "Enhanced Hue %d endpoint %d", colorHueTransitionState->currentEnhancedHue, endpoint); } } else { + currentHue = colorHueTransitionState->currentHue; if (previousHue != colorHueTransitionState->currentHue) { - Attributes::CurrentHue::Set(colorHueTransitionState->endpoint, colorHueTransitionState->currentHue); ChipLogProgress(Zcl, "Hue %d endpoint %d", colorHueTransitionState->currentHue, endpoint); } } + markDirty = SetQuietReportAttribute(quietHue[epIndex], currentHue, (isHueTansitionStart || isHueTansitionDone), + colorHueTransitionState->transitionTime); + Attributes::CurrentHue::Set(endpoint, quietHue[epIndex].value().Value(), markDirty); + if (previousSaturation != colorSaturationTransitionState->currentValue) { - Attributes::CurrentSaturation::Set(colorSaturationTransitionState->endpoint, - (uint8_t) colorSaturationTransitionState->currentValue); ChipLogProgress(Zcl, "Saturation %d endpoint %d", colorSaturationTransitionState->currentValue, endpoint); } + markDirty = SetQuietReportAttribute(quietSaturation[epIndex], colorSaturationTransitionState->currentValue, + (isSaturationTransitionStart || isSaturationTransitionDone), + colorSaturationTransitionState->transitionTime); + Attributes::CurrentSaturation::Set(endpoint, quietSaturation[epIndex].value().Value(), markDirty); + computePwmFromHsv(endpoint); } @@ -2075,16 +2177,13 @@ void ColorControlServer::updateHueSatCommand(EndpointId endpoint) #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_XY /** - * @brief Returns Color16uTransitionState for X color associated to an endpoint + * @brief Returns Color16uTransitionState for X color associated to an endpoint index * * @param endpoint * @return ColorControlServer::Color16uTransitionState* */ -ColorControlServer::Color16uTransitionState * ColorControlServer::getXTransitionState(EndpointId endpoint) +ColorControlServer::Color16uTransitionState * ColorControlServer::getXTransitionStateByIndex(uint16_t index) { - uint16_t index = - emberAfGetClusterServerEndpointIndex(endpoint, ColorControl::Id, MATTER_DM_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); - Color16uTransitionState * state = nullptr; if (index < ArraySize(colorXtransitionStates)) { @@ -2095,16 +2194,24 @@ ColorControlServer::Color16uTransitionState * ColorControlServer::getXTransition } /** - * @brief Returns Color16uTransitionState for Y color associated to an endpoint + * @brief Returns Color16uTransitionState for X color associated to an endpoint * * @param endpoint * @return ColorControlServer::Color16uTransitionState* */ -ColorControlServer::Color16uTransitionState * ColorControlServer::getYTransitionState(EndpointId endpoint) +ColorControlServer::Color16uTransitionState * ColorControlServer::getXTransitionState(EndpointId endpoint) { - uint16_t index = - emberAfGetClusterServerEndpointIndex(endpoint, ColorControl::Id, MATTER_DM_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); + return getXTransitionStateByIndex(getEndpointIndex(endpoint)); +} +/** + * @brief Returns Color16uTransitionState for Y color associated to an endpoint index + * + * @param endpoint + * @return ColorControlServer::Color16uTransitionState* + */ +ColorControlServer::Color16uTransitionState * ColorControlServer::getYTransitionStateByIndex(uint16_t index) +{ Color16uTransitionState * state = nullptr; if (index < ArraySize(colorYtransitionStates)) { @@ -2114,6 +2221,17 @@ ColorControlServer::Color16uTransitionState * ColorControlServer::getYTransition return state; } +/** + * @brief Returns Color16uTransitionState for Y color associated to an endpoint + * + * @param endpoint + * @return ColorControlServer::Color16uTransitionState* + */ +ColorControlServer::Color16uTransitionState * ColorControlServer::getYTransitionState(EndpointId endpoint) +{ + return getYTransitionStateByIndex(getEndpointIndex(endpoint)); +} + uint16_t ColorControlServer::findNewColorValueFromStep(uint16_t oldValue, int16_t step) { uint16_t newValue; @@ -2164,8 +2282,9 @@ EmberEventControl * ColorControlServer::configureXYEventControl(EndpointId endpo */ Status ColorControlServer::moveToColor(uint16_t colorX, uint16_t colorY, uint16_t transitionTime, EndpointId endpoint) { - Color16uTransitionState * colorXTransitionState = getXTransitionState(endpoint); - Color16uTransitionState * colorYTransitionState = getYTransitionState(endpoint); + uint16_t epIndex = getEndpointIndex(endpoint); + Color16uTransitionState * colorXTransitionState = getXTransitionStateByIndex(epIndex); + Color16uTransitionState * colorYTransitionState = getYTransitionStateByIndex(epIndex); VerifyOrReturnError(nullptr != colorXTransitionState, Status::UnsupportedEndpoint); VerifyOrReturnError(nullptr != colorYTransitionState, Status::UnsupportedEndpoint); @@ -2183,6 +2302,7 @@ Status ColorControlServer::moveToColor(uint16_t colorX, uint16_t colorY, uint16_ colorXTransitionState->stepsRemaining = max(transitionTime, 1); colorXTransitionState->stepsTotal = colorXTransitionState->stepsRemaining; colorXTransitionState->timeRemaining = transitionTime; + colorXTransitionState->transitionTime = transitionTime; colorXTransitionState->endpoint = endpoint; colorXTransitionState->lowLimit = MIN_CIE_XY_VALUE; colorXTransitionState->highLimit = MAX_CIE_XY_VALUE; @@ -2193,11 +2313,12 @@ Status ColorControlServer::moveToColor(uint16_t colorX, uint16_t colorY, uint16_ colorYTransitionState->stepsRemaining = colorXTransitionState->stepsRemaining; colorYTransitionState->stepsTotal = colorXTransitionState->stepsRemaining; colorYTransitionState->timeRemaining = transitionTime; + colorYTransitionState->transitionTime = transitionTime; colorYTransitionState->endpoint = endpoint; colorYTransitionState->lowLimit = MIN_CIE_XY_VALUE; colorYTransitionState->highLimit = MAX_CIE_XY_VALUE; - Attributes::RemainingTime::Set(endpoint, transitionTime); + SetQuietReportRemainingTime(endpoint, transitionTime); // kick off the state machine: scheduleTimerCallbackMs(configureXYEventControl(endpoint), transitionTime ? TRANSITION_UPDATE_TIME_MS.count() : 0); @@ -2232,8 +2353,9 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons EndpointId endpoint = commandPath.mEndpointId; Status status = Status::Success; - Color16uTransitionState * colorXTransitionState = getXTransitionState(endpoint); - Color16uTransitionState * colorYTransitionState = getYTransitionState(endpoint); + uint16_t epIndex = getEndpointIndex(endpoint); + Color16uTransitionState * colorXTransitionState = getXTransitionStateByIndex(epIndex); + Color16uTransitionState * colorYTransitionState = getYTransitionStateByIndex(epIndex); VerifyOrExit(colorXTransitionState != nullptr, status = Status::UnsupportedEndpoint); VerifyOrExit(colorYTransitionState != nullptr, status = Status::UnsupportedEndpoint); @@ -2252,6 +2374,7 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons if (rateX == 0 && rateY == 0) { + // any current transition has been stopped. We are done. commandObj->AddStatus(commandPath, Status::Success); return true; } @@ -2276,6 +2399,7 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons colorXTransitionState->stepsRemaining = transitionTimeX; colorXTransitionState->stepsTotal = transitionTimeX; colorXTransitionState->timeRemaining = transitionTimeX; + colorXTransitionState->transitionTime = transitionTimeX; colorXTransitionState->endpoint = endpoint; colorXTransitionState->lowLimit = MIN_CIE_XY_VALUE; colorXTransitionState->highLimit = MAX_CIE_XY_VALUE; @@ -2296,18 +2420,12 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons colorYTransitionState->stepsRemaining = transitionTimeY; colorYTransitionState->stepsTotal = transitionTimeY; colorYTransitionState->timeRemaining = transitionTimeY; + colorYTransitionState->transitionTime = transitionTimeY; colorYTransitionState->endpoint = endpoint; colorYTransitionState->lowLimit = MIN_CIE_XY_VALUE; colorYTransitionState->highLimit = MAX_CIE_XY_VALUE; - if (transitionTimeX < transitionTimeY) - { - Attributes::RemainingTime::Set(endpoint, transitionTimeX); - } - else - { - Attributes::RemainingTime::Set(endpoint, transitionTimeY); - } + SetQuietReportRemainingTime(endpoint, max(transitionTimeX, transitionTimeY)); // kick off the state machine: scheduleTimerCallbackMs(configureXYEventControl(endpoint), TRANSITION_UPDATE_TIME_MS.count()); @@ -2333,12 +2451,19 @@ bool ColorControlServer::stepColorCommand(app::CommandHandler * commandObj, cons Status status = Status::Success; - Color16uTransitionState * colorXTransitionState = getXTransitionState(endpoint); - Color16uTransitionState * colorYTransitionState = getYTransitionState(endpoint); + uint16_t epIndex = getEndpointIndex(endpoint); + Color16uTransitionState * colorXTransitionState = getXTransitionStateByIndex(epIndex); + Color16uTransitionState * colorYTransitionState = getYTransitionStateByIndex(epIndex); VerifyOrExit(colorXTransitionState != nullptr, status = Status::UnsupportedEndpoint); VerifyOrExit(colorYTransitionState != nullptr, status = Status::UnsupportedEndpoint); + if (stepX == 0 && stepY == 0) + { + commandObj->AddStatus(commandPath, Status::InvalidCommand); + return true; + } + if (!shouldExecuteIfOff(endpoint, optionsMask, optionsOverride)) { commandObj->AddStatus(commandPath, Status::Success); @@ -2364,6 +2489,7 @@ bool ColorControlServer::stepColorCommand(app::CommandHandler * commandObj, cons colorXTransitionState->stepsRemaining = max(transitionTime, 1); colorXTransitionState->stepsTotal = colorXTransitionState->stepsRemaining; colorXTransitionState->timeRemaining = transitionTime; + colorXTransitionState->transitionTime = transitionTime; colorXTransitionState->endpoint = endpoint; colorXTransitionState->lowLimit = MIN_CIE_XY_VALUE; colorXTransitionState->highLimit = MAX_CIE_XY_VALUE; @@ -2374,11 +2500,12 @@ bool ColorControlServer::stepColorCommand(app::CommandHandler * commandObj, cons colorYTransitionState->stepsRemaining = colorXTransitionState->stepsRemaining; colorYTransitionState->stepsTotal = colorXTransitionState->stepsRemaining; colorYTransitionState->timeRemaining = transitionTime; + colorYTransitionState->transitionTime = transitionTime; colorYTransitionState->endpoint = endpoint; colorYTransitionState->lowLimit = MIN_CIE_XY_VALUE; colorYTransitionState->highLimit = MAX_CIE_XY_VALUE; - Attributes::RemainingTime::Set(endpoint, transitionTime); + SetQuietReportRemainingTime(endpoint, transitionTime); // kick off the state machine: scheduleTimerCallbackMs(configureXYEventControl(endpoint), transitionTime ? TRANSITION_UPDATE_TIME_MS.count() : 0); @@ -2395,15 +2522,15 @@ bool ColorControlServer::stepColorCommand(app::CommandHandler * commandObj, cons */ void ColorControlServer::updateXYCommand(EndpointId endpoint) { - Color16uTransitionState * colorXTransitionState = getXTransitionState(endpoint); - Color16uTransitionState * colorYTransitionState = getYTransitionState(endpoint); - bool isXTransitionDone, isYTransitionDone; + uint16_t epIndex = getEndpointIndex(endpoint); + Color16uTransitionState * colorXTransitionState = getXTransitionStateByIndex(epIndex); + Color16uTransitionState * colorYTransitionState = getYTransitionStateByIndex(epIndex); // compute new values for X and Y. - isXTransitionDone = computeNewColor16uValue(colorXTransitionState); - isYTransitionDone = computeNewColor16uValue(colorYTransitionState); + bool isXTransitionDone = computeNewColor16uValue(colorXTransitionState); + bool isYTransitionDone = computeNewColor16uValue(colorYTransitionState); - Attributes::RemainingTime::Set(endpoint, max(colorXTransitionState->timeRemaining, colorYTransitionState->timeRemaining)); + SetQuietReportRemainingTime(endpoint, max(colorXTransitionState->timeRemaining, colorYTransitionState->timeRemaining)); if (isXTransitionDone && isYTransitionDone) { @@ -2414,9 +2541,18 @@ void ColorControlServer::updateXYCommand(EndpointId endpoint) scheduleTimerCallbackMs(configureXYEventControl(endpoint), TRANSITION_UPDATE_TIME_MS.count()); } - // update the attributes - Attributes::CurrentX::Set(endpoint, colorXTransitionState->currentValue); - Attributes::CurrentY::Set(endpoint, colorYTransitionState->currentValue); + bool isXTransitionStart = (colorXTransitionState->stepsRemaining == colorXTransitionState->stepsTotal); + bool isYTransitionStart = (colorYTransitionState->stepsRemaining == colorYTransitionState->stepsTotal); + + MarkAttributeDirty markXDirty = + SetQuietReportAttribute(quietColorX[epIndex], colorXTransitionState->currentValue, + (isXTransitionStart || isXTransitionDone), colorXTransitionState->transitionTime); + MarkAttributeDirty markYDirty = + SetQuietReportAttribute(quietColorY[epIndex], colorYTransitionState->currentValue, + (isYTransitionStart || isYTransitionDone), colorYTransitionState->transitionTime); + + Attributes::CurrentX::Set(endpoint, quietColorX[epIndex].value().Value(), markXDirty); + Attributes::CurrentY::Set(endpoint, quietColorY[epIndex].value().Value(), markYDirty); ChipLogProgress(Zcl, "Color X %d Color Y %d", colorXTransitionState->currentValue, colorYTransitionState->currentValue); @@ -2427,16 +2563,13 @@ void ColorControlServer::updateXYCommand(EndpointId endpoint) #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_TEMP /** - * @brief Get the Temp Transition State object associated to the endpoint + * @brief Get the Temp Transition State object associated to the endpoint index * * @param endpoint * @return Color16uTransitionState* */ -ColorControlServer::Color16uTransitionState * ColorControlServer::getTempTransitionState(EndpointId endpoint) +ColorControlServer::Color16uTransitionState * ColorControlServer::getTempTransitionStateByIndex(uint16_t index) { - uint16_t index = - emberAfGetClusterServerEndpointIndex(endpoint, ColorControl::Id, MATTER_DM_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); - Color16uTransitionState * state = nullptr; if (index < ArraySize(colorTempTransitionStates)) { @@ -2446,6 +2579,17 @@ ColorControlServer::Color16uTransitionState * ColorControlServer::getTempTransit return state; } +/** + * @brief Get the Temp Transition State object associated to the endpoint + * + * @param endpoint + * @return Color16uTransitionState* + */ +ColorControlServer::Color16uTransitionState * ColorControlServer::getTempTransitionState(EndpointId endpoint) +{ + return getTempTransitionStateByIndex(getEndpointIndex(endpoint)); +} + /** * @brief executes move to color temp logic * @@ -2491,6 +2635,7 @@ Status ColorControlServer::moveToColorTemp(EndpointId aEndpoint, uint16_t colorT colorTempTransitionState->stepsRemaining = max(transitionTime, 1); colorTempTransitionState->stepsTotal = colorTempTransitionState->stepsRemaining; colorTempTransitionState->timeRemaining = transitionTime; + colorTempTransitionState->transitionTime = transitionTime; colorTempTransitionState->endpoint = endpoint; colorTempTransitionState->lowLimit = temperatureMin; colorTempTransitionState->highLimit = temperatureMax; @@ -2620,7 +2765,7 @@ void ColorControlServer::updateTempCommand(EndpointId endpoint) } } - Attributes::RemainingTime::Set(endpoint, colorTempTransitionState->timeRemaining); + SetQuietReportRemainingTime(endpoint, colorTempTransitionState->timeRemaining); if (isColorTempTransitionDone) { @@ -2668,7 +2813,8 @@ bool ColorControlServer::moveColorTempCommand(app::CommandHandler * commandObj, Color16uTransitionState * colorTempTransitionState = getTempTransitionState(endpoint); VerifyOrExit(colorTempTransitionState != nullptr, status = Status::UnsupportedEndpoint); - // check moveMode before any operation is done on the transition states + // check moveMode and rate before any operation is done on the transition states + // rate value is ignored if the MoveMode is stop if (moveMode == HueMoveMode::kUnknownEnumValue || (rate == 0 && moveMode != HueMoveMode::kStop)) { commandObj->AddStatus(commandPath, Status::InvalidCommand); @@ -2741,11 +2887,12 @@ bool ColorControlServer::moveColorTempCommand(app::CommandHandler * commandObj, colorTempTransitionState->stepsRemaining = transitionTime; colorTempTransitionState->stepsTotal = transitionTime; colorTempTransitionState->timeRemaining = transitionTime; + colorTempTransitionState->transitionTime = transitionTime; colorTempTransitionState->endpoint = endpoint; colorTempTransitionState->lowLimit = colorTemperatureMinimum; colorTempTransitionState->highLimit = colorTemperatureMaximum; - Attributes::RemainingTime::Set(endpoint, transitionTime); + SetQuietReportRemainingTime(endpoint, transitionTime); // kick off the state machine: scheduleTimerCallbackMs(configureTempEventControl(endpoint), TRANSITION_UPDATE_TIME_MS.count()); @@ -2790,8 +2937,8 @@ bool ColorControlServer::stepColorTempCommand(app::CommandHandler * commandObj, Color16uTransitionState * colorTempTransitionState = getTempTransitionState(endpoint); VerifyOrExit(colorTempTransitionState != nullptr, status = Status::UnsupportedEndpoint); - // Confirm validity of the step mode received - if (stepMode == HueStepMode::kUnknownEnumValue) + // Confirm validity of the step mode and step size received + if (stepMode == HueStepMode::kUnknownEnumValue || stepSize == 0) { commandObj->AddStatus(commandPath, Status::InvalidCommand); return true; @@ -2858,11 +3005,12 @@ bool ColorControlServer::stepColorTempCommand(app::CommandHandler * commandObj, colorTempTransitionState->stepsRemaining = max(transitionTime, 1); colorTempTransitionState->stepsTotal = colorTempTransitionState->stepsRemaining; colorTempTransitionState->timeRemaining = transitionTime; + colorTempTransitionState->transitionTime = transitionTime; colorTempTransitionState->endpoint = endpoint; colorTempTransitionState->lowLimit = colorTemperatureMinimum; colorTempTransitionState->highLimit = colorTemperatureMaximum; - Attributes::RemainingTime::Set(endpoint, transitionTime); + SetQuietReportRemainingTime(endpoint, transitionTime); // kick off the state machine: scheduleTimerCallbackMs(configureTempEventControl(endpoint), transitionTime ? TRANSITION_UPDATE_TIME_MS.count() : 0); @@ -2955,6 +3103,89 @@ void ColorControlServer::levelControlColorTempChangeCommand(EndpointId endpoint) #endif // MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_TEMP +/* + * @brief + * Utility function used to update a color control attribute which has the quiet reporting quality. + * matching the following report conditions: + * - At most once per second, or + * - At the start of the movement/transition, or + * - At the end of the movement/transition, or + * - When it changes from null to any other value and vice versa. (Implicit to the QuieterReportingAttribute class) + * + * The QuietReportAttribute class is updated with the new value and when the report conditions are met, + * this function will return MarkAttributeDirty::kIfChanged. + * It is expected that the user will use this return value to trigger a reporting mechanism for the attribute with the new value + * (Which was updated in the quietReporter) + * + * @param quietReporter: The QuieterReportingAttribute object for the attribute to update. + * @param newValue: Value to update the attribute with + * @param isStartOrEndOfTransition: Boolean that indicatse whether the update is occurring at the start or end of a level transition + * @return MarkAttributeDirty::kIfChanged when the attribute must be maredk dirty and be reported. MarkAttributeDirty::kNo when it + * when it no report is needed. + */ +template +MarkAttributeDirty ColorControlServer::SetQuietReportAttribute(QuieterReportingAttribute & quietReporter, V newValue, + bool isStartOrEndOfTransition, uint16_t transitionTime) +{ + AttributeDirtyState dirtyState; + auto now = System::SystemClock().GetMonotonicTimestamp(); + + if (isStartOrEndOfTransition) + { + // At the start or end of the movement/transition we must report + auto predicate = [](const typename QuieterReportingAttribute::SufficientChangePredicateCandidate &) -> bool { + return true; + }; + dirtyState = quietReporter.SetValue(newValue, now, predicate); + } + else + { + // During transitions, reports should be at most once per second + + // For "infinite" transition, default reports interval to 10s (100 1/10ths of a second ) + if (transitionTime == MAX_INT16U_VALUE) + { + transitionTime = 100; + } + + // Opt for the longest interval between reports, 1s or (transitionTime / 4). + // Since transitionTime is in 1/10th of a second, convert it to ms (x 100), thus * 100/4 -> * 25 + System::Clock::Milliseconds64 reportInterval = System::Clock::Milliseconds64(std::max(1000, transitionTime * 25)); + auto predicate = quietReporter.GetPredicateForSufficientTimeSinceLastDirty(reportInterval); + dirtyState = quietReporter.SetValue(newValue, now, predicate); + } + + return (dirtyState == AttributeDirtyState::kMustReport) ? MarkAttributeDirty::kIfChanged : MarkAttributeDirty::kNo; +} + +/* + * @brief + * Function used to set the remaining time based on quiet reporting conditions. + * It will update the attribute storage and report the attribute if it is determined dirty. + * The condition on which the attribute must be reported are defined by the set QuieterReportingPolicyFlags + * of the quietRemainingTime object and the implicit conditions of the QuieterReportingAttribute class + * + * @param endpoint: Endpoint of the RemainingTime attribute to set + * @param newRemainingTime: Value to update the RemainingTime attribute with + * @return Success in setting the attribute value or the IM error code for the failure. + */ +Status ColorControlServer::SetQuietReportRemainingTime(EndpointId endpoint, uint16_t newRemainingTime) +{ + uint16_t epIndex = getEndpointIndex(endpoint); + auto markDirty = MarkAttributeDirty::kNo; + auto now = System::SystemClock().GetMonotonicTimestamp(); + // Establish the quiet report condition for the RemainingTime Attribute + // The quiet report is by the previously set policies : + // - kMarkDirtyOnChangeToFromZero : When the value changes from 0 to any other value and vice versa, or + // - kMarkDirtyOnIncrement : When the value increases. + if (quietRemainingTime[epIndex].SetValue(newRemainingTime, now) == AttributeDirtyState::kMustReport) + { + markDirty = MarkAttributeDirty::kIfChanged; + } + + return Attributes::RemainingTime::Set(endpoint, quietRemainingTime[epIndex].value().Value(), markDirty); +} + /********************************************************** * Callbacks Implementation *********************************************************/ diff --git a/src/app/clusters/color-control-server/color-control-server.h b/src/app/clusters/color-control-server/color-control-server.h index f453c6f02872e4..4238fed1dd8b2d 100644 --- a/src/app/clusters/color-control-server/color-control-server.h +++ b/src/app/clusters/color-control-server/color-control-server.h @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include #include #include @@ -109,6 +111,8 @@ class ColorControlServer // The amount of time remaining until the transition completes. Measured in tenths of a second. // When the transition repeats indefinitely, this will hold the maximum value possible. uint16_t timeRemaining; + // The total transitionTime in 1/10th of a seconds + uint16_t transitionTime; uint16_t initialEnhancedHue; uint16_t currentEnhancedHue; uint16_t finalEnhancedHue; @@ -127,6 +131,8 @@ class ColorControlServer uint16_t stepsTotal; // The amount of time remaining until the transition completes. Measured in tenths of a second. uint16_t timeRemaining; + // The total transitionTime in 1/10th of a seconds + uint16_t transitionTime; uint16_t lowLimit; uint16_t highLimit; chip::EndpointId endpoint; @@ -194,12 +200,30 @@ class ColorControlServer void cancelEndpointTimerCallback(chip::EndpointId endpoint); + template + chip::app::MarkAttributeDirty SetQuietReportAttribute(chip::app::QuieterReportingAttribute & quietReporter, V newValue, + bool isStartOrEndOfTransition, uint16_t transitionTime); + chip::Protocols::InteractionModel::Status SetQuietReportRemainingTime(chip::EndpointId endpoint, uint16_t newRemainingTime); + private: /********************************************************** * Functions Definitions *********************************************************/ - ColorControlServer() {} + ColorControlServer() + { + for (size_t i = 0; i < kColorControlClusterServerMaxEndpointCount; i++) + { + // Set the quiet report policies for the RemaininTime Attribute on all endpoint + // - kMarkDirtyOnChangeToFromZero : When the value changes from 0 to any other value and vice versa, or + // - kMarkDirtyOnIncrement : When the value increases. + quietRemainingTime[i] + .policy() + .Set(chip::app::QuieterReportingPolicyEnum::kMarkDirtyOnIncrement) + .Set(chip::app::QuieterReportingPolicyEnum::kMarkDirtyOnChangeToFromZero); + } + } + bool shouldExecuteIfOff(chip::EndpointId endpoint, uint8_t optionMask, uint8_t optionOverride); void handleModeSwitch(chip::EndpointId endpoint, uint8_t newColorMode); uint16_t computeTransitionTimeFromStateAndRate(Color16uTransitionState * p, uint16_t rate); @@ -213,6 +237,7 @@ class ColorControlServer static void timerCallback(chip::System::Layer *, void * callbackContext); void scheduleTimerCallbackMs(EmberEventControl * control, uint32_t delayMs); void cancelEndpointTimerCallback(EmberEventControl * control); + uint16_t getEndpointIndex(chip::EndpointId); #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_HSV chip::Protocols::InteractionModel::Status moveToSaturation(uint8_t saturation, uint16_t transitionTime, @@ -221,6 +246,8 @@ class ColorControlServer bool isEnhanced, chip::EndpointId endpoint); ColorHueTransitionState * getColorHueTransitionState(chip::EndpointId endpoint); Color16uTransitionState * getSaturationTransitionState(chip::EndpointId endpoint); + ColorHueTransitionState * getColorHueTransitionStateByIndex(uint16_t index); + Color16uTransitionState * getSaturationTransitionStateByIndex(uint16_t index); uint8_t getSaturation(chip::EndpointId endpoint); uint8_t addHue(uint8_t hue1, uint8_t hue2); uint8_t subtractHue(uint8_t hue1, uint8_t hue2); @@ -241,12 +268,15 @@ class ColorControlServer chip::EndpointId endpoint); Color16uTransitionState * getXTransitionState(chip::EndpointId endpoint); Color16uTransitionState * getYTransitionState(chip::EndpointId endpoint); + Color16uTransitionState * getXTransitionStateByIndex(uint16_t index); + Color16uTransitionState * getYTransitionStateByIndex(uint16_t index); uint16_t findNewColorValueFromStep(uint16_t oldValue, int16_t step); EmberEventControl * configureXYEventControl(chip::EndpointId); #endif // #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_XY #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_TEMP Color16uTransitionState * getTempTransitionState(chip::EndpointId endpoint); + Color16uTransitionState * getTempTransitionStateByIndex(uint16_t index); chip::Protocols::InteractionModel::Status moveToColorTemp(chip::EndpointId aEndpoint, uint16_t colorTemperature, uint16_t transitionTime); uint16_t getTemperatureCoupleToLevelMin(chip::EndpointId endpoint); @@ -264,11 +294,18 @@ class ColorControlServer #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_HSV ColorHueTransitionState colorHueTransitionStates[kColorControlClusterServerMaxEndpointCount]; Color16uTransitionState colorSatTransitionStates[kColorControlClusterServerMaxEndpointCount]; + + chip::app::QuieterReportingAttribute quietHue[kColorControlClusterServerMaxEndpointCount]; + chip::app::QuieterReportingAttribute quietSaturation[kColorControlClusterServerMaxEndpointCount]; + chip::app::QuieterReportingAttribute quietEnhancedHue[kColorControlClusterServerMaxEndpointCount]; #endif #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_XY Color16uTransitionState colorXtransitionStates[kColorControlClusterServerMaxEndpointCount]; Color16uTransitionState colorYtransitionStates[kColorControlClusterServerMaxEndpointCount]; + + chip::app::QuieterReportingAttribute quietColorX[kColorControlClusterServerMaxEndpointCount]; + chip::app::QuieterReportingAttribute quietColorY[kColorControlClusterServerMaxEndpointCount]; #endif // MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_XY #ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_TEMP @@ -276,6 +313,7 @@ class ColorControlServer #endif // MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_TEMP EmberEventControl eventControls[kColorControlClusterServerMaxEndpointCount]; + chip::app::QuieterReportingAttribute quietRemainingTime[kColorControlClusterServerMaxEndpointCount]; #ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT friend class DefaultColorControlSceneHandler; diff --git a/src/app/clusters/commissioner-control-server/commissioner-control-server.cpp b/src/app/clusters/commissioner-control-server/commissioner-control-server.cpp new file mode 100644 index 00000000000000..98616f9e0e281b --- /dev/null +++ b/src/app/clusters/commissioner-control-server/commissioner-control-server.cpp @@ -0,0 +1,268 @@ +/* + * + * 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 "commissioner-control-server.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace chip; +using namespace chip::app; + +using chip::Protocols::InteractionModel::Status; + +namespace { + +NodeId GetNodeId(const CommandHandler * commandObj) +{ + auto descriptor = commandObj->GetSubjectDescriptor(); + + if (descriptor.authMode != Access::AuthMode::kCase) + { + return kUndefinedNodeId; + } + return descriptor.subject; +} + +void AddReverseOpenCommissioningWindowResponse(CommandHandler * commandObj, const ConcreteCommandPath & path, + const Clusters::CommissionerControl::CommissioningWindowParams & params) +{ + Clusters::CommissionerControl::Commands::ReverseOpenCommissioningWindow::Type response; + response.commissioningTimeout = params.commissioningTimeout; + response.discriminator = params.discriminator; + response.iterations = params.iterations; + response.PAKEPasscodeVerifier = params.PAKEPasscodeVerifier; + response.salt = params.salt; + + commandObj->AddResponse(path, response); +} + +void RunDeferredCommissionNode(intptr_t commandArg) +{ + auto * info = reinterpret_cast(commandArg); + + Clusters::CommissionerControl::Delegate * delegate = + Clusters::CommissionerControl::CommissionerControlServer::Instance().GetDelegate(); + + if (delegate != nullptr) + { + CHIP_ERROR err = delegate->ReverseCommissionNode(info->params, info->ipAddress.GetIPAddress(), info->port); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "ReverseCommissionNode error: %" CHIP_ERROR_FORMAT, err.Format()); + } + } + else + { + ChipLogError(Zcl, "No delegate available for ReverseCommissionNode"); + } + + delete info; +} + +} // namespace + +namespace chip { +namespace app { +namespace Clusters { +namespace CommissionerControl { + +CommissionerControlServer CommissionerControlServer::sInstance; + +CommissionerControlServer & CommissionerControlServer::Instance() +{ + return sInstance; +} + +CHIP_ERROR CommissionerControlServer::Init(Delegate & delegate) +{ + mDelegate = &delegate; + return CHIP_NO_ERROR; +} + +Status CommissionerControlServer::GetSupportedDeviceCategoriesValue( + EndpointId endpoint, BitMask * supportedDeviceCategories) const +{ + Status status = Attributes::SupportedDeviceCategories::Get(endpoint, supportedDeviceCategories); + if (status != Status::Success) + { + ChipLogProgress(Zcl, "CommissionerControl: reading supportedDeviceCategories, err:0x%x", to_underlying(status)); + } + return status; +} + +Status +CommissionerControlServer::SetSupportedDeviceCategoriesValue(EndpointId endpoint, + const BitMask supportedDeviceCategories) +{ + Status status = Status::Success; + + if ((status = Attributes::SupportedDeviceCategories::Set(endpoint, supportedDeviceCategories)) != Status::Success) + { + ChipLogProgress(Zcl, "CommissionerControl: writing supportedDeviceCategories, err:0x%x", to_underlying(status)); + return status; + } + + return status; +} + +CHIP_ERROR +CommissionerControlServer::GenerateCommissioningRequestResultEvent(const Events::CommissioningRequestResult::Type & result) +{ + EventNumber eventNumber; + CHIP_ERROR error = LogEvent(result, kRootEndpointId, eventNumber); + if (CHIP_NO_ERROR != error) + { + ChipLogError(Zcl, "CommissionerControl: Unable to emit CommissioningRequestResult event: %" CHIP_ERROR_FORMAT, + error.Format()); + } + + return error; +} + +} // namespace CommissionerControl +} // namespace Clusters +} // namespace app +} // namespace chip + +bool emberAfCommissionerControlClusterRequestCommissioningApprovalCallback( + app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, + const Clusters::CommissionerControl::Commands::RequestCommissioningApproval::DecodableType & commandData) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + Status status = Status::Success; + + ChipLogProgress(Zcl, "Received command to request commissioning approval"); + + auto sourceNodeId = GetNodeId(commandObj); + + // Check if the command is executed via a CASE session + if (sourceNodeId == kUndefinedNodeId) + { + ChipLogError(Zcl, "Commissioning approval request not executed via CASE session, failing with UNSUPPORTED_ACCESS"); + commandObj->AddStatus(commandPath, Status::UnsupportedAccess); + return true; + } + + auto fabricIndex = commandObj->GetAccessingFabricIndex(); + auto requestId = commandData.requestId; + auto vendorId = commandData.vendorId; + auto productId = commandData.productId; + + // The label assigned from commandData need to be stored in CommissionerControl::Delegate which ensure that the backing buffer + // of it has a valid lifespan during fabric sync setup process. + auto & label = commandData.label; + + // Create a CommissioningApprovalRequest struct and populate it with the command data + Clusters::CommissionerControl::CommissioningApprovalRequest request = { .requestId = requestId, + .vendorId = vendorId, + .productId = productId, + .clientNodeId = sourceNodeId, + .fabricIndex = fabricIndex, + .label = label }; + + Clusters::CommissionerControl::Delegate * delegate = + Clusters::CommissionerControl::CommissionerControlServer::Instance().GetDelegate(); + + VerifyOrExit(delegate != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + + // Handle commissioning approval request + err = delegate->HandleCommissioningApprovalRequest(request); + +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "emberAfCommissionerControlClusterRequestCommissioningApprovalCallback error: %" CHIP_ERROR_FORMAT, + err.Format()); + status = StatusIB(err).mStatus; + } + + commandObj->AddStatus(commandPath, status); + return true; +} + +bool emberAfCommissionerControlClusterCommissionNodeCallback( + app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, + const Clusters::CommissionerControl::Commands::CommissionNode::DecodableType & commandData) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + ChipLogProgress(Zcl, "Received command to commission node"); + + auto sourceNodeId = GetNodeId(commandObj); + + // Check if the command is executed via a CASE session + if (sourceNodeId == kUndefinedNodeId) + { + ChipLogError(Zcl, "Commission node request not executed via CASE session, failing with UNSUPPORTED_ACCESS"); + commandObj->AddStatus(commandPath, Status::UnsupportedAccess); + return true; + } + + auto requestId = commandData.requestId; + + auto commissionNodeInfo = std::make_unique(); + + Clusters::CommissionerControl::Delegate * delegate = + Clusters::CommissionerControl::CommissionerControlServer::Instance().GetDelegate(); + + VerifyOrExit(delegate != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + + // Set IP address and port in the CommissionNodeInfo struct + commissionNodeInfo->port = commandData.port; + err = commissionNodeInfo->ipAddress.SetIPAddress(commandData.ipAddress); + SuccessOrExit(err == CHIP_NO_ERROR); + + // Validate the commission node command. + err = delegate->ValidateCommissionNodeCommand(sourceNodeId, requestId); + SuccessOrExit(err == CHIP_NO_ERROR); + + // Populate the parameters for the commissioning window + err = delegate->GetCommissioningWindowParams(commissionNodeInfo->params); + SuccessOrExit(err == CHIP_NO_ERROR); + + // Add the response for the commissioning window. + AddReverseOpenCommissioningWindowResponse(commandObj, commandPath, commissionNodeInfo->params); + + // Schedule the deferred reverse commission node task + DeviceLayer::PlatformMgr().ScheduleWork(RunDeferredCommissionNode, reinterpret_cast(commissionNodeInfo.release())); + +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "emberAfCommissionerControlClusterCommissionNodeCallback error: %" CHIP_ERROR_FORMAT, err.Format()); + commandObj->AddStatus(commandPath, StatusIB(err).mStatus); + } + + return true; +} + +void MatterCommissionerControlPluginServerInitCallback() +{ + ChipLogProgress(Zcl, "Initializing Commissioner Control cluster."); +} diff --git a/src/app/clusters/commissioner-control-server/commissioner-control-server.h b/src/app/clusters/commissioner-control-server/commissioner-control-server.h new file mode 100644 index 00000000000000..5e2422f5ebe018 --- /dev/null +++ b/src/app/clusters/commissioner-control-server/commissioner-control-server.h @@ -0,0 +1,182 @@ +/* + * + * 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 chip { +namespace app { +namespace Clusters { +namespace CommissionerControl { + +// Spec indicates that IP Address is either 4 or 16 bytes. +static constexpr size_t kIpAddressBufferSize = 16; + +struct CommissioningApprovalRequest +{ + uint64_t requestId; + VendorId vendorId; + uint16_t productId; + NodeId clientNodeId; + FabricIndex fabricIndex; + Optional label; +}; + +struct CommissioningWindowParams +{ + uint32_t iterations; + uint16_t commissioningTimeout; + uint16_t discriminator; + ByteSpan PAKEPasscodeVerifier; + ByteSpan salt; +}; + +class ProtectedIPAddress +{ +public: + const Optional GetIPAddress() { return ipAddress; } + + CHIP_ERROR SetIPAddress(const Optional & address) + { + if (!address.HasValue()) + { + ipAddress.ClearValue(); + return CHIP_NO_ERROR; + } + + const ByteSpan & addressSpan = address.Value(); + size_t addressLength = addressSpan.size(); + if (addressLength != 4 && addressLength != 16) + { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + memcpy(ipAddressBuffer, addressSpan.data(), addressLength); + ipAddress.SetValue(ByteSpan(ipAddressBuffer, addressLength)); + return CHIP_NO_ERROR; + } + +private: + Optional ipAddress; + uint8_t ipAddressBuffer[kIpAddressBufferSize]; +}; + +struct CommissionNodeInfo +{ + CommissioningWindowParams params; + ProtectedIPAddress ipAddress; + Optional port; +}; + +class Delegate +{ +public: + /** + * @brief Handle a commissioning approval request. + * + * This command is sent by a client to request approval for a future CommissionNode call. + * The server SHALL always return SUCCESS to a correctly formatted RequestCommissioningApproval + * command, and then send a CommissioningRequestResult event once the result is ready. + * + * @param request The commissioning approval request to handle. + * @return CHIP_ERROR indicating the success or failure of the operation. + */ + virtual CHIP_ERROR HandleCommissioningApprovalRequest(const CommissioningApprovalRequest & request) = 0; + + /** + * @brief Validate a commission node command. + * + * This command is sent by a client to request that the server begins commissioning a previously + * approved request. + * + * The server SHALL return FAILURE if the CommissionNode command is not sent from the same + * NodeId as the RequestCommissioningApproval or if the provided RequestId to CommissionNode + * does not match the value provided to RequestCommissioningApproval. + * + * The validation SHALL fail if the client Node ID is kUndefinedNodeId, such as getting the NodeID from + * a group or PASE session. + * + * @param clientNodeId The NodeId of the client. + * @param requestId The request ID to validate. + * @return CHIP_ERROR indicating the success or failure of the operation. + */ + virtual CHIP_ERROR ValidateCommissionNodeCommand(NodeId clientNodeId, uint64_t requestId) = 0; + + /** + * @brief Get the parameters for the commissioning window. + * + * This method is called to retrieve the parameters needed for the commissioning window. + * + * @param[out] outParams The parameters for the commissioning window. + * @return CHIP_ERROR indicating the success or failure of the operation. + */ + virtual CHIP_ERROR GetCommissioningWindowParams(CommissioningWindowParams & outParams) = 0; + + /** + * @brief Reverse the commission node process. + * + * When received within the timeout specified by CommissionNode, the client SHALL open a + * commissioning window on the node which the client called RequestCommissioningApproval to + * have commissioned. + * + * @param params The parameters for the commissioning window. + * @param ipAddress Optional IP address for the commissioning window. + * @param port Optional port for the commissioning window. + * @return CHIP_ERROR indicating the success or failure of the operation. + */ + virtual CHIP_ERROR ReverseCommissionNode(const CommissioningWindowParams & params, const Optional & ipAddress, + const Optional & port) = 0; + + virtual ~Delegate() = default; +}; + +class CommissionerControlServer +{ +public: + static CommissionerControlServer & Instance(); + + CHIP_ERROR Init(Delegate & delegate); + + Delegate * GetDelegate() { return mDelegate; } + + Protocols::InteractionModel::Status + GetSupportedDeviceCategoriesValue(EndpointId endpoint, + BitMask * supportedDeviceCategories) const; + + Protocols::InteractionModel::Status + SetSupportedDeviceCategoriesValue(EndpointId endpoint, const BitMask supportedDeviceCategories); + + /** + * @brief + * Called after the server return SUCCESS to a correctly formatted RequestCommissioningApproval command. + */ + CHIP_ERROR GenerateCommissioningRequestResultEvent(const Events::CommissioningRequestResult::Type & result); + +private: + CommissionerControlServer() = default; + ~CommissionerControlServer() = default; + + static CommissionerControlServer sInstance; + + Delegate * mDelegate = nullptr; +}; + +} // namespace CommissionerControl +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index 035a3daef71b88..fa913bc900a065 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -37,7 +38,7 @@ namespace DeviceEnergyManagement { CHIP_ERROR Instance::Init() { - ReturnErrorOnFailure(InteractionModelEngine::GetInstance()->RegisterCommandHandler(this)); + ReturnErrorOnFailure(CommandHandlerInterfaceRegistry::RegisterCommandHandler(this)); VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); return CHIP_NO_ERROR; @@ -45,7 +46,7 @@ CHIP_ERROR Instance::Init() void Instance::Shutdown() { - InteractionModelEngine::GetInstance()->UnregisterCommandHandler(this); + CommandHandlerInterfaceRegistry::UnregisterCommandHandler(this); unregisterAttributeAccessOverride(this); } @@ -581,7 +582,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq if (!forecast.Value().slots[activeSlotNumber].slotIsPausable.Value()) { ChipLogError(Zcl, "DEM: activeSlotNumber %d is NOT pausable.", activeSlotNumber); - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -606,6 +607,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq if (status != Status::Success) { ChipLogError(Zcl, "DEM: PauseRequest(%ld) FAILURE", static_cast(duration)); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); return; } } @@ -622,7 +624,7 @@ void Instance::HandleResumeRequest(HandlerContext & ctx, const Commands::ResumeR if (ESAStateEnum::kPaused != mDelegate.GetESAState()) { ChipLogError(Zcl, "DEM: ESAState not Paused."); - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidInState); return; } @@ -677,7 +679,7 @@ void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands: if (slotAdjustment.slotIndex > forecast.Value().slots.size()) { ChipLogError(Zcl, "DEM: Bad slot index %d", slotAdjustment.slotIndex); - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -725,6 +727,7 @@ void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands: if (status != Status::Success) { ChipLogError(Zcl, "DEM: ModifyForecastRequest FAILURE"); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } } diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.h b/src/app/clusters/device-energy-management-server/device-energy-management-server.h index b0d27b0b99edd7..c58e5c5a73743a 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.h +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.h @@ -45,6 +45,9 @@ class Delegate * @brief Delegate should implement a handler to begin to adjust client power * consumption/generation to the level requested. * + * Note callers must call GetPowerAdjustmentCapability and ensure the return value is not null + * before calling PowerAdjustRequest. + * * @param power Milli-Watts the ESA SHALL use during the adjustment period. * @param duration The duration that the ESA SHALL maintain the requested power for. * @return Success if the adjustment is accepted; otherwise the command SHALL be rejected with appropriate error. @@ -160,25 +163,42 @@ class Delegate // ------------------------------------------------------------------ // Get attribute methods - virtual ESATypeEnum GetESAType() = 0; - virtual bool GetESACanGenerate() = 0; - virtual ESAStateEnum GetESAState() = 0; - virtual int64_t GetAbsMinPower() = 0; - virtual int64_t GetAbsMaxPower() = 0; - virtual DataModel::Nullable GetPowerAdjustmentCapability() = 0; - virtual DataModel::Nullable GetForecast() = 0; - virtual OptOutStateEnum GetOptOutState() = 0; + virtual ESATypeEnum GetESAType() = 0; + virtual bool GetESACanGenerate() = 0; + virtual ESAStateEnum GetESAState() = 0; + virtual int64_t GetAbsMinPower() = 0; + virtual int64_t GetAbsMaxPower() = 0; + virtual OptOutStateEnum GetOptOutState() = 0; + + /** + * @brief Returns the current PowerAdjustCapability object + * + * The reference returned from GetPowerAdjustmentCapability() is only valid until the next Matter event + * is processed. Callers must not hold on to that reference for any asynchronous processing. + * + * Once another Matter event has had a chance to run, the memory associated with the + * PowerAdjustCapabilityStruct is likely to change or be re-allocated, so would become invalid. + * + * @return The current PowerAdjustCapability object + */ + virtual const DataModel::Nullable & GetPowerAdjustmentCapability() = 0; + + /** + * @brief Returns the current Forecast object + * + * The reference returned from GetForecast() is only valid until the next Matter event + * is processed. Callers must not hold on to that reference for any asynchronous processing. + * + * Once another Matter event has had a chance to run, the memory associated with the + * ForecastStruct is likely to change or be re-allocated, so would become invalid. + * + * @return The current Forecast object + */ + virtual const DataModel::Nullable & GetForecast() = 0; // ------------------------------------------------------------------ // Set attribute methods - virtual CHIP_ERROR SetESAType(ESATypeEnum) = 0; - virtual CHIP_ERROR SetESACanGenerate(bool) = 0; - virtual CHIP_ERROR SetESAState(ESAStateEnum) = 0; - virtual CHIP_ERROR SetAbsMinPower(int64_t) = 0; - virtual CHIP_ERROR SetAbsMaxPower(int64_t) = 0; - virtual CHIP_ERROR SetPowerAdjustmentCapability(DataModel::Nullable) = 0; - virtual CHIP_ERROR SetForecast(DataModel::Nullable) = 0; - virtual CHIP_ERROR SetOptOutState(OptOutStateEnum) = 0; + virtual CHIP_ERROR SetESAState(ESAStateEnum) = 0; protected: EndpointId mEndpointId = 0; diff --git a/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.cpp b/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.cpp index ca0fc231d6cc94..b3c9b8edbccf34 100644 --- a/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.cpp +++ b/src/app/clusters/dishwasher-alarm-server/dishwasher-alarm-server.cpp @@ -129,12 +129,13 @@ Status DishwasherAlarmServer::GetSupportedValue(EndpointId endpoint, BitMask supported) { Status status = Status::Success; - ; + if ((status = Attributes::Supported::Set(endpoint, supported)) != Status::Success) { ChipLogProgress(Zcl, "Dishwasher Alarm: ERR: writing supported, err:0x%x", to_underlying(status)); return status; } + // Whenever there is change in Supported attribute, Latch should change accordingly (if possible). BitMask latch; if (GetLatchValue(endpoint, &latch) == Status::Success && !supported.HasAll(latch)) diff --git a/src/app/clusters/door-lock-server/door-lock-server.cpp b/src/app/clusters/door-lock-server/door-lock-server.cpp index 528cbd6eb0971d..68e5f398b5bc84 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -51,39 +51,6 @@ static constexpr uint8_t DOOR_LOCK_ALIRO_CREDENTIAL_SIZE = 65; static constexpr uint32_t DOOR_LOCK_MAX_LOCK_TIMEOUT_SEC = MAX_INT32U_VALUE / MILLISECOND_TICKS_PER_SECOND; -static constexpr size_t kDoorLockDelegateTableSize = - MATTER_DM_DOOR_LOCK_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; - -static_assert(kDoorLockDelegateTableSize <= kEmberInvalidEndpointIndex, "Door Lock Delegate table size error"); - -namespace chip { -namespace app { -namespace Clusters { -namespace DoorLock { - -Delegate * gDelegateTable[kDoorLockDelegateTableSize] = { nullptr }; - -Delegate * GetDelegate(EndpointId endpoint) -{ - uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, DoorLock::Id, MATTER_DM_DOOR_LOCK_CLUSTER_SERVER_ENDPOINT_COUNT); - return (ep >= kDoorLockDelegateTableSize ? nullptr : gDelegateTable[ep]); -} - -void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) -{ - uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, DoorLock::Id, MATTER_DM_DOOR_LOCK_CLUSTER_SERVER_ENDPOINT_COUNT); - // if endpoint is found - if (ep < ArraySize(gDelegateTable)) - { - gDelegateTable[ep] = delegate; - } -} - -} // namespace DoorLock -} // namespace Clusters -} // namespace app -} // namespace chip - DoorLockServer DoorLockServer::instance; class DoorLockClusterFabricDelegate : public chip::FabricTable::Delegate @@ -117,7 +84,18 @@ DoorLockServer & DoorLockServer::Instance() * * @param endpointId */ -void DoorLockServer::InitServer(chip::EndpointId endpointId) +void DoorLockServer::InitServer(EndpointId endpointId) +{ + CHIP_ERROR err = InitEndpoint(endpointId); + + // We have no way to communicate this error, so just log it. + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Door Lock cluster initialization on endpoint %d failed: %" CHIP_ERROR_FORMAT, endpointId, err.Format()); + } +} + +CHIP_ERROR DoorLockServer::InitEndpoint(EndpointId endpointId, Delegate * delegate) { ChipLogProgress(Zcl, "Door Lock cluster initialized at endpoint #%u", endpointId); @@ -128,11 +106,48 @@ void DoorLockServer::InitServer(chip::EndpointId endpointId) } SetActuatorEnabled(endpointId, true); - for (auto & ep : mEndpointCtx) + auto * endpointContext = getContext(endpointId); + if (!endpointContext) { - ep.lockoutEndTimestamp = ep.lockoutEndTimestamp.zero(); - ep.wrongCodeEntryAttempts = 0; + ChipLogError(Zcl, "Invalid endpoint %d for initializing lock server: no endpoint context available", endpointId); + return CHIP_ERROR_INVALID_ARGUMENT; } + + endpointContext->lockoutEndTimestamp = endpointContext->lockoutEndTimestamp.zero(); + endpointContext->wrongCodeEntryAttempts = 0; + endpointContext->delegate = delegate; + return CHIP_NO_ERROR; +} + +void DoorLockServer::ShutdownEndpoint(EndpointId endpointId) +{ + auto * endpointContext = getContext(endpointId); + if (!endpointContext) + { + ChipLogError(Zcl, "Invalid endpoint %d for shutting down lock server: no endpoint context available", endpointId); + return; + } + + endpointContext->delegate = nullptr; +} + +CHIP_ERROR DoorLockServer::SetDelegate(chip::EndpointId endpointId, chip::app::Clusters::DoorLock::Delegate * delegate) +{ + if (!delegate) + { + ChipLogError(Zcl, "Trying to set a null DoorLock::Delegate on endpoint %d", endpointId); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + auto * endpointContext = getContext(endpointId); + if (!endpointContext) + { + ChipLogError(Zcl, "Invalid endpoint %d for setting a delegate: no endpoint context available", endpointId); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + endpointContext->delegate = delegate; + return CHIP_NO_ERROR; } bool DoorLockServer::SetLockState(chip::EndpointId endpointId, DlLockState newLockState) @@ -942,7 +957,18 @@ void DoorLockServer::clearCredentialCommandHandler( } // Remove all the credentials of the particular type. - auto credentialType = credential.Value().credentialType; + auto credentialType = credential.Value().credentialType; + + if (!credentialTypeSupported(commandPath.mEndpointId, credentialType)) + { + ChipLogProgress(Zcl, + "[ClearCredential] Credential type is not supported [endpointId=%d,credentialType=%u" + "]", + commandPath.mEndpointId, to_underlying(credentialType)); + commandObj->AddStatus(commandPath, Status::InvalidCommand); + return; + } + auto credentialIndex = credential.Value().credentialIndex; if (0xFFFE == credentialIndex) { @@ -2395,6 +2421,42 @@ DlStatus DoorLockServer::createCredential(chip::EndpointId endpointId, chip::Fab return DlStatus::kInvalidField; } + // For Aliro endpoint keys, there is a single shared count for the total + // count of evictable and non-evictable keys that can be stored. This needs + // to be enforced specially, because none of the other logic we have handles that. + if (credentialType == CredentialTypeEnum::kAliroEvictableEndpointKey || + credentialType == CredentialTypeEnum::kAliroNonEvictableEndpointKey) + { + Delegate * delegate = GetDelegate(endpointId); + if (delegate == nullptr) + { + ChipLogError(Zcl, "Door lock delegate is null, can't handle Aliro credentials"); + return DlStatus::kFailure; + } + + size_t maxEndpointKeys = delegate->GetNumberOfAliroEndpointKeysSupported(); + size_t evictableEndpointKeys, nonEvictableEndpointKeys; + + if (!countOccupiedCredentials(endpointId, CredentialTypeEnum::kAliroEvictableEndpointKey, evictableEndpointKeys)) + { + ChipLogError(Zcl, "Unable to count Aliro evictable endpoint keys."); + return DlStatus::kFailure; + } + + if (!countOccupiedCredentials(endpointId, CredentialTypeEnum::kAliroNonEvictableEndpointKey, nonEvictableEndpointKeys)) + { + ChipLogError(Zcl, "Unable to count Aliro non-evictable endpoint keys."); + return DlStatus::kFailure; + } + + if (evictableEndpointKeys + nonEvictableEndpointKeys >= maxEndpointKeys) + { + // We have no space for another credential here. + ChipLogError(Zcl, "Unable to create Aliro endpoint key credential; too many exist already [endpointId=%d]", endpointId); + return DlStatus::kResourceExhausted; + } + } + CredentialStruct credential{ credentialType, credentialIndex }; // appclusters, 5.2.4.40: if userIndex is not provided we should create new user DlStatus status = DlStatus::kSuccess; @@ -2432,6 +2494,42 @@ DlStatus DoorLockServer::createCredential(chip::EndpointId endpointId, chip::Fab return status; } +bool DoorLockServer::countOccupiedCredentials(chip::EndpointId endpointId, CredentialTypeEnum credentialType, + size_t & occupiedCount) +{ + uint16_t maxCredentialCount; + + if (!getMaxNumberOfCredentials(endpointId, credentialType, maxCredentialCount)) + { + return false; + } + + uint16_t startIndex = 1; + // Programming PIN is a special case -- it is unique and its index assumed to be 0. + if (CredentialTypeEnum::kProgrammingPIN == credentialType) + { + startIndex = 0; + maxCredentialCount--; + } + + occupiedCount = 0; + for (uint16_t credentialIndex = startIndex; credentialIndex <= maxCredentialCount; ++credentialIndex) + { + EmberAfPluginDoorLockCredentialInfo credential; + if (!emberAfPluginDoorLockGetCredential(endpointId, credentialIndex, credentialType, credential)) + { + return false; + } + + if (credential.status == DlCredentialStatus::kOccupied) + { + ++occupiedCount; + } + } + + return true; +} + DlStatus DoorLockServer::modifyProgrammingPIN(chip::EndpointId endpointId, chip::FabricIndex modifierFabricIndex, chip::NodeId sourceNodeId, uint16_t credentialIndex, CredentialTypeEnum credentialType, @@ -2908,28 +3006,6 @@ Status DoorLockServer::clearCredential(chip::EndpointId endpointId, chip::Fabric return Status::Failure; } - uint8_t maxCredentialsPerUser; - if (!GetNumberOfCredentialsSupportedPerUser(endpointId, maxCredentialsPerUser)) - { - ChipLogError(Zcl, - "[clearCredential] Unable to get the number of available credentials per user: internal error " - "[endpointId=%d,credentialType=%d,credentialIndex=%d]", - endpointId, to_underlying(credentialType), credentialIndex); - return Status::Failure; - } - - // Should never happen, only possible if the implementation of application is incorrect - if (relatedUser.credentials.size() > maxCredentialsPerUser) - { - ChipLogError(Zcl, - "[clearCredential] Unable to clear credential for related user - user has too many credentials associated" - "[endpointId=%d,credentialType=%u,credentialIndex=%d,modifier=%d,userIndex=%d,credentialsCount=%u]", - endpointId, to_underlying(credentialType), credentialIndex, modifier, relatedUserIndex, - static_cast(relatedUser.credentials.size())); - - return Status::Failure; - } - chip::Platform::ScopedMemoryBuffer newCredentials; if (!newCredentials.Alloc(relatedUser.credentials.size())) { @@ -3445,6 +3521,17 @@ EmberAfDoorLockEndpointContext * DoorLockServer::getContext(chip::EndpointId end return nullptr; } +Delegate * DoorLockServer::GetDelegate(EndpointId endpointId) +{ + auto * endpointContext = getContext(endpointId); + if (!endpointContext) + { + return nullptr; + } + + return endpointContext->delegate; +} + bool DoorLockServer::HandleRemoteLockOperation(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, LockOperationTypeEnum opType, RemoteLockOpHandler opHandler, const Optional & pinCode) @@ -3918,14 +4005,6 @@ void DoorLockServer::setAliroReaderConfigCommandHandler(CommandHandler * command EndpointId endpointID = commandPath.mEndpointId; ChipLogProgress(Zcl, "[SetAliroReaderConfig] Incoming command [endpointId=%d]", endpointID); - // If Aliro Provisioning feature is not supported, return UNSUPPORTED_COMMAND. - if (!SupportsAliroProvisioning(endpointID)) - { - ChipLogProgress(Zcl, "[SetAliroReaderConfig] Aliro Provisioning is not supported [endpointId=%d]", endpointID); - commandObj->AddStatus(commandPath, Status::UnsupportedCommand); - return; - } - Delegate * delegate = GetDelegate(endpointID); if (!delegate) { @@ -3988,10 +4067,7 @@ void DoorLockServer::setAliroReaderConfigCommandHandler(CommandHandler * command // Various attributes changed; mark them dirty. MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroReaderVerificationKey::Id); MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroReaderGroupIdentifier::Id); - if (supportsAliroBLEUWB) - { - MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroGroupResolvingKey::Id); - } + MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroGroupResolvingKey::Id); } sendClusterResponse(commandObj, commandPath, ClusterStatusCode(StatusIB(err).mStatus)); } @@ -4001,14 +4077,6 @@ void DoorLockServer::clearAliroReaderConfigCommandHandler(CommandHandler * comma EndpointId endpointID = commandPath.mEndpointId; ChipLogProgress(Zcl, "[ClearAliroReaderConfig] Incoming command [endpointId=%d]", endpointID); - // If Aliro Provisioning feature is not supported, return UNSUPPORTED_COMMAND. - if (!SupportsAliroProvisioning(endpointID)) - { - ChipLogProgress(Zcl, "[ClearAliroReaderConfig] Aliro Provisioning is not supported [endpointId=%d]", endpointID); - commandObj->AddStatus(commandPath, Status::UnsupportedCommand); - return; - } - Delegate * delegate = GetDelegate(endpointID); if (!delegate) { @@ -4038,10 +4106,7 @@ void DoorLockServer::clearAliroReaderConfigCommandHandler(CommandHandler * comma // Various attributes changed; mark them dirty. MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroReaderVerificationKey::Id); MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroReaderGroupIdentifier::Id); - if (SupportsAliroBLEUWB(endpointID)) - { - MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroGroupResolvingKey::Id); - } + MatterReportingAttributeChangeCallback(endpointID, Clusters::DoorLock::Id, AliroGroupResolvingKey::Id); } sendClusterResponse(commandObj, commandPath, ClusterStatusCode(StatusIB(err).mStatus)); } @@ -4203,8 +4268,7 @@ void DoorLockServer::DoorLockOnAutoRelockCallback(System::Layer *, void * callba } } -CHIP_ERROR DoorLockServer::ReadAliroExpeditedTransactionSupportedProtocolVersions(const ConcreteReadAttributePath & aPath, - AttributeValueEncoder & aEncoder, +CHIP_ERROR DoorLockServer::ReadAliroExpeditedTransactionSupportedProtocolVersions(AttributeValueEncoder & aEncoder, Delegate * delegate) { VerifyOrReturnValue(delegate != nullptr, aEncoder.EncodeEmptyList()); @@ -4225,8 +4289,7 @@ CHIP_ERROR DoorLockServer::ReadAliroExpeditedTransactionSupportedProtocolVersion }); } -CHIP_ERROR DoorLockServer::ReadAliroSupportedBLEUWBProtocolVersions(const ConcreteReadAttributePath & aPath, - AttributeValueEncoder & aEncoder, Delegate * delegate) +CHIP_ERROR DoorLockServer::ReadAliroSupportedBLEUWBProtocolVersions(AttributeValueEncoder & aEncoder, Delegate * delegate) { VerifyOrReturnValue(delegate != nullptr, aEncoder.EncodeEmptyList()); @@ -4296,7 +4359,7 @@ CHIP_ERROR DoorLockServer::Read(const ConcreteReadAttributePath & aPath, Attribu AttributeNullabilityType::kNotNullable); } case AliroExpeditedTransactionSupportedProtocolVersions::Id: { - return ReadAliroExpeditedTransactionSupportedProtocolVersions(aPath, aEncoder, delegate); + return ReadAliroExpeditedTransactionSupportedProtocolVersions(aEncoder, delegate); } case AliroGroupResolvingKey::Id: { uint8_t buffer[kAliroGroupResolvingKeySize]; @@ -4305,7 +4368,7 @@ CHIP_ERROR DoorLockServer::Read(const ConcreteReadAttributePath & aPath, Attribu AttributeNullabilityType::kNullable); } case AliroSupportedBLEUWBProtocolVersions::Id: { - return ReadAliroSupportedBLEUWBProtocolVersions(aPath, aEncoder, delegate); + return ReadAliroSupportedBLEUWBProtocolVersions(aEncoder, delegate); } case AliroBLEAdvertisingVersion::Id: { uint8_t bleAdvertisingVersion = delegate->GetAliroBLEAdvertisingVersion(); diff --git a/src/app/clusters/door-lock-server/door-lock-server.h b/src/app/clusters/door-lock-server/door-lock-server.h index 6941a3c580826d..81b18c60e687e8 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.h +++ b/src/app/clusters/door-lock-server/door-lock-server.h @@ -86,20 +86,9 @@ struct EmberAfDoorLockEndpointContext { chip::System::Clock::Timestamp lockoutEndTimestamp; int wrongCodeEntryAttempts; + chip::app::Clusters::DoorLock::Delegate * delegate = nullptr; }; -namespace chip { -namespace app { -namespace Clusters { -namespace DoorLock { - -void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate); - -} // namespace DoorLock -} // namespace Clusters -} // namespace app -} // namespace chip - /** * @brief Door Lock Server Plugin class. */ @@ -112,7 +101,28 @@ class DoorLockServer : public chip::app::AttributeAccessInterface using Feature = chip::app::Clusters::DoorLock::Feature; using OnFabricRemovedCustomCallback = void (*)(chip::EndpointId endpointId, chip::FabricIndex fabricIndex); - void InitServer(chip::EndpointId endpointId); + /** + * Multiple InitEndpoint calls can happen for different endpoints. Calling + * InitEndpoint twice for the same endpoint requires a ShutdownEndpoint call + * for that endpoint in between. + * + * A DoorLock::Delegate is optional, but needs to be provided in either + * InitEndpoint or in a separate SetDelegate call for Aliro features, and + * possibly other new features, to work. + */ + CHIP_ERROR InitEndpoint(chip::EndpointId endpointId, chip::app::Clusters::DoorLock::Delegate * delegate = nullptr); + + void ShutdownEndpoint(chip::EndpointId endpointId); + + // InitServer is a deprecated alias for InitEndpoint with no delegate. + void InitServer(chip::EndpointId endpointid); + + /** + * Delegate is not supposed to be null. Removing a delegate + * should only happen when shutting down the door lock cluster on the + * endpoint, via ShutdownEndpoint. + */ + CHIP_ERROR SetDelegate(chip::EndpointId endpointId, chip::app::Clusters::DoorLock::Delegate * delegate); /** * Updates the LockState attribute with new value and sends LockOperation event. @@ -350,6 +360,12 @@ class DoorLockServer : public chip::app::AttributeAccessInterface const EmberAfPluginDoorLockCredentialInfo & existingCredential, const chip::ByteSpan & credentialData, Nullable userIndex, const Nullable & userStatus, Nullable userType, uint16_t & createdUserIndex); + /** + * countOccupiedCredentials counts the number of occupied credentials of the + * given type. Returns false on application-side errors (i.e. if the count + * cannot be determined). + */ + bool countOccupiedCredentials(chip::EndpointId endpointId, CredentialTypeEnum credentialType, size_t & occupiedCount); DlStatus modifyProgrammingPIN(chip::EndpointId endpointId, chip::FabricIndex modifierFabricIndex, chip::NodeId sourceNodeId, uint16_t credentialIndex, CredentialTypeEnum credentialType, const EmberAfPluginDoorLockCredentialInfo & existingCredential, @@ -488,6 +504,13 @@ class DoorLockServer : public chip::app::AttributeAccessInterface static void sendClusterResponse(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, chip::Protocols::InteractionModel::ClusterStatusCode status); + /** + * Get the DoorLock::Delegate for the given endpoint, if any. Will return + * null if there is no door lock server initialized on that endpoint or if + * there is no delegate associated with the initialized server. + */ + chip::app::Clusters::DoorLock::Delegate * GetDelegate(chip::EndpointId endpointId); + /** * @brief Common handler for LockDoor, UnlockDoor, UnlockWithTimeout commands * @@ -576,29 +599,25 @@ class DoorLockServer : public chip::app::AttributeAccessInterface /** * @brief Reads AliroExpeditedTransactionSupportedProtocolVersions attribute for door lock * - * @param aPath attribute path. * @param aEncoder attribute value encoder. * @param delegate door lock cluster delegate that will provide the value * * @return CHIP_NO_ERROR on success * @return CHIP_ERROR if attribute read failed */ - CHIP_ERROR ReadAliroExpeditedTransactionSupportedProtocolVersions(const chip::app::ConcreteReadAttributePath & aPath, - chip::app::AttributeValueEncoder & aEncoder, + CHIP_ERROR ReadAliroExpeditedTransactionSupportedProtocolVersions(chip::app::AttributeValueEncoder & aEncoder, chip::app::Clusters::DoorLock::Delegate * delegate); /** * @brief Reads AliroSupportedBLEUWBProtocolVersions attribute for door lock * - * @param aPath attribute path. * @param aEncoder attribute value encoder. * @param delegate door lock cluster delegate that will provide the value * * @return CHIP_NO_ERROR on success * @return CHIP_ERROR if attribute read failed */ - CHIP_ERROR ReadAliroSupportedBLEUWBProtocolVersions(const chip::app::ConcreteReadAttributePath & aPath, - chip::app::AttributeValueEncoder & aEncoder, + CHIP_ERROR ReadAliroSupportedBLEUWBProtocolVersions(chip::app::AttributeValueEncoder & aEncoder, chip::app::Clusters::DoorLock::Delegate * delegate); /** diff --git a/src/app/clusters/ecosystem-information-server/ecosystem-information-server.cpp b/src/app/clusters/ecosystem-information-server/ecosystem-information-server.cpp new file mode 100644 index 00000000000000..26f1c96cd65fa6 --- /dev/null +++ b/src/app/clusters/ecosystem-information-server/ecosystem-information-server.cpp @@ -0,0 +1,377 @@ +/* + * + * 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 "ecosystem-information-server.h" + +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace EcosystemInformation { +namespace { + +constexpr size_t kDeviceNameMaxSize = 64; +constexpr size_t kUniqueLocationIdMaxSize = 64; +constexpr size_t kUniqueLocationIdsListMaxSize = 64; +constexpr size_t kLocationDescriptorNameMaxSize = 128; + +constexpr size_t kDeviceDirectoryMaxSize = 256; +constexpr size_t kLocationDirectoryMaxSize = 64; + +class AttrAccess : public AttributeAccessInterface +{ +public: + // Register for the EcosystemInformationCluster on all endpoints. + AttrAccess() : AttributeAccessInterface(Optional::Missing(), Clusters::EcosystemInformation::Id) {} + + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; +}; + +CHIP_ERROR AttrAccess::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) +{ + VerifyOrDie(aPath.mClusterId == Clusters::EcosystemInformation::Id); + switch (aPath.mAttributeId) + { + case Attributes::RemovedOn::Id: + return EcosystemInformationServer::Instance().EncodeRemovedOnAttribute(aPath.mEndpointId, aEncoder); + case Attributes::DeviceDirectory ::Id: + return EcosystemInformationServer::Instance().EncodeDeviceDirectoryAttribute(aPath.mEndpointId, aEncoder); + case Attributes::LocationDirectory ::Id: + return EcosystemInformationServer::Instance().EncodeLocationStructAttribute(aPath.mEndpointId, aEncoder); + default: + break; + } + return CHIP_NO_ERROR; +} + +// WARNING: caller is expected to use the returned LocationDescriptorStruct::Type immediately. Caller must +// be certain that the provided aLocationDescriptor has not been destroyed, prior to using the return +// struct to encode. +// TODO(#33223) To improve safety we could make GetEncodableLocationDescriptorStruct a private +// memeber method where we explicitly delete member method for the parameter that matches +// (LocationDescriptorStruct && aLocationDescriptor). +Structs::LocationDescriptorStruct::Type GetEncodableLocationDescriptorStruct(const LocationDescriptorStruct & aLocationDescriptor) +{ + Structs::LocationDescriptorStruct::Type locationDescriptor; + // This would imply data is either not properly validated before being + // stored here or corruption has occurred. + VerifyOrDie(!aLocationDescriptor.mLocationName.empty()); + locationDescriptor.locationName = CharSpan(aLocationDescriptor.mLocationName.c_str(), aLocationDescriptor.mLocationName.size()); + + if (aLocationDescriptor.mFloorNumber.has_value()) + { + locationDescriptor.floorNumber.SetNonNull(aLocationDescriptor.mFloorNumber.value()); + } + else + { + locationDescriptor.floorNumber.SetNull(); + } + + if (aLocationDescriptor.mAreaType.has_value()) + { + locationDescriptor.areaType.SetNonNull(aLocationDescriptor.mAreaType.value()); + } + else + { + locationDescriptor.areaType.SetNull(); + } + return locationDescriptor; +} + +} // namespace + +EcosystemDeviceStruct::Builder & EcosystemDeviceStruct::Builder::SetDeviceName(std::string aDeviceName, + uint64_t aDeviceNameLastEditEpochUs) +{ + VerifyOrDie(!mIsAlreadyBuilt); + mDeviceName = std::move(aDeviceName); + mDeviceNameLastEditEpochUs = aDeviceNameLastEditEpochUs; + return *this; +} + +EcosystemDeviceStruct::Builder & EcosystemDeviceStruct::Builder::SetBrigedEndpoint(EndpointId aBridgedEndpoint) +{ + VerifyOrDie(!mIsAlreadyBuilt); + mBridgedEndpoint = aBridgedEndpoint; + return *this; +} + +EcosystemDeviceStruct::Builder & EcosystemDeviceStruct::Builder::SetOriginalEndpoint(EndpointId aOriginalEndpoint) +{ + VerifyOrDie(!mIsAlreadyBuilt); + mOriginalEndpoint = aOriginalEndpoint; + return *this; +} + +EcosystemDeviceStruct::Builder & EcosystemDeviceStruct::Builder::AddDeviceType(Structs::DeviceTypeStruct::Type aDeviceType) +{ + VerifyOrDie(!mIsAlreadyBuilt); + mDeviceTypes.push_back(std::move(aDeviceType)); + return *this; +} + +EcosystemDeviceStruct::Builder & EcosystemDeviceStruct::Builder::AddUniqueLocationId(std::string aUniqueLocationId, + uint64_t aUniqueLocationIdsLastEditEpochUs) +{ + VerifyOrDie(!mIsAlreadyBuilt); + mUniqueLocationIds.push_back(std::move(aUniqueLocationId)); + mUniqueLocationIdsLastEditEpochUs = aUniqueLocationIdsLastEditEpochUs; + return *this; +} + +std::unique_ptr EcosystemDeviceStruct::Builder::Build() +{ + VerifyOrReturnValue(!mIsAlreadyBuilt, nullptr, ChipLogError(Zcl, "Build() already called")); + VerifyOrReturnValue(mDeviceName.size() <= kDeviceNameMaxSize, nullptr, ChipLogError(Zcl, "Device name too large")); + VerifyOrReturnValue(mOriginalEndpoint != kInvalidEndpointId, nullptr, ChipLogError(Zcl, "Invalid original endpoint")); + VerifyOrReturnValue(!mDeviceTypes.empty(), nullptr, ChipLogError(Zcl, "No device types added")); + VerifyOrReturnValue(mUniqueLocationIds.size() <= kUniqueLocationIdsListMaxSize, nullptr, + ChipLogError(Zcl, "Too many location ids")); + + for (auto & locationId : mUniqueLocationIds) + { + VerifyOrReturnValue(locationId.size() <= kUniqueLocationIdMaxSize, nullptr, ChipLogError(Zcl, "Location id too long")); + } + + // std::make_unique does not have access to private constructor we workaround with using new + std::unique_ptr ret{ new EcosystemDeviceStruct( + std::move(mDeviceName), mDeviceNameLastEditEpochUs, mBridgedEndpoint, mOriginalEndpoint, std::move(mDeviceTypes), + std::move(mUniqueLocationIds), mUniqueLocationIdsLastEditEpochUs) }; + mIsAlreadyBuilt = true; + return ret; +} + +CHIP_ERROR EcosystemDeviceStruct::Encode(const AttributeValueEncoder::ListEncodeHelper & aEncoder, const FabricIndex & aFabricIndex) +{ + Structs::EcosystemDeviceStruct::Type deviceStruct; + if (!mDeviceName.empty()) + { + deviceStruct.deviceName.SetValue(CharSpan(mDeviceName.c_str(), mDeviceName.size())); + // When there is a device name we also include mDeviceNameLastEditEpochUs + deviceStruct.deviceNameLastEdit.SetValue(mDeviceNameLastEditEpochUs); + } + deviceStruct.bridgedEndpoint = mBridgedEndpoint; + deviceStruct.originalEndpoint = mOriginalEndpoint; + deviceStruct.deviceTypes = DataModel::List(mDeviceTypes.data(), mDeviceTypes.size()); + + std::vector locationIds; + locationIds.reserve(mUniqueLocationIds.size()); + for (auto & id : mUniqueLocationIds) + { + locationIds.push_back(CharSpan(id.c_str(), id.size())); + } + deviceStruct.uniqueLocationIDs = DataModel::List(locationIds.data(), locationIds.size()); + + deviceStruct.uniqueLocationIDsLastEdit = mUniqueLocationIdsLastEditEpochUs; + + // TODO(#33223) this is a hack, use mFabricIndex when it exists. + deviceStruct.SetFabricIndex(aFabricIndex); + return aEncoder.Encode(deviceStruct); +} + +EcosystemLocationStruct::Builder & EcosystemLocationStruct::Builder::SetLocationName(std::string aLocationName) +{ + VerifyOrDie(!mIsAlreadyBuilt); + mLocationDescriptor.mLocationName = std::move(aLocationName); + return *this; +} + +EcosystemLocationStruct::Builder & EcosystemLocationStruct::Builder::SetFloorNumber(std::optional aFloorNumber) +{ + VerifyOrDie(!mIsAlreadyBuilt); + mLocationDescriptor.mFloorNumber = aFloorNumber; + return *this; +} + +EcosystemLocationStruct::Builder & EcosystemLocationStruct::Builder::SetAreaTypeTag(std::optional aAreaTypeTag) +{ + VerifyOrDie(!mIsAlreadyBuilt); + mLocationDescriptor.mAreaType = aAreaTypeTag; + return *this; +} + +EcosystemLocationStruct::Builder & +EcosystemLocationStruct::Builder::SetLocationDescriptorLastEdit(uint64_t aLocationDescriptorLastEditEpochUs) +{ + VerifyOrDie(!mIsAlreadyBuilt); + mLocationDescriptorLastEditEpochUs = aLocationDescriptorLastEditEpochUs; + return *this; +} + +std::unique_ptr EcosystemLocationStruct::Builder::Build() +{ + VerifyOrReturnValue(!mIsAlreadyBuilt, nullptr, ChipLogError(Zcl, "Build() already called")); + VerifyOrReturnValue(!mLocationDescriptor.mLocationName.empty(), nullptr, ChipLogError(Zcl, "Must Provided Location Name")); + VerifyOrReturnValue(mLocationDescriptor.mLocationName.size() <= kLocationDescriptorNameMaxSize, nullptr, + ChipLogError(Zcl, "Must Location Name must be less than 64 bytes")); + + // std::make_unique does not have access to private constructor we workaround with using new + std::unique_ptr ret{ new EcosystemLocationStruct(std::move(mLocationDescriptor), + mLocationDescriptorLastEditEpochUs) }; + mIsAlreadyBuilt = true; + return ret; +} + +CHIP_ERROR EcosystemLocationStruct::Encode(const AttributeValueEncoder::ListEncodeHelper & aEncoder, + const std::string & aUniqueLocationId, const FabricIndex & aFabricIndex) +{ + Structs::EcosystemLocationStruct::Type locationStruct; + VerifyOrDie(!aUniqueLocationId.empty()); + locationStruct.uniqueLocationID = CharSpan(aUniqueLocationId.c_str(), aUniqueLocationId.size()); + locationStruct.locationDescriptor = GetEncodableLocationDescriptorStruct(mLocationDescriptor); + locationStruct.locationDescriptorLastEdit = mLocationDescriptorLastEditEpochUs; + + // TODO(#33223) this is a hack, use mFabricIndex when it exists. + locationStruct.SetFabricIndex(aFabricIndex); + return aEncoder.Encode(locationStruct); +} + +EcosystemInformationServer EcosystemInformationServer::mInstance; + +EcosystemInformationServer & EcosystemInformationServer::Instance() +{ + return mInstance; +} + +CHIP_ERROR EcosystemInformationServer::AddDeviceInfo(EndpointId aEndpoint, std::unique_ptr aDevice) +{ + VerifyOrReturnError(aDevice, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError((aEndpoint != kRootEndpointId && aEndpoint != kInvalidEndpointId), CHIP_ERROR_INVALID_ARGUMENT); + + auto & deviceInfo = mDevicesMap[aEndpoint]; + VerifyOrReturnError((deviceInfo.mDeviceDirectory.size() < kDeviceDirectoryMaxSize), CHIP_ERROR_NO_MEMORY); + deviceInfo.mDeviceDirectory.push_back(std::move(aDevice)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR EcosystemInformationServer::AddLocationInfo(EndpointId aEndpoint, const std::string & aLocationId, + std::unique_ptr aLocation) +{ + VerifyOrReturnError(aLocation, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError((aEndpoint != kRootEndpointId && aEndpoint != kInvalidEndpointId), CHIP_ERROR_INVALID_ARGUMENT); + + auto & deviceInfo = mDevicesMap[aEndpoint]; + VerifyOrReturnError((deviceInfo.mLocationDirectory.find(aLocationId) == deviceInfo.mLocationDirectory.end()), + CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError((deviceInfo.mLocationDirectory.size() < kLocationDirectoryMaxSize), CHIP_ERROR_NO_MEMORY); + deviceInfo.mLocationDirectory[aLocationId] = std::move(aLocation); + return CHIP_NO_ERROR; +} + +CHIP_ERROR EcosystemInformationServer::RemoveDevice(EndpointId aEndpoint, uint64_t aEpochUs) +{ + auto it = mDevicesMap.find(aEndpoint); + VerifyOrReturnError((it != mDevicesMap.end()), CHIP_ERROR_INVALID_ARGUMENT); + auto & deviceInfo = it->second; + deviceInfo.mRemovedOn.SetValue(aEpochUs); + return CHIP_NO_ERROR; +} + +CHIP_ERROR EcosystemInformationServer::EncodeRemovedOnAttribute(EndpointId aEndpoint, AttributeValueEncoder & aEncoder) +{ + auto it = mDevicesMap.find(aEndpoint); + if (it == mDevicesMap.end()) + { + // We are always going to be given a valid endpoint. If the endpoint + // doesn't exist in our map that indicate that the cluster was not + // added on this endpoint, hence UnsupportedCluster. + return CHIP_IM_GLOBAL_STATUS(UnsupportedCluster); + } + + auto & deviceInfo = it->second; + if (!deviceInfo.mRemovedOn.HasValue()) + { + aEncoder.EncodeNull(); + return CHIP_NO_ERROR; + } + + aEncoder.Encode(deviceInfo.mRemovedOn.Value()); + return CHIP_NO_ERROR; +} + +CHIP_ERROR EcosystemInformationServer::EncodeDeviceDirectoryAttribute(EndpointId aEndpoint, AttributeValueEncoder & aEncoder) +{ + + auto it = mDevicesMap.find(aEndpoint); + if (it == mDevicesMap.end()) + { + // We are always going to be given a valid endpoint. If the endpoint + // doesn't exist in our map that indicate that the cluster was not + // added on this endpoint, hence UnsupportedCluster. + return CHIP_IM_GLOBAL_STATUS(UnsupportedCluster); + } + + auto & deviceInfo = it->second; + if (deviceInfo.mDeviceDirectory.empty() || deviceInfo.mRemovedOn.HasValue()) + { + return aEncoder.EncodeEmptyList(); + } + + FabricIndex fabricIndex = aEncoder.AccessingFabricIndex(); + return aEncoder.EncodeList([&](const auto & encoder) -> CHIP_ERROR { + for (auto & device : deviceInfo.mDeviceDirectory) + { + ReturnErrorOnFailure(device->Encode(encoder, fabricIndex)); + } + return CHIP_NO_ERROR; + }); +} + +CHIP_ERROR EcosystemInformationServer::EncodeLocationStructAttribute(EndpointId aEndpoint, AttributeValueEncoder & aEncoder) +{ + auto it = mDevicesMap.find(aEndpoint); + if (it == mDevicesMap.end()) + { + // We are always going to be given a valid endpoint. If the endpoint + // doesn't exist in our map that indicate that the cluster was not + // added on this endpoint, hence UnsupportedCluster. + return CHIP_IM_GLOBAL_STATUS(UnsupportedCluster); + } + + auto & deviceInfo = it->second; + if (deviceInfo.mLocationDirectory.empty() || deviceInfo.mRemovedOn.HasValue()) + { + return aEncoder.EncodeEmptyList(); + } + + FabricIndex fabricIndex = aEncoder.AccessingFabricIndex(); + return aEncoder.EncodeList([&](const auto & encoder) -> CHIP_ERROR { + for (auto & [id, device] : deviceInfo.mLocationDirectory) + { + ReturnErrorOnFailure(device->Encode(encoder, id, fabricIndex)); + } + return CHIP_NO_ERROR; + }); + return CHIP_NO_ERROR; +} + +} // namespace EcosystemInformation +} // namespace Clusters +} // namespace app +} // namespace chip + +// ----------------------------------------------------------------------------- +// Plugin initialization + +chip::app::Clusters::EcosystemInformation::AttrAccess gAttrAccess; + +void MatterEcosystemInformationPluginServerInitCallback() +{ + registerAttributeAccessOverride(&gAttrAccess); +} diff --git a/src/app/clusters/ecosystem-information-server/ecosystem-information-server.h b/src/app/clusters/ecosystem-information-server/ecosystem-information-server.h new file mode 100644 index 00000000000000..f8407861992d3c --- /dev/null +++ b/src/app/clusters/ecosystem-information-server/ecosystem-information-server.h @@ -0,0 +1,205 @@ +/* + * + * 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 + +// This cluster is targeted by devices that are not resource constrained, for +// that reason we use std containers to simplify implementation of the cluster. +#include +#include +#include +#include +#include + +#include + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace EcosystemInformation { + +// This intentionally mirrors Structs::EcosystemDeviceStruct::Type but has ownership +// of underlying types. +class EcosystemDeviceStruct +{ +public: + class Builder + { + public: + Builder(){}; + + Builder & SetDeviceName(std::string aDeviceName, uint64_t aDeviceNameLastEditEpochUs); + Builder & SetBrigedEndpoint(EndpointId aBridgedEndpoint); + Builder & SetOriginalEndpoint(EndpointId aOriginalEndpoint); + Builder & AddDeviceType(Structs::DeviceTypeStruct::Type aDeviceType); + Builder & AddUniqueLocationId(std::string aUniqueLocationId, uint64_t aUniqueLocationIdsLastEditEpochUs); + + // Upon success this object will have moved all ownership of underlying + // types to EcosystemDeviceStruct and should not be used afterwards. + std::unique_ptr Build(); + + private: + std::string mDeviceName; + uint64_t mDeviceNameLastEditEpochUs = 0; + EndpointId mBridgedEndpoint = kInvalidEndpointId; + EndpointId mOriginalEndpoint = kInvalidEndpointId; + std::vector mDeviceTypes; + std::vector mUniqueLocationIds; + uint64_t mUniqueLocationIdsLastEditEpochUs = 0; + bool mIsAlreadyBuilt = false; + }; + + CHIP_ERROR Encode(const AttributeValueEncoder::ListEncodeHelper & aEncoder, const FabricIndex & aFabricIndex); + +private: + // Constructor is intentionally private. This is to ensure that it is only constructed with + // values that conform to the spec. + explicit EcosystemDeviceStruct(std::string && aDeviceName, uint64_t aDeviceNameLastEditEpochUs, EndpointId aBridgedEndpoint, + EndpointId aOriginalEndpoint, std::vector && aDeviceTypes, + std::vector && aUniqueLocationIds, uint64_t aUniqueLocationIdsLastEditEpochUs) : + mDeviceName(std::move(aDeviceName)), + mDeviceNameLastEditEpochUs(aDeviceNameLastEditEpochUs), mBridgedEndpoint(aBridgedEndpoint), + mOriginalEndpoint(aOriginalEndpoint), mDeviceTypes(std::move(aDeviceTypes)), + mUniqueLocationIds(std::move(aUniqueLocationIds)), mUniqueLocationIdsLastEditEpochUs(aUniqueLocationIdsLastEditEpochUs) + {} + + const std::string mDeviceName; + uint64_t mDeviceNameLastEditEpochUs; + EndpointId mBridgedEndpoint; + EndpointId mOriginalEndpoint; + std::vector mDeviceTypes; + std::vector mUniqueLocationIds; + uint64_t mUniqueLocationIdsLastEditEpochUs; + // TODO(#33223) This structure needs to contain fabric index to be spec compliant. + // To keep initial PR smaller, we are going to assume that all entries + // here are for any fabric. This will allow follow up PR introducing + // fabric scoped to be more throughly reviewed with focus on fabric scoping. +}; + +struct LocationDescriptorStruct +{ + std::string mLocationName; + std::optional mFloorNumber; + std::optional mAreaType; +}; + +// This intentionally mirrors Structs::EcosystemLocationStruct::Type but has ownership +// of underlying types. +class EcosystemLocationStruct +{ +public: + class Builder + { + public: + Builder(){}; + + Builder & SetLocationName(std::string aLocationName); + Builder & SetFloorNumber(std::optional aFloorNumber); + Builder & SetAreaTypeTag(std::optional aAreaTypeTag); + Builder & SetLocationDescriptorLastEdit(uint64_t aLocationDescriptorLastEditEpochUs); + + // Upon success this object will have moved all ownership of underlying + // types to EcosystemDeviceStruct and should not be used afterwards. + std::unique_ptr Build(); + + private: + LocationDescriptorStruct mLocationDescriptor; + uint64_t mLocationDescriptorLastEditEpochUs = 0; + bool mIsAlreadyBuilt = false; + }; + + CHIP_ERROR Encode(const AttributeValueEncoder::ListEncodeHelper & aEncoder, const std::string & aUniqueLocationId, + const FabricIndex & aFabricIndex); + +private: + // Constructor is intentionally private. This is to ensure that it is only constructed with + // values that conform to the spec. + explicit EcosystemLocationStruct(LocationDescriptorStruct && aLocationDescriptor, uint64_t aLocationDescriptorLastEditEpochUs) : + mLocationDescriptor(aLocationDescriptor), mLocationDescriptorLastEditEpochUs(aLocationDescriptorLastEditEpochUs) + {} + // EcosystemLocationStruct is used as a value in a key-value map. + // Because UniqueLocationId is manditory when an entry exist, and + // it is unique, we use it as a key to the key-value pair and is why it is + // not explicitly in this struct. + LocationDescriptorStruct mLocationDescriptor; + uint64_t mLocationDescriptorLastEditEpochUs; + // TODO(#33223) This structure needs to contain fabric index to be spec compliant. + // To keep initial PR smaller, we are going to assume that all entries + // here are for any fabric. This will allow follow up PR introducing + // fabric scoped to be more throughly reviewed with focus on fabric scoping. +}; + +class EcosystemInformationServer +{ +public: + static EcosystemInformationServer & Instance(); + + /** + * @brief Adds device as entry to DeviceDirectory list Attribute. + * + * @param[in] aEndpoint Which endpoint is the device being added to the device directory. + * @param[in] aDevice Device information. + * @return #CHIP_NO_ERROR on success. + * @return Other CHIP_ERROR associated with issue. + */ + CHIP_ERROR AddDeviceInfo(EndpointId aEndpoint, std::unique_ptr aDevice); + /** + * @brief Adds location as entry to LocationDirectory list Attribute. + * + * @param[in] aEndpoint Which endpoint is the location being added to the location directory. + * @param[in] aLocationId LocationID associated with location. + * @param[in] aLocation Location information. + * @return #CHIP_NO_ERROR on success. + * @return Other CHIP_ERROR associated with issue. + */ + CHIP_ERROR AddLocationInfo(EndpointId aEndpoint, const std::string & aLocationId, + std::unique_ptr aLocation); + + /** + * @brief Removes device at the provided endpoint. + * + * @param aEndpoint Endpoint of the associated device that has been removed. + * @param aEpochUs Epoch time in micro seconds assoicated with when device was removed. + * @return #CHIP_NO_ERROR on success. + * @return Other CHIP_ERROR associated with issue. + */ + CHIP_ERROR RemoveDevice(EndpointId aEndpoint, uint64_t aEpochUs); + // TODO(#33223) Add removal and update counterparts to AddDeviceInfo and AddLocationInfo. + + CHIP_ERROR EncodeRemovedOnAttribute(EndpointId aEndpoint, AttributeValueEncoder & aEncoder); + CHIP_ERROR EncodeDeviceDirectoryAttribute(EndpointId aEndpoint, AttributeValueEncoder & aEncoder); + CHIP_ERROR EncodeLocationStructAttribute(EndpointId aEndpoint, AttributeValueEncoder & aEncoder); + +private: + struct DeviceInfo + { + Optional mRemovedOn; + std::vector> mDeviceDirectory; + // Map key is using the UniqueLocationId + std::map> mLocationDirectory; + }; + std::map mDevicesMap; + + static EcosystemInformationServer mInstance; +}; + +} // namespace EcosystemInformation +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.cpp b/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.cpp index f5c8c281615435..cdf480b64cdde4 100644 --- a/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.cpp +++ b/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.cpp @@ -25,6 +25,7 @@ #include #include #include +#include using chip::Protocols::InteractionModel::Status; diff --git a/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h b/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h index 8204a271434e63..53c741d9378cc4 100644 --- a/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h +++ b/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h @@ -21,7 +21,6 @@ #include #include -#include #include namespace chip { @@ -36,8 +35,6 @@ class Delegate void SetEndpointId(EndpointId aEndpoint) { mEndpointId = aEndpoint; } - using HarmonicMeasurementIterator = CommonIterator; - virtual PowerModeEnum GetPowerMode() = 0; virtual uint8_t GetNumberOfMeasurementTypes() = 0; diff --git a/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerHandler.h b/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerHandler.h index 307156e21f1197..38db739bc97f32 100644 --- a/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerHandler.h +++ b/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerHandler.h @@ -57,6 +57,8 @@ enum class EnergyEvseTrigger : uint64_t kEVChargeDemand = 0x0099000000000004, // EV Charge Demand Test Event Clear | Simulate the EV becoming fully charged kEVChargeDemandClear = 0x0099000000000005, + // EV Charge TimeOfUse Mode | Simulate putting the EVSE into a Mode with the TimeOfUse tag included + kEVTimeOfUseMode = 0x0099000000000006, // EVSE has a GroundFault fault kEVSEGroundFault = 0x0099000000000010, // EVSE has a OverTemperature fault @@ -65,6 +67,8 @@ enum class EnergyEvseTrigger : uint64_t kEVSEFaultClear = 0x0099000000000012, // EVSE Diagnostics Complete | Simulate diagnostics have been completed and return to normal kEVSEDiagnosticsComplete = 0x0099000000000020, + // EV Charge TimeOfUse Mode clear | Simulate clearing the EVSE Mode TimeOfUse tag + kEVTimeOfUseModeClear = 0x0099000000000021, }; class EnergyEvseTestEventTriggerHandler : public TestEventTriggerHandler diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp index 2e2f6867e094c1..4807bf33969681 100644 --- a/src/app/clusters/energy-evse-server/energy-evse-server.cpp +++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -37,7 +38,7 @@ namespace EnergyEvse { CHIP_ERROR Instance::Init() { - ReturnErrorOnFailure(InteractionModelEngine::GetInstance()->RegisterCommandHandler(this)); + ReturnErrorOnFailure(CommandHandlerInterfaceRegistry::RegisterCommandHandler(this)); VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); return CHIP_NO_ERROR; @@ -45,7 +46,7 @@ CHIP_ERROR Instance::Init() void Instance::Shutdown() { - InteractionModelEngine::GetInstance()->UnregisterCommandHandler(this); + CommandHandlerInterfaceRegistry::UnregisterCommandHandler(this); unregisterAttributeAccessOverride(this); } @@ -308,13 +309,13 @@ void Instance::HandleEnableCharging(HandlerContext & ctx, const Commands::Enable auto & minimumChargeCurrent = commandData.minimumChargeCurrent; auto & maximumChargeCurrent = commandData.maximumChargeCurrent; - if ((minimumChargeCurrent < kMinimumChargeCurrent) || (minimumChargeCurrent > kMaximumChargeCurrent)) + if (minimumChargeCurrent < kMinimumChargeCurrent) { ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } - if ((maximumChargeCurrent < kMinimumChargeCurrent) || (maximumChargeCurrent > kMaximumChargeCurrent)) + if (maximumChargeCurrent < kMinimumChargeCurrent) { ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; @@ -338,7 +339,7 @@ void Instance::HandleEnableDischarging(HandlerContext & ctx, const Commands::Ena auto & dischargingEnabledUntil = commandData.dischargingEnabledUntil; auto & maximumDischargeCurrent = commandData.maximumDischargeCurrent; - if ((maximumDischargeCurrent < kMinimumChargeCurrent) || (maximumDischargeCurrent > kMaximumChargeCurrent)) + if (maximumDischargeCurrent < kMinimumChargeCurrent) { ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; @@ -361,27 +362,136 @@ void Instance::HandleStartDiagnostics(HandlerContext & ctx, const Commands::Star void Instance::HandleSetTargets(HandlerContext & ctx, const Commands::SetTargets::DecodableType & commandData) { // Call the delegate - // TODO - // Status status = mDelegate.SetTargets(); - Status status = Status::UnsupportedCommand; + auto & chargingTargetSchedules = commandData.chargingTargetSchedules; + + Status status = ValidateTargets(chargingTargetSchedules); + if (status != Status::Success) + { + ChipLogError(AppServer, "SetTargets contained invalid data - Rejecting"); + } + else + { + status = mDelegate.SetTargets(chargingTargetSchedules); + } ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); } + +Status Instance::ValidateTargets( + const DataModel::DecodableList & chargingTargetSchedules) +{ + /* A) check that the targets are valid + * 1) each target must be within valid range (TargetTimeMinutesPastMidnight < 1440) + * 2) each target must be within valid range (TargetSoC percent 0 - 100) + * If SOC feature not supported then this MUST be 100 or not present + * 3) each target must be within valid range (AddedEnergy >= 0) + * B) Day of Week is only allowed to be included once + */ + + uint8_t dayOfWeekBitmap = 0; + + auto iter = chargingTargetSchedules.begin(); + while (iter.Next()) + { + auto & entry = iter.GetValue(); + uint8_t bitmask = entry.dayOfWeekForSequence.GetField(static_cast(0x7F)); + ChipLogProgress(AppServer, "DayOfWeekForSequence = 0x%02x", bitmask); + + if ((dayOfWeekBitmap & bitmask) != 0) + { + // A bit has already been set - Return ConstraintError + ChipLogError(AppServer, "DayOfWeekForSequence has a bit set which has already been set in another entry."); + return Status::ConstraintError; + } + dayOfWeekBitmap |= bitmask; // add this day Of week to the previously seen days + + auto iterInner = entry.chargingTargets.begin(); + uint8_t innerIdx = 0; + while (iterInner.Next()) + { + auto & targetStruct = iterInner.GetValue(); + uint16_t minutesPastMidnight = targetStruct.targetTimeMinutesPastMidnight; + ChipLogProgress(AppServer, "[%d] MinutesPastMidnight : %d", innerIdx, + static_cast(minutesPastMidnight)); + + if (minutesPastMidnight > 1439) + { + ChipLogError(AppServer, "MinutesPastMidnight has invalid value (%d)", static_cast(minutesPastMidnight)); + return Status::ConstraintError; + } + + // If SocReporting is supported, targetSoc must have a value in the range [0, 100] + if (HasFeature(Feature::kSoCReporting)) + { + if (!targetStruct.targetSoC.HasValue()) + { + ChipLogError(AppServer, "kSoCReporting is supported but TargetSoC does not have a value"); + return Status::Failure; + } + + if (targetStruct.targetSoC.Value() > 100) + { + ChipLogError(AppServer, "TargetSoC has invalid value (%d)", static_cast(targetStruct.targetSoC.Value())); + return Status::ConstraintError; + } + } + else if (targetStruct.targetSoC.HasValue() && targetStruct.targetSoC.Value() != 100) + { + // If SocReporting is not supported but targetSoc has a value, it must be 100 + ChipLogError(AppServer, "TargetSoC has can only be 100%% if SOC feature is not supported"); + return Status::ConstraintError; + } + + // One or both of targetSoc and addedEnergy must be specified + if (!(targetStruct.targetSoC.HasValue()) && !(targetStruct.addedEnergy.HasValue())) + { + ChipLogError(AppServer, "Must have one of AddedEnergy or TargetSoC"); + return Status::Failure; + } + + // Validate the value of addedEnergy, if specified is >= 0 + if (targetStruct.addedEnergy.HasValue() && targetStruct.addedEnergy.Value() < 0) + { + ChipLogError(AppServer, "AddedEnergy has invalid value (%ld)", + static_cast(targetStruct.addedEnergy.Value())); + return Status::ConstraintError; + } + innerIdx++; + } + + if (iterInner.GetStatus() != CHIP_NO_ERROR) + { + return Status::InvalidCommand; + } + } + + if (iter.GetStatus() != CHIP_NO_ERROR) + { + return Status::InvalidCommand; + } + + return Status::Success; +} + void Instance::HandleGetTargets(HandlerContext & ctx, const Commands::GetTargets::DecodableType & commandData) { - // Call the delegate - // TODO - // Status status = mDelegate.GetTargets(); - Status status = Status::UnsupportedCommand; + Commands::GetTargetsResponse::Type response; - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); + Status status = mDelegate.GetTargets(response.chargingTargetSchedules); + if (status != Status::Success) + { + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); + return; + } + + ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Protocols::InteractionModel::Status::Success); } + void Instance::HandleClearTargets(HandlerContext & ctx, const Commands::ClearTargets::DecodableType & commandData) { // Call the delegate - // TODO - // Status status = mDelegate.ClearTargets(); - Status status = Status::UnsupportedCommand; + Status status = mDelegate.ClearTargets(); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); } diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.h b/src/app/clusters/energy-evse-server/energy-evse-server.h index 2ff46f339ff6ad..979e44c040a17b 100644 --- a/src/app/clusters/energy-evse-server/energy-evse-server.h +++ b/src/app/clusters/energy-evse-server/energy-evse-server.h @@ -36,8 +36,9 @@ namespace EnergyEvse { // Spec-defined constraints constexpr int64_t kMinimumChargeCurrent = 0; -constexpr int64_t kMaximumChargeCurrent = 80000; constexpr uint32_t kMaxRandomizationDelayWindow = 86400; +constexpr uint8_t kEvseTargetsMaxNumberOfDays = 7; +constexpr uint8_t kEvseTargetsMaxTargetsPerDay = 10; /** @brief * Defines methods for implementing application-specific logic for the EVSE Management Cluster. @@ -81,6 +82,36 @@ class Delegate */ virtual Protocols::InteractionModel::Status StartDiagnostics() = 0; + /** + * @brief Delegate should implement a handler for the SetTargets command. + * It should report Status::Success if successful and may + * return other Status codes if it fails + */ + virtual Protocols::InteractionModel::Status + SetTargets(const DataModel::DecodableList & chargingTargetSchedules) = 0; + + /** + * @brief Delegate should implement a handler for LoadTargets + * + * This needs to load any stored targets into memory + */ + virtual Protocols::InteractionModel::Status LoadTargets() = 0; + + /** + * @brief Delegate should implement a handler for GetTargets + * + * @param[out] The full targets structure + */ + virtual Protocols::InteractionModel::Status + GetTargets(DataModel::List & chargingTargetSchedules) = 0; + + /** + * @brief Delegate should implement a handler for ClearTargets command. + * It should report Status::Success if successful and may + * return other Status codes if it fails + */ + virtual Protocols::InteractionModel::Status ClearTargets() = 0; + // ------------------------------------------------------------------ // Get attribute methods virtual StateEnum GetState() = 0; @@ -178,6 +209,10 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface void HandleSetTargets(HandlerContext & ctx, const Commands::SetTargets::DecodableType & commandData); void HandleGetTargets(HandlerContext & ctx, const Commands::GetTargets::DecodableType & commandData); void HandleClearTargets(HandlerContext & ctx, const Commands::ClearTargets::DecodableType & commandData); + + // Check that the targets are valid + Protocols::InteractionModel::Status + ValidateTargets(const DataModel::DecodableList & chargingTargetSchedules); }; } // namespace EnergyEvse diff --git a/src/app/clusters/icd-management-server/icd-management-server.cpp b/src/app/clusters/icd-management-server/icd-management-server.cpp index e4ead150a1fd79..e98cc5e31718b2 100644 --- a/src/app/clusters/icd-management-server/icd-management-server.cpp +++ b/src/app/clusters/icd-management-server/icd-management-server.cpp @@ -69,6 +69,7 @@ class IcdManagementAttributeAccess : public AttributeAccessInterface CHIP_ERROR ReadRegisteredClients(EndpointId endpoint, AttributeValueEncoder & encoder); CHIP_ERROR ReadICDCounter(EndpointId endpoint, AttributeValueEncoder & encoder); CHIP_ERROR ReadClientsSupportedPerFabric(EndpointId endpoint, AttributeValueEncoder & encoder); + CHIP_ERROR ReadMaximumCheckInBackOff(EndpointId endpoint, AttributeValueEncoder & encoder); PersistentStorageDelegate * mStorage = nullptr; Crypto::SymmetricKeystore * mSymmetricKeystore = nullptr; @@ -102,6 +103,9 @@ CHIP_ERROR IcdManagementAttributeAccess::Read(const ConcreteReadAttributePath & case IcdManagement::Attributes::ClientsSupportedPerFabric::Id: return ReadClientsSupportedPerFabric(aPath.mEndpointId, aEncoder); + + case IcdManagement::Attributes::MaximumCheckInBackOff::Id: + return ReadMaximumCheckInBackOff(aPath.mEndpointId, aEncoder); #endif // CHIP_CONFIG_ENABLE_ICD_CIP } @@ -221,6 +225,11 @@ CHIP_ERROR IcdManagementAttributeAccess::ReadClientsSupportedPerFabric(EndpointI return encoder.Encode(mICDConfigurationData->GetClientsSupportedPerFabric()); } +CHIP_ERROR IcdManagementAttributeAccess::ReadMaximumCheckInBackOff(EndpointId endpoint, AttributeValueEncoder & encoder) +{ + return encoder.Encode(mICDConfigurationData->GetMaximumCheckInBackoff().count()); +} + /** * @brief Function checks if the client has admin permissions to the cluster in the commandPath * @@ -259,10 +268,10 @@ Status ICDManagementServer::RegisterClient(CommandHandler * commandObj, const Co bool isClientAdmin = false; // Check if ClientType is valid - VerifyOrReturnError(clientType != ClientTypeEnum::kUnknownEnumValue, InteractionModel::Status::ConstraintError); + VerifyOrReturnError(clientType != ClientTypeEnum::kUnknownEnumValue, Status::ConstraintError); // Check if client is admin - VerifyOrReturnError(CHIP_NO_ERROR == CheckAdmin(commandObj, commandPath, isClientAdmin), InteractionModel::Status::Failure); + VerifyOrReturnError(CHIP_NO_ERROR == CheckAdmin(commandObj, commandPath, isClientAdmin), Status::Failure); bool isFirstEntryForFabric = false; ICDMonitoringTable table(*mStorage, fabricIndex, mICDConfigurationData->GetClientsSupportedPerFabric(), mSymmetricKeystore); @@ -275,14 +284,14 @@ Status ICDManagementServer::RegisterClient(CommandHandler * commandObj, const Co // Existing entry: Validate Key if, and only if, the ISD does NOT have administrator permissions if (!isClientAdmin) { - VerifyOrReturnError(verificationKey.HasValue(), InteractionModel::Status::Failure); - VerifyOrReturnError(entry.IsKeyEquivalent(verificationKey.Value()), InteractionModel::Status::Failure); + VerifyOrReturnError(verificationKey.HasValue(), Status::Failure); + VerifyOrReturnError(entry.IsKeyEquivalent(verificationKey.Value()), Status::Failure); } } else if (CHIP_ERROR_NOT_FOUND == err) { // New entry - VerifyOrReturnError(entry.index < table.Limit(), InteractionModel::Status::ResourceExhausted); + VerifyOrReturnError(entry.index < table.Limit(), Status::ResourceExhausted); // Check if it's going to be the first entry for fabric isFirstEntryForFabric = table.IsEmpty(); @@ -290,7 +299,7 @@ Status ICDManagementServer::RegisterClient(CommandHandler * commandObj, const Co else { // Error - return InteractionModel::Status::Failure; + return Status::Failure; } // Save @@ -304,8 +313,8 @@ Status ICDManagementServer::RegisterClient(CommandHandler * commandObj, const Co } err = entry.SetKey(key); - VerifyOrReturnError(CHIP_ERROR_INVALID_ARGUMENT != err, InteractionModel::Status::ConstraintError); - VerifyOrReturnError(CHIP_NO_ERROR == err, InteractionModel::Status::Failure); + VerifyOrReturnError(CHIP_ERROR_INVALID_ARGUMENT != err, Status::ConstraintError); + VerifyOrReturnError(CHIP_NO_ERROR == err, Status::Failure); err = table.Set(entry.index, entry); // Delete key upon failure to prevent key storage leakage. @@ -314,8 +323,8 @@ Status ICDManagementServer::RegisterClient(CommandHandler * commandObj, const Co entry.DeleteKey(); } - VerifyOrReturnError(CHIP_ERROR_INVALID_ARGUMENT != err, InteractionModel::Status::ConstraintError); - VerifyOrReturnError(CHIP_NO_ERROR == err, InteractionModel::Status::Failure); + VerifyOrReturnError(CHIP_ERROR_INVALID_ARGUMENT != err, Status::ConstraintError); + VerifyOrReturnError(CHIP_NO_ERROR == err, Status::Failure); if (isFirstEntryForFabric) { @@ -324,7 +333,7 @@ Status ICDManagementServer::RegisterClient(CommandHandler * commandObj, const Co } icdCounter = mICDConfigurationData->GetICDCounter().GetValue(); - return InteractionModel::Status::Success; + return Status::Success; } Status ICDManagementServer::UnregisterClient(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, @@ -336,32 +345,32 @@ Status ICDManagementServer::UnregisterClient(CommandHandler * commandObj, const bool isClientAdmin = false; // Check if client is admin - VerifyOrReturnError(CHIP_NO_ERROR == CheckAdmin(commandObj, commandPath, isClientAdmin), InteractionModel::Status::Failure); + VerifyOrReturnError(CHIP_NO_ERROR == CheckAdmin(commandObj, commandPath, isClientAdmin), Status::Failure); ICDMonitoringTable table(*mStorage, fabricIndex, mICDConfigurationData->GetClientsSupportedPerFabric(), mSymmetricKeystore); // Get current entry, if exists ICDMonitoringEntry entry(mSymmetricKeystore); CHIP_ERROR err = table.Find(nodeId, entry); - VerifyOrReturnError(CHIP_ERROR_NOT_FOUND != err, InteractionModel::Status::NotFound); - VerifyOrReturnError(CHIP_NO_ERROR == err, InteractionModel::Status::Failure); + VerifyOrReturnError(CHIP_ERROR_NOT_FOUND != err, Status::NotFound); + VerifyOrReturnError(CHIP_NO_ERROR == err, Status::Failure); // Existing entry: Validate Key if, and only if, the ISD has NOT administrator permissions if (!isClientAdmin) { - VerifyOrReturnError(verificationKey.HasValue(), InteractionModel::Status::Failure); - VerifyOrReturnError(entry.IsKeyEquivalent(verificationKey.Value()), InteractionModel::Status::Failure); + VerifyOrReturnError(verificationKey.HasValue(), Status::Failure); + VerifyOrReturnError(entry.IsKeyEquivalent(verificationKey.Value()), Status::Failure); } err = table.Remove(entry.index); - VerifyOrReturnError(CHIP_NO_ERROR == err, InteractionModel::Status::Failure); + VerifyOrReturnError(CHIP_NO_ERROR == err, Status::Failure); if (table.IsEmpty()) { TriggerICDMTableUpdatedEvent(); } - return InteractionModel::Status::Success; + return Status::Success; } void ICDManagementServer::TriggerICDMTableUpdatedEvent() @@ -396,9 +405,9 @@ bool emberAfIcdManagementClusterRegisterClientCallback(CommandHandler * commandO uint32_t icdCounter = 0; ICDManagementServer server; - InteractionModel::Status status = server.RegisterClient(commandObj, commandPath, commandData, icdCounter); + Status status = server.RegisterClient(commandObj, commandPath, commandData, icdCounter); - if (InteractionModel::Status::Success == status) + if (Status::Success == status) { // Response IcdManagement::Commands::RegisterClientResponse::Type response{ .ICDCounter = icdCounter }; @@ -419,7 +428,7 @@ bool emberAfIcdManagementClusterUnregisterClientCallback(CommandHandler * comman const Commands::UnregisterClient::DecodableType & commandData) { ICDManagementServer server; - InteractionModel::Status status = server.UnregisterClient(commandObj, commandPath, commandData); + Status status = server.UnregisterClient(commandObj, commandPath, commandData); commandObj->AddStatus(commandPath, status); return true; diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp index 2ee9f2cfa54c04..00d8a2e496518f 100644 --- a/src/app/clusters/level-control/level-control.cpp +++ b/src/app/clusters/level-control/level-control.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -51,6 +52,7 @@ #include using namespace chip; +using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::LevelControl; using chip::Protocols::InteractionModel::Status; @@ -85,7 +87,7 @@ struct CallbackScheduleState // when called consecutively }; -typedef struct +struct EmberAfLevelControlState { CommandId commandId; uint8_t moveToLevel; @@ -98,23 +100,24 @@ typedef struct uint32_t transitionTimeMs; uint32_t elapsedTimeMs; CallbackScheduleState callbackSchedule; -} EmberAfLevelControlState; + QuieterReportingAttribute quietCurrentLevel{ DataModel::NullNullable }; + QuieterReportingAttribute quietRemainingTime{ DataModel::MakeNullable(0) }; +}; static EmberAfLevelControlState stateTable[kLevelControlStateTableSize]; static EmberAfLevelControlState * getState(EndpointId endpoint); static Status moveToLevelHandler(EndpointId endpoint, CommandId commandId, uint8_t level, - app::DataModel::Nullable transitionTimeDs, - chip::Optional> optionsMask, + DataModel::Nullable transitionTimeDs, chip::Optional> optionsMask, chip::Optional> optionsOverride, uint16_t storedLevel); -static void moveHandler(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, MoveModeEnum moveMode, - app::DataModel::Nullable rate, chip::Optional> optionsMask, +static void moveHandler(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, MoveModeEnum moveMode, + DataModel::Nullable rate, chip::Optional> optionsMask, chip::Optional> optionsOverride); -static void stepHandler(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, StepModeEnum stepMode, - uint8_t stepSize, app::DataModel::Nullable transitionTimeDs, +static void stepHandler(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, StepModeEnum stepMode, + uint8_t stepSize, DataModel::Nullable transitionTimeDs, chip::Optional> optionsMask, chip::Optional> optionsOverride); -static void stopHandler(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, +static void stopHandler(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, chip::Optional> optionsMask, chip::Optional> optionsOverride); static void setOnOffValue(EndpointId endpoint, bool onOff); @@ -122,6 +125,9 @@ static void writeRemainingTime(EndpointId endpoint, uint16_t remainingTimeMs); static bool shouldExecuteIfOff(EndpointId endpoint, CommandId commandId, chip::Optional> optionsMask, chip::Optional> optionsOverride); +static Status SetCurrentLevelQuietReport(EndpointId endpoint, EmberAfLevelControlState * state, + DataModel::Nullable newValue, bool isStartOrEndOfTransition); + #if defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl { @@ -160,9 +166,9 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl /// @return CHIP_NO_ERROR if successfully serialized the data, CHIP_ERROR_INVALID_ARGUMENT otherwise CHIP_ERROR SerializeSave(EndpointId endpoint, ClusterId cluster, MutableByteSpan & serializedBytes) override { - using AttributeValuePair = ScenesManagement::Structs::AttributeValuePair::Type; + using AttributeValuePair = ScenesManagement::Structs::AttributeValuePairStruct::Type; - app::DataModel::Nullable level; + DataModel::Nullable level; VerifyOrReturnError(Status::Success == Attributes::CurrentLevel::Get(endpoint, level), CHIP_ERROR_READ_FAILED); AttributeValuePair pairs[kLevelMaxScenableAttributes]; @@ -173,23 +179,23 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl pairs[0].attributeID = Attributes::CurrentLevel::Id; if (!level.IsNull()) { - pairs[0].attributeValue = level.Value(); + pairs[0].valueUnsigned8.SetValue(level.Value()); } else { - chip::app::NumericAttributeTraits::SetNull(pairs[0].attributeValue); + pairs[0].valueUnsigned8.SetValue(NumericAttributeTraits::kNullValue); } size_t attributeCount = 1; if (LevelControlHasFeature(endpoint, LevelControl::Feature::kFrequency)) { uint16_t frequency; VerifyOrReturnError(Status::Success == Attributes::CurrentFrequency::Get(endpoint, &frequency), CHIP_ERROR_READ_FAILED); - pairs[attributeCount].attributeID = Attributes::CurrentFrequency::Id; - pairs[attributeCount].attributeValue = frequency; + pairs[attributeCount].attributeID = Attributes::CurrentFrequency::Id; + pairs[attributeCount].valueUnsigned16.SetValue(frequency); attributeCount++; } - app::DataModel::List attributeValueList(pairs, attributeCount); + DataModel::List attributeValueList(pairs, attributeCount); return EncodeAttributeValueList(attributeValueList, serializedBytes); } @@ -203,7 +209,7 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl CHIP_ERROR ApplyScene(EndpointId endpoint, ClusterId cluster, const ByteSpan & serializedBytes, scenes::TransitionTimeMs timeMs) override { - app::DataModel::DecodableList attributeValueList; + DataModel::DecodableList attributeValueList; ReturnErrorOnFailure(DecodeAttributeValueList(serializedBytes, attributeValueList)); @@ -225,11 +231,13 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl switch (decodePair.attributeID) { case Attributes::CurrentLevel::Id: - level = static_cast(decodePair.attributeValue); + VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + level = decodePair.valueUnsigned8.Value(); break; case Attributes::CurrentFrequency::Id: // TODO : Uncomment when frequency is supported by the level control cluster - // frequency = static_cast(decodePair.attributeValue); + // VerifyOrReturnError(decodePair.valueUnsigned16.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + // frequency = decodePair.valueUnsigned16.Value(); break; default: return CHIP_ERROR_INVALID_ARGUMENT; @@ -240,14 +248,17 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl // TODO : Implement action on frequency when frequency not provisional anymore // if(LevelControlHasFeature(endpoint, LevelControl::Feature::kFrequency)){} - if (!chip::app::NumericAttributeTraits::IsNullValue(level)) + EmberAfLevelControlState * state = getState(endpoint); + if (level < state->minLevel || level > state->maxLevel) { - CommandId command = LevelControlHasFeature(endpoint, LevelControl::Feature::kOnOff) ? Commands::MoveToLevelWithOnOff::Id - : Commands::MoveToLevel::Id; + NumericAttributeTraits::SetNull(level); + } - moveToLevelHandler(endpoint, command, level, app::DataModel::MakeNullable(static_cast(timeMs / 100)), - chip::Optional>(), chip::Optional>(), - INVALID_STORED_LEVEL); + if (!NumericAttributeTraits::IsNullValue(level)) + { + moveToLevelHandler( + endpoint, Commands::MoveToLevel::Id, level, DataModel::MakeNullable(static_cast(timeMs / 100)), + chip::Optional>(1), chip::Optional>(1), INVALID_STORED_LEVEL); } return CHIP_NO_ERROR; @@ -355,18 +366,68 @@ static void reallyUpdateCoupledColorTemp(EndpointId endpoint) } #endif // IGNORE_LEVEL_CONTROL_CLUSTER_OPTIONS && MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_TEMP +/* + * @brief + * This function is used to update the current level attribute + * while respecting its defined quiet reporting quality: + * The attribute will be reported: + * - At most once per second, or + * - At the start of the movement/transition, or + * - At the end of the movement/transition, or + * - When it changes from null to any other value and vice versa. + * + * @param endpoint: endpoint on which the currentLevel attribute must be updated. + * @param state: LevelControlState struct of this given endpoint. + * @param newValue: Value to update the attribute with + * @param isStartOrEndOfTransition: Boolean that indicate whether the update is occuring at the start or end of a level transition + * @return Success in setting the attribute value or the IM error code for the failure. + */ +static Status SetCurrentLevelQuietReport(EndpointId endpoint, EmberAfLevelControlState * state, + DataModel::Nullable newValue, bool isStartOrEndOfTransition) +{ + AttributeDirtyState dirtyState; + auto now = System::SystemClock().GetMonotonicTimestamp(); + + if (isStartOrEndOfTransition) + { + // At the start or end of the movement/transition we must report + auto predicate = [](const decltype(state->quietCurrentLevel)::SufficientChangePredicateCandidate &) -> bool { + return true; + }; + dirtyState = state->quietCurrentLevel.SetValue(newValue, now, predicate); + } + else + { + // During transtions, reports should be at most once per second + System::Clock::Milliseconds64 reportInterval = + std::max(System::Clock::Milliseconds64(1000), System::Clock::Milliseconds64(state->transitionTimeMs / 4)); + auto predicate = state->quietCurrentLevel.GetPredicateForSufficientTimeSinceLastDirty(reportInterval); + dirtyState = state->quietCurrentLevel.SetValue(newValue, now, predicate); + } + + MarkAttributeDirty markDirty = MarkAttributeDirty::kNo; + if (dirtyState == AttributeDirtyState::kMustReport) + { + markDirty = MarkAttributeDirty::kYes; + } + return Attributes::CurrentLevel::Set(endpoint, state->quietCurrentLevel.value(), markDirty); +} + void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint) { EmberAfLevelControlState * state = getState(endpoint); Status status; - app::DataModel::Nullable currentLevel; + DataModel::Nullable currentLevel; const auto callbackStartTimestamp = System::SystemClock().GetMonotonicTimestamp(); + bool isTransitionStart = false; + bool isTransitionEnd = false; if (state == nullptr) { return; } + isTransitionStart = (state->elapsedTimeMs == 0); state->elapsedTimeMs += state->eventDurationMs; // Read the attribute; print error message and return if it can't be read @@ -404,7 +465,9 @@ void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint) ChipLogDetail(Zcl, " to %d ", currentLevel.Value()); ChipLogDetail(Zcl, "(diff %c1)", state->increasing ? '+' : '-'); - status = Attributes::CurrentLevel::Set(endpoint, currentLevel); + // Are we at the requested level? + isTransitionEnd = (currentLevel.Value() == state->moveToLevel); + status = SetCurrentLevelQuietReport(endpoint, state, currentLevel, (isTransitionStart || isTransitionEnd)); if (status != Status::Success) { ChipLogProgress(Zcl, "ERR: writing current level %x", to_underlying(status)); @@ -415,8 +478,7 @@ void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint) updateCoupledColorTemp(endpoint); - // Are we at the requested level? - if (currentLevel.Value() == state->moveToLevel) + if (isTransitionEnd) { if (state->commandId == Commands::MoveToLevelWithOnOff::Id || state->commandId == Commands::MoveWithOnOff::Id || state->commandId == Commands::StepWithOnOff::Id) @@ -470,11 +532,20 @@ static void writeRemainingTime(EndpointId endpoint, uint16_t remainingTimeMs) // This is done to ensure that the attribute, in tenths of a second, only // goes to zero when the remaining time in milliseconds is actually zero. uint16_t remainingTimeDs = static_cast((remainingTimeMs + 99) / 100); - Status status = LevelControl::Attributes::RemainingTime::Set(endpoint, remainingTimeDs); - if (status != Status::Success) + auto markDirty = MarkAttributeDirty::kNo; + auto state = getState(endpoint); + auto now = System::SystemClock().GetMonotonicTimestamp(); + + // Establish the quiet report condition for the RemainingTime Attribute + // The quiet report is determined by the previously set policies: + // - kMarkDirtyOnChangeToFromZero : When the value changes from 0 to any other value and vice versa, or + // - kMarkDirtyOnIncrement : When the value increases. + if (state->quietRemainingTime.SetValue(remainingTimeDs, now) == AttributeDirtyState::kMustReport) { - ChipLogProgress(Zcl, "ERR: writing remaining time %x", to_underlying(status)); + markDirty = MarkAttributeDirty::kYes; } + + Attributes::RemainingTime::Set(endpoint, state->quietRemainingTime.value().ValueOr(0), markDirty); } #endif // IGNORE_LEVEL_CONTROL_CLUSTER_LEVEL_CONTROL_REMAINING_TIME } @@ -575,7 +646,7 @@ static bool shouldExecuteIfOff(EndpointId endpoint, CommandId commandId, chip::O return true; } -bool emberAfLevelControlClusterMoveToLevelCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, +bool emberAfLevelControlClusterMoveToLevelCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::MoveToLevel::DecodableType & commandData) { MATTER_TRACE_SCOPE("MoveToLevel", "LevelControl"); @@ -621,8 +692,7 @@ chip::scenes::SceneHandler * GetSceneHandler() } // namespace LevelControlServer -bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(app::CommandHandler * commandObj, - const app::ConcreteCommandPath & commandPath, +bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::MoveToLevelWithOnOff::DecodableType & commandData) { MATTER_TRACE_SCOPE("MoveToLevelWithOnOff", "LevelControl"); @@ -652,7 +722,7 @@ bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(app::CommandHandler return true; } -bool emberAfLevelControlClusterMoveCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, +bool emberAfLevelControlClusterMoveCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::Move::DecodableType & commandData) { MATTER_TRACE_SCOPE("Move", "LevelControl"); @@ -677,7 +747,7 @@ bool emberAfLevelControlClusterMoveCallback(app::CommandHandler * commandObj, co return true; } -bool emberAfLevelControlClusterMoveWithOnOffCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, +bool emberAfLevelControlClusterMoveWithOnOffCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::MoveWithOnOff::DecodableType & commandData) { MATTER_TRACE_SCOPE("MoveWithOnOff", "LevelControl"); @@ -702,7 +772,7 @@ bool emberAfLevelControlClusterMoveWithOnOffCallback(app::CommandHandler * comma return true; } -bool emberAfLevelControlClusterStepCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, +bool emberAfLevelControlClusterStepCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::Step::DecodableType & commandData) { MATTER_TRACE_SCOPE("Step", "LevelControl"); @@ -728,7 +798,7 @@ bool emberAfLevelControlClusterStepCallback(app::CommandHandler * commandObj, co return true; } -bool emberAfLevelControlClusterStepWithOnOffCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, +bool emberAfLevelControlClusterStepWithOnOffCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::StepWithOnOff::DecodableType & commandData) { MATTER_TRACE_SCOPE("StepWithOnOff", "LevelControl"); @@ -754,7 +824,7 @@ bool emberAfLevelControlClusterStepWithOnOffCallback(app::CommandHandler * comma return true; } -bool emberAfLevelControlClusterStopCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, +bool emberAfLevelControlClusterStopCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::Stop::DecodableType & commandData) { MATTER_TRACE_SCOPE("Stop", "LevelControl"); @@ -767,7 +837,7 @@ bool emberAfLevelControlClusterStopCallback(app::CommandHandler * commandObj, co return true; } -bool emberAfLevelControlClusterStopWithOnOffCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, +bool emberAfLevelControlClusterStopWithOnOffCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::StopWithOnOff::DecodableType & commandData) { MATTER_TRACE_SCOPE("StopWithOnOff", "LevelControl"); @@ -780,12 +850,11 @@ bool emberAfLevelControlClusterStopWithOnOffCallback(app::CommandHandler * comma } static Status moveToLevelHandler(EndpointId endpoint, CommandId commandId, uint8_t level, - app::DataModel::Nullable transitionTimeDs, - chip::Optional> optionsMask, + DataModel::Nullable transitionTimeDs, chip::Optional> optionsMask, chip::Optional> optionsOverride, uint16_t storedLevel) { EmberAfLevelControlState * state = getState(endpoint); - app::DataModel::Nullable currentLevel; + DataModel::Nullable currentLevel; uint8_t actualStepSize; if (state == nullptr) @@ -908,11 +977,9 @@ static Status moveToLevelHandler(EndpointId endpoint, CommandId commandId, uint8 // The duration between events will be the transition time divided by the // distance we must move. - state->eventDurationMs = state->transitionTimeMs / std::max(static_cast(1u), actualStepSize); - state->elapsedTimeMs = 0; - - state->storedLevel = storedLevel; - + state->eventDurationMs = state->transitionTimeMs / std::max(static_cast(1u), actualStepSize); + state->elapsedTimeMs = 0; + state->storedLevel = storedLevel; state->callbackSchedule.runTime = System::Clock::Milliseconds32(0); #ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT @@ -938,18 +1005,25 @@ static Status moveToLevelHandler(EndpointId endpoint, CommandId commandId, uint8 return Status::Success; } -static void moveHandler(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, MoveModeEnum moveMode, - app::DataModel::Nullable rate, chip::Optional> optionsMask, +static void moveHandler(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, MoveModeEnum moveMode, + DataModel::Nullable rate, chip::Optional> optionsMask, chip::Optional> optionsOverride) { - EndpointId endpoint = commandPath.mEndpointId; - CommandId commandId = commandPath.mCommandId; - - EmberAfLevelControlState * state = getState(endpoint); Status status; - app::DataModel::Nullable currentLevel; uint8_t difference; + EmberAfLevelControlState * state; + DataModel::Nullable currentLevel; + + EndpointId endpoint = commandPath.mEndpointId; + CommandId commandId = commandPath.mCommandId; + // Validate the received rate and moveMode first. + if (rate == static_cast(0) || moveMode == MoveModeEnum::kUnknownEnumValue) + { + status = Status::InvalidCommand; + goto send_default_response; + } + state = getState(endpoint); if (state == nullptr) { status = Status::Failure; @@ -962,18 +1036,51 @@ static void moveHandler(app::CommandHandler * commandObj, const app::ConcreteCom goto send_default_response; } - if (!rate.IsNull() && (rate.Value() == 0)) + uint8_t eventDuration; // use this local var so state->eventDurationMs is only set once the command is validated. +#ifndef IGNORE_LEVEL_CONTROL_CLUSTER_TRANSITION + // If the Rate field is null, the device should move at the default move rate, if available, + // Otherwise, move as fast as possible + if (rate.IsNull()) { - // Move at a rate of zero is no move at all. Immediately succeed without touching anything. - ChipLogProgress(Zcl, "Immediate success due to move rate of 0 (would move at no rate)."); - status = Status::Success; - goto send_default_response; + DataModel::Nullable defaultMoveRate; + status = Attributes::DefaultMoveRate::Get(endpoint, defaultMoveRate); + if (status != Status::Success || defaultMoveRate.IsNull()) + { + ChipLogProgress(Zcl, "ERR: reading default move rate %x", to_underlying(status)); + eventDuration = FASTEST_TRANSITION_TIME_MS; + } + else + { + // This should never occur, but old devices could have this, now invalid, value stored. + if (defaultMoveRate.Value() == 0) + { + // The spec is not explicit about what should be done if this happens. + // For now Error out if DefaultMoveRate is equal to 0 as this is invalid + // until spec defines a behaviour. + status = Status::InvalidCommand; + goto send_default_response; + } + // Already checked that defaultMoveRate.Value() != 0. + eventDuration = static_cast(MILLISECOND_TICKS_PER_SECOND / defaultMoveRate.Value()); + } } + else + { + // Already confirmed rate.Value() != 0. + eventDuration = static_cast(MILLISECOND_TICKS_PER_SECOND / rate.Value()); + } +#else + // Transition/rate is not supported so always use fastest transition time and ignore + // both the provided transition time as well as OnOffTransitionTime. + ChipLogProgress(Zcl, "Device does not support transition, ignoring rate"); + eventDuration = FASTEST_TRANSITION_TIME_MS; +#endif // IGNORE_LEVEL_CONTROL_CLUSTER_TRANSITION // Cancel any currently active command before fiddling with the state. cancelEndpointTimerCallback(endpoint); - status = Attributes::CurrentLevel::Get(endpoint, currentLevel); + state->eventDurationMs = eventDuration; + status = Attributes::CurrentLevel::Get(endpoint, currentLevel); if (status != Status::Success) { ChipLogProgress(Zcl, "ERR: reading current level %x", to_underlying(status)); @@ -1026,47 +1133,11 @@ static void moveHandler(app::CommandHandler * commandObj, const app::ConcreteCom } } -#ifndef IGNORE_LEVEL_CONTROL_CLUSTER_TRANSITION - // If the Rate field is null, the device should move at the default move rate, if available, - // Otherwise, move as fast as possible - if (rate.IsNull()) - { - app::DataModel::Nullable defaultMoveRate; - status = Attributes::DefaultMoveRate::Get(endpoint, defaultMoveRate); - if (status != Status::Success || defaultMoveRate.IsNull()) - { - ChipLogProgress(Zcl, "ERR: reading default move rate %x", to_underlying(status)); - state->eventDurationMs = FASTEST_TRANSITION_TIME_MS; - } - else - { - // nonsensical case, means "don't move", so we're done - if (defaultMoveRate.Value() == 0) - { - status = Status::Success; - goto send_default_response; - } - // Already checked that defaultMoveRate.Value() != 0. - state->eventDurationMs = MILLISECOND_TICKS_PER_SECOND / defaultMoveRate.Value(); - } - } - else - { - state->eventDurationMs = MILLISECOND_TICKS_PER_SECOND / std::max(static_cast(1u), rate.Value()); - } -#else - // Transition/rate is not supported so always use fastest transition time and ignore - // both the provided transition time as well as OnOffTransitionTime. - ChipLogProgress(Zcl, "Device does not support transition, ignoring rate"); - state->eventDurationMs = FASTEST_TRANSITION_TIME_MS; -#endif // IGNORE_LEVEL_CONTROL_CLUSTER_TRANSITION - state->transitionTimeMs = difference * state->eventDurationMs; state->elapsedTimeMs = 0; // storedLevel is not used for Move commands. - state->storedLevel = INVALID_STORED_LEVEL; - + state->storedLevel = INVALID_STORED_LEVEL; state->callbackSchedule.runTime = System::Clock::Milliseconds32(0); // The setup was successful, so mark the new state as active and return. @@ -1077,18 +1148,26 @@ static void moveHandler(app::CommandHandler * commandObj, const app::ConcreteCom commandObj->AddStatus(commandPath, status); } -static void stepHandler(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, StepModeEnum stepMode, - uint8_t stepSize, app::DataModel::Nullable transitionTimeDs, +static void stepHandler(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, StepModeEnum stepMode, + uint8_t stepSize, DataModel::Nullable transitionTimeDs, chip::Optional> optionsMask, chip::Optional> optionsOverride) { - EndpointId endpoint = commandPath.mEndpointId; - CommandId commandId = commandPath.mCommandId; - - EmberAfLevelControlState * state = getState(endpoint); Status status; - app::DataModel::Nullable currentLevel; + EmberAfLevelControlState * state; + DataModel::Nullable currentLevel; + + EndpointId endpoint = commandPath.mEndpointId; + CommandId commandId = commandPath.mCommandId; uint8_t actualStepSize = stepSize; + // Validate the received stepSize and stepMode first. + if (stepSize == 0 || stepMode == StepModeEnum::kUnknownEnumValue) + { + status = Status::InvalidCommand; + goto send_default_response; + } + + state = getState(endpoint); if (state == nullptr) { status = Status::Failure; @@ -1150,6 +1229,7 @@ static void stepHandler(app::CommandHandler * commandObj, const app::ConcreteCom } break; default: + // Should never happen as it is verified at function entry. status = Status::InvalidCommand; goto send_default_response; } @@ -1204,8 +1284,7 @@ static void stepHandler(app::CommandHandler * commandObj, const app::ConcreteCom state->elapsedTimeMs = 0; // storedLevel is not used for Step commands - state->storedLevel = INVALID_STORED_LEVEL; - + state->storedLevel = INVALID_STORED_LEVEL; state->callbackSchedule.runTime = System::Clock::Milliseconds32(0); // The setup was successful, so mark the new state as active and return. @@ -1216,14 +1295,13 @@ static void stepHandler(app::CommandHandler * commandObj, const app::ConcreteCom commandObj->AddStatus(commandPath, status); } -static void stopHandler(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, +static void stopHandler(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, chip::Optional> optionsMask, chip::Optional> optionsOverride) { - EndpointId endpoint = commandPath.mEndpointId; - CommandId commandId = commandPath.mCommandId; - + EndpointId endpoint = commandPath.mEndpointId; + CommandId commandId = commandPath.mCommandId; EmberAfLevelControlState * state = getState(endpoint); - Status status; + Status status = Status::Success; if (state == nullptr) { @@ -1233,14 +1311,13 @@ static void stopHandler(app::CommandHandler * commandObj, const app::ConcreteCom if (!shouldExecuteIfOff(endpoint, commandId, optionsMask, optionsOverride)) { - status = Status::Success; goto send_default_response; } // Cancel any currently active command. cancelEndpointTimerCallback(endpoint); + SetCurrentLevelQuietReport(endpoint, state, state->quietCurrentLevel.value(), true /*isStartOrEndOfTransition*/); writeRemainingTime(endpoint, 0); - status = Status::Success; send_default_response: commandObj->AddStatus(commandPath, status); @@ -1250,9 +1327,9 @@ static void stopHandler(app::CommandHandler * commandObj, const app::ConcreteCom // Quotes are from table 3.46. void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool newValue) { - app::DataModel::Nullable resolvedLevel; - app::DataModel::Nullable temporaryCurrentLevelCache; - app::DataModel::Nullable transitionTime; + DataModel::Nullable resolvedLevel; + DataModel::Nullable temporaryCurrentLevelCache; + DataModel::Nullable transitionTime; uint16_t currentOnOffTransitionTime; Status status; @@ -1333,7 +1410,7 @@ void emberAfOnOffClusterLevelControlEffectCallback(EndpointId endpoint, bool new { // If newValue is OnOff::Commands::On::Id... // "Set CurrentLevel to minimum level allowed for the device." - status = Attributes::CurrentLevel::Set(endpoint, minimumLevelAllowedForTheDevice); + status = SetCurrentLevelQuietReport(endpoint, state, minimumLevelAllowedForTheDevice, true /*isStartOrEndOfTransition*/); if (status != Status::Success) { ChipLogProgress(Zcl, "ERR: reading current level %x", to_underlying(status)); @@ -1376,6 +1453,9 @@ void emberAfLevelControlClusterServerInitCallback(EndpointId endpoint) return; } + state->quietRemainingTime.policy() + .Set(QuieterReportingPolicyEnum::kMarkDirtyOnIncrement) + .Set(QuieterReportingPolicyEnum::kMarkDirtyOnChangeToFromZero); state->minLevel = MATTER_DM_PLUGIN_LEVEL_CONTROL_MINIMUM_LEVEL; state->maxLevel = MATTER_DM_PLUGIN_LEVEL_CONTROL_MAXIMUM_LEVEL; @@ -1397,7 +1477,7 @@ void emberAfLevelControlClusterServerInitCallback(EndpointId endpoint) } } - app::DataModel::Nullable currentLevel; + DataModel::Nullable currentLevel; Status status = Attributes::CurrentLevel::Get(endpoint, currentLevel); if (status == Status::Success) { @@ -1418,7 +1498,7 @@ void emberAfLevelControlClusterServerInitCallback(EndpointId endpoint) // 0xFF Work Around ZAP Can't set default value to NULL // https://github.com/project-chip/zap/issues/354 - app::DataModel::Nullable startUpCurrentLevel; + DataModel::Nullable startUpCurrentLevel; status = Attributes::StartUpCurrentLevel::Get(endpoint, startUpCurrentLevel); if (status == Status::Success) { @@ -1448,25 +1528,24 @@ void emberAfLevelControlClusterServerInitCallback(EndpointId endpoint) } } // Otherwise Set the CurrentLevel attribute to its previous value which was already fetch above - - Attributes::CurrentLevel::Set(endpoint, currentLevel); + SetCurrentLevelQuietReport(endpoint, state, currentLevel, true /*isStartOrEndOfTransition*/); } } #endif // IGNORE_LEVEL_CONTROL_CLUSTER_START_UP_CURRENT_LEVEL // In any case, we make sure that the respects min/max if (currentLevel.IsNull() || currentLevel.Value() < state->minLevel) { - Attributes::CurrentLevel::Set(endpoint, state->minLevel); + SetCurrentLevelQuietReport(endpoint, state, state->minLevel, true /*isStartOrEndOfTransition*/); } else if (currentLevel.Value() > state->maxLevel) { - Attributes::CurrentLevel::Set(endpoint, state->maxLevel); + SetCurrentLevelQuietReport(endpoint, state, state->maxLevel, true /*isStartOrEndOfTransition*/); } } #if defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS // Registers Scene handlers for the level control cluster on the server - app::Clusters::ScenesManagement::ScenesServer::Instance().RegisterSceneHandler(endpoint, LevelControlServer::GetSceneHandler()); + Clusters::ScenesManagement::ScenesServer::Instance().RegisterSceneHandler(endpoint, LevelControlServer::GetSceneHandler()); #endif // defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS emberAfPluginLevelControlClusterServerPostInitCallback(endpoint); diff --git a/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp b/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp index d47742570ed2e0..49022891f0b1e9 100644 --- a/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp +++ b/src/app/clusters/microwave-oven-control-server/microwave-oven-control-server.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -53,7 +54,7 @@ Instance::Instance(Delegate * aDelegate, EndpointId aEndpointId, ClusterId aClus Instance::~Instance() { - InteractionModelEngine::GetInstance()->UnregisterCommandHandler(this); + CommandHandlerInterfaceRegistry::UnregisterCommandHandler(this); unregisterAttributeAccessOverride(this); } @@ -88,7 +89,7 @@ CHIP_ERROR Instance::Init() Zcl, "Microwave Oven Control: feature bits error, if feature supports PowerNumberLimits it must support PowerAsNumber")); - ReturnErrorOnFailure(InteractionModelEngine::GetInstance()->RegisterCommandHandler(this)); + ReturnErrorOnFailure(CommandHandlerInterfaceRegistry::RegisterCommandHandler(this)); VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); // If the PowerInWatts feature is supported, get the count of supported watt levels so we can later // ensure incoming watt level values are valid. diff --git a/src/app/clusters/mode-base-server/mode-base-server.cpp b/src/app/clusters/mode-base-server/mode-base-server.cpp index bb6aac6837c0bf..643dd3dd76bee2 100644 --- a/src/app/clusters/mode-base-server/mode-base-server.cpp +++ b/src/app/clusters/mode-base-server/mode-base-server.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -63,7 +64,7 @@ void Instance::Shutdown() return; } UnregisterThisInstance(); - chip::app::InteractionModelEngine::GetInstance()->UnregisterCommandHandler(this); + CommandHandlerInterfaceRegistry::UnregisterCommandHandler(this); unregisterAttributeAccessOverride(this); } @@ -77,7 +78,7 @@ CHIP_ERROR Instance::Init() LoadPersistentAttributes(); - ReturnErrorOnFailure(chip::app::InteractionModelEngine::GetInstance()->RegisterCommandHandler(this)); + ReturnErrorOnFailure(CommandHandlerInterfaceRegistry::RegisterCommandHandler(this)); VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); RegisterThisInstance(); ReturnErrorOnFailure(mDelegate->Init()); diff --git a/src/app/clusters/network-commissioning/network-commissioning.cpp b/src/app/clusters/network-commissioning/network-commissioning.cpp index f2e74033d8266c..2cfe46c70993dc 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.cpp +++ b/src/app/clusters/network-commissioning/network-commissioning.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -358,7 +358,7 @@ Instance::Instance(EndpointId aEndpointId, EthernetDriver * apDelegate) : CHIP_ERROR Instance::Init() { - ReturnErrorOnFailure(InteractionModelEngine::GetInstance()->RegisterCommandHandler(this)); + ReturnErrorOnFailure(CommandHandlerInterfaceRegistry::RegisterCommandHandler(this)); VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); ReturnErrorOnFailure(DeviceLayer::PlatformMgrImpl().AddEventHandler(OnPlatformEventHandler, reinterpret_cast(this))); ReturnErrorOnFailure(mpBaseDriver->Init(this)); diff --git a/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp b/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp index 50056387e3c359..4a3ba4103a0b0d 100644 --- a/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp +++ b/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020-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. @@ -16,12 +16,158 @@ */ #include "occupancy-sensor-server.h" +#include "occupancy-hal.h" -#include +#include +#include +#include +#include +#include +#include -#include "occupancy-hal.h" +using chip::Protocols::InteractionModel::Status; + +namespace chip { +namespace app { +namespace Clusters { +namespace OccupancySensing { + +namespace { +Structs::HoldTimeLimitsStruct::Type + sHoldTimeLimitsStructs[MATTER_DM_OCCUPANCY_SENSING_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT]; + +uint16_t sHoldTime[MATTER_DM_OCCUPANCY_SENSING_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT]; +} // namespace + +CHIP_ERROR OccupancySensingAttrAccess::Init() +{ + VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); + return CHIP_NO_ERROR; +} + +void OccupancySensingAttrAccess::Shutdown() +{ + unregisterAttributeAccessOverride(this); +} + +CHIP_ERROR OccupancySensingAttrAccess::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) +{ + VerifyOrDie(aPath.mClusterId == app::Clusters::OccupancySensing::Id); + + switch (aPath.mAttributeId) + { + case Attributes::FeatureMap::Id: + ReturnErrorOnFailure(aEncoder.Encode(mFeature)); + break; + case Attributes::HoldTime::Id: { + + uint16_t * holdTime = GetHoldTimeForEndpoint(aPath.mEndpointId); + + if (holdTime == nullptr) + { + return CHIP_ERROR_NOT_FOUND; + } + + return aEncoder.Encode(*holdTime); + } + case Attributes::HoldTimeLimits::Id: { + + Structs::HoldTimeLimitsStruct::Type * holdTimeLimitsStruct = GetHoldTimeLimitsForEndpoint(aPath.mEndpointId); + + if (holdTimeLimitsStruct == nullptr) + { + return CHIP_ERROR_NOT_FOUND; + } + + return aEncoder.Encode(*holdTimeLimitsStruct); + } + default: + return CHIP_NO_ERROR; + } + + return CHIP_NO_ERROR; +} + +bool OccupancySensingAttrAccess::HasFeature(Feature aFeature) const +{ + return mFeature.Has(aFeature); +} + +Structs::HoldTimeLimitsStruct::Type * GetHoldTimeLimitsForEndpoint(EndpointId endpoint) +{ + auto index = emberAfGetClusterServerEndpointIndex(endpoint, app::Clusters::OccupancySensing::Id, + MATTER_DM_OCCUPANCY_SENSING_CLUSTER_SERVER_ENDPOINT_COUNT); + + if (index == kEmberInvalidEndpointIndex) + { + return nullptr; + } + + if (index >= ArraySize(sHoldTimeLimitsStructs)) + { + ChipLogError(NotSpecified, "Internal error: invalid/unexpected hold time limits index."); + return nullptr; + } + return &sHoldTimeLimitsStructs[index]; +} + +CHIP_ERROR SetHoldTimeLimits(EndpointId endpointId, const Structs::HoldTimeLimitsStruct::Type & holdTimeLimits) +{ + + VerifyOrReturnError(kInvalidEndpointId != endpointId, CHIP_ERROR_INVALID_ARGUMENT); + + Structs::HoldTimeLimitsStruct::Type * holdTimeLimitsForEndpoint = GetHoldTimeLimitsForEndpoint(endpointId); + VerifyOrReturnError(holdTimeLimitsForEndpoint != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + + holdTimeLimitsForEndpoint->holdTimeMin = holdTimeLimits.holdTimeMin; + holdTimeLimitsForEndpoint->holdTimeMax = holdTimeLimits.holdTimeMax; + holdTimeLimitsForEndpoint->holdTimeDefault = holdTimeLimits.holdTimeDefault; + + MatterReportingAttributeChangeCallback(endpointId, OccupancySensing::Id, Attributes::HoldTimeLimits::Id); + + return CHIP_NO_ERROR; +} + +uint16_t * GetHoldTimeForEndpoint(EndpointId endpoint) +{ + auto index = emberAfGetClusterServerEndpointIndex(endpoint, app::Clusters::OccupancySensing::Id, + MATTER_DM_OCCUPANCY_SENSING_CLUSTER_SERVER_ENDPOINT_COUNT); + + if (index == kEmberInvalidEndpointIndex) + { + return nullptr; + } + + if (index >= ArraySize(sHoldTimeLimitsStructs)) + { + ChipLogError(NotSpecified, "Internal error: invalid/unexpected hold time index."); + return nullptr; + } + return &sHoldTime[index]; +} + +CHIP_ERROR SetHoldTime(EndpointId endpointId, const uint16_t & holdTime) +{ + VerifyOrReturnError(kInvalidEndpointId != endpointId, CHIP_ERROR_INVALID_ARGUMENT); + + uint16_t * holdTimeForEndpoint = GetHoldTimeForEndpoint(endpointId); + VerifyOrReturnError(holdTimeForEndpoint != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + + *holdTimeForEndpoint = holdTime; + + MatterReportingAttributeChangeCallback(endpointId, OccupancySensing::Id, Attributes::HoldTime::Id); + + return CHIP_NO_ERROR; +} + +} // namespace OccupancySensing +} // namespace Clusters +} // namespace app +} // namespace chip using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; using namespace chip::app::Clusters::OccupancySensing; //****************************************************************************** @@ -59,8 +205,6 @@ void emberAfOccupancySensingClusterServerInitCallback(EndpointId endpoint) break; } Attributes::OccupancySensorTypeBitmap::Set(endpoint, deviceTypeBitmap); - - emberAfPluginOccupancyClusterServerPostInitCallback(endpoint); } //****************************************************************************** @@ -82,8 +226,6 @@ void halOccupancyStateChangedCallback(EndpointId endpoint, HalOccupancyState occ Attributes::Occupancy::Set(endpoint, occupancyState); } -void emberAfPluginOccupancyClusterServerPostInitCallback(EndpointId endpoint) {} - HalOccupancySensorType __attribute__((weak)) halOccupancyGetSensorType(EndpointId endpoint) { return HAL_OCCUPANCY_SENSOR_TYPE_PIR; diff --git a/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.h b/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.h index 3ed762cbfb4013..f24c64f4dbfbb1 100644 --- a/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.h +++ b/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020-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. @@ -17,15 +17,48 @@ #pragma once +#include +#include +#include #include #include +#include +#include -/** @brief Occupancy Cluster Server Post Init - * - * Following resolution of the Occupancy state at startup for this endpoint, - * perform any additional initialization needed; e.g., synchronize hardware - * state. - * - * @param endpoint Endpoint that is being initialized Ver.: always - */ -void emberAfPluginOccupancyClusterServerPostInitCallback(chip::EndpointId endpoint); +namespace chip { +namespace app { +namespace Clusters { +namespace OccupancySensing { + +class OccupancySensingAttrAccess : public AttributeAccessInterface +{ +public: + OccupancySensingAttrAccess(BitMask aFeature) : + app::AttributeAccessInterface(Optional::Missing(), app::Clusters::OccupancySensing::Id), mFeature(aFeature) + {} + + ~OccupancySensingAttrAccess() { Shutdown(); } + + CHIP_ERROR Init(); + void Shutdown(); + + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; + + bool HasFeature(Feature aFeature) const; + +private: + BitMask mFeature; +}; + +CHIP_ERROR SetHoldTimeLimits(EndpointId endpointId, const Structs::HoldTimeLimitsStruct::Type & holdTimeLimits); + +CHIP_ERROR SetHoldTime(EndpointId endpointId, const uint16_t & holdTime); + +Structs::HoldTimeLimitsStruct::Type * GetHoldTimeLimitsForEndpoint(EndpointId endpoint); + +uint16_t * GetHoldTimeForEndpoint(EndpointId endpoint); + +} // namespace OccupancySensing +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp index c7e64cd7afc161..98dfaf9da02c3e 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -89,6 +89,12 @@ void UpdateModeBaseCurrentModeToOnMode(EndpointId endpoint) #endif // MATTER_DM_PLUGIN_MODE_BASE +template +bool IsKnownEnumValue(EnumType value) +{ + return (EnsureKnownEnumValue(value) != EnumType::kUnknownEnumValue); +} + } // namespace #ifdef MATTER_DM_PLUGIN_LEVEL_CONTROL @@ -150,7 +156,7 @@ class DefaultOnOffSceneHandler : public scenes::DefaultSceneHandlerImpl /// @return CHIP_NO_ERROR if successfully serialized the data, CHIP_ERROR_INVALID_ARGUMENT otherwise CHIP_ERROR SerializeSave(EndpointId endpoint, ClusterId cluster, MutableByteSpan & serializedBytes) override { - using AttributeValuePair = ScenesManagement::Structs::AttributeValuePair::Type; + using AttributeValuePair = ScenesManagement::Structs::AttributeValuePairStruct::Type; bool currentValue; // read current on/off value @@ -163,8 +169,8 @@ class DefaultOnOffSceneHandler : public scenes::DefaultSceneHandlerImpl AttributeValuePair pairs[scenableAttributeCount]; - pairs[0].attributeID = Attributes::OnOff::Id; - pairs[0].attributeValue = currentValue; + pairs[0].attributeID = Attributes::OnOff::Id; + pairs[0].valueUnsigned8.SetValue(currentValue); app::DataModel::List attributeValueList(pairs); @@ -180,7 +186,7 @@ class DefaultOnOffSceneHandler : public scenes::DefaultSceneHandlerImpl CHIP_ERROR ApplyScene(EndpointId endpoint, ClusterId cluster, const ByteSpan & serializedBytes, scenes::TransitionTimeMs timeMs) override { - app::DataModel::DecodableList attributeValueList; + app::DataModel::DecodableList attributeValueList; VerifyOrReturnError(cluster == OnOff::Id, CHIP_ERROR_INVALID_ARGUMENT); @@ -195,8 +201,9 @@ class DefaultOnOffSceneHandler : public scenes::DefaultSceneHandlerImpl { auto & decodePair = pair_iterator.GetValue(); VerifyOrReturnError(decodePair.attributeID == Attributes::OnOff::Id, CHIP_ERROR_INVALID_ARGUMENT); - ReturnErrorOnFailure( - mSceneEndpointStatePairs.InsertPair(OnOffEndPointPair(endpoint, static_cast(decodePair.attributeValue)))); + VerifyOrReturnError(decodePair.valueUnsigned8.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(mSceneEndpointStatePairs.InsertPair( + OnOffEndPointPair(endpoint, static_cast(decodePair.valueUnsigned8.Value())))); } // Verify that the EFS was completely read CHIP_ERROR err = pair_iterator.GetStatus(); @@ -206,19 +213,8 @@ class DefaultOnOffSceneHandler : public scenes::DefaultSceneHandlerImpl return err; } - // This handler assumes it is being used with the default handler for the level control. Therefore if the level control - // cluster with on off feature is present on the endpoint and the level control handler is registered, it assumes this - // handler will take action on the on-off state. This assumes the level control attributes were also saved in the scene. - // This is to prevent a behavior where the on off state is set by this handler, and then the level control handler or vice - // versa. -#ifdef MATTER_DM_PLUGIN_LEVEL_CONTROL - if (!(LevelControlWithOnOffFeaturePresent(endpoint) && - ScenesManagement::ScenesServer::Instance().IsHandlerRegistered(endpoint, LevelControlServer::GetSceneHandler()))) -#endif - { - VerifyOrReturnError(mTransitionTimeInterface.sceneEventControl(endpoint) != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - OnOffServer::Instance().scheduleTimerCallbackMs(mTransitionTimeInterface.sceneEventControl(endpoint), timeMs); - } + VerifyOrReturnError(mTransitionTimeInterface.sceneEventControl(endpoint) != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + OnOffServer::Instance().scheduleTimerCallbackMs(mTransitionTimeInterface.sceneEventControl(endpoint), timeMs); return CHIP_NO_ERROR; } @@ -608,6 +604,35 @@ bool OnOffServer::offWithEffectCommand(app::CommandHandler * commandObj, const a chip::EndpointId endpoint = commandPath.mEndpointId; Status status = Status::Success; + if (effectId != EffectIdentifierEnum::kUnknownEnumValue) + { + // Depending on effectId value, effectVariant enum type varies. + // The following check validates that effectVariant value is valid in relation to the applicable enum type. + // DelayedAllOffEffectVariantEnum or DyingLightEffectVariantEnum + if (effectId == EffectIdentifierEnum::kDelayedAllOff && + !IsKnownEnumValue(static_cast(effectVariant))) + { + // The server does not support the given variant, it SHALL use the default variant. + effectVariant = to_underlying(DelayedAllOffEffectVariantEnum::kDelayedOffFastFade); + } + else if (effectId == EffectIdentifierEnum::kDyingLight && + !IsKnownEnumValue(static_cast(effectVariant))) + { + // The server does not support the given variant, it SHALL use the default variant. + effectVariant = to_underlying(DyingLightEffectVariantEnum::kDyingLightFadeOff); + } + } + else + { + status = Status::ConstraintError; + } + + if (status != Status::Success) + { + commandObj->AddStatus(commandPath, status); + return true; + } + if (SupportsLightingApplications(endpoint)) { #ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT diff --git a/src/app/clusters/operational-state-server/operational-state-server.cpp b/src/app/clusters/operational-state-server/operational-state-server.cpp index 50b4cd0178a8af..c86de02bfab6ae 100644 --- a/src/app/clusters/operational-state-server/operational-state-server.cpp +++ b/src/app/clusters/operational-state-server/operational-state-server.cpp @@ -20,13 +20,16 @@ * @brief Implementation for the Operational State Server Cluster ***************************************************************************/ #include "operational-state-server.h" + #include #include #include +#include #include #include #include #include +#include using namespace chip; using namespace chip::app; @@ -41,13 +44,16 @@ Instance::Instance(Delegate * aDelegate, EndpointId aEndpointId, ClusterId aClus mDelegate(aDelegate), mEndpointId(aEndpointId), mClusterId(aClusterId) { mDelegate->SetInstance(this); + mCountdownTime.policy() + .Set(QuieterReportingPolicyEnum::kMarkDirtyOnIncrement) + .Set(QuieterReportingPolicyEnum::kMarkDirtyOnChangeToFromZero); } Instance::Instance(Delegate * aDelegate, EndpointId aEndpointId) : Instance(aDelegate, aEndpointId, OperationalState::Id) {} Instance::~Instance() { - InteractionModelEngine::GetInstance()->UnregisterCommandHandler(this); + CommandHandlerInterfaceRegistry::UnregisterCommandHandler(this); unregisterAttributeAccessOverride(this); } @@ -60,7 +66,7 @@ CHIP_ERROR Instance::Init() return CHIP_ERROR_INVALID_ARGUMENT; } - ReturnErrorOnFailure(InteractionModelEngine::GetInstance()->RegisterCommandHandler(this)); + ReturnErrorOnFailure(CommandHandlerInterfaceRegistry::RegisterCommandHandler(this)); VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); @@ -82,6 +88,7 @@ CHIP_ERROR Instance::SetCurrentPhase(const DataModel::Nullable & aPhase if (mCurrentPhase != oldPhase) { MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::CurrentPhase::Id); + UpdateCountdownTimeFromClusterLogic(); } return CHIP_NO_ERROR; } @@ -94,9 +101,11 @@ CHIP_ERROR Instance::SetOperationalState(uint8_t aOpState) return CHIP_ERROR_INVALID_ARGUMENT; } + bool countdownTimeUpdateNeeded = false; if (mOperationalError.errorStateID != to_underlying(ErrorStateEnum::kNoError)) { mOperationalError.Set(to_underlying(ErrorStateEnum::kNoError)); + countdownTimeUpdateNeeded = true; MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::OperationalError::Id); } @@ -105,6 +114,12 @@ CHIP_ERROR Instance::SetOperationalState(uint8_t aOpState) if (mOperationalState != oldState) { MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::OperationalState::Id); + countdownTimeUpdateNeeded = true; + } + + if (countdownTimeUpdateNeeded) + { + UpdateCountdownTimeFromClusterLogic(); } return CHIP_NO_ERROR; } @@ -141,6 +156,8 @@ void Instance::OnOperationalErrorDetected(const Structs::ErrorStateStruct::Type MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::OperationalError::Id); } + UpdateCountdownTimeFromClusterLogic(); + // Generate an ErrorDetected event GenericErrorEvent event(mClusterId, aError); EventNumber eventNumber; @@ -154,7 +171,7 @@ void Instance::OnOperationalErrorDetected(const Structs::ErrorStateStruct::Type void Instance::OnOperationCompletionDetected(uint8_t aCompletionErrorCode, const Optional> & aTotalOperationalTime, - const Optional> & aPausedTime) const + const Optional> & aPausedTime) { ChipLogDetail(Zcl, "OperationalStateServer: OnOperationCompletionDetected"); @@ -167,6 +184,8 @@ void Instance::OnOperationCompletionDetected(uint8_t aCompletionErrorCode, ChipLogError(Zcl, "OperationalStateServer: Failed to record OperationCompletion event: %" CHIP_ERROR_FORMAT, error.Format()); } + + UpdateCountdownTimeFromClusterLogic(); } void Instance::ReportOperationalStateListChange() @@ -177,6 +196,43 @@ void Instance::ReportOperationalStateListChange() void Instance::ReportPhaseListChange() { MatterReportingAttributeChangeCallback(ConcreteAttributePath(mEndpointId, mClusterId, Attributes::PhaseList::Id)); + UpdateCountdownTimeFromClusterLogic(); +} + +void Instance::UpdateCountdownTime(bool fromDelegate) +{ + app::DataModel::Nullable newCountdownTime = mDelegate->GetCountdownTime(); + auto now = System::SystemClock().GetMonotonicTimestamp(); + + bool markDirty = false; + + if (fromDelegate) + { + // Updates from delegate are reduce-reported to every 10s max (choice of this implementation), in addition + // to default change-from-null, change-from-zero and increment policy. + auto predicate = [](const decltype(mCountdownTime)::SufficientChangePredicateCandidate & candidate) -> bool { + if (candidate.lastDirtyValue.IsNull() || candidate.newValue.IsNull()) + { + return false; + } + + uint32_t lastDirtyValue = candidate.lastDirtyValue.Value(); + uint32_t newValue = candidate.newValue.Value(); + uint32_t kNumSecondsDeltaToReport = 10; + return (newValue < lastDirtyValue) && ((lastDirtyValue - newValue) > kNumSecondsDeltaToReport); + }; + markDirty = (mCountdownTime.SetValue(newCountdownTime, now, predicate) == AttributeDirtyState::kMustReport); + } + else + { + auto predicate = [](const decltype(mCountdownTime)::SufficientChangePredicateCandidate &) -> bool { return true; }; + markDirty = (mCountdownTime.SetValue(newCountdownTime, now, predicate) == AttributeDirtyState::kMustReport); + } + + if (markDirty) + { + MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::CountdownTime::Id); + } } bool Instance::IsSupportedPhase(uint8_t aPhase) @@ -268,6 +324,7 @@ void Instance::InvokeCommand(HandlerContext & handlerContext) ChipLogDetail(Zcl, "OperationalState: Entering handling derived cluster commands"); InvokeDerivedClusterCommand(handlerContext); + break; } } @@ -292,18 +349,18 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu } return err; }); + break; } - break; case OperationalState::Attributes::OperationalState::Id: { ReturnErrorOnFailure(aEncoder.Encode(GetCurrentOperationalState())); + break; } - break; case OperationalState::Attributes::OperationalError::Id: { ReturnErrorOnFailure(aEncoder.Encode(mOperationalError)); + break; } - break; case OperationalState::Attributes::PhaseList::Id: { @@ -330,18 +387,19 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu ReturnErrorOnFailure(encoder.Encode(phase2)); } }); + break; } - break; case OperationalState::Attributes::CurrentPhase::Id: { ReturnErrorOnFailure(aEncoder.Encode(GetCurrentPhase())); + break; } - break; case OperationalState::Attributes::CountdownTime::Id: { + // Read through to get value closest to reality. ReturnErrorOnFailure(aEncoder.Encode(mDelegate->GetCountdownTime())); + break; } - break; } return CHIP_NO_ERROR; } diff --git a/src/app/clusters/operational-state-server/operational-state-server.h b/src/app/clusters/operational-state-server/operational-state-server.h index c1640cb99e9ce7..56229c02541d60 100644 --- a/src/app/clusters/operational-state-server/operational-state-server.h +++ b/src/app/clusters/operational-state-server/operational-state-server.h @@ -22,6 +22,8 @@ #include #include #include +#include +#include namespace chip { namespace app { @@ -113,6 +115,12 @@ class Instance : public CommandHandlerInterface, public AttributeAccessInterface */ void GetCurrentOperationalError(GenericOperationalError & error) const; + /** + * @brief Whenever application delegate wants to possibly report a new updated time, + * call this method. The `GetCountdownTime()` method will be called on the delegate. + */ + void UpdateCountdownTimeFromDelegate() { UpdateCountdownTime(/* fromDelegate = */ true); } + // Event triggers /** * @brief Called when the Node detects a OperationalError has been raised. @@ -129,7 +137,7 @@ class Instance : public CommandHandlerInterface, public AttributeAccessInterface */ void OnOperationCompletionDetected(uint8_t aCompletionErrorCode, const Optional> & aTotalOperationalTime = NullOptional, - const Optional> & aPausedTime = NullOptional) const; + const Optional> & aPausedTime = NullOptional); // List change reporting /** @@ -192,6 +200,19 @@ class Instance : public CommandHandlerInterface, public AttributeAccessInterface */ virtual void InvokeDerivedClusterCommand(HandlerContext & handlerContext) { return; }; + /** + * Causes reporting/udpating of CountdownTime attribute from driver if sufficient changes have + * occurred (based on Q quality definition for operational state). Calls the Delegate::GetCountdownTime() method. + * + * @param fromDelegate true if the change notice was triggered by the delegate, false if internal to cluster logic. + */ + void UpdateCountdownTime(bool fromDelegate); + + /** + * @brief Whenever the cluster logic thinks time should be updated, call this. + */ + void UpdateCountdownTimeFromClusterLogic() { UpdateCountdownTime(/* fromDelegate=*/false); } + private: Delegate * mDelegate; @@ -202,6 +223,7 @@ class Instance : public CommandHandlerInterface, public AttributeAccessInterface app::DataModel::Nullable mCurrentPhase; uint8_t mOperationalState = 0; // assume 0 for now. GenericOperationalError mOperationalError = to_underlying(ErrorStateEnum::kNoError); + app::QuieterReportingAttribute mCountdownTime{ DataModel::NullNullable }; /** * This method is inherited from CommandHandlerInterface. @@ -262,9 +284,10 @@ class Delegate virtual ~Delegate() = default; /** - * Get the countdown time. - * NOTE: Changes to this attribute should not be reported. - * From the spec: Changes to this value SHALL NOT be reported in a subscription. + * Get the countdown time. This will get called on many edges such as + * commands to change operational state, or when the delegate deals with + * changes. Make sure it becomes null whenever it is appropriate. + * * @return The current countdown time. */ virtual app::DataModel::Nullable GetCountdownTime() = 0; diff --git a/src/app/clusters/resource-monitoring-server/resource-monitoring-server.cpp b/src/app/clusters/resource-monitoring-server/resource-monitoring-server.cpp index 25a0be188ad7af..4d1197a73b83b8 100644 --- a/src/app/clusters/resource-monitoring-server/resource-monitoring-server.cpp +++ b/src/app/clusters/resource-monitoring-server/resource-monitoring-server.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -58,7 +59,7 @@ Instance::Instance(Delegate * aDelegate, EndpointId aEndpointId, ClusterId aClus Instance::~Instance() { - InteractionModelEngine::GetInstance()->UnregisterCommandHandler(this); + CommandHandlerInterfaceRegistry::UnregisterCommandHandler(this); unregisterAttributeAccessOverride(this); } @@ -71,7 +72,7 @@ CHIP_ERROR Instance::Init() LoadPersistentAttributes(); - ReturnErrorOnFailure(chip::app::InteractionModelEngine::GetInstance()->RegisterCommandHandler(this)); + ReturnErrorOnFailure(CommandHandlerInterfaceRegistry::RegisterCommandHandler(this)); VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); ChipLogDetail(Zcl, "ResourceMonitoring: calling mDelegate->Init()"); ReturnErrorOnFailure(mDelegate->Init()); diff --git a/src/app/clusters/sample-mei-server/sample-mei-server.cpp b/src/app/clusters/sample-mei-server/sample-mei-server.cpp index afeca910b455fe..ac461aab008b45 100644 --- a/src/app/clusters/sample-mei-server/sample-mei-server.cpp +++ b/src/app/clusters/sample-mei-server/sample-mei-server.cpp @@ -6,9 +6,9 @@ #include #include #include +#include #include #include -#include #include #include #include @@ -30,7 +30,7 @@ void MatterSampleMeiPluginServerInitCallback() { ChipLogProgress(Zcl, "Sample MEI Init. Ep %d, Total Ep %u", MATTER_DM_SAMPLE_MEI_CLUSTER_SERVER_ENDPOINT_COUNT, static_cast(kNumSupportedEndpoints)); - ReturnOnFailure(InteractionModelEngine::GetInstance()->RegisterCommandHandler(&SampleMeiServer::Instance())); + ReturnOnFailure(CommandHandlerInterfaceRegistry::RegisterCommandHandler(&SampleMeiServer::Instance())); VerifyOrReturn(registerAttributeAccessOverride(&SampleMeiServer::Instance()), CHIP_ERROR_INCORRECT_STATE); } diff --git a/src/app/clusters/scenes-server/SceneHandlerImpl.h b/src/app/clusters/scenes-server/SceneHandlerImpl.h index 554ba2d7ad4893..88aa1350dfef43 100644 --- a/src/app/clusters/scenes-server/SceneHandlerImpl.h +++ b/src/app/clusters/scenes-server/SceneHandlerImpl.h @@ -36,8 +36,8 @@ class DefaultSceneHandlerImpl : public scenes::SceneHandler template using DecodableList = app::DataModel::DecodableList; - using AttributeValuePairType = app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type; - using AttributeValuePairDecodableType = app::Clusters::ScenesManagement::Structs::AttributeValuePair::DecodableType; + using AttributeValuePairType = app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type; + using AttributeValuePairDecodableType = app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::DecodableType; using ExtensionFieldSetDecodableType = app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::DecodableType; using ExtensionFieldSetType = app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type; diff --git a/src/app/clusters/scenes-server/scenes-server.cpp b/src/app/clusters/scenes-server/scenes-server.cpp index 860e29236fa868..7c215c20446948 100644 --- a/src/app/clusters/scenes-server/scenes-server.cpp +++ b/src/app/clusters/scenes-server/scenes-server.cpp @@ -17,10 +17,12 @@ */ #include "scenes-server.h" + #include #include #include #include +#include #include #include #include @@ -337,7 +339,7 @@ CHIP_ERROR ScenesServer::Init() // Prevents re-initializing VerifyOrReturnError(!mIsInitialized, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(chip::app::InteractionModelEngine::GetInstance()->RegisterCommandHandler(this)); + ReturnErrorOnFailure(chip::app::CommandHandlerInterfaceRegistry::RegisterCommandHandler(this)); VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); mGroupProvider = Credentials::GetGroupDataProvider(); @@ -351,7 +353,7 @@ CHIP_ERROR ScenesServer::Init() void ScenesServer::Shutdown() { - chip::app::InteractionModelEngine::GetInstance()->UnregisterCommandHandler(this); + chip::app::CommandHandlerInterfaceRegistry::UnregisterCommandHandler(this); mGroupProvider = nullptr; mIsInitialized = false; @@ -374,9 +376,10 @@ void AddSceneParse(CommandHandlerInterface::HandlerContext & ctx, const CommandD response.sceneID = req.sceneID; // Verify the attributes are respecting constraints - if (req.transitionTime > scenes::kScenesMaxTransitionTime || req.sceneName.size() > scenes::kSceneNameMaxLength) + if (req.transitionTime > scenes::kScenesMaxTransitionTime || req.sceneName.size() > scenes::kSceneNameMaxLength || + req.sceneID == scenes::kUndefinedSceneId) { - response.status = to_underlying(Protocols::InteractionModel::Status::InvalidCommand); + response.status = to_underlying(Protocols::InteractionModel::Status::ConstraintError); ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); return; } @@ -481,6 +484,14 @@ void ViewSceneParse(HandlerContext & ctx, const CommandData & req, GroupDataProv response.groupID = req.groupID; response.sceneID = req.sceneID; + // Verify the attributes are respecting constraints + if (req.sceneID == scenes::kUndefinedSceneId) + { + response.status = to_underlying(Protocols::InteractionModel::Status::ConstraintError); + ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); + return; + } + // Verify Endpoint in group VerifyOrReturn(nullptr != groupProvider); if (0 != req.groupID && @@ -828,6 +839,14 @@ void ScenesServer::HandleRemoveScene(HandlerContext & ctx, const Commands::Remov response.groupID = req.groupID; response.sceneID = req.sceneID; + // Verify the attributes are respecting constraints + if (req.sceneID == scenes::kUndefinedSceneId) + { + response.status = to_underlying(Protocols::InteractionModel::Status::ConstraintError); + ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); + return; + } + // Scene Table interface data SceneTableEntry scene(SceneStorageId(req.sceneID, req.groupID)); @@ -928,6 +947,14 @@ void ScenesServer::HandleStoreScene(HandlerContext & ctx, const Commands::StoreS response.groupID = req.groupID; response.sceneID = req.sceneID; + // Verify the attributes are respecting constraints + if (req.sceneID == scenes::kUndefinedSceneId) + { + response.status = to_underlying(Protocols::InteractionModel::Status::ConstraintError); + ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); + return; + } + CHIP_ERROR err = StoreSceneParse(ctx.mCommandHandler.GetAccessingFabricIndex(), ctx.mRequestPath.mEndpointId, req.groupID, req.sceneID, mGroupProvider); @@ -941,6 +968,14 @@ void ScenesServer::HandleStoreScene(HandlerContext & ctx, const Commands::StoreS void ScenesServer::HandleRecallScene(HandlerContext & ctx, const Commands::RecallScene::DecodableType & req) { MATTER_TRACE_SCOPE("RecallScene", "Scenes"); + + // Verify the attributes are respecting constraints + if (req.sceneID == scenes::kUndefinedSceneId) + { + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Protocols::InteractionModel::Status::ConstraintError); + return; + } + CHIP_ERROR err = RecallSceneParse(ctx.mCommandHandler.GetAccessingFabricIndex(), ctx.mRequestPath.mEndpointId, req.groupID, req.sceneID, req.transitionTime, mGroupProvider); @@ -1023,6 +1058,14 @@ void ScenesServer::HandleCopyScene(HandlerContext & ctx, const Commands::CopySce response.groupIdentifierFrom = req.groupIdentifierFrom; response.sceneIdentifierFrom = req.sceneIdentifierFrom; + // Verify the attributes are respecting constraints + if (req.sceneIdentifierFrom == scenes::kUndefinedSceneId || req.sceneIdentifierTo == scenes::kUndefinedSceneId) + { + response.status = to_underlying(Protocols::InteractionModel::Status::ResourceExhausted); + ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); + return; + } + // Verify Endpoint in group VerifyOrReturn(nullptr != mGroupProvider); if ((0 != req.groupIdentifierFrom && diff --git a/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp b/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp index 2c0d76f79b649b..e6bc0daac67668 100644 --- a/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp +++ b/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp @@ -24,9 +24,9 @@ #include #include #include +#include #include #include -#include #include #include #include @@ -231,5 +231,5 @@ bool emberAfSoftwareDiagnosticsClusterResetWatermarksCallback(app::CommandHandle void MatterSoftwareDiagnosticsPluginServerInitCallback() { registerAttributeAccessOverride(&gAttrAccess); - InteractionModelEngine::GetInstance()->RegisterCommandHandler(&gCommandHandler); + CommandHandlerInterfaceRegistry::RegisterCommandHandler(&gCommandHandler); } diff --git a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp new file mode 100644 index 00000000000000..dfc395f6bee81d --- /dev/null +++ b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp @@ -0,0 +1,155 @@ +/** + * + * 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 "PresetStructWithOwnedMembers.h" + +using namespace chip; +using namespace chip::app; +using namespace DataModel; +using namespace chip::app::Clusters::Thermostat::Structs; + +namespace chip { +namespace app { +namespace Clusters { +namespace Thermostat { + +PresetStructWithOwnedMembers::PresetStructWithOwnedMembers(const PresetStruct::Type & other) +{ + *this = other; +} + +void PresetStructWithOwnedMembers::operator=(const PresetStruct::Type & other) +{ + SetPresetScenario(other.presetScenario); + CHIP_ERROR err = SetPresetHandle(other.presetHandle); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Failed to set Preset handle with err %" CHIP_ERROR_FORMAT, err.Format()); + } + err = SetName(other.name); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Failed to set Preset name with err %" CHIP_ERROR_FORMAT, err.Format()); + } + SetCoolingSetpoint(other.coolingSetpoint); + SetHeatingSetpoint(other.heatingSetpoint); + SetBuiltIn(other.builtIn); +} + +void PresetStructWithOwnedMembers::SetPresetScenario(PresetScenarioEnum enumValue) +{ + presetScenario = enumValue; +} + +CHIP_ERROR PresetStructWithOwnedMembers::SetPresetHandle(const Nullable & newPresetHandle) +{ + if (!newPresetHandle.IsNull()) + { + size_t newPresetHandleSize = newPresetHandle.Value().size(); + if (newPresetHandleSize > kPresetHandleSize) + { + ChipLogError(Zcl, "Failed to set Preset handle. New preset handle size (%u) > allowed preset handle size (%u)", + static_cast(newPresetHandleSize), static_cast(kPresetNameSize)); + return CHIP_ERROR_NO_MEMORY; + } + MutableByteSpan targetSpan(presetHandleData); + ReturnErrorOnFailure(CopySpanToMutableSpan(newPresetHandle.Value(), targetSpan)); + presetHandle.SetNonNull(targetSpan); + } + else + { + presetHandle.SetNull(); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR PresetStructWithOwnedMembers::SetName(const Optional> & newName) +{ + if (newName.HasValue() && !newName.Value().IsNull()) + { + size_t newNameSize = newName.Value().Value().size(); + if (newNameSize > kPresetNameSize) + { + ChipLogError(Zcl, "Failed to set Preset name. New name size (%u) > allowed preset name size (%u)", + static_cast(newNameSize), static_cast(kPresetNameSize)); + return CHIP_ERROR_NO_MEMORY; + } + MutableCharSpan targetSpan(presetNameData); + CharSpan newNameSpan = newName.Value().Value(); + ReturnErrorOnFailure(CopyCharSpanToMutableCharSpan(newNameSpan, targetSpan)); + + DataModel::Nullable nullableCharSpan; + nullableCharSpan.SetNonNull(targetSpan); + name.SetValue(nullableCharSpan); + } + else + { + name.ClearValue(); + } + return CHIP_NO_ERROR; +} + +void PresetStructWithOwnedMembers::SetCoolingSetpoint(const Optional & newCoolingSetpoint) +{ + coolingSetpoint = newCoolingSetpoint; +} + +void PresetStructWithOwnedMembers::SetHeatingSetpoint(const Optional & newHeatingSetpoint) +{ + heatingSetpoint = newHeatingSetpoint; +} + +void PresetStructWithOwnedMembers::SetBuiltIn(DataModel::Nullable newBuiltIn) +{ + builtIn = newBuiltIn; +} + +PresetScenarioEnum PresetStructWithOwnedMembers::GetPresetScenario() const +{ + return presetScenario; +} + +DataModel::Nullable PresetStructWithOwnedMembers::GetPresetHandle() const +{ + return presetHandle; +} + +Optional> PresetStructWithOwnedMembers::GetName() const +{ + return name; +} + +Optional PresetStructWithOwnedMembers::GetCoolingSetpoint() const +{ + return coolingSetpoint; +} + +Optional PresetStructWithOwnedMembers::GetHeatingSetpoint() const +{ + return heatingSetpoint; +} + +DataModel::Nullable PresetStructWithOwnedMembers::GetBuiltIn() const +{ + return builtIn; +} + +} // namespace Thermostat +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h new file mode 100644 index 00000000000000..7161fb874989e2 --- /dev/null +++ b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h @@ -0,0 +1,72 @@ +/** + * + * 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. + */ + +/**************************************************************************** + * @file + * @brief This class has a struct PresetStructWithOwnedMembers that inherits from + * Structs::PresetStruct::Type and manages the storage of the preset handle + * member which it owns. + * + ******************************************************************************* + ******************************************************************************/ + +#pragma once + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace Thermostat { + +static constexpr size_t kPresetHandleSize = 16; + +static constexpr size_t kPresetNameSize = 64; + +struct PresetStructWithOwnedMembers : protected Structs::PresetStruct::Type +{ +public: + PresetStructWithOwnedMembers() = default; + PresetStructWithOwnedMembers(const Structs::PresetStruct::Type & other); + void operator=(const Structs::PresetStruct::Type & other); + + void SetPresetScenario(PresetScenarioEnum enumValue); + CHIP_ERROR SetPresetHandle(const DataModel::Nullable & newPresetHandle); + CHIP_ERROR SetName(const Optional> & newName); + void SetCoolingSetpoint(const Optional & newCoolingSetpoint); + void SetHeatingSetpoint(const Optional & newHeatingSetpoint); + void SetBuiltIn(DataModel::Nullable newBuiltIn); + + PresetScenarioEnum GetPresetScenario() const; + DataModel::Nullable GetPresetHandle() const; + Optional> GetName() const; + Optional GetCoolingSetpoint() const; + Optional GetHeatingSetpoint() const; + DataModel::Nullable GetBuiltIn() const; + + using Structs::PresetStruct::Type::Encode; + using Structs::PresetStruct::Type::kIsFabricScoped; + +private: + uint8_t presetHandleData[kPresetHandleSize] = { 0 }; + char presetNameData[kPresetNameSize]; +}; + +} // namespace Thermostat +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/thermostat-server/thermostat-delegate.h b/src/app/clusters/thermostat-server/thermostat-delegate.h new file mode 100644 index 00000000000000..86c1e532b92fc2 --- /dev/null +++ b/src/app/clusters/thermostat-server/thermostat-delegate.h @@ -0,0 +1,129 @@ +/** + * + * 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 "PresetStructWithOwnedMembers.h" +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace Thermostat { + +/** @brief + * Defines methods for implementing application-specific logic for handling Presets in the thermostat cluster. + * It defines the interfaces that a thermostat should implement to enable support for reading and writing the + * Presets attribute and reading and writing the ActivePresetHandle attribute. + */ +class Delegate +{ +public: + Delegate() = default; + + virtual ~Delegate() = default; + + /** + * @brief Get the preset type at a given index in the PresetTypes attribute + * + * @param[in] index The index of the preset type in the list. + * @param[out] presetType The preset type at the given index in the list. + * @return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED if the index is out of range for the preset types list. + */ + virtual CHIP_ERROR GetPresetTypeAtIndex(size_t index, Structs::PresetTypeStruct::Type & presetType) = 0; + + /** + * @brief Get the NumberOfPresets attribute value. + * + * @return The max number of presets supported. Return 0 if not set. + */ + virtual uint8_t GetNumberOfPresets() = 0; + + /** + * @brief Get the preset at a given index in the Presets attribute. + * + * @param[in] index The index of the preset in the list. + * @param[out] preset The PresetStructWithOwnedMembers struct that has the data from the preset + * at the given index in the Presets attribute list. + * @return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED if the index is out of range for the presets list. + */ + virtual CHIP_ERROR GetPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) = 0; + + /** + * @brief Get the ActivePresetHandle attribute value. + * + * @param[out] activePresetHandle The MutableByteSpan to copy the active preset handle into. On success, + * the callee must update the length to the length of the copied data. If the value of + * the attribute is null, the callee must set the MutableByteSpan to empty. + */ + virtual CHIP_ERROR GetActivePresetHandle(MutableByteSpan & activePresetHandle) = 0; + + /** + * @brief Set the ActivePresetHandle attribute value. + * + * @param[in] newActivePresetHandle The octet string to set the active preset handle to. + */ + virtual CHIP_ERROR SetActivePresetHandle(const DataModel::Nullable & newActivePresetHandle) = 0; + + /** + * @brief Appends a preset to the pending presets list maintained by the delegate. + * The delegate must ensure it makes a copy of the provided preset and the data + * of its preset handle, if any. For example, it could create a PresetStructWithOwnedMembers + * from the provided preset. + * + * @param[in] preset The preset to add to the list. + * + * @return CHIP_NO_ERROR if the preset was appended to the list successfully. + * @return CHIP_ERROR if there was an error adding the preset to the list. + */ + virtual CHIP_ERROR AppendToPendingPresetList(const Structs::PresetStruct::Type & preset) = 0; + + /** + * @brief Get the Preset at a given index in the pending presets list. + * + * @param[in] index The index of the preset in the list. + * @param[out] preset The PresetStructWithOwnedMembers struct that has the data from the pending preset + * list at the given index. + * @return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED if the index is out of range for the pending presets list. + */ + virtual CHIP_ERROR GetPendingPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) = 0; + + /** + * @brief Updates the presets attribute with the content of the pending presets list. If the preset in the pending presets list + * matches i.e. has the same presetHandle as an existing entry in the Presets attribute, the thermostat will update the entry + * with the new preset values, otherwise it will add a new preset to the Presets attribute. For new presets that get added, + * it is the responsibility of this API to allocate unique preset handles to the presets before saving the preset. This will be + * called when the Thermostat receives a CommitPresetsSchedulesRequest command to commit the pending preset changes. + * + * @return CHIP_NO_ERROR if the updates to the presets attribute has been committed successfully. + * @return CHIP_ERROR if the updates to the presets attribute failed to commit for some reason. + * + */ + virtual CHIP_ERROR ApplyPendingPresets() = 0; + + /** + * @brief Clears the pending presets list. + * + */ + virtual void ClearPendingPresetList() = 0; +}; + +} // namespace Thermostat +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index 214594667b9eb8..71c2f3d6fd6260 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -15,7 +15,9 @@ * limitations under the License. */ -#include +#include "thermostat-server.h" +#include "PresetStructWithOwnedMembers.h" + #include #include @@ -26,11 +28,13 @@ #include #include #include +#include using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::Thermostat; +using namespace chip::app::Clusters::Thermostat::Structs; using namespace chip::app::Clusters::Thermostat::Attributes; using imcode = Protocols::InteractionModel::Status; @@ -65,16 +69,645 @@ constexpr int8_t kDefaultDeadBand = 25; // 2.5C is the default namespace { -class ThermostatAttrAccess : public AttributeAccessInterface +ThermostatAttrAccess gThermostatAttrAccess; + +static_assert(kThermostatEndpointCount <= kEmberInvalidEndpointIndex, "Thermostat Delegate table size error"); + +Delegate * gDelegateTable[kThermostatEndpointCount] = { nullptr }; + +Delegate * GetDelegate(EndpointId endpoint) { -public: - ThermostatAttrAccess() : AttributeAccessInterface(Optional::Missing(), Thermostat::Id) {} + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= ArraySize(gDelegateTable) ? nullptr : gDelegateTable[ep]); +} - CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; - CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override; -}; +/** + * @brief Check if a preset is valid. + * + * @param[in] preset The preset to check. + * + * @return true If the preset is valid i.e the PresetHandle (if not null) fits within size constraints and the presetScenario enum + * value is valid. Otherwise, return false. + */ +bool IsValidPresetEntry(const PresetStruct::Type & preset) +{ + // Check that the preset handle is not too long. + if (!preset.presetHandle.IsNull() && preset.presetHandle.Value().size() > kPresetHandleSize) + { + return false; + } -ThermostatAttrAccess gThermostatAttrAccess; + // Ensure we have a valid PresetScenario. + return (preset.presetScenario != PresetScenarioEnum::kUnknownEnumValue); +} + +/** + * @brief Callback that is called when the timeout for editing the presets expires. + * + * @param[in] systemLayer The system layer. + * @param[in] callbackContext The context passed to the timer callback. + */ +void TimerExpiredCallback(System::Layer * systemLayer, void * callbackContext) +{ + EndpointId endpoint = static_cast(reinterpret_cast(callbackContext)); + + Delegate * delegate = GetDelegate(endpoint); + VerifyOrReturn(delegate != nullptr, ChipLogError(Zcl, "Delegate is null. Unable to handle timer expired")); + + delegate->ClearPendingPresetList(); + gThermostatAttrAccess.SetPresetsEditable(endpoint, false); +} + +/** + * @brief Schedules a timer for the given timeout in seconds. + * + * @param[in] endpoint The endpoint to use. + * @param[in] timeoutSeconds The timeout in seconds. + */ +void ScheduleTimer(EndpointId endpoint, uint16_t timeoutSeconds) +{ + DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds16(timeoutSeconds), TimerExpiredCallback, + reinterpret_cast(static_cast(endpoint))); +} + +/** + * @brief Clears the currently scheduled timer. + * + * @param[in] endpoint The endpoint to use. + */ +void ClearTimer(EndpointId endpoint) +{ + DeviceLayer::SystemLayer().CancelTimer(TimerExpiredCallback, reinterpret_cast(static_cast(endpoint))); +} + +/** + * @brief Extends the currently scheduled timer to a new timeout value in seconds + * + * @param[in] endpoint The endpoint to use. + * @param[in] timeoutSeconds The timeout in seconds to extend the timer to. + */ +void ExtendTimer(EndpointId endpoint, uint16_t timeoutSeconds) +{ + DeviceLayer::SystemLayer().ExtendTimerTo(System::Clock::Seconds16(timeoutSeconds), TimerExpiredCallback, + reinterpret_cast(static_cast(endpoint))); +} + +/** + * @brief Checks if the preset is built-in + * + * @param[in] preset The preset to check. + * + * @return true If the preset is built-in, false otherwise. + */ +bool IsBuiltIn(const PresetStructWithOwnedMembers & preset) +{ + return preset.GetBuiltIn().ValueOr(false); +} + +/** + * @brief Checks if the presets are matching i.e the presetHandles are the same. + * + * @param[in] preset The preset to check. + * @param[in] presetToMatch The preset to match with. + * + * @return true If the presets match, false otherwise. If both preset handles are null, returns false + */ +bool PresetHandlesExistAndMatch(const PresetStructWithOwnedMembers & preset, const PresetStructWithOwnedMembers & presetToMatch) +{ + return !preset.GetPresetHandle().IsNull() && !presetToMatch.GetPresetHandle().IsNull() && + preset.GetPresetHandle().Value().data_equal(presetToMatch.GetPresetHandle().Value()); +} + +/** + * @brief Get the source scoped node id. + * + * @param[in] commandObj The command handler object. + * + * @return The scoped node id of the source node. If the scoped node id is not retreived, return ScopedNodeId(). + */ +ScopedNodeId GetSourceScopedNodeId(CommandHandler * commandObj) +{ + ScopedNodeId sourceNodeId = ScopedNodeId(); + auto sessionHandle = commandObj->GetExchangeContext()->GetSessionHandle(); + + if (sessionHandle->IsSecureSession()) + { + sourceNodeId = sessionHandle->AsSecureSession()->GetPeer(); + } + else if (sessionHandle->IsGroupSession()) + { + sourceNodeId = sessionHandle->AsIncomingGroupSession()->GetPeer(); + } + return sourceNodeId; +} + +/** + * @brief Utility to clean up state by clearing the pending presets list, canceling the timer + * and setting PresetsEditable to false and clear the originator scoped node id. + * + * @param[in] delegate The delegate to use. + * @param[in] endpoint The endpoint to use. + */ +void CleanUp(Delegate * delegate, EndpointId endpoint) +{ + if (delegate != nullptr) + { + delegate->ClearPendingPresetList(); + } + ClearTimer(endpoint); + gThermostatAttrAccess.SetPresetsEditable(endpoint, false); + gThermostatAttrAccess.SetOriginatorScopedNodeId(endpoint, ScopedNodeId()); +} + +/** + * @brief Sends a response for the command and cleans up state by calling CleanUp() + * + * @param[in] delegate The delegate to use. + * @param[in] endpoint The endpoint to use. + * @param[in] commandObj The command handler to use to add the status response. + * @param[in] commandPath The command path. + * @param[in] status The status code to send as the response. + * + * @return true to indicate the response has been sent and command has been handled. + */ +bool SendResponseAndCleanUp(Delegate * delegate, EndpointId endpoint, CommandHandler * commandObj, + const ConcreteCommandPath & commandPath, imcode status) +{ + commandObj->AddStatus(commandPath, status); + CleanUp(delegate, endpoint); + return true; +} + +/** + * @brief Finds an entry in the pending presets list that matches a preset. + * The presetHandle of the two presets must match. + * + * @param[in] delegate The delegate to use. + * @param[in] presetToMatch The preset to match with. + * + * @return true if a matching entry was found in the pending presets list, false otherwise. + */ +bool MatchingPendingPresetExists(Delegate * delegate, const PresetStructWithOwnedMembers & presetToMatch) +{ + VerifyOrReturnValue(delegate != nullptr, false); + + for (uint8_t i = 0; true; i++) + { + PresetStructWithOwnedMembers preset; + CHIP_ERROR err = delegate->GetPendingPresetAtIndex(i, preset); + + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "MatchingPendingPresetExists: GetPendingPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, + err.Format()); + return false; + } + + if (PresetHandlesExistAndMatch(preset, presetToMatch)) + { + return true; + } + } + return false; +} + +/** + * @brief Finds and returns an entry in the Presets attribute list that matches a preset. + * The presetHandle of the two presets must match. + * + * @param[in] delegate The delegate to use. + * @param[in] presetToMatch The preset to match with. + * @param[out] matchingPreset The preset in the Presets attribute list that has the same PresetHandle as the presetToMatch. + * + * @return true if a matching entry was found in the presets attribute list, false otherwise. + */ +bool GetMatchingPresetInPresets(Delegate * delegate, const PresetStructWithOwnedMembers & presetToMatch, + PresetStructWithOwnedMembers & matchingPreset) +{ + VerifyOrReturnValue(delegate != nullptr, false); + + for (uint8_t i = 0; true; i++) + { + CHIP_ERROR err = delegate->GetPresetAtIndex(i, matchingPreset); + + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "GetMatchingPresetInPresets: GetPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); + return false; + } + + if (PresetHandlesExistAndMatch(matchingPreset, presetToMatch)) + { + return true; + } + } + return false; +} + +/** + * @brief Checks if the given preset handle is present in the presets attribute + * @param[in] delegate The delegate to use. + * @param[in] presetHandleToMatch The preset handle to match with. + * + * @return true if the given preset handle is present in the presets attribute list, false otherwise. + */ +bool IsPresetHandlePresentInPresets(Delegate * delegate, const ByteSpan & presetHandleToMatch) +{ + VerifyOrReturnValue(delegate != nullptr, false); + + PresetStructWithOwnedMembers matchingPreset; + for (uint8_t i = 0; true; i++) + { + CHIP_ERROR err = delegate->GetPresetAtIndex(i, matchingPreset); + + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + return false; + } + + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "IsPresetHandlePresentInPresets: GetPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, + err.Format()); + return false; + } + + if (!matchingPreset.GetPresetHandle().IsNull() && matchingPreset.GetPresetHandle().Value().data_equal(presetHandleToMatch)) + { + return true; + } + } + return false; +} + +/** + * @brief Returns the length of the list of presets if the pending presets were to be applied. The calculation is done by + * adding the number of presets in Presets attribute list to the number of pending presets in the pending + * presets list and subtracting the number of duplicate presets. This is called before changes are actually applied. + * + * @param[in] delegate The delegate to use. + * + * @return count of the updated Presets attribute if the pending presets were applied to it. Return 0 for error cases. + */ +uint8_t CountUpdatedPresetsAfterApplyingPendingPresets(Delegate * delegate) +{ + uint8_t numberOfPresets = 0; + uint8_t numberOfMatches = 0; + uint8_t numberOfPendingPresets = 0; + + VerifyOrReturnValue(delegate != nullptr, 0); + + for (uint8_t i = 0; true; i++) + { + PresetStructWithOwnedMembers preset; + CHIP_ERROR err = delegate->GetPresetAtIndex(i, preset); + + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "GetUpdatedPresetsCount: GetPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); + return 0; + } + numberOfPresets++; + + bool found = MatchingPendingPresetExists(delegate, preset); + + if (found) + { + numberOfMatches++; + } + } + + for (uint8_t i = 0; true; i++) + { + PresetStructWithOwnedMembers pendingPreset; + CHIP_ERROR err = delegate->GetPendingPresetAtIndex(i, pendingPreset); + + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "GetUpdatedPresetsCount: GetPendingPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, + err.Format()); + return 0; + } + numberOfPendingPresets++; + } + + // TODO: #34546 - Need to support deletion of presets that are removed from Presets. + // This API needs to modify its logic for the deletion case. + return static_cast(numberOfPresets + numberOfPendingPresets - numberOfMatches); +} + +/** + * @brief Checks if the presetScenario is present in the PresetTypes attribute. + * + * @param[in] delegate The delegate to use. + * @param[in] presetScenario The presetScenario to match with. + * + * @return true if the presetScenario is found, false otherwise. + */ +bool PresetScenarioExistsInPresetTypes(Delegate * delegate, PresetScenarioEnum presetScenario) +{ + VerifyOrReturnValue(delegate != nullptr, false); + + for (uint8_t i = 0; true; i++) + { + PresetTypeStruct::Type presetType; + auto err = delegate->GetPresetTypeAtIndex(i, presetType); + if (err != CHIP_NO_ERROR) + { + return false; + } + + if (presetType.presetScenario == presetScenario) + { + return true; + } + } + return false; +} + +/** + * @brief Returns the count of preset entries in the pending presets list that have the matching presetHandle. + * @param[in] delegate The delegate to use. + * @param[in] presetHandleToMatch The preset handle to match. + * + * @return count of the number of presets found with the matching presetHandle. Returns 0 if no matching presets were found. + */ +uint8_t CountPresetsInPendingListWithPresetHandle(Delegate * delegate, const ByteSpan & presetHandleToMatch) +{ + uint8_t count = 0; + VerifyOrReturnValue(delegate != nullptr, count); + + for (uint8_t i = 0; true; i++) + { + PresetStructWithOwnedMembers preset; + auto err = delegate->GetPendingPresetAtIndex(i, preset); + if (err != CHIP_NO_ERROR) + { + return count; + } + + DataModel::Nullable presetHandle = preset.GetPresetHandle(); + if (!presetHandle.IsNull() && presetHandle.Value().data_equal(presetHandleToMatch)) + { + count++; + } + } + return count; +} + +/** + * @brief Checks if the presetType for the given preset scenario supports name in the presetTypeFeatures bitmap. + * + * @param[in] delegate The delegate to use. + * @param[in] presetScenario The presetScenario to match with. + * + * @return true if the presetType for the given preset scenario supports name, false otherwise. + */ +bool PresetTypeSupportsNames(Delegate * delegate, PresetScenarioEnum scenario) +{ + VerifyOrReturnValue(delegate != nullptr, false); + + for (uint8_t i = 0; true; i++) + { + PresetTypeStruct::Type presetType; + auto err = delegate->GetPresetTypeAtIndex(i, presetType); + if (err != CHIP_NO_ERROR) + { + return false; + } + + if (presetType.presetScenario == scenario) + { + return (presetType.presetTypeFeatures.Has(PresetTypeFeaturesBitmap::kSupportsNames)); + } + } + return false; +} + +int16_t EnforceHeatingSetpointLimits(int16_t HeatingSetpoint, EndpointId endpoint) +{ + // Optional Mfg supplied limits + int16_t AbsMinHeatSetpointLimit = kDefaultAbsMinHeatSetpointLimit; + int16_t AbsMaxHeatSetpointLimit = kDefaultAbsMaxHeatSetpointLimit; + + // Optional User supplied limits + int16_t MinHeatSetpointLimit = kDefaultMinHeatSetpointLimit; + int16_t MaxHeatSetpointLimit = kDefaultMaxHeatSetpointLimit; + + // Attempt to read the setpoint limits + // Absmin/max are manufacturer limits + // min/max are user imposed min/max + + // Note that the limits are initialized above per the spec limits + // if they are not present Get() will not update the value so the defaults are used + imcode status; + + // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3724 + // behavior is not specified when Abs * values are not present and user values are present + // implemented behavior accepts the user values without regard to default Abs values. + + // Per global matter data model policy + // if a attribute is not present then it's default shall be used. + + status = AbsMinHeatSetpointLimit::Get(endpoint, &AbsMinHeatSetpointLimit); + if (status != imcode::Success) + { + ChipLogError(Zcl, "Warning: AbsMinHeatSetpointLimit missing using default"); + } + + status = AbsMaxHeatSetpointLimit::Get(endpoint, &AbsMaxHeatSetpointLimit); + if (status != imcode::Success) + { + ChipLogError(Zcl, "Warning: AbsMaxHeatSetpointLimit missing using default"); + } + status = MinHeatSetpointLimit::Get(endpoint, &MinHeatSetpointLimit); + if (status != imcode::Success) + { + MinHeatSetpointLimit = AbsMinHeatSetpointLimit; + } + + status = MaxHeatSetpointLimit::Get(endpoint, &MaxHeatSetpointLimit); + if (status != imcode::Success) + { + MaxHeatSetpointLimit = AbsMaxHeatSetpointLimit; + } + + // Make sure the user imposed limits are within the manufacturer imposed limits + + // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3725 + // Spec does not specify the behavior is the requested setpoint exceeds the limit allowed + // This implementation clamps at the limit. + + // resolution of 3725 is to clamp. + + if (MinHeatSetpointLimit < AbsMinHeatSetpointLimit) + MinHeatSetpointLimit = AbsMinHeatSetpointLimit; + + if (MaxHeatSetpointLimit > AbsMaxHeatSetpointLimit) + MaxHeatSetpointLimit = AbsMaxHeatSetpointLimit; + + if (HeatingSetpoint < MinHeatSetpointLimit) + HeatingSetpoint = MinHeatSetpointLimit; + + if (HeatingSetpoint > MaxHeatSetpointLimit) + HeatingSetpoint = MaxHeatSetpointLimit; + + return HeatingSetpoint; +} + +int16_t EnforceCoolingSetpointLimits(int16_t CoolingSetpoint, EndpointId endpoint) +{ + // Optional Mfg supplied limits + int16_t AbsMinCoolSetpointLimit = kDefaultAbsMinCoolSetpointLimit; + int16_t AbsMaxCoolSetpointLimit = kDefaultAbsMaxCoolSetpointLimit; + + // Optional User supplied limits + int16_t MinCoolSetpointLimit = kDefaultMinCoolSetpointLimit; + int16_t MaxCoolSetpointLimit = kDefaultMaxCoolSetpointLimit; + + // Attempt to read the setpoint limits + // Absmin/max are manufacturer limits + // min/max are user imposed min/max + + // Note that the limits are initialized above per the spec limits + // if they are not present Get() will not update the value so the defaults are used + imcode status; + + // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3724 + // behavior is not specified when Abs * values are not present and user values are present + // implemented behavior accepts the user values without regard to default Abs values. + + // Per global matter data model policy + // if a attribute is not present then it's default shall be used. + + status = AbsMinCoolSetpointLimit::Get(endpoint, &AbsMinCoolSetpointLimit); + if (status != imcode::Success) + { + ChipLogError(Zcl, "Warning: AbsMinCoolSetpointLimit missing using default"); + } + + status = AbsMaxCoolSetpointLimit::Get(endpoint, &AbsMaxCoolSetpointLimit); + if (status != imcode::Success) + { + ChipLogError(Zcl, "Warning: AbsMaxCoolSetpointLimit missing using default"); + } + + status = MinCoolSetpointLimit::Get(endpoint, &MinCoolSetpointLimit); + if (status != imcode::Success) + { + MinCoolSetpointLimit = AbsMinCoolSetpointLimit; + } + + status = MaxCoolSetpointLimit::Get(endpoint, &MaxCoolSetpointLimit); + if (status != imcode::Success) + { + MaxCoolSetpointLimit = AbsMaxCoolSetpointLimit; + } + + // Make sure the user imposed limits are within the manufacture imposed limits + // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3725 + // Spec does not specify the behavior is the requested setpoint exceeds the limit allowed + // This implementation clamps at the limit. + + // resolution of 3725 is to clamp. + + if (MinCoolSetpointLimit < AbsMinCoolSetpointLimit) + MinCoolSetpointLimit = AbsMinCoolSetpointLimit; + + if (MaxCoolSetpointLimit > AbsMaxCoolSetpointLimit) + MaxCoolSetpointLimit = AbsMaxCoolSetpointLimit; + + if (CoolingSetpoint < MinCoolSetpointLimit) + CoolingSetpoint = MinCoolSetpointLimit; + + if (CoolingSetpoint > MaxCoolSetpointLimit) + CoolingSetpoint = MaxCoolSetpointLimit; + + return CoolingSetpoint; +} + +} // anonymous namespace + +namespace chip { +namespace app { +namespace Clusters { +namespace Thermostat { + +void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) +{ + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + // if endpoint is found, add the delegate in the delegate table + if (ep < ArraySize(gDelegateTable)) + { + gDelegateTable[ep] = delegate; + } +} + +void ThermostatAttrAccess::SetPresetsEditable(EndpointId endpoint, bool presetEditable) +{ + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + + if (ep < ArraySize(mPresetsEditables)) + { + mPresetsEditables[ep] = presetEditable; + } +} + +bool ThermostatAttrAccess::GetPresetsEditable(EndpointId endpoint) +{ + bool presetEditable = false; + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + + if (ep < ArraySize(mPresetsEditables)) + { + presetEditable = mPresetsEditables[ep]; + } + return presetEditable; +} + +void ThermostatAttrAccess::SetOriginatorScopedNodeId(EndpointId endpoint, ScopedNodeId originatorNodeId) +{ + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + + if (ep < ArraySize(mPresetEditRequestOriginatorNodeIds)) + { + mPresetEditRequestOriginatorNodeIds[ep] = originatorNodeId; + } +} + +ScopedNodeId ThermostatAttrAccess::GetOriginatorScopedNodeId(EndpointId endpoint) +{ + ScopedNodeId originatorNodeId = ScopedNodeId(); + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + + if (ep < ArraySize(mPresetEditRequestOriginatorNodeIds)) + { + originatorNodeId = mPresetEditRequestOriginatorNodeIds[ep]; + } + return originatorNodeId; +} CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) { @@ -84,34 +717,95 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A bool localTemperatureNotExposedSupported = (FeatureMap::Get(aPath.mEndpointId, &ourFeatureMap) == imcode::Success) && ((ourFeatureMap & to_underlying(Feature::kLocalTemperatureNotExposed)) != 0); - switch (aPath.mAttributeId) - { - case LocalTemperature::Id: - if (localTemperatureNotExposedSupported) + switch (aPath.mAttributeId) + { + case LocalTemperature::Id: + if (localTemperatureNotExposedSupported) + { + return aEncoder.EncodeNull(); + } + break; + case RemoteSensing::Id: + if (localTemperatureNotExposedSupported) + { + BitMask valueRemoteSensing; + imcode status = RemoteSensing::Get(aPath.mEndpointId, &valueRemoteSensing); + if (status != imcode::Success) + { + StatusIB statusIB(status); + return statusIB.ToChipError(); + } + valueRemoteSensing.Clear(RemoteSensingBitmap::kLocalTemperature); + return aEncoder.Encode(valueRemoteSensing); + } + break; + case PresetTypes::Id: { + Delegate * delegate = GetDelegate(aPath.mEndpointId); + VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); + + return aEncoder.EncodeList([delegate](const auto & encoder) -> CHIP_ERROR { + for (uint8_t i = 0; true; i++) + { + PresetTypeStruct::Type presetType; + auto err = delegate->GetPresetTypeAtIndex(i, presetType); + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + return CHIP_NO_ERROR; + } + ReturnErrorOnFailure(err); + ReturnErrorOnFailure(encoder.Encode(presetType)); + } + }); + } + break; + case NumberOfPresets::Id: { + Delegate * delegate = GetDelegate(aPath.mEndpointId); + VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); + + ReturnErrorOnFailure(aEncoder.Encode(delegate->GetNumberOfPresets())); + } + break; + case Presets::Id: { + Delegate * delegate = GetDelegate(aPath.mEndpointId); + VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); + + return aEncoder.EncodeList([delegate](const auto & encoder) -> CHIP_ERROR { + for (uint8_t i = 0; true; i++) + { + PresetStructWithOwnedMembers preset; + auto err = delegate->GetPresetAtIndex(i, preset); + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + return CHIP_NO_ERROR; + } + ReturnErrorOnFailure(err); + ReturnErrorOnFailure(encoder.Encode(preset)); + } + }); + } + break; + case PresetsSchedulesEditable::Id: { + ReturnErrorOnFailure(aEncoder.Encode(GetPresetsEditable(aPath.mEndpointId))); + } + break; + case ActivePresetHandle::Id: { + Delegate * delegate = GetDelegate(aPath.mEndpointId); + VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); + + uint8_t buffer[kPresetHandleSize]; + MutableByteSpan activePresetHandle(buffer); + + CHIP_ERROR err = delegate->GetActivePresetHandle(activePresetHandle); + ReturnErrorOnFailure(err); + + if (activePresetHandle.empty()) { - return aEncoder.EncodeNull(); + ReturnErrorOnFailure(aEncoder.EncodeNull()); } - break; - case RemoteSensing::Id: - if (localTemperatureNotExposedSupported) + else { - BitMask valueRemoteSensing; - imcode status = RemoteSensing::Get(aPath.mEndpointId, &valueRemoteSensing); - if (status != imcode::Success) - { - StatusIB statusIB(status); - return statusIB.ToChipError(); - } - valueRemoteSensing.Clear(RemoteSensingBitmap::kLocalTemperature); - return aEncoder.Encode(valueRemoteSensing); + ReturnErrorOnFailure(aEncoder.Encode(activePresetHandle)); } - break; - case PresetTypes::Id: { - return aEncoder.EncodeList([](const auto & encoder) -> CHIP_ERROR { return CHIP_NO_ERROR; }); - } - break; - case Presets::Id: { - return aEncoder.EncodeList([](const auto & encoder) -> CHIP_ERROR { return CHIP_NO_ERROR; }); } break; case ScheduleTypes::Id: { @@ -122,10 +816,6 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A return aEncoder.EncodeList([](const auto & encoder) -> CHIP_ERROR { return CHIP_NO_ERROR; }); } break; - case QueuedPreset::Id: { - DataModel::Nullable value; - return aEncoder.Encode(value); - } default: // return CHIP_NO_ERROR and just read from the attribute store in default break; } @@ -158,15 +848,73 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, } break; case Presets::Id: { - return CHIP_ERROR_NOT_IMPLEMENTED; - } - break; - case Schedules::Id: { - return CHIP_ERROR_NOT_IMPLEMENTED; + EndpointId endpoint = aPath.mEndpointId; + Delegate * delegate = GetDelegate(endpoint); + VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); + + // Presets are not editable, return INVALID_IN_STATE. + VerifyOrReturnError(GetPresetsEditable(endpoint), CHIP_IM_GLOBAL_STATUS(InvalidInState), + ChipLogError(Zcl, "Presets are not editable")); + + // Check if the OriginatorScopedNodeId at the endpoint is the same as the node editing the presets, + // otherwise return BUSY. + const Access::SubjectDescriptor subjectDescriptor = aDecoder.GetSubjectDescriptor(); + ScopedNodeId scopedNodeId = ScopedNodeId(); + + // Get the node id if the authentication mode is CASE. + if (subjectDescriptor.authMode == Access::AuthMode::kCase) + { + scopedNodeId = ScopedNodeId(subjectDescriptor.subject, subjectDescriptor.fabricIndex); + } + + if (GetOriginatorScopedNodeId(endpoint) != scopedNodeId) + { + ChipLogError(Zcl, "Another node is editing presets. Server is busy. Try again later"); + return CHIP_IM_GLOBAL_STATUS(Busy); + } + + // If the list operation is replace all, clear the existing pending list, iterate over the new presets list + // and add to the pending presets list. + if (!aPath.IsListOperation() || aPath.mListOp == ConcreteDataAttributePath::ListOperation::ReplaceAll) + { + // Clear the pending presets list + delegate->ClearPendingPresetList(); + + Presets::TypeInfo::DecodableType newPresetsList; + ReturnErrorOnFailure(aDecoder.Decode(newPresetsList)); + + // Iterate over the presets and call the delegate to append to the list of pending presets. + auto iter = newPresetsList.begin(); + while (iter.Next()) + { + const PresetStruct::Type & preset = iter.GetValue(); + if (IsValidPresetEntry(preset)) + { + ReturnErrorOnFailure(delegate->AppendToPendingPresetList(preset)); + } + else + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + } + return iter.GetStatus(); + } + + // If the list operation is AppendItem, call the delegate to append the item to the list of pending presets. + if (aPath.mListOp == ConcreteDataAttributePath::ListOperation::AppendItem) + { + PresetStruct::Type preset; + ReturnErrorOnFailure(aDecoder.Decode(preset)); + if (IsValidPresetEntry(preset)) + { + return delegate->AppendToPendingPresetList(preset); + } + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } } break; - case QueuedPreset::Id: { + case Schedules::Id: { return CHIP_ERROR_NOT_IMPLEMENTED; } break; @@ -177,7 +925,10 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, return CHIP_NO_ERROR; } -} // anonymous namespace +} // namespace Thermostat +} // namespace Clusters +} // namespace app +} // namespace chip void emberAfThermostatClusterServerInitCallback(chip::EndpointId endpoint) { @@ -504,190 +1255,310 @@ bool emberAfThermostatClusterSetActivePresetRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Thermostat::Commands::SetActivePresetRequest::DecodableType & commandData) { - // TODO - return false; + EndpointId endpoint = commandPath.mEndpointId; + Delegate * delegate = GetDelegate(endpoint); + + if (delegate == nullptr) + { + ChipLogError(Zcl, "Delegate is null"); + commandObj->AddStatus(commandPath, imcode::InvalidInState); + return true; + } + + ByteSpan newPresetHandle = commandData.presetHandle; + + // If the preset handle passed in the command is not present in the Presets attribute, return INVALID_COMMAND. + if (!IsPresetHandlePresentInPresets(delegate, newPresetHandle)) + { + commandObj->AddStatus(commandPath, imcode::InvalidCommand); + return true; + } + + CHIP_ERROR err = delegate->SetActivePresetHandle(DataModel::MakeNullable(newPresetHandle)); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Failed to set ActivePresetHandle with error %" CHIP_ERROR_FORMAT, err.Format()); + commandObj->AddStatus(commandPath, StatusIB(err).mStatus); + return true; + } + + commandObj->AddStatus(commandPath, imcode::Success); + return true; } bool emberAfThermostatClusterStartPresetsSchedulesEditRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Thermostat::Commands::StartPresetsSchedulesEditRequest::DecodableType & commandData) { - // TODO - return false; + ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); + + EndpointId endpoint = commandPath.mEndpointId; + + // If the presets are editable and the scoped node id of the client sending StartPresetsSchedulesEditRequest command + // is not the same as the one that previously originated a StartPresetsSchedulesEditRequest command, return BUSY. + if (gThermostatAttrAccess.GetPresetsEditable(endpoint) && + (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != sourceNodeId)) + { + commandObj->AddStatus(commandPath, imcode::Busy); + return true; + } + + // If presets are editable and the scoped node id of the client sending StartPresetsSchedulesEditRequest command + // is the same as the one that previously originated a StartPresetsSchedulesEditRequest command, extend the timer. + if (gThermostatAttrAccess.GetPresetsEditable(endpoint)) + { + ExtendTimer(endpoint, commandData.timeoutSeconds); + commandObj->AddStatus(commandPath, imcode::Success); + return true; + } + + // Set presets editable to true and the scoped originator node id to the source scoped node id, and start a timer with the + // timeout in seconds passed in the command args. Return success. + gThermostatAttrAccess.SetPresetsEditable(endpoint, true); + gThermostatAttrAccess.SetOriginatorScopedNodeId(endpoint, sourceNodeId); + ScheduleTimer(endpoint, commandData.timeoutSeconds); + commandObj->AddStatus(commandPath, imcode::Success); + return true; } bool emberAfThermostatClusterCancelPresetsSchedulesEditRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Thermostat::Commands::CancelPresetsSchedulesEditRequest::DecodableType & commandData) { - // TODO - return false; + EndpointId endpoint = commandPath.mEndpointId; + + // If presets are not editable, return INVALID_IN_STATE. + if (!gThermostatAttrAccess.GetPresetsEditable(endpoint)) + { + commandObj->AddStatus(commandPath, imcode::InvalidInState); + return true; + } + + ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); + + // If the node id sending the CancelPresetsSchedulesRequest command is not the same as the one which send the + // previous StartPresetsSchedulesEditRequest, return UNSUPPORTED_ACCESS. + if (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != sourceNodeId) + { + commandObj->AddStatus(commandPath, imcode::UnsupportedAccess); + return true; + } + + Delegate * delegate = GetDelegate(endpoint); + + if (delegate == nullptr) + { + ChipLogError(Zcl, "Delegate is null"); + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + } + + // Clear the timer, discard the changes and set PresetsEditable to false. + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::Success); } bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Thermostat::Commands::CommitPresetsSchedulesRequest::DecodableType & commandData) { - // TODO - return false; -} + EndpointId endpoint = commandPath.mEndpointId; + Delegate * delegate = GetDelegate(endpoint); -bool emberAfThermostatClusterCancelSetActivePresetRequestCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::CancelSetActivePresetRequest::DecodableType & commandData) -{ - // TODO - return false; -} + if (delegate == nullptr) + { + ChipLogError(Zcl, "Delegate is null"); + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + } -bool emberAfThermostatClusterSetTemperatureSetpointHoldPolicyCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::SetTemperatureSetpointHoldPolicy::DecodableType & commandData) -{ - // TODO - return false; -} + // If presets are not editable, return INVALID_IN_STATE. + if (!gThermostatAttrAccess.GetPresetsEditable(endpoint)) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + } -int16_t EnforceHeatingSetpointLimits(int16_t HeatingSetpoint, EndpointId endpoint) -{ - // Optional Mfg supplied limits - int16_t AbsMinHeatSetpointLimit = kDefaultAbsMinHeatSetpointLimit; - int16_t AbsMaxHeatSetpointLimit = kDefaultAbsMaxHeatSetpointLimit; + ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); - // Optional User supplied limits - int16_t MinHeatSetpointLimit = kDefaultMinHeatSetpointLimit; - int16_t MaxHeatSetpointLimit = kDefaultMaxHeatSetpointLimit; + // If the node id sending the CommitPresetsSchedulesRequest command is not the same as the one which send the + // StartPresetsSchedulesEditRequest, return UNSUPPORTED_ACCESS. + if (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != sourceNodeId) + { + commandObj->AddStatus(commandPath, imcode::UnsupportedAccess); + return true; + } - // Attempt to read the setpoint limits - // Absmin/max are manufacturer limits - // min/max are user imposed min/max + PresetStructWithOwnedMembers preset; + CHIP_ERROR err = CHIP_NO_ERROR; - // Note that the limits are initialized above per the spec limits - // if they are not present Get() will not update the value so the defaults are used - imcode status; + // For each preset in the presets attribute, check that the matching preset in the pending presets list does not + // violate any spec constraints. + for (uint8_t i = 0; true; i++) + { + err = delegate->GetPresetAtIndex(i, preset); - // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3724 - // behavior is not specified when Abs * values are not present and user values are present - // implemented behavior accepts the user values without regard to default Abs values. + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: GetPresetAtIndex failed with error " + "%" CHIP_ERROR_FORMAT, + err.Format()); + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + } - // Per global matter data model policy - // if a attribute is not present then it's default shall be used. + bool found = MatchingPendingPresetExists(delegate, preset); - status = AbsMinHeatSetpointLimit::Get(endpoint, &AbsMinHeatSetpointLimit); - if (status != imcode::Success) - { - ChipLogError(Zcl, "Warning: AbsMinHeatSetpointLimit missing using default"); + // If a built in preset in the Presets attribute list is removed and not found in the pending presets list, return + // CONSTRAINT_ERROR. + if (IsBuiltIn(preset) && !found) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); + } } - status = AbsMaxHeatSetpointLimit::Get(endpoint, &AbsMaxHeatSetpointLimit); - if (status != imcode::Success) + // If there is an ActivePresetHandle set, find the preset in the pending presets list that matches the ActivePresetHandle + // attribute. If a preset is not found with the same presetHandle, return INVALID_IN_STATE. If there is no ActivePresetHandle + // attribute set, continue with other checks. + uint8_t buffer[kPresetHandleSize]; + MutableByteSpan activePresetHandle(buffer); + + err = delegate->GetActivePresetHandle(activePresetHandle); + + if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, "Warning: AbsMaxHeatSetpointLimit missing using default"); + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); } - status = MinHeatSetpointLimit::Get(endpoint, &MinHeatSetpointLimit); - if (status != imcode::Success) + + if (!activePresetHandle.empty()) { - MinHeatSetpointLimit = AbsMinHeatSetpointLimit; + uint8_t count = CountPresetsInPendingListWithPresetHandle(delegate, activePresetHandle); + if (count == 0) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + } } - status = MaxHeatSetpointLimit::Get(endpoint, &MaxHeatSetpointLimit); - if (status != imcode::Success) + // For each preset in the pending presets list, check that the preset does not violate any spec constraints. + for (uint8_t i = 0; true; i++) { - MaxHeatSetpointLimit = AbsMaxHeatSetpointLimit; - } + PresetStructWithOwnedMembers pendingPreset; + err = delegate->GetPendingPresetAtIndex(i, pendingPreset); - // Make sure the user imposed limits are within the manufacturer imposed limits + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: GetPendingPresetAtIndex failed with error " + "%" CHIP_ERROR_FORMAT, + err.Format()); + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + } - // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3725 - // Spec does not specify the behavior is the requested setpoint exceeds the limit allowed - // This implementation clamps at the limit. + bool isPendingPresetWithNullPresetHandle = pendingPreset.GetPresetHandle().IsNull(); - // resolution of 3725 is to clamp. + // If the preset handle is null and the built in field is set to true, return CONSTRAINT_ERROR. + if (isPendingPresetWithNullPresetHandle && IsBuiltIn(pendingPreset)) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); + } - if (MinHeatSetpointLimit < AbsMinHeatSetpointLimit) - MinHeatSetpointLimit = AbsMinHeatSetpointLimit; + bool foundMatchingPresetInPresets = false; + PresetStructWithOwnedMembers matchingPreset; + if (!isPendingPresetWithNullPresetHandle) + { + foundMatchingPresetInPresets = GetMatchingPresetInPresets(delegate, pendingPreset, matchingPreset); - if (MaxHeatSetpointLimit > AbsMaxHeatSetpointLimit) - MaxHeatSetpointLimit = AbsMaxHeatSetpointLimit; + // If the presetHandle for the pending preset is not null and a matching preset is not found in the + // presets attribute list, return NOT_FOUND. + if (!foundMatchingPresetInPresets) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::NotFound); + } - if (HeatingSetpoint < MinHeatSetpointLimit) - HeatingSetpoint = MinHeatSetpointLimit; + // Find the number of presets in the pending preset list that match the preset handle. If there are duplicate + // entries, return CONSTRAINT_ERROR. + uint8_t count = CountPresetsInPendingListWithPresetHandle(delegate, pendingPreset.GetPresetHandle().Value()); + if (count > 1) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); + } + } - if (HeatingSetpoint > MaxHeatSetpointLimit) - HeatingSetpoint = MaxHeatSetpointLimit; + // If the preset is found in the presets attribute list and the preset is builtIn in the pending presets list + // but not in the presets attribute list, return UNSUPPORTED_ACCESS. + if (foundMatchingPresetInPresets && (IsBuiltIn(pendingPreset) && !IsBuiltIn(matchingPreset))) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::UnsupportedAccess); + } - return HeatingSetpoint; -} + // If the preset is found in the presets attribute list and the preset is builtIn in the presets attribute + // but not in the pending presets list, return UNSUPPORTED_ACCESS. + if (foundMatchingPresetInPresets && (!IsBuiltIn(pendingPreset) && IsBuiltIn(matchingPreset))) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::UnsupportedAccess); + } -int16_t EnforceCoolingSetpointLimits(int16_t CoolingSetpoint, EndpointId endpoint) -{ - // Optional Mfg supplied limits - int16_t AbsMinCoolSetpointLimit = kDefaultAbsMinCoolSetpointLimit; - int16_t AbsMaxCoolSetpointLimit = kDefaultAbsMaxCoolSetpointLimit; + // If the presetScenario is not found in the preset types, return CONSTRAINT_ERROR. + PresetScenarioEnum presetScenario = pendingPreset.GetPresetScenario(); + if (!PresetScenarioExistsInPresetTypes(delegate, presetScenario)) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); + } - // Optional User supplied limits - int16_t MinCoolSetpointLimit = kDefaultMinCoolSetpointLimit; - int16_t MaxCoolSetpointLimit = kDefaultMaxCoolSetpointLimit; + // If the preset type for the preset scenario does not support names and a name is specified, return CONSTRAINT_ERROR. + if (!PresetTypeSupportsNames(delegate, presetScenario) && pendingPreset.GetName().HasValue()) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); + } - // Attempt to read the setpoint limits - // Absmin/max are manufacturer limits - // min/max are user imposed min/max + // Enforce the Setpoint Limits for both the cooling and heating setpoints in the pending preset. + Optional coolingSetpointValue = pendingPreset.GetCoolingSetpoint(); + if (coolingSetpointValue.HasValue()) + { + pendingPreset.SetCoolingSetpoint(MakeOptional(EnforceCoolingSetpointLimits(coolingSetpointValue.Value(), endpoint))); + } - // Note that the limits are initialized above per the spec limits - // if they are not present Get() will not update the value so the defaults are used - imcode status; + Optional heatingSetpointValue = pendingPreset.GetHeatingSetpoint(); + if (heatingSetpointValue.HasValue()) + { + pendingPreset.SetHeatingSetpoint(MakeOptional(EnforceHeatingSetpointLimits(heatingSetpointValue.Value(), endpoint))); + } + } - // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3724 - // behavior is not specified when Abs * values are not present and user values are present - // implemented behavior accepts the user values without regard to default Abs values. + uint8_t totalCount = CountUpdatedPresetsAfterApplyingPendingPresets(delegate); - // Per global matter data model policy - // if a attribute is not present then it's default shall be used. + uint8_t numberOfPresetsSupported = delegate->GetNumberOfPresets(); - status = AbsMinCoolSetpointLimit::Get(endpoint, &AbsMinCoolSetpointLimit); - if (status != imcode::Success) + if (numberOfPresetsSupported == 0) { - ChipLogError(Zcl, "Warning: AbsMinCoolSetpointLimit missing using default"); + ChipLogError(Zcl, "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: Failed to get NumberOfPresets"); + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); } - status = AbsMaxCoolSetpointLimit::Get(endpoint, &AbsMaxCoolSetpointLimit); - if (status != imcode::Success) + // If the expected length of the presets attribute with the applied changes exceeds the total number of presets supported, + // return RESOURCE_EXHAUSTED. Note that the changes are not yet applied. + if (numberOfPresetsSupported > 0 && totalCount > numberOfPresetsSupported) { - ChipLogError(Zcl, "Warning: AbsMaxCoolSetpointLimit missing using default"); + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ResourceExhausted); } - status = MinCoolSetpointLimit::Get(endpoint, &MinCoolSetpointLimit); - if (status != imcode::Success) - { - MinCoolSetpointLimit = AbsMinCoolSetpointLimit; - } + // TODO: Check if the number of presets for each presetScenario exceeds the max number of presets supported for that + // scenario. We plan to support only one preset for each presetScenario for our use cases so defer this for re-evaluation. - status = MaxCoolSetpointLimit::Get(endpoint, &MaxCoolSetpointLimit); - if (status != imcode::Success) + // Call the delegate API to apply the pending presets to the presets attribute and update it. + err = delegate->ApplyPendingPresets(); + + if (err != CHIP_NO_ERROR) { - MaxCoolSetpointLimit = AbsMaxCoolSetpointLimit; + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); } - // Make sure the user imposed limits are within the manufacture imposed limits - // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3725 - // Spec does not specify the behavior is the requested setpoint exceeds the limit allowed - // This implementation clamps at the limit. - - // resolution of 3725 is to clamp. - - if (MinCoolSetpointLimit < AbsMinCoolSetpointLimit) - MinCoolSetpointLimit = AbsMinCoolSetpointLimit; - - if (MaxCoolSetpointLimit > AbsMaxCoolSetpointLimit) - MaxCoolSetpointLimit = AbsMaxCoolSetpointLimit; - - if (CoolingSetpoint < MinCoolSetpointLimit) - CoolingSetpoint = MinCoolSetpointLimit; - - if (CoolingSetpoint > MaxCoolSetpointLimit) - CoolingSetpoint = MaxCoolSetpointLimit; - - return CoolingSetpoint; + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::Success); } bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * commandObj, diff --git a/src/app/clusters/thermostat-server/thermostat-server.h b/src/app/clusters/thermostat-server/thermostat-server.h new file mode 100644 index 00000000000000..955ab9e5c5a777 --- /dev/null +++ b/src/app/clusters/thermostat-server/thermostat-server.h @@ -0,0 +1,103 @@ +/** + * + * 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. + */ + +/**************************************************************************** + * @file + * @brief APIs for the Thermostat cluster. + * + ******************************************************************************* + ******************************************************************************/ + +#pragma once + +#include "thermostat-delegate.h" + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace Thermostat { + +static constexpr size_t kThermostatEndpointCount = + MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; + +/** + * @brief Thermostat Attribute Access Interface. + */ +class ThermostatAttrAccess : public chip::app::AttributeAccessInterface +{ +public: + ThermostatAttrAccess() : AttributeAccessInterface(Optional::Missing(), Thermostat::Id) {} + + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; + CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, chip::app::AttributeValueDecoder & aDecoder) override; + + /** + * @brief Sets the scoped node id of the originator that send the last successful + * StartPresetsSchedulesEditRequest for the given endpoint. + * + * @param[in] endpoint The endpoint. + * @param[in] originatorNodeId The originator scoped node id. + */ + void SetOriginatorScopedNodeId(EndpointId endpoint, ScopedNodeId originatorNodeId); + + /** + * @brief Gets the scoped node id of the originator that send the last successful + * StartPresetsSchedulesEditRequest for the given endpoint. + * + * @param[in] endpoint The endpoint. + * + * @return the scoped node id for the given endpoint if set. Otherwise returns ScopedNodeId(). + */ + ScopedNodeId GetOriginatorScopedNodeId(EndpointId endpoint); + + /** + * @brief Sets the presets editable flag for the given endpoint + * + * @param[in] endpoint The endpoint. + * @param[in] presetEditable The value of the presets editable. + */ + void SetPresetsEditable(EndpointId endpoint, bool presetEditable); + + /** + * @brief Gets the prests editable flag value for the given endpoint + * + * @param[in] endpoint The endpoint. + * + * @return the presets editable flag value for the given endpoint if set. Otherwise returns false. + */ + bool GetPresetsEditable(EndpointId endpoint); + +private: + ScopedNodeId mPresetEditRequestOriginatorNodeIds[kThermostatEndpointCount]; + + bool mPresetsEditables[kThermostatEndpointCount]; +}; + +/** + * @brief Sets the default delegate for the specific thermostat features. + * + * @param[in] endpoint The endpoint to set the default delegate on. + * @param[in] delegate The default delegate. + */ +void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate); + +} // namespace Thermostat +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/thread-border-router-management-server/thread-border-router-management-server.cpp b/src/app/clusters/thread-border-router-management-server/thread-border-router-management-server.cpp new file mode 100644 index 00000000000000..5592da410100c2 --- /dev/null +++ b/src/app/clusters/thread-border-router-management-server/thread-border-router-management-server.cpp @@ -0,0 +1,357 @@ +/* + * + * 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 "thread-border-router-management-server.h" + +#include "app-common/zap-generated/cluster-objects.h" +#include "app-common/zap-generated/ids/Attributes.h" +#include "app-common/zap-generated/ids/Clusters.h" +#include "app-common/zap-generated/ids/Commands.h" +#include "app/AttributeAccessInterfaceRegistry.h" +#include "app/AttributeValueEncoder.h" +#include "app/CommandHandler.h" +#include "app/CommandHandlerInterface.h" +#include "app/CommandHandlerInterfaceRegistry.h" +#include "app/InteractionModelEngine.h" +#include "app/MessageDef/StatusIB.h" +#include "app/clusters/general-commissioning-server/general-commissioning-server.h" +#include "app/data-model/Nullable.h" +#include "lib/core/CHIPError.h" +#include "lib/core/Optional.h" +#include "lib/support/CodeUtils.h" +#include "lib/support/Span.h" +#include "lib/support/ThreadOperationalDataset.h" +#include "platform/CHIPDeviceEvent.h" +#include "platform/PlatformManager.h" +#include "protocols/interaction_model/StatusCode.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace ThreadBorderRouterManagement { + +using Protocols::InteractionModel::Status; + +static bool IsCommandOverCASESession(CommandHandlerInterface::HandlerContext & ctx) +{ + Messaging::ExchangeContext * exchangeCtx = ctx.mCommandHandler.GetExchangeContext(); + return exchangeCtx && exchangeCtx->HasSessionHandle() && exchangeCtx->GetSessionHandle()->IsSecureSession() && + exchangeCtx->GetSessionHandle()->AsSecureSession()->GetSecureSessionType() == Transport::SecureSession::Type::kCASE; +} + +Status ServerInstance::HandleGetDatasetRequest(bool isOverCASESession, Delegate::DatasetType type, + Thread::OperationalDataset & dataset) +{ + VerifyOrDie(mDelegate); + if (!isOverCASESession) + { + return Status::UnsupportedAccess; + } + + CHIP_ERROR err = mDelegate->GetDataset(dataset, type); + if (err != CHIP_NO_ERROR) + { + return err == CHIP_IM_GLOBAL_STATUS(NotFound) ? StatusIB(err).mStatus : Status::Failure; + } + return Status::Success; +} + +Status ServerInstance::HandleSetActiveDatasetRequest(CommandHandler * commandHandler, + const Commands::SetActiveDatasetRequest::DecodableType & req) +{ + // The SetActiveDatasetRequest command SHALL be FailSafeArmed. Upon receiving this command, the Thread BR will set its + // active dataset. If the dataset is set successfully, OnActivateDatasetComplete will be called with CHIP_NO_ERROR, prompting + // the Thread BR to respond with a success status. If an error occurs while setting the active dataset, the Thread BR should + // respond with a failure status. In this case, when the FailSafe timer expires, the active dataset set by this command will be + // reverted. If the FailSafe timer expires before the Thread BR responds, the Thread BR will respond with a timeout status and + // the active dataset should also be reverted. + VerifyOrDie(mDelegate); + VerifyOrReturnValue(mFailsafeContext.IsFailSafeArmed(commandHandler->GetAccessingFabricIndex()), Status::FailsafeRequired); + + Thread::OperationalDataset activeDataset; + Thread::OperationalDataset currentActiveDataset; + uint64_t currentActiveDatasetTimestamp = 0; + // If any of the parameters in the ActiveDataset is invalid, the command SHALL fail with a status code + // of INVALID_COMMAND. + VerifyOrReturnValue(activeDataset.Init(req.activeDataset) == CHIP_NO_ERROR, Status::InvalidCommand); + + // If this command is invoked when the ActiveDatasetTimestamp attribute is not null, the command SHALL + // fail with a status code of INVALID_IN_STATE. + if ((mDelegate->GetDataset(currentActiveDataset, Delegate::DatasetType::kActive) == CHIP_NO_ERROR) && + (currentActiveDataset.GetActiveTimestamp(currentActiveDatasetTimestamp) == CHIP_NO_ERROR)) + { + return Status::InvalidInState; + } + // If there is a back end command process, return status BUSY. + if (mAsyncCommandHandle.Get()) + { + return Status::Busy; + } + commandHandler->FlushAcksRightAwayOnSlowCommand(); + mAsyncCommandHandle = CommandHandler::Handle(commandHandler); + mBreadcrumb = req.breadcrumb; + mSetActiveDatasetSequenceNumber++; + mDelegate->SetActiveDataset(activeDataset, mSetActiveDatasetSequenceNumber, this); + return Status::Success; +} + +Status ServerInstance::HandleSetPendingDatasetRequest(const Commands::SetPendingDatasetRequest::DecodableType & req) +{ + VerifyOrDie(mDelegate); + if (!mDelegate->GetPanChangeSupported()) + { + return Status::UnsupportedCommand; + } + Thread::OperationalDataset pendingDataset; + // If any of the parameters in the PendingDataset is invalid, the command SHALL fail with a status code + // of INVALID_COMMAND. + ReturnErrorCodeIf(pendingDataset.Init(req.pendingDataset) != CHIP_NO_ERROR, Status::InvalidCommand); + CHIP_ERROR err = mDelegate->SetPendingDataset(pendingDataset); + return StatusIB(err).mStatus; +} + +void AddDatasetResponse(CommandHandlerInterface::HandlerContext & ctx, Status status, const Thread::OperationalDataset & dataset) +{ + if (status != Status::Success) + { + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); + return; + } + Commands::DatasetResponse::Type response; + response.dataset = dataset.AsByteSpan(); + ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); +} + +void ServerInstance::InvokeCommand(HandlerContext & ctxt) +{ + switch (ctxt.mRequestPath.mCommandId) + { + case Commands::GetActiveDatasetRequest::Id: + HandleCommand(ctxt, [this](HandlerContext & ctx, const auto & req) { + Thread::OperationalDataset dataset; + Status status = HandleGetActiveDatasetRequest(IsCommandOverCASESession(ctx), dataset); + AddDatasetResponse(ctx, status, dataset); + }); + break; + case Commands::GetPendingDatasetRequest::Id: + HandleCommand(ctxt, [this](HandlerContext & ctx, const auto & req) { + Thread::OperationalDataset dataset; + Status status = HandleGetPendingDatasetRequest(IsCommandOverCASESession(ctx), dataset); + AddDatasetResponse(ctx, status, dataset); + }); + break; + case Commands::SetActiveDatasetRequest::Id: + HandleCommand(ctxt, [this](HandlerContext & ctx, const auto & req) { + mPath = ctx.mRequestPath; + Status status = HandleSetActiveDatasetRequest(&ctx.mCommandHandler, req); + if (status != Status::Success) + { + // If status is not Success, we should immediately report the status. Otherwise the async work will report the + // status to the client. + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); + } + }); + break; + case Commands::SetPendingDatasetRequest::Id: + HandleCommand(ctxt, [this](HandlerContext & ctx, const auto & req) { + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, HandleSetPendingDatasetRequest(req)); + }); + break; + default: + break; + } +} + +void ServerInstance::ReadFeatureMap(BitFlags & outFeatureMap) +{ + if (mDelegate->GetPanChangeSupported()) + { + outFeatureMap.Set(Feature::kPANChange); + } +} + +CHIP_ERROR ServerInstance::ReadBorderRouterName(MutableCharSpan & outBorderRouterName) +{ + mDelegate->GetBorderRouterName(outBorderRouterName); + VerifyOrReturnValue(outBorderRouterName.size() <= kBorderRouterNameMaxLength, CHIP_IM_GLOBAL_STATUS(Failure)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR ServerInstance::ReadBorderAgentID(MutableByteSpan & outBorderAgentId) +{ + VerifyOrReturnValue((mDelegate->GetBorderAgentId(outBorderAgentId) == CHIP_NO_ERROR) && + (outBorderAgentId.size() == kBorderAgentIdLength), + CHIP_IM_GLOBAL_STATUS(Failure)); + return CHIP_NO_ERROR; +} + +Optional ServerInstance::ReadActiveDatasetTimestamp() +{ + uint64_t activeDatasetTimestampValue = 0; + Thread::OperationalDataset activeDataset; + if ((mDelegate->GetDataset(activeDataset, Delegate::DatasetType::kActive) == CHIP_NO_ERROR) && + (activeDataset.GetActiveTimestamp(activeDatasetTimestampValue) == CHIP_NO_ERROR)) + { + return MakeOptional(activeDatasetTimestampValue); + } + return NullOptional; +} + +CHIP_ERROR ServerInstance::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) +{ + if (aPath.mClusterId != ThreadBorderRouterManagement::Id) + { + return CHIP_ERROR_INVALID_ARGUMENT; + } + VerifyOrDie(mDelegate); + CHIP_ERROR status = CHIP_NO_ERROR; + switch (aPath.mAttributeId) + { + case Globals::Attributes::FeatureMap::Id: { + BitFlags featureMap; + ReadFeatureMap(featureMap); + status = aEncoder.Encode(featureMap); + break; + } + case Attributes::BorderRouterName::Id: { + char borderRouterNameBuf[kBorderRouterNameMaxLength] = { 0 }; + MutableCharSpan borderRouterName(borderRouterNameBuf); + status = ReadBorderRouterName(borderRouterName); + // If there are any internal errors, the status will be returned and the client will get an error report. + if (status == CHIP_NO_ERROR) + { + status = aEncoder.Encode(borderRouterName); + } + break; + } + case Attributes::BorderAgentID::Id: { + uint8_t borderAgentIDBuf[kBorderAgentIdLength] = { 0 }; + MutableByteSpan borderAgentID(borderAgentIDBuf); + status = ReadBorderAgentID(borderAgentID); + if (status == CHIP_NO_ERROR) + { + status = aEncoder.Encode(borderAgentID); + } + break; + } + case Attributes::ThreadVersion::Id: { + uint16_t threadVersion = mDelegate->GetThreadVersion(); + status = aEncoder.Encode(threadVersion); + break; + } + case Attributes::InterfaceEnabled::Id: { + bool interfaceEnabled = mDelegate->GetInterfaceEnabled(); + status = aEncoder.Encode(interfaceEnabled); + break; + } + case Attributes::ActiveDatasetTimestamp::Id: { + Optional activeDatasetTimestamp = ReadActiveDatasetTimestamp(); + status = activeDatasetTimestamp.HasValue() ? aEncoder.Encode(DataModel::MakeNullable(activeDatasetTimestamp.Value())) + : aEncoder.EncodeNull(); + break; + } + default: + break; + } + return status; +} + +void ServerInstance::CommitSavedBreadcrumb() +{ + if (mBreadcrumb.HasValue()) + { + GeneralCommissioning::SetBreadcrumb(mBreadcrumb.Value()); + } + mBreadcrumb.ClearValue(); +} + +void ServerInstance::OnActivateDatasetComplete(uint32_t sequenceNum, CHIP_ERROR error) +{ + auto commandHandleRef = std::move(mAsyncCommandHandle); + auto commandHandle = commandHandleRef.Get(); + if (commandHandle == nullptr) + { + return; + } + if (mSetActiveDatasetSequenceNumber != sequenceNum) + { + // Previous SetActiveDatasetRequest was handled. + return; + } + if (error == CHIP_NO_ERROR) + { + // TODO: SPEC Issue #10022 + CommitSavedBreadcrumb(); + } + else + { + ChipLogError(Zcl, "Failed on activating the active dataset for Thread BR: %" CHIP_ERROR_FORMAT, error.Format()); + } + commandHandle->AddStatus(mPath, StatusIB(error).mStatus); +} + +void ServerInstance::ReportAttributeChanged(AttributeId attributeId) +{ + MatterReportingAttributeChangeCallback(mServerEndpointId, Id, attributeId); +} + +void ServerInstance::OnFailSafeTimerExpired() +{ + if (mDelegate) + { + mDelegate->RevertActiveDataset(); + } + auto commandHandleRef = std::move(mAsyncCommandHandle); + auto commandHandle = commandHandleRef.Get(); + if (commandHandle == nullptr) + { + return; + } + commandHandle->AddStatus(mPath, Status::Timeout); +} + +void ServerInstance::OnPlatformEventHandler(const DeviceLayer::ChipDeviceEvent * event, intptr_t arg) +{ + ServerInstance * _this = reinterpret_cast(arg); + if (event->Type == DeviceLayer::DeviceEventType::kFailSafeTimerExpired) + { + _this->OnFailSafeTimerExpired(); + } + else if (event->Type == DeviceLayer::DeviceEventType::kCommissioningComplete) + { + _this->mDelegate->CommitActiveDataset(); + } +} + +CHIP_ERROR ServerInstance::Init() +{ + ReturnErrorCodeIf(!mDelegate, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorOnFailure(CommandHandlerInterfaceRegistry::RegisterCommandHandler(this)); + VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(DeviceLayer::PlatformMgrImpl().AddEventHandler(OnPlatformEventHandler, reinterpret_cast(this))); + return mDelegate->Init(this); +} + +} // namespace ThreadBorderRouterManagement +} // namespace Clusters +} // namespace app +} // namespace chip + +void MatterThreadBorderRouterManagementPluginServerInitCallback() +{ + // Nothing to do, the server init routine will be done in Instance::Init() +} diff --git a/src/app/clusters/thread-border-router-management-server/thread-border-router-management-server.h b/src/app/clusters/thread-border-router-management-server/thread-border-router-management-server.h new file mode 100644 index 00000000000000..a2b6d7949ffdff --- /dev/null +++ b/src/app/clusters/thread-border-router-management-server/thread-border-router-management-server.h @@ -0,0 +1,106 @@ +/* + * + * 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 "thread-br-delegate.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ThreadBorderRouterManagement { + +class ServerInstance : public CommandHandlerInterface, + public AttributeAccessInterface, + public Delegate::ActivateDatasetCallback, + public Delegate::AttributeChangeCallback +{ +public: + using Status = Protocols::InteractionModel::Status; + ServerInstance(EndpointId endpointId, Delegate * delegate, FailSafeContext & failSafeContext) : + CommandHandlerInterface(Optional(endpointId), Id), + AttributeAccessInterface(Optional(endpointId), Id), mDelegate(delegate), mServerEndpointId(endpointId), + mFailsafeContext(failSafeContext) + {} + virtual ~ServerInstance() = default; + + CHIP_ERROR Init(); + + // CommandHanlerInterface + void InvokeCommand(HandlerContext & ctx) override; + + // AttributeAccessInterface + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; + + // ActivateDatasetCallback + void OnActivateDatasetComplete(uint32_t sequenceNum, CHIP_ERROR error) override; + + // AttributeChangeCallback + void ReportAttributeChanged(AttributeId attributeId) override; + +private: + // TODO: Split the business logic from the unit test class + friend class TestThreadBorderRouterManagementCluster; + // Command Handlers + Status HandleGetActiveDatasetRequest(bool isOverCASESession, Thread::OperationalDataset & dataset) + { + return HandleGetDatasetRequest(isOverCASESession, Delegate::DatasetType::kActive, dataset); + } + Status HandleGetPendingDatasetRequest(bool isOverCASESession, Thread::OperationalDataset & dataset) + { + return HandleGetDatasetRequest(isOverCASESession, Delegate::DatasetType::kPending, dataset); + } + Status HandleSetActiveDatasetRequest(CommandHandler * commandHandler, + const Commands::SetActiveDatasetRequest::DecodableType & req); + Status HandleSetPendingDatasetRequest(const Commands::SetPendingDatasetRequest::DecodableType & req); + Status HandleGetDatasetRequest(bool isOverCASESession, Delegate::DatasetType type, Thread::OperationalDataset & dataset); + + // Attribute Read handlers + void ReadFeatureMap(BitFlags & feature); + Optional ReadActiveDatasetTimestamp(); + CHIP_ERROR ReadBorderRouterName(MutableCharSpan & borderRouterName); + CHIP_ERROR ReadBorderAgentID(MutableByteSpan & borderAgentId); + + static void OnPlatformEventHandler(const DeviceLayer::ChipDeviceEvent * event, intptr_t arg); + void OnFailSafeTimerExpired(); + void CommitSavedBreadcrumb(); + + Delegate * mDelegate; + app::CommandHandler::Handle mAsyncCommandHandle; + ConcreteCommandPath mPath = ConcreteCommandPath(0, 0, 0); + Optional mBreadcrumb; + uint32_t mSetActiveDatasetSequenceNumber = 0; + EndpointId mServerEndpointId; + FailSafeContext & mFailsafeContext; +}; + +} // namespace ThreadBorderRouterManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/thread-border-router-management-server/thread-br-delegate.h b/src/app/clusters/thread-border-router-management-server/thread-br-delegate.h new file mode 100644 index 00000000000000..201540af96ecff --- /dev/null +++ b/src/app/clusters/thread-border-router-management-server/thread-br-delegate.h @@ -0,0 +1,115 @@ +/* + * + * 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 +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ThreadBorderRouterManagement { + +constexpr size_t kBorderRouterNameMaxLength = 63; +constexpr size_t kBorderAgentIdLength = 16; + +class Delegate +{ +public: + Delegate() = default; + virtual ~Delegate() = default; + + class ActivateDatasetCallback + { + public: + ActivateDatasetCallback() = default; + virtual ~ActivateDatasetCallback() = default; + // If the dataset is set successfully, OnActivateDatasetComplete should be called with CHIP_NO_ERROR when the + // Border Router is attached to the Thread network. + // If an error occurs while setting the active dataset, this callback should be called with the error. + // The error input of this function could be SDK-range error for CHIP error or OpenThread-range error for Thread error. + virtual void OnActivateDatasetComplete(uint32_t sequenceNum, CHIP_ERROR error) = 0; + }; + + class AttributeChangeCallback + { + public: + AttributeChangeCallback() = default; + virtual ~AttributeChangeCallback() = default; + // If the attributes of the Thread Border Router Management is changed, ReportAttributeChanged should be called. + virtual void ReportAttributeChanged(AttributeId attributeId) = 0; + }; + + enum class DatasetType : uint8_t + { + kActive, + kPending, + }; + + virtual CHIP_ERROR Init(AttributeChangeCallback * attributeChangeCallback) = 0; + + // Get whether PanChange feature is supported for the Thread BR. + virtual bool GetPanChangeSupported() = 0; + + // Get the BorderRouterName of the Thread BR, which will also be the service name of Thread BR's MeshCOP service. + virtual void GetBorderRouterName(MutableCharSpan & borderRouterName) = 0; + + // Get the BorderAgentId of the Thread BR. + // @return + // -IncorrectState When Thread stack is not initialized. + // -InvalidArgument When the size of borderAgentId is not 16 bytes. + // -ThreadErrors When failing to get BorderAgentId. + virtual CHIP_ERROR GetBorderAgentId(MutableByteSpan & borderAgentId) = 0; + + // Get the Thread version which matches the value mapping defined in the "Version TLV" section of the Thread specification. + virtual uint16_t GetThreadVersion() = 0; + + // Get whether the associated IEEE 802.15.4 Thread interface is enabled or disabled. + virtual bool GetInterfaceEnabled() = 0; + + // Get the active dataset or the pending dataset. + // @return + // -IncorrectState When Thread stack is not initialized. + // -NotFound when failing to get the dataset. + virtual CHIP_ERROR GetDataset(Thread::OperationalDataset & dataset, DatasetType type) = 0; + + // There should be no active dataset configured when calling this API, otherwise we should use SetPendingDataset. + // The Delegate implementation must store the sequence number and pass it to OnActivateDatasetComplete. + virtual void SetActiveDataset(const Thread::OperationalDataset & activeDataset, uint32_t sequenceNum, + ActivateDatasetCallback * callback) = 0; + + // This function will check save whether there is active dataset configured. + virtual CHIP_ERROR CommitActiveDataset() = 0; + + // The function is called when Failsafe timer is triggered or when the Border Router reboots with a previous Failsafe timer + // started but not disarmed before reboot. The delegate implementation should check whether there is a previous SetActiveDataset + // request and revert the active dataset set by the previous SetActiveDataset. Since there should be no configured dataset when + // calling SetActiveDataset, this function will clear the active dataset to allow trying again a new SetActiveDataset operation. + // The delegate is allowed to call OnActivateDatasetComplete for the previous SetActiveDataset request even after this function + // is called as the sequence number passed to OnActivateDatasetComplete will be different. + virtual CHIP_ERROR RevertActiveDataset() = 0; + + virtual CHIP_ERROR SetPendingDataset(const Thread::OperationalDataset & pendingDataset) = 0; +}; + +} // namespace ThreadBorderRouterManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/thread-network-directory-server/DefaultThreadNetworkDirectoryStorage.cpp b/src/app/clusters/thread-network-directory-server/DefaultThreadNetworkDirectoryStorage.cpp new file mode 100644 index 00000000000000..6daaffce9ce91c --- /dev/null +++ b/src/app/clusters/thread-network-directory-server/DefaultThreadNetworkDirectoryStorage.cpp @@ -0,0 +1,144 @@ +/** + * + * 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 "DefaultThreadNetworkDirectoryStorage.h" +#include +#include +#include + +namespace chip { +namespace app { + +void DefaultThreadNetworkDirectoryStorage::InitializedIfNeeded() +{ + VerifyOrReturn(!mInitialized); + mInitialized = true; + + CHIP_ERROR err; + StorageKeyName key = DefaultStorageKeyAllocator::ThreadNetworkDirectoryIndex(); + uint16_t size = sizeof(mExtendedPanIds); + SuccessOrExit(err = mStorage.SyncGetKeyValue(key.KeyName(), mExtendedPanIds, size)); + VerifyOrExit(size % ExtendedPanId::size() == 0, err = CHIP_ERROR_INTERNAL); + mCount = static_cast(size / ExtendedPanId::size()); + return; +exit: + if (err != CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) + { + ChipLogError(Zcl, "Failed to load Thread Network Directory storage: %" CHIP_ERROR_FORMAT, err.Format()); + } +} + +CHIP_ERROR DefaultThreadNetworkDirectoryStorage::StoreIndex() +{ + VerifyOrDie(mInitialized); + StorageKeyName key = DefaultStorageKeyAllocator::ThreadNetworkDirectoryIndex(); + return mStorage.SyncSetKeyValue(key.KeyName(), mExtendedPanIds, mCount * ExtendedPanId::size()); +} + +bool DefaultThreadNetworkDirectoryStorage::FindNetwork(const ExtendedPanId & exPanId, index_t & outIndex) +{ + for (index_t idx = 0; idx < mCount; idx++) + { + if (mExtendedPanIds[idx] == exPanId) + { + outIndex = idx; + return true; + } + } + return false; +} + +ThreadNetworkDirectoryStorage::ExtendedPanIdIterator * DefaultThreadNetworkDirectoryStorage::IterateNetworkIds() +{ + InitializedIfNeeded(); + return mIterators.CreateObject(*this); +} + +bool DefaultThreadNetworkDirectoryStorage::ContainsNetwork(const ExtendedPanId & exPanId) +{ + InitializedIfNeeded(); + index_t unused; + return FindNetwork(exPanId, unused); +} + +CHIP_ERROR DefaultThreadNetworkDirectoryStorage::GetNetworkDataset(const ExtendedPanId & exPanId, MutableByteSpan & dataset) +{ + VerifyOrReturnError(ContainsNetwork(exPanId), CHIP_ERROR_NOT_FOUND); + uint16_t size = static_cast(CanCastTo(dataset.size()) ? dataset.size() : UINT16_MAX); + StorageKeyName key = DefaultStorageKeyAllocator::ThreadNetworkDirectoryDataset(exPanId.AsNumber()); + ReturnErrorOnFailure(mStorage.SyncGetKeyValue(key.KeyName(), dataset.data(), size)); + dataset.reduce_size(size); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DefaultThreadNetworkDirectoryStorage::AddOrUpdateNetwork(const ExtendedPanId & exPanId, ByteSpan dataset) +{ + VerifyOrReturnError(0 < dataset.size() && dataset.size() <= kMaxThreadDatasetLen, CHIP_ERROR_INVALID_ARGUMENT); + bool update = ContainsNetwork(exPanId); + VerifyOrReturnError(update || mCount < kCapacity, CHIP_ERROR_NO_MEMORY); + + // Store the dataset first + StorageKeyName key = DefaultStorageKeyAllocator::ThreadNetworkDirectoryDataset(exPanId.AsNumber()); + ReturnErrorOnFailure(mStorage.SyncSetKeyValue(key.KeyName(), dataset.data(), static_cast(dataset.size()))); + + // Update the index if we're adding a new network, rolling back on failure. + if (!update) + { + mExtendedPanIds[mCount++] = exPanId; + CHIP_ERROR err = StoreIndex(); + if (err != CHIP_NO_ERROR) + { + mCount--; + mStorage.SyncDeleteKeyValue(key.KeyName()); + return err; + } + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DefaultThreadNetworkDirectoryStorage::RemoveNetwork(const ExtendedPanId & exPanId) +{ + InitializedIfNeeded(); + index_t index; + VerifyOrReturnError(FindNetwork(exPanId, index), CHIP_ERROR_NOT_FOUND); + + // Move subsequent elements down to fill the deleted slot + static_assert(std::is_trivially_copyable_v); + size_t subsequentCount = mCount - (index + 1u); + auto * element = &mExtendedPanIds[index]; + memmove(element, element + 1, subsequentCount * sizeof(*element)); + mCount--; + + CHIP_ERROR err = StoreIndex(); + if (err != CHIP_NO_ERROR) + { + // Roll back the change to our in-memory state + memmove(element + 1, element, subsequentCount * sizeof(*element)); + mExtendedPanIds[index] = exPanId; + mCount++; + return err; + } + + // Delete the dataset itself. Ignore errors since we successfully updated the index. + StorageKeyName key = DefaultStorageKeyAllocator::ThreadNetworkDirectoryDataset(exPanId.AsNumber()); + mStorage.SyncDeleteKeyValue(key.KeyName()); + return CHIP_NO_ERROR; +} + +} // namespace app +} // namespace chip diff --git a/src/app/clusters/thread-network-directory-server/DefaultThreadNetworkDirectoryStorage.h b/src/app/clusters/thread-network-directory-server/DefaultThreadNetworkDirectoryStorage.h new file mode 100644 index 00000000000000..0cda5e3e188c7f --- /dev/null +++ b/src/app/clusters/thread-network-directory-server/DefaultThreadNetworkDirectoryStorage.h @@ -0,0 +1,80 @@ +/** + * + * 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 +#include +#include + +#include + +namespace chip { +namespace app { + +/** + * Stores Thread network information via a PersistentStorageDelegate. + */ +class DefaultThreadNetworkDirectoryStorage : public ThreadNetworkDirectoryStorage +{ +public: + DefaultThreadNetworkDirectoryStorage(PersistentStorageDelegate & storage) : mStorage(storage) {} + + uint8_t Capacity() override { return kCapacity; } + ExtendedPanIdIterator * IterateNetworkIds() override; + bool ContainsNetwork(const ExtendedPanId & exPanId) override; + CHIP_ERROR GetNetworkDataset(const ExtendedPanId & exPanId, MutableByteSpan & dataset) override; + CHIP_ERROR AddOrUpdateNetwork(const ExtendedPanId & exPanId, ByteSpan dataset) override; + CHIP_ERROR RemoveNetwork(const ExtendedPanId & exPanId) override; + +private: + using index_t = uint8_t; + static constexpr index_t kCapacity = CHIP_CONFIG_MAX_THREAD_NETWORK_DIRECTORY_STORAGE_CAPACITY; + static constexpr size_t kIteratorsMax = CHIP_CONFIG_MAX_THREAD_NETWORK_DIRECTORY_STORAGE_CONCURRENT_ITERATORS; + + void InitializedIfNeeded(); + CHIP_ERROR StoreIndex(); + bool FindNetwork(const ExtendedPanId & exPanId, index_t & outIndex); + + struct IteratorImpl final : public ExtendedPanIdIterator + { + IteratorImpl(DefaultThreadNetworkDirectoryStorage & storage) : mContainer(storage) {} + + size_t Count() override { return mContainer.mCount; } + + bool Next(ExtendedPanId & item) override + { + VerifyOrReturnValue(mIndex < Count(), false); + item = mContainer.mExtendedPanIds[mIndex++]; + return true; + } + + void Release() override { mContainer.mIterators.ReleaseObject(this); } + + DefaultThreadNetworkDirectoryStorage & mContainer; + index_t mIndex = 0; + }; + + PersistentStorageDelegate & mStorage; + ObjectPool mIterators; + ExtendedPanId mExtendedPanIds[kCapacity]; + index_t mCount = 0; + bool mInitialized = false; +}; + +} // namespace app +} // namespace chip diff --git a/src/app/clusters/thread-network-directory-server/ThreadNetworkDirectoryStorage.h b/src/app/clusters/thread-network-directory-server/ThreadNetworkDirectoryStorage.h new file mode 100644 index 00000000000000..b31d34e9778bd0 --- /dev/null +++ b/src/app/clusters/thread-network-directory-server/ThreadNetworkDirectoryStorage.h @@ -0,0 +1,127 @@ +/** + * + * 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 +#include +#include + +#include +#include +#include + +namespace chip { +namespace app { + +class ThreadNetworkDirectoryStorage +{ +public: + static constexpr size_t kMaxThreadDatasetLen = 254; + + /** + * A Thread Extended PAN ID is an opaque 8 byte value, + * and can optionally be interpreted as a big-endian number. + * + * ExtendedPanId structs or arrays thereof can be directly + * read from or written to storage and are byte-order independent. + */ + struct ExtendedPanId final + { + uint8_t bytes[8]; + static constexpr size_t size() { return sizeof(bytes); } + + constexpr ExtendedPanId() : bytes{} {} + explicit ExtendedPanId(ByteSpan source) + { + VerifyOrDie(source.size() == size()); + memcpy(bytes, source.data(), size()); + } + + explicit ExtendedPanId(uint64_t number) { Encoding::BigEndian::Put64(bytes, number); } + + constexpr ByteSpan AsSpan() const { return ByteSpan(bytes); } + uint64_t AsNumber() const { return Encoding::BigEndian::Get64(bytes); } + + bool operator==(const ExtendedPanId & other) const { return memcmp(bytes, other.bytes, size()) == 0; } + bool operator!=(const ExtendedPanId & other) const { return !(*this == other); } + }; + + static_assert(std::is_trivially_copyable_v && sizeof(ExtendedPanId) == sizeof(ExtendedPanId::bytes)); + + using ExtendedPanIdIterator = CommonIterator; + + virtual ~ThreadNetworkDirectoryStorage() = default; + + /** + * Returns the maximum number of networks that can be stored. + */ + virtual uint8_t Capacity() = 0; + + /** + * Creates an iterator over the list of stored networks. + * Release() must be called on the iterator after the iteration is finished. + * Adding or removing networks during the iteration is not supported. + * + * The iteration order of stored networks should remain stable as long as + * as no networks are added or removed. + * + * @retval An instance of ExtendedPanIdIterator on success + * @retval nullptr if no iterator instances are available. + */ + virtual ExtendedPanIdIterator * IterateNetworkIds() = 0; + + /** + * Retrieves the dataset associated with the specified Extended PAN ID. + * + * @retval CHIP_ERROR_NOT_FOUND if there is no matching network stored. + * @retval CHIP_ERROR_BUFFER_TOO_SMALL if the provided buffer buffer is too small. + * @retval CHIP_ERROR_* for other errors. + */ + virtual CHIP_ERROR GetNetworkDataset(const ExtendedPanId & exPanId, MutableByteSpan & dataset) = 0; + + /** + * Adds (or updates, if a matching network already exists) the network with the specified + * Extended PAN ID and dataset. Note that the dataset must be treated as an opaque blob; + * no validation of any kind is expected to be performed on the dataset contents. + * + * @retval CHIP_ERROR_INVALID_ARGUMENT if the dataset is empty or too long. + * @retval CHIP_ERROR_NO_MEMORY if adding the network would exceed the storage capacity. + * @retval CHIP_ERROR_* for other errors. + */ + virtual CHIP_ERROR AddOrUpdateNetwork(const ExtendedPanId & exPanId, ByteSpan dataset) = 0; + + /** + * Removes the network with the specified Extended PAN ID. + * + * @retval CHIP_ERROR_NOT_FOUND if there is no matching network stored. + * @retval CHIP_ERROR_* for other errors. + */ + virtual CHIP_ERROR RemoveNetwork(const ExtendedPanId & exPanId) = 0; + + /** + * Returns true if a network with the specified Extended PAN ID is stored, or false otherwise. + */ + virtual bool ContainsNetwork(const ExtendedPanId & exPanId) + { + MutableByteSpan empty; + return GetNetworkDataset(exPanId, empty) != CHIP_ERROR_NOT_FOUND; + } +}; + +} // namespace app +} // namespace chip diff --git a/src/app/clusters/thread-network-directory-server/thread-network-directory-server.cpp b/src/app/clusters/thread-network-directory-server/thread-network-directory-server.cpp new file mode 100644 index 00000000000000..384686693b0a69 --- /dev/null +++ b/src/app/clusters/thread-network-directory-server/thread-network-directory-server.cpp @@ -0,0 +1,291 @@ +/** + * + * 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 "thread-network-directory-server.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::ThreadNetworkDirectory::Attributes; +using namespace chip::app::Clusters::ThreadNetworkDirectory::Commands; +using namespace chip::app::Clusters::ThreadNetworkDirectory::Structs; +using namespace chip::Thread; +using IMStatus = chip::Protocols::InteractionModel::Status; + +namespace chip { +namespace app { +namespace Clusters { + +ThreadNetworkDirectoryServer::ThreadNetworkDirectoryServer(EndpointId endpoint, ThreadNetworkDirectoryStorage & storage) : + AttributeAccessInterface(MakeOptional(endpoint), ThreadNetworkDirectory::Id), + CommandHandlerInterface(MakeOptional(endpoint), ThreadNetworkDirectory::Id), mStorage(storage) +{} + +ThreadNetworkDirectoryServer::~ThreadNetworkDirectoryServer() +{ + unregisterAttributeAccessOverride(this); + CommandHandlerInterfaceRegistry::UnregisterCommandHandler(this); +} + +CHIP_ERROR ThreadNetworkDirectoryServer::Init() +{ + VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INTERNAL); + ReturnErrorOnFailure(CommandHandlerInterfaceRegistry::RegisterCommandHandler(this)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR ThreadNetworkDirectoryServer::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) +{ + switch (aPath.mAttributeId) + { + case PreferredExtendedPanID::Id: + return ReadPreferredExtendedPanId(aPath, aEncoder); + case ThreadNetworks::Id: + return ReadThreadNetworks(aPath, aEncoder); + case ThreadNetworkTableSize::Id: + return aEncoder.Encode(mStorage.Capacity()); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ThreadNetworkDirectoryServer::Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) +{ + switch (aPath.mAttributeId) + { + case PreferredExtendedPanID::Id: + return WritePreferredExtendedPanId(aPath, aDecoder); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ThreadNetworkDirectoryServer::ReadExtendedPanId(const ConcreteDataAttributePath & aPath, + std::optional & outExPanId) +{ + MutableByteSpan value(outExPanId.emplace().bytes); + CHIP_ERROR err = GetSafeAttributePersistenceProvider()->SafeReadValue(aPath, value); + if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) + { + outExPanId.reset(); // default to empty + return CHIP_NO_ERROR; + } + ReturnErrorOnFailure(err); + + if (value.size() == 0) + { + outExPanId.reset(); + return CHIP_NO_ERROR; + } + + VerifyOrReturnError(value.size() == ExtendedPanId::size(), CHIP_ERROR_INTERNAL); + return CHIP_NO_ERROR; +} + +CHIP_ERROR ThreadNetworkDirectoryServer::ReadPreferredExtendedPanId(const ConcreteDataAttributePath & aPath, + AttributeValueEncoder & aEncoder) +{ + std::optional value; + ReturnErrorOnFailure(ReadExtendedPanId(aPath, value)); + return (value.has_value()) ? aEncoder.Encode(value.value().AsSpan()) : aEncoder.EncodeNull(); +} + +CHIP_ERROR ThreadNetworkDirectoryServer::WritePreferredExtendedPanId(const ConcreteDataAttributePath & aPath, + AttributeValueDecoder & aDecoder) +{ + DataModel::Nullable nullableValue; + ReturnErrorOnFailure(aDecoder.Decode(nullableValue)); + + // "A zero-length value SHALL be allowed for nullable values ... and SHALL have the same semantics as the null value." + ByteSpan value = nullableValue.ValueOr(ByteSpan()); + // Ensure the provided value is valid (correct size) and refers to PAN from the list. + VerifyOrReturnError(value.empty() || (value.size() == ExtendedPanId::size() && mStorage.ContainsNetwork(ExtendedPanId(value))), + StatusIB(IMStatus::ConstraintError).ToChipError()); + + return GetSafeAttributePersistenceProvider()->SafeWriteValue(aPath, value); +} + +CHIP_ERROR ThreadNetworkDirectoryServer::ReadThreadNetworks(const ConcreteDataAttributePath &, AttributeValueEncoder & aEncoder) +{ + return aEncoder.EncodeList([this](const auto & encoder) -> CHIP_ERROR { + CHIP_ERROR err = CHIP_NO_ERROR; + ExtendedPanId exPanId; + auto * iterator = mStorage.IterateNetworkIds(); + while (iterator->Next(exPanId)) + { + uint8_t datasetBuffer[kSizeOperationalDataset]; + MutableByteSpan datasetSpan(datasetBuffer); + SuccessOrExit(err = mStorage.GetNetworkDataset(exPanId, datasetSpan)); + + OperationalDataset dataset; + char networkName[kSizeNetworkName + 1]; + ThreadNetworkStruct::Type network; + + dataset.Init(datasetSpan); + SuccessOrExit(err = dataset.GetExtendedPanIdAsByteSpan(network.extendedPanID)); + SuccessOrExit(err = dataset.GetNetworkName(networkName)); + network.networkName = CharSpan::fromCharString(networkName); + SuccessOrExit(err = dataset.GetChannel(network.channel)); + SuccessOrExit(err = dataset.GetActiveTimestamp(network.activeTimestamp)); + + SuccessOrExit(err = encoder.Encode(network)); + } + exit: + iterator->Release(); + return err; + }); +} + +void ThreadNetworkDirectoryServer::InvokeCommand(HandlerContext & ctx) +{ + switch (ctx.mRequestPath.mCommandId) + { + case AddNetwork::Id: + HandleCommand( + ctx, [this](HandlerContext & aCtx, const auto & req) { HandleAddNetworkRequest(aCtx, req); }); + return; + case RemoveNetwork::Id: + HandleCommand( + ctx, [this](HandlerContext & aCtx, const auto & req) { HandleRemoveNetworkRequest(aCtx, req); }); + return; + case GetOperationalDataset::Id: + HandleCommand( + ctx, [this](HandlerContext & aCtx, const auto & req) { HandleOperationalDatasetRequest(aCtx, req); }); + return; + } +} + +void ThreadNetworkDirectoryServer::HandleAddNetworkRequest(HandlerContext & ctx, + const ThreadNetworkDirectory::Commands::AddNetwork::DecodableType & req) +{ + OperationalDataset dataset; + ByteSpan extendedPanIdSpan; + union + { + uint64_t activeTimestamp; + uint16_t channel; + uint8_t masterKey[kSizeMasterKey]; + uint8_t meshLocalPrefix[kSizeMeshLocalPrefix]; + char networkName[kSizeNetworkName + 1]; + uint16_t panId; + uint8_t pksc[kSizePSKc]; + uint32_t securityPolicy; + } unused; + ByteSpan unusedSpan; + + // "It SHALL contain at least the following sub-TLVs: Active Timestamp, Channel, Channel Mask, + // Extended PAN ID, Network Key, Network Mesh-Local Prefix, Network Name, PAN ID, PKSc, and Security Policy." + CHIP_ERROR err; + auto status = IMStatus::ConstraintError; + const char * context = nullptr; + // TODO: An immutable OperationalDatasetView on top of a ByteSpan (without copying) would be useful here. + SuccessOrExitAction(err = dataset.Init(req.operationalDataset), context = "OperationalDataset"); + SuccessOrExitAction(err = dataset.GetExtendedPanIdAsByteSpan(extendedPanIdSpan), context = "ExtendedPanID"); + SuccessOrExitAction(err = dataset.GetActiveTimestamp(unused.activeTimestamp), context = "ActiveTimestamp"); + SuccessOrExitAction(err = dataset.GetChannel(unused.channel), context = "Channel"); + SuccessOrExitAction(err = dataset.GetChannelMask(unusedSpan), context = "ChannelMask"); + SuccessOrExitAction(err = dataset.GetMasterKey(unused.masterKey), context = "NetworkKey"); + SuccessOrExitAction(err = dataset.GetMeshLocalPrefix(unused.meshLocalPrefix), context = "MeshLocalPrefix"); + SuccessOrExitAction(err = dataset.GetNetworkName(unused.networkName), context = "NetworkName"); + SuccessOrExitAction(err = dataset.GetPanId(unused.panId), context = "PanID"); + SuccessOrExitAction(err = dataset.GetPSKc(unused.pksc), context = "PKSc"); + SuccessOrExitAction(err = dataset.GetSecurityPolicy(unused.securityPolicy), context = "SecurityContext"); + + status = IMStatus::Failure; + SuccessOrExit(err = mStorage.AddOrUpdateNetwork(ExtendedPanId(extendedPanIdSpan), req.operationalDataset)); + + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, IMStatus::Success); + MatterReportingAttributeChangeCallback(GetEndpointId(), ThreadNetworkDirectory::Id, ThreadNetworks::Id); + return; + +exit: + ChipLogError(Zcl, "AddNetwork: %" CHIP_ERROR_FORMAT, err.Format()); + ctx.mCommandHandler.AddStatus( + ctx.mRequestPath, (status == IMStatus::Failure && err == CHIP_ERROR_NO_MEMORY) ? IMStatus::ResourceExhausted : status, + context); +} + +void ThreadNetworkDirectoryServer::HandleRemoveNetworkRequest( + HandlerContext & ctx, const ThreadNetworkDirectory::Commands::RemoveNetwork::DecodableType & req) +{ + CHIP_ERROR err; + + if (req.extendedPanID.size() != ExtendedPanId::size()) + { + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, IMStatus::ConstraintError); + return; + } + ExtendedPanId exPanId(req.extendedPanID); + + std::optional preferredExPanId; + ConcreteReadAttributePath preferredExPanIdPath(GetEndpointId(), ThreadNetworkDirectory::Id, + ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::Id); + SuccessOrExit(err = ReadExtendedPanId(preferredExPanIdPath, preferredExPanId)); + if (preferredExPanId.has_value() && preferredExPanId.value() == exPanId) + { + ChipLogError(Zcl, "RemoveNetwork: Rejecting removal of preferred PAN"); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, IMStatus::ConstraintError); + return; + } + + SuccessOrExit(err = mStorage.RemoveNetwork(exPanId)); + + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, IMStatus::Success); + MatterReportingAttributeChangeCallback(GetEndpointId(), ThreadNetworkDirectory::Id, ThreadNetworks::Id); + return; + +exit: + ChipLogError(Zcl, "RemoveNetwork: %" CHIP_ERROR_FORMAT, err.Format()); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, (err == CHIP_ERROR_NOT_FOUND) ? IMStatus::NotFound : IMStatus::Failure); +} + +void ThreadNetworkDirectoryServer::HandleOperationalDatasetRequest( + HandlerContext & ctx, const ThreadNetworkDirectory::Commands::GetOperationalDataset::DecodableType & req) +{ + CHIP_ERROR err; + + if (req.extendedPanID.size() != ExtendedPanId::size()) + { + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, IMStatus::ConstraintError); + return; + } + + uint8_t datasetBuffer[kSizeOperationalDataset]; + MutableByteSpan datasetSpan(datasetBuffer); + OperationalDatasetResponse::Type response; + SuccessOrExit(err = mStorage.GetNetworkDataset(ExtendedPanId(req.extendedPanID), datasetSpan)); + response.operationalDataset = datasetSpan; + ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); + return; +exit: + ChipLogError(Zcl, "GetOperationalDataset: %" CHIP_ERROR_FORMAT, err.Format()); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, (err == CHIP_ERROR_NOT_FOUND) ? IMStatus::NotFound : IMStatus::Failure); +} + +} // namespace Clusters +} // namespace app +} // namespace chip + +void MatterThreadNetworkDirectoryPluginServerInitCallback() {} diff --git a/src/app/clusters/thread-network-directory-server/thread-network-directory-server.h b/src/app/clusters/thread-network-directory-server/thread-network-directory-server.h new file mode 100644 index 00000000000000..2f671bdd6b4e09 --- /dev/null +++ b/src/app/clusters/thread-network-directory-server/thread-network-directory-server.h @@ -0,0 +1,86 @@ +/** + * + * 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 +#include +#include +#include +#include +#include +#include + +#include + +namespace chip { +namespace app { +namespace Clusters { + +class ThreadNetworkDirectoryServer : private AttributeAccessInterface, private CommandHandlerInterface +{ +public: + ThreadNetworkDirectoryServer(EndpointId endpoint, ThreadNetworkDirectoryStorage & storage); + ~ThreadNetworkDirectoryServer(); + + CHIP_ERROR Init(); + + ThreadNetworkDirectoryServer(ThreadNetworkDirectoryServer const &) = delete; + ThreadNetworkDirectoryServer & operator=(ThreadNetworkDirectoryServer const &) = delete; + +private: + using ExtendedPanId = ThreadNetworkDirectoryStorage::ExtendedPanId; + + EndpointId GetEndpointId() { return AttributeAccessInterface::GetEndpointId().Value(); } + + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; + CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override; + void InvokeCommand(HandlerContext & handlerContext) override; + + CHIP_ERROR ReadExtendedPanId(const ConcreteDataAttributePath & aPath, std::optional & outExPanId); + CHIP_ERROR ReadPreferredExtendedPanId(const ConcreteDataAttributePath & aPath, AttributeValueEncoder & aEncoder); + CHIP_ERROR WritePreferredExtendedPanId(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder); + CHIP_ERROR ReadThreadNetworks(const ConcreteDataAttributePath & aPath, AttributeValueEncoder & aEncoder); + + void HandleAddNetworkRequest(HandlerContext & ctx, const ThreadNetworkDirectory::Commands::AddNetwork::DecodableType & req); + void HandleRemoveNetworkRequest(HandlerContext & ctx, + const ThreadNetworkDirectory::Commands::RemoveNetwork::DecodableType & req); + void HandleOperationalDatasetRequest(HandlerContext & ctx, + const ThreadNetworkDirectory::Commands::GetOperationalDataset::DecodableType & req); + + ThreadNetworkDirectoryStorage & mStorage; +}; + +/** + * A ThreadNetworkDirectoryServer using DefaultThreadNetworkDirectoryStorage. + */ +class DefaultThreadNetworkDirectoryServer final : public ThreadNetworkDirectoryServer +{ +public: + DefaultThreadNetworkDirectoryServer(EndpointId endpoint, + PersistentStorageDelegate & storage = Server::GetInstance().GetPersistentStorage()) : + ThreadNetworkDirectoryServer(endpoint, mStorage), + mStorage(storage) + {} + +private: + DefaultThreadNetworkDirectoryStorage mStorage; +}; + +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/time-synchronization-server/time-synchronization-server.h b/src/app/clusters/time-synchronization-server/time-synchronization-server.h index 2581c9712e7862..ecc9a68cc3fc12 100644 --- a/src/app/clusters/time-synchronization-server/time-synchronization-server.h +++ b/src/app/clusters/time-synchronization-server/time-synchronization-server.h @@ -124,9 +124,10 @@ class TimeSynchronizationServer : public FabricTable::Delegate void OnAttributeData(const ConcreteDataAttributePath & aPath, TLV::TLVReader * apData, const StatusIB & aStatus) override; void OnDone(ReadClient * apReadClient) override; - CHIP_ERROR AttemptToGetTimeFromTrustedNode(); #endif + CHIP_ERROR AttemptToGetTimeFromTrustedNode(); + // Platform event handler functions void OnPlatformEventFn(const DeviceLayer::ChipDeviceEvent & event); diff --git a/src/app/clusters/water-heater-management-server/WaterHeaterManagementTestEventTriggerHandler.h b/src/app/clusters/water-heater-management-server/WaterHeaterManagementTestEventTriggerHandler.h new file mode 100644 index 00000000000000..54b07cde0c2158 --- /dev/null +++ b/src/app/clusters/water-heater-management-server/WaterHeaterManagementTestEventTriggerHandler.h @@ -0,0 +1,86 @@ +/* + * + * 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 +#include + +/** + * @brief User handler for handling the test event trigger + * + * @note If TestEventTrigger is enabled, it needs to be implemented in the app + * + * @param eventTrigger Event trigger to handle + * + * @retval true on success + * @retval false if error happened + */ +bool HandleWaterHeaterManagementTestEventTrigger(uint64_t eventTrigger); + +namespace chip { + +/* + * These Test EventTrigger values can be used to produce artificial water heater configuration + * and water temperatures. + * + * They are sent along with the enableKey (manufacturer defined secret) + * in the General Diagnostic cluster TestEventTrigger command + */ +enum class WaterHeaterManagementTrigger : uint64_t +{ + // Simulate installation in a 100L tank full of water at 20C, with a target temperature of 60C, in OFF mode + kBasicInstallationTestEvent = 0x0094'0000'0000'0000, + + // End simulation of installation + kBasicInstallationTestEventClear = 0x0094'0000'0000'0001, + + // Simulate 100% of the water in the tank being at 20C + kWaterTemperature20CTestEvent = 0x0094'0000'0000'0002, + + // Simulate 100% of the water in the tank being at 61C + kWaterTemperature61CTestEvent = 0x0094'0000'0000'0003, + + // Simulate 100% of the water in the tank being at 66C + kWaterTemperature66CTestEvent = 0x0094'0000'0000'0004, + + // Simulate the Water Heater Mode being set to MANUAL + kManualModeTestEvent = 0x0094'0000'0000'0005, + + // Simulate the Water Heater Mode being set to OFF + kOffModeTestEvent = 0x0094'0000'0000'0006, + + // Simulate drawing off 25% of the tank volume of hot water, replaced with water at 20C + kDrawOffHotWaterTestEvent = 0x0094'0000'0000'0007, +}; + +class WaterHeaterManagementTestEventTriggerHandler : public TestEventTriggerHandler +{ +public: + WaterHeaterManagementTestEventTriggerHandler() {} + + CHIP_ERROR HandleEventTrigger(uint64_t eventTrigger) override + { + if (HandleWaterHeaterManagementTestEventTrigger(eventTrigger)) + { + return CHIP_NO_ERROR; + } + return CHIP_ERROR_INVALID_ARGUMENT; + } +}; + +} // namespace chip diff --git a/src/app/clusters/water-heater-management-server/water-heater-management-server.cpp b/src/app/clusters/water-heater-management-server/water-heater-management-server.cpp new file mode 100644 index 00000000000000..6af249370e8fb8 --- /dev/null +++ b/src/app/clusters/water-heater-management-server/water-heater-management-server.cpp @@ -0,0 +1,193 @@ +/* + * 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 "water-heater-management-server.h" + +#include +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::WaterHeaterManagement; +using namespace chip::app::Clusters::WaterHeaterManagement::Attributes; + +using chip::Protocols::InteractionModel::Status; + +namespace chip { +namespace app { +namespace Clusters { +namespace WaterHeaterManagement { + +constexpr uint16_t kClusterRevision = 1; + +CHIP_ERROR Instance::Init() +{ + ReturnErrorOnFailure(CommandHandlerInterfaceRegistry::RegisterCommandHandler(this)); + VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); + + return CHIP_NO_ERROR; +} + +void Instance::Shutdown() +{ + CommandHandlerInterfaceRegistry::UnregisterCommandHandler(this); + unregisterAttributeAccessOverride(this); +} + +bool Instance::HasFeature(Feature aFeature) const +{ + return mFeature.Has(aFeature); +} + +// AttributeAccessInterface +CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) +{ + switch (aPath.mAttributeId) + { + case HeaterTypes::Id: + return aEncoder.Encode(mDelegate.GetHeaterTypes()); + case HeatDemand::Id: + return aEncoder.Encode(mDelegate.GetHeatDemand()); + case TankVolume::Id: + if (!HasFeature(Feature::kEnergyManagement)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + return aEncoder.Encode(mDelegate.GetTankVolume()); + case EstimatedHeatRequired::Id: + if (!HasFeature(Feature::kEnergyManagement)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + return aEncoder.Encode(mDelegate.GetEstimatedHeatRequired()); + case TankPercentage::Id: + if (!HasFeature(Feature::kTankPercent)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + return aEncoder.Encode(mDelegate.GetTankPercentage()); + case BoostState::Id: + return aEncoder.Encode(mDelegate.GetBoostState()); + + /* FeatureMap - is held locally */ + case FeatureMap::Id: + return aEncoder.Encode(mFeature); + case ClusterRevision::Id: + return aEncoder.Encode(kClusterRevision); + } + + /* Allow all other unhandled attributes to fall through to Ember */ + return CHIP_NO_ERROR; +} + +void Instance::InvokeCommand(HandlerContext & handlerContext) +{ + using namespace Commands; + + switch (handlerContext.mRequestPath.mCommandId) + { + case Boost::Id: + HandleCommand( + handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleBoost(ctx, commandData); }); + return; + case CancelBoost::Id: + HandleCommand( + handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleCancelBoost(ctx, commandData); }); + return; + } +} + +void Instance::HandleBoost(HandlerContext & ctx, const Commands::Boost::DecodableType & commandData) +{ + uint32_t duration = commandData.duration; + Optional oneShot = commandData.oneShot; + Optional emergencyBoost = commandData.emergencyBoost; + Optional temporarySetpoint = commandData.temporarySetpoint; + Optional targetPercentage = commandData.targetPercentage; + Optional targetReheat = commandData.targetReheat; + + // Notify the appliance if the appliance hardware cannot be adjusted, then return Failure + if (HasFeature(WaterHeaterManagement::Feature::kTankPercent)) + { + if (targetPercentage.HasValue()) + { + if (targetPercentage.Value() > 100) + { + ChipLogError(Zcl, "Bad targetPercentage %u", targetPercentage.Value()); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidCommand); + return; + } + } + + if (targetReheat.HasValue()) + { + if (targetReheat.Value() > 100) + { + ChipLogError(Zcl, "Bad targetReheat %u", targetReheat.Value()); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidCommand); + return; + } + + if (!targetPercentage.HasValue()) + { + ChipLogError(Zcl, "targetPercentage must be specified if targetReheat specified"); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidCommand); + return; + } + + if (oneShot.HasValue()) + { + ChipLogError(Zcl, "Cannot specify targetReheat with targetPercentage and oneShot. oneShot must be excluded"); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidCommand); + return; + } + } + } + else if (targetPercentage.HasValue() || targetReheat.HasValue()) + { + ChipLogError(Zcl, "Cannot specify targetPercentage or targetReheat if the feature TankPercent is not supported"); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidCommand); + return; + } + + Status status = mDelegate.HandleBoost(duration, oneShot, emergencyBoost, temporarySetpoint, targetPercentage, targetReheat); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); + if (status != Status::Success) + { + ChipLogError(Zcl, "WHM: Boost command failed. status " ChipLogFormatIMStatus, ChipLogValueIMStatus(status)); + } +} + +void Instance::HandleCancelBoost(HandlerContext & ctx, const Commands::CancelBoost::DecodableType & commandData) +{ + Status status = mDelegate.HandleCancelBoost(); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); + if (status != Status::Success) + { + ChipLogError(Zcl, "WHM: CancelBoost command failed. status " ChipLogFormatIMStatus, ChipLogValueIMStatus(status)); + return; + } +} + +} // namespace WaterHeaterManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/water-heater-management-server/water-heater-management-server.h b/src/app/clusters/water-heater-management-server/water-heater-management-server.h new file mode 100644 index 00000000000000..a0a48ab900c200 --- /dev/null +++ b/src/app/clusters/water-heater-management-server/water-heater-management-server.h @@ -0,0 +1,132 @@ +/* + * + * 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 +#include +#include +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace WaterHeaterManagement { + +class Delegate +{ +public: + Delegate() = default; + virtual ~Delegate() = default; + + void SetEndpointId(EndpointId aEndpoint) { mEndpointId = aEndpoint; } + + /** + * @brief Delegate should implement a handler to start boosting the water temperature as required. + * Upon receipt, the Water Heater SHALL transition into the BOOST state, which SHALL cause the water in the + * tank (or the TargetPercentage of the water, if included) to be heated towards the set point (or the + * TemporarySetpoint, if included), which in turn may cause a call for heat, even if the mode is OFF, or + * is TIMED and it is during one of the Off periods. + * + * @param duration Indicates the time period in seconds for which the BOOST state is activated before it automatically reverts + * to the previous mode (e.g. OFF, MANUAL or TIMED). + * @param oneShot Indicates whether the BOOST state should be automatically canceled once the hot water has first reached the + * set point temperature (or the TemporarySetpoint temperature, if specified) for the TargetPercentage (if + * specified). + * @param emergencyBoost Indicates that the consumer wants the water to be heated as quickly as practicable. This MAY cause + * multiple heat sources to be activated (e.g. a heat pump and direct electric heating element). + * @param temporarySetpoint Indicates the target temperature to which to heat the hot water for this Boost command. It SHALL be + * used instead of the normal set point temperature whilst the BOOST state is active. + * @param targetPercentage If the tank supports the TankPercent feature, this field indicates the amount of water that SHALL be + * heated by this Boost command before the heater is switched off. + * @param targetReheat If the tank supports the TankPercent feature, and the heating by this Boost command has ceased because + * the TargetPercentage of the water in the tank has been heated to the set point (or TemporarySetpoint if + * included), this field indicates the percentage to which the hot water in the tank SHALL be allowed to + * fall before again beginning to reheat it. + * + * @return Success if the boost command is accepted; otherwise the command SHALL be rejected with appropriate error. + */ + virtual Protocols::InteractionModel::Status HandleBoost(uint32_t duration, Optional oneShot, + Optional emergencyBoost, Optional temporarySetpoint, + Optional targetPercentage, Optional targetReheat) = 0; + + /** + * @brief Delegate should implement a handler to cancel a boost command. + * Upon receipt, the Water Heater SHALL transition back from the BOOST state to the previous mode (e.g. OFF, + * MANUAL or TIMED). + * + * @return It should report SUCCESS if successful and FAILURE otherwise. + */ + virtual Protocols::InteractionModel::Status HandleCancelBoost() = 0; + + // ------------------------------------------------------------------ + // Get attribute methods + virtual BitMask GetHeaterTypes() = 0; + virtual BitMask GetHeatDemand() = 0; + virtual uint16_t GetTankVolume() = 0; + virtual int64_t GetEstimatedHeatRequired() = 0; + virtual Percent GetTankPercentage() = 0; + virtual BoostStateEnum GetBoostState() = 0; + +protected: + EndpointId mEndpointId = 0; +}; + +class Instance : public AttributeAccessInterface, public CommandHandlerInterface +{ +public: + Instance(EndpointId aEndpointId, Delegate & aDelegate, Feature aFeature) : + AttributeAccessInterface(MakeOptional(aEndpointId), Id), CommandHandlerInterface(MakeOptional(aEndpointId), Id), + mDelegate(aDelegate), mFeature(aFeature) + { + /* set the base class delegates endpointId */ + mDelegate.SetEndpointId(aEndpointId); + } + + ~Instance() { Shutdown(); } + + CHIP_ERROR Init(); + void Shutdown(); + + bool HasFeature(Feature aFeature) const; + +private: + Delegate & mDelegate; + BitMask mFeature; + + // AttributeAccessInterface + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; + // NOTE there are no writable attributes + + // CommandHandlerInterface + void InvokeCommand(HandlerContext & handlerContext) override; + + void HandleBoost(HandlerContext & ctx, const Commands::Boost::DecodableType & commandData); + void HandleCancelBoost(HandlerContext & ctx, const Commands::CancelBoost::DecodableType & commandData); +}; + +} // namespace WaterHeaterManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/wifi-network-management-server/wifi-network-management-server.cpp b/src/app/clusters/wifi-network-management-server/wifi-network-management-server.cpp index 1a739e354bd3df..43048498602ff8 100644 --- a/src/app/clusters/wifi-network-management-server/wifi-network-management-server.cpp +++ b/src/app/clusters/wifi-network-management-server/wifi-network-management-server.cpp @@ -18,11 +18,11 @@ #include "wifi-network-management-server.h" #include +#include #include #include -#include -#include #include +#include #include #include @@ -55,34 +55,23 @@ bool IsValidWpaPersonalCredential(ByteSpan credential) return false; } -Global gWiFiNetworkManagementServerInstance; - } // namespace -WiFiNetworkManagementServer & WiFiNetworkManagementServer::Instance() -{ - return gWiFiNetworkManagementServerInstance.get(); -} - -WiFiNetworkManagementServer::WiFiNetworkManagementServer() : - AttributeAccessInterface(NullOptional, WiFiNetworkManagement::Id), - CommandHandlerInterface(NullOptional, WiFiNetworkManagement::Id) +WiFiNetworkManagementServer::WiFiNetworkManagementServer(EndpointId endpoint) : + AttributeAccessInterface(MakeOptional(endpoint), WiFiNetworkManagement::Id), + CommandHandlerInterface(MakeOptional(endpoint), WiFiNetworkManagement::Id) {} WiFiNetworkManagementServer::~WiFiNetworkManagementServer() { unregisterAttributeAccessOverride(this); - InteractionModelEngine::GetInstance()->UnregisterCommandHandler(this); + CommandHandlerInterfaceRegistry::UnregisterCommandHandler(this); } -CHIP_ERROR WiFiNetworkManagementServer::Init(EndpointId endpoint) +CHIP_ERROR WiFiNetworkManagementServer::Init() { - VerifyOrReturnError(endpoint != kInvalidEndpointId, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(mEndpointId == kInvalidEndpointId, CHIP_ERROR_INCORRECT_STATE); - - mEndpointId = endpoint; VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INTERNAL); - ReturnErrorOnFailure(InteractionModelEngine::GetInstance()->RegisterCommandHandler(this)); + ReturnErrorOnFailure(CommandHandlerInterfaceRegistry::RegisterCommandHandler(this)); return CHIP_NO_ERROR; } @@ -92,7 +81,7 @@ CHIP_ERROR WiFiNetworkManagementServer::ClearNetworkCredentials() mSsidLen = 0; mPassphrase.SetLength(0); - MatterReportingAttributeChangeCallback(mEndpointId, WiFiNetworkManagement::Id, Ssid::Id); + MatterReportingAttributeChangeCallback(GetEndpointId(), WiFiNetworkManagement::Id, Ssid::Id); return CHIP_NO_ERROR; } @@ -111,10 +100,19 @@ CHIP_ERROR WiFiNetworkManagementServer::SetNetworkCredentials(ByteSpan ssid, Byt VerifyOrDie(mPassphrase.SetLength(passphrase.size()) == CHIP_NO_ERROR); memcpy(mPassphrase.Bytes(), passphrase.data(), passphrase.size()); - // Note: The spec currently defines no way to signal a passphrase change if (ssidChanged) { - MatterReportingAttributeChangeCallback(mEndpointId, WiFiNetworkManagement::Id, Ssid::Id); + MatterReportingAttributeChangeCallback(GetEndpointId(), WiFiNetworkManagement::Id, Ssid::Id); + } + if (passphraseChanged) + { + mPassphraseSurrogate++; + System::Clock::Milliseconds64 realtime; + if (System::SystemClock().GetClock_RealTimeMS(realtime) == CHIP_NO_ERROR) + { + mPassphraseSurrogate = std::max(mPassphraseSurrogate, realtime.count()); + } + MatterReportingAttributeChangeCallback(GetEndpointId(), WiFiNetworkManagement::Id, PassphraseSurrogate::Id); } return CHIP_NO_ERROR; } @@ -125,6 +123,8 @@ CHIP_ERROR WiFiNetworkManagementServer::Read(const ConcreteReadAttributePath & a { case Ssid::Id: return HaveNetworkCredentials() ? aEncoder.Encode(SsidSpan()) : aEncoder.EncodeNull(); + case PassphraseSurrogate::Id: + return HaveNetworkCredentials() ? aEncoder.Encode(mPassphraseSurrogate) : aEncoder.EncodeNull(); } return CHIP_NO_ERROR; } @@ -160,17 +160,4 @@ void WiFiNetworkManagementServer::HandleNetworkPassphraseRequest(HandlerContext } // namespace app } // namespace chip -#if defined(MATTER_DM_WIFI_NETWORK_MANAGEMENT_CLUSTER_SERVER_ENDPOINT_COUNT) && \ - MATTER_DM_WIFI_NETWORK_MANAGEMENT_CLUSTER_SERVER_ENDPOINT_COUNT > 1 -#error Only a single Wi-Fi Network Management Cluster instance is supported. -#endif - void MatterWiFiNetworkManagementPluginServerInitCallback() {} - -void emberAfWiFiNetworkManagementClusterServerInitCallback(EndpointId endpoint) -{ - // We could delay constructing the instance until this point; however it's not - // clear if this is inconvenient in terms of forcing the application to initialize - // the network credentials later than it otherwise would. - LogErrorOnFailure(chip::app::Clusters::WiFiNetworkManagementServer::Instance().Init(endpoint)); -} diff --git a/src/app/clusters/wifi-network-management-server/wifi-network-management-server.h b/src/app/clusters/wifi-network-management-server/wifi-network-management-server.h index aa3cba89636a77..c538c585e74899 100644 --- a/src/app/clusters/wifi-network-management-server/wifi-network-management-server.h +++ b/src/app/clusters/wifi-network-management-server/wifi-network-management-server.h @@ -20,9 +20,7 @@ #include #include #include -#include #include -#include #include void emberAfWiFiNetworkManagementClusterServerInitCallback(chip::EndpointId); @@ -34,35 +32,32 @@ namespace Clusters { class WiFiNetworkManagementServer : private AttributeAccessInterface, private CommandHandlerInterface { public: - static WiFiNetworkManagementServer & Instance(); + WiFiNetworkManagementServer(EndpointId endpoint); + ~WiFiNetworkManagementServer(); + + CHIP_ERROR Init(); CHIP_ERROR ClearNetworkCredentials(); CHIP_ERROR SetNetworkCredentials(ByteSpan ssid, ByteSpan passphrase); -private: - friend Global; - friend void ::emberAfWiFiNetworkManagementClusterServerInitCallback(chip::EndpointId); - - WiFiNetworkManagementServer(); - ~WiFiNetworkManagementServer(); - CHIP_ERROR Init(EndpointId endpoint); - WiFiNetworkManagementServer(WiFiNetworkManagementServer const &) = delete; WiFiNetworkManagementServer & operator=(WiFiNetworkManagementServer const &) = delete; +private: + EndpointId GetEndpointId() { return AttributeAccessInterface::GetEndpointId().Value(); } + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; void InvokeCommand(HandlerContext & handlerContext) override; void HandleNetworkPassphraseRequest(HandlerContext & ctx, const WiFiNetworkManagement::Commands::NetworkPassphraseRequest::DecodableType & req); - EndpointId mEndpointId = kInvalidEndpointId; - uint8_t mSsid[32]; uint8_t mSsidLen = 0; static_assert(std::numeric_limits::max() >= sizeof(mSsid)); ByteSpan SsidSpan() const { return ByteSpan(mSsid, mSsidLen); } + uint64_t mPassphraseSurrogate = 0; Crypto::SensitiveDataBuffer<64> mPassphrase; ByteSpan PassphraseSpan() const { return mPassphrase.Span(); } diff --git a/src/app/codegen-data-model/BUILD.gn b/src/app/codegen-data-model/BUILD.gn index 5803f01a37778e..955f76c091c0bd 100644 --- a/src/app/codegen-data-model/BUILD.gn +++ b/src/app/codegen-data-model/BUILD.gn @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import("//build_overrides/chip.gni") + # This source set is TIGHLY coupled with code-generated data models # as generally implemented by `src/app/util` # @@ -20,9 +21,25 @@ import("//build_overrides/chip.gni") # # Use `model.gni` to get access to: # CodegenDataModel.cpp -# CodegenDataModel_Read.cpp # CodegenDataModel.h +# CodegenDataModel_Read.cpp +# CodegenDataModel_Write.cpp +# EmberMetadata.cpp +# EmberMetadata.h +# Instance.cpp # # The above list of files exists to satisfy the "dependency linter" # since those files should technically be "visible to gn" even though we # are supposed to go through model.gni constants + +source_set("instance-header") { + # TODO: this is a workaround until we have actual injection in our code. The issue is that + # DataModel is not currently injected and InteractionModelEngine needs a default + # + # The default should be code-generated data models, however that depends on code + # generation and is application specific. + # + # This only declares that the instance method is provided by something (that something + # generally being unit tests or data_model.gni/data_model.cmake files) + sources = [ "Instance.h" ] +} diff --git a/src/app/codegen-data-model/CodegenDataModel.cpp b/src/app/codegen-data-model/CodegenDataModel.cpp index ec7b13af357287..851f7c341ab127 100644 --- a/src/app/codegen-data-model/CodegenDataModel.cpp +++ b/src/app/codegen-data-model/CodegenDataModel.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -231,18 +232,20 @@ bool CodegenDataModel::EmberCommandListIterator::Exists(const CommandId * list, return (*mCurrentHint == toCheck); } -CHIP_ERROR CodegenDataModel::WriteAttribute(const InteractionModel::WriteAttributeRequest & request, - AttributeValueDecoder & decoder) -{ - // TODO: this needs an implementation - return CHIP_ERROR_NOT_IMPLEMENTED; -} - CHIP_ERROR CodegenDataModel::Invoke(const InteractionModel::InvokeRequest & request, TLV::TLVReader & input_arguments, - InteractionModel::InvokeReply & reply) + CommandHandler * handler) { - // TODO: this needs an implementation - return CHIP_ERROR_NOT_IMPLEMENTED; + // TODO: CommandHandlerInterface support is currently + // residing in InteractionModelEngine itself. We may want to separate this out + // into its own registry, similar to attributes, so that IM is decoupled from actual storage of things. + // + // Open issue at https://github.com/project-chip/connectedhomeip/issues/34258 + + // Ember dispatching automatically uses `handler` to set an appropriate result or status + // This never fails (as handler error is encoded as needed). + DispatchSingleClusterCommand(request.path, input_arguments, handler); + + return CHIP_NO_ERROR; } EndpointId CodegenDataModel::FirstEndpoint() diff --git a/src/app/codegen-data-model/CodegenDataModel.h b/src/app/codegen-data-model/CodegenDataModel.h index b65f38b9155e73..123dcd72382291 100644 --- a/src/app/codegen-data-model/CodegenDataModel.h +++ b/src/app/codegen-data-model/CodegenDataModel.h @@ -71,7 +71,7 @@ class CodegenDataModel : public chip::app::InteractionModel::DataModel CHIP_ERROR ReadAttribute(const InteractionModel::ReadAttributeRequest & request, AttributeValueEncoder & encoder) override; CHIP_ERROR WriteAttribute(const InteractionModel::WriteAttributeRequest & request, AttributeValueDecoder & decoder) override; CHIP_ERROR Invoke(const InteractionModel::InvokeRequest & request, chip::TLV::TLVReader & input_arguments, - InteractionModel::InvokeReply & reply) override; + CommandHandler * handler) override; /// attribute tree iteration EndpointId FirstEndpoint() override; diff --git a/src/app/codegen-data-model/CodegenDataModel_Read.cpp b/src/app/codegen-data-model/CodegenDataModel_Read.cpp index 04265d37f8623f..3e1f246cb3a2f9 100644 --- a/src/app/codegen-data-model/CodegenDataModel_Read.cpp +++ b/src/app/codegen-data-model/CodegenDataModel_Read.cpp @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "lib/core/CHIPError.h" #include #include @@ -29,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -49,56 +49,6 @@ namespace app { namespace { using namespace chip::app::Compatibility::Internal; -// Fetch the source for the given attribute path: either a cluster (for global ones) or attribute -// path. -// -// if returning a CHIP_ERROR, it will NEVER be CHIP_NO_ERROR. -std::variant -FindAttributeMetadata(const ConcreteAttributePath & aPath) -{ - for (auto & attr : GlobalAttributesNotInMetadata) - { - - if (attr == aPath.mAttributeId) - { - const EmberAfCluster * cluster = emberAfFindServerCluster(aPath.mEndpointId, aPath.mClusterId); - if (cluster == nullptr) - { - return (emberAfFindEndpointType(aPath.mEndpointId) == nullptr) ? CHIP_IM_GLOBAL_STATUS(UnsupportedEndpoint) - : CHIP_IM_GLOBAL_STATUS(UnsupportedCluster); - } - - return cluster; - } - } - const EmberAfAttributeMetadata * metadata = - emberAfLocateAttributeMetadata(aPath.mEndpointId, aPath.mClusterId, aPath.mAttributeId); - - if (metadata == nullptr) - { - const EmberAfEndpointType * type = emberAfFindEndpointType(aPath.mEndpointId); - if (type == nullptr) - { - return CHIP_IM_GLOBAL_STATUS(UnsupportedEndpoint); - } - - const EmberAfCluster * cluster = emberAfFindClusterInType(type, aPath.mClusterId, CLUSTER_MASK_SERVER); - if (cluster == nullptr) - { - return CHIP_IM_GLOBAL_STATUS(UnsupportedCluster); - } - - // Since we know the attribute is unsupported and the endpoint/cluster are - // OK, this is the only option left. - return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); - } - - return metadata; -} - /// Attempts to read via an attribute access interface (AAI) /// /// If it returns a CHIP_ERROR, then this is a FINAL result (i.e. either failure or success). @@ -138,6 +88,14 @@ struct ShortPascalString { using LengthType = uint8_t; static constexpr LengthType kNullLength = 0xFF; + + static size_t GetLength(ByteSpan buffer) + { + VerifyOrDie(buffer.size() >= 1); + // NOTE: we do NOT use emberAfStringLength from ember-strings.h because that will result in 0 + // length for null sizes (i.e. 0xFF is translated to 0 and we do not want that here) + return buffer[0]; + } }; /// Metadata of what a ember/pascal LONG string means (prepended by a u16 length) @@ -145,6 +103,15 @@ struct LongPascalString { using LengthType = uint16_t; static constexpr LengthType kNullLength = 0xFFFF; + + static size_t GetLength(ByteSpan buffer) + { + // NOTE: we do NOT use emberAfLongStringLength from ember-strings.h because that will result in 0 + // length for null sizes (i.e. 0xFFFF is translated to 0 and we do not want that here) + VerifyOrDie(buffer.size() >= 2); + const uint8_t * data = buffer.data(); + return Encoding::LittleEndian::Read16(data); + } }; // ember assumptions ... should just work @@ -154,23 +121,20 @@ static_assert(sizeof(LongPascalString::LengthType) == 2); /// Given a ByteSpan containing data from ember, interpret it /// as a span of type OUT (i.e. ByteSpan or CharSpan) given a ENCODING /// where ENCODING is Short or Long pascal strings. -template -std::optional ExtractEmberString(ByteSpan data) +template +std::optional ExtractEmberString(ByteSpan data) { - typename ENCODING::LengthType len; - - // Ember storage format for pascal-prefix data is specifically "native byte order", - // hence the use of memcpy. - VerifyOrDie(sizeof(len) <= data.size()); - memcpy(&len, data.data(), sizeof(len)); + constexpr size_t kLengthTypeSize = sizeof(typename ENCODING::LengthType); + VerifyOrDie(kLengthTypeSize <= data.size()); + auto len = ENCODING::GetLength(data); if (len == ENCODING::kNullLength) { return std::nullopt; } - VerifyOrDie(static_cast(len + sizeof(len)) <= data.size()); - return std::make_optional(reinterpret_cast(data.data() + sizeof(len)), len); + VerifyOrDie(len + sizeof(len) <= data.size()); + return std::make_optional(reinterpret_cast(data.data() + kLengthTypeSize), len); } /// Encode a value inside `encoder` @@ -282,7 +246,7 @@ CHIP_ERROR EncodeEmberValue(ByteSpan data, const EmberAfAttributeMetadata * meta return EncodeStringLike(data, isNullable, encoder); default: ChipLogError(DataManagement, "Attribute type 0x%x not handled", static_cast(metadata->attributeType)); - return CHIP_IM_GLOBAL_STATUS(UnsupportedRead); + return CHIP_IM_GLOBAL_STATUS(Failure); } } @@ -311,21 +275,26 @@ CHIP_ERROR CodegenDataModel::ReadAttribute(const InteractionModel::ReadAttribute RequiredPrivilege::ForReadAttribute(request.path)); if (err != CHIP_NO_ERROR) { + ReturnErrorCodeIf(err != CHIP_ERROR_ACCESS_DENIED, err); + // Implementation of 8.4.3.2 of the spec for path expansion - if (request.path.mExpanded && (err == CHIP_ERROR_ACCESS_DENIED)) + if (request.path.mExpanded) { return CHIP_NO_ERROR; } - return err; + // access denied has a specific code for IM + return CHIP_IM_GLOBAL_STATUS(UnsupportedAccess); } } - auto metadata = FindAttributeMetadata(request.path); + auto metadata = Ember::FindAttributeMetadata(request.path); // Explicit failure in finding a suitable metadata if (const CHIP_ERROR * err = std::get_if(&metadata)) { - VerifyOrDie(*err != CHIP_NO_ERROR); + VerifyOrDie((*err == CHIP_IM_GLOBAL_STATUS(UnsupportedEndpoint)) || // + (*err == CHIP_IM_GLOBAL_STATUS(UnsupportedCluster)) || // + (*err == CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute))); return *err; } diff --git a/src/app/codegen-data-model/CodegenDataModel_Write.cpp b/src/app/codegen-data-model/CodegenDataModel_Write.cpp new file mode 100644 index 00000000000000..999f35ea7836cf --- /dev/null +++ b/src/app/codegen-data-model/CodegenDataModel_Write.cpp @@ -0,0 +1,405 @@ +/* + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace chip { +namespace app { +namespace { + +using namespace chip::app::Compatibility::Internal; + +/// Attempts to write via an attribute access interface (AAI) +/// +/// If it returns a CHIP_ERROR, then this is a FINAL result (i.e. either failure or success) +/// +/// If it returns std::nullopt, then there is no AAI to handle the given path +/// and processing should figure out the value otherwise (generally from other ember data) +std::optional TryWriteViaAccessInterface(const ConcreteAttributePath & path, AttributeAccessInterface * aai, + AttributeValueDecoder & decoder) +{ + // Processing can happen only if an attribute access interface actually exists.. + if (aai == nullptr) + { + return std::nullopt; + } + + CHIP_ERROR err = aai->Write(path, decoder); + + if (err != CHIP_NO_ERROR) + { + return std::make_optional(err); + } + + // If the decoder tried to decode, then a value should have been read for processing. + // - if decoding was done, assume DONE (i.e. final CHIP_NO_ERROR) + // - otherwise, if no decoding done, return that processing must continue via nullopt + return decoder.TriedDecode() ? std::make_optional(CHIP_NO_ERROR) : std::nullopt; +} + +/// Metadata of what a ember/pascal short string means (prepended by a u8 length) +struct ShortPascalString +{ + using LengthType = uint8_t; + static constexpr LengthType kNullLength = 0xFF; + + static void SetLength(uint8_t * buffer, LengthType value) { *buffer = value; } +}; + +/// Metadata of what a ember/pascal LONG string means (prepended by a u16 length) +struct LongPascalString +{ + using LengthType = uint16_t; + static constexpr LengthType kNullLength = 0xFFFF; + + // Encoding for ember string lengths is little-endian (see ember-strings.cpp) + static void SetLength(uint8_t * buffer, LengthType value) { Encoding::LittleEndian::Put16(buffer, value); } +}; + +// ember assumptions ... should just work +static_assert(sizeof(ShortPascalString::LengthType) == 1); +static_assert(sizeof(LongPascalString::LengthType) == 2); + +/// Convert the value stored in 'decoder' into an ember format span 'out' +/// +/// The value converted will be of type T (e.g. CharSpan or ByteSpan) and it will be converted +/// via the given ENCODING (i.e. ShortPascalString or LongPascalString) +/// +/// isNullable defines if the value of NULL is allowed to be converted. +template +CHIP_ERROR DecodeStringLikeIntoEmberBuffer(AttributeValueDecoder decoder, bool isNullable, MutableByteSpan & out) +{ + T workingValue; + + if (isNullable) + { + typename DataModel::Nullable nullableWorkingValue; + ReturnErrorOnFailure(decoder.Decode(nullableWorkingValue)); + + if (nullableWorkingValue.IsNull()) + { + VerifyOrReturnError(out.size() >= sizeof(typename ENCODING::LengthType), CHIP_ERROR_BUFFER_TOO_SMALL); + ENCODING::SetLength(out.data(), ENCODING::kNullLength); + out.reduce_size(sizeof(typename ENCODING::LengthType)); + return CHIP_NO_ERROR; + } + + // continue encoding non-null value + workingValue = nullableWorkingValue.Value(); + } + else + { + ReturnErrorOnFailure(decoder.Decode(workingValue)); + } + + auto len = static_cast(workingValue.size()); + VerifyOrReturnError(out.size() >= sizeof(len) + len, CHIP_ERROR_BUFFER_TOO_SMALL); + + uint8_t * output_buffer = out.data(); + + ENCODING::SetLength(output_buffer, len); + output_buffer += sizeof(len); + + memcpy(output_buffer, workingValue.data(), workingValue.size()); + output_buffer += workingValue.size(); + + out.reduce_size(static_cast(output_buffer - out.data())); + return CHIP_NO_ERROR; +} + +/// Decodes a numeric data value of type T from the `decoder` into a ember-encoded buffer `out` +/// +/// isNullable defines if the value of NULL is allowed to be decoded. +template +CHIP_ERROR DecodeIntoEmberBuffer(AttributeValueDecoder & decoder, bool isNullable, MutableByteSpan & out) +{ + using Traits = NumericAttributeTraits; + typename Traits::StorageType storageValue; + + if (isNullable) + { + DataModel::Nullable workingValue; + ReturnErrorOnFailure(decoder.Decode(workingValue)); + + if (workingValue.IsNull()) + { + Traits::SetNull(storageValue); + } + else + { + // This guards against trying to decode something that overlaps nullable, for example + // Nullable(0xFF) is not representable because 0xFF is the encoding of NULL in ember + // as well as odd-sized integers (e.g. full 32-bit value like 0x11223344 cannot be written + // to a 3-byte odd-sized integger). + VerifyOrReturnError(Traits::CanRepresentValue(isNullable, workingValue.Value()), CHIP_ERROR_INVALID_ARGUMENT); + Traits::WorkingToStorage(workingValue.Value(), storageValue); + } + + VerifyOrReturnError(out.size() >= sizeof(storageValue), CHIP_ERROR_INVALID_ARGUMENT); + } + else + { + typename Traits::WorkingType workingValue; + ReturnErrorOnFailure(decoder.Decode(workingValue)); + + Traits::WorkingToStorage(workingValue, storageValue); + + VerifyOrReturnError(out.size() >= sizeof(storageValue), CHIP_ERROR_INVALID_ARGUMENT); + + // Even non-nullable values may be outside range: e.g. odd-sized integers have working values + // that are larger than the storage values (e.g. a uint32_t being stored as a 3-byte integer) + VerifyOrReturnError(Traits::CanRepresentValue(isNullable, workingValue), CHIP_ERROR_INVALID_ARGUMENT); + } + + const uint8_t * data = Traits::ToAttributeStoreRepresentation(storageValue); + + // The decoding + ToAttributeStoreRepresentation will result in data being + // stored in native format/byteorder, suitable to directly be stored in the data store + memcpy(out.data(), data, sizeof(storageValue)); + out.reduce_size(sizeof(storageValue)); + + return CHIP_NO_ERROR; +} + +/// Read the data from "decoder" into an ember-formatted buffer "out" +/// +/// `out` is a in/out buffer: +/// - its initial size determines the maximum size of the buffer +/// - its output size reflects the actual data size +/// +/// Uses the attribute `metadata` to determine how the data is to be encoded into out. +CHIP_ERROR DecodeValueIntoEmberBuffer(AttributeValueDecoder & decoder, const EmberAfAttributeMetadata * metadata, + MutableByteSpan & out) +{ + VerifyOrReturnError(metadata != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + + const bool isNullable = metadata->IsNullable(); + + switch (AttributeBaseType(metadata->attributeType)) + { + case ZCL_BOOLEAN_ATTRIBUTE_TYPE: // Boolean + return DecodeIntoEmberBuffer(decoder, isNullable, out); + case ZCL_INT8U_ATTRIBUTE_TYPE: // Unsigned 8-bit integer + return DecodeIntoEmberBuffer(decoder, isNullable, out); + case ZCL_INT16U_ATTRIBUTE_TYPE: // Unsigned 16-bit integer + return DecodeIntoEmberBuffer(decoder, isNullable, out); + case ZCL_INT24U_ATTRIBUTE_TYPE: // Unsigned 24-bit integer + return DecodeIntoEmberBuffer>(decoder, isNullable, out); + case ZCL_INT32U_ATTRIBUTE_TYPE: // Unsigned 32-bit integer + return DecodeIntoEmberBuffer(decoder, isNullable, out); + case ZCL_INT40U_ATTRIBUTE_TYPE: // Unsigned 40-bit integer + return DecodeIntoEmberBuffer>(decoder, isNullable, out); + case ZCL_INT48U_ATTRIBUTE_TYPE: // Unsigned 48-bit integer + return DecodeIntoEmberBuffer>(decoder, isNullable, out); + case ZCL_INT56U_ATTRIBUTE_TYPE: // Unsigned 56-bit integer + return DecodeIntoEmberBuffer>(decoder, isNullable, out); + case ZCL_INT64U_ATTRIBUTE_TYPE: // Unsigned 64-bit integer + return DecodeIntoEmberBuffer(decoder, isNullable, out); + case ZCL_INT8S_ATTRIBUTE_TYPE: // Signed 8-bit integer + return DecodeIntoEmberBuffer(decoder, isNullable, out); + case ZCL_INT16S_ATTRIBUTE_TYPE: // Signed 16-bit integer + return DecodeIntoEmberBuffer(decoder, isNullable, out); + case ZCL_INT24S_ATTRIBUTE_TYPE: // Signed 24-bit integer + return DecodeIntoEmberBuffer>(decoder, isNullable, out); + case ZCL_INT32S_ATTRIBUTE_TYPE: // Signed 32-bit integer + return DecodeIntoEmberBuffer(decoder, isNullable, out); + case ZCL_INT40S_ATTRIBUTE_TYPE: // Signed 40-bit integer + return DecodeIntoEmberBuffer>(decoder, isNullable, out); + case ZCL_INT48S_ATTRIBUTE_TYPE: // Signed 48-bit integer + return DecodeIntoEmberBuffer>(decoder, isNullable, out); + case ZCL_INT56S_ATTRIBUTE_TYPE: // Signed 56-bit integer + return DecodeIntoEmberBuffer>(decoder, isNullable, out); + case ZCL_INT64S_ATTRIBUTE_TYPE: // Signed 64-bit integer + return DecodeIntoEmberBuffer(decoder, isNullable, out); + case ZCL_SINGLE_ATTRIBUTE_TYPE: // 32-bit float + return DecodeIntoEmberBuffer(decoder, isNullable, out); + case ZCL_DOUBLE_ATTRIBUTE_TYPE: // 64-bit float + return DecodeIntoEmberBuffer(decoder, isNullable, out); + case ZCL_CHAR_STRING_ATTRIBUTE_TYPE: // Char string + return DecodeStringLikeIntoEmberBuffer(decoder, isNullable, out); + case ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE: + return DecodeStringLikeIntoEmberBuffer(decoder, isNullable, out); + case ZCL_OCTET_STRING_ATTRIBUTE_TYPE: // Octet string + return DecodeStringLikeIntoEmberBuffer(decoder, isNullable, out); + case ZCL_LONG_OCTET_STRING_ATTRIBUTE_TYPE: + return DecodeStringLikeIntoEmberBuffer(decoder, isNullable, out); + default: + ChipLogError(DataManagement, "Attribute type 0x%x not handled", static_cast(metadata->attributeType)); + return CHIP_IM_GLOBAL_STATUS(Failure); + } +} + +} // namespace + +CHIP_ERROR CodegenDataModel::WriteAttribute(const InteractionModel::WriteAttributeRequest & request, + AttributeValueDecoder & decoder) +{ + ChipLogDetail(DataManagement, "Writing attribute: Cluster=" ChipLogFormatMEI " Endpoint=0x%x AttributeId=" ChipLogFormatMEI, + ChipLogValueMEI(request.path.mClusterId), request.path.mEndpointId, ChipLogValueMEI(request.path.mAttributeId)); + + // ACL check for non-internal requests + if (!request.operationFlags.Has(InteractionModel::OperationFlags::kInternal)) + { + ReturnErrorCodeIf(!request.subjectDescriptor.has_value(), CHIP_IM_GLOBAL_STATUS(UnsupportedAccess)); + + Access::RequestPath requestPath{ .cluster = request.path.mClusterId, .endpoint = request.path.mEndpointId }; + CHIP_ERROR err = Access::GetAccessControl().Check(*request.subjectDescriptor, requestPath, + RequiredPrivilege::ForWriteAttribute(request.path)); + + if (err != CHIP_NO_ERROR) + { + ReturnErrorCodeIf(err != CHIP_ERROR_ACCESS_DENIED, err); + + // TODO: when wildcard/group writes are supported, handle them to discard rather than fail with status + return CHIP_IM_GLOBAL_STATUS(UnsupportedAccess); + } + } + + auto metadata = Ember::FindAttributeMetadata(request.path); + + if (const CHIP_ERROR * err = std::get_if(&metadata)) + { + VerifyOrDie((*err == CHIP_IM_GLOBAL_STATUS(UnsupportedEndpoint)) || // + (*err == CHIP_IM_GLOBAL_STATUS(UnsupportedCluster)) || // + (*err == CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute))); + return *err; + } + + const EmberAfAttributeMetadata ** attributeMetadata = std::get_if(&metadata); + + // All the global attributes that we do not have metadata for are + // read-only. Specifically only the following list-based attributes match the + // "global attributes not in metadata" (see GlobalAttributes.h :: GlobalAttributesNotInMetadata): + // - AttributeList + // - EventList + // - AcceptedCommands + // - GeneratedCommands + // + // Given the above, UnsupportedWrite should be correct (attempt to write to a read-only list) + bool isReadOnly = (attributeMetadata == nullptr) || (*attributeMetadata)->IsReadOnly(); + + // Internal is allowed to bypass timed writes and read-only. + if (!request.operationFlags.Has(InteractionModel::OperationFlags::kInternal)) + { + VerifyOrReturnError(!isReadOnly, CHIP_IM_GLOBAL_STATUS(UnsupportedWrite)); + + VerifyOrReturnError(!(*attributeMetadata)->MustUseTimedWrite() || + request.writeFlags.Has(InteractionModel::WriteFlags::kTimed), + CHIP_IM_GLOBAL_STATUS(NeedsTimedInteraction)); + } + + // Extra check: internal requests can bypass the read only check, however global attributes + // have no underlying storage, so write still cannot be done + VerifyOrReturnError(attributeMetadata != nullptr, CHIP_IM_GLOBAL_STATUS(UnsupportedWrite)); + + if (request.path.mDataVersion.HasValue()) + { + std::optional clusterInfo = GetClusterInfo(request.path); + if (!clusterInfo.has_value()) + { + ChipLogError(DataManagement, "Unable to get cluster info for Endpoint 0x%x, Cluster " ChipLogFormatMEI, + request.path.mEndpointId, ChipLogValueMEI(request.path.mClusterId)); + return CHIP_IM_GLOBAL_STATUS(DataVersionMismatch); + } + + if (request.path.mDataVersion.Value() != clusterInfo->dataVersion) + { + ChipLogError(DataManagement, "Write Version mismatch for Endpoint 0x%x, Cluster " ChipLogFormatMEI, + request.path.mEndpointId, ChipLogValueMEI(request.path.mClusterId)); + return CHIP_IM_GLOBAL_STATUS(DataVersionMismatch); + } + } + + AttributeAccessInterface * aai = GetAttributeAccessOverride(request.path.mEndpointId, request.path.mClusterId); + std::optional aai_result = TryWriteViaAccessInterface(request.path, aai, decoder); + if (aai_result.has_value()) + { + if (*aai_result == CHIP_NO_ERROR) + { + // TODO: change callbacks should likely be routed through the context `MarkDirty` only + // however for now this is called directly because ember code does this call + // inside emberAfWriteAttribute. + MatterReportingAttributeChangeCallback(request.path); + CurrentContext().dataModelChangeListener->MarkDirty(request.path); + } + return *aai_result; + } + + MutableByteSpan dataBuffer = gEmberAttributeIOBufferSpan; + ReturnErrorOnFailure(DecodeValueIntoEmberBuffer(decoder, *attributeMetadata, dataBuffer)); + + Protocols::InteractionModel::Status status; + + if (dataBuffer.size() > (*attributeMetadata)->size) + { + ChipLogDetail(Zcl, "Data to write exceeds the attribute size claimed."); + return CHIP_IM_GLOBAL_STATUS(InvalidValue); + } + + if (request.operationFlags.Has(InteractionModel::OperationFlags::kInternal)) + { + // Internal requests use the non-External interface that has less enforcement + // than the external version (e.g. does not check/enforce writable settings, does not + // validate attribute types) - see attribute-table.h documentation for details. + status = emberAfWriteAttribute(request.path.mEndpointId, request.path.mClusterId, request.path.mAttributeId, + dataBuffer.data(), (*attributeMetadata)->attributeType); + } + else + { + status = emAfWriteAttributeExternal(request.path.mEndpointId, request.path.mClusterId, request.path.mAttributeId, + dataBuffer.data(), (*attributeMetadata)->attributeType); + } + + if (status != Protocols::InteractionModel::Status::Success) + { + return CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(status); + } + + // TODO: this WILL requre updates + // + // - Internal writes may need to be able to decide if to mark things dirty or not (see AAI as well) + // - Changes-ommited paths should not be marked dirty (ember is not aware of that flag) + // - This likely maps to `MatterReportingAttributeChangeCallback` HOWEVER current ember write functions + // will selectively call that one depending on old attribute state (i.e. calling every time is a + // change in behavior) + CurrentContext().dataModelChangeListener->MarkDirty(request.path); + return CHIP_NO_ERROR; +} + +} // namespace app +} // namespace chip diff --git a/src/app/codegen-data-model/EmberMetadata.cpp b/src/app/codegen-data-model/EmberMetadata.cpp new file mode 100644 index 00000000000000..9114196a377906 --- /dev/null +++ b/src/app/codegen-data-model/EmberMetadata.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 + +#include +#include +#include + +namespace chip { +namespace app { +namespace Ember { + +std::variant +FindAttributeMetadata(const ConcreteAttributePath & aPath) +{ + if (IsGlobalAttribute(aPath.mAttributeId)) + { + // Global list attribute check first: during path expansion a lot of attributes + // will actually be global attributes (so not too much of a performance hit) + for (auto & attr : GlobalAttributesNotInMetadata) + { + if (attr == aPath.mAttributeId) + { + const EmberAfCluster * cluster = emberAfFindServerCluster(aPath.mEndpointId, aPath.mClusterId); + if (cluster == nullptr) + { + return (emberAfFindEndpointType(aPath.mEndpointId) == nullptr) ? CHIP_IM_GLOBAL_STATUS(UnsupportedEndpoint) + : CHIP_IM_GLOBAL_STATUS(UnsupportedCluster); + } + + return cluster; + } + } + } + const EmberAfAttributeMetadata * metadata = + emberAfLocateAttributeMetadata(aPath.mEndpointId, aPath.mClusterId, aPath.mAttributeId); + + if (metadata == nullptr) + { + const EmberAfEndpointType * type = emberAfFindEndpointType(aPath.mEndpointId); + if (type == nullptr) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedEndpoint); + } + + const EmberAfCluster * cluster = emberAfFindClusterInType(type, aPath.mClusterId, CLUSTER_MASK_SERVER); + if (cluster == nullptr) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedCluster); + } + + // Since we know the attribute is unsupported and the endpoint/cluster are + // OK, this is the only option left. + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + + return metadata; +} + +} // namespace Ember +} // namespace app +} // namespace chip diff --git a/src/app/codegen-data-model/EmberMetadata.h b/src/app/codegen-data-model/EmberMetadata.h new file mode 100644 index 00000000000000..f8f41312f1f7c9 --- /dev/null +++ b/src/app/codegen-data-model/EmberMetadata.h @@ -0,0 +1,46 @@ +/* + * 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 + +namespace chip { +namespace app { +namespace Ember { + +/// Fetch the source for the given attribute path: either a cluster (for global ones) or attribute +/// path. +/// +/// Possible return values: +/// - EmberAfCluster (NEVER null) - Only for GlobalAttributesNotInMetaData +/// - EmberAfAttributeMetadata (NEVER null) - if the attribute is known to ember datastore +/// - CHIP_ERROR, only specifically for unknown attributes, may only be one of: +/// - CHIP_IM_GLOBAL_STATUS(UnsupportedEndpoint); +/// - CHIP_IM_GLOBAL_STATUS(UnsupportedCluster); +/// - CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); +std::variant +FindAttributeMetadata(const ConcreteAttributePath & aPath); + +} // namespace Ember +} // namespace app +} // namespace chip diff --git a/src/app/codegen-data-model/Instance.cpp b/src/app/codegen-data-model/Instance.cpp new file mode 100644 index 00000000000000..98eeeb604503b9 --- /dev/null +++ b/src/app/codegen-data-model/Instance.cpp @@ -0,0 +1,30 @@ +/* + * 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 + +namespace chip { +namespace app { + +InteractionModel::DataModel * CodegenDataModelInstance() +{ + static CodegenDataModel gCodegenModel; + return &gCodegenModel; +} + +} // namespace app +} // namespace chip diff --git a/src/app/codegen-data-model/Instance.h b/src/app/codegen-data-model/Instance.h new file mode 100644 index 00000000000000..4c7530981920c1 --- /dev/null +++ b/src/app/codegen-data-model/Instance.h @@ -0,0 +1,27 @@ +/* + * 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 chip { +namespace app { + +InteractionModel::DataModel * CodegenDataModelInstance(); + +} // namespace app +} // namespace chip diff --git a/third_party/nxp/k32w1_sdk/nxp_arm.gni b/src/app/codegen-data-model/model.cmake similarity index 56% rename from third_party/nxp/k32w1_sdk/nxp_arm.gni rename to src/app/codegen-data-model/model.cmake index 78d1036cc8536a..73b54247a81033 100644 --- a/third_party/nxp/k32w1_sdk/nxp_arm.gni +++ b/src/app/codegen-data-model/model.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2023 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. @@ -11,13 +11,16 @@ # 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. +set(BASE_DIR ${CMAKE_CURRENT_LIST_DIR}) -import("//build_overrides/nxp_sdk.gni") -import("${nxp_sdk_build_root}/nxp_sdk.gni") +# If you change this list, please ALSO CHANGE model.gni +SET(CODEGEN_DATA_MODEL_SOURCES + "${BASE_DIR}/CodegenDataModel.cpp" + "${BASE_DIR}/CodegenDataModel.h" + "${BASE_DIR}/CodegenDataModel_Read.cpp" + "${BASE_DIR}/CodegenDataModel_Write.cpp" + "${BASE_DIR}/EmberMetadata.cpp" + "${BASE_DIR}/EmberMetadata.h" + "${BASE_DIR}/Instance.cpp" +) -assert(nxp_platform == "k32w/k32w1", "${nxp_platform} must be k32w/k32w1.") - -arm_arch = "armv8-m.main+dsp+fp" -arm_cpu = "cortex-m33" -arm_fpu = "fpv5-sp-d16" -arm_float_abi = "hard" diff --git a/src/app/codegen-data-model/model.gni b/src/app/codegen-data-model/model.gni index 3be7b2d2610513..25f50571223971 100644 --- a/src/app/codegen-data-model/model.gni +++ b/src/app/codegen-data-model/model.gni @@ -25,12 +25,17 @@ import("//build_overrides/chip.gni") # be cleanly built as a stand-alone and instead have to be imported as part of # a different data model or compilation unit. codegen_data_model_SOURCES = [ - "${chip_root}/src/app/codegen-data-model/CodegenDataModel.h", "${chip_root}/src/app/codegen-data-model/CodegenDataModel.cpp", + "${chip_root}/src/app/codegen-data-model/CodegenDataModel.h", "${chip_root}/src/app/codegen-data-model/CodegenDataModel_Read.cpp", + "${chip_root}/src/app/codegen-data-model/CodegenDataModel_Write.cpp", + "${chip_root}/src/app/codegen-data-model/EmberMetadata.cpp", + "${chip_root}/src/app/codegen-data-model/EmberMetadata.h", + "${chip_root}/src/app/codegen-data-model/Instance.cpp", ] codegen_data_model_PUBLIC_DEPS = [ "${chip_root}/src/app/common:attribute-type", "${chip_root}/src/app/data-model-interface", + "${chip_root}/src/app/codegen-data-model:instance-header", ] diff --git a/src/app/codegen-data-model/tests/BUILD.gn b/src/app/codegen-data-model/tests/BUILD.gn index 3d265a96a66b29..3f88ac61c41766 100644 --- a/src/app/codegen-data-model/tests/BUILD.gn +++ b/src/app/codegen-data-model/tests/BUILD.gn @@ -24,6 +24,8 @@ source_set("ember_extra_files") { "${chip_root}/src/app/util/ember-io-storage.cpp", "AttributeReportIBEncodeDecode.cpp", "AttributeReportIBEncodeDecode.h", + "EmberInvokeOverride.cpp", + "EmberInvokeOverride.h", "EmberReadWriteOverride.cpp", "EmberReadWriteOverride.h", "InteractionModelTemporaryOverrides.cpp", diff --git a/src/app/codegen-data-model/tests/EmberInvokeOverride.cpp b/src/app/codegen-data-model/tests/EmberInvokeOverride.cpp new file mode 100644 index 00000000000000..552e0be3d966ff --- /dev/null +++ b/src/app/codegen-data-model/tests/EmberInvokeOverride.cpp @@ -0,0 +1,55 @@ +/* + * 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 "EmberInvokeOverride.h" + +#include + +namespace { + +chip::app::ConcreteCommandPath gLastDispatchPath; +uint32_t gDispatchCount = 0; + +} // namespace + +namespace chip { +namespace Test { + +app::ConcreteCommandPath GetLastDispatchPath() +{ + return gLastDispatchPath; +} + +uint32_t DispatchCount() +{ + return gDispatchCount; +} + +} // namespace Test +} // namespace chip + +namespace chip { +namespace app { + +void DispatchSingleClusterCommand(const ConcreteCommandPath & aRequestCommandPath, chip::TLV::TLVReader & aReader, + CommandHandler * apCommandObj) +{ + gLastDispatchPath = aRequestCommandPath; + gDispatchCount++; +} + +} // namespace app +} // namespace chip diff --git a/src/app/codegen-data-model/tests/EmberInvokeOverride.h b/src/app/codegen-data-model/tests/EmberInvokeOverride.h new file mode 100644 index 00000000000000..d2f7b5c32fb1f8 --- /dev/null +++ b/src/app/codegen-data-model/tests/EmberInvokeOverride.h @@ -0,0 +1,31 @@ +/* + * 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 chip { +namespace Test { + +/// what was the last path on which DispatchSingleClusterCommand was called +app::ConcreteCommandPath GetLastDispatchPath(); + +/// How many times was DispatchSingleClusterCommand called +uint32_t DispatchCount(); + +} // namespace Test +} // namespace chip diff --git a/src/app/codegen-data-model/tests/EmberReadWriteOverride.cpp b/src/app/codegen-data-model/tests/EmberReadWriteOverride.cpp index 8c65ee29b05556..d3c3b9975f8176 100644 --- a/src/app/codegen-data-model/tests/EmberReadWriteOverride.cpp +++ b/src/app/codegen-data-model/tests/EmberReadWriteOverride.cpp @@ -17,6 +17,8 @@ #include "EmberReadWriteOverride.h" #include +#include +#include using chip::Protocols::InteractionModel::Status; @@ -63,6 +65,11 @@ void SetEmberReadOutput(std::variant what) gEmberStatusCode = Status::InvalidAction; } +ByteSpan GetEmberBuffer() +{ + return ByteSpan(gEmberIoBuffer, gEmberIoBufferFill); +} + } // namespace Test } // namespace chip @@ -76,12 +83,47 @@ Status emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attRecord, return gEmberStatusCode; } - if (gEmberIoBufferFill > readLength) + if (write) + { + // copy over as much data as possible + // NOTE: we do NOT use (*metadata)->size since it is unclear if our mocks set that correctly + size_t len = std::min(sizeof(gEmberIoBuffer), readLength); + memcpy(gEmberIoBuffer, buffer, len); + gEmberIoBufferFill = len; + } + else { - ChipLogError(Test, "Internal TEST error: insufficient output buffer space."); - return Status::ResourceExhausted; + VerifyOrDie(gEmberIoBufferFill <= readLength); + memcpy(buffer, gEmberIoBuffer, gEmberIoBufferFill); } - memcpy(buffer, gEmberIoBuffer, gEmberIoBufferFill); return Status::Success; } + +Status emAfWriteAttributeExternal(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, + uint8_t * dataPtr, EmberAfAttributeType dataType) +{ + if (gEmberStatusCode != Status::Success) + { + return gEmberStatusCode; + } + + // ember here deduces the size of dataPtr. For testing however, we KNOW we read + // out of the ember IO buffer, so we try to use that + VerifyOrDie(dataPtr == chip::app::Compatibility::Internal::gEmberAttributeIOBufferSpan.data()); + + // In theory this should do type validation and sizes. This is NOT done for testing. + // copy over as much data as possible + // NOTE: we do NOT use (*metadata)->size since it is unclear if our mocks set that correctly + size_t len = std::min(sizeof(gEmberIoBuffer), chip::app::Compatibility::Internal::gEmberAttributeIOBufferSpan.size()); + memcpy(gEmberIoBuffer, dataPtr, len); + gEmberIoBufferFill = len; + + return Status::Success; +} + +Status emberAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t * dataPtr, + EmberAfAttributeType dataType) +{ + return emAfWriteAttributeExternal(endpoint, cluster, attributeID, dataPtr, dataType); +} diff --git a/src/app/codegen-data-model/tests/EmberReadWriteOverride.h b/src/app/codegen-data-model/tests/EmberReadWriteOverride.h index 527a6cfd0d18c7..5aeaeadc254086 100644 --- a/src/app/codegen-data-model/tests/EmberReadWriteOverride.h +++ b/src/app/codegen-data-model/tests/EmberReadWriteOverride.h @@ -29,5 +29,8 @@ namespace Test { /// It may return a value with success or some error. The byte span WILL BE COPIED. void SetEmberReadOutput(std::variant what); +/// Grab the data currently in the buffer +chip::ByteSpan GetEmberBuffer(); + } // namespace Test } // namespace chip diff --git a/src/app/codegen-data-model/tests/InteractionModelTemporaryOverrides.cpp b/src/app/codegen-data-model/tests/InteractionModelTemporaryOverrides.cpp index 868a26880d3ce7..e771827adf18f6 100644 --- a/src/app/codegen-data-model/tests/InteractionModelTemporaryOverrides.cpp +++ b/src/app/codegen-data-model/tests/InteractionModelTemporaryOverrides.cpp @@ -74,11 +74,10 @@ CHIP_ERROR ReadSingleClusterData(const Access::SubjectDescriptor & aSubjectDescr return CHIP_ERROR_NOT_IMPLEMENTED; } -void DispatchSingleClusterCommand(const ConcreteCommandPath & aRequestCommandPath, chip::TLV::TLVReader & aReader, - CommandHandler * apCommandObj) -{ - // TODO: total hardcoded noop -} - } // namespace app } // namespace chip + +void MatterReportingAttributeChangeCallback(const chip::app::ConcreteAttributePath & aPath) +{ + // TODO: should we add logic to track these calls for test purposes? +} diff --git a/src/app/codegen-data-model/tests/TestCodegenModelViaMocks.cpp b/src/app/codegen-data-model/tests/TestCodegenModelViaMocks.cpp index df759e78666659..796c845ebe7787 100644 --- a/src/app/codegen-data-model/tests/TestCodegenModelViaMocks.cpp +++ b/src/app/codegen-data-model/tests/TestCodegenModelViaMocks.cpp @@ -14,13 +14,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include + +#include + +#include "app/ConcreteCommandPath.h" #include #include +#include #include #include #include +#include #include #include #include @@ -29,22 +37,27 @@ #include #include #include +#include #include #include +#include +#include #include +#include #include #include #include #include #include #include +#include #include #include #include +#include +#include #include - -#include -#include +#include using namespace chip; using namespace chip::Test; @@ -57,6 +70,12 @@ namespace { constexpr FabricIndex kTestFabrixIndex = kMinValidFabricIndex; constexpr NodeId kTestNodeId = 0xFFFF'1234'ABCD'4321; +constexpr AttributeId kAttributeIdReadOnly = 0x3001; +constexpr AttributeId kAttributeIdTimedWrite = 0x3002; + +constexpr CommandId kMockCommandId1 = 0x1234; +constexpr CommandId kMockCommandId2 = 0x1122; + constexpr EndpointId kEndpointIdThatIsMissing = kMockEndpointMin - 1; constexpr AttributeId kReadOnlyAttributeId = 0x5001; @@ -107,6 +126,57 @@ bool operator==(const Access::SubjectDescriptor & a, const Access::SubjectDescri return true; } +class TestDataModelChangeListener : public DataModelChangeListener +{ +public: + void MarkDirty(const ConcreteAttributePath & path) override { mDirtyList.push_back(path); } + + std::vector & DirtyList() { return mDirtyList; } + const std::vector & DirtyList() const { return mDirtyList; } + +private: + std::vector mDirtyList; +}; + +class TestEventGenerator : public EventsGenerator +{ + CHIP_ERROR GenerateEvent(EventLoggingDelegate * eventPayloadWriter, const EventOptions & options, + EventNumber & generatedEventNumber) override + { + return CHIP_ERROR_NOT_IMPLEMENTED; + } +}; + +class TestActionContext : public ActionContext +{ +public: + Messaging::ExchangeContext * CurrentExchange() override { return nullptr; } +}; + +class CodegenDataModelWithContext : public CodegenDataModel +{ +public: + CodegenDataModelWithContext() + { + InteractionModelContext context{ + .eventsGenerator = &mEventGenerator, + .dataModelChangeListener = &mChangeListener, + .actionContext = &mActionContext, + }; + + Startup(context); + } + ~CodegenDataModelWithContext() { Shutdown(); } + + TestDataModelChangeListener & ChangeListener() { return mChangeListener; } + const TestDataModelChangeListener & ChangeListener() const { return mChangeListener; } + +private: + TestEventGenerator mEventGenerator; + TestDataModelChangeListener mChangeListener; + TestActionContext mActionContext; +}; + class MockAccessControl : public Access::AccessControl::Delegate, public Access::AccessControl::DeviceTypeResolver { public: @@ -348,6 +418,10 @@ const MockNodeConfig gTestNodeConfig({ MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_IPV6ADR_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_IPV6PRE_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_HWADR_ATTRIBUTE_TYPE), + + // Special case handling + MockAttributeConfig(kAttributeIdReadOnly, ZCL_INT32S_ATTRIBUTE_TYPE, 0), + MockAttributeConfig(kAttributeIdTimedWrite, ZCL_INT32S_ATTRIBUTE_TYPE, ATTRIBUTE_MASK_WRITABLE | ATTRIBUTE_MASK_MUST_USE_TIMED_WRITE), }), }), }); @@ -422,14 +496,58 @@ class StructAttributeAccessInterface : public AttributeAccessInterface return encoder.Encode(mData); } + CHIP_ERROR Write(const ConcreteDataAttributePath & path, AttributeValueDecoder & decoder) override + { + if (static_cast(path) != mPath) + { + // returning without trying to handle means "I do not handle this" + return CHIP_NO_ERROR; + } + + return decoder.Decode(mData); + } + void SetReturnedData(const Clusters::UnitTesting::Structs::SimpleStruct::Type & data) { mData = data; } - Clusters::UnitTesting::Structs::SimpleStruct::Type simpleStruct; + const Clusters::UnitTesting::Structs::SimpleStruct::Type & GetData() const { return mData; } private: ConcreteAttributePath mPath; Clusters::UnitTesting::Structs::SimpleStruct::Type mData; }; +class ErrorAccessInterface : public AttributeAccessInterface +{ +public: + ErrorAccessInterface(ConcreteAttributePath path, CHIP_ERROR err) : + AttributeAccessInterface(MakeOptional(path.mEndpointId), path.mClusterId), mPath(path), mError(err) + {} + ~ErrorAccessInterface() = default; + + CHIP_ERROR Read(const ConcreteReadAttributePath & path, AttributeValueEncoder & encoder) override + { + if (static_cast(path) != mPath) + { + // returning without trying to handle means "I do not handle this" + return CHIP_NO_ERROR; + } + return mError; + } + + CHIP_ERROR Write(const ConcreteDataAttributePath & path, AttributeValueDecoder & decoder) override + { + if (static_cast(path) != mPath) + { + // returning without trying to handle means "I do not handle this" + return CHIP_NO_ERROR; + } + return mError; + } + +private: + ConcreteAttributePath mPath; + CHIP_ERROR mError; +}; + class ListAttributeAcessInterface : public AttributeAccessInterface { public: @@ -458,7 +576,6 @@ class ListAttributeAcessInterface : public AttributeAccessInterface void SetReturnedData(const Clusters::UnitTesting::Structs::SimpleStruct::Type & data) { mData = data; } void SetReturnedDataCount(unsigned count) { mCount = count; } - Clusters::UnitTesting::Structs::SimpleStruct::Type simpleStruct; private: ConcreteAttributePath mPath; @@ -508,7 +625,7 @@ struct TestReadRequest request.path = path; } - std::unique_ptr StartEncoding(chip::app::InteractionModel::DataModel * model, + std::unique_ptr StartEncoding(InteractionModel::DataModel * model, AttributeEncodeState state = AttributeEncodeState()) { std::optional info = model->GetClusterInfo(request.path); @@ -538,11 +655,60 @@ struct TestReadRequest CHIP_ERROR FinishEncoding() { return encodedIBs.FinishEncoding(reportBuilder); } }; +// Sets up data for writing +struct TestWriteRequest +{ + InteractionModel::WriteAttributeRequest request; + uint8_t tlvBuffer[128] = { 0 }; + TLV::TLVReader + tlvReader; /// tlv reader used for the returned AttributeValueDecoder (since attributeValueDecoder uses references) + + TestWriteRequest(const Access::SubjectDescriptor & subject, const ConcreteDataAttributePath & path) + { + request.subjectDescriptor = subject; + request.path = path; + } + + template + TLV::TLVReader ReadEncodedValue(const T & value) + { + TLV::TLVWriter writer; + writer.Init(tlvBuffer); + + // Encoding is within a structure: + // - BEGIN_STRUCT + // - 1: ..... + // - END_STRUCT + TLV::TLVType outerContainerType; + VerifyOrDie(writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outerContainerType) == CHIP_NO_ERROR); + VerifyOrDie(chip::app::DataModel::Encode(writer, TLV::ContextTag(1), value) == CHIP_NO_ERROR); + VerifyOrDie(writer.EndContainer(outerContainerType) == CHIP_NO_ERROR); + VerifyOrDie(writer.Finalize() == CHIP_NO_ERROR); + + TLV::TLVReader reader; + reader.Init(tlvBuffer); + + // position the reader inside the buffer, on the encoded value + VerifyOrDie(reader.Next() == CHIP_NO_ERROR); + VerifyOrDie(reader.EnterContainer(outerContainerType) == CHIP_NO_ERROR); + VerifyOrDie(reader.Next() == CHIP_NO_ERROR); + + return reader; + } + + template + AttributeValueDecoder DecoderFor(const T & value) + { + tlvReader = ReadEncodedValue(value); + return AttributeValueDecoder(tlvReader, request.subjectDescriptor.value_or(kDenySubjectDescriptor)); + } +}; + template void TestEmberScalarTypeRead(typename NumericAttributeTraits::WorkingType value) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; TestReadRequest testRequest( @@ -577,7 +743,7 @@ template void TestEmberScalarNullRead() { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; TestReadRequest testRequest( @@ -606,12 +772,128 @@ void TestEmberScalarNullRead() ASSERT_TRUE(actual.IsNull()); } +template +void TestEmberScalarTypeWrite(const typename NumericAttributeTraits::WorkingType value) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + // non-nullable test + { + TestWriteRequest test( + kAdminSubjectDescriptor, + ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), MOCK_ATTRIBUTE_ID_FOR_NON_NULLABLE_TYPE(ZclType))); + AttributeValueDecoder decoder = test.DecoderFor(value); + + // write should succeed + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_NO_ERROR); + + // Validate data after write + chip::ByteSpan writtenData = Test::GetEmberBuffer(); + + typename NumericAttributeTraits::StorageType storage; + ASSERT_GE(writtenData.size(), sizeof(storage)); + memcpy(&storage, writtenData.data(), sizeof(storage)); + typename NumericAttributeTraits::WorkingType actual = NumericAttributeTraits::StorageToWorking(storage); + + EXPECT_EQ(actual, value); + ASSERT_EQ(model.ChangeListener().DirtyList().size(), 1u); + EXPECT_EQ(model.ChangeListener().DirtyList()[0], test.request.path); + + // reset for the next test + model.ChangeListener().DirtyList().clear(); + } + + // nullable test + { + TestWriteRequest test( + kAdminSubjectDescriptor, + ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), MOCK_ATTRIBUTE_ID_FOR_NULLABLE_TYPE(ZclType))); + AttributeValueDecoder decoder = test.DecoderFor(value); + + // write should succeed + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_NO_ERROR); + + // Validate data after write + chip::ByteSpan writtenData = Test::GetEmberBuffer(); + + typename NumericAttributeTraits::StorageType storage; + ASSERT_GE(writtenData.size(), sizeof(storage)); + memcpy(&storage, writtenData.data(), sizeof(storage)); + typename NumericAttributeTraits::WorkingType actual = NumericAttributeTraits::StorageToWorking(storage); + + ASSERT_EQ(actual, value); + ASSERT_EQ(model.ChangeListener().DirtyList().size(), 1u); + EXPECT_EQ(model.ChangeListener().DirtyList()[0], test.request.path); + } +} + +template +void TestEmberScalarNullWrite() +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test(kAdminSubjectDescriptor, + ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), MOCK_ATTRIBUTE_ID_FOR_NULLABLE_TYPE(ZclType))); + + using NumericType = NumericAttributeTraits; + using NullableType = chip::app::DataModel::Nullable; + AttributeValueDecoder decoder = test.DecoderFor(NullableType()); + + // write should succeed + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_NO_ERROR); + + // Validate data after write + chip::ByteSpan writtenData = Test::GetEmberBuffer(); + + using Traits = NumericAttributeTraits; + + typename Traits::StorageType storage; + ASSERT_GE(writtenData.size(), sizeof(storage)); + memcpy(&storage, writtenData.data(), sizeof(storage)); + ASSERT_TRUE(Traits::IsNullValue(storage)); +} + +template +void TestEmberScalarTypeWriteNullValueToNullable() +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test( + kAdminSubjectDescriptor, + ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), MOCK_ATTRIBUTE_ID_FOR_NON_NULLABLE_TYPE(ZclType))); + + using NumericType = NumericAttributeTraits; + using NullableType = chip::app::DataModel::Nullable; + AttributeValueDecoder decoder = test.DecoderFor(NullableType()); + + // write should fail: we are trying to write null + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_ERROR_WRONG_TLV_TYPE); +} + +uint16_t ReadLe16(const void * buffer) +{ + const uint8_t * p = reinterpret_cast(buffer); + return chip::Encoding::LittleEndian::Read16(p); +} + +void WriteLe16(void * buffer, uint16_t value) +{ + uint8_t * p = reinterpret_cast(buffer); + chip::Encoding::LittleEndian::Write16(p, value); +} + } // namespace TEST(TestCodegenModelViaMocks, IterateOverEndpoints) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; // This iteration relies on the hard-coding that occurs when mock_ember is used EXPECT_EQ(model.FirstEndpoint(), kMockEndpoint1); @@ -639,7 +921,7 @@ TEST(TestCodegenModelViaMocks, IterateOverEndpoints) TEST(TestCodegenModelViaMocks, IterateOverClusters) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; chip::Test::ResetVersion(); @@ -702,7 +984,7 @@ TEST(TestCodegenModelViaMocks, GetClusterInfo) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; chip::Test::ResetVersion(); @@ -727,7 +1009,7 @@ TEST(TestCodegenModelViaMocks, GetClusterInfo) TEST(TestCodegenModelViaMocks, IterateOverAttributes) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; // invalid paths should return in "no more data" ASSERT_FALSE(model.FirstAttribute(ConcreteClusterPath(kEndpointIdThatIsMissing, MockClusterId(1))).path.HasValidIds()); @@ -798,7 +1080,7 @@ TEST(TestCodegenModelViaMocks, IterateOverAttributes) TEST(TestCodegenModelViaMocks, GetAttributeInfo) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; // various non-existent or invalid paths should return no info data ASSERT_FALSE( @@ -838,7 +1120,7 @@ TEST(TestCodegenModelViaMocks, GetAttributeInfo) TEST(TestCodegenModelViaMocks, GlobalAttributeInfo) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; std::optional info = model.GetAttributeInfo( ConcreteAttributePath(kMockEndpoint1, MockClusterId(1), Clusters::Globals::Attributes::GeneratedCommandList::Id)); @@ -853,7 +1135,7 @@ TEST(TestCodegenModelViaMocks, GlobalAttributeInfo) TEST(TestCodegenModelViaMocks, IterateOverAcceptedCommands) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; // invalid paths should return in "no more data" ASSERT_FALSE(model.FirstAcceptedCommand(ConcreteClusterPath(kEndpointIdThatIsMissing, MockClusterId(1))).path.HasValidIds()); @@ -918,7 +1200,7 @@ TEST(TestCodegenModelViaMocks, IterateOverAcceptedCommands) TEST(TestCodegenModelViaMocks, AcceptedCommandInfo) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; // invalid paths should return in "no more data" ASSERT_FALSE(model.GetAcceptedCommandInfo(ConcreteCommandPath(kEndpointIdThatIsMissing, MockClusterId(1), 1)).has_value()); @@ -950,7 +1232,7 @@ TEST(TestCodegenModelViaMocks, AcceptedCommandInfo) TEST(TestCodegenModelViaMocks, IterateOverGeneratedCommands) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; // invalid paths should return in "no more data" ASSERT_FALSE(model.FirstGeneratedCommand(ConcreteClusterPath(kEndpointIdThatIsMissing, MockClusterId(1))).HasValidIds()); @@ -1009,20 +1291,20 @@ TEST(TestCodegenModelViaMocks, IterateOverGeneratedCommands) TEST(TestCodegenModelViaMocks, EmberAttributeReadAclDeny) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; TestReadRequest testRequest(kDenySubjectDescriptor, ConcreteAttributePath(kMockEndpoint1, MockClusterId(1), MockAttributeId(10))); std::unique_ptr encoder = testRequest.StartEncoding(&model); - ASSERT_EQ(model.ReadAttribute(testRequest.request, *encoder), CHIP_ERROR_ACCESS_DENIED); + ASSERT_EQ(model.ReadAttribute(testRequest.request, *encoder), CHIP_IM_GLOBAL_STATUS(UnsupportedAccess)); } TEST(TestCodegenModelViaMocks, ReadForInvalidGlobalAttributePath) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; { @@ -1043,7 +1325,7 @@ TEST(TestCodegenModelViaMocks, ReadForInvalidGlobalAttributePath) TEST(TestCodegenModelViaMocks, EmberAttributeInvalidRead) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; // Invalid attribute @@ -1077,7 +1359,7 @@ TEST(TestCodegenModelViaMocks, EmberAttributeInvalidRead) TEST(TestCodegenModelViaMocks, EmberAttributePathExpansionAccessDeniedRead) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; TestReadRequest testRequest(kDenySubjectDescriptor, @@ -1095,7 +1377,7 @@ TEST(TestCodegenModelViaMocks, EmberAttributePathExpansionAccessDeniedRead) TEST(TestCodegenModelViaMocks, AccessInterfaceUnsupportedRead) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; const ConcreteAttributePath kTestPath(kMockEndpoint3, MockClusterId(4), @@ -1199,7 +1481,7 @@ TEST(TestCodegenModelViaMocks, EmberAttributeReadNulls) TEST(TestCodegenModelViaMocks, EmberAttributeReadErrorReading) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; { @@ -1227,12 +1509,15 @@ TEST(TestCodegenModelViaMocks, EmberAttributeReadErrorReading) std::unique_ptr encoder = testRequest.StartEncoding(&model); ASSERT_EQ(model.ReadAttribute(testRequest.request, *encoder), CHIP_IM_GLOBAL_STATUS(Busy)); } + + // reset things to success to not affect other tests + chip::Test::SetEmberReadOutput(ByteSpan()); } TEST(TestCodegenModelViaMocks, EmberAttributeReadNullOctetString) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; TestReadRequest testRequest(kAdminSubjectDescriptor, @@ -1267,7 +1552,7 @@ TEST(TestCodegenModelViaMocks, EmberAttributeReadNullOctetString) TEST(TestCodegenModelViaMocks, EmberAttributeReadOctetString) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; TestReadRequest testRequest( @@ -1277,9 +1562,8 @@ TEST(TestCodegenModelViaMocks, EmberAttributeReadOctetString) // NOTE: This is a pascal string, so actual data is "test" // the longer encoding is to make it clear we do not encode the overflow - char data[] = "\0\0testing here with overflow"; - uint16_t len = 4; - memcpy(data, &len, sizeof(uint16_t)); + char data[] = "\0\0testing here with overflow"; + WriteLe16(data, 4); chip::Test::SetEmberReadOutput(ByteSpan(reinterpret_cast(data), sizeof(data))); // Actual read via an encoder @@ -1307,7 +1591,7 @@ TEST(TestCodegenModelViaMocks, EmberAttributeReadOctetString) TEST(TestCodegenModelViaMocks, EmberAttributeReadLongOctetString) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; TestReadRequest testRequest(kAdminSubjectDescriptor, @@ -1344,7 +1628,7 @@ TEST(TestCodegenModelViaMocks, EmberAttributeReadLongOctetString) TEST(TestCodegenModelViaMocks, EmberAttributeReadShortString) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; TestReadRequest testRequest(kAdminSubjectDescriptor, @@ -1353,9 +1637,8 @@ TEST(TestCodegenModelViaMocks, EmberAttributeReadShortString) // NOTE: This is a pascal string, so actual data is "abcde" // the longer encoding is to make it clear we do not encode the overflow - char data[] = "\0abcdef...this is the alphabet"; - uint16_t len = 5; - memcpy(data, &len, sizeof(uint8_t)); + char data[] = "\0abcdef...this is the alphabet"; + *data = 5; chip::Test::SetEmberReadOutput(ByteSpan(reinterpret_cast(data), sizeof(data))); // Actual read via an encoder @@ -1381,7 +1664,7 @@ TEST(TestCodegenModelViaMocks, EmberAttributeReadShortString) TEST(TestCodegenModelViaMocks, EmberAttributeReadLongString) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; TestReadRequest testRequest( @@ -1391,9 +1674,8 @@ TEST(TestCodegenModelViaMocks, EmberAttributeReadLongString) // NOTE: This is a pascal string, so actual data is "abcde" // the longer encoding is to make it clear we do not encode the overflow - char data[] = "\0\0abcdef...this is the alphabet"; - uint16_t len = 5; - memcpy(data, &len, sizeof(uint16_t)); + char data[] = "\0\0abcdef...this is the alphabet"; + WriteLe16(data, 5); chip::Test::SetEmberReadOutput(ByteSpan(reinterpret_cast(data), sizeof(data))); // Actual read via an encoder @@ -1419,7 +1701,7 @@ TEST(TestCodegenModelViaMocks, EmberAttributeReadLongString) TEST(TestCodegenModelViaMocks, AttributeAccessInterfaceStructRead) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; const ConcreteAttributePath kStructPath(kMockEndpoint3, MockClusterId(4), @@ -1459,10 +1741,25 @@ TEST(TestCodegenModelViaMocks, AttributeAccessInterfaceStructRead) ASSERT_TRUE(actual.e.data_equal("foo"_span)); } +TEST(TestCodegenModelViaMocks, AttributeAccessInterfaceReadError) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + const ConcreteAttributePath kStructPath(kMockEndpoint3, MockClusterId(4), + MOCK_ATTRIBUTE_ID_FOR_NON_NULLABLE_TYPE(ZCL_STRUCT_ATTRIBUTE_TYPE)); + + TestReadRequest testRequest(kAdminSubjectDescriptor, kStructPath); + RegisteredAttributeAccessInterface aai(kStructPath, CHIP_ERROR_KEY_NOT_FOUND); + std::unique_ptr encoder = testRequest.StartEncoding(&model); + ASSERT_EQ(model.ReadAttribute(testRequest.request, *encoder), CHIP_ERROR_KEY_NOT_FOUND); +} + TEST(TestCodegenModelViaMocks, AttributeAccessInterfaceListRead) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; const ConcreteAttributePath kStructPath(kMockEndpoint3, MockClusterId(4), @@ -1514,7 +1811,7 @@ TEST(TestCodegenModelViaMocks, AttributeAccessInterfaceListRead) TEST(TestCodegenModelViaMocks, AttributeAccessInterfaceListOverflowRead) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; const ConcreteAttributePath kStructPath(kMockEndpoint3, MockClusterId(4), @@ -1573,7 +1870,7 @@ TEST(TestCodegenModelViaMocks, AttributeAccessInterfaceListOverflowRead) TEST(TestCodegenModelViaMocks, AttributeAccessInterfaceListIncrementalRead) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; const ConcreteAttributePath kStructPath(kMockEndpoint3, MockClusterId(4), @@ -1635,7 +1932,7 @@ TEST(TestCodegenModelViaMocks, AttributeAccessInterfaceListIncrementalRead) TEST(TestCodegenModelViaMocks, ReadGlobalAttributeAttributeList) { UseMockNodeConfig config(gTestNodeConfig); - chip::app::CodegenDataModel model; + CodegenDataModelWithContext model; ScopedMockAccessControl accessControl; TestReadRequest testRequest(kAdminSubjectDescriptor, @@ -1687,3 +1984,546 @@ TEST(TestCodegenModelViaMocks, ReadGlobalAttributeAttributeList) EXPECT_EQ(items[i], expected[i]); } } + +TEST(TestCodegenModelViaMocks, EmberAttributeWriteAclDeny) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test(kDenySubjectDescriptor, ConcreteDataAttributePath(kMockEndpoint1, MockClusterId(1), MockAttributeId(10))); + AttributeValueDecoder decoder = test.DecoderFor(1234); + + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_IM_GLOBAL_STATUS(UnsupportedAccess)); + ASSERT_TRUE(model.ChangeListener().DirtyList().empty()); +} + +TEST(TestCodegenModelViaMocks, EmberAttributeWriteBasicTypes) +{ + TestEmberScalarTypeWrite(0x12); + TestEmberScalarTypeWrite(0x1234); + TestEmberScalarTypeWrite, ZCL_INT24U_ATTRIBUTE_TYPE>(0x112233); + TestEmberScalarTypeWrite(0x11223344); + TestEmberScalarTypeWrite, ZCL_INT40U_ATTRIBUTE_TYPE>(0x1122334455ULL); + TestEmberScalarTypeWrite, ZCL_INT48U_ATTRIBUTE_TYPE>(0x112233445566ULL); + TestEmberScalarTypeWrite, ZCL_INT56U_ATTRIBUTE_TYPE>(0x11223344556677ULL); + TestEmberScalarTypeWrite(0x1122334455667788ULL); + + TestEmberScalarTypeWrite(-10); + TestEmberScalarTypeWrite(-123); + TestEmberScalarTypeWrite, ZCL_INT24S_ATTRIBUTE_TYPE>(-1234); + TestEmberScalarTypeWrite(-12345); + TestEmberScalarTypeWrite, ZCL_INT40S_ATTRIBUTE_TYPE>(-123456); + TestEmberScalarTypeWrite, ZCL_INT48S_ATTRIBUTE_TYPE>(-1234567); + TestEmberScalarTypeWrite, ZCL_INT56S_ATTRIBUTE_TYPE>(-12345678); + TestEmberScalarTypeWrite(-123456789); + + TestEmberScalarTypeWrite(true); + TestEmberScalarTypeWrite(false); + TestEmberScalarTypeWrite(0.625); + TestEmberScalarTypeWrite(0.625); +} + +TEST(TestCodegenModelViaMocks, EmberAttributeWriteInvalidValueToNullable) +{ + TestEmberScalarTypeWriteNullValueToNullable(); + TestEmberScalarTypeWriteNullValueToNullable(); + TestEmberScalarTypeWriteNullValueToNullable, ZCL_INT24U_ATTRIBUTE_TYPE>(); + TestEmberScalarTypeWriteNullValueToNullable(); + TestEmberScalarTypeWriteNullValueToNullable, ZCL_INT40U_ATTRIBUTE_TYPE>(); + TestEmberScalarTypeWriteNullValueToNullable, ZCL_INT48U_ATTRIBUTE_TYPE>(); + TestEmberScalarTypeWriteNullValueToNullable, ZCL_INT56U_ATTRIBUTE_TYPE>(); + TestEmberScalarTypeWriteNullValueToNullable(); + + TestEmberScalarTypeWriteNullValueToNullable(); + TestEmberScalarTypeWriteNullValueToNullable(); + TestEmberScalarTypeWriteNullValueToNullable, ZCL_INT24S_ATTRIBUTE_TYPE>(); + TestEmberScalarTypeWriteNullValueToNullable(); + TestEmberScalarTypeWriteNullValueToNullable, ZCL_INT40S_ATTRIBUTE_TYPE>(); + TestEmberScalarTypeWriteNullValueToNullable, ZCL_INT48S_ATTRIBUTE_TYPE>(); + TestEmberScalarTypeWriteNullValueToNullable, ZCL_INT56S_ATTRIBUTE_TYPE>(); + TestEmberScalarTypeWriteNullValueToNullable(); + + TestEmberScalarTypeWriteNullValueToNullable(); + TestEmberScalarTypeWriteNullValueToNullable(); + TestEmberScalarTypeWriteNullValueToNullable(); + TestEmberScalarTypeWriteNullValueToNullable(); +} + +TEST(TestCodegenModelViaMocks, EmberTestWriteReservedNullPlaceholderToNullable) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test( + kAdminSubjectDescriptor, + ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), MOCK_ATTRIBUTE_ID_FOR_NULLABLE_TYPE(ZCL_INT32U_ATTRIBUTE_TYPE))); + + using NumericType = NumericAttributeTraits; + using NullableType = chip::app::DataModel::Nullable; + AttributeValueDecoder decoder = test.DecoderFor(0xFFFFFFFF); + + // write should fail: we are trying to write null which is out of range + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_IM_GLOBAL_STATUS(ConstraintError)); +} + +TEST(TestCodegenModelViaMocks, EmberTestWriteOutOfRepresentableRangeOddIntegerNonNullable) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test(kAdminSubjectDescriptor, + ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), + MOCK_ATTRIBUTE_ID_FOR_NON_NULLABLE_TYPE(ZCL_INT24U_ATTRIBUTE_TYPE))); + + using NumericType = NumericAttributeTraits; + using NullableType = chip::app::DataModel::Nullable; + AttributeValueDecoder decoder = test.DecoderFor(0x1223344); + + // write should fail: written value is not in range + // NOTE: this matches legacy behaviour, however realistically maybe ConstraintError would be more correct + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_ERROR_INVALID_ARGUMENT); +} + +TEST(TestCodegenModelViaMocks, EmberTestWriteOutOfRepresentableRangeOddIntegerNullable) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test( + kAdminSubjectDescriptor, + ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), MOCK_ATTRIBUTE_ID_FOR_NULLABLE_TYPE(ZCL_INT24U_ATTRIBUTE_TYPE))); + + using NumericType = NumericAttributeTraits; + using NullableType = chip::app::DataModel::Nullable; + AttributeValueDecoder decoder = test.DecoderFor(0x1223344); + + // write should fail: written value is not in range + // NOTE: this matches legacy behaviour, however realistically maybe ConstraintError would be more correct + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_ERROR_INVALID_ARGUMENT); +} + +TEST(TestCodegenModelViaMoceNullValueToNullables, EmberAttributeWriteBasicTypesLowestValue) +{ + TestEmberScalarTypeWrite(-127); + TestEmberScalarTypeWrite(-32767); + TestEmberScalarTypeWrite, ZCL_INT24S_ATTRIBUTE_TYPE>(-8388607); + TestEmberScalarTypeWrite(-2147483647); + TestEmberScalarTypeWrite, ZCL_INT40S_ATTRIBUTE_TYPE>(-549755813887); + TestEmberScalarTypeWrite, ZCL_INT48S_ATTRIBUTE_TYPE>(-140737488355327); + TestEmberScalarTypeWrite, ZCL_INT56S_ATTRIBUTE_TYPE>(-36028797018963967); + TestEmberScalarTypeWrite(-9223372036854775807); +} + +TEST(TestCodegenModelViaMocks, EmberAttributeWriteNulls) +{ + TestEmberScalarNullWrite(); + TestEmberScalarNullWrite(); + TestEmberScalarNullWrite, ZCL_INT24U_ATTRIBUTE_TYPE>(); + TestEmberScalarNullWrite(); + TestEmberScalarNullWrite, ZCL_INT40U_ATTRIBUTE_TYPE>(); + TestEmberScalarNullWrite, ZCL_INT48U_ATTRIBUTE_TYPE>(); + TestEmberScalarNullWrite, ZCL_INT56U_ATTRIBUTE_TYPE>(); + TestEmberScalarNullWrite(); + + TestEmberScalarNullWrite(); + TestEmberScalarNullWrite(); + TestEmberScalarNullWrite, ZCL_INT24S_ATTRIBUTE_TYPE>(); + TestEmberScalarNullWrite(); + TestEmberScalarNullWrite, ZCL_INT40S_ATTRIBUTE_TYPE>(); + TestEmberScalarNullWrite, ZCL_INT48S_ATTRIBUTE_TYPE>(); + TestEmberScalarNullWrite, ZCL_INT56S_ATTRIBUTE_TYPE>(); + TestEmberScalarNullWrite(); + TestEmberScalarNullWrite(); + TestEmberScalarNullWrite(); + TestEmberScalarNullWrite(); +} + +TEST(TestCodegenModelViaMocks, EmberAttributeWriteShortString) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test(kAdminSubjectDescriptor, + ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), + MOCK_ATTRIBUTE_ID_FOR_NON_NULLABLE_TYPE(ZCL_CHAR_STRING_ATTRIBUTE_TYPE))); + AttributeValueDecoder decoder = test.DecoderFor("hello world"_span); + + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_NO_ERROR); + chip::ByteSpan writtenData = GetEmberBuffer(); + chip::CharSpan asCharSpan(reinterpret_cast(writtenData.data()), writtenData[0] + 1); + ASSERT_TRUE(asCharSpan.data_equal("\x0Bhello world"_span)); +} + +TEST(TestCodegenModelViaMocks, EmberAttributeWriteLongStringOutOfBounds) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test(kAdminSubjectDescriptor, + ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), + MOCK_ATTRIBUTE_ID_FOR_NON_NULLABLE_TYPE(ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE))); + + // Mocks allow for 16 bytes only by default for string attributes + AttributeValueDecoder decoder = test.DecoderFor( + "this is a very long string that will be longer than the default attribute size for our mocks"_span); + + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_IM_GLOBAL_STATUS(InvalidValue)); +} + +TEST(TestCodegenModelViaMocks, EmberAttributeWriteLongString) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test(kAdminSubjectDescriptor, + ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), + MOCK_ATTRIBUTE_ID_FOR_NON_NULLABLE_TYPE(ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE))); + AttributeValueDecoder decoder = test.DecoderFor("text"_span); + + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_NO_ERROR); + chip::ByteSpan writtenData = GetEmberBuffer(); + + uint16_t len = ReadLe16(writtenData.data()); + EXPECT_EQ(len, 4); + chip::CharSpan asCharSpan(reinterpret_cast(writtenData.data() + 2), 4); + + ASSERT_TRUE(asCharSpan.data_equal("text"_span)); +} + +TEST(TestCodegenModelViaMocks, EmberAttributeWriteNullableLongStringValue) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test(kAdminSubjectDescriptor, + ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), + MOCK_ATTRIBUTE_ID_FOR_NULLABLE_TYPE(ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE))); + AttributeValueDecoder decoder = + test.DecoderFor>(chip::app::DataModel::MakeNullable("text"_span)); + + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_NO_ERROR); + chip::ByteSpan writtenData = GetEmberBuffer(); + + uint16_t len = ReadLe16(writtenData.data()); + EXPECT_EQ(len, 4); + chip::CharSpan asCharSpan(reinterpret_cast(writtenData.data() + 2), 4); + + ASSERT_TRUE(asCharSpan.data_equal("text"_span)); +} + +TEST(TestCodegenModelViaMocks, EmberAttributeWriteLongNullableStringNull) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test(kAdminSubjectDescriptor, + ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), + MOCK_ATTRIBUTE_ID_FOR_NULLABLE_TYPE(ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE))); + AttributeValueDecoder decoder = + test.DecoderFor>(chip::app::DataModel::Nullable()); + + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_NO_ERROR); + chip::ByteSpan writtenData = GetEmberBuffer(); + ASSERT_EQ(writtenData[0], 0xFF); + ASSERT_EQ(writtenData[1], 0xFF); +} + +TEST(TestCodegenModelViaMocks, EmberAttributeWriteShortBytes) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test(kAdminSubjectDescriptor, + ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), + MOCK_ATTRIBUTE_ID_FOR_NON_NULLABLE_TYPE(ZCL_OCTET_STRING_ATTRIBUTE_TYPE))); + uint8_t buffer[] = { 11, 12, 13 }; + + AttributeValueDecoder decoder = test.DecoderFor(ByteSpan(buffer)); + + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_NO_ERROR); + chip::ByteSpan writtenData = GetEmberBuffer(); + + EXPECT_EQ(writtenData[0], 3u); + EXPECT_EQ(writtenData[1], 11u); + EXPECT_EQ(writtenData[2], 12u); + EXPECT_EQ(writtenData[3], 13u); +} + +TEST(TestCodegenModelViaMocks, EmberAttributeWriteLongBytes) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test(kAdminSubjectDescriptor, + ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), + MOCK_ATTRIBUTE_ID_FOR_NON_NULLABLE_TYPE(ZCL_LONG_OCTET_STRING_ATTRIBUTE_TYPE))); + uint8_t buffer[] = { 11, 12, 13 }; + + AttributeValueDecoder decoder = test.DecoderFor(ByteSpan(buffer)); + + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_NO_ERROR); + chip::ByteSpan writtenData = GetEmberBuffer(); + + uint16_t len = ReadLe16(writtenData.data()); + EXPECT_EQ(len, 3); + + EXPECT_EQ(writtenData[2], 11u); + EXPECT_EQ(writtenData[3], 12u); + EXPECT_EQ(writtenData[4], 13u); +} + +TEST(TestCodegenModelViaMocks, EmberAttributeWriteTimedWrite) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test(kAdminSubjectDescriptor, ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), kAttributeIdTimedWrite)); + AttributeValueDecoder decoder = test.DecoderFor(1234); + + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_IM_GLOBAL_STATUS(NeedsTimedInteraction)); + + // writing as timed should be fine + test.request.writeFlags.Set(WriteFlags::kTimed); + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_NO_ERROR); +} + +TEST(TestCodegenModelViaMocks, EmberAttributeWriteReadOnlyAttribute) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test(kAdminSubjectDescriptor, ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), kAttributeIdReadOnly)); + AttributeValueDecoder decoder = test.DecoderFor(1234); + + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_IM_GLOBAL_STATUS(UnsupportedWrite)); + + // Internal writes bypass the read only requirement + test.request.operationFlags.Set(OperationFlags::kInternal); + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_NO_ERROR); +} + +TEST(TestCodegenModelViaMocks, EmberAttributeWriteDataVersion) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test(kAdminSubjectDescriptor, + ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), + MOCK_ATTRIBUTE_ID_FOR_NON_NULLABLE_TYPE(ZCL_INT32S_ATTRIBUTE_TYPE))); + + // Initialize to some version + ResetVersion(); + BumpVersion(); + test.request.path.mDataVersion = MakeOptional(GetVersion()); + + // Make version invalid + BumpVersion(); + + AttributeValueDecoder decoder = test.DecoderFor(1234); + + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_IM_GLOBAL_STATUS(DataVersionMismatch)); + + // Write passes if we set the right version for the data + test.request.path.mDataVersion = MakeOptional(GetVersion()); + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_NO_ERROR); +} + +TEST(TestCodegenModelViaMocks, WriteToInvalidPath) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + { + TestWriteRequest test(kAdminSubjectDescriptor, ConcreteAttributePath(kInvalidEndpointId, MockClusterId(1234), 1234)); + AttributeValueDecoder decoder = test.DecoderFor(1234); + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_IM_GLOBAL_STATUS(UnsupportedEndpoint)); + } + { + TestWriteRequest test(kAdminSubjectDescriptor, ConcreteAttributePath(kMockEndpoint1, MockClusterId(1234), 1234)); + AttributeValueDecoder decoder = test.DecoderFor(1234); + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_IM_GLOBAL_STATUS(UnsupportedCluster)); + } + + { + TestWriteRequest test(kAdminSubjectDescriptor, ConcreteAttributePath(kMockEndpoint1, MockClusterId(1), 1234)); + AttributeValueDecoder decoder = test.DecoderFor(1234); + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); + } +} + +TEST(TestCodegenModelViaMocks, WriteToGlobalAttribute) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test(kAdminSubjectDescriptor, ConcreteAttributePath(kMockEndpoint1, MockClusterId(1), AttributeList::Id)); + AttributeValueDecoder decoder = test.DecoderFor(1234); + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_IM_GLOBAL_STATUS(UnsupportedWrite)); +} + +TEST(TestCodegenModelViaMocks, EmberWriteFailure) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + TestWriteRequest test(kAdminSubjectDescriptor, + ConcreteAttributePath(kMockEndpoint3, MockClusterId(4), + MOCK_ATTRIBUTE_ID_FOR_NON_NULLABLE_TYPE(ZCL_INT32S_ATTRIBUTE_TYPE))); + + { + AttributeValueDecoder decoder = test.DecoderFor(1234); + chip::Test::SetEmberReadOutput(Protocols::InteractionModel::Status::Failure); + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_IM_GLOBAL_STATUS(Failure)); + } + { + AttributeValueDecoder decoder = test.DecoderFor(1234); + chip::Test::SetEmberReadOutput(Protocols::InteractionModel::Status::Busy); + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_IM_GLOBAL_STATUS(Busy)); + } + // reset things to success to not affect other tests + chip::Test::SetEmberReadOutput(ByteSpan()); +} + +TEST(TestCodegenModelViaMocks, EmberWriteAttributeAccessInterfaceTest) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + const ConcreteAttributePath kStructPath(kMockEndpoint3, MockClusterId(4), + MOCK_ATTRIBUTE_ID_FOR_NON_NULLABLE_TYPE(ZCL_STRUCT_ATTRIBUTE_TYPE)); + RegisteredAttributeAccessInterface aai(kStructPath); + + TestWriteRequest test(kAdminSubjectDescriptor, kStructPath); + Clusters::UnitTesting::Structs::SimpleStruct::Type testValue{ + .a = 112, + .b = true, + .e = "aai_write_test"_span, + .g = 0.5, + .h = 0.125, + }; + + AttributeValueDecoder decoder = test.DecoderFor(testValue); + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_NO_ERROR); + + EXPECT_EQ(aai->GetData().a, 112); + EXPECT_TRUE(aai->GetData().e.data_equal("aai_write_test"_span)); + + // AAI marks dirty paths + ASSERT_EQ(model.ChangeListener().DirtyList().size(), 1u); + EXPECT_EQ(model.ChangeListener().DirtyList()[0], kStructPath); + + // AAI does not prevent read/write of regular attributes + // validate that once AAI is added, we still can go through writing regular bits (i.e. + // AAI returning "unknown" has fallback to ember) + TestEmberScalarTypeWrite(1234); + TestEmberScalarNullWrite(); +} + +TEST(TestCodegenModelViaMocks, EmberInvokeTest) +{ + // Ember invoke is fully code-generated - there is a single function for Dispatch + // that will do a `switch` on the path elements and invoke a corresponding `emberAf*` + // callback. + // + // The only thing that can be validated is that this `DispatchSingleClusterCommand` + // is actually invoked. + + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + { + const ConcreteCommandPath kCommandPath(kMockEndpoint1, MockClusterId(1), kMockCommandId1); + const InvokeRequest kInvokeRequest{ .path = kCommandPath }; + chip::TLV::TLVReader tlvReader; + + const uint32_t kDispatchCountPre = chip::Test::DispatchCount(); + + // Using a handler set to nullptr as it is not used by the impl + ASSERT_EQ(model.Invoke(kInvokeRequest, tlvReader, /* handler = */ nullptr), CHIP_NO_ERROR); + + EXPECT_EQ(chip::Test::DispatchCount(), kDispatchCountPre + 1); // single dispatch + EXPECT_EQ(chip::Test::GetLastDispatchPath(), kCommandPath); // for the right path + } + + { + const ConcreteCommandPath kCommandPath(kMockEndpoint1, MockClusterId(1), kMockCommandId2); + const InvokeRequest kInvokeRequest{ .path = kCommandPath }; + chip::TLV::TLVReader tlvReader; + + const uint32_t kDispatchCountPre = chip::Test::DispatchCount(); + + // Using a handler set to nullpotr as it is not used by the impl + ASSERT_EQ(model.Invoke(kInvokeRequest, tlvReader, /* handler = */ nullptr), CHIP_NO_ERROR); + + EXPECT_EQ(chip::Test::DispatchCount(), kDispatchCountPre + 1); // single dispatch + EXPECT_EQ(chip::Test::GetLastDispatchPath(), kCommandPath); // for the right path + } +} + +TEST(TestCodegenModelViaMocks, EmberWriteAttributeAccessInterfaceReturningError) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + const ConcreteAttributePath kStructPath(kMockEndpoint3, MockClusterId(4), + MOCK_ATTRIBUTE_ID_FOR_NON_NULLABLE_TYPE(ZCL_STRUCT_ATTRIBUTE_TYPE)); + RegisteredAttributeAccessInterface aai(kStructPath, CHIP_ERROR_KEY_NOT_FOUND); + + TestWriteRequest test(kAdminSubjectDescriptor, kStructPath); + Clusters::UnitTesting::Structs::SimpleStruct::Type testValue{ + .a = 112, + .b = true, + .e = "aai_write_test"_span, + .g = 0.5, + .h = 0.125, + }; + + AttributeValueDecoder decoder = test.DecoderFor(testValue); + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_ERROR_KEY_NOT_FOUND); + ASSERT_TRUE(model.ChangeListener().DirtyList().empty()); +} + +TEST(TestCodegenModelViaMocks, EmberWriteInvalidDataType) +{ + UseMockNodeConfig config(gTestNodeConfig); + CodegenDataModelWithContext model; + ScopedMockAccessControl accessControl; + + const ConcreteAttributePath kStructPath(kMockEndpoint3, MockClusterId(4), + MOCK_ATTRIBUTE_ID_FOR_NON_NULLABLE_TYPE(ZCL_STRUCT_ATTRIBUTE_TYPE)); + + TestWriteRequest test(kAdminSubjectDescriptor, kStructPath); + Clusters::UnitTesting::Structs::SimpleStruct::Type testValue{ + .a = 112, + .b = true, + .e = "aai_write_test"_span, + .g = 0.5, + .h = 0.125, + }; + + AttributeValueDecoder decoder = test.DecoderFor(testValue); + + // Embed specifically DOES NOT support structures. + // Without AAI, we expect a data type error (translated to failure) + ASSERT_EQ(model.WriteAttribute(test.request, decoder), CHIP_IM_GLOBAL_STATUS(Failure)); + ASSERT_TRUE(model.ChangeListener().DirtyList().empty()); +} diff --git a/src/app/common/templates/config-data.yaml b/src/app/common/templates/config-data.yaml index 83d1b682153ed7..d77db76970818c 100644 --- a/src/app/common/templates/config-data.yaml +++ b/src/app/common/templates/config-data.yaml @@ -13,6 +13,7 @@ EnumsNotUsedAsTypeInXML: - "RvcOperationalState::OperationalStateEnum" - "RvcOperationalState::ErrorStateEnum" - "EnergyEvseMode::ModeTag" + - "WaterHeaterMode::ModeTag" - "DeviceEnergyManagementMode::ModeTag" CommandHandlerInterfaceOnlyClusters: @@ -41,6 +42,10 @@ CommandHandlerInterfaceOnlyClusters: - Electrical Power Measurement - Electrical Energy Measurement - Wi-Fi Network Management + - Thread Border Router Management + - Thread Network Directory + - Water Heater Management + - Water Heater Mode # We need a more configurable way of deciding which clusters have which init functions.... # See https://github.com/project-chip/connectedhomeip/issues/4369 @@ -58,7 +63,6 @@ ClustersWithInitFunctions: - Mode Select - Sample MEI - Scenes Management - - Wi-Fi Network Management ClustersWithAttributeChangedFunctions: - Bridged Device Basic diff --git a/src/app/common/templates/templates.json b/src/app/common/templates/templates.json index 9c1ef210532b95..148ab5419f5b84 100644 --- a/src/app/common/templates/templates.json +++ b/src/app/common/templates/templates.json @@ -25,6 +25,10 @@ "name": "cluster_enums_enum", "path": "../../zap-templates/partials/cluster-enums-enum.zapt" }, + { + "name": "cluster_enums_ensure_known_value", + "path": "../../zap-templates/partials/cluster-enums-ensure-known-value.zapt" + }, { "name": "cluster_objects_field_init", "path": "../../zap-templates/partials/cluster-objects-field-init.zapt" diff --git a/src/app/common_flags.gni b/src/app/common_flags.gni index 91057654fdcccf..be1149b2b67eb5 100644 --- a/src/app/common_flags.gni +++ b/src/app/common_flags.gni @@ -21,4 +21,14 @@ declare_args() { # Flag that controls whether the time-to-wait from BUSY responses is # communicated to OperationalSessionSetup API consumers. chip_enable_busy_handling_for_operational_session_setup = true + + # Data model interface usage: + # - disabled: does not use data model interface at all + # - check: runs BOTH datamodel and non-data-model (if possible) functionality and compares results + # - enabled: runs only the data model interface (does not use the legacy code) + if (current_os == "linux") { + chip_use_data_model_interface = "check" + } else { + chip_use_data_model_interface = "disabled" + } } diff --git a/src/app/data-model-interface/BUILD.gn b/src/app/data-model-interface/BUILD.gn index 65cde75612e2ba..abe66a68f342bd 100644 --- a/src/app/data-model-interface/BUILD.gn +++ b/src/app/data-model-interface/BUILD.gn @@ -20,7 +20,6 @@ source_set("data-model-interface") { "DataModel.h", "DataModelChangeListener.h", "EventsGenerator.h", - "InvokeResponder.h", "MetadataTypes.cpp", "MetadataTypes.h", "OperationTypes.h", @@ -29,6 +28,7 @@ source_set("data-model-interface") { public_deps = [ "${chip_root}/src/access:types", "${chip_root}/src/app:attribute-access", + "${chip_root}/src/app:command-handler-interface", "${chip_root}/src/app:events", "${chip_root}/src/app:paths", "${chip_root}/src/app/MessageDef", diff --git a/src/app/data-model-interface/DataModel.h b/src/app/data-model-interface/DataModel.h index 04911fd75cccc3..bcf24c1aa9e7b2 100644 --- a/src/app/data-model-interface/DataModel.h +++ b/src/app/data-model-interface/DataModel.h @@ -21,9 +21,9 @@ #include #include +#include #include -#include #include #include @@ -58,7 +58,7 @@ class DataModel : public DataModelMetadataTree /// TEMPORARY/TRANSITIONAL requirement for transitioning from ember-specific code /// ReadAttribute is REQUIRED to perform: /// - ACL validation (see notes on OperationFlags::kInternal) - /// - Validation of readability/writability + /// - Validation of readability/writability (also controlled by OperationFlags::kInternal) /// - use request.path.mExpanded to skip encoding replies for data according /// to 8.4.3.2 of the spec: /// > If the path indicates attribute data that is not readable, then the path SHALL @@ -84,8 +84,11 @@ class DataModel : public DataModelMetadataTree /// When this is invoked, caller is expected to have already done some validations: /// - cluster `data version` has been checked for the incoming request if applicable /// - /// When `request.writeFlags.Has(WriteFlags::kForceInternal)` the request is from an internal app update - /// and SHOULD bypass some internal checks (like timed enforcement, potentially read-only restrictions) + /// TEMPORARY/TRANSITIONAL requirement for transitioning from ember-specific code + /// WriteAttribute is REQUIRED to perform: + /// - ACL validation (see notes on OperationFlags::kInternal) + /// - Validation of readability/writability (also controlled by OperationFlags::kInternal) + /// - Validation of timed interaction required (also controlled by OperationFlags::kInternal) /// /// Return codes /// CHIP_IM_GLOBAL_STATUS(code): @@ -96,25 +99,9 @@ class DataModel : public DataModelMetadataTree /// - `NeedsTimedInteraction` for writes that are not timed however are required to be so virtual CHIP_ERROR WriteAttribute(const WriteAttributeRequest & request, AttributeValueDecoder & decoder) = 0; - /// `reply` is used to send back the reply. - /// - calling Reply() or ReplyAsync() will let the application control the reply - /// - returning a CHIP_NO_ERROR without reply/reply_async implies a Status::Success reply without data + /// `handler` is used to send back the reply. /// - returning a value other than CHIP_NO_ERROR implies an error reply (error and data are mutually exclusive) - /// - /// See InvokeReply/AutoCompleteInvokeResponder for details on how to send back replies and expected - /// error handling. If you need to know weather a response was successfully sent, use the underlying - /// `reply` object instead of returning an error code from Invoke. - /// - /// Return codes - /// CHIP_IM_GLOBAL_STATUS(code): - /// - error codes that are translatable to specific IM codes - /// - in particular, the following codes are interesting/expected - /// - `UnsupportedEndpoint` for invalid endpoint - /// - `UnsupportedCluster` for no such cluster on the endpoint - /// - `UnsupportedCommand` for no such command in the cluster - /// - `UnsupportedAccess` for permission errors (ACL or fabric scoped with invalid fabric) - /// - `NeedsTimedInteraction` if the invoke requires timed interaction support - virtual CHIP_ERROR Invoke(const InvokeRequest & request, chip::TLV::TLVReader & input_arguments, InvokeReply & reply) = 0; + virtual CHIP_ERROR Invoke(const InvokeRequest & request, chip::TLV::TLVReader & input_arguments, CommandHandler * handler) = 0; private: InteractionModelContext mContext = { nullptr }; diff --git a/src/app/data-model-interface/DataModelChangeListener.h b/src/app/data-model-interface/DataModelChangeListener.h index 37c278c76b92c8..a5ba12684baffe 100644 --- a/src/app/data-model-interface/DataModelChangeListener.h +++ b/src/app/data-model-interface/DataModelChangeListener.h @@ -16,7 +16,7 @@ */ #pragma once -#include +#include namespace chip { namespace app { @@ -34,12 +34,12 @@ namespace InteractionModel { class DataModelChangeListener { public: - virtual ~DataModelChangeListener() = 0; + virtual ~DataModelChangeListener() = default; /// Mark all attributes matching the given path (which may be a wildcard) dirty. /// /// Wildcards are supported. - virtual void MarkDirty(const AttributePathParams & path) = 0; + virtual void MarkDirty(const ConcreteAttributePath & path) = 0; }; } // namespace InteractionModel diff --git a/src/app/data-model-interface/InvokeResponder.h b/src/app/data-model-interface/InvokeResponder.h deleted file mode 100644 index 9890c3bb6f6d7e..00000000000000 --- a/src/app/data-model-interface/InvokeResponder.h +++ /dev/null @@ -1,316 +0,0 @@ -/* - * 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 - -namespace chip { -namespace app { -namespace InteractionModel { - -/// Handles encoding of an invoke response for a specific invoke request. -/// -/// This class handles a single request (i.e. a CommandDataIB within the -/// matter protocol) and is responsible for constructing its corresponding -/// response (i.e. a InvokeResponseIB within the matter protocol) -/// -/// Invoke responses MUST contain exactly ONE of: -/// - response data (accessed via `ResponseEncoder`) -/// - A status, which may be success or failure, both of which may -/// contain a cluster-specific error code. -/// -/// To encode a response, `Complete` MUST be called. -/// -/// `Complete` requirements -/// - Complete with InteractionModel::Status::Success will respond with data -/// some response data was written. -/// - Any other case (including success with cluster specific codes) implies -/// no response data and a status will be encoded instead -/// - this includes the case when some response data was written already. -/// In that case, the response data will be rolled back and only the status -/// will be encoded. -/// -/// Creating a response MAY be retried at most once, if and only if `Complete` -/// returns CHIP_ERROR_BUFFER_TOO_SMALL. Retry attempts MUST not exceed 1: -/// - FlushPendingResponses MUST be called to make as much buffer space as possible -/// available for encoding -/// - The response encoding (including `ResponseEncoder` usage and calling Complete) -/// MUST be retried once more. If the final Complete returns an error, the result -/// of the invoke will be an error status. -/// -class InvokeResponder -{ -public: - virtual ~InvokeResponder() = default; - - // Copying not allowed since underlying requirement is that on deletion of this - // object, a reply will be sent. - InvokeResponder(const InvokeResponder &) = delete; - InvokeResponder & operator=(const InvokeResponder &) = delete; - - /// Flush any pending replies before encoding the current reply. - /// - /// MAY be called at most once. - /// - /// This function is intended to provided the ability to retry sending a reply - /// if a reply encoding fails due to insufficient buffer. - /// - /// Call this if `Complete(...)` returns CHIP_ERROR_BUFFER_TOO_SMALL and try - /// again. If reply data is needed, the complete ResponseEncoder + Complete - /// call chain MUST be re-run. - virtual CHIP_ERROR FlushPendingResponses() = 0; - - /// Reply with a data payload. - /// - /// MUST be called at most once per reply. - /// Can be called a 2nd time after a `FlushPendingResponses()` call - /// - /// - responseCommandId must correspond with the data encoded in the returned encoder - /// - Complete(CHIP_NO_ERROR) MUST be called to flush the reply - /// - /// If encoder returns CHIP_ERROR_BUFFER_TOO_SMALL, FlushPendingResponses should be - /// used to attempt to free up buffer space then encoding should be tried again. - virtual DataModel::WrappedStructEncoder & ResponseEncoder(CommandId responseCommandId) = 0; - - /// Signal completing of the reply. - /// - /// MUST be called exactly once to signal a response is to be recorded to be sent. - /// The error code (and the data encoded by ResponseEncoder) may be buffered for - /// sending among other batched responses. - /// - /// If this returns CHIP_ERROR_BUFFER_TOO_SMALL, this can be called a 2nd time after - /// a FlushPendingResponses. - /// - /// Argument behavior: - /// - Commands can only be replied with ONE of the following (spec 8.9.4.4): - /// - command data (i.e. ResponseEncoder contents) - /// - A status (including success/error/cluster-specific-success-or-error ) - /// - As a result there are two possible paths: - /// - IF a Status::Success is given (WITHOUT cluster specific status), then - /// the data in ResponseEncoder is sent as a reply. If no data was sent, - /// a invoke `Status::Success` with no cluster specific data is sent - /// - OTHERWISE any previously encoded data via ResponseEncoder is discarded - /// and the given reply (success with cluster status or failure) is sent - /// as a reply to the invoke. - /// - /// - /// Returns success/failure state. One error code MUST be handled in particular: - /// - /// - CHIP_ERROR_BUFFER_TOO_SMALL will return IF AND ONLY IF the responder was unable - /// to fully serialize the given reply/error data. - /// - /// If such an error is returned, the caller MUST retry by calling FlushPendingResponses - /// first and then re-encoding the reply content (use ResponseEncoder if applicable and - /// call Complete again) - /// - /// - Any other error (i.e. different from CHIP_NO_ERROR) mean that the invoke response - /// will contain an error and such an error is considered permanent. - /// - virtual CHIP_ERROR Complete(StatusIB error) = 0; -}; - -/// Enforces that once acquired, Complete will be called on the underlying writer -class AutoCompleteInvokeResponder -{ -public: - // non-copyable: once you have a handle, keep it - AutoCompleteInvokeResponder(const AutoCompleteInvokeResponder &) = delete; - AutoCompleteInvokeResponder & operator=(const AutoCompleteInvokeResponder &) = delete; - - AutoCompleteInvokeResponder(InvokeResponder * writer) : mWriter(writer) {} - ~AutoCompleteInvokeResponder() - { - if (mCompleteState != CompleteState::kComplete) - { - mWriter->Complete(StatusIB{ Protocols::InteractionModel::Status::Failure }); - } - } - - /// Direct access to reply encoding. - /// - /// Use this only in conjunction with the other Raw* calls - DataModel::WrappedStructEncoder & RawResponseEncoder(CommandId replyCommandId) - { - return mWriter->ResponseEncoder(replyCommandId); - } - - /// Direct access to flushing replies - /// - /// Use this only in conjunction with the other Raw* calls - CHIP_ERROR RawFlushPendingReplies() - { - // allow a flush if we never called it (this may not be reasonable, however - // we accept an early flush) or if flush is expected - VerifyOrReturnError((mCompleteState == CompleteState::kNeverCalled) || (mCompleteState == CompleteState::kFlushExpected), - CHIP_ERROR_INCORRECT_STATE); - mCompleteState = CompleteState::kFlushed; - return mWriter->FlushPendingResponses(); - } - - /// Call "Complete" without the automatic retries. - /// - /// Use this in conjunction with the other Raw* calls - CHIP_ERROR RawComplete(StatusIB status) - { - VerifyOrReturnError((mCompleteState == CompleteState::kNeverCalled) || (mCompleteState == CompleteState::kFlushed), - CHIP_ERROR_INCORRECT_STATE); - CHIP_ERROR err = mWriter->Complete(status); - if ((err == CHIP_ERROR_BUFFER_TOO_SMALL) && (mCompleteState == CompleteState::kNeverCalled)) - { - mCompleteState = CompleteState::kFlushExpected; - } - else - { - mCompleteState = CompleteState::kComplete; - } - return err; - } - - /// Complete the given command. - /// - /// Automatically handles retries for sending. - /// Cannot be called after Raw* methods are used. - /// - /// Any error returned by this are final and not retriable - /// as a retry for CHIP_ERROR_BUFFER_TOO_SMALL is already built in. - CHIP_ERROR Complete(StatusIB status) - { - VerifyOrReturnError(mCompleteState == CompleteState::kNeverCalled, CHIP_ERROR_INCORRECT_STATE); - // this is a final complete, including retry handling - mCompleteState = CompleteState::kComplete; - CHIP_ERROR err = mWriter->Complete(status); - - if (err != CHIP_ERROR_BUFFER_TOO_SMALL) - { - return err; - } - - // retry once. Failure to flush is permanent. - ReturnErrorOnFailure(mWriter->FlushPendingResponses()); - return mWriter->Complete(status); - } - - /// Sends the specified data structure as a response - /// - /// This version of the send has built-in RETRY and handles - /// Flush/Complete automatically. - /// Cannot be called after Raw* methods are used. - /// - /// Any error returned by this are final and not retriable - /// as a retry for CHIP_ERROR_BUFFER_TOO_SMALL is already built in. - template - CHIP_ERROR Send(const ReplyData & data) - { - VerifyOrReturnError(mCompleteState == CompleteState::kNeverCalled, CHIP_ERROR_INCORRECT_STATE); - // this is a final complete, including retry handling - mCompleteState = CompleteState::kComplete; - CHIP_ERROR err = data.Encode(ResponseEncoder(ReplyData::GetCommandId())); - if (err != CHIP_ERROR_BUFFER_TOO_SMALL) - { - LogErrorOnFailure(err); - err = mWriter->Complete(StatusIB(err)); - } - if (err != CHIP_ERROR_BUFFER_TOO_SMALL) - { - return err; - } - - // retry once. Failure to flush is permanent. - ReturnErrorOnFailure(mWriter->FlushPendingResponses()); - err = data.Encode(ResponseEncoder(ReplyData::GetCommandId())); - - // If encoding fails, we will end up sending an error back to the other side - // the caller - LogErrorOnFailure(err); - if (err == CHIP_NO_ERROR) - { - err = mWriter->Complete(StatusIB(err)); - } - else - { - // Error in "complete" is not something we can really forward anymore since - // we already got an error in Encode ... just log this. - LogErrorOnFailure(mWriter->Complete(StatusIB(err))); - } - - return err; - } - -private: - // Contract says that complete may only be called twice: - // - initial complete - // - again after a `Flush` - // The states here expect we are in: - // - // +----------------------------Flush---------| - // | v - // NEVER --Complete--> F_EXPECTED --Flush--> FLUSHED --Complete--> COMPLETE - // | ^ - // +-------------(success or permanent error)-----------| - enum class CompleteState - { - kNeverCalled, - kFlushExpected, - kFlushed, - kComplete, - }; - - InvokeResponder * mWriter; - CompleteState mCompleteState = CompleteState::kNeverCalled; -}; - -enum ReplyAsyncFlags -{ - // Some commands that are expensive to process (e.g. crypto). - // Implementations may choose to send an ack on the message right away to - // avoid MRP retransmits. - kSlowCommandHandling = 0x0001, -}; - -class InvokeReply -{ -public: - virtual ~InvokeReply() = default; - - // reply with no data - CHIP_ERROR Reply(StatusIB status) { return this->Reply().Complete(status); } - - // Enqueue the content of the reply at this point in time (rather than Async sending it). - // - // Implementations will often batch several replies into one packet for batch commands, - // so it will be implementation-specific on when the actual reply packet is - // sent. - virtual AutoCompleteInvokeResponder Reply() = 0; - - // Reply "later" to the command. This allows async processing. A reply will be forced - // when the returned InvokeReply is destroyed. - // - // NOTE: Each InvokeReply is associated with a separate `CommandDataIB` within batch - // commands. When replying asynchronously, each InvokeReply will set the response - // data for the given commandpath/ref only. - // - // IF empty pointer is returned, insufficient memory to reply async is available and - // this should be handled (e.g. by returning an error to the handler/replying with - // an errorcode synchronously). - virtual std::unique_ptr ReplyAsync(BitFlags flags) = 0; -}; - -} // namespace InteractionModel -} // namespace app -} // namespace chip diff --git a/src/app/data-model-interface/OperationTypes.h b/src/app/data-model-interface/OperationTypes.h index d19621db71d26a..c9e5ae642158b3 100644 --- a/src/app/data-model-interface/OperationTypes.h +++ b/src/app/data-model-interface/OperationTypes.h @@ -65,7 +65,6 @@ enum class ReadFlags : uint32_t struct ReadAttributeRequest : OperationRequest { ConcreteAttributePath path; - std::optional dataVersion; BitFlags readFlags; }; diff --git a/src/app/data-model-interface/tests/BUILD.gn b/src/app/data-model-interface/tests/BUILD.gn index f366ee718fc3a3..94faf695f687af 100644 --- a/src/app/data-model-interface/tests/BUILD.gn +++ b/src/app/data-model-interface/tests/BUILD.gn @@ -21,5 +21,8 @@ chip_test_suite("tests") { cflags = [ "-Wconversion" ] - public_deps = [ "${chip_root}/src/app/data-model-interface" ] + public_deps = [ + "${chip_root}/src/app/data-model-interface", + "${chip_root}/src/lib/core:string-builder-adapters", + ] } diff --git a/src/app/data-model-interface/tests/TestEventEmitting.cpp b/src/app/data-model-interface/tests/TestEventEmitting.cpp index 81a89f1603a04b..fe4e37e57b7dd0 100644 --- a/src/app/data-model-interface/tests/TestEventEmitting.cpp +++ b/src/app/data-model-interface/tests/TestEventEmitting.cpp @@ -19,9 +19,10 @@ #include #include #include +#include #include -#include +#include namespace { diff --git a/src/app/data-model/BUILD.gn b/src/app/data-model/BUILD.gn index d61b30a68d9611..d8e314e2a523b6 100644 --- a/src/app/data-model/BUILD.gn +++ b/src/app/data-model/BUILD.gn @@ -13,6 +13,20 @@ # limitations under the License. import("//build_overrides/chip.gni") +source_set("nullable") { + sources = [ + "NullObject.h", + "Nullable.h", + ] + + public_deps = [ + "${chip_root}/src/app/util:nullable-primitives", + "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:error", + "${chip_root}/src/lib/support", + ] +} + source_set("data-model") { sources = [ "BasicTypes.h", @@ -24,26 +38,20 @@ source_set("data-model") { "FabricScopedPreEncodedValue.cpp", "FabricScopedPreEncodedValue.h", "List.h", - "NullObject.h", - "Nullable.h", "PreEncodedValue.cpp", "PreEncodedValue.h", "WrappedStructEncoder.h", ] deps = [ - # TODO: dependencies NOT declared because they are not part of - # any GN dependency. Overall src/app seems to suffer greatly - # of this, in part due to zap-generated code dependency. - # - # - app/util/attribute-storage-null-handling.h - # "${chip_root}/src/app:paths", "${chip_root}/src/app/common:enums", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", "${chip_root}/src/protocols/interaction_model", ] + + public_deps = [ ":nullable" ] } # Provides extensions that use heap and should be diff --git a/src/app/data-model/Nullable.h b/src/app/data-model/Nullable.h index f56e67ced19113..660c889e789518 100644 --- a/src/app/data-model/Nullable.h +++ b/src/app/data-model/Nullable.h @@ -45,8 +45,11 @@ struct Nullable : protected std::optional // all constructors of the base class within this derived class. // using std::optional::optional; - using std::optional::operator*; - using std::optional::operator->; + + // Do NOT pull in optional::operator* or optional::operator->, because that + // leads people to write code that looks like it should work, and compiles, + // but does not do the right things with TLV encoding and decoding, when + // nullable data model objects are involved. Nullable(NullOptionalType) : std::optional(std::nullopt) {} diff --git a/third_party/nxp/BUILD.gn b/src/app/data-model/tests/BUILD.gn similarity index 54% rename from third_party/nxp/BUILD.gn rename to src/app/data-model/tests/BUILD.gn index f35b5f9c852ba5..892e0c1494df55 100644 --- a/third_party/nxp/BUILD.gn +++ b/src/app/data-model/tests/BUILD.gn @@ -1,5 +1,4 @@ -# Copyright (c) 2022 Project CHIP Authors -# Copyright 2023 NXP +# 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. @@ -14,21 +13,17 @@ # limitations under the License. import("//build_overrides/chip.gni") -import("//build_overrides/nxp_sdk.gni") -import("${nxp_sdk_build_root}/nxp_sdk.gni") +import("${chip_root}/build/chip/chip_test_suite.gni") -group("nxp_sdk") { - public_deps = [ "${nxp_sdk_build_root}/${nxp_sdk_name}:nxp_sdk" ] -} +chip_test_suite("tests") { + output_name = "libAppDataModelTests" -if (nxp_use_lwip) { - group("nxp_lwip") { - public_deps = [ "${nxp_sdk_build_root}/${nxp_sdk_name}:nxp_lwip" ] - } -} + test_sources = [ "TestNullable.cpp" ] -if (nxp_use_mbedtls_port) { - group("nxp_mbedtls") { - public_deps = [ "${nxp_sdk_build_root}/${nxp_sdk_name}:nxp_mbedtls" ] - } + public_deps = [ + "${chip_root}/src/app/data-model:nullable", + "${chip_root}/src/lib/core:error", + "${chip_root}/src/lib/core:string-builder-adapters", + "${chip_root}/src/lib/support/tests:pw-test-macros", + ] } diff --git a/src/app/tests/TestNullable.cpp b/src/app/data-model/tests/TestNullable.cpp similarity index 100% rename from src/app/tests/TestNullable.cpp rename to src/app/data-model/tests/TestNullable.cpp diff --git a/src/app/icd/server/BUILD.gn b/src/app/icd/server/BUILD.gn index 89c39c203a7c16..f69c25015592af 100644 --- a/src/app/icd/server/BUILD.gn +++ b/src/app/icd/server/BUILD.gn @@ -66,6 +66,22 @@ source_set("notifier") { ] } +source_set("check-in-back-off") { + sources = [ "ICDCheckInBackOffStrategy.h" ] + + public_deps = [ + ":monitoring-table", + "${chip_root}/src/lib/core", + "${chip_root}/src/lib/support", + ] +} + +source_set("default-check-in-back-off") { + sources = [ "DefaultICDCheckInBackOffStrategy.h" ] + + public_deps = [ ":check-in-back-off" ] +} + # ICD Manager source-set is broken out of the main source-set to enable unit tests # All sources and configurations used by the ICDManager need to go in this source-set source_set("manager") { @@ -77,6 +93,7 @@ source_set("manager") { deps = [ ":icd-server-config" ] public_deps = [ + ":check-in-back-off", ":configuration-data", ":notifier", ":observer", diff --git a/src/app/icd/server/DefaultICDCheckInBackOffStrategy.h b/src/app/icd/server/DefaultICDCheckInBackOffStrategy.h new file mode 100644 index 00000000000000..cdf29f0f2d9f9e --- /dev/null +++ b/src/app/icd/server/DefaultICDCheckInBackOffStrategy.h @@ -0,0 +1,63 @@ +/* + * + * 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 +#include + +namespace chip { +namespace app { + +/** + * @brief Default ICD Check-In BackOff Strategy. + * The default strategy is based on the two types of controllers + * - kPermanent : Always send a Check-In message + * - kEphemeral : Never send a Check-In message + * + * This implementation represents a no back off strategy. + */ +class DefaultICDCheckInBackOffStrategy : public ICDCheckInBackOffStrategy +{ +public: + DefaultICDCheckInBackOffStrategy() = default; + ~DefaultICDCheckInBackOffStrategy() = default; + + /** + * @brief Function checks if the entry is a permanent or ephemeral client. + * If the client is permanent, we should send a Check-In message. + * If the client is ephemeral, we should not send a Check-In message. + * + * @param entry Entry for which we are deciding whether we need to send a Check-In message or not. + * @return true If the client is permanent, return true. + * @return false If the client is not permanent, ephemeral or invalid, return false. + */ + bool ShouldSendCheckInMessage(const ICDMonitoringEntry & entry) override + { + return (entry.clientType == Clusters::IcdManagement::ClientTypeEnum::kPermanent); + } + + /** + * @brief The default Check-In BackOff fundamentally implements a no back off strategy. + * As such, we don't need to execute anything to force the maximum Check-In BackOff. + * + */ + CHIP_ERROR ForceMaximumCheckInBackoff() override { return CHIP_NO_ERROR; } +}; + +} // namespace app +} // namespace chip diff --git a/src/app/icd/server/ICDCheckInBackOffStrategy.h b/src/app/icd/server/ICDCheckInBackOffStrategy.h new file mode 100644 index 00000000000000..e0a5a317cadf5d --- /dev/null +++ b/src/app/icd/server/ICDCheckInBackOffStrategy.h @@ -0,0 +1,62 @@ +/* + * + * 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 +#include + +namespace chip { +namespace app { + +/** + * @brief This class defines the necessary interface a ICD Check-In BackOff strategy needs to implment to be consummed by the + * ICDManager class. The strategy is injected with the init server params when initializing the device Server class. + */ +class ICDCheckInBackOffStrategy +{ +public: + virtual ~ICDCheckInBackOffStrategy() = default; + + /** + * @brief Function is used by the ICDManager to determine if a Check-In message should be sent to the given entry based on the + * Check-In BackOff strategy. + * + * There are no requirements on how the Check-In BackOff strategy should behave. + * The only specified requirement is the maximum time between to Check-In message, MaximumCheckInBackOff. + * All strategies must respect this requirement. + * + * @param entry ICDMonitoringEntry for which we are about to send a Check-In message to. + * + * @return true ICDCheckInBackOffStrategy determines that we SHOULD send a Check-In message to the given entry + * @return false ICDCheckInBackOffStrategy determines that we SHOULD NOT send a Check-In message to the given entry + */ + virtual bool ShouldSendCheckInMessage(const ICDMonitoringEntry & entry) = 0; + + /** + * @brief Function is used within the test event trigger to force the maximum BackOff state of the ICD Check-In BackOff + * strategy. This enables to validate the strategy and to certify it respects the MaximumCheckInBackOff interval during + * certification. + * + * Function sets the maxmimum BackOff state for all clients registered with the ICD + * + * @return CHIP_ERROR Any error returned during the forcing of the maximum BackOff state + */ + virtual CHIP_ERROR ForceMaximumCheckInBackoff() = 0; +}; + +} // namespace app +} // namespace chip diff --git a/src/app/icd/server/ICDConfigurationData.h b/src/app/icd/server/ICDConfigurationData.h index 9358f37fd9ecc6..937b08b99e0e45 100644 --- a/src/app/icd/server/ICDConfigurationData.h +++ b/src/app/icd/server/ICDConfigurationData.h @@ -74,6 +74,8 @@ class ICDConfigurationData System::Clock::Milliseconds16 GetMinLitActiveModeThreshold() { return kMinLitActiveModeThreshold; } + System::Clock::Seconds32 GetMaximumCheckInBackoff() { return mMaximumCheckInBackOff; } + /** * If ICD_ENFORCE_SIT_SLOW_POLL_LIMIT is set to 0, function will always return the configured Slow Polling interval * (CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL). @@ -150,6 +152,12 @@ class ICDConfigurationData "Spec requires the minimum of supported clients per fabric be equal or greater to 1."); uint16_t mFabricClientsSupported = CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC; + static_assert((CHIP_CONFIG_ICD_MAXIMUM_CHECK_IN_BACKOFF_SEC) <= kMaxIdleModeDuration.count(), + "Spec requires the MaximumCheckInBackOff to be equal or inferior to 64800s"); + static_assert((CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC) <= (CHIP_CONFIG_ICD_MAXIMUM_CHECK_IN_BACKOFF_SEC), + "Spec requires the MaximumCheckInBackOff to be equal or superior to the IdleModeDuration"); + System::Clock::Seconds32 mMaximumCheckInBackOff = System::Clock::Seconds32(CHIP_CONFIG_ICD_MAXIMUM_CHECK_IN_BACKOFF_SEC); + // SIT ICDs should have a SlowPollingThreshold shorter than or equal to 15s (spec 9.16.1.5) static constexpr System::Clock::Milliseconds32 kSITPollingThreshold = System::Clock::Milliseconds32(15000); System::Clock::Milliseconds32 mSlowPollingInterval = CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL; diff --git a/src/app/icd/server/ICDManager.cpp b/src/app/icd/server/ICDManager.cpp index ee55b0b0f9b23b..2ba08990aef4b6 100644 --- a/src/app/icd/server/ICDManager.cpp +++ b/src/app/icd/server/ICDManager.cpp @@ -31,10 +31,11 @@ namespace { enum class ICDTestEventTriggerEvent : uint64_t { - kAddActiveModeReq = 0x0046'0000'00000001, - kRemoveActiveModeReq = 0x0046'0000'00000002, - kInvalidateHalfCounterValues = 0x0046'0000'00000003, - kInvalidateAllCounterValues = 0x0046'0000'00000004, + kAddActiveModeReq = 0x0046'0000'00000001, + kRemoveActiveModeReq = 0x0046'0000'00000002, + kInvalidateHalfCounterValues = 0x0046'0000'00000003, + kInvalidateAllCounterValues = 0x0046'0000'00000004, + kForceMaximumCheckInBackOffState = 0x0046'0000'00000005, }; } // namespace @@ -51,15 +52,19 @@ using chip::Protocols::InteractionModel::Status; static_assert(UINT8_MAX >= CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS, "ICDManager::mOpenExchangeContextCount cannot hold count for the max exchange count"); -void ICDManager::Init(PersistentStorageDelegate * storage, FabricTable * fabricTable, Crypto::SymmetricKeystore * symmetricKeystore, - Messaging::ExchangeManager * exchangeManager, SubscriptionsInfoProvider * subInfoProvider) +void ICDManager::Init() { #if CHIP_CONFIG_ENABLE_ICD_CIP - VerifyOrDie(storage != nullptr); - VerifyOrDie(fabricTable != nullptr); - VerifyOrDie(symmetricKeystore != nullptr); - VerifyOrDie(exchangeManager != nullptr); - VerifyOrDie(subInfoProvider != nullptr); + VerifyOrDie(mStorage != nullptr); + VerifyOrDie(mFabricTable != nullptr); + VerifyOrDie(mSymmetricKeystore != nullptr); + VerifyOrDie(mExchangeManager != nullptr); + VerifyOrDie(mSubInfoProvider != nullptr); + VerifyOrDie(mICDCheckInBackOffStrategy != nullptr); + + VerifyOrDie(ICDConfigurationData::GetInstance().GetICDCounter().Init(mStorage, DefaultStorageKeyAllocator::ICDCheckInCounter(), + ICDConfigurationData::kICDCounterPersistenceIncrement) == + CHIP_NO_ERROR); #endif // CHIP_CONFIG_ENABLE_ICD_CIP #if CHIP_CONFIG_ENABLE_ICD_LIT @@ -81,18 +86,6 @@ void ICDManager::Init(PersistentStorageDelegate * storage, FabricTable * fabricT VerifyOrDie(ICDNotifier::GetInstance().Subscribe(this) == CHIP_NO_ERROR); -#if CHIP_CONFIG_ENABLE_ICD_CIP - mStorage = storage; - mFabricTable = fabricTable; - mSymmetricKeystore = symmetricKeystore; - mExchangeManager = exchangeManager; - mSubInfoProvider = subInfoProvider; - - VerifyOrDie(ICDConfigurationData::GetInstance().GetICDCounter().Init(mStorage, DefaultStorageKeyAllocator::ICDCheckInCounter(), - ICDConfigurationData::kICDCounterPersistenceIncrement) == - CHIP_NO_ERROR); -#endif // CHIP_CONFIG_ENABLE_ICD_CIP - UpdateICDMode(); UpdateOperationState(OperationalState::IdleMode); } @@ -188,15 +181,14 @@ void ICDManager::SendCheckInMsgs() continue; } - if (entry.clientType == ClientTypeEnum::kEphemeral) + if (!ShouldCheckInMsgsBeSentAtActiveModeFunction(entry.fabricIndex, entry.monitoredSubject)) { - // If the registered client is ephemeral, do not send a Check-In message - // continue to next entry continue; } - if (!ShouldCheckInMsgsBeSentAtActiveModeFunction(entry.fabricIndex, entry.monitoredSubject)) + if (!mICDCheckInBackOffStrategy->ShouldSendCheckInMessage(entry)) { + // continue to next entry continue; } @@ -689,6 +681,9 @@ CHIP_ERROR ICDManager::HandleEventTrigger(uint64_t eventTrigger) case ICDTestEventTriggerEvent::kInvalidateAllCounterValues: err = ICDConfigurationData::GetInstance().GetICDCounter().InvalidateAllCheckInCounterValues(); break; + case ICDTestEventTriggerEvent::kForceMaximumCheckInBackOffState: + err = mICDCheckInBackOffStrategy->ForceMaximumCheckInBackoff(); + break; #endif // CHIP_CONFIG_ENABLE_ICD_CIP default: err = CHIP_ERROR_INVALID_ARGUMENT; diff --git a/src/app/icd/server/ICDManager.h b/src/app/icd/server/ICDManager.h index 4b996e6dba5258..4ec1dfe65231d3 100644 --- a/src/app/icd/server/ICDManager.h +++ b/src/app/icd/server/ICDManager.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -114,8 +115,52 @@ class ICDManager : public ICDListener, public TestEventTriggerHandler ICDManager() = default; ~ICDManager() = default; - void Init(PersistentStorageDelegate * storage, FabricTable * fabricTable, Crypto::SymmetricKeystore * symmetricKeyStore, - Messaging::ExchangeManager * exchangeManager, SubscriptionsInfoProvider * subInfoProvider); + /* + Builder function to set all necessary members for the ICDManager class + */ + +#if CHIP_CONFIG_ENABLE_ICD_CIP + ICDManager & SetPersistentStorageDelegate(PersistentStorageDelegate * storage) + { + mStorage = storage; + return *this; + }; + + ICDManager & SetFabricTable(FabricTable * fabricTable) + { + mFabricTable = fabricTable; + return *this; + }; + + ICDManager & SetSymmetricKeyStore(Crypto::SymmetricKeystore * symmetricKeystore) + { + mSymmetricKeystore = symmetricKeystore; + return *this; + }; + + ICDManager & SetExchangeManager(Messaging::ExchangeManager * exchangeManager) + { + mExchangeManager = exchangeManager; + return *this; + }; + + ICDManager & SetSubscriptionsInfoProvider(SubscriptionsInfoProvider * subInfoProvider) + { + mSubInfoProvider = subInfoProvider; + return *this; + }; + + ICDManager & SetICDCheckInBackOffStrategy(ICDCheckInBackOffStrategy * strategy) + { + mICDCheckInBackOffStrategy = strategy; + return *this; + }; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + + /** + * @brief Validates that the ICDManager has all the necessary members to function and initializes the class + */ + void Init(); void Shutdown(); /** @@ -318,11 +363,12 @@ class ICDManager : public ICDListener, public TestEventTriggerHandler bool mIsBootUpResumeSubscriptionExecuted = false; #endif // !CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION && CHIP_CONFIG_PERSIST_SUBSCRIPTIONS - PersistentStorageDelegate * mStorage = nullptr; - FabricTable * mFabricTable = nullptr; - Messaging::ExchangeManager * mExchangeManager = nullptr; - Crypto::SymmetricKeystore * mSymmetricKeystore = nullptr; - SubscriptionsInfoProvider * mSubInfoProvider = nullptr; + PersistentStorageDelegate * mStorage = nullptr; + FabricTable * mFabricTable = nullptr; + Messaging::ExchangeManager * mExchangeManager = nullptr; + Crypto::SymmetricKeystore * mSymmetricKeystore = nullptr; + SubscriptionsInfoProvider * mSubInfoProvider = nullptr; + ICDCheckInBackOffStrategy * mICDCheckInBackOffStrategy = nullptr; ObjectPool mICDSenderPool; #endif // CHIP_CONFIG_ENABLE_ICD_CIP diff --git a/src/app/icd/server/tests/BUILD.gn b/src/app/icd/server/tests/BUILD.gn index e96954a97dde58..9b08c9e17893ca 100644 --- a/src/app/icd/server/tests/BUILD.gn +++ b/src/app/icd/server/tests/BUILD.gn @@ -22,6 +22,7 @@ chip_test_suite("tests") { output_name = "libICDServerTests" test_sources = [ + "TestDefaultICDCheckInBackOffStrategy.cpp", "TestICDManager.cpp", "TestICDMonitoringTable.cpp", ] @@ -29,8 +30,10 @@ chip_test_suite("tests") { sources = [ "ICDConfigurationDataTestAccess.h" ] public_deps = [ + "${chip_root}/src/app/icd/server:default-check-in-back-off", "${chip_root}/src/app/icd/server:manager", "${chip_root}/src/app/icd/server:monitoring-table", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/support:test_utils", "${chip_root}/src/lib/support:testing", "${chip_root}/src/messaging/tests:helpers", diff --git a/src/app/icd/server/tests/TestDefaultICDCheckInBackOffStrategy.cpp b/src/app/icd/server/tests/TestDefaultICDCheckInBackOffStrategy.cpp new file mode 100644 index 00000000000000..b873379826d468 --- /dev/null +++ b/src/app/icd/server/tests/TestDefaultICDCheckInBackOffStrategy.cpp @@ -0,0 +1,57 @@ +/* + * + * 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 + +#include +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters::IcdManagement; + +using TestSessionKeystoreImpl = Crypto::DefaultSessionKeystore; + +namespace { + +TEST(TestDefaultICDCheckInBackOffStrategy, TestShouldSendCheckInMessagePermanentClient) +{ + TestSessionKeystoreImpl keystore; + ICDMonitoringEntry entry(&keystore); + + entry.clientType = ClientTypeEnum::kPermanent; + + DefaultICDCheckInBackOffStrategy strategy; + EXPECT_TRUE(strategy.ShouldSendCheckInMessage(entry)); +} + +TEST(TestDefaultICDCheckInBackOffStrategy, TestShouldSendCheckInMessageEphemeralClient) +{ + TestSessionKeystoreImpl keystore; + ICDMonitoringEntry entry(&keystore); + + entry.clientType = ClientTypeEnum::kEphemeral; + + DefaultICDCheckInBackOffStrategy strategy; + EXPECT_FALSE(strategy.ShouldSendCheckInMessage(entry)); +} + +} // namespace diff --git a/src/app/icd/server/tests/TestICDManager.cpp b/src/app/icd/server/tests/TestICDManager.cpp index 0b3c1a459441dd..df5c2e4970c579 100644 --- a/src/app/icd/server/tests/TestICDManager.cpp +++ b/src/app/icd/server/tests/TestICDManager.cpp @@ -15,8 +15,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include + #include #include +#include #include #include #include @@ -24,10 +28,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -124,18 +128,16 @@ class TestSubscriptionsInfoProvider : public SubscriptionsInfoProvider bool mHasPersistedSubscription = false; }; -System::Clock::Internal::MockClock * pMockClock = nullptr; -System::Clock::ClockBase * pRealClock = nullptr; -chip::Test::LoopbackMessagingContext * pMessagingContext = nullptr; +System::Clock::Internal::MockClock * pMockClock = nullptr; +System::Clock::ClockBase * pRealClock = nullptr; } // namespace namespace chip { namespace app { -class TestICDManager : public ::testing::Test +class TestICDManager : public Test::LoopbackMessagingContext { - public: /* * Advance the test Mock clock time by the amout passed in argument @@ -147,7 +149,7 @@ class TestICDManager : public ::testing::Test static void AdvanceClockAndRunEventLoop(Milliseconds64 time) { pMockClock->AdvanceMonotonic(time); - pMessagingContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); } // Performs shared setup for all tests in the test suite @@ -159,16 +161,12 @@ class TestICDManager : public ::testing::Test ASSERT_NE(pMockClock, nullptr); } - if (pMessagingContext == nullptr) - { - pMessagingContext = new LoopbackMessagingContext(); - ASSERT_NE(pMessagingContext, nullptr); - } + LoopbackMessagingContext::SetUpTestSuite(); + VerifyOrReturn(!HasFailure()); - pMessagingContext->SetUpTestSuite(); ASSERT_EQ(chip::DeviceLayer::PlatformMgr().InitChipStack(), CHIP_NO_ERROR); - DeviceLayer::SetSystemLayerForTesting(&(pMessagingContext->GetSystemLayer())); + DeviceLayer::SetSystemLayerForTesting(&GetSystemLayer()); pRealClock = &SystemClock(); Clock::Internal::SetSystemClockForTesting(pMockClock); } @@ -180,7 +178,8 @@ class TestICDManager : public ::testing::Test DeviceLayer::SetSystemLayerForTesting(nullptr); DeviceLayer::PlatformMgr().Shutdown(); - pMessagingContext->TearDownTestSuite(); + + LoopbackMessagingContext::TearDownTestSuite(); if (pMockClock != nullptr) { @@ -188,31 +187,34 @@ class TestICDManager : public ::testing::Test pMockClock = nullptr; } - if (pMessagingContext != nullptr) - { - delete pMessagingContext; - pMessagingContext = nullptr; - } - pRealClock = nullptr; } // Performs setup for each individual test in the test suite void SetUp() override { - pMessagingContext->SetUp(); + LoopbackMessagingContext::SetUp(); + VerifyOrReturn(!HasFailure()); mICDStateObserver.ResetAll(); mICDManager.RegisterObserver(&mICDStateObserver); - mICDManager.Init(&testStorage, &(pMessagingContext->GetFabricTable()), &mKeystore, - &(pMessagingContext->GetExchangeManager()), &mSubInfoProvider); + +#if CHIP_CONFIG_ENABLE_ICD_CIP + mICDManager.SetPersistentStorageDelegate(&testStorage) + .SetFabricTable(&GetFabricTable()) + .SetSymmetricKeyStore(&mKeystore) + .SetExchangeManager(&GetExchangeManager()) + .SetSubscriptionsInfoProvider(&mSubInfoProvider) + .SetICDCheckInBackOffStrategy(&mStrategy); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + mICDManager.Init(); } // Performs teardown for each individual test in the test suite void TearDown() override { mICDManager.Shutdown(); - pMessagingContext->TearDown(); + LoopbackMessagingContext::TearDown(); } TestSessionKeystoreImpl mKeystore; @@ -220,6 +222,7 @@ class TestICDManager : public ::testing::Test TestSubscriptionsInfoProvider mSubInfoProvider; TestPersistentStorageDelegate testStorage; TestICDStateObserver mICDStateObserver; + DefaultICDCheckInBackOffStrategy mStrategy; }; TEST_F(TestICDManager, TestICDModeDurations) @@ -576,8 +579,16 @@ TEST_F(TestICDManager, TestICDCounter) // Shut down and reinit ICDManager to increment counter mICDManager.Shutdown(); - mICDManager.Init(&(testStorage), &(pMessagingContext->GetFabricTable()), &(mKeystore), - &(pMessagingContext->GetExchangeManager()), &(mSubInfoProvider)); +#if CHIP_CONFIG_ENABLE_ICD_CIP + mICDManager.SetPersistentStorageDelegate(&testStorage) + .SetFabricTable(&GetFabricTable()) + .SetSymmetricKeyStore(&mKeystore) + .SetExchangeManager(&GetExchangeManager()) + .SetSubscriptionsInfoProvider(&mSubInfoProvider) + .SetICDCheckInBackOffStrategy(&mStrategy); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + mICDManager.Init(); + mICDManager.RegisterObserver(&(mICDStateObserver)); EXPECT_EQ(counter + ICDConfigurationData::kICDCounterPersistenceIncrement, @@ -982,8 +993,15 @@ TEST_F(TestICDManager, TestICDStateObserverOnICDModeChangeOnInit) // Shut down and reinit ICDManager - We should go to LIT mode since we have a registration mICDManager.Shutdown(); mICDManager.RegisterObserver(&(mICDStateObserver)); - mICDManager.Init(&testStorage, &(pMessagingContext->GetFabricTable()), &mKeystore, &(pMessagingContext->GetExchangeManager()), - &mSubInfoProvider); +#if CHIP_CONFIG_ENABLE_ICD_CIP + mICDManager.SetPersistentStorageDelegate(&testStorage) + .SetFabricTable(&GetFabricTable()) + .SetSymmetricKeyStore(&mKeystore) + .SetExchangeManager(&GetExchangeManager()) + .SetSubscriptionsInfoProvider(&mSubInfoProvider) + .SetICDCheckInBackOffStrategy(&mStrategy); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + mICDManager.Init(); // We have a registration, transition to LIT mode EXPECT_TRUE(mICDStateObserver.mOnICDModeChangeCalled); diff --git a/src/app/icd/server/tests/TestICDMonitoringTable.cpp b/src/app/icd/server/tests/TestICDMonitoringTable.cpp index 423bc1506b36fb..177f8caba507e1 100644 --- a/src/app/icd/server/tests/TestICDMonitoringTable.cpp +++ b/src/app/icd/server/tests/TestICDMonitoringTable.cpp @@ -15,12 +15,14 @@ * limitations under the License. */ +#include + #include #include #include -#include #include #include +#include #include #include diff --git a/src/app/reporting/Engine.cpp b/src/app/reporting/Engine.cpp index dfa64cf3b8f9de..50e23498aeeadb 100644 --- a/src/app/reporting/Engine.cpp +++ b/src/app/reporting/Engine.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -79,25 +80,6 @@ bool Engine::IsClusterDataVersionMatch(const SingleLinkedListNode Cluster %" PRIx32 ", Attribute %" PRIx32 " is dirty", aPath.mClusterId, - aPath.mAttributeId); - - DataModelCallbacks::GetInstance()->AttributeOperation(DataModelCallbacks::OperationType::Read, - DataModelCallbacks::OperationOrder::Pre, aPath); - - ReturnErrorOnFailure(ReadSingleClusterData(aSubjectDescriptor, aIsFabricFiltered, aPath, aAttributeReportIBs, aEncoderState)); - - DataModelCallbacks::GetInstance()->AttributeOperation(DataModelCallbacks::OperationType::Read, - DataModelCallbacks::OperationOrder::Post, aPath); - - return CHIP_NO_ERROR; -} - static bool IsOutOfWriterSpaceError(CHIP_ERROR err) { return err == CHIP_ERROR_NO_MEMORY || err == CHIP_ERROR_BUFFER_TOO_SMALL; @@ -200,8 +182,8 @@ CHIP_ERROR Engine::BuildSingleReportDataAttributeReportIBs(ReportDataMessage::Bu ConcreteReadAttributePath pathForRetrieval(readPath); // Load the saved state from previous encoding session for chunking of one single attribute (list chunking). AttributeEncodeState encodeState = apReadHandler->GetAttributeEncodeState(); - err = RetrieveClusterData(apReadHandler->GetSubjectDescriptor(), apReadHandler->IsFabricFiltered(), attributeReportIBs, - pathForRetrieval, &encodeState); + err = Impl::RetrieveClusterData(mpImEngine->GetDataModel(), apReadHandler->GetSubjectDescriptor(), + apReadHandler->IsFabricFiltered(), attributeReportIBs, pathForRetrieval, &encodeState); if (err != CHIP_NO_ERROR) { // If error is not an "out of writer space" error, rollback and encode status. diff --git a/src/app/reporting/Engine.h b/src/app/reporting/Engine.h index 0bf7a9f83de1ae..070db9947b5f1c 100644 --- a/src/app/reporting/Engine.h +++ b/src/app/reporting/Engine.h @@ -168,9 +168,6 @@ class Engine bool * apHasMoreChunks, bool * apHasEncodedData); CHIP_ERROR BuildSingleReportDataEventReports(ReportDataMessage::Builder & reportDataBuilder, ReadHandler * apReadHandler, bool aBufferIsUsed, bool * apHasMoreChunks, bool * apHasEncodedData); - CHIP_ERROR RetrieveClusterData(const Access::SubjectDescriptor & aSubjectDescriptor, bool aIsFabricFiltered, - AttributeReportIBs::Builder & aAttributeReportIBs, - const ConcreteReadAttributePath & aClusterInfo, AttributeEncodeState * apEncoderState); CHIP_ERROR CheckAccessDeniedEventPaths(TLV::TLVWriter & aWriter, bool & aHasEncodedData, ReadHandler * apReadHandler); // If version match, it means don't send, if version mismatch, it means send. diff --git a/src/app/reporting/Read-Checked.cpp b/src/app/reporting/Read-Checked.cpp new file mode 100644 index 00000000000000..76a6d1378eb653 --- /dev/null +++ b/src/app/reporting/Read-Checked.cpp @@ -0,0 +1,160 @@ +/* + * 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 + +namespace chip { +namespace app { +namespace reporting { +namespace CheckedImpl { +namespace { + +/// Checkpoints and saves the state (including error state) for a +/// AttributeReportIBs::Builder +class ScopedAttributeReportIBsBuilderState +{ +public: + ScopedAttributeReportIBsBuilderState(AttributeReportIBs::Builder & builder) : mBuilder(builder), mError(mBuilder.GetError()) + { + mBuilder.Checkpoint(mCheckpoint); + } + + ~ScopedAttributeReportIBsBuilderState() + { + mBuilder.Rollback(mCheckpoint); + mBuilder.ResetError(mError); + } + +private: + AttributeReportIBs::Builder & mBuilder; + chip::TLV::TLVWriter mCheckpoint; + CHIP_ERROR mError; +}; + +} // namespace + +CHIP_ERROR RetrieveClusterData(InteractionModel::DataModel * dataModel, const Access::SubjectDescriptor & subjectDescriptor, + bool isFabricFiltered, AttributeReportIBs::Builder & reportBuilder, + const ConcreteReadAttributePath & path, AttributeEncodeState * encoderState) +{ + ChipLogDetail(DataManagement, " Cluster %" PRIx32 ", Attribute %" PRIx32 " is dirty", path.mClusterId, + path.mAttributeId); + DataModelCallbacks::GetInstance()->AttributeOperation(DataModelCallbacks::OperationType::Read, + DataModelCallbacks::OperationOrder::Pre, path); + + CHIP_ERROR errEmber = CHIP_NO_ERROR; + uint32_t lengthWrittenEmber = 0; + + // a copy for DM logic only. Ember changes state directly + // IMPORTANT: the copy MUST be taken BEFORE ember processes/changes encoderState inline. + AttributeEncodeState stateDm(encoderState); + + { + ScopedAttributeReportIBsBuilderState builderState(reportBuilder); // temporary only + errEmber = + EmberImpl::RetrieveClusterData(dataModel, subjectDescriptor, isFabricFiltered, reportBuilder, path, encoderState); + lengthWrittenEmber = reportBuilder.GetWriter()->GetLengthWritten(); + } + + CHIP_ERROR errDM = DataModelImpl::RetrieveClusterData(dataModel, subjectDescriptor, isFabricFiltered, reportBuilder, path, + encoderState != nullptr ? &stateDm : nullptr); + + if (errEmber != errDM) + { + // Note log + chipDie instead of VerifyOrDie so that breakpoints (and usage of rr) + // is easier to debug. + ChipLogError(Test, "Different return codes between ember and DM"); + ChipLogError(Test, " Ember error: %" CHIP_ERROR_FORMAT, errEmber.Format()); + ChipLogError(Test, " DM error: %" CHIP_ERROR_FORMAT, errDM.Format()); + + // For time-dependent data, we may have size differences here: one data fitting in buffer + // while another not, resulting in different errors (success vs out of space). + // + // Make unit tests strict; otherwise allow it with potentially odd mismatch errors + // (in which case logs will be odd, however we also expect Checked versions to only + // run for a short period until we switch over to either ember or DM completely). +#if CONFIG_BUILD_FOR_HOST_UNIT_TEST + chipDie(); +#endif + } + + // data should be identical for most cases EXCEPT that for time-deltas (e.g. seconds since boot or similar) + // it may actually differ. As a result, the amount of data written in bytes MUST be the same, however if the rest of the + // data is not the same, we just print it out as a warning for manual inspection + // + // We have no direct access to TLV buffer data (especially given backing store splits) + // so for now we check that data length was identical. + // + // NOTE: RetrieveClusterData is responsible for encoding StatusIB errors in case of failures + // so we validate length written requirements for BOTH success and failure. + // + // NOTE: data length is NOT reliable if the data content differs in encoding length. E.g. numbers changing + // from 0xFF to 0x100 or similar will use up more space. + // For unit tests we make the validation strict, however for runtime we just report an + // error for different sizes. + if (lengthWrittenEmber != reportBuilder.GetWriter()->GetLengthWritten()) + { + ChipLogError(Test, "Different written length: %" PRIu32 " (Ember) vs %" PRIu32 " (DataModel)", lengthWrittenEmber, + reportBuilder.GetWriter()->GetLengthWritten()); +#if CONFIG_BUILD_FOR_HOST_UNIT_TEST + chipDie(); +#endif + } + + // For chunked reads, the encoder state MUST be identical (since this is what controls + // where chunking resumes). + if ((errEmber == CHIP_ERROR_NO_MEMORY) || (errEmber == CHIP_ERROR_BUFFER_TOO_SMALL)) + { + // Encoder state MUST match on partial reads (used by chunking) + // specifically ReadViaAccessInterface in ember-compatibility-functions only + // sets the encoder state in case an error occurs. + if (encoderState != nullptr) + { + if (encoderState->AllowPartialData() != stateDm.AllowPartialData()) + { + ChipLogError(Test, "Different partial data"); + // NOTE: die on unit tests only, since partial data size may differ across + // time-dependent data (very rarely because fast code, but still possible) +#if CONFIG_BUILD_FOR_HOST_UNIT_TEST + chipDie(); +#endif + } + if (encoderState->CurrentEncodingListIndex() != stateDm.CurrentEncodingListIndex()) + { + ChipLogError(Test, "Different partial data"); + // NOTE: die on unit tests only, since partial data size may differ across + // time-dependent data (very rarely because fast code, but still possible) +#if CONFIG_BUILD_FOR_HOST_UNIT_TEST + chipDie(); +#endif + } + } + } + + DataModelCallbacks::GetInstance()->AttributeOperation(DataModelCallbacks::OperationType::Read, + DataModelCallbacks::OperationOrder::Post, path); + + return errDM; +} + +} // namespace CheckedImpl +} // namespace reporting +} // namespace app +} // namespace chip diff --git a/src/app/reporting/Read-Checked.h b/src/app/reporting/Read-Checked.h new file mode 100644 index 00000000000000..6df9715fcc3da9 --- /dev/null +++ b/src/app/reporting/Read-Checked.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 +#include +#include +#include + +namespace chip { +namespace app { +namespace reporting { +namespace CheckedImpl { + +CHIP_ERROR RetrieveClusterData(InteractionModel::DataModel * dataModel, const Access::SubjectDescriptor & subjectDescriptor, + bool isFabricFiltered, AttributeReportIBs::Builder & reportBuilder, + const ConcreteReadAttributePath & path, AttributeEncodeState * encoderState); + +} // namespace CheckedImpl +} // namespace reporting +} // namespace app +} // namespace chip diff --git a/src/app/reporting/Read-DataModel.cpp b/src/app/reporting/Read-DataModel.cpp new file mode 100644 index 00000000000000..c004853cdaa495 --- /dev/null +++ b/src/app/reporting/Read-DataModel.cpp @@ -0,0 +1,110 @@ +/* + * 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 + +namespace chip { +namespace app { +namespace reporting { +namespace DataModelImpl { +namespace { + +bool IsOutOfSpaceError(CHIP_ERROR err) +{ + return (err == CHIP_ERROR_NO_MEMORY || err == CHIP_ERROR_BUFFER_TOO_SMALL); +} + +} // namespace + +CHIP_ERROR RetrieveClusterData(InteractionModel::DataModel * dataModel, const Access::SubjectDescriptor & subjectDescriptor, + bool isFabricFiltered, AttributeReportIBs::Builder & reportBuilder, + const ConcreteReadAttributePath & path, AttributeEncodeState * encoderState) +{ + // Odd ifdef is to only do this if the `Read-Check` does not do it already. +#if !CHIP_CONFIG_USE_EMBER_DATA_MODEL + ChipLogDetail(DataManagement, " Cluster %" PRIx32 ", Attribute %" PRIx32 " is dirty", path.mClusterId, + path.mAttributeId); + DataModelCallbacks::GetInstance()->AttributeOperation(DataModelCallbacks::OperationType::Read, + DataModelCallbacks::OperationOrder::Pre, path); +#endif // !CHIP_CONFIG_USE_EMBER_DATA_MODEL + + InteractionModel::ReadAttributeRequest readRequest; + + if (isFabricFiltered) + { + readRequest.readFlags.Set(InteractionModel::ReadFlags::kFabricFiltered); + } + readRequest.subjectDescriptor = subjectDescriptor; + readRequest.path = path; + + DataVersion version = 0; + if (std::optional clusterInfo = dataModel->GetClusterInfo(path); clusterInfo.has_value()) + { + version = clusterInfo->dataVersion; + } + else + { + ChipLogError(DataManagement, "Read request on unknown cluster - no data version available"); + } + + TLV::TLVWriter checkpoint; + reportBuilder.Checkpoint(checkpoint); + + AttributeValueEncoder attributeValueEncoder(reportBuilder, subjectDescriptor, path, version, isFabricFiltered, encoderState); + CHIP_ERROR err = dataModel->ReadAttribute(readRequest, attributeValueEncoder); + + if (err == CHIP_NO_ERROR) + { + // Odd ifdef is to only do this if the `Read-Check` does not do it already. +#if !CHIP_CONFIG_USE_EMBER_DATA_MODEL + // TODO: this callback being only executed on success is awkward. The Write callback is always done + // for both read and write. + // + // For now this preserves existing/previous code logic, however we should consider to ALWAYS + // call this. + DataModelCallbacks::GetInstance()->AttributeOperation(DataModelCallbacks::OperationType::Read, + DataModelCallbacks::OperationOrder::Post, path); +#endif // !CHIP_CONFIG_USE_EMBER_DATA_MODEL + return CHIP_NO_ERROR; + } + + // Encoder state is relevant for errors in case they are retryable. + // + // Generally only IsOutOfSpaceError(err) would be retryable, however we save the state + // for all errors in case this is information that is useful (retry or error position). + if (encoderState != nullptr) + { + *encoderState = attributeValueEncoder.GetState(); + } + + // Out of space errors may be chunked data, reporting those cases would be very confusing + // as they are not fully errors. Report only others (which presumably are not recoverable + // and will be sent to the client as well). + if (!IsOutOfSpaceError(err)) + { + ChipLogError(DataManagement, "Failed to read attribute: %" CHIP_ERROR_FORMAT, err.Format()); + } + return err; +} + +} // namespace DataModelImpl +} // namespace reporting +} // namespace app +} // namespace chip diff --git a/src/app/reporting/Read-DataModel.h b/src/app/reporting/Read-DataModel.h new file mode 100644 index 00000000000000..231429c4a2e242 --- /dev/null +++ b/src/app/reporting/Read-DataModel.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 +#include +#include +#include + +namespace chip { +namespace app { +namespace reporting { +namespace DataModelImpl { + +CHIP_ERROR RetrieveClusterData(InteractionModel::DataModel * dataModel, const Access::SubjectDescriptor & subjectDescriptor, + bool isFabricFiltered, AttributeReportIBs::Builder & reportBuilder, + const ConcreteReadAttributePath & path, AttributeEncodeState * encoderState); + +} // namespace DataModelImpl +} // namespace reporting +} // namespace app +} // namespace chip diff --git a/src/app/reporting/Read-Ember.cpp b/src/app/reporting/Read-Ember.cpp new file mode 100644 index 00000000000000..290c4e627ac7bb --- /dev/null +++ b/src/app/reporting/Read-Ember.cpp @@ -0,0 +1,55 @@ +/* + * 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 + +namespace chip { +namespace app { +namespace reporting { +namespace EmberImpl { + +CHIP_ERROR RetrieveClusterData(InteractionModel::DataModel * dataModel, const Access::SubjectDescriptor & subjectDescriptor, + bool isFabricFiltered, AttributeReportIBs::Builder & reportBuilder, + const ConcreteReadAttributePath & path, AttributeEncodeState * encoderState) +{ + // Odd ifdef is to only do this if the `Read-Check` does not do it already. +#if !CHIP_CONFIG_USE_DATA_MODEL_INTERFACE + ChipLogDetail(DataManagement, " Cluster %" PRIx32 ", Attribute %" PRIx32 " is dirty", path.mClusterId, + path.mAttributeId); + + DataModelCallbacks::GetInstance()->AttributeOperation(DataModelCallbacks::OperationType::Read, + DataModelCallbacks::OperationOrder::Pre, path); +#endif // !CHIP_CONFIG_USE_DATA_MODEL_INTERFACE + + ReturnErrorOnFailure(ReadSingleClusterData(subjectDescriptor, isFabricFiltered, path, reportBuilder, encoderState)); + + // Odd ifdef is to only do this if the `Read-Check` does not do it already. +#if !CHIP_CONFIG_USE_DATA_MODEL_INTERFACE + DataModelCallbacks::GetInstance()->AttributeOperation(DataModelCallbacks::OperationType::Read, + DataModelCallbacks::OperationOrder::Post, path); +#endif // !CHIP_CONFIG_USE_DATA_MODEL_INTERFACE + + return CHIP_NO_ERROR; +} + +} // namespace EmberImpl +} // namespace reporting +} // namespace app +} // namespace chip diff --git a/src/app/reporting/Read-Ember.h b/src/app/reporting/Read-Ember.h new file mode 100644 index 00000000000000..0181734d205053 --- /dev/null +++ b/src/app/reporting/Read-Ember.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 +#include +#include +#include + +namespace chip { +namespace app { +namespace reporting { +namespace EmberImpl { + +CHIP_ERROR RetrieveClusterData(InteractionModel::DataModel * dataModel, const Access::SubjectDescriptor & subjectDescriptor, + bool isFabricFiltered, AttributeReportIBs::Builder & reportBuilder, + const ConcreteReadAttributePath & path, AttributeEncodeState * encoderState); + +} // namespace EmberImpl +} // namespace reporting +} // namespace app +} // namespace chip diff --git a/src/app/reporting/Read.h b/src/app/reporting/Read.h new file mode 100644 index 00000000000000..c568c5356ab472 --- /dev/null +++ b/src/app/reporting/Read.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include + +#if CHIP_CONFIG_USE_EMBER_DATA_MODEL && CHIP_CONFIG_USE_DATA_MODEL_INTERFACE +#include +#else +#if CHIP_CONFIG_USE_DATA_MODEL_INTERFACE +#include +#else +#include +#endif // CHIP_CONFIG_USE_DATA_MODEL_INTERFACE +#endif // CHIP_CONFIG_USE_EMBER_DATA_MODEL && CHIP_CONFIG_USE_DATA_MODEL_INTERFACE + +namespace chip { +namespace app { +namespace reporting { + +#if CHIP_CONFIG_USE_EMBER_DATA_MODEL && CHIP_CONFIG_USE_DATA_MODEL_INTERFACE +namespace Impl = CheckedImpl; +#else +#if CHIP_CONFIG_USE_DATA_MODEL_INTERFACE +namespace Impl = DataModelImpl; +#else +namespace Impl = EmberImpl; +#endif // CHIP_CONFIG_USE_DATA_MODEL_INTERFACE +#endif // CHIP_CONFIG_USE_EMBER_DATA_MODEL && CHIP_CONFIG_USE_DATA_MODEL_INTERFACE + +} // namespace reporting +} // namespace app +} // namespace chip diff --git a/src/app/server/BUILD.gn b/src/app/server/BUILD.gn index 51a259c86d2552..401356d7b753a4 100644 --- a/src/app/server/BUILD.gn +++ b/src/app/server/BUILD.gn @@ -53,6 +53,7 @@ static_library("server") { public_deps = [ "${chip_root}/src/app", "${chip_root}/src/app:test-event-trigger", + "${chip_root}/src/app/icd/server:check-in-back-off", "${chip_root}/src/app/icd/server:icd-server-config", "${chip_root}/src/app/icd/server:observer", "${chip_root}/src/lib/address_resolve", @@ -72,5 +73,10 @@ static_library("server") { if (chip_enable_icd_server) { public_deps += [ "${chip_root}/src/app/icd/server:notifier" ] + + if (chip_enable_icd_checkin) { + public_deps += + [ "${chip_root}/src/app/icd/server:default-check-in-back-off" ] + } } } diff --git a/src/app/server/CommissioningWindowManager.cpp b/src/app/server/CommissioningWindowManager.cpp index 229fd67c5bb24b..47bc3e8ff97f07 100644 --- a/src/app/server/CommissioningWindowManager.cpp +++ b/src/app/server/CommissioningWindowManager.cpp @@ -71,6 +71,12 @@ void CommissioningWindowManager::OnPlatformEvent(const DeviceLayer::ChipDeviceEv #if CONFIG_NETWORK_LAYER_BLE && CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION // If in NonConcurrentConnection, this will already have been completed mServer->GetBleLayerObject()->CloseAllBleConnections(); +#endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + DeviceLayer::ConnectivityManager::WiFiPAFAdvertiseParam args; + args.enable = false; + args.ExtCmds = nullptr; + DeviceLayer::ConnectivityMgr().SetWiFiPAFAdvertisingEnabled(args); #endif } else if (event->Type == DeviceLayer::DeviceEventType::kFailSafeTimerExpired) diff --git a/src/app/server/Dnssd.cpp b/src/app/server/Dnssd.cpp index 3cdcd35f9a7e98..d3de7044bbda8b 100644 --- a/src/app/server/Dnssd.cpp +++ b/src/app/server/Dnssd.cpp @@ -188,7 +188,7 @@ void DnssdServer::GetPrimaryOrFallbackMACAddress(chip::MutableByteSpan mac) /// Set MDNS operational advertisement CHIP_ERROR DnssdServer::AdvertiseOperational() { - VerifyOrDie(mFabricTable != nullptr); + VerifyOrReturnError(mFabricTable != nullptr, CHIP_ERROR_INCORRECT_STATE); for (const FabricInfo & fabricInfo : *mFabricTable) { @@ -213,6 +213,9 @@ CHIP_ERROR DnssdServer::AdvertiseOperational() AddICDKeyToAdvertisement(advertiseParameters); #endif +#if INET_CONFIG_ENABLE_TCP_ENDPOINT + advertiseParameters.SetTCPSupportModes(chip::Dnssd::TCPModeAdvertise::kTCPClientServer); +#endif auto & mdnsAdvertiser = chip::Dnssd::ServiceAdvertiser::Instance(); ChipLogProgress(Discovery, "Advertise operational node " ChipLogFormatX64 "-" ChipLogFormatX64, diff --git a/src/app/server/Dnssd.h b/src/app/server/Dnssd.h index 105318ca5a08be..3103a2010c03f6 100644 --- a/src/app/server/Dnssd.h +++ b/src/app/server/Dnssd.h @@ -96,6 +96,7 @@ class DLL_EXPORT DnssdServer : public ICDStateObserver void SetICDManager(ICDManager * manager) { mICDManager = manager; }; #endif + /// Start operational advertising CHIP_ERROR AdvertiseOperational(); diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index a71d797651b418..22cd274ba87e39 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -56,6 +56,10 @@ #include #include +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +#include +#endif + #if defined(CHIP_SUPPORT_ENABLE_STORAGE_API_AUDIT) || defined(CHIP_SUPPORT_ENABLE_STORAGE_LOAD_TEST_AUDIT) #include #endif // defined(CHIP_SUPPORT_ENABLE_STORAGE_API_AUDIT) || defined(CHIP_SUPPORT_ENABLE_STORAGE_LOAD_TEST_AUDIT) @@ -182,6 +186,10 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) mReportScheduler = initParams.reportScheduler; mTestEventTriggerDelegate = initParams.testEventTriggerDelegate; + if (mTestEventTriggerDelegate == nullptr) + { + ChipLogProgress(AppServer, "WARNING: mTestEventTriggerDelegate is null"); + } deviceInfoprovider = DeviceLayer::GetDeviceInfoProvider(); if (deviceInfoprovider) @@ -210,6 +218,10 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) TcpListenParameters(DeviceLayer::TCPEndPointManager()) .SetAddressType(IPAddressType::kIPv6) .SetListenPort(mOperationalServicePort) +#endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + , + Transport::WiFiPAFListenParameters(DeviceLayer::ConnectivityMgr().GetWiFiPAF()) #endif ); @@ -355,11 +367,22 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) mICDManager.RegisterObserver(mReportScheduler); mICDManager.RegisterObserver(&app::DnssdServer::Instance()); - mICDManager.Init(mDeviceStorage, &GetFabricTable(), mSessionKeystore, &mExchangeMgr, - chip::app::InteractionModelEngine::GetInstance()); +#if CHIP_CONFIG_ENABLE_ICD_CIP + mICDManager.SetPersistentStorageDelegate(mDeviceStorage) + .SetFabricTable(&GetFabricTable()) + .SetSymmetricKeyStore(mSessionKeystore) + .SetExchangeManager(&mExchangeMgr) + .SetSubscriptionsInfoProvider(chip::app::InteractionModelEngine::GetInstance()) + .SetICDCheckInBackOffStrategy(initParams.icdCheckInBackOffStrategy); + +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + mICDManager.Init(); // Register Test Event Trigger Handler - mTestEventTriggerDelegate->AddHandler(&mICDManager); + if (mTestEventTriggerDelegate != nullptr) + { + mTestEventTriggerDelegate->AddHandler(&mICDManager); + } #endif // CHIP_CONFIG_ENABLE_ICD_SERVER @@ -612,7 +635,10 @@ void Server::Shutdown() Credentials::SetGroupDataProvider(nullptr); #if CHIP_CONFIG_ENABLE_ICD_SERVER // Remove Test Event Trigger Handler - mTestEventTriggerDelegate->RemoveHandler(&mICDManager); + if (mTestEventTriggerDelegate != nullptr) + { + mTestEventTriggerDelegate->RemoveHandler(&mICDManager); + } mICDManager.Shutdown(); #endif // CHIP_CONFIG_ENABLE_ICD_SERVER mAttributePersister.Shutdown(); @@ -759,5 +785,8 @@ app::SimpleSubscriptionResumptionStorage CommonCaseDeviceServerInitParams::sSubs #endif app::DefaultAclStorage CommonCaseDeviceServerInitParams::sAclStorage; Crypto::DefaultSessionKeystore CommonCaseDeviceServerInitParams::sSessionKeystore; +#if CHIP_CONFIG_ENABLE_ICD_CIP +app::DefaultICDCheckInBackOffStrategy CommonCaseDeviceServerInitParams::sDefaultICDCheckInBackOffStrategy; +#endif } // namespace chip diff --git a/src/app/server/Server.h b/src/app/server/Server.h index d649e0fc923896..2f6126a4ace635 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -65,12 +65,20 @@ #if CONFIG_NETWORK_LAYER_BLE #include #endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +#include +#endif #include #include #include +#include #if CHIP_CONFIG_ENABLE_ICD_SERVER #include // nogncheck + +#if CHIP_CONFIG_ENABLE_ICD_CIP +#include // nogncheck +#endif #endif namespace chip { @@ -99,6 +107,10 @@ using ServerTransportMgr = chip::TransportMgr +#endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + , + chip::Transport::WiFiPAFBase #endif >; @@ -164,6 +176,9 @@ struct ServerInitParams Credentials::OperationalCertificateStore * opCertStore = nullptr; // Required, if not provided, the Server::Init() WILL fail. app::reporting::ReportScheduler * reportScheduler = nullptr; + // Optional. Support for the ICD Check-In BackOff strategy. Must be initialized before being provided. + // If the ICD Check-In protocol use-case is supported and no strategy is provided, server will use the default strategy. + app::ICDCheckInBackOffStrategy * icdCheckInBackOffStrategy = nullptr; }; /** @@ -278,6 +293,13 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams ChipLogProgress(AppServer, "Subscription persistence not supported"); #endif +#if CHIP_CONFIG_ENABLE_ICD_CIP + if (this->icdCheckInBackOffStrategy == nullptr) + { + this->icdCheckInBackOffStrategy = &sDefaultICDCheckInBackOffStrategy; + } +#endif + return CHIP_NO_ERROR; } @@ -297,6 +319,9 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams #endif static app::DefaultAclStorage sAclStorage; static Crypto::DefaultSessionKeystore sSessionKeystore; +#if CHIP_CONFIG_ENABLE_ICD_CIP + static app::DefaultICDCheckInBackOffStrategy sDefaultICDCheckInBackOffStrategy; +#endif }; /** diff --git a/src/app/tests/AppTestContext.cpp b/src/app/tests/AppTestContext.cpp index ff1154dafbb306..ecf4aff9bf7c40 100644 --- a/src/app/tests/AppTestContext.cpp +++ b/src/app/tests/AppTestContext.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include +#include "AppTestContext.h" #include #include @@ -40,11 +40,10 @@ namespace Test { void AppContext::SetUpTestSuite() { - CHIP_ERROR err = CHIP_NO_ERROR; LoopbackMessagingContext::SetUpTestSuite(); - // TODO: use ASSERT_EQ, once transition to pw_unit_test is complete - VerifyOrDieWithMsg((err = chip::DeviceLayer::PlatformMgr().InitChipStack()) == CHIP_NO_ERROR, AppServer, - "Init CHIP stack failed: %" CHIP_ERROR_FORMAT, err.Format()); + VerifyOrReturn(!HasFailure()); // Stop if parent had a failure. + + ASSERT_EQ(chip::DeviceLayer::PlatformMgr().InitChipStack(), CHIP_NO_ERROR); } void AppContext::TearDownTestSuite() @@ -67,17 +66,15 @@ void AppContext::TearDownTestSuite() void AppContext::SetUp() { - CHIP_ERROR err = CHIP_NO_ERROR; LoopbackMessagingContext::SetUp(); - // TODO: use ASSERT_EQ, once transition to pw_unit_test is complete - VerifyOrDieWithMsg((err = app::InteractionModelEngine::GetInstance()->Init(&GetExchangeManager(), &GetFabricTable(), - app::reporting::GetDefaultReportScheduler())) == - CHIP_NO_ERROR, - AppServer, "Init InteractionModelEngine failed: %" CHIP_ERROR_FORMAT, err.Format()); + VerifyOrReturn(!HasFailure()); // Stop if parent had a failure. + + ASSERT_EQ(app::InteractionModelEngine::GetInstance()->Init(&GetExchangeManager(), &GetFabricTable(), + app::reporting::GetDefaultReportScheduler()), + CHIP_NO_ERROR); Access::SetAccessControl(gPermissiveAccessControl); - VerifyOrDieWithMsg((err = Access::GetAccessControl().Init(chip::Access::Examples::GetPermissiveAccessControlDelegate(), - gDeviceTypeResolver)) == CHIP_NO_ERROR, - AppServer, "Init AccessControl failed: %" CHIP_ERROR_FORMAT, err.Format()); + ASSERT_EQ(Access::GetAccessControl().Init(chip::Access::Examples::GetPermissiveAccessControlDelegate(), gDeviceTypeResolver), + CHIP_NO_ERROR); } void AppContext::TearDown() @@ -85,6 +82,7 @@ void AppContext::TearDown() Access::GetAccessControl().Finish(); Access::ResetAccessControlToDefault(); chip::app::InteractionModelEngine::GetInstance()->Shutdown(); + LoopbackMessagingContext::TearDown(); } diff --git a/src/app/tests/AppTestContext.h b/src/app/tests/AppTestContext.h index a2fe3387d2d7aa..c05e490fb9e6aa 100644 --- a/src/app/tests/AppTestContext.h +++ b/src/app/tests/AppTestContext.h @@ -32,9 +32,9 @@ class AppContext : public LoopbackMessagingContext // Performs shared teardown for all tests in the test suite static void TearDownTestSuite(); // Performs setup for each individual test in the test suite - void SetUp(); + virtual void SetUp(); // Performs teardown for each individual test in the test suite - void TearDown(); + virtual void TearDown(); }; } // namespace Test diff --git a/src/app/tests/BUILD.gn b/src/app/tests/BUILD.gn index e8860f01565141..e600fbeb3f1987 100644 --- a/src/app/tests/BUILD.gn +++ b/src/app/tests/BUILD.gn @@ -40,7 +40,10 @@ static_library("helpers") { "${chip_root}/src/transport/raw/tests:helpers", ] - public_deps = [ "${chip_root}/src/messaging/tests:helpers" ] + public_deps = [ + "${chip_root}/src/lib/support/tests:pw-test-macros", + "${chip_root}/src/messaging/tests:helpers", + ] } source_set("binding-test-srcs") { @@ -52,6 +55,7 @@ source_set("binding-test-srcs") { ] public_deps = [ + "${chip_root}/src/app/util/mock:mock_codegen_data_model", "${chip_root}/src/app/util/mock:mock_ember", "${chip_root}/src/lib/core", ] @@ -70,6 +74,19 @@ source_set("ota-requestor-test-srcs") { ] } +source_set("thread-network-directory-test-srcs") { + sources = [ + "${chip_root}/src/app/clusters/thread-network-directory-server/DefaultThreadNetworkDirectoryStorage.cpp", + "${chip_root}/src/app/clusters/thread-network-directory-server/DefaultThreadNetworkDirectoryStorage.h", + "${chip_root}/src/app/clusters/thread-network-directory-server/ThreadNetworkDirectoryStorage.h", + ] + + public_deps = [ + "${chip_root}/src/app/common:cluster-objects", + "${chip_root}/src/lib/core", + ] +} + source_set("time-sync-data-provider-test-srcs") { sources = [ "${chip_root}/src/app/clusters/time-synchronization-server/TimeSyncDataProvider.cpp" ] @@ -86,6 +103,7 @@ source_set("power-cluster-test-srcs") { public_deps = [ "${chip_root}/src/app/common:cluster-objects", + "${chip_root}/src/app/util/mock:mock_codegen_data_model", "${chip_root}/src/app/util/mock:mock_ember", "${chip_root}/src/lib/core", ] @@ -106,6 +124,7 @@ source_set("scenes-table-test-srcs") { public_deps = [ "${chip_root}/src/app", "${chip_root}/src/app/common:cluster-objects", + "${chip_root}/src/app/util/mock:mock_codegen_data_model", "${chip_root}/src/app/util/mock:mock_ember", "${chip_root}/src/lib/core", ] @@ -120,16 +139,36 @@ source_set("operational-state-test-srcs") { ] } +source_set("thread-border-router-management-test-srcs") { + sources = [ "${chip_root}/src/app/clusters/thread-border-router-management-server/thread-border-router-management-server.cpp" ] + + public_deps = [ + "${chip_root}/src/app", + "${chip_root}/src/app/common:cluster-objects", + "${chip_root}/src/app/util/mock:mock_ember", + "${chip_root}/src/lib/core", + ] +} + source_set("app-test-stubs") { sources = [ "test-ember-api.cpp", "test-ember-api.h", + + # The overrides in these files are overrides from ember-compatibility-functions + # and the data model interface is NOT aware of such functionality + # + # TODO: ideally tests should have been written via mock ember, however mock ember did + # not exist at that time. We should completely re-write how these tests access + # the data via the DataModel interface "test-interaction-model-api.cpp", "test-interaction-model-api.h", ] + public_configs = [ "${chip_root}/src/lib/support/pw_log_chip:config" ] public_deps = [ + "${chip_root}/src/app/util/mock:mock_codegen_data_model", "${chip_root}/src/app/util/mock:mock_ember", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", @@ -156,13 +195,13 @@ chip_test_suite("tests") { "TestConcreteAttributePath.cpp", "TestDataModelSerialization.cpp", "TestDefaultOTARequestorStorage.cpp", + "TestDefaultThreadNetworkDirectoryStorage.cpp", "TestEventLoggingNoUTCTime.cpp", "TestEventOverflow.cpp", "TestEventPathParams.cpp", "TestFabricScopedEventLogging.cpp", "TestInteractionModelEngine.cpp", "TestMessageDef.cpp", - "TestNullable.cpp", "TestNumericAttributeTraits.cpp", "TestOperationalStateClusterObjects.cpp", "TestPendingNotificationMap.cpp", @@ -187,11 +226,14 @@ chip_test_suite("tests") { ":operational-state-test-srcs", ":ota-requestor-test-srcs", ":power-cluster-test-srcs", + ":thread-network-directory-test-srcs", ":time-sync-data-provider-test-srcs", "${chip_root}/src/app", + "${chip_root}/src/app/codegen-data-model:instance-header", "${chip_root}/src/app/common:cluster-objects", "${chip_root}/src/app/icd/client:manager", "${chip_root}/src/app/tests:helpers", + "${chip_root}/src/app/util/mock:mock_codegen_data_model", "${chip_root}/src/app/util/mock:mock_ember", "${chip_root}/src/lib/core", "${chip_root}/src/lib/core:string-builder-adapters", @@ -218,6 +260,9 @@ chip_test_suite("tests") { "${chip_root}/src/app/server", "${chip_root}/src/messaging/tests/echo:common", ] + } else if (!chip_fake_platform) { + test_sources += [ "TestThreadBorderRouterManagementCluster.cpp" ] + public_deps += [ ":thread-border-router-management-test-srcs" ] } if (!chip_fake_platform) { diff --git a/src/app/tests/TestAclAttribute.cpp b/src/app/tests/TestAclAttribute.cpp index 8ff88967deb5b0..c11adde08d6208 100644 --- a/src/app/tests/TestAclAttribute.cpp +++ b/src/app/tests/TestAclAttribute.cpp @@ -109,50 +109,41 @@ class MockInteractionModelApp : public chip::app::ReadClient::Callback namespace chip { namespace app { -class TestAclAttribute : public ::testing::Test +class TestAclAttribute : public Test::AppContext { public: - static void SetUpTestSuite() - { - - mpTestContext = new chip::Test::AppContext; - mpTestContext->SetUpTestSuite(); - } - static void TearDownTestSuite() - { - mpTestContext->TearDownTestSuite(); - delete mpTestContext; - } - void SetUp() override { - mpTestContext->SetUp(); + AppContext::SetUp(); Access::GetAccessControl().Finish(); Access::GetAccessControl().Init(GetTestAccessControlDelegate(), gDeviceTypeResolver); + mOldModel = InteractionModelEngine::GetInstance()->SetDataModel(&TestImCustomDataModel::Instance()); } - void TearDown() override { mpTestContext->TearDown(); } - static chip::Test::AppContext * mpTestContext; -}; + void TearDown() override + { + AppContext::TearDown(); + InteractionModelEngine::GetInstance()->SetDataModel(mOldModel); + } -chip::Test::AppContext * TestAclAttribute::mpTestContext = nullptr; +private: + chip::app::InteractionModel::DataModel * mOldModel = nullptr; +}; // Read Client sends a malformed subscribe request, interaction model engine fails to parse the request and generates a status // report to client, and client is closed. TEST_F(TestAclAttribute, TestACLDeniedAttribute) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler()), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); chip::app::AttributePathParams attributePathParams[2]; @@ -164,13 +155,13 @@ TEST_F(TestAclAttribute, TestACLDeniedAttribute) attributePathParams[1].mClusterId = chip::Test::kTestDeniedClusterId1; attributePathParams[1].mAttributeId = 2; - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpAttributePathParamsList = attributePathParams; readPrepareParams.mAttributePathParamsListSize = 2; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mError, CHIP_IM_GLOBAL_STATUS(InvalidAction)); EXPECT_FALSE(delegate.mGotReport); delegate.mError = CHIP_NO_ERROR; @@ -178,7 +169,7 @@ TEST_F(TestAclAttribute, TestACLDeniedAttribute) } { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); chip::app::AttributePathParams attributePathParams[2]; @@ -189,13 +180,13 @@ TEST_F(TestAclAttribute, TestACLDeniedAttribute) attributePathParams[1].mClusterId = chip::Test::kTestDeniedClusterId2; attributePathParams[1].mAttributeId = 2; - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpAttributePathParamsList = attributePathParams; readPrepareParams.mAttributePathParamsListSize = 2; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mError, CHIP_IM_GLOBAL_STATUS(InvalidAction)); EXPECT_FALSE(delegate.mGotReport); delegate.mError = CHIP_NO_ERROR; @@ -203,7 +194,7 @@ TEST_F(TestAclAttribute, TestACLDeniedAttribute) } { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); chip::app::AttributePathParams attributePathParams[2]; @@ -215,13 +206,13 @@ TEST_F(TestAclAttribute, TestACLDeniedAttribute) attributePathParams[1].mClusterId = chip::Test::kTestClusterId; attributePathParams[1].mAttributeId = 2; - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpAttributePathParamsList = attributePathParams; readPrepareParams.mAttributePathParamsListSize = 2; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mError, CHIP_NO_ERROR); EXPECT_TRUE(delegate.mGotReport); EXPECT_EQ(engine->GetNumActiveReadHandlers(ReadHandler::InteractionType::Subscribe), 1u); @@ -231,7 +222,7 @@ TEST_F(TestAclAttribute, TestACLDeniedAttribute) EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } } // namespace app } // namespace chip diff --git a/src/app/tests/TestAclEvent.cpp b/src/app/tests/TestAclEvent.cpp index 014625ad628b65..bbded462985012 100644 --- a/src/app/tests/TestAclEvent.cpp +++ b/src/app/tests/TestAclEvent.cpp @@ -18,7 +18,6 @@ #include -#include #include #include @@ -27,11 +26,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -172,21 +173,9 @@ class MockInteractionModelApp : public chip::app::ReadClient::Callback namespace chip { namespace app { -class TestAclEvent : public ::testing::Test +class TestAclEvent : public Test::AppContext { public: - static void SetUpTestSuite() - { - - mpTestContext = new chip::Test::AppContext; - mpTestContext->SetUpTestSuite(); - } - static void TearDownTestSuite() - { - mpTestContext->TearDownTestSuite(); - delete mpTestContext; - } - // Performs setup for each individual test in the test suite void SetUp() override { @@ -196,10 +185,10 @@ class TestAclEvent : public ::testing::Test { &gCritEventBuffer[0], sizeof(gCritEventBuffer), chip::app::PriorityLevel::Critical }, }; - mpTestContext->SetUp(); + AppContext::SetUp(); ASSERT_EQ(mEventCounter.Init(0), CHIP_NO_ERROR); - chip::app::EventManagement::CreateEventManagement(&mpTestContext->GetExchangeManager(), ArraySize(logStorageResources), + chip::app::EventManagement::CreateEventManagement(&GetExchangeManager(), ArraySize(logStorageResources), gCircularEventBuffer, logStorageResources, &mEventCounter); Access::GetAccessControl().Finish(); @@ -210,21 +199,17 @@ class TestAclEvent : public ::testing::Test void TearDown() override { chip::app::EventManagement::DestroyEventManagement(); - mpTestContext->TearDown(); + AppContext::TearDown(); } - static chip::Test::AppContext * mpTestContext; - private: chip::MonotonicallyIncreasingCounter mEventCounter; }; -chip::Test::AppContext * TestAclEvent::mpTestContext = nullptr; - TEST_F(TestAclEvent, TestReadRoundtripWithEventStatusIBInEventReport) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_FALSE(rm->TestGetCountRetransTable()); @@ -232,9 +217,7 @@ TEST_F(TestAclEvent, TestReadRoundtripWithEventStatusIBInEventReport) auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler()), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); // A custom AccessControl::Delegate has been installed that grants privilege to any cluster except the test cluster. // When reading events with concrete paths without enough privilege, we will get a EventStatusIB @@ -244,7 +227,7 @@ TEST_F(TestAclEvent, TestReadRoundtripWithEventStatusIBInEventReport) eventPathParams[0].mClusterId = chip::Test::kTestDeniedClusterId2; eventPathParams[0].mEventId = kTestEventIdDebug; - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpEventPathParamsList = eventPathParams; readPrepareParams.mEventPathParamsListSize = 1; readPrepareParams.mEventNumber.SetValue(1); @@ -252,12 +235,12 @@ TEST_F(TestAclEvent, TestReadRoundtripWithEventStatusIBInEventReport) MockInteractionModelApp delegate; EXPECT_FALSE(delegate.mGotEventResponse); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotEventResponse); EXPECT_TRUE(delegate.mNumReadEventFailureStatusReceived); @@ -274,7 +257,7 @@ TEST_F(TestAclEvent, TestReadRoundtripWithEventStatusIBInEventReport) eventPathParams[0].mEndpointId = kTestEndpointId; eventPathParams[0].mClusterId = chip::Test::kTestDeniedClusterId2; - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpEventPathParamsList = eventPathParams; readPrepareParams.mEventPathParamsListSize = 1; readPrepareParams.mEventNumber.SetValue(1); @@ -282,12 +265,12 @@ TEST_F(TestAclEvent, TestReadRoundtripWithEventStatusIBInEventReport) MockInteractionModelApp delegate; EXPECT_FALSE(delegate.mGotEventResponse); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_FALSE(delegate.mGotEventResponse); EXPECT_FALSE(delegate.mNumReadEventFailureStatusReceived); EXPECT_FALSE(delegate.mReadError); @@ -301,7 +284,7 @@ TEST_F(TestAclEvent, TestReadRoundtripWithEventStatusIBInEventReport) chip::app::EventPathParams eventPathParams[1]; eventPathParams[0].mEndpointId = kTestEndpointId; - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpEventPathParamsList = eventPathParams; readPrepareParams.mEventPathParamsListSize = 1; readPrepareParams.mEventNumber.SetValue(1); @@ -309,12 +292,12 @@ TEST_F(TestAclEvent, TestReadRoundtripWithEventStatusIBInEventReport) MockInteractionModelApp delegate; EXPECT_FALSE(delegate.mGotEventResponse); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotEventResponse); EXPECT_FALSE(delegate.mNumReadEventFailureStatusReceived); EXPECT_FALSE(delegate.mReadError); @@ -333,7 +316,7 @@ TEST_F(TestAclEvent, TestReadRoundtripWithEventStatusIBInEventReport) eventPathParams[1].mClusterId = kTestClusterId2; eventPathParams[1].mEventId = kTestEventIdCritical; - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpEventPathParamsList = eventPathParams; readPrepareParams.mEventPathParamsListSize = 1; readPrepareParams.mEventNumber.SetValue(1); @@ -341,19 +324,19 @@ TEST_F(TestAclEvent, TestReadRoundtripWithEventStatusIBInEventReport) MockInteractionModelApp delegate; EXPECT_FALSE(delegate.mGotEventResponse); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotEventResponse); EXPECT_TRUE(delegate.mNumReadEventFailureStatusReceived); EXPECT_FALSE(delegate.mReadError); } EXPECT_FALSE(engine->GetNumActiveReadClients()); engine->Shutdown(); - EXPECT_FALSE(mpTestContext->GetExchangeManager().GetNumActiveExchanges()); + EXPECT_FALSE(GetExchangeManager().GetNumActiveExchanges()); } } // namespace app diff --git a/src/app/tests/TestAttributePathExpandIterator.cpp b/src/app/tests/TestAttributePathExpandIterator.cpp index 032581bff16f8a..236203098c8fb8 100644 --- a/src/app/tests/TestAttributePathExpandIterator.cpp +++ b/src/app/tests/TestAttributePathExpandIterator.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -132,7 +133,7 @@ TEST(TestAttributePathExpandIterator, TestAllWildcard) size_t index = 0; - for (app::AttributePathExpandIterator iter(&clusInfo); iter.Get(path); iter.Next()) + for (app::AttributePathExpandIterator iter(CodegenDataModelInstance(), &clusInfo); iter.Get(path); iter.Next()) { ChipLogDetail(AppServer, "Visited Attribute: 0x%04X / " ChipLogFormatMEI " / " ChipLogFormatMEI, path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId)); @@ -156,7 +157,7 @@ TEST(TestAttributePathExpandIterator, TestWildcardEndpoint) size_t index = 0; - for (app::AttributePathExpandIterator iter(&clusInfo); iter.Get(path); iter.Next()) + for (app::AttributePathExpandIterator iter(CodegenDataModelInstance(), &clusInfo); iter.Get(path); iter.Next()) { ChipLogDetail(AppServer, "Visited Attribute: 0x%04X / " ChipLogFormatMEI " / " ChipLogFormatMEI, path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId)); @@ -183,7 +184,7 @@ TEST(TestAttributePathExpandIterator, TestWildcardCluster) size_t index = 0; - for (app::AttributePathExpandIterator iter(&clusInfo); iter.Get(path); iter.Next()) + for (app::AttributePathExpandIterator iter(CodegenDataModelInstance(), &clusInfo); iter.Get(path); iter.Next()) { ChipLogDetail(AppServer, "Visited Attribute: 0x%04X / " ChipLogFormatMEI " / " ChipLogFormatMEI, path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId)); @@ -210,7 +211,7 @@ TEST(TestAttributePathExpandIterator, TestWildcardClusterGlobalAttributeNotInMet size_t index = 0; - for (app::AttributePathExpandIterator iter(&clusInfo); iter.Get(path); iter.Next()) + for (app::AttributePathExpandIterator iter(CodegenDataModelInstance(), &clusInfo); iter.Get(path); iter.Next()) { ChipLogDetail(AppServer, "Visited Attribute: 0x%04X / " ChipLogFormatMEI " / " ChipLogFormatMEI, path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId)); @@ -244,7 +245,7 @@ TEST(TestAttributePathExpandIterator, TestWildcardAttribute) size_t index = 0; - for (app::AttributePathExpandIterator iter(&clusInfo); iter.Get(path); iter.Next()) + for (app::AttributePathExpandIterator iter(CodegenDataModelInstance(), &clusInfo); iter.Get(path); iter.Next()) { ChipLogDetail(AppServer, "Visited Attribute: 0x%04X / " ChipLogFormatMEI " / " ChipLogFormatMEI, path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId)); @@ -269,7 +270,7 @@ TEST(TestAttributePathExpandIterator, TestNoWildcard) size_t index = 0; - for (app::AttributePathExpandIterator iter(&clusInfo); iter.Get(path); iter.Next()) + for (app::AttributePathExpandIterator iter(CodegenDataModelInstance(), &clusInfo); iter.Get(path); iter.Next()) { ChipLogDetail(AppServer, "Visited Attribute: 0x%04X / " ChipLogFormatMEI " / " ChipLogFormatMEI, path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId)); @@ -413,7 +414,7 @@ TEST(TestAttributePathExpandIterator, TestMultipleClusInfo) size_t index = 0; - for (app::AttributePathExpandIterator iter(&clusInfo1); iter.Get(path); iter.Next()) + for (app::AttributePathExpandIterator iter(CodegenDataModelInstance(), &clusInfo1); iter.Get(path); iter.Next()) { ChipLogDetail(AppServer, "Visited Attribute: 0x%04X / " ChipLogFormatMEI " / " ChipLogFormatMEI, path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId)); diff --git a/src/app/tests/TestAttributePersistenceProvider.cpp b/src/app/tests/TestAttributePersistenceProvider.cpp index 7ae40b52402fe0..1b8c7ee3d3872c 100644 --- a/src/app/tests/TestAttributePersistenceProvider.cpp +++ b/src/app/tests/TestAttributePersistenceProvider.cpp @@ -59,7 +59,13 @@ TEST_F(TestAttributePersistenceProvider, TestStorageAndRetrivalByteSpans) MutableByteSpan valueReadBack(getArray); err = persistenceProvider.SafeReadValue(TestConcretePath, valueReadBack); EXPECT_EQ(err, CHIP_NO_ERROR); - EXPECT_TRUE(std::equal(valueReadBack.begin(), valueReadBack.end(), value.begin(), value.end())); + EXPECT_TRUE(valueReadBack.data_equal(value)); + + uint8_t getArrayThatIsLongerThanNeeded[10]; + MutableByteSpan valueReadBack2(getArrayThatIsLongerThanNeeded); + err = persistenceProvider.SafeReadValue(TestConcretePath, valueReadBack2); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(valueReadBack2.data_equal(value)); // Finishing persistenceProvider.Shutdown(); @@ -320,6 +326,7 @@ TEST_F(TestAttributePersistenceProvider, TestBufferTooSmallErrors) err = persistenceProvider.SafeReadValue(TestConcretePath, valueReadBackByteSpan8); EXPECT_EQ(err, CHIP_ERROR_BUFFER_TOO_SMALL); + // TODO: ReadScalarValue() does not take a buffer, so expecting CHIP_ERROR_BUFFER_TOO_SMALL is bad API // Fail to get value as uint8_t uint8_t valueReadBack8; err = persistenceProvider.ReadScalarValue(TestConcretePath, valueReadBack8); diff --git a/src/app/tests/TestBufferedReadCallback.cpp b/src/app/tests/TestBufferedReadCallback.cpp index 91836675db25f4..f3afeb7715cee3 100644 --- a/src/app/tests/TestBufferedReadCallback.cpp +++ b/src/app/tests/TestBufferedReadCallback.cpp @@ -31,7 +31,6 @@ #include #include -using TestContext = chip::Test::AppContext; using namespace chip::app; using namespace chip; @@ -65,39 +64,7 @@ struct ValidationInstruction using InstructionListType = std::vector; -class TestBufferedReadCallback : public ::testing::Test -{ -public: - static void SetUpTestSuite() - { - mpTestContext = new TestContext; - mpTestContext->SetUpTestSuite(); - } - static void TearDownTestSuite() - { - mpTestContext->TearDownTestSuite(); - if (mpTestContext != nullptr) - { - delete mpTestContext; - } - } - void SetUp() override - { - if (mpTestContext != nullptr) - { - mpTestContext->SetUp(); - } - } - void TearDown() override - { - if (mpTestContext != nullptr) - { - mpTestContext->TearDown(); - } - } - static TestContext * mpTestContext; -}; -TestContext * TestBufferedReadCallback::mpTestContext = nullptr; +using TestBufferedReadCallback = chip::Test::AppContext; class DataSeriesValidator : public BufferedReadCallback::Callback { @@ -268,11 +235,11 @@ void DataSeriesValidator::OnAttributeData(const ConcreteDataAttributePath & aPat auto iter = value.begin(); - uint8_t index = 0; + uint32_t index = 0; while (iter.Next() && index < expectedListLength) { auto & iterValue = iter.GetValue(); - EXPECT_EQ(iterValue, (index)); + EXPECT_EQ(iterValue, (index % 256)); index++; } diff --git a/src/app/tests/TestClusterStateCache.cpp b/src/app/tests/TestClusterStateCache.cpp index b4f41df2278b14..972d85d4df9e2a 100644 --- a/src/app/tests/TestClusterStateCache.cpp +++ b/src/app/tests/TestClusterStateCache.cpp @@ -37,7 +37,6 @@ #include #include -using TestContext = chip::Test::AppContext; using namespace chip::app; using namespace chip; @@ -101,6 +100,11 @@ struct AttributeInstruction } } + ConcreteAttributePath GetAttributePath() const + { + return ConcreteAttributePath(mEndpointId, Clusters::UnitTesting::Id, GetAttributeId()); + } + static uint8_t sInstructionId; }; @@ -108,26 +112,7 @@ uint8_t AttributeInstruction::sInstructionId = 0; using AttributeInstructionListType = std::vector; -class TestClusterStateCache : public ::testing::Test -{ -public: - static void SetUpTestSuite() - { - mpTestContext = new TestContext; - mpTestContext->SetUpTestSuite(); - } - static void TearDownTestSuite() - { - mpTestContext->TearDownTestSuite(); - delete mpTestContext; - } - - void SetUp() override { mpTestContext->SetUp(); } - void TearDown() override { mpTestContext->TearDown(); } - - static TestContext * mpTestContext; -}; -TestContext * TestClusterStateCache::mpTestContext = nullptr; +using TestClusterStateCache = chip::Test::AppContext; class ForwardedDataCallbackValidator final { @@ -626,6 +611,94 @@ void RunAndValidateSequence(AttributeInstructionListType list) ++bufferSize; } while (true); + + // Now check clearing behavior. First for attributes. + ConcreteAttributePath firstAttr = list[0].GetAttributePath(); + + TLV::TLVReader reader; + CHIP_ERROR err = cache.Get(firstAttr, reader); + // Should have gotten a value or status for now. + EXPECT_NE(err, CHIP_ERROR_KEY_NOT_FOUND); + + cache.ClearAttribute(firstAttr); + + err = cache.Get(firstAttr, reader); + // Should have gotten no value. + EXPECT_EQ(err, CHIP_ERROR_KEY_NOT_FOUND); + + // Now clearing for clusters. First check that things that should be there are. + for (auto & listItem : list) + { + ConcreteAttributePath path = listItem.GetAttributePath(); + if (path == firstAttr) + { + // We removed this one already. + continue; + } + + err = cache.Get(path, reader); + + // Should have gotten a value or status for now. + EXPECT_NE(err, CHIP_ERROR_KEY_NOT_FOUND); + } + + auto firstCluster = ConcreteClusterPath(firstAttr); + cache.ClearAttributes(firstCluster); + + for (auto & listItem : list) + { + ConcreteAttributePath path = listItem.GetAttributePath(); + + err = cache.Get(path, reader); + + if (ConcreteClusterPath(path) == firstCluster) + { + EXPECT_EQ(err, CHIP_ERROR_KEY_NOT_FOUND); + } + else + { + // Should still have a value or status + EXPECT_NE(err, CHIP_ERROR_KEY_NOT_FOUND); + } + } + + // Now clearing for endpoints. First check that things that should be there are. + // TODO: Since all our attributes have the same cluster, this is not + // actually testing anything useful right now. + for (auto & listItem : list) + { + ConcreteAttributePath path = listItem.GetAttributePath(); + if (ConcreteClusterPath(path) == firstCluster) + { + // We removed this one already. + continue; + } + + err = cache.Get(path, reader); + + // Should have gotten a value or status for now. + EXPECT_NE(err, CHIP_ERROR_KEY_NOT_FOUND); + } + + auto firstEndpoint = firstAttr.mEndpointId; + cache.ClearAttributes(firstEndpoint); + + for (auto & listItem : list) + { + ConcreteAttributePath path = listItem.GetAttributePath(); + + err = cache.Get(path, reader); + + if (path.mEndpointId == firstEndpoint) + { + EXPECT_EQ(err, CHIP_ERROR_KEY_NOT_FOUND); + } + else + { + // Should still have a value or status + EXPECT_NE(err, CHIP_ERROR_KEY_NOT_FOUND); + } + } } /* diff --git a/src/app/tests/TestCommandInteraction.cpp b/src/app/tests/TestCommandInteraction.cpp index 8c2537a925e9b1..34f59edd245ff6 100644 --- a/src/app/tests/TestCommandInteraction.cpp +++ b/src/app/tests/TestCommandInteraction.cpp @@ -50,7 +50,6 @@ #include #include -using TestContext = chip::Test::AppContext; using namespace chip::Protocols; namespace { @@ -166,27 +165,25 @@ struct BadFields } }; -InteractionModel::Status ServerClusterCommandExists(const ConcreteCommandPath & aRequestCommandPath) +Protocols::InteractionModel::Status ServerClusterCommandExists(const ConcreteCommandPath & aRequestCommandPath) { // Mock cluster catalog, only support commands on one cluster on one endpoint. - using InteractionModel::Status; - if (aRequestCommandPath.mEndpointId != kTestEndpointId) { - return Status::UnsupportedEndpoint; + return Protocols::InteractionModel::Status::UnsupportedEndpoint; } if (aRequestCommandPath.mClusterId != kTestClusterId) { - return Status::UnsupportedCluster; + return Protocols::InteractionModel::Status::UnsupportedCluster; } if (aRequestCommandPath.mCommandId == kTestNonExistCommandId) { - return Status::UnsupportedCommand; + return Protocols::InteractionModel::Status::UnsupportedCommand; } - return Status::Success; + return Protocols::InteractionModel::Status::Success; } void DispatchSingleClusterCommand(const ConcreteCommandPath & aRequestCommandPath, chip::TLV::TLVReader & aReader, @@ -347,7 +344,7 @@ class MockCommandHandlerCallback : public CommandHandlerImpl::Callback { DispatchSingleClusterCommand(aCommandPath, apPayload, &apCommandObj); } - InteractionModel::Status CommandExists(const ConcreteCommandPath & aCommandPath) + Protocols::InteractionModel::Status CommandExists(const ConcreteCommandPath & aCommandPath) { return ServerClusterCommandExists(aCommandPath); } @@ -357,25 +354,9 @@ class MockCommandHandlerCallback : public CommandHandlerImpl::Callback int onFinalCalledTimes = 0; } mockCommandHandlerDelegate; -class TestCommandInteraction : public ::testing::Test +class TestCommandInteraction : public chip::Test::AppContext { public: - static void SetUpTestSuite() - { - mpTestContext = new TestContext; - mpTestContext->SetUpTestSuite(); - } - static void TearDownTestSuite() - { - mpTestContext->TearDownTestSuite(); - delete mpTestContext; - } - - void SetUp() override { mpTestContext->SetUp(); } - void TearDown() override { mpTestContext->TearDown(); } - - static TestContext * mpTestContext; - static size_t GetNumActiveCommandResponderObjects() { return chip::app::InteractionModelEngine::GetInstance()->mCommandResponderObjs.Allocated(); @@ -443,7 +424,6 @@ class TestCommandInteraction : public ::testing::Test const ConcreteCommandPath & aRequestCommandPath, uint32_t aSizeToLeaveInBuffer); static void ValidateCommandHandlerEncodeInvokeResponseMessage(bool aNeedStatusCode); }; -TestContext * TestCommandInteraction::mpTestContext = nullptr; class TestExchangeDelegate : public Messaging::ExchangeDelegate { @@ -686,19 +666,19 @@ void TestCommandInteraction::ValidateCommandHandlerEncodeInvokeResponseMessage(b TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandInvalidMessage1) { mockCommandSenderDelegate.ResetCounter(); - app::CommandSender commandSender(&mockCommandSenderDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderDelegate, &GetExchangeManager()); AddInvokeRequestData(&commandSender); asyncCommand = false; - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 1; - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 1; + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); + DrainAndServiceIO(); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); EXPECT_EQ(mockCommandSenderDelegate.onResponseCalledTimes, 0); EXPECT_EQ(mockCommandSenderDelegate.onFinalCalledTimes, 0); @@ -718,19 +698,19 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandInvalidMessage1) PayloadHeader payloadHeader; payloadHeader.SetExchangeID(0); payloadHeader.SetMessageType(chip::Protocols::InteractionModel::MsgType::StatusResponse); - chip::Test::MessageCapturer messageLog(*mpTestContext); + chip::Test::MessageCapturer messageLog(*this); messageLog.mCaptureStandaloneAcks = false; // Since we are dropping packets, things are not getting acked. Set up our // MRP state to look like what it would have looked like if the packet had // not gotten dropped. - PretendWeGotReplyFromServer(*mpTestContext, commandSender.mExchangeCtx.Get()); + PretendWeGotReplyFromServer(*this, commandSender.mExchangeCtx.Get()); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 0; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToAllowBeforeDropping = 0; + GetLoopback().mDroppedMessageCount = 0; EXPECT_EQ(commandSender.OnMessageReceived(commandSender.mExchangeCtx.Get(), payloadHeader, std::move(msgBuf)), CHIP_IM_GLOBAL_STATUS(Busy)); @@ -740,16 +720,16 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandInvalidMessage1) EXPECT_EQ(mockCommandSenderDelegate.onErrorCalledTimes, 1); EXPECT_EQ(commandSender.GetInvokeResponseMessageCount(), 0u); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Client sent status report with invalid action, server's exchange has been closed, so all it sent is an MRP Ack - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); CheckForInvalidAction(messageLog); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } // Command Sender sends invoke request, command handler drops invoke response, then test injects unknown message to client, @@ -757,19 +737,19 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandInvalidMessage1) TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandInvalidMessage2) { mockCommandSenderDelegate.ResetCounter(); - app::CommandSender commandSender(&mockCommandSenderDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderDelegate, &GetExchangeManager()); AddInvokeRequestData(&commandSender); asyncCommand = false; - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 1; - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 1; + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); + DrainAndServiceIO(); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); EXPECT_EQ(mockCommandSenderDelegate.onResponseCalledTimes, 0); EXPECT_EQ(mockCommandSenderDelegate.onFinalCalledTimes, 0); @@ -788,19 +768,19 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandInvalidMessage2) PayloadHeader payloadHeader; payloadHeader.SetExchangeID(0); payloadHeader.SetMessageType(chip::Protocols::InteractionModel::MsgType::ReportData); - chip::Test::MessageCapturer messageLog(*mpTestContext); + chip::Test::MessageCapturer messageLog(*this); messageLog.mCaptureStandaloneAcks = false; // Since we are dropping packets, things are not getting acked. Set up our // MRP state to look like what it would have looked like if the packet had // not gotten dropped. - PretendWeGotReplyFromServer(*mpTestContext, commandSender.mExchangeCtx.Get()); + PretendWeGotReplyFromServer(*this, commandSender.mExchangeCtx.Get()); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 0; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToAllowBeforeDropping = 0; + GetLoopback().mDroppedMessageCount = 0; EXPECT_EQ(commandSender.OnMessageReceived(commandSender.mExchangeCtx.Get(), payloadHeader, std::move(msgBuf)), CHIP_ERROR_INVALID_MESSAGE_TYPE); @@ -809,16 +789,16 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandInvalidMessage2) EXPECT_EQ(mockCommandSenderDelegate.onFinalCalledTimes, 1); EXPECT_EQ(mockCommandSenderDelegate.onErrorCalledTimes, 1); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Client sent status report with invalid action, server's exchange has been closed, so all it sent is an MRP Ack - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); CheckForInvalidAction(messageLog); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } // Command Sender sends invoke request, command handler drops invoke response, then test injects malformed invoke response @@ -826,19 +806,19 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandInvalidMessage2) TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandInvalidMessage3) { mockCommandSenderDelegate.ResetCounter(); - app::CommandSender commandSender(&mockCommandSenderDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderDelegate, &GetExchangeManager()); AddInvokeRequestData(&commandSender); asyncCommand = false; - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 1; - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 1; + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); + DrainAndServiceIO(); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); EXPECT_EQ(mockCommandSenderDelegate.onResponseCalledTimes, 0); EXPECT_EQ(mockCommandSenderDelegate.onFinalCalledTimes, 0); @@ -857,18 +837,18 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandInvalidMessage3) PayloadHeader payloadHeader; payloadHeader.SetExchangeID(0); payloadHeader.SetMessageType(chip::Protocols::InteractionModel::MsgType::InvokeCommandResponse); - chip::Test::MessageCapturer messageLog(*mpTestContext); + chip::Test::MessageCapturer messageLog(*this); messageLog.mCaptureStandaloneAcks = false; // Since we are dropping packets, things are not getting acked. Set up our // MRP state to look like what it would have looked like if the packet had // not gotten dropped. - PretendWeGotReplyFromServer(*mpTestContext, commandSender.mExchangeCtx.Get()); + PretendWeGotReplyFromServer(*this, commandSender.mExchangeCtx.Get()); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 0; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToAllowBeforeDropping = 0; + GetLoopback().mDroppedMessageCount = 0; EXPECT_EQ(commandSender.OnMessageReceived(commandSender.mExchangeCtx.Get(), payloadHeader, std::move(msgBuf)), CHIP_ERROR_END_OF_TLV); @@ -877,16 +857,16 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandInvalidMessage3) EXPECT_EQ(mockCommandSenderDelegate.onFinalCalledTimes, 1); EXPECT_EQ(mockCommandSenderDelegate.onErrorCalledTimes, 1); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Client sent status report with invalid action, server's exchange has been closed, so all it sent is an MRP Ack - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); CheckForInvalidAction(messageLog); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } // Command Sender sends invoke request, command handler drops invoke response, then test injects malformed status response to @@ -894,19 +874,19 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandInvalidMessage3) TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandInvalidMessage4) { mockCommandSenderDelegate.ResetCounter(); - app::CommandSender commandSender(&mockCommandSenderDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderDelegate, &GetExchangeManager()); AddInvokeRequestData(&commandSender); asyncCommand = false; - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 1; - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 1; + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); + DrainAndServiceIO(); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); EXPECT_EQ(mockCommandSenderDelegate.onResponseCalledTimes, 0); EXPECT_EQ(mockCommandSenderDelegate.onFinalCalledTimes, 0); @@ -924,18 +904,18 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandInvalidMessage4) PayloadHeader payloadHeader; payloadHeader.SetExchangeID(0); payloadHeader.SetMessageType(chip::Protocols::InteractionModel::MsgType::StatusResponse); - chip::Test::MessageCapturer messageLog(*mpTestContext); + chip::Test::MessageCapturer messageLog(*this); messageLog.mCaptureStandaloneAcks = false; // Since we are dropping packets, things are not getting acked. Set up our // MRP state to look like what it would have looked like if the packet had // not gotten dropped. - PretendWeGotReplyFromServer(*mpTestContext, commandSender.mExchangeCtx.Get()); + PretendWeGotReplyFromServer(*this, commandSender.mExchangeCtx.Get()); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 0; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToAllowBeforeDropping = 0; + GetLoopback().mDroppedMessageCount = 0; EXPECT_EQ(commandSender.OnMessageReceived(commandSender.mExchangeCtx.Get(), payloadHeader, std::move(msgBuf)), CHIP_ERROR_END_OF_TLV); @@ -944,24 +924,24 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandInvalidMessage4) EXPECT_EQ(mockCommandSenderDelegate.onFinalCalledTimes, 1); EXPECT_EQ(mockCommandSenderDelegate.onErrorCalledTimes, 1); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Client sent status report with invalid action, server's exchange has been closed, so all it sent is an MRP Ack - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); CheckForInvalidAction(messageLog); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } TEST_F(TestCommandInteraction, TestCommandSender_WithWrongState) { - app::CommandSender commandSender(&mockCommandSenderDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderDelegate, &GetExchangeManager()); - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_ERROR_INCORRECT_STATE); + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_ERROR_INCORRECT_STATE); } TEST_F(TestCommandInteraction, TestCommandHandler_WithWrongState) @@ -986,14 +966,14 @@ TEST_F(TestCommandInteraction, TestCommandHandler_WithWrongState) TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandSender_WithSendCommand) { - app::CommandSender commandSender(&mockCommandSenderDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderDelegate, &GetExchangeManager()); System::PacketBufferHandle buf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); AddInvokeRequestData(&commandSender); - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); GenerateInvokeResponse(buf, kTestCommandIdWithData); bool moreChunkedMessages = false; @@ -1024,7 +1004,7 @@ TEST_F(TestCommandInteraction, TestCommandHandler_WithSendEmptyCommand) TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandSender_WithProcessReceivedMsg) { - app::CommandSender commandSender(&mockCommandSenderDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderDelegate, &GetExchangeManager()); System::PacketBufferHandle buf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); @@ -1040,8 +1020,8 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandSender_ExtendableApiWithP mockCommandSenderExtendedDelegate.ResetCounter(); PendingResponseTrackerImpl pendingResponseTracker; - app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, - &mpTestContext->GetExchangeManager(), &pendingResponseTracker); + app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, &GetExchangeManager(), + &pendingResponseTracker); uint16_t mockCommandRef = 1; pendingResponseTracker.Add(mockCommandRef); @@ -1067,8 +1047,8 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandSender_ExtendableApiWithP mockCommandSenderExtendedDelegate.ResetCounter(); PendingResponseTrackerImpl pendingResponseTracker; - app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, - &mpTestContext->GetExchangeManager(), &pendingResponseTracker); + app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, &GetExchangeManager(), + &pendingResponseTracker); uint16_t mockCommandRef = 1; pendingResponseTracker.Add(mockCommandRef); @@ -1096,8 +1076,8 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandSender_ValidateSecondLarg { mockCommandSenderExtendedDelegate.ResetCounter(); PendingResponseTrackerImpl pendingResponseTracker; - app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, - &mpTestContext->GetExchangeManager(), &pendingResponseTracker); + app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, &GetExchangeManager(), + &pendingResponseTracker); app::CommandSender::AddRequestDataParameters addRequestDataParams; @@ -1123,10 +1103,10 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandSender_ValidateSecondLarg EXPECT_EQ(commandSender.AddRequestData(commandPathParams, requestData, addRequestDataParams), CHIP_ERROR_NO_MEMORY); // Confirm that we can still send out a request with the first command. - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); EXPECT_EQ(commandSender.GetInvokeResponseMessageCount(), 0u); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(mockCommandSenderExtendedDelegate.onResponseCalledTimes, 1); EXPECT_EQ(mockCommandSenderExtendedDelegate.onFinalCalledTimes, 1); @@ -1176,13 +1156,13 @@ TEST_F(TestCommandInteraction, TestCommandHandlerInvalidMessageSync) { mockCommandSenderDelegate.ResetCounter(); - app::CommandSender commandSender(&mockCommandSenderDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderDelegate, &GetExchangeManager()); chip::isCommandDispatched = false; AddInvalidInvokeRequestData(&commandSender); - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_FALSE(chip::isCommandDispatched); EXPECT_EQ(mockCommandSenderDelegate.onResponseCalledTimes, 0); @@ -1190,7 +1170,7 @@ TEST_F(TestCommandInteraction, TestCommandHandlerInvalidMessageSync) EXPECT_EQ(mockCommandSenderDelegate.onErrorCalledTimes, 1); EXPECT_EQ(mockCommandSenderDelegate.mError, CHIP_IM_GLOBAL_STATUS(InvalidAction)); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestCommandInteraction, TestCommandHandlerCommandEncodeExternalFailure) @@ -1273,7 +1253,8 @@ TEST_F(TestCommandInteraction, TestCommandHandler_WithOnInvokeReceivedNotExistCo mockCommandHandlerDelegate.ResetCounter(); MockCommandResponder mockCommandResponder; - InteractionModel::Status status = commandHandler.OnInvokeCommandRequest(mockCommandResponder, std::move(commandDatabuf), false); + Protocols::InteractionModel::Status status = + commandHandler.OnInvokeCommandRequest(mockCommandResponder, std::move(commandDatabuf), false); EXPECT_EQ(status, Protocols::InteractionModel::Status::InvalidAction); EXPECT_TRUE(mockCommandResponder.mChunks.IsNull()); @@ -1317,18 +1298,18 @@ TEST_F(TestCommandInteraction, TestCommandSenderLegacyCallbackUnsupportedCommand { mockCommandSenderDelegate.ResetCounter(); - app::CommandSender commandSender(&mockCommandSenderDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderDelegate, &GetExchangeManager()); AddInvokeRequestData(&commandSender, kTestNonExistCommandId); - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(mockCommandSenderDelegate.onResponseCalledTimes, 0); EXPECT_EQ(mockCommandSenderDelegate.onFinalCalledTimes, 1); EXPECT_EQ(mockCommandSenderDelegate.onErrorCalledTimes, 1); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } // Because UnsupportedCommand is a path specific error we will expect it to come via on response when using Extended Path. @@ -1336,25 +1317,25 @@ TEST_F(TestCommandInteraction, TestCommandSender_ExtendableCallbackUnsupportedCo { mockCommandSenderExtendedDelegate.ResetCounter(); - app::CommandSender commandSender(&mockCommandSenderExtendedDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderExtendedDelegate, &GetExchangeManager()); AddInvokeRequestData(&commandSender, kTestNonExistCommandId); - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(mockCommandSenderExtendedDelegate.onResponseCalledTimes, 1); EXPECT_EQ(mockCommandSenderExtendedDelegate.onFinalCalledTimes, 1); EXPECT_EQ(mockCommandSenderExtendedDelegate.onErrorCalledTimes, 0); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestCommandInteraction, TestCommandSenderLegacyCallbackBuildingBatchCommandFails) { mockCommandSenderDelegate.ResetCounter(); - app::CommandSender commandSender(&mockCommandSenderDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderDelegate, &GetExchangeManager()); app::CommandSender::PrepareCommandParameters prepareCommandParams; app::CommandSender::FinishCommandParameters finishCommandParams; prepareCommandParams.SetStartDataStruct(true).SetCommandRef(0); @@ -1376,15 +1357,15 @@ TEST_F(TestCommandInteraction, TestCommandSenderLegacyCallbackBuildingBatchComma EXPECT_EQ(commandSender.PrepareCommand(commandPathParams, prepareCommandParams), CHIP_ERROR_INCORRECT_STATE); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestCommandInteraction, TestCommandSender_ExtendableCallbackBuildingBatchDuplicateCommandRefFails) { mockCommandSenderExtendedDelegate.ResetCounter(); PendingResponseTrackerImpl pendingResponseTracker; - app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, - &mpTestContext->GetExchangeManager(), &pendingResponseTracker); + app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, &GetExchangeManager(), + &pendingResponseTracker); app::CommandSender::PrepareCommandParameters prepareCommandParams; app::CommandSender::FinishCommandParameters finishCommandParams; @@ -1404,15 +1385,15 @@ TEST_F(TestCommandInteraction, TestCommandSender_ExtendableCallbackBuildingBatch EXPECT_EQ(commandSender.PrepareCommand(commandPathParams, prepareCommandParams), CHIP_ERROR_INVALID_ARGUMENT); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestCommandInteraction, TestCommandSender_ExtendableCallbackBuildingBatchCommandSuccess) { mockCommandSenderExtendedDelegate.ResetCounter(); PendingResponseTrackerImpl pendingResponseTracker; - app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, - &mpTestContext->GetExchangeManager(), &pendingResponseTracker); + app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, &GetExchangeManager(), + &pendingResponseTracker); app::CommandSender::PrepareCommandParameters prepareCommandParams; app::CommandSender::FinishCommandParameters finishCommandParams; @@ -1440,20 +1421,20 @@ TEST_F(TestCommandInteraction, TestCommandSender_ExtendableCallbackBuildingBatch EXPECT_EQ(commandSender.FinishCommand(finishCommandParams), CHIP_NO_ERROR); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestCommandInteraction, TestCommandSenderCommandSuccessResponseFlow) { mockCommandSenderDelegate.ResetCounter(); - app::CommandSender commandSender(&mockCommandSenderDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderDelegate, &GetExchangeManager()); AddInvokeRequestData(&commandSender); - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); EXPECT_EQ(commandSender.GetInvokeResponseMessageCount(), 0u); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(mockCommandSenderDelegate.onResponseCalledTimes, 1); EXPECT_EQ(mockCommandSenderDelegate.onFinalCalledTimes, 1); @@ -1462,76 +1443,76 @@ TEST_F(TestCommandInteraction, TestCommandSenderCommandSuccessResponseFlow) EXPECT_EQ(commandSender.GetInvokeResponseMessageCount(), 1u); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestCommandInteraction, TestCommandSenderCommandAsyncSuccessResponseFlow) { mockCommandSenderDelegate.ResetCounter(); - app::CommandSender commandSender(&mockCommandSenderDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderDelegate, &GetExchangeManager()); AddInvokeRequestData(&commandSender); asyncCommand = true; - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(mockCommandSenderDelegate.onResponseCalledTimes, 0); EXPECT_EQ(mockCommandSenderDelegate.onFinalCalledTimes, 0); EXPECT_EQ(mockCommandSenderDelegate.onErrorCalledTimes, 0); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 1u); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 2u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 2u); // Decrease CommandHandler refcount and send response asyncCommandHandle = nullptr; - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(mockCommandSenderDelegate.onResponseCalledTimes, 1); EXPECT_EQ(mockCommandSenderDelegate.onFinalCalledTimes, 1); EXPECT_EQ(mockCommandSenderDelegate.onErrorCalledTimes, 0); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestCommandInteraction, TestCommandSenderCommandSpecificResponseFlow) { mockCommandSenderDelegate.ResetCounter(); - app::CommandSender commandSender(&mockCommandSenderDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderDelegate, &GetExchangeManager()); AddInvokeRequestData(&commandSender, kTestCommandIdCommandSpecificResponse); - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(mockCommandSenderDelegate.onResponseCalledTimes, 1); EXPECT_EQ(mockCommandSenderDelegate.onFinalCalledTimes, 1); EXPECT_EQ(mockCommandSenderDelegate.onErrorCalledTimes, 0); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestCommandInteraction, TestCommandSenderCommandFailureResponseFlow) { mockCommandSenderDelegate.ResetCounter(); - app::CommandSender commandSender(&mockCommandSenderDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderDelegate, &GetExchangeManager()); AddInvokeRequestData(&commandSender, kTestNonExistCommandId); - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(mockCommandSenderDelegate.onResponseCalledTimes, 0); EXPECT_EQ(mockCommandSenderDelegate.onFinalCalledTimes, 1); EXPECT_EQ(mockCommandSenderDelegate.onErrorCalledTimes, 1); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestCommandInteraction, TestCommandSenderAbruptDestruction) @@ -1546,13 +1527,13 @@ TEST_F(TestCommandInteraction, TestCommandSenderAbruptDestruction) mockCommandSenderDelegate.ResetCounter(); { - app::CommandSender commandSender(&mockCommandSenderDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderDelegate, &GetExchangeManager()); AddInvokeRequestData(&commandSender, kTestCommandIdCommandSpecificResponse); - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // // No callbacks should be invoked yet - let's validate that. @@ -1561,13 +1542,13 @@ TEST_F(TestCommandInteraction, TestCommandSenderAbruptDestruction) EXPECT_EQ(mockCommandSenderDelegate.onFinalCalledTimes, 0); EXPECT_EQ(mockCommandSenderDelegate.onErrorCalledTimes, 0); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 1u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 1u); } // // Upon the sender being destructed by the application, our exchange should get cleaned up too. // - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); } @@ -1578,8 +1559,8 @@ TEST_F(TestCommandInteraction, TestCommandHandler_RejectMultipleIdenticalCommand isCommandDispatched = false; mockCommandSenderExtendedDelegate.ResetCounter(); PendingResponseTrackerImpl pendingResponseTracker; - app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, - &mpTestContext->GetExchangeManager(), &pendingResponseTracker); + app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, &GetExchangeManager(), + &pendingResponseTracker); app::CommandSender::ConfigParameters configParameters; configParameters.SetRemoteMaxPathsPerInvoke(2); @@ -1602,9 +1583,9 @@ TEST_F(TestCommandInteraction, TestCommandHandler_RejectMultipleIdenticalCommand EXPECT_EQ(CHIP_NO_ERROR, commandSender.FinishCommand(finishCommandParams)); } - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(mockCommandSenderExtendedDelegate.onResponseCalledTimes, 0); EXPECT_EQ(mockCommandSenderExtendedDelegate.onFinalCalledTimes, 1); @@ -1612,7 +1593,7 @@ TEST_F(TestCommandInteraction, TestCommandHandler_RejectMultipleIdenticalCommand EXPECT_FALSE(chip::isCommandDispatched); EXPECT_EQ(GetNumActiveCommandResponderObjects(), 0u); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } #if CONFIG_BUILD_FOR_HOST_UNIT_TEST @@ -1623,8 +1604,8 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandHandler_RejectsMultipleCo isCommandDispatched = false; mockCommandSenderExtendedDelegate.ResetCounter(); PendingResponseTrackerImpl pendingResponseTracker; - app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, - &mpTestContext->GetExchangeManager(), &pendingResponseTracker); + app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, &GetExchangeManager(), + &pendingResponseTracker); app::CommandSender::ConfigParameters configParameters; configParameters.SetRemoteMaxPathsPerInvoke(2); @@ -1668,8 +1649,8 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandHandler_RejectsMultipleCo mockCommandHandlerDelegate.ResetCounter(); commandDispatchedCount = 0; - InteractionModel::Status status = commandHandler.ProcessInvokeRequest(std::move(commandDatabuf), false); - EXPECT_EQ(status, InteractionModel::Status::InvalidAction); + Protocols::InteractionModel::Status status = commandHandler.ProcessInvokeRequest(std::move(commandDatabuf), false); + EXPECT_EQ(status, Protocols::InteractionModel::Status::InvalidAction); EXPECT_EQ(commandDispatchedCount, 0u); } @@ -1683,8 +1664,8 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandHandler_RejectMultipleCom mockCommandSenderExtendedDelegate.ResetCounter(); PendingResponseTrackerImpl pendingResponseTracker; - app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, - &mpTestContext->GetExchangeManager(), &pendingResponseTracker); + app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, &GetExchangeManager(), + &pendingResponseTracker); app::CommandSender::ConfigParameters configParameters; configParameters.SetRemoteMaxPathsPerInvoke(2); @@ -1721,8 +1702,9 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandHandler_RejectMultipleCom CommandHandlerImpl commandHandler(&mockCommandHandlerDelegate); MockCommandResponder mockCommandResponder; - InteractionModel::Status status = commandHandler.OnInvokeCommandRequest(mockCommandResponder, std::move(commandDatabuf), false); - EXPECT_EQ(status, InteractionModel::Status::InvalidAction); + Protocols::InteractionModel::Status status = + commandHandler.OnInvokeCommandRequest(mockCommandResponder, std::move(commandDatabuf), false); + EXPECT_EQ(status, Protocols::InteractionModel::Status::InvalidAction); EXPECT_TRUE(mockCommandResponder.mChunks.IsNull()); EXPECT_EQ(commandDispatchedCount, 0u); @@ -1735,8 +1717,8 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandHandler_AcceptMultipleCom mockCommandSenderExtendedDelegate.ResetCounter(); PendingResponseTrackerImpl pendingResponseTracker; - app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, - &mpTestContext->GetExchangeManager(), &pendingResponseTracker); + app::CommandSender commandSender(kCommandSenderTestOnlyMarker, &mockCommandSenderExtendedDelegate, &GetExchangeManager(), + &pendingResponseTracker); app::CommandSender::ConfigParameters configParameters; configParameters.SetRemoteMaxPathsPerInvoke(2); @@ -1777,8 +1759,8 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandHandler_AcceptMultipleCom mockCommandHandlerDelegate.ResetCounter(); commandDispatchedCount = 0; - InteractionModel::Status status = commandHandler.ProcessInvokeRequest(std::move(commandDatabuf), false); - EXPECT_EQ(status, InteractionModel::Status::Success); + Protocols::InteractionModel::Status status = commandHandler.ProcessInvokeRequest(std::move(commandDatabuf), false); + EXPECT_EQ(status, Protocols::InteractionModel::Status::Success); EXPECT_EQ(commandDispatchedCount, 2u); } @@ -1875,15 +1857,15 @@ TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandHandler_FillUpInvokeRespo TEST_F_FROM_FIXTURE(TestCommandInteraction, TestCommandHandler_ReleaseWithExchangeClosed) { - app::CommandSender commandSender(&mockCommandSenderDelegate, &mpTestContext->GetExchangeManager()); + app::CommandSender commandSender(&mockCommandSenderDelegate, &GetExchangeManager()); AddInvokeRequestData(&commandSender); asyncCommandHandle = nullptr; asyncCommand = true; - EXPECT_EQ(commandSender.SendCommandRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(commandSender.SendCommandRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Verify that async command handle has been allocated ASSERT_NE(asyncCommandHandle.Get(), nullptr); diff --git a/src/app/tests/TestDefaultThreadNetworkDirectoryStorage.cpp b/src/app/tests/TestDefaultThreadNetworkDirectoryStorage.cpp new file mode 100644 index 00000000000000..761b78afad4ff9 --- /dev/null +++ b/src/app/tests/TestDefaultThreadNetworkDirectoryStorage.cpp @@ -0,0 +1,292 @@ +/* + * + * 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 +#include +#include +#include + +#include +#include +#include + +using namespace chip; +using namespace chip::app; + +namespace { + +class TestDefaultThreadNetworkDirectoryStorage : public ::testing::Test +{ +public: + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } + +protected: + TestPersistentStorageDelegate persistentStorageDelegate; + DefaultThreadNetworkDirectoryStorage storageImpl{ persistentStorageDelegate }; + ThreadNetworkDirectoryStorage & storage = storageImpl; +}; + +TEST_F(TestDefaultThreadNetworkDirectoryStorage, TestEmptyStorage) +{ + EXPECT_GE(storage.Capacity(), 2); // can't meaningfully test with less and spec requires 2 per fabric + + { + ThreadNetworkDirectoryStorage::ExtendedPanId exPanId; + auto * iterator = storage.IterateNetworkIds(); + EXPECT_TRUE(iterator != nullptr); + EXPECT_EQ(iterator->Count(), 0u); + EXPECT_FALSE(iterator->Next(exPanId)); + iterator->Release(); + } + + ThreadNetworkDirectoryStorage::ExtendedPanId exPanId(UINT64_C(0x1122334455667788)); + EXPECT_FALSE(storage.ContainsNetwork(exPanId)); + EXPECT_EQ(storage.RemoveNetwork(exPanId), CHIP_ERROR_NOT_FOUND); + MutableByteSpan mutableSpan; + EXPECT_EQ(storage.GetNetworkDataset(exPanId, mutableSpan), CHIP_ERROR_NOT_FOUND); +} + +TEST_F(TestDefaultThreadNetworkDirectoryStorage, TestAddEmptyDataset) +{ + ThreadNetworkDirectoryStorage::ExtendedPanId exPanId(UINT64_C(0xd00fd00fdeadbeef)); + EXPECT_EQ(storage.AddOrUpdateNetwork(exPanId, ByteSpan()), CHIP_ERROR_INVALID_ARGUMENT); +} + +TEST_F(TestDefaultThreadNetworkDirectoryStorage, TestAddDatasetTooLong) +{ + ThreadNetworkDirectoryStorage::ExtendedPanId exPanId(UINT64_C(0xd00fd00fdeadbeef)); + uint8_t dataset[ThreadNetworkDirectoryStorage::kMaxThreadDatasetLen + 1] = { 1, 2, 3 }; + EXPECT_EQ(storage.AddOrUpdateNetwork(exPanId, ByteSpan(dataset)), CHIP_ERROR_INVALID_ARGUMENT); +} + +TEST_F(TestDefaultThreadNetworkDirectoryStorage, TestAddRemoveNetworks) +{ + const ThreadNetworkDirectoryStorage::ExtendedPanId panA(UINT64_C(0xd00fd00fdeadbeef)); + const uint8_t datasetA[] = { 1 }; + const uint8_t updatedDatasetA[] = { 0x11, 0x11 }; + const ThreadNetworkDirectoryStorage::ExtendedPanId panB(UINT64_C(0xe475cafef00df00d)); + const uint8_t datasetB[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; + uint8_t mutableBytes[ThreadNetworkDirectoryStorage::kMaxThreadDatasetLen]; + + // Add Pan A only + EXPECT_EQ(storage.AddOrUpdateNetwork(panA, ByteSpan(datasetA)), CHIP_NO_ERROR); + EXPECT_TRUE(storage.ContainsNetwork(panA)); + EXPECT_FALSE(storage.ContainsNetwork(panB)); + + { + MutableByteSpan retrievedDatasetA(mutableBytes); + EXPECT_EQ(storage.GetNetworkDataset(panA, retrievedDatasetA), CHIP_NO_ERROR); + EXPECT_TRUE(retrievedDatasetA.data_equal(ByteSpan(datasetA))); + } + { + MutableByteSpan emptyMutableSpan; + EXPECT_EQ(storage.GetNetworkDataset(panA, emptyMutableSpan), CHIP_ERROR_BUFFER_TOO_SMALL); + } + { + ThreadNetworkDirectoryStorage::ExtendedPanId exPanId; + auto * iterator = storage.IterateNetworkIds(); + EXPECT_TRUE(iterator != nullptr); + EXPECT_EQ(iterator->Count(), 1u); + EXPECT_TRUE(iterator->Next(exPanId)); + EXPECT_EQ(exPanId, panA); + EXPECT_NE(exPanId, panB); // just to ensure operator== is sane + EXPECT_FALSE(iterator->Next(exPanId)); + EXPECT_EQ(iterator->Count(), 1u); + iterator->Release(); + } + + // Update Pan A + EXPECT_EQ(storage.AddOrUpdateNetwork(panA, ByteSpan(updatedDatasetA)), CHIP_NO_ERROR); + EXPECT_TRUE(storage.ContainsNetwork(panA)); + EXPECT_FALSE(storage.ContainsNetwork(panB)); + + { + MutableByteSpan retrievedUpdatedDatasetA(mutableBytes); + EXPECT_EQ(storage.GetNetworkDataset(panA, retrievedUpdatedDatasetA), CHIP_NO_ERROR); + EXPECT_TRUE(retrievedUpdatedDatasetA.data_equal(ByteSpan(updatedDatasetA))); + } + { + auto * iterator = storage.IterateNetworkIds(); + EXPECT_TRUE(iterator != nullptr); + EXPECT_EQ(iterator->Count(), 1u); // still 1 + iterator->Release(); + } + + // Add Pan B + EXPECT_EQ(storage.AddOrUpdateNetwork(panB, ByteSpan(datasetB)), CHIP_NO_ERROR); + EXPECT_TRUE(storage.ContainsNetwork(panA)); + EXPECT_TRUE(storage.ContainsNetwork(panB)); + { + ThreadNetworkDirectoryStorage::ExtendedPanId exPanId1; + ThreadNetworkDirectoryStorage::ExtendedPanId exPanId2; + ThreadNetworkDirectoryStorage::ExtendedPanId unused; + auto * iterator = storage.IterateNetworkIds(); + EXPECT_TRUE(iterator != nullptr); + EXPECT_EQ(iterator->Count(), 2u); + EXPECT_TRUE(iterator->Next(exPanId1)); + EXPECT_TRUE(iterator->Next(exPanId2)); + EXPECT_TRUE((exPanId1 == panA && exPanId2 == panB) || (exPanId1 == panB && exPanId2 == panA)); + EXPECT_FALSE(iterator->Next(unused)); + EXPECT_EQ(iterator->Count(), 2u); + iterator->Release(); + } + { + MutableByteSpan retrievedDatasetB(mutableBytes); + EXPECT_EQ(storage.GetNetworkDataset(panB, retrievedDatasetB), CHIP_NO_ERROR); + EXPECT_TRUE(retrievedDatasetB.data_equal(ByteSpan(datasetB))); + } + + // Remove Pan A + EXPECT_EQ(storage.RemoveNetwork(panA), CHIP_NO_ERROR); + EXPECT_FALSE(storage.ContainsNetwork(panA)); + EXPECT_TRUE(storage.ContainsNetwork(panB)); + + { + MutableByteSpan mutableSpan; + EXPECT_EQ(storage.GetNetworkDataset(panA, mutableSpan), CHIP_ERROR_NOT_FOUND); + } + { + ThreadNetworkDirectoryStorage::ExtendedPanId exPanId; + auto * iterator = storage.IterateNetworkIds(); + EXPECT_TRUE(iterator != nullptr); + EXPECT_EQ(iterator->Count(), 1u); + EXPECT_TRUE(iterator->Next(exPanId)); + EXPECT_EQ(exPanId, panB); + EXPECT_FALSE(iterator->Next(exPanId)); + iterator->Release(); + } + + // Remove Pan B + EXPECT_EQ(storage.RemoveNetwork(panB), CHIP_NO_ERROR); + EXPECT_FALSE(storage.ContainsNetwork(panA)); + EXPECT_FALSE(storage.ContainsNetwork(panB)); + + { + MutableByteSpan mutableSpan; + EXPECT_EQ(storage.GetNetworkDataset(panB, mutableSpan), CHIP_ERROR_NOT_FOUND); + } + { + ThreadNetworkDirectoryStorage::ExtendedPanId exPanId; + auto * iterator = storage.IterateNetworkIds(); + EXPECT_TRUE(iterator != nullptr); + EXPECT_EQ(iterator->Count(), 0u); + EXPECT_FALSE(iterator->Next(exPanId)); + iterator->Release(); + } +} + +TEST_F(TestDefaultThreadNetworkDirectoryStorage, TestStorageOverflow) +{ + // Fill up the storage to capacity + uint8_t dataset[] = { 42 }; + for (uint64_t id = 0; id < storage.Capacity(); id++) + { + EXPECT_EQ(storage.AddOrUpdateNetwork(ThreadNetworkDirectoryStorage::ExtendedPanId(id), ByteSpan(dataset)), CHIP_NO_ERROR); + } + + // Capacity limit should be enforced + const ThreadNetworkDirectoryStorage::ExtendedPanId exPanId(UINT64_C(0xd00fd00fdeadbeef)); + EXPECT_EQ(storage.AddOrUpdateNetwork(exPanId, ByteSpan(dataset)), CHIP_ERROR_NO_MEMORY); + + // Updating an existing network is still possible + dataset[0] = 88; + EXPECT_EQ(storage.AddOrUpdateNetwork(ThreadNetworkDirectoryStorage::ExtendedPanId(0u), ByteSpan(dataset)), CHIP_NO_ERROR); +} + +TEST_F(TestDefaultThreadNetworkDirectoryStorage, TestAddNetworkStorageFailure) +{ + const ThreadNetworkDirectoryStorage::ExtendedPanId panA(UINT64_C(0xd00fd00fdeadbeef)); + const uint8_t datasetA[] = { 1 }; + const ThreadNetworkDirectoryStorage::ExtendedPanId panB(UINT64_C(0xe475cafef00df00d)); + uint8_t datasetB[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; + + EXPECT_EQ(storage.AddOrUpdateNetwork(panA, ByteSpan(datasetA)), CHIP_NO_ERROR); + + // Make the storage delegate return CHIP_ERROR_PERSISTED_STORAGE_FAILED for writes. + // Attempting to add a network should fail and state should be unaffected. + persistentStorageDelegate.SetRejectWrites(true); + EXPECT_EQ(storage.AddOrUpdateNetwork(panB, ByteSpan(datasetB)), CHIP_ERROR_PERSISTED_STORAGE_FAILED); + EXPECT_TRUE(storage.ContainsNetwork(panA)); + EXPECT_FALSE(storage.ContainsNetwork(panB)); + { + auto * iterator = storage.IterateNetworkIds(); + EXPECT_EQ(iterator->Count(), 1u); + iterator->Release(); + } +} + +TEST_F(TestDefaultThreadNetworkDirectoryStorage, TestAddNetworkStorageWriteIndexFailure) +{ + const ThreadNetworkDirectoryStorage::ExtendedPanId panA(UINT64_C(0xd00fd00fdeadbeef)); + const uint8_t datasetA[] = { 1 }; + const ThreadNetworkDirectoryStorage::ExtendedPanId panB(UINT64_C(0xe475cafef00df00d)); + uint8_t datasetB[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; + + EXPECT_EQ(storage.AddOrUpdateNetwork(panA, ByteSpan(datasetA)), CHIP_NO_ERROR); + + // White box test: Poison the index key specifically, so the dataset + // can be written but the subsequent update of the index fails. + // Attempting to add a network should fail and state should be unaffected. + StorageKeyName indexKey = DefaultStorageKeyAllocator::ThreadNetworkDirectoryIndex(); + persistentStorageDelegate.AddPoisonKey(indexKey.KeyName()); + EXPECT_EQ(storage.AddOrUpdateNetwork(panB, ByteSpan(datasetB)), CHIP_ERROR_PERSISTED_STORAGE_FAILED); + EXPECT_TRUE(storage.ContainsNetwork(panA)); + EXPECT_FALSE(storage.ContainsNetwork(panB)); + { + auto * iterator = storage.IterateNetworkIds(); + EXPECT_EQ(iterator->Count(), 1u); + iterator->Release(); + } +} + +TEST_F(TestDefaultThreadNetworkDirectoryStorage, TestRemoveNetworkStorageFailure) +{ + const ThreadNetworkDirectoryStorage::ExtendedPanId panA(UINT64_C(0xd00f0001)); + const ThreadNetworkDirectoryStorage::ExtendedPanId panB(UINT64_C(0xd00f0002)); + const ThreadNetworkDirectoryStorage::ExtendedPanId panC(UINT64_C(0xd00f0003)); + const uint8_t dataset[] = { 1 }; + + // Just in case the test is compiled with CHIP_CONFIG_MAX_FABRICS == 1 + bool canStorePanC = (storage.Capacity() >= 3); + + // Add Pans A, B, and C + EXPECT_EQ(storage.AddOrUpdateNetwork(panA, ByteSpan(dataset)), CHIP_NO_ERROR); + EXPECT_EQ(storage.AddOrUpdateNetwork(panB, ByteSpan(dataset)), CHIP_NO_ERROR); + if (canStorePanC) + { + EXPECT_EQ(storage.AddOrUpdateNetwork(panC, ByteSpan(dataset)), CHIP_NO_ERROR); + } + + // Make the storage delegate return CHIP_ERROR_PERSISTED_STORAGE_FAILED for writes. + // Attempting to remove a network should fail and state should be unaffected. + persistentStorageDelegate.SetRejectWrites(true); + EXPECT_EQ(storage.RemoveNetwork(panA), CHIP_ERROR_PERSISTED_STORAGE_FAILED); + EXPECT_TRUE(storage.ContainsNetwork(panA)); + EXPECT_TRUE(storage.ContainsNetwork(panB)); + if (canStorePanC) + { + EXPECT_TRUE(storage.ContainsNetwork(panC)); + } + { + auto * iterator = storage.IterateNetworkIds(); + EXPECT_EQ(iterator->Count(), canStorePanC ? 3u : 2u); + iterator->Release(); + } +} + +} // namespace diff --git a/src/app/tests/TestEventLogging.cpp b/src/app/tests/TestEventLogging.cpp index 931b706024c740..cbc42d9060e435 100644 --- a/src/app/tests/TestEventLogging.cpp +++ b/src/app/tests/TestEventLogging.cpp @@ -53,19 +53,9 @@ static uint8_t gInfoEventBuffer[120]; static uint8_t gCritEventBuffer[120]; static chip::app::CircularEventBuffer gCircularEventBuffer[3]; -class TestEventLogging : public ::testing::Test +class TestEventLogging : public chip::Test::AppContext { public: - static void SetUpTestSuite() - { - mpTestContext = new chip::Test::AppContext; - mpTestContext->SetUpTestSuite(); - } - static void TearDownTestSuite() - { - mpTestContext->TearDownTestSuite(); - delete mpTestContext; - } // Performs setup for each individual test in the test suite void SetUp() override { @@ -75,9 +65,9 @@ class TestEventLogging : public ::testing::Test { &gCritEventBuffer[0], sizeof(gCritEventBuffer), chip::app::PriorityLevel::Critical }, }; - mpTestContext->SetUp(); + AppContext::SetUp(); ASSERT_EQ(mEventCounter.Init(0), CHIP_NO_ERROR); - chip::app::EventManagement::CreateEventManagement(&mpTestContext->GetExchangeManager(), ArraySize(logStorageResources), + chip::app::EventManagement::CreateEventManagement(&GetExchangeManager(), ArraySize(logStorageResources), gCircularEventBuffer, logStorageResources, &mEventCounter); } @@ -85,17 +75,13 @@ class TestEventLogging : public ::testing::Test void TearDown() override { chip::app::EventManagement::DestroyEventManagement(); - mpTestContext->TearDown(); + AppContext::TearDown(); } - static chip::Test::AppContext * mpTestContext; - private: chip::MonotonicallyIncreasingCounter mEventCounter; }; -chip::Test::AppContext * TestEventLogging::mpTestContext = nullptr; - void ENFORCE_FORMAT(1, 2) SimpleDumpWriter(const char * aFormat, ...) { va_list args; diff --git a/src/app/tests/TestEventLoggingNoUTCTime.cpp b/src/app/tests/TestEventLoggingNoUTCTime.cpp index 907a85982c1155..f3cfc0e8a30ddc 100644 --- a/src/app/tests/TestEventLoggingNoUTCTime.cpp +++ b/src/app/tests/TestEventLoggingNoUTCTime.cpp @@ -73,14 +73,13 @@ class MockClock : public chip::System::Clock::ClockBase chip::System::Clock::ClockBase & mRealClock; }; -class TestEventLoggingNoUTCTime : public ::testing::Test +class TestEventLoggingNoUTCTime : public chip::Test::AppContext { public: // Performs shared setup for all tests in the test suite static void SetUpTestSuite() { - mpTestContext = new chip::Test::AppContext; - mpTestContext->SetUpTestSuite(); + AppContext::SetUpTestSuite(); sClock.Emplace(chip::System::SystemClock()); } @@ -88,8 +87,7 @@ class TestEventLoggingNoUTCTime : public ::testing::Test static void TearDownTestSuite() { sClock.ClearValue(); - mpTestContext->TearDownTestSuite(); - delete mpTestContext; + AppContext::TearDownTestSuite(); } // Performs setup for each individual test in the test suite @@ -101,9 +99,9 @@ class TestEventLoggingNoUTCTime : public ::testing::Test { &gCritEventBuffer[0], sizeof(gCritEventBuffer), chip::app::PriorityLevel::Critical }, }; - mpTestContext->SetUp(); + AppContext::SetUp(); ASSERT_EQ(mEventCounter.Init(0), CHIP_NO_ERROR); - chip::app::EventManagement::CreateEventManagement(&mpTestContext->GetExchangeManager(), ArraySize(logStorageResources), + chip::app::EventManagement::CreateEventManagement(&GetExchangeManager(), ArraySize(logStorageResources), gCircularEventBuffer, logStorageResources, &mEventCounter); } @@ -111,17 +109,14 @@ class TestEventLoggingNoUTCTime : public ::testing::Test void TearDown() override { chip::app::EventManagement::DestroyEventManagement(); - mpTestContext->TearDown(); + AppContext::TearDown(); } - static chip::Test::AppContext * mpTestContext; - private: chip::MonotonicallyIncreasingCounter mEventCounter; static chip::Optional sClock; }; -chip::Test::AppContext * TestEventLoggingNoUTCTime::mpTestContext = nullptr; chip::Optional TestEventLoggingNoUTCTime::sClock; void ENFORCE_FORMAT(1, 2) SimpleDumpWriter(const char * aFormat, ...) diff --git a/src/app/tests/TestEventOverflow.cpp b/src/app/tests/TestEventOverflow.cpp index 45692273c88274..4a3cc2d80c3613 100644 --- a/src/app/tests/TestEventOverflow.cpp +++ b/src/app/tests/TestEventOverflow.cpp @@ -51,20 +51,9 @@ static uint8_t gInfoEventBuffer[2048]; static uint8_t gCritEventBuffer[2048]; static chip::app::CircularEventBuffer gCircularEventBuffer[3]; -class TestEventOverflow : public ::testing::Test +class TestEventOverflow : public chip::Test::AppContext { public: - static void SetUpTestSuite() - { - mpTestContext = new chip::Test::AppContext; - mpTestContext->SetUpTestSuite(); - } - static void TearDownTestSuite() - { - mpTestContext->TearDownTestSuite(); - delete mpTestContext; - } - // Performs setup for each individual test in the test suite void SetUp() override { @@ -74,9 +63,11 @@ class TestEventOverflow : public ::testing::Test { &gCritEventBuffer[0], sizeof(gCritEventBuffer), chip::app::PriorityLevel::Critical }, }; - mpTestContext->SetUp(); + AppContext::SetUp(); + VerifyOrReturn(!HasFailure()); + ASSERT_EQ(mEventCounter.Init(0), CHIP_NO_ERROR); - chip::app::EventManagement::CreateEventManagement(&mpTestContext->GetExchangeManager(), ArraySize(logStorageResources), + chip::app::EventManagement::CreateEventManagement(&GetExchangeManager(), ArraySize(logStorageResources), gCircularEventBuffer, logStorageResources, &mEventCounter); } @@ -84,17 +75,13 @@ class TestEventOverflow : public ::testing::Test void TearDown() override { chip::app::EventManagement::DestroyEventManagement(); - mpTestContext->TearDown(); + AppContext::TearDown(); } - static chip::Test::AppContext * mpTestContext; - private: chip::MonotonicallyIncreasingCounter mEventCounter; }; -chip::Test::AppContext * TestEventOverflow::mpTestContext = nullptr; - class TestEventGenerator : public chip::app::EventLoggingDelegate { public: diff --git a/src/app/tests/TestFabricScopedEventLogging.cpp b/src/app/tests/TestFabricScopedEventLogging.cpp index d113bc692e069f..d825626688f90b 100644 --- a/src/app/tests/TestFabricScopedEventLogging.cpp +++ b/src/app/tests/TestFabricScopedEventLogging.cpp @@ -53,20 +53,9 @@ static uint8_t gInfoEventBuffer[128]; static uint8_t gCritEventBuffer[128]; static chip::app::CircularEventBuffer gCircularEventBuffer[3]; -class TestFabricScopedEventLogging : public ::testing::Test +class TestFabricScopedEventLogging : public chip::Test::AppContext { public: - static void SetUpTestSuite() - { - mpTestContext = new chip::Test::AppContext; - mpTestContext->SetUpTestSuite(); - } - static void TearDownTestSuite() - { - mpTestContext->TearDownTestSuite(); - delete mpTestContext; - } - // Performs setup for each individual test in the test suite void SetUp() override { @@ -76,10 +65,10 @@ class TestFabricScopedEventLogging : public ::testing::Test { &gCritEventBuffer[0], sizeof(gCritEventBuffer), chip::app::PriorityLevel::Critical }, }; - mpTestContext->SetUp(); + AppContext::SetUp(); ASSERT_EQ(mEventCounter.Init(0), CHIP_NO_ERROR); - chip::app::EventManagement::CreateEventManagement(&mpTestContext->GetExchangeManager(), ArraySize(logStorageResources), + chip::app::EventManagement::CreateEventManagement(&GetExchangeManager(), ArraySize(logStorageResources), gCircularEventBuffer, logStorageResources, &mEventCounter); } @@ -87,15 +76,12 @@ class TestFabricScopedEventLogging : public ::testing::Test void TearDown() override { chip::app::EventManagement::DestroyEventManagement(); - mpTestContext->TearDown(); + AppContext::TearDown(); } - static chip::Test::AppContext * mpTestContext; - private: chip::MonotonicallyIncreasingCounter mEventCounter; }; -chip::Test::AppContext * TestFabricScopedEventLogging::mpTestContext = nullptr; void ENFORCE_FORMAT(1, 2) SimpleDumpWriter(const char * aFormat, ...) { diff --git a/src/app/tests/TestFailSafeContext.cpp b/src/app/tests/TestFailSafeContext.cpp index fa13990d4f7947..8d164fad2d42db 100644 --- a/src/app/tests/TestFailSafeContext.cpp +++ b/src/app/tests/TestFailSafeContext.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include #include diff --git a/src/app/tests/TestInteractionModelEngine.cpp b/src/app/tests/TestInteractionModelEngine.cpp index 7817d3636d3fae..db79875b010f48 100644 --- a/src/app/tests/TestInteractionModelEngine.cpp +++ b/src/app/tests/TestInteractionModelEngine.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -42,8 +43,6 @@ #endif // CHIP_CONFIG_PERSIST_SUBSCRIPTIONS namespace { -using TestContext = chip::Test::AppContext; - class NullReadHandlerCallback : public chip::app::ReadHandler::ManagementCallback { public: @@ -59,39 +58,9 @@ class NullReadHandlerCallback : public chip::app::ReadHandler::ManagementCallbac namespace chip { namespace app { -class TestInteractionModelEngine : public ::testing::Test +class TestInteractionModelEngine : public chip::Test::AppContext { public: - static void SetUpTestSuite() - { - mpTestContext = new chip::Test::AppContext; - mpTestContext->SetUpTestSuite(); - } - static void TearDownTestSuite() - { - mpTestContext->TearDownTestSuite(); - if (mpTestContext != nullptr) - { - delete mpTestContext; - } - } - - void SetUp() override - { - - if (mpTestContext != nullptr) - { - mpTestContext->SetUp(); - } - } - void TearDown() override - { - if (mpTestContext != nullptr) - { - mpTestContext->TearDown(); - } - } - void TestSubjectHasActiveSubscriptionSingleSubOneEntry(); void TestSubjectHasActiveSubscriptionSingleSubMultipleEntries(); void TestSubjectHasActiveSubscriptionMultipleSubsSingleEntry(); @@ -100,12 +69,8 @@ class TestInteractionModelEngine : public ::testing::Test void TestSubscriptionResumptionTimer(); void TestDecrementNumSubscriptionsToResume(); static int GetAttributePathListLength(SingleLinkedListNode * apattributePathParamsList); - - static chip::Test::AppContext * mpTestContext; }; -chip::Test::AppContext * TestInteractionModelEngine::mpTestContext = nullptr; - int TestInteractionModelEngine::GetAttributePathListLength(SingleLinkedListNode * apAttributePathParamsList) { int length = 0; @@ -123,9 +88,7 @@ TEST_F(TestInteractionModelEngine, TestAttributePathParamsPushRelease) InteractionModelEngine * engine = InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler()), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); SingleLinkedListNode * attributePathParamsList = nullptr; AttributePathParams attributePathParams1; @@ -160,9 +123,7 @@ TEST_F(TestInteractionModelEngine, TestRemoveDuplicateConcreteAttribute) InteractionModelEngine * engine = InteractionModelEngine::GetInstance(); - EXPECT_EQ(CHIP_NO_ERROR, - engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler())); + EXPECT_EQ(CHIP_NO_ERROR, engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler())); SingleLinkedListNode * attributePathParamsList = nullptr; AttributePathParams attributePathParams1; @@ -294,20 +255,19 @@ TEST_F_FROM_FIXTURE(TestInteractionModelEngine, TestSubjectHasActiveSubscription FabricIndex bobFabricIndex = 1; // Create ExchangeContext - Messaging::ExchangeContext * exchangeCtx1 = mpTestContext->NewExchangeToBob(nullptr, false); + Messaging::ExchangeContext * exchangeCtx1 = NewExchangeToBob(nullptr, false); ASSERT_TRUE(exchangeCtx1); // InteractionModelEngine init - EXPECT_EQ(CHIP_NO_ERROR, - engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - reporting::GetDefaultReportScheduler())); + EXPECT_EQ(CHIP_NO_ERROR, engine->Init(&GetExchangeManager(), &GetFabricTable(), reporting::GetDefaultReportScheduler())); // Verify that there are no active subscriptions EXPECT_FALSE(engine->SubjectHasActiveSubscription(bobFabricIndex, bobNodeId)); // Create and setup readHandler 1 - ReadHandler * readHandler1 = engine->GetReadHandlerPool().CreateObject( - nullCallback, exchangeCtx1, ReadHandler::InteractionType::Subscribe, reporting::GetDefaultReportScheduler()); + ReadHandler * readHandler1 = + engine->GetReadHandlerPool().CreateObject(nullCallback, exchangeCtx1, ReadHandler::InteractionType::Subscribe, + reporting::GetDefaultReportScheduler(), CodegenDataModelInstance()); // Verify that Bob still doesn't have an active subscription EXPECT_FALSE(engine->SubjectHasActiveSubscription(bobFabricIndex, bobNodeId)); @@ -339,30 +299,29 @@ TEST_F_FROM_FIXTURE(TestInteractionModelEngine, TestSubjectHasActiveSubscription FabricIndex bobFabricIndex = 1; // Create ExchangeContexts - Messaging::ExchangeContext * exchangeCtx1 = mpTestContext->NewExchangeToBob(nullptr, false); + Messaging::ExchangeContext * exchangeCtx1 = NewExchangeToBob(nullptr, false); ASSERT_TRUE(exchangeCtx1); - Messaging::ExchangeContext * exchangeCtx2 = mpTestContext->NewExchangeToBob(nullptr, false); + Messaging::ExchangeContext * exchangeCtx2 = NewExchangeToBob(nullptr, false); ASSERT_TRUE(exchangeCtx1); // InteractionModelEngine init - EXPECT_EQ(CHIP_NO_ERROR, - engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - reporting::GetDefaultReportScheduler())); + EXPECT_EQ(CHIP_NO_ERROR, engine->Init(&GetExchangeManager(), &GetFabricTable(), reporting::GetDefaultReportScheduler())); // Verify that both Alice and Bob have no active subscriptions EXPECT_FALSE(engine->SubjectHasActiveSubscription(bobFabricIndex, bobNodeId)); // Create readHandler 1 engine->GetReadHandlerPool().CreateObject(nullCallback, exchangeCtx1, ReadHandler::InteractionType::Subscribe, - reporting::GetDefaultReportScheduler()); + reporting::GetDefaultReportScheduler(), CodegenDataModelInstance()); // Verify that Bob still doesn't have an active subscription EXPECT_FALSE(engine->SubjectHasActiveSubscription(bobFabricIndex, bobNodeId)); // Create and setup readHandler 2 - ReadHandler * readHandler2 = engine->GetReadHandlerPool().CreateObject( - nullCallback, exchangeCtx2, ReadHandler::InteractionType::Subscribe, reporting::GetDefaultReportScheduler()); + ReadHandler * readHandler2 = + engine->GetReadHandlerPool().CreateObject(nullCallback, exchangeCtx2, ReadHandler::InteractionType::Subscribe, + reporting::GetDefaultReportScheduler(), CodegenDataModelInstance()); // Verify that Bob still doesn't have an active subscription EXPECT_FALSE(engine->SubjectHasActiveSubscription(bobFabricIndex, bobNodeId)); @@ -398,28 +357,28 @@ TEST_F_FROM_FIXTURE(TestInteractionModelEngine, TestSubjectHasActiveSubscription FabricIndex aliceFabricIndex = 2; // Create ExchangeContexts - Messaging::ExchangeContext * exchangeCtx1 = mpTestContext->NewExchangeToBob(nullptr, false); + Messaging::ExchangeContext * exchangeCtx1 = NewExchangeToBob(nullptr, false); ASSERT_TRUE(exchangeCtx1); - Messaging::ExchangeContext * exchangeCtx2 = mpTestContext->NewExchangeToAlice(nullptr, false); + Messaging::ExchangeContext * exchangeCtx2 = NewExchangeToAlice(nullptr, false); ASSERT_TRUE(exchangeCtx2); // InteractionModelEngine init - EXPECT_EQ(CHIP_NO_ERROR, - engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - reporting::GetDefaultReportScheduler())); + EXPECT_EQ(CHIP_NO_ERROR, engine->Init(&GetExchangeManager(), &GetFabricTable(), reporting::GetDefaultReportScheduler())); // Verify that both Alice and Bob have no active subscriptions EXPECT_FALSE(engine->SubjectHasActiveSubscription(bobFabricIndex, bobNodeId)); EXPECT_FALSE(engine->SubjectHasActiveSubscription(aliceFabricIndex, aliceNodeId)); // Create and setup readHandler 1 - ReadHandler * readHandler1 = engine->GetReadHandlerPool().CreateObject( - nullCallback, exchangeCtx1, ReadHandler::InteractionType::Subscribe, reporting::GetDefaultReportScheduler()); + ReadHandler * readHandler1 = + engine->GetReadHandlerPool().CreateObject(nullCallback, exchangeCtx1, ReadHandler::InteractionType::Subscribe, + reporting::GetDefaultReportScheduler(), CodegenDataModelInstance()); // Create and setup readHandler 2 - ReadHandler * readHandler2 = engine->GetReadHandlerPool().CreateObject( - nullCallback, exchangeCtx2, ReadHandler::InteractionType::Subscribe, reporting::GetDefaultReportScheduler()); + ReadHandler * readHandler2 = + engine->GetReadHandlerPool().CreateObject(nullCallback, exchangeCtx2, ReadHandler::InteractionType::Subscribe, + reporting::GetDefaultReportScheduler(), CodegenDataModelInstance()); // Verify that Bob still doesn't have an active subscription EXPECT_FALSE(engine->SubjectHasActiveSubscription(bobFabricIndex, bobNodeId)); @@ -474,22 +433,20 @@ TEST_F_FROM_FIXTURE(TestInteractionModelEngine, TestSubjectHasActiveSubscription FabricIndex aliceFabricIndex = 2; // Create ExchangeContexts - Messaging::ExchangeContext * exchangeCtx11 = mpTestContext->NewExchangeToBob(nullptr, false); + Messaging::ExchangeContext * exchangeCtx11 = NewExchangeToBob(nullptr, false); ASSERT_TRUE(exchangeCtx11); - Messaging::ExchangeContext * exchangeCtx12 = mpTestContext->NewExchangeToBob(nullptr, false); + Messaging::ExchangeContext * exchangeCtx12 = NewExchangeToBob(nullptr, false); ASSERT_TRUE(exchangeCtx12); - Messaging::ExchangeContext * exchangeCtx21 = mpTestContext->NewExchangeToAlice(nullptr, false); + Messaging::ExchangeContext * exchangeCtx21 = NewExchangeToAlice(nullptr, false); ASSERT_TRUE(exchangeCtx21); - Messaging::ExchangeContext * exchangeCtx22 = mpTestContext->NewExchangeToAlice(nullptr, false); + Messaging::ExchangeContext * exchangeCtx22 = NewExchangeToAlice(nullptr, false); ASSERT_TRUE(exchangeCtx22); // InteractionModelEngine init - EXPECT_EQ(CHIP_NO_ERROR, - engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - reporting::GetDefaultReportScheduler())); + EXPECT_EQ(CHIP_NO_ERROR, engine->Init(&GetExchangeManager(), &GetFabricTable(), reporting::GetDefaultReportScheduler())); // Verify that both Alice and Bob have no active subscriptions EXPECT_FALSE(engine->SubjectHasActiveSubscription(bobFabricIndex, bobNodeId)); @@ -497,19 +454,21 @@ TEST_F_FROM_FIXTURE(TestInteractionModelEngine, TestSubjectHasActiveSubscription // Create and setup readHandler 1-1 engine->GetReadHandlerPool().CreateObject(nullCallback, exchangeCtx11, ReadHandler::InteractionType::Subscribe, - reporting::GetDefaultReportScheduler()); + reporting::GetDefaultReportScheduler(), CodegenDataModelInstance()); // Create and setup readHandler 1-2 - ReadHandler * readHandler12 = engine->GetReadHandlerPool().CreateObject( - nullCallback, exchangeCtx12, ReadHandler::InteractionType::Subscribe, reporting::GetDefaultReportScheduler()); + ReadHandler * readHandler12 = + engine->GetReadHandlerPool().CreateObject(nullCallback, exchangeCtx12, ReadHandler::InteractionType::Subscribe, + reporting::GetDefaultReportScheduler(), CodegenDataModelInstance()); // Create and setup readHandler 2-1 engine->GetReadHandlerPool().CreateObject(nullCallback, exchangeCtx21, ReadHandler::InteractionType::Subscribe, - reporting::GetDefaultReportScheduler()); + reporting::GetDefaultReportScheduler(), CodegenDataModelInstance()); // Create and setup readHandler 2-2 - ReadHandler * readHandler22 = engine->GetReadHandlerPool().CreateObject( - nullCallback, exchangeCtx22, ReadHandler::InteractionType::Subscribe, reporting::GetDefaultReportScheduler()); + ReadHandler * readHandler22 = + engine->GetReadHandlerPool().CreateObject(nullCallback, exchangeCtx22, ReadHandler::InteractionType::Subscribe, + reporting::GetDefaultReportScheduler(), CodegenDataModelInstance()); // Verify that both Alice and Bob have no active subscriptions EXPECT_FALSE(engine->SubjectHasActiveSubscription(bobFabricIndex, bobNodeId)); @@ -566,23 +525,22 @@ TEST_F_FROM_FIXTURE(TestInteractionModelEngine, TestSubjectHasActiveSubscription FabricIndex bobFabricIndex = 1; // InteractionModelEngine init - EXPECT_EQ(CHIP_NO_ERROR, - engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - reporting::GetDefaultReportScheduler())); + EXPECT_EQ(CHIP_NO_ERROR, engine->Init(&GetExchangeManager(), &GetFabricTable(), reporting::GetDefaultReportScheduler())); // Make sure we are using CASE sessions, because there is no defunct-marking for PASE. - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->ExpireSessionAliceToBob(); - EXPECT_EQ(CHIP_NO_ERROR, mpTestContext->CreateCASESessionBobToAlice(cats)); - EXPECT_EQ(CHIP_NO_ERROR, mpTestContext->CreateCASESessionAliceToBob(cats)); + ExpireSessionBobToAlice(); + ExpireSessionAliceToBob(); + EXPECT_EQ(CHIP_NO_ERROR, CreateCASESessionBobToAlice(cats)); + EXPECT_EQ(CHIP_NO_ERROR, CreateCASESessionAliceToBob(cats)); // Create ExchangeContexts - Messaging::ExchangeContext * exchangeCtx = mpTestContext->NewExchangeToBob(nullptr, false); + Messaging::ExchangeContext * exchangeCtx = NewExchangeToBob(nullptr, false); ASSERT_TRUE(exchangeCtx); // Create readHandler - ReadHandler * readHandler = engine->GetReadHandlerPool().CreateObject( - nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, reporting::GetDefaultReportScheduler()); + ReadHandler * readHandler = + engine->GetReadHandlerPool().CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, + reporting::GetDefaultReportScheduler(), CodegenDataModelInstance()); // Verify there are not active subscriptions EXPECT_FALSE(engine->SubjectHasActiveSubscription(bobFabricIndex, valideSubjectId)); @@ -618,8 +576,8 @@ TEST_F(TestInteractionModelEngine, TestSubjectHasPersistedSubscription) EXPECT_EQ(subscriptionStorage.Init(&storage), CHIP_NO_ERROR); EXPECT_EQ(CHIP_NO_ERROR, - engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler(), nullptr, &subscriptionStorage)); + engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler(), nullptr, + &subscriptionStorage)); NodeId nodeId1 = 1; FabricIndex fabric1 = 1; @@ -672,9 +630,7 @@ TEST_F_FROM_FIXTURE(TestInteractionModelEngine, TestSubscriptionResumptionTimer) InteractionModelEngine * engine = InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler()), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); uint32_t timeTillNextResubscriptionMs; engine->mNumSubscriptionResumptionRetries = 0; @@ -705,9 +661,7 @@ TEST_F_FROM_FIXTURE(TestInteractionModelEngine, TestDecrementNumSubscriptionsToR constexpr uint8_t kNumberOfSubsToResume = 5; uint8_t numberOfSubsRemaining = kNumberOfSubsToResume; - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler()), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); #if CHIP_CONFIG_ENABLE_ICD_CIP && !CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION ICDManager manager; diff --git a/src/app/tests/TestReadInteraction.cpp b/src/app/tests/TestReadInteraction.cpp index 561a0997afa2a8..5c712b7c0a9a4a 100644 --- a/src/app/tests/TestReadInteraction.cpp +++ b/src/app/tests/TestReadInteraction.cpp @@ -18,17 +18,17 @@ #include -#include "app/tests/test-interaction-model-api.h" -#include "lib/support/CHIPMem.h" #include #include #include #include #include #include +#include #include #include #include +#include #include #include #include @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -230,14 +231,13 @@ using Seconds16 = System::Clock::Seconds16; using Milliseconds32 = System::Clock::Milliseconds32; // TODO: Add support for a 2nd Test Context by making sSyncScheduler = true (this was not ported from NL Tests yet) -class TestReadInteraction : public ::testing::Test +class TestReadInteraction : public chip::Test::AppContext { public: static void SetUpTestSuite() { - mpTestContext = new chip::Test::AppContext; - mpTestContext->SetUpTestSuite(); + AppContext::SetUpTestSuite(); gRealClock = &chip::System::SystemClock(); chip::System::Clock::Internal::SetSystemClockForTesting(&gMockClock); @@ -256,8 +256,7 @@ class TestReadInteraction : public ::testing::Test { chip::System::Clock::Internal::SetSystemClockForTesting(gRealClock); - mpTestContext->TearDownTestSuite(); - delete mpTestContext; + AppContext::TearDownTestSuite(); } void SetUp() @@ -268,20 +267,20 @@ class TestReadInteraction : public ::testing::Test { &gCritEventBuffer[0], sizeof(gCritEventBuffer), chip::app::PriorityLevel::Critical }, }; - mpTestContext->SetUp(); + AppContext::SetUp(); ASSERT_EQ(mEventCounter.Init(0), CHIP_NO_ERROR); - chip::app::EventManagement::CreateEventManagement(&mpTestContext->GetExchangeManager(), ArraySize(logStorageResources), + chip::app::EventManagement::CreateEventManagement(&GetExchangeManager(), ArraySize(logStorageResources), gCircularEventBuffer, logStorageResources, &mEventCounter); + mOldModel = InteractionModelEngine::GetInstance()->SetDataModel(&TestImCustomDataModel::Instance()); } void TearDown() { + InteractionModelEngine::GetInstance()->SetDataModel(mOldModel); chip::app::EventManagement::DestroyEventManagement(); - mpTestContext->TearDown(); + AppContext::TearDown(); } - static chip::Test::AppContext * mpTestContext; - void TestReadClient(); void TestReadUnexpectedSubscriptionId(); void TestReadHandler(); @@ -332,10 +331,10 @@ class TestReadInteraction : public ::testing::Test protected: chip::MonotonicallyIncreasingCounter mEventCounter; static bool sSyncScheduler; + chip::app::InteractionModel::DataModel * mOldModel = nullptr; }; -chip::Test::AppContext * TestReadInteraction::mpTestContext = nullptr; -bool TestReadInteraction::sSyncScheduler = false; +bool TestReadInteraction::sSyncScheduler = false; void TestReadInteraction::GenerateReportData(System::PacketBufferHandle & aPayload, ReportType aReportType, bool aSuppressResponse, bool aHasSubscriptionId = false) @@ -420,19 +419,19 @@ void TestReadInteraction::GenerateReportData(System::PacketBufferHandle & aPaylo TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClient) { MockInteractionModelApp delegate; - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); System::PacketBufferHandle buf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); // We don't actually want to deliver that message, because we want to // synthesize the read response. But we don't want it hanging around // forever either. - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->DrainAndServiceIO(); + GetLoopback().mNumMessagesToDrop = 1; + DrainAndServiceIO(); GenerateReportData(buf, ReportType::kValid, true /* aSuppressResponse*/); EXPECT_EQ(readClient.ProcessReportData(std::move(buf), ReadClient::ReportType::kContinuingTransaction), CHIP_NO_ERROR); @@ -441,19 +440,19 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClient) TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadUnexpectedSubscriptionId) { MockInteractionModelApp delegate; - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); System::PacketBufferHandle buf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); // We don't actually want to deliver that message, because we want to // synthesize the read response. But we don't want it hanging around // forever either. - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->DrainAndServiceIO(); + GetLoopback().mNumMessagesToDrop = 1; + DrainAndServiceIO(); // For read, we don't expect there is subscription id in report data. GenerateReportData(buf, ReportType::kValid, true /* aSuppressResponse*/, true /*aHasSubscriptionId*/); @@ -470,12 +469,12 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadHandler) NullReadHandlerCallback nullCallback; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); { - Messaging::ExchangeContext * exchangeCtx = mpTestContext->NewExchangeToAlice(nullptr, false); - ReadHandler readHandler(nullCallback, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, gReportScheduler); + Messaging::ExchangeContext * exchangeCtx = NewExchangeToAlice(nullptr, false); + ReadHandler readHandler(nullCallback, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, gReportScheduler, + CodegenDataModelInstance()); GenerateReportData(reportDatabuf, ReportType::kValid, false /* aSuppressResponse*/); EXPECT_EQ(readHandler.SendReportData(std::move(reportDatabuf), false), CHIP_ERROR_INCORRECT_STATE); @@ -507,7 +506,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadHandler) engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClientGenerateAttributePathList) @@ -521,7 +520,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClientGenerateAttributePathList writer.Init(std::move(msgBuf)); EXPECT_EQ(request.Init(&writer), CHIP_NO_ERROR); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); AttributePathParams attributePathParams[2]; @@ -545,7 +544,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClientGenerateInvalidAttributeP EXPECT_FALSE(msgBuf.IsNull()); writer.Init(std::move(msgBuf)); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); EXPECT_EQ(request.Init(&writer), CHIP_NO_ERROR); @@ -567,17 +566,17 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClientInvalidReport) System::PacketBufferHandle buf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); // We don't actually want to deliver that message, because we want to // synthesize the read response. But we don't want it hanging around // forever either. - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->DrainAndServiceIO(); + GetLoopback().mNumMessagesToDrop = 1; + DrainAndServiceIO(); GenerateReportData(buf, ReportType::kInvalidNoAttributeId, true /* aSuppressResponse*/); @@ -591,17 +590,17 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClientInvalidAttributeId) System::PacketBufferHandle buf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); // We don't actually want to deliver that message, because we want to // synthesize the read response. But we don't want it hanging around // forever either. - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->DrainAndServiceIO(); + GetLoopback().mNumMessagesToDrop = 1; + DrainAndServiceIO(); GenerateReportData(buf, ReportType::kInvalidOutOfRangeAttributeId, true /* aSuppressResponse*/); @@ -626,12 +625,12 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadHandlerInvalidAttributePath) NullReadHandlerCallback nullCallback; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); { - Messaging::ExchangeContext * exchangeCtx = mpTestContext->NewExchangeToAlice(nullptr, false); - ReadHandler readHandler(nullCallback, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, gReportScheduler); + Messaging::ExchangeContext * exchangeCtx = NewExchangeToAlice(nullptr, false); + ReadHandler readHandler(nullCallback, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, gReportScheduler, + CodegenDataModelInstance()); GenerateReportData(reportDatabuf, ReportType::kValid, false /* aSuppressResponse*/); EXPECT_EQ(readHandler.SendReportData(std::move(reportDatabuf), false), CHIP_ERROR_INCORRECT_STATE); @@ -669,7 +668,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadHandlerInvalidAttributePath) } engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClientGenerateOneEventPaths) @@ -683,7 +682,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClientGenerateOneEventPaths) writer.Init(std::move(msgBuf)); EXPECT_EQ(request.Init(&writer), CHIP_NO_ERROR); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); chip::app::EventPathParams eventPathParams[1]; @@ -710,7 +709,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClientGenerateOneEventPaths) readRequestParser.PrettyPrint(); #endif - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClientGenerateTwoEventPaths) @@ -724,7 +723,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClientGenerateTwoEventPaths) writer.Init(std::move(msgBuf)); EXPECT_EQ(request.Init(&writer), CHIP_NO_ERROR); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); chip::app::EventPathParams eventPathParams[2]; @@ -755,13 +754,13 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClientGenerateTwoEventPaths) readRequestParser.PrettyPrint(); #endif - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestReadInteraction, TestReadRoundtrip) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); @@ -769,8 +768,7 @@ TEST_F(TestReadInteraction, TestReadRoundtrip) MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); chip::app::EventPathParams eventPathParams[1]; @@ -787,7 +785,7 @@ TEST_F(TestReadInteraction, TestReadRoundtrip) attributePathParams[1].mAttributeId = 2; attributePathParams[1].mListIndex = 1; - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpEventPathParamsList = eventPathParams; readPrepareParams.mEventPathParamsListSize = 1; readPrepareParams.mpAttributePathParamsList = attributePathParams; @@ -795,12 +793,12 @@ TEST_F(TestReadInteraction, TestReadRoundtrip) readPrepareParams.mEventNumber.SetValue(1); { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumDataElementIndex, 1); EXPECT_TRUE(delegate.mGotEventResponse); @@ -814,12 +812,12 @@ TEST_F(TestReadInteraction, TestReadRoundtrip) } { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotEventResponse); EXPECT_EQ(delegate.mNumAttributeResponse, 2); @@ -833,13 +831,13 @@ TEST_F(TestReadInteraction, TestReadRoundtrip) EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestReadInteraction, TestReadRoundtripWithDataVersionFilter) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); @@ -847,8 +845,7 @@ TEST_F(TestReadInteraction, TestReadRoundtripWithDataVersionFilter) MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); chip::app::AttributePathParams attributePathParams[2]; @@ -866,19 +863,19 @@ TEST_F(TestReadInteraction, TestReadRoundtripWithDataVersionFilter) dataVersionFilters[0].mClusterId = kTestClusterId; dataVersionFilters[0].mDataVersion.SetValue(kTestDataVersion1); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpAttributePathParamsList = attributePathParams; readPrepareParams.mAttributePathParamsListSize = 2; readPrepareParams.mpDataVersionFilterList = dataVersionFilters; readPrepareParams.mDataVersionFilterListSize = 1; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 0); delegate.mNumAttributeResponse = 0; @@ -886,13 +883,13 @@ TEST_F(TestReadInteraction, TestReadRoundtripWithDataVersionFilter) EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestReadInteraction, TestReadRoundtripWithNoMatchPathDataVersionFilter) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); @@ -900,8 +897,7 @@ TEST_F(TestReadInteraction, TestReadRoundtripWithNoMatchPathDataVersionFilter) MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); chip::app::AttributePathParams attributePathParams[2]; attributePathParams[0].mEndpointId = kTestEndpointId; @@ -922,19 +918,19 @@ TEST_F(TestReadInteraction, TestReadRoundtripWithNoMatchPathDataVersionFilter) dataVersionFilters[1].mClusterId = kTestClusterId; dataVersionFilters[1].mDataVersion.SetValue(kTestDataVersion2); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpAttributePathParamsList = attributePathParams; readPrepareParams.mAttributePathParamsListSize = 2; readPrepareParams.mpDataVersionFilterList = dataVersionFilters; readPrepareParams.mDataVersionFilterListSize = 2; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 2); EXPECT_FALSE(delegate.mReadError); @@ -943,13 +939,13 @@ TEST_F(TestReadInteraction, TestReadRoundtripWithNoMatchPathDataVersionFilter) EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestReadInteraction, TestReadRoundtripWithMultiSamePathDifferentDataVersionFilter) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); @@ -957,8 +953,7 @@ TEST_F(TestReadInteraction, TestReadRoundtripWithMultiSamePathDifferentDataVersi MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); chip::app::AttributePathParams attributePathParams[2]; @@ -980,19 +975,19 @@ TEST_F(TestReadInteraction, TestReadRoundtripWithMultiSamePathDifferentDataVersi dataVersionFilters[1].mClusterId = kTestClusterId; dataVersionFilters[1].mDataVersion.SetValue(kTestDataVersion2); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpAttributePathParamsList = attributePathParams; readPrepareParams.mAttributePathParamsListSize = 2; readPrepareParams.mpDataVersionFilterList = dataVersionFilters; readPrepareParams.mDataVersionFilterListSize = 2; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 2); EXPECT_FALSE(delegate.mReadError); @@ -1001,13 +996,13 @@ TEST_F(TestReadInteraction, TestReadRoundtripWithMultiSamePathDifferentDataVersi EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestReadInteraction, TestReadRoundtripWithSameDifferentPathsDataVersionFilter) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); @@ -1015,8 +1010,7 @@ TEST_F(TestReadInteraction, TestReadRoundtripWithSameDifferentPathsDataVersionFi MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); chip::app::AttributePathParams attributePathParams[2]; @@ -1038,19 +1032,19 @@ TEST_F(TestReadInteraction, TestReadRoundtripWithSameDifferentPathsDataVersionFi dataVersionFilters[1].mClusterId = kTestClusterId; dataVersionFilters[1].mDataVersion.SetValue(kTestDataVersion2); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpAttributePathParamsList = attributePathParams; readPrepareParams.mAttributePathParamsListSize = 2; readPrepareParams.mpDataVersionFilterList = dataVersionFilters; readPrepareParams.mDataVersionFilterListSize = 2; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 0); EXPECT_FALSE(delegate.mReadError); @@ -1059,13 +1053,13 @@ TEST_F(TestReadInteraction, TestReadRoundtripWithSameDifferentPathsDataVersionFi EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestReadInteraction, TestReadWildcard) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); @@ -1073,15 +1067,14 @@ TEST_F(TestReadInteraction, TestReadWildcard) MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); chip::app::AttributePathParams attributePathParams[1]; attributePathParams[0].mEndpointId = chip::Test::kMockEndpoint2; attributePathParams[0].mClusterId = chip::Test::MockClusterId(3); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpEventPathParamsList = nullptr; readPrepareParams.mEventPathParamsListSize = 0; readPrepareParams.mpAttributePathParamsList = attributePathParams; @@ -1089,12 +1082,12 @@ TEST_F(TestReadInteraction, TestReadWildcard) { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 5); EXPECT_TRUE(delegate.mGotReport); EXPECT_FALSE(delegate.mReadError); @@ -1105,14 +1098,14 @@ TEST_F(TestReadInteraction, TestReadWildcard) EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } // TestReadChunking will try to read a few large attributes, the report won't fit into the MTU and result in chunking. TEST_F(TestReadInteraction, TestReadChunking) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); @@ -1120,8 +1113,7 @@ TEST_F(TestReadInteraction, TestReadChunking) MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); chip::app::AttributePathParams attributePathParams[1]; @@ -1131,19 +1123,19 @@ TEST_F(TestReadInteraction, TestReadChunking) attributePathParams[0].mClusterId = chip::Test::MockClusterId(2); attributePathParams[0].mAttributeId = chip::Test::MockAttributeId(4); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpEventPathParamsList = nullptr; readPrepareParams.mEventPathParamsListSize = 0; readPrepareParams.mpAttributePathParamsList = attributePathParams; readPrepareParams.mAttributePathParamsListSize = 1; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // We get one chunk with 4 array elements, and then one chunk per // element, and the total size of the array is @@ -1159,21 +1151,20 @@ TEST_F(TestReadInteraction, TestReadChunking) EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestReadInteraction, TestSetDirtyBetweenChunks) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); GenerateEvents(); auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); chip::app::AttributePathParams attributePathParams[2]; for (auto & attributePathParam : attributePathParams) @@ -1183,7 +1174,7 @@ TEST_F(TestReadInteraction, TestSetDirtyBetweenChunks) attributePathParam.mAttributeId = chip::Test::MockAttributeId(4); } - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpEventPathParamsList = nullptr; readPrepareParams.mEventPathParamsListSize = 0; readPrepareParams.mpAttributePathParamsList = attributePathParams; @@ -1283,12 +1274,12 @@ TEST_F(TestReadInteraction, TestSetDirtyBetweenChunks) DirtyingMockDelegate delegate(attributePathParams, currentAttributeResponsesWhenSetDirty, currentArrayItemsWhenSetDirty); EXPECT_FALSE(delegate.mGotEventResponse); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Our list has length kMockAttribute4ListLength. Since the underlying // path iterator should be reset to the beginning of the cluster it is @@ -1309,13 +1300,13 @@ TEST_F(TestReadInteraction, TestSetDirtyBetweenChunks) EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestReadInteraction, TestReadInvalidAttributePathRoundtrip) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); @@ -1323,8 +1314,7 @@ TEST_F(TestReadInteraction, TestReadInvalidAttributePathRoundtrip) MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); chip::app::AttributePathParams attributePathParams[2]; @@ -1332,17 +1322,17 @@ TEST_F(TestReadInteraction, TestReadInvalidAttributePathRoundtrip) attributePathParams[0].mClusterId = kInvalidTestClusterId; attributePathParams[0].mAttributeId = 1; - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpAttributePathParamsList = attributePathParams; readPrepareParams.mAttributePathParamsListSize = 1; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 0); // By now we should have closed all exchanges and sent all pending acks, so @@ -1351,7 +1341,7 @@ TEST_F(TestReadInteraction, TestReadInvalidAttributePathRoundtrip) } engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F_FROM_FIXTURE(TestReadInteraction, TestProcessSubscribeRequest) @@ -1360,13 +1350,13 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestProcessSubscribeRequest) System::PacketBufferHandle subscribeRequestbuf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); SubscribeRequestMessage::Builder subscribeRequestBuilder; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); - Messaging::ExchangeContext * exchangeCtx = mpTestContext->NewExchangeToAlice(nullptr, false); + Messaging::ExchangeContext * exchangeCtx = NewExchangeToAlice(nullptr, false); { - ReadHandler readHandler(*engine, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, gReportScheduler); + ReadHandler readHandler(*engine, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, gReportScheduler, + CodegenDataModelInstance()); writer.Init(std::move(subscribeRequestbuf)); EXPECT_EQ(subscribeRequestBuilder.Init(&writer), CHIP_NO_ERROR); @@ -1403,7 +1393,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestProcessSubscribeRequest) engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } #if CHIP_CONFIG_ENABLE_ICD_SERVER @@ -1417,16 +1407,16 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestICDProcessSubscribeRequestSupMaxInt System::PacketBufferHandle subscribeRequestbuf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); SubscribeRequestMessage::Builder subscribeRequestBuilder; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); uint16_t kMinInterval = 0; uint16_t kMaxIntervalCeiling = 1; - Messaging::ExchangeContext * exchangeCtx = mpTestContext->NewExchangeToAlice(nullptr, false); + Messaging::ExchangeContext * exchangeCtx = NewExchangeToAlice(nullptr, false); { - ReadHandler readHandler(*engine, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, gReportScheduler); + ReadHandler readHandler(*engine, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, gReportScheduler, + CodegenDataModelInstance()); writer.Init(std::move(subscribeRequestbuf)); EXPECT_EQ(subscribeRequestBuilder.Init(&writer), CHIP_NO_ERROR); @@ -1471,7 +1461,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestICDProcessSubscribeRequestSupMaxInt } engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } /** @@ -1484,16 +1474,16 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestICDProcessSubscribeRequestInfMaxInt System::PacketBufferHandle subscribeRequestbuf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); SubscribeRequestMessage::Builder subscribeRequestBuilder; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); uint16_t kMinInterval = 0; uint16_t kMaxIntervalCeiling = 1; - Messaging::ExchangeContext * exchangeCtx = mpTestContext->NewExchangeToAlice(nullptr, false); + Messaging::ExchangeContext * exchangeCtx = NewExchangeToAlice(nullptr, false); { - ReadHandler readHandler(*engine, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, gReportScheduler); + ReadHandler readHandler(*engine, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, gReportScheduler, + CodegenDataModelInstance()); writer.Init(std::move(subscribeRequestbuf)); EXPECT_EQ(subscribeRequestBuilder.Init(&writer), CHIP_NO_ERROR); @@ -1538,7 +1528,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestICDProcessSubscribeRequestInfMaxInt } engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } /** @@ -1551,16 +1541,16 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestICDProcessSubscribeRequestSupMinInt System::PacketBufferHandle subscribeRequestbuf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); SubscribeRequestMessage::Builder subscribeRequestBuilder; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); uint16_t kMinInterval = 305; // Default IdleModeDuration is 300 uint16_t kMaxIntervalCeiling = 605; - Messaging::ExchangeContext * exchangeCtx = mpTestContext->NewExchangeToAlice(nullptr, false); + Messaging::ExchangeContext * exchangeCtx = NewExchangeToAlice(nullptr, false); { - ReadHandler readHandler(*engine, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, gReportScheduler); + ReadHandler readHandler(*engine, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, gReportScheduler, + CodegenDataModelInstance()); writer.Init(std::move(subscribeRequestbuf)); EXPECT_EQ(subscribeRequestBuilder.Init(&writer), CHIP_NO_ERROR); @@ -1605,7 +1595,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestICDProcessSubscribeRequestSupMinInt } engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } /** @@ -1618,16 +1608,16 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestICDProcessSubscribeRequestMaxMinInt System::PacketBufferHandle subscribeRequestbuf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); SubscribeRequestMessage::Builder subscribeRequestBuilder; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); uint16_t kMinInterval = System::Clock::Seconds16::max().count(); uint16_t kMaxIntervalCeiling = System::Clock::Seconds16::max().count(); - Messaging::ExchangeContext * exchangeCtx = mpTestContext->NewExchangeToAlice(nullptr, false); + Messaging::ExchangeContext * exchangeCtx = NewExchangeToAlice(nullptr, false); { - ReadHandler readHandler(*engine, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, gReportScheduler); + ReadHandler readHandler(*engine, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, gReportScheduler, + CodegenDataModelInstance()); writer.Init(std::move(subscribeRequestbuf)); EXPECT_EQ(subscribeRequestBuilder.Init(&writer), CHIP_NO_ERROR); @@ -1670,7 +1660,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestICDProcessSubscribeRequestMaxMinInt } engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } /** @@ -1683,16 +1673,16 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestICDProcessSubscribeRequestInvalidId System::PacketBufferHandle subscribeRequestbuf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); SubscribeRequestMessage::Builder subscribeRequestBuilder; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); uint16_t kMinInterval = 400; uint16_t kMaxIntervalCeiling = 400; - Messaging::ExchangeContext * exchangeCtx = mpTestContext->NewExchangeToAlice(nullptr, false); + Messaging::ExchangeContext * exchangeCtx = NewExchangeToAlice(nullptr, false); { - ReadHandler readHandler(*engine, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, gReportScheduler); + ReadHandler readHandler(*engine, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, gReportScheduler, + CodegenDataModelInstance()); writer.Init(std::move(subscribeRequestbuf)); EXPECT_EQ(subscribeRequestBuilder.Init(&writer), CHIP_NO_ERROR); @@ -1735,7 +1725,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestICDProcessSubscribeRequestInvalidId } engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } #endif // CHIP_CONFIG_ENABLE_ICD_SERVER @@ -1743,18 +1733,17 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestICDProcessSubscribeRequestInvalidId TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeRoundtrip) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::EventPathParams eventPathParams[2]; readPrepareParams.mpEventPathParamsList = eventPathParams; readPrepareParams.mpEventPathParamsList[0].mEndpointId = kTestEventEndpointId; @@ -1784,12 +1773,12 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeRoundtrip) printf("\nSend first subscribe request message to Node: 0x" ChipLogFormatX64 "\n", ChipLogValueX64(chip::kTestDeviceNodeId)); { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); } @@ -1798,12 +1787,12 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeRoundtrip) readPrepareParams.mKeepSubscriptions = false; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); delegate.mGotReport = false; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 1u); ASSERT_NE(engine->ActiveHandlerAt(0), nullptr); @@ -1844,7 +1833,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeRoundtrip) // Advance monotonic timestamp for min interval to elapse gMockClock.AdvanceMonotonic(System::Clock::Seconds16(readPrepareParams.mMinIntervalFloorSeconds)); - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); delegate.mGotReport = false; delegate.mGotEventResponse = false; @@ -1854,7 +1843,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeRoundtrip) EXPECT_EQ(engine->GetReportingEngine().SetDirty(dirtyPath2), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); EXPECT_TRUE(delegate.mGotEventResponse); @@ -1863,7 +1852,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeRoundtrip) // Test report with 2 different path, and 1 same path // Advance monotonic timestamp for min interval to elapse gMockClock.AdvanceMonotonic(System::Clock::Seconds16(readPrepareParams.mMinIntervalFloorSeconds)); - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); delegate.mGotReport = false; delegate.mNumAttributeResponse = 0; @@ -1871,7 +1860,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeRoundtrip) EXPECT_EQ(engine->GetReportingEngine().SetDirty(dirtyPath2), CHIP_NO_ERROR); EXPECT_EQ(engine->GetReportingEngine().SetDirty(dirtyPath2), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); EXPECT_EQ(delegate.mNumAttributeResponse, 2); @@ -1879,7 +1868,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeRoundtrip) // Test report with 3 different path, and one path is overlapped with another // Advance monotonic timestamp for min interval to elapse gMockClock.AdvanceMonotonic(System::Clock::Seconds16(readPrepareParams.mMinIntervalFloorSeconds)); - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); delegate.mGotReport = false; delegate.mNumAttributeResponse = 0; @@ -1887,7 +1876,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeRoundtrip) EXPECT_EQ(engine->GetReportingEngine().SetDirty(dirtyPath2), CHIP_NO_ERROR); EXPECT_EQ(engine->GetReportingEngine().SetDirty(dirtyPath3), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); EXPECT_EQ(delegate.mNumAttributeResponse, 2); @@ -1895,7 +1884,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeRoundtrip) // Test report with 3 different path, all are not overlapped, one path is not interested for current subscription // Advance monotonic timestamp for min interval to elapse gMockClock.AdvanceMonotonic(System::Clock::Seconds16(readPrepareParams.mMinIntervalFloorSeconds)); - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); delegate.mGotReport = false; delegate.mNumAttributeResponse = 0; @@ -1903,7 +1892,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeRoundtrip) EXPECT_EQ(engine->GetReportingEngine().SetDirty(dirtyPath2), CHIP_NO_ERROR); EXPECT_EQ(engine->GetReportingEngine().SetDirty(dirtyPath4), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); EXPECT_EQ(delegate.mNumAttributeResponse, 2); @@ -1915,13 +1904,13 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeRoundtrip) // Test empty report // Advance monotonic timestamp for min interval to elapse gMockClock.AdvanceMonotonic(System::Clock::Seconds16(maxInterval)); - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); EXPECT_TRUE(engine->GetReportingEngine().IsRunScheduled()); delegate.mGotReport = false; delegate.mNumAttributeResponse = 0; - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 0); } @@ -1932,23 +1921,22 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeRoundtrip) EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeEarlyReport) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::EventPathParams eventPathParams[1]; readPrepareParams.mpEventPathParamsList = eventPathParams; readPrepareParams.mpEventPathParamsList[0].mEndpointId = kTestEventEndpointId; @@ -1965,13 +1953,13 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeEarlyReport) readPrepareParams.mKeepSubscriptions = true; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); readPrepareParams.mpEventPathParamsList[0].mIsUrgentEvent = true; delegate.mGotEventResponse = false; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); System::Clock::Timestamp startTime = gMockClock.GetMonotonicTimestamp(); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 1u); @@ -2009,7 +1997,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeEarlyReport) gMockClock.AdvanceMonotonic(Seconds16(readPrepareParams.mMinIntervalFloorSeconds)); EXPECT_FALSE(InteractionModelEngine::GetInstance()->GetReportingEngine().IsRunScheduled()); // Service Timer expired event - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); EXPECT_GT(gReportScheduler->GetMinTimestampForHandler(delegate.mpReadHandler), gMockClock.GetMonotonicTimestamp()); @@ -2021,10 +2009,10 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeEarlyReport) EXPECT_TRUE(InteractionModelEngine::GetInstance()->GetReportingEngine().IsRunScheduled()); // Service Engine Run - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); // Service EventManagement event - mpTestContext->GetIOContext().DriveIO(); - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); + GetIOContext().DriveIO(); EXPECT_TRUE(delegate.mGotEventResponse); } else @@ -2040,14 +2028,14 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeEarlyReport) gMockClock.AdvanceMonotonic(Milliseconds32(50)); // Service Timer expired event - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); EXPECT_TRUE(InteractionModelEngine::GetInstance()->GetReportingEngine().IsRunScheduled()); // Service Engine Run - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); // Service EventManagement event - mpTestContext->GetIOContext().DriveIO(); - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); + GetIOContext().DriveIO(); EXPECT_TRUE(delegate.mGotEventResponse); } @@ -2074,7 +2062,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeEarlyReport) EXPECT_FALSE(InteractionModelEngine::GetInstance()->GetReportingEngine().IsRunScheduled()); // Service Timer expired event - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); // Verify the ReadHandler is considered as reportable even if its node's min timestamp has not expired EXPECT_GT(gReportScheduler->GetMaxTimestampForHandler(delegate.mpReadHandler), gMockClock.GetMonotonicTimestamp()); @@ -2083,35 +2071,34 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeEarlyReport) EXPECT_FALSE(delegate.mpReadHandler->IsDirty()); EXPECT_TRUE(InteractionModelEngine::GetInstance()->GetReportingEngine().IsRunScheduled()); // Service Engine Run - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); // Service EventManagement event - mpTestContext->GetIOContext().DriveIO(); - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); + GetIOContext().DriveIO(); EXPECT_TRUE(gReportScheduler->IsReportScheduled(delegate.mpReadHandler)); EXPECT_FALSE(InteractionModelEngine::GetInstance()->GetReportingEngine().IsRunScheduled()); } - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeUrgentWildcardEvent) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; MockInteractionModelApp nonUrgentDelegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); EXPECT_FALSE(nonUrgentDelegate.mGotEventResponse); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::EventPathParams eventPathParams[2]; readPrepareParams.mpEventPathParamsList = eventPathParams; readPrepareParams.mpEventPathParamsList[0].mEndpointId = kTestEventEndpointId; @@ -2134,18 +2121,18 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeUrgentWildcardEvent) readPrepareParams.mKeepSubscriptions = true; { - app::ReadClient nonUrgentReadClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), + app::ReadClient nonUrgentReadClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), nonUrgentDelegate, chip::app::ReadClient::InteractionType::Subscribe); nonUrgentDelegate.mGotReport = false; EXPECT_EQ(nonUrgentReadClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); readPrepareParams.mpEventPathParamsList[0].mIsUrgentEvent = true; delegate.mGotReport = false; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); System::Clock::Timestamp startTime = gMockClock.GetMonotonicTimestamp(); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 2u); @@ -2178,7 +2165,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeUrgentWildcardEvent) // Advance monotonic looping to allow events to trigger gMockClock.AdvanceMonotonic(System::Clock::Milliseconds32(600)); - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); EXPECT_FALSE(delegate.mGotEventResponse); EXPECT_FALSE(nonUrgentDelegate.mGotEventResponse); @@ -2187,13 +2174,13 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeUrgentWildcardEvent) gMockClock.AdvanceMonotonic(System::Clock::Milliseconds32(800)); // Service Timer expired event - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); // Service Engine Run - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); // Service EventManagement event - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); EXPECT_TRUE(delegate.mGotEventResponse); @@ -2217,7 +2204,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeUrgentWildcardEvent) // Advance monotonic timestamp for min interval to elapse gMockClock.AdvanceMonotonic(System::Clock::Milliseconds32(2100)); - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); // No reporting should have happened. EXPECT_FALSE(delegate.mGotEventResponse); @@ -2260,7 +2247,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeUrgentWildcardEvent) EXPECT_FALSE(delegate.mGotEventResponse); EXPECT_FALSE(nonUrgentDelegate.mGotEventResponse); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Should get those urgent events reported. EXPECT_TRUE(delegate.mGotEventResponse); @@ -2286,7 +2273,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeUrgentWildcardEvent) // Advance monotonic timestamp for min interval to elapse gMockClock.AdvanceMonotonic(System::Clock::Milliseconds32(2100)); - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); // No reporting should have happened. EXPECT_FALSE(delegate.mGotEventResponse); @@ -2324,7 +2311,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeUrgentWildcardEvent) EXPECT_FALSE(delegate.mGotEventResponse); EXPECT_FALSE(nonUrgentDelegate.mGotEventResponse); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Should get those urgent events reported and the non urgent reported for synchronisation EXPECT_TRUE(delegate.mGotEventResponse); @@ -2338,13 +2325,13 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeUrgentWildcardEvent) EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestReadInteraction, TestSubscribeWildcard) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); @@ -2352,11 +2339,10 @@ TEST_F(TestReadInteraction, TestSubscribeWildcard) MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mEventPathParamsListSize = 0; std::unique_ptr attributePathParams(new chip::app::AttributePathParams[2]); @@ -2369,7 +2355,7 @@ TEST_F(TestReadInteraction, TestSubscribeWildcard) printf("\nSend subscribe request message to Node: 0x" ChipLogFormatX64 "\n", ChipLogValueX64(chip::kTestDeviceNodeId)); { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); delegate.mGotReport = false; @@ -2377,7 +2363,7 @@ TEST_F(TestReadInteraction, TestSubscribeWildcard) attributePathParams.release(); EXPECT_EQ(readClient.SendAutoResubscribeRequest(std::move(readPrepareParams)), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); @@ -2439,7 +2425,7 @@ TEST_F(TestReadInteraction, TestSubscribeWildcard) EXPECT_EQ(engine->GetReportingEngine().SetDirty(dirtyPath), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); // We subscribed wildcard path twice, so we will receive two reports here. @@ -2465,7 +2451,7 @@ TEST_F(TestReadInteraction, TestSubscribeWildcard) do { last = delegate.mNumAttributeResponse; - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); } while (last != delegate.mNumAttributeResponse); // Mock endpoint3 has 13 attributes in total, and we subscribed twice. @@ -2484,24 +2470,23 @@ TEST_F(TestReadInteraction, TestSubscribeWildcard) EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } // Subscribe (wildcard, C3, A1), then setDirty (E2, C3, wildcard), receive one attribute after setDirty TEST_F(TestReadInteraction, TestSubscribePartialOverlap) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mEventPathParamsListSize = 0; std::unique_ptr attributePathParams(new chip::app::AttributePathParams[2]); @@ -2515,7 +2500,7 @@ TEST_F(TestReadInteraction, TestSubscribePartialOverlap) printf("\nSend subscribe request message to Node: 0x" ChipLogFormatX64 "\n", ChipLogValueX64(chip::kTestDeviceNodeId)); { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); delegate.mGotReport = false; @@ -2523,7 +2508,7 @@ TEST_F(TestReadInteraction, TestSubscribePartialOverlap) attributePathParams.release(); EXPECT_EQ(readClient.SendAutoResubscribeRequest(std::move(readPrepareParams)), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); @@ -2543,7 +2528,7 @@ TEST_F(TestReadInteraction, TestSubscribePartialOverlap) EXPECT_EQ(engine->GetReportingEngine().SetDirty(dirtyPath), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); EXPECT_EQ(delegate.mNumAttributeResponse, 1); @@ -2555,24 +2540,23 @@ TEST_F(TestReadInteraction, TestSubscribePartialOverlap) EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } // Subscribe (E2, C3, A1), then setDirty (wildcard, wildcard, wildcard), receive one attribute after setDirty TEST_F(TestReadInteraction, TestSubscribeSetDirtyFullyOverlap) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mEventPathParamsListSize = 0; std::unique_ptr attributePathParams(new chip::app::AttributePathParams[1]); @@ -2587,7 +2571,7 @@ TEST_F(TestReadInteraction, TestSubscribeSetDirtyFullyOverlap) printf("\nSend subscribe request message to Node: 0x" ChipLogFormatX64 "\n", ChipLogValueX64(chip::kTestDeviceNodeId)); { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); delegate.mGotReport = false; @@ -2595,7 +2579,7 @@ TEST_F(TestReadInteraction, TestSubscribeSetDirtyFullyOverlap) attributePathParams.release(); EXPECT_EQ(readClient.SendAutoResubscribeRequest(std::move(readPrepareParams)), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); @@ -2612,7 +2596,7 @@ TEST_F(TestReadInteraction, TestSubscribeSetDirtyFullyOverlap) AttributePathParams dirtyPath; EXPECT_EQ(engine->GetReportingEngine().SetDirty(dirtyPath), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); EXPECT_EQ(delegate.mNumAttributeResponse, 1); @@ -2624,20 +2608,20 @@ TEST_F(TestReadInteraction, TestSubscribeSetDirtyFullyOverlap) EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } // Verify that subscription can be shut down just after receiving SUBSCRIBE RESPONSE, // before receiving any subsequent REPORT DATA. TEST_F(TestReadInteraction, TestSubscribeEarlyShutdown) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); InteractionModelEngine & engine = *InteractionModelEngine::GetInstance(); MockInteractionModelApp delegate; // Initialize Interaction Model Engine EXPECT_EQ(rm->TestGetCountRetransTable(), 0); - EXPECT_EQ(engine.Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); + EXPECT_EQ(engine.Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); // Subscribe to the attribute AttributePathParams attributePathParams; @@ -2645,7 +2629,7 @@ TEST_F(TestReadInteraction, TestSubscribeEarlyShutdown) attributePathParams.mClusterId = kTestClusterId; attributePathParams.mAttributeId = 1; - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpAttributePathParamsList = &attributePathParams; readPrepareParams.mAttributePathParamsListSize = 1; readPrepareParams.mMinIntervalFloorSeconds = 2; @@ -2655,12 +2639,12 @@ TEST_F(TestReadInteraction, TestSubscribeEarlyShutdown) printf("Send subscribe request message to Node: 0x" ChipLogFormatX64 "\n", ChipLogValueX64(chip::kTestDeviceNodeId)); { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); EXPECT_EQ(delegate.mNumAttributeResponse, 1); @@ -2675,13 +2659,13 @@ TEST_F(TestReadInteraction, TestSubscribeEarlyShutdown) EXPECT_EQ(rm->TestGetCountRetransTable(), 0); engine.Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeInvalidAttributePathRoundtrip) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); @@ -2690,11 +2674,10 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeInvalidAttributePathRoundt MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::AttributePathParams attributePathParams[1]; readPrepareParams.mpAttributePathParamsList = attributePathParams; readPrepareParams.mpAttributePathParamsList[0].mEndpointId = kTestEndpointId; @@ -2703,20 +2686,20 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeInvalidAttributePathRoundt readPrepareParams.mAttributePathParamsListSize = 1; - readPrepareParams.mSessionHolder.Grab(mpTestContext->GetSessionBobToAlice()); + readPrepareParams.mSessionHolder.Grab(GetSessionBobToAlice()); readPrepareParams.mMinIntervalFloorSeconds = 0; readPrepareParams.mMaxIntervalCeilingSeconds = 1; printf("\nSend subscribe request message to Node: 0x" ChipLogFormatX64 "\n", ChipLogValueX64(chip::kTestDeviceNodeId)); { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); delegate.mNumAttributeResponse = 0; - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 0); @@ -2729,19 +2712,19 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeInvalidAttributePathRoundt // Advance monotonic timestamp for min interval to elapse gMockClock.AdvanceMonotonic(System::Clock::Seconds16(maxInterval)); - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); EXPECT_TRUE(engine->GetReportingEngine().IsRunScheduled()); EXPECT_TRUE(engine->GetReportingEngine().IsRunScheduled()); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 0); } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestReadInteraction, TestReadShutdown) @@ -2755,7 +2738,7 @@ TEST_F(TestReadInteraction, TestReadShutdown) // for (auto & client : pClients) { - client = Platform::New(engine, &mpTestContext->GetExchangeManager(), delegate, + client = Platform::New(engine, &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); } @@ -2784,7 +2767,7 @@ TEST_F(TestReadInteraction, TestReadShutdown) TEST_F(TestReadInteraction, TestSubscribeInvalidInterval) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); @@ -2792,11 +2775,10 @@ TEST_F(TestReadInteraction, TestSubscribeInvalidInterval) MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::AttributePathParams attributePathParams[1]; readPrepareParams.mpAttributePathParamsList = attributePathParams; readPrepareParams.mpAttributePathParamsList[0].mEndpointId = kTestEndpointId; @@ -2805,41 +2787,40 @@ TEST_F(TestReadInteraction, TestSubscribeInvalidInterval) readPrepareParams.mAttributePathParamsListSize = 1; - readPrepareParams.mSessionHolder.Grab(mpTestContext->GetSessionBobToAlice()); + readPrepareParams.mSessionHolder.Grab(GetSessionBobToAlice()); readPrepareParams.mMinIntervalFloorSeconds = 6; readPrepareParams.mMaxIntervalCeilingSeconds = 5; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_ERROR_INVALID_ARGUMENT); printf("\nSend subscribe request message to Node: 0x" ChipLogFormatX64 "\n", ChipLogValueX64(chip::kTestDeviceNodeId)); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F_FROM_FIXTURE(TestReadInteraction, TestPostSubscribeRoundtripStatusReportTimeout) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::EventPathParams eventPathParams[2]; readPrepareParams.mpEventPathParamsList = eventPathParams; readPrepareParams.mpEventPathParamsList[0].mEndpointId = kTestEventEndpointId; @@ -2871,14 +2852,14 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestPostSubscribeRoundtripStatusReportT readPrepareParams.mKeepSubscriptions = false; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); printf("\nSend first subscribe request message to Node: 0x" ChipLogFormatX64 "\n", ChipLogValueX64(chip::kTestDeviceNodeId)); delegate.mGotReport = false; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 1u); ASSERT_NE(engine->ActiveHandlerAt(0), nullptr); @@ -2907,18 +2888,18 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestPostSubscribeRoundtripStatusReportT EXPECT_EQ(engine->GetReportingEngine().SetDirty(dirtyPath2), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); EXPECT_EQ(delegate.mNumAttributeResponse, 2); // Wait for max interval to elapse gMockClock.AdvanceMonotonic(System::Clock::Seconds16(readPrepareParams.mMaxIntervalCeilingSeconds)); - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); delegate.mGotReport = false; delegate.mNumAttributeResponse = 0; - mpTestContext->ExpireSessionBobToAlice(); + ExpireSessionBobToAlice(); EXPECT_EQ(engine->GetReportingEngine().SetDirty(dirtyPath1), CHIP_NO_ERROR); @@ -2926,9 +2907,9 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestPostSubscribeRoundtripStatusReportT EXPECT_TRUE(engine->GetReportingEngine().IsRunScheduled()); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); - mpTestContext->ExpireSessionAliceToBob(); + ExpireSessionAliceToBob(); EXPECT_EQ(engine->GetReportingEngine().GetNumReportsInFlight(), 0u); EXPECT_EQ(delegate.mNumAttributeResponse, 0); } @@ -2939,25 +2920,24 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestPostSubscribeRoundtripStatusReportT EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } TEST_F(TestReadInteraction, TestSubscribeRoundtripStatusReportTimeout) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::EventPathParams eventPathParams[2]; readPrepareParams.mpEventPathParamsList = eventPathParams; readPrepareParams.mpEventPathParamsList[0].mEndpointId = kTestEventEndpointId; @@ -2989,18 +2969,18 @@ TEST_F(TestReadInteraction, TestSubscribeRoundtripStatusReportTimeout) readPrepareParams.mKeepSubscriptions = false; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); printf("\nSend first subscribe request message to Node: 0x" ChipLogFormatX64 "\n", ChipLogValueX64(chip::kTestDeviceNodeId)); delegate.mGotReport = false; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->ExpireSessionAliceToBob(); + ExpireSessionAliceToBob(); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); - mpTestContext->ExpireSessionBobToAlice(); + ExpireSessionBobToAlice(); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 0u); EXPECT_EQ(engine->GetReportingEngine().GetNumReportsInFlight(), 0u); @@ -3013,15 +2993,15 @@ TEST_F(TestReadInteraction, TestSubscribeRoundtripStatusReportTimeout) EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } TEST_F(TestReadInteraction, TestReadChunkingStatusReportTimeout) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); @@ -3029,8 +3009,7 @@ TEST_F(TestReadInteraction, TestReadChunkingStatusReportTimeout) MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); chip::app::AttributePathParams attributePathParams[1]; @@ -3039,21 +3018,21 @@ TEST_F(TestReadInteraction, TestReadChunkingStatusReportTimeout) attributePathParams[0].mClusterId = chip::Test::MockClusterId(2); attributePathParams[0].mAttributeId = chip::Test::MockAttributeId(4); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpEventPathParamsList = nullptr; readPrepareParams.mEventPathParamsListSize = 0; readPrepareParams.mpAttributePathParamsList = attributePathParams; readPrepareParams.mAttributePathParamsListSize = 1; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->DrainAndServiceIO(); - mpTestContext->ExpireSessionBobToAlice(); + ExpireSessionAliceToBob(); + DrainAndServiceIO(); + ExpireSessionBobToAlice(); EXPECT_EQ(engine->GetReportingEngine().GetNumReportsInFlight(), 0u); // By now we should have closed all exchanges and sent all pending acks, so @@ -3063,9 +3042,9 @@ TEST_F(TestReadInteraction, TestReadChunkingStatusReportTimeout) EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } // ReadClient sends the read request, but handler fails to send the one report (SendMessage returns an error). @@ -3074,14 +3053,13 @@ TEST_F(TestReadInteraction, TestReadChunkingStatusReportTimeout) TEST_F(TestReadInteraction, TestReadReportFailure) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); chip::app::AttributePathParams attributePathParams[1]; @@ -3089,47 +3067,46 @@ TEST_F(TestReadInteraction, TestReadReportFailure) attributePathParams[0].mClusterId = chip::Test::MockClusterId(3); attributePathParams[0].mAttributeId = chip::Test::MockAttributeId(1); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpEventPathParamsList = nullptr; readPrepareParams.mEventPathParamsListSize = 0; readPrepareParams.mpAttributePathParamsList = attributePathParams; readPrepareParams.mAttributePathParamsListSize = 1; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeError = 1; - mpTestContext->GetLoopback().mMessageSendError = CHIP_ERROR_INCORRECT_STATE; + GetLoopback().mNumMessagesToAllowBeforeError = 1; + GetLoopback().mMessageSendError = CHIP_ERROR_INCORRECT_STATE; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(engine->GetReportingEngine().GetNumReportsInFlight(), 0u); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 0u); - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeError = 0; - mpTestContext->GetLoopback().mMessageSendError = CHIP_NO_ERROR; + GetLoopback().mNumMessagesToAllowBeforeError = 0; + GetLoopback().mMessageSendError = CHIP_NO_ERROR; } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestReadInteraction, TestSubscribeRoundtripChunkStatusReportTimeout) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::EventPathParams eventPathParams[2]; readPrepareParams.mpEventPathParamsList = eventPathParams; readPrepareParams.mpEventPathParamsList[0].mEndpointId = kTestEventEndpointId; @@ -3158,16 +3135,16 @@ TEST_F(TestReadInteraction, TestSubscribeRoundtripChunkStatusReportTimeout) readPrepareParams.mKeepSubscriptions = false; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); printf("\nSend first subscribe request message to Node: 0x" ChipLogFormatX64 "\n", ChipLogValueX64(chip::kTestDeviceNodeId)); delegate.mGotReport = false; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->DrainAndServiceIO(); - mpTestContext->ExpireSessionBobToAlice(); + ExpireSessionAliceToBob(); + DrainAndServiceIO(); + ExpireSessionBobToAlice(); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 0u); EXPECT_EQ(engine->GetReportingEngine().GetNumReportsInFlight(), 0u); @@ -3180,25 +3157,24 @@ TEST_F(TestReadInteraction, TestSubscribeRoundtripChunkStatusReportTimeout) EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } TEST_F(TestReadInteraction, TestPostSubscribeRoundtripChunkStatusReportTimeout) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::EventPathParams eventPathParams[2]; readPrepareParams.mpEventPathParamsList = eventPathParams; readPrepareParams.mpEventPathParamsList[0].mEndpointId = kTestEventEndpointId; @@ -3227,14 +3203,14 @@ TEST_F(TestReadInteraction, TestPostSubscribeRoundtripChunkStatusReportTimeout) readPrepareParams.mKeepSubscriptions = false; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); printf("\nSend first subscribe request message to Node: 0x" ChipLogFormatX64 "\n", ChipLogValueX64(chip::kTestDeviceNodeId)); delegate.mGotReport = false; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 1u); ASSERT_NE(engine->ActiveHandlerAt(0), nullptr); @@ -3250,55 +3226,54 @@ TEST_F(TestReadInteraction, TestPostSubscribeRoundtripChunkStatusReportTimeout) dirtyPath1.mAttributeId = chip::Test::MockAttributeId(4); gMockClock.AdvanceMonotonic(System::Clock::Seconds16(readPrepareParams.mMaxIntervalCeilingSeconds)); - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); EXPECT_EQ(engine->GetReportingEngine().SetDirty(dirtyPath1), CHIP_NO_ERROR); delegate.mGotReport = false; delegate.mNumAttributeResponse = 0; - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 1; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 1; + GetLoopback().mDroppedMessageCount = 0; - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Drop status report for the first chunked report, then expire session, handler would be timeout EXPECT_EQ(engine->GetReportingEngine().GetNumReportsInFlight(), 1u); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 1u); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 0u); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 0; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToAllowBeforeDropping = 0; + GetLoopback().mDroppedMessageCount = 0; } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } TEST_F(TestReadInteraction, TestPostSubscribeRoundtripChunkReportTimeout) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::EventPathParams eventPathParams[2]; readPrepareParams.mpEventPathParamsList = eventPathParams; readPrepareParams.mpEventPathParamsList[0].mEndpointId = kTestEventEndpointId; @@ -3327,14 +3302,14 @@ TEST_F(TestReadInteraction, TestPostSubscribeRoundtripChunkReportTimeout) readPrepareParams.mKeepSubscriptions = false; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); printf("\nSend first subscribe request message to Node: 0x" ChipLogFormatX64 "\n", ChipLogValueX64(chip::kTestDeviceNodeId)); delegate.mGotReport = false; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 1u); ASSERT_NE(engine->ActiveHandlerAt(0), nullptr); @@ -3350,7 +3325,7 @@ TEST_F(TestReadInteraction, TestPostSubscribeRoundtripChunkReportTimeout) dirtyPath1.mAttributeId = chip::Test::MockAttributeId(4); gMockClock.AdvanceMonotonic(System::Clock::Seconds16(readPrepareParams.mMaxIntervalCeilingSeconds)); - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); EXPECT_EQ(engine->GetReportingEngine().SetDirty(dirtyPath1), CHIP_NO_ERROR); @@ -3358,46 +3333,45 @@ TEST_F(TestReadInteraction, TestPostSubscribeRoundtripChunkReportTimeout) delegate.mNumAttributeResponse = 0; // Drop second chunked report then expire session, client would be timeout - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 2; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 2; + GetLoopback().mDroppedMessageCount = 0; - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(engine->GetReportingEngine().GetNumReportsInFlight(), 1u); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 3u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 3u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); EXPECT_EQ(delegate.mError, CHIP_ERROR_TIMEOUT); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 0; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToAllowBeforeDropping = 0; + GetLoopback().mDroppedMessageCount = 0; } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } TEST_F(TestReadInteraction, TestPostSubscribeRoundtripChunkReport) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::EventPathParams eventPathParams[2]; readPrepareParams.mpEventPathParamsList = eventPathParams; readPrepareParams.mpEventPathParamsList[0].mEndpointId = kTestEventEndpointId; @@ -3426,14 +3400,14 @@ TEST_F(TestReadInteraction, TestPostSubscribeRoundtripChunkReport) readPrepareParams.mKeepSubscriptions = false; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); printf("\nSend first subscribe request message to Node: 0x" ChipLogFormatX64 "\n", ChipLogValueX64(chip::kTestDeviceNodeId)); delegate.mGotReport = false; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 1u); ASSERT_NE(engine->ActiveHandlerAt(0), nullptr); @@ -3456,7 +3430,7 @@ TEST_F(TestReadInteraction, TestPostSubscribeRoundtripChunkReport) // wait for min interval 1 seconds(in test, we use 0.9second considering the time variation), expect no event is // received, then wait for 0.5 seconds, then all chunked dirty reports are sent out, which would not honor minInterval gMockClock.AdvanceMonotonic(System::Clock::Milliseconds32(900)); - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 0); System::Clock::Timestamp startTime = gMockClock.GetMonotonicTimestamp(); @@ -3465,7 +3439,7 @@ TEST_F(TestReadInteraction, TestPostSubscribeRoundtripChunkReport) // be rescheduled accordingly while (true) { - mpTestContext->GetIOContext().DriveIO(); + GetIOContext().DriveIO(); if ((gMockClock.GetMonotonicTimestamp() - startTime) >= System::Clock::Milliseconds32(500)) { break; @@ -3501,16 +3475,15 @@ void CheckForInvalidAction(Test::MessageCapturer & messageLog) TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClientReceiveInvalidMessage) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::AttributePathParams attributePathParams[2]; readPrepareParams.mpAttributePathParamsList = attributePathParams; @@ -3525,20 +3498,19 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClientReceiveInvalidMessage) readPrepareParams.mAttributePathParamsListSize = 2; { - app::ReadClient readClient(engine, &mpTestContext->GetExchangeManager(), delegate, - chip::app::ReadClient::InteractionType::Read); + app::ReadClient readClient(engine, &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 1; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 1; + GetLoopback().mDroppedMessageCount = 0; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); System::PacketBufferHandle msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); EXPECT_FALSE(msgBuf.IsNull()); @@ -3552,21 +3524,21 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClientReceiveInvalidMessage) payloadHeader.SetExchangeID(0); payloadHeader.SetMessageType(chip::Protocols::InteractionModel::MsgType::StatusResponse); - chip::Test::MessageCapturer messageLog(*mpTestContext); + chip::Test::MessageCapturer messageLog(*this); messageLog.mCaptureStandaloneAcks = false; // Since we are dropping packets, things are not getting acked. Set up // our MRP state to look like what it would have looked like if the // packet had not gotten dropped. - PretendWeGotReplyFromServer(*mpTestContext, readClient.mExchange.Get()); + PretendWeGotReplyFromServer(*this, readClient.mExchange.Get()); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 0; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToAllowBeforeDropping = 0; + GetLoopback().mDroppedMessageCount = 0; readClient.OnMessageReceived(readClient.mExchange.Get(), payloadHeader, std::move(msgBuf)); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // The ReadHandler closed its exchange when it sent the Report Data (which we dropped). // Since we synthesized the StatusResponse to the ReadClient, instead of sending it from the ReadHandler, @@ -3577,10 +3549,10 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClientReceiveInvalidMessage) } engine->Shutdown(); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } // Read Client sends the subscribe request, Read Handler drops the response, then test injects unknown status response message @@ -3588,16 +3560,15 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadClientReceiveInvalidMessage) TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveInvalidStatusResponse) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::AttributePathParams attributePathParams[2]; readPrepareParams.mpAttributePathParamsList = attributePathParams; @@ -3615,17 +3586,17 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveInvalidStatus readPrepareParams.mMaxIntervalCeilingSeconds = 5; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 1; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 1; + GetLoopback().mDroppedMessageCount = 0; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); System::PacketBufferHandle msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); EXPECT_FALSE(msgBuf.IsNull()); @@ -3642,37 +3613,37 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveInvalidStatus // Since we are dropping packets, things are not getting acked. Set up // our MRP state to look like what it would have looked like if the // packet had not gotten dropped. - PretendWeGotReplyFromServer(*mpTestContext, readClient.mExchange.Get()); + PretendWeGotReplyFromServer(*this, readClient.mExchange.Get()); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 1u); ASSERT_NE(engine->ActiveHandlerAt(0), nullptr); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 0; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToAllowBeforeDropping = 0; + GetLoopback().mDroppedMessageCount = 0; readClient.OnMessageReceived(readClient.mExchange.Get(), payloadHeader, std::move(msgBuf)); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // TODO: Need to validate what status is being sent to the ReadHandler // The ReadHandler's exchange is closed when we synthesize the subscribe response, since it sent the // Subscribe Response as the last message in the transaction. // Since we synthesized the subscribe response to the ReadClient, instead of sending it from the ReadHandler, // the only messages here are the ReadClient's StatusResponse to the unexpected message and an MRP ack. - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); EXPECT_EQ(delegate.mError, CHIP_IM_GLOBAL_STATUS(Busy)); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 0u); } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } // Read Client sends the subscribe request, Read Handler drops the response, then test injects well-formed status response @@ -3680,16 +3651,15 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveInvalidStatus TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveWellFormedStatusResponse) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::AttributePathParams attributePathParams[2]; readPrepareParams.mpAttributePathParamsList = attributePathParams; @@ -3707,17 +3677,17 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveWellFormedSta readPrepareParams.mMaxIntervalCeilingSeconds = 5; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 1; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 1; + GetLoopback().mDroppedMessageCount = 0; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); System::PacketBufferHandle msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); EXPECT_FALSE(msgBuf.IsNull()); @@ -3734,36 +3704,36 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveWellFormedSta // Since we are dropping packets, things are not getting acked. Set up // our MRP state to look like what it would have looked like if the // packet had not gotten dropped. - PretendWeGotReplyFromServer(*mpTestContext, readClient.mExchange.Get()); + PretendWeGotReplyFromServer(*this, readClient.mExchange.Get()); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 1u); ASSERT_NE(engine->ActiveHandlerAt(0), nullptr); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 0; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToAllowBeforeDropping = 0; + GetLoopback().mDroppedMessageCount = 0; readClient.OnMessageReceived(readClient.mExchange.Get(), payloadHeader, std::move(msgBuf)); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // TODO: Need to validate what status is being sent to the ReadHandler // The ReadHandler's exchange is still open when we synthesize the StatusResponse. // Since we synthesized the StatusResponse to the ReadClient, instead of sending it from the ReadHandler, // the only messages here are the ReadClient's StatusResponse to the unexpected message and an MRP ack. - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); EXPECT_EQ(delegate.mError, CHIP_ERROR_INVALID_MESSAGE_TYPE); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 0u); } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } // Read Client sends the subscribe request, Read Handler drops the response, then test injects invalid report message for Read @@ -3771,16 +3741,15 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveWellFormedSta TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveInvalidReportMessage) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::AttributePathParams attributePathParams[2]; readPrepareParams.mpAttributePathParamsList = attributePathParams; @@ -3798,17 +3767,17 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveInvalidReport readPrepareParams.mMaxIntervalCeilingSeconds = 5; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 1; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 1; + GetLoopback().mDroppedMessageCount = 0; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); System::PacketBufferHandle msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); EXPECT_FALSE(msgBuf.IsNull()); @@ -3824,26 +3793,26 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveInvalidReport // Since we are dropping packets, things are not getting acked. Set up // our MRP state to look like what it would have looked like if the // packet had not gotten dropped. - PretendWeGotReplyFromServer(*mpTestContext, readClient.mExchange.Get()); + PretendWeGotReplyFromServer(*this, readClient.mExchange.Get()); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 1u); ASSERT_NE(engine->ActiveHandlerAt(0), nullptr); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 0; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToAllowBeforeDropping = 0; + GetLoopback().mDroppedMessageCount = 0; readClient.OnMessageReceived(readClient.mExchange.Get(), payloadHeader, std::move(msgBuf)); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // TODO: Need to validate what status is being sent to the ReadHandler // The ReadHandler's exchange is still open when we synthesize the ReportData. // Since we synthesized the ReportData to the ReadClient, instead of sending it from the ReadHandler, // the only messages here are the ReadClient's StatusResponse to the unexpected message and an MRP ack. - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); EXPECT_EQ(delegate.mError, CHIP_ERROR_END_OF_TLV); @@ -3851,10 +3820,10 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveInvalidReport } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } // Read Client create the subscription, handler sends unsolicited malformed report to client, @@ -3862,16 +3831,15 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveInvalidReport TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveUnsolicitedInvalidReportMessage) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::AttributePathParams attributePathParams[2]; readPrepareParams.mpAttributePathParamsList = attributePathParams; @@ -3889,13 +3857,13 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveUnsolicitedIn readPrepareParams.mMaxIntervalCeilingSeconds = 5; { - mpTestContext->GetLoopback().mSentMessageCount = 0; - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + GetLoopback().mSentMessageCount = 0; + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 5u); + DrainAndServiceIO(); + EXPECT_EQ(GetLoopback().mSentMessageCount, 5u); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 1u); ASSERT_NE(engine->ActiveHandlerAt(0), nullptr); delegate.mpReadHandler = engine->ActiveHandlerAt(0); @@ -3908,8 +3876,8 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveUnsolicitedIn response.Init(&writer); EXPECT_EQ(writer.Finalize(&msgBuf), CHIP_NO_ERROR); - mpTestContext->GetLoopback().mSentMessageCount = 0; - auto exchange = InteractionModelEngine::GetInstance()->GetExchangeManager()->NewContext( + GetLoopback().mSentMessageCount = 0; + auto exchange = InteractionModelEngine::GetInstance()->GetExchangeManager()->NewContext( delegate.mpReadHandler->mSessionHandle.Get().Value(), delegate.mpReadHandler); delegate.mpReadHandler->mExchangeCtx.Grab(exchange); @@ -3918,12 +3886,12 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveUnsolicitedIn std::move(msgBuf), Messaging::SendMessageFlags::kExpectResponse), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // The server sends a data report. // The client receives the data report data and sends out status report with invalid action. // The server acks the status report. - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 3u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 3u); } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); @@ -3934,16 +3902,15 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveUnsolicitedIn TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveInvalidSubscribeResponseMessage) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::AttributePathParams attributePathParams[2]; readPrepareParams.mpAttributePathParamsList = attributePathParams; @@ -3961,17 +3928,17 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveInvalidSubscr readPrepareParams.mMaxIntervalCeilingSeconds = 5; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 3; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 3; + GetLoopback().mDroppedMessageCount = 0; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); System::PacketBufferHandle msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); EXPECT_FALSE(msgBuf.IsNull()); @@ -3990,35 +3957,35 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveInvalidSubscr // Since we are dropping packets, things are not getting acked. Set up // our MRP state to look like what it would have looked like if the // packet had not gotten dropped. - PretendWeGotReplyFromServer(*mpTestContext, readClient.mExchange.Get()); + PretendWeGotReplyFromServer(*this, readClient.mExchange.Get()); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 4u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 4u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 1u); ASSERT_NE(engine->ActiveHandlerAt(0), nullptr); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 0; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToAllowBeforeDropping = 0; + GetLoopback().mDroppedMessageCount = 0; readClient.OnMessageReceived(readClient.mExchange.Get(), payloadHeader, std::move(msgBuf)); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // TODO: Need to validate what status is being sent to the ReadHandler // The ReadHandler's exchange is still open when we synthesize the subscribe response. // Since we synthesized the subscribe response to the ReadClient, instead of sending it from the ReadHandler, // the only messages here are the ReadClient's StatusResponse to the unexpected message and an MRP ack. - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); EXPECT_EQ(delegate.mError, CHIP_ERROR_INVALID_SUBSCRIPTION); } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } // Read Client create the subscription, handler sends unsolicited malformed report with invalid subscription id to client, @@ -4026,16 +3993,15 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveInvalidSubscr TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveUnsolicitedReportMessageWithInvalidSubscriptionId) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); chip::app::AttributePathParams attributePathParams[2]; readPrepareParams.mpAttributePathParamsList = attributePathParams; @@ -4053,13 +4019,13 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveUnsolicitedRe readPrepareParams.mMaxIntervalCeilingSeconds = 5; { - mpTestContext->GetLoopback().mSentMessageCount = 0; - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + GetLoopback().mSentMessageCount = 0; + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 5u); + DrainAndServiceIO(); + EXPECT_EQ(GetLoopback().mSentMessageCount, 5u); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 1u); ASSERT_NE(engine->ActiveHandlerAt(0), nullptr); delegate.mpReadHandler = engine->ActiveHandlerAt(0); @@ -4075,8 +4041,8 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveUnsolicitedRe EXPECT_EQ(writer.Finalize(&msgBuf), CHIP_NO_ERROR); - mpTestContext->GetLoopback().mSentMessageCount = 0; - auto exchange = InteractionModelEngine::GetInstance()->GetExchangeManager()->NewContext( + GetLoopback().mSentMessageCount = 0; + auto exchange = InteractionModelEngine::GetInstance()->GetExchangeManager()->NewContext( delegate.mpReadHandler->mSessionHandle.Get().Value(), delegate.mpReadHandler); delegate.mpReadHandler->mExchangeCtx.Grab(exchange); @@ -4085,13 +4051,13 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveUnsolicitedRe std::move(msgBuf), Messaging::SendMessageFlags::kExpectResponse), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // The server sends a data report. // The client receives the data report data and sends out status report with invalid subsciption. // The server should respond with a status report of its own, leading to 4 messages (because // the client would ack the server's status report), just sends an ack to the status report it got. - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 3u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 3u); } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); @@ -4103,7 +4069,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeClientReceiveUnsolicitedRe TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadChunkingInvalidSubscriptionId) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); @@ -4111,8 +4077,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadChunkingInvalidSubscriptionId) MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); EXPECT_FALSE(delegate.mGotEventResponse); chip::app::AttributePathParams attributePathParams[1]; @@ -4121,24 +4086,24 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadChunkingInvalidSubscriptionId) attributePathParams[0].mClusterId = chip::Test::MockClusterId(2); attributePathParams[0].mAttributeId = chip::Test::MockAttributeId(4); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpEventPathParamsList = nullptr; readPrepareParams.mEventPathParamsListSize = 0; readPrepareParams.mpAttributePathParamsList = attributePathParams; readPrepareParams.mAttributePathParamsListSize = 1; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 3; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 3; + GetLoopback().mDroppedMessageCount = 0; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); System::PacketBufferHandle msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); EXPECT_FALSE(msgBuf.IsNull()); @@ -4157,36 +4122,36 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadChunkingInvalidSubscriptionId) // Since we are dropping packets, things are not getting acked. Set up // our MRP state to look like what it would have looked like if the // packet had not gotten dropped. - PretendWeGotReplyFromServer(*mpTestContext, readClient.mExchange.Get()); + PretendWeGotReplyFromServer(*this, readClient.mExchange.Get()); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 4u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 4u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 1u); ASSERT_NE(engine->ActiveHandlerAt(0), nullptr); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 0; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToAllowBeforeDropping = 0; + GetLoopback().mDroppedMessageCount = 0; readClient.OnMessageReceived(readClient.mExchange.Get(), payloadHeader, std::move(msgBuf)); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // TODO: Need to validate what status is being sent to the ReadHandler // The ReadHandler's exchange is still open when we synthesize the report data message. // Since we synthesized the second report data message to the ReadClient with invalid subscription id, instead of // sending it from the ReadHandler, the only messages here are the ReadClient's StatusResponse to the unexpected message // and an MRP ack. - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); EXPECT_EQ(delegate.mError, CHIP_ERROR_INVALID_SUBSCRIPTION); } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } // Read Client sends a malformed subscribe request, interaction model engine fails to parse the request and generates a status @@ -4194,19 +4159,18 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadChunkingInvalidSubscriptionId) TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadHandlerMalformedSubscribeRequest) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); System::PacketBufferHandle msgBuf; @@ -4226,12 +4190,12 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadHandlerMalformedSubscribeReques Messaging::SendFlags(Messaging::SendMessageFlags::kExpectResponse)), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mError, CHIP_IM_GLOBAL_STATUS(InvalidAction)); } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } // Read Client sends a malformed read request, interaction model engine fails to parse the request and generates a status report @@ -4239,19 +4203,18 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadHandlerMalformedSubscribeReques TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadHandlerMalformedReadRequest1) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); System::PacketBufferHandle msgBuf; @@ -4269,12 +4232,12 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadHandlerMalformedReadRequest1) EXPECT_EQ(readClient.mExchange->SendMessage(Protocols::InteractionModel::MsgType::ReadRequest, std::move(msgBuf), Messaging::SendFlags(Messaging::SendMessageFlags::kExpectResponse)), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mError, CHIP_IM_GLOBAL_STATUS(InvalidAction)); } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } // Read Client sends a malformed read request, read handler fails to parse the request and generates a status report to client, @@ -4282,19 +4245,18 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadHandlerMalformedReadRequest1) TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadHandlerMalformedReadRequest2) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Read); System::PacketBufferHandle msgBuf; @@ -4312,13 +4274,13 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadHandlerMalformedReadRequest2) EXPECT_EQ(readClient.mExchange->SendMessage(Protocols::InteractionModel::MsgType::ReadRequest, std::move(msgBuf), Messaging::SendFlags(Messaging::SendMessageFlags::kExpectResponse)), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); ChipLogError(DataManagement, "The error is %s", ErrorStr(delegate.mError)); EXPECT_EQ(delegate.mError, CHIP_IM_GLOBAL_STATUS(InvalidAction)); } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } // Read Client creates a subscription with the server, server sends chunked reports, after the handler sends out the first @@ -4326,14 +4288,13 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadHandlerMalformedReadRequest2) TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeSendUnknownMessage) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); chip::app::AttributePathParams attributePathParams[1]; // Mock Attribute 4 is a big attribute, with 6 large OCTET_STRING @@ -4341,34 +4302,34 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeSendUnknownMessage) attributePathParams[0].mClusterId = chip::Test::MockClusterId(2); attributePathParams[0].mAttributeId = chip::Test::MockAttributeId(4); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpAttributePathParamsList = attributePathParams; readPrepareParams.mAttributePathParamsListSize = 1; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 1; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 1; + GetLoopback().mDroppedMessageCount = 0; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Since we are dropping packets, things are not getting acked. Set up // our MRP state to look like what it would have looked like if the // packet had not gotten dropped. - PretendWeGotReplyFromServer(*mpTestContext, readClient.mExchange.Get()); + PretendWeGotReplyFromServer(*this, readClient.mExchange.Get()); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 1u); ASSERT_NE(engine->ActiveHandlerAt(0), nullptr); - mpTestContext->GetLoopback().mSentMessageCount = 0; + GetLoopback().mSentMessageCount = 0; // Server sends out status report, client should send status report along with Piggybacking ack, but we don't do that // Instead, we send out unknown message to server @@ -4381,19 +4342,19 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeSendUnknownMessage) writer.Finalize(&msgBuf); readClient.mExchange->SendMessage(Protocols::InteractionModel::MsgType::WriteRequest, std::move(msgBuf)); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // client sends invalid write request, server sends out status report with invalid action and closes, client replies // with status report server replies with MRP Ack - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 4u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 4u); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 0u); } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } // Read Client creates a subscription with the server, server sends chunked reports, after the handler sends out invalid status @@ -4401,14 +4362,13 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeSendUnknownMessage) TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeSendInvalidStatusReport) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); chip::app::AttributePathParams attributePathParams[1]; // Mock Attribute 4 is a big attribute, with 6 large OCTET_STRING @@ -4416,30 +4376,30 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeSendInvalidStatusReport) attributePathParams[0].mClusterId = chip::Test::MockClusterId(2); attributePathParams[0].mAttributeId = chip::Test::MockAttributeId(4); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpAttributePathParamsList = attributePathParams; readPrepareParams.mAttributePathParamsListSize = 1; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 1; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 1; + GetLoopback().mDroppedMessageCount = 0; EXPECT_EQ(readClient.SendRequest(readPrepareParams), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Since we are dropping packets, things are not getting acked. Set up // our MRP state to look like what it would have looked like if the // packet had not gotten dropped. - PretendWeGotReplyFromServer(*mpTestContext, readClient.mExchange.Get()); + PretendWeGotReplyFromServer(*this, readClient.mExchange.Get()); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); - mpTestContext->GetLoopback().mSentMessageCount = 0; + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); + GetLoopback().mSentMessageCount = 0; EXPECT_EQ(engine->GetNumActiveReadHandlers(), 1u); ASSERT_NE(engine->ActiveHandlerAt(0), nullptr); @@ -4452,20 +4412,20 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeSendInvalidStatusReport) writer.Finalize(&msgBuf); readClient.mExchange->SendMessage(Protocols::InteractionModel::MsgType::StatusResponse, std::move(msgBuf)); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // client sends malformed status response, server sends out status report with invalid action and close, client replies // with status report server replies with MRP Ack - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 4u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 4u); EXPECT_EQ(engine->GetNumActiveReadHandlers(), 0u); } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } // Read Client sends a malformed subscribe request, the server fails to parse the request and generates a status report to the @@ -4473,19 +4433,18 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscribeSendInvalidStatusReport) TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadHandlerInvalidSubscribeRequest) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); System::PacketBufferHandle msgBuf; @@ -4503,12 +4462,12 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadHandlerInvalidSubscribeRequest) EXPECT_EQ(readClient.mExchange->SendMessage(Protocols::InteractionModel::MsgType::SubscribeRequest, std::move(msgBuf), Messaging::SendFlags(Messaging::SendMessageFlags::kExpectResponse)), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mError, CHIP_IM_GLOBAL_STATUS(InvalidAction)); } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } // Create the subscription, then remove the corresponding fabric in client and handler, the corresponding @@ -4516,7 +4475,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestReadHandlerInvalidSubscribeRequest) TEST_F(TestReadInteraction, TestSubscribeInvalidateFabric) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); @@ -4524,10 +4483,9 @@ TEST_F(TestReadInteraction, TestSubscribeInvalidateFabric) MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpAttributePathParamsList = new chip::app::AttributePathParams[1]; readPrepareParams.mAttributePathParamsListSize = 1; @@ -4539,40 +4497,40 @@ TEST_F(TestReadInteraction, TestSubscribeInvalidateFabric) readPrepareParams.mMaxIntervalCeilingSeconds = 0; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); delegate.mGotReport = false; EXPECT_EQ(readClient.SendAutoResubscribeRequest(std::move(readPrepareParams)), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); EXPECT_EQ(engine->GetNumActiveReadHandlers(ReadHandler::InteractionType::Subscribe), 1u); ASSERT_NE(engine->ActiveHandlerAt(0), nullptr); delegate.mpReadHandler = engine->ActiveHandlerAt(0); - mpTestContext->GetFabricTable().Delete(mpTestContext->GetAliceFabricIndex()); + GetFabricTable().Delete(GetAliceFabricIndex()); EXPECT_EQ(engine->GetNumActiveReadHandlers(ReadHandler::InteractionType::Subscribe), 0u); - mpTestContext->GetFabricTable().Delete(mpTestContext->GetBobFabricIndex()); + GetFabricTable().Delete(GetBobFabricIndex()); EXPECT_EQ(delegate.mError, CHIP_ERROR_IM_FABRIC_DELETED); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateAliceFabric(); - mpTestContext->CreateBobFabric(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateAliceFabric(); + CreateBobFabric(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); engine->Shutdown(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F_FROM_FIXTURE(TestReadInteraction, TestShutdownSubscription) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); @@ -4580,10 +4538,9 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestShutdownSubscription) MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpAttributePathParamsList = new chip::app::AttributePathParams[1]; readPrepareParams.mAttributePathParamsListSize = 1; @@ -4595,14 +4552,14 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestShutdownSubscription) readPrepareParams.mMaxIntervalCeilingSeconds = 0; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); delegate.mGotReport = false; EXPECT_EQ(readClient.SendAutoResubscribeRequest(std::move(readPrepareParams)), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); EXPECT_EQ(engine->GetNumActiveReadHandlers(ReadHandler::InteractionType::Subscribe), 1u); @@ -4613,7 +4570,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestShutdownSubscription) } engine->Shutdown(); EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } /** @@ -4624,18 +4581,17 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestShutdownSubscription) TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscriptionReportWithDefunctSession) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); MockInteractionModelApp delegate; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), gReportScheduler), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR); AttributePathParams subscribePath(chip::Test::kMockEndpoint3, chip::Test::MockClusterId(2), chip::Test::MockAttributeId(1)); - ReadPrepareParams readPrepareParams(mpTestContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mpAttributePathParamsList = &subscribePath; readPrepareParams.mAttributePathParamsListSize = 1; @@ -4643,14 +4599,14 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscriptionReportWithDefunctSessio readPrepareParams.mMaxIntervalCeilingSeconds = 0; { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpTestContext->GetExchangeManager(), delegate, + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, chip::app::ReadClient::InteractionType::Subscribe); delegate.mGotReport = false; EXPECT_EQ(readClient.SendSubscribeRequest(std::move(readPrepareParams)), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); EXPECT_EQ(delegate.mNumAttributeResponse, 1); @@ -4663,13 +4619,13 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscriptionReportWithDefunctSessio // Verify that the session we will reset later is the one we will mess // with now. - EXPECT_EQ(SessionHandle(*readHandler->GetSession()), mpTestContext->GetSessionAliceToBob()); + EXPECT_EQ(SessionHandle(*readHandler->GetSession()), GetSessionAliceToBob()); // Test that we send reports as needed. delegate.mGotReport = false; delegate.mNumAttributeResponse = 0; engine->GetReportingEngine().SetDirty(subscribePath); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mGotReport); EXPECT_EQ(delegate.mNumAttributeResponse, 1); @@ -4684,7 +4640,7 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscriptionReportWithDefunctSessio delegate.mNumAttributeResponse = 0; engine->GetReportingEngine().SetDirty(subscribePath); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_FALSE(delegate.mGotReport); EXPECT_EQ(delegate.mNumAttributeResponse, 0); @@ -4694,11 +4650,11 @@ TEST_F_FROM_FIXTURE(TestReadInteraction, TestSubscriptionReportWithDefunctSessio } engine->Shutdown(); EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); // Get rid of our defunct session. - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->CreateSessionAliceToBob(); + ExpireSessionAliceToBob(); + CreateSessionAliceToBob(); } } // namespace app diff --git a/src/app/tests/TestReportScheduler.cpp b/src/app/tests/TestReportScheduler.cpp index dc54395149bbe4..f9ff58eac9e017 100644 --- a/src/app/tests/TestReportScheduler.cpp +++ b/src/app/tests/TestReportScheduler.cpp @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -26,8 +27,6 @@ #include namespace { -using TestContext = chip::Test::AppContext; - class NullReadHandlerCallback : public chip::app::ReadHandler::ManagementCallback { public: @@ -52,39 +51,9 @@ using Milliseconds64 = System::Clock::Milliseconds64; static const size_t kNumMaxReadHandlers = 16; -class TestReportScheduler : public ::testing::Test +class TestReportScheduler : public chip::Test::AppContext { public: - static void SetUpTestSuite() - { - mpTestContext = new chip::Test::AppContext; - mpTestContext->SetUpTestSuite(); - } - static void TearDownTestSuite() - { - mpTestContext->TearDownTestSuite(); - if (mpTestContext != nullptr) - { - delete mpTestContext; - } - } - - void SetUp() override - { - - if (mpTestContext != nullptr) - { - mpTestContext->SetUp(); - } - } - void TearDown() override - { - if (mpTestContext != nullptr) - { - mpTestContext->TearDown(); - } - } - void TestReadHandlerList(); void TestReportTiming(); void TestObserverCallbacks(); @@ -125,12 +94,8 @@ class TestReportScheduler : public ::testing::Test return ret; } - - static chip::Test::AppContext * mpTestContext; }; -chip::Test::AppContext * TestReportScheduler::mpTestContext = nullptr; - class TestTimerDelegate : public ReportScheduler::TimerDelegate { public: @@ -300,7 +265,7 @@ TEST_F_FROM_FIXTURE(TestReportScheduler, TestReadHandlerList) NullReadHandlerCallback nullCallback; // exchange context - Messaging::ExchangeContext * exchangeCtx = mpTestContext->NewExchangeToAlice(nullptr, false); + Messaging::ExchangeContext * exchangeCtx = NewExchangeToAlice(nullptr, false); // Read handler pool ObjectPool readHandlerPool; @@ -310,8 +275,8 @@ TEST_F_FROM_FIXTURE(TestReportScheduler, TestReadHandlerList) for (size_t i = 0; i < kNumMaxReadHandlers; i++) { - ReadHandler * readHandler = - readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, &sScheduler); + ReadHandler * readHandler = readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, + &sScheduler, CodegenDataModelInstance()); sScheduler.OnSubscriptionEstablished(readHandler); ASSERT_NE(nullptr, readHandler); ASSERT_NE(nullptr, sScheduler.FindReadHandlerNode(readHandler)); @@ -319,7 +284,7 @@ TEST_F_FROM_FIXTURE(TestReportScheduler, TestReadHandlerList) EXPECT_EQ(readHandlerPool.Allocated(), kNumMaxReadHandlers); EXPECT_EQ(sScheduler.GetNumReadHandlers(), kNumMaxReadHandlers); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 1u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 1u); // Test unregister first ReadHandler uint32_t target = 0; @@ -356,7 +321,7 @@ TEST_F_FROM_FIXTURE(TestReportScheduler, TestReadHandlerList) readHandlerPool.ReleaseAll(); exchangeCtx->Close(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F_FROM_FIXTURE(TestReportScheduler, TestReportTiming) @@ -364,7 +329,7 @@ TEST_F_FROM_FIXTURE(TestReportScheduler, TestReportTiming) NullReadHandlerCallback nullCallback; // exchange context - Messaging::ExchangeContext * exchangeCtx = mpTestContext->NewExchangeToAlice(nullptr, false); + Messaging::ExchangeContext * exchangeCtx = NewExchangeToAlice(nullptr, false); // Read handler pool ObjectPool readHandlerPool; @@ -374,20 +339,20 @@ TEST_F_FROM_FIXTURE(TestReportScheduler, TestReportTiming) // Dirty read handler, will be triggered at min interval // Test OnReadHandler created - ReadHandler * readHandler1 = - readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, &sScheduler); + ReadHandler * readHandler1 = readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, + &sScheduler, CodegenDataModelInstance()); EXPECT_EQ(CHIP_NO_ERROR, MockReadHandlerSubscriptionTransaction(readHandler1, &sScheduler, 1, 2)); readHandler1->ForceDirtyState(); // Clean read handler, will be triggered at max interval - ReadHandler * readHandler2 = - readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, &sScheduler); + ReadHandler * readHandler2 = readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, + &sScheduler, CodegenDataModelInstance()); EXPECT_EQ(CHIP_NO_ERROR, MockReadHandlerSubscriptionTransaction(readHandler2, &sScheduler, 0, 3)); // Clean read handler, will be triggered at max interval, but will be cancelled before - ReadHandler * readHandler3 = - readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, &sScheduler); + ReadHandler * readHandler3 = readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, + &sScheduler, CodegenDataModelInstance()); EXPECT_EQ(CHIP_NO_ERROR, MockReadHandlerSubscriptionTransaction(readHandler3, &sScheduler, 0, 3)); // Confirms that none of the ReadHandlers are currently reportable @@ -424,7 +389,7 @@ TEST_F_FROM_FIXTURE(TestReportScheduler, TestReportTiming) sScheduler.UnregisterAllHandlers(); readHandlerPool.ReleaseAll(); exchangeCtx->Close(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F_FROM_FIXTURE(TestReportScheduler, TestObserverCallbacks) @@ -432,7 +397,7 @@ TEST_F_FROM_FIXTURE(TestReportScheduler, TestObserverCallbacks) NullReadHandlerCallback nullCallback; // exchange context - Messaging::ExchangeContext * exchangeCtx = mpTestContext->NewExchangeToAlice(nullptr, false); + Messaging::ExchangeContext * exchangeCtx = NewExchangeToAlice(nullptr, false); // Read handler pool ObjectPool readHandlerPool; @@ -440,8 +405,8 @@ TEST_F_FROM_FIXTURE(TestReportScheduler, TestObserverCallbacks) // Initialize mock timestamp sTestTimerDelegate.SetMockSystemTimestamp(Milliseconds64(0)); - ReadHandler * readHandler = - readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, &sScheduler); + ReadHandler * readHandler = readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, + &sScheduler, CodegenDataModelInstance()); EXPECT_EQ(CHIP_NO_ERROR, MockReadHandlerSubscriptionTransaction(readHandler, &sScheduler, 1, 2)); @@ -499,7 +464,7 @@ TEST_F_FROM_FIXTURE(TestReportScheduler, TestObserverCallbacks) readHandlerPool.ReleaseAll(); exchangeCtx->Close(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F_FROM_FIXTURE(TestReportScheduler, TestSynchronizedScheduler) @@ -507,7 +472,7 @@ TEST_F_FROM_FIXTURE(TestReportScheduler, TestSynchronizedScheduler) NullReadHandlerCallback nullCallback; // exchange context - Messaging::ExchangeContext * exchangeCtx = mpTestContext->NewExchangeToAlice(nullptr, false); + Messaging::ExchangeContext * exchangeCtx = NewExchangeToAlice(nullptr, false); // First test: ReadHandler 2 merge on ReadHandler 1 max interval // Read handler pool @@ -516,14 +481,14 @@ TEST_F_FROM_FIXTURE(TestReportScheduler, TestSynchronizedScheduler) // Initialize the mock system time sTestTimerSynchronizedDelegate.SetMockSystemTimestamp(System::Clock::Milliseconds64(0)); - ReadHandler * readHandler1 = - readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, &syncScheduler); + ReadHandler * readHandler1 = readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, + &syncScheduler, CodegenDataModelInstance()); EXPECT_EQ(CHIP_NO_ERROR, MockReadHandlerSubscriptionTransaction(readHandler1, &syncScheduler, 0, 2)); ReadHandlerNode * node1 = syncScheduler.FindReadHandlerNode(readHandler1); - ReadHandler * readHandler2 = - readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, &syncScheduler); + ReadHandler * readHandler2 = readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, + &syncScheduler, CodegenDataModelInstance()); EXPECT_EQ(CHIP_NO_ERROR, MockReadHandlerSubscriptionTransaction(readHandler2, &syncScheduler, 1, 3)); ReadHandlerNode * node2 = syncScheduler.FindReadHandlerNode(readHandler2); @@ -650,8 +615,8 @@ TEST_F_FROM_FIXTURE(TestReportScheduler, TestSynchronizedScheduler) // Wait for 1 second, nothing should happen here sTestTimerSynchronizedDelegate.IncrementMockTimestamp(System::Clock::Milliseconds64(1000)); - ReadHandler * readHandler3 = - readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, &syncScheduler); + ReadHandler * readHandler3 = readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, + &syncScheduler, CodegenDataModelInstance()); EXPECT_EQ(CHIP_NO_ERROR, MockReadHandlerSubscriptionTransaction(readHandler3, &syncScheduler, 2, 3)); ReadHandlerNode * node3 = syncScheduler.FindReadHandlerNode(readHandler3); @@ -704,8 +669,8 @@ TEST_F_FROM_FIXTURE(TestReportScheduler, TestSynchronizedScheduler) EXPECT_EQ(syncScheduler.mNextReportTimestamp, node1->GetMaxTimestamp()); // Now simulate a new readHandler being added with a max forcing a conflict - ReadHandler * readHandler4 = - readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, &syncScheduler); + ReadHandler * readHandler4 = readHandlerPool.CreateObject(nullCallback, exchangeCtx, ReadHandler::InteractionType::Subscribe, + &syncScheduler, CodegenDataModelInstance()); EXPECT_EQ(CHIP_NO_ERROR, MockReadHandlerSubscriptionTransaction(readHandler4, &syncScheduler, 0, 1)); ReadHandlerNode * node4 = syncScheduler.FindReadHandlerNode(readHandler4); @@ -839,7 +804,7 @@ TEST_F_FROM_FIXTURE(TestReportScheduler, TestSynchronizedScheduler) syncScheduler.UnregisterAllHandlers(); readHandlerPool.ReleaseAll(); exchangeCtx->Close(); - EXPECT_EQ(mpTestContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } } // namespace reporting diff --git a/src/app/tests/TestReportingEngine.cpp b/src/app/tests/TestReportingEngine.cpp index 97d179b4e72dcc..c18fbdbf1f2dcc 100644 --- a/src/app/tests/TestReportingEngine.cpp +++ b/src/app/tests/TestReportingEngine.cpp @@ -24,22 +24,24 @@ #include +#include + #include #include +#include #include #include #include +#include #include #include +#include #include #include #include #include #include #include -#include - -using TestContext = chip::Test::AppContext; namespace chip { @@ -51,25 +53,20 @@ constexpr chip::AttributeId kTestFieldId2 = 2; namespace app { namespace reporting { -std::unique_ptr mpTestContext; - -class TestReportingEngine : public ::testing::Test +class TestReportingEngine : public chip::Test::AppContext { public: - static void SetUpTestSuite() + void SetUp() override { - - mpTestContext = std::make_unique(); - ASSERT_NE(mpTestContext, nullptr); - mpTestContext->SetUpTestSuite(); + chip::Test::AppContext::SetUp(); + mOldModel = InteractionModelEngine::GetInstance()->SetDataModel(&TestImCustomDataModel::Instance()); } - static void TearDownTestSuite() + + void TearDown() override { - mpTestContext->TearDownTestSuite(); - mpTestContext.reset(); + InteractionModelEngine::GetInstance()->SetDataModel(mOldModel); + chip::Test::AppContext::TearDown(); } - void SetUp() { mpTestContext->SetUp(); } - void TearDown() { mpTestContext->TearDown(); } template static bool VerifyDirtySetContent(const Args &... args); @@ -80,6 +77,8 @@ class TestReportingEngine : public ::testing::Test void TestMergeAttributePathWhenDirtySetPoolExhausted(); private: + chip::app::InteractionModel::DataModel * mOldModel = nullptr; + struct ExpectedDirtySetContent : public AttributePathParams { ExpectedDirtySetContent(const AttributePathParams & path) : AttributePathParams(path) {} @@ -161,11 +160,11 @@ TEST_F_FROM_FIXTURE(TestReportingEngine, TestBuildAndSendSingleReportData) ReadRequestMessage::Builder readRequestBuilder; DummyDelegate dummy; - EXPECT_EQ(InteractionModelEngine::GetInstance()->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), + EXPECT_EQ(InteractionModelEngine::GetInstance()->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); TestExchangeDelegate delegate; - Messaging::ExchangeContext * exchangeCtx = mpTestContext->NewExchangeToAlice(&delegate); + Messaging::ExchangeContext * exchangeCtx = NewExchangeToAlice(&delegate); writer.Init(std::move(readRequestbuf)); EXPECT_EQ(readRequestBuilder.Init(&writer), CHIP_NO_ERROR); @@ -187,18 +186,18 @@ TEST_F_FROM_FIXTURE(TestReportingEngine, TestBuildAndSendSingleReportData) EXPECT_EQ(readRequestBuilder.GetError(), CHIP_NO_ERROR); EXPECT_EQ(writer.Finalize(&readRequestbuf), CHIP_NO_ERROR); app::ReadHandler readHandler(dummy, exchangeCtx, chip::app::ReadHandler::InteractionType::Read, - app::reporting::GetDefaultReportScheduler()); + app::reporting::GetDefaultReportScheduler(), CodegenDataModelInstance()); readHandler.OnInitialRequest(std::move(readRequestbuf)); EXPECT_EQ(InteractionModelEngine::GetInstance()->GetReportingEngine().BuildAndSendSingleReportData(&readHandler), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); } TEST_F_FROM_FIXTURE(TestReportingEngine, TestMergeOverlappedAttributePath) { - EXPECT_EQ(InteractionModelEngine::GetInstance()->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), + EXPECT_EQ(InteractionModelEngine::GetInstance()->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); @@ -253,7 +252,7 @@ TEST_F_FROM_FIXTURE(TestReportingEngine, TestMergeOverlappedAttributePath) TEST_F_FROM_FIXTURE(TestReportingEngine, TestMergeAttributePathWhenDirtySetPoolExhausted) { - EXPECT_EQ(InteractionModelEngine::GetInstance()->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), + EXPECT_EQ(InteractionModelEngine::GetInstance()->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); diff --git a/src/app/tests/TestSceneTable.cpp b/src/app/tests/TestSceneTable.cpp index 1563c286ac3e16..ffb0a1fd5650ff 100644 --- a/src/app/tests/TestSceneTable.cpp +++ b/src/app/tests/TestSceneTable.cpp @@ -140,9 +140,9 @@ static app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type OOexten static app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type LCextensionFieldSet; static app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type CCextensionFieldSet; -static app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type OOPairs[1]; -static app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type LCPairs[2]; -static app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type CCPairs[8]; +static app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type OOPairs[1]; +static app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type LCPairs[2]; +static app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type CCPairs[8]; static uint8_t OO_buffer[scenes::kMaxFieldBytesPerCluster] = { 0 }; static uint8_t LC_buffer[scenes::kMaxFieldBytesPerCluster] = { 0 }; @@ -535,30 +535,30 @@ TEST_F(TestSceneTable, TestHandlerFunctions) static const uint16_t LC_av_payload[2] = { 0x64, 0x01F0 }; static const uint16_t CC_av_payload[8] = { 0 }; - OOPairs[0].attributeID = kOnOffAttId; - OOPairs[0].attributeValue = OO_av_payload; - - LCPairs[0].attributeID = kCurrentLevelId; - LCPairs[0].attributeValue = LC_av_payload[0]; - LCPairs[1].attributeID = kCurrentFrequencyId; - LCPairs[1].attributeValue = LC_av_payload[1]; - - CCPairs[0].attributeID = kCurrentSaturationId; - CCPairs[0].attributeValue = CC_av_payload[0]; - CCPairs[1].attributeID = kCurrentXId; - CCPairs[1].attributeValue = CC_av_payload[1]; - CCPairs[2].attributeID = kCurrentYId; - CCPairs[2].attributeValue = CC_av_payload[2]; - CCPairs[3].attributeID = kColorTemperatureMiredsId; - CCPairs[3].attributeValue = CC_av_payload[3]; - CCPairs[4].attributeID = kEnhancedCurrentHueId; - CCPairs[4].attributeValue = CC_av_payload[4]; - CCPairs[5].attributeID = kColorLoopActiveId; - CCPairs[5].attributeValue = CC_av_payload[5]; - CCPairs[6].attributeID = kColorLoopDirectionId; - CCPairs[6].attributeValue = CC_av_payload[6]; - CCPairs[7].attributeID = kColorLoopTimeId; - CCPairs[7].attributeValue = CC_av_payload[7]; + OOPairs[0].attributeID = kOnOffAttId; + OOPairs[0].valueUnsigned8.SetValue(OO_av_payload); + + LCPairs[0].attributeID = kCurrentLevelId; + LCPairs[0].valueUnsigned8.SetValue(static_cast(LC_av_payload[0])); + LCPairs[1].attributeID = kCurrentFrequencyId; + LCPairs[1].valueUnsigned16.SetValue(LC_av_payload[1]); + + CCPairs[0].attributeID = kCurrentSaturationId; + CCPairs[0].valueUnsigned8.SetValue(static_cast(CC_av_payload[0])); + CCPairs[1].attributeID = kCurrentXId; + CCPairs[1].valueUnsigned16.SetValue(CC_av_payload[1]); + CCPairs[2].attributeID = kCurrentYId; + CCPairs[2].valueUnsigned16.SetValue(CC_av_payload[2]); + CCPairs[3].attributeID = kColorTemperatureMiredsId; + CCPairs[3].valueUnsigned16.SetValue(CC_av_payload[3]); + CCPairs[4].attributeID = kEnhancedCurrentHueId; + CCPairs[4].valueUnsigned16.SetValue(CC_av_payload[4]); + CCPairs[5].attributeID = kColorLoopActiveId; + CCPairs[5].valueUnsigned8.SetValue(static_cast(CC_av_payload[5])); + CCPairs[6].attributeID = kColorLoopDirectionId; + CCPairs[6].valueUnsigned8.SetValue(static_cast(CC_av_payload[6])); + CCPairs[7].attributeID = kColorLoopTimeId; + CCPairs[7].valueUnsigned8.SetValue(static_cast(CC_av_payload[7])); // Initialize Extension Field sets as if they were received by add commands OOextensionFieldSet.clusterID = kOnOffClusterId; @@ -667,12 +667,11 @@ TEST_F(TestSceneTable, TestHandlerFunctions) // To test failure on serialize and deserialize when too many pairs are in the field sets app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type extensionFieldFailTestOut; app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::DecodableType extensionFieldFailTestIn; - app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type TooManyPairs[16]; + app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type TooManyPairs[16]; - uint8_t payloadOk = 0; for (uint8_t i = 0; i < 16; i++) { - TooManyPairs[i].attributeValue = payloadOk; + TooManyPairs[i].valueUnsigned8.SetValue(0); } extensionFieldFailTestOut.clusterID = kColorControlClusterId; diff --git a/src/app/tests/TestThreadBorderRouterManagementCluster.cpp b/src/app/tests/TestThreadBorderRouterManagementCluster.cpp new file mode 100644 index 00000000000000..a6915824fb2ea2 --- /dev/null +++ b/src/app/tests/TestThreadBorderRouterManagementCluster.cpp @@ -0,0 +1,336 @@ +/* + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { + +namespace GeneralCommissioning { +// Mock function +void SetBreadcrumb(Attributes::Breadcrumb::TypeInfo::Type breadcrumb) {} +} // namespace GeneralCommissioning + +namespace ThreadBorderRouterManagement { + +class TestDelegate : public Delegate +{ +public: + TestDelegate() = default; + ~TestDelegate() = default; + + CHIP_ERROR Init(AttributeChangeCallback * callback) override { return CHIP_NO_ERROR; } + + bool GetPanChangeSupported() override { return mPanChangeSupported; } + + void GetBorderRouterName(MutableCharSpan & borderRouterName) override + { + size_t nameIndex = mUseInvalidBorderRouterName ? 1 : 0; + if (borderRouterName.size() >= strlen(kTestName[nameIndex])) + { + CopyCharSpanToMutableCharSpan(CharSpan(kTestName[nameIndex], strlen(kTestName[nameIndex])), borderRouterName); + } + } + + CHIP_ERROR GetBorderAgentId(MutableByteSpan & borderAgentId) override + { + if (borderAgentId.size() >= mTestBorderAgentIdLen) + { + CopySpanToMutableSpan(ByteSpan(kTestBorderAgentId, mTestBorderAgentIdLen), borderAgentId); + return CHIP_NO_ERROR; + } + return CHIP_ERROR_BUFFER_TOO_SMALL; + } + + uint16_t GetThreadVersion() override { return kTestThreadVersion; } + + bool GetInterfaceEnabled() override { return mInterfaceEnabled; } + + CHIP_ERROR GetDataset(Thread::OperationalDataset & dataset, DatasetType type) override + { + if (type == DatasetType::kActive && mStoredActiveDatasetLen) + { + dataset.Init(ByteSpan(mStoredActiveDataset, mStoredActiveDatasetLen)); + return CHIP_NO_ERROR; + } + if (type == DatasetType::kPending && mPendingDatasetLen) + { + dataset.Init(ByteSpan(mPendingDataset, mPendingDatasetLen)); + return CHIP_NO_ERROR; + } + return CHIP_IM_GLOBAL_STATUS(NotFound); + } + + void SetActiveDataset(const Thread::OperationalDataset & activeDataset, uint32_t sequenceNumber, + ActivateDatasetCallback * callback) override + { + memcpy(mActiveDataset, activeDataset.AsByteSpan().data(), activeDataset.AsByteSpan().size()); + mActiveDatasetLen = activeDataset.AsByteSpan().size(); + mCallback = callback; + mSetActiveDatasetCommandSequenceNum = sequenceNumber; + } + + CHIP_ERROR CommitActiveDataset() override { return CHIP_NO_ERROR; } + + CHIP_ERROR RevertActiveDataset() override + { + mStoredActiveDatasetLen = 0; + mInterfaceEnabled = false; + mCallback = nullptr; + return CHIP_NO_ERROR; + } + + CHIP_ERROR SetPendingDataset(const Thread::OperationalDataset & pendingDataset) override + { + memcpy(mPendingDataset, pendingDataset.AsByteSpan().data(), pendingDataset.AsByteSpan().size()); + mPendingDatasetLen = pendingDataset.AsByteSpan().size(); + return CHIP_NO_ERROR; + } + + void ActivateActiveDataset() + { + memcpy(mStoredActiveDataset, mActiveDataset, Thread::kSizeOperationalDataset); + mStoredActiveDatasetLen = mActiveDatasetLen; + mInterfaceEnabled = true; + if (mCallback) + { + mCallback->OnActivateDatasetComplete(mSetActiveDatasetCommandSequenceNum, CHIP_NO_ERROR); + } + mCallback = nullptr; + } + + bool mPanChangeSupported = true; + const char * kTestName[2] = { "TestName", "TestNameLength64________________________________________________" }; + const uint8_t kTestBorderAgentId[kBorderAgentIdLength] = { 0x0, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF }; + const uint16_t kTestThreadVersion = 4; + uint8_t mActiveDataset[Thread::kSizeOperationalDataset] = { 0 }; + size_t mActiveDatasetLen = 0; + uint8_t mStoredActiveDataset[Thread::kSizeOperationalDataset] = { 0 }; + size_t mStoredActiveDatasetLen = 0; + uint8_t mPendingDataset[Thread::kSizeOperationalDataset] = { 0 }; + size_t mPendingDatasetLen = 0; + bool mUseInvalidBorderRouterName = true; + size_t mTestBorderAgentIdLen = kBorderAgentIdLength - 1; + bool mInterfaceEnabled = false; + uint32_t mSetActiveDatasetCommandSequenceNum = 0; + ActivateDatasetCallback * mCallback = nullptr; +}; + +constexpr EndpointId kTestEndpointId = 1; +constexpr FabricIndex kTestAccessingFabricIndex = 1; +static FailSafeContext sTestFailsafeContext; +static TestDelegate sTestDelegate; +static ServerInstance sTestSeverInstance(kTestEndpointId, &sTestDelegate, sTestFailsafeContext); + +class TestSetActiveDatasetCommandHandler : public CommandHandler +{ +public: + TestSetActiveDatasetCommandHandler() : mClusterStatus(Protocols::InteractionModel::Status::Success) {} + CHIP_ERROR FallibleAddStatus(const ConcreteCommandPath & aRequestCommandPath, + const Protocols::InteractionModel::ClusterStatusCode & aStatus, const char * context = nullptr) + { + return CHIP_NO_ERROR; + } + + void AddStatus(const ConcreteCommandPath & aRequestCommandPath, const Protocols::InteractionModel::ClusterStatusCode & aStatus, + const char * context = nullptr) + { + mClusterStatus = aStatus; + } + + FabricIndex GetAccessingFabricIndex() const { return kTestAccessingFabricIndex; } + + CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + const DataModel::EncodableToTLV & aEncodable) + { + return CHIP_NO_ERROR; + } + + void AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + const DataModel::EncodableToTLV & aEncodable) + {} + + bool IsTimedInvoke() const { return false; } + + void FlushAcksRightAwayOnSlowCommand() {} + + Access::SubjectDescriptor GetSubjectDescriptor() const + { + Access::SubjectDescriptor subjectDescriptor = { kUndefinedFabricIndex, Access::AuthMode::kNone, kUndefinedNodeId, + kUndefinedCATs }; + return subjectDescriptor; + } + + Messaging::ExchangeContext * GetExchangeContext() const { return nullptr; } + + Protocols::InteractionModel::ClusterStatusCode mClusterStatus; +}; + +TestSetActiveDatasetCommandHandler sTestCommandHandler; + +class TestThreadBorderRouterManagementCluster : public ::testing::Test +{ +public: + static void SetUpTestSuite() + { + ASSERT_EQ(Platform::MemoryInit(), CHIP_NO_ERROR); + ASSERT_EQ(DeviceLayer::PlatformMgr().InitChipStack(), CHIP_NO_ERROR); + } + + static void TearDownTestSuite() + { + DeviceLayer::PlatformMgr().Shutdown(); + Platform::MemoryShutdown(); + } + + void TestAttributeRead(); + void TestCommandHandle(); +}; + +// Test ReadXX functions in ThreadBorderRouterManagement ServerInstance +TEST_F_FROM_FIXTURE(TestThreadBorderRouterManagementCluster, TestAttributeRead) +{ + // FeatureMap attribute + BitFlags featureMap = BitFlags(); + // Make the PAN change feature supported in Test delegate. + sTestDelegate.mPanChangeSupported = true; + sTestSeverInstance.ReadFeatureMap(featureMap); + EXPECT_TRUE(featureMap.Has(Feature::kPANChange)); + // Make the PAN change feature unsupported in Test delegate. + sTestDelegate.mPanChangeSupported = false; + featureMap.ClearAll(); + sTestSeverInstance.ReadFeatureMap(featureMap); + EXPECT_FALSE(featureMap.Has(Feature::kPANChange)); + // BorderRouterName attribute + // Use invalid BR name + sTestDelegate.mUseInvalidBorderRouterName = true; + char borderRouterName[kBorderRouterNameMaxLength + 10] = { 0 }; + MutableCharSpan nameSpan(borderRouterName); + EXPECT_EQ(sTestSeverInstance.ReadBorderRouterName(nameSpan), CHIP_IM_GLOBAL_STATUS(Failure)); + nameSpan = MutableCharSpan(borderRouterName); + // Use valid BR name + sTestDelegate.mUseInvalidBorderRouterName = false; + EXPECT_EQ(sTestSeverInstance.ReadBorderRouterName(nameSpan), CHIP_NO_ERROR); + EXPECT_TRUE(nameSpan.data_equal(CharSpan("TestName", strlen("TestName")))); + // BorderAgentId attribute + uint8_t borderAgentId[kBorderAgentIdLength] = { 0 }; + MutableByteSpan agentIdSpan(borderAgentId); + // Use invalid border agent id + sTestDelegate.mTestBorderAgentIdLen = kBorderAgentIdLength - 1; + EXPECT_EQ(sTestSeverInstance.ReadBorderAgentID(agentIdSpan), CHIP_IM_GLOBAL_STATUS(Failure)); + agentIdSpan = MutableByteSpan(borderAgentId); + // Use valid border agent id + sTestDelegate.mTestBorderAgentIdLen = kBorderAgentIdLength; + EXPECT_EQ(sTestSeverInstance.ReadBorderAgentID(agentIdSpan), CHIP_NO_ERROR); + EXPECT_TRUE(agentIdSpan.data_equal(ByteSpan(sTestDelegate.kTestBorderAgentId))); + // ActiveDatasetTimestamp attribute + // The active dataset timestamp should be null when no active dataset is configured + Optional timestamp = sTestSeverInstance.ReadActiveDatasetTimestamp(); + EXPECT_FALSE(timestamp.HasValue()); +} + +TEST_F_FROM_FIXTURE(TestThreadBorderRouterManagementCluster, TestCommandHandle) +{ + // Test GetActiveDatasetRequest and GetPendingDatasetRequest commands + Thread::OperationalDataset dataset; + using DatasetType = Delegate::DatasetType; + using Status = Protocols::InteractionModel::Status; + // The GetDataset requests should over CASE session. + EXPECT_EQ(sTestSeverInstance.HandleGetDatasetRequest(false /* isOverCASESession */, DatasetType::kActive, dataset), + Status::UnsupportedAccess); + EXPECT_EQ(sTestSeverInstance.HandleGetDatasetRequest(false, DatasetType::kPending, dataset), Status::UnsupportedAccess); + // The GetDataset should return NotFound when no dataset is configured. + EXPECT_EQ(sTestSeverInstance.HandleGetDatasetRequest(true, DatasetType::kActive, dataset), Status::NotFound); + EXPECT_EQ(sTestSeverInstance.HandleGetDatasetRequest(true, DatasetType::kPending, dataset), Status::NotFound); + // Test SetActiveDatasetRequest + ThreadBorderRouterManagement::Commands::SetActiveDatasetRequest::DecodableType req1; + uint8_t invalidDataset[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 }; + uint8_t validDataset[] = { 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0b, 0x35, 0x06, + 0x00, 0x04, 0x00, 0x1f, 0xff, 0xe0, 0x02, 0x08, 0xde, 0xaa, 0x00, 0xbe, 0xef, 0x00, 0xca, 0xef, 0x07, + 0x08, 0xfd, 0xde, 0xad, 0x00, 0xbe, 0xef, 0x00, 0x00, 0x05, 0x10, 0xb7, 0x28, 0x08, 0x04, 0x85, 0xcf, + 0xc5, 0x25, 0x7f, 0x68, 0x4c, 0x54, 0x9d, 0x6a, 0x57, 0x5e, 0x03, 0x0a, 0x4f, 0x70, 0x65, 0x6e, 0x54, + 0x68, 0x72, 0x65, 0x61, 0x64, 0x01, 0x02, 0xc1, 0x15, 0x04, 0x10, 0xcb, 0x13, 0x47, 0xeb, 0x0c, 0xd4, + 0xb3, 0x5c, 0xd1, 0x42, 0xda, 0x5e, 0x6d, 0xf1, 0x8b, 0x88, 0x0c, 0x04, 0x02, 0xa0, 0xf7, 0xf8 }; + Optional activeDatasetTimestamp = chip::NullOptional; + activeDatasetTimestamp = sTestSeverInstance.ReadActiveDatasetTimestamp(); + EXPECT_FALSE(activeDatasetTimestamp.HasValue()); + req1.activeDataset = ByteSpan(invalidDataset); + // SetActiveDatasetRequest is FailsafeRequired. + EXPECT_EQ(sTestSeverInstance.HandleSetActiveDatasetRequest(&sTestCommandHandler, req1), Status::FailsafeRequired); + EXPECT_EQ(sTestFailsafeContext.ArmFailSafe(kTestAccessingFabricIndex, System::Clock::Seconds16(1)), CHIP_NO_ERROR); + // SetActiveDatasetRequest should return InvalidCommand when dataset is invalid. + EXPECT_EQ(sTestSeverInstance.HandleSetActiveDatasetRequest(&sTestCommandHandler, req1), Status::InvalidCommand); + req1.activeDataset = ByteSpan(validDataset); + EXPECT_EQ(sTestSeverInstance.HandleSetActiveDatasetRequest(&sTestCommandHandler, req1), Status::Success); + // When the Server is handling a SetActiveDatasetRequest command, it should return Busy after receiving another one. + EXPECT_EQ(sTestSeverInstance.HandleSetActiveDatasetRequest(&sTestCommandHandler, req1), Status::Busy); + EXPECT_FALSE(sTestDelegate.mInterfaceEnabled); + EXPECT_EQ(sTestDelegate.mSetActiveDatasetCommandSequenceNum, static_cast(1)); + // Activate the dataset. + sTestDelegate.ActivateActiveDataset(); + EXPECT_EQ(sTestCommandHandler.mClusterStatus, + Protocols::InteractionModel::ClusterStatusCode(Protocols::InteractionModel::Status::Success)); + sTestFailsafeContext.DisarmFailSafe(); + // The Dataset should be updated. + EXPECT_EQ(sTestSeverInstance.HandleGetDatasetRequest(true, DatasetType::kActive, dataset), Status::Success); + EXPECT_TRUE(dataset.AsByteSpan().data_equal(ByteSpan(validDataset))); + EXPECT_TRUE(sTestDelegate.mInterfaceEnabled); + activeDatasetTimestamp = sTestSeverInstance.ReadActiveDatasetTimestamp(); + // activeDatasetTimestamp should have value. + EXPECT_TRUE(activeDatasetTimestamp.HasValue()); + EXPECT_EQ(sTestFailsafeContext.ArmFailSafe(kTestAccessingFabricIndex, System::Clock::Seconds16(1)), CHIP_NO_ERROR); + // When ActiveDatasetTimestamp is not null, the set active dataset request should return InvalidInState. + EXPECT_EQ(sTestSeverInstance.HandleSetActiveDatasetRequest(&sTestCommandHandler, req1), Status::InvalidInState); + sTestFailsafeContext.DisarmFailSafe(); + // Test SetPendingDatasetRequest command + Commands::SetPendingDatasetRequest::DecodableType req2; + sTestDelegate.mPanChangeSupported = false; + req2.pendingDataset = ByteSpan(validDataset); + // SetPendingDatasetRequest is supported when PANChange feature is enabled. + EXPECT_EQ(sTestSeverInstance.HandleSetPendingDatasetRequest(req2), Status::UnsupportedCommand); + sTestDelegate.mPanChangeSupported = true; + req2.pendingDataset = ByteSpan(invalidDataset); + // SetPendingDatasetRequest should return InvalidCommand when dataset is invalid. + EXPECT_EQ(sTestSeverInstance.HandleSetPendingDatasetRequest(req2), Status::InvalidCommand); + req2.pendingDataset = ByteSpan(validDataset); + // Success SetPendingDatasetRequest + EXPECT_EQ(sTestSeverInstance.HandleSetPendingDatasetRequest(req2), Status::Success); + EXPECT_EQ(sTestSeverInstance.HandleGetDatasetRequest(true, DatasetType::kPending, dataset), Status::Success); + EXPECT_TRUE(dataset.AsByteSpan().data_equal(ByteSpan(validDataset))); +} + +} // namespace ThreadBorderRouterManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/tests/TestTimedHandler.cpp b/src/app/tests/TestTimedHandler.cpp index 2625257781d314..42748a0ee4d50a 100644 --- a/src/app/tests/TestTimedHandler.cpp +++ b/src/app/tests/TestTimedHandler.cpp @@ -29,8 +29,6 @@ #include #include -using TestContext = chip::Test::AppContext; - namespace chip { namespace app { @@ -39,33 +37,14 @@ using namespace Protocols::InteractionModel; namespace { -class TestTimedHandler : public ::testing::Test +class TestTimedHandler : public chip::Test::AppContext { public: - static void SetUpTestSuite() - { - - mpTestContext = new TestContext; - mpTestContext->SetUpTestSuite(); - } - static void TearDownTestSuite() - { - mpTestContext->TearDownTestSuite(); - delete mpTestContext; - } - - void SetUp() override { mpTestContext->SetUp(); } - void TearDown() override { mpTestContext->TearDown(); } - - static TestContext * mpTestContext; - - static void TestFollowingMessageFastEnough(MsgType aMsgType); - static void TestFollowingMessageTooSlow(MsgType aMsgType); - static void GenerateTimedRequest(uint16_t aTimeoutValue, System::PacketBufferHandle & aPayload); + void TestFollowingMessageFastEnough(MsgType aMsgType); + void TestFollowingMessageTooSlow(MsgType aMsgType); + void GenerateTimedRequest(uint16_t aTimeoutValue, System::PacketBufferHandle & aPayload); }; -TestContext * TestTimedHandler::mpTestContext = nullptr; - class TestExchangeDelegate : public Messaging::ExchangeDelegate { CHIP_ERROR OnMessageReceived(Messaging::ExchangeContext * aExchangeContext, const PayloadHeader & aPayloadHeader, @@ -124,7 +103,7 @@ void TestTimedHandler::TestFollowingMessageFastEnough(MsgType aMsgType) GenerateTimedRequest(500, payload); TestExchangeDelegate delegate; - ExchangeContext * exchange = mpTestContext->NewExchangeToAlice(&delegate); + ExchangeContext * exchange = NewExchangeToAlice(&delegate); ASSERT_NE(exchange, nullptr); EXPECT_FALSE(delegate.mNewMessageReceived); @@ -133,13 +112,13 @@ void TestTimedHandler::TestFollowingMessageFastEnough(MsgType aMsgType) EXPECT_EQ(exchange->SendMessage(MsgType::TimedRequest, std::move(payload), SendMessageFlags::kExpectResponse), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mNewMessageReceived); EXPECT_TRUE(delegate.mLastMessageWasStatus); EXPECT_EQ(delegate.mError, CHIP_NO_ERROR); // Send an empty payload, which will error out but not with the - // UNSUPPORTED_ACCESS status we expect if we miss our timeout. + // TIMEOUT status we expect if we miss our timeout. payload = MessagePacketBuffer::New(0); ASSERT_FALSE(payload.IsNull()); @@ -148,15 +127,15 @@ void TestTimedHandler::TestFollowingMessageFastEnough(MsgType aMsgType) EXPECT_EQ(exchange->SendMessage(aMsgType, std::move(payload), SendMessageFlags::kExpectResponse), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mNewMessageReceived); EXPECT_TRUE(delegate.mLastMessageWasStatus); - EXPECT_NE(StatusIB(delegate.mError).mStatus, Status::UnsupportedAccess); + EXPECT_NE(StatusIB(delegate.mError).mStatus, Status::Timeout); } TEST_F(TestTimedHandler, TestInvokeFastEnough) { - TestTimedHandler::TestFollowingMessageFastEnough(MsgType::InvokeCommandRequest); + TestFollowingMessageFastEnough(MsgType::InvokeCommandRequest); } TEST_F(TestTimedHandler, TestWriteFastEnough) @@ -171,7 +150,7 @@ void TestTimedHandler::TestFollowingMessageTooSlow(MsgType aMsgType) GenerateTimedRequest(50, payload); TestExchangeDelegate delegate; - ExchangeContext * exchange = mpTestContext->NewExchangeToAlice(&delegate); + ExchangeContext * exchange = NewExchangeToAlice(&delegate); ASSERT_NE(exchange, nullptr); EXPECT_FALSE(delegate.mNewMessageReceived); @@ -180,7 +159,7 @@ void TestTimedHandler::TestFollowingMessageTooSlow(MsgType aMsgType) EXPECT_EQ(exchange->SendMessage(MsgType::TimedRequest, std::move(payload), SendMessageFlags::kExpectResponse), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mNewMessageReceived); EXPECT_TRUE(delegate.mLastMessageWasStatus); EXPECT_EQ(delegate.mError, CHIP_NO_ERROR); @@ -189,7 +168,7 @@ void TestTimedHandler::TestFollowingMessageTooSlow(MsgType aMsgType) chip::test_utils::SleepMillis(75); // Send an empty payload, which will error out but not with the - // UNSUPPORTED_ACCESS status we expect if we miss our timeout. + // TIMEOUT status we expect if we miss our timeout. payload = MessagePacketBuffer::New(0); EXPECT_FALSE(payload.IsNull()); @@ -198,10 +177,10 @@ void TestTimedHandler::TestFollowingMessageTooSlow(MsgType aMsgType) EXPECT_EQ(exchange->SendMessage(aMsgType, std::move(payload), SendMessageFlags::kExpectResponse), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mNewMessageReceived); EXPECT_TRUE(delegate.mLastMessageWasStatus); - EXPECT_EQ(StatusIB(delegate.mError).mStatus, Status::UnsupportedAccess); + EXPECT_EQ(StatusIB(delegate.mError).mStatus, Status::Timeout); } TEST_F(TestTimedHandler, TestInvokeTooSlow) @@ -222,14 +201,14 @@ TEST_F(TestTimedHandler, TestInvokeNeverComes) GenerateTimedRequest(50, payload); TestExchangeDelegate delegate; - ExchangeContext * exchange = mpTestContext->NewExchangeToAlice(&delegate); + ExchangeContext * exchange = NewExchangeToAlice(&delegate); ASSERT_NE(exchange, nullptr); EXPECT_FALSE(delegate.mNewMessageReceived); EXPECT_EQ(exchange->SendMessage(MsgType::TimedRequest, std::move(payload), SendMessageFlags::kExpectResponse), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(delegate.mNewMessageReceived); EXPECT_TRUE(delegate.mLastMessageWasStatus); EXPECT_EQ(delegate.mError, CHIP_NO_ERROR); diff --git a/src/app/tests/TestWriteInteraction.cpp b/src/app/tests/TestWriteInteraction.cpp index 3f03b976e2937f..625d6c3328d2f2 100644 --- a/src/app/tests/TestWriteInteraction.cpp +++ b/src/app/tests/TestWriteInteraction.cpp @@ -49,30 +49,16 @@ chip::TestPersistentStorageDelegate gTestStorage; chip::Crypto::DefaultSessionKeystore gSessionKeystore; chip::Credentials::GroupDataProviderImpl gGroupsProvider(kMaxGroupsPerFabric, kMaxGroupKeysPerFabric); -using TestContext = chip::Test::AppContext; - } // namespace namespace chip { namespace app { -class TestWriteInteraction : public ::testing::Test +class TestWriteInteraction : public chip::Test::AppContext { public: - static void SetUpTestSuite() - { - mpTestContext = new TestContext; - mpTestContext->SetUpTestSuite(); - } - - static void TearDownTestSuite() - { - mpTestContext->TearDownTestSuite(); - delete mpTestContext; - } void SetUp() override { - - mpTestContext->SetUp(); + AppContext::SetUp(); gTestStorage.ClearStorage(); gGroupsProvider.SetStorageDelegate(&gTestStorage); @@ -82,8 +68,8 @@ class TestWriteInteraction : public ::testing::Test uint8_t buf[sizeof(chip::CompressedFabricId)]; chip::MutableByteSpan span(buf); - ASSERT_EQ(mpTestContext->GetBobFabric()->GetCompressedFabricIdBytes(span), CHIP_NO_ERROR); - ASSERT_EQ(chip::GroupTesting::InitData(&gGroupsProvider, mpTestContext->GetBobFabricIndex(), span), CHIP_NO_ERROR); + ASSERT_EQ(GetBobFabric()->GetCompressedFabricIdBytes(span), CHIP_NO_ERROR); + ASSERT_EQ(chip::GroupTesting::InitData(&gGroupsProvider, GetBobFabricIndex(), span), CHIP_NO_ERROR); } void TearDown() override { @@ -92,11 +78,9 @@ class TestWriteInteraction : public ::testing::Test { provider->Finish(); } - mpTestContext->TearDown(); + AppContext::TearDown(); } - static TestContext * mpTestContext; - void TestWriteClient(); void TestWriteClientGroup(); void TestWriteHandlerReceiveInvalidMessage(); @@ -111,8 +95,6 @@ class TestWriteInteraction : public ::testing::Test static void GenerateWriteResponse(System::PacketBufferHandle & aPayload); }; -TestContext * TestWriteInteraction::mpTestContext = nullptr; - class TestExchangeDelegate : public Messaging::ExchangeDelegate { CHIP_ERROR OnMessageReceived(Messaging::ExchangeContext * ec, const PayloadHeader & payloadHeader, @@ -261,14 +243,14 @@ TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteClient) { TestWriteClientCallback callback; - app::WriteClient writeClient(&mpTestContext->GetExchangeManager(), &callback, /* aTimedWriteTimeoutMs = */ NullOptional); + app::WriteClient writeClient(&GetExchangeManager(), &callback, /* aTimedWriteTimeoutMs = */ NullOptional); System::PacketBufferHandle buf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); AddAttributeDataIB(writeClient); - EXPECT_EQ(writeClient.SendWriteRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(writeClient.SendWriteRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); GenerateWriteResponse(buf); @@ -276,7 +258,7 @@ TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteClient) writeClient.Close(); - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); EXPECT_EQ(rm->TestGetCountRetransTable(), 0); } @@ -284,17 +266,17 @@ TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteClientGroup) { TestWriteClientCallback callback; - app::WriteClient writeClient(&mpTestContext->GetExchangeManager(), &callback, /* aTimedWriteTimeoutMs = */ NullOptional); + app::WriteClient writeClient(&GetExchangeManager(), &callback, /* aTimedWriteTimeoutMs = */ NullOptional); System::PacketBufferHandle buf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); AddAttributeDataIB(writeClient); - SessionHandle groupSession = mpTestContext->GetSessionBobToFriends(); + SessionHandle groupSession = GetSessionBobToFriends(); EXPECT_TRUE(groupSession->IsGroupSession()); EXPECT_EQ(writeClient.SendWriteRequest(groupSession), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); // The WriteClient should be shutdown once we SendWriteRequest for group. EXPECT_EQ(writeClient.mState, WriteClient::State::AwaitingDestruction); @@ -319,7 +301,7 @@ TEST_F(TestWriteInteraction, TestWriteHandler) GenerateWriteRequest(messageIsTimed, buf); TestExchangeDelegate delegate; - Messaging::ExchangeContext * exchange = mpTestContext->NewExchangeToBob(&delegate); + Messaging::ExchangeContext * exchange = NewExchangeToBob(&delegate); Status status = writeHandler.OnWriteRequest(exchange, std::move(buf), transactionIsTimed); if (messageIsTimed == transactionIsTimed) @@ -328,12 +310,12 @@ TEST_F(TestWriteInteraction, TestWriteHandler) } else { - EXPECT_EQ(status, Status::UnsupportedAccess); + EXPECT_EQ(status, Status::TimedRequestMismatch); } - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); EXPECT_EQ(rm->TestGetCountRetransTable(), 0); } } @@ -342,15 +324,13 @@ TEST_F(TestWriteInteraction, TestWriteHandler) TEST_F(TestWriteInteraction, TestWriteRoundtripWithClusterObjects) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); TestWriteClientCallback callback; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler()), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); app::WriteClient writeClient(engine->GetExchangeManager(), &callback, Optional::Missing()); @@ -375,9 +355,9 @@ TEST_F(TestWriteInteraction, TestWriteRoundtripWithClusterObjects) EXPECT_EQ(callback.mOnSuccessCalled, 0); - EXPECT_EQ(writeClient.SendWriteRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(writeClient.SendWriteRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(callback.mOnSuccessCalled, 1); @@ -408,15 +388,13 @@ TEST_F(TestWriteInteraction, TestWriteRoundtripWithClusterObjects) TEST_F(TestWriteInteraction, TestWriteRoundtripWithClusterObjectsVersionMatch) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); TestWriteClientCallback callback; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler()), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); app::WriteClient writeClient(engine->GetExchangeManager(), &callback, Optional::Missing()); @@ -435,9 +413,9 @@ TEST_F(TestWriteInteraction, TestWriteRoundtripWithClusterObjectsVersionMatch) EXPECT_EQ(callback.mOnSuccessCalled, 0); - EXPECT_EQ(writeClient.SendWriteRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(writeClient.SendWriteRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(callback.mOnSuccessCalled, 1); EXPECT_EQ(callback.mOnErrorCalled, 0); @@ -454,15 +432,13 @@ TEST_F(TestWriteInteraction, TestWriteRoundtripWithClusterObjectsVersionMatch) TEST_F(TestWriteInteraction, TestWriteRoundtripWithClusterObjectsVersionMismatch) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); TestWriteClientCallback callback; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler()), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); app::WriteClient writeClient(engine->GetExchangeManager(), &callback, Optional::Missing()); @@ -484,9 +460,9 @@ TEST_F(TestWriteInteraction, TestWriteRoundtripWithClusterObjectsVersionMismatch EXPECT_EQ(callback.mOnSuccessCalled, 0); - EXPECT_EQ(writeClient.SendWriteRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(writeClient.SendWriteRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(callback.mOnSuccessCalled, 1); EXPECT_EQ(callback.mOnErrorCalled, 0); @@ -503,15 +479,13 @@ TEST_F(TestWriteInteraction, TestWriteRoundtripWithClusterObjectsVersionMismatch TEST_F(TestWriteInteraction, TestWriteRoundtrip) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); TestWriteClientCallback callback; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler()), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); app::WriteClient writeClient(engine->GetExchangeManager(), &callback, Optional::Missing()); @@ -522,9 +496,9 @@ TEST_F(TestWriteInteraction, TestWriteRoundtrip) EXPECT_EQ(callback.mOnErrorCalled, 0); EXPECT_EQ(callback.mOnDoneCalled, 0); - EXPECT_EQ(writeClient.SendWriteRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); + EXPECT_EQ(writeClient.SendWriteRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(callback.mOnSuccessCalled, 1); EXPECT_EQ(callback.mOnErrorCalled, 0); @@ -541,37 +515,35 @@ TEST_F(TestWriteInteraction, TestWriteRoundtrip) #if CONFIG_BUILD_FOR_HOST_UNIT_TEST TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteHandlerReceiveInvalidMessage) { - auto sessionHandle = mpTestContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); app::AttributePathParams attributePath(2, 3, 4); - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); TestWriteClientCallback writeCallback; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler()), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); // Reserve all except the last 128 bytes, so that we make sure to chunk. - app::WriteClient writeClient(&mpTestContext->GetExchangeManager(), &writeCallback, Optional::Missing(), + app::WriteClient writeClient(&GetExchangeManager(), &writeCallback, Optional::Missing(), static_cast(kMaxSecureSduLengthBytes - 128) /* reserved buffer size */); ByteSpan list[5]; EXPECT_EQ(writeClient.EncodeAttribute(attributePath, app::DataModel::List(list, 5)), CHIP_NO_ERROR); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 2; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 2; EXPECT_EQ(writeClient.SendWriteRequest(sessionHandle), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(InteractionModelEngine::GetInstance()->GetNumActiveWriteHandlers(), 1u); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 3u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 3u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); System::PacketBufferHandle msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); EXPECT_FALSE(msgBuf.IsNull()); @@ -590,65 +562,63 @@ TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteHandlerReceiveInvalidMessage) rm->ClearRetransTable(writeClient.mExchangeCtx.Get()); rm->ClearRetransTable(writeHandler->mExchangeCtx.Get()); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; writeHandler->OnMessageReceived(writeHandler->mExchangeCtx.Get(), payloadHeader, std::move(msgBuf)); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(writeCallback.mLastErrorReason.mStatus, Protocols::InteractionModel::Status::InvalidAction); EXPECT_EQ(InteractionModelEngine::GetInstance()->GetNumActiveWriteHandlers(), 0u); engine->Shutdown(); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } // This test is to create Chunked write requests, we drop the message since the 3rd message, then remove fabrics for client and // handler, the corresponding client and handler would be released as well. TEST_F(TestWriteInteraction, TestWriteHandlerInvalidateFabric) { - auto sessionHandle = mpTestContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); app::AttributePathParams attributePath(2, 3, 4); - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); TestWriteClientCallback writeCallback; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler()), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); // Reserve all except the last 128 bytes, so that we make sure to chunk. - app::WriteClient writeClient(&mpTestContext->GetExchangeManager(), &writeCallback, Optional::Missing(), + app::WriteClient writeClient(&GetExchangeManager(), &writeCallback, Optional::Missing(), static_cast(kMaxSecureSduLengthBytes - 128) /* reserved buffer size */); ByteSpan list[5]; EXPECT_EQ(writeClient.EncodeAttribute(attributePath, app::DataModel::List(list, 5)), CHIP_NO_ERROR); - mpTestContext->GetLoopback().mDroppedMessageCount = 0; - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 2; + GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 2; EXPECT_EQ(writeClient.SendWriteRequest(sessionHandle), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(InteractionModelEngine::GetInstance()->GetNumActiveWriteHandlers(), 1u); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 3u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 3u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); - mpTestContext->GetFabricTable().Delete(mpTestContext->GetAliceFabricIndex()); + GetFabricTable().Delete(GetAliceFabricIndex()); EXPECT_EQ(InteractionModelEngine::GetInstance()->GetNumActiveWriteHandlers(), 0u); engine->Shutdown(); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateAliceFabric(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateAliceFabric(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } #endif @@ -657,15 +627,13 @@ TEST_F(TestWriteInteraction, TestWriteHandlerInvalidateFabric) TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteInvalidMessage1) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); TestWriteClientCallback callback; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler()), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); app::WriteClient writeClient(engine->GetExchangeManager(), &callback, Optional::Missing()); @@ -676,15 +644,15 @@ TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteInvalidMessage1) EXPECT_EQ(callback.mOnErrorCalled, 0); EXPECT_EQ(callback.mOnDoneCalled, 0); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 1; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; - EXPECT_EQ(writeClient.SendWriteRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 1; + GetLoopback().mDroppedMessageCount = 0; + EXPECT_EQ(writeClient.SendWriteRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); + DrainAndServiceIO(); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); System::PacketBufferHandle msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); EXPECT_FALSE(msgBuf.IsNull()); @@ -700,15 +668,15 @@ TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteInvalidMessage1) // Since we are dropping packets, things are not getting acked. Set up // our MRP state to look like what it would have looked like if the // packet had not gotten dropped. - PretendWeGotReplyFromServer(*mpTestContext, writeClient.mExchangeCtx.Get()); + PretendWeGotReplyFromServer(*this, writeClient.mExchangeCtx.Get()); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 0; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToAllowBeforeDropping = 0; + GetLoopback().mDroppedMessageCount = 0; EXPECT_EQ(writeClient.OnMessageReceived(writeClient.mExchangeCtx.Get(), payloadHeader, std::move(msgBuf)), CHIP_ERROR_INVALID_MESSAGE_TYPE); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(callback.mError, CHIP_ERROR_INVALID_MESSAGE_TYPE); EXPECT_EQ(callback.mOnSuccessCalled, 0); @@ -717,28 +685,26 @@ TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteInvalidMessage1) // TODO: Check that the server gets the right status. // Client sents status report with invalid action, server's exchange has been closed, so all it sends is an MRP Ack - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); engine->Shutdown(); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } // Write Client sends a write request, receives a malformed write response message, sends a Status Report. TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteInvalidMessage2) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); TestWriteClientCallback callback; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler()), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); app::WriteClient writeClient(engine->GetExchangeManager(), &callback, Optional::Missing()); @@ -749,15 +715,15 @@ TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteInvalidMessage2) EXPECT_EQ(callback.mOnErrorCalled, 0); EXPECT_EQ(callback.mOnDoneCalled, 0); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 1; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; - EXPECT_EQ(writeClient.SendWriteRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 1; + GetLoopback().mDroppedMessageCount = 0; + EXPECT_EQ(writeClient.SendWriteRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); + DrainAndServiceIO(); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); System::PacketBufferHandle msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); EXPECT_FALSE(msgBuf.IsNull()); @@ -773,15 +739,15 @@ TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteInvalidMessage2) // Since we are dropping packets, things are not getting acked. Set up // our MRP state to look like what it would have looked like if the // packet had not gotten dropped. - PretendWeGotReplyFromServer(*mpTestContext, writeClient.mExchangeCtx.Get()); + PretendWeGotReplyFromServer(*this, writeClient.mExchangeCtx.Get()); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 0; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToAllowBeforeDropping = 0; + GetLoopback().mDroppedMessageCount = 0; EXPECT_EQ(writeClient.OnMessageReceived(writeClient.mExchangeCtx.Get(), payloadHeader, std::move(msgBuf)), CHIP_ERROR_END_OF_TLV); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(callback.mError, CHIP_ERROR_END_OF_TLV); EXPECT_EQ(callback.mOnSuccessCalled, 0); @@ -789,28 +755,26 @@ TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteInvalidMessage2) EXPECT_EQ(callback.mOnDoneCalled, 1); // Client sents status report with invalid action, server's exchange has been closed, so all it sends is an MRP Ack - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); engine->Shutdown(); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } // Write Client sends a write request, receives a malformed status response message. TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteInvalidMessage3) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); TestWriteClientCallback callback; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler()), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); app::WriteClient writeClient(engine->GetExchangeManager(), &callback, Optional::Missing()); @@ -821,15 +785,15 @@ TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteInvalidMessage3) EXPECT_EQ(callback.mOnErrorCalled, 0); EXPECT_EQ(callback.mOnDoneCalled, 0); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 1; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; - EXPECT_EQ(writeClient.SendWriteRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 1; + GetLoopback().mDroppedMessageCount = 0; + EXPECT_EQ(writeClient.SendWriteRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); + DrainAndServiceIO(); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); System::PacketBufferHandle msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); EXPECT_FALSE(msgBuf.IsNull()); @@ -845,15 +809,15 @@ TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteInvalidMessage3) // Since we are dropping packets, things are not getting acked. Set up // our MRP state to look like what it would have looked like if the // packet had not gotten dropped. - PretendWeGotReplyFromServer(*mpTestContext, writeClient.mExchangeCtx.Get()); + PretendWeGotReplyFromServer(*this, writeClient.mExchangeCtx.Get()); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 0; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToAllowBeforeDropping = 0; + GetLoopback().mDroppedMessageCount = 0; EXPECT_EQ(writeClient.OnMessageReceived(writeClient.mExchangeCtx.Get(), payloadHeader, std::move(msgBuf)), CHIP_ERROR_END_OF_TLV); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(callback.mError, CHIP_ERROR_END_OF_TLV); EXPECT_EQ(callback.mOnSuccessCalled, 0); @@ -862,28 +826,26 @@ TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteInvalidMessage3) // TODO: Check that the server gets the right status // Client sents status report with invalid action, server's exchange has been closed, so all it sends is an MRP ack. - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); engine->Shutdown(); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } // Write Client sends a write request, receives a busy status response message. TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteInvalidMessage4) { - Messaging::ReliableMessageMgr * rm = mpTestContext->GetExchangeManager().GetReliableMessageMgr(); + Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); TestWriteClientCallback callback; auto * engine = chip::app::InteractionModelEngine::GetInstance(); - EXPECT_EQ(engine->Init(&mpTestContext->GetExchangeManager(), &mpTestContext->GetFabricTable(), - app::reporting::GetDefaultReportScheduler()), - CHIP_NO_ERROR); + EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), app::reporting::GetDefaultReportScheduler()), CHIP_NO_ERROR); app::WriteClient writeClient(engine->GetExchangeManager(), &callback, Optional::Missing()); @@ -894,15 +856,15 @@ TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteInvalidMessage4) EXPECT_EQ(callback.mOnErrorCalled, 0); EXPECT_EQ(callback.mOnDoneCalled, 0); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 1; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 1; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; - EXPECT_EQ(writeClient.SendWriteRequest(mpTestContext->GetSessionBobToAlice()), CHIP_NO_ERROR); - mpTestContext->DrainAndServiceIO(); + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 1; + GetLoopback().mNumMessagesToAllowBeforeDropping = 1; + GetLoopback().mDroppedMessageCount = 0; + EXPECT_EQ(writeClient.SendWriteRequest(GetSessionBobToAlice()), CHIP_NO_ERROR); + DrainAndServiceIO(); - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); - EXPECT_EQ(mpTestContext->GetLoopback().mDroppedMessageCount, 1u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mDroppedMessageCount, 1u); System::PacketBufferHandle msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); EXPECT_FALSE(msgBuf.IsNull()); @@ -919,15 +881,15 @@ TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteInvalidMessage4) // Since we are dropping packets, things are not getting acked. Set up // our MRP state to look like what it would have looked like if the // packet had not gotten dropped. - PretendWeGotReplyFromServer(*mpTestContext, writeClient.mExchangeCtx.Get()); + PretendWeGotReplyFromServer(*this, writeClient.mExchangeCtx.Get()); - mpTestContext->GetLoopback().mSentMessageCount = 0; - mpTestContext->GetLoopback().mNumMessagesToDrop = 0; - mpTestContext->GetLoopback().mNumMessagesToAllowBeforeDropping = 0; - mpTestContext->GetLoopback().mDroppedMessageCount = 0; + GetLoopback().mSentMessageCount = 0; + GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToAllowBeforeDropping = 0; + GetLoopback().mDroppedMessageCount = 0; EXPECT_EQ(writeClient.OnMessageReceived(writeClient.mExchangeCtx.Get(), payloadHeader, std::move(msgBuf)), CHIP_IM_GLOBAL_STATUS(Busy)); - mpTestContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(callback.mError, CHIP_IM_GLOBAL_STATUS(Busy)); EXPECT_EQ(callback.mOnSuccessCalled, 0); @@ -936,13 +898,13 @@ TEST_F_FROM_FIXTURE(TestWriteInteraction, TestWriteInvalidMessage4) // TODO: Check that the server gets the right status.. // Client sents status report with invalid action, server's exchange has been closed, so it just sends an MRP ack. - EXPECT_EQ(mpTestContext->GetLoopback().mSentMessageCount, 2u); + EXPECT_EQ(GetLoopback().mSentMessageCount, 2u); engine->Shutdown(); - mpTestContext->ExpireSessionAliceToBob(); - mpTestContext->ExpireSessionBobToAlice(); - mpTestContext->CreateSessionAliceToBob(); - mpTestContext->CreateSessionBobToAlice(); + ExpireSessionAliceToBob(); + ExpireSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); } } // namespace app diff --git a/src/app/tests/integration/BUILD.gn b/src/app/tests/integration/BUILD.gn index 6acd4ccdd8d6af..88b3eccc14b6f5 100644 --- a/src/app/tests/integration/BUILD.gn +++ b/src/app/tests/integration/BUILD.gn @@ -44,6 +44,7 @@ executable("chip-im-initiator") { deps = [ ":common", "${chip_root}/src/app", + "${chip_root}/src/app/util/mock:mock_codegen_data_model", "${chip_root}/src/app/util/mock:mock_ember", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", @@ -67,6 +68,7 @@ executable("chip-im-responder") { deps = [ ":common", "${chip_root}/src/app", + "${chip_root}/src/app/util/mock:mock_codegen_data_model", "${chip_root}/src/app/util/mock:mock_ember", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", diff --git a/src/app/tests/suites/TestClusterComplexTypes.yaml b/src/app/tests/suites/TestClusterComplexTypes.yaml index e6dccc4d6c3493..e1edf7d327c921 100644 --- a/src/app/tests/suites/TestClusterComplexTypes.yaml +++ b/src/app/tests/suites/TestClusterComplexTypes.yaml @@ -70,7 +70,7 @@ tests: # expires. busyWaitMs: 100 response: - error: UNSUPPORTED_ACCESS + error: TIMEOUT - label: "Send command that does not need timed invoke with a long timeout @@ -88,7 +88,7 @@ tests: # expires. busyWaitMs: 100 response: - error: UNSUPPORTED_ACCESS + error: TIMEOUT # The timed write tests are not in TestCluster.yaml for now because Darwin # SDK APIs have not been updated to do timed invoke properly yet. @@ -125,7 +125,7 @@ tests: # expires. busyWaitMs: 100 response: - error: UNSUPPORTED_ACCESS + error: TIMEOUT - label: "Read attribute that needs timed write state unchanged 2" command: "readAttribute" @@ -173,7 +173,7 @@ tests: # expires. busyWaitMs: 100 response: - error: UNSUPPORTED_ACCESS + error: TIMEOUT - label: "Read attribute that does not need timed write unchanged value" command: "readAttribute" diff --git a/src/app/tests/suites/TestDescriptorCluster.yaml b/src/app/tests/suites/TestDescriptorCluster.yaml index b6b2cbc73e9f42..39179e1143bd75 100644 --- a/src/app/tests/suites/TestDescriptorCluster.yaml +++ b/src/app/tests/suites/TestDescriptorCluster.yaml @@ -82,7 +82,7 @@ tests: command: "readAttribute" attribute: "PartsList" response: - value: [1, 2] + value: [1, 2, 3, 4] - label: "Read attribute ClusterRevision" command: "readAttribute" diff --git a/src/app/tests/suites/TestScenesFabricSceneInfo.yaml b/src/app/tests/suites/TestScenesFabricSceneInfo.yaml index a15f9f0ef310a1..ba83953588bd3b 100644 --- a/src/app/tests/suites/TestScenesFabricSceneInfo.yaml +++ b/src/app/tests/suites/TestScenesFabricSceneInfo.yaml @@ -208,12 +208,50 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], + }, + { + ClusterID: 0x0300, + AttributeValueList: + [ + { + AttributeID: 0x0001, + ValueUnsigned8: 0x64, + }, + { + AttributeID: 0x0003, + ValueUnsigned16: 0x64, + }, + { + AttributeID: 0x0004, + ValueUnsigned16: 0x64, + }, + { + AttributeID: 0x0007, + ValueUnsigned16: 0x64, + }, + { + AttributeID: 0x4000, + ValueUnsigned16: 0x64, + }, + { + AttributeID: 0x4001, + ValueUnsigned8: 0x64, + }, + { + AttributeID: 0x4002, + ValueUnsigned8: 0x64, + }, + { + AttributeID: 0x4003, + ValueUnsigned8: 0x64, + }, + ], }, ] response: @@ -266,12 +304,50 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], + }, + { + ClusterID: 0x0300, + AttributeValueList: + [ + { + AttributeID: 0x0001, + ValueUnsigned8: 0x64, + }, + { + AttributeID: 0x0003, + ValueUnsigned16: 0x64, + }, + { + AttributeID: 0x0004, + ValueUnsigned16: 0x64, + }, + { + AttributeID: 0x0007, + ValueUnsigned16: 0x64, + }, + { + AttributeID: 0x4000, + ValueUnsigned16: 0x64, + }, + { + AttributeID: 0x4001, + ValueUnsigned8: 0x64, + }, + { + AttributeID: 0x4002, + ValueUnsigned8: 0x64, + }, + { + AttributeID: 0x4003, + ValueUnsigned8: 0x64, + }, + ], }, ] @@ -334,12 +410,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x00 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x00 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0xFA }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0xFA }], }, ] @@ -367,12 +443,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x00 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x00 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0xFA }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0xFA }], }, ] diff --git a/src/app/tests/suites/TestScenesMultiFabric.yaml b/src/app/tests/suites/TestScenesMultiFabric.yaml index f969270426bf19..d0e79798acb904 100644 --- a/src/app/tests/suites/TestScenesMultiFabric.yaml +++ b/src/app/tests/suites/TestScenesMultiFabric.yaml @@ -345,12 +345,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], }, ] response: @@ -451,12 +451,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], }, ] response: diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index cf0159804aeee3..3edf69e6a3b739 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -10199,3 +10199,19 @@ PICS: - label: "Does the device implement the ActiveEndpoints attribute?" id: PWRTL.S.A0001 + + # + # Thread Network Directory Cluster + # + - label: + "Does the device implement the Thread Network Directory cluster as a + server" + id: THNETDIR.S + + # + # Wi-Fi Network Management Cluster + # + - label: + "Does the device implement the Wi-Fi Network Management cluster as a + server" + id: WIFINM.S diff --git a/src/app/tests/suites/certification/Test_TC_CC_3_2.yaml b/src/app/tests/suites/certification/Test_TC_CC_3_2.yaml index 0c21f1a6ffcfb1..398ec48f36f4d2 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_3_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_3_2.yaml @@ -346,6 +346,58 @@ tests: minValue: 0 maxValue: 3 + - label: + "Step 5a: TH sends MoveHue command to DUT with MoveMode=0x01 (up) and + Rate=0 (units/s)" + PICS: CC.S.F00 && CC.S.C01.Rsp + command: "MoveHue" + arguments: + values: + - name: "MoveMode" + value: 1 + - name: "Rate" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + + - label: + "Step 5b: TH sends MoveHue command to DUT with MoveMode=0x03 (down) + and Rate=0 (units/s)" + PICS: CC.S.F00 && CC.S.C01.Rsp + command: "MoveHue" + arguments: + values: + - name: "MoveMode" + value: 3 + - name: "Rate" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + + - label: + "Step 5c: TH sends MoveHue command to DUT with MoveMode=0x00 (stop) + and Rate=0 (units/s)" + PICS: CC.S.F00 && CC.S.C01.Rsp + command: "MoveHue" + arguments: + values: + - name: "MoveMode" + value: 0 + - name: "Rate" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + - label: "Turn off light that we turned on" PICS: OO.S.C00.Rsp cluster: "On/Off" diff --git a/src/app/tests/suites/certification/Test_TC_CC_3_3.yaml b/src/app/tests/suites/certification/Test_TC_CC_3_3.yaml index 53175d974716ea..91cdcbffe7d255 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_3_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_3_3.yaml @@ -287,6 +287,46 @@ tests: minValue: 0 maxValue: 3 + - label: + "Step 5a: TH sends StepHue command to DUT with StepMode=0x01 (up), + StepSize=0" + PICS: CC.S.F00 && CC.S.C02.Rsp + command: "StepHue" + arguments: + values: + - name: "StepMode" + value: 1 + - name: "StepSize" + value: 0 + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + + - label: + "Step 5b: TH sends StepHue command to DUT with StepMode=0x03 (down), + StepSize=0" + PICS: CC.S.F00 && CC.S.C02.Rsp + command: "StepHue" + arguments: + values: + - name: "StepMode" + value: 3 + - name: "StepSize" + value: 0 + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + - label: "Turn off light that we turned on" PICS: OO.S.C00.Rsp cluster: "On/Off" diff --git a/src/app/tests/suites/certification/Test_TC_CC_4_2.yaml b/src/app/tests/suites/certification/Test_TC_CC_4_2.yaml index 4b6630f18d4b92..0438a6e376f0ee 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_4_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_4_2.yaml @@ -357,6 +357,42 @@ tests: minValue: 0 maxValue: 3 + - label: + "Step 6a: TH sends MoveSaturation command to DUT with MoveMode=0x01 + (up) and Rate=0 (units/s)" + command: "MoveSaturation" + PICS: CC.S.F00 && CC.S.C04.Rsp + arguments: + values: + - name: "MoveMode" + value: 1 + - name: "Rate" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + + - label: + "Step 6b: TH sends MoveSaturation command to DUT with MoveMode=0x03 + (down) and Rate=0 (units/s)" + command: "MoveSaturation" + PICS: CC.S.F00 && CC.S.C04.Rsp + arguments: + values: + - name: "MoveMode" + value: 3 + - name: "Rate" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + - label: "Turn off light that we turned on" PICS: OO.S.C00.Rsp cluster: "On/Off" diff --git a/src/app/tests/suites/certification/Test_TC_CC_4_3.yaml b/src/app/tests/suites/certification/Test_TC_CC_4_3.yaml index 8a6a953fb25af8..02826ab6bfef76 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_4_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_4_3.yaml @@ -327,6 +327,46 @@ tests: minValue: 0 maxValue: 3 + - label: + "Step 5a: TH sends StepSaturation command to DUT with StepMode=0x01 + (up), StepSize=0" + PICS: CC.S.F00 && CC.S.C05.Rsp + command: "StepSaturation" + arguments: + values: + - name: "StepMode" + value: 1 + - name: "StepSize" + value: 0 + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + + - label: + "Step 5b: TH sends StepSaturation command to DUT with StepMode=0x03 + (down), StepSize=0" + PICS: CC.S.F00 && CC.S.C05.Rsp + command: "StepSaturation" + arguments: + values: + - name: "StepMode" + value: 3 + - name: "StepSize" + value: 0 + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + - label: "Turn off light that we turned on" PICS: OO.S.C00.Rsp cluster: "On/Off" diff --git a/src/app/tests/suites/certification/Test_TC_CC_5_2.yaml b/src/app/tests/suites/certification/Test_TC_CC_5_2.yaml index 17da61ef9ccb57..0c88fdaa0cb906 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_5_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_5_2.yaml @@ -217,6 +217,21 @@ tests: minValue: 0 maxValue: 3 + - label: + "Step 5a: TH sends MoveColor command to DUT with RateX=0 and RateY=0" + command: "MoveColor" + PICS: CC.S.F03 && CC.S.C08.Rsp + arguments: + values: + - name: "RateX" + value: 0 + - name: "RateY" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + - label: "Turn off light that we turned on" PICS: OO.S.C00.Rsp cluster: "On/Off" diff --git a/src/app/tests/suites/certification/Test_TC_CC_5_3.yaml b/src/app/tests/suites/certification/Test_TC_CC_5_3.yaml index 4e8eba6ced993f..1f949647cefe4f 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_5_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_5_3.yaml @@ -189,6 +189,25 @@ tests: minValue: 0 maxValue: 3 + - label: + "Step 5a: TH sends StepColor command to DUT with StepX = 0, StepY = 0" + command: "StepColor" + PICS: CC.S.F03 && CC.S.C09.Rsp + arguments: + values: + - name: "StepX" + value: 0 + - name: "StepY" + value: 0 + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + - label: "Turn off light that we turned on" PICS: OO.S.C00.Rsp cluster: "On/Off" diff --git a/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml b/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml index f5259372823048..2283df1214e72e 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_6_2.yaml @@ -364,8 +364,73 @@ tests: constraints: minValue: 0 maxValue: 3 + - label: - "Step 6a: TH sends MoveColorTemperature command to DUT with MoveMode = + "Step 6a: TH sends _MoveColorTemperature command_ to DUT with + MoveMode=0x01 (up) and Rate=0 (units/s)" + PICS: CC.S.F04 && CC.S.C4b.Rsp + command: MoveColorTemperature + arguments: + values: + - name: "MoveMode" + value: 1 + - name: "Rate" + value: 0 + - name: "ColorTemperatureMinimumMireds" + value: 0 + - name: "ColorTemperatureMaximumMireds" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + + - label: + "Step 6b: TH sends _MoveColorTemperature command_ to DUT with + MoveMode=0x03 (down) and Rate=0 (units/s)" + PICS: CC.S.F04 && CC.S.C4b.Rsp + command: MoveColorTemperature + arguments: + values: + - name: "MoveMode" + value: 3 + - name: "Rate" + value: 0 + - name: "ColorTemperatureMinimumMireds" + value: 0 + - name: "ColorTemperatureMaximumMireds" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + + - label: + "Step 6c: TH sends _MoveColorTemperature command_ to DUT with + MoveMode=0x00 (stop) and Rate=0 (units/s)" + PICS: CC.S.F04 && CC.S.C4b.Rsp + command: MoveColorTemperature + arguments: + values: + - name: "MoveMode" + value: 0 + - name: "Rate" + value: 0 + - name: "ColorTemperatureMinimumMireds" + value: 0 + - name: "ColorTemperatureMaximumMireds" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + + - label: + "Step 7a: TH sends MoveColorTemperature command to DUT with MoveMode = 0x03(down), Rate = 65535 (max value) with ColorTemperatureMinimumMireds of 0" PICS: CC.S.F04 && CC.S.C4b.Rsp @@ -394,7 +459,7 @@ tests: - name: "ms" value: 1000 - - label: "Step 6b: TH reads ColorTemperatureMireds attribute from DUT." + - label: "Step 7b: TH reads ColorTemperatureMireds attribute from DUT." PICS: CC.S.F04 && CC.S.A0007 && CC.S.C4b.Rsp command: "readAttribute" attribute: "ColorTemperatureMireds" @@ -405,7 +470,7 @@ tests: maxValue: ColorTempPhysicalMaxMiredsValue - label: - "Step 7a: TH sends MoveColorTemperature command to DUT with MoveMode = + "Step 8a: TH sends MoveColorTemperature command to DUT with MoveMode = 0x01(up), Rate = 65535 (max value) with ColorTemperatureMaximumMireds of 0" PICS: CC.S.F04 && CC.S.C4b.Rsp @@ -434,7 +499,7 @@ tests: - name: "ms" value: 1000 - - label: "Step 7b: TH reads ColorTemperatureMireds attribute from DUT." + - label: "Step 8b: TH reads ColorTemperatureMireds attribute from DUT." PICS: CC.S.F04 && CC.S.A0007 && CC.S.C4b.Rsp command: "readAttribute" attribute: "ColorTemperatureMireds" diff --git a/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml b/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml index 437ef78af33f27..5222aec2aa198c 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_6_3.yaml @@ -288,7 +288,55 @@ tests: maxValue: 3 - label: - "Step 5a: TH sends StepColorTemperature command to DUT with StepMode = + "Step 5a: TH sends StepColorTemperature command to DUT with + StepMode=0x01 (up), StepSize=0" + PICS: CC.S.F04 && CC.S.C4c.Rsp + command: "StepColorTemperature" + arguments: + values: + - name: "StepMode" + value: 1 + - name: "StepSize" + value: 0 + - name: "ColorTemperatureMinimumMireds" + value: 0 + - name: "ColorTemperatureMaximumMireds" + value: 0 + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + + - label: + "Step 5ab TH sends StepColorTemperature command to DUT with + StepMode=0x03 (down), StepSize=0" + PICS: CC.S.F04 && CC.S.C4c.Rsp + command: "StepColorTemperature" + arguments: + values: + - name: "StepMode" + value: 3 + - name: "StepSize" + value: 0 + - name: "ColorTemperatureMinimumMireds" + value: 0 + - name: "ColorTemperatureMaximumMireds" + value: 0 + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + + - label: + "Step 6a: TH sends StepColorTemperature command to DUT with StepMode = 0x01 (up), StepSize = ColorTempPhysicalMaxMireds and TransitionTime = 0 (instant)." PICS: CC.S.F04 && CC.S.C4c.Rsp @@ -319,7 +367,7 @@ tests: - name: "ms" value: 100 - - label: "Step 5b: TH reads ColorTemperatureMireds attribute from DUT." + - label: "Step 6b: TH reads ColorTemperatureMireds attribute from DUT." PICS: CC.S.F04 && CC.S.A0007 && CC.S.C4c.Rsp command: "readAttribute" attribute: "ColorTemperatureMireds" @@ -330,7 +378,7 @@ tests: maxValue: ColorTempPhysicalMaxMiredsValue - label: - "Step 6a: TH sends StepColorTemperature command to DUT with StepMode = + "Step 7a: TH sends StepColorTemperature command to DUT with StepMode = 0x03 (down), StepSize = ColorTempPhysicalMaxMireds and TransitionTime = 0 (instant)." PICS: CC.S.F04 && CC.S.C4c.Rsp @@ -361,7 +409,7 @@ tests: - name: "ms" value: 100 - - label: "Step 6b: TH reads ColorTemperatureMireds attribute from DUT." + - label: "Step 7b: TH reads ColorTemperatureMireds attribute from DUT." PICS: CC.S.F04 && CC.S.A0007 && CC.S.C4c.Rsp command: "readAttribute" attribute: "ColorTemperatureMireds" diff --git a/src/app/tests/suites/certification/Test_TC_CC_7_2.yaml b/src/app/tests/suites/certification/Test_TC_CC_7_2.yaml index b9ded89a132a6f..18f1113d4928b6 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_7_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_7_2.yaml @@ -329,6 +329,58 @@ tests: minValue: 0 maxValue: 3 + - label: + "Step 5a: TH sends EnhancedMoveHue command to DUT with MoveMode=0x01 + (up) and Rate=0 (units/s)" + PICS: CC.S.F01 && CC.S.C41.Rsp" + command: "EnhancedMoveHue" + arguments: + values: + - name: "MoveMode" + value: 1 + - name: "Rate" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + + - label: + "Step 5b: TH sends EnhancedMoveHue command to DUT with MoveMode=0x03 + (down) and Rate=0 (units/s)" + PICS: CC.S.F01 && CC.S.C41.Rsp + command: "EnhancedMoveHue" + arguments: + values: + - name: "MoveMode" + value: 3 + - name: "Rate" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + + - label: + "Step 5c: TH sends EnhancedMoveHue command to DUT with MoveMode=0x00 + (stop) and Rate=0 (units/s)" + PICS: CC.S.F01 && CC.S.C41.Rsp + command: "EnhancedMoveHue" + arguments: + values: + - name: "MoveMode" + value: 0 + - name: "Rate" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + - label: "Turn Off light that we turned on" PICS: OO.S.C00.Rsp cluster: "On/Off" diff --git a/src/app/tests/suites/certification/Test_TC_CC_7_3.yaml b/src/app/tests/suites/certification/Test_TC_CC_7_3.yaml index 53bf4ba4883f3c..bfdfd26ed3ca1a 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_7_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_7_3.yaml @@ -299,6 +299,46 @@ tests: minValue: 0 maxValue: 3 + - label: + "Step 7a: TH sends EnhancedStepHue command to DUT with StepMode=0x01 + (up), StepSize=0" + PICS: CC.S.F01 && CC.S.C42.Rsp + command: "EnhancedStepHue" + arguments: + values: + - name: "StepMode" + value: 1 + - name: "StepSize" + value: 0 + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + + - label: + "Step 7b: TH sends EnhancedStepHue command to DUT with StepMode=0x03 + (down), StepSize=0" + PICS: CC.S.F01 && CC.S.C42.Rsp + command: "EnhancedStepHue" + arguments: + values: + - name: "StepMode" + value: 3 + - name: "StepSize" + value: 0 + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + response: + error: INVALID_COMMAND + - label: "Turn Off light that we turned on" PICS: OO.S.C00.Rsp cluster: "On/Off" diff --git a/src/app/tests/suites/certification/Test_TC_ICDM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_ICDM_1_1.yaml index 08bdb9322b2b1a..fb507fd7a89663 100755 --- a/src/app/tests/suites/certification/Test_TC_ICDM_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_ICDM_1_1.yaml @@ -35,7 +35,7 @@ tests: command: "readAttribute" attribute: "ClusterRevision" response: - value: 2 + value: 3 constraints: type: int16u diff --git a/src/app/tests/suites/certification/Test_TC_IDM_5_2.yaml b/src/app/tests/suites/certification/Test_TC_IDM_5_2.yaml index dbff45ceff5b9d..534154cb6d7e3c 100644 --- a/src/app/tests/suites/certification/Test_TC_IDM_5_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_IDM_5_2.yaml @@ -94,30 +94,19 @@ tests: verification: | ./chip-tool onoff on 1 1 --repeat-delay-ms 5000 --timedInteractionTimeoutMs 200 - On TH(chip-tool), Verify we are getting status response and UNSUPPORTED_ACCESS from DUT to TH for above command - - [1649686333.696111][3252:3257] CHIP:DMG: StatusResponseMessage = - [1649686333.696178][3252:3257] CHIP:DMG: { - [1649686333.696236][3252:3257] CHIP:DMG: Status = 0x0, - [1649686333.696311][3252:3257] CHIP:DMG: InteractionModelRevision = 1 - [1649686333.696375][3252:3257] CHIP:DMG: } - [1649686333.696434][3252:3257] CHIP:IM: Received status response, status is 0x00 (SUCCESS) - [1649686333.696513][3252:3257] CHIP:EM: Piggybacking Ack for MessageCounter:3570360 on exchange: 28108i - [1649686333.696626][3252:3257] CHIP:IN: Prepared secure message 0xaaaae019e098 to 0x0000000000000001 (1) of type 0x8 and protocolId (0, 1) on exchange 28108i with MessageCounter:6840786. - [1649686333.696711][3252:3257] CHIP:IN: Sending encrypted msg 0xaaaae019e098 with MessageCounter:6840786 to 0x0000000000000001 (1) at monotonic time: 0000000000CE3312 msec - [1649686333.696989][3252:3257] CHIP:DMG: ICR moving to [CommandSen] - [1649686333.698938][3252:3257] CHIP:EM: Received message of type 0x1 with protocolId (0, 1) and MessageCounter:3570361 on exchange 28108i - [1649686333.699013][3252:3257] CHIP:EM: Found matching exchange: 28108i, Delegate: 0xffff68005c30 - [1649686333.699089][3252:3257] CHIP:EM: Rxd Ack; Removing MessageCounter:6840786 from Retrans Table on exchange 28108i - [1649686333.699147][3252:3257] CHIP:EM: Removed CHIP MessageCounter:6840786 from RetransTable on exchange 28108i - [1649686333.699215][3252:3257] CHIP:DMG: ICR moving to [ResponseRe] - [1649686333.699294][3252:3257] CHIP:DMG: StatusResponseMessage = - [1649686333.699354][3252:3257] CHIP:DMG: { - [1649686333.699410][3252:3257] CHIP:DMG: Status = 0x7e, - [1649686333.699471][3252:3257] CHIP:DMG: InteractionModelRevision = 1 - [1649686333.699528][3252:3257] CHIP:DMG: } - [1649686333.699585][3252:3257] CHIP:IM: Received status response, status is 0x7e (UNSUPPORTED_ACCESS) - [1649686333.699661][3252:3257] CHIP:TOO: Error: IM Error 0x0000057E: General error: 0x7e (UNSUPPORTED_ACCESS) + If the device being certified is Matter release 1.4 or later, verify DUT sends back a Status response with the TIMEOUT status code. + If the device being certified is Matter release 1.3 or earlier, verify the DUT sends back a Status response with either TIMEOUT or UNSUPPORTED_ACCESS status code. + + [1718641649.158222][1587554:1587556] CHIP:EM: Rxd Ack; Removing MessageCounter:70404585 from Retrans Table on exchange 44026i + [1718641649.158241][1587554:1587556] CHIP:DMG: ICR moving to [ResponseRe] + [1718641649.158261][1587554:1587556] CHIP:DMG: StatusResponseMessage = + [1718641649.158276][1587554:1587556] CHIP:DMG: { + [1718641649.158290][1587554:1587556] CHIP:DMG: Status = 0x94 (TIMEOUT), + [1718641649.158304][1587554:1587556] CHIP:DMG: InteractionModelRevision = 11 + [1718641649.158318][1587554:1587556] CHIP:DMG: } + [1718641649.158332][1587554:1587556] CHIP:IM: Received status response, status is 0x94 (TIMEOUT) + [1718641649.158355][1587554:1587556] CHIP:TOO: Error: IM Error 0x00000594: General error: 0x94 (TIMEOUT) + disabled: true - label: @@ -128,15 +117,16 @@ tests: verification: | ./chip-tool modeselect write on-mode 0 1 1 --repeat-delay-ms 1000 --timedInteractionTimeoutMs 500 - On TH(chip-tool), Verify we are getting status response and UNSUPPORTED_ACCESS from DUT to TH for above command - - [1654771611.106067][28715:28720] CHIP:DMG: WriteClient moving to [ResponseRe] - [1654771611.106112][28715:28720] CHIP:DMG: StatusResponseMessage = - [1654771611.106140][28715:28720] CHIP:DMG: { - [1654771611.106165][28715:28720] CHIP:DMG: Status = 0x7e (UNSUPPORTED_ACCESS), - [1654771611.106192][28715:28720] CHIP:DMG: InteractionModelRevision = 1 - [1654771611.106216][28715:28720] CHIP:DMG: } - [1654771611.106244][28715:28720] CHIP:IM: Received status response, status is 0x7e (UNSUPPORTED_ACCESS) - [1654771611.106280][28715:28720] CHIP:TOO: Error: IM Error 0x0000057E: General error: 0x7e (UNSUPPORTED_ACCESS) - [1654771611.106303][28715:28720] CHIP:DMG: WriteClient moving to [AwaitingDe] + If the device being certified is Matter release 1.4 or later, verify DUT sends back a Status response with the TIMEOUT status code. + If the device being certified is Matter release 1.3 or earlier, verify the DUT sends back a Status response with either TIMEOUT or UNSUPPORTED_ACCESS status code. + + [1720104134.620521][3325282:3325284] CHIP:DMG: WriteClient moving to [ResponseRe] + [1720104134.620540][3325282:3325284] CHIP:DMG: StatusResponseMessage = + [1720104134.620555][3325282:3325284] CHIP:DMG: { + [1720104134.620569][3325282:3325284] CHIP:DMG: Status = 0x94 (TIMEOUT), + [1720104134.620583][3325282:3325284] CHIP:DMG: InteractionModelRevision = 11 + [1720104134.620596][3325282:3325284] CHIP:DMG: } + [1720104134.620611][3325282:3325284] CHIP:IM: Received status response, status is 0x94 (TIMEOUT) + [1720104134.620689][3325282:3325284] CHIP:TOO: Error: IM Error 0x00000594: General error: 0x94 (TIMEOUT) + disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_LVL_2_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_2_1.yaml index b930badc0971a1..8e9ee05b33e9ff 100644 --- a/src/app/tests/suites/certification/Test_TC_LVL_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_LVL_2_1.yaml @@ -215,7 +215,7 @@ tests: response: constraints: type: int8u - minValue: 0 + minValue: 1 maxValue: 255 - label: "Step 13: TH reads the Options attribute from the DUT" diff --git a/src/app/tests/suites/certification/Test_TC_LVL_4_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_4_1.yaml index 14ac5ea5a69ffd..65e5ede6845c2c 100644 --- a/src/app/tests/suites/certification/Test_TC_LVL_4_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_LVL_4_1.yaml @@ -269,7 +269,7 @@ tests: - label: "Step 4h: TH sends a Move command to the DUT with MoveMode =0x00 (up) - and Rate =0 (units/s), expect success" + and Rate =0 (units/s), expect failure" PICS: LVL.S.C01.Rsp command: "Move" arguments: @@ -282,6 +282,8 @@ tests: value: 1 - name: "OptionsOverride" value: 1 + response: + error: INVALID_COMMAND - label: "Wait 5s" cluster: "DelayCommands" diff --git a/src/app/tests/suites/certification/Test_TC_LVL_9_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_9_1.yaml new file mode 100644 index 00000000000000..36da12403f5e9d --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_LVL_9_1.yaml @@ -0,0 +1,264 @@ +# 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. + +name: 4.2.4. [TC-LVL-9.1] Scenes Management Cluster Interaction (DUT as Server) + +PICS: + - LVL.S + - S.S + +config: + nodeId: 0x12344321 + cluster: "Scenes Management" + endpoint: 1 + G1: + type: group_id + defaultValue: 0x0001 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: + "Step 0a :TH sends KeySetWrite command in the GroupKeyManagement + cluster to DUT using a key that is pre-installed on the TH. + GroupKeySet fields are as follows:" + cluster: "Group Key Management" + endpoint: 0 + command: "KeySetWrite" + arguments: + values: + - name: "GroupKeySet" + value: + { + GroupKeySetID: 0x01a1, + GroupKeySecurityPolicy: 0, + EpochKey0: "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf", + EpochStartTime0: 1110000, + EpochKey1: "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf", + EpochStartTime1: 1110001, + EpochKey2: "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", + EpochStartTime2: 1110002, + } + + - label: + "Step 0b: TH binds GroupIds 0x0001 and 0x0002 with GroupKeySetID + 0x01a1 in the GroupKeyMap attribute list on GroupKeyManagement cluster + by writing the GroupKeyMap attribute with two entries as follows:" + cluster: "Group Key Management" + endpoint: 0 + command: "writeAttribute" + attribute: "GroupKeyMap" + arguments: + value: [{ FabricIndex: 1, GroupId: G1, GroupKeySetID: 0x01a1 }] + + - label: "Step 0c: TH sends a RemoveAllGroups command to DUT." + cluster: "Groups" + endpoint: endpoint + command: "RemoveAllGroups" + + - label: + "Step 1a: TH sends a AddGroup command to DUT with the GroupID field + set to G1." + cluster: "Groups" + command: "AddGroup" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "GroupName" + value: "Group1" + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + + - label: + "Step 1b: TH sends a RemoveAllScenes command to DUT with the GroupID + field set to G1." + command: "RemoveAllScenes" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + - label: + "Step 1c: TH sends a GetSceneMembership command to DUT with the + GroupID field set to G1." + command: "GetSceneMembership" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + - name: "SceneList" + value: [] + + - label: + "Step 2a: TH sends a MoveToLevel command to DUT, with Level =0 and + TransitionTime =0 (immediate)" + cluster: "Level Control" + command: "MoveToLevel" + arguments: + values: + - name: "Level" + value: 0 + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 1 + - name: "OptionsOverride" + value: 1 + + - label: "Step 2b: TH reads the MinLevel attribute from the DUT" + cluster: "Level Control" + command: "readAttribute" + attribute: "MinLevel" + response: + saveAs: MinLevelValue + constraints: + type: int8u + + - label: "Step 2c: TH reads the CurrentLevel attribute from DUT" + cluster: "Level Control" + command: "readAttribute" + attribute: "CurrentLevel" + response: + value: MinLevelValue + + - label: + "Step 3: TH sends a StoreScene command to DUT with the GroupID field + set to G1 and the SceneID field set to 0x01." + command: "StoreScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + + - label: "Step 4: TH sends a AddScene command to DUT with the GroupID field + set to G1, the SceneID field set to 0x02, the TransitionTime field set + to 0 and the ExtensionFieldSets set to: '[{ ClusterID: 0x0008, + AttributeValueList: [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }]}]' + " + command: "AddScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x02 + - name: "TransitionTime" + value: 0 + - name: "SceneName" + value: "Scene1" + - name: "ExtensionFieldSets" + value: + [ + { + ClusterID: 0x0008, + AttributeValueList: + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], + }, + ] + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x02 + + - label: + "Step 5a: TH sends a RecallScene command to DUT with the GroupID field + set to G1 and the SceneID field set to 0x02." + command: "RecallScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x02 + + - label: "Step 5b: TH reads the CurrentLevel attribute from DUT" + cluster: "Level Control" + command: "readAttribute" + attribute: "CurrentLevel" + response: + value: 0x64 + + - label: + "Step 6a: TH sends a RecallScene command to DUT with the GroupID field + set to G1 and the SceneID field set to 0x01." + command: "RecallScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + + - label: "Step 6c: TH reads the CurrentLevel attribute from DUT" + cluster: "Level Control" + command: "readAttribute" + attribute: "CurrentLevel" + response: + value: MinLevelValue + + - label: + "Cleanup: TH sends a RemoveAllScenes command to DUT with the GroupID + field set to G1." + command: "RemoveAllScenes" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + + - label: "Cleanup: TH sends a RemoveAllGroups command to DUT." + cluster: "Groups" + endpoint: endpoint + command: "RemoveAllGroups" diff --git a/src/app/tests/suites/certification/Test_TC_OO_2_7.yaml b/src/app/tests/suites/certification/Test_TC_OO_2_7.yaml new file mode 100644 index 00000000000000..19183ba79aff8d --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_OO_2_7.yaml @@ -0,0 +1,269 @@ +# 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. + +name: 4.2.4. [TC-OO-2.7] Scenes Management Cluster Interaction (DUT as Server) + +PICS: + - OO.S + - S.S + +config: + nodeId: 0x12344321 + cluster: "Scenes Management" + endpoint: 1 + G1: + type: group_id + defaultValue: 0x0001 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: + "Step 0a :TH sends KeySetWrite command in the GroupKeyManagement + cluster to DUT using a key that is pre-installed on the TH. + GroupKeySet fields are as follows:" + cluster: "Group Key Management" + endpoint: 0 + command: "KeySetWrite" + arguments: + values: + - name: "GroupKeySet" + value: + { + GroupKeySetID: 0x01a1, + GroupKeySecurityPolicy: 0, + EpochKey0: "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf", + EpochStartTime0: 1110000, + EpochKey1: "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf", + EpochStartTime1: 1110001, + EpochKey2: "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", + EpochStartTime2: 1110002, + } + + - label: + "Step 0b: TH binds GroupIds 0x0001 and 0x0002 with GroupKeySetID + 0x01a1 in the GroupKeyMap attribute list on GroupKeyManagement cluster + by writing the GroupKeyMap attribute with two entries as follows:" + cluster: "Group Key Management" + endpoint: 0 + command: "writeAttribute" + attribute: "GroupKeyMap" + arguments: + value: [{ FabricIndex: 1, GroupId: G1, GroupKeySetID: 0x01a1 }] + + - label: "Step 0c: TH sends a RemoveAllGroups command to DUT." + cluster: "Groups" + endpoint: endpoint + command: "RemoveAllGroups" + + - label: + "Step 1a: TH sends a AddGroup command to DUT with the GroupID field + set to G1." + cluster: "Groups" + command: "AddGroup" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "GroupName" + value: "Group1" + response: + values: + - name: "Status" + value: 0 + - name: "GroupID" + value: G1 + + - label: + "Step 1b: TH sends a RemoveAllScenes command to DUT with the GroupID + field set to G1." + command: "RemoveAllScenes" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + - label: + "Step 1c: TH sends a GetSceneMembership command to DUT with the + GroupID field set to G1." + command: "GetSceneMembership" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + - name: "SceneList" + value: [] + + - label: "Step 2a: TH sends Off command to DUT" + cluster: "On/Off" + command: "Off" + + - label: "Wait 1000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Step 2b: after a few seconds, TH reads OnOff attribute from DUT" + cluster: "On/Off" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: + "Step 2b: TH sends a StoreScene command to DUT with the GroupID field + set to G1 and the SceneID field set to 0x01." + command: "StoreScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + + - label: "Step 3: TH sends a AddScene command to DUT with the GroupID field + set to G1, the SceneID field set to 0x02, the TransitionTime field set + to 1000 (1s) and the ExtensionFieldSets set to: '[{ ClusterID: 0x0006, + AttributeValueList: [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }]}]' + " + command: "AddScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x02 + - name: "TransitionTime" + value: 1000 + - name: "SceneName" + value: "Scene1" + - name: "ExtensionFieldSets" + value: + [ + { + ClusterID: 0x0006, + AttributeValueList: + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], + }, + ] + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x02 + + - label: + "Step 4a: TH sends a RecallScene command to DUT with the GroupID field + set to G1 and the SceneID field set to 0x02." + PICS: S.S.C05.Rsp + command: "RecallScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x02 + + - label: "Wait 2000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 2000 + + - label: "Step 4b: after a few seconds, TH reads OnOff attribute from DUT" + cluster: "On/Off" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: + "Step 5a: TH sends a RecallScene command to DUT with the GroupID field + set to G1 and the SceneID field set to 0x01." + PICS: S.S.C05.Rsp + command: "RecallScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0x01 + + - label: "Wait 1000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Step 5b: after a few seconds, TH reads OnOff attribute from DUT" + cluster: "On/Off" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: + "Cleanup: TH sends a RemoveAllScenes command to DUT with the GroupID + field set to G1." + command: "RemoveAllScenes" + arguments: + values: + - name: "GroupID" + value: G1 + response: + values: + - name: "Status" + value: 0x00 + - name: "GroupID" + value: G1 + + - label: "Cleanup: TH sends a RemoveAllGroups command to DUT." + cluster: "Groups" + endpoint: endpoint + command: "RemoveAllGroups" diff --git a/src/app/tests/suites/certification/Test_TC_OPCREDS_3_3.yaml b/src/app/tests/suites/certification/Test_TC_OPCREDS_3_3.yaml index f7ca4a135ce56d..8c6391cbd2aa14 100644 --- a/src/app/tests/suites/certification/Test_TC_OPCREDS_3_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_OPCREDS_3_3.yaml @@ -35,11 +35,10 @@ tests: disabled: true - label: - "Step 1: Factory Reset DUT (to ensure NOC list is empty at the + "Step 1: Factory Reset TH (to ensure NOC list is empty at the beginning of the following steps)" - PICS: MCORE.UI.FACTORYRESET verification: | - On both DUT and TH side, on Raspi we do factory reset with the below command. The DUT for cert should follow vendor specific procedure for factory reset + On Raspi factory reset with the below command. sudo rm -rf /tmp/chip_* disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_S_2_2.yaml b/src/app/tests/suites/certification/Test_TC_S_2_2.yaml index 02407f8807d993..bdb3d2b8ad90db 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_2.yaml @@ -81,7 +81,20 @@ tests: value: maxScenesMinusOne / 2 - label: - "Step 0a :TH sends KeySetWrite command in the GroupKeyManagement + "Step 0a :TH reads attribute {ServerList} from the Descriptor cluster + of the endpoint that implements the Scenes Management server on the + DUT. DUT responds with a list of server clusters containing the groups + cluster." + cluster: "Descriptor" + command: "readAttribute" + attribute: "ServerList" + response: + constraints: + type: list + contains: [4] + + - label: + "Step 0b :TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT using a key that is pre-installed on the TH. GroupKeySet fields are as follows:" cluster: "Group Key Management" @@ -103,7 +116,7 @@ tests: } - label: - "Step 0b: TH binds GroupIds 0x0001 and 0x0002 with GroupKeySetID + "Step 0c: TH binds GroupIds 0x0001 and 0x0002 with GroupKeySetID 0x01a1 in the GroupKeyMap attribute list on GroupKeyManagement cluster by writing the GroupKeyMap attribute with two entries as follows:" cluster: "Group Key Management" @@ -117,7 +130,7 @@ tests: { FabricIndex: 1, GroupId: G2, GroupKeySetID: 0x01a1 }, ] - - label: "Step 0c: TH sends a RemoveAllGroups command to DUT." + - label: "Step 0d: TH sends a RemoveAllGroups command to DUT." PICS: G.S.C04.Rsp cluster: "Groups" endpoint: endpoint @@ -289,6 +302,27 @@ tests: - name: "SceneID" value: 0x01 + - label: + "Step 2d: TH sends a StoreScene command to DUT with the GroupID field + set to G1 and the SceneID field set to 0xFF, which is outside of the + constraints for a SceneID." + PICS: S.S.C04.Rsp + command: "StoreScene" + arguments: + values: + - name: "GroupID" + value: GI + - name: "SceneID" + value: 0xFF + response: + values: + - name: "Status" + value: 0x87 + - name: "GroupID" + value: GI + - name: "SceneID" + value: 0xFF + - label: "Step 3a: TH configures AC2 on DUT for all implemented application clusters supporting scenes." @@ -431,6 +465,21 @@ tests: - name: "SceneID" value: 0x01 + - label: + "Step 4e: TH sends a RecallScene command to DUT with the GroupID field + set to G1 and the SceneID field set to 0xFF, which is outside of the + constraints for a SceneID." + PICS: S.S.C05.Rsp + command: "RecallScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0xFF + response: + error: CONSTRAINT_ERROR + - label: "Step 5a: TH sends a ViewScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01." @@ -463,7 +512,7 @@ tests: [ { AttributeID: 0x0000, - AttributeValue: 0x01, + ValueUnsigned8: 0x01, }, ], }, @@ -473,7 +522,7 @@ tests: [ { AttributeID: 0x0000, - AttributeValue: 0x64, + ValueUnsigned8: 0x64, }, ], }, @@ -542,6 +591,27 @@ tests: - name: "SceneID" value: 0xFE + - label: + "Step 5d: TH sends a ViewScene command to DUT with the GroupID field + set to G1 and the SceneID field set to 0xFF, which is outside of the + constraints for a SceneID." + PICS: S.S.C01.Rsp + command: "ViewScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0xFF + response: + values: + - name: "Status" + value: 0x87 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0xFF + - label: "Step 6: TH sends a GetSceneMembership command to DUT with the GroupID field set to G1." @@ -620,12 +690,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], }, ] response: @@ -643,7 +713,7 @@ tests: to 60 000 000 (60 000s) and a set of extension fields appropriate to AC1." verification: | - ./chip-tool scenesmanagement add-scene 0x0001 0x01 60000000 "scene name" '[{"clusterID": "0x0300", "attributeValueList":[{"attributeID": "0x4001", "attributeValue": "0x01"}]}]' 1 1 + ./chip-tool scenesmanagement add-scene 0x0001 0x01 60000000 "scene name" '[{"clusterID": "0x0300", "attributeValueList":[{"attributeID": "0x4001", "ValueUnsigned8": "0x01"}]}]' 1 1 Verify DUT sends a AddSceneResponse command to TH with the Status field set to 0x00 (SUCCESS), the GroupID field set to G1 and the SceneID field set to 0x01 on the TH(Chip-tool) Log and below is the sample log provided for the raspi platform: @@ -721,7 +791,7 @@ tests: "Step 8d: TH sends a AddScene command to DUT with the GroupID field set to G1, the SceneID field set to 0x01, the TransitionTime field set to 70 000 000 (70 000s) and no extension field sets. This should fail - and return a status of 0x85 (INVALID_COMMAND)." + and return a status of 0x87 (CONSTRAINT_ERROR)." PICS: S.S.C00.Rsp command: "AddScene" arguments: @@ -739,7 +809,7 @@ tests: response: values: - name: "Status" - value: 0x85 + value: 0x87 - name: "GroupID" value: G1 - name: "SceneID" @@ -749,7 +819,7 @@ tests: "Step 8e: TH sends a AddScene command to DUT with the GroupID field set to G1, the SceneID field set to 0x01, the TransitionTime field set to 60 000 001 (60 000.001s) and no extension field sets. This should - fail and return a status of 0x85 (INVALID_COMMAND)." + fail and return a status of 0x87 (CONSTRAINT_ERROR)." PICS: S.S.C00.Rsp command: "AddScene" arguments: @@ -767,12 +837,41 @@ tests: response: values: - name: "Status" - value: 0x85 + value: 0x87 - name: "GroupID" value: G1 - name: "SceneID" value: 0x01 + - label: + "Step 8f: TH sends a AddScene command to DUT with the GroupID field + set to G1, the SceneID field set to 0xFF, which is outside of the + constraints for a SceneID, the TransitionTime field set to 1000 (1s) + and no extension field sets. This should fail and return a status of + 0x87 (CONSTRAINT_ERROR)." + PICS: S.S.C00.Rsp + command: "AddScene" + arguments: + values: + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0xFF + - name: "TransitionTime" + value: 1000 + - name: "SceneName" + value: "Scene1" + - name: "ExtensionFieldSets" + value: [] + response: + values: + - name: "Status" + value: 0x87 + - name: "GroupID" + value: G1 + - name: "SceneID" + value: 0xFF + - label: "Step 9a: TH sends a RemoveScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01." @@ -835,7 +934,28 @@ tests: value: 0x01 - label: - "Step 9d: TH sends a GetSceneMembership command to DUT with the + "Step 9d: TH sends a RemoveScene command to DUT with the GroupID field + set to G1 and the SceneID field set to 0xFF, which is outside of the + constraints for a SceneID." + PICS: S.S.C02.Rsp + command: "RemoveScene" + arguments: + values: + - name: "GroupID" + value: GI + - name: "SceneID" + value: 0xFF + response: + values: + - name: "Status" + value: 0x87 + - name: "GroupID" + value: GI + - name: "SceneID" + value: 0xFF + + - label: + "Step 9e: TH sends a GetSceneMembership command to DUT with the GroupID field set to G1." PICS: S.S.C06.Rsp command: "GetSceneMembership" diff --git a/src/app/tests/suites/certification/Test_TC_S_2_3.yaml b/src/app/tests/suites/certification/Test_TC_S_2_3.yaml index b39a2e762a1113..5a76916edb39b7 100644 --- a/src/app/tests/suites/certification/Test_TC_S_2_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_2_3.yaml @@ -287,12 +287,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], }, ] response: @@ -309,7 +309,7 @@ tests: to G1, the SceneID field set to 0x01, the TransitionTime field set to 1000 (1s) and a set of extension fields appropriate to AC1." verification: | - ./chip-tool scenesmanagement add-scene 0x0101 0x01 1000 "scene name" '[{"clusterID": "0x0006", "attributeValueList":[{"attributeID": "0x0001", "attributeValue": "0x01"}, ]}, {"clusterID": "0x0008", "attributeValueList":[{"attributeID": "0x0000", "attributeValue": "0x64"}, ]}]' 1 1 + ./chip-tool scenesmanagement add-scene 0x0101 0x01 1000 "scene name" '[{"clusterID": "0x0006", "attributeValueList":[{"attributeID": "0x0000", "ValueUnsigned8": "0x01"}, ]}, {"clusterID": "0x0008", "attributeValueList":[{"attributeID": "0x0000", "ValueUnsigned8": "0x64"}, ]}]' 1 1 Verify DUT sends a AddSceneResponse command to TH with the Status field set to 0x00 (SUCCESS), the GroupID field set to 257 and the SceneID field set to 0x01 on the TH(Chip-tool) Log and below is the sample log provided for the raspi platform: @@ -361,12 +361,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], }, ] @@ -395,8 +395,8 @@ tests: [1708071897.294574][7731:7733] CHIP:TOO: ClusterID: 6 [1708071897.294580][7731:7733] CHIP:TOO: AttributeValueList: 1 entries [1708071897.294589][7731:7733] CHIP:TOO: [1]: { - [1708071897.294593][7731:7733] CHIP:TOO: AttributeID: 1 - [1708071897.294596][7731:7733] CHIP:TOO: AttributeValue: 1 + [1708071897.294593][7731:7733] CHIP:TOO: AttributeID: 0 + [1708071897.294596][7731:7733] CHIP:TOO: ValueUnsigned8: 1 [1708071897.294599][7731:7733] CHIP:TOO: } [1708071897.294603][7731:7733] CHIP:TOO: } [1708071897.294611][7731:7733] CHIP:TOO: [2]: { @@ -404,7 +404,7 @@ tests: [1708071897.294621][7731:7733] CHIP:TOO: AttributeValueList: 1 entries [1708071897.294628][7731:7733] CHIP:TOO: [1]: { [1708071897.294633][7731:7733] CHIP:TOO: AttributeID: 0 - [1708071897.294636][7731:7733] CHIP:TOO: AttributeValue: 100 + [1708071897.294636][7731:7733] CHIP:TOO: ValueUnsigned8: 100 [1708071897.294639][7731:7733] CHIP:TOO: } [1708071897.294643][7731:7733] CHIP:TOO: } [1708071897.294647][7731:7733] CHIP:TOO: } @@ -543,12 +543,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], }, ] @@ -557,7 +557,7 @@ tests: field set to G1, the SceneID field set to 0x03, the TransitionTime field set to G1 and a set of extension fields appropriate to AC1." verification: | - ./chip-tool scenesmanagement add-scene 0x0101 0x03 1 "scene name" '[{"clusterID": "0x0300", "attributeValueList":[{"attributeID": "0x4002", "attributeValue": "0x01"}]}]' 0xffffffffffff0101 1 + ./chip-tool scenesmanagement add-scene 0x0101 0x03 1 "scene name" '[{"clusterID": "0x0300", "attributeValueList":[{"attributeID": "0x4002", "ValueUnsigned8": "0x01"}]}]' 0xffffffffffff0101 1 Note: As this is a multicast command, no log is expected. cluster: "LogCommands" command: "UserPrompt" @@ -599,12 +599,12 @@ tests: { ClusterID: 0x0006, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x01 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], }, { ClusterID: 0x0008, AttributeValueList: - [{ AttributeID: 0x0000, AttributeValue: 0x64 }], + [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }], }, ] - label: @@ -633,7 +633,7 @@ tests: [1707285444.028853][13682:13684] CHIP:TOO: AttributeValueList: 1 entries [1707285444.028882][13682:13684] CHIP:TOO: [1]: { [1707285444.028896][13682:13684] CHIP:TOO: AttributeID: 16386 - [1707285444.028913][13682:13684] CHIP:TOO: AttributeValue: 1 + [1707285444.028913][13682:13684] CHIP:TOO: ValueUnsigned16: 1 [1707285444.028925][13682:13684] CHIP:TOO: } [1707285444.028937][13682:13684] CHIP:TOO: } [1707285444.028950][13682:13684] CHIP:TOO: } diff --git a/src/app/tests/suites/certification/Test_TC_THNETDIR_2_1.yaml b/src/app/tests/suites/certification/Test_TC_THNETDIR_2_1.yaml new file mode 100644 index 00000000000000..3a2925dc424175 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_THNETDIR_2_1.yaml @@ -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. + +name: "[TC-THNETDIR-2.1] Simple Attributes check with DUT as Server" + +PICS: + - THNETDIR.S + +config: + nodeId: 0x12344321 + cluster: Thread Network Directory + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: DelayCommands + command: WaitForCommissionee + arguments: + values: + - name: nodeId + value: nodeId + + - label: "TH reads SupportedFabrics attribute from DUT" + command: readAttribute + endpoint: 0 + cluster: Operational Credentials + attribute: SupportedFabrics + response: + saveAs: supportedFabrics + constraints: + type: int8u + + - label: "TH reads ThreadNetworkTableSize attribute from DUT" + command: readAttribute + attribute: ThreadNetworkTableSize + response: + constraints: + type: int8u + minValue: 10 # assume 5 supported fabrics + # python: value >= 2 * supportedFabrics diff --git a/src/app/tests/suites/certification/Test_TC_THNETDIR_2_2.yaml b/src/app/tests/suites/certification/Test_TC_THNETDIR_2_2.yaml new file mode 100644 index 00000000000000..be0ec89952d25e --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_THNETDIR_2_2.yaml @@ -0,0 +1,225 @@ +# 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. + +name: "[TC-THNETDIR-2.2] Verification for Add/Remove/Get commands" + +PICS: + - THNETDIR.S + +config: + nodeId: 0x12344321 + cluster: Thread Network Directory + endpoint: 1 + + # Note: TestNetwork* values need to match what's encoded in TestNetworkDataset + TestNetworkDataset: + type: octet_string + defaultValue: "hex:0e080000000000000001000300000f350407fff800020839758ec8144b07fb0708fdf1f1add0797dc00510f366cec7a446bab978d90d27abe38f23030f4f70656e5468726561642d353933380102593804103ca67c969efb0d0c74a4d8ee923b576c0c0402a0f7f8" + TestNetworkExtendedPanId: + type: octet_string + defaultValue: "hex:39758ec8144b07fb" + TestNetworkName: "OpenThread-5938" + TestNetworkChannel: 15 + TestNetworkActiveTimestamp: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: DelayCommands + command: WaitForCommissionee + arguments: + values: + - name: nodeId + value: nodeId + + - label: "TH reads ThreadNetworks attribute from DUT" + command: readAttribute + attribute: ThreadNetworks + response: + saveAs: initialNetworks + constraints: + type: list + + - label: "TH reads PreferredExtendedPanID attribute from DUT" + command: readAttribute + attribute: PreferredExtendedPanID + response: + saveAs: initialPreferredExtendedPanID + constraints: + type: octet_string + minLength: 8 + maxLength: 8 + notValue: TestNetworkExtendedPanId + + - label: + "TH writes ExtendedPanID from TestNetwork to PreferredExtendedPanID on + DUT" + command: writeAttribute + attribute: PreferredExtendedPanID + arguments: + value: TestNetworkExtendedPanId + response: + error: CONSTRAINT_ERROR # TestNetwork is not in ThreadNetworks + + - label: + "TH reads PreferredExtendedPanID attribute from DUT, verifying that + the value did not change" + command: readAttribute + attribute: PreferredExtendedPanID + response: + value: initialPreferredExtendedPanID + + - label: + "TH sends GetOperationalDataset command to DUT with ExtendedPanID of + TestNetwork" + command: GetOperationalDataset + arguments: + values: + - name: ExtendedPanID + value: TestNetworkExtendedPanId + response: + error: NOT_FOUND + + # TODO: Currently fails with darwin-framework-tool because it automatically performs a timed invoke + # - label: "TH sends AddNetwork command to DUT without a timed interaction" + # command: AddNetwork + # arguments: + # values: + # - name: OperationalDataset + # value: TestNetworkDataset + # response: + # error: NEEDS_TIMED_INTERACTION + + - label: "TH sends AddNetwork command to DUT with TestNetwork dataset" + command: AddNetwork + timedInteractionTimeoutMs: 2000 + arguments: + values: + - name: OperationalDataset + value: TestNetworkDataset + + - label: + "TH reads ThreadNetworks attribute from DUT, verifying that the + network has been added" + command: readAttribute + attribute: ThreadNetworks + response: + constraints: + type: list + # python: | + # # Split the list into test (our TestNetwork) and rest (everything else) + # test = next((n for n in value if n['ExtendedPanID'] == TestNetworkExtendedPanId), None) + # rest = [n for n in value if n != test] + # # Check test has the expected values and rest == initialNetworks (ignoring order) + # return (test is not None and + # test['NetworkName'] == TestNetworkName and + # test['Channel'] == TestNetworkChannel and + # test['ActiveTimestamp'] == TestNetworkActiveTimestamp and + # len(value) == len(initialNetworks) + 1 and + # len(rest) == len(initialNetworks) and + # all(n in initialNetworks for n in rest)) + + - label: + "TH sends GetOperationalDataset command to DUT with ExtendedPanID from + TestNetwork" + command: GetOperationalDataset + arguments: + values: + - name: ExtendedPanID + value: TestNetworkExtendedPanId + response: + values: + - name: OperationalDataset + value: TestNetworkDataset + + - label: + "TH writes ExtendedPanID from TestNetwork to PreferredExtendedPanID on + DUT" + command: writeAttribute + attribute: PreferredExtendedPanID + arguments: + value: TestNetworkExtendedPanId + + - label: + "TH reads PreferredExtendedPanID attribute from DUT, verifying that + the value was written" + command: readAttribute + attribute: PreferredExtendedPanID + response: + value: TestNetworkExtendedPanId + + # TODO: Currently fails with darwin-framework-tool because it automatically performs a timed invoke + # - label: "TH sends RemoveNetwork command to DUT without a timed interaction" + # command: RemoveNetwork + # arguments: + # values: + # - name: ExtendedPanID + # value: TestNetworkExtendedPanId + # response: + # error: NEEDS_TIMED_INTERACTION + + - label: + "TH sends RemoveNetwork command to DUT with ExtendedPanID of + TestNetwork while it is the preferred network" + command: RemoveNetwork + timedInteractionTimeoutMs: 2000 + arguments: + values: + - name: ExtendedPanID + value: TestNetworkExtendedPanId + response: + error: CONSTRAINT_ERROR # Preferred network cannot be removed + + - label: "TH writes null to PreferredExtendedPanID on DUT" + command: writeAttribute + attribute: PreferredExtendedPanID + arguments: + value: null + + - label: + "TH reads PreferredExtendedPanID attribute from DUT, verifying that + the value was cleared" + command: readAttribute + attribute: PreferredExtendedPanID + response: + value: null + + - label: + "TH sends RemoveNetwork command to DUT with ExtendedPanID of + TestNetwork" + command: RemoveNetwork + timedInteractionTimeoutMs: 2000 + arguments: + values: + - name: ExtendedPanID + value: TestNetworkExtendedPanId + + - label: + "TH reads ThreadNetworks attribute from DUT, verifying that the + network was removed" + command: readAttribute + attribute: ThreadNetworks + response: + constraints: + type: list + # python: | + # # value == initialNetworks (ignoring order) + # return (len(value) == len(initialNetworks) and + # all(n in initialNetworks for n in value)) + + - label: + "TH writes PreferredExtendedPanID to DUT, restoring the initial value" + command: writeAttribute + attribute: PreferredExtendedPanID + arguments: + value: initialPreferredExtendedPanID diff --git a/src/app/tests/suites/certification/Test_TC_TSTAT_2_1.yaml b/src/app/tests/suites/certification/Test_TC_TSTAT_2_1.yaml index faf34fdea43e92..2db131a5a4df55 100644 --- a/src/app/tests/suites/certification/Test_TC_TSTAT_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_TSTAT_2_1.yaml @@ -243,8 +243,8 @@ tests: response: constraints: type: int8s - minValue: -25 - maxValue: 25 + minValue: -127 + maxValue: 127 - label: "Step 13a: TH reads attribute OccupiedCoolingSetpoint from the DUT" PICS: TSTAT.S.F01 && TSTAT.S.A0017 && TSTAT.S.A0018 diff --git a/src/app/tests/suites/certification/Test_TC_WIFINM_2_1.yaml b/src/app/tests/suites/certification/Test_TC_WIFINM_2_1.yaml new file mode 100644 index 00000000000000..0f9f71157de0ea --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_WIFINM_2_1.yaml @@ -0,0 +1,63 @@ +# 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. + +name: "[TC-WIFINM-2.1] Attributes and commands with DUT as Server" + +PICS: + - WIFINM.S + +config: + nodeId: 0x12344321 + cluster: WiFi Network Management + endpoint: 1 + +# Note: This test assumes the DUT has an active Wi-Fi network, i.e. +# SSID is not null and NetworkPassphraseRequest returns a passphrase. +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: DelayCommands + command: WaitForCommissionee + arguments: + values: + - name: nodeId + value: nodeId + + - label: "TH reads the SSID attribute from the DUT" + command: readAttribute + attribute: SSID + response: + constraints: + type: octet_string + hasValue: true + minLength: 1 + maxLength: 32 + + - label: "TH reads the PassphraseSurrogate attribute from the DUT" + command: readAttribute + attribute: PassphraseSurrogate + response: + constraints: + type: int64u + hasValue: true + + - label: "TH sends the NetworkPassphraseRequest command to the DUT" + command: NetworkPassphraseRequest + response: + values: + - name: Passphrase + constraints: + type: octet_string + hasValue: true + minLength: 8 + maxLength: 64 diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index aa8fb52d289d2b..9ea99c627f16f4 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -1926,7 +1926,7 @@ TSTAT.S.A0006=1 TSTAT.S.A0007=0 TSTAT.S.A0008=0 TSTAT.S.A0009=0 -TSTAT.S.A0010=0 +TSTAT.S.A0010=1 TSTAT.S.A0011=1 TSTAT.S.A0012=1 TSTAT.S.A0013=0 @@ -2987,4 +2987,10 @@ PWRTL.S.A0001=1 PWRTL.S.F00=0 PWRTL.S.F01=0 PWRTL.S.F02=1 -PWRTL.S.F03=1 \ No newline at end of file +PWRTL.S.F03=1 + +# Thread Network Directory Cluster +THNETDIR.S=1 + +# Wi-Fi Network Management Cluster +WIFINM.S=1 diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index a77ecb9a3b2838..a96ef4aebc8fff 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -83,7 +83,8 @@ "Test_TC_LVL_4_1", "Test_TC_LVL_5_1", "Test_TC_LVL_6_1", - "Test_TC_LVL_7_1" + "Test_TC_LVL_7_1", + "Test_TC_LVL_9_1" ], "LocalizationConfiguration": [], "TimeFormatLocalization": ["Test_TC_LTIME_1_2", "Test_TC_LTIME_3_1"], @@ -144,7 +145,12 @@ "ModeSelect": [], "MultipleFabrics": [], "OTASoftwareUpdate": ["OTA_SuccessfulTransfer"], - "OnOff": ["Test_TC_OO_2_1", "Test_TC_OO_2_2", "Test_TC_OO_2_4"], + "OnOff": [ + "Test_TC_OO_2_1", + "Test_TC_OO_2_2", + "Test_TC_OO_2_4", + "Test_TC_OO_2_7" + ], "PowerSource": ["Test_TC_PS_2_1"], "PowerTopology": ["Test_TC_PWRTL_1_1"], "PressureMeasurement": ["Test_TC_PRS_2_1", "Test_TC_PRS_2_2"], diff --git a/src/app/tests/suites/commands/interaction_model/InteractionModel.cpp b/src/app/tests/suites/commands/interaction_model/InteractionModel.cpp index 04e658f18cc188..a3f9f3ff6de892 100644 --- a/src/app/tests/suites/commands/interaction_model/InteractionModel.cpp +++ b/src/app/tests/suites/commands/interaction_model/InteractionModel.cpp @@ -19,7 +19,20 @@ #include "InteractionModel.h" using namespace chip; -using namespace chip::app; + +using chip::app::AttributePathParams; +using chip::app::CommandSender; +using chip::app::ConcreteAttributePath; +using chip::app::ConcreteCommandPath; +using chip::app::ConcreteDataAttributePath; +using chip::app::DataVersionFilter; +using chip::app::EventHeader; +using chip::app::EventPathParams; +using chip::app::InteractionModelEngine; +using chip::app::ReadClient; +using chip::app::ReadPrepareParams; +using chip::app::StatusIB; +using chip::app::WriteClient; namespace chip { namespace test_utils { diff --git a/src/app/tests/test-interaction-model-api.cpp b/src/app/tests/test-interaction-model-api.cpp index ae3f559424f97c..444516a79ddf1a 100644 --- a/src/app/tests/test-interaction-model-api.cpp +++ b/src/app/tests/test-interaction-model-api.cpp @@ -13,25 +13,38 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#include "lib/support/CHIPMem.h" #include -#include #include #include +#include #include #include #include #include #include +using namespace chip::app::InteractionModel; + namespace chip { uint8_t Test::attributeDataTLV[CHIP_CONFIG_DEFAULT_UDP_MTU_SIZE]; size_t Test::attributeDataTLVLen = 0; namespace app { +class TestOnlyAttributeValueEncoderAccessor +{ +public: + TestOnlyAttributeValueEncoderAccessor(AttributeValueEncoder & encoder) : mEncoder(encoder) {} + + AttributeReportIBs::Builder & Builder() { return mEncoder.mAttributeReportIBsBuilder; } + + void SetState(const AttributeEncodeState & state) { mEncoder.mEncodeState = state; } + +private: + AttributeValueEncoder & mEncoder; +}; + // Used by the code in TestWriteInteraction.cpp (and generally tests that interact with the WriteHandler may need this). const EmberAfAttributeMetadata * GetAttributeMetadata(const ConcreteAttributePath & aConcreteClusterPath) { @@ -134,6 +147,101 @@ CHIP_ERROR ReadSingleClusterData(const Access::SubjectDescriptor & aSubjectDescr return AttributeValueEncoder(aAttributeReports, aSubjectDescriptor, aPath, 0 /* dataVersion */).Encode(Test::kTestFieldValue1); } -} // namespace app +TestImCustomDataModel & TestImCustomDataModel::Instance() +{ + static TestImCustomDataModel model; + return model; +} + +CHIP_ERROR TestImCustomDataModel::ReadAttribute(const ReadAttributeRequest & request, AttributeValueEncoder & encoder) +{ + AttributeEncodeState mutableState(&encoder.GetState()); // provide a state copy to start. + + CHIP_ERROR err = ReadSingleClusterData(request.subjectDescriptor.value_or(Access::SubjectDescriptor()), + request.readFlags.Has(ReadFlags::kFabricFiltered), request.path, + TestOnlyAttributeValueEncoderAccessor(encoder).Builder(), &mutableState); + + // state must survive CHIP_ERRORs as it is used for chunking + TestOnlyAttributeValueEncoderAccessor(encoder).SetState(mutableState); + + return err; +} + +CHIP_ERROR TestImCustomDataModel::WriteAttribute(const WriteAttributeRequest & request, AttributeValueDecoder & decoder) +{ + return CHIP_ERROR_NOT_IMPLEMENTED; +} + +CHIP_ERROR TestImCustomDataModel::Invoke(const InvokeRequest & request, chip::TLV::TLVReader & input_arguments, + CommandHandler * handler) +{ + return CHIP_ERROR_NOT_IMPLEMENTED; +} + +EndpointId TestImCustomDataModel::FirstEndpoint() +{ + return CodegenDataModelInstance()->FirstEndpoint(); +} + +EndpointId TestImCustomDataModel::NextEndpoint(EndpointId before) +{ + return CodegenDataModelInstance()->NextEndpoint(before); +} + +ClusterEntry TestImCustomDataModel::FirstCluster(EndpointId endpoint) +{ + return CodegenDataModelInstance()->FirstCluster(endpoint); +} +ClusterEntry TestImCustomDataModel::NextCluster(const ConcreteClusterPath & before) +{ + return CodegenDataModelInstance()->NextCluster(before); +} + +std::optional TestImCustomDataModel::GetClusterInfo(const ConcreteClusterPath & path) +{ + return CodegenDataModelInstance()->GetClusterInfo(path); +} + +AttributeEntry TestImCustomDataModel::FirstAttribute(const ConcreteClusterPath & cluster) +{ + return CodegenDataModelInstance()->FirstAttribute(cluster); +} + +AttributeEntry TestImCustomDataModel::NextAttribute(const ConcreteAttributePath & before) +{ + return CodegenDataModelInstance()->NextAttribute(before); +} + +std::optional TestImCustomDataModel::GetAttributeInfo(const ConcreteAttributePath & path) +{ + return CodegenDataModelInstance()->GetAttributeInfo(path); +} + +CommandEntry TestImCustomDataModel::FirstAcceptedCommand(const ConcreteClusterPath & cluster) +{ + return CodegenDataModelInstance()->FirstAcceptedCommand(cluster); +} + +CommandEntry TestImCustomDataModel::NextAcceptedCommand(const ConcreteCommandPath & before) +{ + return CodegenDataModelInstance()->NextAcceptedCommand(before); +} + +std::optional TestImCustomDataModel::GetAcceptedCommandInfo(const ConcreteCommandPath & path) +{ + return CodegenDataModelInstance()->GetAcceptedCommandInfo(path); +} + +ConcreteCommandPath TestImCustomDataModel::FirstGeneratedCommand(const ConcreteClusterPath & cluster) +{ + return CodegenDataModelInstance()->FirstGeneratedCommand(cluster); +} + +ConcreteCommandPath TestImCustomDataModel::NextGeneratedCommand(const ConcreteCommandPath & before) +{ + return CodegenDataModelInstance()->NextGeneratedCommand(before); +} + +} // namespace app } // namespace chip diff --git a/src/app/tests/test-interaction-model-api.h b/src/app/tests/test-interaction-model-api.h index a4f91add7f42f8..e88fee62ec1d23 100644 --- a/src/app/tests/test-interaction-model-api.h +++ b/src/app/tests/test-interaction-model-api.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -64,7 +65,6 @@ } namespace chip { - namespace Test { constexpr chip::ClusterId kTestDeniedClusterId1 = 1000; @@ -101,5 +101,42 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aRequestCommandPat bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint); +/// A customized class for read/write/invoke that matches functionality +/// with the ember-compatibility-functions functionality here. +/// +/// TODO: these functions currently redirect to ember functions, so could +/// be merged with DataModelFixtures.h/cpp as well. This is not done since +/// if we remove the direct ember dependency from IM, we can implement +/// distinct functional classes. +/// TODO items for above: +/// - once IM only supports DataModel +/// - break ember-overrides in this h/cpp file +class TestImCustomDataModel : public InteractionModel::DataModel +{ +public: + static TestImCustomDataModel & Instance(); + + CHIP_ERROR Shutdown() override { return CHIP_NO_ERROR; } + + CHIP_ERROR ReadAttribute(const InteractionModel::ReadAttributeRequest & request, AttributeValueEncoder & encoder) override; + CHIP_ERROR WriteAttribute(const InteractionModel::WriteAttributeRequest & request, AttributeValueDecoder & decoder) override; + CHIP_ERROR Invoke(const InteractionModel::InvokeRequest & request, chip::TLV::TLVReader & input_arguments, + CommandHandler * handler) override; + + EndpointId FirstEndpoint() override; + EndpointId NextEndpoint(EndpointId before) override; + InteractionModel::ClusterEntry FirstCluster(EndpointId endpoint) override; + InteractionModel::ClusterEntry NextCluster(const ConcreteClusterPath & before) override; + std::optional GetClusterInfo(const ConcreteClusterPath & path) override; + InteractionModel::AttributeEntry FirstAttribute(const ConcreteClusterPath & cluster) override; + InteractionModel::AttributeEntry NextAttribute(const ConcreteAttributePath & before) override; + std::optional GetAttributeInfo(const ConcreteAttributePath & path) override; + InteractionModel::CommandEntry FirstAcceptedCommand(const ConcreteClusterPath & cluster) override; + InteractionModel::CommandEntry NextAcceptedCommand(const ConcreteCommandPath & before) override; + std::optional GetAcceptedCommandInfo(const ConcreteCommandPath & path) override; + ConcreteCommandPath FirstGeneratedCommand(const ConcreteClusterPath & cluster) override; + ConcreteCommandPath NextGeneratedCommand(const ConcreteCommandPath & before) override; +}; + } // namespace app } // namespace chip diff --git a/src/app/util/BUILD.gn b/src/app/util/BUILD.gn index dccbc68c0d943e..29b3bc9563c487 100644 --- a/src/app/util/BUILD.gn +++ b/src/app/util/BUILD.gn @@ -15,22 +15,35 @@ import("//build_overrides/chip.gni") import("${chip_root}/src/app/common_flags.gni") +source_set("nullable-primitives") { + sources = [ + "attribute-storage-null-handling.h", + "odd-sized-integers.h", + ] + + deps = [ + "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:encoding", + "${chip_root}/src/lib/core:types", + ] + public_configs = [ "${chip_root}/src:includes" ] +} + # These headers/cpp only depend on core/common source_set("types") { sources = [ "att-storage.h", "attribute-metadata.cpp", "attribute-metadata.h", - "attribute-storage-null-handling.h", "basic-types.h", "ember-strings.cpp", "ember-strings.h", "endpoint-config-defines.h", - "odd-sized-integers.h", "types_stub.h", ] deps = [ + ":nullable-primitives", "${chip_root}/src/app/common:attribute-type", "${chip_root}/src/lib/core", "${chip_root}/src/lib/core:encoding", diff --git a/src/app/util/af-types.h b/src/app/util/af-types.h index 929ad055d0fc1e..bd5b5ed68ce4bb 100644 --- a/src/app/util/af-types.h +++ b/src/app/util/af-types.h @@ -307,6 +307,11 @@ enum class MarkAttributeDirty { kIfChanged, kNo, + // kYes might need to be used if the attribute value was previously changed + // without reporting, and now is being set in a situation where we know + // reporting needs to be triggered (e.g. because QuieterReportingAttribute + // indicated that). + kYes, }; } // namespace app diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index d154b95cf9ab9e..f21132bd4026ca 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -421,10 +422,7 @@ static void shutdownEndpoint(EmberAfDefinedEndpoint * definedEndpoint) } } - // Clear out any command handler overrides registered for this - // endpoint. - chip::app::InteractionModelEngine::GetInstance()->UnregisterCommandHandlers(definedEndpoint->endpoint); - + CommandHandlerInterfaceRegistry::UnregisterAllCommandHandlersForEndpoint(definedEndpoint->endpoint); unregisterAllAttributeAccessOverridesForEndpoint(definedEndpoint); } diff --git a/src/app/util/attribute-table.cpp b/src/app/util/attribute-table.cpp index 57b5f43d35071f..303b234ff93862 100644 --- a/src/app/util/attribute-table.cpp +++ b/src/app/util/attribute-table.cpp @@ -407,7 +407,12 @@ Status emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, AttributeId at if (!valueChanging) { - // Just do nothing. + // Just do nothing, except triggering reporting if forced. + if (markDirty == MarkAttributeDirty::kYes) + { + MatterReportingAttributeChangeCallback(endpoint, cluster, attributeID); + } + return Status::Success; } diff --git a/src/app/util/ember-compatibility-functions.cpp b/src/app/util/ember-compatibility-functions.cpp index cc3185f78a5df6..c1545bffa88977 100644 --- a/src/app/util/ember-compatibility-functions.cpp +++ b/src/app/util/ember-compatibility-functions.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -100,8 +101,7 @@ Protocols::InteractionModel::Status ServerClusterCommandExists(const ConcreteCom return Status::UnsupportedCluster; } - auto * commandHandler = - InteractionModelEngine::GetInstance()->FindCommandHandler(aCommandPath.mEndpointId, aCommandPath.mClusterId); + auto * commandHandler = CommandHandlerInterfaceRegistry::GetCommandHandler(aCommandPath.mEndpointId, aCommandPath.mClusterId); if (commandHandler) { struct Context @@ -171,22 +171,6 @@ CHIP_ERROR ReadClusterDataVersion(const ConcreteClusterPath & aConcreteClusterPa return CHIP_NO_ERROR; } -CHIP_ERROR SendSuccessStatus(AttributeReportIB::Builder & aAttributeReport, AttributeDataIB::Builder & aAttributeDataIBBuilder) -{ - ReturnErrorOnFailure(aAttributeDataIBBuilder.EndOfAttributeDataIB()); - return aAttributeReport.EndOfAttributeReportIB(); -} - -CHIP_ERROR SendFailureStatus(const ConcreteAttributePath & aPath, AttributeReportIBs::Builder & aAttributeReports, - Protocols::InteractionModel::Status aStatus, TLV::TLVWriter * aReportCheckpoint) -{ - if (aReportCheckpoint != nullptr) - { - aAttributeReports.Rollback(*aReportCheckpoint); - } - return aAttributeReports.EncodeAttributeStatus(aPath, StatusIB(aStatus)); -} - // Helper function for trying to read an attribute value via an // AttributeAccessInterface. On failure, the read has failed. On success, the // aTriedEncode outparam is set to whether the AttributeAccessInterface tried to encode a value. @@ -302,7 +286,7 @@ CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, b if (attributeCluster == nullptr && attributeMetadata == nullptr) { - return SendFailureStatus(aPath, aAttributeReports, UnsupportedAttributeStatus(aPath), nullptr); + return CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(UnsupportedAttributeStatus(aPath)); } // Check access control. A failed check will disallow the operation, and may or may not generate an attribute report @@ -319,8 +303,7 @@ CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, b { return CHIP_NO_ERROR; } - - return SendFailureStatus(aPath, aAttributeReports, Protocols::InteractionModel::Status::UnsupportedAccess, nullptr); + return CHIP_IM_GLOBAL_STATUS(UnsupportedAccess); } } @@ -340,10 +323,6 @@ CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, b } // Read attribute using Ember, if it doesn't have an override. - - TLV::TLVWriter backup; - aAttributeReports.Checkpoint(backup); - AttributeReportIB::Builder & attributeReport = aAttributeReports.CreateAttributeReport(); ReturnErrorOnFailure(aAttributeReports.GetError()); @@ -372,214 +351,174 @@ CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, b static_cast(gEmberAttributeIOBufferSpan.size()), /* write = */ false); - if (status == Status::Success) + if (status != Status::Success) + { + return CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(status); + } + + TLV::TLVWriter * writer = attributeDataIBBuilder.GetWriter(); + VerifyOrReturnError(writer != nullptr, CHIP_NO_ERROR); + + const EmberAfAttributeType attributeType = attributeMetadata->attributeType; + const bool isNullable = attributeMetadata->IsNullable(); + const TLV::Tag tag = TLV::ContextTag(AttributeDataIB::Tag::kData); + + switch (AttributeBaseType(attributeType)) { - EmberAfAttributeType attributeType = attributeMetadata->attributeType; - bool isNullable = attributeMetadata->IsNullable(); - TLV::TLVWriter * writer = attributeDataIBBuilder.GetWriter(); - VerifyOrReturnError(writer != nullptr, CHIP_NO_ERROR); - TLV::Tag tag = TLV::ContextTag(AttributeDataIB::Tag::kData); - switch (AttributeBaseType(attributeType)) + case ZCL_NO_DATA_ATTRIBUTE_TYPE: // No data + ReturnErrorOnFailure(writer->PutNull(tag)); + break; + case ZCL_BOOLEAN_ATTRIBUTE_TYPE: // Boolean + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + case ZCL_INT8U_ATTRIBUTE_TYPE: // Unsigned 8-bit integer + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + case ZCL_INT16U_ATTRIBUTE_TYPE: // Unsigned 16-bit integer + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + case ZCL_INT24U_ATTRIBUTE_TYPE: // Unsigned 24-bit integer + { + using IntType = OddSizedInteger<3, false>; + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + } + case ZCL_INT32U_ATTRIBUTE_TYPE: // Unsigned 32-bit integer + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + case ZCL_INT40U_ATTRIBUTE_TYPE: // Unsigned 40-bit integer + { + using IntType = OddSizedInteger<5, false>; + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + } + case ZCL_INT48U_ATTRIBUTE_TYPE: // Unsigned 48-bit integer + { + using IntType = OddSizedInteger<6, false>; + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + } + case ZCL_INT56U_ATTRIBUTE_TYPE: // Unsigned 56-bit integer + { + using IntType = OddSizedInteger<7, false>; + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + } + case ZCL_INT64U_ATTRIBUTE_TYPE: // Unsigned 64-bit integer + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + case ZCL_INT8S_ATTRIBUTE_TYPE: // Signed 8-bit integer + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + case ZCL_INT16S_ATTRIBUTE_TYPE: // Signed 16-bit integer + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + case ZCL_INT24S_ATTRIBUTE_TYPE: // Signed 24-bit integer + { + using IntType = OddSizedInteger<3, true>; + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + } + case ZCL_INT32S_ATTRIBUTE_TYPE: // Signed 32-bit integer + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + case ZCL_INT40S_ATTRIBUTE_TYPE: // Signed 40-bit integer + { + using IntType = OddSizedInteger<5, true>; + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + } + case ZCL_INT48S_ATTRIBUTE_TYPE: // Signed 48-bit integer + { + using IntType = OddSizedInteger<6, true>; + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + } + case ZCL_INT56S_ATTRIBUTE_TYPE: // Signed 56-bit integer + { + using IntType = OddSizedInteger<7, true>; + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + } + case ZCL_INT64S_ATTRIBUTE_TYPE: // Signed 64-bit integer + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + case ZCL_SINGLE_ATTRIBUTE_TYPE: // 32-bit float + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + case ZCL_DOUBLE_ATTRIBUTE_TYPE: // 64-bit float + ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); + break; + case ZCL_CHAR_STRING_ATTRIBUTE_TYPE: // Char string + { + char * actualData = reinterpret_cast(gEmberAttributeIOBufferSpan.data() + 1); + uint8_t dataLength = gEmberAttributeIOBufferSpan[0]; + if (dataLength == 0xFF) { - case ZCL_NO_DATA_ATTRIBUTE_TYPE: // No data + VerifyOrReturnError(isNullable, CHIP_ERROR_INCORRECT_STATE); ReturnErrorOnFailure(writer->PutNull(tag)); - break; - case ZCL_BOOLEAN_ATTRIBUTE_TYPE: // Boolean - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; - case ZCL_INT8U_ATTRIBUTE_TYPE: // Unsigned 8-bit integer - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; - case ZCL_INT16U_ATTRIBUTE_TYPE: // Unsigned 16-bit integer - { - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; - } - case ZCL_INT24U_ATTRIBUTE_TYPE: // Unsigned 24-bit integer - { - using IntType = OddSizedInteger<3, false>; - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; - } - case ZCL_INT32U_ATTRIBUTE_TYPE: // Unsigned 32-bit integer - { - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; } - case ZCL_INT40U_ATTRIBUTE_TYPE: // Unsigned 40-bit integer + else { - using IntType = OddSizedInteger<5, false>; - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; + ReturnErrorOnFailure(writer->PutString(tag, actualData, dataLength)); } - case ZCL_INT48U_ATTRIBUTE_TYPE: // Unsigned 48-bit integer - { - using IntType = OddSizedInteger<6, false>; - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; - } - case ZCL_INT56U_ATTRIBUTE_TYPE: // Unsigned 56-bit integer - { - using IntType = OddSizedInteger<7, false>; - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; - } - case ZCL_INT64U_ATTRIBUTE_TYPE: // Unsigned 64-bit integer - { - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; - } - case ZCL_INT8S_ATTRIBUTE_TYPE: // Signed 8-bit integer - { - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; - } - case ZCL_INT16S_ATTRIBUTE_TYPE: // Signed 16-bit integer - { - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; - } - case ZCL_INT24S_ATTRIBUTE_TYPE: // Signed 24-bit integer - { - using IntType = OddSizedInteger<3, true>; - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; - } - case ZCL_INT32S_ATTRIBUTE_TYPE: // Signed 32-bit integer - { - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; - } - case ZCL_INT40S_ATTRIBUTE_TYPE: // Signed 40-bit integer - { - using IntType = OddSizedInteger<5, true>; - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; - } - case ZCL_INT48S_ATTRIBUTE_TYPE: // Signed 48-bit integer - { - using IntType = OddSizedInteger<6, true>; - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; - } - case ZCL_INT56S_ATTRIBUTE_TYPE: // Signed 56-bit integer + break; + } + case ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE: { + char * actualData = + reinterpret_cast(gEmberAttributeIOBufferSpan.data() + 2); // The pascal string contains 2 bytes length + uint16_t dataLength; + memcpy(&dataLength, gEmberAttributeIOBufferSpan.data(), sizeof(dataLength)); + if (dataLength == 0xFFFF) { - using IntType = OddSizedInteger<7, true>; - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; + VerifyOrReturnError(isNullable, CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(writer->PutNull(tag)); } - case ZCL_INT64S_ATTRIBUTE_TYPE: // Signed 64-bit integer + else { - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; + ReturnErrorOnFailure(writer->PutString(tag, actualData, dataLength)); } - case ZCL_SINGLE_ATTRIBUTE_TYPE: // 32-bit float + break; + } + case ZCL_OCTET_STRING_ATTRIBUTE_TYPE: // Octet string + { + uint8_t * actualData = gEmberAttributeIOBufferSpan.data() + 1; + uint8_t dataLength = gEmberAttributeIOBufferSpan[0]; + if (dataLength == 0xFF) { - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; + VerifyOrReturnError(isNullable, CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(writer->PutNull(tag)); } - case ZCL_DOUBLE_ATTRIBUTE_TYPE: // 64-bit float + else { - ReturnErrorOnFailure(attributeBufferToNumericTlvData(*writer, isNullable)); - break; + ReturnErrorOnFailure(writer->Put(tag, chip::ByteSpan(actualData, dataLength))); } - case ZCL_CHAR_STRING_ATTRIBUTE_TYPE: // Char string + break; + } + case ZCL_LONG_OCTET_STRING_ATTRIBUTE_TYPE: { + uint8_t * actualData = gEmberAttributeIOBufferSpan.data() + 2; // The pascal string contains 2 bytes length + uint16_t dataLength; + memcpy(&dataLength, gEmberAttributeIOBufferSpan.data(), sizeof(dataLength)); + if (dataLength == 0xFFFF) { - char * actualData = reinterpret_cast(gEmberAttributeIOBufferSpan.data() + 1); - uint8_t dataLength = gEmberAttributeIOBufferSpan[0]; - if (dataLength == 0xFF) - { - if (isNullable) - { - ReturnErrorOnFailure(writer->PutNull(tag)); - } - else - { - return CHIP_ERROR_INCORRECT_STATE; - } - } - else - { - ReturnErrorOnFailure(writer->PutString(tag, actualData, dataLength)); - } - break; - } - case ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE: { - char * actualData = - reinterpret_cast(gEmberAttributeIOBufferSpan.data() + 2); // The pascal string contains 2 bytes length - uint16_t dataLength; - memcpy(&dataLength, gEmberAttributeIOBufferSpan.data(), sizeof(dataLength)); - if (dataLength == 0xFFFF) - { - if (isNullable) - { - ReturnErrorOnFailure(writer->PutNull(tag)); - } - else - { - return CHIP_ERROR_INCORRECT_STATE; - } - } - else - { - ReturnErrorOnFailure(writer->PutString(tag, actualData, dataLength)); - } - break; + VerifyOrReturnError(isNullable, CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(writer->PutNull(tag)); } - case ZCL_OCTET_STRING_ATTRIBUTE_TYPE: // Octet string + else { - uint8_t * actualData = gEmberAttributeIOBufferSpan.data() + 1; - uint8_t dataLength = gEmberAttributeIOBufferSpan[0]; - if (dataLength == 0xFF) - { - if (isNullable) - { - ReturnErrorOnFailure(writer->PutNull(tag)); - } - else - { - return CHIP_ERROR_INCORRECT_STATE; - } - } - else - { - ReturnErrorOnFailure(writer->Put(tag, chip::ByteSpan(actualData, dataLength))); - } - break; - } - case ZCL_LONG_OCTET_STRING_ATTRIBUTE_TYPE: { - uint8_t * actualData = gEmberAttributeIOBufferSpan.data() + 2; // The pascal string contains 2 bytes length - uint16_t dataLength; - memcpy(&dataLength, gEmberAttributeIOBufferSpan.data(), sizeof(dataLength)); - if (dataLength == 0xFFFF) - { - if (isNullable) - { - ReturnErrorOnFailure(writer->PutNull(tag)); - } - else - { - return CHIP_ERROR_INCORRECT_STATE; - } - } - else - { - ReturnErrorOnFailure(writer->Put(tag, chip::ByteSpan(actualData, dataLength))); - } - break; - } - default: - ChipLogError(DataManagement, "Attribute type 0x%x not handled", static_cast(attributeType)); - status = Status::UnsupportedRead; + ReturnErrorOnFailure(writer->Put(tag, chip::ByteSpan(actualData, dataLength))); } + break; } - - if (status == Protocols::InteractionModel::Status::Success) - { - return SendSuccessStatus(attributeReport, attributeDataIBBuilder); + default: + ChipLogError(DataManagement, "Attribute type 0x%x not handled", static_cast(attributeType)); + return CHIP_IM_GLOBAL_STATUS(Failure); } - return SendFailureStatus(aPath, aAttributeReports, status, &backup); + // If we got this far, placing the data to be read in the output TLVWriter succeeded. + // Try to terminate our attribute report to signal success. + ReturnErrorOnFailure(attributeDataIBBuilder.EndOfAttributeDataIB()); + return attributeReport.EndOfAttributeReportIB(); } namespace { diff --git a/src/app/util/ember-global-attribute-access-interface.cpp b/src/app/util/ember-global-attribute-access-interface.cpp index 327ab09c479512..cbc4f070e7825e 100644 --- a/src/app/util/ember-global-attribute-access-interface.cpp +++ b/src/app/util/ember-global-attribute-access-interface.cpp @@ -15,6 +15,7 @@ */ #include +#include #include #include @@ -96,7 +97,7 @@ CHIP_ERROR GlobalAttributeReader::EncodeCommandList(const ConcreteClusterPath & { return aEncoder.EncodeList([&](const auto & encoder) { auto * commandHandler = - InteractionModelEngine::GetInstance()->FindCommandHandler(aClusterPath.mEndpointId, aClusterPath.mClusterId); + CommandHandlerInterfaceRegistry::GetCommandHandler(aClusterPath.mEndpointId, aClusterPath.mClusterId); if (commandHandler) { struct Context diff --git a/src/app/util/mock/BUILD.gn b/src/app/util/mock/BUILD.gn index 59ab39947711c2..fa57cf4e9e71e9 100644 --- a/src/app/util/mock/BUILD.gn +++ b/src/app/util/mock/BUILD.gn @@ -14,6 +14,8 @@ import("//build_overrides/chip.gni") +import("${chip_root}/src/app/codegen-data-model/model.gni") + config("mock_include") { include_dirs = [ "include" ] } @@ -39,3 +41,19 @@ source_set("mock_ember") { cflags = [ "-Wconversion" ] } + +# Include a runnable codegen data model that is based on the mocks +# defined in mock_ember. +source_set("mock_codegen_data_model") { + sources = codegen_data_model_SOURCES + public_deps = codegen_data_model_PUBLIC_DEPS + + sources += [ + "${chip_root}/src/app/util/ember-global-attribute-access-interface.cpp", + "${chip_root}/src/app/util/ember-io-storage.cpp", + "CodegenEmberMocks.cpp", + ] + + public_configs = [ ":mock_include" ] + public_deps += [ ":mock_ember" ] +} diff --git a/src/app/util/mock/CodegenEmberMocks.cpp b/src/app/util/mock/CodegenEmberMocks.cpp new file mode 100644 index 00000000000000..e1f0b2436084a7 --- /dev/null +++ b/src/app/util/mock/CodegenEmberMocks.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include +#include + +using chip::Protocols::InteractionModel::Status; + +void MatterReportingAttributeChangeCallback(const chip::app::ConcreteAttributePath & aPath) +{ + // NOOP currently, exists to satisfy linker only +} + +Status emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attRecord, const EmberAfAttributeMetadata ** metadata, + uint8_t * buffer, uint16_t readLength, bool write) +{ + if (!write) + { + memset(buffer, 0, readLength); + } + return Status::Success; +} + +Status emAfWriteAttributeExternal(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, + uint8_t * dataPtr, EmberAfAttributeType dataType) +{ + return Status::Success; +} + +Status emberAfWriteAttribute(chip::EndpointId endpoint, chip::ClusterId cluster, chip::AttributeId attributeID, uint8_t * dataPtr, + EmberAfAttributeType dataType) +{ + return emAfWriteAttributeExternal(endpoint, cluster, attributeID, dataPtr, dataType); +} diff --git a/src/app/util/mock/MockNodeConfig.cpp b/src/app/util/mock/MockNodeConfig.cpp index 5670966e2ebb29..b48c846e65072d 100644 --- a/src/app/util/mock/MockNodeConfig.cpp +++ b/src/app/util/mock/MockNodeConfig.cpp @@ -26,6 +26,63 @@ namespace chip { namespace Test { +namespace internal { +uint16_t SizeForType(EmberAfAttributeType type) +{ + switch (type) + { + case ZCL_BOOLEAN_ATTRIBUTE_TYPE: + case ZCL_INT8S_ATTRIBUTE_TYPE: + case ZCL_INT8U_ATTRIBUTE_TYPE: + case ZCL_BITMAP8_ATTRIBUTE_TYPE: + case ZCL_ENUM8_ATTRIBUTE_TYPE: + return 1; + case ZCL_INT16S_ATTRIBUTE_TYPE: + case ZCL_INT16U_ATTRIBUTE_TYPE: + case ZCL_BITMAP16_ATTRIBUTE_TYPE: + case ZCL_ENUM16_ATTRIBUTE_TYPE: + return 2; + case ZCL_INT24S_ATTRIBUTE_TYPE: + case ZCL_INT24U_ATTRIBUTE_TYPE: + return 3; + case ZCL_SINGLE_ATTRIBUTE_TYPE: + case ZCL_INT32S_ATTRIBUTE_TYPE: + case ZCL_INT32U_ATTRIBUTE_TYPE: + case ZCL_BITMAP32_ATTRIBUTE_TYPE: + return 4; + case ZCL_INT40S_ATTRIBUTE_TYPE: + case ZCL_INT40U_ATTRIBUTE_TYPE: + return 5; + case ZCL_INT48S_ATTRIBUTE_TYPE: + case ZCL_INT48U_ATTRIBUTE_TYPE: + return 6; + case ZCL_INT56S_ATTRIBUTE_TYPE: + case ZCL_INT56U_ATTRIBUTE_TYPE: + return 7; + case ZCL_DOUBLE_ATTRIBUTE_TYPE: + case ZCL_INT64S_ATTRIBUTE_TYPE: + case ZCL_INT64U_ATTRIBUTE_TYPE: + case ZCL_BITMAP64_ATTRIBUTE_TYPE: + return 8; + case ZCL_CHAR_STRING_ATTRIBUTE_TYPE: + case ZCL_LONG_CHAR_STRING_ATTRIBUTE_TYPE: + case ZCL_OCTET_STRING_ATTRIBUTE_TYPE: + case ZCL_LONG_OCTET_STRING_ATTRIBUTE_TYPE: + return kDefaultStringSize; + case ZCL_ARRAY_ATTRIBUTE_TYPE: + case ZCL_STRUCT_ATTRIBUTE_TYPE: + // These items are using AAI and are acceptable for tests + return 0; + default: + // this type of attribute is not supported for tests, we cannot guess its size + // + // see attribute-type.h for a list of attributes + ChipLogError(Test, "Warning: size for attribute type 0x%x is not set", type); + return 0; + } +} + +} // namespace internal namespace { diff --git a/src/app/util/mock/MockNodeConfig.h b/src/app/util/mock/MockNodeConfig.h index 55649e00935c83..10110604678c20 100644 --- a/src/app/util/mock/MockNodeConfig.h +++ b/src/app/util/mock/MockNodeConfig.h @@ -31,6 +31,12 @@ namespace Test { namespace internal { +constexpr uint16_t kDefaultStringSize = 16; // note: this is INCLUDING the length byte(s) + +// Determine an appropriate size for the given type. +// NOTE: this is for test only, not all types are included +uint16_t SizeForType(EmberAfAttributeType type); + constexpr EmberAfAttributeMetadata DefaultAttributeMetadata(chip::AttributeId id) { return EmberAfAttributeMetadata{ @@ -54,6 +60,7 @@ struct MockAttributeConfig { attributeMetaData.attributeType = type; attributeMetaData.mask = mask; + attributeMetaData.size = internal::SizeForType(type); } const AttributeId id; diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp index b485e7c5dfb4cb..f903b5b52ea8da 100644 --- a/src/app/util/util.cpp +++ b/src/app/util/util.cpp @@ -139,6 +139,8 @@ void MatterEnergyEvseModePluginServerInitCallback() {} void MatterPowerTopologyPluginServerInitCallback() {} void MatterElectricalEnergyMeasurementPluginServerInitCallback() {} void MatterElectricalPowerMeasurementPluginServerInitCallback() {} +void MatterWaterHeaterManagementPluginServerInitCallback() {} +void MatterWaterHeaterModePluginServerInitCallback() {} bool emberAfContainsAttribute(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId) { diff --git a/src/app/zap-templates/matter-idl-client.json b/src/app/zap-templates/matter-idl-client.json index 98bddf36ffaad1..8c918bc54260ca 100644 --- a/src/app/zap-templates/matter-idl-client.json +++ b/src/app/zap-templates/matter-idl-client.json @@ -38,6 +38,10 @@ { "name": "idl_cluster_definition", "path": "partials/idl/cluster_definition.zapt" + }, + { + "name": "idl_global_types", + "path": "partials/idl/global_types.zapt" } ], "templates": [ diff --git a/src/app/zap-templates/matter-idl-server.json b/src/app/zap-templates/matter-idl-server.json index 6b39f04826d6ee..047e4d6759e879 100644 --- a/src/app/zap-templates/matter-idl-server.json +++ b/src/app/zap-templates/matter-idl-server.json @@ -38,6 +38,10 @@ { "name": "idl_cluster_definition", "path": "partials/idl/cluster_definition.zapt" + }, + { + "name": "idl_global_types", + "path": "partials/idl/global_types.zapt" } ], "templates": [ diff --git a/src/app/zap-templates/partials/cluster-enums-ensure-known-value.zapt b/src/app/zap-templates/partials/cluster-enums-ensure-known-value.zapt new file mode 100644 index 00000000000000..939c33c037246a --- /dev/null +++ b/src/app/zap-templates/partials/cluster-enums-ensure-known-value.zapt @@ -0,0 +1,14 @@ +{{#unless (isInConfigList (concat ns "::" label) "EnumsNotUsedAsTypeInXML")}} +static auto __attribute__((unused)) EnsureKnownEnumValue({{ns}}::{{asType label}} val) +{ + using EnumType = {{ns}}::{{asType label}}; + switch (val) { + {{#zcl_enum_items}} + case EnumType::k{{asUpperCamelCase label}}: + {{/zcl_enum_items}} + return val; + default: + return EnumType::kUnknownEnumValue; + } +} +{{/unless}} diff --git a/src/app/zap-templates/partials/idl/global_types.zapt b/src/app/zap-templates/partials/idl/global_types.zapt new file mode 100644 index 00000000000000..bd72b43b2b36b5 --- /dev/null +++ b/src/app/zap-templates/partials/idl/global_types.zapt @@ -0,0 +1,30 @@ +{{#zcl_enums}} +{{#if has_no_clusters}} +enum {{asUpperCamelCase name preserveAcronyms=true}} : enum{{multiply size 8}} { + {{#zcl_enum_items}} + k{{asUpperCamelCase label preserveAcronyms=true}} = {{value}}; + {{/zcl_enum_items}} +} + +{{/if}} +{{/zcl_enums}} +{{#zcl_bitmaps}} +{{#if has_no_clusters}} +{{#if_is_atomic name}} +{{! Work around https://github.com/project-chip/zap/issues/1370 and manually filter out built-in bitmap types. }} +{{else}} +bitmap {{asUpperCamelCase name preserveAcronyms=true}} : bitmap{{multiply size 8}} { + {{#zcl_bitmap_items}} + k{{asUpperCamelCase label preserveAcronyms=true}} = {{asHex mask}}; + {{/zcl_bitmap_items}} +} + +{{/if_is_atomic}} +{{/if}} +{{/zcl_bitmaps}} +{{#zcl_structs}} +{{#if has_no_clusters}} +{{~>idl_structure_definition extraIndent=0}} + +{{/if}} +{{/zcl_structs}} diff --git a/src/app/zap-templates/partials/idl/structure_definition.zapt b/src/app/zap-templates/partials/idl/structure_definition.zapt index 453efe65d9cdbb..4045cdf11e98a8 100644 --- a/src/app/zap-templates/partials/idl/structure_definition.zapt +++ b/src/app/zap-templates/partials/idl/structure_definition.zapt @@ -1,7 +1,14 @@ {{indent extraIndent~}} {{#if isFabricScoped~}} fabric_scoped {{/if~}} struct {{name}} { +{{#if has_no_clusters}} +{{#zcl_struct_items}} + {{> idl_structure_member}} + +{{/zcl_struct_items}} +{{else}} {{#zcl_struct_items}} {{indent extraIndent~}} {{> idl_structure_member}} {{/zcl_struct_items}} +{{/if}} {{indent extraIndent~}} } diff --git a/src/app/zap-templates/templates/app/MatterIDL_Client.zapt b/src/app/zap-templates/templates/app/MatterIDL_Client.zapt index 143e065c1b459d..b3a93844e49a0e 100644 --- a/src/app/zap-templates/templates/app/MatterIDL_Client.zapt +++ b/src/app/zap-templates/templates/app/MatterIDL_Client.zapt @@ -1,6 +1,7 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +{{>idl_global_types}} {{#zcl_clusters~}} {{>idl_cluster_definition}} {{/zcl_clusters}} diff --git a/src/app/zap-templates/templates/app/MatterIDL_Server.zapt b/src/app/zap-templates/templates/app/MatterIDL_Server.zapt index 9531fc268a189a..ce0d2bdb5b1600 100644 --- a/src/app/zap-templates/templates/app/MatterIDL_Server.zapt +++ b/src/app/zap-templates/templates/app/MatterIDL_Server.zapt @@ -1,6 +1,7 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +{{>idl_global_types}} {{#all_user_clusters~}} {{>idl_cluster_definition}} {{/all_user_clusters}} diff --git a/src/app/zap-templates/templates/app/cluster-enums-check.zapt b/src/app/zap-templates/templates/app/cluster-enums-check.zapt index c5acb97314f4ff..b0d8ce150c4dbd 100644 --- a/src/app/zap-templates/templates/app/cluster-enums-check.zapt +++ b/src/app/zap-templates/templates/app/cluster-enums-check.zapt @@ -9,40 +9,17 @@ namespace app { namespace Clusters { {{#zcl_enums}} {{#if has_more_than_one_cluster}} -{{#unless (isInConfigList (concat "::" label) "EnumsNotUsedAsTypeInXML")}} -static auto __attribute__((unused)) EnsureKnownEnumValue(detail::{{asType label}} val) -{ - using EnumType = detail::{{asType label}}; - switch (val) { - {{#zcl_enum_items}} - case EnumType::k{{asUpperCamelCase label}}: - {{/zcl_enum_items}} - return val; - default: - return EnumType::kUnknownEnumValue; - } -} -{{/unless}} +{{> cluster_enums_ensure_known_value ns="detail"}} +{{else if has_no_clusters}} +{{> cluster_enums_ensure_known_value ns="Globals"}} + {{/if}} {{/zcl_enums}} {{#zcl_clusters}} {{#zcl_enums}} {{#unless has_more_than_one_cluster}} -{{#unless (isInConfigList (concat (asUpperCamelCase ../name) "::" label) "EnumsNotUsedAsTypeInXML")}} -static auto __attribute__((unused)) EnsureKnownEnumValue({{asUpperCamelCase ../name}}::{{asType label}} val) -{ - using EnumType = {{asUpperCamelCase ../name}}::{{asType label}}; - switch (val) { - {{#zcl_enum_items}} - case EnumType::k{{asUpperCamelCase label}}: - {{/zcl_enum_items}} - return val; - default: - return EnumType::kUnknownEnumValue; - } -} -{{/unless}} +{{> cluster_enums_ensure_known_value ns=(asUpperCamelCase ../name)}} {{/unless}} {{/zcl_enums}} diff --git a/src/app/zap-templates/templates/app/cluster-enums.zapt b/src/app/zap-templates/templates/app/cluster-enums.zapt index 17ce795200795f..3a1457895c8107 100644 --- a/src/app/zap-templates/templates/app/cluster-enums.zapt +++ b/src/app/zap-templates/templates/app/cluster-enums.zapt @@ -37,6 +37,37 @@ k{{asUpperCamelCase label}} = {{asHex mask}}, } // namespace detail +namespace Globals { +// Global enums. +{{#zcl_enums}} + +{{#if has_no_clusters}} + +{{> cluster_enums_enum ns=""}} + +{{/if}} +{{/zcl_enums}} + +// Global bitmaps. +{{#zcl_bitmaps}} + +{{#if has_no_clusters}} +{{! Work around https://github.com/project-chip/zap/issues/1370 and manually filter out built-in bitmap types. }} +{{#if_is_atomic label}} +{{else}} + +// Bitmap for {{label}} +enum class {{asType label}} : {{asUnderlyingZclType name}} { +{{#zcl_bitmap_items}} +k{{asUpperCamelCase label}} = {{asHex mask}}, +{{/zcl_bitmap_items}} +}; + +{{/if_is_atomic}} +{{/if}} +{{/zcl_bitmaps}} + +} // namespace Globals {{#zcl_clusters}} namespace {{asUpperCamelCase name}} { diff --git a/src/app/zap-templates/templates/app/cluster-objects-src.zapt b/src/app/zap-templates/templates/app/cluster-objects-src.zapt index 50bd812be31521..1322756b85213e 100644 --- a/src/app/zap-templates/templates/app/cluster-objects-src.zapt +++ b/src/app/zap-templates/templates/app/cluster-objects-src.zapt @@ -64,6 +64,18 @@ namespace Structs { } // namespace Structs } // namespace detail +namespace Globals { +// Global structs +namespace Structs { +{{#zcl_structs}} +{{#if has_no_clusters}} +{{> cluster_objects_struct header=false}} + +{{/if}} +{{/zcl_structs}} +} // namespace Structs +} // namespace Globals + {{#zcl_clusters}} namespace {{asUpperCamelCase name}} { {{#zcl_structs}} diff --git a/src/app/zap-templates/templates/app/cluster-objects.zapt b/src/app/zap-templates/templates/app/cluster-objects.zapt index 1453523b1b7986..e9f42b17c5ff66 100644 --- a/src/app/zap-templates/templates/app/cluster-objects.zapt +++ b/src/app/zap-templates/templates/app/cluster-objects.zapt @@ -35,6 +35,18 @@ namespace Structs { } // namespace detail namespace Globals { + +// Global structs. +namespace Structs { + +{{#zcl_structs}} +{{#if has_no_clusters}} +{{> cluster_objects_struct header=true}} + +{{/if}} +{{/zcl_structs}} +} // namespace Structs + namespace Attributes { {{#zcl_attributes_server}} {{#unless clusterRef}} diff --git a/src/app/zap-templates/zcl/data-model/all.xml b/src/app/zap-templates/zcl/data-model/all.xml index 23709faca1ace5..2a2f73ccfc1709 100644 --- a/src/app/zap-templates/zcl/data-model/all.xml +++ b/src/app/zap-templates/zcl/data-model/all.xml @@ -18,6 +18,7 @@ + @@ -33,6 +34,7 @@ + @@ -108,6 +110,8 @@ + + diff --git a/src/app/zap-templates/zcl/data-model/chip/access-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/access-control-cluster.xml index 17cef9f767ee54..4fc5018b41e802 100644 --- a/src/app/zap-templates/zcl/data-model/chip/access-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/access-control-cluster.xml @@ -20,7 +20,7 @@ limitations under the License. - + @@ -33,6 +33,14 @@ limitations under the License. + + + + + + + + @@ -49,8 +57,8 @@ limitations under the License. - - + + @@ -60,16 +68,45 @@ limitations under the License. + + + + + + + + + + + + + + + + + + + + General Access Control 0x001F ACCESS_CONTROL_CLUSTER true + + + + + + + + true + 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 + 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. @@ -84,36 +121,52 @@ limitations under the License. - - SubjectsPerAccessControlEntry - - + SubjectsPerAccessControlEntry + TargetsPerAccessControlEntry + AccessControlEntriesPerFabric + CommissioningARL + ARL - - TargetsPerAccessControlEntry - - + + 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. + + + - - AccessControlEntriesPerFabric - - + + Returns the review token for the request, which can be used to correlate with a FabricRestrictionReviewUpdate event. + + - + The cluster SHALL send AccessControlEntryChanged events whenever its ACL attribute data is changed by an Administrator. - + - + + The cluster SHALL send AccessControlExtensionChanged events whenever its extension attribute data is changed by an Administrator. - + + + + The cluster SHALL send AccessRestrictionEntryChanged events whenever its ARL attribute data is changed by the device maker. + + + + + The cluster SHALL send FabricRestrictionReviewUpdate events to indicate completion of a fabric restriction review. + + + + + 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 a9c0f7f620e42a..7f6320a5880dc9 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 @@ -104,7 +104,7 @@ limitations under the License.
Reachable - UniqueID + UniqueID CapabilityMinima ProductAppearance SpecificationVersion diff --git a/src/app/zap-templates/zcl/data-model/chip/bridged-device-basic-information.xml b/src/app/zap-templates/zcl/data-model/chip/bridged-device-basic-information.xml index 3c4499d6d7a28e..74f88bea39e623 100644 --- a/src/app/zap-templates/zcl/data-model/chip/bridged-device-basic-information.xml +++ b/src/app/zap-templates/zcl/data-model/chip/bridged-device-basic-information.xml @@ -71,6 +71,12 @@ limitations under the License. true + + + + + + VendorName VendorID ProductName @@ -85,9 +91,14 @@ limitations under the License. ProductLabel SerialNumber Reachable - UniqueID + UniqueID ProductAppearance + + The server SHALL attempt to keep the devices specified active for StayActiveDuration milliseconds when they are next active. + + + The StartUp event SHALL be emitted by a Node as soon as reasonable after completing a boot or reboot process. @@ -102,6 +113,10 @@ limitations under the License. This event SHALL be generated when there is a change in the Reachable attribute. + + This event (when supported) SHALL be generated the next time a bridged device becomes active after a KeepActive command is received. + +
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 749731069494f5..c97d4a59baa00b 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 @@ -98,7 +98,7 @@ limitations under the License. true true - + 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 new file mode 100644 index 00000000000000..7228b8f47a20ab --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/commissioner-control-cluster.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + General + Commissioner Control + 0x0751 + COMMISSIONER_CONTROL_CLUSTER + true + true + Supports the ability for clients to request the commissioning of themselves or other nodes onto a fabric which the cluster server can commission onto. + + + + + SupportedDeviceCategories + + + + + This command is sent by a client to request approval for a future CommissionNode call. + + + + + + + + + This command is sent by a client to request that the server begins commissioning a previously approved request. + + + + + + + + + + When received within the timeout specified by CommissionNode, the client SHALL open a commissioning window on to the node which the client called RequestCommissioningApproval to have commissioned. + + + + + + + + + This event SHALL be sent by the server following a RequestCommissioningApproval command which the server responded to with SUCCESS. + + + + + + + + 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 639b965cfc9bf9..d63dbeb05ca11a 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 @@ -19,6 +19,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 new file mode 100644 index 00000000000000..1b553eeb54faf6 --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/ecosystem-information-cluster.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + General + Ecosystem Information + 0x0750 + ECOSYSTEM_INFORMATION_CLUSTER + Provides extended device information for all the logical devices represented by a Bridged Node. + true + true + + + + RemovedOn + + + + DeviceDirectory + + + + LocationDirectory + + + + 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 5c22b8e93be8da..94774774d53a10 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 @@ -13,7 +13,6 @@ limitations under the License. --> - @@ -32,6 +31,7 @@ limitations under the License. + @@ -75,7 +75,7 @@ limitations under the License. - + @@ -94,11 +94,13 @@ limitations under the License. true true Electric Vehicle Supply Equipment (EVSE) is equipment used to charge an Electric Vehicle (EV) or Plug-In Hybrid Electric Vehicle. This cluster provides an interface to the functionality of Electric Vehicle Supply Equipment (EVSE) management. - - + - + + + + @@ -113,22 +115,18 @@ limitations under the License. - - - State - SupplyState - FaultState - ChargingEnabledUntil + State + SupplyState + FaultState + ChargingEnabledUntil - - DischargingEnabledUntil - CircuitCapacity - MinimumChargeCurrent - MaximumChargeCurrent + DischargingEnabledUntil + CircuitCapacity + MinimumChargeCurrent + MaximumChargeCurrent - - MaximumDischargeCurrent + MaximumDischargeCurrent UserMaximumChargeCurrent @@ -138,77 +136,75 @@ limitations under the License. RandomizationDelayWindow - - - - NextChargeStartTime + NextChargeStartTime - - NextChargeTargetTime + NextChargeTargetTime - - NextChargeRequiredEnergy + NextChargeRequiredEnergy - - NextChargeTargetSoC + NextChargeTargetSoC - - + ApproximateEVEfficiency - - StateOfCharge + StateOfCharge - - BatteryCapacity + BatteryCapacity - - VehicleID - SessionID - SessionDuration - SessionEnergyCharged + VehicleID + SessionID + SessionDuration + SessionEnergyCharged - - SessionEnergyDischarged + SessionEnergyDischarged Allows a client to disable the EVSE from charging and discharging. + - - - - Allows a client to enable the EVSE to charge an EV. + + + + This command allows a client to enable the EVSE to charge an EV, + - - - Allows a client to enable the EVSE to discharge an EV. + + + Upon receipt, this SHALL allow a client to enable the discharge of an EV, + 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 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. + EVConnected + EVNotDetected @@ -217,19 +213,24 @@ limitations under the License. + EnergyTransferStarted - + + + EnergyTransferStopped + + Fault @@ -237,10 +238,11 @@ limitations under the License. + RFID - + diff --git a/src/app/zap-templates/zcl/data-model/chip/global-structs.xml b/src/app/zap-templates/zcl/data-model/chip/global-structs.xml index 54b4f69bc93bb8..04f477a6094f5e 100644 --- a/src/app/zap-templates/zcl/data-model/chip/global-structs.xml +++ b/src/app/zap-templates/zcl/data-model/chip/global-structs.xml @@ -23,12 +23,34 @@ TODO: Make these structures global rather than defining them for each cluster. - + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/icd-management-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/icd-management-cluster.xml index c1e2805de8bf15..533495af167134 100644 --- a/src/app/zap-templates/zcl/data-model/chip/icd-management-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/icd-management-cluster.xml @@ -69,7 +69,7 @@ limitations under the License. - + @@ -96,8 +96,17 @@ limitations under the License. + +> +> +> +> +> + + + IdleModeDuration ActiveModeDuration ActiveModeThreshold @@ -113,6 +122,7 @@ limitations under the License. UserActiveModeTriggerHint UserActiveModeTriggerInstruction OperatingMode + MaximumCheckInBackOff Register a client to the end device 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 11837b8be0e8f4..f126d8836f720c 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 @@ -33,8 +33,8 @@ limitations under the License. LAUNDRY_DRYER_CONTROLS_CLUSTER true true - This cluster supports remotely monitoring and controling the different typs of - functionality available to a drying device, such as a laundry dryer. + This cluster provides a way to access options associated with the operation of + a laundry dryer device type. 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 79a7da56a448e0..4d0e67ddbd1b47 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 @@ -46,7 +46,7 @@ limitations under the License. true true - + @@ -74,8 +74,8 @@ limitations under the License. OnLevel OnTransitionTime OffTransitionTime - DefaultMoveRate - Options + DefaultMoveRate + Options StartUpCurrentLevel 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 ce12fb58abb9f5..f0266fffecb872 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 @@ -2426,6 +2426,7 @@ limitations under the License. Endpoint + diff --git a/src/app/zap-templates/zcl/data-model/chip/mode-base-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/mode-base-cluster.xml index 111df8eca07eff..b8e81233473932 100644 --- a/src/app/zap-templates/zcl/data-model/chip/mode-base-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/mode-base-cluster.xml @@ -32,6 +32,7 @@ This is because zap does not currently support generating code for clusters that + @@ -47,6 +48,7 @@ This is because zap does not currently support generating code for clusters that + 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 0c1189093c4e79..b6315bdc1287c1 100644 --- a/src/app/zap-templates/zcl/data-model/chip/scene.xml +++ b/src/app/zap-templates/zcl/data-model/chip/scene.xml @@ -29,16 +29,39 @@ limitations under the License. - + - + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -63,7 +86,7 @@ limitations under the License. FabricSceneInfo - Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' + Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' diff --git a/src/app/zap-templates/zcl/data-model/chip/semantic-tag-namespace-enums.xml b/src/app/zap-templates/zcl/data-model/chip/semantic-tag-namespace-enums.xml index a1572523bcb0b3..8e6d9237e29d90 100644 --- a/src/app/zap-templates/zcl/data-model/chip/semantic-tag-namespace-enums.xml +++ b/src/app/zap-templates/zcl/data-model/chip/semantic-tag-namespace-enums.xml @@ -44,6 +44,7 @@ TODO: Make these namespace enums global rather than defining them for each clust + 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 84e9a464336080..3332172500e451 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 @@ -18,12 +18,12 @@ limitations under the License. Data types - + - - - - + + + + @@ -71,7 +71,7 @@ limitations under the License. - + General Service Area The Service Area cluster provides an interface for controlling the locations where a device should operate, and for querying the current location. 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 62e9a6d883516d..f731b66c6a1422 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 @@ -92,12 +92,6 @@ limitations under the License. - - - - - - @@ -206,7 +200,8 @@ limitations under the License. - + + @@ -224,11 +219,6 @@ limitations under the License. - - - - - @@ -323,9 +313,6 @@ limitations under the License. - - - @@ -345,7 +332,7 @@ limitations under the License. - + LocalTemperatureCalibration @@ -467,10 +454,8 @@ limitations under the License. PresetsSchedulesEditable - TemperatureSetpointHoldPolicy - SetpointHoldExpiryTimestamp - QueuedPreset - + SetpointHoldExpiryTimestamp + @@ -508,7 +493,6 @@ limitations under the License. This command is used to set the active preset. - This command is used to start editing the presets and schedules. @@ -523,14 +507,6 @@ limitations under the License. This command is used to notify the server that all edits are done and should be committed. - - This command is sent to cancel a queued preset. - - - - This command sets the set point hold policy. - - 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 2c1cd01d67c7b2..b6ee4385fb73ff 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 @@ -22,7 +22,7 @@ limitations under the License. - + HRAP Thread Border Router Management 0x0452 @@ -33,40 +33,39 @@ limitations under the License. - BorderRouterName + BorderRouterName - BorderAgentID + BorderAgentID - ThreadVersion + ThreadVersion - InterfaceEnabled + InterfaceEnabled - ActiveDatasetTimestamp + ActiveDatasetTimestamp - - + 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. - + Command to set or update the active Dataset of the Thread network to which the Border Router is connected. - + 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-directory-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/thread-network-directory-cluster.xml index f802b7ab4452c0..3a6445b15bbad3 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 @@ -17,14 +17,15 @@ limitations under the License. - + - + + - + Network Infrastructure Thread Network Directory 0x0453 @@ -37,7 +38,7 @@ limitations under the License. - + PreferredExtendedPanID @@ -56,22 +57,16 @@ limitations under the License. Removes an entry from the ThreadNetworks list. - + - + Retrieves a Thread Operational Dataset from the ThreadNetworks list. - + This is the response to a GetOperationalDataset request. - - - This event SHALL be generated when an entry in ThreadNetworks is added, removed, or had its Operational Dataset changed. - - - 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 new file mode 100644 index 00000000000000..0c5a9a1efea2fa --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/water-heater-management-cluster.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Energy Management + Water Heater Management + 0x0094 + WATER_HEATER_MANAGEMENT_CLUSTER + This cluster is used to allow clients to control the operation of a hot water heating appliance so that it can be used with energy management. + true + + + + + + + + + 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. + + + + + 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 new file mode 100644 index 00000000000000..23a1b2eec5d4c0 --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/water-heater-mode-cluster.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + General + Water Heater Mode + 0x009E + WATER_HEATER_MODE_CLUSTER + true + true + Attributes and commands for selecting a mode from a list of supported options. + + + + + + + + + + SupportedModes + CurrentMode + StartUpMode + OnMode + + + + + This command is used to change device modes. + On receipt of this command the device SHALL respond with a ChangeToModeResponse command. + + + + + + + This command is sent by the device on receipt of the ChangeToModeWithStatus command. + + + + + + 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 f05faad4dae4d2..8c8b4d40c3abdd 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 @@ -17,7 +17,7 @@ limitations under the License. - + Network Infrastructure Wi-Fi Network Management 0x0451 @@ -30,11 +30,15 @@ limitations under the License. - SSID + 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/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index 95fa00cb7952c7..1452fa0f9ed8f7 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -33,6 +33,7 @@ "channel-cluster.xml", "clusters-extensions.xml", "color-control-cluster.xml", + "commissioner-control-cluster.xml", "concentration-measurement-cluster.xml", "content-launch-cluster.xml", "content-app-observer-cluster.xml", @@ -47,6 +48,7 @@ "microwave-oven-mode-cluster.xml", "microwave-oven-control-cluster.xml", "door-lock-cluster.xml", + "ecosystem-information-cluster.xml", "energy-preference-cluster.xml", "electrical-energy-measurement-cluster.xml", "electrical-measurement-cluster.xml", @@ -129,6 +131,8 @@ "valve-configuration-and-control-cluster.xml", "wake-on-lan-cluster.xml", "washer-controls-cluster.xml", + "water-heater-management-cluster.xml", + "water-heater-mode-cluster.xml", "wifi-network-diagnostics-cluster.xml", "wifi-network-management-cluster.xml", "window-covering.xml", @@ -275,7 +279,8 @@ "ActiveModeThreshold", "RegisteredClients", "ICDCounter", - "ClientsSupportedPerFabric" + "ClientsSupportedPerFabric", + "MaximumCheckInBackOff" ], "Occupancy Sensing": ["HoldTimeLimits"], "Operational Credentials": [ @@ -296,6 +301,14 @@ "general_error_boolean", "cluster_error_boolean" ], + "Thread Border Router Management": [ + "BorderRouterName", + "BorderAgentID", + "ThreadVersion", + "InterfaceEnabled", + "ActiveDatasetTimestamp", + "FeatureMap" + ], "Thread Network Diagnostics": [ "Channel", "RoutingRole", @@ -606,7 +619,6 @@ "FeatureMap" ], "Air Quality": ["AirQuality", "FeatureMap"], - "Thermostat": ["QueuedPreset"], "Electrical Energy Measurement": [ "Accuracy", "CumulativeEnergyImported", @@ -641,7 +653,23 @@ "Power Topology": ["FeatureMap"], "Valve Configuration and Control": ["RemainingDuration"], "Boolean State Configuration": ["CurrentSensitivityLevel"], - "Wi-Fi Network Management": ["SSID"] + "Water Heater Management": [ + "HeaterTypes", + "HeatDemand", + "TankVolume", + "EstimatedHeatRequired", + "TankPercentage", + "BoostState", + "FeatureMap", + "ClusterRevision" + ], + "Water Heater Mode": ["SupportedModes", "CurrentMode", "FeatureMap"], + "Wi-Fi Network Management": ["SSID", "PassphraseSurrogate"], + "Thread Network Directory": [ + "PreferredExtendedPanID", + "ThreadNetworks", + "ThreadNetworkTableSize" + ] }, "defaultReportingPolicy": "mandatory", "ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"], diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index e3ec959ff64e83..769e6e87b698e8 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -32,6 +32,7 @@ "channel-cluster.xml", "clusters-extensions.xml", "color-control-cluster.xml", + "commissioner-control-cluster.xml", "concentration-measurement-cluster.xml", "content-launch-cluster.xml", "content-app-observer-cluster.xml", @@ -45,6 +46,7 @@ "microwave-oven-mode-cluster.xml", "door-lock-cluster.xml", "drlc-cluster.xml", + "ecosystem-information-cluster.xml", "electrical-energy-measurement-cluster.xml", "electrical-measurement-cluster.xml", "electrical-power-measurement-cluster.xml", @@ -127,6 +129,8 @@ "valve-configuration-and-control-cluster.xml", "wake-on-lan-cluster.xml", "washer-controls-cluster.xml", + "water-heater-management-cluster.xml", + "water-heater-mode-cluster.xml", "wifi-network-diagnostics-cluster.xml", "wifi-network-management-cluster.xml", "window-covering.xml", @@ -273,7 +277,8 @@ "ActiveModeThreshold", "RegisteredClients", "ICDCounter", - "ClientsSupportedPerFabric" + "ClientsSupportedPerFabric", + "MaximumCheckInBackOff" ], "Occupancy Sensing": ["HoldTimeLimits"], "Operational Credentials": [ @@ -294,6 +299,14 @@ "general_error_boolean", "cluster_error_boolean" ], + "Thread Border Router Management": [ + "BorderRouterName", + "BorderAgentID", + "ThreadVersion", + "InterfaceEnabled", + "ActiveDatasetTimestamp", + "FeatureMap" + ], "Thread Network Diagnostics": [ "Channel", "RoutingRole", @@ -604,7 +617,6 @@ "FeatureMap" ], "Air Quality": ["AirQuality", "FeatureMap"], - "Thermostat": ["QueuedPreset"], "Electrical Energy Measurement": [ "Accuracy", "CumulativeEnergyImported", @@ -639,7 +651,23 @@ "Power Topology": ["FeatureMap"], "Valve Configuration and Control": ["RemainingDuration"], "Boolean State Configuration": ["CurrentSensitivityLevel"], - "Wi-Fi Network Management": ["SSID"] + "Water Heater Management": [ + "HeaterTypes", + "HeatDemand", + "TankVolume", + "EstimatedHeatRequired", + "TankPercentage", + "BoostState", + "FeatureMap", + "ClusterRevision" + ], + "Water Heater Mode": ["SupportedModes", "CurrentMode", "FeatureMap"], + "Wi-Fi Network Management": ["SSID", "PassphraseSurrogate"], + "Thread Network Directory": [ + "PreferredExtendedPanID", + "ThreadNetworks", + "ThreadNetworkTableSize" + ] }, "defaultReportingPolicy": "mandatory", "ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"], diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index 4c7757224b1a7d..6939c1475ead70 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -23,6 +23,7 @@ "CHANNEL_CLUSTER": [], "CLIENT_MONITORING_CLUSTER": [], "COLOR_CONTROL_CLUSTER": [], + "COMMISSIONER_CONTROL_CLUSTER": [], "COMMISSIONING_CLUSTER": [], "CONTENT_LAUNCHER_CLUSTER": [], "CONTENT_CONTROL_CLUSTER": [], @@ -36,6 +37,7 @@ "DISHWASHER_MODE_CLUSTER": [], "MICROWAVE_OVEN_MODE_CLUSTER": [], "DOOR_LOCK_CLUSTER": [], + "ECOSYSTEM_INFORMATION_CLUSTER": [], "ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER": [], "ELECTRICAL_MEASUREMENT_CLUSTER": [], "ELECTRICAL_POWER_MEASUREMENT_CLUSTER": [], @@ -70,7 +72,7 @@ "NETWORK_COMMISSIONING_CLUSTER": [], "SAMPLE_MEI_CLUSTER": [], "NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER": [], - "OCCUPANCY_SENSING_CLUSTER": ["occupancy-sensor-server"], + "OCCUPANCY_SENSING_CLUSTER": [], "ON_OFF_CLUSTER": [], "ON_OFF_SWITCH_CONFIGURATION_CLUSTER": [], "OPERATIONAL_CREDENTIALS_CLUSTER": [], @@ -116,6 +118,7 @@ "THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER": [], "THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER": [], "THREAD_NETWORK_DIAGNOSTICS_CLUSTER": [], + "THREAD_NETWORK_DIRECTORY_CLUSTER": [], "TIME_CLUSTER": [], "TIME_FORMAT_LOCALIZATION_CLUSTER": [], "TIME_SYNCHRONIZATION_CLUSTER": [], @@ -129,6 +132,8 @@ "WAKE_ON_LAN_CLUSTER": [], "LAUNDRY_WASHER_CONTROLS_CLUSTER": [], "LAUNDRY_DRYER_CONTROLS_CLUSTER": [], + "WATER_HEATER_MANAGEMENT_CLUSTER": [], + "WATER_HEATER_MODE_CLUSTER": [], "WIFI_NETWORK_DIAGNOSTICS_CLUSTER": [], "WINDOW_COVERING_CLUSTER": [], "ZLL_COMMISSIONING_CLUSTER": [] @@ -168,6 +173,7 @@ ], "CHANNEL_CLUSTER": ["channel-server"], "COLOR_CONTROL_CLUSTER": ["color-control-server"], + "COMMISSIONER_CONTROL_CLUSTER": ["commissioner-control-server"], "COMMISSIONING_CLUSTER": [], "CONTENT_LAUNCHER_CLUSTER": ["content-launch-server"], "CONTENT_CONTROL_CLUSTER": ["content-control-server"], @@ -181,6 +187,7 @@ "DISHWASHER_MODE_CLUSTER": ["mode-base-server"], "MICROWAVE_OVEN_MODE_CLUSTER": ["mode-base-server"], "DOOR_LOCK_CLUSTER": ["door-lock-server"], + "ECOSYSTEM_INFORMATION_CLUSTER": ["ecosystem-information-server"], "ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER": [ "electrical-energy-measurement-server" ], @@ -287,11 +294,13 @@ "THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER": [ "thermostat-user-interface-configuration-server" ], - "THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER": [], + "THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER": [ + "thread-border-router-management-server" + ], "THREAD_NETWORK_DIAGNOSTICS_CLUSTER": [ "thread-network-diagnostics-server" ], - "THREAD_NETWORK_DIRECTORY_CLUSTER": [], + "THREAD_NETWORK_DIRECTORY_CLUSTER": ["thread-network-directory-server"], "TIME_CLUSTER": [], "TIME_FORMAT_LOCALIZATION_CLUSTER": ["time-format-localization-server"], "TIME_SYNCHRONIZATION_CLUSTER": ["time-synchronization-server"], @@ -311,6 +320,8 @@ "WIFI_NETWORK_DIAGNOSTICS_CLUSTER": ["wifi-network-diagnostics-server"], "WIFI_NETWORK_MANAGEMENT_CLUSTER": ["wifi-network-management-server"], "WINDOW_COVERING_CLUSTER": ["window-covering-server"], + "WATER_HEATER_MANAGEMENT_CLUSTER": ["water-heater-management-server"], + "WATER_HEATER_MODE_CLUSTER": ["mode-base-server"], "ZLL_COMMISSIONING_CLUSTER": [] } } diff --git a/src/ble/BLEEndPoint.cpp b/src/ble/BLEEndPoint.cpp index 78e74bdec78b1a..d8e2a7b2a49d5e 100644 --- a/src/ble/BLEEndPoint.cpp +++ b/src/ble/BLEEndPoint.cpp @@ -133,11 +133,8 @@ CHIP_ERROR BLEEndPoint::StartConnect() // Add reference to message fragment for duration of platform's GATT write attempt. CHIP retains partial // ownership of message fragment's packet buffer, since this is the same buffer as that of the whole message, just // with a fragmenter-modified payload offset and data length, by a Retain() on the handle when calling this function. - if (!SendWrite(buf.Retain())) - { - err = BLE_ERROR_GATT_WRITE_FAILED; - ExitNow(); - } + err = SendWrite(buf.Retain()); + SuccessOrExit(err); // Free request buffer on write confirmation. Stash a reference to it in mSendQueue, which we don't use anyway // until the connection has been set up. @@ -213,13 +210,13 @@ void BLEEndPoint::HandleSubscribeReceived() // Add reference to message fragment for duration of platform's GATT indication attempt. CHIP retains partial // ownership of message fragment's packet buffer, since this is the same buffer as that of the whole message, just // with a fragmenter-modified payload offset and data length. - if (!SendIndication(mSendQueue.Retain())) + err = SendIndication(mSendQueue.Retain()); + if (err != CHIP_NO_ERROR) { // Ensure transmit queue is empty and set to NULL. mSendQueue = nullptr; ChipLogError(Ble, "cap resp ind failed"); - err = BLE_ERROR_GATT_INDICATE_FAILED; ExitNow(); } @@ -389,9 +386,10 @@ void BLEEndPoint::FinalizeClose(uint8_t oldState, uint8_t flags, CHIP_ERROR err) // Indicate close of chipConnection to peripheral via GATT unsubscribe. Keep end point allocated until // unsubscribe completes or times out, so platform doesn't close underlying BLE connection before // we're really sure the unsubscribe request has been sent. - if (!mBle->mPlatformDelegate->UnsubscribeCharacteristic(mConnObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_2_UUID)) + err = mBle->mPlatformDelegate->UnsubscribeCharacteristic(mConnObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_2_UUID); + if (err != CHIP_NO_ERROR) { - ChipLogError(Ble, "BtpEngine unsub failed"); + ChipLogError(Ble, "BtpEngine unsubscribe failed %" CHIP_ERROR_FORMAT, err.Format()); // If unsubscribe fails, release BLE connection and free end point immediately. Free(); @@ -568,31 +566,20 @@ CHIP_ERROR BLEEndPoint::SendCharacteristic(PacketBufferHandle && buf) if (mRole == kBleRole_Central) { - if (!SendWrite(std::move(buf))) - { - err = BLE_ERROR_GATT_WRITE_FAILED; - } - else - { - // Write succeeded, so shrink remote receive window counter by 1. - mRemoteReceiveWindowSize = static_cast(mRemoteReceiveWindowSize - 1); - ChipLogDebugBleEndPoint(Ble, "decremented remote rx window, new size = %u", mRemoteReceiveWindowSize); - } + SuccessOrExit(err = SendWrite(std::move(buf))); + // Write succeeded, so shrink remote receive window counter by 1. + mRemoteReceiveWindowSize = static_cast(mRemoteReceiveWindowSize - 1); + ChipLogDebugBleEndPoint(Ble, "decremented remote rx window, new size = %u", mRemoteReceiveWindowSize); } else // (mRole == kBleRole_Peripheral), verified on Init { - if (!SendIndication(std::move(buf))) - { - err = BLE_ERROR_GATT_INDICATE_FAILED; - } - else - { - // Indication succeeded, so shrink remote receive window counter by 1. - mRemoteReceiveWindowSize = static_cast(mRemoteReceiveWindowSize - 1); - ChipLogDebugBleEndPoint(Ble, "decremented remote rx window, new size = %u", mRemoteReceiveWindowSize); - } + SuccessOrExit(err = SendIndication(std::move(buf))); + // Indication succeeded, so shrink remote receive window counter by 1. + mRemoteReceiveWindowSize = static_cast(mRemoteReceiveWindowSize - 1); + ChipLogDebugBleEndPoint(Ble, "decremented remote rx window, new size = %u", mRemoteReceiveWindowSize); } +exit: return err; } @@ -750,8 +737,8 @@ CHIP_ERROR BLEEndPoint::HandleHandshakeConfirmationReceived() { // Subscribe to characteristic which peripheral will use to send indications. Prompts peripheral to send // BLE transport capabilities indication. - VerifyOrExit(mBle->mPlatformDelegate->SubscribeCharacteristic(mConnObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_2_UUID), - err = BLE_ERROR_GATT_SUBSCRIBE_FAILED); + err = mBle->mPlatformDelegate->SubscribeCharacteristic(mConnObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_2_UUID); + SuccessOrExit(err); // We just sent a GATT subscribe request, so make sure to attempt unsubscribe on close. mConnStateFlags.Set(ConnectionStateFlag::kDidBeginSubscribe); @@ -1309,18 +1296,25 @@ CHIP_ERROR BLEEndPoint::Receive(PacketBufferHandle && data) return err; } -bool BLEEndPoint::SendWrite(PacketBufferHandle && buf) +CHIP_ERROR BLEEndPoint::SendWrite(PacketBufferHandle && buf) { mConnStateFlags.Set(ConnectionStateFlag::kGattOperationInFlight); - return mBle->mPlatformDelegate->SendWriteRequest(mConnObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_1_UUID, std::move(buf)); + auto err = mBle->mPlatformDelegate->SendWriteRequest(mConnObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_1_UUID, std::move(buf)); + VerifyOrReturnError(err == CHIP_NO_ERROR, err, + ChipLogError(Ble, "Send write request failed: %" CHIP_ERROR_FORMAT, err.Format())); + + return err; } -bool BLEEndPoint::SendIndication(PacketBufferHandle && buf) +CHIP_ERROR BLEEndPoint::SendIndication(PacketBufferHandle && buf) { mConnStateFlags.Set(ConnectionStateFlag::kGattOperationInFlight); - return mBle->mPlatformDelegate->SendIndication(mConnObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_2_UUID, std::move(buf)); + auto err = mBle->mPlatformDelegate->SendIndication(mConnObj, &CHIP_BLE_SVC_ID, &CHIP_BLE_CHAR_2_UUID, std::move(buf)); + VerifyOrReturnError(err == CHIP_NO_ERROR, err, ChipLogError(Ble, "Send indication failed: %" CHIP_ERROR_FORMAT, err.Format())); + + return err; } CHIP_ERROR BLEEndPoint::StartConnectTimer() diff --git a/src/ble/BLEEndPoint.h b/src/ble/BLEEndPoint.h index f027a9c2a9c0e6..97c094747a8d7f 100644 --- a/src/ble/BLEEndPoint.h +++ b/src/ble/BLEEndPoint.h @@ -169,8 +169,8 @@ class DLL_EXPORT BLEEndPoint CHIP_ERROR ContinueMessageSend(); CHIP_ERROR DoSendStandAloneAck(); CHIP_ERROR SendCharacteristic(PacketBufferHandle && buf); - bool SendIndication(PacketBufferHandle && buf); - bool SendWrite(PacketBufferHandle && buf); + CHIP_ERROR SendIndication(PacketBufferHandle && buf); + CHIP_ERROR SendWrite(PacketBufferHandle && buf); // Receive path: CHIP_ERROR HandleConnectComplete(); diff --git a/src/ble/BlePlatformDelegate.h b/src/ble/BlePlatformDelegate.h index bdf1e19ad211fc..35f8e1808eb25c 100644 --- a/src/ble/BlePlatformDelegate.h +++ b/src/ble/BlePlatformDelegate.h @@ -28,6 +28,7 @@ #error "Please include instead!" #endif +#include #include #include @@ -48,30 +49,26 @@ class DLL_EXPORT BlePlatformDelegate // Following APIs must be implemented by platform: // Subscribe to updates and indications on the specfied characteristic - virtual bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId) = 0; + virtual CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, + const ChipBleUUID * charId) = 0; // Unsubscribe from updates and indications on the specified characteristic - virtual bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, - const ChipBleUUID * charId) = 0; + virtual CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, + const ChipBleUUID * charId) = 0; // Close the underlying BLE connection. - virtual bool CloseConnection(BLE_CONNECTION_OBJECT connObj) = 0; + virtual CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT connObj) = 0; // Get MTU size negotiated for specified BLE connection. Return value of 0 means MTU size could not be determined. virtual uint16_t GetMTU(BLE_CONNECTION_OBJECT connObj) const = 0; - // Data path calling convention: - // A 'true' return value from a Send* function indicates that the characteristic was written or updated - // successfully. A 'false' value indicates failure, and is used to report this failure to the user via the return - // value of chipConnection::SendMessage. - // Send GATT characteristic indication request - virtual bool SendIndication(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) = 0; + virtual CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) = 0; // Send GATT characteristic write request - virtual bool SendWriteRequest(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) = 0; + virtual CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) = 0; }; } /* namespace Ble */ diff --git a/src/ble/tests/BUILD.gn b/src/ble/tests/BUILD.gn index ac897ab40a9c27..cfc5b5cb67be25 100644 --- a/src/ble/tests/BUILD.gn +++ b/src/ble/tests/BUILD.gn @@ -31,6 +31,7 @@ chip_test_suite("tests") { public_deps = [ "${chip_root}/src/ble", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/platform", ] } diff --git a/src/ble/tests/TestBleErrorStr.cpp b/src/ble/tests/TestBleErrorStr.cpp index 6868532823d950..7e3f0f51d5bfc4 100644 --- a/src/ble/tests/TestBleErrorStr.cpp +++ b/src/ble/tests/TestBleErrorStr.cpp @@ -28,13 +28,13 @@ #include #include +#include + #include #define _CHIP_BLE_BLE_H #include -#include - using namespace chip; // Test input data. diff --git a/src/ble/tests/TestBleLayer.cpp b/src/ble/tests/TestBleLayer.cpp index 5377e4465f66c5..fe3c82db1a1917 100644 --- a/src/ble/tests/TestBleLayer.cpp +++ b/src/ble/tests/TestBleLayer.cpp @@ -21,9 +21,10 @@ #include #include -#include +#include #include +#include #include #include #include @@ -131,19 +132,23 @@ class TestBleLayer : public BleLayer, /// // Implementation of BlePlatformDelegate - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT, const ChipBleUUID *, const ChipBleUUID *) override { return true; } - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT, const ChipBleUUID *, const ChipBleUUID *) override { return true; } - bool CloseConnection(BLE_CONNECTION_OBJECT connObj) override { return true; } - uint16_t GetMTU(BLE_CONNECTION_OBJECT connObj) const override { return 0; } - bool SendIndication(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) override + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT, const ChipBleUUID *, const ChipBleUUID *) override { - return true; + return CHIP_NO_ERROR; } - bool SendWriteRequest(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) override + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT, const ChipBleUUID *, const ChipBleUUID *) override { - return true; + return CHIP_NO_ERROR; + } + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT) override { return CHIP_NO_ERROR; } + uint16_t GetMTU(BLE_CONNECTION_OBJECT) const override { return 0; } + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT, const ChipBleUUID *, const ChipBleUUID *, PacketBufferHandle) override + { + return CHIP_NO_ERROR; + } + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT, const ChipBleUUID *, const ChipBleUUID *, PacketBufferHandle) override + { + return CHIP_NO_ERROR; } private: diff --git a/src/ble/tests/TestBleUUID.cpp b/src/ble/tests/TestBleUUID.cpp index 445535594fae4b..e4284001f138dd 100644 --- a/src/ble/tests/TestBleUUID.cpp +++ b/src/ble/tests/TestBleUUID.cpp @@ -27,7 +27,7 @@ #define _CHIP_BLE_BLE_H #include -#include +#include using namespace chip; using namespace chip::Ble; diff --git a/src/ble/tests/TestBtpEngine.cpp b/src/ble/tests/TestBtpEngine.cpp index 2b8fb1ff84b562..e565ac2a30de91 100644 --- a/src/ble/tests/TestBtpEngine.cpp +++ b/src/ble/tests/TestBtpEngine.cpp @@ -20,6 +20,9 @@ #include #include +#include + +#include #include #include @@ -27,8 +30,6 @@ #include #include -#include - using namespace chip; using namespace chip::Ble; diff --git a/src/controller/AutoCommissioner.cpp b/src/controller/AutoCommissioner.cpp index 8232292479ff3f..0e83d7125cf175 100644 --- a/src/controller/AutoCommissioner.cpp +++ b/src/controller/AutoCommissioner.cpp @@ -590,11 +590,16 @@ CHIP_ERROR AutoCommissioner::StartCommissioning(DeviceCommissioner * commissione mStopCommissioning = false; mCommissioner = commissioner; mCommissioneeDeviceProxy = proxy; - mNeedsNetworkSetup = - mCommissioneeDeviceProxy->GetSecureSession().Value()->AsSecureSession()->GetPeerAddress().GetTransportType() == - Transport::Type::kBle; + + auto transportType = + mCommissioneeDeviceProxy->GetSecureSession().Value()->AsSecureSession()->GetPeerAddress().GetTransportType(); + mNeedsNetworkSetup = (transportType == Transport::Type::kBle); +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + mNeedsNetworkSetup = mNeedsNetworkSetup || (transportType == Transport::Type::kWiFiPAF); +#endif CHIP_ERROR err = CHIP_NO_ERROR; CommissioningStage nextStage = GetNextCommissioningStage(CommissioningStage::kSecurePairing, err); + mCommissioner->PerformCommissioningStep(mCommissioneeDeviceProxy, nextStage, mParams, this, GetEndpoint(nextStage), GetCommandTimeout(mCommissioneeDeviceProxy, nextStage)); return CHIP_NO_ERROR; diff --git a/src/controller/BUILD.gn b/src/controller/BUILD.gn index b06b2defecb8f2..b4e81158d497e8 100644 --- a/src/controller/BUILD.gn +++ b/src/controller/BUILD.gn @@ -74,6 +74,7 @@ static_library("controller") { "CommandSenderAllocator.h", "CommissioneeDeviceProxy.h", "CommissioningDelegate.h", + "CommissioningWindowParams.h", "DeviceDiscoveryDelegate.h", "DevicePairingDelegate.h", "InvokeInteraction.h", diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 444b48bcf12b49..955e36bfb0d8a2 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -66,6 +66,9 @@ #include #include #endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +#include +#endif #include #include @@ -466,6 +469,13 @@ DeviceCommissioner::DeviceCommissioner() : mDeviceNOCChainCallback(OnDeviceNOCChainGeneration, this), mSetUpCodePairer(this) {} +DeviceCommissioner::~DeviceCommissioner() +{ +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + DeviceLayer::ConnectivityMgr().WiFiPAFCancelConnect(); +#endif +} + CHIP_ERROR DeviceCommissioner::Init(CommissionerInitParams params) { VerifyOrReturnError(params.operationalCredentialsDelegate != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -730,6 +740,12 @@ CHIP_ERROR DeviceCommissioner::EstablishPASEConnection(NodeId remoteDeviceId, Re peerAddress = Transport::PeerAddress::UDP(params.GetPeerAddress().GetIPAddress(), params.GetPeerAddress().GetPort(), params.GetPeerAddress().GetInterface()); } +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + else if (params.GetPeerAddress().GetTransportType() == Transport::Type::kWiFiPAF) + { + peerAddress = Transport::PeerAddress::WiFiPAF(remoteDeviceId); + } +#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF current = FindCommissioneeDevice(peerAddress); if (current != nullptr) @@ -804,6 +820,24 @@ CHIP_ERROR DeviceCommissioner::EstablishPASEConnection(NodeId remoteDeviceId, Re ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); } } +#endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + if (params.GetPeerAddress().GetTransportType() == Transport::Type::kWiFiPAF) + { + if (DeviceLayer::ConnectivityMgr().GetWiFiPAF()->GetWiFiPAFState() != Transport::WiFiPAFBase::State::kConnected) + { + ChipLogProgress(Controller, "WiFi-PAF: Subscribing the NAN-USD devices"); + if (!DeviceLayer::ConnectivityMgrImpl().IsWiFiManagementStarted()) + { + ChipLogError(Controller, "Wi-Fi Management should have be started now."); + ExitNow(CHIP_ERROR_INTERNAL); + } + mRendezvousParametersForDeviceDiscoveredOverWiFiPAF = params; + DeviceLayer::ConnectivityMgr().WiFiPAFConnect(params.GetSetupDiscriminator().value(), (void *) this, + OnWiFiPAFSubscribeComplete, OnWiFiPAFSubscribeError); + ExitNow(CHIP_NO_ERROR); + } + } #endif session = mSystemState->SessionMgr()->CreateUnauthenticatedSession(params.GetPeerAddress(), params.GetMRPConfig()); VerifyOrExit(session.HasValue(), err = CHIP_ERROR_NO_MEMORY); @@ -872,6 +906,43 @@ void DeviceCommissioner::OnDiscoveredDeviceOverBleError(void * appState, CHIP_ER } #endif // CONFIG_NETWORK_LAYER_BLE +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +void DeviceCommissioner::OnWiFiPAFSubscribeComplete(void * appState) +{ + auto self = (DeviceCommissioner *) appState; + auto device = self->mDeviceInPASEEstablishment; + + if (nullptr != device && device->GetDeviceTransportType() == Transport::Type::kWiFiPAF) + { + ChipLogProgress(Controller, "WiFi-PAF: Subscription Completed, dev_id = %lu", device->GetDeviceId()); + auto remoteId = device->GetDeviceId(); + auto params = self->mRendezvousParametersForDeviceDiscoveredOverWiFiPAF; + + self->mRendezvousParametersForDeviceDiscoveredOverWiFiPAF = RendezvousParameters(); + self->ReleaseCommissioneeDevice(device); + LogErrorOnFailure(self->EstablishPASEConnection(remoteId, params)); + } +} + +void DeviceCommissioner::OnWiFiPAFSubscribeError(void * appState, CHIP_ERROR err) +{ + auto self = (DeviceCommissioner *) appState; + auto device = self->mDeviceInPASEEstablishment; + + if (nullptr != device && device->GetDeviceTransportType() == Transport::Type::kWiFiPAF) + { + ChipLogError(Controller, "WiFi-PAF: Subscription Error, id = %lu, err = %" CHIP_ERROR_FORMAT, device->GetDeviceId(), + err.Format()); + self->ReleaseCommissioneeDevice(device); + self->mRendezvousParametersForDeviceDiscoveredOverWiFiPAF = RendezvousParameters(); + if (self->mPairingDelegate != nullptr) + { + self->mPairingDelegate->OnPairingComplete(err); + } + } +} +#endif + CHIP_ERROR DeviceCommissioner::Commission(NodeId remoteDeviceId, CommissioningParameters & params) { if (mDefaultCommissioner == nullptr) @@ -1844,13 +1915,25 @@ void DeviceCommissioner::CleanupCommissioning(DeviceProxy * proxy, NodeId nodeId if (completionStatus.err == CHIP_NO_ERROR) { + // CommissioningStageComplete uses mDeviceBeingCommissioned, which can + // be commissionee if we are cleaning up before we've gone operational. Normally + // that would not happen in this non-error case, _except_ if we were told to skip sending + // CommissioningComplete: in that case we do not have an operational DeviceProxy, so + // we're using our CommissioneeDeviceProxy to do a successful cleanup. + // + // This means we have to call CommissioningStageComplete() before we destroy commissionee. + // + // This should be safe, because CommissioningStageComplete() does not call CleanupCommissioning + // when called in the cleanup stage (which is where we are), and StopPairing does not directly release + // mDeviceBeingCommissioned. + CommissioningStageComplete(CHIP_NO_ERROR); + CommissioneeDeviceProxy * commissionee = FindCommissioneeDevice(nodeId); if (commissionee != nullptr) { ReleaseCommissioneeDevice(commissionee); } // Send the callbacks, we're done. - CommissioningStageComplete(CHIP_NO_ERROR); SendCommissioningCompleteCallbacks(nodeId, mCommissioningCompletionStatus); } else if (completionStatus.err == CHIP_ERROR_CANCELLED) @@ -1929,12 +2012,13 @@ void DeviceCommissioner::CleanupDoneAfterError() VerifyOrReturn(mDeviceBeingCommissioned != nullptr); NodeId nodeId = mDeviceBeingCommissioned->GetDeviceId(); - // At this point, we also want to close off the pase session so we need to re-establish - CommissioneeDeviceProxy * commissionee = FindCommissioneeDevice(nodeId); // Signal completion - this will reset mDeviceBeingCommissioned. CommissioningStageComplete(CHIP_NO_ERROR); + // At this point, we also want to close off the pase session so we need to re-establish + CommissioneeDeviceProxy * commissionee = FindCommissioneeDevice(nodeId); + // If we've disarmed the failsafe, it's because we're starting again, so kill the pase connection. if (commissionee != nullptr) { diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index 1ab85ca0dc182b..4b876156199735 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -243,9 +243,10 @@ class DLL_EXPORT DeviceController : public AbstractDnssdDiscoveryController * An error return from this function means that neither callback has been * called yet, and neither callback will be called in the future. */ - CHIP_ERROR GetConnectedDevice(NodeId peerNodeId, Callback::Callback * onConnection, - chip::Callback::Callback * onFailure, - TransportPayloadCapability transportPayloadCapability = TransportPayloadCapability::kMRPPayload) + virtual CHIP_ERROR + GetConnectedDevice(NodeId peerNodeId, Callback::Callback * onConnection, + Callback::Callback * onFailure, + TransportPayloadCapability transportPayloadCapability = TransportPayloadCapability::kMRPPayload) { VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); mSystemState->CASESessionMgr()->FindOrEstablishSession(ScopedNodeId(peerNodeId, GetFabricIndex()), onConnection, onFailure, @@ -467,7 +468,7 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, { public: DeviceCommissioner(); - ~DeviceCommissioner() override {} + ~DeviceCommissioner() override; #if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY // make this commissioner discoverable /** @@ -846,6 +847,11 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, static void OnDiscoveredDeviceOverBleError(void * appState, CHIP_ERROR err); RendezvousParameters mRendezvousParametersForDeviceDiscoveredOverBle; #endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + static void OnWiFiPAFSubscribeComplete(void * appState); + static void OnWiFiPAFSubscribeError(void * appState, CHIP_ERROR err); + RendezvousParameters mRendezvousParametersForDeviceDiscoveredOverWiFiPAF; +#endif static void OnBasicFailure(void * context, CHIP_ERROR err); static void OnBasicSuccess(void * context, const chip::app::DataModel::NullObjectType &); diff --git a/src/controller/CHIPDeviceControllerFactory.cpp b/src/controller/CHIPDeviceControllerFactory.cpp index 24f60ed9d8a50a..dbc55dd7b7327e 100644 --- a/src/controller/CHIPDeviceControllerFactory.cpp +++ b/src/controller/CHIPDeviceControllerFactory.cpp @@ -141,6 +141,9 @@ CHIP_ERROR DeviceControllerFactory::InitSystemState(FactoryInitParams params) #else stateParams.bleLayer = params.bleLayer; #endif // CONFIG_DEVICE_LAYER +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + stateParams.wifipaf_layer = params.wifipaf_layer; +#endif VerifyOrReturnError(stateParams.bleLayer != nullptr, CHIP_ERROR_INVALID_ARGUMENT); #endif @@ -167,6 +170,10 @@ CHIP_ERROR DeviceControllerFactory::InitSystemState(FactoryInitParams params) Transport::TcpListenParameters(stateParams.tcpEndPointManager) .SetAddressType(IPAddressType::kIPv6) .SetListenPort(params.listenPort) +#endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + , + Transport::WiFiPAFListenParameters() #endif )); diff --git a/src/controller/CHIPDeviceControllerFactory.h b/src/controller/CHIPDeviceControllerFactory.h index 474357ec4a4bde..16e2ad487126b9 100644 --- a/src/controller/CHIPDeviceControllerFactory.h +++ b/src/controller/CHIPDeviceControllerFactory.h @@ -145,6 +145,9 @@ struct FactoryInitParams #if CONFIG_NETWORK_LAYER_BLE Ble::BleLayer * bleLayer = nullptr; #endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + Transport::WiFiPAFLayer * wifipaf_layer = nullptr; +#endif // // Controls enabling server cluster interactions on a controller. This in turn diff --git a/src/controller/CHIPDeviceControllerSystemState.h b/src/controller/CHIPDeviceControllerSystemState.h index 1ea0593d594993..e040ad14616431 100644 --- a/src/controller/CHIPDeviceControllerSystemState.h +++ b/src/controller/CHIPDeviceControllerSystemState.h @@ -52,10 +52,16 @@ #include #include #endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +#include +#endif namespace chip { inline constexpr size_t kMaxDeviceTransportBlePendingPackets = 1; +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +inline constexpr size_t kMaxDeviceTransportWiFiPAFPendingPackets = 1; +#endif #if INET_CONFIG_ENABLE_TCP_ENDPOINT inline constexpr size_t kMaxDeviceTransportTcpActiveConnectionCount = CHIP_CONFIG_MAX_ACTIVE_TCP_CONNECTIONS; @@ -76,6 +82,10 @@ using DeviceTransportMgr = #if INET_CONFIG_ENABLE_TCP_ENDPOINT , Transport::TCP +#endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + , + Transport::WiFiPAF /* WiFiPAF */ #endif >; @@ -93,6 +103,9 @@ struct DeviceControllerSystemStateParams FabricTable * fabricTable = nullptr; #if CONFIG_NETWORK_LAYER_BLE Ble::BleLayer * bleLayer = nullptr; +#endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + Transport::WiFiPAFLayer * wifipaf_layer = nullptr; #endif Credentials::GroupDataProvider * groupDataProvider = nullptr; Crypto::SessionKeystore * sessionKeystore = nullptr; @@ -208,7 +221,7 @@ class DeviceControllerSystemState mGroupDataProvider != nullptr && mReportScheduler != nullptr && mTimerDelegate != nullptr && mSessionKeystore != nullptr && mSessionResumptionStorage != nullptr && mBDXTransferServer != nullptr; }; - bool IsShutDown() { return mHaveShutDown; } + bool IsShutDown() const { return mHaveShutDown; } System::Layer * SystemLayer() const { return mSystemLayer; }; Inet::EndPointManager * TCPEndPointManager() const { return mTCPEndPointManager; }; diff --git a/src/controller/CommissioningWindowOpener.cpp b/src/controller/CommissioningWindowOpener.cpp index 47666972137bcc..e8d1b29cb6437d 100644 --- a/src/controller/CommissioningWindowOpener.cpp +++ b/src/controller/CommissioningWindowOpener.cpp @@ -43,11 +43,12 @@ CHIP_ERROR CommissioningWindowOpener::OpenBasicCommissioningWindow(NodeId device // Basic commissioning does not use the setup payload. - mCommissioningWindowOption = CommissioningWindowOption::kOriginalSetupCode; - mBasicCommissioningWindowCallback = callback; - mCommissioningWindowCallback = nullptr; - mNodeId = deviceId; - mCommissioningWindowTimeout = timeout; + mCommissioningWindowOption = CommissioningWindowOption::kOriginalSetupCode; + mBasicCommissioningWindowCallback = callback; + mCommissioningWindowCallback = nullptr; + mCommissioningWindowVerifierCallback = nullptr; + mNodeId = deviceId; + mCommissioningWindowTimeout = timeout; mNextStep = Step::kOpenCommissioningWindow; return mController->GetConnectedDevice(mNodeId, &mDeviceConnected, &mDeviceConnectionFailure); @@ -59,60 +60,75 @@ CHIP_ERROR CommissioningWindowOpener::OpenCommissioningWindow(NodeId deviceId, S Callback::Callback * callback, SetupPayload & payload, bool readVIDPIDAttributes) { - VerifyOrReturnError(mNextStep == Step::kAcceptCommissioningStart, CHIP_ERROR_INCORRECT_STATE); + return OpenCommissioningWindow(CommissioningWindowPasscodeParams() + .SetNodeId(deviceId) + .SetTimeout(timeout) + .SetIteration(iteration) + .SetDiscriminator(discriminator) + .SetSetupPIN(setupPIN) + .SetSalt(salt) + .SetReadVIDPIDAttributes(readVIDPIDAttributes) + .SetCallback(callback), + payload); +} - VerifyOrReturnError(kSpake2p_Min_PBKDF_Iterations <= iteration && iteration <= kSpake2p_Max_PBKDF_Iterations, +CHIP_ERROR CommissioningWindowOpener::OpenCommissioningWindow(const CommissioningWindowPasscodeParams & params, + SetupPayload & payload) +{ + VerifyOrReturnError(mNextStep == Step::kAcceptCommissioningStart, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(params.HasNodeId(), CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(params.HasDiscriminator(), CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(kSpake2p_Min_PBKDF_Iterations <= params.GetIteration() && + params.GetIteration() <= kSpake2p_Max_PBKDF_Iterations, + CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(!params.HasSalt() || + (params.GetSalt().size() >= kSpake2p_Min_PBKDF_Salt_Length && + params.GetSalt().size() <= kSpake2p_Max_PBKDF_Salt_Length), CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError( - !salt.HasValue() || - (salt.Value().size() >= kSpake2p_Min_PBKDF_Salt_Length && salt.Value().size() <= kSpake2p_Max_PBKDF_Salt_Length), - CHIP_ERROR_INVALID_ARGUMENT); mSetupPayload = SetupPayload(); - if (setupPIN.HasValue()) + if (params.HasSetupPIN()) { - if (!SetupPayload::IsValidSetupPIN(setupPIN.Value())) - { - return CHIP_ERROR_INVALID_ARGUMENT; - } - + VerifyOrReturnError(SetupPayload::IsValidSetupPIN(params.GetSetupPIN()), CHIP_ERROR_INVALID_ARGUMENT); mCommissioningWindowOption = CommissioningWindowOption::kTokenWithProvidedPIN; - mSetupPayload.setUpPINCode = setupPIN.Value(); + mSetupPayload.setUpPINCode = params.GetSetupPIN(); } else { mCommissioningWindowOption = CommissioningWindowOption::kTokenWithRandomPIN; } - if (salt.HasValue()) + mSetupPayload.version = 0; + mDiscriminator.SetLongValue(params.GetDiscriminator()); + mSetupPayload.discriminator = mDiscriminator; + mSetupPayload.rendezvousInformation.SetValue(RendezvousInformationFlag::kOnNetwork); + + if (params.HasSalt()) { - memcpy(mPBKDFSaltBuffer, salt.Value().data(), salt.Value().size()); - mPBKDFSalt = ByteSpan(mPBKDFSaltBuffer, salt.Value().size()); + memcpy(mPBKDFSaltBuffer, params.GetSalt().data(), params.GetSalt().size()); + mPBKDFSalt = ByteSpan(mPBKDFSaltBuffer, params.GetSalt().size()); } else { ReturnErrorOnFailure(DRBG_get_bytes(mPBKDFSaltBuffer, sizeof(mPBKDFSaltBuffer))); mPBKDFSalt = ByteSpan(mPBKDFSaltBuffer); } + mPBKDFIterations = params.GetIteration(); - mSetupPayload.version = 0; - mSetupPayload.discriminator.SetLongValue(discriminator); - mSetupPayload.rendezvousInformation.SetValue(RendezvousInformationFlag::kOnNetwork); - - mCommissioningWindowCallback = callback; - mBasicCommissioningWindowCallback = nullptr; - mNodeId = deviceId; - mCommissioningWindowTimeout = timeout; - mPBKDFIterations = iteration; - - bool randomSetupPIN = !setupPIN.HasValue(); + bool randomSetupPIN = !params.HasSetupPIN(); ReturnErrorOnFailure( PASESession::GeneratePASEVerifier(mVerifier, mPBKDFIterations, mPBKDFSalt, randomSetupPIN, mSetupPayload.setUpPINCode)); - payload = mSetupPayload; + payload = mSetupPayload; + mCommissioningWindowCallback = params.GetCallback(); + mBasicCommissioningWindowCallback = nullptr; + mCommissioningWindowVerifierCallback = nullptr; + mNodeId = params.GetNodeId(); + mCommissioningWindowTimeout = params.GetTimeout(); + mTargetEndpointId = params.GetEndpointId(); - if (readVIDPIDAttributes) + if (params.GetReadVIDPIDAttributes()) { mNextStep = Step::kReadVID; } @@ -124,14 +140,42 @@ CHIP_ERROR CommissioningWindowOpener::OpenCommissioningWindow(NodeId deviceId, S return mController->GetConnectedDevice(mNodeId, &mDeviceConnected, &mDeviceConnectionFailure); } +CHIP_ERROR CommissioningWindowOpener::OpenCommissioningWindow(const CommissioningWindowVerifierParams & params) +{ + VerifyOrReturnError(mNextStep == Step::kAcceptCommissioningStart, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(params.HasNodeId(), CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(params.HasDiscriminator(), CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(kSpake2p_Min_PBKDF_Iterations <= params.GetIteration() && + params.GetIteration() <= kSpake2p_Max_PBKDF_Iterations, + CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(params.GetSalt().size() >= kSpake2p_Min_PBKDF_Salt_Length && + params.GetSalt().size() <= kSpake2p_Max_PBKDF_Salt_Length, + CHIP_ERROR_INVALID_ARGUMENT); + memcpy(mPBKDFSaltBuffer, params.GetSalt().data(), params.GetSalt().size()); + mPBKDFSalt = ByteSpan(mPBKDFSaltBuffer, params.GetSalt().size()); + + ReturnErrorOnFailure(mVerifier.Deserialize(params.GetVerifier())); + mCommissioningWindowVerifierCallback = params.GetCallback(); + mBasicCommissioningWindowCallback = nullptr; + mCommissioningWindowCallback = nullptr; + mNodeId = params.GetNodeId(); + mCommissioningWindowTimeout = params.GetTimeout(); + mPBKDFIterations = params.GetIteration(); + mCommissioningWindowOption = CommissioningWindowOption::kTokenWithProvidedPIN; + mDiscriminator.SetLongValue(params.GetDiscriminator()); + mTargetEndpointId = params.GetEndpointId(); + + mNextStep = Step::kOpenCommissioningWindow; + + return mController->GetConnectedDevice(mNodeId, &mDeviceConnected, &mDeviceConnectionFailure); +} + CHIP_ERROR CommissioningWindowOpener::OpenCommissioningWindowInternal(Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle) { ChipLogProgress(Controller, "OpenCommissioningWindow for device ID 0x" ChipLogFormatX64, ChipLogValueX64(mNodeId)); - constexpr EndpointId kAdministratorCommissioningClusterEndpoint = 0; - - ClusterBase cluster(exchangeMgr, sessionHandle, kAdministratorCommissioningClusterEndpoint); + ClusterBase cluster(exchangeMgr, sessionHandle, mTargetEndpointId); if (mCommissioningWindowOption != CommissioningWindowOption::kOriginalSetupCode) { @@ -142,7 +186,7 @@ CHIP_ERROR CommissioningWindowOpener::OpenCommissioningWindowInternal(Messaging: AdministratorCommissioning::Commands::OpenCommissioningWindow::Type request; request.commissioningTimeout = mCommissioningWindowTimeout.count(); request.PAKEPasscodeVerifier = serializedVerifierSpan; - request.discriminator = mSetupPayload.discriminator.GetLongValue(); + request.discriminator = mDiscriminator.GetLongValue(); request.iterations = mPBKDFIterations; request.salt = mPBKDFSalt; @@ -230,15 +274,19 @@ void CommissioningWindowOpener::OnOpenCommissioningWindowSuccess(void * context, self->mCommissioningWindowCallback->mCall(self->mCommissioningWindowCallback->mContext, self->mNodeId, CHIP_NO_ERROR, self->mSetupPayload); - // Don't touch `self` anymore; it might have been destroyed by the - // callee. + // Don't touch `self` anymore; it might have been destroyed by the callee. + } + else if (self->mCommissioningWindowVerifierCallback != nullptr) + { + self->mCommissioningWindowVerifierCallback->mCall(self->mCommissioningWindowVerifierCallback->mContext, self->mNodeId, + CHIP_NO_ERROR); + // Don't touch `self` anymore; it might have been destroyed by the callee. } else if (self->mBasicCommissioningWindowCallback != nullptr) { self->mBasicCommissioningWindowCallback->mCall(self->mBasicCommissioningWindowCallback->mContext, self->mNodeId, CHIP_NO_ERROR); - // Don't touch `self` anymore; it might have been destroyed by the - // callee. + // Don't touch `self` anymore; it might have been destroyed by the callee. } } @@ -252,6 +300,11 @@ void CommissioningWindowOpener::OnOpenCommissioningWindowFailure(void * context, self->mCommissioningWindowCallback->mCall(self->mCommissioningWindowCallback->mContext, self->mNodeId, error, SetupPayload()); } + else if (self->mCommissioningWindowVerifierCallback != nullptr) + { + self->mCommissioningWindowVerifierCallback->mCall(self->mCommissioningWindowVerifierCallback->mContext, self->mNodeId, + error); + } else if (self->mBasicCommissioningWindowCallback != nullptr) { self->mBasicCommissioningWindowCallback->mCall(self->mBasicCommissioningWindowCallback->mContext, self->mNodeId, error); diff --git a/src/controller/CommissioningWindowOpener.h b/src/controller/CommissioningWindowOpener.h index 10547dce3a662d..28a25d77f7a014 100644 --- a/src/controller/CommissioningWindowOpener.h +++ b/src/controller/CommissioningWindowOpener.h @@ -20,22 +20,17 @@ #include #include #include +#include #include #include #include #include #include #include -#include namespace chip { namespace Controller { -// Passing SetupPayload by value on purpose, in case a consumer decides to reuse -// this object from inside the callback. -typedef void (*OnOpenCommissioningWindow)(void * context, NodeId deviceId, CHIP_ERROR status, SetupPayload payload); -typedef void (*OnOpenBasicCommissioningWindow)(void * context, NodeId deviceId, CHIP_ERROR status); - /** * A helper class to open a commissioning window given some parameters. */ @@ -107,6 +102,38 @@ class CommissioningWindowOpener Callback::Callback * callback, SetupPayload & payload, bool readVIDPIDAttributes = false); + /** + * @brief + * Try to look up the device attached to our controller with the given + * node id and ask it to re-enter commissioning mode with a PASE verifier + * derived from the given information and the given discriminator. The + * device will exit commissioning mode after a successful commissioning, + * or after the given `timeout` time. + * + * @param[in] params The parameters required to open an enhanced commissioning window + * with the provided or generated passcode. + * @param[out] payload The setup payload, not including the VID/PID bits, + * even if those were asked for, that is generated + * based on the passed-in information. The payload + * provided to the callback function, unlike this + * out parameter, will include the VID/PID bits if + * readVIDPIDAttributes is true. + */ + CHIP_ERROR OpenCommissioningWindow(const CommissioningWindowPasscodeParams & params, SetupPayload & payload); + + /** + * @brief + * Try to look up the device attached to our controller with the given + * node id and ask it to re-enter commissioning mode with a PASE verifier + * derived from the given information and the given discriminator. The + * device will exit commissioning mode after a successful commissioning, + * or after the given `timeout` time. + * + * @param[in] params The parameters required to open an enhanced commissioning window + * with the provided PAKE passcode verifier. + */ + CHIP_ERROR OpenCommissioningWindow(const CommissioningWindowVerifierParams & params); + private: enum class Step : uint8_t { @@ -133,10 +160,13 @@ class CommissioningWindowOpener DeviceController * const mController = nullptr; Step mNextStep = Step::kAcceptCommissioningStart; - Callback::Callback * mCommissioningWindowCallback = nullptr; - Callback::Callback * mBasicCommissioningWindowCallback = nullptr; + Callback::Callback * mCommissioningWindowCallback = nullptr; + Callback::Callback * mCommissioningWindowVerifierCallback = nullptr; + Callback::Callback * mBasicCommissioningWindowCallback = nullptr; SetupPayload mSetupPayload; - NodeId mNodeId = kUndefinedNodeId; + SetupDiscriminator mDiscriminator{}; + NodeId mNodeId = kUndefinedNodeId; + EndpointId mTargetEndpointId = kRootEndpointId; // Default endpoint for Administrator Commissioning Cluster System::Clock::Seconds16 mCommissioningWindowTimeout = System::Clock::kZero; CommissioningWindowOption mCommissioningWindowOption = CommissioningWindowOption::kOriginalSetupCode; Crypto::Spake2pVerifier mVerifier; // Used for non-basic commissioning. diff --git a/src/controller/CommissioningWindowParams.h b/src/controller/CommissioningWindowParams.h new file mode 100644 index 00000000000000..c845ecf2c80135 --- /dev/null +++ b/src/controller/CommissioningWindowParams.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 +#include +#include +#include + +namespace chip { +namespace Controller { + +// Passing SetupPayload by value on purpose, in case a consumer decides to reuse +// this object from inside the callback. +typedef void (*OnOpenCommissioningWindow)(void * context, NodeId deviceId, CHIP_ERROR status, SetupPayload payload); +typedef void (*OnOpenCommissioningWindowWithVerifier)(void * context, NodeId deviceId, CHIP_ERROR status); +typedef void (*OnOpenBasicCommissioningWindow)(void * context, NodeId deviceId, CHIP_ERROR status); + +template +class CommissioningWindowCommonParams +{ +public: + CommissioningWindowCommonParams() = default; + + bool HasNodeId() const { return mNodeId != kUndefinedNodeId; } + NodeId GetNodeId() const + { + VerifyOrDie(HasNodeId()); + return mNodeId; + } + // The node identifier of device + Derived & SetNodeId(NodeId nodeId) + { + mNodeId = nodeId; + return static_cast(*this); + } + + EndpointId GetEndpointId() const { return mEndpointId; } + Derived & SetEndpointId(EndpointId endpointId) + { + mEndpointId = endpointId; + return static_cast(*this); + } + + System::Clock::Seconds16 GetTimeout() const { return mTimeout; } + // The duration for which the commissioning window should remain open. + Derived & SetTimeout(System::Clock::Seconds16 timeout) + { + mTimeout = timeout; + return static_cast(*this); + } + Derived & SetTimeout(uint16_t timeoutSeconds) { return SetTimeout(System::Clock::Seconds16(timeoutSeconds)); } + + // The PAKE iteration count associated with the PAKE Passcode ID and + // ephemeral PAKE passcode verifier to be used for this commissioning. + uint32_t GetIteration() const { return mIteration; } + Derived & SetIteration(uint32_t iteration) + { + mIteration = iteration; + return static_cast(*this); + } + + // The long discriminator for the DNS-SD advertisement. + uint16_t GetDiscriminator() const { return mDiscriminator.Value(); } + bool HasDiscriminator() const { return mDiscriminator.HasValue(); } + Derived & SetDiscriminator(uint16_t discriminator) + { + mDiscriminator = MakeOptional(discriminator); + return static_cast(*this); + } + +private: + NodeId mNodeId = kUndefinedNodeId; + EndpointId mEndpointId = kRootEndpointId; // Default endpoint for Administrator Commissioning Cluster + System::Clock::Seconds16 mTimeout = System::Clock::Seconds16(300); // Defaulting + uint32_t mIteration = 1000; // Defaulting + Optional mDiscriminator = NullOptional; // Using optional type to avoid picking a sentinnel in valid range +}; + +class CommissioningWindowPasscodeParams : public CommissioningWindowCommonParams +{ +public: + CommissioningWindowPasscodeParams() = default; + + bool HasSetupPIN() const { return mSetupPIN.HasValue(); } + // Get the value of setup PIN (Passcode) if present, crashes otherwise. + uint32_t GetSetupPIN() const { return mSetupPIN.Value(); } + // The setup PIN (Passcode) to use. A random one will be generated if not provided. + CommissioningWindowPasscodeParams & SetSetupPIN(uint32_t setupPIN) { return SetSetupPIN(MakeOptional(setupPIN)); } + // The setup PIN (Passcode) to use. A random one will be generated if NullOptional is used. + CommissioningWindowPasscodeParams & SetSetupPIN(Optional setupPIN) + { + mSetupPIN = setupPIN; + return *this; + } + + bool HasSalt() const { return mSalt.HasValue(); } + // Get the value of salt if present. + // Dies if absent! Make sure to check HasSalt() + ByteSpan GetSalt() const { return mSalt.Value(); } + // The salt to use. A random one will be generated if not provided. + // If provided, must be at least kSpake2p_Min_PBKDF_Salt_Length bytes + // and at most kSpake2p_Max_PBKDF_Salt_Length bytes in length. + CommissioningWindowPasscodeParams & SetSalt(ByteSpan salt) { return SetSalt(MakeOptional(salt)); } + // The salt to use. A random one will be generated if NullOptional is used. + // If provided, must be at least kSpake2p_Min_PBKDF_Salt_Length bytes + // and at most kSpake2p_Max_PBKDF_Salt_Length bytes in length. + // Note that this an overloaded optional arg function to support existing APIs. + CommissioningWindowPasscodeParams & SetSalt(Optional salt) + { + mSalt = salt; + return *this; + } + + bool GetReadVIDPIDAttributes() const { return mReadVIDPIDAttributes; } + // Should the API internally read VID and PID from the device while opening the + // commissioning window. If this argument is `true`, the API will read VID and PID + // from the device and include them in the setup payload passed to the callback. + CommissioningWindowPasscodeParams & SetReadVIDPIDAttributes(bool readVIDPIDAttributes) + { + mReadVIDPIDAttributes = readVIDPIDAttributes; + return *this; + } + + Callback::Callback * GetCallback() const { return mCallback; } + // The function to be called on success or failure of opening the commissioning window. + // This will include the SetupPayload generated from provided parameters. + CommissioningWindowPasscodeParams & SetCallback(Callback::Callback * callback) + { + mCallback = callback; + return *this; + } + +private: + Optional mSetupPIN = NullOptional; + Optional mSalt = NullOptional; + bool mReadVIDPIDAttributes = false; + Callback::Callback * mCallback = nullptr; +}; + +class CommissioningWindowVerifierParams : public CommissioningWindowCommonParams +{ +public: + CommissioningWindowVerifierParams() = default; + + ByteSpan GetVerifier() const { return mVerifier.Value(); } + // The PAKE passcode verifier generated with enclosed iterations, salt and not-enclosed passcode. + CommissioningWindowVerifierParams & SetVerifier(ByteSpan verifier) + { + mVerifier = MakeOptional(verifier); + return *this; + } + + ByteSpan GetSalt() const { return mSalt.Value(); } + // The salt that was used to generate the verifier. + // It must be at least kSpake2p_Min_PBKDF_Salt_Length bytes. + // Note: This is REQUIRED when verifier is used + CommissioningWindowVerifierParams & SetSalt(ByteSpan salt) + { + mSalt = MakeOptional(salt); + return *this; + } + + Callback::Callback * GetCallback() const { return mCallback; } + // The function to be called on success or failure of opening the + // commissioning window. This will NOT include the SetupPayload. + CommissioningWindowVerifierParams & SetCallback(Callback::Callback * callback) + { + mCallback = callback; + return *this; + } + +private: + Optional mSalt; + Optional mVerifier; + Callback::Callback * mCallback = nullptr; +}; + +} // namespace Controller +} // namespace chip diff --git a/src/controller/SetUpCodePairer.cpp b/src/controller/SetUpCodePairer.cpp index 17f2e5945eb1bf..99e991dfe8c114 100644 --- a/src/controller/SetUpCodePairer.cpp +++ b/src/controller/SetUpCodePairer.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -59,6 +60,13 @@ CHIP_ERROR GetPayload(const char * setUpCode, SetupPayload & payload) } } // namespace +SetUpCodePairer::~SetUpCodePairer() +{ +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + DeviceLayer::ConnectivityMgr().WiFiPAFCancelConnect(); +#endif +} + CHIP_ERROR SetUpCodePairer::PairDevice(NodeId remoteId, const char * setUpCode, SetupCodePairerBehaviour commission, DiscoveryType discoveryType, Optional resolutionData) { @@ -129,6 +137,15 @@ CHIP_ERROR SetUpCodePairer::Connect(SetupPayload & payload) } VerifyOrReturnError(searchOverAll || CHIP_NO_ERROR == err || CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE == err, err); } + if (searchOverAll || payload.rendezvousInformation.Value().Has(RendezvousInformationFlag::kWiFiPAF)) + { + ChipLogProgress(Controller, "WiFi-PAF: has RendezvousInformationFlag::kWiFiPAF"); + if (CHIP_NO_ERROR == (err = StartDiscoverOverWiFiPAF(payload))) + { + isRunning = true; + } + VerifyOrReturnError(searchOverAll || CHIP_NO_ERROR == err || CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE == err, err); + } } // We always want to search on network because any node that has already been commissioned will use on-network regardless of the @@ -243,6 +260,31 @@ CHIP_ERROR SetUpCodePairer::StopConnectOverSoftAP() return CHIP_NO_ERROR; } +CHIP_ERROR SetUpCodePairer::StartDiscoverOverWiFiPAF(SetupPayload & payload) +{ +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + ChipLogProgress(Controller, "Starting commissioning discovery over WiFiPAF"); + VerifyOrReturnError(mCommissioner != nullptr, CHIP_ERROR_INCORRECT_STATE); + mWaitingForDiscovery[kWiFiPAFTransport] = true; + CHIP_ERROR err = DeviceLayer::ConnectivityMgr().WiFiPAFConnect(payload.discriminator, (void *) this, OnWiFiPAFSubscribeComplete, + OnWiFiPAFSubscribeError); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Controller, "Commissioning discovery over WiFiPAF failed, err = %" CHIP_ERROR_FORMAT, err.Format()); + mWaitingForDiscovery[kWiFiPAFTransport] = false; + } + return err; +#else + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +#endif // CONFIG_NETWORK_LAYER_BLE +} + +CHIP_ERROR SetUpCodePairer::StopConnectOverWiFiPAF() +{ + mWaitingForDiscovery[kWiFiPAFTransport] = false; + return CHIP_NO_ERROR; +} + bool SetUpCodePairer::ConnectToDiscoveredDevice() { if (mWaitingForPASE) @@ -335,6 +377,37 @@ void SetUpCodePairer::OnBLEDiscoveryError(CHIP_ERROR err) } #endif // CONFIG_NETWORK_LAYER_BLE +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +void SetUpCodePairer::OnDiscoveredDeviceOverWifiPAF() +{ + ChipLogProgress(Controller, "Discovered device to be commissioned over WiFiPAF, RemoteId: %lu", mRemoteId); + + mWaitingForDiscovery[kWiFiPAFTransport] = false; + auto param = SetUpCodePairerParameters(); + param.SetPeerAddress(Transport::PeerAddress(Transport::Type::kWiFiPAF, mRemoteId)); + mDiscoveredParameters.emplace_back(param); + ConnectToDiscoveredDevice(); +} + +void SetUpCodePairer::OnWifiPAFDiscoveryError(CHIP_ERROR err) +{ + ChipLogError(Controller, "Commissioning discovery over WiFiPAF failed: %" CHIP_ERROR_FORMAT, err.Format()); + mWaitingForDiscovery[kWiFiPAFTransport] = false; +} + +void SetUpCodePairer::OnWiFiPAFSubscribeComplete(void * appState) +{ + auto self = (SetUpCodePairer *) appState; + self->OnDiscoveredDeviceOverWifiPAF(); +} + +void SetUpCodePairer::OnWiFiPAFSubscribeError(void * appState, CHIP_ERROR err) +{ + auto self = (SetUpCodePairer *) appState; + self->OnWifiPAFDiscoveryError(err); +} +#endif + bool SetUpCodePairer::IdIsPresent(uint16_t vendorOrProductID) { return vendorOrProductID != kNotAvailable; @@ -473,6 +546,7 @@ void SetUpCodePairer::ResetDiscoveryState() StopConnectOverBle(); StopConnectOverIP(); StopConnectOverSoftAP(); + StopConnectOverWiFiPAF(); // Just in case any of those failed to reset the waiting state properly. for (auto & waiting : mWaitingForDiscovery) diff --git a/src/controller/SetUpCodePairer.h b/src/controller/SetUpCodePairer.h index e177af7322d391..3414341a2cdd51 100644 --- a/src/controller/SetUpCodePairer.h +++ b/src/controller/SetUpCodePairer.h @@ -77,7 +77,7 @@ class DLL_EXPORT SetUpCodePairer : public DevicePairingDelegate { public: SetUpCodePairer(DeviceCommissioner * commissioner) : mCommissioner(commissioner) {} - virtual ~SetUpCodePairer() {} + ~SetUpCodePairer(); CHIP_ERROR PairDevice(chip::NodeId remoteId, const char * setUpCode, SetupCodePairerBehaviour connectionType = SetupCodePairerBehaviour::kCommission, @@ -111,6 +111,8 @@ class DLL_EXPORT SetUpCodePairer : public DevicePairingDelegate CHIP_ERROR StopConnectOverIP(); CHIP_ERROR StartDiscoverOverSoftAP(SetupPayload & payload); CHIP_ERROR StopConnectOverSoftAP(); + CHIP_ERROR StartDiscoverOverWiFiPAF(SetupPayload & payload); + CHIP_ERROR StopConnectOverWiFiPAF(); // Returns whether we have kicked off a new connection attempt. bool ConnectToDiscoveredDevice(); @@ -150,6 +152,7 @@ class DLL_EXPORT SetUpCodePairer : public DevicePairingDelegate kBLETransport = 0, kIPTransport, kSoftAPTransport, + kWiFiPAFTransport, kTransportTypeCount, }; @@ -165,6 +168,12 @@ class DLL_EXPORT SetUpCodePairer : public DevicePairingDelegate static void OnDiscoveredDeviceOverBleSuccess(void * appState, BLE_CONNECTION_OBJECT connObj); static void OnDiscoveredDeviceOverBleError(void * appState, CHIP_ERROR err); #endif // CONFIG_NETWORK_LAYER_BLE +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + void OnDiscoveredDeviceOverWifiPAF(); + void OnWifiPAFDiscoveryError(CHIP_ERROR err); + static void OnWiFiPAFSubscribeComplete(void * appState); + static void OnWiFiPAFSubscribeError(void * appState, CHIP_ERROR err); +#endif bool NodeMatchesCurrentFilter(const Dnssd::DiscoveredNodeData & nodeData) const; static bool IdIsPresent(uint16_t vendorOrProductID); diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 42771c75bf41f2..47fdf1ec0a0072 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -1,6 +1,23 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum TestGlobalEnum : enum8 { + kSomeValue = 0; + kSomeOtherValue = 1; + kFinalValue = 2; +} + +bitmap TestGlobalBitmap : bitmap32 { + kFirstBit = 0x1; + kSecondBit = 0x2; +} + +struct TestGlobalStruct { + char_string<128> name = 0; + nullable TestGlobalBitmap myBitmap = 1; + optional nullable TestGlobalEnum myEnum = 2; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; @@ -216,7 +233,7 @@ deprecated cluster OnOffSwitchConfiguration = 7 { /** Attributes and commands for controlling devices that can be set to a level between fully 'On' and fully 'Off.' */ cluster LevelControl = 8 { - revision 5; + revision 6; enum MoveModeEnum : enum8 { kUp = 0; @@ -431,7 +448,7 @@ cluster Binding = 30 { and enforce Access Control for the Node's endpoints and their associated cluster instances. */ cluster AccessControl = 31 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum AccessControlEntryAuthModeEnum : enum8 { kPASE = 1; @@ -447,12 +464,42 @@ cluster AccessControl = 31 { 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; @@ -488,17 +535,41 @@ cluster AccessControl = 31 { fabric_idx fabricIndex = 254; } + fabric_sensitive info event access(read: administer) AccessRestrictionEntryChanged = 2 { + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) FabricRestrictionReviewUpdate = 3 { + int64u token = 0; + nullable long_char_string instruction = 1; + nullable long_char_string redirectURL = 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 { + AccessRestrictionStruct 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): DefaultSuccess = 0; } /** This cluster provides a standardized way for a Node (typically a Bridge, but could be any Node) to expose action information. */ @@ -760,7 +831,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -2225,6 +2296,10 @@ cluster BridgedDeviceBasicInformation = 57 { kFabric = 5; } + bitmap Feature : bitmap32 { + kBridgedICDSupport = 0x100000; + } + struct ProductAppearanceStruct { ProductFinishEnum finish = 0; nullable ColorEnum primaryColor = 1; @@ -2244,6 +2319,10 @@ cluster BridgedDeviceBasicInformation = 57 { boolean reachableNewValue = 0; } + info event ActiveChanged = 128 { + int32u promisedActiveDuration = 0; + } + readonly attribute optional char_string<32> vendorName = 1; readonly attribute optional vendor_id vendorID = 2; readonly attribute optional char_string<32> productName = 3; @@ -2258,7 +2337,7 @@ cluster BridgedDeviceBasicInformation = 57 { readonly attribute optional char_string<64> productLabel = 14; readonly attribute optional char_string<32> serialNumber = 15; readonly attribute boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; @@ -2266,6 +2345,13 @@ cluster BridgedDeviceBasicInformation = 57 { readonly attribute attrib_id attributeList[] = 65531; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; + + request struct KeepActiveRequest { + int32u stayActiveDuration = 0; + } + + /** The server SHALL attempt to keep the devices specified active for StayActiveDuration milliseconds when they are next active. */ + command KeepActive(KeepActiveRequest): DefaultSuccess = 128; } /** This cluster exposes interactions with a switch device, for the purpose of using those interactions by other devices. @@ -2670,7 +2756,7 @@ cluster BooleanState = 69 { /** Allows servers to ensure that listed clients are notified when a server is available for communication. */ cluster IcdManagement = 70 { - revision 2; + revision 3; enum ClientTypeEnum : enum8 { kPermanent = 0; @@ -2686,6 +2772,7 @@ cluster IcdManagement = 70 { kCheckInProtocolSupport = 0x1; kUserActiveModeTrigger = 0x2; kLongIdleTimeSupport = 0x4; + kDynamicSitLitSupport = 0x8; } bitmap UserActiveModeTriggerBitmap : bitmap32 { @@ -2724,6 +2811,7 @@ cluster IcdManagement = 70 { 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; @@ -2933,8 +3021,8 @@ cluster OvenMode = 73 { command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0; } -/** This cluster supports remotely monitoring and controling the different typs of - functionality available to a drying device, such as a laundry dryer. */ +/** This cluster provides a way to access options associated with the operation of + a laundry dryer device type. */ cluster LaundryDryerControls = 74 { revision 1; @@ -3756,14 +3844,21 @@ provisional cluster ScenesManagement = 98 { kSceneNames = 0x1; } - struct AttributeValuePair { + struct AttributeValuePairStruct { attrib_id attributeID = 0; - int32u attributeValue = 1; + 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; - AttributeValuePair attributeValueList[] = 1; + AttributeValuePairStruct attributeValueList[] = 1; } fabric_scoped struct SceneInfoStruct { @@ -3875,7 +3970,7 @@ provisional cluster ScenesManagement = 98 { int8u sceneIdentifierFrom = 2; } - /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */ + /** 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; @@ -4311,6 +4406,64 @@ cluster ElectricalEnergyMeasurement = 145 { readonly attribute int16u clusterRevision = 65533; } +/** This cluster is used to allow clients to control the operation of a hot water heating appliance so that it can be used with energy management. */ +provisional cluster WaterHeaterManagement = 148 { + revision 1; + + enum BoostStateEnum : enum8 { + kInactive = 0; + kActive = 1; + } + + bitmap Feature : bitmap32 { + kEnergyManagement = 0x1; + kTankPercent = 0x2; + } + + bitmap WaterHeaterDemandBitmap : bitmap8 { + kImmersionElement1 = 0x1; + kImmersionElement2 = 0x2; + kHeatPump = 0x4; + kBoiler = 0x8; + kOther = 0x10; + } + + bitmap WaterHeaterTypeBitmap : bitmap8 { + kImmersionElement1 = 0x1; + kImmersionElement2 = 0x2; + kHeatPump = 0x4; + kBoiler = 0x8; + kOther = 0x10; + } + + readonly attribute WaterHeaterTypeBitmap heaterTypes = 0; + readonly attribute WaterHeaterDemandBitmap heatDemand = 1; + readonly attribute optional int16u tankVolume = 2; + readonly attribute optional energy_mwh estimatedHeatRequired = 3; + readonly attribute optional percent tankPercentage = 4; + readonly attribute BoostStateEnum boostState = 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 BoostRequest { + elapsed_s duration = 0; + optional boolean oneShot = 1; + optional boolean emergencyBoost = 2; + optional temperature temporarySetpoint = 3; + optional percent targetPercentage = 4; + optional percent targetReheat = 5; + } + + /** Allows a client to request that the water heater is put into a Boost state. */ + command access(invoke: manage) Boost(BoostRequest): DefaultSuccess = 0; + /** Allows a client to cancel an ongoing Boost operation. */ + command access(invoke: manage) CancelBoost(): DefaultSuccess = 1; +} + /** This cluster provides an interface to the functionality of Smart Energy Demand Response and Load Control. */ provisional cluster DemandResponseLoadControl = 150 { revision 4; @@ -4823,7 +4976,7 @@ provisional cluster DeviceEnergyManagement = 152 { /** Electric Vehicle Supply Equipment (EVSE) is equipment used to charge an Electric Vehicle (EV) or Plug-In Hybrid Electric Vehicle. This cluster provides an interface to the functionality of Electric Vehicle Supply Equipment (EVSE) management. */ cluster EnergyEvse = 153 { - revision 2; + revision 4; enum EnergyTransferStoppedReasonEnum : enum8 { kEVStopped = 0; @@ -4867,6 +5020,7 @@ cluster EnergyEvse = 153 { kDischargingEnabled = 2; kDisabledError = 3; kDisabledDiagnostics = 4; + kEnabled = 5; } bitmap Feature : bitmap32 { @@ -4914,6 +5068,7 @@ cluster EnergyEvse = 153 { int32u sessionID = 0; StateEnum state = 1; amperage_ma maximumCurrent = 2; + optional amperage_ma maximumDischargeCurrent = 3; } info event EnergyTransferStopped = 3 { @@ -4921,6 +5076,7 @@ cluster EnergyEvse = 153 { StateEnum state = 1; EnergyTransferStoppedReasonEnum reason = 2; energy_mwh energyTransferred = 4; + optional energy_mwh energyDischarged = 5; } critical event Fault = 4 { @@ -4985,15 +5141,15 @@ cluster EnergyEvse = 153 { /** Allows a client to disable the EVSE from charging and discharging. */ timed command Disable(): DefaultSuccess = 1; - /** Allows a client to enable the EVSE to charge an EV. */ + /** This command allows a client to enable the EVSE to charge an EV, */ timed command EnableCharging(EnableChargingRequest): DefaultSuccess = 2; - /** Allows a client to enable the EVSE to discharge an EV. */ + /** Upon receipt, this SHALL allow a client to enable the discharge of an EV, */ timed command EnableDischarging(EnableDischargingRequest): DefaultSuccess = 3; /** Allows a client to put the EVSE into a self-diagnostics mode. */ timed command StartDiagnostics(): DefaultSuccess = 4; /** Allows a client to set the user specified charging targets. */ timed command SetTargets(SetTargetsRequest): DefaultSuccess = 5; - /** Allows a client to retrieve the user specified charging targets. */ + /** Allows a client to retrieve the current set of charging targets. */ timed command GetTargets(): GetTargetsResponse = 6; /** Allows a client to clear all stored charging targets. */ timed command ClearTargets(): DefaultSuccess = 7; @@ -5104,6 +5260,56 @@ cluster EnergyEvseMode = 157 { command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0; } +/** Attributes and commands for selecting a mode from a list of supported options. */ +cluster WaterHeaterMode = 158 { + revision 1; + + enum ModeTag : enum16 { + kOff = 16384; + kManual = 16385; + kTimed = 16386; + } + + bitmap Feature : bitmap32 { + kOnOff = 0x1; + } + + struct ModeTagStruct { + optional vendor_id mfgCode = 0; + enum16 value = 1; + } + + struct ModeOptionStruct { + char_string<64> label = 0; + int8u mode = 1; + ModeTagStruct modeTags[] = 2; + } + + readonly attribute ModeOptionStruct supportedModes[] = 0; + readonly attribute int8u currentMode = 1; + attribute optional nullable int8u startUpMode = 2; + attribute optional nullable int8u onMode = 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 ChangeToModeRequest { + int8u newMode = 0; + } + + response struct ChangeToModeResponse = 1 { + enum8 status = 0; + optional char_string statusText = 1; + } + + /** This command is used to change device modes. + On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */ + command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0; +} + /** Attributes and commands for selecting a mode from a list of supported options. */ provisional cluster DeviceEnergyManagementMode = 159 { revision 1; @@ -6002,7 +6208,7 @@ deprecated cluster BarrierControl = 259 { } /** The Service Area cluster provides an interface for controlling the locations where a device should operate, and for querying the current location. */ -cluster ServiceArea = 336 { +provisional cluster ServiceArea = 336 { revision 1; // NOTE: Default/not specifically set enum AreaTypeTag : enum8 { @@ -6227,14 +6433,14 @@ cluster ServiceArea = 336 { kSelectWhileRunning = 0x2; } - struct HomeLocationStruct { + struct LocationDescriptorStruct { char_string<128> locationName = 0; nullable int16s floorNumber = 1; nullable AreaTypeTag areaType = 2; } struct LocationInfoStruct { - nullable HomeLocationStruct locationInfo = 0; + nullable LocationDescriptorStruct locationInfo = 0; nullable LandmarkTag landmarkTag = 1; nullable PositionTag positionTag = 2; nullable FloorSurfaceTag surfaceTag = 3; @@ -6469,7 +6675,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -6536,7 +6743,6 @@ cluster Thermostat = 513 { kMatterScheduleConfiguration = 0x80; kPresets = 0x100; kSetpoints = 0x200; - kQueuedPresetsSupported = 0x400; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -6596,11 +6802,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -6634,11 +6835,6 @@ cluster Thermostat = 513 { PresetTypeFeaturesBitmap presetTypeFeatures = 2; } - struct QueuedPresetStruct { - nullable octet_string<16> presetHandle = 0; - nullable epoch_s transitionTimestamp = 1; - } - struct ScheduleTypeStruct { SystemModeEnum systemMode = 0; int8u numberOfSchedules = 1; @@ -6711,9 +6907,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; - readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -6751,17 +6945,12 @@ cluster Thermostat = 513 { request struct SetActivePresetRequestRequest { octet_string<16> presetHandle = 0; - optional int16u delayMinutes = 1; } request struct StartPresetsSchedulesEditRequestRequest { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -6780,10 +6969,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command is sent to cancel a queued preset. */ - command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for controlling a fan in a heating/cooling system. */ @@ -6904,7 +7089,7 @@ cluster ThermostatUserInterfaceConfiguration = 516 { /** Attributes and commands for controlling the color properties of a color-capable light. */ cluster ColorControl = 768 { - revision 6; + revision 7; enum ColorLoopAction : enum8 { kDeactivate = 0; @@ -7983,10 +8168,11 @@ cluster RadonConcentrationMeasurement = 1071 { } /** Functionality to retrieve operational information about a managed Wi-Fi network. */ -cluster WiFiNetworkManagement = 1105 { +provisional cluster WiFiNetworkManagement = 1105 { revision 1; - readonly attribute nullable octet_string<32> ssid = 1; + readonly attribute nullable octet_string<32> ssid = 0; + readonly attribute access(read: manage) nullable int64u passphraseSurrogate = 1; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -7999,22 +8185,22 @@ cluster WiFiNetworkManagement = 1105 { } /** Request the current WPA-Personal passphrase or PSK associated with the managed Wi-Fi network. */ - command access(invoke: administer) NetworkPassphraseRequest(): NetworkPassphraseResponse = 0; + command access(invoke: manage) NetworkPassphraseRequest(): NetworkPassphraseResponse = 0; } /** Manage the Thread network of Thread Border Router */ -cluster ThreadBorderRouterManagement = 1106 { +provisional cluster ThreadBorderRouterManagement = 1106 { revision 1; bitmap Feature : bitmap32 { kPANChange = 0x1; } - readonly attribute char_string<63> borderRouterName = 0; - readonly attribute octet_string<254> borderAgentID = 1; - readonly attribute int16u threadVersion = 2; - readonly attribute boolean interfaceEnabled = 3; - readonly attribute nullable int64u activeDatasetTimestamp = 5; + provisional readonly attribute char_string<63> borderRouterName = 0; + provisional readonly attribute octet_string<254> borderAgentID = 1; + provisional readonly attribute int16u threadVersion = 2; + provisional readonly attribute boolean interfaceEnabled = 3; + provisional readonly attribute nullable int64u activeDatasetTimestamp = 4; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -8022,7 +8208,7 @@ cluster ThreadBorderRouterManagement = 1106 { readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; - response struct DatasetResponse = 3 { + response struct DatasetResponse = 2 { octet_string<254> dataset = 0; } @@ -8040,26 +8226,23 @@ cluster ThreadBorderRouterManagement = 1106 { /** 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 */ command access(invoke: manage) GetPendingDatasetRequest(): DatasetResponse = 1; /** Command to set or update the active Dataset of the Thread network to which the Border Router is connected. */ - command access(invoke: manage) SetActiveDatasetRequest(SetActiveDatasetRequestRequest): DefaultSuccess = 4; + command access(invoke: manage) SetActiveDatasetRequest(SetActiveDatasetRequestRequest): DefaultSuccess = 3; /** Command set or update the pending Dataset of the Thread network to which the Border Router is connected. */ - command access(invoke: manage) SetPendingDatasetRequest(SetPendingDatasetRequestRequest): DefaultSuccess = 5; + command access(invoke: manage) SetPendingDatasetRequest(SetPendingDatasetRequestRequest): DefaultSuccess = 4; } /** Manages the names and credentials of Thread networks visible to the user. */ -cluster ThreadNetworkDirectory = 1107 { +provisional cluster ThreadNetworkDirectory = 1107 { revision 1; struct ThreadNetworkStruct { - int64u extendedPanID = 0; + octet_string<8> extendedPanID = 0; char_string<16> networkName = 1; int16u channel = 2; + int64u activeTimestamp = 3; } - info event access(read: operate) NetworkChanged = 0 { - int64u extendedPanID = 0; - } - - attribute access(read: manage, write: manage) nullable int64u preferredExtendedPanID = 0; + attribute access(read: manage, write: manage) nullable octet_string<8> preferredExtendedPanID = 0; readonly attribute access(read: operate) ThreadNetworkStruct threadNetworks[] = 1; readonly attribute int8u threadNetworkTableSize = 2; readonly attribute command_id generatedCommandList[] = 65528; @@ -8074,11 +8257,11 @@ cluster ThreadNetworkDirectory = 1107 { } request struct RemoveNetworkRequest { - int64u extendedPanID = 0; + octet_string<8> extendedPanID = 0; } request struct GetOperationalDatasetRequest { - int64u extendedPanID = 0; + octet_string<8> extendedPanID = 0; } response struct OperationalDatasetResponse = 3 { @@ -8090,7 +8273,7 @@ cluster ThreadNetworkDirectory = 1107 { /** Removes an entry from the ThreadNetworks list. */ timed command access(invoke: manage) RemoveNetwork(RemoveNetworkRequest): DefaultSuccess = 1; /** Retrieves a Thread Operational Dataset from the ThreadNetworks list. */ - timed command GetOperationalDataset(GetOperationalDatasetRequest): OperationalDatasetResponse = 2; + command GetOperationalDataset(GetOperationalDatasetRequest): OperationalDatasetResponse = 2; } /** This cluster provides an interface for managing low power mode on a device that supports the Wake On LAN protocol. */ @@ -9127,6 +9310,199 @@ provisional cluster ContentAppObserver = 1296 { command ContentAppMessage(ContentAppMessageRequest): ContentAppMessageResponse = 0; } +/** Provides extended device information for all the logical devices represented by a Bridged Node. */ +provisional cluster EcosystemInformation = 1872 { + revision 1; + + 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; + } + + struct LocationDescriptorStruct { + char_string<128> locationName = 0; + nullable int16s floorNumber = 1; + nullable AreaTypeTag areaType = 2; + } + + fabric_scoped struct EcosystemLocationStruct { + fabric_sensitive char_string<64> uniqueLocationID = 0; + fabric_sensitive LocationDescriptorStruct locationDescriptor = 1; + fabric_sensitive epoch_us locationDescriptorLastEdit = 2; + fabric_idx fabricIndex = 254; + } + + struct DeviceTypeStruct { + devtype_id deviceType = 0; + int16u revision = 1; + } + + fabric_scoped struct EcosystemDeviceStruct { + optional fabric_sensitive char_string<64> deviceName = 0; + optional fabric_sensitive epoch_us deviceNameLastEdit = 1; + fabric_sensitive endpoint_no bridgedEndpoint = 2; + fabric_sensitive endpoint_no originalEndpoint = 3; + fabric_sensitive DeviceTypeStruct deviceTypes[] = 4; + fabric_sensitive char_string uniqueLocationIDs[] = 5; + fabric_sensitive epoch_us uniqueLocationIDsLastEdit = 6; + fabric_idx fabricIndex = 254; + } + + readonly attribute access(read: manage) optional nullable epoch_us removedOn = 0; + readonly attribute access(read: manage) EcosystemDeviceStruct deviceDirectory[] = 1; + readonly attribute access(read: manage) EcosystemLocationStruct locationDirectory[] = 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; +} + +/** Supports the ability for clients to request the commissioning of themselves or other nodes onto a fabric which the cluster server can commission onto. */ +provisional cluster CommissionerControl = 1873 { + revision 1; + + bitmap SupportedDeviceCategoryBitmap : bitmap32 { + kFabricSynchronization = 0x1; + } + + fabric_sensitive info event access(read: manage) CommissioningRequestResult = 0 { + int64u requestId = 0; + node_id clientNodeId = 1; + enum8 statusCode = 2; + fabric_idx fabricIndex = 254; + } + + readonly attribute access(read: manage) SupportedDeviceCategoryBitmap supportedDeviceCategories = 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 RequestCommissioningApprovalRequest { + int64u requestId = 0; + vendor_id vendorId = 1; + int16u productId = 2; + optional char_string<64> label = 3; + } + + request struct CommissionNodeRequest { + int64u requestId = 0; + int16u responseTimeoutSeconds = 1; + optional octet_string ipAddress = 2; + optional int16u port = 3; + } + + response struct ReverseOpenCommissioningWindow = 2 { + int16u commissioningTimeout = 0; + octet_string PAKEPasscodeVerifier = 1; + int16u discriminator = 2; + int32u iterations = 3; + octet_string<32> salt = 4; + } + + /** This command is sent by a client to request approval for a future CommissionNode call. */ + command access(invoke: manage) RequestCommissioningApproval(RequestCommissioningApprovalRequest): DefaultSuccess = 0; + /** This command is sent by a client to request that the server begins commissioning a previously approved request. */ + command access(invoke: manage) CommissionNode(CommissionNodeRequest): ReverseOpenCommissioningWindow = 1; +} + /** Attributes related to the electrical properties of a device. This cluster is used by power outlets and other devices that need to provide instantaneous data as opposed to metrology data which should be retrieved from the metering cluster.. */ deprecated cluster ElectricalMeasurement = 2820 { revision 3; diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index abba3d15cd18ca..eb527e60667894 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -416,7 +416,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "6", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3189,6 +3189,67 @@ } ] }, + { + "name": "Water Heater Management", + "code": 148, + "mfgCode": null, + "define": "WATER_HEATER_MANAGEMENT_CLUSTER", + "side": "client", + "enabled": 1, + "apiMaturity": "provisional", + "commands": [ + { + "name": "Boost", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "CancelBoost", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Device Energy Management", "code": 152, @@ -3394,6 +3455,66 @@ } ] }, + { + "name": "Water Heater Mode", + "code": 158, + "mfgCode": null, + "define": "WATER_HEATER_MODE_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "ChangeToMode", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "ChangeToModeResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Device Energy Management Mode", "code": 159, @@ -4120,7 +4241,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "7", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -4754,6 +4875,7 @@ "define": "THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER", "side": "client", "enabled": 1, + "apiMaturity": "provisional", "commands": [ { "name": "GetActiveDatasetRequest", @@ -4772,20 +4894,88 @@ "isEnabled": 1 }, { - "name": "SetActiveDatasetRequest", + "name": "SetPendingDatasetRequest", "code": 4, "mfgCode": null, "source": "client", "isIncoming": 0, "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 }, { - "name": "SetPendingDatasetRequest", - "code": 5, + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Thread Network Directory", + "code": 1107, + "mfgCode": null, + "define": "THREAD_NETWORK_DIRECTORY_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "AddNetwork", + "code": 0, "mfgCode": null, "source": "client", "isIncoming": 0, "isEnabled": 1 + }, + { + "name": "RemoveNetwork", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "GetOperationalDataset", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "OperationalDatasetResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 1, + "isEnabled": 1 } ], "attributes": [ @@ -4815,10 +5005,10 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "1", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 } ] diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index e96b2925e77a65..9a39e2f20eecd1 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -3963,6 +3963,8 @@ public static class AccessControlCluster extends BaseChipCluster { private static final long SUBJECTS_PER_ACCESS_CONTROL_ENTRY_ATTRIBUTE_ID = 2L; private static final long TARGETS_PER_ACCESS_CONTROL_ENTRY_ATTRIBUTE_ID = 3L; private static final long ACCESS_CONTROL_ENTRIES_PER_FABRIC_ATTRIBUTE_ID = 4L; + private static final long COMMISSIONING_A_R_L_ATTRIBUTE_ID = 5L; + private static final long ARL_ATTRIBUTE_ID = 6L; 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; @@ -3980,6 +3982,26 @@ public long initWithDevice(long devicePtr, int endpointId) { return 0L; } + public void reviewFabricRestrictions(DefaultClusterCallback callback, ArrayList arl) { + reviewFabricRestrictions(callback, arl, 0); + } + + public void reviewFabricRestrictions(DefaultClusterCallback callback, ArrayList arl, int timedInvokeTimeoutMs) { + final long commandId = 0L; + + ArrayList elements = new ArrayList<>(); + final long arlFieldID = 0L; + BaseTLVType arltlvValue = ArrayType.generateArrayType(arl, (elementarl) -> elementarl.encodeTlv()); + elements.add(new StructElement(arlFieldID, arltlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + public interface AclAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } @@ -3988,6 +4010,14 @@ public interface ExtensionAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } + public interface CommissioningARLAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface ArlAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } @@ -4162,6 +4192,63 @@ public void onSuccess(byte[] tlv) { }, ACCESS_CONTROL_ENTRIES_PER_FABRIC_ATTRIBUTE_ID, minInterval, maxInterval); } + public void readCommissioningARLAttribute( + CommissioningARLAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COMMISSIONING_A_R_L_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, COMMISSIONING_A_R_L_ATTRIBUTE_ID, true); + } + + public void subscribeCommissioningARLAttribute( + CommissioningARLAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COMMISSIONING_A_R_L_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, COMMISSIONING_A_R_L_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readArlAttribute( + ArlAttributeCallback callback) { + readArlAttributeWithFabricFilter(callback, true); + } + + public void readArlAttributeWithFabricFilter( + ArlAttributeCallback callback, boolean isFabricFiltered) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ARL_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ARL_ATTRIBUTE_ID, isFabricFiltered); + } + + public void subscribeArlAttribute( + ArlAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ARL_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ARL_ATTRIBUTE_ID, minInterval, maxInterval); + } + public void readGeneratedCommandListAttribute( GeneratedCommandListAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); @@ -14963,6 +15050,26 @@ public long initWithDevice(long devicePtr, int endpointId) { return 0L; } + public void keepActive(DefaultClusterCallback callback, Long stayActiveDuration) { + keepActive(callback, stayActiveDuration, 0); + } + + public void keepActive(DefaultClusterCallback callback, Long stayActiveDuration, int timedInvokeTimeoutMs) { + final long commandId = 128L; + + ArrayList elements = new ArrayList<>(); + final long stayActiveDurationFieldID = 0L; + BaseTLVType stayActiveDurationtlvValue = new UIntType(stayActiveDuration); + elements.add(new StructElement(stayActiveDurationFieldID, stayActiveDurationtlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + public interface ProductAppearanceAttributeCallback extends BaseAttributeCallback { void onSuccess(ChipStructs.BridgedDeviceBasicInformationClusterProductAppearanceStruct value); } @@ -18601,6 +18708,7 @@ public static class IcdManagementCluster extends BaseChipCluster { private static final long USER_ACTIVE_MODE_TRIGGER_HINT_ATTRIBUTE_ID = 6L; private static final long USER_ACTIVE_MODE_TRIGGER_INSTRUCTION_ATTRIBUTE_ID = 7L; private static final long OPERATING_MODE_ATTRIBUTE_ID = 8L; + private static final long MAXIMUM_CHECK_IN_BACK_OFF_ATTRIBUTE_ID = 9L; 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; @@ -18985,6 +19093,32 @@ public void onSuccess(byte[] tlv) { }, OPERATING_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } + public void readMaximumCheckInBackOffAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAXIMUM_CHECK_IN_BACK_OFF_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, MAXIMUM_CHECK_IN_BACK_OFF_ATTRIBUTE_ID, true); + } + + public void subscribeMaximumCheckInBackOffAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAXIMUM_CHECK_IN_BACK_OFF_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, MAXIMUM_CHECK_IN_BACK_OFF_ATTRIBUTE_ID, minInterval, maxInterval); + } + public void readGeneratedCommandListAttribute( GeneratedCommandListAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); @@ -30208,17 +30342,15 @@ public void onSuccess(byte[] tlv) { } } - public static class DemandResponseLoadControlCluster extends BaseChipCluster { - public static final long CLUSTER_ID = 150L; + public static class WaterHeaterManagementCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 148L; - private static final long LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID = 0L; - private static final long NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID = 1L; - private static final long EVENTS_ATTRIBUTE_ID = 2L; - private static final long ACTIVE_EVENTS_ATTRIBUTE_ID = 3L; - private static final long NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID = 4L; - private static final long NUMBER_OF_TRANSITIONS_ATTRIBUTE_ID = 5L; - private static final long DEFAULT_RANDOM_START_ATTRIBUTE_ID = 6L; - private static final long DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID = 7L; + private static final long HEATER_TYPES_ATTRIBUTE_ID = 0L; + private static final long HEAT_DEMAND_ATTRIBUTE_ID = 1L; + private static final long TANK_VOLUME_ATTRIBUTE_ID = 2L; + private static final long ESTIMATED_HEAT_REQUIRED_ATTRIBUTE_ID = 3L; + private static final long TANK_PERCENTAGE_ATTRIBUTE_ID = 4L; + private static final long BOOST_STATE_ATTRIBUTE_ID = 5L; 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; @@ -30226,7 +30358,7 @@ public static class DemandResponseLoadControlCluster extends BaseChipCluster { private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; - public DemandResponseLoadControlCluster(long devicePtr, int endpointId) { + public WaterHeaterManagementCluster(long devicePtr, int endpointId) { super(devicePtr, endpointId, CLUSTER_ID); } @@ -30236,57 +30368,37 @@ public long initWithDevice(long devicePtr, int endpointId) { return 0L; } - public void registerLoadControlProgramRequest(DefaultClusterCallback callback, ChipStructs.DemandResponseLoadControlClusterLoadControlProgramStruct loadControlProgram) { - registerLoadControlProgramRequest(callback, loadControlProgram, 0); + public void boost(DefaultClusterCallback callback, Long duration, Optional oneShot, Optional emergencyBoost, Optional temporarySetpoint, Optional targetPercentage, Optional targetReheat) { + boost(callback, duration, oneShot, emergencyBoost, temporarySetpoint, targetPercentage, targetReheat, 0); } - public void registerLoadControlProgramRequest(DefaultClusterCallback callback, ChipStructs.DemandResponseLoadControlClusterLoadControlProgramStruct loadControlProgram, int timedInvokeTimeoutMs) { + public void boost(DefaultClusterCallback callback, Long duration, Optional oneShot, Optional emergencyBoost, Optional temporarySetpoint, Optional targetPercentage, Optional targetReheat, int timedInvokeTimeoutMs) { final long commandId = 0L; ArrayList elements = new ArrayList<>(); - final long loadControlProgramFieldID = 0L; - BaseTLVType loadControlProgramtlvValue = loadControlProgram.encodeTlv(); - elements.add(new StructElement(loadControlProgramFieldID, loadControlProgramtlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void unregisterLoadControlProgramRequest(DefaultClusterCallback callback, byte[] loadControlProgramID) { - unregisterLoadControlProgramRequest(callback, loadControlProgramID, 0); - } + final long durationFieldID = 0L; + BaseTLVType durationtlvValue = new UIntType(duration); + elements.add(new StructElement(durationFieldID, durationtlvValue)); - public void unregisterLoadControlProgramRequest(DefaultClusterCallback callback, byte[] loadControlProgramID, int timedInvokeTimeoutMs) { - final long commandId = 1L; + final long oneShotFieldID = 1L; + BaseTLVType oneShottlvValue = oneShot.map((nonOptionaloneShot) -> new BooleanType(nonOptionaloneShot)).orElse(new EmptyType()); + elements.add(new StructElement(oneShotFieldID, oneShottlvValue)); - ArrayList elements = new ArrayList<>(); - final long loadControlProgramIDFieldID = 0L; - BaseTLVType loadControlProgramIDtlvValue = new ByteArrayType(loadControlProgramID); - elements.add(new StructElement(loadControlProgramIDFieldID, loadControlProgramIDtlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } + final long emergencyBoostFieldID = 2L; + BaseTLVType emergencyBoosttlvValue = emergencyBoost.map((nonOptionalemergencyBoost) -> new BooleanType(nonOptionalemergencyBoost)).orElse(new EmptyType()); + elements.add(new StructElement(emergencyBoostFieldID, emergencyBoosttlvValue)); - public void addLoadControlEventRequest(DefaultClusterCallback callback, ChipStructs.DemandResponseLoadControlClusterLoadControlEventStruct event) { - addLoadControlEventRequest(callback, event, 0); - } + final long temporarySetpointFieldID = 3L; + BaseTLVType temporarySetpointtlvValue = temporarySetpoint.map((nonOptionaltemporarySetpoint) -> new IntType(nonOptionaltemporarySetpoint)).orElse(new EmptyType()); + elements.add(new StructElement(temporarySetpointFieldID, temporarySetpointtlvValue)); - public void addLoadControlEventRequest(DefaultClusterCallback callback, ChipStructs.DemandResponseLoadControlClusterLoadControlEventStruct event, int timedInvokeTimeoutMs) { - final long commandId = 2L; + final long targetPercentageFieldID = 4L; + BaseTLVType targetPercentagetlvValue = targetPercentage.map((nonOptionaltargetPercentage) -> new UIntType(nonOptionaltargetPercentage)).orElse(new EmptyType()); + elements.add(new StructElement(targetPercentageFieldID, targetPercentagetlvValue)); - ArrayList elements = new ArrayList<>(); - final long eventFieldID = 0L; - BaseTLVType eventtlvValue = event.encodeTlv(); - elements.add(new StructElement(eventFieldID, eventtlvValue)); + final long targetReheatFieldID = 5L; + BaseTLVType targetReheattlvValue = targetReheat.map((nonOptionaltargetReheat) -> new UIntType(nonOptionaltargetReheat)).orElse(new EmptyType()); + elements.add(new StructElement(targetReheatFieldID, targetReheattlvValue)); StructType commandArgs = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @@ -30296,36 +30408,12 @@ public void onResponse(StructType invokeStructValue) { }}, commandId, commandArgs, timedInvokeTimeoutMs); } - public void removeLoadControlEventRequest(DefaultClusterCallback callback, byte[] eventID, Integer cancelControl) { - removeLoadControlEventRequest(callback, eventID, cancelControl, 0); + public void cancelBoost(DefaultClusterCallback callback) { + cancelBoost(callback, 0); } - public void removeLoadControlEventRequest(DefaultClusterCallback callback, byte[] eventID, Integer cancelControl, int timedInvokeTimeoutMs) { - final long commandId = 3L; - - ArrayList elements = new ArrayList<>(); - final long eventIDFieldID = 0L; - BaseTLVType eventIDtlvValue = new ByteArrayType(eventID); - elements.add(new StructElement(eventIDFieldID, eventIDtlvValue)); - - final long cancelControlFieldID = 1L; - BaseTLVType cancelControltlvValue = new UIntType(cancelControl); - elements.add(new StructElement(cancelControlFieldID, cancelControltlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void clearLoadControlEventsRequest(DefaultClusterCallback callback) { - clearLoadControlEventsRequest(callback, 0); - } - - public void clearLoadControlEventsRequest(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { - final long commandId = 4L; + public void cancelBoost(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + final long commandId = 1L; ArrayList elements = new ArrayList<>(); StructType commandArgs = new StructType(elements); @@ -30336,18 +30424,6 @@ public void onResponse(StructType invokeStructValue) { }}, commandId, commandArgs, timedInvokeTimeoutMs); } - public interface LoadControlProgramsAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); - } - - public interface EventsAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); - } - - public interface ActiveEventsAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); - } - public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } @@ -30364,35 +30440,9 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } - public void readLoadControlProgramsAttribute( - LoadControlProgramsAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID, true); - } - - public void subscribeLoadControlProgramsAttribute( - LoadControlProgramsAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID, minInterval, maxInterval); - } - - public void readNumberOfLoadControlProgramsAttribute( + public void readHeaterTypesAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, HEATER_TYPES_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -30400,12 +30450,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID, true); + }, HEATER_TYPES_ATTRIBUTE_ID, true); } - public void subscribeNumberOfLoadControlProgramsAttribute( + public void subscribeHeaterTypesAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, HEATER_TYPES_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -30413,64 +30463,38 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID, minInterval, maxInterval); + }, HEATER_TYPES_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readEventsAttribute( - EventsAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENTS_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, EVENTS_ATTRIBUTE_ID, true); - } - - public void subscribeEventsAttribute( - EventsAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENTS_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, EVENTS_ATTRIBUTE_ID, minInterval, maxInterval); - } - - public void readActiveEventsAttribute( - ActiveEventsAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_EVENTS_ATTRIBUTE_ID); + public void readHeatDemandAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, HEAT_DEMAND_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, ACTIVE_EVENTS_ATTRIBUTE_ID, true); + }, HEAT_DEMAND_ATTRIBUTE_ID, true); } - public void subscribeActiveEventsAttribute( - ActiveEventsAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_EVENTS_ATTRIBUTE_ID); + public void subscribeHeatDemandAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, HEAT_DEMAND_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, ACTIVE_EVENTS_ATTRIBUTE_ID, minInterval, maxInterval); + }, HEAT_DEMAND_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readNumberOfEventsPerProgramAttribute( + public void readTankVolumeAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TANK_VOLUME_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -30478,12 +30502,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID, true); + }, TANK_VOLUME_ATTRIBUTE_ID, true); } - public void subscribeNumberOfEventsPerProgramAttribute( + public void subscribeTankVolumeAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TANK_VOLUME_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -30491,38 +30515,38 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID, minInterval, maxInterval); + }, TANK_VOLUME_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readNumberOfTransitionsAttribute( - IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_TRANSITIONS_ATTRIBUTE_ID); + public void readEstimatedHeatRequiredAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ESTIMATED_HEAT_REQUIRED_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, NUMBER_OF_TRANSITIONS_ATTRIBUTE_ID, true); + }, ESTIMATED_HEAT_REQUIRED_ATTRIBUTE_ID, true); } - public void subscribeNumberOfTransitionsAttribute( - IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_TRANSITIONS_ATTRIBUTE_ID); + public void subscribeEstimatedHeatRequiredAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ESTIMATED_HEAT_REQUIRED_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, NUMBER_OF_TRANSITIONS_ATTRIBUTE_ID, minInterval, maxInterval); + }, ESTIMATED_HEAT_REQUIRED_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readDefaultRandomStartAttribute( + public void readTankPercentageAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_RANDOM_START_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TANK_PERCENTAGE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -30530,21 +30554,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, DEFAULT_RANDOM_START_ATTRIBUTE_ID, true); - } - - public void writeDefaultRandomStartAttribute(DefaultClusterCallback callback, Integer value) { - writeDefaultRandomStartAttribute(callback, value, 0); - } - - public void writeDefaultRandomStartAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { - BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), DEFAULT_RANDOM_START_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + }, TANK_PERCENTAGE_ATTRIBUTE_ID, true); } - public void subscribeDefaultRandomStartAttribute( + public void subscribeTankPercentageAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_RANDOM_START_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TANK_PERCENTAGE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -30552,12 +30567,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, DEFAULT_RANDOM_START_ATTRIBUTE_ID, minInterval, maxInterval); + }, TANK_PERCENTAGE_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readDefaultRandomDurationAttribute( + public void readBoostStateAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BOOST_STATE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -30565,21 +30580,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID, true); + }, BOOST_STATE_ATTRIBUTE_ID, true); } - public void writeDefaultRandomDurationAttribute(DefaultClusterCallback callback, Integer value) { - writeDefaultRandomDurationAttribute(callback, value, 0); - } - - public void writeDefaultRandomDurationAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { - BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); - } - - public void subscribeDefaultRandomDurationAttribute( + public void subscribeBoostStateAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BOOST_STATE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -30587,7 +30593,546 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID, minInterval, maxInterval); + }, BOOST_STATE_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readEventListAttribute( + EventListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeEventListAttribute( + EventListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAttributeListAttribute( + AttributeListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readFeatureMapAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, true); + } + + public void subscribeFeatureMapAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readClusterRevisionAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, true); + } + + public void subscribeClusterRevisionAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); + } + } + + public static class DemandResponseLoadControlCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 150L; + + private static final long LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID = 0L; + private static final long NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID = 1L; + private static final long EVENTS_ATTRIBUTE_ID = 2L; + private static final long ACTIVE_EVENTS_ATTRIBUTE_ID = 3L; + private static final long NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID = 4L; + private static final long NUMBER_OF_TRANSITIONS_ATTRIBUTE_ID = 5L; + private static final long DEFAULT_RANDOM_START_ATTRIBUTE_ID = 6L; + private static final long DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID = 7L; + 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; + private static final long ATTRIBUTE_LIST_ATTRIBUTE_ID = 65531L; + private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; + private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; + + public DemandResponseLoadControlCluster(long devicePtr, int endpointId) { + super(devicePtr, endpointId, CLUSTER_ID); + } + + @Override + @Deprecated + public long initWithDevice(long devicePtr, int endpointId) { + return 0L; + } + + public void registerLoadControlProgramRequest(DefaultClusterCallback callback, ChipStructs.DemandResponseLoadControlClusterLoadControlProgramStruct loadControlProgram) { + registerLoadControlProgramRequest(callback, loadControlProgram, 0); + } + + public void registerLoadControlProgramRequest(DefaultClusterCallback callback, ChipStructs.DemandResponseLoadControlClusterLoadControlProgramStruct loadControlProgram, int timedInvokeTimeoutMs) { + final long commandId = 0L; + + ArrayList elements = new ArrayList<>(); + final long loadControlProgramFieldID = 0L; + BaseTLVType loadControlProgramtlvValue = loadControlProgram.encodeTlv(); + elements.add(new StructElement(loadControlProgramFieldID, loadControlProgramtlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void unregisterLoadControlProgramRequest(DefaultClusterCallback callback, byte[] loadControlProgramID) { + unregisterLoadControlProgramRequest(callback, loadControlProgramID, 0); + } + + public void unregisterLoadControlProgramRequest(DefaultClusterCallback callback, byte[] loadControlProgramID, int timedInvokeTimeoutMs) { + final long commandId = 1L; + + ArrayList elements = new ArrayList<>(); + final long loadControlProgramIDFieldID = 0L; + BaseTLVType loadControlProgramIDtlvValue = new ByteArrayType(loadControlProgramID); + elements.add(new StructElement(loadControlProgramIDFieldID, loadControlProgramIDtlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void addLoadControlEventRequest(DefaultClusterCallback callback, ChipStructs.DemandResponseLoadControlClusterLoadControlEventStruct event) { + addLoadControlEventRequest(callback, event, 0); + } + + public void addLoadControlEventRequest(DefaultClusterCallback callback, ChipStructs.DemandResponseLoadControlClusterLoadControlEventStruct event, int timedInvokeTimeoutMs) { + final long commandId = 2L; + + ArrayList elements = new ArrayList<>(); + final long eventFieldID = 0L; + BaseTLVType eventtlvValue = event.encodeTlv(); + elements.add(new StructElement(eventFieldID, eventtlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void removeLoadControlEventRequest(DefaultClusterCallback callback, byte[] eventID, Integer cancelControl) { + removeLoadControlEventRequest(callback, eventID, cancelControl, 0); + } + + public void removeLoadControlEventRequest(DefaultClusterCallback callback, byte[] eventID, Integer cancelControl, int timedInvokeTimeoutMs) { + final long commandId = 3L; + + ArrayList elements = new ArrayList<>(); + final long eventIDFieldID = 0L; + BaseTLVType eventIDtlvValue = new ByteArrayType(eventID); + elements.add(new StructElement(eventIDFieldID, eventIDtlvValue)); + + final long cancelControlFieldID = 1L; + BaseTLVType cancelControltlvValue = new UIntType(cancelControl); + elements.add(new StructElement(cancelControlFieldID, cancelControltlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void clearLoadControlEventsRequest(DefaultClusterCallback callback) { + clearLoadControlEventsRequest(callback, 0); + } + + public void clearLoadControlEventsRequest(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + final long commandId = 4L; + + ArrayList elements = new ArrayList<>(); + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public interface LoadControlProgramsAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface EventsAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface ActiveEventsAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AcceptedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface EventListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AttributeListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public void readLoadControlProgramsAttribute( + LoadControlProgramsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID, true); + } + + public void subscribeLoadControlProgramsAttribute( + LoadControlProgramsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readNumberOfLoadControlProgramsAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID, true); + } + + public void subscribeNumberOfLoadControlProgramsAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readEventsAttribute( + EventsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENTS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENTS_ATTRIBUTE_ID, true); + } + + public void subscribeEventsAttribute( + EventsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENTS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENTS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readActiveEventsAttribute( + ActiveEventsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_EVENTS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACTIVE_EVENTS_ATTRIBUTE_ID, true); + } + + public void subscribeActiveEventsAttribute( + ActiveEventsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_EVENTS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACTIVE_EVENTS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readNumberOfEventsPerProgramAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID, true); + } + + public void subscribeNumberOfEventsPerProgramAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readNumberOfTransitionsAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_TRANSITIONS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NUMBER_OF_TRANSITIONS_ATTRIBUTE_ID, true); + } + + public void subscribeNumberOfTransitionsAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_TRANSITIONS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NUMBER_OF_TRANSITIONS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readDefaultRandomStartAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_RANDOM_START_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, DEFAULT_RANDOM_START_ATTRIBUTE_ID, true); + } + + public void writeDefaultRandomStartAttribute(DefaultClusterCallback callback, Integer value) { + writeDefaultRandomStartAttribute(callback, value, 0); + } + + public void writeDefaultRandomStartAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = new UIntType(value); + writeAttribute(new WriteAttributesCallbackImpl(callback), DEFAULT_RANDOM_START_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + } + + public void subscribeDefaultRandomStartAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_RANDOM_START_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, DEFAULT_RANDOM_START_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readDefaultRandomDurationAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID, true); + } + + public void writeDefaultRandomDurationAttribute(DefaultClusterCallback callback, Integer value) { + writeDefaultRandomDurationAttribute(callback, value, 0); + } + + public void writeDefaultRandomDurationAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = new UIntType(value); + writeAttribute(new WriteAttributesCallbackImpl(callback), DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + } + + public void subscribeDefaultRandomDurationAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID, minInterval, maxInterval); } public void readGeneratedCommandListAttribute( @@ -33047,11 +33592,268 @@ public void onSuccess(byte[] tlv) { } } - public static class PowerTopologyCluster extends BaseChipCluster { - public static final long CLUSTER_ID = 156L; + public static class PowerTopologyCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 156L; + + private static final long AVAILABLE_ENDPOINTS_ATTRIBUTE_ID = 0L; + private static final long ACTIVE_ENDPOINTS_ATTRIBUTE_ID = 1L; + 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; + private static final long ATTRIBUTE_LIST_ATTRIBUTE_ID = 65531L; + private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; + private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; + + public PowerTopologyCluster(long devicePtr, int endpointId) { + super(devicePtr, endpointId, CLUSTER_ID); + } + + @Override + @Deprecated + public long initWithDevice(long devicePtr, int endpointId) { + return 0L; + } + + public interface AvailableEndpointsAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface ActiveEndpointsAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AcceptedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface EventListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AttributeListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public void readAvailableEndpointsAttribute( + AvailableEndpointsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID, true); + } + + public void subscribeAvailableEndpointsAttribute( + AvailableEndpointsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readActiveEndpointsAttribute( + ActiveEndpointsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_ENDPOINTS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACTIVE_ENDPOINTS_ATTRIBUTE_ID, true); + } + + public void subscribeActiveEndpointsAttribute( + ActiveEndpointsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_ENDPOINTS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACTIVE_ENDPOINTS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readEventListAttribute( + EventListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeEventListAttribute( + EventListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAttributeListAttribute( + AttributeListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readFeatureMapAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, true); + } + + public void subscribeFeatureMapAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readClusterRevisionAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, true); + } + + public void subscribeClusterRevisionAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); + } + } + + public static class EnergyEvseModeCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 157L; - private static final long AVAILABLE_ENDPOINTS_ATTRIBUTE_ID = 0L; - private static final long ACTIVE_ENDPOINTS_ATTRIBUTE_ID = 1L; + private static final long SUPPORTED_MODES_ATTRIBUTE_ID = 0L; + private static final long CURRENT_MODE_ATTRIBUTE_ID = 1L; + private static final long START_UP_MODE_ATTRIBUTE_ID = 2L; + private static final long ON_MODE_ATTRIBUTE_ID = 3L; 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; @@ -33059,7 +33861,7 @@ public static class PowerTopologyCluster extends BaseChipCluster { private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; - public PowerTopologyCluster(long devicePtr, int endpointId) { + public EnergyEvseModeCluster(long devicePtr, int endpointId) { super(devicePtr, endpointId, CLUSTER_ID); } @@ -33069,12 +33871,57 @@ public long initWithDevice(long devicePtr, int endpointId) { return 0L; } - public interface AvailableEndpointsAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + public void changeToMode(ChangeToModeResponseCallback callback, Integer newMode) { + changeToMode(callback, newMode, 0); } - public interface ActiveEndpointsAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + public void changeToMode(ChangeToModeResponseCallback callback, Integer newMode, int timedInvokeTimeoutMs) { + final long commandId = 0L; + + ArrayList elements = new ArrayList<>(); + final long newModeFieldID = 0L; + BaseTLVType newModetlvValue = new UIntType(newMode); + elements.add(new StructElement(newModeFieldID, newModetlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + final long statusFieldID = 0L; + Integer status = null; + final long statusTextFieldID = 1L; + Optional statusText = Optional.empty(); + for (StructElement element: invokeStructValue.value()) { + if (element.contextTagNum() == statusFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + status = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == statusTextFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + statusText = Optional.of(castingValue.value(String.class)); + } + } + } + callback.onSuccess(status, statusText); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public interface ChangeToModeResponseCallback extends BaseClusterCallback { + void onSuccess(Integer status, Optional statusText); + } + + public interface SupportedModesAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface StartUpModeAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Integer value); + } + + public interface OnModeAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Integer value); } public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { @@ -33093,56 +33940,126 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } - public void readAvailableEndpointsAttribute( - AvailableEndpointsAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID); + public void readSupportedModesAttribute( + SupportedModesAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_MODES_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); } - }, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID, true); + }, SUPPORTED_MODES_ATTRIBUTE_ID, true); } - public void subscribeAvailableEndpointsAttribute( - AvailableEndpointsAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID); + public void subscribeSupportedModesAttribute( + SupportedModesAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_MODES_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); } - }, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID, minInterval, maxInterval); + }, SUPPORTED_MODES_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readActiveEndpointsAttribute( - ActiveEndpointsAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_ENDPOINTS_ATTRIBUTE_ID); + public void readCurrentModeAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_MODE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, ACTIVE_ENDPOINTS_ATTRIBUTE_ID, true); + }, CURRENT_MODE_ATTRIBUTE_ID, true); } - public void subscribeActiveEndpointsAttribute( - ActiveEndpointsAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_ENDPOINTS_ATTRIBUTE_ID); + public void subscribeCurrentModeAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_MODE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, ACTIVE_ENDPOINTS_ATTRIBUTE_ID, minInterval, maxInterval); + }, CURRENT_MODE_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readStartUpModeAttribute( + StartUpModeAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, START_UP_MODE_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, START_UP_MODE_ATTRIBUTE_ID, true); + } + + public void writeStartUpModeAttribute(DefaultClusterCallback callback, Integer value) { + writeStartUpModeAttribute(callback, value, 0); + } + + public void writeStartUpModeAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = value != null ? new UIntType(value) : new NullType(); + writeAttribute(new WriteAttributesCallbackImpl(callback), START_UP_MODE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + } + + public void subscribeStartUpModeAttribute( + StartUpModeAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, START_UP_MODE_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, START_UP_MODE_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readOnModeAttribute( + OnModeAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ON_MODE_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ON_MODE_ATTRIBUTE_ID, true); + } + + public void writeOnModeAttribute(DefaultClusterCallback callback, Integer value) { + writeOnModeAttribute(callback, value, 0); + } + + public void writeOnModeAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = value != null ? new UIntType(value) : new NullType(); + writeAttribute(new WriteAttributesCallbackImpl(callback), ON_MODE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + } + + public void subscribeOnModeAttribute( + OnModeAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ON_MODE_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ON_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } public void readGeneratedCommandListAttribute( @@ -33302,8 +34219,8 @@ public void onSuccess(byte[] tlv) { } } - public static class EnergyEvseModeCluster extends BaseChipCluster { - public static final long CLUSTER_ID = 157L; + public static class WaterHeaterModeCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 158L; private static final long SUPPORTED_MODES_ATTRIBUTE_ID = 0L; private static final long CURRENT_MODE_ATTRIBUTE_ID = 1L; @@ -33316,7 +34233,7 @@ public static class EnergyEvseModeCluster extends BaseChipCluster { private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; - public EnergyEvseModeCluster(long devicePtr, int endpointId) { + public WaterHeaterModeCluster(long devicePtr, int endpointId) { super(devicePtr, endpointId, CLUSTER_ID); } @@ -33368,7 +34285,7 @@ public interface ChangeToModeResponseCallback extends BaseClusterCallback { } public interface SupportedModesAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + void onSuccess(List value); } public interface StartUpModeAttributeCallback extends BaseAttributeCallback { @@ -33402,7 +34319,7 @@ public void readSupportedModesAttribute( 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); } }, SUPPORTED_MODES_ATTRIBUTE_ID, true); @@ -33415,7 +34332,7 @@ public void subscribeSupportedModesAttribute( 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); } }, SUPPORTED_MODES_ATTRIBUTE_ID, minInterval, maxInterval); @@ -39399,9 +40316,7 @@ public static class ThermostatCluster extends BaseChipCluster { private static final long PRESETS_ATTRIBUTE_ID = 80L; private static final long SCHEDULES_ATTRIBUTE_ID = 81L; private static final long PRESETS_SCHEDULES_EDITABLE_ATTRIBUTE_ID = 82L; - private static final long TEMPERATURE_SETPOINT_HOLD_POLICY_ATTRIBUTE_ID = 83L; - private static final long SETPOINT_HOLD_EXPIRY_TIMESTAMP_ATTRIBUTE_ID = 84L; - private static final long QUEUED_PRESET_ATTRIBUTE_ID = 85L; + private static final long SETPOINT_HOLD_EXPIRY_TIMESTAMP_ATTRIBUTE_ID = 83L; 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; @@ -39566,11 +40481,11 @@ public void onResponse(StructType invokeStructValue) { }}, commandId, commandArgs, timedInvokeTimeoutMs); } - public void setActivePresetRequest(DefaultClusterCallback callback, byte[] presetHandle, Optional delayMinutes) { - setActivePresetRequest(callback, presetHandle, delayMinutes, 0); + public void setActivePresetRequest(DefaultClusterCallback callback, byte[] presetHandle) { + setActivePresetRequest(callback, presetHandle, 0); } - public void setActivePresetRequest(DefaultClusterCallback callback, byte[] presetHandle, Optional delayMinutes, int timedInvokeTimeoutMs) { + public void setActivePresetRequest(DefaultClusterCallback callback, byte[] presetHandle, int timedInvokeTimeoutMs) { final long commandId = 6L; ArrayList elements = new ArrayList<>(); @@ -39578,10 +40493,6 @@ public void setActivePresetRequest(DefaultClusterCallback callback, byte[] prese BaseTLVType presetHandletlvValue = new ByteArrayType(presetHandle); elements.add(new StructElement(presetHandleFieldID, presetHandletlvValue)); - final long delayMinutesFieldID = 1L; - BaseTLVType delayMinutestlvValue = delayMinutes.map((nonOptionaldelayMinutes) -> new UIntType(nonOptionaldelayMinutes)).orElse(new EmptyType()); - elements.add(new StructElement(delayMinutesFieldID, delayMinutestlvValue)); - StructType commandArgs = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @Override @@ -39642,42 +40553,6 @@ public void onResponse(StructType invokeStructValue) { }}, commandId, commandArgs, timedInvokeTimeoutMs); } - public void cancelSetActivePresetRequest(DefaultClusterCallback callback) { - cancelSetActivePresetRequest(callback, 0); - } - - public void cancelSetActivePresetRequest(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { - final long commandId = 10L; - - ArrayList elements = new ArrayList<>(); - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void setTemperatureSetpointHoldPolicy(DefaultClusterCallback callback, Integer temperatureSetpointHoldPolicy) { - setTemperatureSetpointHoldPolicy(callback, temperatureSetpointHoldPolicy, 0); - } - - public void setTemperatureSetpointHoldPolicy(DefaultClusterCallback callback, Integer temperatureSetpointHoldPolicy, int timedInvokeTimeoutMs) { - final long commandId = 11L; - - ArrayList elements = new ArrayList<>(); - final long temperatureSetpointHoldPolicyFieldID = 0L; - BaseTLVType temperatureSetpointHoldPolicytlvValue = new UIntType(temperatureSetpointHoldPolicy); - elements.add(new StructElement(temperatureSetpointHoldPolicyFieldID, temperatureSetpointHoldPolicytlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - public interface GetWeeklyScheduleResponseCallback extends BaseClusterCallback { void onSuccess(Integer numberOfTransitionsForSequence, Integer dayOfWeekForSequence, Integer modeForSequence, ArrayList transitions); } @@ -39758,10 +40633,6 @@ public interface SetpointHoldExpiryTimestampAttributeCallback extends BaseAttrib void onSuccess(@Nullable Long value); } - public interface QueuedPresetAttributeCallback extends BaseAttributeCallback { - void onSuccess(@Nullable ChipStructs.ThermostatClusterQueuedPresetStruct value); - } - public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } @@ -41599,32 +42470,6 @@ public void onSuccess(byte[] tlv) { }, PRESETS_SCHEDULES_EDITABLE_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readTemperatureSetpointHoldPolicyAttribute( - IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TEMPERATURE_SETPOINT_HOLD_POLICY_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, TEMPERATURE_SETPOINT_HOLD_POLICY_ATTRIBUTE_ID, true); - } - - public void subscribeTemperatureSetpointHoldPolicyAttribute( - IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TEMPERATURE_SETPOINT_HOLD_POLICY_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, TEMPERATURE_SETPOINT_HOLD_POLICY_ATTRIBUTE_ID, minInterval, maxInterval); - } - public void readSetpointHoldExpiryTimestampAttribute( SetpointHoldExpiryTimestampAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SETPOINT_HOLD_EXPIRY_TIMESTAMP_ATTRIBUTE_ID); @@ -41651,32 +42496,6 @@ public void onSuccess(byte[] tlv) { }, SETPOINT_HOLD_EXPIRY_TIMESTAMP_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readQueuedPresetAttribute( - QueuedPresetAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, QUEUED_PRESET_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - @Nullable ChipStructs.ThermostatClusterQueuedPresetStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, QUEUED_PRESET_ATTRIBUTE_ID, true); - } - - public void subscribeQueuedPresetAttribute( - QueuedPresetAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, QUEUED_PRESET_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - @Nullable ChipStructs.ThermostatClusterQueuedPresetStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, QUEUED_PRESET_ATTRIBUTE_ID, minInterval, maxInterval); - } - public void readGeneratedCommandListAttribute( GeneratedCommandListAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); @@ -53360,7 +54179,8 @@ public void onSuccess(byte[] tlv) { public static class WiFiNetworkManagementCluster extends BaseChipCluster { public static final long CLUSTER_ID = 1105L; - private static final long SSID_ATTRIBUTE_ID = 1L; + private static final long SSID_ATTRIBUTE_ID = 0L; + private static final long PASSPHRASE_SURROGATE_ATTRIBUTE_ID = 1L; 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; @@ -53412,6 +54232,10 @@ public interface SsidAttributeCallback extends BaseAttributeCallback { void onSuccess(@Nullable byte[] value); } + public interface PassphraseSurrogateAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } @@ -53454,6 +54278,32 @@ public void onSuccess(byte[] tlv) { }, SSID_ATTRIBUTE_ID, minInterval, maxInterval); } + public void readPassphraseSurrogateAttribute( + PassphraseSurrogateAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PASSPHRASE_SURROGATE_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, PASSPHRASE_SURROGATE_ATTRIBUTE_ID, true); + } + + public void subscribePassphraseSurrogateAttribute( + PassphraseSurrogateAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PASSPHRASE_SURROGATE_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, PASSPHRASE_SURROGATE_ATTRIBUTE_ID, minInterval, maxInterval); + } + public void readGeneratedCommandListAttribute( GeneratedCommandListAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); @@ -53618,7 +54468,7 @@ public static class ThreadBorderRouterManagementCluster extends BaseChipCluster private static final long BORDER_AGENT_I_D_ATTRIBUTE_ID = 1L; private static final long THREAD_VERSION_ATTRIBUTE_ID = 2L; private static final long INTERFACE_ENABLED_ATTRIBUTE_ID = 3L; - private static final long ACTIVE_DATASET_TIMESTAMP_ATTRIBUTE_ID = 5L; + private static final long ACTIVE_DATASET_TIMESTAMP_ATTRIBUTE_ID = 4L; 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; @@ -53693,7 +54543,7 @@ public void setActiveDatasetRequest(DefaultClusterCallback callback, byte[] acti } public void setActiveDatasetRequest(DefaultClusterCallback callback, byte[] activeDataset, Optional breadcrumb, int timedInvokeTimeoutMs) { - final long commandId = 4L; + final long commandId = 3L; ArrayList elements = new ArrayList<>(); final long activeDatasetFieldID = 0L; @@ -53717,7 +54567,7 @@ public void setPendingDatasetRequest(DefaultClusterCallback callback, byte[] pen } public void setPendingDatasetRequest(DefaultClusterCallback callback, byte[] pendingDataset, int timedInvokeTimeoutMs) { - final long commandId = 5L; + final long commandId = 4L; ArrayList elements = new ArrayList<>(); final long pendingDatasetFieldID = 0L; @@ -54084,12 +54934,12 @@ public void onResponse(StructType invokeStructValue) { } - public void removeNetwork(DefaultClusterCallback callback, Long extendedPanID, int timedInvokeTimeoutMs) { + public void removeNetwork(DefaultClusterCallback callback, byte[] extendedPanID, int timedInvokeTimeoutMs) { final long commandId = 1L; ArrayList elements = new ArrayList<>(); final long extendedPanIDFieldID = 0L; - BaseTLVType extendedPanIDtlvValue = new UIntType(extendedPanID); + BaseTLVType extendedPanIDtlvValue = new ByteArrayType(extendedPanID); elements.add(new StructElement(extendedPanIDFieldID, extendedPanIDtlvValue)); StructType commandArgs = new StructType(elements); @@ -54100,13 +54950,16 @@ public void onResponse(StructType invokeStructValue) { }}, commandId, commandArgs, timedInvokeTimeoutMs); } + public void getOperationalDataset(OperationalDatasetResponseCallback callback, byte[] extendedPanID) { + getOperationalDataset(callback, extendedPanID, 0); + } - public void getOperationalDataset(OperationalDatasetResponseCallback callback, Long extendedPanID, int timedInvokeTimeoutMs) { + public void getOperationalDataset(OperationalDatasetResponseCallback callback, byte[] extendedPanID, int timedInvokeTimeoutMs) { final long commandId = 2L; ArrayList elements = new ArrayList<>(); final long extendedPanIDFieldID = 0L; - BaseTLVType extendedPanIDtlvValue = new UIntType(extendedPanID); + BaseTLVType extendedPanIDtlvValue = new ByteArrayType(extendedPanID); elements.add(new StructElement(extendedPanIDFieldID, extendedPanIDtlvValue)); StructType commandArgs = new StructType(elements); @@ -54132,7 +54985,7 @@ public interface OperationalDatasetResponseCallback extends BaseClusterCallback } public interface PreferredExtendedPanIDAttributeCallback extends BaseAttributeCallback { - void onSuccess(@Nullable Long value); + void onSuccess(@Nullable byte[] value); } public interface ThreadNetworksAttributeCallback extends BaseAttributeCallback { @@ -54162,18 +55015,18 @@ public void readPreferredExtendedPanIDAttribute( readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + @Nullable byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } }, PREFERRED_EXTENDED_PAN_I_D_ATTRIBUTE_ID, true); } - public void writePreferredExtendedPanIDAttribute(DefaultClusterCallback callback, Long value) { + public void writePreferredExtendedPanIDAttribute(DefaultClusterCallback callback, byte[] value) { writePreferredExtendedPanIDAttribute(callback, value, 0); } - public void writePreferredExtendedPanIDAttribute(DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { - BaseTLVType tlvValue = value != null ? new UIntType(value) : new NullType(); + public void writePreferredExtendedPanIDAttribute(DefaultClusterCallback callback, byte[] value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = value != null ? new ByteArrayType(value) : new NullType(); writeAttribute(new WriteAttributesCallbackImpl(callback), PREFERRED_EXTENDED_PAN_I_D_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } @@ -54184,7 +55037,7 @@ public void subscribePreferredExtendedPanIDAttribute( subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + @Nullable byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } }, PREFERRED_EXTENDED_PAN_I_D_ATTRIBUTE_ID, minInterval, maxInterval); @@ -56742,9 +57595,447 @@ public void onSuccess(byte[] tlv) { } } - public static class LowPowerCluster extends BaseChipCluster { - public static final long CLUSTER_ID = 1288L; + public static class LowPowerCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 1288L; + + 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; + private static final long ATTRIBUTE_LIST_ATTRIBUTE_ID = 65531L; + private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; + private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; + + public LowPowerCluster(long devicePtr, int endpointId) { + super(devicePtr, endpointId, CLUSTER_ID); + } + + @Override + @Deprecated + public long initWithDevice(long devicePtr, int endpointId) { + return 0L; + } + + public void sleep(DefaultClusterCallback callback) { + sleep(callback, 0); + } + + public void sleep(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + final long commandId = 0L; + + ArrayList elements = new ArrayList<>(); + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AcceptedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface EventListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AttributeListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public void readGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readEventListAttribute( + EventListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeEventListAttribute( + EventListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAttributeListAttribute( + AttributeListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readFeatureMapAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, true); + } + + public void subscribeFeatureMapAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readClusterRevisionAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, true); + } + + public void subscribeClusterRevisionAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); + } + } + + public static class KeypadInputCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 1289L; + + 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; + private static final long ATTRIBUTE_LIST_ATTRIBUTE_ID = 65531L; + private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; + private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; + + public KeypadInputCluster(long devicePtr, int endpointId) { + super(devicePtr, endpointId, CLUSTER_ID); + } + + @Override + @Deprecated + public long initWithDevice(long devicePtr, int endpointId) { + return 0L; + } + + public void sendKey(SendKeyResponseCallback callback, Integer keyCode) { + sendKey(callback, keyCode, 0); + } + + public void sendKey(SendKeyResponseCallback callback, Integer keyCode, int timedInvokeTimeoutMs) { + final long commandId = 0L; + + ArrayList elements = new ArrayList<>(); + final long keyCodeFieldID = 0L; + BaseTLVType keyCodetlvValue = new UIntType(keyCode); + elements.add(new StructElement(keyCodeFieldID, keyCodetlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + final long statusFieldID = 0L; + Integer status = null; + for (StructElement element: invokeStructValue.value()) { + if (element.contextTagNum() == statusFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + status = castingValue.value(Integer.class); + } + } + } + callback.onSuccess(status); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public interface SendKeyResponseCallback extends BaseClusterCallback { + void onSuccess(Integer status); + } + + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AcceptedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface EventListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AttributeListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public void readGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readEventListAttribute( + EventListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeEventListAttribute( + EventListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAttributeListAttribute( + AttributeListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readFeatureMapAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, true); + } + + public void subscribeFeatureMapAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readClusterRevisionAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, true); + } + + public void subscribeClusterRevisionAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); + } + } + + public static class ContentLauncherCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 1290L; + private static final long ACCEPT_HEADER_ATTRIBUTE_ID = 0L; + private static final long SUPPORTED_STREAMING_PROTOCOLS_ATTRIBUTE_ID = 1L; 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; @@ -56752,7 +58043,7 @@ public static class LowPowerCluster extends BaseChipCluster { private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; - public LowPowerCluster(long devicePtr, int endpointId) { + public ContentLauncherCluster(long devicePtr, int endpointId) { super(devicePtr, endpointId, CLUSTER_ID); } @@ -56762,22 +58053,112 @@ public long initWithDevice(long devicePtr, int endpointId) { return 0L; } - public void sleep(DefaultClusterCallback callback) { - sleep(callback, 0); + public void launchContent(LauncherResponseCallback callback, ChipStructs.ContentLauncherClusterContentSearchStruct search, Boolean autoPlay, Optional data, Optional playbackPreferences, Optional useCurrentContext) { + launchContent(callback, search, autoPlay, data, playbackPreferences, useCurrentContext, 0); } - public void sleep(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + public void launchContent(LauncherResponseCallback callback, ChipStructs.ContentLauncherClusterContentSearchStruct search, Boolean autoPlay, Optional data, Optional playbackPreferences, Optional useCurrentContext, int timedInvokeTimeoutMs) { final long commandId = 0L; ArrayList elements = new ArrayList<>(); + final long searchFieldID = 0L; + BaseTLVType searchtlvValue = search.encodeTlv(); + elements.add(new StructElement(searchFieldID, searchtlvValue)); + + final long autoPlayFieldID = 1L; + BaseTLVType autoPlaytlvValue = new BooleanType(autoPlay); + elements.add(new StructElement(autoPlayFieldID, autoPlaytlvValue)); + + final long dataFieldID = 2L; + BaseTLVType datatlvValue = data.map((nonOptionaldata) -> new StringType(nonOptionaldata)).orElse(new EmptyType()); + elements.add(new StructElement(dataFieldID, datatlvValue)); + + final long playbackPreferencesFieldID = 3L; + BaseTLVType playbackPreferencestlvValue = playbackPreferences.map((nonOptionalplaybackPreferences) -> nonOptionalplaybackPreferences.encodeTlv()).orElse(new EmptyType()); + elements.add(new StructElement(playbackPreferencesFieldID, playbackPreferencestlvValue)); + + final long useCurrentContextFieldID = 4L; + BaseTLVType useCurrentContexttlvValue = useCurrentContext.map((nonOptionaluseCurrentContext) -> new BooleanType(nonOptionaluseCurrentContext)).orElse(new EmptyType()); + elements.add(new StructElement(useCurrentContextFieldID, useCurrentContexttlvValue)); + StructType commandArgs = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @Override public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); + final long statusFieldID = 0L; + Integer status = null; + final long dataFieldID = 1L; + Optional data = Optional.empty(); + for (StructElement element: invokeStructValue.value()) { + if (element.contextTagNum() == statusFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + status = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == dataFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + data = Optional.of(castingValue.value(String.class)); + } + } + } + callback.onSuccess(status, data); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void launchURL(LauncherResponseCallback callback, String contentURL, Optional displayString, Optional brandingInformation) { + launchURL(callback, contentURL, displayString, brandingInformation, 0); + } + + public void launchURL(LauncherResponseCallback callback, String contentURL, Optional displayString, Optional brandingInformation, int timedInvokeTimeoutMs) { + final long commandId = 1L; + + ArrayList elements = new ArrayList<>(); + final long contentURLFieldID = 0L; + BaseTLVType contentURLtlvValue = new StringType(contentURL); + elements.add(new StructElement(contentURLFieldID, contentURLtlvValue)); + + final long displayStringFieldID = 1L; + BaseTLVType displayStringtlvValue = displayString.map((nonOptionaldisplayString) -> new StringType(nonOptionaldisplayString)).orElse(new EmptyType()); + elements.add(new StructElement(displayStringFieldID, displayStringtlvValue)); + + final long brandingInformationFieldID = 2L; + BaseTLVType brandingInformationtlvValue = brandingInformation.map((nonOptionalbrandingInformation) -> nonOptionalbrandingInformation.encodeTlv()).orElse(new EmptyType()); + elements.add(new StructElement(brandingInformationFieldID, brandingInformationtlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + final long statusFieldID = 0L; + Integer status = null; + final long dataFieldID = 1L; + Optional data = Optional.empty(); + for (StructElement element: invokeStructValue.value()) { + if (element.contextTagNum() == statusFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + status = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == dataFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + data = Optional.of(castingValue.value(String.class)); + } + } + } + callback.onSuccess(status, data); }}, commandId, commandArgs, timedInvokeTimeoutMs); } + public interface LauncherResponseCallback extends BaseClusterCallback { + void onSuccess(Integer status, Optional data); + } + + public interface AcceptHeaderAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } @@ -56794,6 +58175,58 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } + public void readAcceptHeaderAttribute( + AcceptHeaderAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPT_HEADER_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPT_HEADER_ATTRIBUTE_ID, true); + } + + public void subscribeAcceptHeaderAttribute( + AcceptHeaderAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPT_HEADER_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPT_HEADER_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readSupportedStreamingProtocolsAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_STREAMING_PROTOCOLS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, SUPPORTED_STREAMING_PROTOCOLS_ATTRIBUTE_ID, true); + } + + public void subscribeSupportedStreamingProtocolsAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_STREAMING_PROTOCOLS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, SUPPORTED_STREAMING_PROTOCOLS_ATTRIBUTE_ID, minInterval, maxInterval); + } + public void readGeneratedCommandListAttribute( GeneratedCommandListAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); @@ -56951,9 +58384,11 @@ public void onSuccess(byte[] tlv) { } } - public static class KeypadInputCluster extends BaseChipCluster { - public static final long CLUSTER_ID = 1289L; + public static class AudioOutputCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 1291L; + private static final long OUTPUT_LIST_ATTRIBUTE_ID = 0L; + private static final long CURRENT_OUTPUT_ATTRIBUTE_ID = 1L; 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; @@ -56961,7 +58396,7 @@ public static class KeypadInputCluster extends BaseChipCluster { private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; - public KeypadInputCluster(long devicePtr, int endpointId) { + public AudioOutputCluster(long devicePtr, int endpointId) { super(devicePtr, endpointId, CLUSTER_ID); } @@ -56971,38 +58406,52 @@ public long initWithDevice(long devicePtr, int endpointId) { return 0L; } - public void sendKey(SendKeyResponseCallback callback, Integer keyCode) { - sendKey(callback, keyCode, 0); + public void selectOutput(DefaultClusterCallback callback, Integer index) { + selectOutput(callback, index, 0); } - public void sendKey(SendKeyResponseCallback callback, Integer keyCode, int timedInvokeTimeoutMs) { + public void selectOutput(DefaultClusterCallback callback, Integer index, int timedInvokeTimeoutMs) { final long commandId = 0L; ArrayList elements = new ArrayList<>(); - final long keyCodeFieldID = 0L; - BaseTLVType keyCodetlvValue = new UIntType(keyCode); - elements.add(new StructElement(keyCodeFieldID, keyCodetlvValue)); + final long indexFieldID = 0L; + BaseTLVType indextlvValue = new UIntType(index); + elements.add(new StructElement(indexFieldID, indextlvValue)); StructType commandArgs = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @Override public void onResponse(StructType invokeStructValue) { - final long statusFieldID = 0L; - Integer status = null; - for (StructElement element: invokeStructValue.value()) { - if (element.contextTagNum() == statusFieldID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - status = castingValue.value(Integer.class); - } - } - } - callback.onSuccess(status); + callback.onSuccess(); }}, commandId, commandArgs, timedInvokeTimeoutMs); } - public interface SendKeyResponseCallback extends BaseClusterCallback { - void onSuccess(Integer status); + public void renameOutput(DefaultClusterCallback callback, Integer index, String name) { + renameOutput(callback, index, name, 0); + } + + public void renameOutput(DefaultClusterCallback callback, Integer index, String name, int timedInvokeTimeoutMs) { + final long commandId = 1L; + + ArrayList elements = new ArrayList<>(); + final long indexFieldID = 0L; + BaseTLVType indextlvValue = new UIntType(index); + elements.add(new StructElement(indexFieldID, indextlvValue)); + + final long nameFieldID = 1L; + BaseTLVType nametlvValue = new StringType(name); + elements.add(new StructElement(nameFieldID, nametlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public interface OutputListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); } public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { @@ -57021,6 +58470,58 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } + public void readOutputListAttribute( + OutputListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, OUTPUT_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, OUTPUT_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeOutputListAttribute( + OutputListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, OUTPUT_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, OUTPUT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readCurrentOutputAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_OUTPUT_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CURRENT_OUTPUT_ATTRIBUTE_ID, true); + } + + public void subscribeCurrentOutputAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_OUTPUT_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CURRENT_OUTPUT_ATTRIBUTE_ID, minInterval, maxInterval); + } + public void readGeneratedCommandListAttribute( GeneratedCommandListAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); @@ -57178,11 +58679,11 @@ public void onSuccess(byte[] tlv) { } } - public static class ContentLauncherCluster extends BaseChipCluster { - public static final long CLUSTER_ID = 1290L; + public static class ApplicationLauncherCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 1292L; - private static final long ACCEPT_HEADER_ATTRIBUTE_ID = 0L; - private static final long SUPPORTED_STREAMING_PROTOCOLS_ATTRIBUTE_ID = 1L; + private static final long CATALOG_LIST_ATTRIBUTE_ID = 0L; + private static final long CURRENT_APP_ATTRIBUTE_ID = 1L; 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; @@ -57190,7 +58691,7 @@ public static class ContentLauncherCluster extends BaseChipCluster { private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; - public ContentLauncherCluster(long devicePtr, int endpointId) { + public ApplicationLauncherCluster(long devicePtr, int endpointId) { super(devicePtr, endpointId, CLUSTER_ID); } @@ -57200,34 +58701,22 @@ public long initWithDevice(long devicePtr, int endpointId) { return 0L; } - public void launchContent(LauncherResponseCallback callback, ChipStructs.ContentLauncherClusterContentSearchStruct search, Boolean autoPlay, Optional data, Optional playbackPreferences, Optional useCurrentContext) { - launchContent(callback, search, autoPlay, data, playbackPreferences, useCurrentContext, 0); + public void launchApp(LauncherResponseCallback callback, Optional application, Optional data) { + launchApp(callback, application, data, 0); } - public void launchContent(LauncherResponseCallback callback, ChipStructs.ContentLauncherClusterContentSearchStruct search, Boolean autoPlay, Optional data, Optional playbackPreferences, Optional useCurrentContext, int timedInvokeTimeoutMs) { + public void launchApp(LauncherResponseCallback callback, Optional application, Optional data, int timedInvokeTimeoutMs) { final long commandId = 0L; ArrayList elements = new ArrayList<>(); - final long searchFieldID = 0L; - BaseTLVType searchtlvValue = search.encodeTlv(); - elements.add(new StructElement(searchFieldID, searchtlvValue)); - - final long autoPlayFieldID = 1L; - BaseTLVType autoPlaytlvValue = new BooleanType(autoPlay); - elements.add(new StructElement(autoPlayFieldID, autoPlaytlvValue)); + final long applicationFieldID = 0L; + BaseTLVType applicationtlvValue = application.map((nonOptionalapplication) -> nonOptionalapplication.encodeTlv()).orElse(new EmptyType()); + elements.add(new StructElement(applicationFieldID, applicationtlvValue)); - final long dataFieldID = 2L; - BaseTLVType datatlvValue = data.map((nonOptionaldata) -> new StringType(nonOptionaldata)).orElse(new EmptyType()); + final long dataFieldID = 1L; + BaseTLVType datatlvValue = data.map((nonOptionaldata) -> new ByteArrayType(nonOptionaldata)).orElse(new EmptyType()); elements.add(new StructElement(dataFieldID, datatlvValue)); - final long playbackPreferencesFieldID = 3L; - BaseTLVType playbackPreferencestlvValue = playbackPreferences.map((nonOptionalplaybackPreferences) -> nonOptionalplaybackPreferences.encodeTlv()).orElse(new EmptyType()); - elements.add(new StructElement(playbackPreferencesFieldID, playbackPreferencestlvValue)); - - final long useCurrentContextFieldID = 4L; - BaseTLVType useCurrentContexttlvValue = useCurrentContext.map((nonOptionaluseCurrentContext) -> new BooleanType(nonOptionaluseCurrentContext)).orElse(new EmptyType()); - elements.add(new StructElement(useCurrentContextFieldID, useCurrentContexttlvValue)); - StructType commandArgs = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @Override @@ -57235,7 +58724,7 @@ public void onResponse(StructType invokeStructValue) { final long statusFieldID = 0L; Integer status = null; final long dataFieldID = 1L; - Optional data = Optional.empty(); + Optional data = Optional.empty(); for (StructElement element: invokeStructValue.value()) { if (element.contextTagNum() == statusFieldID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { @@ -57243,9 +58732,9 @@ public void onResponse(StructType invokeStructValue) { status = castingValue.value(Integer.class); } } else if (element.contextTagNum() == dataFieldID) { - if (element.value(BaseTLVType.class).type() == TLVType.String) { - StringType castingValue = element.value(StringType.class); - data = Optional.of(castingValue.value(String.class)); + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + data = Optional.of(castingValue.value(byte[].class)); } } } @@ -57253,25 +58742,54 @@ public void onResponse(StructType invokeStructValue) { }}, commandId, commandArgs, timedInvokeTimeoutMs); } - public void launchURL(LauncherResponseCallback callback, String contentURL, Optional displayString, Optional brandingInformation) { - launchURL(callback, contentURL, displayString, brandingInformation, 0); + public void stopApp(LauncherResponseCallback callback, Optional application) { + stopApp(callback, application, 0); } - public void launchURL(LauncherResponseCallback callback, String contentURL, Optional displayString, Optional brandingInformation, int timedInvokeTimeoutMs) { + public void stopApp(LauncherResponseCallback callback, Optional application, int timedInvokeTimeoutMs) { final long commandId = 1L; ArrayList elements = new ArrayList<>(); - final long contentURLFieldID = 0L; - BaseTLVType contentURLtlvValue = new StringType(contentURL); - elements.add(new StructElement(contentURLFieldID, contentURLtlvValue)); + final long applicationFieldID = 0L; + BaseTLVType applicationtlvValue = application.map((nonOptionalapplication) -> nonOptionalapplication.encodeTlv()).orElse(new EmptyType()); + elements.add(new StructElement(applicationFieldID, applicationtlvValue)); - final long displayStringFieldID = 1L; - BaseTLVType displayStringtlvValue = displayString.map((nonOptionaldisplayString) -> new StringType(nonOptionaldisplayString)).orElse(new EmptyType()); - elements.add(new StructElement(displayStringFieldID, displayStringtlvValue)); + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + final long statusFieldID = 0L; + Integer status = null; + final long dataFieldID = 1L; + Optional data = Optional.empty(); + for (StructElement element: invokeStructValue.value()) { + if (element.contextTagNum() == statusFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + status = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == dataFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + data = Optional.of(castingValue.value(byte[].class)); + } + } + } + callback.onSuccess(status, data); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } - final long brandingInformationFieldID = 2L; - BaseTLVType brandingInformationtlvValue = brandingInformation.map((nonOptionalbrandingInformation) -> nonOptionalbrandingInformation.encodeTlv()).orElse(new EmptyType()); - elements.add(new StructElement(brandingInformationFieldID, brandingInformationtlvValue)); + public void hideApp(LauncherResponseCallback callback, Optional application) { + hideApp(callback, application, 0); + } + + public void hideApp(LauncherResponseCallback callback, Optional application, int timedInvokeTimeoutMs) { + final long commandId = 2L; + + ArrayList elements = new ArrayList<>(); + final long applicationFieldID = 0L; + BaseTLVType applicationtlvValue = application.map((nonOptionalapplication) -> nonOptionalapplication.encodeTlv()).orElse(new EmptyType()); + elements.add(new StructElement(applicationFieldID, applicationtlvValue)); StructType commandArgs = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @@ -57280,7 +58798,7 @@ public void onResponse(StructType invokeStructValue) { final long statusFieldID = 0L; Integer status = null; final long dataFieldID = 1L; - Optional data = Optional.empty(); + Optional data = Optional.empty(); for (StructElement element: invokeStructValue.value()) { if (element.contextTagNum() == statusFieldID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { @@ -57288,9 +58806,9 @@ public void onResponse(StructType invokeStructValue) { status = castingValue.value(Integer.class); } } else if (element.contextTagNum() == dataFieldID) { - if (element.value(BaseTLVType.class).type() == TLVType.String) { - StringType castingValue = element.value(StringType.class); - data = Optional.of(castingValue.value(String.class)); + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + data = Optional.of(castingValue.value(byte[].class)); } } } @@ -57299,11 +58817,15 @@ public void onResponse(StructType invokeStructValue) { } public interface LauncherResponseCallback extends BaseClusterCallback { - void onSuccess(Integer status, Optional data); + void onSuccess(Integer status, Optional data); } - public interface AcceptHeaderAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + public interface CatalogListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface CurrentAppAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable ChipStructs.ApplicationLauncherClusterApplicationEPStruct value); } public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { @@ -57322,56 +58844,56 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } - public void readAcceptHeaderAttribute( - AcceptHeaderAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPT_HEADER_ATTRIBUTE_ID); + public void readCatalogListAttribute( + CatalogListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CATALOG_LIST_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); } - }, ACCEPT_HEADER_ATTRIBUTE_ID, true); + }, CATALOG_LIST_ATTRIBUTE_ID, true); } - public void subscribeAcceptHeaderAttribute( - AcceptHeaderAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPT_HEADER_ATTRIBUTE_ID); + public void subscribeCatalogListAttribute( + CatalogListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CATALOG_LIST_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); } - }, ACCEPT_HEADER_ATTRIBUTE_ID, minInterval, maxInterval); + }, CATALOG_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readSupportedStreamingProtocolsAttribute( - LongAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_STREAMING_PROTOCOLS_ATTRIBUTE_ID); + public void readCurrentAppAttribute( + CurrentAppAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_APP_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + @Nullable ChipStructs.ApplicationLauncherClusterApplicationEPStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, SUPPORTED_STREAMING_PROTOCOLS_ATTRIBUTE_ID, true); + }, CURRENT_APP_ATTRIBUTE_ID, true); } - public void subscribeSupportedStreamingProtocolsAttribute( - LongAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_STREAMING_PROTOCOLS_ATTRIBUTE_ID); + public void subscribeCurrentAppAttribute( + CurrentAppAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_APP_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + @Nullable ChipStructs.ApplicationLauncherClusterApplicationEPStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, SUPPORTED_STREAMING_PROTOCOLS_ATTRIBUTE_ID, minInterval, maxInterval); + }, CURRENT_APP_ATTRIBUTE_ID, minInterval, maxInterval); } public void readGeneratedCommandListAttribute( @@ -57531,11 +59053,17 @@ public void onSuccess(byte[] tlv) { } } - public static class AudioOutputCluster extends BaseChipCluster { - public static final long CLUSTER_ID = 1291L; + public static class ApplicationBasicCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 1293L; - private static final long OUTPUT_LIST_ATTRIBUTE_ID = 0L; - private static final long CURRENT_OUTPUT_ATTRIBUTE_ID = 1L; + private static final long VENDOR_NAME_ATTRIBUTE_ID = 0L; + private static final long VENDOR_I_D_ATTRIBUTE_ID = 1L; + private static final long APPLICATION_NAME_ATTRIBUTE_ID = 2L; + private static final long PRODUCT_I_D_ATTRIBUTE_ID = 3L; + private static final long APPLICATION_ATTRIBUTE_ID = 4L; + private static final long STATUS_ATTRIBUTE_ID = 5L; + private static final long APPLICATION_VERSION_ATTRIBUTE_ID = 6L; + private static final long ALLOWED_VENDOR_LIST_ATTRIBUTE_ID = 7L; 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; @@ -57543,7 +59071,7 @@ public static class AudioOutputCluster extends BaseChipCluster { private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; - public AudioOutputCluster(long devicePtr, int endpointId) { + public ApplicationBasicCluster(long devicePtr, int endpointId) { super(devicePtr, endpointId, CLUSTER_ID); } @@ -57553,99 +59081,163 @@ public long initWithDevice(long devicePtr, int endpointId) { return 0L; } - public void selectOutput(DefaultClusterCallback callback, Integer index) { - selectOutput(callback, index, 0); + public interface ApplicationAttributeCallback extends BaseAttributeCallback { + void onSuccess(ChipStructs.ApplicationBasicClusterApplicationStruct value); } - public void selectOutput(DefaultClusterCallback callback, Integer index, int timedInvokeTimeoutMs) { - final long commandId = 0L; + public interface AllowedVendorListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } - ArrayList elements = new ArrayList<>(); - final long indexFieldID = 0L; - BaseTLVType indextlvValue = new UIntType(index); - elements.add(new StructElement(indexFieldID, indextlvValue)); + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); + public interface AcceptedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); } - public void renameOutput(DefaultClusterCallback callback, Integer index, String name) { - renameOutput(callback, index, name, 0); + public interface EventListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); } - public void renameOutput(DefaultClusterCallback callback, Integer index, String name, int timedInvokeTimeoutMs) { - final long commandId = 1L; + public interface AttributeListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } - ArrayList elements = new ArrayList<>(); - final long indexFieldID = 0L; - BaseTLVType indextlvValue = new UIntType(index); - elements.add(new StructElement(indexFieldID, indextlvValue)); + public void readVendorNameAttribute( + CharStringAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_NAME_ATTRIBUTE_ID); - final long nameFieldID = 1L; - BaseTLVType nametlvValue = new StringType(name); - elements.add(new StructElement(nameFieldID, nametlvValue)); + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, VENDOR_NAME_ATTRIBUTE_ID, true); + } - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { + public void subscribeVendorNameAttribute( + CharStringAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_NAME_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); + public void onSuccess(byte[] tlv) { + String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, VENDOR_NAME_ATTRIBUTE_ID, minInterval, maxInterval); } - public interface OutputListAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + public void readVendorIDAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_I_D_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, VENDOR_I_D_ATTRIBUTE_ID, true); } - public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + public void subscribeVendorIDAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_I_D_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, VENDOR_I_D_ATTRIBUTE_ID, minInterval, maxInterval); } - public interface AcceptedCommandListAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + public void readApplicationNameAttribute( + CharStringAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPLICATION_NAME_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, APPLICATION_NAME_ATTRIBUTE_ID, true); } - public interface EventListAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + public void subscribeApplicationNameAttribute( + CharStringAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPLICATION_NAME_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, APPLICATION_NAME_ATTRIBUTE_ID, minInterval, maxInterval); } - public interface AttributeListAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + public void readProductIDAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_I_D_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, PRODUCT_I_D_ATTRIBUTE_ID, true); } - public void readOutputListAttribute( - OutputListAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, OUTPUT_LIST_ATTRIBUTE_ID); + public void subscribeProductIDAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_I_D_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, PRODUCT_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readApplicationAttribute( + ApplicationAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPLICATION_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + ChipStructs.ApplicationBasicClusterApplicationStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, OUTPUT_LIST_ATTRIBUTE_ID, true); + }, APPLICATION_ATTRIBUTE_ID, true); } - public void subscribeOutputListAttribute( - OutputListAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, OUTPUT_LIST_ATTRIBUTE_ID); + public void subscribeApplicationAttribute( + ApplicationAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPLICATION_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + ChipStructs.ApplicationBasicClusterApplicationStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, OUTPUT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + }, APPLICATION_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readCurrentOutputAttribute( + public void readStatusAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_OUTPUT_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, STATUS_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -57653,12 +59245,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, CURRENT_OUTPUT_ATTRIBUTE_ID, true); + }, STATUS_ATTRIBUTE_ID, true); } - public void subscribeCurrentOutputAttribute( + public void subscribeStatusAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_OUTPUT_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, STATUS_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -57666,7 +59258,59 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, CURRENT_OUTPUT_ATTRIBUTE_ID, minInterval, maxInterval); + }, STATUS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readApplicationVersionAttribute( + CharStringAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPLICATION_VERSION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, APPLICATION_VERSION_ATTRIBUTE_ID, true); + } + + public void subscribeApplicationVersionAttribute( + CharStringAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPLICATION_VERSION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, APPLICATION_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAllowedVendorListAttribute( + AllowedVendorListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ALLOWED_VENDOR_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ALLOWED_VENDOR_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAllowedVendorListAttribute( + AllowedVendorListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ALLOWED_VENDOR_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ALLOWED_VENDOR_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } public void readGeneratedCommandListAttribute( @@ -57826,11 +59470,9 @@ public void onSuccess(byte[] tlv) { } } - public static class ApplicationLauncherCluster extends BaseChipCluster { - public static final long CLUSTER_ID = 1292L; + public static class AccountLoginCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 1294L; - private static final long CATALOG_LIST_ATTRIBUTE_ID = 0L; - private static final long CURRENT_APP_ATTRIBUTE_ID = 1L; 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; @@ -57838,7 +59480,7 @@ public static class ApplicationLauncherCluster extends BaseChipCluster { private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; - public ApplicationLauncherCluster(long devicePtr, int endpointId) { + public AccountLoginCluster(long devicePtr, int endpointId) { super(devicePtr, endpointId, CLUSTER_ID); } @@ -57848,131 +59490,77 @@ public long initWithDevice(long devicePtr, int endpointId) { return 0L; } - public void launchApp(LauncherResponseCallback callback, Optional application, Optional data) { - launchApp(callback, application, data, 0); - } - public void launchApp(LauncherResponseCallback callback, Optional application, Optional data, int timedInvokeTimeoutMs) { + public void getSetupPIN(GetSetupPINResponseCallback callback, String tempAccountIdentifier, int timedInvokeTimeoutMs) { final long commandId = 0L; ArrayList elements = new ArrayList<>(); - final long applicationFieldID = 0L; - BaseTLVType applicationtlvValue = application.map((nonOptionalapplication) -> nonOptionalapplication.encodeTlv()).orElse(new EmptyType()); - elements.add(new StructElement(applicationFieldID, applicationtlvValue)); - - final long dataFieldID = 1L; - BaseTLVType datatlvValue = data.map((nonOptionaldata) -> new ByteArrayType(nonOptionaldata)).orElse(new EmptyType()); - elements.add(new StructElement(dataFieldID, datatlvValue)); + final long tempAccountIdentifierFieldID = 0L; + BaseTLVType tempAccountIdentifiertlvValue = new StringType(tempAccountIdentifier); + elements.add(new StructElement(tempAccountIdentifierFieldID, tempAccountIdentifiertlvValue)); StructType commandArgs = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @Override public void onResponse(StructType invokeStructValue) { - final long statusFieldID = 0L; - Integer status = null; - final long dataFieldID = 1L; - Optional data = Optional.empty(); + final long setupPINFieldID = 0L; + String setupPIN = null; for (StructElement element: invokeStructValue.value()) { - if (element.contextTagNum() == statusFieldID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - status = castingValue.value(Integer.class); - } - } else if (element.contextTagNum() == dataFieldID) { - if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { - ByteArrayType castingValue = element.value(ByteArrayType.class); - data = Optional.of(castingValue.value(byte[].class)); + if (element.contextTagNum() == setupPINFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + setupPIN = castingValue.value(String.class); } } } - callback.onSuccess(status, data); + callback.onSuccess(setupPIN); }}, commandId, commandArgs, timedInvokeTimeoutMs); } - public void stopApp(LauncherResponseCallback callback, Optional application) { - stopApp(callback, application, 0); - } - public void stopApp(LauncherResponseCallback callback, Optional application, int timedInvokeTimeoutMs) { - final long commandId = 1L; + public void login(DefaultClusterCallback callback, String tempAccountIdentifier, String setupPIN, Optional node, int timedInvokeTimeoutMs) { + final long commandId = 2L; ArrayList elements = new ArrayList<>(); - final long applicationFieldID = 0L; - BaseTLVType applicationtlvValue = application.map((nonOptionalapplication) -> nonOptionalapplication.encodeTlv()).orElse(new EmptyType()); - elements.add(new StructElement(applicationFieldID, applicationtlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - final long statusFieldID = 0L; - Integer status = null; - final long dataFieldID = 1L; - Optional data = Optional.empty(); - for (StructElement element: invokeStructValue.value()) { - if (element.contextTagNum() == statusFieldID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - status = castingValue.value(Integer.class); - } - } else if (element.contextTagNum() == dataFieldID) { - if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { - ByteArrayType castingValue = element.value(ByteArrayType.class); - data = Optional.of(castingValue.value(byte[].class)); - } - } - } - callback.onSuccess(status, data); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void hideApp(LauncherResponseCallback callback, Optional application) { - hideApp(callback, application, 0); - } + final long tempAccountIdentifierFieldID = 0L; + BaseTLVType tempAccountIdentifiertlvValue = new StringType(tempAccountIdentifier); + elements.add(new StructElement(tempAccountIdentifierFieldID, tempAccountIdentifiertlvValue)); - public void hideApp(LauncherResponseCallback callback, Optional application, int timedInvokeTimeoutMs) { - final long commandId = 2L; + final long setupPINFieldID = 1L; + BaseTLVType setupPINtlvValue = new StringType(setupPIN); + elements.add(new StructElement(setupPINFieldID, setupPINtlvValue)); - ArrayList elements = new ArrayList<>(); - final long applicationFieldID = 0L; - BaseTLVType applicationtlvValue = application.map((nonOptionalapplication) -> nonOptionalapplication.encodeTlv()).orElse(new EmptyType()); - elements.add(new StructElement(applicationFieldID, applicationtlvValue)); + final long nodeFieldID = 2L; + BaseTLVType nodetlvValue = node.map((nonOptionalnode) -> new UIntType(nonOptionalnode)).orElse(new EmptyType()); + elements.add(new StructElement(nodeFieldID, nodetlvValue)); StructType commandArgs = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @Override public void onResponse(StructType invokeStructValue) { - final long statusFieldID = 0L; - Integer status = null; - final long dataFieldID = 1L; - Optional data = Optional.empty(); - for (StructElement element: invokeStructValue.value()) { - if (element.contextTagNum() == statusFieldID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - status = castingValue.value(Integer.class); - } - } else if (element.contextTagNum() == dataFieldID) { - if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { - ByteArrayType castingValue = element.value(ByteArrayType.class); - data = Optional.of(castingValue.value(byte[].class)); - } - } - } - callback.onSuccess(status, data); + callback.onSuccess(); }}, commandId, commandArgs, timedInvokeTimeoutMs); } - public interface LauncherResponseCallback extends BaseClusterCallback { - void onSuccess(Integer status, Optional data); - } - public interface CatalogListAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + public void logout(DefaultClusterCallback callback, Optional node, int timedInvokeTimeoutMs) { + final long commandId = 3L; + + ArrayList elements = new ArrayList<>(); + final long nodeFieldID = 0L; + BaseTLVType nodetlvValue = node.map((nonOptionalnode) -> new UIntType(nonOptionalnode)).orElse(new EmptyType()); + elements.add(new StructElement(nodeFieldID, nodetlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); } - public interface CurrentAppAttributeCallback extends BaseAttributeCallback { - void onSuccess(@Nullable ChipStructs.ApplicationLauncherClusterApplicationEPStruct value); + public interface GetSetupPINResponseCallback extends BaseClusterCallback { + void onSuccess(String setupPIN); } public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { @@ -57991,58 +59579,6 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } - public void readCatalogListAttribute( - CatalogListAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CATALOG_LIST_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, CATALOG_LIST_ATTRIBUTE_ID, true); - } - - public void subscribeCatalogListAttribute( - CatalogListAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CATALOG_LIST_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, CATALOG_LIST_ATTRIBUTE_ID, minInterval, maxInterval); - } - - public void readCurrentAppAttribute( - CurrentAppAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_APP_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - @Nullable ChipStructs.ApplicationLauncherClusterApplicationEPStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, CURRENT_APP_ATTRIBUTE_ID, true); - } - - public void subscribeCurrentAppAttribute( - CurrentAppAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_APP_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - @Nullable ChipStructs.ApplicationLauncherClusterApplicationEPStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, CURRENT_APP_ATTRIBUTE_ID, minInterval, maxInterval); - } - public void readGeneratedCommandListAttribute( GeneratedCommandListAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); @@ -58200,17 +59736,17 @@ public void onSuccess(byte[] tlv) { } } - public static class ApplicationBasicCluster extends BaseChipCluster { - public static final long CLUSTER_ID = 1293L; + public static class ContentControlCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 1295L; - private static final long VENDOR_NAME_ATTRIBUTE_ID = 0L; - private static final long VENDOR_I_D_ATTRIBUTE_ID = 1L; - private static final long APPLICATION_NAME_ATTRIBUTE_ID = 2L; - private static final long PRODUCT_I_D_ATTRIBUTE_ID = 3L; - private static final long APPLICATION_ATTRIBUTE_ID = 4L; - private static final long STATUS_ATTRIBUTE_ID = 5L; - private static final long APPLICATION_VERSION_ATTRIBUTE_ID = 6L; - private static final long ALLOWED_VENDOR_LIST_ATTRIBUTE_ID = 7L; + private static final long ENABLED_ATTRIBUTE_ID = 0L; + private static final long ON_DEMAND_RATINGS_ATTRIBUTE_ID = 1L; + private static final long ON_DEMAND_RATING_THRESHOLD_ATTRIBUTE_ID = 2L; + private static final long SCHEDULED_CONTENT_RATINGS_ATTRIBUTE_ID = 3L; + private static final long SCHEDULED_CONTENT_RATING_THRESHOLD_ATTRIBUTE_ID = 4L; + private static final long SCREEN_DAILY_TIME_ATTRIBUTE_ID = 5L; + private static final long REMAINING_SCREEN_TIME_ATTRIBUTE_ID = 6L; + private static final long BLOCK_UNRATED_ATTRIBUTE_ID = 7L; 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; @@ -58218,7 +59754,7 @@ public static class ApplicationBasicCluster extends BaseChipCluster { private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; - public ApplicationBasicCluster(long devicePtr, int endpointId) { + public ContentControlCluster(long devicePtr, int endpointId) { super(devicePtr, endpointId, CLUSTER_ID); } @@ -58228,12 +59764,214 @@ public long initWithDevice(long devicePtr, int endpointId) { return 0L; } - public interface ApplicationAttributeCallback extends BaseAttributeCallback { - void onSuccess(ChipStructs.ApplicationBasicClusterApplicationStruct value); + public void updatePIN(DefaultClusterCallback callback, Optional oldPIN, String newPIN) { + updatePIN(callback, oldPIN, newPIN, 0); } - public interface AllowedVendorListAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + public void updatePIN(DefaultClusterCallback callback, Optional oldPIN, String newPIN, int timedInvokeTimeoutMs) { + final long commandId = 0L; + + ArrayList elements = new ArrayList<>(); + final long oldPINFieldID = 0L; + BaseTLVType oldPINtlvValue = oldPIN.map((nonOptionaloldPIN) -> new StringType(nonOptionaloldPIN)).orElse(new EmptyType()); + elements.add(new StructElement(oldPINFieldID, oldPINtlvValue)); + + final long newPINFieldID = 1L; + BaseTLVType newPINtlvValue = new StringType(newPIN); + elements.add(new StructElement(newPINFieldID, newPINtlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void resetPIN(ResetPINResponseCallback callback) { + resetPIN(callback, 0); + } + + public void resetPIN(ResetPINResponseCallback callback, int timedInvokeTimeoutMs) { + final long commandId = 1L; + + ArrayList elements = new ArrayList<>(); + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + final long PINCodeFieldID = 0L; + String PINCode = null; + for (StructElement element: invokeStructValue.value()) { + if (element.contextTagNum() == PINCodeFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + PINCode = castingValue.value(String.class); + } + } + } + callback.onSuccess(PINCode); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void enable(DefaultClusterCallback callback) { + enable(callback, 0); + } + + public void enable(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + final long commandId = 3L; + + ArrayList elements = new ArrayList<>(); + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void disable(DefaultClusterCallback callback) { + disable(callback, 0); + } + + public void disable(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + final long commandId = 4L; + + ArrayList elements = new ArrayList<>(); + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void addBonusTime(DefaultClusterCallback callback, Optional PINCode, Optional bonusTime) { + addBonusTime(callback, PINCode, bonusTime, 0); + } + + public void addBonusTime(DefaultClusterCallback callback, Optional PINCode, Optional bonusTime, int timedInvokeTimeoutMs) { + final long commandId = 5L; + + ArrayList elements = new ArrayList<>(); + final long PINCodeFieldID = 0L; + BaseTLVType PINCodetlvValue = PINCode.map((nonOptionalPINCode) -> new StringType(nonOptionalPINCode)).orElse(new EmptyType()); + elements.add(new StructElement(PINCodeFieldID, PINCodetlvValue)); + + final long bonusTimeFieldID = 1L; + BaseTLVType bonusTimetlvValue = bonusTime.map((nonOptionalbonusTime) -> new UIntType(nonOptionalbonusTime)).orElse(new EmptyType()); + elements.add(new StructElement(bonusTimeFieldID, bonusTimetlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void setScreenDailyTime(DefaultClusterCallback callback, Long screenTime) { + setScreenDailyTime(callback, screenTime, 0); + } + + public void setScreenDailyTime(DefaultClusterCallback callback, Long screenTime, int timedInvokeTimeoutMs) { + final long commandId = 6L; + + ArrayList elements = new ArrayList<>(); + final long screenTimeFieldID = 0L; + BaseTLVType screenTimetlvValue = new UIntType(screenTime); + elements.add(new StructElement(screenTimeFieldID, screenTimetlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void blockUnratedContent(DefaultClusterCallback callback) { + blockUnratedContent(callback, 0); + } + + public void blockUnratedContent(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + final long commandId = 7L; + + ArrayList elements = new ArrayList<>(); + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void unblockUnratedContent(DefaultClusterCallback callback) { + unblockUnratedContent(callback, 0); + } + + public void unblockUnratedContent(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { + final long commandId = 8L; + + ArrayList elements = new ArrayList<>(); + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void setOnDemandRatingThreshold(DefaultClusterCallback callback, String rating) { + setOnDemandRatingThreshold(callback, rating, 0); + } + + public void setOnDemandRatingThreshold(DefaultClusterCallback callback, String rating, int timedInvokeTimeoutMs) { + final long commandId = 9L; + + ArrayList elements = new ArrayList<>(); + final long ratingFieldID = 0L; + BaseTLVType ratingtlvValue = new StringType(rating); + elements.add(new StructElement(ratingFieldID, ratingtlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void setScheduledContentRatingThreshold(DefaultClusterCallback callback, String rating) { + setScheduledContentRatingThreshold(callback, rating, 0); + } + + public void setScheduledContentRatingThreshold(DefaultClusterCallback callback, String rating, int timedInvokeTimeoutMs) { + final long commandId = 10L; + + ArrayList elements = new ArrayList<>(); + final long ratingFieldID = 0L; + BaseTLVType ratingtlvValue = new StringType(rating); + elements.add(new StructElement(ratingFieldID, ratingtlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public interface ResetPINResponseCallback extends BaseClusterCallback { + void onSuccess(String PINCode); + } + + public interface OnDemandRatingsAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface ScheduledContentRatingsAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); } public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { @@ -58252,61 +59990,61 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } - public void readVendorNameAttribute( - CharStringAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_NAME_ATTRIBUTE_ID); + public void readEnabledAttribute( + BooleanAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ENABLED_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, VENDOR_NAME_ATTRIBUTE_ID, true); + }, ENABLED_ATTRIBUTE_ID, true); } - public void subscribeVendorNameAttribute( - CharStringAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_NAME_ATTRIBUTE_ID); + public void subscribeEnabledAttribute( + BooleanAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ENABLED_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, VENDOR_NAME_ATTRIBUTE_ID, minInterval, maxInterval); + }, ENABLED_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readVendorIDAttribute( - IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_I_D_ATTRIBUTE_ID); + public void readOnDemandRatingsAttribute( + OnDemandRatingsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ON_DEMAND_RATINGS_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, VENDOR_I_D_ATTRIBUTE_ID, true); + }, ON_DEMAND_RATINGS_ATTRIBUTE_ID, true); } - public void subscribeVendorIDAttribute( - IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_I_D_ATTRIBUTE_ID); + public void subscribeOnDemandRatingsAttribute( + OnDemandRatingsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ON_DEMAND_RATINGS_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, VENDOR_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, ON_DEMAND_RATINGS_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readApplicationNameAttribute( + public void readOnDemandRatingThresholdAttribute( CharStringAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPLICATION_NAME_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ON_DEMAND_RATING_THRESHOLD_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -58314,12 +60052,12 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, APPLICATION_NAME_ATTRIBUTE_ID, true); + }, ON_DEMAND_RATING_THRESHOLD_ATTRIBUTE_ID, true); } - public void subscribeApplicationNameAttribute( + public void subscribeOnDemandRatingThresholdAttribute( CharStringAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPLICATION_NAME_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ON_DEMAND_RATING_THRESHOLD_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -58327,137 +60065,137 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, APPLICATION_NAME_ATTRIBUTE_ID, minInterval, maxInterval); + }, ON_DEMAND_RATING_THRESHOLD_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readProductIDAttribute( - IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_I_D_ATTRIBUTE_ID); + public void readScheduledContentRatingsAttribute( + ScheduledContentRatingsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SCHEDULED_CONTENT_RATINGS_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, PRODUCT_I_D_ATTRIBUTE_ID, true); + }, SCHEDULED_CONTENT_RATINGS_ATTRIBUTE_ID, true); } - public void subscribeProductIDAttribute( - IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_I_D_ATTRIBUTE_ID); + public void subscribeScheduledContentRatingsAttribute( + ScheduledContentRatingsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SCHEDULED_CONTENT_RATINGS_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, PRODUCT_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, SCHEDULED_CONTENT_RATINGS_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readApplicationAttribute( - ApplicationAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPLICATION_ATTRIBUTE_ID); + public void readScheduledContentRatingThresholdAttribute( + CharStringAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SCHEDULED_CONTENT_RATING_THRESHOLD_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - ChipStructs.ApplicationBasicClusterApplicationStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, APPLICATION_ATTRIBUTE_ID, true); + }, SCHEDULED_CONTENT_RATING_THRESHOLD_ATTRIBUTE_ID, true); } - public void subscribeApplicationAttribute( - ApplicationAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPLICATION_ATTRIBUTE_ID); + public void subscribeScheduledContentRatingThresholdAttribute( + CharStringAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SCHEDULED_CONTENT_RATING_THRESHOLD_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - ChipStructs.ApplicationBasicClusterApplicationStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, APPLICATION_ATTRIBUTE_ID, minInterval, maxInterval); + }, SCHEDULED_CONTENT_RATING_THRESHOLD_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readStatusAttribute( - IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, STATUS_ATTRIBUTE_ID); + public void readScreenDailyTimeAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SCREEN_DAILY_TIME_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, STATUS_ATTRIBUTE_ID, true); + }, SCREEN_DAILY_TIME_ATTRIBUTE_ID, true); } - public void subscribeStatusAttribute( - IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, STATUS_ATTRIBUTE_ID); + public void subscribeScreenDailyTimeAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SCREEN_DAILY_TIME_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, STATUS_ATTRIBUTE_ID, minInterval, maxInterval); + }, SCREEN_DAILY_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readApplicationVersionAttribute( - CharStringAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPLICATION_VERSION_ATTRIBUTE_ID); + public void readRemainingScreenTimeAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REMAINING_SCREEN_TIME_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, APPLICATION_VERSION_ATTRIBUTE_ID, true); + }, REMAINING_SCREEN_TIME_ATTRIBUTE_ID, true); } - public void subscribeApplicationVersionAttribute( - CharStringAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPLICATION_VERSION_ATTRIBUTE_ID); + public void subscribeRemainingScreenTimeAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REMAINING_SCREEN_TIME_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, APPLICATION_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); + }, REMAINING_SCREEN_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readAllowedVendorListAttribute( - AllowedVendorListAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ALLOWED_VENDOR_LIST_ATTRIBUTE_ID); + public void readBlockUnratedAttribute( + BooleanAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BLOCK_UNRATED_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, ALLOWED_VENDOR_LIST_ATTRIBUTE_ID, true); + }, BLOCK_UNRATED_ATTRIBUTE_ID, true); } - public void subscribeAllowedVendorListAttribute( - AllowedVendorListAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ALLOWED_VENDOR_LIST_ATTRIBUTE_ID); + public void subscribeBlockUnratedAttribute( + BooleanAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BLOCK_UNRATED_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, ALLOWED_VENDOR_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + }, BLOCK_UNRATED_ATTRIBUTE_ID, minInterval, maxInterval); } public void readGeneratedCommandListAttribute( @@ -58617,8 +60355,8 @@ public void onSuccess(byte[] tlv) { } } - public static class AccountLoginCluster extends BaseChipCluster { - public static final long CLUSTER_ID = 1294L; + public static class ContentAppObserverCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 1296L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; @@ -58627,87 +60365,66 @@ public static class AccountLoginCluster extends BaseChipCluster { private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; - public AccountLoginCluster(long devicePtr, int endpointId) { + public ContentAppObserverCluster(long devicePtr, int endpointId) { super(devicePtr, endpointId, CLUSTER_ID); } - @Override - @Deprecated - public long initWithDevice(long devicePtr, int endpointId) { - return 0L; - } - - - public void getSetupPIN(GetSetupPINResponseCallback callback, String tempAccountIdentifier, int timedInvokeTimeoutMs) { - final long commandId = 0L; - - ArrayList elements = new ArrayList<>(); - final long tempAccountIdentifierFieldID = 0L; - BaseTLVType tempAccountIdentifiertlvValue = new StringType(tempAccountIdentifier); - elements.add(new StructElement(tempAccountIdentifierFieldID, tempAccountIdentifiertlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - final long setupPINFieldID = 0L; - String setupPIN = null; - for (StructElement element: invokeStructValue.value()) { - if (element.contextTagNum() == setupPINFieldID) { - if (element.value(BaseTLVType.class).type() == TLVType.String) { - StringType castingValue = element.value(StringType.class); - setupPIN = castingValue.value(String.class); - } - } - } - callback.onSuccess(setupPIN); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - - public void login(DefaultClusterCallback callback, String tempAccountIdentifier, String setupPIN, Optional node, int timedInvokeTimeoutMs) { - final long commandId = 2L; - - ArrayList elements = new ArrayList<>(); - final long tempAccountIdentifierFieldID = 0L; - BaseTLVType tempAccountIdentifiertlvValue = new StringType(tempAccountIdentifier); - elements.add(new StructElement(tempAccountIdentifierFieldID, tempAccountIdentifiertlvValue)); - - final long setupPINFieldID = 1L; - BaseTLVType setupPINtlvValue = new StringType(setupPIN); - elements.add(new StructElement(setupPINFieldID, setupPINtlvValue)); - - final long nodeFieldID = 2L; - BaseTLVType nodetlvValue = node.map((nonOptionalnode) -> new UIntType(nonOptionalnode)).orElse(new EmptyType()); - elements.add(new StructElement(nodeFieldID, nodetlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); + @Override + @Deprecated + public long initWithDevice(long devicePtr, int endpointId) { + return 0L; } + public void contentAppMessage(ContentAppMessageResponseCallback callback, Optional data, String encodingHint) { + contentAppMessage(callback, data, encodingHint, 0); + } - public void logout(DefaultClusterCallback callback, Optional node, int timedInvokeTimeoutMs) { - final long commandId = 3L; + public void contentAppMessage(ContentAppMessageResponseCallback callback, Optional data, String encodingHint, int timedInvokeTimeoutMs) { + final long commandId = 0L; ArrayList elements = new ArrayList<>(); - final long nodeFieldID = 0L; - BaseTLVType nodetlvValue = node.map((nonOptionalnode) -> new UIntType(nonOptionalnode)).orElse(new EmptyType()); - elements.add(new StructElement(nodeFieldID, nodetlvValue)); + final long dataFieldID = 0L; + BaseTLVType datatlvValue = data.map((nonOptionaldata) -> new StringType(nonOptionaldata)).orElse(new EmptyType()); + elements.add(new StructElement(dataFieldID, datatlvValue)); + + final long encodingHintFieldID = 1L; + BaseTLVType encodingHinttlvValue = new StringType(encodingHint); + elements.add(new StructElement(encodingHintFieldID, encodingHinttlvValue)); StructType commandArgs = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @Override public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); + final long statusFieldID = 0L; + Integer status = null; + final long dataFieldID = 1L; + Optional data = Optional.empty(); + final long encodingHintFieldID = 2L; + Optional encodingHint = Optional.empty(); + for (StructElement element: invokeStructValue.value()) { + if (element.contextTagNum() == statusFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + status = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == dataFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + data = Optional.of(castingValue.value(String.class)); + } + } else if (element.contextTagNum() == encodingHintFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + encodingHint = Optional.of(castingValue.value(String.class)); + } + } + } + callback.onSuccess(status, data, encodingHint); }}, commandId, commandArgs, timedInvokeTimeoutMs); } - public interface GetSetupPINResponseCallback extends BaseClusterCallback { - void onSuccess(String setupPIN); + public interface ContentAppMessageResponseCallback extends BaseClusterCallback { + void onSuccess(Integer status, Optional data, Optional encodingHint); } public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { @@ -58883,17 +60600,12 @@ public void onSuccess(byte[] tlv) { } } - public static class ContentControlCluster extends BaseChipCluster { - public static final long CLUSTER_ID = 1295L; + public static class EcosystemInformationCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 1872L; - private static final long ENABLED_ATTRIBUTE_ID = 0L; - private static final long ON_DEMAND_RATINGS_ATTRIBUTE_ID = 1L; - private static final long ON_DEMAND_RATING_THRESHOLD_ATTRIBUTE_ID = 2L; - private static final long SCHEDULED_CONTENT_RATINGS_ATTRIBUTE_ID = 3L; - private static final long SCHEDULED_CONTENT_RATING_THRESHOLD_ATTRIBUTE_ID = 4L; - private static final long SCREEN_DAILY_TIME_ATTRIBUTE_ID = 5L; - private static final long REMAINING_SCREEN_TIME_ATTRIBUTE_ID = 6L; - private static final long BLOCK_UNRATED_ATTRIBUTE_ID = 7L; + private static final long REMOVED_ON_ATTRIBUTE_ID = 0L; + private static final long DEVICE_DIRECTORY_ATTRIBUTE_ID = 1L; + private static final long LOCATION_DIRECTORY_ATTRIBUTE_ID = 2L; 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; @@ -58901,7 +60613,7 @@ public static class ContentControlCluster extends BaseChipCluster { private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; - public ContentControlCluster(long devicePtr, int endpointId) { + public EcosystemInformationCluster(long devicePtr, int endpointId) { super(devicePtr, endpointId, CLUSTER_ID); } @@ -58911,214 +60623,16 @@ public long initWithDevice(long devicePtr, int endpointId) { return 0L; } - public void updatePIN(DefaultClusterCallback callback, Optional oldPIN, String newPIN) { - updatePIN(callback, oldPIN, newPIN, 0); - } - - public void updatePIN(DefaultClusterCallback callback, Optional oldPIN, String newPIN, int timedInvokeTimeoutMs) { - final long commandId = 0L; - - ArrayList elements = new ArrayList<>(); - final long oldPINFieldID = 0L; - BaseTLVType oldPINtlvValue = oldPIN.map((nonOptionaloldPIN) -> new StringType(nonOptionaloldPIN)).orElse(new EmptyType()); - elements.add(new StructElement(oldPINFieldID, oldPINtlvValue)); - - final long newPINFieldID = 1L; - BaseTLVType newPINtlvValue = new StringType(newPIN); - elements.add(new StructElement(newPINFieldID, newPINtlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void resetPIN(ResetPINResponseCallback callback) { - resetPIN(callback, 0); - } - - public void resetPIN(ResetPINResponseCallback callback, int timedInvokeTimeoutMs) { - final long commandId = 1L; - - ArrayList elements = new ArrayList<>(); - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - final long PINCodeFieldID = 0L; - String PINCode = null; - for (StructElement element: invokeStructValue.value()) { - if (element.contextTagNum() == PINCodeFieldID) { - if (element.value(BaseTLVType.class).type() == TLVType.String) { - StringType castingValue = element.value(StringType.class); - PINCode = castingValue.value(String.class); - } - } - } - callback.onSuccess(PINCode); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void enable(DefaultClusterCallback callback) { - enable(callback, 0); - } - - public void enable(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { - final long commandId = 3L; - - ArrayList elements = new ArrayList<>(); - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void disable(DefaultClusterCallback callback) { - disable(callback, 0); - } - - public void disable(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { - final long commandId = 4L; - - ArrayList elements = new ArrayList<>(); - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void addBonusTime(DefaultClusterCallback callback, Optional PINCode, Optional bonusTime) { - addBonusTime(callback, PINCode, bonusTime, 0); - } - - public void addBonusTime(DefaultClusterCallback callback, Optional PINCode, Optional bonusTime, int timedInvokeTimeoutMs) { - final long commandId = 5L; - - ArrayList elements = new ArrayList<>(); - final long PINCodeFieldID = 0L; - BaseTLVType PINCodetlvValue = PINCode.map((nonOptionalPINCode) -> new StringType(nonOptionalPINCode)).orElse(new EmptyType()); - elements.add(new StructElement(PINCodeFieldID, PINCodetlvValue)); - - final long bonusTimeFieldID = 1L; - BaseTLVType bonusTimetlvValue = bonusTime.map((nonOptionalbonusTime) -> new UIntType(nonOptionalbonusTime)).orElse(new EmptyType()); - elements.add(new StructElement(bonusTimeFieldID, bonusTimetlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void setScreenDailyTime(DefaultClusterCallback callback, Long screenTime) { - setScreenDailyTime(callback, screenTime, 0); - } - - public void setScreenDailyTime(DefaultClusterCallback callback, Long screenTime, int timedInvokeTimeoutMs) { - final long commandId = 6L; - - ArrayList elements = new ArrayList<>(); - final long screenTimeFieldID = 0L; - BaseTLVType screenTimetlvValue = new UIntType(screenTime); - elements.add(new StructElement(screenTimeFieldID, screenTimetlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void blockUnratedContent(DefaultClusterCallback callback) { - blockUnratedContent(callback, 0); - } - - public void blockUnratedContent(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { - final long commandId = 7L; - - ArrayList elements = new ArrayList<>(); - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void unblockUnratedContent(DefaultClusterCallback callback) { - unblockUnratedContent(callback, 0); - } - - public void unblockUnratedContent(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { - final long commandId = 8L; - - ArrayList elements = new ArrayList<>(); - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void setOnDemandRatingThreshold(DefaultClusterCallback callback, String rating) { - setOnDemandRatingThreshold(callback, rating, 0); - } - - public void setOnDemandRatingThreshold(DefaultClusterCallback callback, String rating, int timedInvokeTimeoutMs) { - final long commandId = 9L; - - ArrayList elements = new ArrayList<>(); - final long ratingFieldID = 0L; - BaseTLVType ratingtlvValue = new StringType(rating); - elements.add(new StructElement(ratingFieldID, ratingtlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void setScheduledContentRatingThreshold(DefaultClusterCallback callback, String rating) { - setScheduledContentRatingThreshold(callback, rating, 0); - } - - public void setScheduledContentRatingThreshold(DefaultClusterCallback callback, String rating, int timedInvokeTimeoutMs) { - final long commandId = 10L; - - ArrayList elements = new ArrayList<>(); - final long ratingFieldID = 0L; - BaseTLVType ratingtlvValue = new StringType(rating); - elements.add(new StructElement(ratingFieldID, ratingtlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public interface ResetPINResponseCallback extends BaseClusterCallback { - void onSuccess(String PINCode); + public interface RemovedOnAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); } - public interface OnDemandRatingsAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + public interface DeviceDirectoryAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); } - public interface ScheduledContentRatingsAttributeCallback extends BaseAttributeCallback { - void onSuccess(List value); + public interface LocationDirectoryAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); } public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { @@ -59137,212 +60651,92 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } - public void readEnabledAttribute( - BooleanAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ENABLED_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, ENABLED_ATTRIBUTE_ID, true); - } - - public void subscribeEnabledAttribute( - BooleanAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ENABLED_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, ENABLED_ATTRIBUTE_ID, minInterval, maxInterval); - } - - public void readOnDemandRatingsAttribute( - OnDemandRatingsAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ON_DEMAND_RATINGS_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, ON_DEMAND_RATINGS_ATTRIBUTE_ID, true); - } - - public void subscribeOnDemandRatingsAttribute( - OnDemandRatingsAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ON_DEMAND_RATINGS_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, ON_DEMAND_RATINGS_ATTRIBUTE_ID, minInterval, maxInterval); - } - - public void readOnDemandRatingThresholdAttribute( - CharStringAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ON_DEMAND_RATING_THRESHOLD_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, ON_DEMAND_RATING_THRESHOLD_ATTRIBUTE_ID, true); - } - - public void subscribeOnDemandRatingThresholdAttribute( - CharStringAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ON_DEMAND_RATING_THRESHOLD_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, ON_DEMAND_RATING_THRESHOLD_ATTRIBUTE_ID, minInterval, maxInterval); - } - - public void readScheduledContentRatingsAttribute( - ScheduledContentRatingsAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SCHEDULED_CONTENT_RATINGS_ATTRIBUTE_ID); + public void readRemovedOnAttribute( + RemovedOnAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REMOVED_ON_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, SCHEDULED_CONTENT_RATINGS_ATTRIBUTE_ID, true); + }, REMOVED_ON_ATTRIBUTE_ID, true); } - public void subscribeScheduledContentRatingsAttribute( - ScheduledContentRatingsAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SCHEDULED_CONTENT_RATINGS_ATTRIBUTE_ID); + public void subscribeRemovedOnAttribute( + RemovedOnAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REMOVED_ON_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, SCHEDULED_CONTENT_RATINGS_ATTRIBUTE_ID, minInterval, maxInterval); - } - - public void readScheduledContentRatingThresholdAttribute( - CharStringAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SCHEDULED_CONTENT_RATING_THRESHOLD_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, SCHEDULED_CONTENT_RATING_THRESHOLD_ATTRIBUTE_ID, true); + }, REMOVED_ON_ATTRIBUTE_ID, minInterval, maxInterval); } - public void subscribeScheduledContentRatingThresholdAttribute( - CharStringAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SCHEDULED_CONTENT_RATING_THRESHOLD_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, SCHEDULED_CONTENT_RATING_THRESHOLD_ATTRIBUTE_ID, minInterval, maxInterval); + public void readDeviceDirectoryAttribute( + DeviceDirectoryAttributeCallback callback) { + readDeviceDirectoryAttributeWithFabricFilter(callback, true); } - public void readScreenDailyTimeAttribute( - LongAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SCREEN_DAILY_TIME_ATTRIBUTE_ID); + public void readDeviceDirectoryAttributeWithFabricFilter( + DeviceDirectoryAttributeCallback callback, boolean isFabricFiltered) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEVICE_DIRECTORY_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, SCREEN_DAILY_TIME_ATTRIBUTE_ID, true); + }, DEVICE_DIRECTORY_ATTRIBUTE_ID, isFabricFiltered); } - public void subscribeScreenDailyTimeAttribute( - LongAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SCREEN_DAILY_TIME_ATTRIBUTE_ID); + public void subscribeDeviceDirectoryAttribute( + DeviceDirectoryAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEVICE_DIRECTORY_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, SCREEN_DAILY_TIME_ATTRIBUTE_ID, minInterval, maxInterval); - } - - public void readRemainingScreenTimeAttribute( - LongAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REMAINING_SCREEN_TIME_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, REMAINING_SCREEN_TIME_ATTRIBUTE_ID, true); + }, DEVICE_DIRECTORY_ATTRIBUTE_ID, minInterval, maxInterval); } - public void subscribeRemainingScreenTimeAttribute( - LongAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REMAINING_SCREEN_TIME_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, REMAINING_SCREEN_TIME_ATTRIBUTE_ID, minInterval, maxInterval); + public void readLocationDirectoryAttribute( + LocationDirectoryAttributeCallback callback) { + readLocationDirectoryAttributeWithFabricFilter(callback, true); } - public void readBlockUnratedAttribute( - BooleanAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BLOCK_UNRATED_ATTRIBUTE_ID); + public void readLocationDirectoryAttributeWithFabricFilter( + LocationDirectoryAttributeCallback callback, boolean isFabricFiltered) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LOCATION_DIRECTORY_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, BLOCK_UNRATED_ATTRIBUTE_ID, true); + }, LOCATION_DIRECTORY_ATTRIBUTE_ID, isFabricFiltered); } - public void subscribeBlockUnratedAttribute( - BooleanAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BLOCK_UNRATED_ATTRIBUTE_ID); + public void subscribeLocationDirectoryAttribute( + LocationDirectoryAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LOCATION_DIRECTORY_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, BLOCK_UNRATED_ATTRIBUTE_ID, minInterval, maxInterval); + }, LOCATION_DIRECTORY_ATTRIBUTE_ID, minInterval, maxInterval); } public void readGeneratedCommandListAttribute( @@ -59502,9 +60896,10 @@ public void onSuccess(byte[] tlv) { } } - public static class ContentAppObserverCluster extends BaseChipCluster { - public static final long CLUSTER_ID = 1296L; + public static class CommissionerControlCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 1873L; + private static final long SUPPORTED_DEVICE_CATEGORIES_ATTRIBUTE_ID = 0L; 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; @@ -59512,7 +60907,7 @@ public static class ContentAppObserverCluster extends BaseChipCluster { private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; - public ContentAppObserverCluster(long devicePtr, int endpointId) { + public CommissionerControlCluster(long devicePtr, int endpointId) { super(devicePtr, endpointId, CLUSTER_ID); } @@ -59522,56 +60917,110 @@ public long initWithDevice(long devicePtr, int endpointId) { return 0L; } - public void contentAppMessage(ContentAppMessageResponseCallback callback, Optional data, String encodingHint) { - contentAppMessage(callback, data, encodingHint, 0); + public void requestCommissioningApproval(DefaultClusterCallback callback, Long requestId, Integer vendorId, Integer productId, Optional label) { + requestCommissioningApproval(callback, requestId, vendorId, productId, label, 0); } - public void contentAppMessage(ContentAppMessageResponseCallback callback, Optional data, String encodingHint, int timedInvokeTimeoutMs) { + public void requestCommissioningApproval(DefaultClusterCallback callback, Long requestId, Integer vendorId, Integer productId, Optional label, int timedInvokeTimeoutMs) { final long commandId = 0L; ArrayList elements = new ArrayList<>(); - final long dataFieldID = 0L; - BaseTLVType datatlvValue = data.map((nonOptionaldata) -> new StringType(nonOptionaldata)).orElse(new EmptyType()); - elements.add(new StructElement(dataFieldID, datatlvValue)); + final long requestIdFieldID = 0L; + BaseTLVType requestIdtlvValue = new UIntType(requestId); + elements.add(new StructElement(requestIdFieldID, requestIdtlvValue)); - final long encodingHintFieldID = 1L; - BaseTLVType encodingHinttlvValue = new StringType(encodingHint); - elements.add(new StructElement(encodingHintFieldID, encodingHinttlvValue)); + final long vendorIdFieldID = 1L; + BaseTLVType vendorIdtlvValue = new UIntType(vendorId); + elements.add(new StructElement(vendorIdFieldID, vendorIdtlvValue)); + + final long productIdFieldID = 2L; + BaseTLVType productIdtlvValue = new UIntType(productId); + elements.add(new StructElement(productIdFieldID, productIdtlvValue)); + + final long labelFieldID = 3L; + BaseTLVType labeltlvValue = label.map((nonOptionallabel) -> new StringType(nonOptionallabel)).orElse(new EmptyType()); + elements.add(new StructElement(labelFieldID, labeltlvValue)); StructType commandArgs = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @Override public void onResponse(StructType invokeStructValue) { - final long statusFieldID = 0L; - Integer status = null; - final long dataFieldID = 1L; - Optional data = Optional.empty(); - final long encodingHintFieldID = 2L; - Optional encodingHint = Optional.empty(); + callback.onSuccess(); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + + public void commissionNode(ReverseOpenCommissioningWindowCallback callback, Long requestId, Integer responseTimeoutSeconds, Optional ipAddress, Optional port) { + commissionNode(callback, requestId, responseTimeoutSeconds, ipAddress, port, 0); + } + + public void commissionNode(ReverseOpenCommissioningWindowCallback callback, Long requestId, Integer responseTimeoutSeconds, Optional ipAddress, Optional port, int timedInvokeTimeoutMs) { + final long commandId = 1L; + + ArrayList elements = new ArrayList<>(); + final long requestIdFieldID = 0L; + BaseTLVType requestIdtlvValue = new UIntType(requestId); + elements.add(new StructElement(requestIdFieldID, requestIdtlvValue)); + + final long responseTimeoutSecondsFieldID = 1L; + BaseTLVType responseTimeoutSecondstlvValue = new UIntType(responseTimeoutSeconds); + elements.add(new StructElement(responseTimeoutSecondsFieldID, responseTimeoutSecondstlvValue)); + + final long ipAddressFieldID = 2L; + BaseTLVType ipAddresstlvValue = ipAddress.map((nonOptionalipAddress) -> new ByteArrayType(nonOptionalipAddress)).orElse(new EmptyType()); + elements.add(new StructElement(ipAddressFieldID, ipAddresstlvValue)); + + final long portFieldID = 3L; + BaseTLVType porttlvValue = port.map((nonOptionalport) -> new UIntType(nonOptionalport)).orElse(new EmptyType()); + elements.add(new StructElement(portFieldID, porttlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + final long commissioningTimeoutFieldID = 0L; + Integer commissioningTimeout = null; + final long PAKEPasscodeVerifierFieldID = 1L; + byte[] PAKEPasscodeVerifier = null; + final long discriminatorFieldID = 2L; + Integer discriminator = null; + final long iterationsFieldID = 3L; + Long iterations = null; + final long saltFieldID = 4L; + byte[] salt = null; for (StructElement element: invokeStructValue.value()) { - if (element.contextTagNum() == statusFieldID) { + if (element.contextTagNum() == commissioningTimeoutFieldID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - status = castingValue.value(Integer.class); + commissioningTimeout = castingValue.value(Integer.class); } - } else if (element.contextTagNum() == dataFieldID) { - if (element.value(BaseTLVType.class).type() == TLVType.String) { - StringType castingValue = element.value(StringType.class); - data = Optional.of(castingValue.value(String.class)); + } else if (element.contextTagNum() == PAKEPasscodeVerifierFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + PAKEPasscodeVerifier = castingValue.value(byte[].class); } - } else if (element.contextTagNum() == encodingHintFieldID) { - if (element.value(BaseTLVType.class).type() == TLVType.String) { - StringType castingValue = element.value(StringType.class); - encodingHint = Optional.of(castingValue.value(String.class)); + } else if (element.contextTagNum() == discriminatorFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + discriminator = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == iterationsFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + iterations = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == saltFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + salt = castingValue.value(byte[].class); } } } - callback.onSuccess(status, data, encodingHint); + callback.onSuccess(commissioningTimeout, PAKEPasscodeVerifier, discriminator, iterations, salt); }}, commandId, commandArgs, timedInvokeTimeoutMs); } - public interface ContentAppMessageResponseCallback extends BaseClusterCallback { - void onSuccess(Integer status, Optional data, Optional encodingHint); + public interface ReverseOpenCommissioningWindowCallback extends BaseClusterCallback { + void onSuccess(Integer commissioningTimeout, byte[] PAKEPasscodeVerifier, Integer discriminator, Long iterations, byte[] salt); } public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { @@ -59590,6 +61039,32 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } + public void readSupportedDeviceCategoriesAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_DEVICE_CATEGORIES_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, SUPPORTED_DEVICE_CATEGORIES_ATTRIBUTE_ID, true); + } + + public void subscribeSupportedDeviceCategoriesAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_DEVICE_CATEGORIES_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, SUPPORTED_DEVICE_CATEGORIES_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/ChipEventStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java index d25d80c3f791fc..7a7634b395cb38 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java @@ -236,6 +236,143 @@ public String toString() { return output.toString(); } } +public static class AccessControlClusterAccessRestrictionEntryChangedEvent { + public Integer fabricIndex; + private static final long FABRIC_INDEX_ID = 254L; + + public AccessControlClusterAccessRestrictionEntryChangedEvent( + Integer fabricIndex + ) { + this.fabricIndex = fabricIndex; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); + + return new StructType(values); + } + + public static AccessControlClusterAccessRestrictionEntryChangedEvent decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer fabricIndex = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == FABRIC_INDEX_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + fabricIndex = castingValue.value(Integer.class); + } + } + } + return new AccessControlClusterAccessRestrictionEntryChangedEvent( + fabricIndex + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("AccessControlClusterAccessRestrictionEntryChangedEvent {\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class AccessControlClusterFabricRestrictionReviewUpdateEvent { + public Long token; + public @Nullable String instruction; + public @Nullable String redirectURL; + public Integer fabricIndex; + private static final long TOKEN_ID = 0L; + private static final long INSTRUCTION_ID = 1L; + private static final long REDIRECT_U_R_L_ID = 2L; + private static final long FABRIC_INDEX_ID = 254L; + + public AccessControlClusterFabricRestrictionReviewUpdateEvent( + Long token, + @Nullable String instruction, + @Nullable String redirectURL, + Integer fabricIndex + ) { + this.token = token; + this.instruction = instruction; + this.redirectURL = redirectURL; + this.fabricIndex = fabricIndex; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(TOKEN_ID, new UIntType(token))); + values.add(new StructElement(INSTRUCTION_ID, instruction != null ? new StringType(instruction) : new NullType())); + values.add(new StructElement(REDIRECT_U_R_L_ID, redirectURL != null ? new StringType(redirectURL) : new NullType())); + values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); + + return new StructType(values); + } + + public static AccessControlClusterFabricRestrictionReviewUpdateEvent decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Long token = null; + @Nullable String instruction = null; + @Nullable String redirectURL = null; + Integer fabricIndex = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == TOKEN_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + token = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == INSTRUCTION_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + instruction = castingValue.value(String.class); + } + } else if (element.contextTagNum() == REDIRECT_U_R_L_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + redirectURL = castingValue.value(String.class); + } + } else if (element.contextTagNum() == FABRIC_INDEX_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + fabricIndex = castingValue.value(Integer.class); + } + } + } + return new AccessControlClusterFabricRestrictionReviewUpdateEvent( + token, + instruction, + redirectURL, + fabricIndex + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("AccessControlClusterFabricRestrictionReviewUpdateEvent {\n"); + output.append("\ttoken: "); + output.append(token); + output.append("\n"); + output.append("\tinstruction: "); + output.append(instruction); + output.append("\n"); + output.append("\tredirectURL: "); + output.append(redirectURL); + output.append("\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class ActionsClusterStateChangedEvent { public Integer actionID; public Long invokeID; @@ -1899,6 +2036,52 @@ public String toString() { return output.toString(); } } +public static class BridgedDeviceBasicInformationClusterActiveChangedEvent { + public Long promisedActiveDuration; + private static final long PROMISED_ACTIVE_DURATION_ID = 0L; + + public BridgedDeviceBasicInformationClusterActiveChangedEvent( + Long promisedActiveDuration + ) { + this.promisedActiveDuration = promisedActiveDuration; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(PROMISED_ACTIVE_DURATION_ID, new UIntType(promisedActiveDuration))); + + return new StructType(values); + } + + public static BridgedDeviceBasicInformationClusterActiveChangedEvent decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Long promisedActiveDuration = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == PROMISED_ACTIVE_DURATION_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + promisedActiveDuration = castingValue.value(Long.class); + } + } + } + return new BridgedDeviceBasicInformationClusterActiveChangedEvent( + promisedActiveDuration + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("BridgedDeviceBasicInformationClusterActiveChangedEvent {\n"); + output.append("\tpromisedActiveDuration: "); + output.append(promisedActiveDuration); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class SwitchClusterSwitchLatchedEvent { public Integer newPosition; private static final long NEW_POSITION_ID = 0L; @@ -4323,18 +4506,22 @@ public static class EnergyEvseClusterEnergyTransferStartedEvent { public Long sessionID; public Integer state; public Long maximumCurrent; + public Optional maximumDischargeCurrent; private static final long SESSION_I_D_ID = 0L; private static final long STATE_ID = 1L; private static final long MAXIMUM_CURRENT_ID = 2L; + private static final long MAXIMUM_DISCHARGE_CURRENT_ID = 3L; public EnergyEvseClusterEnergyTransferStartedEvent( Long sessionID, Integer state, - Long maximumCurrent + Long maximumCurrent, + Optional maximumDischargeCurrent ) { this.sessionID = sessionID; this.state = state; this.maximumCurrent = maximumCurrent; + this.maximumDischargeCurrent = maximumDischargeCurrent; } public StructType encodeTlv() { @@ -4342,6 +4529,7 @@ public StructType encodeTlv() { values.add(new StructElement(SESSION_I_D_ID, new UIntType(sessionID))); values.add(new StructElement(STATE_ID, new UIntType(state))); values.add(new StructElement(MAXIMUM_CURRENT_ID, new IntType(maximumCurrent))); + values.add(new StructElement(MAXIMUM_DISCHARGE_CURRENT_ID, maximumDischargeCurrent.map((nonOptionalmaximumDischargeCurrent) -> new IntType(nonOptionalmaximumDischargeCurrent)).orElse(new EmptyType()))); return new StructType(values); } @@ -4353,6 +4541,7 @@ public static EnergyEvseClusterEnergyTransferStartedEvent decodeTlv(BaseTLVType Long sessionID = null; Integer state = null; Long maximumCurrent = null; + Optional maximumDischargeCurrent = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == SESSION_I_D_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { @@ -4369,12 +4558,18 @@ public static EnergyEvseClusterEnergyTransferStartedEvent decodeTlv(BaseTLVType IntType castingValue = element.value(IntType.class); maximumCurrent = castingValue.value(Long.class); } + } else if (element.contextTagNum() == MAXIMUM_DISCHARGE_CURRENT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + maximumDischargeCurrent = Optional.of(castingValue.value(Long.class)); + } } } return new EnergyEvseClusterEnergyTransferStartedEvent( sessionID, state, - maximumCurrent + maximumCurrent, + maximumDischargeCurrent ); } @@ -4391,6 +4586,9 @@ public String toString() { output.append("\tmaximumCurrent: "); output.append(maximumCurrent); output.append("\n"); + output.append("\tmaximumDischargeCurrent: "); + output.append(maximumDischargeCurrent); + output.append("\n"); output.append("}\n"); return output.toString(); } @@ -4400,21 +4598,25 @@ public static class EnergyEvseClusterEnergyTransferStoppedEvent { public Integer state; public Integer reason; public Long energyTransferred; + public Optional energyDischarged; private static final long SESSION_I_D_ID = 0L; private static final long STATE_ID = 1L; private static final long REASON_ID = 2L; private static final long ENERGY_TRANSFERRED_ID = 4L; + private static final long ENERGY_DISCHARGED_ID = 5L; public EnergyEvseClusterEnergyTransferStoppedEvent( Long sessionID, Integer state, Integer reason, - Long energyTransferred + Long energyTransferred, + Optional energyDischarged ) { this.sessionID = sessionID; this.state = state; this.reason = reason; this.energyTransferred = energyTransferred; + this.energyDischarged = energyDischarged; } public StructType encodeTlv() { @@ -4423,6 +4625,7 @@ public StructType encodeTlv() { values.add(new StructElement(STATE_ID, new UIntType(state))); values.add(new StructElement(REASON_ID, new UIntType(reason))); values.add(new StructElement(ENERGY_TRANSFERRED_ID, new IntType(energyTransferred))); + values.add(new StructElement(ENERGY_DISCHARGED_ID, energyDischarged.map((nonOptionalenergyDischarged) -> new IntType(nonOptionalenergyDischarged)).orElse(new EmptyType()))); return new StructType(values); } @@ -4435,6 +4638,7 @@ public static EnergyEvseClusterEnergyTransferStoppedEvent decodeTlv(BaseTLVType Integer state = null; Integer reason = null; Long energyTransferred = null; + Optional energyDischarged = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == SESSION_I_D_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { @@ -4456,13 +4660,19 @@ public static EnergyEvseClusterEnergyTransferStoppedEvent decodeTlv(BaseTLVType IntType castingValue = element.value(IntType.class); energyTransferred = castingValue.value(Long.class); } + } else if (element.contextTagNum() == ENERGY_DISCHARGED_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + energyDischarged = Optional.of(castingValue.value(Long.class)); + } } } return new EnergyEvseClusterEnergyTransferStoppedEvent( sessionID, state, reason, - energyTransferred + energyTransferred, + energyDischarged ); } @@ -4482,6 +4692,9 @@ public String toString() { output.append("\tenergyTransferred: "); output.append(energyTransferred); output.append("\n"); + output.append("\tenergyDischarged: "); + output.append(energyDischarged); + output.append("\n"); output.append("}\n"); return output.toString(); } @@ -5584,52 +5797,6 @@ public String toString() { return output.toString(); } } -public static class ThreadNetworkDirectoryClusterNetworkChangedEvent { - public Long extendedPanID; - private static final long EXTENDED_PAN_I_D_ID = 0L; - - public ThreadNetworkDirectoryClusterNetworkChangedEvent( - Long extendedPanID - ) { - this.extendedPanID = extendedPanID; - } - - public StructType encodeTlv() { - ArrayList values = new ArrayList<>(); - values.add(new StructElement(EXTENDED_PAN_I_D_ID, new UIntType(extendedPanID))); - - return new StructType(values); - } - - public static ThreadNetworkDirectoryClusterNetworkChangedEvent decodeTlv(BaseTLVType tlvValue) { - if (tlvValue == null || tlvValue.type() != TLVType.Struct) { - return null; - } - Long extendedPanID = null; - for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == EXTENDED_PAN_I_D_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - extendedPanID = castingValue.value(Long.class); - } - } - } - return new ThreadNetworkDirectoryClusterNetworkChangedEvent( - extendedPanID - ); - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(); - output.append("ThreadNetworkDirectoryClusterNetworkChangedEvent {\n"); - output.append("\textendedPanID: "); - output.append(extendedPanID); - output.append("\n"); - output.append("}\n"); - return output.toString(); - } -} public static class TargetNavigatorClusterTargetUpdatedEvent { public ArrayList targetList; public Integer currentTarget; @@ -5946,6 +6113,97 @@ public String toString() { return output.toString(); } } +public static class CommissionerControlClusterCommissioningRequestResultEvent { + public Long requestId; + public Long clientNodeId; + public Integer statusCode; + public Integer fabricIndex; + private static final long REQUEST_ID_ID = 0L; + private static final long CLIENT_NODE_ID_ID = 1L; + private static final long STATUS_CODE_ID = 2L; + private static final long FABRIC_INDEX_ID = 254L; + + public CommissionerControlClusterCommissioningRequestResultEvent( + Long requestId, + Long clientNodeId, + Integer statusCode, + Integer fabricIndex + ) { + this.requestId = requestId; + this.clientNodeId = clientNodeId; + this.statusCode = statusCode; + this.fabricIndex = fabricIndex; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(REQUEST_ID_ID, new UIntType(requestId))); + values.add(new StructElement(CLIENT_NODE_ID_ID, new UIntType(clientNodeId))); + values.add(new StructElement(STATUS_CODE_ID, new UIntType(statusCode))); + values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); + + return new StructType(values); + } + + public static CommissionerControlClusterCommissioningRequestResultEvent decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Long requestId = null; + Long clientNodeId = null; + Integer statusCode = null; + Integer fabricIndex = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == REQUEST_ID_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + requestId = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == CLIENT_NODE_ID_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + clientNodeId = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == STATUS_CODE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + statusCode = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == FABRIC_INDEX_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + fabricIndex = castingValue.value(Integer.class); + } + } + } + return new CommissionerControlClusterCommissioningRequestResultEvent( + requestId, + clientNodeId, + statusCode, + fabricIndex + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("CommissionerControlClusterCommissioningRequestResultEvent {\n"); + output.append("\trequestId: "); + output.append(requestId); + output.append("\n"); + output.append("\tclientNodeId: "); + output.append(clientNodeId); + output.append("\n"); + output.append("\tstatusCode: "); + output.append(statusCode); + output.append("\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class UnitTestingClusterTestEventEvent { public Integer arg1; public Integer arg2; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 35a08b3e35268d..df78372f96c945 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -282,6 +282,234 @@ public String toString() { return output.toString(); } } +public static class AccessControlClusterAccessRestrictionStruct { + public Integer type; + public @Nullable Long id; + private static final long TYPE_ID = 0L; + private static final long ID_ID = 1L; + + public AccessControlClusterAccessRestrictionStruct( + Integer type, + @Nullable Long id + ) { + this.type = type; + this.id = id; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(TYPE_ID, new UIntType(type))); + values.add(new StructElement(ID_ID, id != null ? new UIntType(id) : new NullType())); + + return new StructType(values); + } + + public static AccessControlClusterAccessRestrictionStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer type = null; + @Nullable Long id = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == TYPE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + type = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == ID_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + id = castingValue.value(Long.class); + } + } + } + return new AccessControlClusterAccessRestrictionStruct( + type, + id + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("AccessControlClusterAccessRestrictionStruct {\n"); + output.append("\ttype: "); + output.append(type); + output.append("\n"); + output.append("\tid: "); + output.append(id); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class AccessControlClusterCommissioningAccessRestrictionEntryStruct { + public Integer endpoint; + public Long cluster; + public ArrayList restrictions; + private static final long ENDPOINT_ID = 0L; + private static final long CLUSTER_ID = 1L; + private static final long RESTRICTIONS_ID = 2L; + + public AccessControlClusterCommissioningAccessRestrictionEntryStruct( + Integer endpoint, + Long cluster, + ArrayList restrictions + ) { + this.endpoint = endpoint; + this.cluster = cluster; + this.restrictions = restrictions; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(ENDPOINT_ID, new UIntType(endpoint))); + values.add(new StructElement(CLUSTER_ID, new UIntType(cluster))); + values.add(new StructElement(RESTRICTIONS_ID, ArrayType.generateArrayType(restrictions, (elementrestrictions) -> elementrestrictions.encodeTlv()))); + + return new StructType(values); + } + + public static AccessControlClusterCommissioningAccessRestrictionEntryStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer endpoint = null; + Long cluster = null; + ArrayList restrictions = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == ENDPOINT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + endpoint = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == CLUSTER_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + cluster = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == RESTRICTIONS_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Array) { + ArrayType castingValue = element.value(ArrayType.class); + restrictions = castingValue.map((elementcastingValue) -> ChipStructs.AccessControlClusterAccessRestrictionStruct.decodeTlv(elementcastingValue)); + } + } + } + return new AccessControlClusterCommissioningAccessRestrictionEntryStruct( + endpoint, + cluster, + restrictions + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("AccessControlClusterCommissioningAccessRestrictionEntryStruct {\n"); + output.append("\tendpoint: "); + output.append(endpoint); + output.append("\n"); + output.append("\tcluster: "); + output.append(cluster); + output.append("\n"); + output.append("\trestrictions: "); + output.append(restrictions); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class AccessControlClusterAccessRestrictionEntryStruct { + public Integer endpoint; + public Long cluster; + public ArrayList restrictions; + public Integer fabricIndex; + private static final long ENDPOINT_ID = 0L; + private static final long CLUSTER_ID = 1L; + private static final long RESTRICTIONS_ID = 2L; + private static final long FABRIC_INDEX_ID = 254L; + + public AccessControlClusterAccessRestrictionEntryStruct( + Integer endpoint, + Long cluster, + ArrayList restrictions, + Integer fabricIndex + ) { + this.endpoint = endpoint; + this.cluster = cluster; + this.restrictions = restrictions; + this.fabricIndex = fabricIndex; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(ENDPOINT_ID, new UIntType(endpoint))); + values.add(new StructElement(CLUSTER_ID, new UIntType(cluster))); + values.add(new StructElement(RESTRICTIONS_ID, ArrayType.generateArrayType(restrictions, (elementrestrictions) -> elementrestrictions.encodeTlv()))); + values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); + + return new StructType(values); + } + + public static AccessControlClusterAccessRestrictionEntryStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer endpoint = null; + Long cluster = null; + ArrayList restrictions = null; + Integer fabricIndex = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == ENDPOINT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + endpoint = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == CLUSTER_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + cluster = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == RESTRICTIONS_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Array) { + ArrayType castingValue = element.value(ArrayType.class); + restrictions = castingValue.map((elementcastingValue) -> ChipStructs.AccessControlClusterAccessRestrictionStruct.decodeTlv(elementcastingValue)); + } + } else if (element.contextTagNum() == FABRIC_INDEX_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + fabricIndex = castingValue.value(Integer.class); + } + } + } + return new AccessControlClusterAccessRestrictionEntryStruct( + endpoint, + cluster, + restrictions, + fabricIndex + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("AccessControlClusterAccessRestrictionEntryStruct {\n"); + output.append("\tendpoint: "); + output.append(endpoint); + output.append("\n"); + output.append("\tcluster: "); + output.append(cluster); + output.append("\n"); + output.append("\trestrictions: "); + output.append(restrictions); + output.append("\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class AccessControlClusterAccessControlTargetStruct { public @Nullable Long cluster; public @Nullable Integer endpoint; @@ -5078,62 +5306,167 @@ public String toString() { return output.toString(); } } -public static class ScenesManagementClusterAttributeValuePair { +public static class ScenesManagementClusterAttributeValuePairStruct { public Long attributeID; - public Long attributeValue; + public Optional valueUnsigned8; + public Optional valueSigned8; + public Optional valueUnsigned16; + public Optional valueSigned16; + public Optional valueUnsigned32; + public Optional valueSigned32; + public Optional valueUnsigned64; + public Optional valueSigned64; private static final long ATTRIBUTE_I_D_ID = 0L; - private static final long ATTRIBUTE_VALUE_ID = 1L; - - public ScenesManagementClusterAttributeValuePair( + private static final long VALUE_UNSIGNED8_ID = 1L; + private static final long VALUE_SIGNED8_ID = 2L; + private static final long VALUE_UNSIGNED16_ID = 3L; + private static final long VALUE_SIGNED16_ID = 4L; + private static final long VALUE_UNSIGNED32_ID = 5L; + private static final long VALUE_SIGNED32_ID = 6L; + private static final long VALUE_UNSIGNED64_ID = 7L; + private static final long VALUE_SIGNED64_ID = 8L; + + public ScenesManagementClusterAttributeValuePairStruct( Long attributeID, - Long attributeValue + Optional valueUnsigned8, + Optional valueSigned8, + Optional valueUnsigned16, + Optional valueSigned16, + Optional valueUnsigned32, + Optional valueSigned32, + Optional valueUnsigned64, + Optional valueSigned64 ) { this.attributeID = attributeID; - this.attributeValue = attributeValue; + this.valueUnsigned8 = valueUnsigned8; + this.valueSigned8 = valueSigned8; + this.valueUnsigned16 = valueUnsigned16; + this.valueSigned16 = valueSigned16; + this.valueUnsigned32 = valueUnsigned32; + this.valueSigned32 = valueSigned32; + this.valueUnsigned64 = valueUnsigned64; + this.valueSigned64 = valueSigned64; } public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(ATTRIBUTE_I_D_ID, new UIntType(attributeID))); - values.add(new StructElement(ATTRIBUTE_VALUE_ID, new UIntType(attributeValue))); + values.add(new StructElement(VALUE_UNSIGNED8_ID, valueUnsigned8.map((nonOptionalvalueUnsigned8) -> new UIntType(nonOptionalvalueUnsigned8)).orElse(new EmptyType()))); + values.add(new StructElement(VALUE_SIGNED8_ID, valueSigned8.map((nonOptionalvalueSigned8) -> new IntType(nonOptionalvalueSigned8)).orElse(new EmptyType()))); + values.add(new StructElement(VALUE_UNSIGNED16_ID, valueUnsigned16.map((nonOptionalvalueUnsigned16) -> new UIntType(nonOptionalvalueUnsigned16)).orElse(new EmptyType()))); + values.add(new StructElement(VALUE_SIGNED16_ID, valueSigned16.map((nonOptionalvalueSigned16) -> new IntType(nonOptionalvalueSigned16)).orElse(new EmptyType()))); + values.add(new StructElement(VALUE_UNSIGNED32_ID, valueUnsigned32.map((nonOptionalvalueUnsigned32) -> new UIntType(nonOptionalvalueUnsigned32)).orElse(new EmptyType()))); + values.add(new StructElement(VALUE_SIGNED32_ID, valueSigned32.map((nonOptionalvalueSigned32) -> new IntType(nonOptionalvalueSigned32)).orElse(new EmptyType()))); + values.add(new StructElement(VALUE_UNSIGNED64_ID, valueUnsigned64.map((nonOptionalvalueUnsigned64) -> new UIntType(nonOptionalvalueUnsigned64)).orElse(new EmptyType()))); + values.add(new StructElement(VALUE_SIGNED64_ID, valueSigned64.map((nonOptionalvalueSigned64) -> new IntType(nonOptionalvalueSigned64)).orElse(new EmptyType()))); return new StructType(values); } - public static ScenesManagementClusterAttributeValuePair decodeTlv(BaseTLVType tlvValue) { + public static ScenesManagementClusterAttributeValuePairStruct decodeTlv(BaseTLVType tlvValue) { if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } Long attributeID = null; - Long attributeValue = null; + Optional valueUnsigned8 = Optional.empty(); + Optional valueSigned8 = Optional.empty(); + Optional valueUnsigned16 = Optional.empty(); + Optional valueSigned16 = Optional.empty(); + Optional valueUnsigned32 = Optional.empty(); + Optional valueSigned32 = Optional.empty(); + Optional valueUnsigned64 = Optional.empty(); + Optional valueSigned64 = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == ATTRIBUTE_I_D_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); attributeID = castingValue.value(Long.class); } - } else if (element.contextTagNum() == ATTRIBUTE_VALUE_ID) { + } else if (element.contextTagNum() == VALUE_UNSIGNED8_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + valueUnsigned8 = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == VALUE_SIGNED8_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + valueSigned8 = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == VALUE_UNSIGNED16_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + valueUnsigned16 = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == VALUE_SIGNED16_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + valueSigned16 = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == VALUE_UNSIGNED32_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + valueUnsigned32 = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == VALUE_SIGNED32_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + valueSigned32 = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == VALUE_UNSIGNED64_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - attributeValue = castingValue.value(Long.class); + valueUnsigned64 = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == VALUE_SIGNED64_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + valueSigned64 = Optional.of(castingValue.value(Long.class)); } } } - return new ScenesManagementClusterAttributeValuePair( + return new ScenesManagementClusterAttributeValuePairStruct( attributeID, - attributeValue + valueUnsigned8, + valueSigned8, + valueUnsigned16, + valueSigned16, + valueUnsigned32, + valueSigned32, + valueUnsigned64, + valueSigned64 ); } @Override public String toString() { StringBuilder output = new StringBuilder(); - output.append("ScenesManagementClusterAttributeValuePair {\n"); + output.append("ScenesManagementClusterAttributeValuePairStruct {\n"); output.append("\tattributeID: "); output.append(attributeID); output.append("\n"); - output.append("\tattributeValue: "); - output.append(attributeValue); + output.append("\tvalueUnsigned8: "); + output.append(valueUnsigned8); + output.append("\n"); + output.append("\tvalueSigned8: "); + output.append(valueSigned8); + output.append("\n"); + output.append("\tvalueUnsigned16: "); + output.append(valueUnsigned16); + output.append("\n"); + output.append("\tvalueSigned16: "); + output.append(valueSigned16); + output.append("\n"); + output.append("\tvalueUnsigned32: "); + output.append(valueUnsigned32); + output.append("\n"); + output.append("\tvalueSigned32: "); + output.append(valueSigned32); + output.append("\n"); + output.append("\tvalueUnsigned64: "); + output.append(valueUnsigned64); + output.append("\n"); + output.append("\tvalueSigned64: "); + output.append(valueSigned64); output.append("\n"); output.append("}\n"); return output.toString(); @@ -5141,13 +5474,13 @@ public String toString() { } public static class ScenesManagementClusterExtensionFieldSet { public Long clusterID; - public ArrayList attributeValueList; + public ArrayList attributeValueList; private static final long CLUSTER_I_D_ID = 0L; private static final long ATTRIBUTE_VALUE_LIST_ID = 1L; public ScenesManagementClusterExtensionFieldSet( Long clusterID, - ArrayList attributeValueList + ArrayList attributeValueList ) { this.clusterID = clusterID; this.attributeValueList = attributeValueList; @@ -5166,7 +5499,7 @@ public static ScenesManagementClusterExtensionFieldSet decodeTlv(BaseTLVType tlv return null; } Long clusterID = null; - ArrayList attributeValueList = null; + ArrayList attributeValueList = null; for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == CLUSTER_I_D_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { @@ -5176,7 +5509,7 @@ public static ScenesManagementClusterExtensionFieldSet decodeTlv(BaseTLVType tlv } else if (element.contextTagNum() == ATTRIBUTE_VALUE_LIST_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Array) { ArrayType castingValue = element.value(ArrayType.class); - attributeValueList = castingValue.map((elementcastingValue) -> ChipStructs.ScenesManagementClusterAttributeValuePair.decodeTlv(elementcastingValue)); + attributeValueList = castingValue.map((elementcastingValue) -> ChipStructs.ScenesManagementClusterAttributeValuePairStruct.decodeTlv(elementcastingValue)); } } } @@ -8503,13 +8836,13 @@ public String toString() { return output.toString(); } } -public static class DeviceEnergyManagementModeClusterModeTagStruct { +public static class WaterHeaterModeClusterModeTagStruct { public Optional mfgCode; public Integer value; private static final long MFG_CODE_ID = 0L; private static final long VALUE_ID = 1L; - public DeviceEnergyManagementModeClusterModeTagStruct( + public WaterHeaterModeClusterModeTagStruct( Optional mfgCode, Integer value ) { @@ -8525,7 +8858,7 @@ public StructType encodeTlv() { return new StructType(values); } - public static DeviceEnergyManagementModeClusterModeTagStruct decodeTlv(BaseTLVType tlvValue) { + public static WaterHeaterModeClusterModeTagStruct decodeTlv(BaseTLVType tlvValue) { if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } @@ -8544,7 +8877,7 @@ public static DeviceEnergyManagementModeClusterModeTagStruct decodeTlv(BaseTLVTy } } } - return new DeviceEnergyManagementModeClusterModeTagStruct( + return new WaterHeaterModeClusterModeTagStruct( mfgCode, value ); @@ -8553,7 +8886,7 @@ public static DeviceEnergyManagementModeClusterModeTagStruct decodeTlv(BaseTLVTy @Override public String toString() { StringBuilder output = new StringBuilder(); - output.append("DeviceEnergyManagementModeClusterModeTagStruct {\n"); + output.append("WaterHeaterModeClusterModeTagStruct {\n"); output.append("\tmfgCode: "); output.append(mfgCode); output.append("\n"); @@ -8564,18 +8897,18 @@ public String toString() { return output.toString(); } } -public static class DeviceEnergyManagementModeClusterModeOptionStruct { +public static class WaterHeaterModeClusterModeOptionStruct { public String label; public Integer mode; - public ArrayList modeTags; + public ArrayList modeTags; private static final long LABEL_ID = 0L; private static final long MODE_ID = 1L; private static final long MODE_TAGS_ID = 2L; - public DeviceEnergyManagementModeClusterModeOptionStruct( + public WaterHeaterModeClusterModeOptionStruct( String label, Integer mode, - ArrayList modeTags + ArrayList modeTags ) { this.label = label; this.mode = mode; @@ -8591,13 +8924,13 @@ public StructType encodeTlv() { return new StructType(values); } - public static DeviceEnergyManagementModeClusterModeOptionStruct decodeTlv(BaseTLVType tlvValue) { + public static WaterHeaterModeClusterModeOptionStruct decodeTlv(BaseTLVType tlvValue) { if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } String label = null; Integer mode = null; - ArrayList modeTags = null; + ArrayList modeTags = null; for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == LABEL_ID) { if (element.value(BaseTLVType.class).type() == TLVType.String) { @@ -8612,11 +8945,11 @@ public static DeviceEnergyManagementModeClusterModeOptionStruct decodeTlv(BaseTL } else if (element.contextTagNum() == MODE_TAGS_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Array) { ArrayType castingValue = element.value(ArrayType.class); - modeTags = castingValue.map((elementcastingValue) -> ChipStructs.DeviceEnergyManagementModeClusterModeTagStruct.decodeTlv(elementcastingValue)); + modeTags = castingValue.map((elementcastingValue) -> ChipStructs.WaterHeaterModeClusterModeTagStruct.decodeTlv(elementcastingValue)); } } } - return new DeviceEnergyManagementModeClusterModeOptionStruct( + return new WaterHeaterModeClusterModeOptionStruct( label, mode, modeTags @@ -8626,7 +8959,7 @@ public static DeviceEnergyManagementModeClusterModeOptionStruct decodeTlv(BaseTL @Override public String toString() { StringBuilder output = new StringBuilder(); - output.append("DeviceEnergyManagementModeClusterModeOptionStruct {\n"); + output.append("WaterHeaterModeClusterModeOptionStruct {\n"); output.append("\tlabel: "); output.append(label); output.append("\n"); @@ -8640,52 +8973,189 @@ public String toString() { return output.toString(); } } -public static class DoorLockClusterCredentialStruct { - public Integer credentialType; - public Integer credentialIndex; - private static final long CREDENTIAL_TYPE_ID = 0L; - private static final long CREDENTIAL_INDEX_ID = 1L; +public static class DeviceEnergyManagementModeClusterModeTagStruct { + public Optional mfgCode; + public Integer value; + private static final long MFG_CODE_ID = 0L; + private static final long VALUE_ID = 1L; - public DoorLockClusterCredentialStruct( - Integer credentialType, - Integer credentialIndex + public DeviceEnergyManagementModeClusterModeTagStruct( + Optional mfgCode, + Integer value ) { - this.credentialType = credentialType; - this.credentialIndex = credentialIndex; + this.mfgCode = mfgCode; + this.value = value; } public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(CREDENTIAL_TYPE_ID, new UIntType(credentialType))); - values.add(new StructElement(CREDENTIAL_INDEX_ID, new UIntType(credentialIndex))); + values.add(new StructElement(MFG_CODE_ID, mfgCode.map((nonOptionalmfgCode) -> new UIntType(nonOptionalmfgCode)).orElse(new EmptyType()))); + values.add(new StructElement(VALUE_ID, new UIntType(value))); return new StructType(values); } - public static DoorLockClusterCredentialStruct decodeTlv(BaseTLVType tlvValue) { + public static DeviceEnergyManagementModeClusterModeTagStruct decodeTlv(BaseTLVType tlvValue) { if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Integer credentialType = null; - Integer credentialIndex = null; + Optional mfgCode = Optional.empty(); + Integer value = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == CREDENTIAL_TYPE_ID) { + if (element.contextTagNum() == MFG_CODE_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - credentialType = castingValue.value(Integer.class); + mfgCode = Optional.of(castingValue.value(Integer.class)); } - } else if (element.contextTagNum() == CREDENTIAL_INDEX_ID) { + } else if (element.contextTagNum() == VALUE_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - credentialIndex = castingValue.value(Integer.class); + value = castingValue.value(Integer.class); } } } - return new DoorLockClusterCredentialStruct( - credentialType, - credentialIndex - ); - } + return new DeviceEnergyManagementModeClusterModeTagStruct( + mfgCode, + value + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("DeviceEnergyManagementModeClusterModeTagStruct {\n"); + output.append("\tmfgCode: "); + output.append(mfgCode); + output.append("\n"); + output.append("\tvalue: "); + output.append(value); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class DeviceEnergyManagementModeClusterModeOptionStruct { + public String label; + public Integer mode; + public ArrayList modeTags; + private static final long LABEL_ID = 0L; + private static final long MODE_ID = 1L; + private static final long MODE_TAGS_ID = 2L; + + public DeviceEnergyManagementModeClusterModeOptionStruct( + String label, + Integer mode, + ArrayList modeTags + ) { + this.label = label; + this.mode = mode; + this.modeTags = modeTags; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(LABEL_ID, new StringType(label))); + values.add(new StructElement(MODE_ID, new UIntType(mode))); + values.add(new StructElement(MODE_TAGS_ID, ArrayType.generateArrayType(modeTags, (elementmodeTags) -> elementmodeTags.encodeTlv()))); + + return new StructType(values); + } + + public static DeviceEnergyManagementModeClusterModeOptionStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + String label = null; + Integer mode = null; + ArrayList modeTags = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == LABEL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + label = castingValue.value(String.class); + } + } else if (element.contextTagNum() == MODE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + mode = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == MODE_TAGS_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Array) { + ArrayType castingValue = element.value(ArrayType.class); + modeTags = castingValue.map((elementcastingValue) -> ChipStructs.DeviceEnergyManagementModeClusterModeTagStruct.decodeTlv(elementcastingValue)); + } + } + } + return new DeviceEnergyManagementModeClusterModeOptionStruct( + label, + mode, + modeTags + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("DeviceEnergyManagementModeClusterModeOptionStruct {\n"); + output.append("\tlabel: "); + output.append(label); + output.append("\n"); + output.append("\tmode: "); + output.append(mode); + output.append("\n"); + output.append("\tmodeTags: "); + output.append(modeTags); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class DoorLockClusterCredentialStruct { + public Integer credentialType; + public Integer credentialIndex; + private static final long CREDENTIAL_TYPE_ID = 0L; + private static final long CREDENTIAL_INDEX_ID = 1L; + + public DoorLockClusterCredentialStruct( + Integer credentialType, + Integer credentialIndex + ) { + this.credentialType = credentialType; + this.credentialIndex = credentialIndex; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(CREDENTIAL_TYPE_ID, new UIntType(credentialType))); + values.add(new StructElement(CREDENTIAL_INDEX_ID, new UIntType(credentialIndex))); + + return new StructType(values); + } + + public static DoorLockClusterCredentialStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer credentialType = null; + Integer credentialIndex = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == CREDENTIAL_TYPE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + credentialType = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == CREDENTIAL_INDEX_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + credentialIndex = castingValue.value(Integer.class); + } + } + } + return new DoorLockClusterCredentialStruct( + credentialType, + credentialIndex + ); + } @Override public String toString() { @@ -8701,7 +9171,7 @@ public String toString() { return output.toString(); } } -public static class ServiceAreaClusterHomeLocationStruct { +public static class ServiceAreaClusterLocationDescriptorStruct { public String locationName; public @Nullable Integer floorNumber; public @Nullable Integer areaType; @@ -8709,7 +9179,7 @@ public static class ServiceAreaClusterHomeLocationStruct { private static final long FLOOR_NUMBER_ID = 1L; private static final long AREA_TYPE_ID = 2L; - public ServiceAreaClusterHomeLocationStruct( + public ServiceAreaClusterLocationDescriptorStruct( String locationName, @Nullable Integer floorNumber, @Nullable Integer areaType @@ -8728,7 +9198,7 @@ public StructType encodeTlv() { return new StructType(values); } - public static ServiceAreaClusterHomeLocationStruct decodeTlv(BaseTLVType tlvValue) { + public static ServiceAreaClusterLocationDescriptorStruct decodeTlv(BaseTLVType tlvValue) { if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } @@ -8753,7 +9223,7 @@ public static ServiceAreaClusterHomeLocationStruct decodeTlv(BaseTLVType tlvValu } } } - return new ServiceAreaClusterHomeLocationStruct( + return new ServiceAreaClusterLocationDescriptorStruct( locationName, floorNumber, areaType @@ -8763,7 +9233,7 @@ public static ServiceAreaClusterHomeLocationStruct decodeTlv(BaseTLVType tlvValu @Override public String toString() { StringBuilder output = new StringBuilder(); - output.append("ServiceAreaClusterHomeLocationStruct {\n"); + output.append("ServiceAreaClusterLocationDescriptorStruct {\n"); output.append("\tlocationName: "); output.append(locationName); output.append("\n"); @@ -8778,7 +9248,7 @@ public String toString() { } } public static class ServiceAreaClusterLocationInfoStruct { - public @Nullable ChipStructs.ServiceAreaClusterHomeLocationStruct locationInfo; + public @Nullable ChipStructs.ServiceAreaClusterLocationDescriptorStruct locationInfo; public @Nullable Integer landmarkTag; public @Nullable Integer positionTag; public @Nullable Integer surfaceTag; @@ -8788,7 +9258,7 @@ public static class ServiceAreaClusterLocationInfoStruct { private static final long SURFACE_TAG_ID = 3L; public ServiceAreaClusterLocationInfoStruct( - @Nullable ChipStructs.ServiceAreaClusterHomeLocationStruct locationInfo, + @Nullable ChipStructs.ServiceAreaClusterLocationDescriptorStruct locationInfo, @Nullable Integer landmarkTag, @Nullable Integer positionTag, @Nullable Integer surfaceTag @@ -8813,7 +9283,7 @@ public static ServiceAreaClusterLocationInfoStruct decodeTlv(BaseTLVType tlvValu if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - @Nullable ChipStructs.ServiceAreaClusterHomeLocationStruct locationInfo = null; + @Nullable ChipStructs.ServiceAreaClusterLocationDescriptorStruct locationInfo = null; @Nullable Integer landmarkTag = null; @Nullable Integer positionTag = null; @Nullable Integer surfaceTag = null; @@ -8821,7 +9291,7 @@ public static ServiceAreaClusterLocationInfoStruct decodeTlv(BaseTLVType tlvValu if (element.contextTagNum() == LOCATION_INFO_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Struct) { StructType castingValue = element.value(StructType.class); - locationInfo = ChipStructs.ServiceAreaClusterHomeLocationStruct.decodeTlv(castingValue); + locationInfo = ChipStructs.ServiceAreaClusterLocationDescriptorStruct.decodeTlv(castingValue); } } else if (element.contextTagNum() == LANDMARK_TAG_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { @@ -9535,67 +10005,6 @@ public String toString() { return output.toString(); } } -public static class ThermostatClusterQueuedPresetStruct { - public @Nullable byte[] presetHandle; - public @Nullable Long transitionTimestamp; - private static final long PRESET_HANDLE_ID = 0L; - private static final long TRANSITION_TIMESTAMP_ID = 1L; - - public ThermostatClusterQueuedPresetStruct( - @Nullable byte[] presetHandle, - @Nullable Long transitionTimestamp - ) { - this.presetHandle = presetHandle; - this.transitionTimestamp = transitionTimestamp; - } - - public StructType encodeTlv() { - ArrayList values = new ArrayList<>(); - values.add(new StructElement(PRESET_HANDLE_ID, presetHandle != null ? new ByteArrayType(presetHandle) : new NullType())); - values.add(new StructElement(TRANSITION_TIMESTAMP_ID, transitionTimestamp != null ? new UIntType(transitionTimestamp) : new NullType())); - - return new StructType(values); - } - - public static ThermostatClusterQueuedPresetStruct decodeTlv(BaseTLVType tlvValue) { - if (tlvValue == null || tlvValue.type() != TLVType.Struct) { - return null; - } - @Nullable byte[] presetHandle = null; - @Nullable Long transitionTimestamp = null; - for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == PRESET_HANDLE_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { - ByteArrayType castingValue = element.value(ByteArrayType.class); - presetHandle = castingValue.value(byte[].class); - } - } else if (element.contextTagNum() == TRANSITION_TIMESTAMP_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - transitionTimestamp = castingValue.value(Long.class); - } - } - } - return new ThermostatClusterQueuedPresetStruct( - presetHandle, - transitionTimestamp - ); - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(); - output.append("ThermostatClusterQueuedPresetStruct {\n"); - output.append("\tpresetHandle: "); - output.append(Arrays.toString(presetHandle)); - output.append("\n"); - output.append("\ttransitionTimestamp: "); - output.append(transitionTimestamp); - output.append("\n"); - output.append("}\n"); - return output.toString(); - } -} public static class ThermostatClusterScheduleTypeStruct { public Integer systemMode; public Integer numberOfSchedules; @@ -9825,28 +10234,33 @@ public String toString() { } } public static class ThreadNetworkDirectoryClusterThreadNetworkStruct { - public Long extendedPanID; + public byte[] extendedPanID; public String networkName; public Integer channel; + public Long activeTimestamp; private static final long EXTENDED_PAN_I_D_ID = 0L; private static final long NETWORK_NAME_ID = 1L; private static final long CHANNEL_ID = 2L; + private static final long ACTIVE_TIMESTAMP_ID = 3L; public ThreadNetworkDirectoryClusterThreadNetworkStruct( - Long extendedPanID, + byte[] extendedPanID, String networkName, - Integer channel + Integer channel, + Long activeTimestamp ) { this.extendedPanID = extendedPanID; this.networkName = networkName; this.channel = channel; + this.activeTimestamp = activeTimestamp; } public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(EXTENDED_PAN_I_D_ID, new UIntType(extendedPanID))); + values.add(new StructElement(EXTENDED_PAN_I_D_ID, new ByteArrayType(extendedPanID))); values.add(new StructElement(NETWORK_NAME_ID, new StringType(networkName))); values.add(new StructElement(CHANNEL_ID, new UIntType(channel))); + values.add(new StructElement(ACTIVE_TIMESTAMP_ID, new UIntType(activeTimestamp))); return new StructType(values); } @@ -9855,14 +10269,15 @@ public static ThreadNetworkDirectoryClusterThreadNetworkStruct decodeTlv(BaseTLV if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Long extendedPanID = null; + byte[] extendedPanID = null; String networkName = null; Integer channel = null; + Long activeTimestamp = null; for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == EXTENDED_PAN_I_D_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - extendedPanID = castingValue.value(Long.class); + if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { + ByteArrayType castingValue = element.value(ByteArrayType.class); + extendedPanID = castingValue.value(byte[].class); } } else if (element.contextTagNum() == NETWORK_NAME_ID) { if (element.value(BaseTLVType.class).type() == TLVType.String) { @@ -9874,12 +10289,18 @@ public static ThreadNetworkDirectoryClusterThreadNetworkStruct decodeTlv(BaseTLV UIntType castingValue = element.value(UIntType.class); channel = castingValue.value(Integer.class); } + } else if (element.contextTagNum() == ACTIVE_TIMESTAMP_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + activeTimestamp = castingValue.value(Long.class); + } } } return new ThreadNetworkDirectoryClusterThreadNetworkStruct( extendedPanID, networkName, - channel + channel, + activeTimestamp ); } @@ -9888,7 +10309,7 @@ public String toString() { StringBuilder output = new StringBuilder(); output.append("ThreadNetworkDirectoryClusterThreadNetworkStruct {\n"); output.append("\textendedPanID: "); - output.append(extendedPanID); + output.append(Arrays.toString(extendedPanID)); output.append("\n"); output.append("\tnetworkName: "); output.append(networkName); @@ -9896,6 +10317,9 @@ public String toString() { output.append("\tchannel: "); output.append(channel); output.append("\n"); + output.append("\tactiveTimestamp: "); + output.append(activeTimestamp); + output.append("\n"); output.append("}\n"); return output.toString(); } @@ -12087,6 +12511,385 @@ public String toString() { return output.toString(); } } +public static class EcosystemInformationClusterLocationDescriptorStruct { + public String locationName; + public @Nullable Integer floorNumber; + public @Nullable Integer areaType; + private static final long LOCATION_NAME_ID = 0L; + private static final long FLOOR_NUMBER_ID = 1L; + private static final long AREA_TYPE_ID = 2L; + + public EcosystemInformationClusterLocationDescriptorStruct( + String locationName, + @Nullable Integer floorNumber, + @Nullable Integer areaType + ) { + this.locationName = locationName; + this.floorNumber = floorNumber; + this.areaType = areaType; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(LOCATION_NAME_ID, new StringType(locationName))); + values.add(new StructElement(FLOOR_NUMBER_ID, floorNumber != null ? new IntType(floorNumber) : new NullType())); + values.add(new StructElement(AREA_TYPE_ID, areaType != null ? new UIntType(areaType) : new NullType())); + + return new StructType(values); + } + + public static EcosystemInformationClusterLocationDescriptorStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + String locationName = null; + @Nullable Integer floorNumber = null; + @Nullable Integer areaType = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == LOCATION_NAME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + locationName = castingValue.value(String.class); + } + } else if (element.contextTagNum() == FLOOR_NUMBER_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + floorNumber = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == AREA_TYPE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + areaType = castingValue.value(Integer.class); + } + } + } + return new EcosystemInformationClusterLocationDescriptorStruct( + locationName, + floorNumber, + areaType + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("EcosystemInformationClusterLocationDescriptorStruct {\n"); + output.append("\tlocationName: "); + output.append(locationName); + output.append("\n"); + output.append("\tfloorNumber: "); + output.append(floorNumber); + output.append("\n"); + output.append("\tareaType: "); + output.append(areaType); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class EcosystemInformationClusterEcosystemLocationStruct { + public String uniqueLocationID; + public ChipStructs.EcosystemInformationClusterLocationDescriptorStruct locationDescriptor; + public Long locationDescriptorLastEdit; + public Integer fabricIndex; + private static final long UNIQUE_LOCATION_I_D_ID = 0L; + private static final long LOCATION_DESCRIPTOR_ID = 1L; + private static final long LOCATION_DESCRIPTOR_LAST_EDIT_ID = 2L; + private static final long FABRIC_INDEX_ID = 254L; + + public EcosystemInformationClusterEcosystemLocationStruct( + String uniqueLocationID, + ChipStructs.EcosystemInformationClusterLocationDescriptorStruct locationDescriptor, + Long locationDescriptorLastEdit, + Integer fabricIndex + ) { + this.uniqueLocationID = uniqueLocationID; + this.locationDescriptor = locationDescriptor; + this.locationDescriptorLastEdit = locationDescriptorLastEdit; + this.fabricIndex = fabricIndex; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(UNIQUE_LOCATION_I_D_ID, new StringType(uniqueLocationID))); + values.add(new StructElement(LOCATION_DESCRIPTOR_ID, locationDescriptor.encodeTlv())); + values.add(new StructElement(LOCATION_DESCRIPTOR_LAST_EDIT_ID, new UIntType(locationDescriptorLastEdit))); + values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); + + return new StructType(values); + } + + public static EcosystemInformationClusterEcosystemLocationStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + String uniqueLocationID = null; + ChipStructs.EcosystemInformationClusterLocationDescriptorStruct locationDescriptor = null; + Long locationDescriptorLastEdit = null; + Integer fabricIndex = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == UNIQUE_LOCATION_I_D_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + uniqueLocationID = castingValue.value(String.class); + } + } else if (element.contextTagNum() == LOCATION_DESCRIPTOR_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + locationDescriptor = ChipStructs.EcosystemInformationClusterLocationDescriptorStruct.decodeTlv(castingValue); + } + } else if (element.contextTagNum() == LOCATION_DESCRIPTOR_LAST_EDIT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + locationDescriptorLastEdit = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == FABRIC_INDEX_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + fabricIndex = castingValue.value(Integer.class); + } + } + } + return new EcosystemInformationClusterEcosystemLocationStruct( + uniqueLocationID, + locationDescriptor, + locationDescriptorLastEdit, + fabricIndex + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("EcosystemInformationClusterEcosystemLocationStruct {\n"); + output.append("\tuniqueLocationID: "); + output.append(uniqueLocationID); + output.append("\n"); + output.append("\tlocationDescriptor: "); + output.append(locationDescriptor); + output.append("\n"); + output.append("\tlocationDescriptorLastEdit: "); + output.append(locationDescriptorLastEdit); + output.append("\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class EcosystemInformationClusterDeviceTypeStruct { + public Long deviceType; + public Integer revision; + private static final long DEVICE_TYPE_ID = 0L; + private static final long REVISION_ID = 1L; + + public EcosystemInformationClusterDeviceTypeStruct( + Long deviceType, + Integer revision + ) { + this.deviceType = deviceType; + this.revision = revision; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(DEVICE_TYPE_ID, new UIntType(deviceType))); + values.add(new StructElement(REVISION_ID, new UIntType(revision))); + + return new StructType(values); + } + + public static EcosystemInformationClusterDeviceTypeStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Long deviceType = null; + Integer revision = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == DEVICE_TYPE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + deviceType = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == REVISION_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + revision = castingValue.value(Integer.class); + } + } + } + return new EcosystemInformationClusterDeviceTypeStruct( + deviceType, + revision + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("EcosystemInformationClusterDeviceTypeStruct {\n"); + output.append("\tdeviceType: "); + output.append(deviceType); + output.append("\n"); + output.append("\trevision: "); + output.append(revision); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class EcosystemInformationClusterEcosystemDeviceStruct { + public Optional deviceName; + public Optional deviceNameLastEdit; + public Integer bridgedEndpoint; + public Integer originalEndpoint; + public ArrayList deviceTypes; + public ArrayList uniqueLocationIDs; + public Long uniqueLocationIDsLastEdit; + public Integer fabricIndex; + private static final long DEVICE_NAME_ID = 0L; + private static final long DEVICE_NAME_LAST_EDIT_ID = 1L; + private static final long BRIDGED_ENDPOINT_ID = 2L; + private static final long ORIGINAL_ENDPOINT_ID = 3L; + private static final long DEVICE_TYPES_ID = 4L; + private static final long UNIQUE_LOCATION_I_DS_ID = 5L; + private static final long UNIQUE_LOCATION_I_DS_LAST_EDIT_ID = 6L; + private static final long FABRIC_INDEX_ID = 254L; + + public EcosystemInformationClusterEcosystemDeviceStruct( + Optional deviceName, + Optional deviceNameLastEdit, + Integer bridgedEndpoint, + Integer originalEndpoint, + ArrayList deviceTypes, + ArrayList uniqueLocationIDs, + Long uniqueLocationIDsLastEdit, + Integer fabricIndex + ) { + this.deviceName = deviceName; + this.deviceNameLastEdit = deviceNameLastEdit; + this.bridgedEndpoint = bridgedEndpoint; + this.originalEndpoint = originalEndpoint; + this.deviceTypes = deviceTypes; + this.uniqueLocationIDs = uniqueLocationIDs; + this.uniqueLocationIDsLastEdit = uniqueLocationIDsLastEdit; + this.fabricIndex = fabricIndex; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(DEVICE_NAME_ID, deviceName.map((nonOptionaldeviceName) -> new StringType(nonOptionaldeviceName)).orElse(new EmptyType()))); + values.add(new StructElement(DEVICE_NAME_LAST_EDIT_ID, deviceNameLastEdit.map((nonOptionaldeviceNameLastEdit) -> new UIntType(nonOptionaldeviceNameLastEdit)).orElse(new EmptyType()))); + values.add(new StructElement(BRIDGED_ENDPOINT_ID, new UIntType(bridgedEndpoint))); + values.add(new StructElement(ORIGINAL_ENDPOINT_ID, new UIntType(originalEndpoint))); + values.add(new StructElement(DEVICE_TYPES_ID, ArrayType.generateArrayType(deviceTypes, (elementdeviceTypes) -> elementdeviceTypes.encodeTlv()))); + values.add(new StructElement(UNIQUE_LOCATION_I_DS_ID, ArrayType.generateArrayType(uniqueLocationIDs, (elementuniqueLocationIDs) -> new StringType(elementuniqueLocationIDs)))); + values.add(new StructElement(UNIQUE_LOCATION_I_DS_LAST_EDIT_ID, new UIntType(uniqueLocationIDsLastEdit))); + values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); + + return new StructType(values); + } + + public static EcosystemInformationClusterEcosystemDeviceStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Optional deviceName = Optional.empty(); + Optional deviceNameLastEdit = Optional.empty(); + Integer bridgedEndpoint = null; + Integer originalEndpoint = null; + ArrayList deviceTypes = null; + ArrayList uniqueLocationIDs = null; + Long uniqueLocationIDsLastEdit = null; + Integer fabricIndex = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == DEVICE_NAME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + deviceName = Optional.of(castingValue.value(String.class)); + } + } else if (element.contextTagNum() == DEVICE_NAME_LAST_EDIT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + deviceNameLastEdit = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == BRIDGED_ENDPOINT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + bridgedEndpoint = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == ORIGINAL_ENDPOINT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + originalEndpoint = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == DEVICE_TYPES_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Array) { + ArrayType castingValue = element.value(ArrayType.class); + deviceTypes = castingValue.map((elementcastingValue) -> ChipStructs.EcosystemInformationClusterDeviceTypeStruct.decodeTlv(elementcastingValue)); + } + } else if (element.contextTagNum() == UNIQUE_LOCATION_I_DS_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Array) { + ArrayType castingValue = element.value(ArrayType.class); + uniqueLocationIDs = castingValue.map((elementcastingValue) -> elementcastingValue.value(String.class)); + } + } else if (element.contextTagNum() == UNIQUE_LOCATION_I_DS_LAST_EDIT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + uniqueLocationIDsLastEdit = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == FABRIC_INDEX_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + fabricIndex = castingValue.value(Integer.class); + } + } + } + return new EcosystemInformationClusterEcosystemDeviceStruct( + deviceName, + deviceNameLastEdit, + bridgedEndpoint, + originalEndpoint, + deviceTypes, + uniqueLocationIDs, + uniqueLocationIDsLastEdit, + fabricIndex + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("EcosystemInformationClusterEcosystemDeviceStruct {\n"); + output.append("\tdeviceName: "); + output.append(deviceName); + output.append("\n"); + output.append("\tdeviceNameLastEdit: "); + output.append(deviceNameLastEdit); + output.append("\n"); + output.append("\tbridgedEndpoint: "); + output.append(bridgedEndpoint); + output.append("\n"); + output.append("\toriginalEndpoint: "); + output.append(originalEndpoint); + output.append("\n"); + output.append("\tdeviceTypes: "); + output.append(deviceTypes); + output.append("\n"); + output.append("\tuniqueLocationIDs: "); + output.append(uniqueLocationIDs); + output.append("\n"); + output.append("\tuniqueLocationIDsLastEdit: "); + output.append(uniqueLocationIDsLastEdit); + output.append("\n"); + output.append("\tfabricIndex: "); + output.append(fabricIndex); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class UnitTestingClusterSimpleStruct { public Integer a; public Boolean b; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index eb51a558634fe4..e411dd6acabf6b 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -229,6 +229,9 @@ public static BaseCluster getCluster(long clusterId) { if (clusterId == ElectricalEnergyMeasurement.ID) { return new ElectricalEnergyMeasurement(); } + if (clusterId == WaterHeaterManagement.ID) { + return new WaterHeaterManagement(); + } if (clusterId == DemandResponseLoadControl.ID) { return new DemandResponseLoadControl(); } @@ -250,6 +253,9 @@ public static BaseCluster getCluster(long clusterId) { if (clusterId == EnergyEvseMode.ID) { return new EnergyEvseMode(); } + if (clusterId == WaterHeaterMode.ID) { + return new WaterHeaterMode(); + } if (clusterId == DeviceEnergyManagementMode.ID) { return new DeviceEnergyManagementMode(); } @@ -382,6 +388,12 @@ public static BaseCluster getCluster(long clusterId) { if (clusterId == ContentAppObserver.ID) { return new ContentAppObserver(); } + if (clusterId == EcosystemInformation.ID) { + return new EcosystemInformation(); + } + if (clusterId == CommissionerControl.ID) { + return new CommissionerControl(); + } if (clusterId == ElectricalMeasurement.ID) { return new ElectricalMeasurement(); } @@ -1675,6 +1687,8 @@ public enum Attribute { SubjectsPerAccessControlEntry(2L), TargetsPerAccessControlEntry(3L), AccessControlEntriesPerFabric(4L), + CommissioningARL(5L), + Arl(6L), GeneratedCommandList(65528L), AcceptedCommandList(65529L), EventList(65530L), @@ -1702,7 +1716,9 @@ public static Attribute value(long id) throws NoSuchFieldError { public enum Event { AccessControlEntryChanged(0L), - AccessControlExtensionChanged(1L),; + AccessControlExtensionChanged(1L), + AccessRestrictionEntryChanged(2L), + FabricRestrictionReviewUpdate(3L),; private final long id; Event(long id) { this.id = id; @@ -1722,7 +1738,8 @@ public static Event value(long id) throws NoSuchFieldError { } } - public enum Command {; + public enum Command { + ReviewFabricRestrictions(0L),; private final long id; Command(long id) { this.id = id; @@ -1740,7 +1757,24 @@ public static Command value(long id) throws NoSuchFieldError { } throw new NoSuchFieldError(); } - }@Override + }public enum ReviewFabricRestrictionsCommandField {Arl(0),; + private final int id; + ReviewFabricRestrictionsCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static ReviewFabricRestrictionsCommandField value(int id) throws NoSuchFieldError { + for (ReviewFabricRestrictionsCommandField field : ReviewFabricRestrictionsCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }@Override public String getAttributeName(long id) throws NoSuchFieldError { return Attribute.value(id).toString(); } @@ -4446,7 +4480,8 @@ public enum Event { StartUp(0L), ShutDown(1L), Leave(2L), - ReachableChanged(3L),; + ReachableChanged(3L), + ActiveChanged(128L),; private final long id; Event(long id) { this.id = id; @@ -4466,7 +4501,8 @@ public static Event value(long id) throws NoSuchFieldError { } } - public enum Command {; + public enum Command { + KeepActive(128L),; private final long id; Command(long id) { this.id = id; @@ -4484,7 +4520,24 @@ public static Command value(long id) throws NoSuchFieldError { } throw new NoSuchFieldError(); } - }@Override + }public enum KeepActiveCommandField {StayActiveDuration(0),; + private final int id; + KeepActiveCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static KeepActiveCommandField value(int id) throws NoSuchFieldError { + for (KeepActiveCommandField field : KeepActiveCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }@Override public String getAttributeName(long id) throws NoSuchFieldError { return Attribute.value(id).toString(); } @@ -5793,6 +5846,7 @@ public enum Attribute { UserActiveModeTriggerHint(6L), UserActiveModeTriggerInstruction(7L), OperatingMode(8L), + MaximumCheckInBackOff(9L), GeneratedCommandList(65528L), AcceptedCommandList(65529L), EventList(65530L), @@ -9300,6 +9354,131 @@ public long getCommandID(String name) throws IllegalArgumentException { return Command.valueOf(name).getID(); } } + public static class WaterHeaterManagement implements BaseCluster { + public static final long ID = 148L; + public long getID() { + return ID; + } + + public enum Attribute { + HeaterTypes(0L), + HeatDemand(1L), + TankVolume(2L), + EstimatedHeatRequired(3L), + TankPercentage(4L), + BoostState(5L), + GeneratedCommandList(65528L), + AcceptedCommandList(65529L), + EventList(65530L), + AttributeList(65531L), + FeatureMap(65532L), + ClusterRevision(65533L),; + private final long id; + Attribute(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Attribute value(long id) throws NoSuchFieldError { + for (Attribute attribute : Attribute.values()) { + if (attribute.getID() == id) { + return attribute; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Event {; + private final long id; + Event(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Event value(long id) throws NoSuchFieldError { + for (Event event : Event.values()) { + if (event.getID() == id) { + return event; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Command { + Boost(0L), + CancelBoost(1L),; + private final long id; + Command(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Command value(long id) throws NoSuchFieldError { + for (Command command : Command.values()) { + if (command.getID() == id) { + return command; + } + } + throw new NoSuchFieldError(); + } + }public enum BoostCommandField {Duration(0),OneShot(1),EmergencyBoost(2),TemporarySetpoint(3),TargetPercentage(4),TargetReheat(5),; + private final int id; + BoostCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static BoostCommandField value(int id) throws NoSuchFieldError { + for (BoostCommandField field : BoostCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }@Override + public String getAttributeName(long id) throws NoSuchFieldError { + return Attribute.value(id).toString(); + } + + @Override + public String getEventName(long id) throws NoSuchFieldError { + return Event.value(id).toString(); + } + + @Override + public String getCommandName(long id) throws NoSuchFieldError { + return Command.value(id).toString(); + } + + @Override + public long getAttributeID(String name) throws IllegalArgumentException { + return Attribute.valueOf(name).getID(); + } + + @Override + public long getEventID(String name) throws IllegalArgumentException { + return Event.valueOf(name).getID(); + } + + @Override + public long getCommandID(String name) throws IllegalArgumentException { + return Command.valueOf(name).getID(); + } + } public static class DemandResponseLoadControl implements BaseCluster { public static final long ID = 150L; public long getID() { @@ -10344,6 +10523,128 @@ public long getCommandID(String name) throws IllegalArgumentException { return Command.valueOf(name).getID(); } } + public static class WaterHeaterMode implements BaseCluster { + public static final long ID = 158L; + public long getID() { + return ID; + } + + public enum Attribute { + SupportedModes(0L), + CurrentMode(1L), + StartUpMode(2L), + OnMode(3L), + GeneratedCommandList(65528L), + AcceptedCommandList(65529L), + EventList(65530L), + AttributeList(65531L), + FeatureMap(65532L), + ClusterRevision(65533L),; + private final long id; + Attribute(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Attribute value(long id) throws NoSuchFieldError { + for (Attribute attribute : Attribute.values()) { + if (attribute.getID() == id) { + return attribute; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Event {; + private final long id; + Event(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Event value(long id) throws NoSuchFieldError { + for (Event event : Event.values()) { + if (event.getID() == id) { + return event; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Command { + ChangeToMode(0L),; + private final long id; + Command(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Command value(long id) throws NoSuchFieldError { + for (Command command : Command.values()) { + if (command.getID() == id) { + return command; + } + } + throw new NoSuchFieldError(); + } + }public enum ChangeToModeCommandField {NewMode(0),; + private final int id; + ChangeToModeCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static ChangeToModeCommandField value(int id) throws NoSuchFieldError { + for (ChangeToModeCommandField field : ChangeToModeCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }@Override + public String getAttributeName(long id) throws NoSuchFieldError { + return Attribute.value(id).toString(); + } + + @Override + public String getEventName(long id) throws NoSuchFieldError { + return Event.value(id).toString(); + } + + @Override + public String getCommandName(long id) throws NoSuchFieldError { + return Command.value(id).toString(); + } + + @Override + public long getAttributeID(String name) throws IllegalArgumentException { + return Attribute.valueOf(name).getID(); + } + + @Override + public long getEventID(String name) throws IllegalArgumentException { + return Event.valueOf(name).getID(); + } + + @Override + public long getCommandID(String name) throws IllegalArgumentException { + return Command.valueOf(name).getID(); + } + } public static class DeviceEnergyManagementMode implements BaseCluster { public static final long ID = 159L; public long getID() { @@ -11635,9 +11936,7 @@ public enum Attribute { Presets(80L), Schedules(81L), PresetsSchedulesEditable(82L), - TemperatureSetpointHoldPolicy(83L), - SetpointHoldExpiryTimestamp(84L), - QueuedPreset(85L), + SetpointHoldExpiryTimestamp(83L), GeneratedCommandList(65528L), AcceptedCommandList(65529L), EventList(65530L), @@ -11692,9 +11991,7 @@ public enum Command { SetActivePresetRequest(6L), StartPresetsSchedulesEditRequest(7L), CancelPresetsSchedulesEditRequest(8L), - CommitPresetsSchedulesRequest(9L), - CancelSetActivePresetRequest(10L), - SetTemperatureSetpointHoldPolicy(11L),; + CommitPresetsSchedulesRequest(9L),; private final long id; Command(long id) { this.id = id; @@ -11780,7 +12077,7 @@ public static SetActiveScheduleRequestCommandField value(int id) throws NoSuchFi } throw new NoSuchFieldError(); } - }public enum SetActivePresetRequestCommandField {PresetHandle(0),DelayMinutes(1),; + }public enum SetActivePresetRequestCommandField {PresetHandle(0),; private final int id; SetActivePresetRequestCommandField(int id) { this.id = id; @@ -11814,23 +12111,6 @@ public static StartPresetsSchedulesEditRequestCommandField value(int id) throws } throw new NoSuchFieldError(); } - }public enum SetTemperatureSetpointHoldPolicyCommandField {TemperatureSetpointHoldPolicy(0),; - private final int id; - SetTemperatureSetpointHoldPolicyCommandField(int id) { - this.id = id; - } - - public int getID() { - return id; - } - public static SetTemperatureSetpointHoldPolicyCommandField value(int id) throws NoSuchFieldError { - for (SetTemperatureSetpointHoldPolicyCommandField field : SetTemperatureSetpointHoldPolicyCommandField.values()) { - if (field.getID() == id) { - return field; - } - } - throw new NoSuchFieldError(); - } }@Override public String getAttributeName(long id) throws NoSuchFieldError { return Attribute.value(id).toString(); @@ -14459,7 +14739,8 @@ public long getID() { } public enum Attribute { - Ssid(1L), + Ssid(0L), + PassphraseSurrogate(1L), GeneratedCommandList(65528L), AcceptedCommandList(65529L), EventList(65530L), @@ -14565,7 +14846,7 @@ public enum Attribute { BorderAgentID(1L), ThreadVersion(2L), InterfaceEnabled(3L), - ActiveDatasetTimestamp(5L), + ActiveDatasetTimestamp(4L), GeneratedCommandList(65528L), AcceptedCommandList(65529L), EventList(65530L), @@ -14614,8 +14895,8 @@ public static Event value(long id) throws NoSuchFieldError { public enum Command { GetActiveDatasetRequest(0L), GetPendingDatasetRequest(1L), - SetActiveDatasetRequest(4L), - SetPendingDatasetRequest(5L),; + SetActiveDatasetRequest(3L), + SetPendingDatasetRequest(4L),; private final long id; Command(long id) { this.id = id; @@ -14732,8 +15013,7 @@ public static Attribute value(long id) throws NoSuchFieldError { } } - public enum Event { - NetworkChanged(0L),; + public enum Event {; private final long id; Event(long id) { this.id = id; @@ -16910,6 +17190,247 @@ public long getCommandID(String name) throws IllegalArgumentException { return Command.valueOf(name).getID(); } } + public static class EcosystemInformation implements BaseCluster { + public static final long ID = 1872L; + public long getID() { + return ID; + } + + public enum Attribute { + RemovedOn(0L), + DeviceDirectory(1L), + LocationDirectory(2L), + GeneratedCommandList(65528L), + AcceptedCommandList(65529L), + EventList(65530L), + AttributeList(65531L), + FeatureMap(65532L), + ClusterRevision(65533L),; + private final long id; + Attribute(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Attribute value(long id) throws NoSuchFieldError { + for (Attribute attribute : Attribute.values()) { + if (attribute.getID() == id) { + return attribute; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Event {; + private final long id; + Event(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Event value(long id) throws NoSuchFieldError { + for (Event event : Event.values()) { + if (event.getID() == id) { + return event; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Command {; + private final long id; + Command(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Command value(long id) throws NoSuchFieldError { + for (Command command : Command.values()) { + if (command.getID() == id) { + return command; + } + } + throw new NoSuchFieldError(); + } + }@Override + public String getAttributeName(long id) throws NoSuchFieldError { + return Attribute.value(id).toString(); + } + + @Override + public String getEventName(long id) throws NoSuchFieldError { + return Event.value(id).toString(); + } + + @Override + public String getCommandName(long id) throws NoSuchFieldError { + return Command.value(id).toString(); + } + + @Override + public long getAttributeID(String name) throws IllegalArgumentException { + return Attribute.valueOf(name).getID(); + } + + @Override + public long getEventID(String name) throws IllegalArgumentException { + return Event.valueOf(name).getID(); + } + + @Override + public long getCommandID(String name) throws IllegalArgumentException { + return Command.valueOf(name).getID(); + } + } + public static class CommissionerControl implements BaseCluster { + public static final long ID = 1873L; + public long getID() { + return ID; + } + + public enum Attribute { + SupportedDeviceCategories(0L), + GeneratedCommandList(65528L), + AcceptedCommandList(65529L), + EventList(65530L), + AttributeList(65531L), + FeatureMap(65532L), + ClusterRevision(65533L),; + private final long id; + Attribute(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Attribute value(long id) throws NoSuchFieldError { + for (Attribute attribute : Attribute.values()) { + if (attribute.getID() == id) { + return attribute; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Event { + CommissioningRequestResult(0L),; + private final long id; + Event(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Event value(long id) throws NoSuchFieldError { + for (Event event : Event.values()) { + if (event.getID() == id) { + return event; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Command { + RequestCommissioningApproval(0L), + CommissionNode(1L),; + private final long id; + Command(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Command value(long id) throws NoSuchFieldError { + for (Command command : Command.values()) { + if (command.getID() == id) { + return command; + } + } + throw new NoSuchFieldError(); + } + }public enum RequestCommissioningApprovalCommandField {RequestId(0),VendorId(1),ProductId(2),Label(3),; + private final int id; + RequestCommissioningApprovalCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static RequestCommissioningApprovalCommandField value(int id) throws NoSuchFieldError { + for (RequestCommissioningApprovalCommandField field : RequestCommissioningApprovalCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }public enum CommissionNodeCommandField {RequestId(0),ResponseTimeoutSeconds(1),IpAddress(2),Port(3),; + private final int id; + CommissionNodeCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static CommissionNodeCommandField value(int id) throws NoSuchFieldError { + for (CommissionNodeCommandField field : CommissionNodeCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } + }@Override + public String getAttributeName(long id) throws NoSuchFieldError { + return Attribute.value(id).toString(); + } + + @Override + public String getEventName(long id) throws NoSuchFieldError { + return Event.value(id).toString(); + } + + @Override + public String getCommandName(long id) throws NoSuchFieldError { + return Command.value(id).toString(); + } + + @Override + public long getAttributeID(String name) throws IllegalArgumentException { + return Attribute.valueOf(name).getID(); + } + + @Override + public long getEventID(String name) throws IllegalArgumentException { + return Event.valueOf(name).getID(); + } + + @Override + public long getCommandID(String name) throws IllegalArgumentException { + return Command.valueOf(name).getID(); + } + } public static class ElectricalMeasurement implements BaseCluster { public static final long ID = 2820L; public long getID() { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index 00ccd333d9ff76..a70357a4d5ae63 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -1383,6 +1383,48 @@ public void onError(Exception ex) { } } + public static class DelegatedAccessControlClusterCommissioningARLAttributeCallback implements ChipClusters.AccessControlCluster.CommissioningARLAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedAccessControlClusterArlAttributeCallback implements ChipClusters.AccessControlCluster.ArlAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + public static class DelegatedAccessControlClusterGeneratedCommandListAttributeCallback implements ChipClusters.AccessControlCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -10601,6 +10643,90 @@ public void onError(Exception ex) { } } + public static class DelegatedWaterHeaterManagementClusterGeneratedCommandListAttributeCallback implements ChipClusters.WaterHeaterManagementCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedWaterHeaterManagementClusterAcceptedCommandListAttributeCallback implements ChipClusters.WaterHeaterManagementCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedWaterHeaterManagementClusterEventListAttributeCallback implements ChipClusters.WaterHeaterManagementCluster.EventListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedWaterHeaterManagementClusterAttributeListAttributeCallback implements ChipClusters.WaterHeaterManagementCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + public static class DelegatedDemandResponseLoadControlClusterLoadControlProgramsAttributeCallback implements ChipClusters.DemandResponseLoadControlCluster.LoadControlProgramsAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -11867,7 +11993,7 @@ public void onError(Exception ex) { } - public static class DelegatedDeviceEnergyManagementModeClusterChangeToModeResponseCallback implements ChipClusters.DeviceEnergyManagementModeCluster.ChangeToModeResponseCallback, DelegatedClusterCallback { + public static class DelegatedWaterHeaterModeClusterChangeToModeResponseCallback implements ChipClusters.WaterHeaterModeCluster.ChangeToModeResponseCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -11890,7 +12016,7 @@ public void onError(Exception error) { callback.onFailure(error); } } - public static class DelegatedDeviceEnergyManagementModeClusterSupportedModesAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.SupportedModesAttributeCallback, DelegatedClusterCallback { + public static class DelegatedWaterHeaterModeClusterSupportedModesAttributeCallback implements ChipClusters.WaterHeaterModeCluster.SupportedModesAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -11898,9 +12024,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); } @@ -11911,7 +12037,7 @@ public void onError(Exception ex) { } } - public static class DelegatedDeviceEnergyManagementModeClusterStartUpModeAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.StartUpModeAttributeCallback, DelegatedClusterCallback { + public static class DelegatedWaterHeaterModeClusterStartUpModeAttributeCallback implements ChipClusters.WaterHeaterModeCluster.StartUpModeAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -11932,7 +12058,7 @@ public void onError(Exception ex) { } } - public static class DelegatedDeviceEnergyManagementModeClusterOnModeAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.OnModeAttributeCallback, DelegatedClusterCallback { + public static class DelegatedWaterHeaterModeClusterOnModeAttributeCallback implements ChipClusters.WaterHeaterModeCluster.OnModeAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -11953,7 +12079,7 @@ public void onError(Exception ex) { } } - public static class DelegatedDeviceEnergyManagementModeClusterGeneratedCommandListAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedWaterHeaterModeClusterGeneratedCommandListAttributeCallback implements ChipClusters.WaterHeaterModeCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -11974,7 +12100,7 @@ public void onError(Exception ex) { } } - public static class DelegatedDeviceEnergyManagementModeClusterAcceptedCommandListAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedWaterHeaterModeClusterAcceptedCommandListAttributeCallback implements ChipClusters.WaterHeaterModeCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -11995,7 +12121,7 @@ public void onError(Exception ex) { } } - public static class DelegatedDeviceEnergyManagementModeClusterEventListAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.EventListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedWaterHeaterModeClusterEventListAttributeCallback implements ChipClusters.WaterHeaterModeCluster.EventListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -12016,7 +12142,7 @@ public void onError(Exception ex) { } } - public static class DelegatedDeviceEnergyManagementModeClusterAttributeListAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedWaterHeaterModeClusterAttributeListAttributeCallback implements ChipClusters.WaterHeaterModeCluster.AttributeListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -12038,7 +12164,7 @@ public void onError(Exception ex) { } - public static class DelegatedDoorLockClusterGetWeekDayScheduleResponseCallback implements ChipClusters.DoorLockCluster.GetWeekDayScheduleResponseCallback, DelegatedClusterCallback { + public static class DelegatedDeviceEnergyManagementModeClusterChangeToModeResponseCallback implements ChipClusters.DeviceEnergyManagementModeCluster.ChangeToModeResponseCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -12046,25 +12172,13 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(Integer weekDayIndex, Integer userIndex, Integer status, Optional daysMask, Optional startHour, Optional startMinute, Optional endHour, Optional endMinute) { + public void onSuccess(Integer status, Optional statusText) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo weekDayIndexResponseValue = new CommandResponseInfo("weekDayIndex", "Integer"); - responseValues.put(weekDayIndexResponseValue, weekDayIndex); - CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "Integer"); - responseValues.put(userIndexResponseValue, userIndex); CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); responseValues.put(statusResponseValue, status); - CommandResponseInfo daysMaskResponseValue = new CommandResponseInfo("daysMask", "Optional"); - responseValues.put(daysMaskResponseValue, daysMask); - CommandResponseInfo startHourResponseValue = new CommandResponseInfo("startHour", "Optional"); - responseValues.put(startHourResponseValue, startHour); - CommandResponseInfo startMinuteResponseValue = new CommandResponseInfo("startMinute", "Optional"); - responseValues.put(startMinuteResponseValue, startMinute); - CommandResponseInfo endHourResponseValue = new CommandResponseInfo("endHour", "Optional"); - responseValues.put(endHourResponseValue, endHour); - CommandResponseInfo endMinuteResponseValue = new CommandResponseInfo("endMinute", "Optional"); - responseValues.put(endMinuteResponseValue, endMinute); + CommandResponseInfo statusTextResponseValue = new CommandResponseInfo("statusText", "Optional"); + responseValues.put(statusTextResponseValue, statusText); callback.onSuccess(responseValues); } @@ -12073,8 +12187,7 @@ public void onError(Exception error) { callback.onFailure(error); } } - - public static class DelegatedDoorLockClusterGetYearDayScheduleResponseCallback implements ChipClusters.DoorLockCluster.GetYearDayScheduleResponseCallback, DelegatedClusterCallback { + public static class DelegatedDeviceEnergyManagementModeClusterSupportedModesAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.SupportedModesAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -12082,29 +12195,20 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(Integer yearDayIndex, Integer userIndex, Integer status, Optional localStartTime, Optional localEndTime) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); - - CommandResponseInfo yearDayIndexResponseValue = new CommandResponseInfo("yearDayIndex", "Integer"); - responseValues.put(yearDayIndexResponseValue, yearDayIndex); - CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "Integer"); - responseValues.put(userIndexResponseValue, userIndex); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); - responseValues.put(statusResponseValue, status); - CommandResponseInfo localStartTimeResponseValue = new CommandResponseInfo("localStartTime", "Optional"); - responseValues.put(localStartTimeResponseValue, localStartTime); - CommandResponseInfo localEndTimeResponseValue = new CommandResponseInfo("localEndTime", "Optional"); - responseValues.put(localEndTimeResponseValue, localEndTime); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @Override - public void onError(Exception error) { - callback.onFailure(error); + public void onError(Exception ex) { + callback.onFailure(ex); } } - public static class DelegatedDoorLockClusterGetHolidayScheduleResponseCallback implements ChipClusters.DoorLockCluster.GetHolidayScheduleResponseCallback, DelegatedClusterCallback { + public static class DelegatedDeviceEnergyManagementModeClusterStartUpModeAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.StartUpModeAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -12112,29 +12216,20 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(Integer holidayIndex, Integer status, Optional localStartTime, Optional localEndTime, Optional operatingMode) { + public void onSuccess(@Nullable Integer value) { Map responseValues = new LinkedHashMap<>(); - - CommandResponseInfo holidayIndexResponseValue = new CommandResponseInfo("holidayIndex", "Integer"); - responseValues.put(holidayIndexResponseValue, holidayIndex); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); - responseValues.put(statusResponseValue, status); - CommandResponseInfo localStartTimeResponseValue = new CommandResponseInfo("localStartTime", "Optional"); - responseValues.put(localStartTimeResponseValue, localStartTime); - CommandResponseInfo localEndTimeResponseValue = new CommandResponseInfo("localEndTime", "Optional"); - responseValues.put(localEndTimeResponseValue, localEndTime); - CommandResponseInfo operatingModeResponseValue = new CommandResponseInfo("operatingMode", "Optional"); - responseValues.put(operatingModeResponseValue, operatingMode); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Integer"); + responseValues.put(commandResponseInfo, value); callback.onSuccess(responseValues); } @Override - public void onError(Exception error) { - callback.onFailure(error); + public void onError(Exception ex) { + callback.onFailure(ex); } } - public static class DelegatedDoorLockClusterGetUserResponseCallback implements ChipClusters.DoorLockCluster.GetUserResponseCallback, DelegatedClusterCallback { + public static class DelegatedDeviceEnergyManagementModeClusterOnModeAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.OnModeAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -12142,40 +12237,20 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(Integer userIndex, @Nullable String userName, @Nullable Long userUniqueID, @Nullable Integer userStatus, @Nullable Integer userType, @Nullable Integer credentialRule, @Nullable ArrayList credentials, @Nullable Integer creatorFabricIndex, @Nullable Integer lastModifiedFabricIndex, @Nullable Integer nextUserIndex) { + public void onSuccess(@Nullable Integer value) { Map responseValues = new LinkedHashMap<>(); - - CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "Integer"); - responseValues.put(userIndexResponseValue, userIndex); - CommandResponseInfo userNameResponseValue = new CommandResponseInfo("userName", "String"); - responseValues.put(userNameResponseValue, userName); - CommandResponseInfo userUniqueIDResponseValue = new CommandResponseInfo("userUniqueID", "Long"); - responseValues.put(userUniqueIDResponseValue, userUniqueID); - CommandResponseInfo userStatusResponseValue = new CommandResponseInfo("userStatus", "Integer"); - responseValues.put(userStatusResponseValue, userStatus); - CommandResponseInfo userTypeResponseValue = new CommandResponseInfo("userType", "Integer"); - responseValues.put(userTypeResponseValue, userType); - CommandResponseInfo credentialRuleResponseValue = new CommandResponseInfo("credentialRule", "Integer"); - responseValues.put(credentialRuleResponseValue, credentialRule); - // credentials: CredentialStruct - // Conversion from this type to Java is not properly implemented yet - - CommandResponseInfo creatorFabricIndexResponseValue = new CommandResponseInfo("creatorFabricIndex", "Integer"); - responseValues.put(creatorFabricIndexResponseValue, creatorFabricIndex); - CommandResponseInfo lastModifiedFabricIndexResponseValue = new CommandResponseInfo("lastModifiedFabricIndex", "Integer"); - responseValues.put(lastModifiedFabricIndexResponseValue, lastModifiedFabricIndex); - CommandResponseInfo nextUserIndexResponseValue = new CommandResponseInfo("nextUserIndex", "Integer"); - responseValues.put(nextUserIndexResponseValue, nextUserIndex); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Integer"); + responseValues.put(commandResponseInfo, value); callback.onSuccess(responseValues); } @Override - public void onError(Exception error) { - callback.onFailure(error); + public void onError(Exception ex) { + callback.onFailure(ex); } } - public static class DelegatedDoorLockClusterSetCredentialResponseCallback implements ChipClusters.DoorLockCluster.SetCredentialResponseCallback, DelegatedClusterCallback { + public static class DelegatedDeviceEnergyManagementModeClusterGeneratedCommandListAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -12183,25 +12258,20 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(Integer status, @Nullable Integer userIndex, @Nullable Integer nextCredentialIndex) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); - - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); - responseValues.put(statusResponseValue, status); - CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "Integer"); - responseValues.put(userIndexResponseValue, userIndex); - CommandResponseInfo nextCredentialIndexResponseValue = new CommandResponseInfo("nextCredentialIndex", "Integer"); - responseValues.put(nextCredentialIndexResponseValue, nextCredentialIndex); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @Override - public void onError(Exception error) { - callback.onFailure(error); + public void onError(Exception ex) { + callback.onFailure(ex); } } - public static class DelegatedDoorLockClusterGetCredentialStatusResponseCallback implements ChipClusters.DoorLockCluster.GetCredentialStatusResponseCallback, DelegatedClusterCallback { + public static class DelegatedDeviceEnergyManagementModeClusterAcceptedCommandListAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -12209,24 +12279,251 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(Boolean credentialExists, @Nullable Integer userIndex, @Nullable Integer creatorFabricIndex, @Nullable Integer lastModifiedFabricIndex, @Nullable Integer nextCredentialIndex) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); - - CommandResponseInfo credentialExistsResponseValue = new CommandResponseInfo("credentialExists", "Boolean"); - responseValues.put(credentialExistsResponseValue, credentialExists); - CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "Integer"); - responseValues.put(userIndexResponseValue, userIndex); - CommandResponseInfo creatorFabricIndexResponseValue = new CommandResponseInfo("creatorFabricIndex", "Integer"); - responseValues.put(creatorFabricIndexResponseValue, creatorFabricIndex); - CommandResponseInfo lastModifiedFabricIndexResponseValue = new CommandResponseInfo("lastModifiedFabricIndex", "Integer"); - responseValues.put(lastModifiedFabricIndexResponseValue, lastModifiedFabricIndex); - CommandResponseInfo nextCredentialIndexResponseValue = new CommandResponseInfo("nextCredentialIndex", "Integer"); - responseValues.put(nextCredentialIndexResponseValue, nextCredentialIndex); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @Override - public void onError(Exception error) { + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedDeviceEnergyManagementModeClusterEventListAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.EventListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedDeviceEnergyManagementModeClusterAttributeListAttributeCallback implements ChipClusters.DeviceEnergyManagementModeCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + + public static class DelegatedDoorLockClusterGetWeekDayScheduleResponseCallback implements ChipClusters.DoorLockCluster.GetWeekDayScheduleResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Integer weekDayIndex, Integer userIndex, Integer status, Optional daysMask, Optional startHour, Optional startMinute, Optional endHour, Optional endMinute) { + Map responseValues = new LinkedHashMap<>(); + + CommandResponseInfo weekDayIndexResponseValue = new CommandResponseInfo("weekDayIndex", "Integer"); + responseValues.put(weekDayIndexResponseValue, weekDayIndex); + CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "Integer"); + responseValues.put(userIndexResponseValue, userIndex); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); + responseValues.put(statusResponseValue, status); + CommandResponseInfo daysMaskResponseValue = new CommandResponseInfo("daysMask", "Optional"); + responseValues.put(daysMaskResponseValue, daysMask); + CommandResponseInfo startHourResponseValue = new CommandResponseInfo("startHour", "Optional"); + responseValues.put(startHourResponseValue, startHour); + CommandResponseInfo startMinuteResponseValue = new CommandResponseInfo("startMinute", "Optional"); + responseValues.put(startMinuteResponseValue, startMinute); + CommandResponseInfo endHourResponseValue = new CommandResponseInfo("endHour", "Optional"); + responseValues.put(endHourResponseValue, endHour); + CommandResponseInfo endMinuteResponseValue = new CommandResponseInfo("endMinute", "Optional"); + responseValues.put(endMinuteResponseValue, endMinute); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + + public static class DelegatedDoorLockClusterGetYearDayScheduleResponseCallback implements ChipClusters.DoorLockCluster.GetYearDayScheduleResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Integer yearDayIndex, Integer userIndex, Integer status, Optional localStartTime, Optional localEndTime) { + Map responseValues = new LinkedHashMap<>(); + + CommandResponseInfo yearDayIndexResponseValue = new CommandResponseInfo("yearDayIndex", "Integer"); + responseValues.put(yearDayIndexResponseValue, yearDayIndex); + CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "Integer"); + responseValues.put(userIndexResponseValue, userIndex); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); + responseValues.put(statusResponseValue, status); + CommandResponseInfo localStartTimeResponseValue = new CommandResponseInfo("localStartTime", "Optional"); + responseValues.put(localStartTimeResponseValue, localStartTime); + CommandResponseInfo localEndTimeResponseValue = new CommandResponseInfo("localEndTime", "Optional"); + responseValues.put(localEndTimeResponseValue, localEndTime); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + + public static class DelegatedDoorLockClusterGetHolidayScheduleResponseCallback implements ChipClusters.DoorLockCluster.GetHolidayScheduleResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Integer holidayIndex, Integer status, Optional localStartTime, Optional localEndTime, Optional operatingMode) { + Map responseValues = new LinkedHashMap<>(); + + CommandResponseInfo holidayIndexResponseValue = new CommandResponseInfo("holidayIndex", "Integer"); + responseValues.put(holidayIndexResponseValue, holidayIndex); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); + responseValues.put(statusResponseValue, status); + CommandResponseInfo localStartTimeResponseValue = new CommandResponseInfo("localStartTime", "Optional"); + responseValues.put(localStartTimeResponseValue, localStartTime); + CommandResponseInfo localEndTimeResponseValue = new CommandResponseInfo("localEndTime", "Optional"); + responseValues.put(localEndTimeResponseValue, localEndTime); + CommandResponseInfo operatingModeResponseValue = new CommandResponseInfo("operatingMode", "Optional"); + responseValues.put(operatingModeResponseValue, operatingMode); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + + public static class DelegatedDoorLockClusterGetUserResponseCallback implements ChipClusters.DoorLockCluster.GetUserResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Integer userIndex, @Nullable String userName, @Nullable Long userUniqueID, @Nullable Integer userStatus, @Nullable Integer userType, @Nullable Integer credentialRule, @Nullable ArrayList credentials, @Nullable Integer creatorFabricIndex, @Nullable Integer lastModifiedFabricIndex, @Nullable Integer nextUserIndex) { + Map responseValues = new LinkedHashMap<>(); + + CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "Integer"); + responseValues.put(userIndexResponseValue, userIndex); + CommandResponseInfo userNameResponseValue = new CommandResponseInfo("userName", "String"); + responseValues.put(userNameResponseValue, userName); + CommandResponseInfo userUniqueIDResponseValue = new CommandResponseInfo("userUniqueID", "Long"); + responseValues.put(userUniqueIDResponseValue, userUniqueID); + CommandResponseInfo userStatusResponseValue = new CommandResponseInfo("userStatus", "Integer"); + responseValues.put(userStatusResponseValue, userStatus); + CommandResponseInfo userTypeResponseValue = new CommandResponseInfo("userType", "Integer"); + responseValues.put(userTypeResponseValue, userType); + CommandResponseInfo credentialRuleResponseValue = new CommandResponseInfo("credentialRule", "Integer"); + responseValues.put(credentialRuleResponseValue, credentialRule); + // credentials: CredentialStruct + // Conversion from this type to Java is not properly implemented yet + + CommandResponseInfo creatorFabricIndexResponseValue = new CommandResponseInfo("creatorFabricIndex", "Integer"); + responseValues.put(creatorFabricIndexResponseValue, creatorFabricIndex); + CommandResponseInfo lastModifiedFabricIndexResponseValue = new CommandResponseInfo("lastModifiedFabricIndex", "Integer"); + responseValues.put(lastModifiedFabricIndexResponseValue, lastModifiedFabricIndex); + CommandResponseInfo nextUserIndexResponseValue = new CommandResponseInfo("nextUserIndex", "Integer"); + responseValues.put(nextUserIndexResponseValue, nextUserIndex); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + + public static class DelegatedDoorLockClusterSetCredentialResponseCallback implements ChipClusters.DoorLockCluster.SetCredentialResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Integer status, @Nullable Integer userIndex, @Nullable Integer nextCredentialIndex) { + Map responseValues = new LinkedHashMap<>(); + + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); + responseValues.put(statusResponseValue, status); + CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "Integer"); + responseValues.put(userIndexResponseValue, userIndex); + CommandResponseInfo nextCredentialIndexResponseValue = new CommandResponseInfo("nextCredentialIndex", "Integer"); + responseValues.put(nextCredentialIndexResponseValue, nextCredentialIndex); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + + public static class DelegatedDoorLockClusterGetCredentialStatusResponseCallback implements ChipClusters.DoorLockCluster.GetCredentialStatusResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Boolean credentialExists, @Nullable Integer userIndex, @Nullable Integer creatorFabricIndex, @Nullable Integer lastModifiedFabricIndex, @Nullable Integer nextCredentialIndex) { + Map responseValues = new LinkedHashMap<>(); + + CommandResponseInfo credentialExistsResponseValue = new CommandResponseInfo("credentialExists", "Boolean"); + responseValues.put(credentialExistsResponseValue, credentialExists); + CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "Integer"); + responseValues.put(userIndexResponseValue, userIndex); + CommandResponseInfo creatorFabricIndexResponseValue = new CommandResponseInfo("creatorFabricIndex", "Integer"); + responseValues.put(creatorFabricIndexResponseValue, creatorFabricIndex); + CommandResponseInfo lastModifiedFabricIndexResponseValue = new CommandResponseInfo("lastModifiedFabricIndex", "Integer"); + responseValues.put(lastModifiedFabricIndexResponseValue, lastModifiedFabricIndex); + CommandResponseInfo nextCredentialIndexResponseValue = new CommandResponseInfo("nextCredentialIndex", "Integer"); + responseValues.put(nextCredentialIndexResponseValue, nextCredentialIndex); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { callback.onFailure(error); } } @@ -13945,27 +14242,6 @@ public void onError(Exception ex) { } } - public static class DelegatedThermostatClusterQueuedPresetAttributeCallback implements ChipClusters.ThermostatCluster.QueuedPresetAttributeCallback, DelegatedClusterCallback { - private ClusterCommandCallback callback; - @Override - public void setCallbackDelegate(ClusterCommandCallback callback) { - this.callback = callback; - } - - @Override - public void onSuccess(@Nullable ChipStructs.ThermostatClusterQueuedPresetStruct value) { - Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.ThermostatClusterQueuedPresetStruct"); - responseValues.put(commandResponseInfo, value); - callback.onSuccess(responseValues); - } - - @Override - public void onError(Exception ex) { - callback.onFailure(ex); - } - } - public static class DelegatedThermostatClusterGeneratedCommandListAttributeCallback implements ChipClusters.ThermostatCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -17621,7 +17897,28 @@ public void onError(Exception ex) { } } - public static class DelegatedWiFiNetworkManagementClusterGeneratedCommandListAttributeCallback implements ChipClusters.WiFiNetworkManagementCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedWiFiNetworkManagementClusterPassphraseSurrogateAttributeCallback implements ChipClusters.WiFiNetworkManagementCluster.PassphraseSurrogateAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedWiFiNetworkManagementClusterGeneratedCommandListAttributeCallback implements ChipClusters.WiFiNetworkManagementCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -17862,9 +18159,9 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(@Nullable Long value) { + public void onSuccess(@Nullable byte[] value) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "byte[]"); responseValues.put(commandResponseInfo, value); callback.onSuccess(responseValues); } @@ -19173,7 +19470,283 @@ public void onError(Exception ex) { } } - public static class DelegatedAudioOutputClusterEventListAttributeCallback implements ChipClusters.AudioOutputCluster.EventListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedAudioOutputClusterEventListAttributeCallback implements ChipClusters.AudioOutputCluster.EventListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedAudioOutputClusterAttributeListAttributeCallback implements ChipClusters.AudioOutputCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + + public static class DelegatedApplicationLauncherClusterLauncherResponseCallback implements ChipClusters.ApplicationLauncherCluster.LauncherResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Integer status, Optional data) { + Map responseValues = new LinkedHashMap<>(); + + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); + responseValues.put(statusResponseValue, status); + CommandResponseInfo dataResponseValue = new CommandResponseInfo("data", "Optional"); + responseValues.put(dataResponseValue, data); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + public static class DelegatedApplicationLauncherClusterCatalogListAttributeCallback implements ChipClusters.ApplicationLauncherCluster.CatalogListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedApplicationLauncherClusterCurrentAppAttributeCallback implements ChipClusters.ApplicationLauncherCluster.CurrentAppAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable ChipStructs.ApplicationLauncherClusterApplicationEPStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.ApplicationLauncherClusterApplicationEPStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedApplicationLauncherClusterGeneratedCommandListAttributeCallback implements ChipClusters.ApplicationLauncherCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedApplicationLauncherClusterAcceptedCommandListAttributeCallback implements ChipClusters.ApplicationLauncherCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedApplicationLauncherClusterEventListAttributeCallback implements ChipClusters.ApplicationLauncherCluster.EventListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedApplicationLauncherClusterAttributeListAttributeCallback implements ChipClusters.ApplicationLauncherCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedApplicationBasicClusterApplicationAttributeCallback implements ChipClusters.ApplicationBasicCluster.ApplicationAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(ChipStructs.ApplicationBasicClusterApplicationStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.ApplicationBasicClusterApplicationStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedApplicationBasicClusterAllowedVendorListAttributeCallback implements ChipClusters.ApplicationBasicCluster.AllowedVendorListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedApplicationBasicClusterGeneratedCommandListAttributeCallback implements ChipClusters.ApplicationBasicCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedApplicationBasicClusterAcceptedCommandListAttributeCallback implements ChipClusters.ApplicationBasicCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedApplicationBasicClusterEventListAttributeCallback implements ChipClusters.ApplicationBasicCluster.EventListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19194,7 +19767,7 @@ public void onError(Exception ex) { } } - public static class DelegatedAudioOutputClusterAttributeListAttributeCallback implements ChipClusters.AudioOutputCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedApplicationBasicClusterAttributeListAttributeCallback implements ChipClusters.ApplicationBasicCluster.AttributeListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19216,7 +19789,7 @@ public void onError(Exception ex) { } - public static class DelegatedApplicationLauncherClusterLauncherResponseCallback implements ChipClusters.ApplicationLauncherCluster.LauncherResponseCallback, DelegatedClusterCallback { + public static class DelegatedAccountLoginClusterGetSetupPINResponseCallback implements ChipClusters.AccountLoginCluster.GetSetupPINResponseCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19224,13 +19797,11 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(Integer status, Optional data) { + public void onSuccess(String setupPIN) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); - responseValues.put(statusResponseValue, status); - CommandResponseInfo dataResponseValue = new CommandResponseInfo("data", "Optional"); - responseValues.put(dataResponseValue, data); + CommandResponseInfo setupPINResponseValue = new CommandResponseInfo("setupPIN", "String"); + responseValues.put(setupPINResponseValue, setupPIN); callback.onSuccess(responseValues); } @@ -19239,7 +19810,7 @@ public void onError(Exception error) { callback.onFailure(error); } } - public static class DelegatedApplicationLauncherClusterCatalogListAttributeCallback implements ChipClusters.ApplicationLauncherCluster.CatalogListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedAccountLoginClusterGeneratedCommandListAttributeCallback implements ChipClusters.AccountLoginCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19247,9 +19818,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); } @@ -19260,28 +19831,7 @@ public void onError(Exception ex) { } } - public static class DelegatedApplicationLauncherClusterCurrentAppAttributeCallback implements ChipClusters.ApplicationLauncherCluster.CurrentAppAttributeCallback, DelegatedClusterCallback { - private ClusterCommandCallback callback; - @Override - public void setCallbackDelegate(ClusterCommandCallback callback) { - this.callback = callback; - } - - @Override - public void onSuccess(@Nullable ChipStructs.ApplicationLauncherClusterApplicationEPStruct value) { - Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.ApplicationLauncherClusterApplicationEPStruct"); - responseValues.put(commandResponseInfo, value); - callback.onSuccess(responseValues); - } - - @Override - public void onError(Exception ex) { - callback.onFailure(ex); - } - } - - public static class DelegatedApplicationLauncherClusterGeneratedCommandListAttributeCallback implements ChipClusters.ApplicationLauncherCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedAccountLoginClusterAcceptedCommandListAttributeCallback implements ChipClusters.AccountLoginCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19302,7 +19852,7 @@ public void onError(Exception ex) { } } - public static class DelegatedApplicationLauncherClusterAcceptedCommandListAttributeCallback implements ChipClusters.ApplicationLauncherCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedAccountLoginClusterEventListAttributeCallback implements ChipClusters.AccountLoginCluster.EventListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19323,7 +19873,7 @@ public void onError(Exception ex) { } } - public static class DelegatedApplicationLauncherClusterEventListAttributeCallback implements ChipClusters.ApplicationLauncherCluster.EventListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedAccountLoginClusterAttributeListAttributeCallback implements ChipClusters.AccountLoginCluster.AttributeListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19344,7 +19894,8 @@ public void onError(Exception ex) { } } - public static class DelegatedApplicationLauncherClusterAttributeListAttributeCallback implements ChipClusters.ApplicationLauncherCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + + public static class DelegatedContentControlClusterResetPINResponseCallback implements ChipClusters.ContentControlCluster.ResetPINResponseCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19352,20 +19903,20 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(List valueList) { + public void onSuccess(String PINCode) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); - responseValues.put(commandResponseInfo, valueList); + + CommandResponseInfo PINCodeResponseValue = new CommandResponseInfo("PINCode", "String"); + responseValues.put(PINCodeResponseValue, PINCode); callback.onSuccess(responseValues); } @Override - public void onError(Exception ex) { - callback.onFailure(ex); + public void onError(Exception error) { + callback.onFailure(error); } } - - public static class DelegatedApplicationBasicClusterApplicationAttributeCallback implements ChipClusters.ApplicationBasicCluster.ApplicationAttributeCallback, DelegatedClusterCallback { + public static class DelegatedContentControlClusterOnDemandRatingsAttributeCallback implements ChipClusters.ContentControlCluster.OnDemandRatingsAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19373,10 +19924,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(ChipStructs.ApplicationBasicClusterApplicationStruct value) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.ApplicationBasicClusterApplicationStruct"); - responseValues.put(commandResponseInfo, value); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); callback.onSuccess(responseValues); } @@ -19386,7 +19937,7 @@ public void onError(Exception ex) { } } - public static class DelegatedApplicationBasicClusterAllowedVendorListAttributeCallback implements ChipClusters.ApplicationBasicCluster.AllowedVendorListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedContentControlClusterScheduledContentRatingsAttributeCallback implements ChipClusters.ContentControlCluster.ScheduledContentRatingsAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19394,9 +19945,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); } @@ -19407,7 +19958,7 @@ public void onError(Exception ex) { } } - public static class DelegatedApplicationBasicClusterGeneratedCommandListAttributeCallback implements ChipClusters.ApplicationBasicCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedContentControlClusterGeneratedCommandListAttributeCallback implements ChipClusters.ContentControlCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19428,7 +19979,7 @@ public void onError(Exception ex) { } } - public static class DelegatedApplicationBasicClusterAcceptedCommandListAttributeCallback implements ChipClusters.ApplicationBasicCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedContentControlClusterAcceptedCommandListAttributeCallback implements ChipClusters.ContentControlCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19449,7 +20000,7 @@ public void onError(Exception ex) { } } - public static class DelegatedApplicationBasicClusterEventListAttributeCallback implements ChipClusters.ApplicationBasicCluster.EventListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedContentControlClusterEventListAttributeCallback implements ChipClusters.ContentControlCluster.EventListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19470,7 +20021,7 @@ public void onError(Exception ex) { } } - public static class DelegatedApplicationBasicClusterAttributeListAttributeCallback implements ChipClusters.ApplicationBasicCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedContentControlClusterAttributeListAttributeCallback implements ChipClusters.ContentControlCluster.AttributeListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19492,7 +20043,7 @@ public void onError(Exception ex) { } - public static class DelegatedAccountLoginClusterGetSetupPINResponseCallback implements ChipClusters.AccountLoginCluster.GetSetupPINResponseCallback, DelegatedClusterCallback { + public static class DelegatedContentAppObserverClusterContentAppMessageResponseCallback implements ChipClusters.ContentAppObserverCluster.ContentAppMessageResponseCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19500,11 +20051,15 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(String setupPIN) { + public void onSuccess(Integer status, Optional data, Optional encodingHint) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo setupPINResponseValue = new CommandResponseInfo("setupPIN", "String"); - responseValues.put(setupPINResponseValue, setupPIN); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); + responseValues.put(statusResponseValue, status); + CommandResponseInfo dataResponseValue = new CommandResponseInfo("data", "Optional"); + responseValues.put(dataResponseValue, data); + CommandResponseInfo encodingHintResponseValue = new CommandResponseInfo("encodingHint", "Optional"); + responseValues.put(encodingHintResponseValue, encodingHint); callback.onSuccess(responseValues); } @@ -19513,7 +20068,7 @@ public void onError(Exception error) { callback.onFailure(error); } } - public static class DelegatedAccountLoginClusterGeneratedCommandListAttributeCallback implements ChipClusters.AccountLoginCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedContentAppObserverClusterGeneratedCommandListAttributeCallback implements ChipClusters.ContentAppObserverCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19534,7 +20089,7 @@ public void onError(Exception ex) { } } - public static class DelegatedAccountLoginClusterAcceptedCommandListAttributeCallback implements ChipClusters.AccountLoginCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedContentAppObserverClusterAcceptedCommandListAttributeCallback implements ChipClusters.ContentAppObserverCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19555,7 +20110,7 @@ public void onError(Exception ex) { } } - public static class DelegatedAccountLoginClusterEventListAttributeCallback implements ChipClusters.AccountLoginCluster.EventListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedContentAppObserverClusterEventListAttributeCallback implements ChipClusters.ContentAppObserverCluster.EventListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19576,7 +20131,7 @@ public void onError(Exception ex) { } } - public static class DelegatedAccountLoginClusterAttributeListAttributeCallback implements ChipClusters.AccountLoginCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedContentAppObserverClusterAttributeListAttributeCallback implements ChipClusters.ContentAppObserverCluster.AttributeListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19597,8 +20152,7 @@ public void onError(Exception ex) { } } - - public static class DelegatedContentControlClusterResetPINResponseCallback implements ChipClusters.ContentControlCluster.ResetPINResponseCallback, DelegatedClusterCallback { + public static class DelegatedEcosystemInformationClusterRemovedOnAttributeCallback implements ChipClusters.EcosystemInformationCluster.RemovedOnAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19606,20 +20160,20 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(String PINCode) { + public void onSuccess(@Nullable Long value) { Map responseValues = new LinkedHashMap<>(); - - CommandResponseInfo PINCodeResponseValue = new CommandResponseInfo("PINCode", "String"); - responseValues.put(PINCodeResponseValue, PINCode); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); callback.onSuccess(responseValues); } @Override - public void onError(Exception error) { - callback.onFailure(error); + public void onError(Exception ex) { + callback.onFailure(ex); } } - public static class DelegatedContentControlClusterOnDemandRatingsAttributeCallback implements ChipClusters.ContentControlCluster.OnDemandRatingsAttributeCallback, DelegatedClusterCallback { + + public static class DelegatedEcosystemInformationClusterDeviceDirectoryAttributeCallback implements ChipClusters.EcosystemInformationCluster.DeviceDirectoryAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19627,9 +20181,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); } @@ -19640,7 +20194,7 @@ public void onError(Exception ex) { } } - public static class DelegatedContentControlClusterScheduledContentRatingsAttributeCallback implements ChipClusters.ContentControlCluster.ScheduledContentRatingsAttributeCallback, DelegatedClusterCallback { + public static class DelegatedEcosystemInformationClusterLocationDirectoryAttributeCallback implements ChipClusters.EcosystemInformationCluster.LocationDirectoryAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19648,9 +20202,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); } @@ -19661,7 +20215,7 @@ public void onError(Exception ex) { } } - public static class DelegatedContentControlClusterGeneratedCommandListAttributeCallback implements ChipClusters.ContentControlCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedEcosystemInformationClusterGeneratedCommandListAttributeCallback implements ChipClusters.EcosystemInformationCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19682,7 +20236,7 @@ public void onError(Exception ex) { } } - public static class DelegatedContentControlClusterAcceptedCommandListAttributeCallback implements ChipClusters.ContentControlCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedEcosystemInformationClusterAcceptedCommandListAttributeCallback implements ChipClusters.EcosystemInformationCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19703,7 +20257,7 @@ public void onError(Exception ex) { } } - public static class DelegatedContentControlClusterEventListAttributeCallback implements ChipClusters.ContentControlCluster.EventListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedEcosystemInformationClusterEventListAttributeCallback implements ChipClusters.EcosystemInformationCluster.EventListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19724,7 +20278,7 @@ public void onError(Exception ex) { } } - public static class DelegatedContentControlClusterAttributeListAttributeCallback implements ChipClusters.ContentControlCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedEcosystemInformationClusterAttributeListAttributeCallback implements ChipClusters.EcosystemInformationCluster.AttributeListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19746,7 +20300,7 @@ public void onError(Exception ex) { } - public static class DelegatedContentAppObserverClusterContentAppMessageResponseCallback implements ChipClusters.ContentAppObserverCluster.ContentAppMessageResponseCallback, DelegatedClusterCallback { + public static class DelegatedCommissionerControlClusterReverseOpenCommissioningWindowCallback implements ChipClusters.CommissionerControlCluster.ReverseOpenCommissioningWindowCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19754,15 +20308,19 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(Integer status, Optional data, Optional encodingHint) { + public void onSuccess(Integer commissioningTimeout, byte[] PAKEPasscodeVerifier, Integer discriminator, Long iterations, byte[] salt) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); - responseValues.put(statusResponseValue, status); - CommandResponseInfo dataResponseValue = new CommandResponseInfo("data", "Optional"); - responseValues.put(dataResponseValue, data); - CommandResponseInfo encodingHintResponseValue = new CommandResponseInfo("encodingHint", "Optional"); - responseValues.put(encodingHintResponseValue, encodingHint); + CommandResponseInfo commissioningTimeoutResponseValue = new CommandResponseInfo("commissioningTimeout", "Integer"); + responseValues.put(commissioningTimeoutResponseValue, commissioningTimeout); + CommandResponseInfo PAKEPasscodeVerifierResponseValue = new CommandResponseInfo("PAKEPasscodeVerifier", "byte[]"); + responseValues.put(PAKEPasscodeVerifierResponseValue, PAKEPasscodeVerifier); + CommandResponseInfo discriminatorResponseValue = new CommandResponseInfo("discriminator", "Integer"); + responseValues.put(discriminatorResponseValue, discriminator); + CommandResponseInfo iterationsResponseValue = new CommandResponseInfo("iterations", "Long"); + responseValues.put(iterationsResponseValue, iterations); + CommandResponseInfo saltResponseValue = new CommandResponseInfo("salt", "byte[]"); + responseValues.put(saltResponseValue, salt); callback.onSuccess(responseValues); } @@ -19771,7 +20329,7 @@ public void onError(Exception error) { callback.onFailure(error); } } - public static class DelegatedContentAppObserverClusterGeneratedCommandListAttributeCallback implements ChipClusters.ContentAppObserverCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedCommissionerControlClusterGeneratedCommandListAttributeCallback implements ChipClusters.CommissionerControlCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19792,7 +20350,7 @@ public void onError(Exception ex) { } } - public static class DelegatedContentAppObserverClusterAcceptedCommandListAttributeCallback implements ChipClusters.ContentAppObserverCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedCommissionerControlClusterAcceptedCommandListAttributeCallback implements ChipClusters.CommissionerControlCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19813,7 +20371,7 @@ public void onError(Exception ex) { } } - public static class DelegatedContentAppObserverClusterEventListAttributeCallback implements ChipClusters.ContentAppObserverCluster.EventListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedCommissionerControlClusterEventListAttributeCallback implements ChipClusters.CommissionerControlCluster.EventListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -19834,7 +20392,7 @@ public void onError(Exception ex) { } } - public static class DelegatedContentAppObserverClusterAttributeListAttributeCallback implements ChipClusters.ContentAppObserverCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + public static class DelegatedCommissionerControlClusterAttributeListAttributeCallback implements ChipClusters.CommissionerControlCluster.AttributeListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override public void setCallbackDelegate(ClusterCommandCallback callback) { @@ -21748,6 +22306,10 @@ public Map initializeClusterMap() { (ptr, endpointId) -> new ChipClusters.ElectricalEnergyMeasurementCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("electricalEnergyMeasurement", electricalEnergyMeasurementClusterInfo); + ClusterInfo waterHeaterManagementClusterInfo = new ClusterInfo( + (ptr, endpointId) -> new ChipClusters.WaterHeaterManagementCluster(ptr, endpointId), new HashMap<>()); + clusterMap.put("waterHeaterManagement", waterHeaterManagementClusterInfo); + ClusterInfo demandResponseLoadControlClusterInfo = new ClusterInfo( (ptr, endpointId) -> new ChipClusters.DemandResponseLoadControlCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("demandResponseLoadControl", demandResponseLoadControlClusterInfo); @@ -21776,6 +22338,10 @@ public Map initializeClusterMap() { (ptr, endpointId) -> new ChipClusters.EnergyEvseModeCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("energyEvseMode", energyEvseModeClusterInfo); + ClusterInfo waterHeaterModeClusterInfo = new ClusterInfo( + (ptr, endpointId) -> new ChipClusters.WaterHeaterModeCluster(ptr, endpointId), new HashMap<>()); + clusterMap.put("waterHeaterMode", waterHeaterModeClusterInfo); + ClusterInfo deviceEnergyManagementModeClusterInfo = new ClusterInfo( (ptr, endpointId) -> new ChipClusters.DeviceEnergyManagementModeCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("deviceEnergyManagementMode", deviceEnergyManagementModeClusterInfo); @@ -21952,6 +22518,14 @@ public Map initializeClusterMap() { (ptr, endpointId) -> new ChipClusters.ContentAppObserverCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("contentAppObserver", contentAppObserverClusterInfo); + ClusterInfo ecosystemInformationClusterInfo = new ClusterInfo( + (ptr, endpointId) -> new ChipClusters.EcosystemInformationCluster(ptr, endpointId), new HashMap<>()); + clusterMap.put("ecosystemInformation", ecosystemInformationClusterInfo); + + ClusterInfo commissionerControlClusterInfo = new ClusterInfo( + (ptr, endpointId) -> new ChipClusters.CommissionerControlCluster(ptr, endpointId), new HashMap<>()); + clusterMap.put("commissionerControl", commissionerControlClusterInfo); + ClusterInfo electricalMeasurementClusterInfo = new ClusterInfo( (ptr, endpointId) -> new ChipClusters.ElectricalMeasurementCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("electricalMeasurement", electricalMeasurementClusterInfo); @@ -22039,6 +22613,7 @@ public void combineCommand(Map destination, Map destination, Map destination, Map> getCommandMap() { Map accessControlClusterInteractionInfoMap = new LinkedHashMap<>(); + Map accessControlreviewFabricRestrictionsCommandParams = new LinkedHashMap(); + + InteractionInfo accessControlreviewFabricRestrictionsInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.AccessControlCluster) cluster) + .reviewFabricRestrictions((DefaultClusterCallback) callback + , (ArrayList) + commandArguments.get("arl") + ); + }, + () -> new DelegatedDefaultClusterCallback(), + accessControlreviewFabricRestrictionsCommandParams + ); + accessControlClusterInteractionInfoMap.put("reviewFabricRestrictions", accessControlreviewFabricRestrictionsInteractionInfo); + commandMap.put("accessControl", accessControlClusterInteractionInfoMap); Map actionsClusterInteractionInfoMap = new LinkedHashMap<>(); @@ -23665,6 +24258,23 @@ public Map> getCommandMap() { Map bridgedDeviceBasicInformationClusterInteractionInfoMap = new LinkedHashMap<>(); + Map bridgedDeviceBasicInformationkeepActiveCommandParams = new LinkedHashMap(); + + CommandParameterInfo bridgedDeviceBasicInformationkeepActivestayActiveDurationCommandParameterInfo = new CommandParameterInfo("stayActiveDuration", Long.class, Long.class); + bridgedDeviceBasicInformationkeepActiveCommandParams.put("stayActiveDuration",bridgedDeviceBasicInformationkeepActivestayActiveDurationCommandParameterInfo); + InteractionInfo bridgedDeviceBasicInformationkeepActiveInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.BridgedDeviceBasicInformationCluster) cluster) + .keepActive((DefaultClusterCallback) callback + , (Long) + commandArguments.get("stayActiveDuration") + ); + }, + () -> new DelegatedDefaultClusterCallback(), + bridgedDeviceBasicInformationkeepActiveCommandParams + ); + bridgedDeviceBasicInformationClusterInteractionInfoMap.put("keepActive", bridgedDeviceBasicInformationkeepActiveInteractionInfo); + commandMap.put("bridgedDeviceBasicInformation", bridgedDeviceBasicInformationClusterInteractionInfoMap); Map switchClusterInteractionInfoMap = new LinkedHashMap<>(); @@ -24959,6 +25569,64 @@ public Map> getCommandMap() { commandMap.put("electricalEnergyMeasurement", electricalEnergyMeasurementClusterInteractionInfoMap); + Map waterHeaterManagementClusterInteractionInfoMap = new LinkedHashMap<>(); + + Map waterHeaterManagementboostCommandParams = new LinkedHashMap(); + + CommandParameterInfo waterHeaterManagementboostdurationCommandParameterInfo = new CommandParameterInfo("duration", Long.class, Long.class); + waterHeaterManagementboostCommandParams.put("duration",waterHeaterManagementboostdurationCommandParameterInfo); + + CommandParameterInfo waterHeaterManagementboostoneShotCommandParameterInfo = new CommandParameterInfo("oneShot", Optional.class, Boolean.class); + waterHeaterManagementboostCommandParams.put("oneShot",waterHeaterManagementboostoneShotCommandParameterInfo); + + CommandParameterInfo waterHeaterManagementboostemergencyBoostCommandParameterInfo = new CommandParameterInfo("emergencyBoost", Optional.class, Boolean.class); + waterHeaterManagementboostCommandParams.put("emergencyBoost",waterHeaterManagementboostemergencyBoostCommandParameterInfo); + + CommandParameterInfo waterHeaterManagementboosttemporarySetpointCommandParameterInfo = new CommandParameterInfo("temporarySetpoint", Optional.class, Integer.class); + waterHeaterManagementboostCommandParams.put("temporarySetpoint",waterHeaterManagementboosttemporarySetpointCommandParameterInfo); + + CommandParameterInfo waterHeaterManagementboosttargetPercentageCommandParameterInfo = new CommandParameterInfo("targetPercentage", Optional.class, Integer.class); + waterHeaterManagementboostCommandParams.put("targetPercentage",waterHeaterManagementboosttargetPercentageCommandParameterInfo); + + CommandParameterInfo waterHeaterManagementboosttargetReheatCommandParameterInfo = new CommandParameterInfo("targetReheat", Optional.class, Integer.class); + waterHeaterManagementboostCommandParams.put("targetReheat",waterHeaterManagementboosttargetReheatCommandParameterInfo); + InteractionInfo waterHeaterManagementboostInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterManagementCluster) cluster) + .boost((DefaultClusterCallback) callback + , (Long) + commandArguments.get("duration") + , (Optional) + commandArguments.get("oneShot") + , (Optional) + commandArguments.get("emergencyBoost") + , (Optional) + commandArguments.get("temporarySetpoint") + , (Optional) + commandArguments.get("targetPercentage") + , (Optional) + commandArguments.get("targetReheat") + ); + }, + () -> new DelegatedDefaultClusterCallback(), + waterHeaterManagementboostCommandParams + ); + waterHeaterManagementClusterInteractionInfoMap.put("boost", waterHeaterManagementboostInteractionInfo); + + Map waterHeaterManagementcancelBoostCommandParams = new LinkedHashMap(); + InteractionInfo waterHeaterManagementcancelBoostInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterManagementCluster) cluster) + .cancelBoost((DefaultClusterCallback) callback + ); + }, + () -> new DelegatedDefaultClusterCallback(), + waterHeaterManagementcancelBoostCommandParams + ); + waterHeaterManagementClusterInteractionInfoMap.put("cancelBoost", waterHeaterManagementcancelBoostInteractionInfo); + + commandMap.put("waterHeaterManagement", waterHeaterManagementClusterInteractionInfoMap); + Map demandResponseLoadControlClusterInteractionInfoMap = new LinkedHashMap<>(); Map demandResponseLoadControlregisterLoadControlProgramRequestCommandParams = new LinkedHashMap(); @@ -25412,6 +26080,28 @@ public Map> getCommandMap() { commandMap.put("energyEvseMode", energyEvseModeClusterInteractionInfoMap); + Map waterHeaterModeClusterInteractionInfoMap = new LinkedHashMap<>(); + + Map waterHeaterModechangeToModeCommandParams = new LinkedHashMap(); + + CommandParameterInfo waterHeaterModechangeToModenewModeCommandParameterInfo = new CommandParameterInfo("newMode", Integer.class, Integer.class); + waterHeaterModechangeToModeCommandParams.put("newMode",waterHeaterModechangeToModenewModeCommandParameterInfo); + InteractionInfo waterHeaterModechangeToModeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterModeCluster) cluster) + .changeToMode((ChipClusters.WaterHeaterModeCluster.ChangeToModeResponseCallback) callback + , (Integer) + commandArguments.get("newMode") + + ); + }, + () -> new DelegatedWaterHeaterModeClusterChangeToModeResponseCallback(), + waterHeaterModechangeToModeCommandParams + ); + waterHeaterModeClusterInteractionInfoMap.put("changeToMode", waterHeaterModechangeToModeInteractionInfo); + + commandMap.put("waterHeaterMode", waterHeaterModeClusterInteractionInfoMap); + Map deviceEnergyManagementModeClusterInteractionInfoMap = new LinkedHashMap<>(); Map deviceEnergyManagementModechangeToModeCommandParams = new LinkedHashMap(); @@ -26242,17 +26932,12 @@ public Map> getCommandMap() { CommandParameterInfo thermostatsetActivePresetRequestpresetHandleCommandParameterInfo = new CommandParameterInfo("presetHandle", byte[].class, byte[].class); thermostatsetActivePresetRequestCommandParams.put("presetHandle",thermostatsetActivePresetRequestpresetHandleCommandParameterInfo); - - CommandParameterInfo thermostatsetActivePresetRequestdelayMinutesCommandParameterInfo = new CommandParameterInfo("delayMinutes", Optional.class, Integer.class); - thermostatsetActivePresetRequestCommandParams.put("delayMinutes",thermostatsetActivePresetRequestdelayMinutesCommandParameterInfo); InteractionInfo thermostatsetActivePresetRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThermostatCluster) cluster) .setActivePresetRequest((DefaultClusterCallback) callback , (byte[]) commandArguments.get("presetHandle") - , (Optional) - commandArguments.get("delayMinutes") ); }, () -> new DelegatedDefaultClusterCallback(), @@ -26301,35 +26986,6 @@ public Map> getCommandMap() { ); thermostatClusterInteractionInfoMap.put("commitPresetsSchedulesRequest", thermostatcommitPresetsSchedulesRequestInteractionInfo); - Map thermostatcancelSetActivePresetRequestCommandParams = new LinkedHashMap(); - InteractionInfo thermostatcancelSetActivePresetRequestInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.ThermostatCluster) cluster) - .cancelSetActivePresetRequest((DefaultClusterCallback) callback - ); - }, - () -> new DelegatedDefaultClusterCallback(), - thermostatcancelSetActivePresetRequestCommandParams - ); - thermostatClusterInteractionInfoMap.put("cancelSetActivePresetRequest", thermostatcancelSetActivePresetRequestInteractionInfo); - - Map thermostatsetTemperatureSetpointHoldPolicyCommandParams = new LinkedHashMap(); - - CommandParameterInfo thermostatsetTemperatureSetpointHoldPolicytemperatureSetpointHoldPolicyCommandParameterInfo = new CommandParameterInfo("temperatureSetpointHoldPolicy", Integer.class, Integer.class); - thermostatsetTemperatureSetpointHoldPolicyCommandParams.put("temperatureSetpointHoldPolicy",thermostatsetTemperatureSetpointHoldPolicytemperatureSetpointHoldPolicyCommandParameterInfo); - InteractionInfo thermostatsetTemperatureSetpointHoldPolicyInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.ThermostatCluster) cluster) - .setTemperatureSetpointHoldPolicy((DefaultClusterCallback) callback - , (Integer) - commandArguments.get("temperatureSetpointHoldPolicy") - ); - }, - () -> new DelegatedDefaultClusterCallback(), - thermostatsetTemperatureSetpointHoldPolicyCommandParams - ); - thermostatClusterInteractionInfoMap.put("setTemperatureSetpointHoldPolicy", thermostatsetTemperatureSetpointHoldPolicyInteractionInfo); - commandMap.put("thermostat", thermostatClusterInteractionInfoMap); Map fanControlClusterInteractionInfoMap = new LinkedHashMap<>(); @@ -27226,13 +27882,13 @@ public Map> getCommandMap() { Map threadNetworkDirectoryremoveNetworkCommandParams = new LinkedHashMap(); - CommandParameterInfo threadNetworkDirectoryremoveNetworkextendedPanIDCommandParameterInfo = new CommandParameterInfo("extendedPanID", Long.class, Long.class); + CommandParameterInfo threadNetworkDirectoryremoveNetworkextendedPanIDCommandParameterInfo = new CommandParameterInfo("extendedPanID", byte[].class, byte[].class); threadNetworkDirectoryremoveNetworkCommandParams.put("extendedPanID",threadNetworkDirectoryremoveNetworkextendedPanIDCommandParameterInfo); InteractionInfo threadNetworkDirectoryremoveNetworkInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThreadNetworkDirectoryCluster) cluster) .removeNetwork((DefaultClusterCallback) callback - , (Long) + , (byte[]) commandArguments.get("extendedPanID"), 10000 ); }, @@ -27243,16 +27899,16 @@ public Map> getCommandMap() { Map threadNetworkDirectorygetOperationalDatasetCommandParams = new LinkedHashMap(); - CommandParameterInfo threadNetworkDirectorygetOperationalDatasetextendedPanIDCommandParameterInfo = new CommandParameterInfo("extendedPanID", Long.class, Long.class); + CommandParameterInfo threadNetworkDirectorygetOperationalDatasetextendedPanIDCommandParameterInfo = new CommandParameterInfo("extendedPanID", byte[].class, byte[].class); threadNetworkDirectorygetOperationalDatasetCommandParams.put("extendedPanID",threadNetworkDirectorygetOperationalDatasetextendedPanIDCommandParameterInfo); InteractionInfo threadNetworkDirectorygetOperationalDatasetInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThreadNetworkDirectoryCluster) cluster) .getOperationalDataset((ChipClusters.ThreadNetworkDirectoryCluster.OperationalDatasetResponseCallback) callback - , (Long) + , (byte[]) commandArguments.get("extendedPanID") - , 10000); + ); }, () -> new DelegatedThreadNetworkDirectoryClusterOperationalDatasetResponseCallback(), threadNetworkDirectorygetOperationalDatasetCommandParams @@ -28212,6 +28868,82 @@ public Map> getCommandMap() { commandMap.put("contentAppObserver", contentAppObserverClusterInteractionInfoMap); + Map ecosystemInformationClusterInteractionInfoMap = new LinkedHashMap<>(); + + commandMap.put("ecosystemInformation", ecosystemInformationClusterInteractionInfoMap); + + Map commissionerControlClusterInteractionInfoMap = new LinkedHashMap<>(); + + Map commissionerControlrequestCommissioningApprovalCommandParams = new LinkedHashMap(); + + CommandParameterInfo commissionerControlrequestCommissioningApprovalrequestIdCommandParameterInfo = new CommandParameterInfo("requestId", Long.class, Long.class); + commissionerControlrequestCommissioningApprovalCommandParams.put("requestId",commissionerControlrequestCommissioningApprovalrequestIdCommandParameterInfo); + + CommandParameterInfo commissionerControlrequestCommissioningApprovalvendorIdCommandParameterInfo = new CommandParameterInfo("vendorId", Integer.class, Integer.class); + commissionerControlrequestCommissioningApprovalCommandParams.put("vendorId",commissionerControlrequestCommissioningApprovalvendorIdCommandParameterInfo); + + CommandParameterInfo commissionerControlrequestCommissioningApprovalproductIdCommandParameterInfo = new CommandParameterInfo("productId", Integer.class, Integer.class); + commissionerControlrequestCommissioningApprovalCommandParams.put("productId",commissionerControlrequestCommissioningApprovalproductIdCommandParameterInfo); + + CommandParameterInfo commissionerControlrequestCommissioningApprovallabelCommandParameterInfo = new CommandParameterInfo("label", Optional.class, String.class); + commissionerControlrequestCommissioningApprovalCommandParams.put("label",commissionerControlrequestCommissioningApprovallabelCommandParameterInfo); + InteractionInfo commissionerControlrequestCommissioningApprovalInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.CommissionerControlCluster) cluster) + .requestCommissioningApproval((DefaultClusterCallback) callback + , (Long) + commandArguments.get("requestId") + , (Integer) + commandArguments.get("vendorId") + , (Integer) + commandArguments.get("productId") + , (Optional) + commandArguments.get("label") + ); + }, + () -> new DelegatedDefaultClusterCallback(), + commissionerControlrequestCommissioningApprovalCommandParams + ); + commissionerControlClusterInteractionInfoMap.put("requestCommissioningApproval", commissionerControlrequestCommissioningApprovalInteractionInfo); + + Map commissionerControlcommissionNodeCommandParams = new LinkedHashMap(); + + CommandParameterInfo commissionerControlcommissionNoderequestIdCommandParameterInfo = new CommandParameterInfo("requestId", Long.class, Long.class); + commissionerControlcommissionNodeCommandParams.put("requestId",commissionerControlcommissionNoderequestIdCommandParameterInfo); + + CommandParameterInfo commissionerControlcommissionNoderesponseTimeoutSecondsCommandParameterInfo = new CommandParameterInfo("responseTimeoutSeconds", Integer.class, Integer.class); + commissionerControlcommissionNodeCommandParams.put("responseTimeoutSeconds",commissionerControlcommissionNoderesponseTimeoutSecondsCommandParameterInfo); + + CommandParameterInfo commissionerControlcommissionNodeipAddressCommandParameterInfo = new CommandParameterInfo("ipAddress", Optional.class, byte[].class); + commissionerControlcommissionNodeCommandParams.put("ipAddress",commissionerControlcommissionNodeipAddressCommandParameterInfo); + + CommandParameterInfo commissionerControlcommissionNodeportCommandParameterInfo = new CommandParameterInfo("port", Optional.class, Integer.class); + commissionerControlcommissionNodeCommandParams.put("port",commissionerControlcommissionNodeportCommandParameterInfo); + InteractionInfo commissionerControlcommissionNodeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.CommissionerControlCluster) cluster) + .commissionNode((ChipClusters.CommissionerControlCluster.ReverseOpenCommissioningWindowCallback) callback + , (Long) + commandArguments.get("requestId") + + , (Integer) + commandArguments.get("responseTimeoutSeconds") + + , (Optional) + commandArguments.get("ipAddress") + + , (Optional) + commandArguments.get("port") + + ); + }, + () -> new DelegatedCommissionerControlClusterReverseOpenCommissioningWindowCallback(), + commissionerControlcommissionNodeCommandParams + ); + commissionerControlClusterInteractionInfoMap.put("commissionNode", commissionerControlcommissionNodeInteractionInfo); + + commandMap.put("commissionerControl", commissionerControlClusterInteractionInfoMap); + Map electricalMeasurementClusterInteractionInfoMap = new LinkedHashMap<>(); Map electricalMeasurementgetProfileInfoCommandCommandParams = 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 cbf57969d6f96f..9429c815ceb3dc 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -1140,6 +1140,28 @@ private static Map readAccessControlInteractionInfo() { readAccessControlAccessControlEntriesPerFabricCommandParams ); result.put("readAccessControlEntriesPerFabricAttribute", readAccessControlAccessControlEntriesPerFabricAttributeInteractionInfo); + Map readAccessControlCommissioningARLCommandParams = new LinkedHashMap(); + InteractionInfo readAccessControlCommissioningARLAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.AccessControlCluster) cluster).readCommissioningARLAttribute( + (ChipClusters.AccessControlCluster.CommissioningARLAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedAccessControlClusterCommissioningARLAttributeCallback(), + readAccessControlCommissioningARLCommandParams + ); + result.put("readCommissioningARLAttribute", readAccessControlCommissioningARLAttributeInteractionInfo); + Map readAccessControlArlCommandParams = new LinkedHashMap(); + InteractionInfo readAccessControlArlAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.AccessControlCluster) cluster).readArlAttribute( + (ChipClusters.AccessControlCluster.ArlAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedAccessControlClusterArlAttributeCallback(), + readAccessControlArlCommandParams + ); + result.put("readArlAttribute", readAccessControlArlAttributeInteractionInfo); Map readAccessControlGeneratedCommandListCommandParams = new LinkedHashMap(); InteractionInfo readAccessControlGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -5803,6 +5825,17 @@ private static Map readIcdManagementInteractionInfo() { readIcdManagementOperatingModeCommandParams ); result.put("readOperatingModeAttribute", readIcdManagementOperatingModeAttributeInteractionInfo); + Map readIcdManagementMaximumCheckInBackOffCommandParams = new LinkedHashMap(); + InteractionInfo readIcdManagementMaximumCheckInBackOffAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.IcdManagementCluster) cluster).readMaximumCheckInBackOffAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readIcdManagementMaximumCheckInBackOffCommandParams + ); + result.put("readMaximumCheckInBackOffAttribute", readIcdManagementMaximumCheckInBackOffAttributeInteractionInfo); Map readIcdManagementGeneratedCommandListCommandParams = new LinkedHashMap(); InteractionInfo readIcdManagementGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -9313,6 +9346,142 @@ private static Map readElectricalEnergyMeasurementInter return result; } + private static Map readWaterHeaterManagementInteractionInfo() { + Map result = new LinkedHashMap<>();Map readWaterHeaterManagementHeaterTypesCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterManagementHeaterTypesAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterManagementCluster) cluster).readHeaterTypesAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readWaterHeaterManagementHeaterTypesCommandParams + ); + result.put("readHeaterTypesAttribute", readWaterHeaterManagementHeaterTypesAttributeInteractionInfo); + Map readWaterHeaterManagementHeatDemandCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterManagementHeatDemandAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterManagementCluster) cluster).readHeatDemandAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readWaterHeaterManagementHeatDemandCommandParams + ); + result.put("readHeatDemandAttribute", readWaterHeaterManagementHeatDemandAttributeInteractionInfo); + Map readWaterHeaterManagementTankVolumeCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterManagementTankVolumeAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterManagementCluster) cluster).readTankVolumeAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readWaterHeaterManagementTankVolumeCommandParams + ); + result.put("readTankVolumeAttribute", readWaterHeaterManagementTankVolumeAttributeInteractionInfo); + Map readWaterHeaterManagementEstimatedHeatRequiredCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterManagementEstimatedHeatRequiredAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterManagementCluster) cluster).readEstimatedHeatRequiredAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readWaterHeaterManagementEstimatedHeatRequiredCommandParams + ); + result.put("readEstimatedHeatRequiredAttribute", readWaterHeaterManagementEstimatedHeatRequiredAttributeInteractionInfo); + Map readWaterHeaterManagementTankPercentageCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterManagementTankPercentageAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterManagementCluster) cluster).readTankPercentageAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readWaterHeaterManagementTankPercentageCommandParams + ); + result.put("readTankPercentageAttribute", readWaterHeaterManagementTankPercentageAttributeInteractionInfo); + Map readWaterHeaterManagementBoostStateCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterManagementBoostStateAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterManagementCluster) cluster).readBoostStateAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readWaterHeaterManagementBoostStateCommandParams + ); + result.put("readBoostStateAttribute", readWaterHeaterManagementBoostStateAttributeInteractionInfo); + Map readWaterHeaterManagementGeneratedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterManagementGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterManagementCluster) cluster).readGeneratedCommandListAttribute( + (ChipClusters.WaterHeaterManagementCluster.GeneratedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWaterHeaterManagementClusterGeneratedCommandListAttributeCallback(), + readWaterHeaterManagementGeneratedCommandListCommandParams + ); + result.put("readGeneratedCommandListAttribute", readWaterHeaterManagementGeneratedCommandListAttributeInteractionInfo); + Map readWaterHeaterManagementAcceptedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterManagementAcceptedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterManagementCluster) cluster).readAcceptedCommandListAttribute( + (ChipClusters.WaterHeaterManagementCluster.AcceptedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWaterHeaterManagementClusterAcceptedCommandListAttributeCallback(), + readWaterHeaterManagementAcceptedCommandListCommandParams + ); + result.put("readAcceptedCommandListAttribute", readWaterHeaterManagementAcceptedCommandListAttributeInteractionInfo); + Map readWaterHeaterManagementEventListCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterManagementEventListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterManagementCluster) cluster).readEventListAttribute( + (ChipClusters.WaterHeaterManagementCluster.EventListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWaterHeaterManagementClusterEventListAttributeCallback(), + readWaterHeaterManagementEventListCommandParams + ); + result.put("readEventListAttribute", readWaterHeaterManagementEventListAttributeInteractionInfo); + Map readWaterHeaterManagementAttributeListCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterManagementAttributeListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterManagementCluster) cluster).readAttributeListAttribute( + (ChipClusters.WaterHeaterManagementCluster.AttributeListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWaterHeaterManagementClusterAttributeListAttributeCallback(), + readWaterHeaterManagementAttributeListCommandParams + ); + result.put("readAttributeListAttribute", readWaterHeaterManagementAttributeListAttributeInteractionInfo); + Map readWaterHeaterManagementFeatureMapCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterManagementFeatureMapAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterManagementCluster) cluster).readFeatureMapAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readWaterHeaterManagementFeatureMapCommandParams + ); + result.put("readFeatureMapAttribute", readWaterHeaterManagementFeatureMapAttributeInteractionInfo); + Map readWaterHeaterManagementClusterRevisionCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterManagementClusterRevisionAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterManagementCluster) cluster).readClusterRevisionAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readWaterHeaterManagementClusterRevisionCommandParams + ); + result.put("readClusterRevisionAttribute", readWaterHeaterManagementClusterRevisionAttributeInteractionInfo); + + return result; + } private static Map readDemandResponseLoadControlInteractionInfo() { Map result = new LinkedHashMap<>();Map readDemandResponseLoadControlLoadControlProgramsCommandParams = new LinkedHashMap(); InteractionInfo readDemandResponseLoadControlLoadControlProgramsAttributeInteractionInfo = new InteractionInfo( @@ -10353,6 +10522,120 @@ private static Map readEnergyEvseModeInteractionInfo() return result; } + private static Map readWaterHeaterModeInteractionInfo() { + Map result = new LinkedHashMap<>();Map readWaterHeaterModeSupportedModesCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterModeSupportedModesAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterModeCluster) cluster).readSupportedModesAttribute( + (ChipClusters.WaterHeaterModeCluster.SupportedModesAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWaterHeaterModeClusterSupportedModesAttributeCallback(), + readWaterHeaterModeSupportedModesCommandParams + ); + result.put("readSupportedModesAttribute", readWaterHeaterModeSupportedModesAttributeInteractionInfo); + Map readWaterHeaterModeCurrentModeCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterModeCurrentModeAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterModeCluster) cluster).readCurrentModeAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readWaterHeaterModeCurrentModeCommandParams + ); + result.put("readCurrentModeAttribute", readWaterHeaterModeCurrentModeAttributeInteractionInfo); + Map readWaterHeaterModeStartUpModeCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterModeStartUpModeAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterModeCluster) cluster).readStartUpModeAttribute( + (ChipClusters.WaterHeaterModeCluster.StartUpModeAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWaterHeaterModeClusterStartUpModeAttributeCallback(), + readWaterHeaterModeStartUpModeCommandParams + ); + result.put("readStartUpModeAttribute", readWaterHeaterModeStartUpModeAttributeInteractionInfo); + Map readWaterHeaterModeOnModeCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterModeOnModeAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterModeCluster) cluster).readOnModeAttribute( + (ChipClusters.WaterHeaterModeCluster.OnModeAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWaterHeaterModeClusterOnModeAttributeCallback(), + readWaterHeaterModeOnModeCommandParams + ); + result.put("readOnModeAttribute", readWaterHeaterModeOnModeAttributeInteractionInfo); + Map readWaterHeaterModeGeneratedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterModeGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterModeCluster) cluster).readGeneratedCommandListAttribute( + (ChipClusters.WaterHeaterModeCluster.GeneratedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWaterHeaterModeClusterGeneratedCommandListAttributeCallback(), + readWaterHeaterModeGeneratedCommandListCommandParams + ); + result.put("readGeneratedCommandListAttribute", readWaterHeaterModeGeneratedCommandListAttributeInteractionInfo); + Map readWaterHeaterModeAcceptedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterModeAcceptedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterModeCluster) cluster).readAcceptedCommandListAttribute( + (ChipClusters.WaterHeaterModeCluster.AcceptedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWaterHeaterModeClusterAcceptedCommandListAttributeCallback(), + readWaterHeaterModeAcceptedCommandListCommandParams + ); + result.put("readAcceptedCommandListAttribute", readWaterHeaterModeAcceptedCommandListAttributeInteractionInfo); + Map readWaterHeaterModeEventListCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterModeEventListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterModeCluster) cluster).readEventListAttribute( + (ChipClusters.WaterHeaterModeCluster.EventListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWaterHeaterModeClusterEventListAttributeCallback(), + readWaterHeaterModeEventListCommandParams + ); + result.put("readEventListAttribute", readWaterHeaterModeEventListAttributeInteractionInfo); + Map readWaterHeaterModeAttributeListCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterModeAttributeListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterModeCluster) cluster).readAttributeListAttribute( + (ChipClusters.WaterHeaterModeCluster.AttributeListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWaterHeaterModeClusterAttributeListAttributeCallback(), + readWaterHeaterModeAttributeListCommandParams + ); + result.put("readAttributeListAttribute", readWaterHeaterModeAttributeListAttributeInteractionInfo); + Map readWaterHeaterModeFeatureMapCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterModeFeatureMapAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterModeCluster) cluster).readFeatureMapAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readWaterHeaterModeFeatureMapCommandParams + ); + result.put("readFeatureMapAttribute", readWaterHeaterModeFeatureMapAttributeInteractionInfo); + Map readWaterHeaterModeClusterRevisionCommandParams = new LinkedHashMap(); + InteractionInfo readWaterHeaterModeClusterRevisionAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterModeCluster) cluster).readClusterRevisionAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readWaterHeaterModeClusterRevisionCommandParams + ); + result.put("readClusterRevisionAttribute", readWaterHeaterModeClusterRevisionAttributeInteractionInfo); + + return result; + } private static Map readDeviceEnergyManagementModeInteractionInfo() { Map result = new LinkedHashMap<>();Map readDeviceEnergyManagementModeSupportedModesCommandParams = new LinkedHashMap(); InteractionInfo readDeviceEnergyManagementModeSupportedModesAttributeInteractionInfo = new InteractionInfo( @@ -12644,17 +12927,6 @@ private static Map readThermostatInteractionInfo() { readThermostatPresetsSchedulesEditableCommandParams ); result.put("readPresetsSchedulesEditableAttribute", readThermostatPresetsSchedulesEditableAttributeInteractionInfo); - Map readThermostatTemperatureSetpointHoldPolicyCommandParams = new LinkedHashMap(); - InteractionInfo readThermostatTemperatureSetpointHoldPolicyAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.ThermostatCluster) cluster).readTemperatureSetpointHoldPolicyAttribute( - (ChipClusters.IntegerAttributeCallback) callback - ); - }, - () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), - readThermostatTemperatureSetpointHoldPolicyCommandParams - ); - result.put("readTemperatureSetpointHoldPolicyAttribute", readThermostatTemperatureSetpointHoldPolicyAttributeInteractionInfo); Map readThermostatSetpointHoldExpiryTimestampCommandParams = new LinkedHashMap(); InteractionInfo readThermostatSetpointHoldExpiryTimestampAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -16677,6 +16949,17 @@ private static Map readWiFiNetworkManagementInteraction readWiFiNetworkManagementSsidCommandParams ); result.put("readSsidAttribute", readWiFiNetworkManagementSsidAttributeInteractionInfo); + Map readWiFiNetworkManagementPassphraseSurrogateCommandParams = new LinkedHashMap(); + InteractionInfo readWiFiNetworkManagementPassphraseSurrogateAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WiFiNetworkManagementCluster) cluster).readPassphraseSurrogateAttribute( + (ChipClusters.WiFiNetworkManagementCluster.PassphraseSurrogateAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedWiFiNetworkManagementClusterPassphraseSurrogateAttributeCallback(), + readWiFiNetworkManagementPassphraseSurrogateCommandParams + ); + result.put("readPassphraseSurrogateAttribute", readWiFiNetworkManagementPassphraseSurrogateAttributeInteractionInfo); Map readWiFiNetworkManagementGeneratedCommandListCommandParams = new LinkedHashMap(); InteractionInfo readWiFiNetworkManagementGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -18339,6 +18622,190 @@ private static Map readContentAppObserverInteractionInf return result; } + private static Map readEcosystemInformationInteractionInfo() { + Map result = new LinkedHashMap<>();Map readEcosystemInformationRemovedOnCommandParams = new LinkedHashMap(); + InteractionInfo readEcosystemInformationRemovedOnAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EcosystemInformationCluster) cluster).readRemovedOnAttribute( + (ChipClusters.EcosystemInformationCluster.RemovedOnAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEcosystemInformationClusterRemovedOnAttributeCallback(), + readEcosystemInformationRemovedOnCommandParams + ); + result.put("readRemovedOnAttribute", readEcosystemInformationRemovedOnAttributeInteractionInfo); + Map readEcosystemInformationDeviceDirectoryCommandParams = new LinkedHashMap(); + InteractionInfo readEcosystemInformationDeviceDirectoryAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EcosystemInformationCluster) cluster).readDeviceDirectoryAttribute( + (ChipClusters.EcosystemInformationCluster.DeviceDirectoryAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEcosystemInformationClusterDeviceDirectoryAttributeCallback(), + readEcosystemInformationDeviceDirectoryCommandParams + ); + result.put("readDeviceDirectoryAttribute", readEcosystemInformationDeviceDirectoryAttributeInteractionInfo); + Map readEcosystemInformationLocationDirectoryCommandParams = new LinkedHashMap(); + InteractionInfo readEcosystemInformationLocationDirectoryAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EcosystemInformationCluster) cluster).readLocationDirectoryAttribute( + (ChipClusters.EcosystemInformationCluster.LocationDirectoryAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEcosystemInformationClusterLocationDirectoryAttributeCallback(), + readEcosystemInformationLocationDirectoryCommandParams + ); + result.put("readLocationDirectoryAttribute", readEcosystemInformationLocationDirectoryAttributeInteractionInfo); + Map readEcosystemInformationGeneratedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readEcosystemInformationGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EcosystemInformationCluster) cluster).readGeneratedCommandListAttribute( + (ChipClusters.EcosystemInformationCluster.GeneratedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEcosystemInformationClusterGeneratedCommandListAttributeCallback(), + readEcosystemInformationGeneratedCommandListCommandParams + ); + result.put("readGeneratedCommandListAttribute", readEcosystemInformationGeneratedCommandListAttributeInteractionInfo); + Map readEcosystemInformationAcceptedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readEcosystemInformationAcceptedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EcosystemInformationCluster) cluster).readAcceptedCommandListAttribute( + (ChipClusters.EcosystemInformationCluster.AcceptedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEcosystemInformationClusterAcceptedCommandListAttributeCallback(), + readEcosystemInformationAcceptedCommandListCommandParams + ); + result.put("readAcceptedCommandListAttribute", readEcosystemInformationAcceptedCommandListAttributeInteractionInfo); + Map readEcosystemInformationEventListCommandParams = new LinkedHashMap(); + InteractionInfo readEcosystemInformationEventListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EcosystemInformationCluster) cluster).readEventListAttribute( + (ChipClusters.EcosystemInformationCluster.EventListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEcosystemInformationClusterEventListAttributeCallback(), + readEcosystemInformationEventListCommandParams + ); + result.put("readEventListAttribute", readEcosystemInformationEventListAttributeInteractionInfo); + Map readEcosystemInformationAttributeListCommandParams = new LinkedHashMap(); + InteractionInfo readEcosystemInformationAttributeListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EcosystemInformationCluster) cluster).readAttributeListAttribute( + (ChipClusters.EcosystemInformationCluster.AttributeListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedEcosystemInformationClusterAttributeListAttributeCallback(), + readEcosystemInformationAttributeListCommandParams + ); + result.put("readAttributeListAttribute", readEcosystemInformationAttributeListAttributeInteractionInfo); + Map readEcosystemInformationFeatureMapCommandParams = new LinkedHashMap(); + InteractionInfo readEcosystemInformationFeatureMapAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EcosystemInformationCluster) cluster).readFeatureMapAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readEcosystemInformationFeatureMapCommandParams + ); + result.put("readFeatureMapAttribute", readEcosystemInformationFeatureMapAttributeInteractionInfo); + Map readEcosystemInformationClusterRevisionCommandParams = new LinkedHashMap(); + InteractionInfo readEcosystemInformationClusterRevisionAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.EcosystemInformationCluster) cluster).readClusterRevisionAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readEcosystemInformationClusterRevisionCommandParams + ); + result.put("readClusterRevisionAttribute", readEcosystemInformationClusterRevisionAttributeInteractionInfo); + + return result; + } + private static Map readCommissionerControlInteractionInfo() { + Map result = new LinkedHashMap<>();Map readCommissionerControlSupportedDeviceCategoriesCommandParams = new LinkedHashMap(); + InteractionInfo readCommissionerControlSupportedDeviceCategoriesAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.CommissionerControlCluster) cluster).readSupportedDeviceCategoriesAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readCommissionerControlSupportedDeviceCategoriesCommandParams + ); + result.put("readSupportedDeviceCategoriesAttribute", readCommissionerControlSupportedDeviceCategoriesAttributeInteractionInfo); + Map readCommissionerControlGeneratedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readCommissionerControlGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.CommissionerControlCluster) cluster).readGeneratedCommandListAttribute( + (ChipClusters.CommissionerControlCluster.GeneratedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedCommissionerControlClusterGeneratedCommandListAttributeCallback(), + readCommissionerControlGeneratedCommandListCommandParams + ); + result.put("readGeneratedCommandListAttribute", readCommissionerControlGeneratedCommandListAttributeInteractionInfo); + Map readCommissionerControlAcceptedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readCommissionerControlAcceptedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.CommissionerControlCluster) cluster).readAcceptedCommandListAttribute( + (ChipClusters.CommissionerControlCluster.AcceptedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedCommissionerControlClusterAcceptedCommandListAttributeCallback(), + readCommissionerControlAcceptedCommandListCommandParams + ); + result.put("readAcceptedCommandListAttribute", readCommissionerControlAcceptedCommandListAttributeInteractionInfo); + Map readCommissionerControlEventListCommandParams = new LinkedHashMap(); + InteractionInfo readCommissionerControlEventListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.CommissionerControlCluster) cluster).readEventListAttribute( + (ChipClusters.CommissionerControlCluster.EventListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedCommissionerControlClusterEventListAttributeCallback(), + readCommissionerControlEventListCommandParams + ); + result.put("readEventListAttribute", readCommissionerControlEventListAttributeInteractionInfo); + Map readCommissionerControlAttributeListCommandParams = new LinkedHashMap(); + InteractionInfo readCommissionerControlAttributeListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.CommissionerControlCluster) cluster).readAttributeListAttribute( + (ChipClusters.CommissionerControlCluster.AttributeListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedCommissionerControlClusterAttributeListAttributeCallback(), + readCommissionerControlAttributeListCommandParams + ); + result.put("readAttributeListAttribute", readCommissionerControlAttributeListAttributeInteractionInfo); + Map readCommissionerControlFeatureMapCommandParams = new LinkedHashMap(); + InteractionInfo readCommissionerControlFeatureMapAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.CommissionerControlCluster) cluster).readFeatureMapAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readCommissionerControlFeatureMapCommandParams + ); + result.put("readFeatureMapAttribute", readCommissionerControlFeatureMapAttributeInteractionInfo); + Map readCommissionerControlClusterRevisionCommandParams = new LinkedHashMap(); + InteractionInfo readCommissionerControlClusterRevisionAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.CommissionerControlCluster) cluster).readClusterRevisionAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readCommissionerControlClusterRevisionCommandParams + ); + result.put("readClusterRevisionAttribute", readCommissionerControlClusterRevisionAttributeInteractionInfo); + + return result; + } private static Map readElectricalMeasurementInteractionInfo() { Map result = new LinkedHashMap<>();Map readElectricalMeasurementMeasurementTypeCommandParams = new LinkedHashMap(); InteractionInfo readElectricalMeasurementMeasurementTypeAttributeInteractionInfo = new InteractionInfo( @@ -21000,6 +21467,7 @@ public Map> getReadAttributeMap() { put("valveConfigurationAndControl", readValveConfigurationAndControlInteractionInfo()); put("electricalPowerMeasurement", readElectricalPowerMeasurementInteractionInfo()); put("electricalEnergyMeasurement", readElectricalEnergyMeasurementInteractionInfo()); + put("waterHeaterManagement", readWaterHeaterManagementInteractionInfo()); put("demandResponseLoadControl", readDemandResponseLoadControlInteractionInfo()); put("messages", readMessagesInteractionInfo()); put("deviceEnergyManagement", readDeviceEnergyManagementInteractionInfo()); @@ -21007,6 +21475,7 @@ public Map> getReadAttributeMap() { put("energyPreference", readEnergyPreferenceInteractionInfo()); put("powerTopology", readPowerTopologyInteractionInfo()); put("energyEvseMode", readEnergyEvseModeInteractionInfo()); + put("waterHeaterMode", readWaterHeaterModeInteractionInfo()); put("deviceEnergyManagementMode", readDeviceEnergyManagementModeInteractionInfo()); put("doorLock", readDoorLockInteractionInfo()); put("windowCovering", readWindowCoveringInteractionInfo()); @@ -21051,6 +21520,8 @@ public Map> getReadAttributeMap() { put("accountLogin", readAccountLoginInteractionInfo()); put("contentControl", readContentControlInteractionInfo()); put("contentAppObserver", readContentAppObserverInteractionInfo()); + put("ecosystemInformation", readEcosystemInformationInteractionInfo()); + put("commissionerControl", readCommissionerControlInteractionInfo()); put("electricalMeasurement", readElectricalMeasurementInteractionInfo()); put("unitTesting", readUnitTestingInteractionInfo()); put("faultInjection", readFaultInjectionInteractionInfo()); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java index 86d5b9b7763dbc..32759bb97af64c 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java @@ -1194,6 +1194,8 @@ public Map> getWriteAttributeMap() { writeAttributeMap.put("electricalPowerMeasurement", writeElectricalPowerMeasurementInteractionInfo); Map writeElectricalEnergyMeasurementInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("electricalEnergyMeasurement", writeElectricalEnergyMeasurementInteractionInfo); + Map writeWaterHeaterManagementInteractionInfo = new LinkedHashMap<>(); + writeAttributeMap.put("waterHeaterManagement", writeWaterHeaterManagementInteractionInfo); Map writeDemandResponseLoadControlInteractionInfo = new LinkedHashMap<>(); Map writeDemandResponseLoadControlDefaultRandomStartCommandParams = new LinkedHashMap(); CommandParameterInfo demandResponseLoadControldefaultRandomStartCommandParameterInfo = @@ -1406,6 +1408,52 @@ public Map> getWriteAttributeMap() { ); writeEnergyEvseModeInteractionInfo.put("writeOnModeAttribute", writeEnergyEvseModeOnModeAttributeInteractionInfo); writeAttributeMap.put("energyEvseMode", writeEnergyEvseModeInteractionInfo); + Map writeWaterHeaterModeInteractionInfo = new LinkedHashMap<>(); + Map writeWaterHeaterModeStartUpModeCommandParams = new LinkedHashMap(); + CommandParameterInfo waterHeaterModestartUpModeCommandParameterInfo = + new CommandParameterInfo( + "value", + Integer.class, + Integer.class + ); + writeWaterHeaterModeStartUpModeCommandParams.put( + "value", + waterHeaterModestartUpModeCommandParameterInfo + ); + InteractionInfo writeWaterHeaterModeStartUpModeAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterModeCluster) cluster).writeStartUpModeAttribute( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("value") + ); + }, + () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), + writeWaterHeaterModeStartUpModeCommandParams + ); + writeWaterHeaterModeInteractionInfo.put("writeStartUpModeAttribute", writeWaterHeaterModeStartUpModeAttributeInteractionInfo); + Map writeWaterHeaterModeOnModeCommandParams = new LinkedHashMap(); + CommandParameterInfo waterHeaterModeonModeCommandParameterInfo = + new CommandParameterInfo( + "value", + Integer.class, + Integer.class + ); + writeWaterHeaterModeOnModeCommandParams.put( + "value", + waterHeaterModeonModeCommandParameterInfo + ); + InteractionInfo writeWaterHeaterModeOnModeAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterHeaterModeCluster) cluster).writeOnModeAttribute( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("value") + ); + }, + () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), + writeWaterHeaterModeOnModeCommandParams + ); + writeWaterHeaterModeInteractionInfo.put("writeOnModeAttribute", writeWaterHeaterModeOnModeAttributeInteractionInfo); + writeAttributeMap.put("waterHeaterMode", writeWaterHeaterModeInteractionInfo); Map writeDeviceEnergyManagementModeInteractionInfo = new LinkedHashMap<>(); Map writeDeviceEnergyManagementModeStartUpModeCommandParams = new LinkedHashMap(); CommandParameterInfo deviceEnergyManagementModestartUpModeCommandParameterInfo = @@ -3669,8 +3717,8 @@ public Map> getWriteAttributeMap() { CommandParameterInfo threadNetworkDirectorypreferredExtendedPanIDCommandParameterInfo = new CommandParameterInfo( "value", - Long.class, - Long.class + byte[].class, + byte[].class ); writeThreadNetworkDirectoryPreferredExtendedPanIDCommandParams.put( "value", @@ -3680,7 +3728,7 @@ public Map> getWriteAttributeMap() { (cluster, callback, commandArguments) -> { ((ChipClusters.ThreadNetworkDirectoryCluster) cluster).writePreferredExtendedPanIDAttribute( (DefaultClusterCallback) callback, - (Long) commandArguments.get("value") + (byte[]) commandArguments.get("value") ); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), @@ -3716,6 +3764,10 @@ public Map> getWriteAttributeMap() { writeAttributeMap.put("contentControl", writeContentControlInteractionInfo); Map writeContentAppObserverInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("contentAppObserver", writeContentAppObserverInteractionInfo); + Map writeEcosystemInformationInteractionInfo = new LinkedHashMap<>(); + writeAttributeMap.put("ecosystemInformation", writeEcosystemInformationInteractionInfo); + Map writeCommissionerControlInteractionInfo = new LinkedHashMap<>(); + writeAttributeMap.put("commissionerControl", writeCommissionerControlInteractionInfo); Map writeElectricalMeasurementInteractionInfo = new LinkedHashMap<>(); Map writeElectricalMeasurementAverageRmsVoltageMeasurementPeriodCommandParams = new LinkedHashMap(); CommandParameterInfo electricalMeasurementaverageRmsVoltageMeasurementPeriodCommandParameterInfo = diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessRestrictionEntryChangedEvent.kt similarity index 69% rename from src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt rename to src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessRestrictionEntryChangedEvent.kt index b90c6e8126260b..56d9b39e1a005e 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessRestrictionEntryChangedEvent.kt @@ -22,34 +22,34 @@ import matter.tlv.Tag import matter.tlv.TlvReader import matter.tlv.TlvWriter -class ThreadNetworkDirectoryClusterNetworkChangedEvent(val extendedPanID: ULong) { +class AccessControlClusterAccessRestrictionEntryChangedEvent(val fabricIndex: UInt) { override fun toString(): String = buildString { - append("ThreadNetworkDirectoryClusterNetworkChangedEvent {\n") - append("\textendedPanID : $extendedPanID\n") + append("AccessControlClusterAccessRestrictionEntryChangedEvent {\n") + append("\tfabricIndex : $fabricIndex\n") append("}\n") } fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_EXTENDED_PAN_I_D), extendedPanID) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) endStructure() } } companion object { - private const val TAG_EXTENDED_PAN_I_D = 0 + private const val TAG_FABRIC_INDEX = 254 fun fromTlv( tlvTag: Tag, tlvReader: TlvReader, - ): ThreadNetworkDirectoryClusterNetworkChangedEvent { + ): AccessControlClusterAccessRestrictionEntryChangedEvent { tlvReader.enterStructure(tlvTag) - val extendedPanID = tlvReader.getULong(ContextSpecificTag(TAG_EXTENDED_PAN_I_D)) + val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) tlvReader.exitContainer() - return ThreadNetworkDirectoryClusterNetworkChangedEvent(extendedPanID) + return AccessControlClusterAccessRestrictionEntryChangedEvent(fabricIndex) } } } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterFabricRestrictionReviewUpdateEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterFabricRestrictionReviewUpdateEvent.kt new file mode 100644 index 00000000000000..92934af0a1b4e1 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterFabricRestrictionReviewUpdateEvent.kt @@ -0,0 +1,97 @@ +/* + * + * 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. + */ +package chip.devicecontroller.cluster.eventstructs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class AccessControlClusterFabricRestrictionReviewUpdateEvent( + val token: ULong, + val instruction: String?, + val redirectURL: String?, + val fabricIndex: UInt, +) { + override fun toString(): String = buildString { + append("AccessControlClusterFabricRestrictionReviewUpdateEvent {\n") + append("\ttoken : $token\n") + append("\tinstruction : $instruction\n") + append("\tredirectURL : $redirectURL\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_TOKEN), token) + if (instruction != null) { + put(ContextSpecificTag(TAG_INSTRUCTION), instruction) + } else { + putNull(ContextSpecificTag(TAG_INSTRUCTION)) + } + if (redirectURL != null) { + put(ContextSpecificTag(TAG_REDIRECT_U_R_L), redirectURL) + } else { + putNull(ContextSpecificTag(TAG_REDIRECT_U_R_L)) + } + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_TOKEN = 0 + private const val TAG_INSTRUCTION = 1 + private const val TAG_REDIRECT_U_R_L = 2 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): AccessControlClusterFabricRestrictionReviewUpdateEvent { + tlvReader.enterStructure(tlvTag) + val token = tlvReader.getULong(ContextSpecificTag(TAG_TOKEN)) + val instruction = + if (!tlvReader.isNull()) { + tlvReader.getString(ContextSpecificTag(TAG_INSTRUCTION)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_INSTRUCTION)) + null + } + val redirectURL = + if (!tlvReader.isNull()) { + tlvReader.getString(ContextSpecificTag(TAG_REDIRECT_U_R_L)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_REDIRECT_U_R_L)) + null + } + val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return AccessControlClusterFabricRestrictionReviewUpdateEvent( + token, + instruction, + redirectURL, + fabricIndex, + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterActiveChangedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterActiveChangedEvent.kt new file mode 100644 index 00000000000000..73be6ff7c1042e --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterActiveChangedEvent.kt @@ -0,0 +1,56 @@ +/* + * + * 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. + */ +package chip.devicecontroller.cluster.eventstructs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class BridgedDeviceBasicInformationClusterActiveChangedEvent(val promisedActiveDuration: ULong) { + override fun toString(): String = buildString { + append("BridgedDeviceBasicInformationClusterActiveChangedEvent {\n") + append("\tpromisedActiveDuration : $promisedActiveDuration\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_PROMISED_ACTIVE_DURATION), promisedActiveDuration) + endStructure() + } + } + + companion object { + private const val TAG_PROMISED_ACTIVE_DURATION = 0 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): BridgedDeviceBasicInformationClusterActiveChangedEvent { + tlvReader.enterStructure(tlvTag) + val promisedActiveDuration = + tlvReader.getULong(ContextSpecificTag(TAG_PROMISED_ACTIVE_DURATION)) + + tlvReader.exitContainer() + + return BridgedDeviceBasicInformationClusterActiveChangedEvent(promisedActiveDuration) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/CommissionerControlClusterCommissioningRequestResultEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/CommissionerControlClusterCommissioningRequestResultEvent.kt new file mode 100644 index 00000000000000..2a7a8d3c5b8ffb --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/CommissionerControlClusterCommissioningRequestResultEvent.kt @@ -0,0 +1,77 @@ +/* + * + * 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. + */ +package chip.devicecontroller.cluster.eventstructs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class CommissionerControlClusterCommissioningRequestResultEvent( + val requestId: ULong, + val clientNodeId: ULong, + val statusCode: UInt, + val fabricIndex: UInt, +) { + override fun toString(): String = buildString { + append("CommissionerControlClusterCommissioningRequestResultEvent {\n") + append("\trequestId : $requestId\n") + append("\tclientNodeId : $clientNodeId\n") + append("\tstatusCode : $statusCode\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_REQUEST_ID), requestId) + put(ContextSpecificTag(TAG_CLIENT_NODE_ID), clientNodeId) + put(ContextSpecificTag(TAG_STATUS_CODE), statusCode) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_REQUEST_ID = 0 + private const val TAG_CLIENT_NODE_ID = 1 + private const val TAG_STATUS_CODE = 2 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): CommissionerControlClusterCommissioningRequestResultEvent { + tlvReader.enterStructure(tlvTag) + val requestId = tlvReader.getULong(ContextSpecificTag(TAG_REQUEST_ID)) + val clientNodeId = tlvReader.getULong(ContextSpecificTag(TAG_CLIENT_NODE_ID)) + val statusCode = tlvReader.getUInt(ContextSpecificTag(TAG_STATUS_CODE)) + val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return CommissionerControlClusterCommissioningRequestResultEvent( + requestId, + clientNodeId, + statusCode, + fabricIndex, + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt index 1ab0f94916c9c9..345a0aef9f870e 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt @@ -17,6 +17,7 @@ package chip.devicecontroller.cluster.eventstructs import chip.devicecontroller.cluster.* +import java.util.Optional import matter.tlv.ContextSpecificTag import matter.tlv.Tag import matter.tlv.TlvReader @@ -26,12 +27,14 @@ class EnergyEvseClusterEnergyTransferStartedEvent( val sessionID: ULong, val state: UInt, val maximumCurrent: Long, + val maximumDischargeCurrent: Optional, ) { override fun toString(): String = buildString { append("EnergyEvseClusterEnergyTransferStartedEvent {\n") append("\tsessionID : $sessionID\n") append("\tstate : $state\n") append("\tmaximumCurrent : $maximumCurrent\n") + append("\tmaximumDischargeCurrent : $maximumDischargeCurrent\n") append("}\n") } @@ -41,6 +44,10 @@ class EnergyEvseClusterEnergyTransferStartedEvent( put(ContextSpecificTag(TAG_SESSION_I_D), sessionID) put(ContextSpecificTag(TAG_STATE), state) put(ContextSpecificTag(TAG_MAXIMUM_CURRENT), maximumCurrent) + if (maximumDischargeCurrent.isPresent) { + val optmaximumDischargeCurrent = maximumDischargeCurrent.get() + put(ContextSpecificTag(TAG_MAXIMUM_DISCHARGE_CURRENT), optmaximumDischargeCurrent) + } endStructure() } } @@ -49,16 +56,28 @@ class EnergyEvseClusterEnergyTransferStartedEvent( private const val TAG_SESSION_I_D = 0 private const val TAG_STATE = 1 private const val TAG_MAXIMUM_CURRENT = 2 + private const val TAG_MAXIMUM_DISCHARGE_CURRENT = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterEnergyTransferStartedEvent { tlvReader.enterStructure(tlvTag) val sessionID = tlvReader.getULong(ContextSpecificTag(TAG_SESSION_I_D)) val state = tlvReader.getUInt(ContextSpecificTag(TAG_STATE)) val maximumCurrent = tlvReader.getLong(ContextSpecificTag(TAG_MAXIMUM_CURRENT)) + val maximumDischargeCurrent = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MAXIMUM_DISCHARGE_CURRENT))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_MAXIMUM_DISCHARGE_CURRENT))) + } else { + Optional.empty() + } tlvReader.exitContainer() - return EnergyEvseClusterEnergyTransferStartedEvent(sessionID, state, maximumCurrent) + return EnergyEvseClusterEnergyTransferStartedEvent( + sessionID, + state, + maximumCurrent, + maximumDischargeCurrent, + ) } } } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt index 405ec933dc91e0..b6c3f8cc88f71b 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt @@ -17,6 +17,7 @@ package chip.devicecontroller.cluster.eventstructs import chip.devicecontroller.cluster.* +import java.util.Optional import matter.tlv.ContextSpecificTag import matter.tlv.Tag import matter.tlv.TlvReader @@ -27,6 +28,7 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( val state: UInt, val reason: UInt, val energyTransferred: Long, + val energyDischarged: Optional, ) { override fun toString(): String = buildString { append("EnergyEvseClusterEnergyTransferStoppedEvent {\n") @@ -34,6 +36,7 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( append("\tstate : $state\n") append("\treason : $reason\n") append("\tenergyTransferred : $energyTransferred\n") + append("\tenergyDischarged : $energyDischarged\n") append("}\n") } @@ -44,6 +47,10 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( put(ContextSpecificTag(TAG_STATE), state) put(ContextSpecificTag(TAG_REASON), reason) put(ContextSpecificTag(TAG_ENERGY_TRANSFERRED), energyTransferred) + if (energyDischarged.isPresent) { + val optenergyDischarged = energyDischarged.get() + put(ContextSpecificTag(TAG_ENERGY_DISCHARGED), optenergyDischarged) + } endStructure() } } @@ -53,6 +60,7 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( private const val TAG_STATE = 1 private const val TAG_REASON = 2 private const val TAG_ENERGY_TRANSFERRED = 4 + private const val TAG_ENERGY_DISCHARGED = 5 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterEnergyTransferStoppedEvent { tlvReader.enterStructure(tlvTag) @@ -60,6 +68,12 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( val state = tlvReader.getUInt(ContextSpecificTag(TAG_STATE)) val reason = tlvReader.getUInt(ContextSpecificTag(TAG_REASON)) val energyTransferred = tlvReader.getLong(ContextSpecificTag(TAG_ENERGY_TRANSFERRED)) + val energyDischarged = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ENERGY_DISCHARGED))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_ENERGY_DISCHARGED))) + } else { + Optional.empty() + } tlvReader.exitContainer() @@ -68,6 +82,7 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( state, reason, energyTransferred, + energyDischarged, ) } } 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 4bcff980b6cbe6..e101562093412c 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -5,6 +5,9 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessControlEntryStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessControlExtensionStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessControlTargetStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessRestrictionEntryStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessRestrictionStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterCommissioningAccessRestrictionEntryStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterActionStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterEndpointListStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActivatedCarbonFilterMonitoringClusterReplacementProductStruct.kt", @@ -56,6 +59,10 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DishwasherModeClusterModeOptionStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DishwasherModeClusterModeTagStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DoorLockClusterCredentialStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterDeviceTypeStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterEcosystemDeviceStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterLocationDescriptorStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.kt", @@ -113,10 +120,10 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterOperationalStateStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcRunModeClusterModeOptionStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcRunModeClusterModeTagStruct.kt", - "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterSceneInfoStruct.kt", - "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationDescriptorStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterMapStruct.kt", @@ -125,7 +132,6 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TargetNavigatorClusterTargetInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterPresetStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterPresetTypeStruct.kt", - "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterQueuedPresetStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterScheduleStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterScheduleTransitionStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterScheduleTypeStruct.kt", @@ -147,11 +153,15 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestFabricScoped.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestListStructOctet.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UserLabelClusterLabelStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WaterHeaterModeClusterModeOptionStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WaterHeaterModeClusterModeTagStruct.kt", ] eventstructs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlEntryChangedEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlExtensionChangedEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessRestrictionEntryChangedEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterFabricRestrictionReviewUpdateEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccountLoginClusterLoggedOutEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterActionFailedEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterStateChangedEvent.kt", @@ -161,8 +171,10 @@ eventstructs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BooleanStateClusterStateChangeEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BooleanStateConfigurationClusterAlarmsStateChangedEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BooleanStateConfigurationClusterSensorFaultEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterActiveChangedEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterReachableChangedEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterStartUpEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/CommissionerControlClusterCommissioningRequestResultEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DeviceEnergyManagementClusterPowerAdjustEndEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DeviceEnergyManagementClusterResumedEvent.kt", @@ -219,7 +231,6 @@ eventstructs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TargetNavigatorClusterTargetUpdatedEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDiagnosticsClusterConnectionStatusEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDiagnosticsClusterNetworkFaultChangeEvent.kt", - "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TimeSynchronizationClusterDSTStatusEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TimeSynchronizationClusterTimeZoneStatusEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/UnitTestingClusterTestDifferentVendorMeiEventEvent.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessRestrictionEntryStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessRestrictionEntryStruct.kt new file mode 100644 index 00000000000000..155295421d82d7 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessRestrictionEntryStruct.kt @@ -0,0 +1,89 @@ +/* + * + * 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class AccessControlClusterAccessRestrictionEntryStruct( + val endpoint: UInt, + val cluster: ULong, + val restrictions: List, + val fabricIndex: UInt, +) { + override fun toString(): String = buildString { + append("AccessControlClusterAccessRestrictionEntryStruct {\n") + append("\tendpoint : $endpoint\n") + append("\tcluster : $cluster\n") + append("\trestrictions : $restrictions\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ENDPOINT), endpoint) + put(ContextSpecificTag(TAG_CLUSTER), cluster) + startArray(ContextSpecificTag(TAG_RESTRICTIONS)) + for (item in restrictions.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_ENDPOINT = 0 + private const val TAG_CLUSTER = 1 + private const val TAG_RESTRICTIONS = 2 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): AccessControlClusterAccessRestrictionEntryStruct { + tlvReader.enterStructure(tlvTag) + val endpoint = tlvReader.getUInt(ContextSpecificTag(TAG_ENDPOINT)) + val cluster = tlvReader.getULong(ContextSpecificTag(TAG_CLUSTER)) + val restrictions = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_RESTRICTIONS)) + while (!tlvReader.isEndOfContainer()) { + add(AccessControlClusterAccessRestrictionStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return AccessControlClusterAccessRestrictionEntryStruct( + endpoint, + cluster, + restrictions, + fabricIndex, + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessRestrictionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessRestrictionStruct.kt new file mode 100644 index 00000000000000..ae0cd7214cc140 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessRestrictionStruct.kt @@ -0,0 +1,66 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class AccessControlClusterAccessRestrictionStruct(val type: UInt, val id: ULong?) { + override fun toString(): String = buildString { + append("AccessControlClusterAccessRestrictionStruct {\n") + append("\ttype : $type\n") + append("\tid : $id\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_TYPE), type) + if (id != null) { + put(ContextSpecificTag(TAG_ID), id) + } else { + putNull(ContextSpecificTag(TAG_ID)) + } + endStructure() + } + } + + companion object { + private const val TAG_TYPE = 0 + private const val TAG_ID = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): AccessControlClusterAccessRestrictionStruct { + tlvReader.enterStructure(tlvTag) + val type = tlvReader.getUInt(ContextSpecificTag(TAG_TYPE)) + val id = + if (!tlvReader.isNull()) { + tlvReader.getULong(ContextSpecificTag(TAG_ID)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_ID)) + null + } + + tlvReader.exitContainer() + + return AccessControlClusterAccessRestrictionStruct(type, id) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterCommissioningAccessRestrictionEntryStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterCommissioningAccessRestrictionEntryStruct.kt new file mode 100644 index 00000000000000..c19d1e6c8a248a --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterCommissioningAccessRestrictionEntryStruct.kt @@ -0,0 +1,83 @@ +/* + * + * 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class AccessControlClusterCommissioningAccessRestrictionEntryStruct( + val endpoint: UInt, + val cluster: ULong, + val restrictions: List, +) { + override fun toString(): String = buildString { + append("AccessControlClusterCommissioningAccessRestrictionEntryStruct {\n") + append("\tendpoint : $endpoint\n") + append("\tcluster : $cluster\n") + append("\trestrictions : $restrictions\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ENDPOINT), endpoint) + put(ContextSpecificTag(TAG_CLUSTER), cluster) + startArray(ContextSpecificTag(TAG_RESTRICTIONS)) + for (item in restrictions.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + endStructure() + } + } + + companion object { + private const val TAG_ENDPOINT = 0 + private const val TAG_CLUSTER = 1 + private const val TAG_RESTRICTIONS = 2 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): AccessControlClusterCommissioningAccessRestrictionEntryStruct { + tlvReader.enterStructure(tlvTag) + val endpoint = tlvReader.getUInt(ContextSpecificTag(TAG_ENDPOINT)) + val cluster = tlvReader.getULong(ContextSpecificTag(TAG_CLUSTER)) + val restrictions = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_RESTRICTIONS)) + while (!tlvReader.isEndOfContainer()) { + add(AccessControlClusterAccessRestrictionStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return AccessControlClusterCommissioningAccessRestrictionEntryStruct( + endpoint, + cluster, + restrictions, + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterDeviceTypeStruct.kt similarity index 58% rename from src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt rename to src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterDeviceTypeStruct.kt index 3cf9c98d53e6d1..a5974dea0c190e 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterDeviceTypeStruct.kt @@ -22,35 +22,35 @@ import matter.tlv.Tag import matter.tlv.TlvReader import matter.tlv.TlvWriter -class ScenesManagementClusterAttributeValuePair(val attributeID: ULong, val attributeValue: ULong) { +class EcosystemInformationClusterDeviceTypeStruct(val deviceType: ULong, val revision: UInt) { override fun toString(): String = buildString { - append("ScenesManagementClusterAttributeValuePair {\n") - append("\tattributeID : $attributeID\n") - append("\tattributeValue : $attributeValue\n") + append("EcosystemInformationClusterDeviceTypeStruct {\n") + append("\tdeviceType : $deviceType\n") + append("\trevision : $revision\n") append("}\n") } fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ATTRIBUTE_I_D), attributeID) - put(ContextSpecificTag(TAG_ATTRIBUTE_VALUE), attributeValue) + put(ContextSpecificTag(TAG_DEVICE_TYPE), deviceType) + put(ContextSpecificTag(TAG_REVISION), revision) endStructure() } } companion object { - private const val TAG_ATTRIBUTE_I_D = 0 - private const val TAG_ATTRIBUTE_VALUE = 1 + private const val TAG_DEVICE_TYPE = 0 + private const val TAG_REVISION = 1 - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ScenesManagementClusterAttributeValuePair { + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EcosystemInformationClusterDeviceTypeStruct { tlvReader.enterStructure(tlvTag) - val attributeID = tlvReader.getULong(ContextSpecificTag(TAG_ATTRIBUTE_I_D)) - val attributeValue = tlvReader.getULong(ContextSpecificTag(TAG_ATTRIBUTE_VALUE)) + val deviceType = tlvReader.getULong(ContextSpecificTag(TAG_DEVICE_TYPE)) + val revision = tlvReader.getUInt(ContextSpecificTag(TAG_REVISION)) tlvReader.exitContainer() - return ScenesManagementClusterAttributeValuePair(attributeID, attributeValue) + return EcosystemInformationClusterDeviceTypeStruct(deviceType, revision) } } } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterEcosystemDeviceStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterEcosystemDeviceStruct.kt new file mode 100644 index 00000000000000..c603107ebf7449 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterEcosystemDeviceStruct.kt @@ -0,0 +1,142 @@ +/* + * + * 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import java.util.Optional +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EcosystemInformationClusterEcosystemDeviceStruct( + val deviceName: Optional, + val deviceNameLastEdit: Optional, + val bridgedEndpoint: UInt, + val originalEndpoint: UInt, + val deviceTypes: List, + val uniqueLocationIDs: List, + val uniqueLocationIDsLastEdit: ULong, + val fabricIndex: UInt, +) { + override fun toString(): String = buildString { + append("EcosystemInformationClusterEcosystemDeviceStruct {\n") + append("\tdeviceName : $deviceName\n") + append("\tdeviceNameLastEdit : $deviceNameLastEdit\n") + append("\tbridgedEndpoint : $bridgedEndpoint\n") + append("\toriginalEndpoint : $originalEndpoint\n") + append("\tdeviceTypes : $deviceTypes\n") + append("\tuniqueLocationIDs : $uniqueLocationIDs\n") + append("\tuniqueLocationIDsLastEdit : $uniqueLocationIDsLastEdit\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (deviceName.isPresent) { + val optdeviceName = deviceName.get() + put(ContextSpecificTag(TAG_DEVICE_NAME), optdeviceName) + } + if (deviceNameLastEdit.isPresent) { + val optdeviceNameLastEdit = deviceNameLastEdit.get() + put(ContextSpecificTag(TAG_DEVICE_NAME_LAST_EDIT), optdeviceNameLastEdit) + } + put(ContextSpecificTag(TAG_BRIDGED_ENDPOINT), bridgedEndpoint) + put(ContextSpecificTag(TAG_ORIGINAL_ENDPOINT), originalEndpoint) + startArray(ContextSpecificTag(TAG_DEVICE_TYPES)) + for (item in deviceTypes.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + startArray(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_DS)) + for (item in uniqueLocationIDs.iterator()) { + put(AnonymousTag, item) + } + endArray() + put(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_DS_LAST_EDIT), uniqueLocationIDsLastEdit) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_DEVICE_NAME = 0 + private const val TAG_DEVICE_NAME_LAST_EDIT = 1 + private const val TAG_BRIDGED_ENDPOINT = 2 + private const val TAG_ORIGINAL_ENDPOINT = 3 + private const val TAG_DEVICE_TYPES = 4 + private const val TAG_UNIQUE_LOCATION_I_DS = 5 + private const val TAG_UNIQUE_LOCATION_I_DS_LAST_EDIT = 6 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): EcosystemInformationClusterEcosystemDeviceStruct { + tlvReader.enterStructure(tlvTag) + val deviceName = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DEVICE_NAME))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_DEVICE_NAME))) + } else { + Optional.empty() + } + val deviceNameLastEdit = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DEVICE_NAME_LAST_EDIT))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_DEVICE_NAME_LAST_EDIT))) + } else { + Optional.empty() + } + val bridgedEndpoint = tlvReader.getUInt(ContextSpecificTag(TAG_BRIDGED_ENDPOINT)) + val originalEndpoint = tlvReader.getUInt(ContextSpecificTag(TAG_ORIGINAL_ENDPOINT)) + val deviceTypes = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_DEVICE_TYPES)) + while (!tlvReader.isEndOfContainer()) { + add(EcosystemInformationClusterDeviceTypeStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + val uniqueLocationIDs = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_DS)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getString(AnonymousTag)) + } + tlvReader.exitContainer() + } + val uniqueLocationIDsLastEdit = + tlvReader.getULong(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_DS_LAST_EDIT)) + val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return EcosystemInformationClusterEcosystemDeviceStruct( + deviceName, + deviceNameLastEdit, + bridgedEndpoint, + originalEndpoint, + deviceTypes, + uniqueLocationIDs, + uniqueLocationIDsLastEdit, + fabricIndex, + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt new file mode 100644 index 00000000000000..5b1b7103aaed67 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt @@ -0,0 +1,82 @@ +/* + * + * 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EcosystemInformationClusterEcosystemLocationStruct( + val uniqueLocationID: String, + val locationDescriptor: EcosystemInformationClusterLocationDescriptorStruct, + val locationDescriptorLastEdit: ULong, + val fabricIndex: UInt, +) { + override fun toString(): String = buildString { + append("EcosystemInformationClusterEcosystemLocationStruct {\n") + append("\tuniqueLocationID : $uniqueLocationID\n") + append("\tlocationDescriptor : $locationDescriptor\n") + append("\tlocationDescriptorLastEdit : $locationDescriptorLastEdit\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_D), uniqueLocationID) + locationDescriptor.toTlv(ContextSpecificTag(TAG_LOCATION_DESCRIPTOR), this) + put(ContextSpecificTag(TAG_LOCATION_DESCRIPTOR_LAST_EDIT), locationDescriptorLastEdit) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_UNIQUE_LOCATION_I_D = 0 + private const val TAG_LOCATION_DESCRIPTOR = 1 + private const val TAG_LOCATION_DESCRIPTOR_LAST_EDIT = 2 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): EcosystemInformationClusterEcosystemLocationStruct { + tlvReader.enterStructure(tlvTag) + val uniqueLocationID = tlvReader.getString(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_D)) + val locationDescriptor = + EcosystemInformationClusterLocationDescriptorStruct.fromTlv( + ContextSpecificTag(TAG_LOCATION_DESCRIPTOR), + tlvReader, + ) + val locationDescriptorLastEdit = + tlvReader.getULong(ContextSpecificTag(TAG_LOCATION_DESCRIPTOR_LAST_EDIT)) + val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return EcosystemInformationClusterEcosystemLocationStruct( + uniqueLocationID, + locationDescriptor, + locationDescriptorLastEdit, + fabricIndex, + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterLocationDescriptorStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterLocationDescriptorStruct.kt new file mode 100644 index 00000000000000..36a8de6b6f175a --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterLocationDescriptorStruct.kt @@ -0,0 +1,91 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EcosystemInformationClusterLocationDescriptorStruct( + val locationName: String, + val floorNumber: Int?, + val areaType: UInt?, +) { + override fun toString(): String = buildString { + append("EcosystemInformationClusterLocationDescriptorStruct {\n") + append("\tlocationName : $locationName\n") + append("\tfloorNumber : $floorNumber\n") + append("\tareaType : $areaType\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_LOCATION_NAME), locationName) + if (floorNumber != null) { + put(ContextSpecificTag(TAG_FLOOR_NUMBER), floorNumber) + } else { + putNull(ContextSpecificTag(TAG_FLOOR_NUMBER)) + } + if (areaType != null) { + put(ContextSpecificTag(TAG_AREA_TYPE), areaType) + } else { + putNull(ContextSpecificTag(TAG_AREA_TYPE)) + } + endStructure() + } + } + + companion object { + private const val TAG_LOCATION_NAME = 0 + private const val TAG_FLOOR_NUMBER = 1 + private const val TAG_AREA_TYPE = 2 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): EcosystemInformationClusterLocationDescriptorStruct { + tlvReader.enterStructure(tlvTag) + val locationName = tlvReader.getString(ContextSpecificTag(TAG_LOCATION_NAME)) + val floorNumber = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_FLOOR_NUMBER)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_FLOOR_NUMBER)) + null + } + val areaType = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_AREA_TYPE)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_AREA_TYPE)) + null + } + + tlvReader.exitContainer() + + return EcosystemInformationClusterLocationDescriptorStruct( + locationName, + floorNumber, + areaType, + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt new file mode 100644 index 00000000000000..f8526c71f933a5 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt @@ -0,0 +1,172 @@ +/* + * + * 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. + */ +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 ScenesManagementClusterAttributeValuePairStruct( + val attributeID: ULong, + val valueUnsigned8: Optional, + val valueSigned8: Optional, + val valueUnsigned16: Optional, + val valueSigned16: Optional, + val valueUnsigned32: Optional, + val valueSigned32: Optional, + val valueUnsigned64: Optional, + val valueSigned64: Optional, +) { + override fun toString(): String = buildString { + append("ScenesManagementClusterAttributeValuePairStruct {\n") + append("\tattributeID : $attributeID\n") + append("\tvalueUnsigned8 : $valueUnsigned8\n") + append("\tvalueSigned8 : $valueSigned8\n") + append("\tvalueUnsigned16 : $valueUnsigned16\n") + append("\tvalueSigned16 : $valueSigned16\n") + append("\tvalueUnsigned32 : $valueUnsigned32\n") + append("\tvalueSigned32 : $valueSigned32\n") + append("\tvalueUnsigned64 : $valueUnsigned64\n") + append("\tvalueSigned64 : $valueSigned64\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ATTRIBUTE_I_D), attributeID) + if (valueUnsigned8.isPresent) { + val optvalueUnsigned8 = valueUnsigned8.get() + put(ContextSpecificTag(TAG_VALUE_UNSIGNED8), optvalueUnsigned8) + } + if (valueSigned8.isPresent) { + val optvalueSigned8 = valueSigned8.get() + put(ContextSpecificTag(TAG_VALUE_SIGNED8), optvalueSigned8) + } + if (valueUnsigned16.isPresent) { + val optvalueUnsigned16 = valueUnsigned16.get() + put(ContextSpecificTag(TAG_VALUE_UNSIGNED16), optvalueUnsigned16) + } + if (valueSigned16.isPresent) { + val optvalueSigned16 = valueSigned16.get() + put(ContextSpecificTag(TAG_VALUE_SIGNED16), optvalueSigned16) + } + if (valueUnsigned32.isPresent) { + val optvalueUnsigned32 = valueUnsigned32.get() + put(ContextSpecificTag(TAG_VALUE_UNSIGNED32), optvalueUnsigned32) + } + if (valueSigned32.isPresent) { + val optvalueSigned32 = valueSigned32.get() + put(ContextSpecificTag(TAG_VALUE_SIGNED32), optvalueSigned32) + } + if (valueUnsigned64.isPresent) { + val optvalueUnsigned64 = valueUnsigned64.get() + put(ContextSpecificTag(TAG_VALUE_UNSIGNED64), optvalueUnsigned64) + } + if (valueSigned64.isPresent) { + val optvalueSigned64 = valueSigned64.get() + put(ContextSpecificTag(TAG_VALUE_SIGNED64), optvalueSigned64) + } + endStructure() + } + } + + companion object { + private const val TAG_ATTRIBUTE_I_D = 0 + private const val TAG_VALUE_UNSIGNED8 = 1 + private const val TAG_VALUE_SIGNED8 = 2 + private const val TAG_VALUE_UNSIGNED16 = 3 + private const val TAG_VALUE_SIGNED16 = 4 + private const val TAG_VALUE_UNSIGNED32 = 5 + private const val TAG_VALUE_SIGNED32 = 6 + private const val TAG_VALUE_UNSIGNED64 = 7 + private const val TAG_VALUE_SIGNED64 = 8 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ScenesManagementClusterAttributeValuePairStruct { + tlvReader.enterStructure(tlvTag) + val attributeID = tlvReader.getULong(ContextSpecificTag(TAG_ATTRIBUTE_I_D)) + val valueUnsigned8 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED8))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_VALUE_UNSIGNED8))) + } else { + Optional.empty() + } + val valueSigned8 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_SIGNED8))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_VALUE_SIGNED8))) + } else { + Optional.empty() + } + val valueUnsigned16 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED16))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_VALUE_UNSIGNED16))) + } else { + Optional.empty() + } + val valueSigned16 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_SIGNED16))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_VALUE_SIGNED16))) + } else { + Optional.empty() + } + val valueUnsigned32 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED32))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_VALUE_UNSIGNED32))) + } else { + Optional.empty() + } + val valueSigned32 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_SIGNED32))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_VALUE_SIGNED32))) + } else { + Optional.empty() + } + val valueUnsigned64 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED64))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_VALUE_UNSIGNED64))) + } else { + Optional.empty() + } + val valueSigned64 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_SIGNED64))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_VALUE_SIGNED64))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ScenesManagementClusterAttributeValuePairStruct( + attributeID, + valueUnsigned8, + valueSigned8, + valueUnsigned16, + valueSigned16, + valueUnsigned32, + valueSigned32, + valueUnsigned64, + valueSigned64, + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt index 64bc8aff47ea55..a2add794802904 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt @@ -25,7 +25,7 @@ import matter.tlv.TlvWriter class ScenesManagementClusterExtensionFieldSet( val clusterID: ULong, - val attributeValueList: List, + val attributeValueList: List, ) { override fun toString(): String = buildString { append("ScenesManagementClusterExtensionFieldSet {\n") @@ -55,10 +55,10 @@ class ScenesManagementClusterExtensionFieldSet( tlvReader.enterStructure(tlvTag) val clusterID = tlvReader.getULong(ContextSpecificTag(TAG_CLUSTER_I_D)) val attributeValueList = - buildList { + buildList { tlvReader.enterArray(ContextSpecificTag(TAG_ATTRIBUTE_VALUE_LIST)) while (!tlvReader.isEndOfContainer()) { - add(ScenesManagementClusterAttributeValuePair.fromTlv(AnonymousTag, tlvReader)) + add(ScenesManagementClusterAttributeValuePairStruct.fromTlv(AnonymousTag, tlvReader)) } tlvReader.exitContainer() } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationDescriptorStruct.kt similarity index 91% rename from src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt rename to src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationDescriptorStruct.kt index 4eb2b2ea14784e..9a5362c443eab9 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationDescriptorStruct.kt @@ -22,13 +22,13 @@ import matter.tlv.Tag import matter.tlv.TlvReader import matter.tlv.TlvWriter -class ServiceAreaClusterHomeLocationStruct( +class ServiceAreaClusterLocationDescriptorStruct( val locationName: String, val floorNumber: Int?, val areaType: UInt?, ) { override fun toString(): String = buildString { - append("ServiceAreaClusterHomeLocationStruct {\n") + append("ServiceAreaClusterLocationDescriptorStruct {\n") append("\tlocationName : $locationName\n") append("\tfloorNumber : $floorNumber\n") append("\tareaType : $areaType\n") @@ -58,7 +58,7 @@ class ServiceAreaClusterHomeLocationStruct( private const val TAG_FLOOR_NUMBER = 1 private const val TAG_AREA_TYPE = 2 - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterHomeLocationStruct { + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterLocationDescriptorStruct { tlvReader.enterStructure(tlvTag) val locationName = tlvReader.getString(ContextSpecificTag(TAG_LOCATION_NAME)) val floorNumber = @@ -78,7 +78,7 @@ class ServiceAreaClusterHomeLocationStruct( tlvReader.exitContainer() - return ServiceAreaClusterHomeLocationStruct(locationName, floorNumber, areaType) + return ServiceAreaClusterLocationDescriptorStruct(locationName, floorNumber, areaType) } } } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt index c6137199382840..3d3938fdbedf2b 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt @@ -23,7 +23,7 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class ServiceAreaClusterLocationInfoStruct( - val locationInfo: ServiceAreaClusterHomeLocationStruct?, + val locationInfo: ServiceAreaClusterLocationDescriptorStruct?, val landmarkTag: UInt?, val positionTag: UInt?, val surfaceTag: UInt?, @@ -74,7 +74,7 @@ class ServiceAreaClusterLocationInfoStruct( tlvReader.enterStructure(tlvTag) val locationInfo = if (!tlvReader.isNull()) { - ServiceAreaClusterHomeLocationStruct.fromTlv( + ServiceAreaClusterLocationDescriptorStruct.fromTlv( ContextSpecificTag(TAG_LOCATION_INFO), tlvReader, ) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterQueuedPresetStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterQueuedPresetStruct.kt deleted file mode 100644 index fbb176317e9fb4..00000000000000 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterQueuedPresetStruct.kt +++ /dev/null @@ -1,79 +0,0 @@ -/* - * - * 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. - */ -package chip.devicecontroller.cluster.structs - -import chip.devicecontroller.cluster.* -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class ThermostatClusterQueuedPresetStruct( - val presetHandle: ByteArray?, - val transitionTimestamp: ULong?, -) { - override fun toString(): String = buildString { - append("ThermostatClusterQueuedPresetStruct {\n") - append("\tpresetHandle : $presetHandle\n") - append("\ttransitionTimestamp : $transitionTimestamp\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - if (presetHandle != null) { - put(ContextSpecificTag(TAG_PRESET_HANDLE), presetHandle) - } else { - putNull(ContextSpecificTag(TAG_PRESET_HANDLE)) - } - if (transitionTimestamp != null) { - put(ContextSpecificTag(TAG_TRANSITION_TIMESTAMP), transitionTimestamp) - } else { - putNull(ContextSpecificTag(TAG_TRANSITION_TIMESTAMP)) - } - endStructure() - } - } - - companion object { - private const val TAG_PRESET_HANDLE = 0 - private const val TAG_TRANSITION_TIMESTAMP = 1 - - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ThermostatClusterQueuedPresetStruct { - tlvReader.enterStructure(tlvTag) - val presetHandle = - if (!tlvReader.isNull()) { - tlvReader.getByteArray(ContextSpecificTag(TAG_PRESET_HANDLE)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_PRESET_HANDLE)) - null - } - val transitionTimestamp = - if (!tlvReader.isNull()) { - tlvReader.getULong(ContextSpecificTag(TAG_TRANSITION_TIMESTAMP)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_TRANSITION_TIMESTAMP)) - null - } - - tlvReader.exitContainer() - - return ThermostatClusterQueuedPresetStruct(presetHandle, transitionTimestamp) - } - } -} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt index 2ba4a216410ef3..ae988738b7be34 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt @@ -23,15 +23,17 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class ThreadNetworkDirectoryClusterThreadNetworkStruct( - val extendedPanID: ULong, + val extendedPanID: ByteArray, val networkName: String, val channel: UInt, + val activeTimestamp: ULong, ) { override fun toString(): String = buildString { append("ThreadNetworkDirectoryClusterThreadNetworkStruct {\n") append("\textendedPanID : $extendedPanID\n") append("\tnetworkName : $networkName\n") append("\tchannel : $channel\n") + append("\tactiveTimestamp : $activeTimestamp\n") append("}\n") } @@ -41,6 +43,7 @@ class ThreadNetworkDirectoryClusterThreadNetworkStruct( put(ContextSpecificTag(TAG_EXTENDED_PAN_I_D), extendedPanID) put(ContextSpecificTag(TAG_NETWORK_NAME), networkName) put(ContextSpecificTag(TAG_CHANNEL), channel) + put(ContextSpecificTag(TAG_ACTIVE_TIMESTAMP), activeTimestamp) endStructure() } } @@ -49,19 +52,26 @@ class ThreadNetworkDirectoryClusterThreadNetworkStruct( private const val TAG_EXTENDED_PAN_I_D = 0 private const val TAG_NETWORK_NAME = 1 private const val TAG_CHANNEL = 2 + private const val TAG_ACTIVE_TIMESTAMP = 3 fun fromTlv( tlvTag: Tag, tlvReader: TlvReader, ): ThreadNetworkDirectoryClusterThreadNetworkStruct { tlvReader.enterStructure(tlvTag) - val extendedPanID = tlvReader.getULong(ContextSpecificTag(TAG_EXTENDED_PAN_I_D)) + val extendedPanID = tlvReader.getByteArray(ContextSpecificTag(TAG_EXTENDED_PAN_I_D)) val networkName = tlvReader.getString(ContextSpecificTag(TAG_NETWORK_NAME)) val channel = tlvReader.getUInt(ContextSpecificTag(TAG_CHANNEL)) + val activeTimestamp = tlvReader.getULong(ContextSpecificTag(TAG_ACTIVE_TIMESTAMP)) tlvReader.exitContainer() - return ThreadNetworkDirectoryClusterThreadNetworkStruct(extendedPanID, networkName, channel) + return ThreadNetworkDirectoryClusterThreadNetworkStruct( + extendedPanID, + networkName, + channel, + activeTimestamp, + ) } } } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WaterHeaterModeClusterModeOptionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WaterHeaterModeClusterModeOptionStruct.kt new file mode 100644 index 00000000000000..731c0395d7213d --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WaterHeaterModeClusterModeOptionStruct.kt @@ -0,0 +1,76 @@ +/* + * + * 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class WaterHeaterModeClusterModeOptionStruct( + val label: String, + val mode: UInt, + val modeTags: List, +) { + override fun toString(): String = buildString { + append("WaterHeaterModeClusterModeOptionStruct {\n") + append("\tlabel : $label\n") + append("\tmode : $mode\n") + append("\tmodeTags : $modeTags\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_LABEL), label) + put(ContextSpecificTag(TAG_MODE), mode) + startArray(ContextSpecificTag(TAG_MODE_TAGS)) + for (item in modeTags.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + endStructure() + } + } + + companion object { + private const val TAG_LABEL = 0 + private const val TAG_MODE = 1 + private const val TAG_MODE_TAGS = 2 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): WaterHeaterModeClusterModeOptionStruct { + tlvReader.enterStructure(tlvTag) + val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL)) + val mode = tlvReader.getUInt(ContextSpecificTag(TAG_MODE)) + val modeTags = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_MODE_TAGS)) + while (!tlvReader.isEndOfContainer()) { + add(WaterHeaterModeClusterModeTagStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return WaterHeaterModeClusterModeOptionStruct(label, mode, modeTags) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WaterHeaterModeClusterModeTagStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WaterHeaterModeClusterModeTagStruct.kt new file mode 100644 index 00000000000000..52281b378efc57 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WaterHeaterModeClusterModeTagStruct.kt @@ -0,0 +1,65 @@ +/* + * + * 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. + */ +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 WaterHeaterModeClusterModeTagStruct(val mfgCode: Optional, val value: UInt) { + override fun toString(): String = buildString { + append("WaterHeaterModeClusterModeTagStruct {\n") + append("\tmfgCode : $mfgCode\n") + append("\tvalue : $value\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (mfgCode.isPresent) { + val optmfgCode = mfgCode.get() + put(ContextSpecificTag(TAG_MFG_CODE), optmfgCode) + } + put(ContextSpecificTag(TAG_VALUE), value) + endStructure() + } + } + + companion object { + private const val TAG_MFG_CODE = 0 + private const val TAG_VALUE = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): WaterHeaterModeClusterModeTagStruct { + tlvReader.enterStructure(tlvTag) + val mfgCode = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MFG_CODE))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MFG_CODE))) + } else { + Optional.empty() + } + val value = tlvReader.getUInt(ContextSpecificTag(TAG_VALUE)) + + tlvReader.exitContainer() + + return WaterHeaterModeClusterModeTagStruct(mfgCode, value) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/AccessControlCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/AccessControlCluster.kt index 05caa07c4e9b3e..a46d8802a3c7ad 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/AccessControlCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/AccessControlCluster.kt @@ -22,6 +22,8 @@ import java.util.logging.Level import java.util.logging.Logger import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.transform +import matter.controller.InvokeRequest +import matter.controller.InvokeResponse import matter.controller.MatterController import matter.controller.ReadData import matter.controller.ReadRequest @@ -34,7 +36,9 @@ import matter.controller.WriteRequests import matter.controller.WriteResponse import matter.controller.cluster.structs.* import matter.controller.model.AttributePath +import matter.controller.model.CommandPath import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag import matter.tlv.TlvReader import matter.tlv.TlvWriter @@ -64,6 +68,31 @@ class AccessControlCluster( object SubscriptionEstablished : ExtensionAttributeSubscriptionState() } + class CommissioningARLAttribute( + val value: List? + ) + + sealed class CommissioningARLAttributeSubscriptionState { + data class Success( + val value: List? + ) : CommissioningARLAttributeSubscriptionState() + + data class Error(val exception: Exception) : CommissioningARLAttributeSubscriptionState() + + object SubscriptionEstablished : CommissioningARLAttributeSubscriptionState() + } + + class ArlAttribute(val value: List?) + + sealed class ArlAttributeSubscriptionState { + data class Success(val value: List?) : + ArlAttributeSubscriptionState() + + data class Error(val exception: Exception) : ArlAttributeSubscriptionState() + + object SubscriptionEstablished : ArlAttributeSubscriptionState() + } + class GeneratedCommandListAttribute(val value: List) sealed class GeneratedCommandListAttributeSubscriptionState { @@ -104,6 +133,34 @@ class AccessControlCluster( object SubscriptionEstablished : AttributeListAttributeSubscriptionState() } + suspend fun reviewFabricRestrictions( + arl: List, + timedInvokeTimeout: Duration? = null, + ) { + val commandId: UInt = 0u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_ARL_REQ: Int = 0 + tlvWriter.startArray(ContextSpecificTag(TAG_ARL_REQ)) + for (item in arl.iterator()) { + item.toTlv(AnonymousTag, tlvWriter) + } + tlvWriter.endArray() + 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 readAclAttribute(): AclAttribute { val ATTRIBUTE_ID: UInt = 0u @@ -654,6 +711,229 @@ class AccessControlCluster( } } + suspend fun readCommissioningARLAttribute(): CommissioningARLAttribute { + val ATTRIBUTE_ID: UInt = 5u + + 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) { "Commissioningarl attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List? = + if (tlvReader.isNextTag(AnonymousTag)) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add( + AccessControlClusterCommissioningAccessRestrictionEntryStruct.fromTlv( + AnonymousTag, + tlvReader, + ) + ) + } + tlvReader.exitContainer() + } + } else { + null + } + + return CommissioningARLAttribute(decodedValue) + } + + suspend fun subscribeCommissioningARLAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 5u + 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( + CommissioningARLAttributeSubscriptionState.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) { + "Commissioningarl attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List? = + if (tlvReader.isNextTag(AnonymousTag)) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add( + AccessControlClusterCommissioningAccessRestrictionEntryStruct.fromTlv( + AnonymousTag, + tlvReader, + ) + ) + } + tlvReader.exitContainer() + } + } else { + null + } + + decodedValue?.let { emit(CommissioningARLAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(CommissioningARLAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readArlAttribute(): ArlAttribute { + val ATTRIBUTE_ID: UInt = 6u + + 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) { "Arl attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List? = + if (tlvReader.isNextTag(AnonymousTag)) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(AccessControlClusterAccessRestrictionEntryStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + } else { + null + } + + return ArlAttribute(decodedValue) + } + + suspend fun subscribeArlAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 6u + 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( + ArlAttributeSubscriptionState.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) { "Arl attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List? = + if (tlvReader.isNextTag(AnonymousTag)) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add( + AccessControlClusterAccessRestrictionEntryStruct.fromTlv( + AnonymousTag, + tlvReader, + ) + ) + } + tlvReader.exitContainer() + } + } else { + null + } + + decodedValue?.let { emit(ArlAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(ArlAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { val ATTRIBUTE_ID: UInt = 65528u diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/BasicInformationCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/BasicInformationCluster.kt index b3ca847f528a3c..e60bab759236b3 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/BasicInformationCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/BasicInformationCluster.kt @@ -1792,7 +1792,7 @@ class BasicInformationCluster( } } - suspend fun readUniqueIDAttribute(): String? { + suspend fun readUniqueIDAttribute(): String { val ATTRIBUTE_ID: UInt = 18u val attributePath = @@ -1818,12 +1818,7 @@ class BasicInformationCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: String? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getString(AnonymousTag) - } else { - null - } + val decodedValue: String = tlvReader.getString(AnonymousTag) return decodedValue } @@ -1867,14 +1862,9 @@ class BasicInformationCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: String? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getString(AnonymousTag) - } else { - null - } + val decodedValue: String = tlvReader.getString(AnonymousTag) - decodedValue?.let { emit(StringSubscriptionState.Success(it)) } + emit(StringSubscriptionState.Success(decodedValue)) } SubscriptionState.SubscriptionEstablished -> { emit(StringSubscriptionState.SubscriptionEstablished) diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/BridgedDeviceBasicInformationCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/BridgedDeviceBasicInformationCluster.kt index 905c46fb0adb17..64742323eec50c 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/BridgedDeviceBasicInformationCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/BridgedDeviceBasicInformationCluster.kt @@ -23,6 +23,8 @@ import java.util.logging.Logger import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.transform import matter.controller.BooleanSubscriptionState +import matter.controller.InvokeRequest +import matter.controller.InvokeResponse import matter.controller.MatterController import matter.controller.ReadData import matter.controller.ReadRequest @@ -36,7 +38,9 @@ import matter.controller.WriteRequests import matter.controller.WriteResponse import matter.controller.cluster.structs.* import matter.controller.model.AttributePath +import matter.controller.model.CommandPath import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag import matter.tlv.TlvReader import matter.tlv.TlvWriter @@ -97,6 +101,27 @@ class BridgedDeviceBasicInformationCluster( object SubscriptionEstablished : AttributeListAttributeSubscriptionState() } + suspend fun keepActive(stayActiveDuration: UInt, timedInvokeTimeout: Duration? = null) { + val commandId: UInt = 128u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_STAY_ACTIVE_DURATION_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_STAY_ACTIVE_DURATION_REQ), stayActiveDuration) + 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 readVendorNameAttribute(): String? { val ATTRIBUTE_ID: UInt = 1u @@ -1411,7 +1436,7 @@ class BridgedDeviceBasicInformationCluster( } } - suspend fun readUniqueIDAttribute(): String? { + suspend fun readUniqueIDAttribute(): String { val ATTRIBUTE_ID: UInt = 18u val attributePath = @@ -1437,12 +1462,7 @@ class BridgedDeviceBasicInformationCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: String? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getString(AnonymousTag) - } else { - null - } + val decodedValue: String = tlvReader.getString(AnonymousTag) return decodedValue } @@ -1486,14 +1506,9 @@ class BridgedDeviceBasicInformationCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: String? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getString(AnonymousTag) - } else { - null - } + val decodedValue: String = tlvReader.getString(AnonymousTag) - decodedValue?.let { emit(StringSubscriptionState.Success(it)) } + emit(StringSubscriptionState.Success(decodedValue)) } SubscriptionState.SubscriptionEstablished -> { emit(StringSubscriptionState.SubscriptionEstablished) diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/CommissionerControlCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/CommissionerControlCluster.kt new file mode 100644 index 00000000000000..6a3d288d56e49c --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/CommissionerControlCluster.kt @@ -0,0 +1,874 @@ +/* + * + * 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. + */ + +package matter.controller.cluster.clusters + +import java.time.Duration +import java.util.logging.Level +import java.util.logging.Logger +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.transform +import matter.controller.InvokeRequest +import matter.controller.InvokeResponse +import matter.controller.MatterController +import matter.controller.ReadData +import matter.controller.ReadRequest +import matter.controller.SubscribeRequest +import matter.controller.SubscriptionState +import matter.controller.UIntSubscriptionState +import matter.controller.UShortSubscriptionState +import matter.controller.cluster.structs.* +import matter.controller.model.AttributePath +import matter.controller.model.CommandPath +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class CommissionerControlCluster( + private val controller: MatterController, + private val endpointId: UShort, +) { + class ReverseOpenCommissioningWindow( + val commissioningTimeout: UShort, + val PAKEPasscodeVerifier: ByteArray, + val discriminator: UShort, + val iterations: UInt, + val salt: ByteArray, + ) + + class GeneratedCommandListAttribute(val value: List) + + sealed class GeneratedCommandListAttributeSubscriptionState { + data class Success(val value: List) : GeneratedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : GeneratedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : GeneratedCommandListAttributeSubscriptionState() + } + + class AcceptedCommandListAttribute(val value: List) + + sealed class AcceptedCommandListAttributeSubscriptionState { + data class Success(val value: List) : AcceptedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AcceptedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : AcceptedCommandListAttributeSubscriptionState() + } + + class EventListAttribute(val value: List) + + sealed class EventListAttributeSubscriptionState { + data class Success(val value: List) : EventListAttributeSubscriptionState() + + data class Error(val exception: Exception) : EventListAttributeSubscriptionState() + + object SubscriptionEstablished : EventListAttributeSubscriptionState() + } + + class AttributeListAttribute(val value: List) + + sealed class AttributeListAttributeSubscriptionState { + data class Success(val value: List) : AttributeListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AttributeListAttributeSubscriptionState() + + object SubscriptionEstablished : AttributeListAttributeSubscriptionState() + } + + suspend fun requestCommissioningApproval( + requestId: ULong, + vendorId: UShort, + productId: UShort, + label: String?, + timedInvokeTimeout: Duration? = null, + ) { + val commandId: UInt = 0u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_REQUEST_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_REQUEST_ID_REQ), requestId) + + val TAG_VENDOR_ID_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_VENDOR_ID_REQ), vendorId) + + val TAG_PRODUCT_ID_REQ: Int = 2 + tlvWriter.put(ContextSpecificTag(TAG_PRODUCT_ID_REQ), productId) + + val TAG_LABEL_REQ: Int = 3 + label?.let { tlvWriter.put(ContextSpecificTag(TAG_LABEL_REQ), label) } + 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 commissionNode( + requestId: ULong, + responseTimeoutSeconds: UShort, + ipAddress: ByteArray?, + port: UShort?, + timedInvokeTimeout: Duration? = null, + ): ReverseOpenCommissioningWindow { + val commandId: UInt = 1u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_REQUEST_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_REQUEST_ID_REQ), requestId) + + val TAG_RESPONSE_TIMEOUT_SECONDS_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_RESPONSE_TIMEOUT_SECONDS_REQ), responseTimeoutSeconds) + + val TAG_IP_ADDRESS_REQ: Int = 2 + ipAddress?.let { tlvWriter.put(ContextSpecificTag(TAG_IP_ADDRESS_REQ), ipAddress) } + + val TAG_PORT_REQ: Int = 3 + port?.let { tlvWriter.put(ContextSpecificTag(TAG_PORT_REQ), port) } + 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}") + + val tlvReader = TlvReader(response.payload) + tlvReader.enterStructure(AnonymousTag) + val TAG_COMMISSIONING_TIMEOUT: Int = 0 + var commissioningTimeout_decoded: UShort? = null + + val TAG_P_A_K_E_PASSCODE_VERIFIER: Int = 1 + var PAKEPasscodeVerifier_decoded: ByteArray? = null + + val TAG_DISCRIMINATOR: Int = 2 + var discriminator_decoded: UShort? = null + + val TAG_ITERATIONS: Int = 3 + var iterations_decoded: UInt? = null + + val TAG_SALT: Int = 4 + var salt_decoded: ByteArray? = null + + while (!tlvReader.isEndOfContainer()) { + val tag = tlvReader.peekElement().tag + + if (tag == ContextSpecificTag(TAG_COMMISSIONING_TIMEOUT)) { + commissioningTimeout_decoded = tlvReader.getUShort(tag) + } + + if (tag == ContextSpecificTag(TAG_P_A_K_E_PASSCODE_VERIFIER)) { + PAKEPasscodeVerifier_decoded = tlvReader.getByteArray(tag) + } + + if (tag == ContextSpecificTag(TAG_DISCRIMINATOR)) { + discriminator_decoded = tlvReader.getUShort(tag) + } + + if (tag == ContextSpecificTag(TAG_ITERATIONS)) { + iterations_decoded = tlvReader.getUInt(tag) + } + + if (tag == ContextSpecificTag(TAG_SALT)) { + salt_decoded = tlvReader.getByteArray(tag) + } else { + tlvReader.skipElement() + } + } + + if (commissioningTimeout_decoded == null) { + throw IllegalStateException("commissioningTimeout not found in TLV") + } + + if (PAKEPasscodeVerifier_decoded == null) { + throw IllegalStateException("PAKEPasscodeVerifier not found in TLV") + } + + if (discriminator_decoded == null) { + throw IllegalStateException("discriminator not found in TLV") + } + + if (iterations_decoded == null) { + throw IllegalStateException("iterations not found in TLV") + } + + if (salt_decoded == null) { + throw IllegalStateException("salt not found in TLV") + } + + tlvReader.exitContainer() + + return ReverseOpenCommissioningWindow( + commissioningTimeout_decoded, + PAKEPasscodeVerifier_decoded, + discriminator_decoded, + iterations_decoded, + salt_decoded, + ) + } + + suspend fun readSupportedDeviceCategoriesAttribute(): UInt { + val ATTRIBUTE_ID: UInt = 0u + + 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) { "Supporteddevicecategories attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeSupportedDeviceCategoriesAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 0u + 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( + UIntSubscriptionState.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) { + "Supporteddevicecategories attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + emit(UIntSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UIntSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65528u + + 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) { "Generatedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return GeneratedCommandListAttribute(decodedValue) + } + + suspend fun subscribeGeneratedCommandListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65528u + 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( + GeneratedCommandListAttributeSubscriptionState.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) { + "Generatedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(GeneratedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(GeneratedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65529u + + 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) { "Acceptedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AcceptedCommandListAttribute(decodedValue) + } + + suspend fun subscribeAcceptedCommandListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65529u + 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( + AcceptedCommandListAttributeSubscriptionState.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) { + "Acceptedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AcceptedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AcceptedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readEventListAttribute(): EventListAttribute { + val ATTRIBUTE_ID: UInt = 65530u + + 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) { "Eventlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return EventListAttribute(decodedValue) + } + + suspend fun subscribeEventListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65530u + 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( + EventListAttributeSubscriptionState.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) { "Eventlist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(EventListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(EventListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAttributeListAttribute(): AttributeListAttribute { + val ATTRIBUTE_ID: UInt = 65531u + + 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) { "Attributelist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AttributeListAttribute(decodedValue) + } + + suspend fun subscribeAttributeListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65531u + 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( + AttributeListAttributeSubscriptionState.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) { "Attributelist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AttributeListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AttributeListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readFeatureMapAttribute(): UInt { + val ATTRIBUTE_ID: UInt = 65532u + + 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) { "Featuremap attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeFeatureMapAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65532u + 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( + UIntSubscriptionState.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) { "Featuremap attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + emit(UIntSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UIntSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readClusterRevisionAttribute(): UShort { + val ATTRIBUTE_ID: UInt = 65533u + + 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) { "Clusterrevision attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeClusterRevisionAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65533u + 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( + UShortSubscriptionState.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) { + "Clusterrevision attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + emit(UShortSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UShortSubscriptionState.SubscriptionEstablished) + } + } + } + } + + companion object { + private val logger = Logger.getLogger(CommissionerControlCluster::class.java.name) + const val CLUSTER_ID: UInt = 1873u + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/EcosystemInformationCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/EcosystemInformationCluster.kt new file mode 100644 index 00000000000000..5dfa4a7f8067ef --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/EcosystemInformationCluster.kt @@ -0,0 +1,969 @@ +/* + * + * 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. + */ + +package matter.controller.cluster.clusters + +import java.time.Duration +import java.util.logging.Level +import java.util.logging.Logger +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.transform +import matter.controller.MatterController +import matter.controller.ReadData +import matter.controller.ReadRequest +import matter.controller.SubscribeRequest +import matter.controller.SubscriptionState +import matter.controller.UIntSubscriptionState +import matter.controller.UShortSubscriptionState +import matter.controller.cluster.structs.* +import matter.controller.model.AttributePath +import matter.tlv.AnonymousTag +import matter.tlv.TlvReader + +class EcosystemInformationCluster( + private val controller: MatterController, + private val endpointId: UShort, +) { + class RemovedOnAttribute(val value: ULong?) + + sealed class RemovedOnAttributeSubscriptionState { + data class Success(val value: ULong?) : RemovedOnAttributeSubscriptionState() + + data class Error(val exception: Exception) : RemovedOnAttributeSubscriptionState() + + object SubscriptionEstablished : RemovedOnAttributeSubscriptionState() + } + + class DeviceDirectoryAttribute(val value: List) + + sealed class DeviceDirectoryAttributeSubscriptionState { + data class Success(val value: List) : + DeviceDirectoryAttributeSubscriptionState() + + data class Error(val exception: Exception) : DeviceDirectoryAttributeSubscriptionState() + + object SubscriptionEstablished : DeviceDirectoryAttributeSubscriptionState() + } + + class LocationDirectoryAttribute( + val value: List + ) + + sealed class LocationDirectoryAttributeSubscriptionState { + data class Success(val value: List) : + LocationDirectoryAttributeSubscriptionState() + + data class Error(val exception: Exception) : LocationDirectoryAttributeSubscriptionState() + + object SubscriptionEstablished : LocationDirectoryAttributeSubscriptionState() + } + + class GeneratedCommandListAttribute(val value: List) + + sealed class GeneratedCommandListAttributeSubscriptionState { + data class Success(val value: List) : GeneratedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : GeneratedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : GeneratedCommandListAttributeSubscriptionState() + } + + class AcceptedCommandListAttribute(val value: List) + + sealed class AcceptedCommandListAttributeSubscriptionState { + data class Success(val value: List) : AcceptedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AcceptedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : AcceptedCommandListAttributeSubscriptionState() + } + + class EventListAttribute(val value: List) + + sealed class EventListAttributeSubscriptionState { + data class Success(val value: List) : EventListAttributeSubscriptionState() + + data class Error(val exception: Exception) : EventListAttributeSubscriptionState() + + object SubscriptionEstablished : EventListAttributeSubscriptionState() + } + + class AttributeListAttribute(val value: List) + + sealed class AttributeListAttributeSubscriptionState { + data class Success(val value: List) : AttributeListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AttributeListAttributeSubscriptionState() + + object SubscriptionEstablished : AttributeListAttributeSubscriptionState() + } + + suspend fun readRemovedOnAttribute(): RemovedOnAttribute { + val ATTRIBUTE_ID: UInt = 0u + + 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) { "Removedon attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ULong? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getULong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return RemovedOnAttribute(decodedValue) + } + + suspend fun subscribeRemovedOnAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 0u + 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( + RemovedOnAttributeSubscriptionState.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) { "Removedon attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ULong? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getULong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(RemovedOnAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(RemovedOnAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readDeviceDirectoryAttribute(): DeviceDirectoryAttribute { + val ATTRIBUTE_ID: UInt = 1u + + 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) { "Devicedirectory attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(EcosystemInformationClusterEcosystemDeviceStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + return DeviceDirectoryAttribute(decodedValue) + } + + suspend fun subscribeDeviceDirectoryAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 1u + 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( + DeviceDirectoryAttributeSubscriptionState.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) { + "Devicedirectory attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add( + EcosystemInformationClusterEcosystemDeviceStruct.fromTlv(AnonymousTag, tlvReader) + ) + } + tlvReader.exitContainer() + } + + emit(DeviceDirectoryAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(DeviceDirectoryAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readLocationDirectoryAttribute(): LocationDirectoryAttribute { + val ATTRIBUTE_ID: UInt = 2u + + 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) { "Locationdirectory attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(EcosystemInformationClusterEcosystemLocationStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + return LocationDirectoryAttribute(decodedValue) + } + + suspend fun subscribeLocationDirectoryAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 2u + 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( + LocationDirectoryAttributeSubscriptionState.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) { + "Locationdirectory attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add( + EcosystemInformationClusterEcosystemLocationStruct.fromTlv( + AnonymousTag, + tlvReader, + ) + ) + } + tlvReader.exitContainer() + } + + emit(LocationDirectoryAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(LocationDirectoryAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65528u + + 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) { "Generatedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return GeneratedCommandListAttribute(decodedValue) + } + + suspend fun subscribeGeneratedCommandListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65528u + 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( + GeneratedCommandListAttributeSubscriptionState.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) { + "Generatedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(GeneratedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(GeneratedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65529u + + 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) { "Acceptedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AcceptedCommandListAttribute(decodedValue) + } + + suspend fun subscribeAcceptedCommandListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65529u + 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( + AcceptedCommandListAttributeSubscriptionState.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) { + "Acceptedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AcceptedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AcceptedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readEventListAttribute(): EventListAttribute { + val ATTRIBUTE_ID: UInt = 65530u + + 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) { "Eventlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return EventListAttribute(decodedValue) + } + + suspend fun subscribeEventListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65530u + 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( + EventListAttributeSubscriptionState.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) { "Eventlist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(EventListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(EventListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAttributeListAttribute(): AttributeListAttribute { + val ATTRIBUTE_ID: UInt = 65531u + + 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) { "Attributelist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AttributeListAttribute(decodedValue) + } + + suspend fun subscribeAttributeListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65531u + 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( + AttributeListAttributeSubscriptionState.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) { "Attributelist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AttributeListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AttributeListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readFeatureMapAttribute(): UInt { + val ATTRIBUTE_ID: UInt = 65532u + + 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) { "Featuremap attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeFeatureMapAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65532u + 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( + UIntSubscriptionState.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) { "Featuremap attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + emit(UIntSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UIntSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readClusterRevisionAttribute(): UShort { + val ATTRIBUTE_ID: UInt = 65533u + + 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) { "Clusterrevision attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeClusterRevisionAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65533u + 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( + UShortSubscriptionState.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) { + "Clusterrevision attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + emit(UShortSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UShortSubscriptionState.SubscriptionEstablished) + } + } + } + } + + companion object { + private val logger = Logger.getLogger(EcosystemInformationCluster::class.java.name) + const val CLUSTER_ID: UInt = 1872u + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/IcdManagementCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/IcdManagementCluster.kt index ddc206eeb28aad..68f206d72e71f4 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/IcdManagementCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/IcdManagementCluster.kt @@ -1066,6 +1066,99 @@ class IcdManagementCluster( } } + suspend fun readMaximumCheckInBackOffAttribute(): UInt? { + val ATTRIBUTE_ID: UInt = 9u + + 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) { "Maximumcheckinbackoff attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUInt(AnonymousTag) + } else { + null + } + + return decodedValue + } + + suspend fun subscribeMaximumCheckInBackOffAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 9u + 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( + UIntSubscriptionState.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) { + "Maximumcheckinbackoff attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUInt(AnonymousTag) + } else { + null + } + + decodedValue?.let { emit(UIntSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(UIntSubscriptionState.SubscriptionEstablished) + } + } + } + } + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { val ATTRIBUTE_ID: UInt = 65528u diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt index 5d36b70eea4726..66db507eb79cd5 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt @@ -253,17 +253,6 @@ class ThermostatCluster(private val controller: MatterController, private val en object SubscriptionEstablished : SetpointHoldExpiryTimestampAttributeSubscriptionState() } - class QueuedPresetAttribute(val value: ThermostatClusterQueuedPresetStruct?) - - sealed class QueuedPresetAttributeSubscriptionState { - data class Success(val value: ThermostatClusterQueuedPresetStruct?) : - QueuedPresetAttributeSubscriptionState() - - data class Error(val exception: Exception) : QueuedPresetAttributeSubscriptionState() - - object SubscriptionEstablished : QueuedPresetAttributeSubscriptionState() - } - class GeneratedCommandListAttribute(val value: List) sealed class GeneratedCommandListAttributeSubscriptionState { @@ -511,7 +500,6 @@ class ThermostatCluster(private val controller: MatterController, private val en suspend fun setActivePresetRequest( presetHandle: ByteArray, - delayMinutes: UShort?, timedInvokeTimeout: Duration? = null, ) { val commandId: UInt = 6u @@ -521,9 +509,6 @@ class ThermostatCluster(private val controller: MatterController, private val en val TAG_PRESET_HANDLE_REQ: Int = 0 tlvWriter.put(ContextSpecificTag(TAG_PRESET_HANDLE_REQ), presetHandle) - - val TAG_DELAY_MINUTES_REQ: Int = 1 - delayMinutes?.let { tlvWriter.put(ContextSpecificTag(TAG_DELAY_MINUTES_REQ), delayMinutes) } tlvWriter.endStructure() val request: InvokeRequest = @@ -597,51 +582,6 @@ class ThermostatCluster(private val controller: MatterController, private val en logger.log(Level.FINE, "Invoke command succeeded: ${response}") } - suspend fun cancelSetActivePresetRequest(timedInvokeTimeout: Duration? = null) { - val commandId: UInt = 10u - - val tlvWriter = TlvWriter() - tlvWriter.startStructure(AnonymousTag) - 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 setTemperatureSetpointHoldPolicy( - temperatureSetpointHoldPolicy: UByte, - timedInvokeTimeout: Duration? = null, - ) { - val commandId: UInt = 11u - - val tlvWriter = TlvWriter() - tlvWriter.startStructure(AnonymousTag) - - val TAG_TEMPERATURE_SETPOINT_HOLD_POLICY_REQ: Int = 0 - tlvWriter.put( - ContextSpecificTag(TAG_TEMPERATURE_SETPOINT_HOLD_POLICY_REQ), - temperatureSetpointHoldPolicy, - ) - 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 readLocalTemperatureAttribute(): LocalTemperatureAttribute { val ATTRIBUTE_ID: UInt = 0u @@ -7590,103 +7530,8 @@ class ThermostatCluster(private val controller: MatterController, private val en } } - suspend fun readTemperatureSetpointHoldPolicyAttribute(): UByte? { - val ATTRIBUTE_ID: UInt = 83u - - 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) { - "Temperaturesetpointholdpolicy 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 subscribeTemperatureSetpointHoldPolicyAttribute( - minInterval: Int, - maxInterval: Int, - ): Flow { - val ATTRIBUTE_ID: UInt = 83u - 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) { - "Temperaturesetpointholdpolicy 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 readSetpointHoldExpiryTimestampAttribute(): SetpointHoldExpiryTimestampAttribute { - val ATTRIBUTE_ID: UInt = 84u + val ATTRIBUTE_ID: UInt = 83u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -7730,7 +7575,7 @@ class ThermostatCluster(private val controller: MatterController, private val en minInterval: Int, maxInterval: Int, ): Flow { - val ATTRIBUTE_ID: UInt = 84u + val ATTRIBUTE_ID: UInt = 83u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -7790,107 +7635,6 @@ class ThermostatCluster(private val controller: MatterController, private val en } } - suspend fun readQueuedPresetAttribute(): QueuedPresetAttribute { - val ATTRIBUTE_ID: UInt = 85u - - 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) { "Queuedpreset attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: ThermostatClusterQueuedPresetStruct? = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(AnonymousTag)) { - ThermostatClusterQueuedPresetStruct.fromTlv(AnonymousTag, tlvReader) - } else { - null - } - } else { - tlvReader.getNull(AnonymousTag) - null - } - - return QueuedPresetAttribute(decodedValue) - } - - suspend fun subscribeQueuedPresetAttribute( - minInterval: Int, - maxInterval: Int, - ): Flow { - val ATTRIBUTE_ID: UInt = 85u - 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( - QueuedPresetAttributeSubscriptionState.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) { "Queuedpreset attribute not found in Node State update" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: ThermostatClusterQueuedPresetStruct? = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(AnonymousTag)) { - ThermostatClusterQueuedPresetStruct.fromTlv(AnonymousTag, tlvReader) - } else { - null - } - } else { - tlvReader.getNull(AnonymousTag) - null - } - - decodedValue?.let { emit(QueuedPresetAttributeSubscriptionState.Success(it)) } - } - SubscriptionState.SubscriptionEstablished -> { - emit(QueuedPresetAttributeSubscriptionState.SubscriptionEstablished) - } - } - } - } - suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { val ATTRIBUTE_ID: UInt = 65528u diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadBorderRouterManagementCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadBorderRouterManagementCluster.kt index 74a006c4d2a96b..b212ff7904d2fc 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadBorderRouterManagementCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadBorderRouterManagementCluster.kt @@ -185,7 +185,7 @@ class ThreadBorderRouterManagementCluster( breadcrumb: ULong?, timedInvokeTimeout: Duration? = null, ) { - val commandId: UInt = 4u + val commandId: UInt = 3u val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) @@ -212,7 +212,7 @@ class ThreadBorderRouterManagementCluster( pendingDataset: ByteArray, timedInvokeTimeout: Duration? = null, ) { - val commandId: UInt = 5u + val commandId: UInt = 4u val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) @@ -561,7 +561,7 @@ class ThreadBorderRouterManagementCluster( } suspend fun readActiveDatasetTimestampAttribute(): ActiveDatasetTimestampAttribute { - val ATTRIBUTE_ID: UInt = 5u + val ATTRIBUTE_ID: UInt = 4u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -601,7 +601,7 @@ class ThreadBorderRouterManagementCluster( minInterval: Int, maxInterval: Int, ): Flow { - val ATTRIBUTE_ID: UInt = 5u + val ATTRIBUTE_ID: UInt = 4u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadNetworkDirectoryCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadNetworkDirectoryCluster.kt index 6bbf6ffe4f813c..b5af2b1db2895a 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadNetworkDirectoryCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadNetworkDirectoryCluster.kt @@ -49,10 +49,10 @@ class ThreadNetworkDirectoryCluster( ) { class OperationalDatasetResponse(val operationalDataset: ByteArray) - class PreferredExtendedPanIDAttribute(val value: ULong?) + class PreferredExtendedPanIDAttribute(val value: ByteArray?) sealed class PreferredExtendedPanIDAttributeSubscriptionState { - data class Success(val value: ULong?) : PreferredExtendedPanIDAttributeSubscriptionState() + data class Success(val value: ByteArray?) : PreferredExtendedPanIDAttributeSubscriptionState() data class Error(val exception: Exception) : PreferredExtendedPanIDAttributeSubscriptionState() @@ -131,7 +131,7 @@ class ThreadNetworkDirectoryCluster( logger.log(Level.FINE, "Invoke command succeeded: ${response}") } - suspend fun removeNetwork(extendedPanID: ULong, timedInvokeTimeout: Duration) { + suspend fun removeNetwork(extendedPanID: ByteArray, timedInvokeTimeout: Duration) { val commandId: UInt = 1u val tlvWriter = TlvWriter() @@ -153,8 +153,8 @@ class ThreadNetworkDirectoryCluster( } suspend fun getOperationalDataset( - extendedPanID: ULong, - timedInvokeTimeout: Duration, + extendedPanID: ByteArray, + timedInvokeTimeout: Duration? = null, ): OperationalDatasetResponse { val commandId: UInt = 2u @@ -225,9 +225,9 @@ class ThreadNetworkDirectoryCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: ULong? = + val decodedValue: ByteArray? = if (!tlvReader.isNull()) { - tlvReader.getULong(AnonymousTag) + tlvReader.getByteArray(AnonymousTag) } else { tlvReader.getNull(AnonymousTag) null @@ -237,7 +237,7 @@ class ThreadNetworkDirectoryCluster( } suspend fun writePreferredExtendedPanIDAttribute( - value: ULong, + value: ByteArray, timedWriteTimeout: Duration? = null, ) { val ATTRIBUTE_ID: UInt = 0u @@ -320,9 +320,9 @@ class ThreadNetworkDirectoryCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: ULong? = + val decodedValue: ByteArray? = if (!tlvReader.isNull()) { - tlvReader.getULong(AnonymousTag) + tlvReader.getByteArray(AnonymousTag) } else { tlvReader.getNull(AnonymousTag) null diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/WaterHeaterManagementCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/WaterHeaterManagementCluster.kt new file mode 100644 index 00000000000000..7d0ce89e2a612e --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/WaterHeaterManagementCluster.kt @@ -0,0 +1,1228 @@ +/* + * + * 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. + */ + +package matter.controller.cluster.clusters + +import java.time.Duration +import java.util.logging.Level +import java.util.logging.Logger +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.transform +import matter.controller.InvokeRequest +import matter.controller.InvokeResponse +import matter.controller.LongSubscriptionState +import matter.controller.MatterController +import matter.controller.ReadData +import matter.controller.ReadRequest +import matter.controller.SubscribeRequest +import matter.controller.SubscriptionState +import matter.controller.UByteSubscriptionState +import matter.controller.UIntSubscriptionState +import matter.controller.UShortSubscriptionState +import matter.controller.cluster.structs.* +import matter.controller.model.AttributePath +import matter.controller.model.CommandPath +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class WaterHeaterManagementCluster( + private val controller: MatterController, + private val endpointId: UShort, +) { + class GeneratedCommandListAttribute(val value: List) + + sealed class GeneratedCommandListAttributeSubscriptionState { + data class Success(val value: List) : GeneratedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : GeneratedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : GeneratedCommandListAttributeSubscriptionState() + } + + class AcceptedCommandListAttribute(val value: List) + + sealed class AcceptedCommandListAttributeSubscriptionState { + data class Success(val value: List) : AcceptedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AcceptedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : AcceptedCommandListAttributeSubscriptionState() + } + + class EventListAttribute(val value: List) + + sealed class EventListAttributeSubscriptionState { + data class Success(val value: List) : EventListAttributeSubscriptionState() + + data class Error(val exception: Exception) : EventListAttributeSubscriptionState() + + object SubscriptionEstablished : EventListAttributeSubscriptionState() + } + + class AttributeListAttribute(val value: List) + + sealed class AttributeListAttributeSubscriptionState { + data class Success(val value: List) : AttributeListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AttributeListAttributeSubscriptionState() + + object SubscriptionEstablished : AttributeListAttributeSubscriptionState() + } + + suspend fun boost( + duration: UInt, + oneShot: Boolean?, + emergencyBoost: Boolean?, + temporarySetpoint: Short?, + targetPercentage: UByte?, + targetReheat: UByte?, + timedInvokeTimeout: Duration? = null, + ) { + val commandId: UInt = 0u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_DURATION_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_DURATION_REQ), duration) + + val TAG_ONE_SHOT_REQ: Int = 1 + oneShot?.let { tlvWriter.put(ContextSpecificTag(TAG_ONE_SHOT_REQ), oneShot) } + + val TAG_EMERGENCY_BOOST_REQ: Int = 2 + emergencyBoost?.let { + tlvWriter.put(ContextSpecificTag(TAG_EMERGENCY_BOOST_REQ), emergencyBoost) + } + + val TAG_TEMPORARY_SETPOINT_REQ: Int = 3 + temporarySetpoint?.let { + tlvWriter.put(ContextSpecificTag(TAG_TEMPORARY_SETPOINT_REQ), temporarySetpoint) + } + + val TAG_TARGET_PERCENTAGE_REQ: Int = 4 + targetPercentage?.let { + tlvWriter.put(ContextSpecificTag(TAG_TARGET_PERCENTAGE_REQ), targetPercentage) + } + + val TAG_TARGET_REHEAT_REQ: Int = 5 + targetReheat?.let { tlvWriter.put(ContextSpecificTag(TAG_TARGET_REHEAT_REQ), targetReheat) } + 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 cancelBoost(timedInvokeTimeout: Duration? = null) { + val commandId: UInt = 1u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + 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 readHeaterTypesAttribute(): UByte { + val ATTRIBUTE_ID: UInt = 0u + + 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) { "Heatertypes attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeHeaterTypesAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 0u + 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) { "Heatertypes attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + + emit(UByteSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UByteSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readHeatDemandAttribute(): UByte { + val ATTRIBUTE_ID: UInt = 1u + + 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) { "Heatdemand attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeHeatDemandAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 1u + 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) { "Heatdemand attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + + emit(UByteSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UByteSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readTankVolumeAttribute(): UShort? { + val ATTRIBUTE_ID: UInt = 2u + + 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) { "Tankvolume attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUShort(AnonymousTag) + } else { + null + } + + return decodedValue + } + + suspend fun subscribeTankVolumeAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 2u + 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( + UShortSubscriptionState.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) { "Tankvolume attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUShort(AnonymousTag) + } else { + null + } + + decodedValue?.let { emit(UShortSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(UShortSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readEstimatedHeatRequiredAttribute(): Long? { + val ATTRIBUTE_ID: UInt = 3u + + 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) { "Estimatedheatrequired attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + + return decodedValue + } + + suspend fun subscribeEstimatedHeatRequiredAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 3u + 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( + LongSubscriptionState.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) { + "Estimatedheatrequired attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + + decodedValue?.let { emit(LongSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(LongSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readTankPercentageAttribute(): UByte? { + val ATTRIBUTE_ID: UInt = 4u + + 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) { "Tankpercentage 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 subscribeTankPercentageAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 4u + 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) { + "Tankpercentage 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 readBoostStateAttribute(): UByte { + val ATTRIBUTE_ID: UInt = 5u + + 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) { "Booststate attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeBoostStateAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 5u + 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) { "Booststate attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + + emit(UByteSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UByteSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65528u + + 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) { "Generatedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return GeneratedCommandListAttribute(decodedValue) + } + + suspend fun subscribeGeneratedCommandListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65528u + 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( + GeneratedCommandListAttributeSubscriptionState.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) { + "Generatedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(GeneratedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(GeneratedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65529u + + 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) { "Acceptedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AcceptedCommandListAttribute(decodedValue) + } + + suspend fun subscribeAcceptedCommandListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65529u + 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( + AcceptedCommandListAttributeSubscriptionState.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) { + "Acceptedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AcceptedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AcceptedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readEventListAttribute(): EventListAttribute { + val ATTRIBUTE_ID: UInt = 65530u + + 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) { "Eventlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return EventListAttribute(decodedValue) + } + + suspend fun subscribeEventListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65530u + 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( + EventListAttributeSubscriptionState.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) { "Eventlist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(EventListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(EventListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAttributeListAttribute(): AttributeListAttribute { + val ATTRIBUTE_ID: UInt = 65531u + + 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) { "Attributelist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AttributeListAttribute(decodedValue) + } + + suspend fun subscribeAttributeListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65531u + 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( + AttributeListAttributeSubscriptionState.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) { "Attributelist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AttributeListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AttributeListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readFeatureMapAttribute(): UInt { + val ATTRIBUTE_ID: UInt = 65532u + + 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) { "Featuremap attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeFeatureMapAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65532u + 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( + UIntSubscriptionState.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) { "Featuremap attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + emit(UIntSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UIntSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readClusterRevisionAttribute(): UShort { + val ATTRIBUTE_ID: UInt = 65533u + + 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) { "Clusterrevision attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeClusterRevisionAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65533u + 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( + UShortSubscriptionState.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) { + "Clusterrevision attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + emit(UShortSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UShortSubscriptionState.SubscriptionEstablished) + } + } + } + } + + companion object { + private val logger = Logger.getLogger(WaterHeaterManagementCluster::class.java.name) + const val CLUSTER_ID: UInt = 148u + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/WaterHeaterModeCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/WaterHeaterModeCluster.kt new file mode 100644 index 00000000000000..27352644935c8a --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/WaterHeaterModeCluster.kt @@ -0,0 +1,1199 @@ +/* + * + * 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. + */ + +package matter.controller.cluster.clusters + +import java.time.Duration +import java.util.logging.Level +import java.util.logging.Logger +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.transform +import matter.controller.InvokeRequest +import matter.controller.InvokeResponse +import matter.controller.MatterController +import matter.controller.ReadData +import matter.controller.ReadRequest +import matter.controller.SubscribeRequest +import matter.controller.SubscriptionState +import matter.controller.UByteSubscriptionState +import matter.controller.UIntSubscriptionState +import matter.controller.UShortSubscriptionState +import matter.controller.WriteRequest +import matter.controller.WriteRequests +import matter.controller.WriteResponse +import matter.controller.cluster.structs.* +import matter.controller.model.AttributePath +import matter.controller.model.CommandPath +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class WaterHeaterModeCluster( + private val controller: MatterController, + private val endpointId: UShort, +) { + class ChangeToModeResponse(val status: UByte, val statusText: String?) + + class SupportedModesAttribute(val value: List) + + sealed class SupportedModesAttributeSubscriptionState { + data class Success(val value: List) : + SupportedModesAttributeSubscriptionState() + + data class Error(val exception: Exception) : SupportedModesAttributeSubscriptionState() + + object SubscriptionEstablished : SupportedModesAttributeSubscriptionState() + } + + class StartUpModeAttribute(val value: UByte?) + + sealed class StartUpModeAttributeSubscriptionState { + data class Success(val value: UByte?) : StartUpModeAttributeSubscriptionState() + + data class Error(val exception: Exception) : StartUpModeAttributeSubscriptionState() + + object SubscriptionEstablished : StartUpModeAttributeSubscriptionState() + } + + class OnModeAttribute(val value: UByte?) + + sealed class OnModeAttributeSubscriptionState { + data class Success(val value: UByte?) : OnModeAttributeSubscriptionState() + + data class Error(val exception: Exception) : OnModeAttributeSubscriptionState() + + object SubscriptionEstablished : OnModeAttributeSubscriptionState() + } + + class GeneratedCommandListAttribute(val value: List) + + sealed class GeneratedCommandListAttributeSubscriptionState { + data class Success(val value: List) : GeneratedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : GeneratedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : GeneratedCommandListAttributeSubscriptionState() + } + + class AcceptedCommandListAttribute(val value: List) + + sealed class AcceptedCommandListAttributeSubscriptionState { + data class Success(val value: List) : AcceptedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AcceptedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : AcceptedCommandListAttributeSubscriptionState() + } + + class EventListAttribute(val value: List) + + sealed class EventListAttributeSubscriptionState { + data class Success(val value: List) : EventListAttributeSubscriptionState() + + data class Error(val exception: Exception) : EventListAttributeSubscriptionState() + + object SubscriptionEstablished : EventListAttributeSubscriptionState() + } + + class AttributeListAttribute(val value: List) + + sealed class AttributeListAttributeSubscriptionState { + data class Success(val value: List) : AttributeListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AttributeListAttributeSubscriptionState() + + object SubscriptionEstablished : AttributeListAttributeSubscriptionState() + } + + suspend fun changeToMode( + newMode: UByte, + timedInvokeTimeout: Duration? = null, + ): ChangeToModeResponse { + val commandId: UInt = 0u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_NEW_MODE_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_NEW_MODE_REQ), newMode) + 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}") + + val tlvReader = TlvReader(response.payload) + tlvReader.enterStructure(AnonymousTag) + val TAG_STATUS: Int = 0 + var status_decoded: UByte? = null + + val TAG_STATUS_TEXT: Int = 1 + var statusText_decoded: String? = null + + while (!tlvReader.isEndOfContainer()) { + val tag = tlvReader.peekElement().tag + + if (tag == ContextSpecificTag(TAG_STATUS)) { + status_decoded = tlvReader.getUByte(tag) + } + + if (tag == ContextSpecificTag(TAG_STATUS_TEXT)) { + statusText_decoded = + if (tlvReader.isNull()) { + tlvReader.getNull(tag) + null + } else { + if (tlvReader.isNextTag(tag)) { + tlvReader.getString(tag) + } else { + null + } + } + } else { + tlvReader.skipElement() + } + } + + if (status_decoded == null) { + throw IllegalStateException("status not found in TLV") + } + + tlvReader.exitContainer() + + return ChangeToModeResponse(status_decoded, statusText_decoded) + } + + suspend fun readSupportedModesAttribute(): SupportedModesAttribute { + val ATTRIBUTE_ID: UInt = 0u + + 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) { "Supportedmodes attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(WaterHeaterModeClusterModeOptionStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + return SupportedModesAttribute(decodedValue) + } + + suspend fun subscribeSupportedModesAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 0u + 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( + SupportedModesAttributeSubscriptionState.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) { + "Supportedmodes attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(WaterHeaterModeClusterModeOptionStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + emit(SupportedModesAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(SupportedModesAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readCurrentModeAttribute(): UByte { + val ATTRIBUTE_ID: UInt = 1u + + 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) { "Currentmode attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeCurrentModeAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 1u + 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) { "Currentmode attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + + emit(UByteSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UByteSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readStartUpModeAttribute(): StartUpModeAttribute { + val ATTRIBUTE_ID: UInt = 2u + + 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) { "Startupmode attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUByte(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return StartUpModeAttribute(decodedValue) + } + + suspend fun writeStartUpModeAttribute(value: UByte, timedWriteTimeout: Duration? = null) { + val ATTRIBUTE_ID: UInt = 2u + + 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 subscribeStartUpModeAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 2u + 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( + StartUpModeAttributeSubscriptionState.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) { "Startupmode 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.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUByte(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(StartUpModeAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(StartUpModeAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readOnModeAttribute(): OnModeAttribute { + val ATTRIBUTE_ID: UInt = 3u + + 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) { "Onmode attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUByte(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return OnModeAttribute(decodedValue) + } + + suspend fun writeOnModeAttribute(value: UByte, timedWriteTimeout: Duration? = null) { + val ATTRIBUTE_ID: UInt = 3u + + 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 subscribeOnModeAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 3u + 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( + OnModeAttributeSubscriptionState.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) { "Onmode 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.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUByte(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(OnModeAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(OnModeAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65528u + + 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) { "Generatedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return GeneratedCommandListAttribute(decodedValue) + } + + suspend fun subscribeGeneratedCommandListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65528u + 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( + GeneratedCommandListAttributeSubscriptionState.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) { + "Generatedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(GeneratedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(GeneratedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65529u + + 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) { "Acceptedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AcceptedCommandListAttribute(decodedValue) + } + + suspend fun subscribeAcceptedCommandListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65529u + 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( + AcceptedCommandListAttributeSubscriptionState.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) { + "Acceptedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AcceptedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AcceptedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readEventListAttribute(): EventListAttribute { + val ATTRIBUTE_ID: UInt = 65530u + + 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) { "Eventlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return EventListAttribute(decodedValue) + } + + suspend fun subscribeEventListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65530u + 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( + EventListAttributeSubscriptionState.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) { "Eventlist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(EventListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(EventListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAttributeListAttribute(): AttributeListAttribute { + val ATTRIBUTE_ID: UInt = 65531u + + 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) { "Attributelist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AttributeListAttribute(decodedValue) + } + + suspend fun subscribeAttributeListAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65531u + 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( + AttributeListAttributeSubscriptionState.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) { "Attributelist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AttributeListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AttributeListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readFeatureMapAttribute(): UInt { + val ATTRIBUTE_ID: UInt = 65532u + + 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) { "Featuremap attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeFeatureMapAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65532u + 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( + UIntSubscriptionState.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) { "Featuremap attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + emit(UIntSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UIntSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readClusterRevisionAttribute(): UShort { + val ATTRIBUTE_ID: UInt = 65533u + + 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) { "Clusterrevision attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeClusterRevisionAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 65533u + 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( + UShortSubscriptionState.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) { + "Clusterrevision attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + emit(UShortSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UShortSubscriptionState.SubscriptionEstablished) + } + } + } + } + + companion object { + private val logger = Logger.getLogger(WaterHeaterModeCluster::class.java.name) + const val CLUSTER_ID: UInt = 158u + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/WiFiNetworkManagementCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/WiFiNetworkManagementCluster.kt index 32f8edab8d7b69..48efb1cea1f4b2 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/WiFiNetworkManagementCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/WiFiNetworkManagementCluster.kt @@ -55,6 +55,16 @@ class WiFiNetworkManagementCluster( object SubscriptionEstablished : SsidAttributeSubscriptionState() } + class PassphraseSurrogateAttribute(val value: ULong?) + + sealed class PassphraseSurrogateAttributeSubscriptionState { + data class Success(val value: ULong?) : PassphraseSurrogateAttributeSubscriptionState() + + data class Error(val exception: Exception) : PassphraseSurrogateAttributeSubscriptionState() + + object SubscriptionEstablished : PassphraseSurrogateAttributeSubscriptionState() + } + class GeneratedCommandListAttribute(val value: List) sealed class GeneratedCommandListAttributeSubscriptionState { @@ -139,7 +149,7 @@ class WiFiNetworkManagementCluster( } suspend fun readSsidAttribute(): SsidAttribute { - val ATTRIBUTE_ID: UInt = 1u + val ATTRIBUTE_ID: UInt = 0u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -179,7 +189,7 @@ class WiFiNetworkManagementCluster( minInterval: Int, maxInterval: Int, ): Flow { - val ATTRIBUTE_ID: UInt = 1u + val ATTRIBUTE_ID: UInt = 0u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -231,6 +241,101 @@ class WiFiNetworkManagementCluster( } } + suspend fun readPassphraseSurrogateAttribute(): PassphraseSurrogateAttribute { + val ATTRIBUTE_ID: UInt = 1u + + 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) { "Passphrasesurrogate attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ULong? = + if (!tlvReader.isNull()) { + tlvReader.getULong(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return PassphraseSurrogateAttribute(decodedValue) + } + + suspend fun subscribePassphraseSurrogateAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 1u + 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( + PassphraseSurrogateAttributeSubscriptionState.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) { + "Passphrasesurrogate attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ULong? = + if (!tlvReader.isNull()) { + tlvReader.getULong(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(PassphraseSurrogateAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(PassphraseSurrogateAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { val ATTRIBUTE_ID: UInt = 65528u diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterAccessRestrictionEntryChangedEvent.kt similarity index 69% rename from src/controller/java/generated/java/matter/controller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt rename to src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterAccessRestrictionEntryChangedEvent.kt index a5b1f26621002e..8a272f8854ae12 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterAccessRestrictionEntryChangedEvent.kt @@ -22,34 +22,34 @@ import matter.tlv.Tag import matter.tlv.TlvReader import matter.tlv.TlvWriter -class ThreadNetworkDirectoryClusterNetworkChangedEvent(val extendedPanID: ULong) { +class AccessControlClusterAccessRestrictionEntryChangedEvent(val fabricIndex: UByte) { override fun toString(): String = buildString { - append("ThreadNetworkDirectoryClusterNetworkChangedEvent {\n") - append("\textendedPanID : $extendedPanID\n") + append("AccessControlClusterAccessRestrictionEntryChangedEvent {\n") + append("\tfabricIndex : $fabricIndex\n") append("}\n") } fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_EXTENDED_PAN_I_D), extendedPanID) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) endStructure() } } companion object { - private const val TAG_EXTENDED_PAN_I_D = 0 + private const val TAG_FABRIC_INDEX = 254 fun fromTlv( tlvTag: Tag, tlvReader: TlvReader, - ): ThreadNetworkDirectoryClusterNetworkChangedEvent { + ): AccessControlClusterAccessRestrictionEntryChangedEvent { tlvReader.enterStructure(tlvTag) - val extendedPanID = tlvReader.getULong(ContextSpecificTag(TAG_EXTENDED_PAN_I_D)) + val fabricIndex = tlvReader.getUByte(ContextSpecificTag(TAG_FABRIC_INDEX)) tlvReader.exitContainer() - return ThreadNetworkDirectoryClusterNetworkChangedEvent(extendedPanID) + return AccessControlClusterAccessRestrictionEntryChangedEvent(fabricIndex) } } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterFabricRestrictionReviewUpdateEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterFabricRestrictionReviewUpdateEvent.kt new file mode 100644 index 00000000000000..2dca6ad48fbbe1 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterFabricRestrictionReviewUpdateEvent.kt @@ -0,0 +1,97 @@ +/* + * + * 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. + */ +package matter.controller.cluster.eventstructs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class AccessControlClusterFabricRestrictionReviewUpdateEvent( + val token: ULong, + val instruction: String?, + val redirectURL: String?, + val fabricIndex: UByte, +) { + override fun toString(): String = buildString { + append("AccessControlClusterFabricRestrictionReviewUpdateEvent {\n") + append("\ttoken : $token\n") + append("\tinstruction : $instruction\n") + append("\tredirectURL : $redirectURL\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_TOKEN), token) + if (instruction != null) { + put(ContextSpecificTag(TAG_INSTRUCTION), instruction) + } else { + putNull(ContextSpecificTag(TAG_INSTRUCTION)) + } + if (redirectURL != null) { + put(ContextSpecificTag(TAG_REDIRECT_U_R_L), redirectURL) + } else { + putNull(ContextSpecificTag(TAG_REDIRECT_U_R_L)) + } + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_TOKEN = 0 + private const val TAG_INSTRUCTION = 1 + private const val TAG_REDIRECT_U_R_L = 2 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): AccessControlClusterFabricRestrictionReviewUpdateEvent { + tlvReader.enterStructure(tlvTag) + val token = tlvReader.getULong(ContextSpecificTag(TAG_TOKEN)) + val instruction = + if (!tlvReader.isNull()) { + tlvReader.getString(ContextSpecificTag(TAG_INSTRUCTION)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_INSTRUCTION)) + null + } + val redirectURL = + if (!tlvReader.isNull()) { + tlvReader.getString(ContextSpecificTag(TAG_REDIRECT_U_R_L)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_REDIRECT_U_R_L)) + null + } + val fabricIndex = tlvReader.getUByte(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return AccessControlClusterFabricRestrictionReviewUpdateEvent( + token, + instruction, + redirectURL, + fabricIndex, + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/BridgedDeviceBasicInformationClusterActiveChangedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/BridgedDeviceBasicInformationClusterActiveChangedEvent.kt new file mode 100644 index 00000000000000..7713cb0faf07b3 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/BridgedDeviceBasicInformationClusterActiveChangedEvent.kt @@ -0,0 +1,56 @@ +/* + * + * 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. + */ +package matter.controller.cluster.eventstructs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class BridgedDeviceBasicInformationClusterActiveChangedEvent(val promisedActiveDuration: UInt) { + override fun toString(): String = buildString { + append("BridgedDeviceBasicInformationClusterActiveChangedEvent {\n") + append("\tpromisedActiveDuration : $promisedActiveDuration\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_PROMISED_ACTIVE_DURATION), promisedActiveDuration) + endStructure() + } + } + + companion object { + private const val TAG_PROMISED_ACTIVE_DURATION = 0 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): BridgedDeviceBasicInformationClusterActiveChangedEvent { + tlvReader.enterStructure(tlvTag) + val promisedActiveDuration = + tlvReader.getUInt(ContextSpecificTag(TAG_PROMISED_ACTIVE_DURATION)) + + tlvReader.exitContainer() + + return BridgedDeviceBasicInformationClusterActiveChangedEvent(promisedActiveDuration) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/CommissionerControlClusterCommissioningRequestResultEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/CommissionerControlClusterCommissioningRequestResultEvent.kt new file mode 100644 index 00000000000000..c8947776269773 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/CommissionerControlClusterCommissioningRequestResultEvent.kt @@ -0,0 +1,77 @@ +/* + * + * 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. + */ +package matter.controller.cluster.eventstructs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class CommissionerControlClusterCommissioningRequestResultEvent( + val requestId: ULong, + val clientNodeId: ULong, + val statusCode: UByte, + val fabricIndex: UByte, +) { + override fun toString(): String = buildString { + append("CommissionerControlClusterCommissioningRequestResultEvent {\n") + append("\trequestId : $requestId\n") + append("\tclientNodeId : $clientNodeId\n") + append("\tstatusCode : $statusCode\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_REQUEST_ID), requestId) + put(ContextSpecificTag(TAG_CLIENT_NODE_ID), clientNodeId) + put(ContextSpecificTag(TAG_STATUS_CODE), statusCode) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_REQUEST_ID = 0 + private const val TAG_CLIENT_NODE_ID = 1 + private const val TAG_STATUS_CODE = 2 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): CommissionerControlClusterCommissioningRequestResultEvent { + tlvReader.enterStructure(tlvTag) + val requestId = tlvReader.getULong(ContextSpecificTag(TAG_REQUEST_ID)) + val clientNodeId = tlvReader.getULong(ContextSpecificTag(TAG_CLIENT_NODE_ID)) + val statusCode = tlvReader.getUByte(ContextSpecificTag(TAG_STATUS_CODE)) + val fabricIndex = tlvReader.getUByte(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return CommissionerControlClusterCommissioningRequestResultEvent( + requestId, + clientNodeId, + statusCode, + fabricIndex, + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt index 28c49717661652..17459394a0bfef 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt @@ -16,6 +16,7 @@ */ package matter.controller.cluster.eventstructs +import java.util.Optional import matter.controller.cluster.* import matter.tlv.ContextSpecificTag import matter.tlv.Tag @@ -26,12 +27,14 @@ class EnergyEvseClusterEnergyTransferStartedEvent( val sessionID: UInt, val state: UByte, val maximumCurrent: Long, + val maximumDischargeCurrent: Optional, ) { override fun toString(): String = buildString { append("EnergyEvseClusterEnergyTransferStartedEvent {\n") append("\tsessionID : $sessionID\n") append("\tstate : $state\n") append("\tmaximumCurrent : $maximumCurrent\n") + append("\tmaximumDischargeCurrent : $maximumDischargeCurrent\n") append("}\n") } @@ -41,6 +44,10 @@ class EnergyEvseClusterEnergyTransferStartedEvent( put(ContextSpecificTag(TAG_SESSION_I_D), sessionID) put(ContextSpecificTag(TAG_STATE), state) put(ContextSpecificTag(TAG_MAXIMUM_CURRENT), maximumCurrent) + if (maximumDischargeCurrent.isPresent) { + val optmaximumDischargeCurrent = maximumDischargeCurrent.get() + put(ContextSpecificTag(TAG_MAXIMUM_DISCHARGE_CURRENT), optmaximumDischargeCurrent) + } endStructure() } } @@ -49,16 +56,28 @@ class EnergyEvseClusterEnergyTransferStartedEvent( private const val TAG_SESSION_I_D = 0 private const val TAG_STATE = 1 private const val TAG_MAXIMUM_CURRENT = 2 + private const val TAG_MAXIMUM_DISCHARGE_CURRENT = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterEnergyTransferStartedEvent { tlvReader.enterStructure(tlvTag) val sessionID = tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_I_D)) val state = tlvReader.getUByte(ContextSpecificTag(TAG_STATE)) val maximumCurrent = tlvReader.getLong(ContextSpecificTag(TAG_MAXIMUM_CURRENT)) + val maximumDischargeCurrent = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MAXIMUM_DISCHARGE_CURRENT))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_MAXIMUM_DISCHARGE_CURRENT))) + } else { + Optional.empty() + } tlvReader.exitContainer() - return EnergyEvseClusterEnergyTransferStartedEvent(sessionID, state, maximumCurrent) + return EnergyEvseClusterEnergyTransferStartedEvent( + sessionID, + state, + maximumCurrent, + maximumDischargeCurrent, + ) } } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt index e044a582d7f500..56c91b5c1beb71 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt @@ -16,6 +16,7 @@ */ package matter.controller.cluster.eventstructs +import java.util.Optional import matter.controller.cluster.* import matter.tlv.ContextSpecificTag import matter.tlv.Tag @@ -27,6 +28,7 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( val state: UByte, val reason: UByte, val energyTransferred: Long, + val energyDischarged: Optional, ) { override fun toString(): String = buildString { append("EnergyEvseClusterEnergyTransferStoppedEvent {\n") @@ -34,6 +36,7 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( append("\tstate : $state\n") append("\treason : $reason\n") append("\tenergyTransferred : $energyTransferred\n") + append("\tenergyDischarged : $energyDischarged\n") append("}\n") } @@ -44,6 +47,10 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( put(ContextSpecificTag(TAG_STATE), state) put(ContextSpecificTag(TAG_REASON), reason) put(ContextSpecificTag(TAG_ENERGY_TRANSFERRED), energyTransferred) + if (energyDischarged.isPresent) { + val optenergyDischarged = energyDischarged.get() + put(ContextSpecificTag(TAG_ENERGY_DISCHARGED), optenergyDischarged) + } endStructure() } } @@ -53,6 +60,7 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( private const val TAG_STATE = 1 private const val TAG_REASON = 2 private const val TAG_ENERGY_TRANSFERRED = 4 + private const val TAG_ENERGY_DISCHARGED = 5 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterEnergyTransferStoppedEvent { tlvReader.enterStructure(tlvTag) @@ -60,6 +68,12 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( val state = tlvReader.getUByte(ContextSpecificTag(TAG_STATE)) val reason = tlvReader.getUByte(ContextSpecificTag(TAG_REASON)) val energyTransferred = tlvReader.getLong(ContextSpecificTag(TAG_ENERGY_TRANSFERRED)) + val energyDischarged = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ENERGY_DISCHARGED))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_ENERGY_DISCHARGED))) + } else { + Optional.empty() + } tlvReader.exitContainer() @@ -68,6 +82,7 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( state, reason, energyTransferred, + energyDischarged, ) } } 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 7c11cb00b0aceb..dc0b4b09ec96f6 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -5,6 +5,9 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/AccessControlClusterAccessControlEntryStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/AccessControlClusterAccessControlExtensionStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/AccessControlClusterAccessControlTargetStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/AccessControlClusterAccessRestrictionEntryStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/AccessControlClusterAccessRestrictionStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/AccessControlClusterCommissioningAccessRestrictionEntryStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ActionsClusterActionStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ActionsClusterEndpointListStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ActivatedCarbonFilterMonitoringClusterReplacementProductStruct.kt", @@ -56,6 +59,10 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/DishwasherModeClusterModeOptionStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/DishwasherModeClusterModeTagStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/DoorLockClusterCredentialStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterDeviceTypeStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterEcosystemDeviceStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterLocationDescriptorStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.kt", @@ -113,10 +120,10 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/RvcOperationalStateClusterOperationalStateStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/RvcRunModeClusterModeOptionStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/RvcRunModeClusterModeTagStruct.kt", - "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterSceneInfoStruct.kt", - "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationDescriptorStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterMapStruct.kt", @@ -125,7 +132,6 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/TargetNavigatorClusterTargetInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterPresetStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterPresetTypeStruct.kt", - "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterQueuedPresetStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterScheduleStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterScheduleTransitionStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterScheduleTypeStruct.kt", @@ -147,11 +153,15 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterTestFabricScoped.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterTestListStructOctet.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/UserLabelClusterLabelStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/WaterHeaterModeClusterModeOptionStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/WaterHeaterModeClusterModeTagStruct.kt", ] matter_eventstructs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterAccessControlEntryChangedEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterAccessControlExtensionChangedEvent.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterAccessRestrictionEntryChangedEvent.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterFabricRestrictionReviewUpdateEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccountLoginClusterLoggedOutEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ActionsClusterActionFailedEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ActionsClusterStateChangedEvent.kt", @@ -161,8 +171,10 @@ matter_eventstructs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/BooleanStateClusterStateChangeEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/BooleanStateConfigurationClusterAlarmsStateChangedEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/BooleanStateConfigurationClusterSensorFaultEvent.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/BridgedDeviceBasicInformationClusterActiveChangedEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/BridgedDeviceBasicInformationClusterReachableChangedEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/BridgedDeviceBasicInformationClusterStartUpEvent.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/CommissionerControlClusterCommissioningRequestResultEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/DeviceEnergyManagementClusterPowerAdjustEndEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/DeviceEnergyManagementClusterResumedEvent.kt", @@ -219,7 +231,6 @@ matter_eventstructs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/TargetNavigatorClusterTargetUpdatedEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ThreadNetworkDiagnosticsClusterConnectionStatusEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ThreadNetworkDiagnosticsClusterNetworkFaultChangeEvent.kt", - "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ThreadNetworkDirectoryClusterNetworkChangedEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/TimeSynchronizationClusterDSTStatusEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/TimeSynchronizationClusterTimeZoneStatusEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/UnitTestingClusterTestDifferentVendorMeiEventEvent.kt", @@ -254,6 +265,7 @@ matter_clusters_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/CarbonMonoxideConcentrationMeasurementCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ChannelCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ColorControlCluster.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/CommissionerControlCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ContentAppObserverCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ContentControlCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ContentLauncherCluster.kt", @@ -265,6 +277,7 @@ matter_clusters_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/DishwasherAlarmCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/DishwasherModeCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/DoorLockCluster.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/EcosystemInformationCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ElectricalMeasurementCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ElectricalPowerMeasurementCluster.kt", @@ -352,6 +365,8 @@ matter_clusters_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/UserLabelCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ValveConfigurationAndControlCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/WakeOnLanCluster.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/WaterHeaterManagementCluster.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/WaterHeaterModeCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/WiFiNetworkDiagnosticsCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/WiFiNetworkManagementCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/WindowCoveringCluster.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/AccessControlClusterAccessRestrictionEntryStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/AccessControlClusterAccessRestrictionEntryStruct.kt new file mode 100644 index 00000000000000..6750b4fc80c401 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/AccessControlClusterAccessRestrictionEntryStruct.kt @@ -0,0 +1,89 @@ +/* + * + * 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. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class AccessControlClusterAccessRestrictionEntryStruct( + val endpoint: UShort, + val cluster: UInt, + val restrictions: List, + val fabricIndex: UByte, +) { + override fun toString(): String = buildString { + append("AccessControlClusterAccessRestrictionEntryStruct {\n") + append("\tendpoint : $endpoint\n") + append("\tcluster : $cluster\n") + append("\trestrictions : $restrictions\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ENDPOINT), endpoint) + put(ContextSpecificTag(TAG_CLUSTER), cluster) + startArray(ContextSpecificTag(TAG_RESTRICTIONS)) + for (item in restrictions.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_ENDPOINT = 0 + private const val TAG_CLUSTER = 1 + private const val TAG_RESTRICTIONS = 2 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): AccessControlClusterAccessRestrictionEntryStruct { + tlvReader.enterStructure(tlvTag) + val endpoint = tlvReader.getUShort(ContextSpecificTag(TAG_ENDPOINT)) + val cluster = tlvReader.getUInt(ContextSpecificTag(TAG_CLUSTER)) + val restrictions = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_RESTRICTIONS)) + while (!tlvReader.isEndOfContainer()) { + add(AccessControlClusterAccessRestrictionStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + val fabricIndex = tlvReader.getUByte(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return AccessControlClusterAccessRestrictionEntryStruct( + endpoint, + cluster, + restrictions, + fabricIndex, + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/AccessControlClusterAccessRestrictionStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/AccessControlClusterAccessRestrictionStruct.kt new file mode 100644 index 00000000000000..16452c2baa2919 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/AccessControlClusterAccessRestrictionStruct.kt @@ -0,0 +1,66 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class AccessControlClusterAccessRestrictionStruct(val type: UByte, val id: UInt?) { + override fun toString(): String = buildString { + append("AccessControlClusterAccessRestrictionStruct {\n") + append("\ttype : $type\n") + append("\tid : $id\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_TYPE), type) + if (id != null) { + put(ContextSpecificTag(TAG_ID), id) + } else { + putNull(ContextSpecificTag(TAG_ID)) + } + endStructure() + } + } + + companion object { + private const val TAG_TYPE = 0 + private const val TAG_ID = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): AccessControlClusterAccessRestrictionStruct { + tlvReader.enterStructure(tlvTag) + val type = tlvReader.getUByte(ContextSpecificTag(TAG_TYPE)) + val id = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_ID)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_ID)) + null + } + + tlvReader.exitContainer() + + return AccessControlClusterAccessRestrictionStruct(type, id) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/AccessControlClusterCommissioningAccessRestrictionEntryStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/AccessControlClusterCommissioningAccessRestrictionEntryStruct.kt new file mode 100644 index 00000000000000..c2c9582400272a --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/AccessControlClusterCommissioningAccessRestrictionEntryStruct.kt @@ -0,0 +1,83 @@ +/* + * + * 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. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class AccessControlClusterCommissioningAccessRestrictionEntryStruct( + val endpoint: UShort, + val cluster: UInt, + val restrictions: List, +) { + override fun toString(): String = buildString { + append("AccessControlClusterCommissioningAccessRestrictionEntryStruct {\n") + append("\tendpoint : $endpoint\n") + append("\tcluster : $cluster\n") + append("\trestrictions : $restrictions\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ENDPOINT), endpoint) + put(ContextSpecificTag(TAG_CLUSTER), cluster) + startArray(ContextSpecificTag(TAG_RESTRICTIONS)) + for (item in restrictions.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + endStructure() + } + } + + companion object { + private const val TAG_ENDPOINT = 0 + private const val TAG_CLUSTER = 1 + private const val TAG_RESTRICTIONS = 2 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): AccessControlClusterCommissioningAccessRestrictionEntryStruct { + tlvReader.enterStructure(tlvTag) + val endpoint = tlvReader.getUShort(ContextSpecificTag(TAG_ENDPOINT)) + val cluster = tlvReader.getUInt(ContextSpecificTag(TAG_CLUSTER)) + val restrictions = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_RESTRICTIONS)) + while (!tlvReader.isEndOfContainer()) { + add(AccessControlClusterAccessRestrictionStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return AccessControlClusterCommissioningAccessRestrictionEntryStruct( + endpoint, + cluster, + restrictions, + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterDeviceTypeStruct.kt similarity index 58% rename from src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt rename to src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterDeviceTypeStruct.kt index 1a14970ba2bd58..1ebb7b6abd3f60 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterDeviceTypeStruct.kt @@ -22,35 +22,35 @@ import matter.tlv.Tag import matter.tlv.TlvReader import matter.tlv.TlvWriter -class ScenesManagementClusterAttributeValuePair(val attributeID: UInt, val attributeValue: UInt) { +class EcosystemInformationClusterDeviceTypeStruct(val deviceType: UInt, val revision: UShort) { override fun toString(): String = buildString { - append("ScenesManagementClusterAttributeValuePair {\n") - append("\tattributeID : $attributeID\n") - append("\tattributeValue : $attributeValue\n") + append("EcosystemInformationClusterDeviceTypeStruct {\n") + append("\tdeviceType : $deviceType\n") + append("\trevision : $revision\n") append("}\n") } fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ATTRIBUTE_I_D), attributeID) - put(ContextSpecificTag(TAG_ATTRIBUTE_VALUE), attributeValue) + put(ContextSpecificTag(TAG_DEVICE_TYPE), deviceType) + put(ContextSpecificTag(TAG_REVISION), revision) endStructure() } } companion object { - private const val TAG_ATTRIBUTE_I_D = 0 - private const val TAG_ATTRIBUTE_VALUE = 1 + private const val TAG_DEVICE_TYPE = 0 + private const val TAG_REVISION = 1 - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ScenesManagementClusterAttributeValuePair { + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EcosystemInformationClusterDeviceTypeStruct { tlvReader.enterStructure(tlvTag) - val attributeID = tlvReader.getUInt(ContextSpecificTag(TAG_ATTRIBUTE_I_D)) - val attributeValue = tlvReader.getUInt(ContextSpecificTag(TAG_ATTRIBUTE_VALUE)) + val deviceType = tlvReader.getUInt(ContextSpecificTag(TAG_DEVICE_TYPE)) + val revision = tlvReader.getUShort(ContextSpecificTag(TAG_REVISION)) tlvReader.exitContainer() - return ScenesManagementClusterAttributeValuePair(attributeID, attributeValue) + return EcosystemInformationClusterDeviceTypeStruct(deviceType, revision) } } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterEcosystemDeviceStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterEcosystemDeviceStruct.kt new file mode 100644 index 00000000000000..0f04e02f973a58 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterEcosystemDeviceStruct.kt @@ -0,0 +1,142 @@ +/* + * + * 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. + */ +package matter.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EcosystemInformationClusterEcosystemDeviceStruct( + val deviceName: Optional, + val deviceNameLastEdit: Optional, + val bridgedEndpoint: UShort, + val originalEndpoint: UShort, + val deviceTypes: List, + val uniqueLocationIDs: List, + val uniqueLocationIDsLastEdit: ULong, + val fabricIndex: UByte, +) { + override fun toString(): String = buildString { + append("EcosystemInformationClusterEcosystemDeviceStruct {\n") + append("\tdeviceName : $deviceName\n") + append("\tdeviceNameLastEdit : $deviceNameLastEdit\n") + append("\tbridgedEndpoint : $bridgedEndpoint\n") + append("\toriginalEndpoint : $originalEndpoint\n") + append("\tdeviceTypes : $deviceTypes\n") + append("\tuniqueLocationIDs : $uniqueLocationIDs\n") + append("\tuniqueLocationIDsLastEdit : $uniqueLocationIDsLastEdit\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (deviceName.isPresent) { + val optdeviceName = deviceName.get() + put(ContextSpecificTag(TAG_DEVICE_NAME), optdeviceName) + } + if (deviceNameLastEdit.isPresent) { + val optdeviceNameLastEdit = deviceNameLastEdit.get() + put(ContextSpecificTag(TAG_DEVICE_NAME_LAST_EDIT), optdeviceNameLastEdit) + } + put(ContextSpecificTag(TAG_BRIDGED_ENDPOINT), bridgedEndpoint) + put(ContextSpecificTag(TAG_ORIGINAL_ENDPOINT), originalEndpoint) + startArray(ContextSpecificTag(TAG_DEVICE_TYPES)) + for (item in deviceTypes.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + startArray(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_DS)) + for (item in uniqueLocationIDs.iterator()) { + put(AnonymousTag, item) + } + endArray() + put(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_DS_LAST_EDIT), uniqueLocationIDsLastEdit) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_DEVICE_NAME = 0 + private const val TAG_DEVICE_NAME_LAST_EDIT = 1 + private const val TAG_BRIDGED_ENDPOINT = 2 + private const val TAG_ORIGINAL_ENDPOINT = 3 + private const val TAG_DEVICE_TYPES = 4 + private const val TAG_UNIQUE_LOCATION_I_DS = 5 + private const val TAG_UNIQUE_LOCATION_I_DS_LAST_EDIT = 6 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): EcosystemInformationClusterEcosystemDeviceStruct { + tlvReader.enterStructure(tlvTag) + val deviceName = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DEVICE_NAME))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_DEVICE_NAME))) + } else { + Optional.empty() + } + val deviceNameLastEdit = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DEVICE_NAME_LAST_EDIT))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_DEVICE_NAME_LAST_EDIT))) + } else { + Optional.empty() + } + val bridgedEndpoint = tlvReader.getUShort(ContextSpecificTag(TAG_BRIDGED_ENDPOINT)) + val originalEndpoint = tlvReader.getUShort(ContextSpecificTag(TAG_ORIGINAL_ENDPOINT)) + val deviceTypes = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_DEVICE_TYPES)) + while (!tlvReader.isEndOfContainer()) { + add(EcosystemInformationClusterDeviceTypeStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + val uniqueLocationIDs = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_DS)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getString(AnonymousTag)) + } + tlvReader.exitContainer() + } + val uniqueLocationIDsLastEdit = + tlvReader.getULong(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_DS_LAST_EDIT)) + val fabricIndex = tlvReader.getUByte(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return EcosystemInformationClusterEcosystemDeviceStruct( + deviceName, + deviceNameLastEdit, + bridgedEndpoint, + originalEndpoint, + deviceTypes, + uniqueLocationIDs, + uniqueLocationIDsLastEdit, + fabricIndex, + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt new file mode 100644 index 00000000000000..5d44434897197d --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt @@ -0,0 +1,82 @@ +/* + * + * 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. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EcosystemInformationClusterEcosystemLocationStruct( + val uniqueLocationID: String, + val locationDescriptor: EcosystemInformationClusterLocationDescriptorStruct, + val locationDescriptorLastEdit: ULong, + val fabricIndex: UByte, +) { + override fun toString(): String = buildString { + append("EcosystemInformationClusterEcosystemLocationStruct {\n") + append("\tuniqueLocationID : $uniqueLocationID\n") + append("\tlocationDescriptor : $locationDescriptor\n") + append("\tlocationDescriptorLastEdit : $locationDescriptorLastEdit\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_D), uniqueLocationID) + locationDescriptor.toTlv(ContextSpecificTag(TAG_LOCATION_DESCRIPTOR), this) + put(ContextSpecificTag(TAG_LOCATION_DESCRIPTOR_LAST_EDIT), locationDescriptorLastEdit) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_UNIQUE_LOCATION_I_D = 0 + private const val TAG_LOCATION_DESCRIPTOR = 1 + private const val TAG_LOCATION_DESCRIPTOR_LAST_EDIT = 2 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): EcosystemInformationClusterEcosystemLocationStruct { + tlvReader.enterStructure(tlvTag) + val uniqueLocationID = tlvReader.getString(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_D)) + val locationDescriptor = + EcosystemInformationClusterLocationDescriptorStruct.fromTlv( + ContextSpecificTag(TAG_LOCATION_DESCRIPTOR), + tlvReader, + ) + val locationDescriptorLastEdit = + tlvReader.getULong(ContextSpecificTag(TAG_LOCATION_DESCRIPTOR_LAST_EDIT)) + val fabricIndex = tlvReader.getUByte(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return EcosystemInformationClusterEcosystemLocationStruct( + uniqueLocationID, + locationDescriptor, + locationDescriptorLastEdit, + fabricIndex, + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterLocationDescriptorStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterLocationDescriptorStruct.kt new file mode 100644 index 00000000000000..ddb0f9498efefc --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterLocationDescriptorStruct.kt @@ -0,0 +1,91 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EcosystemInformationClusterLocationDescriptorStruct( + val locationName: String, + val floorNumber: Short?, + val areaType: UByte?, +) { + override fun toString(): String = buildString { + append("EcosystemInformationClusterLocationDescriptorStruct {\n") + append("\tlocationName : $locationName\n") + append("\tfloorNumber : $floorNumber\n") + append("\tareaType : $areaType\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_LOCATION_NAME), locationName) + if (floorNumber != null) { + put(ContextSpecificTag(TAG_FLOOR_NUMBER), floorNumber) + } else { + putNull(ContextSpecificTag(TAG_FLOOR_NUMBER)) + } + if (areaType != null) { + put(ContextSpecificTag(TAG_AREA_TYPE), areaType) + } else { + putNull(ContextSpecificTag(TAG_AREA_TYPE)) + } + endStructure() + } + } + + companion object { + private const val TAG_LOCATION_NAME = 0 + private const val TAG_FLOOR_NUMBER = 1 + private const val TAG_AREA_TYPE = 2 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): EcosystemInformationClusterLocationDescriptorStruct { + tlvReader.enterStructure(tlvTag) + val locationName = tlvReader.getString(ContextSpecificTag(TAG_LOCATION_NAME)) + val floorNumber = + if (!tlvReader.isNull()) { + tlvReader.getShort(ContextSpecificTag(TAG_FLOOR_NUMBER)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_FLOOR_NUMBER)) + null + } + val areaType = + if (!tlvReader.isNull()) { + tlvReader.getUByte(ContextSpecificTag(TAG_AREA_TYPE)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_AREA_TYPE)) + null + } + + tlvReader.exitContainer() + + return EcosystemInformationClusterLocationDescriptorStruct( + locationName, + floorNumber, + areaType, + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt new file mode 100644 index 00000000000000..9f142d41b3da4f --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt @@ -0,0 +1,172 @@ +/* + * + * 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. + */ +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 ScenesManagementClusterAttributeValuePairStruct( + val attributeID: UInt, + val valueUnsigned8: Optional, + val valueSigned8: Optional, + val valueUnsigned16: Optional, + val valueSigned16: Optional, + val valueUnsigned32: Optional, + val valueSigned32: Optional, + val valueUnsigned64: Optional, + val valueSigned64: Optional, +) { + override fun toString(): String = buildString { + append("ScenesManagementClusterAttributeValuePairStruct {\n") + append("\tattributeID : $attributeID\n") + append("\tvalueUnsigned8 : $valueUnsigned8\n") + append("\tvalueSigned8 : $valueSigned8\n") + append("\tvalueUnsigned16 : $valueUnsigned16\n") + append("\tvalueSigned16 : $valueSigned16\n") + append("\tvalueUnsigned32 : $valueUnsigned32\n") + append("\tvalueSigned32 : $valueSigned32\n") + append("\tvalueUnsigned64 : $valueUnsigned64\n") + append("\tvalueSigned64 : $valueSigned64\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ATTRIBUTE_I_D), attributeID) + if (valueUnsigned8.isPresent) { + val optvalueUnsigned8 = valueUnsigned8.get() + put(ContextSpecificTag(TAG_VALUE_UNSIGNED8), optvalueUnsigned8) + } + if (valueSigned8.isPresent) { + val optvalueSigned8 = valueSigned8.get() + put(ContextSpecificTag(TAG_VALUE_SIGNED8), optvalueSigned8) + } + if (valueUnsigned16.isPresent) { + val optvalueUnsigned16 = valueUnsigned16.get() + put(ContextSpecificTag(TAG_VALUE_UNSIGNED16), optvalueUnsigned16) + } + if (valueSigned16.isPresent) { + val optvalueSigned16 = valueSigned16.get() + put(ContextSpecificTag(TAG_VALUE_SIGNED16), optvalueSigned16) + } + if (valueUnsigned32.isPresent) { + val optvalueUnsigned32 = valueUnsigned32.get() + put(ContextSpecificTag(TAG_VALUE_UNSIGNED32), optvalueUnsigned32) + } + if (valueSigned32.isPresent) { + val optvalueSigned32 = valueSigned32.get() + put(ContextSpecificTag(TAG_VALUE_SIGNED32), optvalueSigned32) + } + if (valueUnsigned64.isPresent) { + val optvalueUnsigned64 = valueUnsigned64.get() + put(ContextSpecificTag(TAG_VALUE_UNSIGNED64), optvalueUnsigned64) + } + if (valueSigned64.isPresent) { + val optvalueSigned64 = valueSigned64.get() + put(ContextSpecificTag(TAG_VALUE_SIGNED64), optvalueSigned64) + } + endStructure() + } + } + + companion object { + private const val TAG_ATTRIBUTE_I_D = 0 + private const val TAG_VALUE_UNSIGNED8 = 1 + private const val TAG_VALUE_SIGNED8 = 2 + private const val TAG_VALUE_UNSIGNED16 = 3 + private const val TAG_VALUE_SIGNED16 = 4 + private const val TAG_VALUE_UNSIGNED32 = 5 + private const val TAG_VALUE_SIGNED32 = 6 + private const val TAG_VALUE_UNSIGNED64 = 7 + private const val TAG_VALUE_SIGNED64 = 8 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader, + ): ScenesManagementClusterAttributeValuePairStruct { + tlvReader.enterStructure(tlvTag) + val attributeID = tlvReader.getUInt(ContextSpecificTag(TAG_ATTRIBUTE_I_D)) + val valueUnsigned8 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED8))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_VALUE_UNSIGNED8))) + } else { + Optional.empty() + } + val valueSigned8 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_SIGNED8))) { + Optional.of(tlvReader.getByte(ContextSpecificTag(TAG_VALUE_SIGNED8))) + } else { + Optional.empty() + } + val valueUnsigned16 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED16))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_VALUE_UNSIGNED16))) + } else { + Optional.empty() + } + val valueSigned16 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_SIGNED16))) { + Optional.of(tlvReader.getShort(ContextSpecificTag(TAG_VALUE_SIGNED16))) + } else { + Optional.empty() + } + val valueUnsigned32 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED32))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_VALUE_UNSIGNED32))) + } else { + Optional.empty() + } + val valueSigned32 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_SIGNED32))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_VALUE_SIGNED32))) + } else { + Optional.empty() + } + val valueUnsigned64 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED64))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_VALUE_UNSIGNED64))) + } else { + Optional.empty() + } + val valueSigned64 = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_SIGNED64))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_VALUE_SIGNED64))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ScenesManagementClusterAttributeValuePairStruct( + attributeID, + valueUnsigned8, + valueSigned8, + valueUnsigned16, + valueSigned16, + valueUnsigned32, + valueSigned32, + valueUnsigned64, + valueSigned64, + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt index bf90959b2604ed..bd219e98d152fd 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt @@ -25,7 +25,7 @@ import matter.tlv.TlvWriter class ScenesManagementClusterExtensionFieldSet( val clusterID: UInt, - val attributeValueList: List, + val attributeValueList: List, ) { override fun toString(): String = buildString { append("ScenesManagementClusterExtensionFieldSet {\n") @@ -55,10 +55,10 @@ class ScenesManagementClusterExtensionFieldSet( tlvReader.enterStructure(tlvTag) val clusterID = tlvReader.getUInt(ContextSpecificTag(TAG_CLUSTER_I_D)) val attributeValueList = - buildList { + buildList { tlvReader.enterArray(ContextSpecificTag(TAG_ATTRIBUTE_VALUE_LIST)) while (!tlvReader.isEndOfContainer()) { - add(ScenesManagementClusterAttributeValuePair.fromTlv(AnonymousTag, tlvReader)) + add(ScenesManagementClusterAttributeValuePairStruct.fromTlv(AnonymousTag, tlvReader)) } tlvReader.exitContainer() } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationDescriptorStruct.kt similarity index 91% rename from src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt rename to src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationDescriptorStruct.kt index 76eb3671a26962..fd24fa9218c22d 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationDescriptorStruct.kt @@ -22,13 +22,13 @@ import matter.tlv.Tag import matter.tlv.TlvReader import matter.tlv.TlvWriter -class ServiceAreaClusterHomeLocationStruct( +class ServiceAreaClusterLocationDescriptorStruct( val locationName: String, val floorNumber: Short?, val areaType: UByte?, ) { override fun toString(): String = buildString { - append("ServiceAreaClusterHomeLocationStruct {\n") + append("ServiceAreaClusterLocationDescriptorStruct {\n") append("\tlocationName : $locationName\n") append("\tfloorNumber : $floorNumber\n") append("\tareaType : $areaType\n") @@ -58,7 +58,7 @@ class ServiceAreaClusterHomeLocationStruct( private const val TAG_FLOOR_NUMBER = 1 private const val TAG_AREA_TYPE = 2 - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterHomeLocationStruct { + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterLocationDescriptorStruct { tlvReader.enterStructure(tlvTag) val locationName = tlvReader.getString(ContextSpecificTag(TAG_LOCATION_NAME)) val floorNumber = @@ -78,7 +78,7 @@ class ServiceAreaClusterHomeLocationStruct( tlvReader.exitContainer() - return ServiceAreaClusterHomeLocationStruct(locationName, floorNumber, areaType) + return ServiceAreaClusterLocationDescriptorStruct(locationName, floorNumber, areaType) } } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt index 5c8b08507bb76f..d61927fb7ec852 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt @@ -23,7 +23,7 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class ServiceAreaClusterLocationInfoStruct( - val locationInfo: ServiceAreaClusterHomeLocationStruct?, + val locationInfo: ServiceAreaClusterLocationDescriptorStruct?, val landmarkTag: UByte?, val positionTag: UByte?, val surfaceTag: UByte?, @@ -74,7 +74,7 @@ class ServiceAreaClusterLocationInfoStruct( tlvReader.enterStructure(tlvTag) val locationInfo = if (!tlvReader.isNull()) { - ServiceAreaClusterHomeLocationStruct.fromTlv( + ServiceAreaClusterLocationDescriptorStruct.fromTlv( ContextSpecificTag(TAG_LOCATION_INFO), tlvReader, ) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterQueuedPresetStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterQueuedPresetStruct.kt deleted file mode 100644 index 4cb63aed9e7b39..00000000000000 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterQueuedPresetStruct.kt +++ /dev/null @@ -1,79 +0,0 @@ -/* - * - * 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. - */ -package matter.controller.cluster.structs - -import matter.controller.cluster.* -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class ThermostatClusterQueuedPresetStruct( - val presetHandle: ByteArray?, - val transitionTimestamp: UInt?, -) { - override fun toString(): String = buildString { - append("ThermostatClusterQueuedPresetStruct {\n") - append("\tpresetHandle : $presetHandle\n") - append("\ttransitionTimestamp : $transitionTimestamp\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - if (presetHandle != null) { - put(ContextSpecificTag(TAG_PRESET_HANDLE), presetHandle) - } else { - putNull(ContextSpecificTag(TAG_PRESET_HANDLE)) - } - if (transitionTimestamp != null) { - put(ContextSpecificTag(TAG_TRANSITION_TIMESTAMP), transitionTimestamp) - } else { - putNull(ContextSpecificTag(TAG_TRANSITION_TIMESTAMP)) - } - endStructure() - } - } - - companion object { - private const val TAG_PRESET_HANDLE = 0 - private const val TAG_TRANSITION_TIMESTAMP = 1 - - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ThermostatClusterQueuedPresetStruct { - tlvReader.enterStructure(tlvTag) - val presetHandle = - if (!tlvReader.isNull()) { - tlvReader.getByteArray(ContextSpecificTag(TAG_PRESET_HANDLE)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_PRESET_HANDLE)) - null - } - val transitionTimestamp = - if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_TRANSITION_TIMESTAMP)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_TRANSITION_TIMESTAMP)) - null - } - - tlvReader.exitContainer() - - return ThermostatClusterQueuedPresetStruct(presetHandle, transitionTimestamp) - } - } -} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt index db8dbbb0324745..bacfb457534ddd 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt @@ -23,15 +23,17 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class ThreadNetworkDirectoryClusterThreadNetworkStruct( - val extendedPanID: ULong, + val extendedPanID: ByteArray, val networkName: String, val channel: UShort, + val activeTimestamp: ULong, ) { override fun toString(): String = buildString { append("ThreadNetworkDirectoryClusterThreadNetworkStruct {\n") append("\textendedPanID : $extendedPanID\n") append("\tnetworkName : $networkName\n") append("\tchannel : $channel\n") + append("\tactiveTimestamp : $activeTimestamp\n") append("}\n") } @@ -41,6 +43,7 @@ class ThreadNetworkDirectoryClusterThreadNetworkStruct( put(ContextSpecificTag(TAG_EXTENDED_PAN_I_D), extendedPanID) put(ContextSpecificTag(TAG_NETWORK_NAME), networkName) put(ContextSpecificTag(TAG_CHANNEL), channel) + put(ContextSpecificTag(TAG_ACTIVE_TIMESTAMP), activeTimestamp) endStructure() } } @@ -49,19 +52,26 @@ class ThreadNetworkDirectoryClusterThreadNetworkStruct( private const val TAG_EXTENDED_PAN_I_D = 0 private const val TAG_NETWORK_NAME = 1 private const val TAG_CHANNEL = 2 + private const val TAG_ACTIVE_TIMESTAMP = 3 fun fromTlv( tlvTag: Tag, tlvReader: TlvReader, ): ThreadNetworkDirectoryClusterThreadNetworkStruct { tlvReader.enterStructure(tlvTag) - val extendedPanID = tlvReader.getULong(ContextSpecificTag(TAG_EXTENDED_PAN_I_D)) + val extendedPanID = tlvReader.getByteArray(ContextSpecificTag(TAG_EXTENDED_PAN_I_D)) val networkName = tlvReader.getString(ContextSpecificTag(TAG_NETWORK_NAME)) val channel = tlvReader.getUShort(ContextSpecificTag(TAG_CHANNEL)) + val activeTimestamp = tlvReader.getULong(ContextSpecificTag(TAG_ACTIVE_TIMESTAMP)) tlvReader.exitContainer() - return ThreadNetworkDirectoryClusterThreadNetworkStruct(extendedPanID, networkName, channel) + return ThreadNetworkDirectoryClusterThreadNetworkStruct( + extendedPanID, + networkName, + channel, + activeTimestamp, + ) } } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/WaterHeaterModeClusterModeOptionStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/WaterHeaterModeClusterModeOptionStruct.kt new file mode 100644 index 00000000000000..52252bf6e4cc56 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/WaterHeaterModeClusterModeOptionStruct.kt @@ -0,0 +1,76 @@ +/* + * + * 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. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class WaterHeaterModeClusterModeOptionStruct( + val label: String, + val mode: UByte, + val modeTags: List, +) { + override fun toString(): String = buildString { + append("WaterHeaterModeClusterModeOptionStruct {\n") + append("\tlabel : $label\n") + append("\tmode : $mode\n") + append("\tmodeTags : $modeTags\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_LABEL), label) + put(ContextSpecificTag(TAG_MODE), mode) + startArray(ContextSpecificTag(TAG_MODE_TAGS)) + for (item in modeTags.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + endStructure() + } + } + + companion object { + private const val TAG_LABEL = 0 + private const val TAG_MODE = 1 + private const val TAG_MODE_TAGS = 2 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): WaterHeaterModeClusterModeOptionStruct { + tlvReader.enterStructure(tlvTag) + val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL)) + val mode = tlvReader.getUByte(ContextSpecificTag(TAG_MODE)) + val modeTags = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_MODE_TAGS)) + while (!tlvReader.isEndOfContainer()) { + add(WaterHeaterModeClusterModeTagStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return WaterHeaterModeClusterModeOptionStruct(label, mode, modeTags) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/WaterHeaterModeClusterModeTagStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/WaterHeaterModeClusterModeTagStruct.kt new file mode 100644 index 00000000000000..fc91c1389574ab --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/WaterHeaterModeClusterModeTagStruct.kt @@ -0,0 +1,65 @@ +/* + * + * 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. + */ +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 WaterHeaterModeClusterModeTagStruct(val mfgCode: Optional, val value: UShort) { + override fun toString(): String = buildString { + append("WaterHeaterModeClusterModeTagStruct {\n") + append("\tmfgCode : $mfgCode\n") + append("\tvalue : $value\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (mfgCode.isPresent) { + val optmfgCode = mfgCode.get() + put(ContextSpecificTag(TAG_MFG_CODE), optmfgCode) + } + put(ContextSpecificTag(TAG_VALUE), value) + endStructure() + } + } + + companion object { + private const val TAG_MFG_CODE = 0 + private const val TAG_VALUE = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): WaterHeaterModeClusterModeTagStruct { + tlvReader.enterStructure(tlvTag) + val mfgCode = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MFG_CODE))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_MFG_CODE))) + } else { + Optional.empty() + } + val value = tlvReader.getUShort(ContextSpecificTag(TAG_VALUE)) + + tlvReader.exitContainer() + + return WaterHeaterModeClusterModeTagStruct(mfgCode, value) + } + } +} diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 66797f78118dd1..6a971995c099fe 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -2496,6 +2496,242 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR value); return value; } + case Attributes::CommissioningARL::Id: { + using TypeInfo = Attributes::CommissioningARL::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_endpoint; + std::string newElement_0_endpointClassName = "java/lang/Integer"; + std::string newElement_0_endpointCtorSignature = "(I)V"; + jint jninewElement_0_endpoint = static_cast(entry_0.endpoint); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_endpointClassName.c_str(), + newElement_0_endpointCtorSignature.c_str(), + jninewElement_0_endpoint, newElement_0_endpoint); + jobject newElement_0_cluster; + std::string newElement_0_clusterClassName = "java/lang/Long"; + std::string newElement_0_clusterCtorSignature = "(J)V"; + jlong jninewElement_0_cluster = static_cast(entry_0.cluster); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_clusterClassName.c_str(), + newElement_0_clusterCtorSignature.c_str(), + jninewElement_0_cluster, newElement_0_cluster); + jobject newElement_0_restrictions; + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_restrictions); + + auto iter_newElement_0_restrictions_2 = entry_0.restrictions.begin(); + while (iter_newElement_0_restrictions_2.Next()) + { + auto & entry_2 = iter_newElement_0_restrictions_2.GetValue(); + jobject newElement_2; + jobject newElement_2_type; + std::string newElement_2_typeClassName = "java/lang/Integer"; + std::string newElement_2_typeCtorSignature = "(I)V"; + jint jninewElement_2_type = static_cast(entry_2.type); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_2_typeClassName.c_str(), + newElement_2_typeCtorSignature.c_str(), + jninewElement_2_type, newElement_2_type); + jobject newElement_2_id; + if (entry_2.id.IsNull()) + { + newElement_2_id = nullptr; + } + else + { + std::string newElement_2_idClassName = "java/lang/Long"; + std::string newElement_2_idCtorSignature = "(J)V"; + jlong jninewElement_2_id = static_cast(entry_2.id.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_2_idClassName.c_str(), + newElement_2_idCtorSignature.c_str(), + jninewElement_2_id, newElement_2_id); + } + + jclass accessRestrictionStructStructClass_3; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$AccessControlClusterAccessRestrictionStruct", + accessRestrictionStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$AccessControlClusterAccessRestrictionStruct"); + return nullptr; + } + + jmethodID accessRestrictionStructStructCtor_3; + err = chip::JniReferences::GetInstance().FindMethod(env, accessRestrictionStructStructClass_3, "", + "(Ljava/lang/Integer;Ljava/lang/Long;)V", + &accessRestrictionStructStructCtor_3); + if (err != CHIP_NO_ERROR || accessRestrictionStructStructCtor_3 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$AccessControlClusterAccessRestrictionStruct constructor"); + return nullptr; + } + + newElement_2 = env->NewObject(accessRestrictionStructStructClass_3, accessRestrictionStructStructCtor_3, + newElement_2_type, newElement_2_id); + chip::JniReferences::GetInstance().AddToList(newElement_0_restrictions, newElement_2); + } + + jclass commissioningAccessRestrictionEntryStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$AccessControlClusterCommissioningAccessRestrictionEntryStruct", + commissioningAccessRestrictionEntryStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$AccessControlClusterCommissioningAccessRestrictionEntryStruct"); + return nullptr; + } + + jmethodID commissioningAccessRestrictionEntryStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod(env, commissioningAccessRestrictionEntryStructStructClass_1, + "", + "(Ljava/lang/Integer;Ljava/lang/Long;Ljava/util/ArrayList;)V", + &commissioningAccessRestrictionEntryStructStructCtor_1); + if (err != CHIP_NO_ERROR || commissioningAccessRestrictionEntryStructStructCtor_1 == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipStructs$AccessControlClusterCommissioningAccessRestrictionEntryStruct constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(commissioningAccessRestrictionEntryStructStructClass_1, + commissioningAccessRestrictionEntryStructStructCtor_1, newElement_0_endpoint, + newElement_0_cluster, newElement_0_restrictions); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::Arl::Id: { + using TypeInfo = Attributes::Arl::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_endpoint; + std::string newElement_0_endpointClassName = "java/lang/Integer"; + std::string newElement_0_endpointCtorSignature = "(I)V"; + jint jninewElement_0_endpoint = static_cast(entry_0.endpoint); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_endpointClassName.c_str(), + newElement_0_endpointCtorSignature.c_str(), + jninewElement_0_endpoint, newElement_0_endpoint); + jobject newElement_0_cluster; + std::string newElement_0_clusterClassName = "java/lang/Long"; + std::string newElement_0_clusterCtorSignature = "(J)V"; + jlong jninewElement_0_cluster = static_cast(entry_0.cluster); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_clusterClassName.c_str(), + newElement_0_clusterCtorSignature.c_str(), + jninewElement_0_cluster, newElement_0_cluster); + jobject newElement_0_restrictions; + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_restrictions); + + auto iter_newElement_0_restrictions_2 = entry_0.restrictions.begin(); + while (iter_newElement_0_restrictions_2.Next()) + { + auto & entry_2 = iter_newElement_0_restrictions_2.GetValue(); + jobject newElement_2; + jobject newElement_2_type; + std::string newElement_2_typeClassName = "java/lang/Integer"; + std::string newElement_2_typeCtorSignature = "(I)V"; + jint jninewElement_2_type = static_cast(entry_2.type); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_2_typeClassName.c_str(), + newElement_2_typeCtorSignature.c_str(), + jninewElement_2_type, newElement_2_type); + jobject newElement_2_id; + if (entry_2.id.IsNull()) + { + newElement_2_id = nullptr; + } + else + { + std::string newElement_2_idClassName = "java/lang/Long"; + std::string newElement_2_idCtorSignature = "(J)V"; + jlong jninewElement_2_id = static_cast(entry_2.id.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_2_idClassName.c_str(), + newElement_2_idCtorSignature.c_str(), + jninewElement_2_id, newElement_2_id); + } + + jclass accessRestrictionStructStructClass_3; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$AccessControlClusterAccessRestrictionStruct", + accessRestrictionStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$AccessControlClusterAccessRestrictionStruct"); + return nullptr; + } + + jmethodID accessRestrictionStructStructCtor_3; + err = chip::JniReferences::GetInstance().FindMethod(env, accessRestrictionStructStructClass_3, "", + "(Ljava/lang/Integer;Ljava/lang/Long;)V", + &accessRestrictionStructStructCtor_3); + if (err != CHIP_NO_ERROR || accessRestrictionStructStructCtor_3 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$AccessControlClusterAccessRestrictionStruct constructor"); + return nullptr; + } + + newElement_2 = env->NewObject(accessRestrictionStructStructClass_3, accessRestrictionStructStructCtor_3, + newElement_2_type, newElement_2_id); + chip::JniReferences::GetInstance().AddToList(newElement_0_restrictions, newElement_2); + } + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + jint jninewElement_0_fabricIndex = static_cast(entry_0.fabricIndex); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + jninewElement_0_fabricIndex, newElement_0_fabricIndex); + + jclass accessRestrictionEntryStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$AccessControlClusterAccessRestrictionEntryStruct", + accessRestrictionEntryStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$AccessControlClusterAccessRestrictionEntryStruct"); + return nullptr; + } + + jmethodID accessRestrictionEntryStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, accessRestrictionEntryStructStructClass_1, "", + "(Ljava/lang/Integer;Ljava/lang/Long;Ljava/util/ArrayList;Ljava/lang/Integer;)V", + &accessRestrictionEntryStructStructCtor_1); + if (err != CHIP_NO_ERROR || accessRestrictionEntryStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$AccessControlClusterAccessRestrictionEntryStruct constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(accessRestrictionEntryStructStructClass_1, accessRestrictionEntryStructStructCtor_1, + newElement_0_endpoint, newElement_0_cluster, newElement_0_restrictions, + newElement_0_fabricIndex); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } case Attributes::GeneratedCommandList::Id: { using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; TypeInfo::DecodableType cppValue; @@ -12425,150 +12661,8 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR value); return value; } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = app::DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) - { - return nullptr; - } - jobject value; - chip::JniReferences::GetInstance().CreateArrayList(value); - - auto iter_value_0 = cppValue.begin(); - while (iter_value_0.Next()) - { - auto & entry_0 = iter_value_0.GetValue(); - jobject newElement_0; - std::string newElement_0ClassName = "java/lang/Long"; - std::string newElement_0CtorSignature = "(J)V"; - jlong jninewElement_0 = static_cast(entry_0); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); - chip::JniReferences::GetInstance().AddToList(value, newElement_0); - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = app::DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) - { - return nullptr; - } - jobject value; - chip::JniReferences::GetInstance().CreateArrayList(value); - - auto iter_value_0 = cppValue.begin(); - while (iter_value_0.Next()) - { - auto & entry_0 = iter_value_0.GetValue(); - jobject newElement_0; - std::string newElement_0ClassName = "java/lang/Long"; - std::string newElement_0CtorSignature = "(J)V"; - jlong jninewElement_0 = static_cast(entry_0); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); - chip::JniReferences::GetInstance().AddToList(value, newElement_0); - } - return value; - } - case Attributes::EventList::Id: { - using TypeInfo = Attributes::EventList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = app::DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) - { - return nullptr; - } - jobject value; - chip::JniReferences::GetInstance().CreateArrayList(value); - - auto iter_value_0 = cppValue.begin(); - while (iter_value_0.Next()) - { - auto & entry_0 = iter_value_0.GetValue(); - jobject newElement_0; - std::string newElement_0ClassName = "java/lang/Long"; - std::string newElement_0CtorSignature = "(J)V"; - jlong jninewElement_0 = static_cast(entry_0); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); - chip::JniReferences::GetInstance().AddToList(value, newElement_0); - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = app::DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) - { - return nullptr; - } - jobject value; - chip::JniReferences::GetInstance().CreateArrayList(value); - - auto iter_value_0 = cppValue.begin(); - while (iter_value_0.Next()) - { - auto & entry_0 = iter_value_0.GetValue(); - jobject newElement_0; - std::string newElement_0ClassName = "java/lang/Long"; - std::string newElement_0CtorSignature = "(J)V"; - jlong jninewElement_0 = static_cast(entry_0); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); - chip::JniReferences::GetInstance().AddToList(value, newElement_0); - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = app::DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) - { - return nullptr; - } - jobject value; - std::string valueClassName = "java/lang/Long"; - std::string valueCtorSignature = "(J)V"; - jlong jnivalue = static_cast(cppValue); - chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), - jnivalue, value); - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::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; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case app::Clusters::Timer::Id: { - using namespace app::Clusters::Timer; - switch (aPath.mAttributeId) - { - case Attributes::SetTime::Id: { - using TypeInfo = Attributes::SetTime::TypeInfo; + case Attributes::MaximumCheckInBackOff::Id: { + using TypeInfo = Attributes::MaximumCheckInBackOff::TypeInfo; TypeInfo::DecodableType cppValue; *aError = app::DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) @@ -12583,38 +12677,196 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jnivalue, value); return value; } - case Attributes::TimeRemaining::Id: { - using TypeInfo = Attributes::TimeRemaining::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = app::DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) - { - return nullptr; - } - jobject value; - std::string valueClassName = "java/lang/Long"; - std::string valueCtorSignature = "(J)V"; - jlong jnivalue = static_cast(cppValue); - chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), - jnivalue, value); - return value; - } - case Attributes::TimerState::Id: { - using TypeInfo = Attributes::TimerState::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; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::EventList::Id: { + using TypeInfo = Attributes::EventList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::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; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + break; + } + break; + } + case app::Clusters::Timer::Id: { + using namespace app::Clusters::Timer; + switch (aPath.mAttributeId) + { + case Attributes::SetTime::Id: { + using TypeInfo = Attributes::SetTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } + case Attributes::TimeRemaining::Id: { + using TypeInfo = Attributes::TimeRemaining::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } + case Attributes::TimerState::Id: { + using TypeInfo = Attributes::TimerState::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; @@ -21605,6 +21857,244 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } break; } + case app::Clusters::WaterHeaterManagement::Id: { + using namespace app::Clusters::WaterHeaterManagement; + switch (aPath.mAttributeId) + { + case Attributes::HeaterTypes::Id: { + using TypeInfo = Attributes::HeaterTypes::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.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, + value); + return value; + } + case Attributes::HeatDemand::Id: { + using TypeInfo = Attributes::HeatDemand::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.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, + value); + return value; + } + case Attributes::TankVolume::Id: { + using TypeInfo = Attributes::TankVolume::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::EstimatedHeatRequired::Id: { + using TypeInfo = Attributes::EstimatedHeatRequired::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } + case Attributes::TankPercentage::Id: { + using TypeInfo = Attributes::TankPercentage::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::BoostState::Id: { + using TypeInfo = Attributes::BoostState::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; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::EventList::Id: { + using TypeInfo = Attributes::EventList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::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; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + break; + } + break; + } case app::Clusters::DemandResponseLoadControl::Id: { using namespace app::Clusters::DemandResponseLoadControl; switch (aPath.mAttributeId) @@ -25655,6 +26145,317 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } break; } + case app::Clusters::WaterHeaterMode::Id: { + using namespace app::Clusters::WaterHeaterMode; + switch (aPath.mAttributeId) + { + case Attributes::SupportedModes::Id: { + using TypeInfo = Attributes::SupportedModes::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_label; + LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(entry_0.label, newElement_0_label)); + jobject newElement_0_mode; + std::string newElement_0_modeClassName = "java/lang/Integer"; + std::string newElement_0_modeCtorSignature = "(I)V"; + jint jninewElement_0_mode = static_cast(entry_0.mode); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_modeClassName.c_str(), + newElement_0_modeCtorSignature.c_str(), + jninewElement_0_mode, newElement_0_mode); + jobject newElement_0_modeTags; + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_modeTags); + + auto iter_newElement_0_modeTags_2 = entry_0.modeTags.begin(); + while (iter_newElement_0_modeTags_2.Next()) + { + auto & entry_2 = iter_newElement_0_modeTags_2.GetValue(); + jobject newElement_2; + jobject newElement_2_mfgCode; + if (!entry_2.mfgCode.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_mfgCode); + } + else + { + jobject newElement_2_mfgCodeInsideOptional; + std::string newElement_2_mfgCodeInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_mfgCodeInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_mfgCodeInsideOptional = static_cast(entry_2.mfgCode.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_mfgCodeInsideOptionalClassName.c_str(), + newElement_2_mfgCodeInsideOptionalCtorSignature.c_str(), jninewElement_2_mfgCodeInsideOptional, + newElement_2_mfgCodeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_mfgCodeInsideOptional, newElement_2_mfgCode); + } + jobject newElement_2_value; + std::string newElement_2_valueClassName = "java/lang/Integer"; + std::string newElement_2_valueCtorSignature = "(I)V"; + jint jninewElement_2_value = static_cast(entry_2.value); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_2_valueClassName.c_str(), + newElement_2_valueCtorSignature.c_str(), + jninewElement_2_value, newElement_2_value); + + jclass modeTagStructStructClass_3; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$WaterHeaterModeClusterModeTagStruct", modeTagStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$WaterHeaterModeClusterModeTagStruct"); + return nullptr; + } + + jmethodID modeTagStructStructCtor_3; + err = chip::JniReferences::GetInstance().FindMethod(env, modeTagStructStructClass_3, "", + "(Ljava/util/Optional;Ljava/lang/Integer;)V", + &modeTagStructStructCtor_3); + if (err != CHIP_NO_ERROR || modeTagStructStructCtor_3 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$WaterHeaterModeClusterModeTagStruct constructor"); + return nullptr; + } + + newElement_2 = env->NewObject(modeTagStructStructClass_3, modeTagStructStructCtor_3, newElement_2_mfgCode, + newElement_2_value); + chip::JniReferences::GetInstance().AddToList(newElement_0_modeTags, newElement_2); + } + + jclass modeOptionStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$WaterHeaterModeClusterModeOptionStruct", modeOptionStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$WaterHeaterModeClusterModeOptionStruct"); + return nullptr; + } + + jmethodID modeOptionStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod(env, modeOptionStructStructClass_1, "", + "(Ljava/lang/String;Ljava/lang/Integer;Ljava/util/ArrayList;)V", + &modeOptionStructStructCtor_1); + if (err != CHIP_NO_ERROR || modeOptionStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$WaterHeaterModeClusterModeOptionStruct constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(modeOptionStructStructClass_1, modeOptionStructStructCtor_1, newElement_0_label, + newElement_0_mode, newElement_0_modeTags); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::CurrentMode::Id: { + using TypeInfo = Attributes::CurrentMode::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::StartUpMode::Id: { + using TypeInfo = Attributes::StartUpMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + jint jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::OnMode::Id: { + using TypeInfo = Attributes::OnMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + jint jnivalue = static_cast(cppValue.Value()); + 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; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::EventList::Id: { + using TypeInfo = Attributes::EventList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::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; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + break; + } + break; + } case app::Clusters::DeviceEnergyManagementMode::Id: { using namespace app::Clusters::DeviceEnergyManagementMode; switch (aPath.mAttributeId) @@ -27812,28 +28613,28 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jninewElement_0_locationInfo_locationInfo_areaType, newElement_0_locationInfo_locationInfo_areaType); } - jclass homeLocationStructStructClass_4; + jclass locationDescriptorStructStructClass_4; err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$ServiceAreaClusterHomeLocationStruct", - homeLocationStructStructClass_4); + env, "chip/devicecontroller/ChipStructs$ServiceAreaClusterLocationDescriptorStruct", + locationDescriptorStructStructClass_4); if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, "Could not find class ChipStructs$ServiceAreaClusterHomeLocationStruct"); + ChipLogError(Zcl, "Could not find class ChipStructs$ServiceAreaClusterLocationDescriptorStruct"); return nullptr; } - jmethodID homeLocationStructStructCtor_4; + jmethodID locationDescriptorStructStructCtor_4; err = chip::JniReferences::GetInstance().FindMethod( - env, homeLocationStructStructClass_4, "", - "(Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;)V", &homeLocationStructStructCtor_4); - if (err != CHIP_NO_ERROR || homeLocationStructStructCtor_4 == nullptr) + env, locationDescriptorStructStructClass_4, "", + "(Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;)V", &locationDescriptorStructStructCtor_4); + if (err != CHIP_NO_ERROR || locationDescriptorStructStructCtor_4 == nullptr) { - ChipLogError(Zcl, "Could not find ChipStructs$ServiceAreaClusterHomeLocationStruct constructor"); + ChipLogError(Zcl, "Could not find ChipStructs$ServiceAreaClusterLocationDescriptorStruct constructor"); return nullptr; } newElement_0_locationInfo_locationInfo = env->NewObject( - homeLocationStructStructClass_4, homeLocationStructStructCtor_4, + locationDescriptorStructStructClass_4, locationDescriptorStructStructCtor_4, newElement_0_locationInfo_locationInfo_locationName, newElement_0_locationInfo_locationInfo_floorNumber, newElement_0_locationInfo_locationInfo_areaType); } @@ -27895,7 +28696,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jmethodID locationInfoStructStructCtor_2; err = chip::JniReferences::GetInstance().FindMethod( env, locationInfoStructStructClass_2, "", - "(Lchip/devicecontroller/ChipStructs$ServiceAreaClusterHomeLocationStruct;Ljava/lang/Integer;Ljava/lang/" + "(Lchip/devicecontroller/ChipStructs$ServiceAreaClusterLocationDescriptorStruct;Ljava/lang/Integer;Ljava/lang/" "Integer;Ljava/lang/Integer;)V", &locationInfoStructStructCtor_2); if (err != CHIP_NO_ERROR || locationInfoStructStructCtor_2 == nullptr) @@ -30460,22 +31261,6 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jnivalue, value); return value; } - case Attributes::TemperatureSetpointHoldPolicy::Id: { - using TypeInfo = Attributes::TemperatureSetpointHoldPolicy::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.Raw()); - chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, - value); - return value; - } case Attributes::SetpointHoldExpiryTimestamp::Id: { using TypeInfo = Attributes::SetpointHoldExpiryTimestamp::TypeInfo; TypeInfo::DecodableType cppValue; @@ -30499,73 +31284,6 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } return value; } - case Attributes::QueuedPreset::Id: { - using TypeInfo = Attributes::QueuedPreset::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = app::DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) - { - return nullptr; - } - jobject value; - if (cppValue.IsNull()) - { - value = nullptr; - } - else - { - jobject value_presetHandle; - if (cppValue.Value().presetHandle.IsNull()) - { - value_presetHandle = nullptr; - } - else - { - jbyteArray value_presetHandleByteArray = - env->NewByteArray(static_cast(cppValue.Value().presetHandle.Value().size())); - env->SetByteArrayRegion(value_presetHandleByteArray, 0, - static_cast(cppValue.Value().presetHandle.Value().size()), - reinterpret_cast(cppValue.Value().presetHandle.Value().data())); - value_presetHandle = value_presetHandleByteArray; - } - jobject value_transitionTimestamp; - if (cppValue.Value().transitionTimestamp.IsNull()) - { - value_transitionTimestamp = nullptr; - } - else - { - std::string value_transitionTimestampClassName = "java/lang/Long"; - std::string value_transitionTimestampCtorSignature = "(J)V"; - jlong jnivalue_transitionTimestamp = static_cast(cppValue.Value().transitionTimestamp.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_transitionTimestampClassName.c_str(), value_transitionTimestampCtorSignature.c_str(), - jnivalue_transitionTimestamp, value_transitionTimestamp); - } - - jclass queuedPresetStructStructClass_1; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$ThermostatClusterQueuedPresetStruct", queuedPresetStructStructClass_1); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$ThermostatClusterQueuedPresetStruct"); - return nullptr; - } - - jmethodID queuedPresetStructStructCtor_1; - err = chip::JniReferences::GetInstance().FindMethod(env, queuedPresetStructStructClass_1, "", - "([BLjava/lang/Long;)V", &queuedPresetStructStructCtor_1); - if (err != CHIP_NO_ERROR || queuedPresetStructStructCtor_1 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$ThermostatClusterQueuedPresetStruct constructor"); - return nullptr; - } - - value = env->NewObject(queuedPresetStructStructClass_1, queuedPresetStructStructCtor_1, value_presetHandle, - value_transitionTimestamp); - } - return value; - } case Attributes::GeneratedCommandList::Id: { using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; TypeInfo::DecodableType cppValue; @@ -37902,6 +38620,29 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } return value; } + case Attributes::PassphraseSurrogate::Id: { + using TypeInfo = Attributes::PassphraseSurrogate::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + 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; @@ -38283,11 +39024,10 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } else { - std::string valueClassName = "java/lang/Long"; - std::string valueCtorSignature = "(J)V"; - jlong jnivalue = static_cast(cppValue.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), - jnivalue, value); + jbyteArray valueByteArray = env->NewByteArray(static_cast(cppValue.Value().size())); + env->SetByteArrayRegion(valueByteArray, 0, static_cast(cppValue.Value().size()), + reinterpret_cast(cppValue.Value().data())); + value = valueByteArray; } return value; } @@ -38308,12 +39048,11 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR auto & entry_0 = iter_value_0.GetValue(); jobject newElement_0; jobject newElement_0_extendedPanID; - std::string newElement_0_extendedPanIDClassName = "java/lang/Long"; - std::string newElement_0_extendedPanIDCtorSignature = "(J)V"; - jlong jninewElement_0_extendedPanID = static_cast(entry_0.extendedPanID); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_extendedPanIDClassName.c_str(), newElement_0_extendedPanIDCtorSignature.c_str(), - jninewElement_0_extendedPanID, newElement_0_extendedPanID); + jbyteArray newElement_0_extendedPanIDByteArray = + env->NewByteArray(static_cast(entry_0.extendedPanID.size())); + env->SetByteArrayRegion(newElement_0_extendedPanIDByteArray, 0, static_cast(entry_0.extendedPanID.size()), + reinterpret_cast(entry_0.extendedPanID.data())); + newElement_0_extendedPanID = newElement_0_extendedPanIDByteArray; jobject newElement_0_networkName; LogErrorOnFailure( chip::JniReferences::GetInstance().CharToStringUTF(entry_0.networkName, newElement_0_networkName)); @@ -38324,6 +39063,13 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_channelClassName.c_str(), newElement_0_channelCtorSignature.c_str(), jninewElement_0_channel, newElement_0_channel); + jobject newElement_0_activeTimestamp; + std::string newElement_0_activeTimestampClassName = "java/lang/Long"; + std::string newElement_0_activeTimestampCtorSignature = "(J)V"; + jlong jninewElement_0_activeTimestamp = static_cast(entry_0.activeTimestamp); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_activeTimestampClassName.c_str(), newElement_0_activeTimestampCtorSignature.c_str(), + jninewElement_0_activeTimestamp, newElement_0_activeTimestamp); jclass threadNetworkStructStructClass_1; err = chip::JniReferences::GetInstance().GetLocalClassRef( @@ -38337,7 +39083,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jmethodID threadNetworkStructStructCtor_1; err = chip::JniReferences::GetInstance().FindMethod(env, threadNetworkStructStructClass_1, "", - "(Ljava/lang/Long;Ljava/lang/String;Ljava/lang/Integer;)V", + "([BLjava/lang/String;Ljava/lang/Integer;Ljava/lang/Long;)V", &threadNetworkStructStructCtor_1); if (err != CHIP_NO_ERROR || threadNetworkStructStructCtor_1 == nullptr) { @@ -38345,8 +39091,9 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } - newElement_0 = env->NewObject(threadNetworkStructStructClass_1, threadNetworkStructStructCtor_1, - newElement_0_extendedPanID, newElement_0_networkName, newElement_0_channel); + newElement_0 = + env->NewObject(threadNetworkStructStructClass_1, threadNetworkStructStructCtor_1, newElement_0_extendedPanID, + newElement_0_networkName, newElement_0_channel, newElement_0_activeTimestamp); chip::JniReferences::GetInstance().AddToList(value, newElement_0); } return value; @@ -42162,6 +42909,620 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } break; } + case app::Clusters::EcosystemInformation::Id: { + using namespace app::Clusters::EcosystemInformation; + switch (aPath.mAttributeId) + { + case Attributes::RemovedOn::Id: { + using TypeInfo = Attributes::RemovedOn::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::DeviceDirectory::Id: { + using TypeInfo = Attributes::DeviceDirectory::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_deviceName; + if (!entry_0.deviceName.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_deviceName); + } + else + { + jobject newElement_0_deviceNameInsideOptional; + LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(entry_0.deviceName.Value(), + newElement_0_deviceNameInsideOptional)); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_deviceNameInsideOptional, + newElement_0_deviceName); + } + jobject newElement_0_deviceNameLastEdit; + if (!entry_0.deviceNameLastEdit.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_deviceNameLastEdit); + } + else + { + jobject newElement_0_deviceNameLastEditInsideOptional; + std::string newElement_0_deviceNameLastEditInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_deviceNameLastEditInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_deviceNameLastEditInsideOptional = static_cast(entry_0.deviceNameLastEdit.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_deviceNameLastEditInsideOptionalClassName.c_str(), + newElement_0_deviceNameLastEditInsideOptionalCtorSignature.c_str(), + jninewElement_0_deviceNameLastEditInsideOptional, newElement_0_deviceNameLastEditInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_deviceNameLastEditInsideOptional, + newElement_0_deviceNameLastEdit); + } + jobject newElement_0_bridgedEndpoint; + std::string newElement_0_bridgedEndpointClassName = "java/lang/Integer"; + std::string newElement_0_bridgedEndpointCtorSignature = "(I)V"; + jint jninewElement_0_bridgedEndpoint = static_cast(entry_0.bridgedEndpoint); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_bridgedEndpointClassName.c_str(), newElement_0_bridgedEndpointCtorSignature.c_str(), + jninewElement_0_bridgedEndpoint, newElement_0_bridgedEndpoint); + jobject newElement_0_originalEndpoint; + std::string newElement_0_originalEndpointClassName = "java/lang/Integer"; + std::string newElement_0_originalEndpointCtorSignature = "(I)V"; + jint jninewElement_0_originalEndpoint = static_cast(entry_0.originalEndpoint); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_originalEndpointClassName.c_str(), newElement_0_originalEndpointCtorSignature.c_str(), + jninewElement_0_originalEndpoint, newElement_0_originalEndpoint); + jobject newElement_0_deviceTypes; + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_deviceTypes); + + auto iter_newElement_0_deviceTypes_2 = entry_0.deviceTypes.begin(); + while (iter_newElement_0_deviceTypes_2.Next()) + { + auto & entry_2 = iter_newElement_0_deviceTypes_2.GetValue(); + jobject newElement_2; + jobject newElement_2_deviceType; + std::string newElement_2_deviceTypeClassName = "java/lang/Long"; + std::string newElement_2_deviceTypeCtorSignature = "(J)V"; + jlong jninewElement_2_deviceType = static_cast(entry_2.deviceType); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_deviceTypeClassName.c_str(), newElement_2_deviceTypeCtorSignature.c_str(), + jninewElement_2_deviceType, newElement_2_deviceType); + jobject newElement_2_revision; + std::string newElement_2_revisionClassName = "java/lang/Integer"; + std::string newElement_2_revisionCtorSignature = "(I)V"; + jint jninewElement_2_revision = static_cast(entry_2.revision); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_2_revisionClassName.c_str(), + newElement_2_revisionCtorSignature.c_str(), + jninewElement_2_revision, newElement_2_revision); + + jclass deviceTypeStructStructClass_3; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EcosystemInformationClusterDeviceTypeStruct", + deviceTypeStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EcosystemInformationClusterDeviceTypeStruct"); + return nullptr; + } + + jmethodID deviceTypeStructStructCtor_3; + err = chip::JniReferences::GetInstance().FindMethod(env, deviceTypeStructStructClass_3, "", + "(Ljava/lang/Long;Ljava/lang/Integer;)V", + &deviceTypeStructStructCtor_3); + if (err != CHIP_NO_ERROR || deviceTypeStructStructCtor_3 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EcosystemInformationClusterDeviceTypeStruct constructor"); + return nullptr; + } + + newElement_2 = env->NewObject(deviceTypeStructStructClass_3, deviceTypeStructStructCtor_3, + newElement_2_deviceType, newElement_2_revision); + chip::JniReferences::GetInstance().AddToList(newElement_0_deviceTypes, newElement_2); + } + jobject newElement_0_uniqueLocationIDs; + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_uniqueLocationIDs); + + auto iter_newElement_0_uniqueLocationIDs_2 = entry_0.uniqueLocationIDs.begin(); + while (iter_newElement_0_uniqueLocationIDs_2.Next()) + { + auto & entry_2 = iter_newElement_0_uniqueLocationIDs_2.GetValue(); + jobject newElement_2; + LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(entry_2, newElement_2)); + chip::JniReferences::GetInstance().AddToList(newElement_0_uniqueLocationIDs, newElement_2); + } + jobject newElement_0_uniqueLocationIDsLastEdit; + std::string newElement_0_uniqueLocationIDsLastEditClassName = "java/lang/Long"; + std::string newElement_0_uniqueLocationIDsLastEditCtorSignature = "(J)V"; + jlong jninewElement_0_uniqueLocationIDsLastEdit = static_cast(entry_0.uniqueLocationIDsLastEdit); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_uniqueLocationIDsLastEditClassName.c_str(), + newElement_0_uniqueLocationIDsLastEditCtorSignature.c_str(), jninewElement_0_uniqueLocationIDsLastEdit, + newElement_0_uniqueLocationIDsLastEdit); + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + jint jninewElement_0_fabricIndex = static_cast(entry_0.fabricIndex); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + jninewElement_0_fabricIndex, newElement_0_fabricIndex); + + jclass ecosystemDeviceStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EcosystemInformationClusterEcosystemDeviceStruct", + ecosystemDeviceStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EcosystemInformationClusterEcosystemDeviceStruct"); + return nullptr; + } + + jmethodID ecosystemDeviceStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, ecosystemDeviceStructStructClass_1, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/ArrayList;Ljava/" + "util/ArrayList;Ljava/lang/Long;Ljava/lang/Integer;)V", + &ecosystemDeviceStructStructCtor_1); + if (err != CHIP_NO_ERROR || ecosystemDeviceStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EcosystemInformationClusterEcosystemDeviceStruct constructor"); + return nullptr; + } + + newElement_0 = + env->NewObject(ecosystemDeviceStructStructClass_1, ecosystemDeviceStructStructCtor_1, newElement_0_deviceName, + newElement_0_deviceNameLastEdit, newElement_0_bridgedEndpoint, newElement_0_originalEndpoint, + newElement_0_deviceTypes, newElement_0_uniqueLocationIDs, newElement_0_uniqueLocationIDsLastEdit, + newElement_0_fabricIndex); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::LocationDirectory::Id: { + using TypeInfo = Attributes::LocationDirectory::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_uniqueLocationID; + LogErrorOnFailure( + chip::JniReferences::GetInstance().CharToStringUTF(entry_0.uniqueLocationID, newElement_0_uniqueLocationID)); + jobject newElement_0_locationDescriptor; + jobject newElement_0_locationDescriptor_locationName; + LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(entry_0.locationDescriptor.locationName, + newElement_0_locationDescriptor_locationName)); + jobject newElement_0_locationDescriptor_floorNumber; + if (entry_0.locationDescriptor.floorNumber.IsNull()) + { + newElement_0_locationDescriptor_floorNumber = nullptr; + } + else + { + std::string newElement_0_locationDescriptor_floorNumberClassName = "java/lang/Integer"; + std::string newElement_0_locationDescriptor_floorNumberCtorSignature = "(I)V"; + jint jninewElement_0_locationDescriptor_floorNumber = + static_cast(entry_0.locationDescriptor.floorNumber.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_locationDescriptor_floorNumberClassName.c_str(), + newElement_0_locationDescriptor_floorNumberCtorSignature.c_str(), + jninewElement_0_locationDescriptor_floorNumber, newElement_0_locationDescriptor_floorNumber); + } + jobject newElement_0_locationDescriptor_areaType; + if (entry_0.locationDescriptor.areaType.IsNull()) + { + newElement_0_locationDescriptor_areaType = nullptr; + } + else + { + std::string newElement_0_locationDescriptor_areaTypeClassName = "java/lang/Integer"; + std::string newElement_0_locationDescriptor_areaTypeCtorSignature = "(I)V"; + jint jninewElement_0_locationDescriptor_areaType = + static_cast(entry_0.locationDescriptor.areaType.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_locationDescriptor_areaTypeClassName.c_str(), + newElement_0_locationDescriptor_areaTypeCtorSignature.c_str(), jninewElement_0_locationDescriptor_areaType, + newElement_0_locationDescriptor_areaType); + } + + jclass locationDescriptorStructStructClass_2; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EcosystemInformationClusterLocationDescriptorStruct", + locationDescriptorStructStructClass_2); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EcosystemInformationClusterLocationDescriptorStruct"); + return nullptr; + } + + jmethodID locationDescriptorStructStructCtor_2; + err = chip::JniReferences::GetInstance().FindMethod(env, locationDescriptorStructStructClass_2, "", + "(Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;)V", + &locationDescriptorStructStructCtor_2); + if (err != CHIP_NO_ERROR || locationDescriptorStructStructCtor_2 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EcosystemInformationClusterLocationDescriptorStruct constructor"); + return nullptr; + } + + newElement_0_locationDescriptor = + env->NewObject(locationDescriptorStructStructClass_2, locationDescriptorStructStructCtor_2, + newElement_0_locationDescriptor_locationName, newElement_0_locationDescriptor_floorNumber, + newElement_0_locationDescriptor_areaType); + jobject newElement_0_locationDescriptorLastEdit; + std::string newElement_0_locationDescriptorLastEditClassName = "java/lang/Long"; + std::string newElement_0_locationDescriptorLastEditCtorSignature = "(J)V"; + jlong jninewElement_0_locationDescriptorLastEdit = static_cast(entry_0.locationDescriptorLastEdit); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_locationDescriptorLastEditClassName.c_str(), + newElement_0_locationDescriptorLastEditCtorSignature.c_str(), jninewElement_0_locationDescriptorLastEdit, + newElement_0_locationDescriptorLastEdit); + jobject newElement_0_fabricIndex; + std::string newElement_0_fabricIndexClassName = "java/lang/Integer"; + std::string newElement_0_fabricIndexCtorSignature = "(I)V"; + jint jninewElement_0_fabricIndex = static_cast(entry_0.fabricIndex); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_fabricIndexClassName.c_str(), + newElement_0_fabricIndexCtorSignature.c_str(), + jninewElement_0_fabricIndex, newElement_0_fabricIndex); + + jclass ecosystemLocationStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$EcosystemInformationClusterEcosystemLocationStruct", + ecosystemLocationStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EcosystemInformationClusterEcosystemLocationStruct"); + return nullptr; + } + + jmethodID ecosystemLocationStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, ecosystemLocationStructStructClass_1, "", + "(Ljava/lang/String;Lchip/devicecontroller/" + "ChipStructs$EcosystemInformationClusterLocationDescriptorStruct;Ljava/lang/Long;Ljava/lang/Integer;)V", + &ecosystemLocationStructStructCtor_1); + if (err != CHIP_NO_ERROR || ecosystemLocationStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EcosystemInformationClusterEcosystemLocationStruct constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(ecosystemLocationStructStructClass_1, ecosystemLocationStructStructCtor_1, + newElement_0_uniqueLocationID, newElement_0_locationDescriptor, + newElement_0_locationDescriptorLastEdit, newElement_0_fabricIndex); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::EventList::Id: { + using TypeInfo = Attributes::EventList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::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; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + break; + } + break; + } + case app::Clusters::CommissionerControl::Id: { + using namespace app::Clusters::CommissionerControl; + switch (aPath.mAttributeId) + { + case Attributes::SupportedDeviceCategories::Id: { + using TypeInfo = Attributes::SupportedDeviceCategories::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Raw()); + 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; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::EventList::Id: { + using TypeInfo = Attributes::EventList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::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; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + break; + } + break; + } case app::Clusters::ElectricalMeasurement::Id: { using namespace app::Clusters::ElectricalMeasurement; switch (aPath.mAttributeId) diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp index 4db00a7efd0f57..7f3c03f9e8ab05 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -500,6 +500,117 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & return value; } + case Events::AccessRestrictionEntryChanged::Id: { + Events::AccessRestrictionEntryChanged::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value_fabricIndex; + std::string value_fabricIndexClassName = "java/lang/Integer"; + std::string value_fabricIndexCtorSignature = "(I)V"; + jint jnivalue_fabricIndex = static_cast(cppValue.fabricIndex); + chip::JniReferences::GetInstance().CreateBoxedObject(value_fabricIndexClassName.c_str(), + value_fabricIndexCtorSignature.c_str(), jnivalue_fabricIndex, + value_fabricIndex); + + jclass accessRestrictionEntryChangedStructClass; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipEventStructs$AccessControlClusterAccessRestrictionEntryChangedEvent", + accessRestrictionEntryChangedStructClass); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipEventStructs$AccessControlClusterAccessRestrictionEntryChangedEvent"); + return nullptr; + } + + jmethodID accessRestrictionEntryChangedStructCtor; + err = chip::JniReferences::GetInstance().FindMethod(env, accessRestrictionEntryChangedStructClass, "", + "(Ljava/lang/Integer;)V", &accessRestrictionEntryChangedStructCtor); + if (err != CHIP_NO_ERROR || accessRestrictionEntryChangedStructCtor == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipEventStructs$AccessControlClusterAccessRestrictionEntryChangedEvent constructor"); + return nullptr; + } + + jobject value = env->NewObject(accessRestrictionEntryChangedStructClass, accessRestrictionEntryChangedStructCtor, + value_fabricIndex); + + return value; + } + case Events::FabricRestrictionReviewUpdate::Id: { + Events::FabricRestrictionReviewUpdate::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value_token; + std::string value_tokenClassName = "java/lang/Long"; + std::string value_tokenCtorSignature = "(J)V"; + jlong jnivalue_token = static_cast(cppValue.token); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_tokenClassName.c_str(), value_tokenCtorSignature.c_str(), jnivalue_token, value_token); + + jobject value_instruction; + if (cppValue.instruction.IsNull()) + { + value_instruction = nullptr; + } + else + { + LogErrorOnFailure( + chip::JniReferences::GetInstance().CharToStringUTF(cppValue.instruction.Value(), value_instruction)); + } + + jobject value_redirectURL; + if (cppValue.redirectURL.IsNull()) + { + value_redirectURL = nullptr; + } + else + { + LogErrorOnFailure( + chip::JniReferences::GetInstance().CharToStringUTF(cppValue.redirectURL.Value(), value_redirectURL)); + } + + jobject value_fabricIndex; + std::string value_fabricIndexClassName = "java/lang/Integer"; + std::string value_fabricIndexCtorSignature = "(I)V"; + jint jnivalue_fabricIndex = static_cast(cppValue.fabricIndex); + chip::JniReferences::GetInstance().CreateBoxedObject(value_fabricIndexClassName.c_str(), + value_fabricIndexCtorSignature.c_str(), jnivalue_fabricIndex, + value_fabricIndex); + + jclass fabricRestrictionReviewUpdateStructClass; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipEventStructs$AccessControlClusterFabricRestrictionReviewUpdateEvent", + fabricRestrictionReviewUpdateStructClass); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipEventStructs$AccessControlClusterFabricRestrictionReviewUpdateEvent"); + return nullptr; + } + + jmethodID fabricRestrictionReviewUpdateStructCtor; + err = chip::JniReferences::GetInstance().FindMethod( + env, fabricRestrictionReviewUpdateStructClass, "", + "(Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;)V", + &fabricRestrictionReviewUpdateStructCtor); + if (err != CHIP_NO_ERROR || fabricRestrictionReviewUpdateStructCtor == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipEventStructs$AccessControlClusterFabricRestrictionReviewUpdateEvent constructor"); + return nullptr; + } + + jobject value = env->NewObject(fabricRestrictionReviewUpdateStructClass, fabricRestrictionReviewUpdateStructCtor, + value_token, value_instruction, value_redirectURL, value_fabricIndex); + + return value; + } default: *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; break; @@ -2159,6 +2270,45 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & return value; } + case Events::ActiveChanged::Id: { + Events::ActiveChanged::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value_promisedActiveDuration; + std::string value_promisedActiveDurationClassName = "java/lang/Long"; + std::string value_promisedActiveDurationCtorSignature = "(J)V"; + jlong jnivalue_promisedActiveDuration = static_cast(cppValue.promisedActiveDuration); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_promisedActiveDurationClassName.c_str(), value_promisedActiveDurationCtorSignature.c_str(), + jnivalue_promisedActiveDuration, value_promisedActiveDuration); + + jclass activeChangedStructClass; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipEventStructs$BridgedDeviceBasicInformationClusterActiveChangedEvent", + activeChangedStructClass); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipEventStructs$BridgedDeviceBasicInformationClusterActiveChangedEvent"); + return nullptr; + } + + jmethodID activeChangedStructCtor; + err = chip::JniReferences::GetInstance().FindMethod(env, activeChangedStructClass, "", "(Ljava/lang/Long;)V", + &activeChangedStructCtor); + if (err != CHIP_NO_ERROR || activeChangedStructCtor == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipEventStructs$BridgedDeviceBasicInformationClusterActiveChangedEvent constructor"); + return nullptr; + } + + jobject value = env->NewObject(activeChangedStructClass, activeChangedStructCtor, value_promisedActiveDuration); + + return value; + } default: *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; break; @@ -4896,6 +5046,16 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } break; } + case app::Clusters::WaterHeaterManagement::Id: { + using namespace app::Clusters::WaterHeaterManagement; + switch (aPath.mEventId) + { + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + break; + } + break; + } case app::Clusters::DemandResponseLoadControl::Id: { using namespace app::Clusters::DemandResponseLoadControl; switch (aPath.mEventId) @@ -5862,6 +6022,25 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & value_maximumCurrentCtorSignature.c_str(), jnivalue_maximumCurrent, value_maximumCurrent); + jobject value_maximumDischargeCurrent; + if (!cppValue.maximumDischargeCurrent.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_maximumDischargeCurrent); + } + else + { + jobject value_maximumDischargeCurrentInsideOptional; + std::string value_maximumDischargeCurrentInsideOptionalClassName = "java/lang/Long"; + std::string value_maximumDischargeCurrentInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_maximumDischargeCurrentInsideOptional = static_cast(cppValue.maximumDischargeCurrent.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_maximumDischargeCurrentInsideOptionalClassName.c_str(), + value_maximumDischargeCurrentInsideOptionalCtorSignature.c_str(), + jnivalue_maximumDischargeCurrentInsideOptional, value_maximumDischargeCurrentInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_maximumDischargeCurrentInsideOptional, + value_maximumDischargeCurrent); + } + jclass energyTransferStartedStructClass; err = chip::JniReferences::GetInstance().GetLocalClassRef( env, "chip/devicecontroller/ChipEventStructs$EnergyEvseClusterEnergyTransferStartedEvent", @@ -5873,9 +6052,9 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } jmethodID energyTransferStartedStructCtor; - err = chip::JniReferences::GetInstance().FindMethod(env, energyTransferStartedStructClass, "", - "(Ljava/lang/Long;Ljava/lang/Integer;Ljava/lang/Long;)V", - &energyTransferStartedStructCtor); + err = chip::JniReferences::GetInstance().FindMethod( + env, energyTransferStartedStructClass, "", + "(Ljava/lang/Long;Ljava/lang/Integer;Ljava/lang/Long;Ljava/util/Optional;)V", &energyTransferStartedStructCtor); if (err != CHIP_NO_ERROR || energyTransferStartedStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipEventStructs$EnergyEvseClusterEnergyTransferStartedEvent constructor"); @@ -5883,7 +6062,7 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } jobject value = env->NewObject(energyTransferStartedStructClass, energyTransferStartedStructCtor, value_sessionID, - value_state, value_maximumCurrent); + value_state, value_maximumCurrent, value_maximumDischargeCurrent); return value; } @@ -5923,6 +6102,24 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & value_energyTransferredCtorSignature.c_str(), jnivalue_energyTransferred, value_energyTransferred); + jobject value_energyDischarged; + if (!cppValue.energyDischarged.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyDischarged); + } + else + { + jobject value_energyDischargedInsideOptional; + std::string value_energyDischargedInsideOptionalClassName = "java/lang/Long"; + std::string value_energyDischargedInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyDischargedInsideOptional = static_cast(cppValue.energyDischarged.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyDischargedInsideOptionalClassName.c_str(), + value_energyDischargedInsideOptionalCtorSignature.c_str(), jnivalue_energyDischargedInsideOptional, + value_energyDischargedInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_energyDischargedInsideOptional, value_energyDischarged); + } + jclass energyTransferStoppedStructClass; err = chip::JniReferences::GetInstance().GetLocalClassRef( env, "chip/devicecontroller/ChipEventStructs$EnergyEvseClusterEnergyTransferStoppedEvent", @@ -5936,7 +6133,8 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & jmethodID energyTransferStoppedStructCtor; err = chip::JniReferences::GetInstance().FindMethod( env, energyTransferStoppedStructClass, "", - "(Ljava/lang/Long;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Long;)V", &energyTransferStoppedStructCtor); + "(Ljava/lang/Long;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Long;Ljava/util/Optional;)V", + &energyTransferStoppedStructCtor); if (err != CHIP_NO_ERROR || energyTransferStoppedStructCtor == nullptr) { ChipLogError(Zcl, "Could not find ChipEventStructs$EnergyEvseClusterEnergyTransferStoppedEvent constructor"); @@ -5944,7 +6142,7 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } jobject value = env->NewObject(energyTransferStoppedStructClass, energyTransferStoppedStructCtor, value_sessionID, - value_state, value_reason, value_energyTransferred); + value_state, value_reason, value_energyTransferred, value_energyDischarged); return value; } @@ -6086,6 +6284,16 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } break; } + case app::Clusters::WaterHeaterMode::Id: { + using namespace app::Clusters::WaterHeaterMode; + switch (aPath.mEventId) + { + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + break; + } + break; + } case app::Clusters::DeviceEnergyManagementMode::Id: { using namespace app::Clusters::DeviceEnergyManagementMode; switch (aPath.mEventId) @@ -7423,44 +7631,6 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & using namespace app::Clusters::ThreadNetworkDirectory; switch (aPath.mEventId) { - case Events::NetworkChanged::Id: { - Events::NetworkChanged::DecodableType cppValue; - *aError = app::DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) - { - return nullptr; - } - jobject value_extendedPanID; - std::string value_extendedPanIDClassName = "java/lang/Long"; - std::string value_extendedPanIDCtorSignature = "(J)V"; - jlong jnivalue_extendedPanID = static_cast(cppValue.extendedPanID); - chip::JniReferences::GetInstance().CreateBoxedObject(value_extendedPanIDClassName.c_str(), - value_extendedPanIDCtorSignature.c_str(), - jnivalue_extendedPanID, value_extendedPanID); - - jclass networkChangedStructClass; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipEventStructs$ThreadNetworkDirectoryClusterNetworkChangedEvent", - networkChangedStructClass); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipEventStructs$ThreadNetworkDirectoryClusterNetworkChangedEvent"); - return nullptr; - } - - jmethodID networkChangedStructCtor; - err = chip::JniReferences::GetInstance().FindMethod(env, networkChangedStructClass, "", "(Ljava/lang/Long;)V", - &networkChangedStructCtor); - if (err != CHIP_NO_ERROR || networkChangedStructCtor == nullptr) - { - ChipLogError(Zcl, "Could not find ChipEventStructs$ThreadNetworkDirectoryClusterNetworkChangedEvent constructor"); - return nullptr; - } - - jobject value = env->NewObject(networkChangedStructClass, networkChangedStructCtor, value_extendedPanID); - - return value; - } default: *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; break; @@ -7920,6 +8090,90 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } break; } + case app::Clusters::EcosystemInformation::Id: { + using namespace app::Clusters::EcosystemInformation; + switch (aPath.mEventId) + { + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + break; + } + break; + } + case app::Clusters::CommissionerControl::Id: { + using namespace app::Clusters::CommissionerControl; + switch (aPath.mEventId) + { + case Events::CommissioningRequestResult::Id: { + Events::CommissioningRequestResult::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value_requestId; + std::string value_requestIdClassName = "java/lang/Long"; + std::string value_requestIdCtorSignature = "(J)V"; + jlong jnivalue_requestId = static_cast(cppValue.requestId); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_requestIdClassName.c_str(), value_requestIdCtorSignature.c_str(), jnivalue_requestId, value_requestId); + + jobject value_clientNodeId; + std::string value_clientNodeIdClassName = "java/lang/Long"; + std::string value_clientNodeIdCtorSignature = "(J)V"; + jlong jnivalue_clientNodeId = static_cast(cppValue.clientNodeId); + chip::JniReferences::GetInstance().CreateBoxedObject(value_clientNodeIdClassName.c_str(), + value_clientNodeIdCtorSignature.c_str(), + jnivalue_clientNodeId, value_clientNodeId); + + jobject value_statusCode; + std::string value_statusCodeClassName = "java/lang/Integer"; + std::string value_statusCodeCtorSignature = "(I)V"; + jint jnivalue_statusCode = static_cast(cppValue.statusCode); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_statusCodeClassName.c_str(), value_statusCodeCtorSignature.c_str(), jnivalue_statusCode, value_statusCode); + + jobject value_fabricIndex; + std::string value_fabricIndexClassName = "java/lang/Integer"; + std::string value_fabricIndexCtorSignature = "(I)V"; + jint jnivalue_fabricIndex = static_cast(cppValue.fabricIndex); + chip::JniReferences::GetInstance().CreateBoxedObject(value_fabricIndexClassName.c_str(), + value_fabricIndexCtorSignature.c_str(), jnivalue_fabricIndex, + value_fabricIndex); + + jclass commissioningRequestResultStructClass; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipEventStructs$CommissionerControlClusterCommissioningRequestResultEvent", + commissioningRequestResultStructClass); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipEventStructs$CommissionerControlClusterCommissioningRequestResultEvent"); + return nullptr; + } + + jmethodID commissioningRequestResultStructCtor; + err = chip::JniReferences::GetInstance().FindMethod( + env, commissioningRequestResultStructClass, "", + "(Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/Integer;Ljava/lang/Integer;)V", &commissioningRequestResultStructCtor); + if (err != CHIP_NO_ERROR || commissioningRequestResultStructCtor == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipEventStructs$CommissionerControlClusterCommissioningRequestResultEvent constructor"); + return nullptr; + } + + jobject value = env->NewObject(commissioningRequestResultStructClass, commissioningRequestResultStructCtor, + value_requestId, value_clientNodeId, value_statusCode, value_fabricIndex); + + return value; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + break; + } + break; + } case app::Clusters::ElectricalMeasurement::Id: { using namespace app::Clusters::ElectricalMeasurement; switch (aPath.mEventId) diff --git a/src/controller/python/ChipCommissionableNodeController-ScriptBinding.cpp b/src/controller/python/ChipCommissionableNodeController-ScriptBinding.cpp index 157789f5d64136..806bd5b5bb8be4 100644 --- a/src/controller/python/ChipCommissionableNodeController-ScriptBinding.cpp +++ b/src/controller/python/ChipCommissionableNodeController-ScriptBinding.cpp @@ -117,7 +117,9 @@ void pychip_CommissionableNodeController_PrintDiscoveredCommissioners( { ChipLogProgress(Discovery, "\tMrp Interval active\tNot present"); } - ChipLogProgress(Discovery, "\tSupports TCP\t\t%d", dnsSdInfo->supportsTcp); + + ChipLogProgress(Discovery, "\tSupports TCP Client\t\t%d", dnsSdInfo->supportsTcpClient); + ChipLogProgress(Discovery, "\tSupports TCP Server\t\t%d", dnsSdInfo->supportsTcpServer); if (dnsSdInfo->isICDOperatingAsLIT.has_value()) { diff --git a/src/controller/python/ChipDeviceController-Discovery.cpp b/src/controller/python/ChipDeviceController-Discovery.cpp index 46f0729d61243c..7c669603f4ff1d 100644 --- a/src/controller/python/ChipDeviceController-Discovery.cpp +++ b/src/controller/python/ChipDeviceController-Discovery.cpp @@ -142,7 +142,9 @@ void pychip_DeviceController_IterateDiscoveredCommissionableNodes(Controller::De { jsonVal["mrpRetryActiveThreshold"] = activeThreshold->count(); } - jsonVal["supportsTcp"] = dnsSdInfo->supportsTcp; + + jsonVal["supportsTcpClient"] = dnsSdInfo->supportsTcpClient; + jsonVal["supportsTcpServer"] = dnsSdInfo->supportsTcpServer; { Json::Value addresses; for (unsigned j = 0; j < dnsSdInfo->numIPs; ++j) diff --git a/src/controller/python/ChipDeviceController-ScriptBinding.cpp b/src/controller/python/ChipDeviceController-ScriptBinding.cpp index a98c8082d45380..d9b557bb62be67 100644 --- a/src/controller/python/ChipDeviceController-ScriptBinding.cpp +++ b/src/controller/python/ChipDeviceController-ScriptBinding.cpp @@ -213,7 +213,8 @@ PyChipError pychip_DeviceCommissioner_CloseBleConnection(chip::Controller::Devic const char * pychip_Stack_StatusReportToString(uint32_t profileId, uint16_t statusCode); PyChipError pychip_GetConnectedDeviceByNodeId(chip::Controller::DeviceCommissioner * devCtrl, chip::NodeId nodeId, - chip::Controller::Python::PyObject * context, DeviceAvailableFunc callback); + chip::Controller::Python::PyObject * context, DeviceAvailableFunc callback, + int transportPayloadCapability); PyChipError pychip_FreeOperationalDeviceProxy(chip::OperationalDeviceProxy * deviceProxy); PyChipError pychip_GetLocalSessionId(chip::OperationalDeviceProxy * deviceProxy, uint16_t * localSessionId); PyChipError pychip_GetNumSessionsToPeer(chip::OperationalDeviceProxy * deviceProxy, uint32_t * numSessions); @@ -239,6 +240,13 @@ void pychip_Storage_ShutdownAdapter(chip::Controller::Python::StorageAdapter * s // ICD // void pychip_CheckInDelegate_SetOnCheckInCompleteCallback(PyChipCheckInDelegate::OnCheckInCompleteCallback * callback); + +// +// LargePayload and TCP +PyChipError pychip_SessionAllowsLargePayload(chip::OperationalDeviceProxy * deviceProxy, bool * allowsLargePayload); +PyChipError pychip_IsSessionOverTCPConnection(chip::OperationalDeviceProxy * deviceProxy, bool * isSessionOverTCP); +PyChipError pychip_IsActiveSession(chip::OperationalDeviceProxy * deviceProxy, bool * isActiveSession); +PyChipError pychip_CloseTCPConnectionWithPeer(chip::OperationalDeviceProxy * deviceProxy); } void * pychip_Storage_InitializeStorageAdapter(chip::Controller::Python::PyObject * context, @@ -584,6 +592,7 @@ struct IcdRegistrationParameters uint64_t checkInNodeId; uint64_t monitoredSubject; uint32_t stayActiveMsec; + uint8_t clientType; }; PyChipError pychip_DeviceController_SetIcdRegistrationParameters(bool enabled, const IcdRegistrationParameters * params) @@ -622,6 +631,7 @@ PyChipError pychip_DeviceController_SetIcdRegistrationParameters(bool enabled, c sCommissioningParameters.SetICDCheckInNodeId(params->checkInNodeId); sCommissioningParameters.SetICDMonitoredSubject(params->monitoredSubject); sCommissioningParameters.SetICDRegistrationStrategy(ICDRegistrationStrategy::kBeforeComplete); + sCommissioningParameters.SetICDClientType(static_cast(params->clientType)); return ToPyChipError(CHIP_NO_ERROR); } @@ -714,9 +724,14 @@ PyChipError pychip_DeviceController_OpenCommissioningWindow(chip::Controller::De SetupPayload payload; auto opener = Platform::New(static_cast(devCtrl)); - PyChipError err = ToPyChipError(opener->OpenCommissioningWindow(nodeid, System::Clock::Seconds16(timeout), iteration, - discriminator, NullOptional, NullOptional, - pairingDelegate->GetOpenWindowCallback(opener), payload)); + PyChipError err = + ToPyChipError(opener->OpenCommissioningWindow(Controller::CommissioningWindowPasscodeParams() + .SetNodeId(nodeid) + .SetTimeout(timeout) + .SetIteration(iteration) + .SetDiscriminator(discriminator) + .SetCallback(pairingDelegate->GetOpenWindowCallback(opener)), + payload)); return err; } @@ -800,11 +815,58 @@ struct GetDeviceCallbacks } // anonymous namespace PyChipError pychip_GetConnectedDeviceByNodeId(chip::Controller::DeviceCommissioner * devCtrl, chip::NodeId nodeId, - chip::Controller::Python::PyObject * context, DeviceAvailableFunc callback) + chip::Controller::Python::PyObject * context, DeviceAvailableFunc callback, + int transportPayloadCapability) { VerifyOrReturnError(devCtrl != nullptr, ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT)); auto * callbacks = new GetDeviceCallbacks(context, callback); - return ToPyChipError(devCtrl->GetConnectedDevice(nodeId, &callbacks->mOnSuccess, &callbacks->mOnFailure)); + return ToPyChipError(devCtrl->GetConnectedDevice(nodeId, &callbacks->mOnSuccess, &callbacks->mOnFailure, + static_cast(transportPayloadCapability))); +} + +PyChipError pychip_SessionAllowsLargePayload(chip::OperationalDeviceProxy * deviceProxy, bool * allowsLargePayload) +{ + VerifyOrReturnError(deviceProxy->GetSecureSession().HasValue(), ToPyChipError(CHIP_ERROR_MISSING_SECURE_SESSION)); + VerifyOrReturnError(allowsLargePayload != nullptr, ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT)); + + *allowsLargePayload = deviceProxy->GetSecureSession().Value()->AsSecureSession()->AllowsLargePayload(); + + return ToPyChipError(CHIP_NO_ERROR); +} + +PyChipError pychip_IsSessionOverTCPConnection(chip::OperationalDeviceProxy * deviceProxy, bool * isSessionOverTCP) +{ + VerifyOrReturnError(deviceProxy->GetSecureSession().HasValue(), ToPyChipError(CHIP_ERROR_MISSING_SECURE_SESSION)); + VerifyOrReturnError(isSessionOverTCP != nullptr, ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT)); + + *isSessionOverTCP = deviceProxy->GetSecureSession().Value()->AsSecureSession()->GetTCPConnection() != nullptr; + + return ToPyChipError(CHIP_NO_ERROR); +} + +PyChipError pychip_IsActiveSession(chip::OperationalDeviceProxy * deviceProxy, bool * isActiveSession) +{ + VerifyOrReturnError(isActiveSession != nullptr, ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT)); + + *isActiveSession = false; + if (deviceProxy->GetSecureSession().HasValue()) + { + *isActiveSession = deviceProxy->GetSecureSession().Value()->AsSecureSession()->IsActiveSession(); + } + + return ToPyChipError(CHIP_NO_ERROR); +} + +PyChipError pychip_CloseTCPConnectionWithPeer(chip::OperationalDeviceProxy * deviceProxy) +{ + VerifyOrReturnError(deviceProxy->GetSecureSession().HasValue(), ToPyChipError(CHIP_ERROR_MISSING_SECURE_SESSION)); + VerifyOrReturnError(deviceProxy->GetSecureSession().Value()->AsSecureSession()->AllowsLargePayload(), + ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT)); + + deviceProxy->GetExchangeManager()->GetSessionManager()->TCPDisconnect( + deviceProxy->GetSecureSession().Value()->AsSecureSession()->GetTCPConnection(), /* shouldAbort = */ false); + + return ToPyChipError(CHIP_NO_ERROR); } PyChipError pychip_FreeOperationalDeviceProxy(chip::OperationalDeviceProxy * deviceProxy) diff --git a/src/controller/python/chip/CertificateAuthority.py b/src/controller/python/chip/CertificateAuthority.py index bce921cfb785bf..0fbfcfdbdb93b8 100644 --- a/src/controller/python/chip/CertificateAuthority.py +++ b/src/controller/python/chip/CertificateAuthority.py @@ -28,6 +28,8 @@ from chip.native import PyChipError from chip.storage import PersistentStorage +LOGGER = logging.getLogger(__name__) + class CertificateAuthority: ''' This represents an operational Root Certificate Authority (CA) with a root key key pair with associated @@ -64,7 +66,7 @@ def __init__(self, chipStack: ChipStack.ChipStack, caIndex: int, persistentStora persistentStorage: An optional reference to a PersistentStorage object. If one is provided, it will pick that over the default PersistentStorage object retrieved from the chipStack. ''' - self.logger().warning(f"New CertificateAuthority at index {caIndex}") + LOGGER.info(f"New CertificateAuthority at index {caIndex}") self._chipStack = chipStack self._caIndex = caIndex @@ -105,7 +107,7 @@ def LoadFabricAdminsFromStorage(self): if (not (self._isActive)): raise RuntimeError("Object isn't active") - self.logger().warning("Loading fabric admins from storage...") + LOGGER.info("Loading fabric admins from storage...") caList = self._persistentStorage.GetReplKey(key='caList') if (str(self._caIndex) not in caList): @@ -244,7 +246,7 @@ def LoadAuthoritiesFromStorage(self): if (not (self._isActive)): raise RuntimeError("Object is not active") - self.logger().warning("Loading certificate authorities from storage...") + LOGGER.info("Loading certificate authorities from storage...") # # Persist details to storage (read modify write). diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index efadd7fd4f87c7..91c83e8954fa37 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -61,6 +61,8 @@ # Defined in $CHIP_ROOT/src/lib/core/CHIPError.h CHIP_ERROR_TIMEOUT: int = 50 +LOGGER = logging.getLogger(__name__) + _DevicePairingDelegate_OnPairingCompleteFunct = CFUNCTYPE(None, PyChipError) _DeviceUnpairingCompleteFunct = CFUNCTYPE(None, c_uint64, PyChipError) _DevicePairingDelegate_OnCommissioningCompleteFunct = CFUNCTYPE( @@ -82,6 +84,16 @@ _ChipDeviceController_IterateDiscoveredCommissionableNodesFunct = CFUNCTYPE(None, c_char_p, c_size_t) +# Defines for the transport payload types to use to select the suitable +# underlying transport of the session. +# class TransportPayloadCapability(ctypes.c_int): + + +class TransportPayloadCapability(ctypes.c_int): + MRP_PAYLOAD = 0 + LARGE_PAYLOAD = 1 + MRP_OR_TCP_PAYLOAD = 2 + @dataclass class CommissioningParameters: @@ -105,13 +117,14 @@ class ICDRegistrationParameters: checkInNodeId: typing.Optional[int] monitoredSubject: typing.Optional[int] stayActiveMs: typing.Optional[int] + clientType: typing.Optional[Clusters.IcdManagement.Enums.ClientTypeEnum] class CStruct(Structure): _fields_ = [('symmetricKey', c_char_p), ('symmetricKeyLength', c_size_t), ('checkInNodeId', - c_uint64), ('monitoredSubject', c_uint64), ('stayActiveMsec', c_uint32)] + c_uint64), ('monitoredSubject', c_uint64), ('stayActiveMsec', c_uint32), ('clientType', c_uint8)] def to_c(self): - return ICDRegistrationParameters.CStruct(self.symmetricKey, len(self.symmetricKey), self.checkInNodeId, self.monitoredSubject, self.stayActiveMs) + return ICDRegistrationParameters.CStruct(self.symmetricKey, len(self.symmetricKey), self.checkInNodeId, self.monitoredSubject, self.stayActiveMs, self.clientType.value) @_DeviceAvailableCallbackFunct @@ -205,8 +218,7 @@ def OnCheckInCallback(nodeid): RegisterOnActiveCallback(scopedNodeId, OnCheckInCallback) try: - async with asyncio.timeout(timeoutSeconds): - await future + asyncio.wait_for(future, timeout=timeoutSeconds) finally: UnregisterOnActiveCallback(scopedNodeId, OnCheckInCallback) @@ -247,7 +259,10 @@ def future(self) -> typing.Optional[concurrent.futures.Future]: async def __aexit__(self, exc_type, exc_value, traceback): if not self._future.done(): - raise RuntimeError("CallbackContext future not completed") + # In case the initial call (which sets up for the callback) fails, + # the future will never be used actually. So just cancel it here + # for completeness, in case somebody is expecting it to be completed. + self._future.cancel() self._future = None self._lock.release() @@ -366,6 +381,53 @@ def attestationChallenge(self) -> bytes: return bytes(buf) + @property + def sessionAllowsLargePayload(self) -> bool: + self._dmLib.pychip_SessionAllowsLargePayload.argtypes = [ctypes.c_void_p, POINTER(ctypes.c_bool)] + self._dmLib.pychip_SessionAllowsLargePayload.restype = PyChipError + + supportsLargePayload = ctypes.c_bool(False) + + builtins.chipStack.Call( + lambda: self._dmLib.pychip_SessionAllowsLargePayload(self._deviceProxy, pointer(supportsLargePayload)) + ).raise_on_error() + + return supportsLargePayload.value + + @property + def isSessionOverTCPConnection(self) -> bool: + self._dmLib.pychip_IsSessionOverTCPConnection.argtypes = [ctypes.c_void_p, POINTER(ctypes.c_bool)] + self._dmLib.pychip_IsSessionOverTCPConnection.restype = PyChipError + + isSessionOverTCP = ctypes.c_bool(False) + + builtins.chipStack.Call( + lambda: self._dmLib.pychip_IsSessionOverTCPConnection(self._deviceProxy, pointer(isSessionOverTCP)) + ).raise_on_error() + + return isSessionOverTCP.value + + @property + def isActiveSession(self) -> bool: + self._dmLib.pychip_IsActiveSession.argtypes = [ctypes.c_void_p, POINTER(ctypes.c_bool)] + self._dmLib.pychip_IsActiveSession.restype = PyChipError + + isActiveSession = ctypes.c_bool(False) + + builtins.chipStack.Call( + lambda: self._dmLib.pychip_IsActiveSession(self._deviceProxy, pointer(isActiveSession)) + ).raise_on_error() + + return isActiveSession.value + + def closeTCPConnectionWithPeer(self): + self._dmLib.pychip_CloseTCPConnectionWithPeer.argtypes = [ctypes.c_void_p] + self._dmLib.pychip_CloseTCPConnectionWithPeer.restype = PyChipError + + builtins.chipStack.Call( + lambda: self._dmLib.pychip_CloseTCPConnectionWithPeer(self._deviceProxy) + ).raise_on_error() + DiscoveryFilterType = discovery.FilterType DiscoveryType = discovery.DiscoveryType @@ -401,9 +463,9 @@ def __init__(self, name: str = ''): def _set_dev_ctrl(self, devCtrl, pairingDelegate): def HandleCommissioningComplete(nodeId: int, err: PyChipError): if err.is_success: - logging.info("Commissioning complete") + LOGGER.info("Commissioning complete") else: - logging.warning("Failed to commission: {}".format(err)) + LOGGER.warning("Failed to commission: {}".format(err)) self._dmLib.pychip_DeviceController_SetIcdRegistrationParameters(False, None) @@ -411,7 +473,7 @@ def HandleCommissioningComplete(nodeId: int, err: PyChipError): err = self._dmLib.pychip_GetCompletionError() if self._commissioning_context.future is None: - logging.exception("HandleCommissioningComplete called unexpectedly") + LOGGER.exception("HandleCommissioningComplete called unexpectedly") return if err.is_success: @@ -425,14 +487,14 @@ def HandleFabricCheck(nodeId): def HandleOpenWindowComplete(nodeid: int, setupPinCode: int, setupManualCode: str, setupQRCode: str, err: PyChipError) -> None: if err.is_success: - logging.info("Open Commissioning Window complete setting nodeid {} pincode to {}".format(nodeid, setupPinCode)) + LOGGER.info("Open Commissioning Window complete setting nodeid {} pincode to {}".format(nodeid, setupPinCode)) commissioningParameters = CommissioningParameters( setupPinCode=setupPinCode, setupManualCode=setupManualCode.decode(), setupQRCode=setupQRCode.decode()) else: - logging.warning("Failed to open commissioning window: {}".format(err)) + LOGGER.warning("Failed to open commissioning window: {}".format(err)) if self._open_window_context.future is None: - logging.exception("HandleOpenWindowComplete called unexpectedly") + LOGGER.exception("HandleOpenWindowComplete called unexpectedly") return if err.is_success: @@ -442,12 +504,12 @@ def HandleOpenWindowComplete(nodeid: int, setupPinCode: int, setupManualCode: st def HandleUnpairDeviceComplete(nodeid: int, err: PyChipError): if err.is_success: - logging.info("Succesfully unpaired device with nodeid {}".format(nodeid)) + LOGGER.info("Succesfully unpaired device with nodeid {}".format(nodeid)) else: - logging.warning("Failed to unpair device: {}".format(err)) + LOGGER.warning("Failed to unpair device: {}".format(err)) if self._unpair_device_context.future is None: - logging.exception("HandleUnpairDeviceComplete called unexpectedly") + LOGGER.exception("HandleUnpairDeviceComplete called unexpectedly") return if err.is_success: @@ -457,9 +519,9 @@ def HandleUnpairDeviceComplete(nodeid: int, err: PyChipError): def HandlePASEEstablishmentComplete(err: PyChipError): if not err.is_success: - logging.warning("Failed to establish secure session to device: {}".format(err)) + LOGGER.warning("Failed to establish secure session to device: {}".format(err)) else: - logging.info("Established secure session with Device") + LOGGER.info("Established secure session with Device") if self._commissioning_context.future is not None: # During Commissioning, HandlePASEEstablishmentComplete will also be called. @@ -469,7 +531,7 @@ def HandlePASEEstablishmentComplete(err: PyChipError): return if self._pase_establishment_context.future is None: - logging.exception("HandlePASEEstablishmentComplete called unexpectedly") + LOGGER.exception("HandlePASEEstablishmentComplete called unexpectedly") return if err.is_success: @@ -601,11 +663,10 @@ async def ConnectBLE(self, discriminator: int, setupPinCode: int, nodeid: int, i async with self._commissioning_context as ctx: self._enablePairingCompleteCallback(True) - res = await self._ChipStack.CallAsync( + await self._ChipStack.CallAsync( lambda: self._dmLib.pychip_DeviceController_ConnectBLE( self.devCtrl, discriminator, isShortDiscriminator, setupPinCode, nodeid) ) - res.raise_on_error() return await asyncio.futures.wrap_future(ctx.future) @@ -613,11 +674,11 @@ async def UnpairDevice(self, nodeid: int) -> None: self.CheckIsActive() async with self._unpair_device_context as ctx: - res = await self._ChipStack.CallAsync( + await self._ChipStack.CallAsync( lambda: self._dmLib.pychip_DeviceController_UnpairDevice( self.devCtrl, nodeid, self.cbHandleDeviceUnpairCompleteFunct) ) - res.raise_on_error() + return await asyncio.futures.wrap_future(ctx.future) def CloseBLEConnection(self): @@ -654,8 +715,7 @@ async def _establishPASESession(self, callFunct): async with self._pase_establishment_context as ctx: self._enablePairingCompleteCallback(True) - res = await self._ChipStack.CallAsync(callFunct) - res.raise_on_error() + await self._ChipStack.CallAsync(callFunct) await asyncio.futures.wrap_future(ctx.future) async def EstablishPASESessionBLE(self, setupPinCode: int, discriminator: int, nodeid: int) -> None: @@ -754,13 +814,12 @@ async def DiscoverCommissionableNodes(self, filterType: discovery.FilterType = d # Discovery is also used during commissioning. Make sure this manual discovery # and commissioning attempts do not interfere with each other. async with self._commissioning_lock: - res = await self._ChipStack.CallAsync( + await self._ChipStack.CallAsync( lambda: self._dmLib.pychip_DeviceController_DiscoverCommissionableNodes( self.devCtrl, int(filterType), str(filter).encode("utf-8"))) - res.raise_on_error() async def _wait_discovery(): - while not await self._ChipStack.CallAsync( + while not await self._ChipStack.CallAsyncWithResult( lambda: self._dmLib.pychip_DeviceController_HasDiscoveredCommissionableNode(self.devCtrl)): await asyncio.sleep(0.1) return @@ -774,9 +833,8 @@ async def _wait_discovery(): # Expected timeout, do nothing pass finally: - res = await self._ChipStack.CallAsync( + await self._ChipStack.CallAsync( lambda: self._dmLib.pychip_DeviceController_StopCommissionableDiscovery(self.devCtrl)) - res.raise_on_error() return await self.GetDiscoveredDevices() @@ -794,7 +852,7 @@ def HandleDevice(deviceJson, deviceJsonLen): self._dmLib.pychip_DeviceController_IterateDiscoveredCommissionableNodes(devCtrl.devCtrl, HandleDevice) return devices - return await self._ChipStack.CallAsync(lambda: GetDevices(self)) + return await self._ChipStack.CallAsyncWithResult(lambda: GetDevices(self)) def GetIPForDiscoveredDevice(self, idx, addrStr, length): self.CheckIsActive() @@ -826,11 +884,10 @@ async def OpenCommissioningWindow(self, nodeid: int, timeout: int, iteration: in self.CheckIsActive() async with self._open_window_context as ctx: - res = await self._ChipStack.CallAsync( + await self._ChipStack.CallAsync( lambda: self._dmLib.pychip_DeviceController_OpenCommissioningWindow( self.devCtrl, self.pairingDelegate, nodeid, timeout, iteration, discriminator, option) ) - res.raise_on_error() return await asyncio.futures.wrap_future(ctx.future) @@ -894,19 +951,19 @@ async def FindOrEstablishPASESession(self, setupCode: str, nodeid: int, timeoutM ''' Returns CommissioneeDeviceProxy if we can find or establish a PASE connection to the specified device''' self.CheckIsActive() returnDevice = c_void_p(None) - res = await self._ChipStack.CallAsync(lambda: self._dmLib.pychip_GetDeviceBeingCommissioned( + res = await self._ChipStack.CallAsyncWithResult(lambda: self._dmLib.pychip_GetDeviceBeingCommissioned( self.devCtrl, nodeid, byref(returnDevice)), timeoutMs) if res.is_success: return DeviceProxyWrapper(returnDevice, DeviceProxyWrapper.DeviceProxyType.COMMISSIONEE, self._dmLib) await self.EstablishPASESession(setupCode, nodeid) - res = await self._ChipStack.CallAsync(lambda: self._dmLib.pychip_GetDeviceBeingCommissioned( + res = await self._ChipStack.CallAsyncWithResult(lambda: self._dmLib.pychip_GetDeviceBeingCommissioned( self.devCtrl, nodeid, byref(returnDevice)), timeoutMs) if res.is_success: return DeviceProxyWrapper(returnDevice, DeviceProxyWrapper.DeviceProxyType.COMMISSIONEE, self._dmLib) - def GetConnectedDeviceSync(self, nodeid, allowPASE=True, timeoutMs: int = None): + def GetConnectedDeviceSync(self, nodeid, allowPASE=True, timeoutMs: int = None, payloadCapability: int = TransportPayloadCapability.MRP_PAYLOAD): ''' Gets an OperationalDeviceProxy or CommissioneeDeviceProxy for the specified Node. nodeId: Target's Node ID @@ -926,7 +983,7 @@ def GetConnectedDeviceSync(self, nodeid, allowPASE=True, timeoutMs: int = None): res = self._ChipStack.Call(lambda: self._dmLib.pychip_GetDeviceBeingCommissioned( self.devCtrl, nodeid, byref(returnDevice)), timeoutMs) if res.is_success: - logging.info('Using PASE connection') + LOGGER.info('Using PASE connection') return DeviceProxyWrapper(returnDevice, DeviceProxyWrapper.DeviceProxyType.COMMISSIONEE, self._dmLib) class DeviceAvailableClosure(): @@ -943,7 +1000,7 @@ def deviceAvailable(self, device, err): closure = DeviceAvailableClosure() ctypes.pythonapi.Py_IncRef(ctypes.py_object(closure)) self._ChipStack.Call(lambda: self._dmLib.pychip_GetConnectedDeviceByNodeId( - self.devCtrl, nodeid, ctypes.py_object(closure), _DeviceAvailableCallback), + self.devCtrl, nodeid, ctypes.py_object(closure), _DeviceAvailableCallback, payloadCapability), timeoutMs).raise_on_error() # The callback might have been received synchronously (during self._ChipStack.Call()). @@ -975,7 +1032,8 @@ async def WaitForActive(self, nodeid, *, timeoutSeconds=30.0, stayActiveDuration await WaitForCheckIn(ScopedNodeId(nodeid, self._fabricIndex), timeoutSeconds=timeoutSeconds) return await self.SendCommand(nodeid, 0, Clusters.IcdManagement.Commands.StayActiveRequest(stayActiveDuration=stayActiveDurationMs)) - async def GetConnectedDevice(self, nodeid, allowPASE: bool = True, timeoutMs: int = None): + async def GetConnectedDevice(self, nodeid, allowPASE: bool = True, timeoutMs: int = None, + payloadCapability: int = TransportPayloadCapability.MRP_PAYLOAD): ''' Gets an OperationalDeviceProxy or CommissioneeDeviceProxy for the specified Node. nodeId: Target's Node ID @@ -989,10 +1047,10 @@ async def GetConnectedDevice(self, nodeid, allowPASE: bool = True, timeoutMs: in if allowPASE: returnDevice = c_void_p(None) - res = await self._ChipStack.CallAsync(lambda: self._dmLib.pychip_GetDeviceBeingCommissioned( + res = await self._ChipStack.CallAsyncWithResult(lambda: self._dmLib.pychip_GetDeviceBeingCommissioned( self.devCtrl, nodeid, byref(returnDevice)), timeoutMs) if res.is_success: - logging.info('Using PASE connection') + LOGGER.info('Using PASE connection') return DeviceProxyWrapper(returnDevice, DeviceProxyWrapper.DeviceProxyType.COMMISSIONEE, self._dmLib) eventLoop = asyncio.get_running_loop() @@ -1019,10 +1077,9 @@ def deviceAvailable(self, device, err): closure = DeviceAvailableClosure(eventLoop, future) ctypes.pythonapi.Py_IncRef(ctypes.py_object(closure)) - res = await self._ChipStack.CallAsync(lambda: self._dmLib.pychip_GetConnectedDeviceByNodeId( - self.devCtrl, nodeid, ctypes.py_object(closure), _DeviceAvailableCallback), + await self._ChipStack.CallAsync(lambda: self._dmLib.pychip_GetConnectedDeviceByNodeId( + self.devCtrl, nodeid, ctypes.py_object(closure), _DeviceAvailableCallback, payloadCapability), timeoutMs) - res.raise_on_error() # The callback might have been received synchronously (during self._ChipStack.CallAsync()). # In that case the Future has already been set it will return immediately @@ -1125,7 +1182,8 @@ async def TestOnlySendCommandTimedRequestFlagWithNoTimedInvoke(self, nodeid: int async def SendCommand(self, nodeid: int, endpoint: int, payload: ClusterObjects.ClusterCommand, responseType=None, timedRequestTimeoutMs: typing.Union[None, int] = None, interactionTimeoutMs: typing.Union[None, int] = None, busyWaitMs: typing.Union[None, int] = None, - suppressResponse: typing.Union[None, bool] = None): + suppressResponse: typing.Union[None, bool] = None, + payloadCapability: int = TransportPayloadCapability.MRP_PAYLOAD): ''' Send a cluster-object encapsulated command to a node and get returned a future that can be awaited upon to receive the response. If a valid responseType is passed in, that will be used to de-serialize the object. If not, @@ -1145,7 +1203,7 @@ async def SendCommand(self, nodeid: int, endpoint: int, payload: ClusterObjects. eventLoop = asyncio.get_running_loop() future = eventLoop.create_future() - device = await self.GetConnectedDevice(nodeid, timeoutMs=interactionTimeoutMs) + device = await self.GetConnectedDevice(nodeid, timeoutMs=interactionTimeoutMs, payloadCapability=payloadCapability) res = await ClusterCommand.SendCommand( future, eventLoop, responseType, device.deviceProxy, ClusterCommand.CommandPath( EndpointId=endpoint, @@ -1159,7 +1217,8 @@ async def SendCommand(self, nodeid: int, endpoint: int, payload: ClusterObjects. async def SendBatchCommands(self, nodeid: int, commands: typing.List[ClusterCommand.InvokeRequestInfo], timedRequestTimeoutMs: typing.Optional[int] = None, interactionTimeoutMs: typing.Optional[int] = None, busyWaitMs: typing.Optional[int] = None, - suppressResponse: typing.Optional[bool] = None): + suppressResponse: typing.Optional[bool] = None, + payloadCapability: int = TransportPayloadCapability.MRP_PAYLOAD): ''' Send a batch of cluster-object encapsulated commands to a node and get returned a future that can be awaited upon to receive the responses. If a valid responseType is passed in, that will be used to de-serialize the object. If not, @@ -1187,7 +1246,7 @@ async def SendBatchCommands(self, nodeid: int, commands: typing.List[ClusterComm eventLoop = asyncio.get_running_loop() future = eventLoop.create_future() - device = await self.GetConnectedDevice(nodeid, timeoutMs=interactionTimeoutMs) + device = await self.GetConnectedDevice(nodeid, timeoutMs=interactionTimeoutMs, payloadCapability=payloadCapability) res = await ClusterCommand.SendBatchCommands( future, eventLoop, device.deviceProxy, commands, @@ -1216,7 +1275,8 @@ def SendGroupCommand(self, groupid: int, payload: ClusterObjects.ClusterCommand, async def WriteAttribute(self, nodeid: int, attributes: typing.List[typing.Tuple[int, ClusterObjects.ClusterAttributeDescriptor]], timedRequestTimeoutMs: typing.Union[None, int] = None, - interactionTimeoutMs: typing.Union[None, int] = None, busyWaitMs: typing.Union[None, int] = None): + interactionTimeoutMs: typing.Union[None, int] = None, busyWaitMs: typing.Union[None, int] = None, + payloadCapability: int = TransportPayloadCapability.MRP_PAYLOAD): ''' Write a list of attributes on a target node. @@ -1238,7 +1298,7 @@ async def WriteAttribute(self, nodeid: int, eventLoop = asyncio.get_running_loop() future = eventLoop.create_future() - device = await self.GetConnectedDevice(nodeid, timeoutMs=interactionTimeoutMs) + device = await self.GetConnectedDevice(nodeid, timeoutMs=interactionTimeoutMs, payloadCapability=payloadCapability) attrs = [] for v in attributes: @@ -1348,7 +1408,6 @@ def _parseEventPathTuple(self, pathTuple: typing.Union[ # Wildcard return ClusterAttribute.EventPath() elif not isinstance(pathTuple, tuple): - logging.debug(type(pathTuple)) if isinstance(pathTuple, int): return ClusterAttribute.EventPath(EndpointId=pathTuple) elif issubclass(pathTuple, ClusterObjects.Cluster): @@ -1398,7 +1457,8 @@ async def Read(self, nodeid: int, attributes: typing.List[typing.Union[ ]] = None, eventNumberFilter: typing.Optional[int] = None, returnClusterObject: bool = False, reportInterval: typing.Tuple[int, int] = None, - fabricFiltered: bool = True, keepSubscriptions: bool = False, autoResubscribe: bool = True): + fabricFiltered: bool = True, keepSubscriptions: bool = False, autoResubscribe: bool = True, + payloadCapability: int = TransportPayloadCapability.MRP_PAYLOAD): ''' Read a list of attributes and/or events from a target node @@ -1438,6 +1498,13 @@ async def Read(self, nodeid: int, attributes: typing.List[typing.Union[ reportInterval: A tuple of two int-s for (MinIntervalFloor, MaxIntervalCeiling). Used by establishing subscriptions. When not provided, a read request will be sent. + fabricFiltered: If True (default), the read/subscribe is fabric-filtered and will only see things associated with the fabric + of the reader/subscriber. Relevant for attributes with fabric-scoped data. + keepSubscriptions: Keep existing subscriptions. If set to False, existing subscriptions with this node will get cancelled + and a new one gets setup. + autoResubscribe: Automatically resubscribe to the subscription if subscription is lost. The automatic re-subscription only + applies if the subscription establishes on first try. If the first subscription establishment attempt fails the function + returns right away. Returns: - AsyncReadTransaction.ReadResponse. Please see ReadAttribute and ReadEvent for examples of how to access data. @@ -1451,7 +1518,7 @@ async def Read(self, nodeid: int, attributes: typing.List[typing.Union[ eventLoop = asyncio.get_running_loop() future = eventLoop.create_future() - device = await self.GetConnectedDevice(nodeid) + device = await self.GetConnectedDevice(nodeid, payloadCapability=payloadCapability) attributePaths = [self._parseAttributePathTuple( v) for v in attributes] if attributes else None clusterDataVersionFilters = [self._parseDataVersionFilterTuple( @@ -1482,7 +1549,8 @@ async def ReadAttribute(self, nodeid: int, attributes: typing.List[typing.Union[ ]], dataVersionFilters: typing.List[typing.Tuple[int, typing.Type[ClusterObjects.Cluster], int]] = None, returnClusterObject: bool = False, reportInterval: typing.Tuple[int, int] = None, - fabricFiltered: bool = True, keepSubscriptions: bool = False, autoResubscribe: bool = True): + fabricFiltered: bool = True, keepSubscriptions: bool = False, autoResubscribe: bool = True, + payloadCapability: int = TransportPayloadCapability.MRP_PAYLOAD): ''' Read a list of attributes from a target node, this is a wrapper of DeviceController.Read() @@ -1507,6 +1575,13 @@ async def ReadAttribute(self, nodeid: int, attributes: typing.List[typing.Union[ reportInterval: A tuple of two int-s for (MinIntervalFloor, MaxIntervalCeiling). Used by establishing subscriptions. When not provided, a read request will be sent. + fabricFiltered: If True (default), the read/subscribe is fabric-filtered and will only see things associated with the fabric + of the reader/subscriber. Relevant for attributes with fabric-scoped data. + keepSubscriptions: Keep existing subscriptions. If set to False, existing subscriptions with this node will get cancelled + and a new one gets setup. + autoResubscribe: Automatically resubscribe to the subscription if subscription is lost. The automatic re-subscription only + applies if the subscription establishes on first try. If the first subscription establishment attempt fails the function + returns right away. Returns: - subscription request: ClusterAttribute.SubscriptionTransaction @@ -1535,7 +1610,8 @@ async def ReadAttribute(self, nodeid: int, attributes: typing.List[typing.Union[ reportInterval=reportInterval, fabricFiltered=fabricFiltered, keepSubscriptions=keepSubscriptions, - autoResubscribe=autoResubscribe) + autoResubscribe=autoResubscribe, + payloadCapability=payloadCapability) if isinstance(res, ClusterAttribute.SubscriptionTransaction): return res else: @@ -1557,7 +1633,8 @@ async def ReadEvent(self, nodeid: int, events: typing.List[typing.Union[ fabricFiltered: bool = True, reportInterval: typing.Tuple[int, int] = None, keepSubscriptions: bool = False, - autoResubscribe: bool = True): + autoResubscribe: bool = True, + payloadCapability: int = TransportPayloadCapability.MRP_PAYLOAD): ''' Read a list of events from a target node, this is a wrapper of DeviceController.Read() @@ -1583,6 +1660,11 @@ async def ReadEvent(self, nodeid: int, events: typing.List[typing.Union[ eventNumberFilter: Optional minimum event number filter. reportInterval: A tuple of two int-s for (MinIntervalFloor, MaxIntervalCeiling). Used by establishing subscriptions. When not provided, a read request will be sent. + keepSubscriptions: Keep existing subscriptions. If set to False, existing subscriptions with this node will get cancelled + and a new one gets setup. + autoResubscribe: Automatically resubscribe to the subscription if subscription is lost. The automatic re-subscription only + applies if the subscription establishes on first try. If the first subscription establishment attempt fails the function + returns right away. Returns: - subscription request: ClusterAttribute.SubscriptionTransaction @@ -1599,7 +1681,7 @@ async def ReadEvent(self, nodeid: int, events: typing.List[typing.Union[ ''' res = await self.Read(nodeid=nodeid, events=events, eventNumberFilter=eventNumberFilter, fabricFiltered=fabricFiltered, reportInterval=reportInterval, keepSubscriptions=keepSubscriptions, - autoResubscribe=autoResubscribe) + autoResubscribe=autoResubscribe, payloadCapability=payloadCapability) if isinstance(res, ClusterAttribute.SubscriptionTransaction): return res else: @@ -1747,7 +1829,7 @@ def _InitLib(self): self._dmLib.pychip_ScriptDevicePairingDelegate_SetExpectingPairingComplete.restype = PyChipError self._dmLib.pychip_GetConnectedDeviceByNodeId.argtypes = [ - c_void_p, c_uint64, py_object, _DeviceAvailableCallbackFunct] + c_void_p, c_uint64, py_object, _DeviceAvailableCallbackFunct, c_int] self._dmLib.pychip_GetConnectedDeviceByNodeId.restype = PyChipError self._dmLib.pychip_FreeOperationalDeviceProxy.argtypes = [ @@ -1916,11 +1998,10 @@ async def Commission(self, nodeid) -> int: async with self._commissioning_context as ctx: self._enablePairingCompleteCallback(False) - res = await self._ChipStack.CallAsync( + await self._ChipStack.CallAsync( lambda: self._dmLib.pychip_DeviceController_Commission( self.devCtrl, nodeid) ) - res.raise_on_error() return await asyncio.futures.wrap_future(ctx.future) @@ -2002,7 +2083,8 @@ def GenerateICDRegistrationParameters(self): secrets.token_bytes(16), self._nodeId, self._nodeId, - 30) + 30, + Clusters.IcdManagement.Enums.ClientTypeEnum.kPermanent) def EnableICDRegistration(self, parameters: ICDRegistrationParameters): ''' Enables ICD registration for the following commissioning session. @@ -2064,11 +2146,10 @@ async def CommissionOnNetwork(self, nodeId: int, setupPinCode: int, async with self._commissioning_context as ctx: self._enablePairingCompleteCallback(True) - res = await self._ChipStack.CallAsync( + await self._ChipStack.CallAsync( lambda: self._dmLib.pychip_DeviceController_OnNetworkCommission( self.devCtrl, self.pairingDelegate, nodeId, setupPinCode, int(filterType), str(filter).encode("utf-8") if filter is not None else None, discoveryTimeoutMsec) ) - res.raise_on_error() return await asyncio.futures.wrap_future(ctx.future) @@ -2085,11 +2166,10 @@ async def CommissionWithCode(self, setupPayload: str, nodeid: int, discoveryType async with self._commissioning_context as ctx: self._enablePairingCompleteCallback(True) - res = await self._ChipStack.CallAsync( + await self._ChipStack.CallAsync( lambda: self._dmLib.pychip_DeviceController_ConnectWithCode( self.devCtrl, setupPayload.encode("utf-8"), nodeid, discoveryType.value) ) - res.raise_on_error() return await asyncio.futures.wrap_future(ctx.future) @@ -2105,17 +2185,16 @@ async def CommissionIP(self, ipaddr: str, setupPinCode: int, nodeid: int) -> int async with self._commissioning_context as ctx: self._enablePairingCompleteCallback(True) - res = await self._ChipStack.CallAsync( + await self._ChipStack.CallAsync( lambda: self._dmLib.pychip_DeviceController_ConnectIP( self.devCtrl, ipaddr.encode("utf-8"), setupPinCode, nodeid) ) - res.raise_on_error() return await asyncio.futures.wrap_future(ctx.future) def NOCChainCallback(self, nocChain): if self._issue_node_chain_context.future is None: - logging.exception("NOCChainCallback while not expecting a callback") + LOGGER.exception("NOCChainCallback while not expecting a callback") return self._issue_node_chain_context.future.set_result(nocChain) return @@ -2126,11 +2205,11 @@ async def IssueNOCChain(self, csr: Clusters.OperationalCredentials.Commands.CSRR self.CheckIsActive() async with self._issue_node_chain_context as ctx: - res = await self._ChipStack.CallAsync( + await self._ChipStack.CallAsync( lambda: self._dmLib.pychip_DeviceController_IssueNOCChain( self.devCtrl, py_object(self), csr.NOCSRElements, len(csr.NOCSRElements), nodeId) ) - res.raise_on_error() + return await asyncio.futures.wrap_future(ctx.future) diff --git a/src/controller/python/chip/ChipStack.py b/src/controller/python/chip/ChipStack.py index dc4efc223f491d..b717859c70351d 100644 --- a/src/controller/python/chip/ChipStack.py +++ b/src/controller/python/chip/ChipStack.py @@ -216,7 +216,7 @@ def Call(self, callFunct, timeoutMs: int = None): ''' return self.PostTaskOnChipThread(callFunct).Wait(timeoutMs) - async def CallAsync(self, callFunct, timeoutMs: int = None): + async def CallAsyncWithResult(self, callFunct, timeoutMs: int = None): '''Run a Python function on CHIP stack, and wait for the response. This function will post a task on CHIP mainloop and waits for the call response in a asyncio friendly manner. ''' @@ -232,6 +232,11 @@ async def CallAsync(self, callFunct, timeoutMs: int = None): return await asyncio.wait_for(callObj.future, timeoutMs / 1000 if timeoutMs else None) + async def CallAsync(self, callFunct, timeoutMs: int = None) -> None: + '''Run a Python function on CHIP stack, and wait for the response.''' + res: PyChipError = await self.CallAsyncWithResult(callFunct, timeoutMs) + res.raise_on_error() + def PostTaskOnChipThread(self, callFunct) -> AsyncCallableHandle: '''Run a Python function on CHIP stack, and wait for the response. This function will post a task on CHIP mainloop, and return an object with Wait() method for getting the result. diff --git a/src/controller/python/chip/FabricAdmin.py b/src/controller/python/chip/FabricAdmin.py index fc20327e628bcc..d9e2e35cb2bcc4 100644 --- a/src/controller/python/chip/FabricAdmin.py +++ b/src/controller/python/chip/FabricAdmin.py @@ -25,6 +25,8 @@ from chip.crypto import p256keypair from chip.native import GetLibraryHandle +LOGGER = logging.getLogger(__name__) + class FabricAdmin: ''' Administers a fabric associated with a unique FabricID under a given CertificateAuthority @@ -34,10 +36,6 @@ class FabricAdmin: def _Handle(cls): return GetLibraryHandle() - @classmethod - def logger(cls): - return logging.getLogger('FabricAdmin') - def __init__(self, certificateAuthority: CertificateAuthority.CertificateAuthority, vendorId: int, fabricId: int = 1): ''' Initializes the object. @@ -60,7 +58,7 @@ def __init__(self, certificateAuthority: CertificateAuthority.CertificateAuthori self._fabricId = fabricId self._certificateAuthority = certificateAuthority - self.logger().warning(f"New FabricAdmin: FabricId: 0x{self._fabricId:016X}, VendorId = 0x{self.vendorId:04X}") + LOGGER.info(f"New FabricAdmin: FabricId: 0x{self._fabricId:016X}, VendorId = 0x{self.vendorId:04X}") self._isActive = True self._activeControllers = [] @@ -94,7 +92,7 @@ def NewController(self, nodeId: int = None, paaTrustStorePath: str = "", if (nodeId in nodeIdList): raise RuntimeError(f"Provided NodeId {nodeId} collides with an existing controller instance!") - self.logger().warning( + LOGGER.info( f"Allocating new controller with CaIndex: {self._certificateAuthority.caIndex}, " f"FabricId: 0x{self._fabricId:016X}, NodeId: 0x{nodeId:016X}, CatTags: {catTags}") diff --git a/src/controller/python/chip/clusters/Attribute.py b/src/controller/python/chip/clusters/Attribute.py index 36f5a794f9e73e..06e893aa963be4 100644 --- a/src/controller/python/chip/clusters/Attribute.py +++ b/src/controller/python/chip/clusters/Attribute.py @@ -40,6 +40,8 @@ from .ClusterObjects import Cluster, ClusterAttributeDescriptor, ClusterEvent +LOGGER = logging.getLogger(__name__) + @unique class EventTimestampType(Enum): @@ -286,7 +288,7 @@ def _BuildClusterIndex(): ''' Build internal cluster index for locating the corresponding cluster object by path in the future. ''' for clusterName, obj in inspect.getmembers(sys.modules['chip.clusters.Objects']): - if ('chip.clusters.Objects' in str(obj)) and inspect.isclass(obj): + if ('chip.clusters.Objects' in str(obj)) and inspect.isclass(obj) and issubclass(obj, Cluster): _ClusterIndex[obj.id] = obj @@ -467,7 +469,7 @@ def OverrideLivenessTimeoutMs(self, timeoutMs: int): async def TriggerResubscribeIfScheduled(self, reason: str): handle = chip.native.GetLibraryHandle() - await builtins.chipStack.CallAsync( + await builtins.chipStack.CallAsyncWithResult( lambda: handle.pychip_ReadClient_TriggerResubscribeIfScheduled( self._readTransaction._pReadClient, reason.encode("utf-8")) ) @@ -569,7 +571,7 @@ def subscriptionId(self) -> int: def Shutdown(self): if (self._isDone): - print("Subscription was already terminated previously!") + LOGGER.warning("Subscription 0x%08x was already terminated previously!", self.subscriptionId) return handle = chip.native.GetLibraryHandle() @@ -675,7 +677,7 @@ def handleAttributeData(self, path: AttributePath, dataVersion: int, status: int self._changedPathSet.add(path) except Exception as ex: - logging.exception(ex) + LOGGER.exception(ex) def handleEventData(self, header: EventHeader, path: EventPath, data: bytes, status: int): try: @@ -693,12 +695,12 @@ def handleEventData(self, header: EventHeader, path: EventPath, data: bytes, sta try: eventValue = eventType.FromTLV(data) except Exception as ex: - logging.error( + LOGGER.error( f"Error convering TLV to Cluster Object for path: Endpoint = {path.EndpointId}/" f"Cluster = {path.ClusterId}/Event = {path.EventId}") - logging.error( + LOGGER.error( f"Failed Cluster Object: {str(eventType)}") - logging.error(ex) + LOGGER.error(ex) eventValue = ValueDecodeFailure( tlvData, ex) @@ -715,9 +717,11 @@ def handleEventData(self, header: EventHeader, path: EventPath, data: bytes, sta eventResult, self._subscription_handler) except Exception as ex: - logging.exception(ex) + LOGGER.exception(ex) def handleError(self, chipError: PyChipError): + if self._subscription_handler: + self._subscription_handler.OnErrorCb(chipError.code, self._subscription_handler) self._resultError = chipError def _handleSubscriptionEstablished(self, subscriptionId): @@ -726,7 +730,7 @@ def _handleSubscriptionEstablished(self, subscriptionId): self, subscriptionId, self._devCtrl) self._future.set_result(self._subscription_handler) else: - logging.info("Re-subscription succeeded!") + self._subscription_handler._subscriptionId = subscriptionId if self._subscription_handler._onResubscriptionSucceededCb is not None: if (self._subscription_handler._onResubscriptionSucceededCb_isAsync): self._event_loop.create_task( @@ -761,7 +765,7 @@ def _handleReportEnd(self): attribute_path = TypedAttributePath(Path=change) except (KeyError, ValueError) as err: # path could not be resolved into a TypedAttributePath - logging.getLogger(__name__).exception(err) + LOGGER.exception(err) continue self._subscription_handler.OnAttributeChangeCb( attribute_path, self._subscription_handler) @@ -778,10 +782,7 @@ def _handleDone(self): # if not self._future.done(): if self._resultError is not None: - if self._subscription_handler: - self._subscription_handler.OnErrorCb(self._resultError.code, self._subscription_handler) - else: - self._future.set_exception(self._resultError.to_exception()) + self._future.set_exception(self._resultError.to_exception()) else: self._future.set_result(AsyncReadTransaction.ReadResponse( attributes=self._cache.attributeCache, events=self._events, tlvAttributes=self._cache.attributeTLVCache)) @@ -816,7 +817,7 @@ def handleResponse(self, path: AttributePath, status: int): imStatus = chip.interaction_model.Status(status) self._resultData.append(AttributeWriteResult(Path=path, Status=imStatus)) except ValueError as ex: - logging.exception(ex) + LOGGER.exception(ex) def handleError(self, chipError: PyChipError): self._resultError = chipError diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index db05bf7319200b..8822e6da3ddf43 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -867,6 +867,13 @@ class ChipClusters: "clusterName": "AccessControl", "clusterId": 0x0000001F, "commands": { + 0x00000000: { + "commandId": 0x00000000, + "commandName": "ReviewFabricRestrictions", + "args": { + "arl": "AccessRestrictionStruct", + }, + }, }, "attributes": { 0x00000000: { @@ -901,6 +908,18 @@ class ChipClusters: "type": "int", "reportable": True, }, + 0x00000005: { + "attributeName": "CommissioningARL", + "attributeId": 0x00000005, + "type": "", + "reportable": True, + }, + 0x00000006: { + "attributeName": "Arl", + "attributeId": 0x00000006, + "type": "", + "reportable": True, + }, 0x0000FFF8: { "attributeName": "GeneratedCommandList", "attributeId": 0x0000FFF8, @@ -3246,6 +3265,13 @@ class ChipClusters: "clusterName": "BridgedDeviceBasicInformation", "clusterId": 0x00000039, "commands": { + 0x00000080: { + "commandId": 0x00000080, + "commandName": "KeepActive", + "args": { + "stayActiveDuration": "int", + }, + }, }, "attributes": { 0x00000001: { @@ -4138,6 +4164,12 @@ class ChipClusters: "type": "int", "reportable": True, }, + 0x00000009: { + "attributeName": "MaximumCheckInBackOff", + "attributeId": 0x00000009, + "type": "int", + "reportable": True, + }, 0x0000FFF8: { "attributeName": "GeneratedCommandList", "attributeId": 0x0000FFF8, @@ -6580,6 +6612,104 @@ class ChipClusters: }, }, } + _WATER_HEATER_MANAGEMENT_CLUSTER_INFO = { + "clusterName": "WaterHeaterManagement", + "clusterId": 0x00000094, + "commands": { + 0x00000000: { + "commandId": 0x00000000, + "commandName": "Boost", + "args": { + "duration": "int", + "oneShot": "bool", + "emergencyBoost": "bool", + "temporarySetpoint": "int", + "targetPercentage": "int", + "targetReheat": "int", + }, + }, + 0x00000001: { + "commandId": 0x00000001, + "commandName": "CancelBoost", + "args": { + }, + }, + }, + "attributes": { + 0x00000000: { + "attributeName": "HeaterTypes", + "attributeId": 0x00000000, + "type": "int", + "reportable": True, + }, + 0x00000001: { + "attributeName": "HeatDemand", + "attributeId": 0x00000001, + "type": "int", + "reportable": True, + }, + 0x00000002: { + "attributeName": "TankVolume", + "attributeId": 0x00000002, + "type": "int", + "reportable": True, + }, + 0x00000003: { + "attributeName": "EstimatedHeatRequired", + "attributeId": 0x00000003, + "type": "int", + "reportable": True, + }, + 0x00000004: { + "attributeName": "TankPercentage", + "attributeId": 0x00000004, + "type": "int", + "reportable": True, + }, + 0x00000005: { + "attributeName": "BoostState", + "attributeId": 0x00000005, + "type": "int", + "reportable": True, + }, + 0x0000FFF8: { + "attributeName": "GeneratedCommandList", + "attributeId": 0x0000FFF8, + "type": "int", + "reportable": True, + }, + 0x0000FFF9: { + "attributeName": "AcceptedCommandList", + "attributeId": 0x0000FFF9, + "type": "int", + "reportable": True, + }, + 0x0000FFFA: { + "attributeName": "EventList", + "attributeId": 0x0000FFFA, + "type": "int", + "reportable": True, + }, + 0x0000FFFB: { + "attributeName": "AttributeList", + "attributeId": 0x0000FFFB, + "type": "int", + "reportable": True, + }, + 0x0000FFFC: { + "attributeName": "FeatureMap", + "attributeId": 0x0000FFFC, + "type": "int", + "reportable": True, + }, + 0x0000FFFD: { + "attributeName": "ClusterRevision", + "attributeId": 0x0000FFFD, + "type": "int", + "reportable": True, + }, + }, + } _DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_INFO = { "clusterName": "DemandResponseLoadControl", "clusterId": 0x00000096, @@ -7379,6 +7509,83 @@ class ChipClusters: }, }, } + _WATER_HEATER_MODE_CLUSTER_INFO = { + "clusterName": "WaterHeaterMode", + "clusterId": 0x0000009E, + "commands": { + 0x00000000: { + "commandId": 0x00000000, + "commandName": "ChangeToMode", + "args": { + "newMode": "int", + }, + }, + }, + "attributes": { + 0x00000000: { + "attributeName": "SupportedModes", + "attributeId": 0x00000000, + "type": "", + "reportable": True, + }, + 0x00000001: { + "attributeName": "CurrentMode", + "attributeId": 0x00000001, + "type": "int", + "reportable": True, + }, + 0x00000002: { + "attributeName": "StartUpMode", + "attributeId": 0x00000002, + "type": "int", + "reportable": True, + "writable": True, + }, + 0x00000003: { + "attributeName": "OnMode", + "attributeId": 0x00000003, + "type": "int", + "reportable": True, + "writable": True, + }, + 0x0000FFF8: { + "attributeName": "GeneratedCommandList", + "attributeId": 0x0000FFF8, + "type": "int", + "reportable": True, + }, + 0x0000FFF9: { + "attributeName": "AcceptedCommandList", + "attributeId": 0x0000FFF9, + "type": "int", + "reportable": True, + }, + 0x0000FFFA: { + "attributeName": "EventList", + "attributeId": 0x0000FFFA, + "type": "int", + "reportable": True, + }, + 0x0000FFFB: { + "attributeName": "AttributeList", + "attributeId": 0x0000FFFB, + "type": "int", + "reportable": True, + }, + 0x0000FFFC: { + "attributeName": "FeatureMap", + "attributeId": 0x0000FFFC, + "type": "int", + "reportable": True, + }, + 0x0000FFFD: { + "attributeName": "ClusterRevision", + "attributeId": 0x0000FFFD, + "type": "int", + "reportable": True, + }, + }, + } _DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER_INFO = { "clusterName": "DeviceEnergyManagementMode", "clusterId": 0x0000009F, @@ -8638,7 +8845,6 @@ class ChipClusters: "commandName": "SetActivePresetRequest", "args": { "presetHandle": "bytes", - "delayMinutes": "int", }, }, 0x00000007: { @@ -8660,19 +8866,6 @@ class ChipClusters: "args": { }, }, - 0x0000000A: { - "commandId": 0x0000000A, - "commandName": "CancelSetActivePresetRequest", - "args": { - }, - }, - 0x0000000B: { - "commandId": 0x0000000B, - "commandName": "SetTemperatureSetpointHoldPolicy", - "args": { - "temperatureSetpointHoldPolicy": "int", - }, - }, }, "attributes": { 0x00000000: { @@ -9065,23 +9258,11 @@ class ChipClusters: "reportable": True, }, 0x00000053: { - "attributeName": "TemperatureSetpointHoldPolicy", - "attributeId": 0x00000053, - "type": "int", - "reportable": True, - }, - 0x00000054: { "attributeName": "SetpointHoldExpiryTimestamp", - "attributeId": 0x00000054, + "attributeId": 0x00000053, "type": "int", "reportable": True, }, - 0x00000055: { - "attributeName": "QueuedPreset", - "attributeId": 0x00000055, - "type": "", - "reportable": True, - }, 0x0000FFF8: { "attributeName": "GeneratedCommandList", "attributeId": 0x0000FFF8, @@ -11654,12 +11835,18 @@ class ChipClusters: }, }, "attributes": { - 0x00000001: { + 0x00000000: { "attributeName": "Ssid", - "attributeId": 0x00000001, + "attributeId": 0x00000000, "type": "bytes", "reportable": True, }, + 0x00000001: { + "attributeName": "PassphraseSurrogate", + "attributeId": 0x00000001, + "type": "int", + "reportable": True, + }, 0x0000FFF8: { "attributeName": "GeneratedCommandList", "attributeId": 0x0000FFF8, @@ -11714,16 +11901,16 @@ class ChipClusters: "args": { }, }, - 0x00000004: { - "commandId": 0x00000004, + 0x00000003: { + "commandId": 0x00000003, "commandName": "SetActiveDatasetRequest", "args": { "activeDataset": "bytes", "breadcrumb": "int", }, }, - 0x00000005: { - "commandId": 0x00000005, + 0x00000004: { + "commandId": 0x00000004, "commandName": "SetPendingDatasetRequest", "args": { "pendingDataset": "bytes", @@ -11755,9 +11942,9 @@ class ChipClusters: "type": "bool", "reportable": True, }, - 0x00000005: { + 0x00000004: { "attributeName": "ActiveDatasetTimestamp", - "attributeId": 0x00000005, + "attributeId": 0x00000004, "type": "int", "reportable": True, }, @@ -11814,14 +12001,14 @@ class ChipClusters: "commandId": 0x00000001, "commandName": "RemoveNetwork", "args": { - "extendedPanID": "int", + "extendedPanID": "bytes", }, }, 0x00000002: { "commandId": 0x00000002, "commandName": "GetOperationalDataset", "args": { - "extendedPanID": "int", + "extendedPanID": "bytes", }, }, }, @@ -11829,7 +12016,7 @@ class ChipClusters: 0x00000000: { "attributeName": "PreferredExtendedPanID", "attributeId": 0x00000000, - "type": "int", + "type": "bytes", "reportable": True, "writable": True, }, @@ -13101,6 +13288,138 @@ class ChipClusters: }, }, } + _ECOSYSTEM_INFORMATION_CLUSTER_INFO = { + "clusterName": "EcosystemInformation", + "clusterId": 0x00000750, + "commands": { + }, + "attributes": { + 0x00000000: { + "attributeName": "RemovedOn", + "attributeId": 0x00000000, + "type": "int", + "reportable": True, + }, + 0x00000001: { + "attributeName": "DeviceDirectory", + "attributeId": 0x00000001, + "type": "", + "reportable": True, + }, + 0x00000002: { + "attributeName": "LocationDirectory", + "attributeId": 0x00000002, + "type": "", + "reportable": True, + }, + 0x0000FFF8: { + "attributeName": "GeneratedCommandList", + "attributeId": 0x0000FFF8, + "type": "int", + "reportable": True, + }, + 0x0000FFF9: { + "attributeName": "AcceptedCommandList", + "attributeId": 0x0000FFF9, + "type": "int", + "reportable": True, + }, + 0x0000FFFA: { + "attributeName": "EventList", + "attributeId": 0x0000FFFA, + "type": "int", + "reportable": True, + }, + 0x0000FFFB: { + "attributeName": "AttributeList", + "attributeId": 0x0000FFFB, + "type": "int", + "reportable": True, + }, + 0x0000FFFC: { + "attributeName": "FeatureMap", + "attributeId": 0x0000FFFC, + "type": "int", + "reportable": True, + }, + 0x0000FFFD: { + "attributeName": "ClusterRevision", + "attributeId": 0x0000FFFD, + "type": "int", + "reportable": True, + }, + }, + } + _COMMISSIONER_CONTROL_CLUSTER_INFO = { + "clusterName": "CommissionerControl", + "clusterId": 0x00000751, + "commands": { + 0x00000000: { + "commandId": 0x00000000, + "commandName": "RequestCommissioningApproval", + "args": { + "requestId": "int", + "vendorId": "int", + "productId": "int", + "label": "str", + }, + }, + 0x00000001: { + "commandId": 0x00000001, + "commandName": "CommissionNode", + "args": { + "requestId": "int", + "responseTimeoutSeconds": "int", + "ipAddress": "bytes", + "port": "int", + }, + }, + }, + "attributes": { + 0x00000000: { + "attributeName": "SupportedDeviceCategories", + "attributeId": 0x00000000, + "type": "int", + "reportable": True, + }, + 0x0000FFF8: { + "attributeName": "GeneratedCommandList", + "attributeId": 0x0000FFF8, + "type": "int", + "reportable": True, + }, + 0x0000FFF9: { + "attributeName": "AcceptedCommandList", + "attributeId": 0x0000FFF9, + "type": "int", + "reportable": True, + }, + 0x0000FFFA: { + "attributeName": "EventList", + "attributeId": 0x0000FFFA, + "type": "int", + "reportable": True, + }, + 0x0000FFFB: { + "attributeName": "AttributeList", + "attributeId": 0x0000FFFB, + "type": "int", + "reportable": True, + }, + 0x0000FFFC: { + "attributeName": "FeatureMap", + "attributeId": 0x0000FFFC, + "type": "int", + "reportable": True, + }, + 0x0000FFFD: { + "attributeName": "ClusterRevision", + "attributeId": 0x0000FFFD, + "type": "int", + "reportable": True, + }, + }, + } _ELECTRICAL_MEASUREMENT_CLUSTER_INFO = { "clusterName": "ElectricalMeasurement", "clusterId": 0x00000B04, @@ -14960,6 +15279,7 @@ class ChipClusters: 0x00000081: _VALVE_CONFIGURATION_AND_CONTROL_CLUSTER_INFO, 0x00000090: _ELECTRICAL_POWER_MEASUREMENT_CLUSTER_INFO, 0x00000091: _ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER_INFO, + 0x00000094: _WATER_HEATER_MANAGEMENT_CLUSTER_INFO, 0x00000096: _DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_INFO, 0x00000097: _MESSAGES_CLUSTER_INFO, 0x00000098: _DEVICE_ENERGY_MANAGEMENT_CLUSTER_INFO, @@ -14967,6 +15287,7 @@ class ChipClusters: 0x0000009B: _ENERGY_PREFERENCE_CLUSTER_INFO, 0x0000009C: _POWER_TOPOLOGY_CLUSTER_INFO, 0x0000009D: _ENERGY_EVSE_MODE_CLUSTER_INFO, + 0x0000009E: _WATER_HEATER_MODE_CLUSTER_INFO, 0x0000009F: _DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER_INFO, 0x00000101: _DOOR_LOCK_CLUSTER_INFO, 0x00000102: _WINDOW_COVERING_CLUSTER_INFO, @@ -15011,6 +15332,8 @@ class ChipClusters: 0x0000050E: _ACCOUNT_LOGIN_CLUSTER_INFO, 0x0000050F: _CONTENT_CONTROL_CLUSTER_INFO, 0x00000510: _CONTENT_APP_OBSERVER_CLUSTER_INFO, + 0x00000750: _ECOSYSTEM_INFORMATION_CLUSTER_INFO, + 0x00000751: _COMMISSIONER_CONTROL_CLUSTER_INFO, 0x00000B04: _ELECTRICAL_MEASUREMENT_CLUSTER_INFO, 0xFFF1FC05: _UNIT_TESTING_CLUSTER_INFO, 0xFFF1FC06: _FAULT_INJECTION_CLUSTER_INFO, @@ -15085,6 +15408,7 @@ class ChipClusters: "ValveConfigurationAndControl": _VALVE_CONFIGURATION_AND_CONTROL_CLUSTER_INFO, "ElectricalPowerMeasurement": _ELECTRICAL_POWER_MEASUREMENT_CLUSTER_INFO, "ElectricalEnergyMeasurement": _ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER_INFO, + "WaterHeaterManagement": _WATER_HEATER_MANAGEMENT_CLUSTER_INFO, "DemandResponseLoadControl": _DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_INFO, "Messages": _MESSAGES_CLUSTER_INFO, "DeviceEnergyManagement": _DEVICE_ENERGY_MANAGEMENT_CLUSTER_INFO, @@ -15092,6 +15416,7 @@ class ChipClusters: "EnergyPreference": _ENERGY_PREFERENCE_CLUSTER_INFO, "PowerTopology": _POWER_TOPOLOGY_CLUSTER_INFO, "EnergyEvseMode": _ENERGY_EVSE_MODE_CLUSTER_INFO, + "WaterHeaterMode": _WATER_HEATER_MODE_CLUSTER_INFO, "DeviceEnergyManagementMode": _DEVICE_ENERGY_MANAGEMENT_MODE_CLUSTER_INFO, "DoorLock": _DOOR_LOCK_CLUSTER_INFO, "WindowCovering": _WINDOW_COVERING_CLUSTER_INFO, @@ -15136,6 +15461,8 @@ class ChipClusters: "AccountLogin": _ACCOUNT_LOGIN_CLUSTER_INFO, "ContentControl": _CONTENT_CONTROL_CLUSTER_INFO, "ContentAppObserver": _CONTENT_APP_OBSERVER_CLUSTER_INFO, + "EcosystemInformation": _ECOSYSTEM_INFORMATION_CLUSTER_INFO, + "CommissionerControl": _COMMISSIONER_CONTROL_CLUSTER_INFO, "ElectricalMeasurement": _ELECTRICAL_MEASUREMENT_CLUSTER_INFO, "UnitTesting": _UNIT_TESTING_CLUSTER_INFO, "FaultInjection": _FAULT_INJECTION_CLUSTER_INFO, diff --git a/src/controller/python/chip/clusters/Command.py b/src/controller/python/chip/clusters/Command.py index 93951338f988f5..785bb3d3daf47f 100644 --- a/src/controller/python/chip/clusters/Command.py +++ b/src/controller/python/chip/clusters/Command.py @@ -316,7 +316,7 @@ async def SendCommand(future: Future, eventLoop, responseType: Type, device, com payloadTLV = payload.ToTLV() ctypes.pythonapi.Py_IncRef(ctypes.py_object(transaction)) - return await builtins.chipStack.CallAsync( + return await builtins.chipStack.CallAsyncWithResult( lambda: handle.pychip_CommandSender_SendCommand( ctypes.py_object(transaction), device, c_uint16(0 if timedRequestTimeoutMs is None else timedRequestTimeoutMs), commandPath.EndpointId, @@ -388,7 +388,7 @@ async def SendBatchCommands(future: Future, eventLoop, device, commands: List[In transaction = AsyncBatchCommandsTransaction(future, eventLoop, responseTypes) ctypes.pythonapi.Py_IncRef(ctypes.py_object(transaction)) - return await builtins.chipStack.CallAsync( + return await builtins.chipStack.CallAsyncWithResult( lambda: handle.pychip_CommandSender_SendBatchCommands( py_object(transaction), device, c_uint16(0 if timedRequestTimeoutMs is None else timedRequestTimeoutMs), diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 9a6c6a55a7f420..9f1772de0df353 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -36,6 +36,40 @@ ClusterObjectDescriptor, ClusterObjectFieldDescriptor) from .Types import Nullable, NullValue +class Globals: + class Enums: + class TestGlobalEnum(MatterIntEnum): + kSomeValue = 0x00 + kSomeOtherValue = 0x01 + kFinalValue = 0x02 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 3, + + class Bitmaps: + class TestGlobalBitmap(IntFlag): + kFirstBit = 0x1 + kSecondBit = 0x2 + + class Structs: + @dataclass + class TestGlobalStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="name", Tag=0, Type=str), + ClusterObjectFieldDescriptor(Label="myBitmap", Tag=1, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="myEnum", Tag=2, Type=typing.Union[None, Nullable, Globals.Enums.TestGlobalEnum]), + ]) + + name: 'str' = "" + myBitmap: 'typing.Union[Nullable, uint]' = NullValue + myEnum: 'typing.Union[None, Nullable, Globals.Enums.TestGlobalEnum]' = None + + @dataclass class Identify(Cluster): @@ -74,16 +108,16 @@ class EffectIdentifierEnum(MatterIntEnum): kStopEffect = 0xFF # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class EffectVariantEnum(MatterIntEnum): kDefault = 0x00 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 1, class IdentifyTypeEnum(MatterIntEnum): @@ -95,8 +129,8 @@ class IdentifyTypeEnum(MatterIntEnum): kActuator = 0x05 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 6, class Commands: @@ -622,16 +656,16 @@ class DelayedAllOffEffectVariantEnum(MatterIntEnum): kDelayedOffSlowFade = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class DyingLightEffectVariantEnum(MatterIntEnum): kDyingLightFadeOff = 0x00 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 1, class EffectIdentifierEnum(MatterIntEnum): @@ -639,8 +673,8 @@ class EffectIdentifierEnum(MatterIntEnum): kDyingLight = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class StartUpOnOffEnum(MatterIntEnum): @@ -649,8 +683,8 @@ class StartUpOnOffEnum(MatterIntEnum): kToggle = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class Bitmaps: @@ -1145,8 +1179,8 @@ class MoveModeEnum(MatterIntEnum): kDown = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class StepModeEnum(MatterIntEnum): @@ -1154,8 +1188,8 @@ class StepModeEnum(MatterIntEnum): kDown = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class Bitmaps: @@ -2501,6 +2535,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="subjectsPerAccessControlEntry", Tag=0x00000002, Type=uint), ClusterObjectFieldDescriptor(Label="targetsPerAccessControlEntry", Tag=0x00000003, Type=uint), ClusterObjectFieldDescriptor(Label="accessControlEntriesPerFabric", Tag=0x00000004, Type=uint), + ClusterObjectFieldDescriptor(Label="commissioningARL", Tag=0x00000005, Type=typing.Optional[typing.List[AccessControl.Structs.CommissioningAccessRestrictionEntryStruct]]), + ClusterObjectFieldDescriptor(Label="arl", Tag=0x00000006, Type=typing.Optional[typing.List[AccessControl.Structs.AccessRestrictionEntryStruct]]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), @@ -2514,6 +2550,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: subjectsPerAccessControlEntry: 'uint' = None targetsPerAccessControlEntry: 'uint' = None accessControlEntriesPerFabric: 'uint' = None + commissioningARL: 'typing.Optional[typing.List[AccessControl.Structs.CommissioningAccessRestrictionEntryStruct]]' = None + arl: 'typing.Optional[typing.List[AccessControl.Structs.AccessRestrictionEntryStruct]]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None eventList: 'typing.List[uint]' = None @@ -2528,8 +2566,8 @@ class AccessControlEntryAuthModeEnum(MatterIntEnum): kGroup = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 0, class AccessControlEntryPrivilegeEnum(MatterIntEnum): @@ -2540,21 +2578,82 @@ class AccessControlEntryPrivilegeEnum(MatterIntEnum): kAdminister = 0x05 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 0, + class AccessRestrictionTypeEnum(MatterIntEnum): + kAttributeAccessForbidden = 0x00 + kAttributeWriteForbidden = 0x01 + kCommandForbidden = 0x02 + kEventForbidden = 0x03 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 4, + class ChangeTypeEnum(MatterIntEnum): kChanged = 0x00 kAdded = 0x01 kRemoved = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, + class Bitmaps: + class Feature(IntFlag): + kExtension = 0x1 + kManagedDevice = 0x2 + class Structs: + @dataclass + class AccessRestrictionStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="type", Tag=0, Type=AccessControl.Enums.AccessRestrictionTypeEnum), + ClusterObjectFieldDescriptor(Label="id", Tag=1, Type=typing.Union[Nullable, uint]), + ]) + + type: 'AccessControl.Enums.AccessRestrictionTypeEnum' = 0 + id: 'typing.Union[Nullable, uint]' = NullValue + + @dataclass + class CommissioningAccessRestrictionEntryStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="endpoint", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="cluster", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="restrictions", Tag=2, Type=typing.List[AccessControl.Structs.AccessRestrictionStruct]), + ]) + + endpoint: 'uint' = 0 + cluster: 'uint' = 0 + restrictions: 'typing.List[AccessControl.Structs.AccessRestrictionStruct]' = field(default_factory=lambda: []) + + @dataclass + class AccessRestrictionEntryStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="endpoint", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="cluster", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="restrictions", Tag=2, Type=typing.List[AccessControl.Structs.AccessRestrictionStruct]), + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=254, Type=uint), + ]) + + endpoint: 'uint' = 0 + cluster: 'uint' = 0 + restrictions: 'typing.List[AccessControl.Structs.AccessRestrictionStruct]' = field(default_factory=lambda: []) + fabricIndex: 'uint' = 0 + @dataclass class AccessControlTargetStruct(ClusterObject): @ChipUtility.classproperty @@ -2602,6 +2701,39 @@ def descriptor(cls) -> ClusterObjectDescriptor: data: 'bytes' = b"" fabricIndex: 'uint' = 0 + class Commands: + @dataclass + class ReviewFabricRestrictions(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x0000001F + command_id: typing.ClassVar[int] = 0x00000000 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="arl", Tag=0, Type=typing.List[AccessControl.Structs.AccessRestrictionStruct]), + ]) + + arl: 'typing.List[AccessControl.Structs.AccessRestrictionStruct]' = field(default_factory=lambda: []) + + @dataclass + class ReviewFabricRestrictionsResponse(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x0000001F + command_id: typing.ClassVar[int] = 0x00000001 + is_client: typing.ClassVar[bool] = False + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="token", Tag=0, Type=uint), + ]) + + token: 'uint' = 0 + class Attributes: @dataclass class Acl(ClusterAttributeDescriptor): @@ -2683,6 +2815,38 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'uint' = 0 + @dataclass + class CommissioningARL(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000001F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000005 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[typing.List[AccessControl.Structs.CommissioningAccessRestrictionEntryStruct]]) + + value: 'typing.Optional[typing.List[AccessControl.Structs.CommissioningAccessRestrictionEntryStruct]]' = None + + @dataclass + class Arl(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000001F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000006 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[typing.List[AccessControl.Structs.AccessRestrictionEntryStruct]]) + + value: 'typing.Optional[typing.List[AccessControl.Structs.AccessRestrictionEntryStruct]]' = None + @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): @ChipUtility.classproperty @@ -2834,6 +2998,50 @@ def descriptor(cls) -> ClusterObjectDescriptor: latestValue: 'typing.Union[Nullable, AccessControl.Structs.AccessControlExtensionStruct]' = NullValue fabricIndex: 'uint' = 0 + @dataclass + class AccessRestrictionEntryChanged(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000001F + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000002 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=254, Type=uint), + ]) + + fabricIndex: 'uint' = 0 + + @dataclass + class FabricRestrictionReviewUpdate(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000001F + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000003 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="token", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="instruction", Tag=1, Type=typing.Union[Nullable, str]), + ClusterObjectFieldDescriptor(Label="redirectURL", Tag=2, Type=typing.Union[Nullable, str]), + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=254, Type=uint), + ]) + + token: 'uint' = 0 + instruction: 'typing.Union[Nullable, str]' = NullValue + redirectURL: 'typing.Union[Nullable, str]' = NullValue + fabricIndex: 'uint' = 0 + @dataclass class Actions(Cluster): @@ -2870,8 +3078,8 @@ class ActionErrorEnum(MatterIntEnum): kInterrupted = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class ActionStateEnum(MatterIntEnum): @@ -2881,8 +3089,8 @@ class ActionStateEnum(MatterIntEnum): kDisabled = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class ActionTypeEnum(MatterIntEnum): @@ -2895,8 +3103,8 @@ class ActionTypeEnum(MatterIntEnum): kAlarm = 0x06 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 7, class EndpointListTypeEnum(MatterIntEnum): @@ -2905,8 +3113,8 @@ class EndpointListTypeEnum(MatterIntEnum): kZone = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class Bitmaps: @@ -3411,7 +3619,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="serialNumber", Tag=0x0000000F, Type=typing.Optional[str]), ClusterObjectFieldDescriptor(Label="localConfigDisabled", Tag=0x00000010, Type=typing.Optional[bool]), ClusterObjectFieldDescriptor(Label="reachable", Tag=0x00000011, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="uniqueID", Tag=0x00000012, Type=typing.Optional[str]), + ClusterObjectFieldDescriptor(Label="uniqueID", Tag=0x00000012, Type=str), ClusterObjectFieldDescriptor(Label="capabilityMinima", Tag=0x00000013, Type=BasicInformation.Structs.CapabilityMinimaStruct), ClusterObjectFieldDescriptor(Label="productAppearance", Tag=0x00000014, Type=typing.Optional[BasicInformation.Structs.ProductAppearanceStruct]), ClusterObjectFieldDescriptor(Label="specificationVersion", Tag=0x00000015, Type=uint), @@ -3442,7 +3650,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: serialNumber: 'typing.Optional[str]' = None localConfigDisabled: 'typing.Optional[bool]' = None reachable: 'typing.Optional[bool]' = None - uniqueID: 'typing.Optional[str]' = None + uniqueID: 'str' = None capabilityMinima: 'BasicInformation.Structs.CapabilityMinimaStruct' = None productAppearance: 'typing.Optional[BasicInformation.Structs.ProductAppearanceStruct]' = None specificationVersion: 'uint' = None @@ -3479,8 +3687,8 @@ class ColorEnum(MatterIntEnum): kGold = 0x14 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 21, class ProductFinishEnum(MatterIntEnum): @@ -3492,8 +3700,8 @@ class ProductFinishEnum(MatterIntEnum): kFabric = 0x05 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 6, class Structs: @@ -3838,9 +4046,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[str]) + return ClusterObjectFieldDescriptor(Type=str) - value: 'typing.Optional[str]' = None + value: 'str' = "" @dataclass class CapabilityMinima(ClusterAttributeDescriptor): @@ -4107,8 +4315,8 @@ class ApplyUpdateActionEnum(MatterIntEnum): kDiscontinue = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class DownloadProtocolEnum(MatterIntEnum): @@ -4118,8 +4326,8 @@ class DownloadProtocolEnum(MatterIntEnum): kVendorSpecific = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class StatusEnum(MatterIntEnum): @@ -4129,8 +4337,8 @@ class StatusEnum(MatterIntEnum): kDownloadProtocolNotSupported = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class Commands: @@ -4384,8 +4592,8 @@ class AnnouncementReasonEnum(MatterIntEnum): kUrgentUpdateAvailable = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class ChangeReasonEnum(MatterIntEnum): @@ -4396,8 +4604,8 @@ class ChangeReasonEnum(MatterIntEnum): kDelayByProvider = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class UpdateStateEnum(MatterIntEnum): @@ -4412,8 +4620,8 @@ class UpdateStateEnum(MatterIntEnum): kDelayedOnUserConsent = 0x08 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 9, class Structs: @@ -4894,8 +5102,8 @@ class CalendarTypeEnum(MatterIntEnum): kUseActiveLocale = 0xFF # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 12, class HourFormatEnum(MatterIntEnum): @@ -4904,8 +5112,8 @@ class HourFormatEnum(MatterIntEnum): kUseActiveLocale = 0xFF # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class Bitmaps: @@ -5090,8 +5298,8 @@ class TempUnitEnum(MatterIntEnum): kKelvin = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class Bitmaps: @@ -5475,8 +5683,8 @@ class BatApprovedChemistryEnum(MatterIntEnum): kZincCerium = 0x20 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 33, class BatChargeFaultEnum(MatterIntEnum): @@ -5493,8 +5701,8 @@ class BatChargeFaultEnum(MatterIntEnum): kSafetyTimeout = 0x0A # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 11, class BatChargeLevelEnum(MatterIntEnum): @@ -5503,8 +5711,8 @@ class BatChargeLevelEnum(MatterIntEnum): kCritical = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class BatChargeStateEnum(MatterIntEnum): @@ -5514,8 +5722,8 @@ class BatChargeStateEnum(MatterIntEnum): kIsNotCharging = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class BatCommonDesignationEnum(MatterIntEnum): @@ -5602,8 +5810,8 @@ class BatCommonDesignationEnum(MatterIntEnum): k32600 = 0x50 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 81, class BatFaultEnum(MatterIntEnum): @@ -5612,8 +5820,8 @@ class BatFaultEnum(MatterIntEnum): kUnderTemp = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class BatReplaceabilityEnum(MatterIntEnum): @@ -5623,8 +5831,8 @@ class BatReplaceabilityEnum(MatterIntEnum): kFactoryReplaceable = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class PowerSourceStatusEnum(MatterIntEnum): @@ -5634,8 +5842,8 @@ class PowerSourceStatusEnum(MatterIntEnum): kUnavailable = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class WiredCurrentTypeEnum(MatterIntEnum): @@ -5643,8 +5851,8 @@ class WiredCurrentTypeEnum(MatterIntEnum): kDc = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class WiredFaultEnum(MatterIntEnum): @@ -5653,8 +5861,8 @@ class WiredFaultEnum(MatterIntEnum): kUnderVoltage = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class Bitmaps: @@ -6420,8 +6628,8 @@ class CommissioningErrorEnum(MatterIntEnum): kBusyWithOtherAdmin = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class RegulatoryLocationTypeEnum(MatterIntEnum): @@ -6430,8 +6638,8 @@ class RegulatoryLocationTypeEnum(MatterIntEnum): kIndoorOutdoor = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class Structs: @@ -6794,8 +7002,8 @@ class NetworkCommissioningStatusEnum(MatterIntEnum): kUnknownError = 0x0C # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 13, class WiFiBandEnum(MatterIntEnum): @@ -6807,8 +7015,8 @@ class WiFiBandEnum(MatterIntEnum): k1g = 0x05 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 6, class Bitmaps: @@ -7422,8 +7630,8 @@ class IntentEnum(MatterIntEnum): kCrashLogs = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class StatusEnum(MatterIntEnum): @@ -7434,8 +7642,8 @@ class StatusEnum(MatterIntEnum): kDenied = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class TransferProtocolEnum(MatterIntEnum): @@ -7443,8 +7651,8 @@ class TransferProtocolEnum(MatterIntEnum): kBdx = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class Commands: @@ -7640,8 +7848,8 @@ class BootReasonEnum(MatterIntEnum): kSoftwareReset = 0x06 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 7, class HardwareFaultEnum(MatterIntEnum): @@ -7658,8 +7866,8 @@ class HardwareFaultEnum(MatterIntEnum): kTamperDetected = 0x0A # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 11, class InterfaceTypeEnum(MatterIntEnum): @@ -7670,8 +7878,8 @@ class InterfaceTypeEnum(MatterIntEnum): kThread = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class NetworkFaultEnum(MatterIntEnum): @@ -7681,8 +7889,8 @@ class NetworkFaultEnum(MatterIntEnum): kConnectionFailed = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class RadioFaultEnum(MatterIntEnum): @@ -7695,8 +7903,8 @@ class RadioFaultEnum(MatterIntEnum): kEthernetFault = 0x06 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 7, class Bitmaps: @@ -8550,8 +8758,8 @@ class ConnectionStatusEnum(MatterIntEnum): kNotConnected = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class NetworkFaultEnum(MatterIntEnum): @@ -8561,8 +8769,8 @@ class NetworkFaultEnum(MatterIntEnum): kNetworkJammed = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class RoutingRoleEnum(MatterIntEnum): @@ -8575,8 +8783,8 @@ class RoutingRoleEnum(MatterIntEnum): kLeader = 0x06 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 7, class Bitmaps: @@ -9917,8 +10125,8 @@ class AssociationFailureCauseEnum(MatterIntEnum): kSsidNotFound = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class ConnectionStatusEnum(MatterIntEnum): @@ -9926,8 +10134,8 @@ class ConnectionStatusEnum(MatterIntEnum): kNotConnected = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class SecurityTypeEnum(MatterIntEnum): @@ -9939,8 +10147,8 @@ class SecurityTypeEnum(MatterIntEnum): kWpa3 = 0x05 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 6, class WiFiVersionEnum(MatterIntEnum): @@ -9953,8 +10161,8 @@ class WiFiVersionEnum(MatterIntEnum): kAh = 0x06 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 7, class Bitmaps: @@ -10397,8 +10605,8 @@ class PHYRateEnum(MatterIntEnum): kRate400G = 0x09 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 10, class Bitmaps: @@ -10720,16 +10928,16 @@ class GranularityEnum(MatterIntEnum): kMicrosecondsGranularity = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class StatusCode(MatterIntEnum): kTimeNotAccepted = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 0, class TimeSourceEnum(MatterIntEnum): @@ -10752,8 +10960,8 @@ class TimeSourceEnum(MatterIntEnum): kGnss = 0x10 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 17, class TimeZoneDatabaseEnum(MatterIntEnum): @@ -10762,8 +10970,8 @@ class TimeZoneDatabaseEnum(MatterIntEnum): kNone = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class Bitmaps: @@ -11350,7 +11558,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="productLabel", Tag=0x0000000E, Type=typing.Optional[str]), ClusterObjectFieldDescriptor(Label="serialNumber", Tag=0x0000000F, Type=typing.Optional[str]), ClusterObjectFieldDescriptor(Label="reachable", Tag=0x00000011, Type=bool), - ClusterObjectFieldDescriptor(Label="uniqueID", Tag=0x00000012, Type=typing.Optional[str]), + ClusterObjectFieldDescriptor(Label="uniqueID", Tag=0x00000012, Type=str), ClusterObjectFieldDescriptor(Label="productAppearance", Tag=0x00000014, Type=typing.Optional[BridgedDeviceBasicInformation.Structs.ProductAppearanceStruct]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), @@ -11374,7 +11582,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: productLabel: 'typing.Optional[str]' = None serialNumber: 'typing.Optional[str]' = None reachable: 'bool' = None - uniqueID: 'typing.Optional[str]' = None + uniqueID: 'str' = None productAppearance: 'typing.Optional[BridgedDeviceBasicInformation.Structs.ProductAppearanceStruct]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None @@ -11408,8 +11616,8 @@ class ColorEnum(MatterIntEnum): kGold = 0x14 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 21, class ProductFinishEnum(MatterIntEnum): @@ -11421,10 +11629,14 @@ class ProductFinishEnum(MatterIntEnum): kFabric = 0x05 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 6, + class Bitmaps: + class Feature(IntFlag): + kBridgedICDSupport = 0x100000 + class Structs: @dataclass class ProductAppearanceStruct(ClusterObject): @@ -11439,6 +11651,23 @@ def descriptor(cls) -> ClusterObjectDescriptor: finish: 'BridgedDeviceBasicInformation.Enums.ProductFinishEnum' = 0 primaryColor: 'typing.Union[Nullable, BridgedDeviceBasicInformation.Enums.ColorEnum]' = NullValue + class Commands: + @dataclass + class KeepActive(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000039 + command_id: typing.ClassVar[int] = 0x00000080 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="stayActiveDuration", Tag=0, Type=uint), + ]) + + stayActiveDuration: 'uint' = 0 + class Attributes: @dataclass class VendorName(ClusterAttributeDescriptor): @@ -11676,9 +11905,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[str]) + return ClusterObjectFieldDescriptor(Type=str) - value: 'typing.Optional[str]' = None + value: 'str' = "" @dataclass class ProductAppearance(ClusterAttributeDescriptor): @@ -11863,6 +12092,25 @@ def descriptor(cls) -> ClusterObjectDescriptor: reachableNewValue: 'bool' = False + @dataclass + class ActiveChanged(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000039 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000080 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="promisedActiveDuration", Tag=0, Type=uint), + ]) + + promisedActiveDuration: 'uint' = 0 + @dataclass class Switch(Cluster): @@ -12222,8 +12470,8 @@ class CommissioningWindowStatusEnum(MatterIntEnum): kBasicWindowOpen = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class StatusCode(MatterIntEnum): @@ -12232,8 +12480,8 @@ class StatusCode(MatterIntEnum): kWindowNotOpen = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 0, class Bitmaps: @@ -12493,8 +12741,8 @@ class CertificateChainTypeEnum(MatterIntEnum): kPAICertificate = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 0, class NodeOperationalCertStatusEnum(MatterIntEnum): @@ -12510,8 +12758,8 @@ class NodeOperationalCertStatusEnum(MatterIntEnum): kInvalidFabricIndex = 0x0B # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 7, class Structs: @@ -12995,8 +13243,8 @@ class GroupKeySecurityPolicyEnum(MatterIntEnum): kCacheAndSync = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class Bitmaps: @@ -14162,6 +14410,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="userActiveModeTriggerHint", Tag=0x00000006, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="userActiveModeTriggerInstruction", Tag=0x00000007, Type=typing.Optional[str]), ClusterObjectFieldDescriptor(Label="operatingMode", Tag=0x00000008, Type=typing.Optional[IcdManagement.Enums.OperatingModeEnum]), + ClusterObjectFieldDescriptor(Label="maximumCheckInBackOff", Tag=0x00000009, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), @@ -14179,6 +14428,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: userActiveModeTriggerHint: 'typing.Optional[uint]' = None userActiveModeTriggerInstruction: 'typing.Optional[str]' = None operatingMode: 'typing.Optional[IcdManagement.Enums.OperatingModeEnum]' = None + maximumCheckInBackOff: 'typing.Optional[uint]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None eventList: 'typing.List[uint]' = None @@ -14192,8 +14442,8 @@ class ClientTypeEnum(MatterIntEnum): kEphemeral = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class OperatingModeEnum(MatterIntEnum): @@ -14201,8 +14451,8 @@ class OperatingModeEnum(MatterIntEnum): kLit = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class Bitmaps: @@ -14210,6 +14460,7 @@ class Feature(IntFlag): kCheckInProtocolSupport = 0x1 kUserActiveModeTrigger = 0x2 kLongIdleTimeSupport = 0x4 + kDynamicSitLitSupport = 0x8 class UserActiveModeTriggerBitmap(IntFlag): kPowerCycle = 0x1 @@ -14484,6 +14735,22 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Optional[IcdManagement.Enums.OperatingModeEnum]' = None + @dataclass + class MaximumCheckInBackOff(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000046 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000009 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) + + value: 'typing.Optional[uint]' = None + @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): @ChipUtility.classproperty @@ -14618,8 +14885,8 @@ class TimerStatusEnum(MatterIntEnum): kReady = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class Bitmaps: @@ -14877,8 +15144,8 @@ class ErrorStateEnum(MatterIntEnum): kCommandInvalidInState = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class OperationalStateEnum(MatterIntEnum): @@ -14888,8 +15155,8 @@ class OperationalStateEnum(MatterIntEnum): kError = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class Structs: @@ -15271,8 +15538,8 @@ class ModeTag(MatterIntEnum): kProofing = 0x4008 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 0, class Bitmaps: @@ -15540,8 +15807,8 @@ class DrynessLevelEnum(MatterIntEnum): kMax = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class Attributes: @@ -16536,8 +16803,8 @@ class NumberOfRinsesEnum(MatterIntEnum): kMax = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class Bitmaps: @@ -17969,8 +18236,8 @@ class AirQualityEnum(MatterIntEnum): kExtremelyPoor = 0x06 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 7, class Bitmaps: @@ -18150,8 +18417,8 @@ class AlarmStateEnum(MatterIntEnum): kCritical = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class ContaminationStateEnum(MatterIntEnum): @@ -18161,8 +18428,8 @@ class ContaminationStateEnum(MatterIntEnum): kCritical = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class EndOfServiceEnum(MatterIntEnum): @@ -18170,8 +18437,8 @@ class EndOfServiceEnum(MatterIntEnum): kExpired = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class ExpressedStateEnum(MatterIntEnum): @@ -18186,8 +18453,8 @@ class ExpressedStateEnum(MatterIntEnum): kInterconnectCO = 0x08 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 9, class MuteStateEnum(MatterIntEnum): @@ -18195,8 +18462,8 @@ class MuteStateEnum(MatterIntEnum): kMuted = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class SensitivityEnum(MatterIntEnum): @@ -18205,8 +18472,8 @@ class SensitivityEnum(MatterIntEnum): kLow = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class Bitmaps: @@ -19023,8 +19290,8 @@ class ModeTag(MatterIntEnum): kDefrost = 0x4001 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 0, class Bitmaps: @@ -19563,8 +19830,8 @@ class ErrorStateEnum(MatterIntEnum): kCommandInvalidInState = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class OperationalStateEnum(MatterIntEnum): @@ -19574,8 +19841,8 @@ class OperationalStateEnum(MatterIntEnum): kError = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class Structs: @@ -20334,17 +20601,31 @@ class Feature(IntFlag): class Structs: @dataclass - class AttributeValuePair(ClusterObject): + class AttributeValuePairStruct(ClusterObject): @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="attributeID", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="attributeValue", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="valueUnsigned8", Tag=1, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="valueSigned8", Tag=2, Type=typing.Optional[int]), + ClusterObjectFieldDescriptor(Label="valueUnsigned16", Tag=3, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="valueSigned16", Tag=4, Type=typing.Optional[int]), + ClusterObjectFieldDescriptor(Label="valueUnsigned32", Tag=5, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="valueSigned32", Tag=6, Type=typing.Optional[int]), + ClusterObjectFieldDescriptor(Label="valueUnsigned64", Tag=7, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="valueSigned64", Tag=8, Type=typing.Optional[int]), ]) attributeID: 'uint' = 0 - attributeValue: 'uint' = 0 + valueUnsigned8: 'typing.Optional[uint]' = None + valueSigned8: 'typing.Optional[int]' = None + valueUnsigned16: 'typing.Optional[uint]' = None + valueSigned16: 'typing.Optional[int]' = None + valueUnsigned32: 'typing.Optional[uint]' = None + valueSigned32: 'typing.Optional[int]' = None + valueUnsigned64: 'typing.Optional[uint]' = None + valueSigned64: 'typing.Optional[int]' = None @dataclass class ExtensionFieldSet(ClusterObject): @@ -20353,11 +20634,11 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="clusterID", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="attributeValueList", Tag=1, Type=typing.List[ScenesManagement.Structs.AttributeValuePair]), + ClusterObjectFieldDescriptor(Label="attributeValueList", Tag=1, Type=typing.List[ScenesManagement.Structs.AttributeValuePairStruct]), ]) clusterID: 'uint' = 0 - attributeValueList: 'typing.List[ScenesManagement.Structs.AttributeValuePair]' = field(default_factory=lambda: []) + attributeValueList: 'typing.List[ScenesManagement.Structs.AttributeValuePairStruct]' = field(default_factory=lambda: []) @dataclass class SceneInfoStruct(ClusterObject): @@ -20869,8 +21150,8 @@ class ChangeIndicationEnum(MatterIntEnum): kCritical = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class DegradationDirectionEnum(MatterIntEnum): @@ -20878,8 +21159,8 @@ class DegradationDirectionEnum(MatterIntEnum): kDown = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class ProductIdentifierTypeEnum(MatterIntEnum): @@ -20890,8 +21171,8 @@ class ProductIdentifierTypeEnum(MatterIntEnum): kOem = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class Bitmaps: @@ -21164,8 +21445,8 @@ class ChangeIndicationEnum(MatterIntEnum): kCritical = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class DegradationDirectionEnum(MatterIntEnum): @@ -21173,8 +21454,8 @@ class DegradationDirectionEnum(MatterIntEnum): kDown = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class ProductIdentifierTypeEnum(MatterIntEnum): @@ -21185,8 +21466,8 @@ class ProductIdentifierTypeEnum(MatterIntEnum): kOem = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class Bitmaps: @@ -21820,8 +22101,8 @@ class StatusCodeEnum(MatterIntEnum): kFailureDueToFault = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 0, class ValveStateEnum(MatterIntEnum): @@ -21830,8 +22111,8 @@ class ValveStateEnum(MatterIntEnum): kTransitioning = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class Bitmaps: @@ -22274,8 +22555,8 @@ class MeasurementTypeEnum(MatterIntEnum): kElectricalEnergy = 0x0E # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 15, class PowerModeEnum(MatterIntEnum): @@ -22284,8 +22565,8 @@ class PowerModeEnum(MatterIntEnum): kAc = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class Bitmaps: @@ -22861,8 +23142,8 @@ class MeasurementTypeEnum(MatterIntEnum): kElectricalEnergy = 0x0E # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 15, class Bitmaps: @@ -23190,6 +23471,304 @@ def descriptor(cls) -> ClusterObjectDescriptor: energyExported: 'typing.Optional[ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]' = None +@dataclass +class WaterHeaterManagement(Cluster): + id: typing.ClassVar[int] = 0x00000094 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="heaterTypes", Tag=0x00000000, Type=uint), + ClusterObjectFieldDescriptor(Label="heatDemand", Tag=0x00000001, Type=uint), + ClusterObjectFieldDescriptor(Label="tankVolume", Tag=0x00000002, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="estimatedHeatRequired", Tag=0x00000003, Type=typing.Optional[int]), + ClusterObjectFieldDescriptor(Label="tankPercentage", Tag=0x00000004, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="boostState", Tag=0x00000005, Type=WaterHeaterManagement.Enums.BoostStateEnum), + ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="featureMap", Tag=0x0000FFFC, Type=uint), + ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), + ]) + + heaterTypes: 'uint' = None + heatDemand: 'uint' = None + tankVolume: 'typing.Optional[uint]' = None + estimatedHeatRequired: 'typing.Optional[int]' = None + tankPercentage: 'typing.Optional[uint]' = None + boostState: 'WaterHeaterManagement.Enums.BoostStateEnum' = None + generatedCommandList: 'typing.List[uint]' = None + acceptedCommandList: 'typing.List[uint]' = None + eventList: 'typing.List[uint]' = None + attributeList: 'typing.List[uint]' = None + featureMap: 'uint' = None + clusterRevision: 'uint' = None + + class Enums: + class BoostStateEnum(MatterIntEnum): + kInactive = 0x00 + kActive = 0x01 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 2, + + class Bitmaps: + class Feature(IntFlag): + kEnergyManagement = 0x1 + kTankPercent = 0x2 + + class WaterHeaterDemandBitmap(IntFlag): + kImmersionElement1 = 0x1 + kImmersionElement2 = 0x2 + kHeatPump = 0x4 + kBoiler = 0x8 + kOther = 0x10 + + class WaterHeaterTypeBitmap(IntFlag): + kImmersionElement1 = 0x1 + kImmersionElement2 = 0x2 + kHeatPump = 0x4 + kBoiler = 0x8 + kOther = 0x10 + + class Commands: + @dataclass + class Boost(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000094 + command_id: typing.ClassVar[int] = 0x00000000 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="duration", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="oneShot", Tag=1, Type=typing.Optional[bool]), + ClusterObjectFieldDescriptor(Label="emergencyBoost", Tag=2, Type=typing.Optional[bool]), + ClusterObjectFieldDescriptor(Label="temporarySetpoint", Tag=3, Type=typing.Optional[int]), + ClusterObjectFieldDescriptor(Label="targetPercentage", Tag=4, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="targetReheat", Tag=5, Type=typing.Optional[uint]), + ]) + + duration: 'uint' = 0 + oneShot: 'typing.Optional[bool]' = None + emergencyBoost: 'typing.Optional[bool]' = None + temporarySetpoint: 'typing.Optional[int]' = None + targetPercentage: 'typing.Optional[uint]' = None + targetReheat: 'typing.Optional[uint]' = None + + @dataclass + class CancelBoost(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000094 + command_id: typing.ClassVar[int] = 0x00000001 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + class Attributes: + @dataclass + class HeaterTypes(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000094 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class HeatDemand(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000094 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000001 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class TankVolume(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000094 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000002 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) + + value: 'typing.Optional[uint]' = None + + @dataclass + class EstimatedHeatRequired(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000094 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000003 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[int]) + + value: 'typing.Optional[int]' = None + + @dataclass + class TankPercentage(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000094 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000004 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) + + value: 'typing.Optional[uint]' = None + + @dataclass + class BoostState(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000094 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000005 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=WaterHeaterManagement.Enums.BoostStateEnum) + + value: 'WaterHeaterManagement.Enums.BoostStateEnum' = 0 + + @dataclass + class GeneratedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000094 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF8 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AcceptedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000094 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF9 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class EventList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000094 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFA + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AttributeList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000094 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFB + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class FeatureMap(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000094 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFC + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class ClusterRevision(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000094 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFD + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass class DemandResponseLoadControl(Cluster): id: typing.ClassVar[int] = 0x00000096 @@ -23243,8 +23822,8 @@ class CriticalityLevelEnum(MatterIntEnum): kServiceDisconnect = 0x09 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 10, class HeatingSourceEnum(MatterIntEnum): @@ -23253,8 +23832,8 @@ class HeatingSourceEnum(MatterIntEnum): kNonElectric = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class LoadControlEventChangeSourceEnum(MatterIntEnum): @@ -23262,8 +23841,8 @@ class LoadControlEventChangeSourceEnum(MatterIntEnum): kUserAction = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class LoadControlEventStatusEnum(MatterIntEnum): @@ -23282,8 +23861,8 @@ class LoadControlEventStatusEnum(MatterIntEnum): kFailed = 0x0C # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 13, class Bitmaps: @@ -23834,8 +24413,8 @@ class FutureMessagePreferenceEnum(MatterIntEnum): kBanned = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class MessagePriorityEnum(MatterIntEnum): @@ -23845,8 +24424,8 @@ class MessagePriorityEnum(MatterIntEnum): kCritical = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class Bitmaps: @@ -24184,8 +24763,8 @@ class AdjustmentCauseEnum(MatterIntEnum): kGridOptimization = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class CauseEnum(MatterIntEnum): @@ -24196,8 +24775,8 @@ class CauseEnum(MatterIntEnum): kCancelled = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class CostTypeEnum(MatterIntEnum): @@ -24207,8 +24786,8 @@ class CostTypeEnum(MatterIntEnum): kTemperature = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class ESAStateEnum(MatterIntEnum): @@ -24219,8 +24798,8 @@ class ESAStateEnum(MatterIntEnum): kPaused = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class ESATypeEnum(MatterIntEnum): @@ -24241,8 +24820,8 @@ class ESATypeEnum(MatterIntEnum): kOther = 0xFF # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 14, class ForecastUpdateReasonEnum(MatterIntEnum): @@ -24251,8 +24830,8 @@ class ForecastUpdateReasonEnum(MatterIntEnum): kGridOptimization = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class OptOutStateEnum(MatterIntEnum): @@ -24262,8 +24841,8 @@ class OptOutStateEnum(MatterIntEnum): kOptOut = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class PowerAdjustReasonEnum(MatterIntEnum): @@ -24272,8 +24851,8 @@ class PowerAdjustReasonEnum(MatterIntEnum): kGridOptimizationAdjustment = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class Bitmaps: @@ -24951,8 +25530,8 @@ class EnergyTransferStoppedReasonEnum(MatterIntEnum): kOther = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class FaultStateEnum(MatterIntEnum): @@ -24975,8 +25554,8 @@ class FaultStateEnum(MatterIntEnum): kOther = 0xFF # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 16, class StateEnum(MatterIntEnum): @@ -24989,8 +25568,8 @@ class StateEnum(MatterIntEnum): kFault = 0x06 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 7, class SupplyStateEnum(MatterIntEnum): @@ -24999,11 +25578,12 @@ class SupplyStateEnum(MatterIntEnum): kDischargingEnabled = 0x02 kDisabledError = 0x03 kDisabledDiagnostics = 0x04 + kEnabled = 0x05 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. - kUnknownEnumValue = 5, + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 6, class Bitmaps: class Feature(IntFlag): @@ -25731,11 +26311,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="sessionID", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="state", Tag=1, Type=EnergyEvse.Enums.StateEnum), ClusterObjectFieldDescriptor(Label="maximumCurrent", Tag=2, Type=int), + ClusterObjectFieldDescriptor(Label="maximumDischargeCurrent", Tag=3, Type=typing.Optional[int]), ]) sessionID: 'uint' = 0 state: 'EnergyEvse.Enums.StateEnum' = 0 maximumCurrent: 'int' = 0 + maximumDischargeCurrent: 'typing.Optional[int]' = None @dataclass class EnergyTransferStopped(ClusterEvent): @@ -25755,12 +26337,14 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="state", Tag=1, Type=EnergyEvse.Enums.StateEnum), ClusterObjectFieldDescriptor(Label="reason", Tag=2, Type=EnergyEvse.Enums.EnergyTransferStoppedReasonEnum), ClusterObjectFieldDescriptor(Label="energyTransferred", Tag=4, Type=int), + ClusterObjectFieldDescriptor(Label="energyDischarged", Tag=5, Type=typing.Optional[int]), ]) sessionID: 'uint' = 0 state: 'EnergyEvse.Enums.StateEnum' = 0 reason: 'EnergyEvse.Enums.EnergyTransferStoppedReasonEnum' = 0 energyTransferred: 'int' = 0 + energyDischarged: 'typing.Optional[int]' = None @dataclass class Fault(ClusterEvent): @@ -25848,8 +26432,8 @@ class EnergyPriorityEnum(MatterIntEnum): kWaterConsumption = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class Bitmaps: @@ -26485,6 +27069,278 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'uint' = 0 +@dataclass +class WaterHeaterMode(Cluster): + id: typing.ClassVar[int] = 0x0000009E + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="supportedModes", Tag=0x00000000, Type=typing.List[WaterHeaterMode.Structs.ModeOptionStruct]), + ClusterObjectFieldDescriptor(Label="currentMode", Tag=0x00000001, Type=uint), + ClusterObjectFieldDescriptor(Label="startUpMode", Tag=0x00000002, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="onMode", Tag=0x00000003, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="featureMap", Tag=0x0000FFFC, Type=uint), + ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), + ]) + + supportedModes: 'typing.List[WaterHeaterMode.Structs.ModeOptionStruct]' = None + currentMode: 'uint' = None + startUpMode: 'typing.Union[None, Nullable, uint]' = None + onMode: 'typing.Union[None, Nullable, uint]' = None + generatedCommandList: 'typing.List[uint]' = None + acceptedCommandList: 'typing.List[uint]' = None + eventList: 'typing.List[uint]' = None + attributeList: 'typing.List[uint]' = None + featureMap: 'uint' = None + clusterRevision: 'uint' = None + + class Enums: + class ModeTag(MatterIntEnum): + kOff = 0x4000 + kManual = 0x4001 + kTimed = 0x4002 + # kUnknownEnumValue intentionally not defined. This enum never goes + # through DataModel::Decode, likely because it is a part of a derived + # cluster. As a result having kUnknownEnumValue in this enum is error + # prone, and was removed. See + # src/app/common/templates/config-data.yaml. + + class Bitmaps: + class Feature(IntFlag): + kOnOff = 0x1 + + class Structs: + @dataclass + class ModeTagStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="mfgCode", Tag=0, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="value", Tag=1, Type=uint), + ]) + + mfgCode: 'typing.Optional[uint]' = None + value: 'uint' = 0 + + @dataclass + class ModeOptionStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="label", Tag=0, Type=str), + ClusterObjectFieldDescriptor(Label="mode", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="modeTags", Tag=2, Type=typing.List[WaterHeaterMode.Structs.ModeTagStruct]), + ]) + + label: 'str' = "" + mode: 'uint' = 0 + modeTags: 'typing.List[WaterHeaterMode.Structs.ModeTagStruct]' = field(default_factory=lambda: []) + + class Commands: + @dataclass + class ChangeToMode(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x0000009E + command_id: typing.ClassVar[int] = 0x00000000 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = 'ChangeToModeResponse' + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="newMode", Tag=0, Type=uint), + ]) + + newMode: 'uint' = 0 + + @dataclass + class ChangeToModeResponse(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x0000009E + command_id: typing.ClassVar[int] = 0x00000001 + is_client: typing.ClassVar[bool] = False + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="status", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="statusText", Tag=1, Type=typing.Optional[str]), + ]) + + status: 'uint' = 0 + statusText: 'typing.Optional[str]' = None + + class Attributes: + @dataclass + class SupportedModes(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009E + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[WaterHeaterMode.Structs.ModeOptionStruct]) + + value: 'typing.List[WaterHeaterMode.Structs.ModeOptionStruct]' = field(default_factory=lambda: []) + + @dataclass + class CurrentMode(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009E + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000001 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class StartUpMode(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009E + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000002 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, uint]) + + value: 'typing.Union[None, Nullable, uint]' = None + + @dataclass + class OnMode(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009E + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000003 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, uint]) + + value: 'typing.Union[None, Nullable, uint]' = None + + @dataclass + class GeneratedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009E + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF8 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AcceptedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009E + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF9 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class EventList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009E + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFA + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AttributeList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009E + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFB + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class FeatureMap(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009E + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFC + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class ClusterRevision(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0000009E + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFD + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass class DeviceEnergyManagementMode(Cluster): id: typing.ClassVar[int] = 0x0000009F @@ -26883,8 +27739,8 @@ class AlarmCodeEnum(MatterIntEnum): kForcedUser = 0x08 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class CredentialRuleEnum(MatterIntEnum): @@ -26893,8 +27749,8 @@ class CredentialRuleEnum(MatterIntEnum): kTri = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class CredentialTypeEnum(MatterIntEnum): @@ -26909,8 +27765,8 @@ class CredentialTypeEnum(MatterIntEnum): kAliroNonEvictableEndpointKey = 0x08 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 9, class DataOperationTypeEnum(MatterIntEnum): @@ -26919,8 +27775,8 @@ class DataOperationTypeEnum(MatterIntEnum): kModify = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class DlLockState(MatterIntEnum): @@ -26930,8 +27786,8 @@ class DlLockState(MatterIntEnum): kUnlatched = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class DlLockType(MatterIntEnum): @@ -26949,8 +27805,8 @@ class DlLockType(MatterIntEnum): kEurocylinder = 0x0B # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 12, class DlStatus(MatterIntEnum): @@ -26963,8 +27819,8 @@ class DlStatus(MatterIntEnum): kNotFound = 0x8B # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class DoorLockOperationEventCode(MatterIntEnum): @@ -26985,8 +27841,8 @@ class DoorLockOperationEventCode(MatterIntEnum): kManualUnlock = 0x0E # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 15, class DoorLockProgrammingEventCode(MatterIntEnum): @@ -26999,8 +27855,8 @@ class DoorLockProgrammingEventCode(MatterIntEnum): kIdDeleted = 0x06 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 7, class DoorLockSetPinOrIdStatus(MatterIntEnum): @@ -27010,8 +27866,8 @@ class DoorLockSetPinOrIdStatus(MatterIntEnum): kDuplicateCodeError = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class DoorLockUserStatus(MatterIntEnum): @@ -27021,8 +27877,8 @@ class DoorLockUserStatus(MatterIntEnum): kNotSupported = 0xFF # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class DoorLockUserType(MatterIntEnum): @@ -27034,8 +27890,8 @@ class DoorLockUserType(MatterIntEnum): kNotSupported = 0xFF # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class DoorStateEnum(MatterIntEnum): @@ -27047,8 +27903,8 @@ class DoorStateEnum(MatterIntEnum): kDoorAjar = 0x05 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 6, class LockDataTypeEnum(MatterIntEnum): @@ -27068,8 +27924,8 @@ class LockDataTypeEnum(MatterIntEnum): kAliroNonEvictableEndpointKey = 0x0D # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 14, class LockOperationTypeEnum(MatterIntEnum): @@ -27080,8 +27936,8 @@ class LockOperationTypeEnum(MatterIntEnum): kUnlatch = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class OperatingModeEnum(MatterIntEnum): @@ -27092,8 +27948,8 @@ class OperatingModeEnum(MatterIntEnum): kPassage = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class OperationErrorEnum(MatterIntEnum): @@ -27104,8 +27960,8 @@ class OperationErrorEnum(MatterIntEnum): kInsufficientBattery = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class OperationSourceEnum(MatterIntEnum): @@ -27122,8 +27978,8 @@ class OperationSourceEnum(MatterIntEnum): kAliro = 0x0A # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 11, class UserStatusEnum(MatterIntEnum): @@ -27132,8 +27988,8 @@ class UserStatusEnum(MatterIntEnum): kOccupiedDisabled = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class UserTypeEnum(MatterIntEnum): @@ -27149,8 +28005,8 @@ class UserTypeEnum(MatterIntEnum): kRemoteOnlyUser = 0x09 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 10, class Bitmaps: @@ -28932,8 +29788,8 @@ class EndProductType(MatterIntEnum): kUnknown = 0xFF # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 24, class Type(MatterIntEnum): @@ -28950,8 +29806,8 @@ class Type(MatterIntEnum): kUnknown = 0xFF # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 10, class Bitmaps: @@ -30025,8 +30881,8 @@ class AreaTypeTag(MatterIntEnum): kWorkshop = 0x5E # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 95, class FloorSurfaceTag(MatterIntEnum): @@ -30056,8 +30912,8 @@ class FloorSurfaceTag(MatterIntEnum): kVinyl = 0x17 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 24, class LandmarkTag(MatterIntEnum): @@ -30114,8 +30970,8 @@ class LandmarkTag(MatterIntEnum): kWineCooler = 0x32 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 51, class OperationalStatusEnum(MatterIntEnum): @@ -30125,8 +30981,8 @@ class OperationalStatusEnum(MatterIntEnum): kCompleted = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class PositionTag(MatterIntEnum): @@ -30146,8 +31002,8 @@ class PositionTag(MatterIntEnum): kBehind = 0x0D # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 14, class SelectLocationsStatus(MatterIntEnum): @@ -30158,8 +31014,8 @@ class SelectLocationsStatus(MatterIntEnum): kInvalidSet = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class SkipCurrentLocationStatus(MatterIntEnum): @@ -30168,8 +31024,8 @@ class SkipCurrentLocationStatus(MatterIntEnum): kInvalidInMode = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class Bitmaps: @@ -30179,7 +31035,7 @@ class Feature(IntFlag): class Structs: @dataclass - class HomeLocationStruct(ClusterObject): + class LocationDescriptorStruct(ClusterObject): @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( @@ -30199,13 +31055,13 @@ class LocationInfoStruct(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="locationInfo", Tag=0, Type=typing.Union[Nullable, ServiceArea.Structs.HomeLocationStruct]), + ClusterObjectFieldDescriptor(Label="locationInfo", Tag=0, Type=typing.Union[Nullable, ServiceArea.Structs.LocationDescriptorStruct]), ClusterObjectFieldDescriptor(Label="landmarkTag", Tag=1, Type=typing.Union[Nullable, ServiceArea.Enums.LandmarkTag]), ClusterObjectFieldDescriptor(Label="positionTag", Tag=2, Type=typing.Union[Nullable, ServiceArea.Enums.PositionTag]), ClusterObjectFieldDescriptor(Label="surfaceTag", Tag=3, Type=typing.Union[Nullable, ServiceArea.Enums.FloorSurfaceTag]), ]) - locationInfo: 'typing.Union[Nullable, ServiceArea.Structs.HomeLocationStruct]' = NullValue + locationInfo: 'typing.Union[Nullable, ServiceArea.Structs.LocationDescriptorStruct]' = NullValue landmarkTag: 'typing.Union[Nullable, ServiceArea.Enums.LandmarkTag]' = NullValue positionTag: 'typing.Union[Nullable, ServiceArea.Enums.PositionTag]' = NullValue surfaceTag: 'typing.Union[Nullable, ServiceArea.Enums.FloorSurfaceTag]' = NullValue @@ -30594,8 +31450,8 @@ class ControlModeEnum(MatterIntEnum): kAutomatic = 0x07 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class OperationModeEnum(MatterIntEnum): @@ -30605,8 +31461,8 @@ class OperationModeEnum(MatterIntEnum): kLocal = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class Bitmaps: @@ -31437,9 +32293,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="presets", Tag=0x00000050, Type=typing.Optional[typing.List[Thermostat.Structs.PresetStruct]]), ClusterObjectFieldDescriptor(Label="schedules", Tag=0x00000051, Type=typing.Optional[typing.List[Thermostat.Structs.ScheduleStruct]]), ClusterObjectFieldDescriptor(Label="presetsSchedulesEditable", Tag=0x00000052, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="temperatureSetpointHoldPolicy", Tag=0x00000053, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="setpointHoldExpiryTimestamp", Tag=0x00000054, Type=typing.Union[None, Nullable, uint]), - ClusterObjectFieldDescriptor(Label="queuedPreset", Tag=0x00000055, Type=typing.Union[None, Nullable, Thermostat.Structs.QueuedPresetStruct]), + ClusterObjectFieldDescriptor(Label="setpointHoldExpiryTimestamp", Tag=0x00000053, Type=typing.Union[None, Nullable, uint]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), @@ -31508,9 +32362,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: presets: 'typing.Optional[typing.List[Thermostat.Structs.PresetStruct]]' = None schedules: 'typing.Optional[typing.List[Thermostat.Structs.ScheduleStruct]]' = None presetsSchedulesEditable: 'typing.Optional[bool]' = None - temperatureSetpointHoldPolicy: 'typing.Optional[uint]' = None setpointHoldExpiryTimestamp: 'typing.Union[None, Nullable, uint]' = None - queuedPreset: 'typing.Union[None, Nullable, Thermostat.Structs.QueuedPresetStruct]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None eventList: 'typing.List[uint]' = None @@ -31523,8 +32375,8 @@ class ACCapacityFormatEnum(MatterIntEnum): kBTUh = 0x00 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 1, class ACCompressorTypeEnum(MatterIntEnum): @@ -31534,8 +32386,8 @@ class ACCompressorTypeEnum(MatterIntEnum): kT3 = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class ACLouverPositionEnum(MatterIntEnum): @@ -31546,8 +32398,8 @@ class ACLouverPositionEnum(MatterIntEnum): kThreeQuarters = 0x05 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 0, class ACRefrigerantTypeEnum(MatterIntEnum): @@ -31557,8 +32409,8 @@ class ACRefrigerantTypeEnum(MatterIntEnum): kR407c = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class ACTypeEnum(MatterIntEnum): @@ -31569,8 +32421,8 @@ class ACTypeEnum(MatterIntEnum): kHeatPumpInverter = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class ControlSequenceOfOperationEnum(MatterIntEnum): @@ -31582,8 +32434,8 @@ class ControlSequenceOfOperationEnum(MatterIntEnum): kCoolingAndHeatingWithReheat = 0x05 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 6, class PresetScenarioEnum(MatterIntEnum): @@ -31593,11 +32445,12 @@ class PresetScenarioEnum(MatterIntEnum): kSleep = 0x03 kWake = 0x04 kVacation = 0x05 - kUserDefined = 0x06 + kGoingToSleep = 0x06 + kUserDefined = 0xFE # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 7, class SetpointChangeSourceEnum(MatterIntEnum): @@ -31606,8 +32459,8 @@ class SetpointChangeSourceEnum(MatterIntEnum): kExternal = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class SetpointRaiseLowerModeEnum(MatterIntEnum): @@ -31616,8 +32469,8 @@ class SetpointRaiseLowerModeEnum(MatterIntEnum): kBoth = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class StartOfWeekEnum(MatterIntEnum): @@ -31630,8 +32483,8 @@ class StartOfWeekEnum(MatterIntEnum): kSaturday = 0x06 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 7, class SystemModeEnum(MatterIntEnum): @@ -31646,8 +32499,8 @@ class SystemModeEnum(MatterIntEnum): kSleep = 0x09 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class TemperatureSetpointHoldEnum(MatterIntEnum): @@ -31655,8 +32508,8 @@ class TemperatureSetpointHoldEnum(MatterIntEnum): kSetpointHoldOn = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class ThermostatRunningModeEnum(MatterIntEnum): @@ -31665,8 +32518,8 @@ class ThermostatRunningModeEnum(MatterIntEnum): kHeat = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 1, class Bitmaps: @@ -31688,7 +32541,6 @@ class Feature(IntFlag): kMatterScheduleConfiguration = 0x80 kPresets = 0x100 kSetpoints = 0x200 - kQueuedPresetsSupported = 0x400 class HVACSystemTypeBitmap(IntFlag): kCoolingStage = 0x3 @@ -31739,10 +32591,6 @@ class ScheduleTypeFeaturesBitmap(IntFlag): kSupportsNames = 0x4 kSupportsOff = 0x8 - class TemperatureSetpointHoldPolicyBitmap(IntFlag): - kHoldDurationElapsed = 0x1 - kHoldDurationElapsedOrPresetChanged = 0x2 - class Structs: @dataclass class ScheduleTransitionStruct(ClusterObject): @@ -31822,19 +32670,6 @@ def descriptor(cls) -> ClusterObjectDescriptor: numberOfPresets: 'uint' = 0 presetTypeFeatures: 'uint' = 0 - @dataclass - class QueuedPresetStruct(ClusterObject): - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields=[ - ClusterObjectFieldDescriptor(Label="presetHandle", Tag=0, Type=typing.Union[Nullable, bytes]), - ClusterObjectFieldDescriptor(Label="transitionTimestamp", Tag=1, Type=typing.Union[Nullable, uint]), - ]) - - presetHandle: 'typing.Union[Nullable, bytes]' = NullValue - transitionTimestamp: 'typing.Union[Nullable, uint]' = NullValue - @dataclass class ScheduleTypeStruct(ClusterObject): @ChipUtility.classproperty @@ -31987,11 +32822,9 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="presetHandle", Tag=0, Type=bytes), - ClusterObjectFieldDescriptor(Label="delayMinutes", Tag=1, Type=typing.Optional[uint]), ]) presetHandle: 'bytes' = b"" - delayMinutes: 'typing.Optional[uint]' = None @dataclass class StartPresetsSchedulesEditRequest(ClusterCommand): @@ -32035,35 +32868,6 @@ def descriptor(cls) -> ClusterObjectDescriptor: Fields=[ ]) - @dataclass - class CancelSetActivePresetRequest(ClusterCommand): - cluster_id: typing.ClassVar[int] = 0x00000201 - command_id: typing.ClassVar[int] = 0x0000000A - is_client: typing.ClassVar[bool] = True - response_type: typing.ClassVar[str] = None - - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields=[ - ]) - - @dataclass - class SetTemperatureSetpointHoldPolicy(ClusterCommand): - cluster_id: typing.ClassVar[int] = 0x00000201 - command_id: typing.ClassVar[int] = 0x0000000B - is_client: typing.ClassVar[bool] = True - response_type: typing.ClassVar[str] = None - - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields=[ - ClusterObjectFieldDescriptor(Label="temperatureSetpointHoldPolicy", Tag=0, Type=uint), - ]) - - temperatureSetpointHoldPolicy: 'uint' = 0 - class Attributes: @dataclass class LocalTemperature(ClusterAttributeDescriptor): @@ -33025,22 +33829,6 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Optional[bool]' = None - @dataclass - class TemperatureSetpointHoldPolicy(ClusterAttributeDescriptor): - @ChipUtility.classproperty - def cluster_id(cls) -> int: - return 0x00000201 - - @ChipUtility.classproperty - def attribute_id(cls) -> int: - return 0x00000053 - - @ChipUtility.classproperty - def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) - - value: 'typing.Optional[uint]' = None - @dataclass class SetpointHoldExpiryTimestamp(ClusterAttributeDescriptor): @ChipUtility.classproperty @@ -33049,7 +33837,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00000054 + return 0x00000053 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -33057,22 +33845,6 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Union[None, Nullable, uint]' = None - @dataclass - class QueuedPreset(ClusterAttributeDescriptor): - @ChipUtility.classproperty - def cluster_id(cls) -> int: - return 0x00000201 - - @ChipUtility.classproperty - def attribute_id(cls) -> int: - return 0x00000055 - - @ChipUtility.classproperty - def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, Thermostat.Structs.QueuedPresetStruct]) - - value: 'typing.Union[None, Nullable, Thermostat.Structs.QueuedPresetStruct]' = None - @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): @ChipUtility.classproperty @@ -33223,8 +33995,8 @@ class AirflowDirectionEnum(MatterIntEnum): kReverse = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class FanModeEnum(MatterIntEnum): @@ -33237,8 +34009,8 @@ class FanModeEnum(MatterIntEnum): kSmart = 0x06 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 7, class FanModeSequenceEnum(MatterIntEnum): @@ -33250,8 +34022,8 @@ class FanModeSequenceEnum(MatterIntEnum): kOffHigh = 0x05 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 6, class StepDirectionEnum(MatterIntEnum): @@ -33259,8 +34031,8 @@ class StepDirectionEnum(MatterIntEnum): kDecrease = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class Bitmaps: @@ -33631,8 +34403,8 @@ class KeypadLockoutEnum(MatterIntEnum): kLockout5 = 0x05 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 6, class ScheduleProgrammingVisibilityEnum(MatterIntEnum): @@ -33640,8 +34412,8 @@ class ScheduleProgrammingVisibilityEnum(MatterIntEnum): kScheduleProgrammingDenied = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class TemperatureDisplayModeEnum(MatterIntEnum): @@ -33649,8 +34421,8 @@ class TemperatureDisplayModeEnum(MatterIntEnum): kFahrenheit = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class Attributes: @@ -33933,8 +34705,8 @@ class ColorLoopAction(MatterIntEnum): kActivateFromEnhancedCurrentHue = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class ColorLoopDirection(MatterIntEnum): @@ -33942,8 +34714,8 @@ class ColorLoopDirection(MatterIntEnum): kIncrementHue = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class ColorMode(MatterIntEnum): @@ -33952,8 +34724,8 @@ class ColorMode(MatterIntEnum): kColorTemperature = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class HueDirection(MatterIntEnum): @@ -33963,8 +34735,8 @@ class HueDirection(MatterIntEnum): kDown = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class HueMoveMode(MatterIntEnum): @@ -33973,8 +34745,8 @@ class HueMoveMode(MatterIntEnum): kDown = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class HueStepMode(MatterIntEnum): @@ -33982,8 +34754,8 @@ class HueStepMode(MatterIntEnum): kDown = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 0, class SaturationMoveMode(MatterIntEnum): @@ -33992,8 +34764,8 @@ class SaturationMoveMode(MatterIntEnum): kDown = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class SaturationStepMode(MatterIntEnum): @@ -34001,8 +34773,8 @@ class SaturationStepMode(MatterIntEnum): kDown = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 0, class Bitmaps: @@ -35825,8 +36597,8 @@ class LightSensorTypeEnum(MatterIntEnum): kCmos = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class Attributes: @@ -36932,8 +37704,8 @@ class OccupancySensorTypeEnum(MatterIntEnum): kPhysicalContact = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class Bitmaps: @@ -37347,8 +38119,8 @@ class LevelValueEnum(MatterIntEnum): kCritical = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class MeasurementMediumEnum(MatterIntEnum): @@ -37357,8 +38129,8 @@ class MeasurementMediumEnum(MatterIntEnum): kSoil = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class MeasurementUnitEnum(MatterIntEnum): @@ -37372,8 +38144,8 @@ class MeasurementUnitEnum(MatterIntEnum): kBqm3 = 0x07 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 8, class Bitmaps: @@ -37713,8 +38485,8 @@ class LevelValueEnum(MatterIntEnum): kCritical = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class MeasurementMediumEnum(MatterIntEnum): @@ -37723,8 +38495,8 @@ class MeasurementMediumEnum(MatterIntEnum): kSoil = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class MeasurementUnitEnum(MatterIntEnum): @@ -37738,8 +38510,8 @@ class MeasurementUnitEnum(MatterIntEnum): kBqm3 = 0x07 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 8, class Bitmaps: @@ -38079,8 +38851,8 @@ class LevelValueEnum(MatterIntEnum): kCritical = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class MeasurementMediumEnum(MatterIntEnum): @@ -38089,8 +38861,8 @@ class MeasurementMediumEnum(MatterIntEnum): kSoil = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class MeasurementUnitEnum(MatterIntEnum): @@ -38104,8 +38876,8 @@ class MeasurementUnitEnum(MatterIntEnum): kBqm3 = 0x07 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 8, class Bitmaps: @@ -38445,8 +39217,8 @@ class LevelValueEnum(MatterIntEnum): kCritical = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class MeasurementMediumEnum(MatterIntEnum): @@ -38455,8 +39227,8 @@ class MeasurementMediumEnum(MatterIntEnum): kSoil = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class MeasurementUnitEnum(MatterIntEnum): @@ -38470,8 +39242,8 @@ class MeasurementUnitEnum(MatterIntEnum): kBqm3 = 0x07 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 8, class Bitmaps: @@ -38811,8 +39583,8 @@ class LevelValueEnum(MatterIntEnum): kCritical = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class MeasurementMediumEnum(MatterIntEnum): @@ -38821,8 +39593,8 @@ class MeasurementMediumEnum(MatterIntEnum): kSoil = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class MeasurementUnitEnum(MatterIntEnum): @@ -38836,8 +39608,8 @@ class MeasurementUnitEnum(MatterIntEnum): kBqm3 = 0x07 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 8, class Bitmaps: @@ -39177,8 +39949,8 @@ class LevelValueEnum(MatterIntEnum): kCritical = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class MeasurementMediumEnum(MatterIntEnum): @@ -39187,8 +39959,8 @@ class MeasurementMediumEnum(MatterIntEnum): kSoil = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class MeasurementUnitEnum(MatterIntEnum): @@ -39202,8 +39974,8 @@ class MeasurementUnitEnum(MatterIntEnum): kBqm3 = 0x07 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 8, class Bitmaps: @@ -39543,8 +40315,8 @@ class LevelValueEnum(MatterIntEnum): kCritical = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class MeasurementMediumEnum(MatterIntEnum): @@ -39553,8 +40325,8 @@ class MeasurementMediumEnum(MatterIntEnum): kSoil = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class MeasurementUnitEnum(MatterIntEnum): @@ -39568,8 +40340,8 @@ class MeasurementUnitEnum(MatterIntEnum): kBqm3 = 0x07 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 8, class Bitmaps: @@ -39909,8 +40681,8 @@ class LevelValueEnum(MatterIntEnum): kCritical = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class MeasurementMediumEnum(MatterIntEnum): @@ -39919,8 +40691,8 @@ class MeasurementMediumEnum(MatterIntEnum): kSoil = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class MeasurementUnitEnum(MatterIntEnum): @@ -39934,8 +40706,8 @@ class MeasurementUnitEnum(MatterIntEnum): kBqm3 = 0x07 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 8, class Bitmaps: @@ -40275,8 +41047,8 @@ class LevelValueEnum(MatterIntEnum): kCritical = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class MeasurementMediumEnum(MatterIntEnum): @@ -40285,8 +41057,8 @@ class MeasurementMediumEnum(MatterIntEnum): kSoil = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class MeasurementUnitEnum(MatterIntEnum): @@ -40300,8 +41072,8 @@ class MeasurementUnitEnum(MatterIntEnum): kBqm3 = 0x07 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 8, class Bitmaps: @@ -40641,8 +41413,8 @@ class LevelValueEnum(MatterIntEnum): kCritical = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class MeasurementMediumEnum(MatterIntEnum): @@ -40651,8 +41423,8 @@ class MeasurementMediumEnum(MatterIntEnum): kSoil = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class MeasurementUnitEnum(MatterIntEnum): @@ -40666,8 +41438,8 @@ class MeasurementUnitEnum(MatterIntEnum): kBqm3 = 0x07 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 8, class Bitmaps: @@ -40961,7 +41733,8 @@ class WiFiNetworkManagement(Cluster): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="ssid", Tag=0x00000001, Type=typing.Union[Nullable, bytes]), + ClusterObjectFieldDescriptor(Label="ssid", Tag=0x00000000, Type=typing.Union[Nullable, bytes]), + ClusterObjectFieldDescriptor(Label="passphraseSurrogate", Tag=0x00000001, Type=typing.Union[Nullable, uint]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), @@ -40971,6 +41744,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ]) ssid: 'typing.Union[Nullable, bytes]' = None + passphraseSurrogate: 'typing.Union[Nullable, uint]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None eventList: 'typing.List[uint]' = None @@ -41017,7 +41791,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00000001 + return 0x00000000 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -41025,6 +41799,22 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Union[Nullable, bytes]' = NullValue + @dataclass + class PassphraseSurrogate(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000451 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000001 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, uint]) + + value: 'typing.Union[Nullable, uint]' = NullValue + @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): @ChipUtility.classproperty @@ -41134,7 +41924,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="borderAgentID", Tag=0x00000001, Type=bytes), ClusterObjectFieldDescriptor(Label="threadVersion", Tag=0x00000002, Type=uint), ClusterObjectFieldDescriptor(Label="interfaceEnabled", Tag=0x00000003, Type=bool), - ClusterObjectFieldDescriptor(Label="activeDatasetTimestamp", Tag=0x00000005, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="activeDatasetTimestamp", Tag=0x00000004, Type=typing.Union[Nullable, uint]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), @@ -41189,7 +41979,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class DatasetResponse(ClusterCommand): cluster_id: typing.ClassVar[int] = 0x00000452 - command_id: typing.ClassVar[int] = 0x00000003 + command_id: typing.ClassVar[int] = 0x00000002 is_client: typing.ClassVar[bool] = False response_type: typing.ClassVar[str] = None @@ -41205,7 +41995,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class SetActiveDatasetRequest(ClusterCommand): cluster_id: typing.ClassVar[int] = 0x00000452 - command_id: typing.ClassVar[int] = 0x00000004 + command_id: typing.ClassVar[int] = 0x00000003 is_client: typing.ClassVar[bool] = True response_type: typing.ClassVar[str] = None @@ -41223,7 +42013,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: @dataclass class SetPendingDatasetRequest(ClusterCommand): cluster_id: typing.ClassVar[int] = 0x00000452 - command_id: typing.ClassVar[int] = 0x00000005 + command_id: typing.ClassVar[int] = 0x00000004 is_client: typing.ClassVar[bool] = True response_type: typing.ClassVar[str] = None @@ -41309,7 +42099,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00000005 + return 0x00000004 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -41422,7 +42212,7 @@ class ThreadNetworkDirectory(Cluster): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="preferredExtendedPanID", Tag=0x00000000, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="preferredExtendedPanID", Tag=0x00000000, Type=typing.Union[Nullable, bytes]), ClusterObjectFieldDescriptor(Label="threadNetworks", Tag=0x00000001, Type=typing.List[ThreadNetworkDirectory.Structs.ThreadNetworkStruct]), ClusterObjectFieldDescriptor(Label="threadNetworkTableSize", Tag=0x00000002, Type=uint), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), @@ -41433,7 +42223,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), ]) - preferredExtendedPanID: 'typing.Union[Nullable, uint]' = None + preferredExtendedPanID: 'typing.Union[Nullable, bytes]' = None threadNetworks: 'typing.List[ThreadNetworkDirectory.Structs.ThreadNetworkStruct]' = None threadNetworkTableSize: 'uint' = None generatedCommandList: 'typing.List[uint]' = None @@ -41450,14 +42240,16 @@ class ThreadNetworkStruct(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="extendedPanID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="extendedPanID", Tag=0, Type=bytes), ClusterObjectFieldDescriptor(Label="networkName", Tag=1, Type=str), ClusterObjectFieldDescriptor(Label="channel", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="activeTimestamp", Tag=3, Type=uint), ]) - extendedPanID: 'uint' = 0 + extendedPanID: 'bytes' = b"" networkName: 'str' = "" channel: 'uint' = 0 + activeTimestamp: 'uint' = 0 class Commands: @dataclass @@ -41491,14 +42283,14 @@ class RemoveNetwork(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="extendedPanID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="extendedPanID", Tag=0, Type=bytes), ]) @ChipUtility.classproperty def must_use_timed_invoke(cls) -> bool: return True - extendedPanID: 'uint' = 0 + extendedPanID: 'bytes' = b"" @dataclass class GetOperationalDataset(ClusterCommand): @@ -41511,14 +42303,10 @@ class GetOperationalDataset(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="extendedPanID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="extendedPanID", Tag=0, Type=bytes), ]) - @ChipUtility.classproperty - def must_use_timed_invoke(cls) -> bool: - return True - - extendedPanID: 'uint' = 0 + extendedPanID: 'bytes' = b"" @dataclass class OperationalDatasetResponse(ClusterCommand): @@ -41549,9 +42337,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, uint]) + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, bytes]) - value: 'typing.Union[Nullable, uint]' = NullValue + value: 'typing.Union[Nullable, bytes]' = NullValue @dataclass class ThreadNetworks(ClusterAttributeDescriptor): @@ -41681,26 +42469,6 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'uint' = 0 - class Events: - @dataclass - class NetworkChanged(ClusterEvent): - @ChipUtility.classproperty - def cluster_id(cls) -> int: - return 0x00000453 - - @ChipUtility.classproperty - def event_id(cls) -> int: - return 0x00000000 - - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields=[ - ClusterObjectFieldDescriptor(Label="extendedPanID", Tag=0, Type=uint), - ]) - - extendedPanID: 'uint' = 0 - @dataclass class WakeOnLan(Cluster): @@ -41896,16 +42664,16 @@ class ChannelTypeEnum(MatterIntEnum): kOtt = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class LineupInfoTypeEnum(MatterIntEnum): kMso = 0x00 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 1, class StatusEnum(MatterIntEnum): @@ -41914,8 +42682,8 @@ class StatusEnum(MatterIntEnum): kNoMatches = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class Bitmaps: @@ -42437,8 +43205,8 @@ class StatusEnum(MatterIntEnum): kNotAllowed = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class Structs: @@ -42713,8 +43481,8 @@ class CharacteristicEnum(MatterIntEnum): kKaraoke = 0x11 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 18, class PlaybackStateEnum(MatterIntEnum): @@ -42724,8 +43492,8 @@ class PlaybackStateEnum(MatterIntEnum): kBuffering = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class StatusEnum(MatterIntEnum): @@ -42737,8 +43505,8 @@ class StatusEnum(MatterIntEnum): kSeekOutOfRange = 0x05 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 6, class Bitmaps: @@ -43366,8 +44134,8 @@ class InputTypeEnum(MatterIntEnum): kOther = 0x0B # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 12, class Bitmaps: @@ -43831,8 +44599,8 @@ class CECKeyCodeEnum(MatterIntEnum): kData = 0x76 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 14, class StatusEnum(MatterIntEnum): @@ -43841,8 +44609,8 @@ class StatusEnum(MatterIntEnum): kInvalidKeyInCurrentState = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class Bitmaps: @@ -44031,8 +44799,8 @@ class CharacteristicEnum(MatterIntEnum): kKaraoke = 0x11 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 18, class MetricTypeEnum(MatterIntEnum): @@ -44040,8 +44808,8 @@ class MetricTypeEnum(MatterIntEnum): kPercentage = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class ParameterEnum(MatterIntEnum): @@ -44064,8 +44832,8 @@ class ParameterEnum(MatterIntEnum): kAny = 0x10 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 17, class StatusEnum(MatterIntEnum): @@ -44076,8 +44844,8 @@ class StatusEnum(MatterIntEnum): kAudioTrackNotAvailable = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class Bitmaps: @@ -44443,8 +45211,8 @@ class OutputTypeEnum(MatterIntEnum): kOther = 0x05 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 6, class Bitmaps: @@ -44666,8 +45434,8 @@ class StatusEnum(MatterIntEnum): kSystemBusy = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class Bitmaps: @@ -44947,8 +45715,8 @@ class ApplicationStatusEnum(MatterIntEnum): kActiveVisibleNotFocus = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class Structs: @@ -45912,8 +46680,8 @@ class StatusEnum(MatterIntEnum): kUnexpectedData = 0x01 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 2, class Commands: @@ -46053,6 +46821,593 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'uint' = 0 +@dataclass +class EcosystemInformation(Cluster): + id: typing.ClassVar[int] = 0x00000750 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="removedOn", Tag=0x00000000, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="deviceDirectory", Tag=0x00000001, Type=typing.List[EcosystemInformation.Structs.EcosystemDeviceStruct]), + ClusterObjectFieldDescriptor(Label="locationDirectory", Tag=0x00000002, Type=typing.List[EcosystemInformation.Structs.EcosystemLocationStruct]), + ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="featureMap", Tag=0x0000FFFC, Type=uint), + ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), + ]) + + removedOn: 'typing.Union[None, Nullable, uint]' = None + deviceDirectory: 'typing.List[EcosystemInformation.Structs.EcosystemDeviceStruct]' = None + locationDirectory: 'typing.List[EcosystemInformation.Structs.EcosystemLocationStruct]' = None + generatedCommandList: 'typing.List[uint]' = None + acceptedCommandList: 'typing.List[uint]' = None + eventList: 'typing.List[uint]' = None + attributeList: 'typing.List[uint]' = None + featureMap: 'uint' = None + clusterRevision: 'uint' = None + + class Enums: + class AreaTypeTag(MatterIntEnum): + kAisle = 0x00 + kAttic = 0x01 + kBackDoor = 0x02 + kBackYard = 0x03 + kBalcony = 0x04 + kBallroom = 0x05 + kBathroom = 0x06 + kBedroom = 0x07 + kBorder = 0x08 + kBoxroom = 0x09 + kBreakfastRoom = 0x0A + kCarport = 0x0B + kCellar = 0x0C + kCloakroom = 0x0D + kCloset = 0x0E + kConservatory = 0x0F + kCorridor = 0x10 + kCraftRoom = 0x11 + kCupboard = 0x12 + kDeck = 0x13 + kDen = 0x14 + kDining = 0x15 + kDrawingRoom = 0x16 + kDressingRoom = 0x17 + kDriveway = 0x18 + kElevator = 0x19 + kEnsuite = 0x1A + kEntrance = 0x1B + kEntryway = 0x1C + kFamilyRoom = 0x1D + kFoyer = 0x1E + kFrontDoor = 0x1F + kFrontYard = 0x20 + kGameRoom = 0x21 + kGarage = 0x22 + kGarageDoor = 0x23 + kGarden = 0x24 + kGardenDoor = 0x25 + kGuestBathroom = 0x26 + kGuestBedroom = 0x27 + kGuestRestroom = 0x28 + kGuestRoom = 0x29 + kGym = 0x2A + kHallway = 0x2B + kHearthRoom = 0x2C + kKidsRoom = 0x2D + kKidsBedroom = 0x2E + kKitchen = 0x2F + kLarder = 0x30 + kLaundryRoom = 0x31 + kLawn = 0x32 + kLibrary = 0x33 + kLivingRoom = 0x34 + kLounge = 0x35 + kMediaTvRoom = 0x36 + kMudRoom = 0x37 + kMusicRoom = 0x38 + kNursery = 0x39 + kOffice = 0x3A + kOutdoorKitchen = 0x3B + kOutside = 0x3C + kPantry = 0x3D + kParkingLot = 0x3E + kParlor = 0x3F + kPatio = 0x40 + kPlayRoom = 0x41 + kPoolRoom = 0x42 + kPorch = 0x43 + kPrimaryBathroom = 0x44 + kPrimaryBedroom = 0x45 + kRamp = 0x46 + kReceptionRoom = 0x47 + kRecreationRoom = 0x48 + kRestroom = 0x49 + kRoof = 0x4A + kSauna = 0x4B + kScullery = 0x4C + kSewingRoom = 0x4D + kShed = 0x4E + kSideDoor = 0x4F + kSideYard = 0x50 + kSittingRoom = 0x51 + kSnug = 0x52 + kSpa = 0x53 + kStaircase = 0x54 + kSteamRoom = 0x55 + kStorageRoom = 0x56 + kStudio = 0x57 + kStudy = 0x58 + kSunRoom = 0x59 + kSwimmingPool = 0x5A + kTerrace = 0x5B + kUtilityRoom = 0x5C + kWard = 0x5D + kWorkshop = 0x5E + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 95, + + class Structs: + @dataclass + class LocationDescriptorStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="locationName", Tag=0, Type=str), + ClusterObjectFieldDescriptor(Label="floorNumber", Tag=1, Type=typing.Union[Nullable, int]), + ClusterObjectFieldDescriptor(Label="areaType", Tag=2, Type=typing.Union[Nullable, EcosystemInformation.Enums.AreaTypeTag]), + ]) + + locationName: 'str' = "" + floorNumber: 'typing.Union[Nullable, int]' = NullValue + areaType: 'typing.Union[Nullable, EcosystemInformation.Enums.AreaTypeTag]' = NullValue + + @dataclass + class EcosystemLocationStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="uniqueLocationID", Tag=0, Type=str), + ClusterObjectFieldDescriptor(Label="locationDescriptor", Tag=1, Type=EcosystemInformation.Structs.LocationDescriptorStruct), + ClusterObjectFieldDescriptor(Label="locationDescriptorLastEdit", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=254, Type=uint), + ]) + + uniqueLocationID: 'str' = "" + locationDescriptor: 'EcosystemInformation.Structs.LocationDescriptorStruct' = field(default_factory=lambda: EcosystemInformation.Structs.LocationDescriptorStruct()) + locationDescriptorLastEdit: 'uint' = 0 + fabricIndex: 'uint' = 0 + + @dataclass + class DeviceTypeStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="deviceType", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="revision", Tag=1, Type=uint), + ]) + + deviceType: 'uint' = 0 + revision: 'uint' = 0 + + @dataclass + class EcosystemDeviceStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="deviceName", Tag=0, Type=typing.Optional[str]), + ClusterObjectFieldDescriptor(Label="deviceNameLastEdit", Tag=1, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="bridgedEndpoint", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="originalEndpoint", Tag=3, Type=uint), + ClusterObjectFieldDescriptor(Label="deviceTypes", Tag=4, Type=typing.List[EcosystemInformation.Structs.DeviceTypeStruct]), + ClusterObjectFieldDescriptor(Label="uniqueLocationIDs", Tag=5, Type=typing.List[str]), + ClusterObjectFieldDescriptor(Label="uniqueLocationIDsLastEdit", Tag=6, Type=uint), + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=254, Type=uint), + ]) + + deviceName: 'typing.Optional[str]' = None + deviceNameLastEdit: 'typing.Optional[uint]' = None + bridgedEndpoint: 'uint' = 0 + originalEndpoint: 'uint' = 0 + deviceTypes: 'typing.List[EcosystemInformation.Structs.DeviceTypeStruct]' = field(default_factory=lambda: []) + uniqueLocationIDs: 'typing.List[str]' = field(default_factory=lambda: []) + uniqueLocationIDsLastEdit: 'uint' = 0 + fabricIndex: 'uint' = 0 + + class Attributes: + @dataclass + class RemovedOn(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000750 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, uint]) + + value: 'typing.Union[None, Nullable, uint]' = None + + @dataclass + class DeviceDirectory(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000750 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000001 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[EcosystemInformation.Structs.EcosystemDeviceStruct]) + + value: 'typing.List[EcosystemInformation.Structs.EcosystemDeviceStruct]' = field(default_factory=lambda: []) + + @dataclass + class LocationDirectory(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000750 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000002 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[EcosystemInformation.Structs.EcosystemLocationStruct]) + + value: 'typing.List[EcosystemInformation.Structs.EcosystemLocationStruct]' = field(default_factory=lambda: []) + + @dataclass + class GeneratedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000750 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF8 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AcceptedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000750 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF9 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class EventList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000750 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFA + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AttributeList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000750 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFB + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class FeatureMap(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000750 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFC + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class ClusterRevision(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000750 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFD + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + +@dataclass +class CommissionerControl(Cluster): + id: typing.ClassVar[int] = 0x00000751 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="supportedDeviceCategories", Tag=0x00000000, Type=uint), + ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="featureMap", Tag=0x0000FFFC, Type=uint), + ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), + ]) + + supportedDeviceCategories: 'uint' = None + generatedCommandList: 'typing.List[uint]' = None + acceptedCommandList: 'typing.List[uint]' = None + eventList: 'typing.List[uint]' = None + attributeList: 'typing.List[uint]' = None + featureMap: 'uint' = None + clusterRevision: 'uint' = None + + class Bitmaps: + class SupportedDeviceCategoryBitmap(IntFlag): + kFabricSynchronization = 0x1 + + class Commands: + @dataclass + class RequestCommissioningApproval(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000751 + command_id: typing.ClassVar[int] = 0x00000000 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="requestId", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="vendorId", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="productId", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="label", Tag=3, Type=typing.Optional[str]), + ]) + + requestId: 'uint' = 0 + vendorId: 'uint' = 0 + productId: 'uint' = 0 + label: 'typing.Optional[str]' = None + + @dataclass + class CommissionNode(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000751 + command_id: typing.ClassVar[int] = 0x00000001 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = 'ReverseOpenCommissioningWindow' + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="requestId", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="responseTimeoutSeconds", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="ipAddress", Tag=2, Type=typing.Optional[bytes]), + ClusterObjectFieldDescriptor(Label="port", Tag=3, Type=typing.Optional[uint]), + ]) + + requestId: 'uint' = 0 + responseTimeoutSeconds: 'uint' = 0 + ipAddress: 'typing.Optional[bytes]' = None + port: 'typing.Optional[uint]' = None + + @dataclass + class ReverseOpenCommissioningWindow(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x00000751 + command_id: typing.ClassVar[int] = 0x00000002 + is_client: typing.ClassVar[bool] = False + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="commissioningTimeout", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="PAKEPasscodeVerifier", Tag=1, Type=bytes), + ClusterObjectFieldDescriptor(Label="discriminator", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="iterations", Tag=3, Type=uint), + ClusterObjectFieldDescriptor(Label="salt", Tag=4, Type=bytes), + ]) + + commissioningTimeout: 'uint' = 0 + PAKEPasscodeVerifier: 'bytes' = b"" + discriminator: 'uint' = 0 + iterations: 'uint' = 0 + salt: 'bytes' = b"" + + class Attributes: + @dataclass + class SupportedDeviceCategories(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000751 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class GeneratedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000751 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF8 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AcceptedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000751 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF9 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class EventList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000751 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFA + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AttributeList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000751 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFB + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class FeatureMap(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000751 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFC + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class ClusterRevision(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000751 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFD + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + class Events: + @dataclass + class CommissioningRequestResult(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000751 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="requestId", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="clientNodeId", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="statusCode", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=254, Type=uint), + ]) + + requestId: 'uint' = 0 + clientNodeId: 'uint' = 0 + statusCode: 'uint' = 0 + fabricIndex: 'uint' = 0 + + @dataclass class ElectricalMeasurement(Cluster): id: typing.ClassVar[int] = 0x00000B04 @@ -48757,8 +50112,8 @@ class SimpleEnum(MatterIntEnum): kValueC = 0x03 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 4, class Bitmaps: @@ -51235,8 +52590,8 @@ class FaultType(MatterIntEnum): kCertFault = 0x04 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, class Commands: diff --git a/src/controller/python/chip/clusters/__init__.py b/src/controller/python/chip/clusters/__init__.py index 473e3f70a4f8d9..779b8c6fe5a4bb 100644 --- a/src/controller/python/chip/clusters/__init__.py +++ b/src/controller/python/chip/clusters/__init__.py @@ -27,33 +27,34 @@ ApplicationBasic, ApplicationLauncher, AudioOutput, BallastConfiguration, BarrierControl, BasicInformation, BinaryInputBasic, Binding, BooleanState, BooleanStateConfiguration, BridgedDeviceBasicInformation, CarbonDioxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurement, Channel, ColorControl, - ContentControl, ContentLauncher, DemandResponseLoadControl, Descriptor, DeviceEnergyManagement, - DeviceEnergyManagementMode, DiagnosticLogs, DishwasherAlarm, DishwasherMode, DoorLock, - ElectricalEnergyMeasurement, ElectricalMeasurement, ElectricalPowerMeasurement, EnergyEvse, EnergyEvseMode, - EnergyPreference, EthernetNetworkDiagnostics, FanControl, FaultInjection, FixedLabel, FlowMeasurement, - FormaldehydeConcentrationMeasurement, GeneralCommissioning, GeneralDiagnostics, GroupKeyManagement, Groups, - HepaFilterMonitoring, IcdManagement, Identify, IlluminanceMeasurement, KeypadInput, LaundryDryerControls, - LaundryWasherControls, LaundryWasherMode, LevelControl, LocalizationConfiguration, LowPower, MediaInput, - MediaPlayback, MicrowaveOvenControl, MicrowaveOvenMode, ModeSelect, NetworkCommissioning, - NitrogenDioxideConcentrationMeasurement, OccupancySensing, OnOff, OnOffSwitchConfiguration, - OperationalCredentials, OperationalState, OtaSoftwareUpdateProvider, OtaSoftwareUpdateRequestor, - OvenCavityOperationalState, OvenMode, OzoneConcentrationMeasurement, Pm1ConcentrationMeasurement, - Pm10ConcentrationMeasurement, Pm25ConcentrationMeasurement, PowerSource, PowerSourceConfiguration, - PowerTopology, PressureMeasurement, ProxyConfiguration, ProxyDiscovery, ProxyValid, PulseWidthModulation, - PumpConfigurationAndControl, RadonConcentrationMeasurement, RefrigeratorAlarm, + CommissionerControl, ContentControl, ContentLauncher, DemandResponseLoadControl, Descriptor, + DeviceEnergyManagement, DeviceEnergyManagementMode, DiagnosticLogs, DishwasherAlarm, DishwasherMode, DoorLock, + EcosystemInformation, ElectricalEnergyMeasurement, ElectricalMeasurement, ElectricalPowerMeasurement, + EnergyEvse, EnergyEvseMode, EnergyPreference, EthernetNetworkDiagnostics, FanControl, FaultInjection, + FixedLabel, FlowMeasurement, FormaldehydeConcentrationMeasurement, GeneralCommissioning, GeneralDiagnostics, + GroupKeyManagement, Groups, HepaFilterMonitoring, IcdManagement, Identify, IlluminanceMeasurement, + KeypadInput, LaundryDryerControls, LaundryWasherControls, LaundryWasherMode, LevelControl, + LocalizationConfiguration, LowPower, MediaInput, MediaPlayback, MicrowaveOvenControl, MicrowaveOvenMode, + ModeSelect, NetworkCommissioning, NitrogenDioxideConcentrationMeasurement, OccupancySensing, OnOff, + OnOffSwitchConfiguration, OperationalCredentials, OperationalState, OtaSoftwareUpdateProvider, + OtaSoftwareUpdateRequestor, OvenCavityOperationalState, OvenMode, OzoneConcentrationMeasurement, + Pm1ConcentrationMeasurement, Pm10ConcentrationMeasurement, Pm25ConcentrationMeasurement, PowerSource, + PowerSourceConfiguration, PowerTopology, PressureMeasurement, ProxyConfiguration, ProxyDiscovery, ProxyValid, + PulseWidthModulation, PumpConfigurationAndControl, RadonConcentrationMeasurement, RefrigeratorAlarm, RefrigeratorAndTemperatureControlledCabinetMode, RelativeHumidityMeasurement, RvcCleanMode, RvcOperationalState, RvcRunMode, ScenesManagement, SmokeCoAlarm, SoftwareDiagnostics, Switch, TargetNavigator, TemperatureControl, TemperatureMeasurement, Thermostat, ThermostatUserInterfaceConfiguration, - ThreadBorderRouterManagement, ThreadNetworkDiagnostics, TimeFormatLocalization, TimeSynchronization, - TotalVolatileOrganicCompoundsConcentrationMeasurement, UnitLocalization, UnitTesting, UserLabel, - ValveConfigurationAndControl, WakeOnLan, WiFiNetworkDiagnostics, WindowCovering) + ThreadBorderRouterManagement, ThreadNetworkDiagnostics, ThreadNetworkDirectory, TimeFormatLocalization, + TimeSynchronization, TotalVolatileOrganicCompoundsConcentrationMeasurement, UnitLocalization, UnitTesting, + UserLabel, ValveConfigurationAndControl, WakeOnLan, WaterHeaterManagement, WaterHeaterMode, + WiFiNetworkDiagnostics, WindowCovering) __all__ = [Attribute, CHIPClusters, Command, AccessControl, AccountLogin, Actions, ActivatedCarbonFilterMonitoring, AdministratorCommissioning, AirQuality, ApplicationBasic, ApplicationLauncher, AudioOutput, BallastConfiguration, BarrierControl, BasicInformation, BinaryInputBasic, Binding, BooleanState, BooleanStateConfiguration, BridgedDeviceBasicInformation, CarbonDioxideConcentrationMeasurement, - CarbonMonoxideConcentrationMeasurement, Channel, - ColorControl, ContentControl, ContentLauncher, DemandResponseLoadControl, Descriptor, DeviceEnergyManagementMode, DeviceEnergyManagement, DeviceEnergyManagementMode, DiagnosticLogs, DishwasherAlarm, DishwasherMode, - DoorLock, ElectricalEnergyMeasurement, ElectricalMeasurement, ElectricalPowerMeasurement, EnergyEvse, EnergyEvseMode, EnergyPreference, + CarbonMonoxideConcentrationMeasurement, Channel, ColorControl, CommissionerControl, + ContentControl, ContentLauncher, DemandResponseLoadControl, Descriptor, DeviceEnergyManagementMode, DeviceEnergyManagement, DeviceEnergyManagementMode, DiagnosticLogs, DishwasherAlarm, DishwasherMode, + DoorLock, EcosystemInformation, ElectricalEnergyMeasurement, ElectricalMeasurement, ElectricalPowerMeasurement, EnergyEvse, EnergyEvseMode, EnergyPreference, EthernetNetworkDiagnostics, FanControl, FaultInjection, FixedLabel, FlowMeasurement, FormaldehydeConcentrationMeasurement, GeneralCommissioning, GeneralDiagnostics, GroupKeyManagement, Groups, HepaFilterMonitoring, IcdManagement, Identify, IlluminanceMeasurement, KeypadInput, LaundryDryerControls, @@ -67,6 +68,6 @@ RefrigeratorAlarm, RefrigeratorAndTemperatureControlledCabinetMode, RelativeHumidityMeasurement, RvcCleanMode, RvcOperationalState, RvcRunMode, ScenesManagement, SmokeCoAlarm, SoftwareDiagnostics, Switch, TargetNavigator, TemperatureControl, TemperatureMeasurement, Thermostat, ThermostatUserInterfaceConfiguration, - ThreadBorderRouterManagement, ThreadNetworkDiagnostics, TimeFormatLocalization, TimeSynchronization, + ThreadBorderRouterManagement, ThreadNetworkDiagnostics, ThreadNetworkDirectory, TimeFormatLocalization, TimeSynchronization, TotalVolatileOrganicCompoundsConcentrationMeasurement, UnitLocalization, - UnitTesting, UserLabel, ValveConfigurationAndControl, WakeOnLan, WiFiNetworkDiagnostics, WindowCovering] + UnitTesting, UserLabel, ValveConfigurationAndControl, WakeOnLan, WaterHeaterManagement, WaterHeaterMode, WiFiNetworkDiagnostics, WindowCovering] diff --git a/src/controller/python/chip/clusters/attribute.cpp b/src/controller/python/chip/clusters/attribute.cpp index 7c5b2c906ab69c..421284a0ae795b 100644 --- a/src/controller/python/chip/clusters/attribute.cpp +++ b/src/controller/python/chip/clusters/attribute.cpp @@ -145,18 +145,20 @@ class ReadClientCallback : public ReadClient::Callback void OnSubscriptionEstablished(SubscriptionId aSubscriptionId) override { + // Only enable auto resubscribe if the subscription is established successfully. + mAutoResubscribeNeeded = mAutoResubscribe; gOnSubscriptionEstablishedCallback(mAppContext, aSubscriptionId); } CHIP_ERROR OnResubscriptionNeeded(ReadClient * apReadClient, CHIP_ERROR aTerminationCause) override { - if (mAutoResubscribe) + if (mAutoResubscribeNeeded) { ReturnErrorOnFailure(ReadClient::Callback::OnResubscriptionNeeded(apReadClient, aTerminationCause)); } gOnResubscriptionAttemptedCallback(mAppContext, ToPyChipError(aTerminationCause), apReadClient->ComputeTimeTillNextSubscription()); - if (mAutoResubscribe) + if (mAutoResubscribeNeeded) { return CHIP_NO_ERROR; } @@ -242,7 +244,8 @@ class ReadClientCallback : public ReadClient::Callback PyObject * mAppContext; std::unique_ptr mReadClient; - bool mAutoResubscribe = true; + bool mAutoResubscribe = true; + bool mAutoResubscribeNeeded = false; }; extern "C" { diff --git a/src/controller/python/chip/clusters/command.cpp b/src/controller/python/chip/clusters/command.cpp index d65766b7989d4d..037c848f96fae0 100644 --- a/src/controller/python/chip/clusters/command.cpp +++ b/src/controller/python/chip/clusters/command.cpp @@ -203,10 +203,13 @@ PyChipError SendBatchCommandsInternal(void * appContext, DeviceProxy * device, u CHIP_ERROR err = CHIP_NO_ERROR; bool testOnlySuppressTimedRequestMessage = false; - uint16_t * testOnlyCommandRefsOverride = nullptr; +#if CONFIG_BUILD_FOR_HOST_UNIT_TEST + uint16_t * testOnlyCommandRefsOverride = nullptr; +#endif VerifyOrReturnError(device->GetSecureSession().HasValue(), ToPyChipError(CHIP_ERROR_MISSING_SECURE_SESSION)); +#if CONFIG_BUILD_FOR_HOST_UNIT_TEST // Test only override validation checks and setup if (testOnlyOverrides != nullptr) { @@ -228,6 +231,7 @@ PyChipError SendBatchCommandsInternal(void * appContext, DeviceProxy * device, u config.SetRemoteMaxPathsPerInvoke(testOnlyOverrides->overrideRemoteMaxPathsPerInvoke); } else +#endif { auto remoteSessionParameters = device->GetSecureSession().Value()->GetRemoteSessionParameters(); config.SetRemoteMaxPathsPerInvoke(remoteSessionParameters.GetMaxPathsPerInvoke()); @@ -273,6 +277,7 @@ PyChipError SendBatchCommandsInternal(void * appContext, DeviceProxy * device, u Optional timedRequestTimeout = timedRequestTimeoutMs != 0 ? Optional(timedRequestTimeoutMs) : Optional::Missing(); CommandSender::FinishCommandParameters finishCommandParams(timedRequestTimeout); +#if CONFIG_BUILD_FOR_HOST_UNIT_TEST if (testOnlyCommandRefsOverride != nullptr) { finishCommandParams.commandRef.SetValue(testOnlyCommandRefsOverride[i]); @@ -291,6 +296,7 @@ PyChipError SendBatchCommandsInternal(void * appContext, DeviceProxy * device, u callback->AddCommandRefToIndexLookup(finishCommandParams.commandRef.Value(), i); } else +#endif { SuccessOrExit(err = callback->AddCommandRefToIndexLookup(finishCommandParams.commandRef.Value(), i)); } @@ -300,12 +306,14 @@ PyChipError SendBatchCommandsInternal(void * appContext, DeviceProxy * device, u Optional interactionTimeout = interactionTimeoutMs != 0 ? MakeOptional(System::Clock::Milliseconds32(interactionTimeoutMs)) : Optional::Missing(); +#if CONFIG_BUILD_FOR_HOST_UNIT_TEST if (testOnlySuppressTimedRequestMessage) { SuccessOrExit(err = sender->TestOnlyCommandSenderTimedRequestFlagWithNoTimedInvoke(device->GetSecureSession().Value(), interactionTimeout)); } else +#endif { SuccessOrExit(err = sender->SendCommandRequest(device->GetSecureSession().Value(), interactionTimeout)); } diff --git a/src/controller/python/chip/discovery/__init__.py b/src/controller/python/chip/discovery/__init__.py index a25fb490007824..c818b5e22358ac 100644 --- a/src/controller/python/chip/discovery/__init__.py +++ b/src/controller/python/chip/discovery/__init__.py @@ -92,7 +92,8 @@ class CommissionableNode(): mrpRetryIntervalIdle: int = None mrpRetryIntervalActive: int = None mrpRetryActiveThreshold: int = None - supportsTcp: bool = None + supportsTcpClient: bool = None + supportsTcpServer: bool = None isICDOperatingAsLIT: bool = None addresses: List[str] = None rotatingId: Optional[str] = None diff --git a/src/controller/python/chip/storage/__init__.py b/src/controller/python/chip/storage/__init__.py index 385efca6be1c8c..20432dcd01870b 100644 --- a/src/controller/python/chip/storage/__init__.py +++ b/src/controller/python/chip/storage/__init__.py @@ -29,6 +29,8 @@ import chip.exceptions import chip.native +LOGGER = logging.getLogger(__name__) + _SyncSetKeyValueCbFunct = CFUNCTYPE( None, py_object, c_char_p, POINTER(c_char), c_uint16) _SyncGetKeyValueCbFunct = CFUNCTYPE( @@ -91,9 +93,6 @@ class PersistentStorage: Object must be resident before the Matter stack starts up and last past its shutdown. ''' - @classmethod - def logger(cls): - return logging.getLogger('PersistentStorage') def __init__(self, path: str = None, jsonData: Dict = None): ''' Initializes the object with either a path to a JSON file that contains the configuration OR @@ -109,9 +108,9 @@ def __init__(self, path: str = None, jsonData: Dict = None): raise ValueError("Can't provide both a valid path and jsonData") if (path is not None): - self.logger().warn(f"Initializing persistent storage from file: {path}") + LOGGER.info(f"Initializing persistent storage from file: {path}") else: - self.logger().warn("Initializing persistent storage from dict") + LOGGER.info("Initializing persistent storage from dict") self._handle = chip.native.GetLibraryHandle() self._isActive = True @@ -125,24 +124,24 @@ def __init__(self, path: str = None, jsonData: Dict = None): self._file.seek(0) if (size != 0): - self.logger().warn(f"Loading configuration from {path}...") + LOGGER.info(f"Loading configuration from {path}...") self._jsonData = json.load(self._file) else: self._jsonData = {} except Exception as ex: - logging.error(ex) - logging.critical(f"Could not load configuration from {path} - resetting configuration...") + LOGGER.error(ex) + LOGGER.critical(f"Could not load configuration from {path} - resetting configuration...") self._jsonData = {} else: self._jsonData = jsonData if ('sdk-config' not in self._jsonData): - logging.warn("No valid SDK configuration present - clearing out configuration") + LOGGER.warn("No valid SDK configuration present - clearing out configuration") self._jsonData['sdk-config'] = {} if ('repl-config' not in self._jsonData): - logging.warn("No valid REPL configuration present - clearing out configuration") + LOGGER.warn("No valid REPL configuration present - clearing out configuration") self._jsonData['repl-config'] = {} # Clear out the file so that calling 'Commit' will re-open the file at that time in write mode. @@ -166,7 +165,6 @@ def Commit(self): ''' Commits the cached JSON configuration to file (if one was provided in the constructor). Otherwise, this is a no-op. ''' - self.logger().info("Committing...") if (self._path is None): return @@ -175,9 +173,8 @@ def Commit(self): try: self._file = open(self._path, 'w') except Exception as ex: - logging.warn( - f"Could not open {self._path} for writing configuration. Error:") - logging.warn(ex) + LOGGER.error( + f"Could not open {self._path} for writing configuration. Error: {ex}") return self._file.seek(0) @@ -188,7 +185,7 @@ def Commit(self): def SetReplKey(self, key: str, value): ''' Set a REPL key to a specific value. Creates the key if one doesn't exist already. ''' - self.logger().info(f"SetReplKey: {key} = {value}") + LOGGER.debug(f"SetReplKey: {key} = {value}") if (key is None or key == ''): raise ValueError("Invalid Key") @@ -212,7 +209,7 @@ def GetReplKey(self, key: str): def SetSdkKey(self, key: str, value: bytes): ''' Set an SDK key to a specific value. Creates the key if one doesn't exist already. ''' - self.logger().info(f"SetSdkKey: {key} = {value}") + LOGGER.debug(f"SetSdkKey: {key} = {value}") if (key is None or key == ''): raise ValueError("Invalid Key") @@ -236,7 +233,7 @@ def GetSdkKey(self, key: str): def DeleteSdkKey(self, key: str): ''' Deletes an SDK key if one exists. ''' - self.logger().info(f"DeleteSdkKey: {key}") + LOGGER.debug(f"DeleteSdkKey: {key}") del (self._jsonData['sdk-config'][key]) self.Commit() diff --git a/src/controller/python/chip/yaml/runner.py b/src/controller/python/chip/yaml/runner.py index ce1eaf84fcfbb9..494e6f964aa33f 100644 --- a/src/controller/python/chip/yaml/runner.py +++ b/src/controller/python/chip/yaml/runner.py @@ -31,14 +31,11 @@ from chip.exceptions import ChipStackError from chip.yaml.data_model_lookup import DataModelLookup from chip.yaml.errors import ActionCreationError, UnexpectedActionCreationError -from matter_yamltests.pseudo_clusters.clusters.delay_commands import DelayCommands -from matter_yamltests.pseudo_clusters.clusters.log_commands import LogCommands -from matter_yamltests.pseudo_clusters.clusters.system_commands import SystemCommands -from matter_yamltests.pseudo_clusters.pseudo_clusters import PseudoClusters +from matter_yamltests.pseudo_clusters.pseudo_clusters import get_default_pseudo_clusters from .data_model_lookup import PreDefinedDataModelLookup -_PSEUDO_CLUSTERS = PseudoClusters([DelayCommands(), LogCommands(), SystemCommands()]) +_PSEUDO_CLUSTERS = get_default_pseudo_clusters() logger = logging.getLogger('YamlParser') @@ -129,8 +126,8 @@ def __init__(self, test_step): raise ActionCreationError(f'Default cluster {test_step.cluster} {test_step.command}, not supported') async def run_action(self, dev_ctrl: ChipDeviceController) -> _ActionResult: - _ = await _PSEUDO_CLUSTERS.execute(self._test_step) - return _ActionResult(status=_ActionStatus.SUCCESS, response=None) + response = await _PSEUDO_CLUSTERS.execute(self._test_step) + return _ActionResult(status=_ActionStatus.SUCCESS, response=response[0]) class InvokeAction(BaseAction): @@ -884,8 +881,12 @@ def decode(self, result: _ActionResult): response = result.response decoded_response = {} + if isinstance(response, dict): + return response + if isinstance(response, chip.interaction_model.InteractionModelError): decoded_response['error'] = stringcase.snakecase(response.status.name).upper() + decoded_response['clusterError'] = response.clusterStatus return decoded_response if isinstance(response, chip.interaction_model.Status): @@ -912,7 +913,8 @@ def decode(self, result: _ActionResult): 'mrpRetryIntervalIdle': response.mrpRetryIntervalIdle, 'mrpRetryIntervalActive': response.mrpRetryIntervalActive, 'mrpRetryActiveThreshold': response.mrpRetryActiveThreshold, - 'supportsTcp': response.supportsTcp, + 'supportsTcpClient': response.supportsTcpClient, + 'supportsTcpServer': response.supportsTcpServer, 'isICDOperatingAsLIT': response.isICDOperatingAsLIT, 'addresses': response.addresses, 'rotatingId': response.rotatingId, @@ -939,12 +941,13 @@ def decode(self, result: _ActionResult): cluster_id = event.Header.ClusterId cluster_name = self._test_spec_definition.get_cluster_name(cluster_id) event_id = event.Header.EventId + event_number = event.Header.EventNumber event_name = self._test_spec_definition.get_event_name(cluster_id, event_id) event_definition = self._test_spec_definition.get_event_by_name(cluster_name, event_name) is_fabric_scoped = bool(event_definition.is_fabric_sensitive) decoded_event = Converter.from_data_model_to_test_definition( self._test_spec_definition, cluster_name, event_definition.fields, event.Data, is_fabric_scoped) - decoded_response.append({'value': decoded_event}) + decoded_response.append({'value': decoded_event, 'eventNumber': event_number}) return decoded_response if isinstance(response, ChipStackError): diff --git a/src/controller/python/templates/partials/bitmap_def.zapt b/src/controller/python/templates/partials/bitmap_def.zapt new file mode 100644 index 00000000000000..00f34968519dc8 --- /dev/null +++ b/src/controller/python/templates/partials/bitmap_def.zapt @@ -0,0 +1,4 @@ + class {{asType label}}(IntFlag): +{{#zcl_bitmap_items}} + k{{asUpperCamelCase label}} = {{asHex mask}} +{{/zcl_bitmap_items}} diff --git a/src/controller/python/templates/partials/enum_def.zapt b/src/controller/python/templates/partials/enum_def.zapt new file mode 100644 index 00000000000000..d8063739e159ef --- /dev/null +++ b/src/controller/python/templates/partials/enum_def.zapt @@ -0,0 +1,18 @@ +{{! Takes cluster (possibly "Globals") as argument, already upper-camel-cased. }} + class {{asType label}}(MatterIntEnum): +{{#zcl_enum_items}} + k{{asUpperCamelCase label}} = {{asHex value 2}} +{{/zcl_enum_items}} +{{#unless (isInConfigList (concat cluster "::" label) "EnumsNotUsedAsTypeInXML")}} + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = {{first_unused_enum_value mode="first_unused"}}, +{{else}} + # kUnknownEnumValue intentionally not defined. This enum never goes + # through DataModel::Decode, likely because it is a part of a derived + # cluster. As a result having kUnknownEnumValue in this enum is error + # prone, and was removed. See + # src/app/common/templates/config-data.yaml. +{{/unless}} diff --git a/src/controller/python/templates/partials/struct_def.zapt b/src/controller/python/templates/partials/struct_def.zapt new file mode 100644 index 00000000000000..86e643be7d8863 --- /dev/null +++ b/src/controller/python/templates/partials/struct_def.zapt @@ -0,0 +1,15 @@ +{{! Takes cluster (possibly "Globals") as argument, already upper-camel-cased. }} + @dataclass + class {{asUpperCamelCase name}}(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + {{#zcl_struct_items}} + ClusterObjectFieldDescriptor(Label="{{ asLowerCamelCase label }}", Tag={{ fieldIdentifier }}, Type={{zapTypeToPythonClusterObjectType type ns=../cluster}}), + {{/zcl_struct_items}} + ]) + + {{#zcl_struct_items}} + {{ asLowerCamelCase label }}: '{{zapTypeToPythonClusterObjectType type ns=../cluster}}' = {{getPythonFieldDefault type ns=../cluster}} + {{/zcl_struct_items}} diff --git a/src/controller/python/templates/python-cluster-Objects-py.zapt b/src/controller/python/templates/python-cluster-Objects-py.zapt index b5f8ed80ca03d9..0aa05721e69a16 100644 --- a/src/controller/python/templates/python-cluster-Objects-py.zapt +++ b/src/controller/python/templates/python-cluster-Objects-py.zapt @@ -19,6 +19,33 @@ from .ClusterObjects import (Cluster, ClusterAttributeDescriptor, ClusterCommand ClusterObjectDescriptor, ClusterObjectFieldDescriptor) from .Types import Nullable, NullValue +class Globals: + class Enums: +{{#zcl_enums}} +{{#if has_no_clusters}} +{{> enum_def cluster="Globals"}} + +{{/if}} +{{/zcl_enums}} + class Bitmaps: +{{#zcl_bitmaps}} +{{#if has_no_clusters}} +{{! Work around https://github.com/project-chip/zap/issues/1370 and manually filter out built-in bitmap types. }} +{{#if_is_atomic label}} +{{else}} +{{> bitmap_def }} + +{{/if_is_atomic}} +{{/if}} +{{/zcl_bitmaps}} + class Structs: +{{#zcl_structs}} +{{#if has_no_clusters}} +{{> struct_def cluster="Globals"}} + +{{/if}} +{{/zcl_structs}} + {{#zcl_clusters}} @dataclass @@ -50,23 +77,7 @@ class {{asUpperCamelCase name}}(Cluster): {{#first}} class Enums: {{/first}} - class {{asType label}}(MatterIntEnum): -{{#zcl_enum_items}} - k{{asUpperCamelCase label}} = {{asHex value 2}} -{{/zcl_enum_items}} -{{#unless (isInConfigList (concat (asUpperCamelCase ../name) "::" label) "EnumsNotUsedAsTypeInXML")}} - # All received enum values that are not listed above will be mapped - # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. - kUnknownEnumValue = {{first_unused_enum_value mode="first_unused"}}, -{{else}} - # kUnknownEnumValue intentionally not defined. This enum never goes - # through DataModel::Decode, likely because it is a part of a derived - # cluster. As a result having kUnknownEnumValue in this enum is error - # prone, and was removed. See - # src/app/common/templates/config-data.yaml. -{{/unless}} +{{> enum_def cluster=(asUpperCamelCase ../name)}} {{#last}} {{/last}} @@ -75,30 +86,14 @@ class {{asUpperCamelCase name}}(Cluster): {{#first}} class Bitmaps: {{/first}} - class {{asType label}}(IntFlag): -{{#zcl_bitmap_items}} - k{{asUpperCamelCase label}} = {{asHex mask}} -{{/zcl_bitmap_items}} +{{> bitmap_def }} {{/zcl_bitmaps}} {{#zcl_structs}} {{#first}} class Structs: {{/first}} - @dataclass - class {{asUpperCamelCase name}}(ClusterObject): - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields=[ - {{#zcl_struct_items}} - ClusterObjectFieldDescriptor(Label="{{ asLowerCamelCase label }}", Tag={{ fieldIdentifier }}, Type={{zapTypeToPythonClusterObjectType type ns=(asUpperCamelCase parent.parent.name)}}), - {{/zcl_struct_items}} - ]) - - {{#zcl_struct_items}} - {{ asLowerCamelCase label }}: '{{zapTypeToPythonClusterObjectType type ns=(asUpperCamelCase parent.parent.name)}}' = {{getPythonFieldDefault type ns=(asUpperCamelCase parent.parent.name)}} - {{/zcl_struct_items}} +{{> struct_def cluster=(asUpperCamelCase parent.name) }} {{/zcl_structs}} {{#zcl_commands}} diff --git a/src/controller/python/templates/templates.json b/src/controller/python/templates/templates.json index bffd9dfa2de7cc..ebe67b0f384b22 100644 --- a/src/controller/python/templates/templates.json +++ b/src/controller/python/templates/templates.json @@ -22,8 +22,16 @@ "path": "../../../../src/app/zap-templates/partials/clusters_header.zapt" }, { - "name": "cluster_header", - "path": "../../../../src/app/zap-templates/partials/cluster_header.zapt" + "name": "enum_def", + "path": "partials/enum_def.zapt" + }, + { + "name": "bitmap_def", + "path": "partials/bitmap_def.zapt" + }, + { + "name": "struct_def", + "path": "partials/struct_def.zapt" } ], "templates": [ diff --git a/src/controller/python/test/test_scripts/base.py b/src/controller/python/test/test_scripts/base.py index ca1e37a279b417..dc07e15bc2f709 100644 --- a/src/controller/python/test/test_scripts/base.py +++ b/src/controller/python/test/test_scripts/base.py @@ -184,7 +184,7 @@ def __init__(self, nodeid: int, paaTrustStorePath: str, testCommissioner: bool = keypair: p256keypair.P256Keypair = None): chip.native.Init() - self.chipStack = ChipStack('/tmp/repl_storage.json') + self.chipStack = ChipStack('/tmp/repl_storage.json', enableServerInteractions=True) self.certificateAuthorityManager = chip.CertificateAuthority.CertificateAuthorityManager(chipStack=self.chipStack) self.certificateAuthority = self.certificateAuthorityManager.NewCertificateAuthority() self.fabricAdmin = self.certificateAuthority.NewFabricAdmin(vendorId=0xFFF1, fabricId=1) @@ -1158,6 +1158,24 @@ def TestResolve(self, nodeid): self.logger.exception("Failed to resolve. {}".format(ex)) return False + async def TestTriggerTestEventHandler(self, nodeid, enable_key, event_trigger): + self.logger.info("Test trigger test event handler for device = %08x", nodeid) + try: + await self.devCtrl.SendCommand(nodeid, 0, Clusters.GeneralDiagnostics.Commands.TestEventTrigger(enableKey=enable_key, eventTrigger=event_trigger)) + return True + except Exception as ex: + self.logger.exception("Failed to trigger test event handler {}".format(ex)) + return False + + async def TestWaitForActive(self, nodeid): + self.logger.info("Test wait for device = %08x", nodeid) + try: + await self.devCtrl.WaitForActive(nodeid) + return True + except Exception as ex: + self.logger.exception("Failed to wait for active. {}".format(ex)) + return False + async def TestReadBasicAttributes(self, nodeid: int, endpoint: int): attrs = Clusters.BasicInformation.Attributes basic_cluster_attrs = { diff --git a/src/controller/python/test/test_scripts/icd_wait_for_device_test.py b/src/controller/python/test/test_scripts/icd_wait_for_device_test.py new file mode 100755 index 00000000000000..e28a76e17ac41e --- /dev/null +++ b/src/controller/python/test/test_scripts/icd_wait_for_device_test.py @@ -0,0 +1,148 @@ +#!/usr/bin/env python3 + +# +# Copyright (c) 2021 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Commissioning test. + +import asyncio +import os +import sys +from optparse import OptionParser + +from base import BaseTestHelper, FailIfNot, TestFail, TestTimeout, logger + +TEST_DISCRIMINATOR = 3840 +TEST_DISCOVERY_TYPE = 2 + +ENDPOINT_ID = 0 +LIGHTING_ENDPOINT_ID = 1 +GROUP_ID = 0 + + +async def waitForActiveAndTriggerCheckIn(test, nodeid): + coro = test.TestWaitForActive(nodeid=nodeid) + await test.TestTriggerTestEventHandler(nodeid, bytes.fromhex("00112233445566778899aabbccddeeff"), 0x0046 << 48) + return await coro + + +async def main(): + optParser = OptionParser() + optParser.add_option( + "-t", + "--timeout", + action="store", + dest="testTimeout", + default=75, + type='int', + help="The program will return with timeout after specified seconds.", + metavar="", + ) + optParser.add_option( + "-a", + "--address", + action="store", + dest="deviceAddress", + default='', + type='str', + help="Address of the device", + metavar="", + ) + optParser.add_option( + "--setup-payload", + action="store", + dest="setupPayload", + default='', + type='str', + help="Setup Payload (manual pairing code or QR code content)", + metavar="" + ) + optParser.add_option( + "--nodeid", + action="store", + dest="nodeid", + default=1, + type=int, + help="The Node ID issued to the device", + metavar="" + ) + optParser.add_option( + "--discriminator", + action="store", + dest="discriminator", + default=TEST_DISCRIMINATOR, + type=int, + help="Discriminator of the device", + metavar="" + ) + optParser.add_option( + "-p", + "--paa-trust-store-path", + action="store", + dest="paaTrustStorePath", + default='', + type='str', + help="Path that contains valid and trusted PAA Root Certificates.", + metavar="" + ) + optParser.add_option( + "--discovery-type", + action="store", + dest="discoveryType", + default=TEST_DISCOVERY_TYPE, + type=int, + help="Discovery type of commissioning. (0: networkOnly 1: networkOnlyWithoutPASEAutoRetry 2: All)", + metavar="" + ) + + (options, remainingArgs) = optParser.parse_args(sys.argv[1:]) + + timeoutTicker = TestTimeout(options.testTimeout) + timeoutTicker.start() + + test = BaseTestHelper( + nodeid=112233, paaTrustStorePath=options.paaTrustStorePath, testCommissioner=True) + + devCtrl = test.devCtrl + devCtrl.EnableICDRegistration(devCtrl.GenerateICDRegistrationParameters()) + logger.info("Testing commissioning") + FailIfNot(await test.TestCommissioning(ip=options.deviceAddress, + setuppin=20202021, + 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') + + timeoutTicker.stop() + + logger.info("Test finished") + + # TODO: Python device controller cannot be shutdown clean sometimes and will block on AsyncDNSResolverSockets shutdown. + # Call os._exit(0) to force close it. + os._exit(0) + + +if __name__ == "__main__": + try: + loop = asyncio.get_event_loop() + loop.run_until_complete(main()) + loop.close() + except Exception as ex: + logger.exception(ex) + TestFail("Exception occurred when running tests.") diff --git a/src/controller/python/test/test_scripts/mobile-device-test.py b/src/controller/python/test/test_scripts/mobile-device-test.py index 27f8e98964d7b9..79ad383ef3f2f0 100755 --- a/src/controller/python/test/test_scripts/mobile-device-test.py +++ b/src/controller/python/test/test_scripts/mobile-device-test.py @@ -19,6 +19,18 @@ # Commissioning test. +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --log-level INFO -t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + import asyncio import os diff --git a/src/controller/tests/BUILD.gn b/src/controller/tests/BUILD.gn index 1e2b15d7778beb..a1d7b9433075b7 100644 --- a/src/controller/tests/BUILD.gn +++ b/src/controller/tests/BUILD.gn @@ -31,6 +31,7 @@ chip_test_suite("tests") { test_sources += [ "TestReadChunking.cpp" ] test_sources += [ "TestWriteChunking.cpp" ] test_sources += [ "TestEventNumberCaching.cpp" ] + test_sources += [ "TestCommissioningWindowOpener.cpp" ] } cflags = [ "-Wconversion" ] @@ -39,6 +40,7 @@ chip_test_suite("tests") { "${chip_root}/src/app/common:cluster-objects", "${chip_root}/src/app/tests:helpers", "${chip_root}/src/controller", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/support:test_utils", "${chip_root}/src/messaging/tests:helpers", "${chip_root}/src/transport/raw/tests:helpers", diff --git a/src/controller/tests/TestCommissionableNodeController.cpp b/src/controller/tests/TestCommissionableNodeController.cpp index 6d9ef65db11e97..e113bc38add8f1 100644 --- a/src/controller/tests/TestCommissionableNodeController.cpp +++ b/src/controller/tests/TestCommissionableNodeController.cpp @@ -16,9 +16,10 @@ * limitations under the License. */ -#include +#include #include +#include #include using namespace chip; diff --git a/src/controller/tests/TestCommissioningWindowOpener.cpp b/src/controller/tests/TestCommissioningWindowOpener.cpp new file mode 100644 index 00000000000000..01aa42fbe8b17a --- /dev/null +++ b/src/controller/tests/TestCommissioningWindowOpener.cpp @@ -0,0 +1,192 @@ +/* + * + * 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 +#include + +using namespace chip; + +namespace { + +class MockDeviceController : public Controller::DeviceController +{ +public: + CHIP_ERROR + GetConnectedDevice(NodeId peerNodeId, Callback::Callback * onConnection, + Callback::Callback * onFailure, + TransportPayloadCapability transportPayloadCapability = TransportPayloadCapability::kMRPPayload) override + { + return CHIP_NO_ERROR; + } +}; + +// Valid crypto values from src/protocols/secure_channel/tests/TestPASESession.cpp +constexpr uint32_t sTestSpake2p01_PinCode = 20202021; +constexpr uint32_t sTestSpake2p01_IterationCount = 1000; +constexpr uint8_t sTestSpake2p01_Salt[] = { 0x53, 0x50, 0x41, 0x4B, 0x45, 0x32, 0x50, 0x20, + 0x4B, 0x65, 0x79, 0x20, 0x53, 0x61, 0x6C, 0x74 }; +constexpr Crypto::Spake2pVerifierSerialized sTestSpake2p01_SerializedVerifier = { + 0xB9, 0x61, 0x70, 0xAA, 0xE8, 0x03, 0x34, 0x68, 0x84, 0x72, 0x4F, 0xE9, 0xA3, 0xB2, 0x87, 0xC3, 0x03, 0x30, 0xC2, 0xA6, + 0x60, 0x37, 0x5D, 0x17, 0xBB, 0x20, 0x5A, 0x8C, 0xF1, 0xAE, 0xCB, 0x35, 0x04, 0x57, 0xF8, 0xAB, 0x79, 0xEE, 0x25, 0x3A, + 0xB6, 0xA8, 0xE4, 0x6B, 0xB0, 0x9E, 0x54, 0x3A, 0xE4, 0x22, 0x73, 0x6D, 0xE5, 0x01, 0xE3, 0xDB, 0x37, 0xD4, 0x41, 0xFE, + 0x34, 0x49, 0x20, 0xD0, 0x95, 0x48, 0xE4, 0xC1, 0x82, 0x40, 0x63, 0x0C, 0x4F, 0xF4, 0x91, 0x3C, 0x53, 0x51, 0x38, 0x39, + 0xB7, 0xC0, 0x7F, 0xCC, 0x06, 0x27, 0xA1, 0xB8, 0x57, 0x3A, 0x14, 0x9F, 0xCD, 0x1F, 0xA4, 0x66, 0xCF +}; + +static void OCWPasscodeCallback(void * context, NodeId deviceId, CHIP_ERROR status, SetupPayload payload) {} +static void OCWVerifierCallback(void * context, NodeId deviceId, CHIP_ERROR status) {} + +class TestCommissioningWindowOpener : public ::testing::Test +{ +public: + static void SetUpTestSuite() { ASSERT_EQ(Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { Platform::MemoryShutdown(); } + +protected: + // Initialize with a null pointer for now, replace with a valid controller pointer if available + MockDeviceController mockController; + Controller::CommissioningWindowOpener opener = Controller::CommissioningWindowOpener(&mockController); +}; + +TEST_F(TestCommissioningWindowOpener, OpenCommissioningWindowVerifier_Success) +{ + Callback::Callback callback(OCWVerifierCallback, this); + + CHIP_ERROR err = opener.OpenCommissioningWindow(Controller::CommissioningWindowVerifierParams() + .SetNodeId(0x1234) + .SetTimeout(300) + .SetIteration(sTestSpake2p01_IterationCount) + .SetDiscriminator(3840) + .SetSalt(ByteSpan(sTestSpake2p01_Salt)) + .SetVerifier(ByteSpan(sTestSpake2p01_SerializedVerifier)) + .SetCallback(&callback)); + EXPECT_EQ(err, CHIP_NO_ERROR); +} + +TEST_F(TestCommissioningWindowOpener, OpenCommissioningWindowVerifier_Failure_InvalidSalt) +{ + Callback::Callback callback(OCWVerifierCallback, this); + + CHIP_ERROR err = opener.OpenCommissioningWindow(Controller::CommissioningWindowVerifierParams() + .SetNodeId(0x1234) + .SetTimeout(300) + .SetIteration(sTestSpake2p01_IterationCount) + .SetDiscriminator(3840) + .SetSalt(ByteSpan()) + .SetVerifier(ByteSpan(sTestSpake2p01_SerializedVerifier)) + .SetCallback(&callback)); + EXPECT_EQ(err, CHIP_ERROR_INVALID_ARGUMENT); +} + +TEST_F(TestCommissioningWindowOpener, OpenCommissioningWindowVerifier_Failure_InvalidVerifier) +{ + Callback::Callback callback(OCWVerifierCallback, this); + + CHIP_ERROR err = opener.OpenCommissioningWindow(Controller::CommissioningWindowVerifierParams() + .SetNodeId(0x1234) + .SetTimeout(300) + .SetIteration(sTestSpake2p01_IterationCount) + .SetDiscriminator(3840) + .SetSalt(ByteSpan(sTestSpake2p01_Salt)) + .SetVerifier(ByteSpan()) + .SetCallback(&callback)); + EXPECT_EQ(err, CHIP_ERROR_INVALID_ARGUMENT); +} + +TEST_F(TestCommissioningWindowOpener, OpenCommissioningWindowVerifier_Failure_InvalidIteration) +{ + Callback::Callback callback(OCWVerifierCallback, this); + + CHIP_ERROR err = opener.OpenCommissioningWindow(Controller::CommissioningWindowVerifierParams() + .SetNodeId(0x1234) + .SetTimeout(300) + .SetIteration(0) + .SetDiscriminator(3840) + .SetSalt(ByteSpan(sTestSpake2p01_Salt)) + .SetVerifier(ByteSpan(sTestSpake2p01_SerializedVerifier)) + .SetCallback(&callback)); + EXPECT_EQ(err, CHIP_ERROR_INVALID_ARGUMENT); +} + +TEST_F(TestCommissioningWindowOpener, OpenCommissioningWindowPasscode_Success) +{ + SetupPayload ignored; + Callback::Callback callback(OCWPasscodeCallback, this); + CHIP_ERROR err = opener.OpenCommissioningWindow(Controller::CommissioningWindowPasscodeParams() + .SetNodeId(0x1234) + .SetTimeout(300) + .SetIteration(sTestSpake2p01_IterationCount) + .SetDiscriminator(3840) + .SetSetupPIN(sTestSpake2p01_PinCode) + .SetReadVIDPIDAttributes(true) + .SetSalt(ByteSpan(sTestSpake2p01_Salt)) + .SetCallback(&callback), + ignored); + EXPECT_EQ(err, CHIP_NO_ERROR); +} + +TEST_F(TestCommissioningWindowOpener, OpenCommissioningWindowPasscode_Success_NoPin) +{ + SetupPayload ignored; + Callback::Callback callback(OCWPasscodeCallback, this); + CHIP_ERROR err = opener.OpenCommissioningWindow(Controller::CommissioningWindowPasscodeParams() + .SetNodeId(0x1234) + .SetTimeout(300) + .SetIteration(sTestSpake2p01_IterationCount) + .SetDiscriminator(3840) + .SetSalt(ByteSpan(sTestSpake2p01_Salt)) + .SetCallback(&callback), + ignored); + EXPECT_EQ(err, CHIP_NO_ERROR); +} + +TEST_F(TestCommissioningWindowOpener, OpenCommissioningWindowPasscode_Success_NoSalt) +{ + SetupPayload ignored; + Callback::Callback callback(OCWPasscodeCallback, this); + CHIP_ERROR err = opener.OpenCommissioningWindow(Controller::CommissioningWindowPasscodeParams() + .SetNodeId(0x1234) + .SetTimeout(300) + .SetIteration(sTestSpake2p01_IterationCount) + .SetDiscriminator(3840) + .SetSetupPIN(sTestSpake2p01_PinCode) + .SetCallback(&callback), + ignored); + EXPECT_EQ(err, CHIP_NO_ERROR); +} + +TEST_F(TestCommissioningWindowOpener, OpenCommissioningWindowPasscode_Failure_InvalidIteration) +{ + SetupPayload ignored; + Callback::Callback callback(OCWPasscodeCallback, this); + CHIP_ERROR err = opener.OpenCommissioningWindow(Controller::CommissioningWindowPasscodeParams() + .SetNodeId(0x1234) + .SetTimeout(300) + .SetIteration(0) + .SetDiscriminator(3840) + .SetCallback(&callback), + ignored); + EXPECT_EQ(err, CHIP_ERROR_INVALID_ARGUMENT); +} + +// Add more test cases as needed to cover different scenarios +} // namespace diff --git a/src/controller/tests/TestEventCaching.cpp b/src/controller/tests/TestEventCaching.cpp index b4c262725f74d3..cbff4b743ea0dd 100644 --- a/src/controller/tests/TestEventCaching.cpp +++ b/src/controller/tests/TestEventCaching.cpp @@ -16,7 +16,7 @@ * limitations under the License. */ -#include +#include #include "app-common/zap-generated/ids/Attributes.h" #include "app-common/zap-generated/ids/Clusters.h" @@ -34,10 +34,10 @@ #include #include #include +#include #include #include #include -#include using namespace chip; using namespace chip::app; @@ -50,8 +50,6 @@ static uint8_t gInfoEventBuffer[4096]; static uint8_t gCritEventBuffer[4096]; static chip::app::CircularEventBuffer gCircularEventBuffer[3]; -using TestContext = chip::Test::AppContext; - // // The generated endpoint_config for the controller app has Endpoint 1 // already used in the fixed endpoint set of size 1. Consequently, let's use the next @@ -59,33 +57,10 @@ using TestContext = chip::Test::AppContext; // constexpr EndpointId kTestEndpointId = 2; -class TestEventCaching : public ::testing::Test +class TestEventCaching : public Test::AppContext { -public: - // Performs shared setup for all tests in the test suite - static void SetUpTestSuite() - { - if (mpContext == nullptr) - { - mpContext = new TestContext(); - ASSERT_NE(mpContext, nullptr); - } - mpContext->SetUpTestSuite(); - } - - // Performs shared teardown for all tests in the test suite - static void TearDownTestSuite() - { - mpContext->TearDownTestSuite(); - if (mpContext != nullptr) - { - delete mpContext; - mpContext = nullptr; - } - } - protected: - // Performs setup for each test in the suite + // Performs setup for each test in the suite. Run once for each test function. void SetUp() { const chip::app::LogStorageResources logStorageResources[] = { @@ -94,29 +69,24 @@ class TestEventCaching : public ::testing::Test { &gCritEventBuffer[0], sizeof(gCritEventBuffer), chip::app::PriorityLevel::Critical }, }; - mpContext->SetUp(); + AppContext::SetUp(); // Call parent. + VerifyOrReturn(!HasFailure()); // Stop if parent had a failure. - CHIP_ERROR err = CHIP_NO_ERROR; - // TODO: use ASSERT_EQ, once transition to pw_unit_test is complete - VerifyOrDieWithMsg((err = mEventCounter.Init(0)) == CHIP_NO_ERROR, AppServer, - "Init EventCounter failed: %" CHIP_ERROR_FORMAT, err.Format()); - chip::app::EventManagement::CreateEventManagement(&mpContext->GetExchangeManager(), ArraySize(logStorageResources), + ASSERT_EQ(mEventCounter.Init(0), CHIP_NO_ERROR); + chip::app::EventManagement::CreateEventManagement(&GetExchangeManager(), ArraySize(logStorageResources), gCircularEventBuffer, logStorageResources, &mEventCounter); } - // Performs teardown for each test in the suite + // Performs teardown for each test in the suite. Run once for each test function. void TearDown() { chip::app::EventManagement::DestroyEventManagement(); - mpContext->TearDown(); + AppContext::TearDown(); // Call parent. } - static TestContext * mpContext; - private: MonotonicallyIncreasingCounter mEventCounter; }; -TestContext * TestEventCaching::mpContext = nullptr; //clang-format off DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(testClusterAttrs) @@ -179,7 +149,7 @@ void GenerateEvents(chip::EventNumber & firstEventNumber, chip::EventNumber & la */ TEST_F(TestEventCaching, TestBasicCaching) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); app::InteractionModelEngine * engine = app::InteractionModelEngine::GetInstance(); // Initialize the ember side server logic @@ -207,12 +177,12 @@ TEST_F(TestEventCaching, TestBasicCaching) TestReadCallback readCallback; { - app::ReadClient readClient(engine, &mpContext->GetExchangeManager(), - readCallback.mClusterCacheAdapter.GetBufferedCallback(), app::ReadClient::InteractionType::Read); + app::ReadClient readClient(engine, &GetExchangeManager(), readCallback.mClusterCacheAdapter.GetBufferedCallback(), + app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readParams), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); uint8_t generationCount = 0; readCallback.mClusterCacheAdapter.ForEachEventData( @@ -340,12 +310,12 @@ TEST_F(TestEventCaching, TestBasicCaching) GenerateEvents(firstEventNumber, lastEventNumber); { - app::ReadClient readClient(engine, &mpContext->GetExchangeManager(), - readCallback.mClusterCacheAdapter.GetBufferedCallback(), app::ReadClient::InteractionType::Read); + app::ReadClient readClient(engine, &GetExchangeManager(), readCallback.mClusterCacheAdapter.GetBufferedCallback(), + app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readParams), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // // Validate that we still have all 5 of the old events we received, as well as the new ones that just got generated. @@ -392,8 +362,8 @@ TEST_F(TestEventCaching, TestBasicCaching) // we don't receive events lower than that value. // { - app::ReadClient readClient(engine, &mpContext->GetExchangeManager(), - readCallback.mClusterCacheAdapter.GetBufferedCallback(), app::ReadClient::InteractionType::Read); + app::ReadClient readClient(engine, &GetExchangeManager(), readCallback.mClusterCacheAdapter.GetBufferedCallback(), + app::ReadClient::InteractionType::Read); readCallback.mClusterCacheAdapter.ClearEventCache(); constexpr EventNumber kLastSeenEventNumber = 3; @@ -405,7 +375,7 @@ TEST_F(TestEventCaching, TestBasicCaching) EXPECT_EQ(readClient.SendRequest(readParams), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // We should only get events with event numbers larger than kHighestEventNumberSeen. EXPECT_EQ(readCallback.mEventsSeen, lastEventNumber - kLastSeenEventNumber); @@ -441,12 +411,12 @@ TEST_F(TestEventCaching, TestBasicCaching) { readParams.mEventNumber.SetValue(5); - app::ReadClient readClient(engine, &mpContext->GetExchangeManager(), - readCallback.mClusterCacheAdapter.GetBufferedCallback(), app::ReadClient::InteractionType::Read); + app::ReadClient readClient(engine, &GetExchangeManager(), readCallback.mClusterCacheAdapter.GetBufferedCallback(), + app::ReadClient::InteractionType::Read); readCallback.mClusterCacheAdapter.ClearEventCache(true); EXPECT_EQ(readClient.SendRequest(readParams), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // // Validate that we would receive 5 events @@ -474,7 +444,7 @@ TEST_F(TestEventCaching, TestBasicCaching) EXPECT_TRUE(highestEventNumber.HasValue() && highestEventNumber.Value() == 9); } - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); emberAfClearDynamicEndpoint(0); } diff --git a/src/controller/tests/TestEventChunking.cpp b/src/controller/tests/TestEventChunking.cpp index c7790959e6866e..0aa0b9d0a5714f 100644 --- a/src/controller/tests/TestEventChunking.cpp +++ b/src/controller/tests/TestEventChunking.cpp @@ -16,7 +16,7 @@ * limitations under the License. */ -#include +#include #include "app-common/zap-generated/ids/Attributes.h" #include "app-common/zap-generated/ids/Clusters.h" @@ -38,10 +38,10 @@ #include #include #include +#include #include #include #include -#include using namespace chip; using namespace chip::app; @@ -54,8 +54,6 @@ static uint8_t gInfoEventBuffer[4096]; static uint8_t gCritEventBuffer[4096]; static chip::app::CircularEventBuffer gCircularEventBuffer[3]; -using TestContext = chip::Test::AppContext; - uint32_t gIterationCount = 0; // @@ -69,31 +67,8 @@ constexpr AttributeId kTestListLargeAttribute = 8; // This attribute will be lar // The size of the attribute which is a bit larger than the size of event used in the test. constexpr size_t kSizeOfLargeAttribute = 60; -class TestEventChunking : public ::testing::Test +class TestEventChunking : public chip::Test::AppContext { -public: - // Performs shared setup for all tests in the test suite - static void SetUpTestSuite() - { - if (mpContext == nullptr) - { - mpContext = new TestContext(); - ASSERT_NE(mpContext, nullptr); - } - mpContext->SetUpTestSuite(); - } - - // Performs shared teardown for all tests in the test suite - static void TearDownTestSuite() - { - mpContext->TearDownTestSuite(); - if (mpContext != nullptr) - { - delete mpContext; - mpContext = nullptr; - } - } - protected: // Performs setup for each test in the suite void SetUp() @@ -104,13 +79,13 @@ class TestEventChunking : public ::testing::Test { &gCritEventBuffer[0], sizeof(gCritEventBuffer), chip::app::PriorityLevel::Critical }, }; - mpContext->SetUp(); + AppContext::SetUp(); CHIP_ERROR err = CHIP_NO_ERROR; // TODO: use ASSERT_EQ, once transition to pw_unit_test is complete VerifyOrDieWithMsg((err = mEventCounter.Init(0)) == CHIP_NO_ERROR, AppServer, "Init EventCounter failed: %" CHIP_ERROR_FORMAT, err.Format()); - chip::app::EventManagement::CreateEventManagement(&mpContext->GetExchangeManager(), ArraySize(logStorageResources), + chip::app::EventManagement::CreateEventManagement(&GetExchangeManager(), ArraySize(logStorageResources), gCircularEventBuffer, logStorageResources, &mEventCounter); } @@ -118,15 +93,12 @@ class TestEventChunking : public ::testing::Test void TearDown() { chip::app::EventManagement::DestroyEventManagement(); - mpContext->TearDown(); + AppContext::TearDown(); } - static TestContext * mpContext; - private: MonotonicallyIncreasingCounter mEventCounter; }; -TestContext * TestEventChunking::mpContext = nullptr; //clang-format off DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(testClusterAttrs) @@ -317,7 +289,7 @@ void GenerateEvents(chip::EventNumber & firstEventNumber, chip::EventNumber & la */ TEST_F(TestEventChunking, TestEventChunking) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); app::InteractionModelEngine * engine = app::InteractionModelEngine::GetInstance(); // Initialize the ember side server logic @@ -358,15 +330,15 @@ TEST_F(TestEventChunking, TestEventChunking) app::InteractionModelEngine::GetInstance()->GetReportingEngine().SetWriterReserved(static_cast(800 + i)); - app::ReadClient readClient(engine, &mpContext->GetExchangeManager(), readCallback.mBufferedCallback, + app::ReadClient readClient(engine, &GetExchangeManager(), readCallback.mBufferedCallback, app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readParams), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(readCallback.mEventCount, static_cast((lastEventNumber - firstEventNumber) + 1)); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); // // Stop the test if we detected an error. Otherwise, it'll be difficult to read the logs. @@ -383,7 +355,7 @@ TEST_F(TestEventChunking, TestEventChunking) // Similar to the tests above, but it will read attributes AND events TEST_F(TestEventChunking, TestMixedEventsAndAttributesChunking) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); app::InteractionModelEngine * engine = app::InteractionModelEngine::GetInstance(); // Initialize the ember side server logic @@ -426,12 +398,12 @@ TEST_F(TestEventChunking, TestMixedEventsAndAttributesChunking) app::InteractionModelEngine::GetInstance()->GetReportingEngine().SetWriterReserved(static_cast(800 + i)); - app::ReadClient readClient(engine, &mpContext->GetExchangeManager(), readCallback.mBufferedCallback, + app::ReadClient readClient(engine, &GetExchangeManager(), readCallback.mBufferedCallback, app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readParams), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // // Always returns the same number of attributes read (5 + revision + GlobalAttributesNotInMetadata). @@ -440,7 +412,7 @@ TEST_F(TestEventChunking, TestMixedEventsAndAttributesChunking) EXPECT_EQ(readCallback.mAttributeCount, 6 + ArraySize(GlobalAttributesNotInMetadata)); EXPECT_EQ(readCallback.mEventCount, static_cast(lastEventNumber - firstEventNumber + 1)); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); // // Stop the test if we detected an error. Otherwise, it'll be difficult to read the logs. @@ -459,7 +431,7 @@ TEST_F(TestEventChunking, TestMixedEventsAndAttributesChunking) // can be encoded in to one chunk in the tests above. This test will force it by reading only one attribtue and read many events. TEST_F(TestEventChunking, TestMixedEventsAndLargeAttributesChunking) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); app::InteractionModelEngine * engine = app::InteractionModelEngine::GetInstance(); // Initialize the ember side server logic @@ -502,18 +474,18 @@ TEST_F(TestEventChunking, TestMixedEventsAndLargeAttributesChunking) app::InteractionModelEngine::GetInstance()->GetReportingEngine().SetWriterReserved(static_cast(800 + i)); - app::ReadClient readClient(engine, &mpContext->GetExchangeManager(), readCallback.mBufferedCallback, + app::ReadClient readClient(engine, &GetExchangeManager(), readCallback.mBufferedCallback, app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readParams), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(readCallback.mOnReportEnd); EXPECT_EQ(readCallback.mAttributeCount, 1u); EXPECT_EQ(readCallback.mEventCount, static_cast(lastEventNumber - firstEventNumber + 1)); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); // // Stop the test if we detected an error. Otherwise, it'll be difficult to read the logs. diff --git a/src/controller/tests/TestEventNumberCaching.cpp b/src/controller/tests/TestEventNumberCaching.cpp index 4d77813262a691..9b580f759e06c1 100644 --- a/src/controller/tests/TestEventNumberCaching.cpp +++ b/src/controller/tests/TestEventNumberCaching.cpp @@ -16,7 +16,7 @@ * limitations under the License. */ -#include +#include #include "app-common/zap-generated/ids/Clusters.h" #include "app/ClusterStateCache.h" @@ -31,9 +31,9 @@ #include #include #include +#include #include #include -#include using namespace chip; using namespace chip::app; @@ -46,8 +46,6 @@ static uint8_t gInfoEventBuffer[4096]; static uint8_t gCritEventBuffer[4096]; static chip::app::CircularEventBuffer gCircularEventBuffer[3]; -using TestContext = chip::Test::AppContext; - // // The generated endpoint_config for the controller app has Endpoint 1 // already used in the fixed endpoint set of size 1. Consequently, let's use the next @@ -55,31 +53,8 @@ using TestContext = chip::Test::AppContext; // constexpr EndpointId kTestEndpointId = 2; -class TestEventNumberCaching : public ::testing::Test +class TestEventNumberCaching : public chip::Test::AppContext { -public: - // Performs shared setup for all tests in the test suite - static void SetUpTestSuite() - { - if (mpContext == nullptr) - { - mpContext = new TestContext(); - ASSERT_NE(mpContext, nullptr); - } - mpContext->SetUpTestSuite(); - } - - // Performs shared teardown for all tests in the test suite - static void TearDownTestSuite() - { - mpContext->TearDownTestSuite(); - if (mpContext != nullptr) - { - delete mpContext; - mpContext = nullptr; - } - } - protected: // Performs setup for each test in the suite void SetUp() @@ -90,13 +65,13 @@ class TestEventNumberCaching : public ::testing::Test { &gCritEventBuffer[0], sizeof(gCritEventBuffer), chip::app::PriorityLevel::Critical }, }; - mpContext->SetUp(); + AppContext::SetUp(); CHIP_ERROR err = CHIP_NO_ERROR; // TODO: use ASSERT_EQ, once transition to pw_unit_test is complete VerifyOrDieWithMsg((err = mEventCounter.Init(0)) == CHIP_NO_ERROR, AppServer, "Init EventCounter failed: %" CHIP_ERROR_FORMAT, err.Format()); - chip::app::EventManagement::CreateEventManagement(&mpContext->GetExchangeManager(), ArraySize(logStorageResources), + chip::app::EventManagement::CreateEventManagement(&GetExchangeManager(), ArraySize(logStorageResources), gCircularEventBuffer, logStorageResources, &mEventCounter); } @@ -104,15 +79,12 @@ class TestEventNumberCaching : public ::testing::Test void TearDown() { chip::app::EventManagement::DestroyEventManagement(); - mpContext->TearDown(); + AppContext::TearDown(); } - static TestContext * mpContext; - private: MonotonicallyIncreasingCounter mEventCounter; }; -TestContext * TestEventNumberCaching::mpContext = nullptr; //clang-format off DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(testClusterAttrs) @@ -168,7 +140,7 @@ void GenerateEvents(chip::EventNumber & firstEventNumber, chip::EventNumber & la */ TEST_F(TestEventNumberCaching, TestEventNumberCaching) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); app::InteractionModelEngine * engine = app::InteractionModelEngine::GetInstance(); // Initialize the ember side server logic @@ -199,12 +171,12 @@ TEST_F(TestEventNumberCaching, TestEventNumberCaching) Optional highestEventNumber; readCallback.mClusterCacheAdapter.GetHighestReceivedEventNumber(highestEventNumber); EXPECT_FALSE(highestEventNumber.HasValue()); - app::ReadClient readClient(engine, &mpContext->GetExchangeManager(), - readCallback.mClusterCacheAdapter.GetBufferedCallback(), app::ReadClient::InteractionType::Read); + app::ReadClient readClient(engine, &GetExchangeManager(), readCallback.mClusterCacheAdapter.GetBufferedCallback(), + app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readParams), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(readCallback.mEventsSeen, lastEventNumber - firstEventNumber + 1); @@ -223,8 +195,8 @@ TEST_F(TestEventNumberCaching, TestEventNumberCaching) // we don't receive events except ones larger than that value. // { - app::ReadClient readClient(engine, &mpContext->GetExchangeManager(), - readCallback.mClusterCacheAdapter.GetBufferedCallback(), app::ReadClient::InteractionType::Read); + app::ReadClient readClient(engine, &GetExchangeManager(), readCallback.mClusterCacheAdapter.GetBufferedCallback(), + app::ReadClient::InteractionType::Read); readCallback.mClusterCacheAdapter.ClearEventCache(true); Optional highestEventNumber; @@ -242,7 +214,7 @@ TEST_F(TestEventNumberCaching, TestEventNumberCaching) EXPECT_FALSE(readParams.mEventNumber.HasValue()); EXPECT_EQ(readClient.SendRequest(readParams), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // We should only get events with event numbers larger than kHighestEventNumberSeen. EXPECT_EQ(readCallback.mEventsSeen, lastEventNumber - kHighestEventNumberSeen); @@ -256,7 +228,7 @@ TEST_F(TestEventNumberCaching, TestEventNumberCaching) readCallback.mClusterCacheAdapter.GetHighestReceivedEventNumber(highestEventNumber); EXPECT_TRUE(highestEventNumber.HasValue() && highestEventNumber.Value() == lastEventNumber); } - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); emberAfClearDynamicEndpoint(0); } diff --git a/src/controller/tests/TestReadChunking.cpp b/src/controller/tests/TestReadChunking.cpp index 8fe5e51c2b097f..b00d0bed75ebcf 100644 --- a/src/controller/tests/TestReadChunking.cpp +++ b/src/controller/tests/TestReadChunking.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include "app-common/zap-generated/ids/Attributes.h" #include "app-common/zap-generated/ids/Clusters.h" @@ -41,12 +41,11 @@ #include #include #include +#include #include #include #include -#include -using TestContext = chip::Test::AppContext; using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; @@ -72,42 +71,6 @@ constexpr AttributeId kTestBadAttribute = constexpr int kListAttributeItems = 5; -class TestReadChunking : public ::testing::Test -{ -public: - // Performs shared setup for all tests in the test suite - static void SetUpTestSuite() - { - if (mpContext == nullptr) - { - mpContext = new TestContext(); - ASSERT_NE(mpContext, nullptr); - } - mpContext->SetUpTestSuite(); - } - - // Performs shared teardown for all tests in the test suite - static void TearDownTestSuite() - { - mpContext->TearDownTestSuite(); - if (mpContext != nullptr) - { - delete mpContext; - mpContext = nullptr; - } - } - -protected: - // Performs setup for each test in the suite - void SetUp() { mpContext->SetUp(); } - - // Performs teardown for each test in the suite - void TearDown() { mpContext->TearDown(); } - - static TestContext * mpContext; -}; -TestContext * TestReadChunking::mpContext = nullptr; - //clang-format off DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(testClusterAttrs) DECLARE_DYNAMIC_ATTRIBUTE(0x00000001, INT8U, 1, 0), DECLARE_DYNAMIC_ATTRIBUTE(0x00000002, INT8U, 1, 0), @@ -492,6 +455,15 @@ void TestMutableReadCallback::OnAttributeData(const app::ConcreteDataAttributePa // Ignore all other attributes, we don't care above the global attributes. } +class TestReadChunking : public chip::Test::AppContext +{ +protected: + struct Instruction; + void DoTest(TestMutableReadCallback * callback, Instruction instruction); + void DriveIOUntilSubscriptionEstablished(TestMutableReadCallback * callback); + void DriveIOUntilEndOfReport(TestMutableReadCallback * callback); +}; + /* * This validates all the various corner cases encountered during chunking by * artificially reducing the size of a packet buffer used to encode attribute data @@ -511,7 +483,7 @@ void TestMutableReadCallback::OnAttributeData(const app::ConcreteDataAttributePa */ TEST_F(TestReadChunking, TestChunking) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); app::InteractionModelEngine * engine = app::InteractionModelEngine::GetInstance(); // Initialize the ember side server logic @@ -542,12 +514,12 @@ TEST_F(TestReadChunking, TestChunking) app::InteractionModelEngine::GetInstance()->GetReportingEngine().SetWriterReserved(static_cast(850 + i)); - app::ReadClient readClient(engine, &mpContext->GetExchangeManager(), readCallback.mBufferedCallback, + app::ReadClient readClient(engine, &GetExchangeManager(), readCallback.mBufferedCallback, app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readParams), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(readCallback.mOnReportEnd); // @@ -556,7 +528,7 @@ TEST_F(TestReadChunking, TestChunking) EXPECT_EQ(readCallback.mAttributeCount, 6 + ArraySize(GlobalAttributesNotInMetadata)); readCallback.mAttributeCount = 0; - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); // // Stop the test if we detected an error. Otherwise, it'll be difficult to read the logs. @@ -573,7 +545,7 @@ TEST_F(TestReadChunking, TestChunking) // Similar to the test above, but for the list chunking feature. TEST_F(TestReadChunking, TestListChunking) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); app::InteractionModelEngine * engine = app::InteractionModelEngine::GetInstance(); // Initialize the ember side server logic @@ -617,12 +589,12 @@ TEST_F(TestReadChunking, TestListChunking) app::InteractionModelEngine::GetInstance()->GetReportingEngine().SetWriterReserved( static_cast(maxPacketSize - packetSize)); - app::ReadClient readClient(engine, &mpContext->GetExchangeManager(), readCallback.mBufferedCallback, + app::ReadClient readClient(engine, &GetExchangeManager(), readCallback.mBufferedCallback, app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readParams), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Up until our packets are big enough, we might just keep getting // errors due to the inability to encode even a single IB in a packet. @@ -654,7 +626,7 @@ TEST_F(TestReadChunking, TestListChunking) EXPECT_FALSE(readCallback.mBufferedCallback.mSawEmptyList); } - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); // // Stop the test if we detected an error. Otherwise, it'll be difficult to read the logs. @@ -674,7 +646,7 @@ TEST_F(TestReadChunking, TestListChunking) // Read an attribute that can never fit into the buffer. Result in an empty report, server should shutdown the transaction. TEST_F(TestReadChunking, TestBadChunking) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); app::InteractionModelEngine * engine = app::InteractionModelEngine::GetInstance(); // Initialize the ember side server logic @@ -695,12 +667,12 @@ TEST_F(TestReadChunking, TestBadChunking) TestReadCallback readCallback; { - app::ReadClient readClient(engine, &mpContext->GetExchangeManager(), readCallback.mBufferedCallback, + app::ReadClient readClient(engine, &GetExchangeManager(), readCallback.mBufferedCallback, app::ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(readParams), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // The server should return an empty list as attribute data for the first report (for list chunking), and encodes nothing // (then shuts down the read handler) for the second report. @@ -711,11 +683,11 @@ TEST_F(TestReadChunking, TestBadChunking) EXPECT_FALSE(readCallback.mOnReportEnd); // The server should shutted down, while the client is still alive (pending for the attribute data.) - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } // Sanity check - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); emberAfClearDynamicEndpoint(0); } @@ -725,7 +697,7 @@ TEST_F(TestReadChunking, TestBadChunking) */ TEST_F(TestReadChunking, TestDynamicEndpoint) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); app::InteractionModelEngine * engine = app::InteractionModelEngine::GetInstance(); // Initialize the ember side server logic @@ -745,21 +717,21 @@ TEST_F(TestReadChunking, TestDynamicEndpoint) { - app::ReadClient readClient(engine, &mpContext->GetExchangeManager(), readCallback.mBufferedCallback, + app::ReadClient readClient(engine, &GetExchangeManager(), readCallback.mBufferedCallback, app::ReadClient::InteractionType::Subscribe); // Enable the new endpoint emberAfSetDynamicEndpoint(0, kTestEndpointId, &testEndpoint, Span(dataVersionStorage)); EXPECT_EQ(readClient.SendRequest(readParams), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(readCallback.mOnSubscriptionEstablished); readCallback.mAttributeCount = 0; emberAfSetDynamicEndpoint(0, kTestEndpointId4, &testEndpoint4, Span(dataVersionStorage)); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Ensure we have received the report, we do not care about the initial report here. // GlobalAttributesNotInMetadata attributes are not included in testClusterAttrsOnEndpoint4. @@ -774,7 +746,7 @@ TEST_F(TestReadChunking, TestDynamicEndpoint) // Disable the new endpoint emberAfEndpointEnableDisable(kTestEndpointId4, false); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // We may receive some attribute reports for descriptor cluster, but we do not care about it for now. @@ -784,7 +756,7 @@ TEST_F(TestReadChunking, TestDynamicEndpoint) readCallback.mOnReportEnd = false; emberAfEndpointEnableDisable(kTestEndpointId4, true); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Ensure we have received the report, we do not care about the initial report here. // GlobalAttributesNotInMetadata attributes are not included in testClusterAttrsOnEndpoint4. @@ -797,9 +769,9 @@ TEST_F(TestReadChunking, TestDynamicEndpoint) chip::test_utils::SleepMillis(SecondsToMilliseconds(2)); // Destroying the read client will terminate the subscription transaction. - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); emberAfClearDynamicEndpoint(0); } @@ -845,57 +817,59 @@ enum AttrIds using AttributeWithValue = std::pair; using AttributesList = std::vector; -struct Instruction +void CheckValues(TestMutableReadCallback * callback, std::vector expectedValues = {}) +{ + for (const auto & vals : expectedValues) + { + EXPECT_EQ(callback->mValues[vals.first], vals.second); + } +} + +void ExpectSameDataVersions(TestMutableReadCallback * callback, AttributesList attrList) +{ + if (attrList.size() == 0) + { + return; + } + DataVersion expectedVersion = callback->mDataVersions[attrList[0]]; + for (const auto & attr : attrList) + { + EXPECT_EQ(callback->mDataVersions[attr], expectedVersion); + } +} + +}; // namespace TestSetDirtyBetweenChunksUtil + +struct TestReadChunking::Instruction { // The maximum number of attributes should be iterated in a single report chunk. uint32_t chunksize; // A list of functions that will be executed before driving the main loop. std::vector> preworks; // A list of pair for attributes and their expected values in the report. - std::vector expectedValues; + std::vector expectedValues; // A list of list of various attributes which should have the same data version in the report. - std::vector attributesWithSameDataVersion; + std::vector attributesWithSameDataVersion; }; -void DriveIOUntilSubscriptionEstablished(TestContext * pContext, TestMutableReadCallback * callback) +void TestReadChunking::DriveIOUntilSubscriptionEstablished(TestMutableReadCallback * callback) { callback->mOnReportEnd = false; - pContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return callback->mOnSubscriptionEstablished; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return callback->mOnSubscriptionEstablished; }); EXPECT_TRUE(callback->mOnReportEnd); EXPECT_TRUE(callback->mOnSubscriptionEstablished); callback->mActionOn.clear(); } -void DriveIOUntilEndOfReport(TestContext * pContext, TestMutableReadCallback * callback) +void TestReadChunking::DriveIOUntilEndOfReport(TestMutableReadCallback * callback) { callback->mOnReportEnd = false; - pContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return callback->mOnReportEnd; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return callback->mOnReportEnd; }); EXPECT_TRUE(callback->mOnReportEnd); callback->mActionOn.clear(); } -void CheckValues(TestMutableReadCallback * callback, std::vector expectedValues = {}) -{ - for (const auto & vals : expectedValues) - { - EXPECT_EQ(callback->mValues[vals.first], vals.second); - } -} - -void ExpectSameDataVersions(TestMutableReadCallback * callback, AttributesList attrList) -{ - if (attrList.size() == 0) - { - return; - } - DataVersion expectedVersion = callback->mDataVersions[attrList[0]]; - for (const auto & attr : attrList) - { - EXPECT_EQ(callback->mDataVersions[attr], expectedVersion); - } -} - -void DoTest(TestContext * pContext, TestMutableReadCallback * callback, Instruction instruction) +void TestReadChunking::DoTest(TestMutableReadCallback * callback, Instruction instruction) { app::InteractionModelEngine::GetInstance()->GetReportingEngine().SetMaxAttributesPerChunk(instruction.chunksize); @@ -904,22 +878,20 @@ void DoTest(TestContext * pContext, TestMutableReadCallback * callback, Instruct act(); } - DriveIOUntilEndOfReport(pContext, callback); + DriveIOUntilEndOfReport(callback); - CheckValues(callback, instruction.expectedValues); + TestSetDirtyBetweenChunksUtil::CheckValues(callback, instruction.expectedValues); for (const auto & attrList : instruction.attributesWithSameDataVersion) { - ExpectSameDataVersions(callback, attrList); + TestSetDirtyBetweenChunksUtil::ExpectSameDataVersions(callback, attrList); } } -}; // namespace TestSetDirtyBetweenChunksUtil - TEST_F(TestReadChunking, TestSetDirtyBetweenChunks) { using namespace TestSetDirtyBetweenChunksUtil; - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); app::InteractionModelEngine * engine = app::InteractionModelEngine::GetInstance(); // Initialize the ember side server logic @@ -953,7 +925,7 @@ TEST_F(TestReadChunking, TestSetDirtyBetweenChunks) gIterationCount = 1; - app::ReadClient readClient(engine, &mpContext->GetExchangeManager(), readCallback.mBufferedCallback, + app::ReadClient readClient(engine, &GetExchangeManager(), readCallback.mBufferedCallback, app::ReadClient::InteractionType::Subscribe); EXPECT_EQ(readClient.SendRequest(readParams), CHIP_NO_ERROR); @@ -965,11 +937,11 @@ TEST_F(TestReadChunking, TestSetDirtyBetweenChunks) // We are expected to miss attributes on kTestEndpointId during initial reports. ChipLogProgress(DataManagement, "Case 1-1: Set dirty during priming report."); readCallback.mActionOn[AttrOnEp5] = TouchAttrOp(AttrOnEp1); - DriveIOUntilSubscriptionEstablished(mpContext, &readCallback); + DriveIOUntilSubscriptionEstablished(&readCallback); CheckValues(&readCallback, { { AttrOnEp1, 1 } }); ChipLogProgress(DataManagement, "Case 1-2: Check for attributes missed last report."); - DoTest(mpContext, &readCallback, Instruction{ .chunksize = 2, .expectedValues = { { AttrOnEp1, 2 } } }); + DoTest(&readCallback, Instruction{ .chunksize = 2, .expectedValues = { { AttrOnEp1, 2 } } }); } // CASE 2 -- Set dirty during chunked report, the attribute is already dirty. @@ -977,7 +949,7 @@ TEST_F(TestReadChunking, TestSetDirtyBetweenChunks) ChipLogProgress(DataManagement, "Case 2: Set dirty during chunked report by wildcard path."); readCallback.mActionOn[AttrOnEp5] = WriteAttrOp(AttrOnEp5, 3); DoTest( - mpContext, &readCallback, + &readCallback, Instruction{ .chunksize = 2, .preworks = { WriteAttrOp(AttrOnEp5, 2), WriteAttrOp(AttrOnEp5, 2), WriteAttrOp(AttrOnEp5, 2) }, @@ -991,7 +963,7 @@ TEST_F(TestReadChunking, TestSetDirtyBetweenChunks) "Case 3-1: Set dirty during chunked report by wildcard path -- new dirty attribute."); readCallback.mActionOn[AttrOnEp5] = WriteAttrOp(AttrOnEp5, 4); DoTest( - mpContext, &readCallback, + &readCallback, Instruction{ .chunksize = 1, .preworks = { WriteAttrOp(AttrOnEp5, 4), WriteAttrOp(AttrOnEp5, 4) }, .expectedValues = { { AttrOnEp5, 4 }, { AttrOnEp5, 4 }, { AttrOnEp5, 4 } }, @@ -1002,7 +974,7 @@ TEST_F(TestReadChunking, TestSetDirtyBetweenChunks) app::InteractionModelEngine::GetInstance()->GetReportingEngine().SetMaxAttributesPerChunk(1); readCallback.mActionOn[AttrOnEp5] = WriteAttrOp(AttrOnEp5, 5); DoTest( - mpContext, &readCallback, + &readCallback, Instruction{ .chunksize = 1, .preworks = { WriteAttrOp(AttrOnEp5, 5), WriteAttrOp(AttrOnEp5, 5) }, .expectedValues = { { AttrOnEp5, 5 }, { AttrOnEp5, 5 }, { AttrOnEp5, 5 } }, @@ -1032,18 +1004,18 @@ TEST_F(TestReadChunking, TestSetDirtyBetweenChunks) { TestMutableReadCallback readCallback; - app::ReadClient readClient(engine, &mpContext->GetExchangeManager(), readCallback.mBufferedCallback, + app::ReadClient readClient(engine, &GetExchangeManager(), readCallback.mBufferedCallback, app::ReadClient::InteractionType::Subscribe); EXPECT_EQ(readClient.SendRequest(readParams), CHIP_NO_ERROR); - DriveIOUntilSubscriptionEstablished(mpContext, &readCallback); + DriveIOUntilSubscriptionEstablished(&readCallback); // Note, although the two attributes comes from the same cluster, they are generated by different interested paths. // In this case, we won't reset the path iterator. ChipLogProgress(DataManagement, "Case 1-1: Test set dirty during reports generated by concrete paths."); readCallback.mActionOn[AttrOnEp5] = WriteAttrOp(AttrOnEp5, 4); - DoTest(mpContext, &readCallback, + DoTest(&readCallback, Instruction{ .chunksize = 1, .preworks = { WriteAttrOp(AttrOnEp5, 3), WriteAttrOp(AttrOnEp5, 3), WriteAttrOp(AttrOnEp5, 3) }, @@ -1051,16 +1023,16 @@ TEST_F(TestReadChunking, TestSetDirtyBetweenChunks) // The attribute failed to catch last report will be picked by this report. ChipLogProgress(DataManagement, "Case 1-2: Check for attributes missed last report."); - DoTest(mpContext, &readCallback, { .chunksize = 1, .expectedValues = { { AttrOnEp5, 4 } } }); + DoTest(&readCallback, { .chunksize = 1, .expectedValues = { { AttrOnEp5, 4 } } }); } } chip::test_utils::SleepMillis(SecondsToMilliseconds(3)); // Destroying the read client will terminate the subscription transaction. - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); emberAfClearDynamicEndpoint(1); emberAfClearDynamicEndpoint(0); diff --git a/src/controller/tests/TestServerCommandDispatch.cpp b/src/controller/tests/TestServerCommandDispatch.cpp index 41fab0ae0e3802..960d849fc660ad 100644 --- a/src/controller/tests/TestServerCommandDispatch.cpp +++ b/src/controller/tests/TestServerCommandDispatch.cpp @@ -22,23 +22,22 @@ * */ -#include +#include -#include "app-common/zap-generated/ids/Attributes.h" -#include "app-common/zap-generated/ids/Clusters.h" -#include "protocols/interaction_model/Constants.h" #include +#include +#include #include +#include #include #include #include #include #include #include +#include #include -#include - -using TestContext = chip::Test::AppContext; +#include using namespace chip; using namespace chip::app; @@ -63,10 +62,10 @@ class TestClusterCommandHandler : public chip::app::CommandHandlerInterface public: TestClusterCommandHandler() : chip::app::CommandHandlerInterface(Optional::Missing(), Clusters::UnitTesting::Id) { - chip::app::InteractionModelEngine::GetInstance()->RegisterCommandHandler(this); + CommandHandlerInterfaceRegistry::RegisterCommandHandler(this); } - ~TestClusterCommandHandler() { chip::app::InteractionModelEngine::GetInstance()->UnregisterCommandHandler(this); } + ~TestClusterCommandHandler() { CommandHandlerInterfaceRegistry::UnregisterCommandHandler(this); } void OverrideAcceptedCommands() { mOverrideAcceptedCommands = true; } void ClaimNoCommands() { mClaimNoCommands = true; } @@ -130,45 +129,11 @@ CHIP_ERROR TestClusterCommandHandler::EnumerateAcceptedCommands(const ConcreteCl namespace { -class TestServerCommandDispatch : public ::testing::Test +class TestServerCommandDispatch : public chip::Test::AppContext { -public: - // Performs shared setup for all tests in the test suite - static void SetUpTestSuite() - { - if (mpContext == nullptr) - { - mpContext = new TestContext(); - ASSERT_NE(mpContext, nullptr); - } - mpContext->SetUpTestSuite(); - } - - // Performs shared teardown for all tests in the test suite - static void TearDownTestSuite() - { - mpContext->TearDownTestSuite(); - if (mpContext != nullptr) - { - delete mpContext; - mpContext = nullptr; - } - } - protected: - // Performs setup for each test in the suite - void SetUp() { mpContext->SetUp(); } - - // Performs teardown for each test in the suite - void TearDown() { mpContext->TearDown(); } - - static TestContext * mpContext; - - // Helpers - - static void TestDataResponseHelper(const EmberAfEndpointType * aEndpoint, bool aExpectSuccess); + void TestDataResponseHelper(const EmberAfEndpointType * aEndpoint, bool aExpectSuccess); }; -TestContext * TestServerCommandDispatch::mpContext = nullptr; // We want to send a TestSimpleArgumentRequest::Type, but get a // TestStructArrayArgumentResponse in return, so need to shadow the actual @@ -181,7 +146,7 @@ struct FakeRequest : public Clusters::UnitTesting::Commands::TestSimpleArgumentR TEST_F(TestServerCommandDispatch, TestNoHandler) { FakeRequest request; - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); request.arg1 = true; @@ -203,12 +168,12 @@ TEST_F(TestServerCommandDispatch, TestNoHandler) responseDirective = kSendDataResponse; - chip::Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, + chip::Controller::InvokeCommandRequest(&GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } static const int kDescriptorAttributeArraySize = 254; @@ -261,7 +226,7 @@ DECLARE_DYNAMIC_ENDPOINT(testEndpoint3, testEndpointClusters3); void TestServerCommandDispatch::TestDataResponseHelper(const EmberAfEndpointType * aEndpoint, bool aExpectSuccess) { FakeRequest request; - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessWasCalled = false; bool onFailureWasCalled = false; @@ -307,13 +272,13 @@ void TestServerCommandDispatch::TestDataResponseHelper(const EmberAfEndpointType responseDirective = kSendDataResponse; - chip::Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, + chip::Controller::InvokeCommandRequest(&GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(onSuccessWasCalled == aExpectSuccess && onFailureWasCalled != aExpectSuccess); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); onSuccessWasCalled = false; onFailureWasCalled = false; @@ -346,12 +311,12 @@ void TestServerCommandDispatch::TestDataResponseHelper(const EmberAfEndpointType }; chip::Controller::ReadAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, readSuccessCb, readFailureCb); + &GetExchangeManager(), sessionHandle, kTestEndpointId, readSuccessCb, readFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(onSuccessWasCalled && !onFailureWasCalled); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); emberAfClearDynamicEndpoint(0); } diff --git a/src/controller/tests/TestWriteChunking.cpp b/src/controller/tests/TestWriteChunking.cpp index 60be2212aa00e8..9ffad2c602835c 100644 --- a/src/controller/tests/TestWriteChunking.cpp +++ b/src/controller/tests/TestWriteChunking.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include "app-common/zap-generated/ids/Attributes.h" #include "app-common/zap-generated/ids/Clusters.h" @@ -37,10 +37,9 @@ #include #include #include +#include #include -#include -using TestContext = chip::Test::AppContext; using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; @@ -62,41 +61,39 @@ constexpr uint32_t kTestListLength = 5; // We don't really care about the content, we just need a buffer. uint8_t sByteSpanData[app::kMaxSecureSduLengthBytes]; -class TestWriteChunking : public ::testing::Test +class TestWriteChunking : public Test::AppContext { -public: - // Performs shared setup for all tests in the test suite - static void SetUpTestSuite() - { - if (mpContext == nullptr) - { - mpContext = new TestContext(); - ASSERT_NE(mpContext, nullptr); - } - mpContext->SetUpTestSuite(); - } +private: + using PathStatus = std::pair; - // Performs shared teardown for all tests in the test suite - static void TearDownTestSuite() +protected: + enum class Operations : uint8_t { - mpContext->TearDownTestSuite(); - if (mpContext != nullptr) - { - delete mpContext; - mpContext = nullptr; - } - } + kNoop, + kShutdownWriteClient, + }; -protected: - // Performs setup for each test in the suite - void SetUp() { mpContext->SetUp(); } + enum class ListData : uint8_t + { + kNull, + kList, + kBadValue, + }; - // Performs teardown for each test in the suite - void TearDown() { mpContext->TearDown(); } + struct Instructions + { + // The paths used in write request + std::vector paths; + // The type of content of the list, it should be an empty vector or its size should equals to the list of paths. + std::vector data; + // operations on OnListWriteBegin and OnListWriteEnd on the server side. + std::function onListWriteBeginActions; + // The expected status when OnListWriteEnd is called. In the same order as paths + std::vector expectedStatus; + }; - static TestContext * mpContext; + void RunTest(Instructions instructions); }; -TestContext * TestWriteChunking::mpContext = nullptr; //clang-format off DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(testClusterAttrsOnEndpoint) @@ -211,7 +208,7 @@ CHIP_ERROR TestAttrAccess::Write(const app::ConcreteDataAttributePath & aPath, a */ TEST_F(TestWriteChunking, TestListChunking) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); // Initialize the ember side server logic InitDataModelHandler(); @@ -238,7 +235,7 @@ TEST_F(TestWriteChunking, TestListChunking) gIterationCount = i; - app::WriteClient writeClient(&mpContext->GetExchangeManager(), &writeCallback, Optional::Missing(), + app::WriteClient writeClient(&GetExchangeManager(), &writeCallback, Optional::Missing(), static_cast(minReservationSize + i) /* reserved buffer size */); ByteSpan list[kTestListLength]; @@ -256,14 +253,14 @@ TEST_F(TestWriteChunking, TestListChunking) // for (int j = 0; j < 10 && writeCallback.mOnDoneCount == 0; j++) { - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); } EXPECT_EQ(writeCallback.mSuccessCount, kTestListLength + 1 /* an extra item for the empty list at the beginning */); EXPECT_EQ(writeCallback.mErrorCount, 0u); EXPECT_EQ(writeCallback.mOnDoneCount, 1u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); // // Stop the test if we detected an error. Otherwise, it'll be difficult to read the logs. @@ -281,7 +278,7 @@ TEST_F(TestWriteChunking, TestListChunking) // As the actual overhead may change, we will test over a few possible payload lengths, from 850 to MTU used in write clients. TEST_F(TestWriteChunking, TestBadChunking) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool atLeastOneRequestSent = false; bool atLeastOneRequestFailed = false; @@ -306,7 +303,7 @@ TEST_F(TestWriteChunking, TestBadChunking) gIterationCount = (uint32_t) i; - app::WriteClient writeClient(&mpContext->GetExchangeManager(), &writeCallback, Optional::Missing()); + app::WriteClient writeClient(&GetExchangeManager(), &writeCallback, Optional::Missing()); ByteSpan list[kTestListLength]; for (auto & item : list) @@ -335,14 +332,14 @@ TEST_F(TestWriteChunking, TestBadChunking) // for (int j = 0; j < 10 && writeCallback.mOnDoneCount == 0; j++) { - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); } EXPECT_EQ(writeCallback.mSuccessCount, kTestListLength + 1 /* an extra item for the empty list at the beginning */); EXPECT_EQ(writeCallback.mErrorCount, 0u); EXPECT_EQ(writeCallback.mOnDoneCount, 1u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); // // Stop the test if we detected an error. Otherwise, it'll be difficult to read the logs. @@ -352,7 +349,7 @@ TEST_F(TestWriteChunking, TestBadChunking) break; } } - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); EXPECT_TRUE(atLeastOneRequestSent && atLeastOneRequestFailed); emberAfClearDynamicEndpoint(0); } @@ -363,7 +360,7 @@ TEST_F(TestWriteChunking, TestBadChunking) */ TEST_F(TestWriteChunking, TestConflictWrite) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); // Initialize the ember side server logic InitDataModelHandler(); @@ -380,11 +377,11 @@ TEST_F(TestWriteChunking, TestConflictWrite) constexpr size_t kReserveSize = kMaxSecureSduLengthBytes - 128; TestWriteCallback writeCallback1; - app::WriteClient writeClient1(&mpContext->GetExchangeManager(), &writeCallback1, Optional::Missing(), + app::WriteClient writeClient1(&GetExchangeManager(), &writeCallback1, Optional::Missing(), static_cast(kReserveSize)); TestWriteCallback writeCallback2; - app::WriteClient writeClient2(&mpContext->GetExchangeManager(), &writeCallback2, Optional::Missing(), + app::WriteClient writeClient2(&GetExchangeManager(), &writeCallback2, Optional::Missing(), static_cast(kReserveSize)); ByteSpan list[kTestListLength]; @@ -402,7 +399,7 @@ TEST_F(TestWriteChunking, TestConflictWrite) err = writeClient2.SendWriteRequest(sessionHandle); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); { const TestWriteCallback * writeCallbackRef1 = &writeCallback1; @@ -426,7 +423,7 @@ TEST_F(TestWriteChunking, TestConflictWrite) EXPECT_EQ(writeCallbackRef2->mOnDoneCount, 1u); } - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); emberAfClearDynamicEndpoint(0); } @@ -437,7 +434,7 @@ TEST_F(TestWriteChunking, TestConflictWrite) */ TEST_F(TestWriteChunking, TestNonConflictWrite) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); // Initialize the ember side server logic InitDataModelHandler(); @@ -455,11 +452,11 @@ TEST_F(TestWriteChunking, TestNonConflictWrite) constexpr size_t kReserveSize = kMaxSecureSduLengthBytes - 128; TestWriteCallback writeCallback1; - app::WriteClient writeClient1(&mpContext->GetExchangeManager(), &writeCallback1, Optional::Missing(), + app::WriteClient writeClient1(&GetExchangeManager(), &writeCallback1, Optional::Missing(), static_cast(kReserveSize)); TestWriteCallback writeCallback2; - app::WriteClient writeClient2(&mpContext->GetExchangeManager(), &writeCallback2, Optional::Missing(), + app::WriteClient writeClient2(&GetExchangeManager(), &writeCallback2, Optional::Missing(), static_cast(kReserveSize)); ByteSpan list[kTestListLength]; @@ -477,7 +474,7 @@ TEST_F(TestWriteChunking, TestNonConflictWrite) err = writeClient2.SendWriteRequest(sessionHandle); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); { EXPECT_EQ(writeCallback1.mErrorCount, 0u); @@ -489,48 +486,19 @@ TEST_F(TestWriteChunking, TestNonConflictWrite) EXPECT_EQ(writeCallback2.mOnDoneCount, 1u); } - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); emberAfClearDynamicEndpoint(0); } -namespace TestTransactionalListInstructions { - -using PathStatus = std::pair; - -enum class Operations : uint8_t -{ - kNoop, - kShutdownWriteClient, -}; - -enum class ListData : uint8_t -{ - kNull, - kList, - kBadValue, -}; - -struct Instructions -{ - // The paths used in write request - std::vector paths; - // The type of content of the list, it should be an empty vector or its size should equals to the list of paths. - std::vector data; - // operations on OnListWriteBegin and OnListWriteEnd on the server side. - std::function onListWriteBeginActions; - // The expected status when OnListWriteEnd is called. In the same order as paths - std::vector expectedStatus; -}; - -void RunTest(TestContext * pContext, Instructions instructions) +void TestWriteChunking::RunTest(Instructions instructions) { CHIP_ERROR err = CHIP_NO_ERROR; - auto sessionHandle = pContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); TestWriteCallback writeCallback; std::unique_ptr writeClient = std::make_unique( - &pContext->GetExchangeManager(), &writeCallback, Optional::Missing(), + &GetExchangeManager(), &writeCallback, Optional::Missing(), static_cast(kMaxSecureSduLengthBytes - 128) /* use a smaller chunk so we only need a few attributes in the write request. */); @@ -598,9 +566,9 @@ void RunTest(TestContext * pContext, Instructions instructions) err = writeClient->SendWriteRequest(sessionHandle); EXPECT_EQ(err, CHIP_NO_ERROR); - pContext->GetIOContext().DriveIOUntil(sessionHandle->ComputeRoundTripTimeout(app::kExpectedIMProcessingTime) + - System::Clock::Seconds16(1), - [&]() { return pContext->GetExchangeManager().GetNumActiveExchanges() == 0; }); + GetIOContext().DriveIOUntil(sessionHandle->ComputeRoundTripTimeout(app::kExpectedIMProcessingTime) + + System::Clock::Seconds16(1), + [&]() { return GetExchangeManager().GetNumActiveExchanges() == 0; }); EXPECT_EQ(onGoingPath, app::ConcreteAttributePath()); EXPECT_EQ(status.size(), instructions.expectedStatus.size()); @@ -614,12 +582,8 @@ void RunTest(TestContext * pContext, Instructions instructions) testServer.mOnListWriteEnd = nullptr; } -} // namespace TestTransactionalListInstructions - TEST_F(TestWriteChunking, TestTransactionalList) { - using namespace TestTransactionalListInstructions; - // Initialize the ember side server logic InitDataModelHandler(); @@ -631,98 +595,88 @@ TEST_F(TestWriteChunking, TestTransactionalList) // Test 1: we should receive transaction notifications ChipLogProgress(Zcl, "Test 1: we should receive transaction notifications"); - RunTest(mpContext, - Instructions{ - .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute) }, - .expectedStatus = { true }, - }); + RunTest(Instructions{ + .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute) }, + .expectedStatus = { true }, + }); ChipLogProgress(Zcl, "Test 2: we should receive transaction notifications for incomplete list operations"); - RunTest( - mpContext, - Instructions{ - .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute) }, - .onListWriteBeginActions = [&](const app::ConcreteAttributePath & aPath) { return Operations::kShutdownWriteClient; }, - .expectedStatus = { false }, - }); + RunTest(Instructions{ + .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute) }, + .onListWriteBeginActions = [&](const app::ConcreteAttributePath & aPath) { return Operations::kShutdownWriteClient; }, + .expectedStatus = { false }, + }); ChipLogProgress(Zcl, "Test 3: we should receive transaction notifications for every list in the transaction"); - RunTest(mpContext, - Instructions{ - .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute), - ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute2) }, - .expectedStatus = { true, true }, - }); + RunTest(Instructions{ + .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute), + ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute2) }, + .expectedStatus = { true, true }, + }); ChipLogProgress(Zcl, "Test 4: we should receive transaction notifications with the status of each list"); - RunTest(mpContext, - Instructions{ - .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute), - ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute2) }, - .onListWriteBeginActions = - [&](const app::ConcreteAttributePath & aPath) { - if (aPath.mAttributeId == kTestListAttribute2) - { - return Operations::kShutdownWriteClient; - } - return Operations::kNoop; - }, - .expectedStatus = { true, false }, - }); + RunTest(Instructions{ + .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute), + ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute2) }, + .onListWriteBeginActions = + [&](const app::ConcreteAttributePath & aPath) { + if (aPath.mAttributeId == kTestListAttribute2) + { + return Operations::kShutdownWriteClient; + } + return Operations::kNoop; + }, + .expectedStatus = { true, false }, + }); ChipLogProgress(Zcl, "Test 5: transactional list callbacks will be called for nullable lists, test if it is handled correctly for " "null value before non null values"); - RunTest(mpContext, - Instructions{ - .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute), - ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute) }, - .data = { ListData::kNull, ListData::kList }, - .expectedStatus = { true }, - }); + RunTest(Instructions{ + .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute), + ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute) }, + .data = { ListData::kNull, ListData::kList }, + .expectedStatus = { true }, + }); ChipLogProgress(Zcl, "Test 6: transactional list callbacks will be called for nullable lists, test if it is handled correctly for " "null value after non null values"); - RunTest(mpContext, - Instructions{ - .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute), - ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute) }, - .data = { ListData::kList, ListData::kNull }, - .expectedStatus = { true }, - }); + RunTest(Instructions{ + .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute), + ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute) }, + .data = { ListData::kList, ListData::kNull }, + .expectedStatus = { true }, + }); ChipLogProgress(Zcl, "Test 7: transactional list callbacks will be called for nullable lists, test if it is handled correctly for " "null value between non null values"); - RunTest(mpContext, - Instructions{ - .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute), - ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute), - ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute) }, - .data = { ListData::kList, ListData::kNull, ListData::kList }, - .expectedStatus = { true }, - }); + RunTest(Instructions{ + .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute), + ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute), + ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute) }, + .data = { ListData::kList, ListData::kNull, ListData::kList }, + .expectedStatus = { true }, + }); ChipLogProgress(Zcl, "Test 8: transactional list callbacks will be called for nullable lists"); - RunTest(mpContext, - Instructions{ - .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute) }, - .data = { ListData::kNull }, - .expectedStatus = { true }, - }); + RunTest(Instructions{ + .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute) }, + .data = { ListData::kNull }, + .expectedStatus = { true }, + }); ChipLogProgress(Zcl, "Test 9: for nullable lists, we should receive notifications for unsuccessful writes when non-fatal occurred " "during processing the requests"); - RunTest(mpContext, - Instructions{ - .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute) }, - .data = { ListData::kBadValue }, - .expectedStatus = { false }, - }); - - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + RunTest(Instructions{ + .paths = { ConcreteAttributePath(kTestEndpointId, Clusters::UnitTesting::Id, kTestListAttribute) }, + .data = { ListData::kBadValue }, + .expectedStatus = { false }, + }); + + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); emberAfClearDynamicEndpoint(0); } diff --git a/src/controller/tests/data_model/BUILD.gn b/src/controller/tests/data_model/BUILD.gn index c67922717645dd..692696d3be2548 100644 --- a/src/controller/tests/data_model/BUILD.gn +++ b/src/controller/tests/data_model/BUILD.gn @@ -17,10 +17,11 @@ import("//build_overrides/chip.gni") import("//build_overrides/pigweed.gni") import("${chip_root}/build/chip/chip_test_suite.gni") +import("${chip_root}/src/app/common_flags.gni") import("${chip_root}/src/platform/device.gni") chip_test_suite("data_model") { - output_name = "libDataModelTests" + output_name = "libControllerDataModelTests" sources = [ "DataModelFixtures.cpp", @@ -40,7 +41,9 @@ chip_test_suite("data_model") { public_deps = [ "${chip_root}/src/app", "${chip_root}/src/app/common:cluster-objects", + "${chip_root}/src/app/data-model-interface", "${chip_root}/src/app/tests:helpers", + "${chip_root}/src/app/util/mock:mock_codegen_data_model", "${chip_root}/src/app/util/mock:mock_ember", "${chip_root}/src/controller", "${chip_root}/src/lib/core:string-builder-adapters", diff --git a/src/controller/tests/data_model/DataModelFixtures.cpp b/src/controller/tests/data_model/DataModelFixtures.cpp index 11dbd1059f7415..eb043acd04353d 100644 --- a/src/controller/tests/data_model/DataModelFixtures.cpp +++ b/src/controller/tests/data_model/DataModelFixtures.cpp @@ -21,11 +21,14 @@ #include #include #include +#include #include +#include using namespace chip; using namespace chip::app; using namespace chip::app::DataModelTests; +using namespace chip::app::InteractionModel; using namespace chip::app::Clusters; using namespace chip::app::Clusters::UnitTesting; using namespace chip::Protocols; @@ -33,6 +36,19 @@ using namespace chip::Protocols; namespace chip { namespace app { +class TestOnlyAttributeValueEncoderAccessor +{ +public: + TestOnlyAttributeValueEncoderAccessor(AttributeValueEncoder & encoder) : mEncoder(encoder) {} + + AttributeReportIBs::Builder & Builder() { return mEncoder.mAttributeReportIBsBuilder; } + + void SetState(const AttributeEncodeState & state) { mEncoder.mEncodeState = state; } + +private: + AttributeValueEncoder & mEncoder; +}; + namespace DataModelTests { ScopedChangeOnly gReadResponseDirective(ReadResponseDirective::kSendDataResponse); @@ -41,6 +57,11 @@ ScopedChangeOnly gCommandResponseDirective(CommandResp ScopedChangeOnly gIsLitIcd(false); +// TODO: usage of a global value that changes as a READ sideffect is problematic for +// dual-read use cases (i.e. during checked ember/datamodel tests) +// +// For now see the hack "change undo" in CustomDataModel::ReadAttribute, however +// overall this is problematic. uint16_t gInt16uTotalReadCount = 0; CommandHandler::Handle gAsyncCommandHandle; @@ -312,15 +333,15 @@ CHIP_ERROR WriteSingleClusterData(const Access::SubjectDescriptor & aSubjectDesc // Boolean attribute of unit testing cluster triggers "multiple errors" case. if (aPath.mClusterId == Clusters::UnitTesting::Id && aPath.mAttributeId == Attributes::Boolean::TypeInfo::GetAttributeId()) { - InteractionModel::ClusterStatusCode status{ Protocols::InteractionModel::Status::InvalidValue }; + Protocols::InteractionModel::ClusterStatusCode status{ Protocols::InteractionModel::Status::InvalidValue }; if (gWriteResponseDirective == WriteResponseDirective::kSendMultipleSuccess) { - status = InteractionModel::Status::Success; + status = Protocols::InteractionModel::Status::Success; } else if (gWriteResponseDirective == WriteResponseDirective::kSendMultipleErrors) { - status = InteractionModel::Status::Failure; + status = Protocols::InteractionModel::Status::Failure; } else { @@ -337,14 +358,14 @@ CHIP_ERROR WriteSingleClusterData(const Access::SubjectDescriptor & aSubjectDesc if (aPath.mClusterId == Clusters::UnitTesting::Id && aPath.mAttributeId == Attributes::Int8u::TypeInfo::GetAttributeId()) { - InteractionModel::ClusterStatusCode status{ Protocols::InteractionModel::Status::InvalidValue }; + Protocols::InteractionModel::ClusterStatusCode status{ Protocols::InteractionModel::Status::InvalidValue }; if (gWriteResponseDirective == WriteResponseDirective::kSendClusterSpecificSuccess) { - status = InteractionModel::ClusterStatusCode::ClusterSpecificSuccess(kExampleClusterSpecificSuccess); + status = Protocols::InteractionModel::ClusterStatusCode::ClusterSpecificSuccess(kExampleClusterSpecificSuccess); } else if (gWriteResponseDirective == WriteResponseDirective::kSendClusterSpecificFailure) { - status = InteractionModel::ClusterStatusCode::ClusterSpecificFailure(kExampleClusterSpecificFailure); + status = Protocols::InteractionModel::ClusterStatusCode::ClusterSpecificFailure(kExampleClusterSpecificFailure); } else { @@ -446,10 +467,10 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, chip } } -InteractionModel::Status ServerClusterCommandExists(const ConcreteCommandPath & aCommandPath) +Protocols::InteractionModel::Status ServerClusterCommandExists(const ConcreteCommandPath & aCommandPath) { // Mock cluster catalog, only support commands on one cluster on one endpoint. - using InteractionModel::Status; + using Protocols::InteractionModel::Status; if (aCommandPath.mEndpointId != kTestEndpointId) { @@ -464,5 +485,114 @@ InteractionModel::Status ServerClusterCommandExists(const ConcreteCommandPath & return Status::Success; } +CustomDataModel & CustomDataModel::Instance() +{ + static CustomDataModel model; + return model; +} + +CHIP_ERROR CustomDataModel::ReadAttribute(const ReadAttributeRequest & request, AttributeValueEncoder & encoder) +{ + 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)) + { + // 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--; + } +#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, + TestOnlyAttributeValueEncoderAccessor(encoder).Builder(), &mutableState); + + // state must survive CHIP_ERRORs as it is used for chunking + TestOnlyAttributeValueEncoderAccessor(encoder).SetState(mutableState); + + return err; +} + +CHIP_ERROR CustomDataModel::WriteAttribute(const WriteAttributeRequest & request, AttributeValueDecoder & decoder) +{ + return CHIP_ERROR_NOT_IMPLEMENTED; +} + +CHIP_ERROR CustomDataModel::Invoke(const InvokeRequest & request, chip::TLV::TLVReader & input_arguments, CommandHandler * handler) +{ + return CHIP_ERROR_NOT_IMPLEMENTED; +} + +EndpointId CustomDataModel::FirstEndpoint() +{ + return CodegenDataModelInstance()->FirstEndpoint(); +} + +EndpointId CustomDataModel::NextEndpoint(EndpointId before) +{ + return CodegenDataModelInstance()->NextEndpoint(before); +} + +ClusterEntry CustomDataModel::FirstCluster(EndpointId endpoint) +{ + return CodegenDataModelInstance()->FirstCluster(endpoint); +} + +ClusterEntry CustomDataModel::NextCluster(const ConcreteClusterPath & before) +{ + return CodegenDataModelInstance()->NextCluster(before); +} + +std::optional CustomDataModel::GetClusterInfo(const ConcreteClusterPath & path) +{ + return CodegenDataModelInstance()->GetClusterInfo(path); +} + +AttributeEntry CustomDataModel::FirstAttribute(const ConcreteClusterPath & cluster) +{ + return CodegenDataModelInstance()->FirstAttribute(cluster); +} + +AttributeEntry CustomDataModel::NextAttribute(const ConcreteAttributePath & before) +{ + return CodegenDataModelInstance()->NextAttribute(before); +} + +std::optional CustomDataModel::GetAttributeInfo(const ConcreteAttributePath & path) +{ + return CodegenDataModelInstance()->GetAttributeInfo(path); +} + +CommandEntry CustomDataModel::FirstAcceptedCommand(const ConcreteClusterPath & cluster) +{ + return CodegenDataModelInstance()->FirstAcceptedCommand(cluster); +} + +CommandEntry CustomDataModel::NextAcceptedCommand(const ConcreteCommandPath & before) +{ + return CodegenDataModelInstance()->NextAcceptedCommand(before); +} + +std::optional CustomDataModel::GetAcceptedCommandInfo(const ConcreteCommandPath & path) +{ + return CodegenDataModelInstance()->GetAcceptedCommandInfo(path); +} + +ConcreteCommandPath CustomDataModel::FirstGeneratedCommand(const ConcreteClusterPath & cluster) +{ + return CodegenDataModelInstance()->FirstGeneratedCommand(cluster); +} + +ConcreteCommandPath CustomDataModel::NextGeneratedCommand(const ConcreteCommandPath & before) +{ + return CodegenDataModelInstance()->NextGeneratedCommand(before); +} + } // namespace app } // namespace chip diff --git a/src/controller/tests/data_model/DataModelFixtures.h b/src/controller/tests/data_model/DataModelFixtures.h index dfdc60e5b59b06..405b4ff4d4e7d8 100644 --- a/src/controller/tests/data_model/DataModelFixtures.h +++ b/src/controller/tests/data_model/DataModelFixtures.h @@ -22,6 +22,7 @@ #pragma once #include +#include #include #include #include @@ -97,6 +98,43 @@ extern ScopedChangeOnly gCommandResponseDirective; // Populated with the command handle when gCommandResponseDirective == kAsync extern CommandHandler::Handle gAsyncCommandHandle; +/// A customized class for read/write/invoke that matches functionality +/// with the ember-compatibility-functions functionality here. +/// +/// TODO: these functions currently redirect to ember functions, so could +/// be merged with test-interaction-model-api.h/cpp as well. This is not done since +/// if we remove the direct ember dependency from IM, we can implement +/// distinct functional classes. +/// TODO items for above: +/// - once IM only supports DataModel +/// - break ember-overrides in this h/cpp file +class CustomDataModel : public InteractionModel::DataModel +{ +public: + static CustomDataModel & Instance(); + + CHIP_ERROR Shutdown() override { return CHIP_NO_ERROR; } + + CHIP_ERROR ReadAttribute(const InteractionModel::ReadAttributeRequest & request, AttributeValueEncoder & encoder) override; + CHIP_ERROR WriteAttribute(const InteractionModel::WriteAttributeRequest & request, AttributeValueDecoder & decoder) override; + CHIP_ERROR Invoke(const InteractionModel::InvokeRequest & request, chip::TLV::TLVReader & input_arguments, + CommandHandler * handler) override; + + EndpointId FirstEndpoint() override; + EndpointId NextEndpoint(EndpointId before) override; + InteractionModel::ClusterEntry FirstCluster(EndpointId endpoint) override; + InteractionModel::ClusterEntry NextCluster(const ConcreteClusterPath & before) override; + std::optional GetClusterInfo(const ConcreteClusterPath & path) override; + InteractionModel::AttributeEntry FirstAttribute(const ConcreteClusterPath & cluster) override; + InteractionModel::AttributeEntry NextAttribute(const ConcreteAttributePath & before) override; + std::optional GetAttributeInfo(const ConcreteAttributePath & path) override; + InteractionModel::CommandEntry FirstAcceptedCommand(const ConcreteClusterPath & cluster) override; + InteractionModel::CommandEntry NextAcceptedCommand(const ConcreteCommandPath & before) override; + std::optional GetAcceptedCommandInfo(const ConcreteCommandPath & path) override; + ConcreteCommandPath FirstGeneratedCommand(const ConcreteClusterPath & cluster) override; + ConcreteCommandPath NextGeneratedCommand(const ConcreteCommandPath & before) override; +}; + } // namespace DataModelTests } // namespace app } // namespace chip diff --git a/src/controller/tests/data_model/TestCommands.cpp b/src/controller/tests/data_model/TestCommands.cpp index 2ccb98d5cf7e00..4e8b3dd39adb74 100644 --- a/src/controller/tests/data_model/TestCommands.cpp +++ b/src/controller/tests/data_model/TestCommands.cpp @@ -42,8 +42,6 @@ #include #include -using TestContext = chip::Test::AppContext; - using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; @@ -52,34 +50,7 @@ using namespace chip::Protocols; namespace { -class TestCommands : public ::testing::Test -{ -public: - // Performs shared setup for all tests in the test suite - static void SetUpTestSuite() - { - mpContext = new TestContext(); - ASSERT_NE(mpContext, nullptr); - mpContext->SetUpTestSuite(); - } - - // Performs shared teardown for all tests in the test suite - static void TearDownTestSuite() - { - mpContext->TearDownTestSuite(); - delete mpContext; - } - -protected: - // Performs setup for each individual test in the test suite - void SetUp() { mpContext->SetUp(); } - - // Performs teardown for each individual test in the test suite - void TearDown() { mpContext->TearDown(); } - - static TestContext * mpContext; -}; -TestContext * TestCommands::mpContext = nullptr; +using TestCommands = chip::Test::AppContext; TEST_F(TestCommands, TestDataResponse) { @@ -92,7 +63,7 @@ TEST_F(TestCommands, TestDataResponse) }; FakeRequest request; - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessWasCalled = false; bool onFailureWasCalled = false; @@ -128,13 +99,13 @@ TEST_F(TestCommands, TestDataResponse) ScopedChange directive(gCommandResponseDirective, CommandResponseDirective::kSendDataResponse); - chip::Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, + chip::Controller::InvokeCommandRequest(&GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(onSuccessWasCalled && !onFailureWasCalled); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestCommands, TestSuccessNoDataResponse) @@ -145,7 +116,7 @@ TEST_F(TestCommands, TestSuccessNoDataResponse) }; FakeRequest request; - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessWasCalled = false; bool onFailureWasCalled = false; @@ -166,13 +137,13 @@ TEST_F(TestCommands, TestSuccessNoDataResponse) ScopedChange directive(gCommandResponseDirective, CommandResponseDirective::kSendSuccessStatusCode); - chip::Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, + chip::Controller::InvokeCommandRequest(&GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(onSuccessWasCalled && !onFailureWasCalled && statusCheck); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestCommands, TestMultipleSuccessNoDataResponses) @@ -183,7 +154,7 @@ TEST_F(TestCommands, TestMultipleSuccessNoDataResponses) }; FakeRequest request; - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); size_t successCalls = 0; size_t failureCalls = 0; @@ -194,7 +165,7 @@ TEST_F(TestCommands, TestMultipleSuccessNoDataResponses) // not safe to do so. auto onSuccessCb = [&successCalls, &statusCheck](const ConcreteCommandPath & commandPath, const StatusIB & aStatus, const auto & dataResponse) { - statusCheck = (aStatus.mStatus == InteractionModel::Status::Success); + statusCheck = (aStatus.mStatus == Protocols::InteractionModel::Status::Success); ++successCalls; }; @@ -204,14 +175,13 @@ TEST_F(TestCommands, TestMultipleSuccessNoDataResponses) ScopedChange directive(gCommandResponseDirective, CommandResponseDirective::kSendMultipleSuccessStatusCodes); - Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, - onFailureCb); + Controller::InvokeCommandRequest(&GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(successCalls == 1 && statusCheck); EXPECT_EQ(failureCalls, 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestCommands, TestAsyncResponse) @@ -222,7 +192,7 @@ TEST_F(TestCommands, TestAsyncResponse) }; FakeRequest request; - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessWasCalled = false; bool onFailureWasCalled = false; @@ -243,13 +213,13 @@ TEST_F(TestCommands, TestAsyncResponse) ScopedChange directive(gCommandResponseDirective, CommandResponseDirective::kAsync); - chip::Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, + chip::Controller::InvokeCommandRequest(&GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(!onSuccessWasCalled && !onFailureWasCalled && !statusCheck); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 2u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 2u); CommandHandler * commandHandle = gAsyncCommandHandle.Get(); ASSERT_NE(commandHandle, nullptr); @@ -258,16 +228,16 @@ TEST_F(TestCommands, TestAsyncResponse) Protocols::InteractionModel::Status::Success); gAsyncCommandHandle.Release(); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(onSuccessWasCalled && !onFailureWasCalled && statusCheck); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestCommands, TestFailure) { Clusters::UnitTesting::Commands::TestSimpleArgumentRequest::Type request; - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessWasCalled = false; bool onFailureWasCalled = false; @@ -288,13 +258,13 @@ TEST_F(TestCommands, TestFailure) ScopedChange directive(gCommandResponseDirective, CommandResponseDirective::kSendError); - chip::Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, + chip::Controller::InvokeCommandRequest(&GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(!onSuccessWasCalled && onFailureWasCalled && statusCheck); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestCommands, TestMultipleFailures) @@ -305,7 +275,7 @@ TEST_F(TestCommands, TestMultipleFailures) }; FakeRequest request; - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); size_t successCalls = 0; size_t failureCalls = 0; @@ -320,20 +290,19 @@ TEST_F(TestCommands, TestMultipleFailures) // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. auto onFailureCb = [&failureCalls, &statusCheck](CHIP_ERROR aError) { - statusCheck = aError.IsIMStatus() && StatusIB(aError).mStatus == InteractionModel::Status::Failure; + statusCheck = aError.IsIMStatus() && StatusIB(aError).mStatus == Protocols::InteractionModel::Status::Failure; ++failureCalls; }; ScopedChange directive(gCommandResponseDirective, CommandResponseDirective::kSendMultipleErrors); - Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, - onFailureCb); + Controller::InvokeCommandRequest(&GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(successCalls, 0u); EXPECT_TRUE(failureCalls == 1 && statusCheck); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestCommands, TestSuccessNoDataResponseWithClusterStatus) @@ -344,7 +313,7 @@ TEST_F(TestCommands, TestSuccessNoDataResponseWithClusterStatus) }; FakeRequest request; - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessWasCalled = false; bool onFailureWasCalled = false; @@ -366,19 +335,19 @@ TEST_F(TestCommands, TestSuccessNoDataResponseWithClusterStatus) ScopedChange directive(gCommandResponseDirective, CommandResponseDirective::kSendSuccessStatusCodeWithClusterStatus); - chip::Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, + chip::Controller::InvokeCommandRequest(&GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(onSuccessWasCalled && !onFailureWasCalled && statusCheck); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestCommands, TestFailureWithClusterStatus) { Clusters::UnitTesting::Commands::TestSimpleArgumentRequest::Type request; - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessWasCalled = false; bool onFailureWasCalled = false; @@ -405,13 +374,13 @@ TEST_F(TestCommands, TestFailureWithClusterStatus) ScopedChange directive(gCommandResponseDirective, CommandResponseDirective::kSendErrorWithClusterStatus); - chip::Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, + chip::Controller::InvokeCommandRequest(&GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(!onSuccessWasCalled && onFailureWasCalled && statusCheck); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } } // namespace diff --git a/src/controller/tests/data_model/TestRead.cpp b/src/controller/tests/data_model/TestRead.cpp index 954ff5044418d4..1281d9190c56bc 100644 --- a/src/controller/tests/data_model/TestRead.cpp +++ b/src/controller/tests/data_model/TestRead.cpp @@ -38,8 +38,6 @@ #include #include -using TestContext = chip::Test::AppContext; - using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; @@ -49,43 +47,26 @@ using namespace chip::Test; namespace { -class TestRead : public ::testing::Test, public app::ReadHandler::ApplicationCallback +class TestRead : public chip::Test::AppContext, public app::ReadHandler::ApplicationCallback { -public: - // Performs shared setup for all tests in the test suite - static void SetUpTestSuite() - { - if (mpContext == nullptr) - { - mpContext = new TestContext(); - ASSERT_NE(mpContext, nullptr); - } - mpContext->SetUpTestSuite(); - } +protected: + static uint16_t mMaxInterval; - // Performs shared teardown for all tests in the test suite - static void TearDownTestSuite() + // Performs setup for each individual test in the test suite + void SetUp() override { - mpContext->TearDownTestSuite(); - if (mpContext != nullptr) - { - delete mpContext; - mpContext = nullptr; - } + chip::Test::AppContext::SetUp(); + mOldModel = InteractionModelEngine::GetInstance()->SetDataModel(&CustomDataModel::Instance()); } -protected: - // Performs setup for each individual test in the test suite - void SetUp() { mpContext->SetUp(); } - // Performs teardown for each individual test in the test suite - void TearDown() { mpContext->TearDown(); } - - static TestContext * mpContext; - - static uint16_t mMaxInterval; + void TearDown() override + { + InteractionModelEngine::GetInstance()->SetDataModel(mOldModel); + chip::Test::AppContext::TearDown(); + } - CHIP_ERROR OnSubscriptionRequested(app::ReadHandler & aReadHandler, Transport::SecureSession & aSecureSession) + CHIP_ERROR OnSubscriptionRequested(app::ReadHandler & aReadHandler, Transport::SecureSession & aSecureSession) override { VerifyOrReturnError(!mEmitSubscriptionError, CHIP_ERROR_INVALID_ARGUMENT); @@ -96,34 +77,33 @@ class TestRead : public ::testing::Test, public app::ReadHandler::ApplicationCal return CHIP_NO_ERROR; } - void OnSubscriptionEstablished(app::ReadHandler & aReadHandler) { mNumActiveSubscriptions++; } + void OnSubscriptionEstablished(app::ReadHandler & aReadHandler) override { mNumActiveSubscriptions++; } - void OnSubscriptionTerminated(app::ReadHandler & aReadHandler) { mNumActiveSubscriptions--; } + void OnSubscriptionTerminated(app::ReadHandler & aReadHandler) override { mNumActiveSubscriptions--; } // Issue the given number of reads in parallel and wait for them all to // succeed. - static void MultipleReadHelper(TestContext * apCtx, size_t aReadCount); + void MultipleReadHelper(size_t aReadCount); // Helper for MultipleReadHelper that does not spin the event loop, so we // don't end up with nested event loops. - static void MultipleReadHelperInternal(TestContext * apCtx, size_t aReadCount, uint32_t & aNumSuccessCalls, - uint32_t & aNumFailureCalls); + void MultipleReadHelperInternal(size_t aReadCount, uint32_t & aNumSuccessCalls, uint32_t & aNumFailureCalls); // Establish the given number of subscriptions, then issue the given number // of reads in parallel and wait for them all to succeed. - static void SubscribeThenReadHelper(TestContext * apCtx, size_t aSubscribeCount, size_t aReadCount); + void SubscribeThenReadHelper(size_t aSubscribeCount, size_t aReadCount); // Compute the amount of time it would take a subscription with a given // max-interval to time out. static System::Clock::Timeout ComputeSubscriptionTimeout(System::Clock::Seconds16 aMaxInterval); - bool mEmitSubscriptionError = false; - int32_t mNumActiveSubscriptions = 0; - bool mAlterSubscriptionIntervals = false; + bool mEmitSubscriptionError = false; + int32_t mNumActiveSubscriptions = 0; + bool mAlterSubscriptionIntervals = false; + chip::app::InteractionModel::DataModel * mOldModel = nullptr; }; -TestContext * TestRead::mpContext = nullptr; -uint16_t TestRead::mMaxInterval = 66; +uint16_t TestRead::mMaxInterval = 66; class MockInteractionModelApp : public chip::app::ClusterStateCache::Callback { @@ -176,7 +156,7 @@ class MockInteractionModelApp : public chip::app::ClusterStateCache::Callback TEST_F(TestRead, TestReadAttributeResponse) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessCbInvoked = false, onFailureCbInvoked = false; ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); @@ -205,14 +185,14 @@ TEST_F(TestRead, TestReadAttributeResponse) }; Controller::ReadAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb); + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(onSuccessCbInvoked && !onFailureCbInvoked); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadClients(), 0u); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } // NOTE: This test must execute before TestReadSubscribeAttributeResponseWithCache or else it will fail on @@ -225,7 +205,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithVersionOnlyCache) MockInteractionModelApp delegate; chip::app::ClusterStateCache cache(delegate, Optional::Missing(), false /*cachedData*/); - chip::app::ReadPrepareParams readPrepareParams(mpContext->GetSessionBobToAlice()); + chip::app::ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); // // Test the application callback as well to ensure we get the right number of SubscriptionEstablishment/Termination // callbacks. @@ -234,7 +214,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithVersionOnlyCache) // read of E2C2A* and E3C2A2. Expect cache E2C2 version { - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), cache.GetBufferedCallback(), chip::app::ReadClient::InteractionType::Read); chip::app::AttributePathParams attributePathParams2[2]; attributePathParams2[0].mEndpointId = chip::Test::kMockEndpoint2; @@ -249,7 +229,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithVersionOnlyCache) err = readClient.SendRequest(readPrepareParams); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // There are supported 2 global and 3 non-global attributes in E2C2A* and 1 E3C2A2 EXPECT_EQ(delegate.mNumAttributeResponse, 6); EXPECT_FALSE(delegate.mReadError); @@ -286,7 +266,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithVersionOnlyCache) } EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadClients(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) @@ -305,7 +285,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) eventPathParam.mEventId = 0; } - chip::app::ReadPrepareParams readPrepareParams(mpContext->GetSessionBobToAlice()); + chip::app::ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); readPrepareParams.mMinIntervalFloorSeconds = 0; readPrepareParams.mMaxIntervalCeilingSeconds = 4; // @@ -321,7 +301,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) { testId++; ChipLogProgress(DataManagement, "\t -- Running Read with ClusterStateCache Test ID %d", testId); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), cache.GetBufferedCallback(), chip::app::ReadClient::InteractionType::Read); chip::app::AttributePathParams attributePathParams1[3]; attributePathParams1[0].mEndpointId = chip::Test::kMockEndpoint2; @@ -341,7 +321,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) err = readClient.SendRequest(readPrepareParams); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 6); EXPECT_FALSE(delegate.mReadError); Optional version1; @@ -356,7 +336,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) { testId++; ChipLogProgress(DataManagement, "\t -- Running Read with ClusterStateCache Test ID %d", testId); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), cache.GetBufferedCallback(), chip::app::ReadClient::InteractionType::Read); chip::app::AttributePathParams attributePathParams1[3]; attributePathParams1[0].mEndpointId = chip::Test::kMockEndpoint2; @@ -376,7 +356,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) err = readClient.SendRequest(readPrepareParams); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 3); EXPECT_FALSE(delegate.mReadError); Optional version1; @@ -427,7 +407,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) { testId++; ChipLogProgress(DataManagement, "\t -- Running Read with ClusterStateCache Test ID %d", testId); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), cache.GetBufferedCallback(), chip::app::ReadClient::InteractionType::Read); chip::app::AttributePathParams attributePathParams1[3]; attributePathParams1[0].mEndpointId = kInvalidEndpointId; @@ -447,7 +427,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) err = readClient.SendRequest(readPrepareParams); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 2); EXPECT_FALSE(delegate.mReadError); Optional version1; @@ -493,7 +473,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) { testId++; ChipLogProgress(DataManagement, "\t -- Running Read with ClusterStateCache Test ID %d", testId); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), cache.GetBufferedCallback(), chip::app::ReadClient::InteractionType::Read); chip::app::AttributePathParams attributePathParams2[2]; attributePathParams2[0].mEndpointId = chip::Test::kMockEndpoint2; @@ -508,7 +488,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) err = readClient.SendRequest(readPrepareParams); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // There are supported 2 global and 3 non-global attributes in E2C2A* and 1 E3C2A2 EXPECT_EQ(delegate.mNumAttributeResponse, 6); EXPECT_FALSE(delegate.mReadError); @@ -568,7 +548,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) { testId++; ChipLogProgress(DataManagement, "\t -- Running Read with ClusterStateCache Test ID %d", testId); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), cache.GetBufferedCallback(), chip::app::ReadClient::InteractionType::Read); chip::app::AttributePathParams attributePathParams1[3]; attributePathParams1[0].mEndpointId = chip::Test::kMockEndpoint2; @@ -588,7 +568,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) err = readClient.SendRequest(readPrepareParams); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 1); EXPECT_FALSE(delegate.mReadError); Optional version1; @@ -637,7 +617,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) { testId++; ChipLogProgress(DataManagement, "\t -- Running Read with ClusterStateCache Test ID %d", testId); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), cache.GetBufferedCallback(), chip::app::ReadClient::InteractionType::Read); chip::app::AttributePathParams attributePathParams2[2]; attributePathParams2[0].mEndpointId = chip::Test::kMockEndpoint2; @@ -652,7 +632,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) err = readClient.SendRequest(readPrepareParams); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 1); EXPECT_FALSE(delegate.mReadError); Optional version1; @@ -714,7 +694,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) { testId++; ChipLogProgress(DataManagement, "\t -- Running Read with ClusterStateCache Test ID %d", testId); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), cache.GetBufferedCallback(), chip::app::ReadClient::InteractionType::Read); chip::app::AttributePathParams attributePathParams1[3]; attributePathParams1[0].mEndpointId = chip::Test::kMockEndpoint2; @@ -734,7 +714,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) err = readClient.SendRequest(readPrepareParams); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 3); EXPECT_FALSE(delegate.mReadError); Optional version1; @@ -783,7 +763,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) { testId++; ChipLogProgress(DataManagement, "\t -- Running Read with ClusterStateCache Test ID %d", testId); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), cache.GetBufferedCallback(), chip::app::ReadClient::InteractionType::Read); chip::app::AttributePathParams attributePathParams1[3]; attributePathParams1[0].mEndpointId = chip::Test::kMockEndpoint2; @@ -803,7 +783,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) err = readClient.SendRequest(readPrepareParams); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 3); EXPECT_FALSE(delegate.mReadError); Optional version1; @@ -852,7 +832,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) { testId++; ChipLogProgress(DataManagement, "\t -- Running Read with ClusterStateCache Test ID %d", testId); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), cache.GetBufferedCallback(), chip::app::ReadClient::InteractionType::Read); chip::app::AttributePathParams attributePathParams2[2]; attributePathParams2[0].mEndpointId = chip::Test::kMockEndpoint2; @@ -867,7 +847,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) err = readClient.SendRequest(readPrepareParams); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 6); EXPECT_FALSE(delegate.mReadError); Optional version1; @@ -927,7 +907,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) { testId++; ChipLogProgress(DataManagement, "\t -- Running Read with ClusterStateCache Test ID %d", testId); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), cache.GetBufferedCallback(), chip::app::ReadClient::InteractionType::Read); chip::app::AttributePathParams attributePathParams2[2]; attributePathParams2[0].mEndpointId = chip::Test::kMockEndpoint2; @@ -950,7 +930,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) err = readClient.SendRequest(readPrepareParams); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 6); EXPECT_FALSE(delegate.mReadError); Optional version1; @@ -1013,7 +993,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) { testId++; ChipLogProgress(DataManagement, "\t -- Running Read with ClusterStateCache Test ID %d", testId); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), cache.GetBufferedCallback(), chip::app::ReadClient::InteractionType::Read); chip::app::AttributePathParams attributePathParams3[3]; @@ -1034,7 +1014,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) err = readClient.SendRequest(readPrepareParams); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // E1C2A* has 3 attributes and E2C3A* has 5 attributes and E2C2A* has 4 attributes EXPECT_EQ(delegate.mNumAttributeResponse, 12); EXPECT_FALSE(delegate.mReadError); @@ -1120,7 +1100,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) { testId++; ChipLogProgress(DataManagement, "\t -- Running Read with ClusterStateCache Test ID %d", testId); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), cache.GetBufferedCallback(), chip::app::ReadClient::InteractionType::Read); chip::app::AttributePathParams attributePathParams3[3]; @@ -1146,7 +1126,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) err = readClient.SendRequest(readPrepareParams); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 7); EXPECT_FALSE(delegate.mReadError); Optional version1; @@ -1231,7 +1211,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) { testId++; ChipLogProgress(DataManagement, "\t -- Running Read with ClusterStateCache Test ID %d", testId); - app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), + app::ReadClient readClient(chip::app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), cache.GetBufferedCallback(), chip::app::ReadClient::InteractionType::Read); chip::app::AttributePathParams attributePathParams1[1]; attributePathParams1[0].mEndpointId = chip::Test::kMockEndpoint3; @@ -1242,7 +1222,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) err = readClient.SendRequest(readPrepareParams); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 6); EXPECT_FALSE(delegate.mReadError); Optional version1; @@ -1294,12 +1274,12 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) } EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadClients(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestRead, TestReadEventResponse) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessCbInvoked = false, onFailureCbInvoked = false, onDoneCbInvoked = false; // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's @@ -1318,21 +1298,21 @@ TEST_F(TestRead, TestReadEventResponse) auto onDoneCb = [&onDoneCbInvoked](app::ReadClient * apReadClient) { onDoneCbInvoked = true; }; Controller::ReadEvent( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, onDoneCb); + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, onDoneCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_FALSE(onFailureCbInvoked); EXPECT_TRUE(onDoneCbInvoked); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadClients(), 0u); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestRead, TestReadAttributeError) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessCbInvoked = false, onFailureCbInvoked = false; ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataError); @@ -1351,19 +1331,19 @@ TEST_F(TestRead, TestReadAttributeError) }; Controller::ReadAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb); + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(!onSuccessCbInvoked && onFailureCbInvoked); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadClients(), 0u); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestRead, TestReadAttributeTimeout) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessCbInvoked = false, onFailureCbInvoked = false; ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataError); @@ -1382,21 +1362,21 @@ TEST_F(TestRead, TestReadAttributeTimeout) }; Controller::ReadAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb); + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb); - mpContext->ExpireSessionAliceToBob(); + ExpireSessionAliceToBob(); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 1u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 1u); - mpContext->ExpireSessionBobToAlice(); + ExpireSessionBobToAlice(); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(!onSuccessCbInvoked && onFailureCbInvoked); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(), 0u); @@ -1404,10 +1384,10 @@ TEST_F(TestRead, TestReadAttributeTimeout) // Let's put back the sessions so that the next tests (which assume a valid initialized set of sessions) // can function correctly. // - mpContext->CreateSessionAliceToBob(); - mpContext->CreateSessionBobToAlice(); + CreateSessionAliceToBob(); + CreateSessionBobToAlice(); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } class TestResubscriptionCallback : public app::ReadClient::Callback @@ -1468,18 +1448,18 @@ class TestResubscriptionCallback : public app::ReadClient::Callback // TEST_F(TestRead, TestResubscribeAttributeTimeout) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); - mpContext->SetMRPMode(chip::Test::MessagingContext::MRPMode::kResponsive); + SetMRPMode(chip::Test::MessagingContext::MRPMode::kResponsive); { TestResubscriptionCallback callback; - app::ReadClient readClient(app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), callback, + app::ReadClient readClient(app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), callback, app::ReadClient::InteractionType::Subscribe); callback.SetReadClient(&readClient); - app::ReadPrepareParams readPrepareParams(mpContext->GetSessionBobToAlice()); + app::ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); // Read full wildcard paths, repeat twice to ensure chunking. app::AttributePathParams attributePathParams[1]; @@ -1499,8 +1479,8 @@ TEST_F(TestRead, TestResubscribeAttributeTimeout) // // Drive servicing IO till we have established a subscription. // - mpContext->GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), - [&]() { return callback.mOnSubscriptionEstablishedCount >= 1; }); + GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), + [&]() { return callback.mOnSubscriptionEstablishedCount >= 1; }); EXPECT_EQ(callback.mOnSubscriptionEstablishedCount, 1); EXPECT_EQ(callback.mOnError, 0); EXPECT_EQ(callback.mOnResubscriptionsAttempted, 0); @@ -1515,21 +1495,21 @@ TEST_F(TestRead, TestResubscribeAttributeTimeout) // Disable packet transmission, and drive IO till we have reported a re-subscription attempt. // // - mpContext->GetLoopback().mNumMessagesToDrop = chip::Test::LoopbackTransport::kUnlimitedMessageCount; - mpContext->GetIOContext().DriveIOUntil(ComputeSubscriptionTimeout(System::Clock::Seconds16(maxInterval)), - [&]() { return callback.mOnResubscriptionsAttempted > 0; }); + GetLoopback().mNumMessagesToDrop = chip::Test::LoopbackTransport::kUnlimitedMessageCount; + GetIOContext().DriveIOUntil(ComputeSubscriptionTimeout(System::Clock::Seconds16(maxInterval)), + [&]() { return callback.mOnResubscriptionsAttempted > 0; }); EXPECT_EQ(callback.mOnResubscriptionsAttempted, 1); EXPECT_EQ(callback.mLastError, CHIP_ERROR_TIMEOUT); - mpContext->GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToDrop = 0; callback.ClearCounters(); // // Drive servicing IO till we have established a subscription. // - mpContext->GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), - [&]() { return callback.mOnSubscriptionEstablishedCount == 1; }); + GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), + [&]() { return callback.mOnSubscriptionEstablishedCount == 1; }); EXPECT_EQ(callback.mOnSubscriptionEstablishedCount, 1); // @@ -1539,10 +1519,10 @@ TEST_F(TestRead, TestResubscribeAttributeTimeout) EXPECT_EQ(callback.mOnDone, 0); } - mpContext->SetMRPMode(chip::Test::MessagingContext::MRPMode::kDefault); + SetMRPMode(chip::Test::MessagingContext::MRPMode::kDefault); app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } // @@ -1551,18 +1531,18 @@ TEST_F(TestRead, TestResubscribeAttributeTimeout) // TEST_F(TestRead, TestSubscribeAttributeTimeout) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); - mpContext->SetMRPMode(chip::Test::MessagingContext::MRPMode::kResponsive); + SetMRPMode(chip::Test::MessagingContext::MRPMode::kResponsive); { TestResubscriptionCallback callback; - app::ReadClient readClient(app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), callback, + app::ReadClient readClient(app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), callback, app::ReadClient::InteractionType::Subscribe); callback.SetReadClient(&readClient); - app::ReadPrepareParams readPrepareParams(mpContext->GetSessionBobToAlice()); + app::ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); app::AttributePathParams attributePathParams[1]; readPrepareParams.mpAttributePathParamsList = attributePathParams; @@ -1583,14 +1563,14 @@ TEST_F(TestRead, TestSubscribeAttributeTimeout) // // Drive servicing IO till we have established a subscription. // - mpContext->GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), - [&]() { return callback.mOnSubscriptionEstablishedCount >= 1; }); + GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), + [&]() { return callback.mOnSubscriptionEstablishedCount >= 1; }); EXPECT_EQ(callback.mOnSubscriptionEstablishedCount, 1); // // Request we drop all further messages. // - mpContext->GetLoopback().mNumMessagesToDrop = chip::Test::LoopbackTransport::kUnlimitedMessageCount; + GetLoopback().mNumMessagesToDrop = chip::Test::LoopbackTransport::kUnlimitedMessageCount; chip::app::ReadHandler * readHandler = app::InteractionModelEngine::GetInstance()->ActiveHandlerAt(0); @@ -1603,8 +1583,8 @@ TEST_F(TestRead, TestSubscribeAttributeTimeout) // by the liveness timer firing once we hit our max-interval plus // retransmit timeouts. // - mpContext->GetIOContext().DriveIOUntil(ComputeSubscriptionTimeout(System::Clock::Seconds16(maxInterval)), - [&]() { return callback.mOnError >= 1; }); + GetIOContext().DriveIOUntil(ComputeSubscriptionTimeout(System::Clock::Seconds16(maxInterval)), + [&]() { return callback.mOnError >= 1; }); EXPECT_EQ(callback.mOnError, 1); EXPECT_EQ(callback.mLastError, CHIP_ERROR_TIMEOUT); @@ -1612,16 +1592,16 @@ TEST_F(TestRead, TestSubscribeAttributeTimeout) EXPECT_EQ(callback.mOnResubscriptionsAttempted, 0); } - mpContext->SetMRPMode(chip::Test::MessagingContext::MRPMode::kDefault); + SetMRPMode(chip::Test::MessagingContext::MRPMode::kDefault); app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); - mpContext->GetLoopback().mNumMessagesToDrop = 0; + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); + GetLoopback().mNumMessagesToDrop = 0; } TEST_F(TestRead, TestReadHandler_MultipleSubscriptions) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); uint32_t numSuccessCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; @@ -1661,14 +1641,14 @@ TEST_F(TestRead, TestReadHandler_MultipleSubscriptions) for (size_t i = 0; i < (app::InteractionModelEngine::kReadHandlerPoolSize + 1); i++) { EXPECT_EQ(Controller::SubscribeAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 20, + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 20, onSubscriptionEstablishedCb, nullptr, false, true), CHIP_NO_ERROR); } // There are too many messages and the test (gcc_debug, which includes many sanity checks) will be quite slow. Note: report // engine is using ScheduleWork which cannot be handled by DrainAndServiceIO correctly. - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(60), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(60), [&]() { return numSuccessCalls == (app::InteractionModelEngine::kReadHandlerPoolSize + 1) && numSubscriptionEstablishedCalls == (app::InteractionModelEngine::kReadHandlerPoolSize + 1); }); @@ -1680,15 +1660,15 @@ TEST_F(TestRead, TestReadHandler_MultipleSubscriptions) app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); EXPECT_EQ(mNumActiveSubscriptions, 0); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); - mpContext->SetMRPMode(chip::Test::MessagingContext::MRPMode::kDefault); + SetMRPMode(chip::Test::MessagingContext::MRPMode::kDefault); app::InteractionModelEngine::GetInstance()->UnregisterReadHandlerAppCallback(); } TEST_F(TestRead, TestReadHandler_SubscriptionAppRejection) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); uint32_t numSuccessCalls = 0; uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; @@ -1724,11 +1704,11 @@ TEST_F(TestRead, TestReadHandler_SubscriptionAppRejection) mEmitSubscriptionError = true; EXPECT_EQ(Controller::SubscribeAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, onSubscriptionEstablishedCb, nullptr, false, true), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(numSuccessCalls, 0u); @@ -1742,7 +1722,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionAppRejection) app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); app::InteractionModelEngine::GetInstance()->UnregisterReadHandlerAppCallback(); mEmitSubscriptionError = false; @@ -1754,7 +1734,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionAppRejection) // Max interval equal to client-requested min-interval. TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest1) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); uint32_t numSuccessCalls = 0; uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; @@ -1799,11 +1779,11 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest1) mAlterSubscriptionIntervals = false; EXPECT_EQ(Controller::SubscribeAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 5, 5, + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 5, 5, onSubscriptionEstablishedCb, nullptr, true), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // // Failures won't get routed to us here since re-subscriptions are enabled by default in the Controller::SubscribeAttribute @@ -1818,7 +1798,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest1) EXPECT_EQ(mNumActiveSubscriptions, 0); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); app::InteractionModelEngine::GetInstance()->UnregisterReadHandlerAppCallback(); mAlterSubscriptionIntervals = false; @@ -1829,7 +1809,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest1) // With no server adjustment. TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest2) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); uint32_t numSuccessCalls = 0; uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; @@ -1874,11 +1854,11 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest2) mAlterSubscriptionIntervals = false; EXPECT_EQ(Controller::SubscribeAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, onSubscriptionEstablishedCb, nullptr, true), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // // Failures won't get routed to us here since re-subscriptions are enabled by default in the Controller::SubscribeAttribute @@ -1893,7 +1873,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest2) EXPECT_EQ(mNumActiveSubscriptions, 0); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); app::InteractionModelEngine::GetInstance()->UnregisterReadHandlerAppCallback(); mAlterSubscriptionIntervals = false; @@ -1904,7 +1884,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest2) // With server adjustment to a value greater than client-requested, but less than 60m (allowed). TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest3) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); uint32_t numSuccessCalls = 0; uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; @@ -1949,11 +1929,11 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest3) mAlterSubscriptionIntervals = true; mMaxInterval = 3000; EXPECT_EQ(Controller::SubscribeAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, onSubscriptionEstablishedCb, nullptr, true), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // // Failures won't get routed to us here since re-subscriptions are enabled by default in the Controller::SubscribeAttribute @@ -1968,7 +1948,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest3) EXPECT_EQ(mNumActiveSubscriptions, 0); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); app::InteractionModelEngine::GetInstance()->UnregisterReadHandlerAppCallback(); mAlterSubscriptionIntervals = false; @@ -1981,7 +1961,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest3) // server adjustment to a value greater than client-requested, but greater than 60 (not allowed). TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest4) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); uint32_t numSuccessCalls = 0; uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; @@ -2017,11 +1997,11 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest4) mAlterSubscriptionIntervals = true; mMaxInterval = 3700; EXPECT_EQ(Controller::SubscribeAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, onSubscriptionEstablishedCb, nullptr, true), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // // Failures won't get routed to us here since re-subscriptions are enabled by default in the Controller::SubscribeAttribute @@ -2035,7 +2015,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest4) EXPECT_EQ(mNumActiveSubscriptions, 0); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); app::InteractionModelEngine::GetInstance()->UnregisterReadHandlerAppCallback(); mAlterSubscriptionIntervals = false; @@ -2048,7 +2028,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest4) // With no server adjustment. TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest5) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); uint32_t numSuccessCalls = 0; uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; @@ -2093,11 +2073,11 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest5) mAlterSubscriptionIntervals = false; EXPECT_EQ(Controller::SubscribeAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 4000, + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 4000, onSubscriptionEstablishedCb, nullptr, true), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // // Failures won't get routed to us here since re-subscriptions are enabled by default in the Controller::SubscribeAttribute @@ -2112,7 +2092,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest5) EXPECT_EQ(mNumActiveSubscriptions, 0); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); app::InteractionModelEngine::GetInstance()->UnregisterReadHandlerAppCallback(); mAlterSubscriptionIntervals = false; @@ -2123,7 +2103,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest5) // With server adjustment to a value lower than 60m. Allowed TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest6) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); uint32_t numSuccessCalls = 0; uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; @@ -2168,11 +2148,11 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest6) mAlterSubscriptionIntervals = true; mMaxInterval = 3000; EXPECT_EQ(Controller::SubscribeAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 4000, + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 4000, onSubscriptionEstablishedCb, nullptr, true), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // // Failures won't get routed to us here since re-subscriptions are enabled by default in the Controller::SubscribeAttribute @@ -2187,7 +2167,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest6) EXPECT_EQ(mNumActiveSubscriptions, 0); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); app::InteractionModelEngine::GetInstance()->UnregisterReadHandlerAppCallback(); mAlterSubscriptionIntervals = false; @@ -2198,7 +2178,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest6) // With server adjustment to a value larger than 60m, but less than max interval. Allowed TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest7) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); uint32_t numSuccessCalls = 0; uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; @@ -2242,11 +2222,11 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest7) mAlterSubscriptionIntervals = true; mMaxInterval = 3700; EXPECT_EQ(Controller::SubscribeAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 4000, + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 4000, onSubscriptionEstablishedCb, nullptr, true), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // // Failures won't get routed to us here since re-subscriptions are enabled by default in the Controller::SubscribeAttribute @@ -2261,7 +2241,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest7) EXPECT_EQ(mNumActiveSubscriptions, 0); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); app::InteractionModelEngine::GetInstance()->UnregisterReadHandlerAppCallback(); mAlterSubscriptionIntervals = false; @@ -2274,7 +2254,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest7) // With server adjustment to a value larger than 60m, but larger than max interval. Disallowed TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest8) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); uint32_t numSuccessCalls = 0; uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; @@ -2309,11 +2289,11 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest8) mAlterSubscriptionIntervals = true; mMaxInterval = 4100; EXPECT_EQ(Controller::SubscribeAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 4000, + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 4000, onSubscriptionEstablishedCb, nullptr, true), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // // Failures won't get routed to us here since re-subscriptions are enabled by default in the Controller::SubscribeAttribute @@ -2327,7 +2307,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest8) EXPECT_EQ(mNumActiveSubscriptions, 0); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); app::InteractionModelEngine::GetInstance()->UnregisterReadHandlerAppCallback(); mAlterSubscriptionIntervals = false; @@ -2337,7 +2317,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest8) // Validate client is not requesting max-interval < min-interval. TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest9) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); uint32_t numSuccessCalls = 0; uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; @@ -2373,7 +2353,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest9) mAlterSubscriptionIntervals = false; EXPECT_EQ(Controller::SubscribeAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 5, 4, + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 5, 4, onSubscriptionEstablishedCb, nullptr, true), CHIP_ERROR_INVALID_ARGUMENT); @@ -2389,7 +2369,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest9) EXPECT_EQ(mNumActiveSubscriptions, 0); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); app::InteractionModelEngine::GetInstance()->UnregisterReadHandlerAppCallback(); mAlterSubscriptionIntervals = false; @@ -2401,19 +2381,19 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest9) */ TEST_F(TestRead, TestSubscribe_OnActiveModeNotification) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); - mpContext->SetMRPMode(chip::Test::MessagingContext::MRPMode::kResponsive); + SetMRPMode(chip::Test::MessagingContext::MRPMode::kResponsive); { TestResubscriptionCallback callback; - app::ReadClient readClient(app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), callback, + app::ReadClient readClient(app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), callback, app::ReadClient::InteractionType::Subscribe); callback.mScheduleLITResubscribeImmediately = false; callback.SetReadClient(&readClient); - app::ReadPrepareParams readPrepareParams(mpContext->GetSessionBobToAlice()); + app::ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); // Read full wildcard paths, repeat twice to ensure chunking. app::AttributePathParams attributePathParams[1]; @@ -2434,8 +2414,8 @@ TEST_F(TestRead, TestSubscribe_OnActiveModeNotification) // // Drive servicing IO till we have established a subscription. // - mpContext->GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), - [&]() { return callback.mOnSubscriptionEstablishedCount >= 1; }); + GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), + [&]() { return callback.mOnSubscriptionEstablishedCount >= 1; }); EXPECT_EQ(callback.mOnSubscriptionEstablishedCount, 1); EXPECT_EQ(callback.mOnError, 0); EXPECT_EQ(callback.mOnResubscriptionsAttempted, 0); @@ -2451,13 +2431,12 @@ TEST_F(TestRead, TestSubscribe_OnActiveModeNotification) // WakeUp() is called. // // - mpContext->GetLoopback().mNumMessagesToDrop = chip::Test::LoopbackTransport::kUnlimitedMessageCount; - mpContext->GetIOContext().DriveIOUntil(ComputeSubscriptionTimeout(System::Clock::Seconds16(maxInterval)), - [&]() { return false; }); + GetLoopback().mNumMessagesToDrop = chip::Test::LoopbackTransport::kUnlimitedMessageCount; + GetIOContext().DriveIOUntil(ComputeSubscriptionTimeout(System::Clock::Seconds16(maxInterval)), [&]() { return false; }); EXPECT_EQ(callback.mOnResubscriptionsAttempted, 1); EXPECT_EQ(callback.mLastError, CHIP_ERROR_LIT_SUBSCRIBE_INACTIVE_TIMEOUT); - mpContext->GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToDrop = 0; callback.ClearCounters(); app::InteractionModelEngine::GetInstance()->OnActiveModeNotification( ScopedNodeId(readClient.GetPeerNodeId(), readClient.GetFabricIndex())); @@ -2467,8 +2446,8 @@ TEST_F(TestRead, TestSubscribe_OnActiveModeNotification) // // Drive servicing IO till we have established a subscription. // - mpContext->GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), - [&]() { return callback.mOnSubscriptionEstablishedCount == 1; }); + GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), + [&]() { return callback.mOnSubscriptionEstablishedCount == 1; }); EXPECT_EQ(callback.mOnSubscriptionEstablishedCount, 1); // @@ -2478,10 +2457,10 @@ TEST_F(TestRead, TestSubscribe_OnActiveModeNotification) EXPECT_EQ(callback.mOnDone, 0); } - mpContext->SetMRPMode(chip::Test::MessagingContext::MRPMode::kDefault); + SetMRPMode(chip::Test::MessagingContext::MRPMode::kDefault); app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } /** @@ -2490,21 +2469,21 @@ TEST_F(TestRead, TestSubscribe_OnActiveModeNotification) */ TEST_F(TestRead, TestSubscribe_DynamicLITSubscription) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); - mpContext->SetMRPMode(chip::Test::MessagingContext::MRPMode::kResponsive); + SetMRPMode(chip::Test::MessagingContext::MRPMode::kResponsive); ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); ScopedChange isLitIcd(gIsLitIcd, false); { TestResubscriptionCallback callback; - app::ReadClient readClient(app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), callback, + app::ReadClient readClient(app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), callback, app::ReadClient::InteractionType::Subscribe); callback.mScheduleLITResubscribeImmediately = false; callback.SetReadClient(&readClient); - app::ReadPrepareParams readPrepareParams(mpContext->GetSessionBobToAlice()); + app::ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); // Read full wildcard paths, repeat twice to ensure chunking. app::AttributePathParams attributePathParams[1]; @@ -2525,8 +2504,8 @@ TEST_F(TestRead, TestSubscribe_DynamicLITSubscription) // // Drive servicing IO till we have established a subscription. // - mpContext->GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), - [&]() { return callback.mOnSubscriptionEstablishedCount >= 1; }); + GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), + [&]() { return callback.mOnSubscriptionEstablishedCount >= 1; }); EXPECT_EQ(callback.mOnSubscriptionEstablishedCount, 1); EXPECT_EQ(callback.mOnError, 0); EXPECT_EQ(callback.mOnResubscriptionsAttempted, 0); @@ -2545,20 +2524,20 @@ TEST_F(TestRead, TestSubscribe_DynamicLITSubscription) // // Even if we set the peer type to LIT before, the report indicates that the peer is a SIT now, it will just bahve as // normal, non-LIT subscriptions. - mpContext->GetLoopback().mNumMessagesToDrop = chip::Test::LoopbackTransport::kUnlimitedMessageCount; - mpContext->GetIOContext().DriveIOUntil(ComputeSubscriptionTimeout(System::Clock::Seconds16(maxInterval)), - [&]() { return callback.mOnResubscriptionsAttempted != 0; }); + GetLoopback().mNumMessagesToDrop = chip::Test::LoopbackTransport::kUnlimitedMessageCount; + GetIOContext().DriveIOUntil(ComputeSubscriptionTimeout(System::Clock::Seconds16(maxInterval)), + [&]() { return callback.mOnResubscriptionsAttempted != 0; }); EXPECT_EQ(callback.mOnResubscriptionsAttempted, 1); EXPECT_EQ(callback.mLastError, CHIP_ERROR_TIMEOUT); - mpContext->GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToDrop = 0; callback.ClearCounters(); // // Drive servicing IO till we have established a subscription. // - mpContext->GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), - [&]() { return callback.mOnSubscriptionEstablishedCount == 1; }); + GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), + [&]() { return callback.mOnSubscriptionEstablishedCount == 1; }); EXPECT_EQ(callback.mOnSubscriptionEstablishedCount, 1); // @@ -2578,25 +2557,23 @@ TEST_F(TestRead, TestSubscribe_DynamicLITSubscription) app::InteractionModelEngine::GetInstance()->GetReportingEngine().SetDirty(path); } callback.ClearCounters(); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(60), [&]() { - return app::InteractionModelEngine::GetInstance()->GetNumDirtySubscriptions() == 0; - }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(60), + [&]() { return app::InteractionModelEngine::GetInstance()->GetNumDirtySubscriptions() == 0; }); // When we received the update that OperatingMode becomes LIT, we automatically set the inner peer type to LIT ICD. - mpContext->GetLoopback().mNumMessagesToDrop = chip::Test::LoopbackTransport::kUnlimitedMessageCount; - mpContext->GetIOContext().DriveIOUntil(ComputeSubscriptionTimeout(System::Clock::Seconds16(maxInterval)), - [&]() { return false; }); + GetLoopback().mNumMessagesToDrop = chip::Test::LoopbackTransport::kUnlimitedMessageCount; + GetIOContext().DriveIOUntil(ComputeSubscriptionTimeout(System::Clock::Seconds16(maxInterval)), [&]() { return false; }); EXPECT_EQ(callback.mOnResubscriptionsAttempted, 1); EXPECT_EQ(callback.mLastError, CHIP_ERROR_LIT_SUBSCRIBE_INACTIVE_TIMEOUT); - mpContext->GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToDrop = 0; callback.ClearCounters(); } - mpContext->SetMRPMode(chip::Test::MessagingContext::MRPMode::kDefault); + SetMRPMode(chip::Test::MessagingContext::MRPMode::kDefault); app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } /** @@ -2605,19 +2582,19 @@ TEST_F(TestRead, TestSubscribe_DynamicLITSubscription) */ TEST_F(TestRead, TestSubscribe_ImmediatelyResubscriptionForLIT) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); - mpContext->SetMRPMode(chip::Test::MessagingContext::MRPMode::kResponsive); + SetMRPMode(chip::Test::MessagingContext::MRPMode::kResponsive); { TestResubscriptionCallback callback; - app::ReadClient readClient(app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), callback, + app::ReadClient readClient(app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), callback, app::ReadClient::InteractionType::Subscribe); callback.mScheduleLITResubscribeImmediately = true; callback.SetReadClient(&readClient); - app::ReadPrepareParams readPrepareParams(mpContext->GetSessionBobToAlice()); + app::ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); // Read full wildcard paths, repeat twice to ensure chunking. app::AttributePathParams attributePathParams[1]; @@ -2638,8 +2615,8 @@ TEST_F(TestRead, TestSubscribe_ImmediatelyResubscriptionForLIT) // // Drive servicing IO till we have established a subscription. // - mpContext->GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), - [&]() { return callback.mOnSubscriptionEstablishedCount >= 1; }); + GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), + [&]() { return callback.mOnSubscriptionEstablishedCount >= 1; }); EXPECT_EQ(callback.mOnSubscriptionEstablishedCount, 1); EXPECT_EQ(callback.mOnError, 0); EXPECT_EQ(callback.mOnResubscriptionsAttempted, 0); @@ -2655,20 +2632,20 @@ TEST_F(TestRead, TestSubscribe_ImmediatelyResubscriptionForLIT) // WakeUp() is called. // // - mpContext->GetLoopback().mNumMessagesToDrop = chip::Test::LoopbackTransport::kUnlimitedMessageCount; - mpContext->GetIOContext().DriveIOUntil(ComputeSubscriptionTimeout(System::Clock::Seconds16(maxInterval)), - [&]() { return callback.mLastError == CHIP_ERROR_LIT_SUBSCRIBE_INACTIVE_TIMEOUT; }); + GetLoopback().mNumMessagesToDrop = chip::Test::LoopbackTransport::kUnlimitedMessageCount; + GetIOContext().DriveIOUntil(ComputeSubscriptionTimeout(System::Clock::Seconds16(maxInterval)), + [&]() { return callback.mLastError == CHIP_ERROR_LIT_SUBSCRIBE_INACTIVE_TIMEOUT; }); EXPECT_EQ(callback.mOnResubscriptionsAttempted, 1); EXPECT_EQ(callback.mLastError, CHIP_ERROR_LIT_SUBSCRIBE_INACTIVE_TIMEOUT); - mpContext->GetLoopback().mNumMessagesToDrop = 0; + GetLoopback().mNumMessagesToDrop = 0; callback.ClearCounters(); // // Drive servicing IO till we have established a subscription. // - mpContext->GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), - [&]() { return callback.mOnSubscriptionEstablishedCount == 1; }); + GetIOContext().DriveIOUntil(System::Clock::Milliseconds32(2000), + [&]() { return callback.mOnSubscriptionEstablishedCount == 1; }); EXPECT_EQ(callback.mOnSubscriptionEstablishedCount, 1); // @@ -2678,10 +2655,10 @@ TEST_F(TestRead, TestSubscribe_ImmediatelyResubscriptionForLIT) EXPECT_EQ(callback.mOnDone, 0); } - mpContext->SetMRPMode(chip::Test::MessagingContext::MRPMode::kDefault); + SetMRPMode(chip::Test::MessagingContext::MRPMode::kDefault); app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestRead, TestReadHandler_MultipleReads) @@ -2689,9 +2666,9 @@ TEST_F(TestRead, TestReadHandler_MultipleReads) static_assert(CHIP_IM_MAX_REPORTS_IN_FLIGHT <= app::InteractionModelEngine::kReadHandlerPoolSize, "How can we have more reports in flight than read handlers?"); - MultipleReadHelper(mpContext, CHIP_IM_MAX_REPORTS_IN_FLIGHT); + MultipleReadHelper(CHIP_IM_MAX_REPORTS_IN_FLIGHT); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); } @@ -2702,9 +2679,9 @@ TEST_F(TestRead, TestReadHandler_OneSubscribeMultipleReads) "How can we have more reports in flight than read handlers?"); static_assert(CHIP_IM_MAX_REPORTS_IN_FLIGHT > 1, "We won't do any reads"); - SubscribeThenReadHelper(mpContext, 1, CHIP_IM_MAX_REPORTS_IN_FLIGHT - 1); + SubscribeThenReadHelper(1, CHIP_IM_MAX_REPORTS_IN_FLIGHT - 1); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); } @@ -2715,16 +2692,16 @@ TEST_F(TestRead, TestReadHandler_TwoSubscribesMultipleReads) "How can we have more reports in flight than read handlers?"); static_assert(CHIP_IM_MAX_REPORTS_IN_FLIGHT > 2, "We won't do any reads"); - SubscribeThenReadHelper(mpContext, 2, CHIP_IM_MAX_REPORTS_IN_FLIGHT - 2); + SubscribeThenReadHelper(2, CHIP_IM_MAX_REPORTS_IN_FLIGHT - 2); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); } -void TestRead::SubscribeThenReadHelper(TestContext * apCtx, size_t aSubscribeCount, size_t aReadCount) +void TestRead::SubscribeThenReadHelper(size_t aSubscribeCount, size_t aReadCount) { - auto sessionHandle = apCtx->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); uint32_t numSuccessCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; @@ -2748,25 +2725,25 @@ void TestRead::SubscribeThenReadHelper(TestContext * apCtx, size_t aSubscribeCou EXPECT_TRUE(false); }; - auto onSubscriptionEstablishedCb = [&numSubscriptionEstablishedCalls, &apCtx, aSubscribeCount, aReadCount, &numReadSuccessCalls, + auto onSubscriptionEstablishedCb = [&numSubscriptionEstablishedCalls, this, aSubscribeCount, aReadCount, &numReadSuccessCalls, &numReadFailureCalls](const app::ReadClient & readClient, chip::SubscriptionId aSubscriptionId) { numSubscriptionEstablishedCalls++; if (numSubscriptionEstablishedCalls == aSubscribeCount) { - MultipleReadHelperInternal(apCtx, aReadCount, numReadSuccessCalls, numReadFailureCalls); + MultipleReadHelperInternal(aReadCount, numReadSuccessCalls, numReadFailureCalls); } }; for (size_t i = 0; i < aSubscribeCount; ++i) { EXPECT_EQ(Controller::SubscribeAttribute( - &apCtx->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, onSubscriptionEstablishedCb, nullptr, false, true), CHIP_NO_ERROR); } - apCtx->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(numSuccessCalls, aSubscribeCount); EXPECT_EQ(numSubscriptionEstablishedCalls, aSubscribeCount); @@ -2776,13 +2753,12 @@ void TestRead::SubscribeThenReadHelper(TestContext * apCtx, size_t aSubscribeCou // The guts of MultipleReadHelper which take references to the success/failure // counts to modify and assume the consumer will be spinning the event loop. -void TestRead::MultipleReadHelperInternal(TestContext * apCtx, size_t aReadCount, uint32_t & aNumSuccessCalls, - uint32_t & aNumFailureCalls) +void TestRead::MultipleReadHelperInternal(size_t aReadCount, uint32_t & aNumSuccessCalls, uint32_t & aNumFailureCalls) { EXPECT_EQ(aNumSuccessCalls, 0u); EXPECT_EQ(aNumFailureCalls, 0u); - auto sessionHandle = apCtx->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); @@ -2803,19 +2779,19 @@ void TestRead::MultipleReadHelperInternal(TestContext * apCtx, size_t aReadCount }; EXPECT_EQ(Controller::ReadAttribute( - &apCtx->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb), + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb), CHIP_NO_ERROR); } } -void TestRead::MultipleReadHelper(TestContext * apCtx, size_t aReadCount) +void TestRead::MultipleReadHelper(size_t aReadCount) { uint32_t numSuccessCalls = 0; uint32_t numFailureCalls = 0; - MultipleReadHelperInternal(apCtx, aReadCount, numSuccessCalls, numFailureCalls); + MultipleReadHelperInternal(aReadCount, numSuccessCalls, numFailureCalls); - apCtx->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(numSuccessCalls, aReadCount); EXPECT_EQ(numFailureCalls, 0u); @@ -2823,7 +2799,7 @@ void TestRead::MultipleReadHelper(TestContext * apCtx, size_t aReadCount) TEST_F(TestRead, TestReadHandler_MultipleSubscriptionsWithDataVersionFilter) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); uint32_t numSuccessCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; @@ -2859,14 +2835,14 @@ TEST_F(TestRead, TestReadHandler_MultipleSubscriptionsWithDataVersionFilter) for (size_t i = 0; i < (app::InteractionModelEngine::kReadHandlerPoolSize + 1); i++) { EXPECT_EQ(Controller::SubscribeAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, 0, 10, onSubscriptionEstablishedCb, nullptr, false, true, dataVersion), CHIP_NO_ERROR); } // There are too many messages and the test (gcc_debug, which includes many sanity checks) will be quite slow. Note: report // engine is using ScheduleWork which cannot be handled by DrainAndServiceIO correctly. - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(30), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(30), [&]() { return numSubscriptionEstablishedCalls == (app::InteractionModelEngine::kReadHandlerPoolSize + 1) && numSuccessCalls == (app::InteractionModelEngine::kReadHandlerPoolSize + 1); }); @@ -2879,11 +2855,12 @@ TEST_F(TestRead, TestReadHandler_MultipleSubscriptionsWithDataVersionFilter) EXPECT_EQ(numSubscriptionEstablishedCalls, (app::InteractionModelEngine::kReadHandlerPoolSize + 1)); app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestRead, TestReadHandler_DataVersionFiltersTruncated) { + static TestRead * pContext = this; struct : public chip::Test::LoopbackTransportDelegate { size_t requestSize = 0; @@ -2891,13 +2868,13 @@ TEST_F(TestRead, TestReadHandler_DataVersionFiltersTruncated) { // We only care about the messages we (Alice) send to Bob, not the responses. // Assume the first message we see in an iteration is the request. - if (peer == mpContext->GetBobAddress() && requestSize == 0) + if (peer == pContext->GetBobAddress() && requestSize == 0) { requestSize = message->TotalLength(); } } } loopbackDelegate; - mpContext->GetLoopback().SetLoopbackTransportDelegate(&loopbackDelegate); + GetLoopback().SetLoopbackTransportDelegate(&loopbackDelegate); // Note that on the server side, wildcard expansion does not actually work for kTestEndpointId due // to lack of meta-data, but we don't care about the reports we get back in this test. @@ -2919,7 +2896,7 @@ TEST_F(TestRead, TestReadHandler_DataVersionFiltersTruncated) lastRequestSize = loopbackDelegate.requestSize; loopbackDelegate.requestSize = 0; // reset - ReadPrepareParams read(mpContext->GetSessionAliceToBob()); + ReadPrepareParams read(GetSessionAliceToBob()); read.mpAttributePathParamsList = &wildcardPath; read.mAttributePathParamsListSize = 1; read.mpDataVersionFilterList = dataVersionFilters; @@ -2934,14 +2911,14 @@ TEST_F(TestRead, TestReadHandler_DataVersionFiltersTruncated) } readCallback; - ReadClient readClient(app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), readCallback, + ReadClient readClient(app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), readCallback, ReadClient::InteractionType::Read); EXPECT_EQ(readClient.SendRequest(read), CHIP_NO_ERROR); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.done; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.done; }); EXPECT_EQ(readCallback.error, CHIP_NO_ERROR); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); EXPECT_NE(loopbackDelegate.requestSize, 0u); EXPECT_GE(loopbackDelegate.requestSize, lastRequestSize); @@ -2959,12 +2936,12 @@ TEST_F(TestRead, TestReadHandler_DataVersionFiltersTruncated) ADD_FAILURE(); exit: - mpContext->GetLoopback().SetLoopbackTransportDelegate(nullptr); + GetLoopback().SetLoopbackTransportDelegate(nullptr); } TEST_F(TestRead, TestReadHandlerResourceExhaustion_MultipleReads) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); uint32_t numSuccessCalls = 0; uint32_t numFailureCalls = 0; @@ -2989,10 +2966,10 @@ TEST_F(TestRead, TestReadHandlerResourceExhaustion_MultipleReads) app::InteractionModelEngine::GetInstance()->SetForceHandlerQuota(true); EXPECT_EQ(Controller::ReadAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb), + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); app::InteractionModelEngine::GetInstance()->SetHandlerCapacityForReads(-1); app::InteractionModelEngine::GetInstance()->SetForceHandlerQuota(false); @@ -3001,7 +2978,7 @@ TEST_F(TestRead, TestReadHandlerResourceExhaustion_MultipleReads) EXPECT_EQ(numSuccessCalls, 0u); EXPECT_EQ(numFailureCalls, 1u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestRead, TestReadFabricScopedWithoutFabricFilter) @@ -3016,7 +2993,7 @@ TEST_F(TestRead, TestReadFabricScopedWithoutFabricFilter) * encoder. * - When a fabric filtered read request is received, the response encoder is able to encode the attribute correctly. */ - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessCbInvoked = false, onFailureCbInvoked = false; ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); @@ -3039,14 +3016,14 @@ TEST_F(TestRead, TestReadFabricScopedWithoutFabricFilter) }; Controller::ReadAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, false /* fabric filtered */); + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, false /* fabric filtered */); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(onSuccessCbInvoked && !onFailureCbInvoked); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadClients(), 0u); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestRead, TestReadFabricScopedWithFabricFilter) @@ -3061,7 +3038,7 @@ TEST_F(TestRead, TestReadFabricScopedWithFabricFilter) * encoder. * - When a fabric filtered read request is received, the response encoder is able to encode the attribute correctly. */ - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessCbInvoked = false, onFailureCbInvoked = false; ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); @@ -3093,14 +3070,14 @@ TEST_F(TestRead, TestReadFabricScopedWithFabricFilter) }; Controller::ReadAttribute( - &mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, true /* fabric filtered */); + &GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb, true /* fabric filtered */); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(onSuccessCbInvoked && !onFailureCbInvoked); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadClients(), 0u); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } namespace SubscriptionPathQuotaHelpers { @@ -3201,16 +3178,16 @@ void EstablishReadOrSubscriptions(const SessionHandle & sessionHandle, size_t nu TEST_F(TestRead, TestSubscribeAttributeDeniedNotExistPath) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); - mpContext->SetMRPMode(chip::Test::MessagingContext::MRPMode::kResponsive); + SetMRPMode(chip::Test::MessagingContext::MRPMode::kResponsive); { SubscriptionPathQuotaHelpers::TestReadCallback callback; - app::ReadClient readClient(app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), callback, + app::ReadClient readClient(app::InteractionModelEngine::GetInstance(), &GetExchangeManager(), callback, app::ReadClient::InteractionType::Subscribe); - app::ReadPrepareParams readPrepareParams(mpContext->GetSessionBobToAlice()); + app::ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); app::AttributePathParams attributePathParams[1]; readPrepareParams.mpAttributePathParamsList = attributePathParams; @@ -3226,27 +3203,27 @@ TEST_F(TestRead, TestSubscribeAttributeDeniedNotExistPath) auto err = readClient.SendRequest(readPrepareParams); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(callback.mOnError, 1u); EXPECT_EQ(callback.mLastError, CHIP_IM_GLOBAL_STATUS(InvalidAction)); EXPECT_EQ(callback.mOnDone, 1u); } - mpContext->SetMRPMode(chip::Test::MessagingContext::MRPMode::kDefault); + SetMRPMode(chip::Test::MessagingContext::MRPMode::kDefault); app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestRead, TestReadHandler_KillOverQuotaSubscriptions) { - // Note: We cannot use mpContext->DrainAndServiceIO() since the perpetual read will make DrainAndServiceIO never return. + // Note: We cannot use DrainAndServiceIO() since the perpetual read will make DrainAndServiceIO never return. using namespace SubscriptionPathQuotaHelpers; - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); const auto kExpectedParallelSubs = - app::InteractionModelEngine::kMinSupportedSubscriptionsPerFabric * mpContext->GetFabricTable().FabricCount(); + app::InteractionModelEngine::kMinSupportedSubscriptionsPerFabric * GetFabricTable().FabricCount(); const auto kExpectedParallelPaths = kExpectedParallelSubs * app::InteractionModelEngine::kMinSupportedPathsPerSubscription; app::InteractionModelEngine::GetInstance()->RegisterReadHandlerAppCallback(this); @@ -3258,13 +3235,13 @@ TEST_F(TestRead, TestReadHandler_KillOverQuotaSubscriptions) TestPerpetualListReadCallback perpetualReadCallback; std::vector> readClients; - EstablishReadOrSubscriptions(mpContext->GetSessionAliceToBob(), 1, 1, + EstablishReadOrSubscriptions(GetSessionAliceToBob(), 1, 1, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, kPerpetualAttributeid), app::ReadClient::InteractionType::Read, &perpetualReadCallback, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, 1, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, 1, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, kPerpetualAttributeid), app::ReadClient::InteractionType::Read, &perpetualReadCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(app::ReadHandler::InteractionType::Read) == 2; }); // Ensure our read transactions are established. @@ -3280,18 +3257,18 @@ TEST_F(TestRead, TestReadHandler_KillOverQuotaSubscriptions) // // Subscription A EstablishReadOrSubscriptions( - mpContext->GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerSubscription + 1, + GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerSubscription + 1, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Subscribe, &readCallback, readClients); // Subscription B EstablishReadOrSubscriptions( - mpContext->GetSessionBobToAlice(), kExpectedParallelSubs, app::InteractionModelEngine::kMinSupportedPathsPerSubscription, + GetSessionBobToAlice(), kExpectedParallelSubs, app::InteractionModelEngine::kMinSupportedPathsPerSubscription, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Subscribe, &readCallback, readClients); // There are too many messages and the test (gcc_debug, which includes many sanity checks) will be quite slow. Note: report // engine is using ScheduleWork which cannot be handled by DrainAndServiceIO correctly. - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnSubscriptionEstablishedCount == kExpectedParallelSubs + 1 && readCallback.mAttributeCount == kExpectedParallelSubs * app::InteractionModelEngine::kMinSupportedPathsPerSubscription + @@ -3317,11 +3294,11 @@ TEST_F(TestRead, TestReadHandler_KillOverQuotaSubscriptions) TestReadCallback callback; std::vector> outReadClient; EstablishReadOrSubscriptions( - mpContext->GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerSubscription + 1, + GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerSubscription + 1, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Subscribe, &callback, outReadClient); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return callback.mOnError == 1; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return callback.mOnError == 1; }); // Over-sized request after used all paths will receive Paths Exhausted status code. EXPECT_EQ(callback.mOnError, 1u); @@ -3332,13 +3309,13 @@ TEST_F(TestRead, TestReadHandler_KillOverQuotaSubscriptions) // was previously established with more paths than the limit per fabric) { EstablishReadOrSubscriptions( - mpContext->GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerSubscription, + GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerSubscription, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Subscribe, &readCallback, readClients); readCallback.ClearCounters(); // Run until the new subscription got setup fully as viewed by the client. - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnSubscriptionEstablishedCount == 1 && readCallback.mAttributeCount == app::InteractionModelEngine::kMinSupportedPathsPerSubscription; }); @@ -3363,9 +3340,8 @@ TEST_F(TestRead, TestReadHandler_KillOverQuotaSubscriptions) readCallback.ClearCounters(); // Run until all subscriptions are clean. - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(60), [&]() { - return app::InteractionModelEngine::GetInstance()->GetNumDirtySubscriptions() == 0; - }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(60), + [&]() { return app::InteractionModelEngine::GetInstance()->GetNumDirtySubscriptions() == 0; }); // Before the above subscription, we have one subscription with kMinSupportedPathsPerSubscription + 1 paths, we should evict // that subscription before evicting any other subscriptions, which will result we used exactly kExpectedParallelPaths and have @@ -3380,19 +3356,19 @@ TEST_F(TestRead, TestReadHandler_KillOverQuotaSubscriptions) // Part 2: Testing per fabric minimas. // Validate we have more than kMinSupportedSubscriptionsPerFabric subscriptions for testing per fabric minimas. EXPECT_GT(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(app::ReadHandler::InteractionType::Subscribe, - mpContext->GetAliceFabricIndex()), + GetAliceFabricIndex()), app::InteractionModelEngine::kMinSupportedSubscriptionsPerFabric); // The following check will trigger the logic in im to kill the read handlers that use more paths than the limit per fabric. { EstablishReadOrSubscriptions( - mpContext->GetSessionAliceToBob(), app::InteractionModelEngine::kMinSupportedSubscriptionsPerFabric, + GetSessionAliceToBob(), app::InteractionModelEngine::kMinSupportedSubscriptionsPerFabric, app::InteractionModelEngine::kMinSupportedPathsPerSubscription, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Subscribe, &readCallbackFabric2, readClients); // Run until we have established the subscriptions. - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallbackFabric2.mOnSubscriptionEstablishedCount == app::InteractionModelEngine::kMinSupportedSubscriptionsPerFabric && readCallbackFabric2.mAttributeCount == @@ -3420,9 +3396,8 @@ TEST_F(TestRead, TestReadHandler_KillOverQuotaSubscriptions) readCallbackFabric2.ClearCounters(); // Run until all subscriptions are clean. - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(60), [&]() { - return app::InteractionModelEngine::GetInstance()->GetNumDirtySubscriptions() == 0; - }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(60), + [&]() { return app::InteractionModelEngine::GetInstance()->GetNumDirtySubscriptions() == 0; }); // Some subscriptions on fabric 1 should be evicted since fabric 1 is using more resources than the limits. EXPECT_EQ(readCallback.mAttributeCount, @@ -3432,22 +3407,22 @@ TEST_F(TestRead, TestReadHandler_KillOverQuotaSubscriptions) app::InteractionModelEngine::kMinSupportedPathsPerSubscription * app::InteractionModelEngine::kMinSupportedSubscriptionsPerFabric); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(app::ReadHandler::InteractionType::Subscribe, - mpContext->GetAliceFabricIndex()), + GetAliceFabricIndex()), app::InteractionModelEngine::kMinSupportedSubscriptionsPerFabric); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(app::ReadHandler::InteractionType::Subscribe, - mpContext->GetBobFabricIndex()), + GetBobFabricIndex()), app::InteractionModelEngine::kMinSupportedSubscriptionsPerFabric); // Ensure our read transactions are still alive. EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(app::ReadHandler::InteractionType::Read), 2u); app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Shutdown all clients readClients.clear(); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); app::InteractionModelEngine::GetInstance()->SetForceHandlerQuota(false); app::InteractionModelEngine::GetInstance()->SetHandlerCapacityForSubscriptions(-1); app::InteractionModelEngine::GetInstance()->SetPathPoolCapacityForSubscriptions(-1); @@ -3456,10 +3431,10 @@ TEST_F(TestRead, TestReadHandler_KillOverQuotaSubscriptions) TEST_F(TestRead, TestReadHandler_KillOldestSubscriptions) { using namespace SubscriptionPathQuotaHelpers; - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); const auto kExpectedParallelSubs = - app::InteractionModelEngine::kMinSupportedSubscriptionsPerFabric * mpContext->GetFabricTable().FabricCount(); + app::InteractionModelEngine::kMinSupportedSubscriptionsPerFabric * GetFabricTable().FabricCount(); const auto kExpectedParallelPaths = kExpectedParallelSubs * app::InteractionModelEngine::kMinSupportedPathsPerSubscription; app::InteractionModelEngine::GetInstance()->RegisterReadHandlerAppCallback(this); @@ -3473,11 +3448,11 @@ TEST_F(TestRead, TestReadHandler_KillOldestSubscriptions) // This should just use all availbale resources. EstablishReadOrSubscriptions( - mpContext->GetSessionBobToAlice(), kExpectedParallelSubs, app::InteractionModelEngine::kMinSupportedPathsPerSubscription, + GetSessionBobToAlice(), kExpectedParallelSubs, app::InteractionModelEngine::kMinSupportedPathsPerSubscription, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Subscribe, &readCallback, readClients); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(readCallback.mAttributeCount, kExpectedParallelSubs * app::InteractionModelEngine::kMinSupportedPathsPerSubscription); EXPECT_EQ(readCallback.mOnSubscriptionEstablishedCount, kExpectedParallelSubs); @@ -3488,11 +3463,11 @@ TEST_F(TestRead, TestReadHandler_KillOldestSubscriptions) TestReadCallback callback; std::vector> outReadClient; EstablishReadOrSubscriptions( - mpContext->GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerSubscription + 1, + GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerSubscription + 1, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Subscribe, &callback, outReadClient); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Over-sized request after used all paths will receive Paths Exhausted status code. EXPECT_EQ(callback.mOnError, 1u); @@ -3502,12 +3477,12 @@ TEST_F(TestRead, TestReadHandler_KillOldestSubscriptions) // The following check will trigger the logic in im to kill the read handlers that uses more paths than the limit per fabric. { EstablishReadOrSubscriptions( - mpContext->GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerSubscription, + GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerSubscription, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Subscribe, &readCallback, readClients); readCallback.ClearCounters(); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // This read handler should evict some existing subscriptions for enough space EXPECT_EQ(readCallback.mOnSubscriptionEstablishedCount, 1u); @@ -3524,17 +3499,17 @@ TEST_F(TestRead, TestReadHandler_KillOldestSubscriptions) app::InteractionModelEngine::GetInstance()->GetReportingEngine().SetDirty(path); } readCallback.ClearCounters(); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_LE(readCallback.mAttributeCount, kExpectedParallelPaths); app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); // Shutdown all clients readClients.clear(); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); app::InteractionModelEngine::GetInstance()->SetForceHandlerQuota(false); app::InteractionModelEngine::GetInstance()->SetHandlerCapacityForSubscriptions(-1); app::InteractionModelEngine::GetInstance()->SetPathPoolCapacityForSubscriptions(-1); @@ -3547,7 +3522,7 @@ struct TestReadHandler_ParallelReads_TestCase_Parameters int MaxFabrics = -1; }; -static void TestReadHandler_ParallelReads_TestCase(TestContext * apContext, +static void TestReadHandler_ParallelReads_TestCase(TestRead * apContext, const TestReadHandler_ParallelReads_TestCase_Parameters & params, std::function body) { @@ -3573,18 +3548,18 @@ static void TestReadHandler_ParallelReads_TestCase(TestContext * apContext, TEST_F(TestRead, TestReadHandler_ParallelReads) { - // Note: We cannot use mpContext->DrainAndServiceIO() except at the end of each test case since the perpetual read transactions - // will never end. Note: We use mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { CONDITION }); and + // Note: We cannot use DrainAndServiceIO() except at the end of each test case since the perpetual read transactions + // will never end. Note: We use GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { CONDITION }); and // EXPECT_EQ( CONDITION ) to ensure the CONDITION is satisfied. using namespace SubscriptionPathQuotaHelpers; using Params = TestReadHandler_ParallelReads_TestCase_Parameters; - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); app::InteractionModelEngine::GetInstance()->RegisterReadHandlerAppCallback(this); auto TestCase = [&](const TestReadHandler_ParallelReads_TestCase_Parameters & params, std::function body) { - TestReadHandler_ParallelReads_TestCase(mpContext, params, body); + TestReadHandler_ParallelReads_TestCase(this, params, body); }; // Case 1.1: 2 reads used up the path pool (but not the ReadHandler pool), and one incoming oversized read request => @@ -3601,16 +3576,14 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) TestPerpetualListReadCallback backgroundReadCallback2; std::vector> readClients; - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, - app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback1, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, - app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback2, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0; }); EXPECT_TRUE(backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0); @@ -3619,11 +3592,11 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) backgroundReadCallback2.ClearCounter(); EstablishReadOrSubscriptions( - mpContext->GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest + 1, + GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest + 1, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The two subscriptions should still alive EXPECT_TRUE(backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0); @@ -3646,14 +3619,14 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) TestPerpetualListReadCallback backgroundReadCallback2; std::vector> readClients; - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, 1, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback1, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, 1, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback2, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0; }); EXPECT_TRUE(backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0); @@ -3662,11 +3635,11 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) backgroundReadCallback2.ClearCounter(); EstablishReadOrSubscriptions( - mpContext->GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest + 1, + GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest + 1, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The two subscriptions should still alive EXPECT_TRUE(backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0); @@ -3688,26 +3661,24 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) TestPerpetualListReadCallback backgroundReadCallback2; std::vector> readClients; - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, - app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback1, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionAliceToBob(), 1, - app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + EstablishReadOrSubscriptions(GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback2, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0; }); EXPECT_TRUE(backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0); EstablishReadOrSubscriptions( - mpContext->GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest + 1, + GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest + 1, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The new read request should be accepted EXPECT_EQ(readCallback.mAttributeCount, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest + 1); @@ -3716,7 +3687,7 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) // The two subscriptions should still alive backgroundReadCallback1.ClearCounter(); backgroundReadCallback2.ClearCounter(); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0; }); EXPECT_TRUE(backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0); @@ -3735,16 +3706,14 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) TestPerpetualListReadCallback backgroundReadCallback2; std::vector> readClients; - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, - app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback1, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionAliceToBob(), 1, - app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + EstablishReadOrSubscriptions(GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback2, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0; }); EXPECT_TRUE(backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0); @@ -3753,11 +3722,11 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) backgroundReadCallback2.ClearCounter(); EstablishReadOrSubscriptions( - mpContext->GetSessionAliceToBob(), 1, 1, + GetSessionAliceToBob(), 1, 1, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The new read request should be accepted EXPECT_EQ(readCallback.mAttributeCount, 1u); @@ -3766,7 +3735,7 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) // The two subscriptions should still alive backgroundReadCallback1.ClearCounter(); backgroundReadCallback2.ClearCounter(); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0; }); EXPECT_TRUE(backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0); @@ -3786,27 +3755,26 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) TestPerpetualListReadCallback backgroundReadCallback; std::vector> readClients; - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest + 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &readCallbackForOversizedRead, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), - [&]() { return readCallbackForOversizedRead.reportsReceived > 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), + [&]() { return readCallbackForOversizedRead.reportsReceived > 0; }); - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, 1, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), - [&]() { return backgroundReadCallback.reportsReceived > 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback.reportsReceived > 0; }); EXPECT_TRUE(readCallbackForOversizedRead.reportsReceived > 0 && backgroundReadCallback.reportsReceived > 0); EstablishReadOrSubscriptions( - mpContext->GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The new read request should be accepted. EXPECT_EQ(readCallback.mOnError, 0u); @@ -3817,8 +3785,7 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(), 1u); backgroundReadCallback.ClearCounter(); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), - [&]() { return backgroundReadCallback.reportsReceived > 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback.reportsReceived > 0; }); // We don't check the readCallbackForOversizedRead, since it cannot prove anything -- it can be 0 even when the // oversized read request is alive. We ensure this by checking (1) we have only one active read handler, (2) the one @@ -3842,27 +3809,26 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) TestPerpetualListReadCallback backgroundReadCallback; std::vector> readClients; - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, 1, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), - [&]() { return backgroundReadCallback.reportsReceived > 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback.reportsReceived > 0; }); - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest + 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &readCallbackForOversizedRead, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), - [&]() { return readCallbackForOversizedRead.reportsReceived > 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), + [&]() { return readCallbackForOversizedRead.reportsReceived > 0; }); EXPECT_TRUE(readCallbackForOversizedRead.reportsReceived > 0 && backgroundReadCallback.reportsReceived > 0); EstablishReadOrSubscriptions( - mpContext->GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The new read request should be accepted. EXPECT_EQ(readCallback.mOnError, 0u); @@ -3873,8 +3839,7 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(), 1u); backgroundReadCallback.ClearCounter(); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), - [&]() { return backgroundReadCallback.reportsReceived > 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback.reportsReceived > 0; }); // We don't check the readCallbackForOversizedRead, since it cannot prove anything -- it can be 0 even when the // oversized read request is alive. We ensure this by checking (1) we have only one active read handler, (2) the one @@ -3900,25 +3865,25 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) TestPerpetualListReadCallback backgroundReadCallback; std::vector> readClients; - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, 1, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest + 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &readCallbackForOversizedRead, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback.reportsReceived > 0 && readCallbackForOversizedRead.reportsReceived > 0; }); EXPECT_TRUE(readCallbackForOversizedRead.reportsReceived > 0 && backgroundReadCallback.reportsReceived > 0); EstablishReadOrSubscriptions( - mpContext->GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The new read request should be rejected. EXPECT_NE(readCallback.mOnError, 0u); @@ -3927,7 +3892,7 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) // Ensure the two read transactions are not evicted. backgroundReadCallback.ClearCounter(); readCallbackForOversizedRead.ClearCounter(); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallbackForOversizedRead.reportsReceived > 0 && backgroundReadCallback.reportsReceived > 0; }); EXPECT_TRUE(readCallbackForOversizedRead.reportsReceived > 0 && backgroundReadCallback.reportsReceived > 0); @@ -3948,28 +3913,26 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) TestPerpetualListReadCallback backgroundReadCallback2; std::vector> readClients; - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, 1, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback1, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), - [&]() { return backgroundReadCallback1.reportsReceived > 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback1.reportsReceived > 0; }); - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, 1, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback2, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), - [&]() { return backgroundReadCallback2.reportsReceived > 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback2.reportsReceived > 0; }); EXPECT_TRUE(backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0); backgroundReadCallback1.ClearCounter(); backgroundReadCallback2.ClearCounter(); EstablishReadOrSubscriptions( - mpContext->GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The new read request should be rejected. EXPECT_EQ(readCallback.mOnError, 0u); @@ -3982,8 +3945,7 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(), 1u); // Note: Younger read handler will be evicted. - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), - [&]() { return backgroundReadCallback1.reportsReceived > 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback1.reportsReceived > 0; }); EXPECT_GT(backgroundReadCallback1.reportsReceived, 0); }); @@ -4001,29 +3963,27 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) TestPerpetualListReadCallback backgroundReadCallback2; std::vector> readClients; - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest + 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback1, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), - [&]() { return backgroundReadCallback1.reportsReceived > 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback1.reportsReceived > 0; }); - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, 1, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback2, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), - [&]() { return backgroundReadCallback2.reportsReceived > 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback2.reportsReceived > 0; }); EXPECT_TRUE(backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0); backgroundReadCallback1.ClearCounter(); backgroundReadCallback2.ClearCounter(); EstablishReadOrSubscriptions( - mpContext->GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The new read request should be rejected. EXPECT_EQ(readCallback.mOnError, 0u); @@ -4036,8 +3996,7 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(), 1u); // Note: Larger read handler will be evicted before evicting the younger one. - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), - [&]() { return backgroundReadCallback2.reportsReceived > 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback2.reportsReceived > 0; }); EXPECT_GT(backgroundReadCallback2.reportsReceived, 0); }); @@ -4058,17 +4017,17 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) TestPerpetualListReadCallback backgroundReadCallback3; std::vector> readClients; - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, 1, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback1, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, 1, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback2, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionAliceToBob(), 1, 1, + EstablishReadOrSubscriptions(GetSessionAliceToBob(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback3, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0 && backgroundReadCallback3.reportsReceived > 0; }); @@ -4076,11 +4035,11 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) backgroundReadCallback3.reportsReceived > 0); EstablishReadOrSubscriptions( - mpContext->GetSessionCharlieToDavid(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + GetSessionCharlieToDavid(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The new read request should be accepted. EXPECT_EQ(readCallback.mOnError, 0u); @@ -4088,10 +4047,10 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) EXPECT_EQ(readCallback.mAttributeCount, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest); // Should evict one read request from Bob fabric for enough resources. EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(app::ReadHandler::InteractionType::Read, - mpContext->GetAliceFabricIndex()), + GetAliceFabricIndex()), 1u); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(app::ReadHandler::InteractionType::Read, - mpContext->GetBobFabricIndex()), + GetBobFabricIndex()), 1u); }); @@ -4112,17 +4071,17 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) TestPerpetualListReadCallback backgroundReadCallback3; std::vector> readClients; - EstablishReadOrSubscriptions(mpContext->GetSessionAliceToBob(), 1, 1, + EstablishReadOrSubscriptions(GetSessionAliceToBob(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback1, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionAliceToBob(), 1, 1, + EstablishReadOrSubscriptions(GetSessionAliceToBob(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback2, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, 1, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback3, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0 && backgroundReadCallback3.reportsReceived > 0; }); @@ -4130,11 +4089,11 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) backgroundReadCallback3.reportsReceived > 0); EstablishReadOrSubscriptions( - mpContext->GetSessionCharlieToDavid(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + GetSessionCharlieToDavid(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The new read request should be accepted. EXPECT_EQ(readCallback.mOnError, 0u); @@ -4142,10 +4101,10 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) EXPECT_EQ(readCallback.mAttributeCount, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest); // Should evict one read request from Bob fabric for enough resources. EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(app::ReadHandler::InteractionType::Read, - mpContext->GetAliceFabricIndex()), + GetAliceFabricIndex()), 1u); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(app::ReadHandler::InteractionType::Read, - mpContext->GetBobFabricIndex()), + GetBobFabricIndex()), 1u); }); @@ -4164,20 +4123,17 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) TestPerpetualListReadCallback backgroundReadCallback3; std::vector> readClients; - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, - app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback1, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, - app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback2, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionAliceToBob(), 1, - app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + EstablishReadOrSubscriptions(GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback3, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0 && backgroundReadCallback3.reportsReceived > 0; }); @@ -4185,21 +4141,21 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) backgroundReadCallback3.reportsReceived > 0); EstablishReadOrSubscriptions( - mpContext->GetSessionCharlieToDavid(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + GetSessionCharlieToDavid(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The new read request should be rejected. EXPECT_EQ(readCallback.mOnError, 1u); EXPECT_EQ(readCallback.mLastError, CHIP_IM_GLOBAL_STATUS(Busy)); // Should evict one read request from Bob fabric for enough resources. EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(app::ReadHandler::InteractionType::Read, - mpContext->GetAliceFabricIndex()), + GetAliceFabricIndex()), 2u); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(app::ReadHandler::InteractionType::Read, - mpContext->GetBobFabricIndex()), + GetBobFabricIndex()), 1u); }); @@ -4217,26 +4173,24 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) TestPerpetualListReadCallback backgroundReadCallback2; std::vector> readClients; - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 1, - app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback1, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionAliceToBob(), 1, - app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + EstablishReadOrSubscriptions(GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback2, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0; }); EXPECT_TRUE(backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0); EstablishReadOrSubscriptions( - mpContext->GetSessionCharlieToDavid(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + GetSessionCharlieToDavid(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The new read request should be accepted. EXPECT_EQ(readCallback.mOnError, 0u); @@ -4244,10 +4198,10 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) EXPECT_EQ(readCallback.mAttributeCount, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest); // No read transactions should be evicted. EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(app::ReadHandler::InteractionType::Read, - mpContext->GetAliceFabricIndex()), + GetAliceFabricIndex()), 1u); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(app::ReadHandler::InteractionType::Read, - mpContext->GetBobFabricIndex()), + GetBobFabricIndex()), 1u); }); @@ -4265,22 +4219,22 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) TestPerpetualListReadCallback backgroundReadCallback2; std::vector> readClients; - EstablishReadOrSubscriptions(mpContext->GetSessionCharlieToDavid(), 1, 1, + EstablishReadOrSubscriptions(GetSessionCharlieToDavid(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback1, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionAliceToBob(), 1, 1, + EstablishReadOrSubscriptions(GetSessionAliceToBob(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback2, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0; }); EXPECT_TRUE(backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0); EstablishReadOrSubscriptions( - mpContext->GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The new read request should be accepted. EXPECT_EQ(readCallback.mOnError, 0u); @@ -4309,23 +4263,23 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) TestPerpetualListReadCallback backgroundReadCallback2; std::vector> readClients; - EstablishReadOrSubscriptions(mpContext->GetSessionCharlieToDavid(), 1, 1, + EstablishReadOrSubscriptions(GetSessionCharlieToDavid(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback1, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionAliceToBob(), 1, + EstablishReadOrSubscriptions(GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest + 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback2, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0; }); EXPECT_TRUE(backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0); EstablishReadOrSubscriptions( - mpContext->GetSessionBobToAlice(), 1, 1, + GetSessionBobToAlice(), 1, 1, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The new read request should be accepted. EXPECT_EQ(readCallback.mOnError, 0u); @@ -4355,15 +4309,15 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) std::vector> readClients; EstablishReadOrSubscriptions( - mpContext->GetSessionCharlieToDavid(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), + GetSessionCharlieToDavid(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallbackForPASESession, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionAliceToBob(), 1, 1, + EstablishReadOrSubscriptions(GetSessionAliceToBob(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback1, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionAliceToBob(), 1, 1, + EstablishReadOrSubscriptions(GetSessionAliceToBob(), 1, 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback2, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallbackForPASESession.reportsReceived > 0 && backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0; }); @@ -4371,10 +4325,10 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) backgroundReadCallback2.reportsReceived > 0); EstablishReadOrSubscriptions( - mpContext->GetSessionBobToAlice(), 1, 1, + GetSessionBobToAlice(), 1, 1, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The new read request should be accepted. EXPECT_EQ(readCallback.mOnError, 0u); @@ -4407,14 +4361,14 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) std::vector> readClients; EstablishReadOrSubscriptions( - mpContext->GetSessionCharlieToDavid(), 3, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest - 1, + GetSessionCharlieToDavid(), 3, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest - 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallbackForPASESession, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionBobToAlice(), 3, + EstablishReadOrSubscriptions(GetSessionBobToAlice(), 3, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest + 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback1, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers( app::ReadHandler::InteractionType::Read) == 6; }); @@ -4424,10 +4378,10 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) // We have to evict one read transaction on PASE session and one read transaction on Alice's fabric. EstablishReadOrSubscriptions( - mpContext->GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The new read request should be accepted. EXPECT_EQ(readCallback.mOnError, 0u); @@ -4460,18 +4414,18 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) std::vector> readClients; EstablishReadOrSubscriptions( - mpContext->GetSessionCharlieToDavid(), 2, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest - 1, + GetSessionCharlieToDavid(), 2, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest - 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallbackForPASESession, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionAliceToBob(), 1, + EstablishReadOrSubscriptions(GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest + 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback1, readClients); - EstablishReadOrSubscriptions(mpContext->GetSessionAliceToBob(), 1, + EstablishReadOrSubscriptions(GetSessionAliceToBob(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest + 1, app::AttributePathParams(kTestEndpointId, kPerpetualClusterId, 1), app::ReadClient::InteractionType::Read, &backgroundReadCallback2, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return backgroundReadCallbackForPASESession.reportsReceived > 0 && backgroundReadCallback1.reportsReceived > 0 && backgroundReadCallback2.reportsReceived > 0 && app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(app::ReadHandler::InteractionType::Read, @@ -4484,10 +4438,10 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) // To handle this read request, we must evict both read transactions from the PASE session. EstablishReadOrSubscriptions( - mpContext->GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, + GetSessionBobToAlice(), 1, app::InteractionModelEngine::kMinSupportedPathsPerReadRequest, app::AttributePathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id), app::ReadClient::InteractionType::Read, &readCallback, readClients); - mpContext->GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); + GetIOContext().DriveIOUntil(System::Clock::Seconds16(5), [&]() { return readCallback.mOnDone != 0; }); // The new read request should be accepted. EXPECT_EQ(readCallback.mOnError, 0u); @@ -4504,9 +4458,9 @@ TEST_F(TestRead, TestReadHandler_ParallelReads) }); app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); app::InteractionModelEngine::GetInstance()->SetForceHandlerQuota(false); app::InteractionModelEngine::GetInstance()->SetConfigMaxFabrics(-1); app::InteractionModelEngine::GetInstance()->SetHandlerCapacityForReads(-1); @@ -4520,14 +4474,14 @@ TEST_F(TestRead, TestReadHandler_TooManyPaths) { using namespace chip::app; - chip::Messaging::ReliableMessageMgr * rm = mpContext->GetExchangeManager().GetReliableMessageMgr(); + chip::Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); auto * engine = InteractionModelEngine::GetInstance(); engine->SetForceHandlerQuota(true); - ReadPrepareParams readPrepareParams(mpContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams(GetSessionBobToAlice()); // Needs to be larger than our plausible path pool. chip::app::AttributePathParams attributePathParams[sTooLargePathCount]; readPrepareParams.mpAttributePathParamsList = attributePathParams; @@ -4537,13 +4491,13 @@ TEST_F(TestRead, TestReadHandler_TooManyPaths) MockInteractionModelApp delegate; EXPECT_EQ(delegate.mNumAttributeResponse, 0); EXPECT_FALSE(delegate.mReadError); - ReadClient readClient(InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), delegate, + ReadClient readClient(InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate, ReadClient::InteractionType::Read); CHIP_ERROR err = readClient.SendRequest(readPrepareParams); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(delegate.mNumAttributeResponse, 0); EXPECT_TRUE(delegate.mReadError); @@ -4553,7 +4507,7 @@ TEST_F(TestRead, TestReadHandler_TooManyPaths) } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); engine->SetForceHandlerQuota(false); } @@ -4561,7 +4515,7 @@ TEST_F(TestRead, TestReadHandler_TwoParallelReadsSecondTooManyPaths) { using namespace chip::app; - chip::Messaging::ReliableMessageMgr * rm = mpContext->GetExchangeManager().GetReliableMessageMgr(); + chip::Messaging::ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); // Shouldn't have anything in the retransmit table when starting the test. EXPECT_EQ(rm->TestGetCountRetransTable(), 0); @@ -4572,16 +4526,16 @@ TEST_F(TestRead, TestReadHandler_TwoParallelReadsSecondTooManyPaths) MockInteractionModelApp delegate1; EXPECT_EQ(delegate1.mNumAttributeResponse, 0); EXPECT_FALSE(delegate1.mReadError); - ReadClient readClient1(InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), delegate1, + ReadClient readClient1(InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate1, ReadClient::InteractionType::Read); MockInteractionModelApp delegate2; EXPECT_EQ(delegate2.mNumAttributeResponse, 0); EXPECT_FALSE(delegate2.mReadError); - ReadClient readClient2(InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), delegate2, + ReadClient readClient2(InteractionModelEngine::GetInstance(), &GetExchangeManager(), delegate2, ReadClient::InteractionType::Read); - ReadPrepareParams readPrepareParams1(mpContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams1(GetSessionBobToAlice()); // Read full wildcard paths, repeat twice to ensure chunking. chip::app::AttributePathParams attributePathParams1[2]; readPrepareParams1.mpAttributePathParamsList = attributePathParams1; @@ -4590,7 +4544,7 @@ TEST_F(TestRead, TestReadHandler_TwoParallelReadsSecondTooManyPaths) CHIP_ERROR err = readClient1.SendRequest(readPrepareParams1); EXPECT_EQ(err, CHIP_NO_ERROR); - ReadPrepareParams readPrepareParams2(mpContext->GetSessionBobToAlice()); + ReadPrepareParams readPrepareParams2(GetSessionBobToAlice()); // Read full wildcard paths, repeat twice to ensure chunking. chip::app::AttributePathParams attributePathParams2[sTooLargePathCount]; readPrepareParams2.mpAttributePathParamsList = attributePathParams2; @@ -4599,7 +4553,7 @@ TEST_F(TestRead, TestReadHandler_TwoParallelReadsSecondTooManyPaths) err = readClient2.SendRequest(readPrepareParams2); EXPECT_EQ(err, CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_NE(delegate1.mNumAttributeResponse, 0); EXPECT_FALSE(delegate1.mReadError); @@ -4612,13 +4566,13 @@ TEST_F(TestRead, TestReadHandler_TwoParallelReadsSecondTooManyPaths) } EXPECT_EQ(engine->GetNumActiveReadClients(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); engine->SetForceHandlerQuota(false); } TEST_F(TestRead, TestReadAttribute_ManyDataValues) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); size_t successCalls = 0; size_t failureCalls = 0; @@ -4637,21 +4591,21 @@ TEST_F(TestRead, TestReadAttribute_ManyDataValues) // not safe to do so. auto onFailureCb = [&failureCalls](const app::ConcreteDataAttributePath * attributePath, CHIP_ERROR aError) { ++failureCalls; }; - Controller::ReadAttribute(&mpContext->GetExchangeManager(), sessionHandle, + Controller::ReadAttribute(&GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(successCalls, 1u); EXPECT_EQ(failureCalls, 0u); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadClients(), 0u); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestRead, TestReadAttribute_ManyDataValuesWrongPath) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); size_t successCalls = 0; size_t failureCalls = 0; @@ -4670,21 +4624,21 @@ TEST_F(TestRead, TestReadAttribute_ManyDataValuesWrongPath) // not safe to do so. auto onFailureCb = [&failureCalls](const app::ConcreteDataAttributePath * attributePath, CHIP_ERROR aError) { ++failureCalls; }; - Controller::ReadAttribute(&mpContext->GetExchangeManager(), sessionHandle, + Controller::ReadAttribute(&GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(successCalls, 0u); EXPECT_EQ(failureCalls, 1u); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadClients(), 0u); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestRead, TestReadAttribute_ManyErrors) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); size_t successCalls = 0; size_t failureCalls = 0; @@ -4703,16 +4657,16 @@ TEST_F(TestRead, TestReadAttribute_ManyErrors) // not safe to do so. auto onFailureCb = [&failureCalls](const app::ConcreteDataAttributePath * attributePath, CHIP_ERROR aError) { ++failureCalls; }; - Controller::ReadAttribute(&mpContext->GetExchangeManager(), sessionHandle, + Controller::ReadAttribute(&GetExchangeManager(), sessionHandle, kTestEndpointId, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(successCalls, 0u); EXPECT_EQ(failureCalls, 1u); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadClients(), 0u); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } // @@ -4728,7 +4682,7 @@ TEST_F(TestRead, TestReadHandler_KeepSubscriptionTest) TestReadCallback readCallback; app::AttributePathParams pathParams(kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int16u::Id); - app::ReadPrepareParams readParam(mpContext->GetSessionAliceToBob()); + app::ReadPrepareParams readParam(GetSessionAliceToBob()); readParam.mpAttributePathParamsList = &pathParams; readParam.mAttributePathParamsListSize = 1; readParam.mMaxIntervalCeilingSeconds = 1; @@ -4739,7 +4693,7 @@ TEST_F(TestRead, TestReadHandler_KeepSubscriptionTest) app::ReadClient::InteractionType::Subscribe); EXPECT_EQ(readClient->SendRequest(readParam), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(), 1u); @@ -4751,12 +4705,12 @@ TEST_F(TestRead, TestReadHandler_KeepSubscriptionTest) app::ReadClient::InteractionType::Subscribe); EXPECT_EQ(readClient->SendRequest(readParam), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(app::InteractionModelEngine::GetInstance()->GetNumActiveReadHandlers(), 0u); EXPECT_NE(readCallback.mOnError, 0u); app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); } System::Clock::Timeout TestRead::ComputeSubscriptionTimeout(System::Clock::Seconds16 aMaxInterval) diff --git a/src/controller/tests/data_model/TestWrite.cpp b/src/controller/tests/data_model/TestWrite.cpp index 8f0d96f7667507..03d100ab33dabb 100644 --- a/src/controller/tests/data_model/TestWrite.cpp +++ b/src/controller/tests/data_model/TestWrite.cpp @@ -33,8 +33,6 @@ #include #include -using TestContext = chip::Test::AppContext; - using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; @@ -84,31 +82,9 @@ class SingleWriteCallback : public WriteClient::Callback StatusIB mPathStatus; }; -class TestWrite : public ::testing::Test +class TestWrite : public chip::Test::AppContext { public: - // Performs shared setup for all tests in the test suite - static void SetUpTestSuite() - { - if (mpContext == nullptr) - { - mpContext = new TestContext(); - ASSERT_NE(mpContext, nullptr); - } - mpContext->SetUpTestSuite(); - } - - // Performs shared teardown for all tests in the test suite - static void TearDownTestSuite() - { - mpContext->TearDownTestSuite(); - if (mpContext != nullptr) - { - delete mpContext; - mpContext = nullptr; - } - } - void ResetCallback() { mSingleWriteCallback.reset(); } void PrepareWriteCallback(ConcreteAttributePath path) { mSingleWriteCallback = std::make_unique(path); } @@ -116,22 +92,12 @@ class TestWrite : public ::testing::Test SingleWriteCallback * GetWriteCallback() { return mSingleWriteCallback.get(); } protected: - // Performs setup for each individual test in the test suite - void SetUp() { mpContext->SetUp(); } - - // Performs teardown for each individual test in the test suite - void TearDown() { mpContext->TearDown(); } - - static TestContext * mpContext; - std::unique_ptr mSingleWriteCallback; }; -TestContext * TestWrite::mpContext = nullptr; - TEST_F(TestWrite, TestDataResponse) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessCbInvoked = false, onFailureCbInvoked = false; Clusters::UnitTesting::Structs::TestListStructOctet::Type valueBuf[4]; Clusters::UnitTesting::Attributes::ListStructOctetString::TypeInfo::Type value; @@ -160,16 +126,16 @@ TEST_F(TestWrite, TestDataResponse) chip::Controller::WriteAttribute( sessionHandle, kTestEndpointId, value, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(onSuccessCbInvoked && !onFailureCbInvoked); EXPECT_EQ(chip::app::InteractionModelEngine::GetInstance()->GetNumActiveWriteHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestWrite, TestDataResponseWithAcceptedDataVersion) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessCbInvoked = false, onFailureCbInvoked = false; Clusters::UnitTesting::Structs::TestListStructOctet::Type valueBuf[4]; Clusters::UnitTesting::Attributes::ListStructOctetString::TypeInfo::Type value; @@ -200,16 +166,16 @@ TEST_F(TestWrite, TestDataResponseWithAcceptedDataVersion) chip::Controller::WriteAttribute( sessionHandle, kTestEndpointId, value, onSuccessCb, onFailureCb, nullptr, dataVersion); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(onSuccessCbInvoked && !onFailureCbInvoked); EXPECT_EQ(chip::app::InteractionModelEngine::GetInstance()->GetNumActiveWriteHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestWrite, TestDataResponseWithRejectedDataVersion) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessCbInvoked = false, onFailureCbInvoked = false; Clusters::UnitTesting::Structs::TestListStructOctet::Type valueBuf[4]; Clusters::UnitTesting::Attributes::ListStructOctetString::TypeInfo::Type value; @@ -239,16 +205,16 @@ TEST_F(TestWrite, TestDataResponseWithRejectedDataVersion) chip::Controller::WriteAttribute( sessionHandle, kTestEndpointId, value, onSuccessCb, onFailureCb, nullptr, dataVersion); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(!onSuccessCbInvoked && onFailureCbInvoked); EXPECT_EQ(chip::app::InteractionModelEngine::GetInstance()->GetNumActiveWriteHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestWrite, TestAttributeError) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessCbInvoked = false, onFailureCbInvoked = false; Attributes::ListStructOctetString::TypeInfo::Type value; Structs::TestListStructOctet::Type valueBuf[4]; @@ -278,16 +244,16 @@ TEST_F(TestWrite, TestAttributeError) Controller::WriteAttribute(sessionHandle, kTestEndpointId, value, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(!onSuccessCbInvoked && onFailureCbInvoked); EXPECT_EQ(InteractionModelEngine::GetInstance()->GetNumActiveWriteHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestWrite, TestFabricScopedAttributeWithoutFabricIndex) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); bool onSuccessCbInvoked = false, onFailureCbInvoked = false; Clusters::UnitTesting::Structs::TestFabricScoped::Type valueBuf[4]; Clusters::UnitTesting::Attributes::ListFabricScoped::TypeInfo::Type value; @@ -315,16 +281,16 @@ TEST_F(TestWrite, TestFabricScopedAttributeWithoutFabricIndex) chip::Controller::WriteAttribute( sessionHandle, kTestEndpointId, value, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(!onSuccessCbInvoked && onFailureCbInvoked); EXPECT_EQ(chip::app::InteractionModelEngine::GetInstance()->GetNumActiveWriteHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestWrite, TestMultipleSuccessResponses) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); size_t successCalls = 0; size_t failureCalls = 0; @@ -341,17 +307,17 @@ TEST_F(TestWrite, TestMultipleSuccessResponses) chip::Controller::WriteAttribute(sessionHandle, kTestEndpointId, true, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(successCalls, 1u); EXPECT_EQ(failureCalls, 0u); EXPECT_EQ(chip::app::InteractionModelEngine::GetInstance()->GetNumActiveWriteHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestWrite, TestMultipleFailureResponses) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); size_t successCalls = 0; size_t failureCalls = 0; @@ -368,17 +334,17 @@ TEST_F(TestWrite, TestMultipleFailureResponses) chip::Controller::WriteAttribute(sessionHandle, kTestEndpointId, true, onSuccessCb, onFailureCb); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_EQ(successCalls, 0u); EXPECT_EQ(failureCalls, 1u); EXPECT_EQ(chip::app::InteractionModelEngine::GetInstance()->GetNumActiveWriteHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } TEST_F(TestWrite, TestWriteClusterSpecificStatuses) { - auto sessionHandle = mpContext->GetSessionBobToAlice(); + auto sessionHandle = GetSessionBobToAlice(); // Cluster-specific success code case { @@ -390,14 +356,14 @@ TEST_F(TestWrite, TestWriteClusterSpecificStatuses) SingleWriteCallback * writeCb = this->GetWriteCallback(); - WriteClient writeClient(&mpContext->GetExchangeManager(), this->GetWriteCallback(), Optional::Missing()); + WriteClient writeClient(&GetExchangeManager(), this->GetWriteCallback(), Optional::Missing()); AttributePathParams attributePath{ kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int8u::Id }; constexpr uint8_t attributeValue = 1u; ASSERT_EQ(writeClient.EncodeAttribute(attributePath, attributeValue), CHIP_NO_ERROR); ASSERT_EQ(writeClient.SendWriteRequest(sessionHandle), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(writeCb->WasDone()); EXPECT_TRUE(writeCb->PathWasResponded()); @@ -409,7 +375,7 @@ TEST_F(TestWrite, TestWriteClusterSpecificStatuses) EXPECT_EQ(pathStatus.mClusterStatus.Value(), kExampleClusterSpecificSuccess); EXPECT_EQ(chip::app::InteractionModelEngine::GetInstance()->GetNumActiveWriteHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } // Cluster-specific failure code case @@ -422,7 +388,7 @@ TEST_F(TestWrite, TestWriteClusterSpecificStatuses) SingleWriteCallback * writeCb = this->GetWriteCallback(); - WriteClient writeClient(&mpContext->GetExchangeManager(), this->GetWriteCallback(), Optional::Missing()); + WriteClient writeClient(&GetExchangeManager(), this->GetWriteCallback(), Optional::Missing()); AttributePathParams attributePath{ kTestEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Attributes::Int8u::Id }; @@ -430,7 +396,7 @@ TEST_F(TestWrite, TestWriteClusterSpecificStatuses) ASSERT_EQ(writeClient.EncodeAttribute(attributePath, attributeValue), CHIP_NO_ERROR); ASSERT_EQ(writeClient.SendWriteRequest(sessionHandle), CHIP_NO_ERROR); - mpContext->DrainAndServiceIO(); + DrainAndServiceIO(); EXPECT_TRUE(writeCb->WasDone()); EXPECT_TRUE(writeCb->PathWasResponded()); @@ -442,7 +408,7 @@ TEST_F(TestWrite, TestWriteClusterSpecificStatuses) EXPECT_EQ(pathStatus.mClusterStatus.Value(), kExampleClusterSpecificFailure); EXPECT_EQ(chip::app::InteractionModelEngine::GetInstance()->GetNumActiveWriteHandlers(), 0u); - EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); + EXPECT_EQ(GetExchangeManager().GetNumActiveExchanges(), 0u); } } diff --git a/src/credentials/BUILD.gn b/src/credentials/BUILD.gn index df7afc0c1025ba..670cefcd209c10 100644 --- a/src/credentials/BUILD.gn +++ b/src/credentials/BUILD.gn @@ -13,6 +13,7 @@ # limitations under the License. import("//build_overrides/chip.gni") +import("//build_overrides/jsoncpp.gni") import("//build_overrides/nlassert.gni") import("${chip_root}/src/crypto/crypto.gni") import("${chip_root}/src/lib/core/core.gni") @@ -185,3 +186,17 @@ static_library("file_attestation_trust_store") { "${nlassert_root}:nlassert", ] } + +static_library("test_dac_revocation_delegate") { + output_name = "libTestDACRevocationDelegate" + + sources = [ + "attestation_verifier/TestDACRevocationDelegateImpl.cpp", + "attestation_verifier/TestDACRevocationDelegateImpl.h", + ] + + public_deps = [ + ":credentials", + jsoncpp_root, + ] +} diff --git a/src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.cpp b/src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.cpp index f3444b0c303940..14759d850ffc40 100644 --- a/src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.cpp +++ b/src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.cpp @@ -610,11 +610,14 @@ CHIP_ERROR DefaultDACVerifier::VerifyNodeOperationalCSRInformation(const ByteSpa void DefaultDACVerifier::CheckForRevokedDACChain(const AttestationInfo & info, Callback::Callback * onCompletion) { - AttestationVerificationResult attestationError = AttestationVerificationResult::kSuccess; - - // TODO(#33124): Implement default version of CheckForRevokedDACChain - - onCompletion->mCall(onCompletion->mContext, info, attestationError); + if (mRevocationDelegate != nullptr) + { + mRevocationDelegate->CheckForRevokedDACChain(info, onCompletion); + } + else + { + onCompletion->mCall(onCompletion->mContext, info, AttestationVerificationResult::kSuccess); + } } bool CsaCdKeysTrustStore::IsCdTestKey(const ByteSpan & kid) const @@ -693,9 +696,10 @@ const AttestationTrustStore * GetTestAttestationTrustStore() return &gTestAttestationTrustStore.get(); } -DeviceAttestationVerifier * GetDefaultDACVerifier(const AttestationTrustStore * paaRootStore) +DeviceAttestationVerifier * GetDefaultDACVerifier(const AttestationTrustStore * paaRootStore, + DeviceAttestationRevocationDelegate * revocationDelegate) { - static DefaultDACVerifier defaultDACVerifier{ paaRootStore }; + static DefaultDACVerifier defaultDACVerifier{ paaRootStore, revocationDelegate }; return &defaultDACVerifier; } diff --git a/src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.h b/src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.h index 346d098a58a337..7e0fc1c4378848 100644 --- a/src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.h +++ b/src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.h @@ -59,6 +59,10 @@ class DefaultDACVerifier : public DeviceAttestationVerifier public: DefaultDACVerifier(const AttestationTrustStore * paaRootStore) : mAttestationTrustStore(paaRootStore) {} + DefaultDACVerifier(const AttestationTrustStore * paaRootStore, DeviceAttestationRevocationDelegate * revocationDelegate) : + mAttestationTrustStore(paaRootStore), mRevocationDelegate(revocationDelegate) + {} + void VerifyAttestationInformation(const DeviceAttestationVerifier::AttestationInfo & info, Callback::Callback * onCompletion) override; @@ -79,11 +83,17 @@ class DefaultDACVerifier : public DeviceAttestationVerifier CsaCdKeysTrustStore * GetCertificationDeclarationTrustStore() override { return &mCdKeysTrustStore; } + void SetRevocationDelegate(DeviceAttestationRevocationDelegate * revocationDelegate) + { + mRevocationDelegate = revocationDelegate; + } + protected: DefaultDACVerifier() {} CsaCdKeysTrustStore mCdKeysTrustStore; const AttestationTrustStore * mAttestationTrustStore; + DeviceAttestationRevocationDelegate * mRevocationDelegate = nullptr; }; /** @@ -112,7 +122,8 @@ const AttestationTrustStore * GetTestAttestationTrustStore(); * process lifetime. In particular, after the first call it's not * possible to change which AttestationTrustStore is used by this verifier. */ -DeviceAttestationVerifier * GetDefaultDACVerifier(const AttestationTrustStore * paaRootStore); +DeviceAttestationVerifier * GetDefaultDACVerifier(const AttestationTrustStore * paaRootStore, + DeviceAttestationRevocationDelegate * revocationDelegate = nullptr); } // namespace Credentials } // namespace chip diff --git a/src/credentials/attestation_verifier/DeviceAttestationVerifier.h b/src/credentials/attestation_verifier/DeviceAttestationVerifier.h index f45ceae06c23fe..e6915931a73b68 100644 --- a/src/credentials/attestation_verifier/DeviceAttestationVerifier.h +++ b/src/credentials/attestation_verifier/DeviceAttestationVerifier.h @@ -47,6 +47,7 @@ enum class AttestationVerificationResult : uint16_t kPaiVendorIdMismatch = 205, kPaiAuthorityNotFound = 206, kPaiMissing = 207, + kPaiAndDacRevoked = 208, kDacExpired = 300, kDacSignatureInvalid = 301, @@ -418,6 +419,28 @@ class DeviceAttestationVerifier bool mEnableCdTestKeySupport = true; }; +/** + * @brief Interface for checking the device attestation revocation status + * + */ +class DeviceAttestationRevocationDelegate +{ +public: + DeviceAttestationRevocationDelegate() = default; + virtual ~DeviceAttestationRevocationDelegate() = default; + + /** + * @brief Verify whether or not the given DAC chain is revoked. + * + * @param[in] info All of the information required to check for revoked DAC chain. + * @param[in] onCompletion Callback handler to provide Attestation Information Verification result to the caller of + * CheckForRevokedDACChain(). + */ + virtual void + CheckForRevokedDACChain(const DeviceAttestationVerifier::AttestationInfo & info, + Callback::Callback * onCompletion) = 0; +}; + /** * Instance getter for the global DeviceAttestationVerifier. * diff --git a/src/credentials/attestation_verifier/TestDACRevocationDelegateImpl.cpp b/src/credentials/attestation_verifier/TestDACRevocationDelegateImpl.cpp new file mode 100644 index 00000000000000..4e1978525e7327 --- /dev/null +++ b/src/credentials/attestation_verifier/TestDACRevocationDelegateImpl.cpp @@ -0,0 +1,219 @@ +/* + * + * 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 +#include +#include +#include +#include + +#include +#include +#include + +using namespace chip::Crypto; + +namespace chip { +namespace Credentials { + +namespace { +CHIP_ERROR BytesToHexStr(const ByteSpan & bytes, MutableCharSpan & outHexStr) +{ + Encoding::HexFlags flags = Encoding::HexFlags::kUppercase; + ReturnErrorOnFailure(BytesToHex(bytes.data(), bytes.size(), outHexStr.data(), outHexStr.size(), flags)); + outHexStr.reduce_size(2 * bytes.size()); + return CHIP_NO_ERROR; +} +} // anonymous namespace + +CHIP_ERROR TestDACRevocationDelegateImpl::SetDeviceAttestationRevocationSetPath(std::string_view path) +{ + VerifyOrReturnError(path.empty() != true, CHIP_ERROR_INVALID_ARGUMENT); + mDeviceAttestationRevocationSetPath = path; + return CHIP_NO_ERROR; +} + +void TestDACRevocationDelegateImpl::ClearDeviceAttestationRevocationSetPath() +{ + // clear the string_view + mDeviceAttestationRevocationSetPath = mDeviceAttestationRevocationSetPath.substr(0, 0); +} + +// This method parses the below JSON Scheme +// [ +// { +// "type": "revocation_set", +// "issuer_subject_key_id": "", +// "issuer_name": "", +// "revoked_serial_numbers: [ +// "serial1 bytes as base64", +// "serial2 bytes as base64" +// ] +// } +// ] +// +bool TestDACRevocationDelegateImpl::IsEntryInRevocationSet(const CharSpan & akidHexStr, const CharSpan & issuerNameBase64Str, + const CharSpan & serialNumberHexStr) +{ + std::ifstream file(mDeviceAttestationRevocationSetPath.data()); + if (!file.is_open()) + { + ChipLogError(NotSpecified, "Failed to open file: %s", mDeviceAttestationRevocationSetPath.data()); + return false; + } + + // Parse the JSON data incrementally + Json::CharReaderBuilder readerBuilder; + Json::Value jsonData; + std::string errs; + + bool parsingSuccessful = Json::parseFromStream(readerBuilder, file, &jsonData, &errs); + + // Close the file as it's no longer needed + file.close(); + + if (!parsingSuccessful) + { + ChipLogError(NotSpecified, "Failed to parse JSON: %s", errs.c_str()); + return false; + } + + std::string issuerName = std::string(issuerNameBase64Str.data(), issuerNameBase64Str.size()); + std::string serialNumber = std::string(serialNumberHexStr.data(), serialNumberHexStr.size()); + std::string akid = std::string(akidHexStr.data(), akidHexStr.size()); + + for (const auto & revokedSet : jsonData) + { + if (revokedSet["issuer_name"].asString() != issuerName) + { + continue; + } + if (revokedSet["issuer_subject_key_id"].asString() != akid) + { + continue; + } + for (const auto & revokedSerialNumber : revokedSet["revoked_serial_numbers"]) + { + if (revokedSerialNumber.asString() == serialNumber) + { + return true; + } + } + } + return false; +} + +CHIP_ERROR TestDACRevocationDelegateImpl::GetAKIDHexStr(const ByteSpan & certDer, MutableCharSpan & outAKIDHexStr) +{ + uint8_t akidBuf[kAuthorityKeyIdentifierLength]; + MutableByteSpan akid(akidBuf); + + ReturnErrorOnFailure(ExtractAKIDFromX509Cert(certDer, akid)); + + return BytesToHexStr(akid, outAKIDHexStr); +} + +CHIP_ERROR TestDACRevocationDelegateImpl::GetSerialNumberHexStr(const ByteSpan & certDer, MutableCharSpan & outSerialNumberHexStr) +{ + uint8_t serialNumberBuf[kMaxCertificateSerialNumberLength] = { 0 }; + MutableByteSpan serialNumber(serialNumberBuf); + + ReturnErrorOnFailure(ExtractSerialNumberFromX509Cert(certDer, serialNumber)); + return BytesToHexStr(serialNumber, outSerialNumberHexStr); +} + +CHIP_ERROR TestDACRevocationDelegateImpl::GetIssuerNameBase64Str(const ByteSpan & certDer, + MutableCharSpan & outIssuerNameBase64String) +{ + uint8_t issuerBuf[kMaxCertificateDistinguishedNameLength] = { 0 }; + MutableByteSpan issuer(issuerBuf); + + ReturnErrorOnFailure(ExtractIssuerFromX509Cert(certDer, issuer)); + VerifyOrReturnError(outIssuerNameBase64String.size() >= BASE64_ENCODED_LEN(issuer.size()), CHIP_ERROR_BUFFER_TOO_SMALL); + + uint16_t encodedLen = Base64Encode(issuer.data(), static_cast(issuer.size()), outIssuerNameBase64String.data()); + outIssuerNameBase64String.reduce_size(encodedLen); + return CHIP_NO_ERROR; +} + +bool TestDACRevocationDelegateImpl::IsCertificateRevoked(const ByteSpan & certDer) +{ + static constexpr uint32_t maxIssuerBase64Len = BASE64_ENCODED_LEN(kMaxCertificateDistinguishedNameLength); + + char issuerNameBuffer[maxIssuerBase64Len] = { 0 }; + char serialNumberHexStrBuffer[2 * kMaxCertificateSerialNumberLength] = { 0 }; + char akidHexStrBuffer[2 * kAuthorityKeyIdentifierLength] = { 0 }; + + MutableCharSpan issuerName(issuerNameBuffer); + MutableCharSpan serialNumber(serialNumberHexStrBuffer); + MutableCharSpan akid(akidHexStrBuffer); + + VerifyOrReturnValue(CHIP_NO_ERROR == GetIssuerNameBase64Str(certDer, issuerName), false); + ChipLogDetail(NotSpecified, "Issuer: %.*s", static_cast(issuerName.size()), issuerName.data()); + + VerifyOrReturnValue(CHIP_NO_ERROR == GetSerialNumberHexStr(certDer, serialNumber), false); + ChipLogDetail(NotSpecified, "Serial Number: %.*s", static_cast(serialNumber.size()), serialNumber.data()); + + VerifyOrReturnValue(CHIP_NO_ERROR == GetAKIDHexStr(certDer, akid), false); + ChipLogDetail(NotSpecified, "AKID: %.*s", static_cast(akid.size()), akid.data()); + + // TODO: Cross-validate the CRLSignerCertificate and CRLSignerDelegator per spec: #34587 + + return IsEntryInRevocationSet(akid, issuerName, serialNumber); +} + +void TestDACRevocationDelegateImpl::CheckForRevokedDACChain( + const DeviceAttestationVerifier::AttestationInfo & info, + Callback::Callback * onCompletion) +{ + AttestationVerificationResult attestationError = AttestationVerificationResult::kSuccess; + + if (mDeviceAttestationRevocationSetPath.empty()) + { + + onCompletion->mCall(onCompletion->mContext, info, attestationError); + } + + ChipLogDetail(NotSpecified, "Checking for revoked DAC in %s", mDeviceAttestationRevocationSetPath.data()); + + if (IsCertificateRevoked(info.dacDerBuffer)) + { + ChipLogProgress(NotSpecified, "Found revoked DAC in %s", mDeviceAttestationRevocationSetPath.data()); + attestationError = AttestationVerificationResult::kDacRevoked; + } + + ChipLogDetail(NotSpecified, "Checking for revoked PAI in %s", mDeviceAttestationRevocationSetPath.data()); + + if (IsCertificateRevoked(info.paiDerBuffer)) + { + ChipLogProgress(NotSpecified, "Found revoked PAI in %s", mDeviceAttestationRevocationSetPath.data()); + + if (attestationError == AttestationVerificationResult::kDacRevoked) + { + attestationError = AttestationVerificationResult::kPaiAndDacRevoked; + } + else + { + attestationError = AttestationVerificationResult::kPaiRevoked; + } + } + + onCompletion->mCall(onCompletion->mContext, info, attestationError); +} + +} // namespace Credentials +} // namespace chip diff --git a/src/credentials/attestation_verifier/TestDACRevocationDelegateImpl.h b/src/credentials/attestation_verifier/TestDACRevocationDelegateImpl.h new file mode 100644 index 00000000000000..c820e56f5f6ce3 --- /dev/null +++ b/src/credentials/attestation_verifier/TestDACRevocationDelegateImpl.h @@ -0,0 +1,65 @@ +/* + * + * 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 +#include +#include + +namespace chip { +namespace Credentials { + +class TestDACRevocationDelegateImpl : public DeviceAttestationRevocationDelegate +{ +public: + TestDACRevocationDelegateImpl() = default; + ~TestDACRevocationDelegateImpl() = default; + + /** + * @brief Verify whether or not the given DAC chain is revoked. + * + * @param[in] info All of the information required to check for revoked DAC chain. + * @param[in] onCompletion Callback handler to provide Attestation Information Verification result to the caller of + * CheckForRevokedDACChain(). + */ + void CheckForRevokedDACChain( + const DeviceAttestationVerifier::AttestationInfo & info, + Callback::Callback * onCompletion) override; + + // Set the path to the device attestation revocation set JSON file. + // revocation set can be generated using credentials/generate-revocation-set.py script + // This API returns CHIP_ERROR_INVALID_ARGUMENT if the path is null. + CHIP_ERROR SetDeviceAttestationRevocationSetPath(std::string_view path); + + // Clear the path to the device attestation revocation set JSON file. + // This can be used to skip the revocation check + void ClearDeviceAttestationRevocationSetPath(); + +private: + CHIP_ERROR GetAKIDHexStr(const ByteSpan & certDer, MutableCharSpan & outAKIDHexStr); + CHIP_ERROR GetSerialNumberHexStr(const ByteSpan & certDer, MutableCharSpan & outSerialNumberHexStr); + CHIP_ERROR GetIssuerNameBase64Str(const ByteSpan & certDer, MutableCharSpan & outIssuerNameBase64String); + bool IsEntryInRevocationSet(const CharSpan & akidHexStr, const CharSpan & issuerNameBase64Str, + const CharSpan & serialNumberHexStr); + bool IsCertificateRevoked(const ByteSpan & certDer); + + std::string_view mDeviceAttestationRevocationSetPath; +}; + +} // namespace Credentials +} // namespace chip diff --git a/src/credentials/tests/BUILD.gn b/src/credentials/tests/BUILD.gn index 2ec6db203bcaa0..393b246ef20ee3 100644 --- a/src/credentials/tests/BUILD.gn +++ b/src/credentials/tests/BUILD.gn @@ -68,7 +68,9 @@ chip_test_suite("tests") { "${chip_root}/src/controller:controller", "${chip_root}/src/credentials", "${chip_root}/src/credentials:default_attestation_verifier", + "${chip_root}/src/credentials:test_dac_revocation_delegate", "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/support:testing", ] } diff --git a/src/credentials/tests/TestCertificationDeclaration.cpp b/src/credentials/tests/TestCertificationDeclaration.cpp index 45c8d5027bac93..ecc1372dd43bf9 100644 --- a/src/credentials/tests/TestCertificationDeclaration.cpp +++ b/src/credentials/tests/TestCertificationDeclaration.cpp @@ -25,14 +25,15 @@ #include #include +#include + #include #include #include #include +#include #include -#include - using namespace chip; using namespace chip::ASN1; using namespace chip::Crypto; diff --git a/src/credentials/tests/TestChipCert.cpp b/src/credentials/tests/TestChipCert.cpp index 9a6e50b58561fb..94d53c7ae1619e 100644 --- a/src/credentials/tests/TestChipCert.cpp +++ b/src/credentials/tests/TestChipCert.cpp @@ -24,18 +24,19 @@ * */ +#include + #include #include #include #include #include #include +#include #include #include #include -#include - #include "CHIPCert_error_test_vectors.h" #include "CHIPCert_test_vectors.h" diff --git a/src/credentials/tests/TestCommissionerDUTVectors.cpp b/src/credentials/tests/TestCommissionerDUTVectors.cpp index c512776cc89a69..a3c0ac7f85f885 100644 --- a/src/credentials/tests/TestCommissionerDUTVectors.cpp +++ b/src/credentials/tests/TestCommissionerDUTVectors.cpp @@ -15,6 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include + #include #include @@ -27,11 +30,10 @@ #include #include +#include #include #include -#include - #include #include #include diff --git a/src/credentials/tests/TestDeviceAttestationConstruction.cpp b/src/credentials/tests/TestDeviceAttestationConstruction.cpp index e624b257a32ef2..8fc949ca29c999 100644 --- a/src/credentials/tests/TestDeviceAttestationConstruction.cpp +++ b/src/credentials/tests/TestDeviceAttestationConstruction.cpp @@ -15,17 +15,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include + +#include + #include #include #include +#include #include #include #include #include -#include -#include - using namespace chip; using namespace chip::Credentials; diff --git a/src/credentials/tests/TestDeviceAttestationCredentials.cpp b/src/credentials/tests/TestDeviceAttestationCredentials.cpp index bf203c8321adf1..0f80df9fa9f6f4 100644 --- a/src/credentials/tests/TestDeviceAttestationCredentials.cpp +++ b/src/credentials/tests/TestDeviceAttestationCredentials.cpp @@ -15,6 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include + #include #include @@ -22,19 +25,21 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include -#include - #include "CHIPAttCert_test_vectors.h" +#include + using namespace chip; using namespace chip::Crypto; using namespace chip::Credentials; @@ -411,3 +416,160 @@ TEST_F(TestDeviceAttestationCredentials, TestAttestationTrustStore) } } } + +static void WriteTestRevokedData(const char * jsonData, const char * fileName) +{ + // TODO: Add option to load test data from the test without using file. #34588 + + // write data to /tmp/sample_revoked_set.json using fstream APIs + std::ofstream file; + file.open(fileName, std::ofstream::out | std::ofstream::trunc); + file << jsonData; + file.close(); +} + +TEST_F(TestDeviceAttestationCredentials, TestDACRevocationDelegateImpl) +{ + uint8_t attestationElementsTestVector[] = { 0 }; + uint8_t attestationChallengeTestVector[] = { 0 }; + uint8_t attestationSignatureTestVector[] = { 0 }; + uint8_t attestationNonceTestVector[] = { 0 }; + + // Details for TestCerts::sTestCert_DAC_FFF1_8000_0004_Cert + // Issuer: MEYxGDAWBgNVBAMMD01hdHRlciBUZXN0IFBBSTEUMBIGCisGAQQBgqJ8AgEMBEZGRjExFDASBgorBgEEAYKifAICDAQ4MDAw + // AKID: AF42B7094DEBD515EC6ECF33B81115225F325288 + // Serial Number: 0C694F7F866067B2 + // + // Details for TestCerts::sTestCert_PAI_FFF1_8000_Cert + // Issuer: MDAxGDAWBgNVBAMMD01hdHRlciBUZXN0IFBBQTEUMBIGCisGAQQBgqJ8AgEMBEZGRjE= + // AKID: 6AFD22771F511FECBF1641976710DCDC31A1717E + // Serial Number: 3E6CE6509AD840CD1 + Credentials::DeviceAttestationVerifier::AttestationInfo info( + ByteSpan(attestationElementsTestVector), ByteSpan(attestationChallengeTestVector), ByteSpan(attestationSignatureTestVector), + TestCerts::sTestCert_PAI_FFF1_8000_Cert, TestCerts::sTestCert_DAC_FFF1_8000_0004_Cert, ByteSpan(attestationNonceTestVector), + static_cast(0xFFF1), 0x8000); + + AttestationVerificationResult attestationResult = AttestationVerificationResult::kNotImplemented; + + Callback::Callback attestationInformationVerificationCallback( + OnAttestationInformationVerificationCallback, &attestationResult); + + TestDACRevocationDelegateImpl revocationDelegateImpl; + + // Test without revocation set + revocationDelegateImpl.CheckForRevokedDACChain(info, &attestationInformationVerificationCallback); + EXPECT_EQ(attestationResult, AttestationVerificationResult::kSuccess); + + const char * tmpJsonFile = "/tmp/sample_revoked_set.json"; + revocationDelegateImpl.SetDeviceAttestationRevocationSetPath(tmpJsonFile); + + // Test empty json + WriteTestRevokedData("", tmpJsonFile); + revocationDelegateImpl.CheckForRevokedDACChain(info, &attestationInformationVerificationCallback); + EXPECT_EQ(attestationResult, AttestationVerificationResult::kSuccess); + + // Test DAC is revoked + const char * jsonData = R"( + [{ + "type": "revocation_set", + "issuer_subject_key_id": "AF42B7094DEBD515EC6ECF33B81115225F325288", + "issuer_name": "MEYxGDAWBgNVBAMMD01hdHRlciBUZXN0IFBBSTEUMBIGCisGAQQBgqJ8AgEMBEZGRjExFDASBgorBgEEAYKifAICDAQ4MDAw", + "revoked_serial_numbers": ["0C694F7F866067B2"] + }] + )"; + WriteTestRevokedData(jsonData, tmpJsonFile); + revocationDelegateImpl.CheckForRevokedDACChain(info, &attestationInformationVerificationCallback); + EXPECT_EQ(attestationResult, AttestationVerificationResult::kDacRevoked); + + // Test PAI is revoked + jsonData = R"( + [{ + "type": "revocation_set", + "issuer_subject_key_id": "6AFD22771F511FECBF1641976710DCDC31A1717E", + "issuer_name": "MDAxGDAWBgNVBAMMD01hdHRlciBUZXN0IFBBQTEUMBIGCisGAQQBgqJ8AgEMBEZGRjE=", + "revoked_serial_numbers": ["3E6CE6509AD840CD"] + }] + )"; + WriteTestRevokedData(jsonData, tmpJsonFile); + revocationDelegateImpl.CheckForRevokedDACChain(info, &attestationInformationVerificationCallback); + EXPECT_EQ(attestationResult, AttestationVerificationResult::kPaiRevoked); + + // Test DAC and PAI both revoked + jsonData = R"( + [{ + "type": "revocation_set", + "issuer_subject_key_id": "AF42B7094DEBD515EC6ECF33B81115225F325288", + "issuer_name": "MEYxGDAWBgNVBAMMD01hdHRlciBUZXN0IFBBSTEUMBIGCisGAQQBgqJ8AgEMBEZGRjExFDASBgorBgEEAYKifAICDAQ4MDAw", + "revoked_serial_numbers": ["0C694F7F866067B2"] + }, + { + "type": "revocation_set", + "issuer_subject_key_id": "6AFD22771F511FECBF1641976710DCDC31A1717E", + "issuer_name": "MDAxGDAWBgNVBAMMD01hdHRlciBUZXN0IFBBQTEUMBIGCisGAQQBgqJ8AgEMBEZGRjE=", + "revoked_serial_numbers": ["3E6CE6509AD840CD"] + }] + )"; + WriteTestRevokedData(jsonData, tmpJsonFile); + revocationDelegateImpl.CheckForRevokedDACChain(info, &attestationInformationVerificationCallback); + EXPECT_EQ(attestationResult, AttestationVerificationResult::kPaiAndDacRevoked); + + // Test with another test DAC and PAI + Credentials::DeviceAttestationVerifier::AttestationInfo FFF2_8001_info( + ByteSpan(attestationElementsTestVector), ByteSpan(attestationChallengeTestVector), ByteSpan(attestationSignatureTestVector), + TestCerts::sTestCert_PAI_FFF2_8001_Cert, TestCerts::sTestCert_DAC_FFF2_8001_0008_Cert, ByteSpan(attestationNonceTestVector), + static_cast(0xFFF2), 0x8001); + revocationDelegateImpl.CheckForRevokedDACChain(FFF2_8001_info, &attestationInformationVerificationCallback); + EXPECT_EQ(attestationResult, AttestationVerificationResult::kSuccess); + + // Test issuer does not match + jsonData = R"( + [{ + "type": "revocation_set", + "issuer_subject_key_id": "BF42B7094DEBD515EC6ECF33B81115225F325289", + "issuer_name": "MEYxGDAWBgNVBAMMD01hdHRlciBUZXN0IFBBSTEUMBIGCisGAQQBgqJ8AgEMBEZGRjExFDASBgorBgEEAYKifAICDAQ4MDAw", + "revoked_serial_numbers": ["0C694F7F866067B2"] + }] + )"; + WriteTestRevokedData(jsonData, tmpJsonFile); + revocationDelegateImpl.CheckForRevokedDACChain(info, &attestationInformationVerificationCallback); + EXPECT_EQ(attestationResult, AttestationVerificationResult::kSuccess); + + // Test subject key ID does not match + jsonData = R"( + [{ + "type": "revocation_set", + "issuer_subject_key_id": "BF42B7094DEBD515EC6ECF33B81115225F325289", + "issuer_name": "MEYxGDAWBgNVBAMMD01hdHRlciBUZXN0IFBBSTEUMBIGCisGAQQBgqJ8AgEMBEZGRjExFDASBgorBgEEAYKifAICDAQ4MDAw", + "revoked_serial_numbers": ["0C694F7F866067B2"] + }] + )"; + WriteTestRevokedData(jsonData, tmpJsonFile); + revocationDelegateImpl.CheckForRevokedDACChain(info, &attestationInformationVerificationCallback); + EXPECT_EQ(attestationResult, AttestationVerificationResult::kSuccess); + + // Test serial number does not match + jsonData = R"( + [{ + "type": "revocation_set", + "issuer_subject_key_id": "AF42B7094DEBD515EC6ECF33B81115225F325288", + "issuer_name": "MEYxGDAWBgNVBAMMD01hdHRlciBUZXN0IFBBSTEUMBIGCisGAQQBgqJ8AgEMBEZGRjExFDASBgorBgEEAYKifAICDAQ4MDAw", + "revoked_serial_numbers": ["3E6CE6509AD840CD1", "BC694F7F866067B1"] + }] + )"; + WriteTestRevokedData(jsonData, tmpJsonFile); + revocationDelegateImpl.CheckForRevokedDACChain(info, &attestationInformationVerificationCallback); + EXPECT_EQ(attestationResult, AttestationVerificationResult::kSuccess); + + // Test starting serial number bytes match but not all + jsonData = R"( + [{ + "type": "revocation_set", + "issuer_subject_key_id": "AF42B7094DEBD515EC6ECF33B81115225F325288", + "issuer_name": "MEYxGDAWBgNVBAMMD01hdHRlciBUZXN0IFBBSTEUMBIGCisGAQQBgqJ8AgEMBEZGRjExFDASBgorBgEEAYKifAICDAQ4MDAw", + "revoked_serial_numbers": ["0C694F7F866067B21234"] + }] + )"; + WriteTestRevokedData(jsonData, tmpJsonFile); + revocationDelegateImpl.CheckForRevokedDACChain(info, &attestationInformationVerificationCallback); + EXPECT_EQ(attestationResult, AttestationVerificationResult::kSuccess); +} diff --git a/src/credentials/tests/TestFabricTable.cpp b/src/credentials/tests/TestFabricTable.cpp index 75f51c1c2cb402..c5b78fc13e5b4f 100644 --- a/src/credentials/tests/TestFabricTable.cpp +++ b/src/credentials/tests/TestFabricTable.cpp @@ -22,9 +22,12 @@ */ #include -#include +#include + +#include #include +#include #include @@ -41,8 +44,6 @@ #include -#include - using namespace chip; using namespace chip::Credentials; diff --git a/src/credentials/tests/TestGroupDataProvider.cpp b/src/credentials/tests/TestGroupDataProvider.cpp index 7718cf0ee49cd2..6628b939012624 100644 --- a/src/credentials/tests/TestGroupDataProvider.cpp +++ b/src/credentials/tests/TestGroupDataProvider.cpp @@ -16,17 +16,20 @@ * limitations under the License. */ +#include +#include +#include +#include + +#include + #include #include -#include +#include #include #include #include #include -#include -#include -#include -#include using namespace chip::Credentials; using GroupInfo = GroupDataProvider::GroupInfo; diff --git a/src/credentials/tests/TestPersistentStorageOpCertStore.cpp b/src/credentials/tests/TestPersistentStorageOpCertStore.cpp index c1a57e00e95af2..d558818bb40f89 100644 --- a/src/credentials/tests/TestPersistentStorageOpCertStore.cpp +++ b/src/credentials/tests/TestPersistentStorageOpCertStore.cpp @@ -18,8 +18,10 @@ #include +#include + #include -#include +#include #include #include #include diff --git a/src/crypto/tests/BUILD.gn b/src/crypto/tests/BUILD.gn index 8570ed3defc157..d495f68ab54317 100644 --- a/src/crypto/tests/BUILD.gn +++ b/src/crypto/tests/BUILD.gn @@ -68,6 +68,7 @@ chip_test_suite("tests") { "${chip_root}/src/credentials/tests:cert_test_vectors", "${chip_root}/src/crypto", "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/support:testing", "${chip_root}/src/platform", ] diff --git a/src/crypto/tests/TestChipCryptoPAL.cpp b/src/crypto/tests/TestChipCryptoPAL.cpp index b4e0fbb2558057..2d1f5c0612217a 100644 --- a/src/crypto/tests/TestChipCryptoPAL.cpp +++ b/src/crypto/tests/TestChipCryptoPAL.cpp @@ -35,10 +35,12 @@ #include "SPAKE2P_POINT_VALID_test_vectors.h" #include "SPAKE2P_RFC_test_vectors.h" +#include + #include #include -#include #include +#include #include #include diff --git a/src/crypto/tests/TestGroupOperationalCredentials.cpp b/src/crypto/tests/TestGroupOperationalCredentials.cpp index 941423e327f873..9185704acd9d1c 100644 --- a/src/crypto/tests/TestGroupOperationalCredentials.cpp +++ b/src/crypto/tests/TestGroupOperationalCredentials.cpp @@ -18,12 +18,13 @@ #include +#include + #include #include +#include #include -#include - using namespace chip; using namespace chip::Crypto; diff --git a/src/crypto/tests/TestPSAOpKeyStore.cpp b/src/crypto/tests/TestPSAOpKeyStore.cpp index 4a16a19e254b60..ae3b142c27e25b 100644 --- a/src/crypto/tests/TestPSAOpKeyStore.cpp +++ b/src/crypto/tests/TestPSAOpKeyStore.cpp @@ -18,16 +18,17 @@ #include +#include + #include #include +#include #include #include #include #include #include -#include - using namespace chip; using namespace chip::Crypto; diff --git a/src/crypto/tests/TestPersistentStorageOpKeyStore.cpp b/src/crypto/tests/TestPersistentStorageOpKeyStore.cpp index 4448004ff2d3a3..26cf12ca7c2a1a 100644 --- a/src/crypto/tests/TestPersistentStorageOpKeyStore.cpp +++ b/src/crypto/tests/TestPersistentStorageOpKeyStore.cpp @@ -17,18 +17,18 @@ */ #include +#include + +#include #include +#include #include #include #include #include #include -#include - -#include - using namespace chip; using namespace chip::Crypto; diff --git a/src/crypto/tests/TestSessionKeystore.cpp b/src/crypto/tests/TestSessionKeystore.cpp index b3908d1695aaac..372ac0ad02c850 100644 --- a/src/crypto/tests/TestSessionKeystore.cpp +++ b/src/crypto/tests/TestSessionKeystore.cpp @@ -18,15 +18,16 @@ #include "AES_CCM_128_test_vectors.h" +#include + #include #include +#include #include #include #include #include -#include - #if CHIP_CRYPTO_PSA #include #endif diff --git a/src/darwin/Framework/CHIP/MTRBaseDevice.mm b/src/darwin/Framework/CHIP/MTRBaseDevice.mm index 331d61129b9daf..7f03a9690b8e61 100644 --- a/src/darwin/Framework/CHIP/MTRBaseDevice.mm +++ b/src/darwin/Framework/CHIP/MTRBaseDevice.mm @@ -14,8 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#import -#import +#import #import "MTRAttributeTLVValueDecoder_Internal.h" #import "MTRBaseDevice_Internal.h" @@ -31,31 +30,32 @@ #import "MTRLogging_Internal.h" #import "MTRMetricKeys.h" #import "MTRSetupPayload_Internal.h" +#import "MTRUtilities.h" #import "NSDataSpanConversion.h" #import "NSStringSpanConversion.h" #import "zap-generated/MTRCommandPayloads_Internal.h" -#include "app/ConcreteAttributePath.h" -#include "app/ConcreteCommandPath.h" -#include "app/ConcreteEventPath.h" -#include "app/StatusResponse.h" -#include "lib/core/CHIPError.h" -#include "lib/core/DataModelTypes.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include +#import "app/ConcreteAttributePath.h" +#import "app/ConcreteCommandPath.h" +#import "app/ConcreteEventPath.h" +#import "app/StatusResponse.h" +#import "lib/core/CHIPError.h" +#import "lib/core/DataModelTypes.h" + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#import using namespace chip; using namespace chip::app; @@ -2290,8 +2290,9 @@ + (MTRAttributeRequestPath *)requestPathWithEndpointID:(NSNumber * _Nullable)end - (BOOL)isEqualToAttributeRequestPath:(MTRAttributeRequestPath *)path { - return [_endpoint isEqualToNumber:path.endpoint] && [_cluster isEqualToNumber:path.cluster] && - [_attribute isEqualToNumber:path.attribute]; + return MTREqualObjects(_endpoint, path.endpoint) + && MTREqualObjects(_cluster, path.cluster) + && MTREqualObjects(_attribute, path.attribute); } - (BOOL)isEqual:(id)object @@ -2362,8 +2363,9 @@ + (MTREventRequestPath *)requestPathWithEndpointID:(NSNumber * _Nullable)endpoin - (BOOL)isEqualToEventRequestPath:(MTREventRequestPath *)path { - return - [_endpoint isEqualToNumber:path.endpoint] && [_cluster isEqualToNumber:path.cluster] && [_event isEqualToNumber:path.event]; + return MTREqualObjects(_endpoint, path.endpoint) + && MTREqualObjects(_cluster, path.cluster) + && MTREqualObjects(_event, path.event); } - (BOOL)isEqual:(id)object @@ -2432,7 +2434,8 @@ ConcreteClusterPath path(static_cast([endpointID unsignedShort - (BOOL)isEqualToClusterPath:(MTRClusterPath *)clusterPath { - return [_endpoint isEqualToNumber:clusterPath.endpoint] && [_cluster isEqualToNumber:clusterPath.cluster]; + return MTREqualObjects(_endpoint, clusterPath.endpoint) + && MTREqualObjects(_cluster, clusterPath.cluster); } - (BOOL)isEqual:(id)object @@ -2520,7 +2523,7 @@ ConcreteDataAttributePath path(static_cast([endpointID unsigne - (BOOL)isEqualToAttributePath:(MTRAttributePath *)attributePath { - return [self isEqualToClusterPath:attributePath] && [_attribute isEqualToNumber:attributePath.attribute]; + return [self isEqualToClusterPath:attributePath] && MTREqualObjects(_attribute, attributePath.attribute); } - (BOOL)isEqual:(id)object @@ -2613,7 +2616,7 @@ ConcreteEventPath path(static_cast([endpointID unsignedShortVa - (BOOL)isEqualToEventPath:(MTREventPath *)eventPath { - return [self isEqualToClusterPath:eventPath] && [_event isEqualToNumber:eventPath.event]; + return [self isEqualToClusterPath:eventPath] && MTREqualObjects(_event, eventPath.event); } - (BOOL)isEqual:(id)object @@ -2703,7 +2706,7 @@ ConcreteCommandPath path(static_cast([endpointID unsignedShort - (BOOL)isEqualToCommandPath:(MTRCommandPath *)commandPath { - return [self isEqualToClusterPath:commandPath] && [_command isEqualToNumber:commandPath.command]; + return [self isEqualToClusterPath:commandPath] && MTREqualObjects(_command, commandPath.command); } - (BOOL)isEqual:(id)object diff --git a/src/darwin/Framework/CHIP/MTRBaseSubscriptionCallback.h b/src/darwin/Framework/CHIP/MTRBaseSubscriptionCallback.h index ebcf3aae949433..9edd153fd2410c 100644 --- a/src/darwin/Framework/CHIP/MTRBaseSubscriptionCallback.h +++ b/src/darwin/Framework/CHIP/MTRBaseSubscriptionCallback.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -93,6 +94,12 @@ class MTRBaseSubscriptionCallback : public chip::app::ClusterStateCache::Callbac chip::app::BufferedReadCallback & GetBufferedCallback() { return mBufferedReadAdapter; } + // Methods to clear state from our cluster state cache. Must be called on + // the Matter queue. + void ClearCachedAttributeState(chip::EndpointId aEndpoint); + void ClearCachedAttributeState(const chip::app::ConcreteClusterPath & aCluster); + void ClearCachedAttributeState(const chip::app::ConcreteAttributePath & aAttribute); + // We need to exist to get a ReadClient, so can't take this as a constructor argument. void AdoptReadClient(std::unique_ptr aReadClient) { mReadClient = std::move(aReadClient); } void AdoptClusterStateCache(std::unique_ptr aClusterStateCache) diff --git a/src/darwin/Framework/CHIP/MTRBaseSubscriptionCallback.mm b/src/darwin/Framework/CHIP/MTRBaseSubscriptionCallback.mm index ca91aed5016126..4d91c76a385a9f 100644 --- a/src/darwin/Framework/CHIP/MTRBaseSubscriptionCallback.mm +++ b/src/darwin/Framework/CHIP/MTRBaseSubscriptionCallback.mm @@ -201,3 +201,27 @@ }); } } + +void MTRBaseSubscriptionCallback::ClearCachedAttributeState(EndpointId aEndpoint) +{ + assertChipStackLockedByCurrentThread(); + if (mClusterStateCache) { + mClusterStateCache->ClearAttributes(aEndpoint); + } +} + +void MTRBaseSubscriptionCallback::ClearCachedAttributeState(const ConcreteClusterPath & aCluster) +{ + assertChipStackLockedByCurrentThread(); + if (mClusterStateCache) { + mClusterStateCache->ClearAttributes(aCluster); + } +} + +void MTRBaseSubscriptionCallback::ClearCachedAttributeState(const ConcreteAttributePath & aAttribute) +{ + assertChipStackLockedByCurrentThread(); + if (mClusterStateCache) { + mClusterStateCache->ClearAttribute(aAttribute); + } +} diff --git a/src/darwin/Framework/CHIP/MTRDemuxingStorage.mm b/src/darwin/Framework/CHIP/MTRDemuxingStorage.mm index 1521a8c54f6726..fff85f8eb4c3d2 100644 --- a/src/darwin/Framework/CHIP/MTRDemuxingStorage.mm +++ b/src/darwin/Framework/CHIP/MTRDemuxingStorage.mm @@ -144,6 +144,8 @@ static bool IsMemoryOnlyGlobalKey(NSString * key) // We do not expect to see the "g/a/*" keys for attribute values. + // We do not expect to see the "g/sa/*" keys for attribute values. + // We do not expect to see the "g/bt" and "g/bt/*" keys for the binding // table. @@ -162,6 +164,11 @@ static bool IsMemoryOnlyGlobalKey(NSString * key) // We do not expect to see the "g/icd/cic" key; that's only used for an ICD // that sends check-in messages. + // We do not expect to see the "g/icdfl" key; that's only used by + // DefaultICDClientStorage, which Matter.framework does not use. + + // We do not expect to see the "g/tnd/*" Thread Network Directory keys. + return false; } @@ -215,6 +222,9 @@ static bool IsMemoryOnlyIndexSpecificKey(NSString * key) // We do not expect to see the "e/*" scenes keys. + // We do not epect to see the "icdc" or "icdk" keys, since those are only + // used by DefaultICDClientStorage, which Matter.framework does not use. + return false; } diff --git a/src/darwin/Framework/CHIP/MTRDevice.h b/src/darwin/Framework/CHIP/MTRDevice.h index a8098a7174572e..1c31cbc26a661b 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.h +++ b/src/darwin/Framework/CHIP/MTRDevice.h @@ -114,7 +114,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) * * The delegate will be called on the provided queue, for attribute reports, event reports, and device state changes. */ -- (void)setDelegate:(id)delegate queue:(dispatch_queue_t)queue MTR_NEWLY_DEPRECATED("Please use addDelegate:queue:interestedPaths:"); +- (void)setDelegate:(id)delegate queue:(dispatch_queue_t)queue MTR_DEPRECATED("Please use addDelegate:queue:interestedPaths:", ios(16.1, 18.0), macos(13.0, 15.0), watchos(9.1, 11.0), tvos(16.1, 18.0)); /** * Adds a delegate to receive asynchronous callbacks about the device. @@ -123,7 +123,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) * * MTRDevice holds a weak reference to the delegate object. */ -- (void)addDelegate:(id)delegate queue:(dispatch_queue_t)queue MTR_NEWLY_AVAILABLE; +- (void)addDelegate:(id)delegate queue:(dispatch_queue_t)queue MTR_AVAILABLE(ios(18.0), macos(15.0), watchos(11.0), tvos(18.0)); /** * Adds a delegate to receive asynchronous callbacks about the device, and limit attribute and/or event reports to a specific set of paths. @@ -138,12 +138,12 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) * * MTRDevice holds a weak reference to the delegate object. */ -- (void)addDelegate:(id)delegate queue:(dispatch_queue_t)queue interestedPathsForAttributes:(NSArray * _Nullable)interestedPathsForAttributes interestedPathsForEvents:(NSArray * _Nullable)interestedPathsForEvents MTR_NEWLY_AVAILABLE; +- (void)addDelegate:(id)delegate queue:(dispatch_queue_t)queue interestedPathsForAttributes:(NSArray * _Nullable)interestedPathsForAttributes interestedPathsForEvents:(NSArray * _Nullable)interestedPathsForEvents MTR_AVAILABLE(ios(18.0), macos(15.0), watchos(11.0), tvos(18.0)); /** * Removes the delegate from receiving callbacks about the device. */ -- (void)removeDelegate:(id)delegate MTR_NEWLY_AVAILABLE; +- (void)removeDelegate:(id)delegate MTR_AVAILABLE(ios(18.0), macos(15.0), watchos(11.0), tvos(18.0)); /** * Read attribute in a designated attribute path. If there is no value available diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index 89db49f077cdca..b8ef8694825e1f 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -15,7 +15,7 @@ * limitations under the License. */ -#import +#import #import #import "MTRAsyncWorkQueue.h" @@ -39,19 +39,20 @@ #import "MTRMetricsCollector.h" #import "MTRTimeUtils.h" #import "MTRUnfairLock.h" +#import "MTRUtilities.h" #import "zap-generated/MTRCommandPayloads_Internal.h" -#include "lib/core/CHIPError.h" -#include "lib/core/DataModelTypes.h" -#include -#include +#import "lib/core/CHIPError.h" +#import "lib/core/DataModelTypes.h" +#import +#import -#include -#include -#include -#include -#include -#include +#import +#import +#import +#import +#import +#import typedef void (^MTRDeviceAttributeReportHandler)(NSArray * _Nonnull); @@ -60,6 +61,9 @@ #define kSecondsToWaitBeforeMarkingUnreachableAfterSettingUpSubscription 10 +// Disabling pending crashes +#define ENABLE_CONNECTIVITY_MONITORING 0 + // Consider moving utility classes to their own file #pragma mark - Utility Classes @@ -333,7 +337,8 @@ - (id)copyWithZone:(NSZone *)zone - (BOOL)isEqualToClusterData:(MTRDeviceClusterData *)otherClusterData { - return [_dataVersion isEqual:otherClusterData.dataVersion] && [_attributes isEqual:otherClusterData.attributes]; + return MTREqualObjects(_dataVersion, otherClusterData.dataVersion) + && MTREqualObjects(_attributes, otherClusterData.attributes); } - (BOOL)isEqual:(id)object @@ -536,6 +541,9 @@ - (instancetype)initWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceControlle - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:_systemTimeChangeObserverToken]; + + // TODO: retain cycle and clean up https://github.com/project-chip/connectedhomeip/issues/34267 + MTR_LOG("MTRDevice dealloc: %p", self); } - (NSString *)description @@ -796,7 +804,7 @@ - (void)addDelegate:(id)delegate queue:(dispatch_queue_t)queu [self _addDelegate:delegate queue:queue interestedPathsForAttributes:nil interestedPathsForEvents:nil]; } -- (void)addDelegate:(id)delegate queue:(dispatch_queue_t)queue interestedPathsForAttributes:(NSArray * _Nullable)interestedPathsForAttributes interestedPathsForEvents:(NSArray * _Nullable)interestedPathsForEvents MTR_NEWLY_AVAILABLE; +- (void)addDelegate:(id)delegate queue:(dispatch_queue_t)queue interestedPathsForAttributes:(NSArray * _Nullable)interestedPathsForAttributes interestedPathsForEvents:(NSArray * _Nullable)interestedPathsForEvents { MTR_LOG("%@ addDelegate %@ with interested attribute paths %@ event paths %@", self, delegate, interestedPathsForAttributes, interestedPathsForEvents); [self _addDelegate:delegate queue:queue interestedPathsForAttributes:interestedPathsForAttributes interestedPathsForEvents:interestedPathsForEvents]; @@ -841,11 +849,13 @@ - (void)_addDelegate:(id)delegate queue:(dispatch_queue_t)que #endif if (shouldSetUpSubscription) { + MTR_LOG("%@ - starting subscription setup", self); // Record the time of first addDelegate call that triggers initial subscribe, and do not reset this value on subsequent addDelegate calls if (!_initialSubscribeStart) { _initialSubscribeStart = [NSDate now]; } if ([self _deviceUsesThread]) { + MTR_LOG(" => %@ - device is a thread device, scheduling in pool", self); [self _scheduleSubscriptionPoolWork:^{ std::lock_guard lock(self->_lock); [self _setupSubscriptionWithReason:@"delegate is set and scheduled subscription is happening"]; @@ -898,12 +908,17 @@ - (void)invalidate _reattemptingSubscription = NO; [_deviceController asyncDispatchToMatterQueue:^{ + MTR_LOG("%@ invalidate disconnecting ReadClient and SubscriptionCallback", self); + // Destroy the read client and callback (has to happen on the Matter // queue, to avoid deleting objects that are being referenced), to // tear down the subscription. We will get no more callbacks from - // the subscrption after this point. + // the subscription after this point. std::lock_guard lock(self->_lock); self->_currentReadClient = nullptr; + if (self->_currentSubscriptionCallback) { + delete self->_currentSubscriptionCallback; + } self->_currentSubscriptionCallback = nullptr; [self _changeInternalState:MTRInternalDeviceStateUnsubscribed]; @@ -930,6 +945,7 @@ - (void)nodeMayBeAdvertisingOperational // whether it might be. - (void)_triggerResubscribeWithReason:(NSString *)reason nodeLikelyReachable:(BOOL)nodeLikelyReachable { + MTR_LOG("%@ _triggerResubscribeWithReason called with reason %@", self, reason); assertChipStackLockedByCurrentThread(); // We might want to trigger a resubscribe on our existing ReadClient. Do @@ -1225,6 +1241,12 @@ - (void)_handleSubscriptionEstablished - (void)_handleSubscriptionError:(NSError *)error { std::lock_guard lock(_lock); + [self _doHandleSubscriptionError:error]; +} + +- (void)_doHandleSubscriptionError:(NSError *)error +{ + os_unfair_lock_assert_owner(&_lock); [self _changeInternalState:MTRInternalDeviceStateUnsubscribed]; _unreportedEvents = nil; @@ -1298,7 +1320,7 @@ - (void)_scheduleSubscriptionPoolWork:(dispatch_block_t)workBlock inNanoseconds: // Sanity check we are not scheduling for this device multiple times in the pool if (_subscriptionPoolWorkCompletionBlock) { - MTR_LOG_ERROR("%@ already scheduled in subscription pool for this device - ignoring: %@", self, description); + MTR_LOG("%@ already scheduled in subscription pool for this device - ignoring: %@", self, description); return; } @@ -1307,6 +1329,7 @@ - (void)_scheduleSubscriptionPoolWork:(dispatch_block_t)workBlock inNanoseconds: // In the case where a resubscription triggering event happened and already established, running the work block should result in a no-op MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.queue]; [workItem setReadyHandler:^(id _Nonnull context, NSInteger retryCount, MTRAsyncWorkCompletionBlock _Nonnull completion) { + MTR_LOG("%@ - work item is ready to attempt pooled subscription", self); os_unfair_lock_lock(&self->_lock); #ifdef DEBUG [self _callDelegatesWithBlock:^(id testDelegate) { @@ -1332,6 +1355,7 @@ - (void)_scheduleSubscriptionPoolWork:(dispatch_block_t)workBlock inNanoseconds: workBlock(); }]; [self->_deviceController.concurrentSubscriptionPool enqueueWorkItem:workItem description:description]; + MTR_LOG("%@ - enqueued in the subscription pool", self); }); } @@ -1381,15 +1405,21 @@ - (void)_handleResubscriptionNeededWithDelay:(NSNumber *)resubscriptionDelayMs dispatch_after(dispatch_time(DISPATCH_TIME_NOW, resubscriptionDelayNs), self.queue, resubscriptionBlock); } - // Set up connectivity monitoring in case network routability changes for the positive, to accellerate resubscription + // Set up connectivity monitoring in case network routability changes for the positive, to accelerate resubscription [self _setupConnectivityMonitoring]; } - (void)_handleSubscriptionReset:(NSNumber * _Nullable)retryDelay { std::lock_guard lock(_lock); + [self _doHandleSubscriptionReset:retryDelay]; +} + +- (void)_doHandleSubscriptionReset:(NSNumber * _Nullable)retryDelay +{ + os_unfair_lock_assert_owner(&_lock); - // If we are here, then either we failed to establish initil CASE, or we + // If we are here, then either we failed to establish initial CASE, or we // failed to send the initial SubscribeRequest message, or our ReadClient // has given up completely. Those all count as "we have tried and failed to // subscribe". @@ -1459,7 +1489,7 @@ - (void)_reattemptSubscriptionNowIfNeededWithReason:(NSString *)reason return; } - MTR_LOG("%@ reattempting subscription", self); + MTR_LOG("%@ reattempting subscription with reason %@", self, reason); self.reattemptingSubscription = NO; [self _setupSubscriptionWithReason:reason]; } @@ -2088,6 +2118,22 @@ - (void)unitTestClearClusterData } #endif +- (void)_reconcilePersistedClustersWithStorage +{ + os_unfair_lock_assert_owner(&self->_lock); + + NSMutableSet * clusterPathsToRemove = [NSMutableSet set]; + for (MTRClusterPath * clusterPath in _persistedClusters) { + MTRDeviceClusterData * data = [_deviceController.controllerDataStore getStoredClusterDataForNodeID:_nodeID endpointID:clusterPath.endpoint clusterID:clusterPath.cluster]; + if (!data) { + [clusterPathsToRemove addObject:clusterPath]; + } + } + + MTR_LOG_ERROR("%@ Storage missing %lu / %lu clusters - reconciling in-memory records", self, static_cast(clusterPathsToRemove.count), static_cast(_persistedClusters.count)); + [_persistedClusters minusSet:clusterPathsToRemove]; +} + - (nullable MTRDeviceClusterData *)_clusterDataForPath:(MTRClusterPath *)clusterPath { os_unfair_lock_assert_owner(&self->_lock); @@ -2120,8 +2166,16 @@ - (nullable MTRDeviceClusterData *)_clusterDataForPath:(MTRClusterPath *)cluster // Page in the stored value for the data. MTRDeviceClusterData * data = [_deviceController.controllerDataStore getStoredClusterDataForNodeID:_nodeID endpointID:clusterPath.endpoint clusterID:clusterPath.cluster]; + MTR_LOG("%@ cluster path %@ cache miss - load from storage success %@", self, clusterPath, YES_NO(data)); if (data != nil) { [_persistedClusterData setObject:data forKey:clusterPath]; + } else { + // If clusterPath is in _persistedClusters and the data store returns nil for it, then the in-memory cache is now not dependable, and subscription should be reset and reestablished to reload cache from device + + // First make sure _persistedClusters is consistent with storage, so repeated calls don't immediately re-trigger this + [self _reconcilePersistedClustersWithStorage]; + + [self _resetSubscriptionWithReasonString:[NSString stringWithFormat:@"Data store has no data for cluster %@", clusterPath]]; } return data; @@ -2223,36 +2277,31 @@ - (void)_removeCachedAttribute:(NSNumber *)attributeID fromCluster:(MTRClusterPa [clusterData removeValueForAttribute:attributeID]; } -- (void)_createDataVersionFilterListFromDictionary:(NSDictionary *)dataVersions dataVersionFilterList:(DataVersionFilter **)dataVersionFilterList count:(size_t *)count sizeReduction:(size_t)sizeReduction +- (void)_createDataVersionFilterListFromDictionary:(NSDictionary *)dataVersions dataVersionFilterList:(DataVersionFilter **)dataVersionFilterList count:(size_t *)count { - size_t maxDataVersionFilterSize = dataVersions.count; + size_t dataVersionFilterSize = dataVersions.count; // Check if any filter list should be generated - if (!dataVersions.count || (maxDataVersionFilterSize <= sizeReduction)) { + if (dataVersionFilterSize == 0) { *count = 0; *dataVersionFilterList = nullptr; return; } - maxDataVersionFilterSize -= sizeReduction; - DataVersionFilter * dataVersionFilterArray = new DataVersionFilter[maxDataVersionFilterSize]; + DataVersionFilter * dataVersionFilterArray = new DataVersionFilter[dataVersionFilterSize]; size_t i = 0; for (MTRClusterPath * path in dataVersions) { NSNumber * dataVersionNumber = dataVersions[path]; - if (dataVersionNumber) { - dataVersionFilterArray[i++] = DataVersionFilter(static_cast(path.endpoint.unsignedShortValue), static_cast(path.cluster.unsignedLongValue), static_cast(dataVersionNumber.unsignedLongValue)); - } - if (i == maxDataVersionFilterSize) { - break; - } + dataVersionFilterArray[i++] = DataVersionFilter(static_cast(path.endpoint.unsignedShortValue), static_cast(path.cluster.unsignedLongValue), static_cast(dataVersionNumber.unsignedLongValue)); } *dataVersionFilterList = dataVersionFilterArray; - *count = maxDataVersionFilterSize; + *count = dataVersionFilterSize; } - (void)_setupConnectivityMonitoring { +#if ENABLE_CONNECTIVITY_MONITORING // Dispatch to own queue first to avoid deadlock with syncGetCompressedFabricID dispatch_async(self.queue, ^{ // Get the required info before setting up the connectivity monitor @@ -2277,6 +2326,7 @@ - (void)_setupConnectivityMonitoring errorHandler:nil]; } queue:self.queue]; }); +#endif } - (void)_stopConnectivityMonitoring @@ -2289,13 +2339,43 @@ - (void)_stopConnectivityMonitoring } } +- (void)_resetSubscriptionWithReasonString:(NSString *)reasonString +{ + os_unfair_lock_assert_owner(&self->_lock); + MTR_LOG_ERROR("%@ %@ - resetting subscription", self, reasonString); + + [_deviceController asyncDispatchToMatterQueue:^{ + MTR_LOG("%@ subscription reset disconnecting ReadClient and SubscriptionCallback", self); + + std::lock_guard lock(self->_lock); + self->_currentReadClient = nullptr; + if (self->_currentSubscriptionCallback) { + delete self->_currentSubscriptionCallback; + } + self->_currentSubscriptionCallback = nullptr; + + [self _doHandleSubscriptionError:nil]; + // Use nil reset delay so that this keeps existing backoff timing + [self _doHandleSubscriptionReset:nil]; + } + errorHandler:nil]; +} + +#ifdef DEBUG +- (void)unitTestResetSubscription +{ + std::lock_guard lock(self->_lock); + [self _resetSubscriptionWithReasonString:@"Unit test reset subscription"]; +} +#endif + // assume lock is held - (void)_setupSubscriptionWithReason:(NSString *)reason { os_unfair_lock_assert_owner(&self->_lock); if (![self _subscriptionsAllowed]) { - MTR_LOG("%@ _setupSubscription: Subscriptions not allowed. Do not set up subscription", self); + MTR_LOG("%@ _setupSubscription: Subscriptions not allowed. Do not set up subscription (reason: %@)", self, reason); return; } @@ -2314,6 +2394,7 @@ - (void)_setupSubscriptionWithReason:(NSString *)reason // for now just subscribe once if (!NeedToStartSubscriptionSetup(_internalDeviceState)) { + MTR_LOG("%@ setupSubscription: no need to subscribe due to internal state %lu (reason: %@)", self, static_cast(_internalDeviceState), reason); return; } @@ -2443,75 +2524,55 @@ - (void)_setupSubscriptionWithReason:(NSString *)reason auto readClient = std::make_unique(InteractionModelEngine::GetInstance(), exchangeManager, clusterStateCache->GetBufferedCallback(), ReadClient::InteractionType::Subscribe); - // Subscribe with data version filter list and retry with smaller list if out of packet space - CHIP_ERROR err; - NSDictionary * dataVersions = [self _getCachedDataVersions]; - size_t dataVersionFilterListSizeReduction = 0; - for (;;) { - // Wildcard endpoint, cluster, attribute, event. - auto attributePath = std::make_unique(); - auto eventPath = std::make_unique(); - // We want to get event reports at the minInterval, not the maxInterval. - eventPath->mIsUrgentEvent = true; - ReadPrepareParams readParams(session.Value()); - - readParams.mMinIntervalFloorSeconds = 0; - // Select a max interval based on the device's claimed idle sleep interval. - auto idleSleepInterval = std::chrono::duration_cast( - session.Value()->GetRemoteMRPConfig().mIdleRetransTimeout); - - auto maxIntervalCeilingMin = System::Clock::Seconds32(MTR_DEVICE_SUBSCRIPTION_MAX_INTERVAL_MIN); - if (idleSleepInterval < maxIntervalCeilingMin) { - idleSleepInterval = maxIntervalCeilingMin; - } - - auto maxIntervalCeilingMax = System::Clock::Seconds32(MTR_DEVICE_SUBSCRIPTION_MAX_INTERVAL_MAX); - if (idleSleepInterval > maxIntervalCeilingMax) { - idleSleepInterval = maxIntervalCeilingMax; - } + // Wildcard endpoint, cluster, attribute, event. + auto attributePath = std::make_unique(); + auto eventPath = std::make_unique(); + // We want to get event reports at the minInterval, not the maxInterval. + eventPath->mIsUrgentEvent = true; + ReadPrepareParams readParams(session.Value()); + + readParams.mMinIntervalFloorSeconds = 0; + // Select a max interval based on the device's claimed idle sleep interval. + auto idleSleepInterval = std::chrono::duration_cast( + session.Value()->GetRemoteMRPConfig().mIdleRetransTimeout); + + auto maxIntervalCeilingMin = System::Clock::Seconds32(MTR_DEVICE_SUBSCRIPTION_MAX_INTERVAL_MIN); + if (idleSleepInterval < maxIntervalCeilingMin) { + idleSleepInterval = maxIntervalCeilingMin; + } + + auto maxIntervalCeilingMax = System::Clock::Seconds32(MTR_DEVICE_SUBSCRIPTION_MAX_INTERVAL_MAX); + if (idleSleepInterval > maxIntervalCeilingMax) { + idleSleepInterval = maxIntervalCeilingMax; + } #ifdef DEBUG - if (maxIntervalOverride.HasValue()) { - idleSleepInterval = maxIntervalOverride.Value(); - } -#endif - readParams.mMaxIntervalCeilingSeconds = static_cast(idleSleepInterval.count()); - - readParams.mpAttributePathParamsList = attributePath.get(); - readParams.mAttributePathParamsListSize = 1; - readParams.mpEventPathParamsList = eventPath.get(); - readParams.mEventPathParamsListSize = 1; - readParams.mKeepSubscriptions = true; - readParams.mIsFabricFiltered = false; - size_t dataVersionFilterListSize = 0; - DataVersionFilter * dataVersionFilterList; - [self _createDataVersionFilterListFromDictionary:dataVersions dataVersionFilterList:&dataVersionFilterList count:&dataVersionFilterListSize sizeReduction:dataVersionFilterListSizeReduction]; - readParams.mDataVersionFilterListSize = dataVersionFilterListSize; - readParams.mpDataVersionFilterList = dataVersionFilterList; - attributePath.release(); - eventPath.release(); - - // TODO: Change from local filter list generation to rehydrating ClusterStateCache ot take advantage of existing filter list sorting algorithm - - // SendAutoResubscribeRequest cleans up the params, even on failure. - err = readClient->SendAutoResubscribeRequest(std::move(readParams)); - if (err == CHIP_NO_ERROR) { - break; - } - - // If error is not a "no memory" issue, then break and go through regular resubscribe logic - if (err != CHIP_ERROR_NO_MEMORY) { - break; - } - - // If "no memory" error is not caused by data version filter list, break as well - if (!dataVersionFilterListSize) { - break; - } - - // Now "no memory" could mean subscribe request packet space ran out. Reduce size and try again immediately - dataVersionFilterListSizeReduction++; + if (maxIntervalOverride.HasValue()) { + idleSleepInterval = maxIntervalOverride.Value(); } +#endif + readParams.mMaxIntervalCeilingSeconds = static_cast(idleSleepInterval.count()); + + readParams.mpAttributePathParamsList = attributePath.get(); + readParams.mAttributePathParamsListSize = 1; + readParams.mpEventPathParamsList = eventPath.get(); + readParams.mEventPathParamsListSize = 1; + readParams.mKeepSubscriptions = true; + readParams.mIsFabricFiltered = false; + + // Subscribe with data version filter list from our cache. + size_t dataVersionFilterListSize = 0; + DataVersionFilter * dataVersionFilterList; + [self _createDataVersionFilterListFromDictionary:[self _getCachedDataVersions] dataVersionFilterList:&dataVersionFilterList count:&dataVersionFilterListSize]; + readParams.mDataVersionFilterListSize = dataVersionFilterListSize; + readParams.mpDataVersionFilterList = dataVersionFilterList; + attributePath.release(); + eventPath.release(); + + // TODO: Change from local filter list generation to rehydrating ClusterStateCache to take advantage of existing filter list sorting algorithm + + // SendAutoResubscribeRequest cleans up the params, even on failure. + CHIP_ERROR err = readClient->SendAutoResubscribeRequest(std::move(readParams)); if (err != CHIP_NO_ERROR) { NSError * error = [MTRError errorForCHIPErrorCode:err logContext:self]; MTR_LOG_ERROR("%@ SendAutoResubscribeRequest error %@", self, error); @@ -2523,7 +2584,7 @@ - (void)_setupSubscriptionWithReason:(NSString *)reason return; } - MTR_LOG("%@ Subscribe with data version list size %lu, reduced by %lu", self, static_cast(dataVersions.count), static_cast(dataVersionFilterListSizeReduction)); + MTR_LOG("%@ Subscribe with data version list size %lu", self, static_cast(dataVersionFilterListSize)); // Callback and ClusterStateCache and ReadClient will be deleted // when OnDone is called. @@ -3429,6 +3490,13 @@ - (void)_pruneEndpointsIn:(MTRDeviceDataValueDictionary)previousPartsListValue } [self _removeClusters:clusterPathsToRemove doRemoveFromDataStore:NO]; [self.deviceController.controllerDataStore clearStoredClusterDataForNodeID:self.nodeID endpointID:endpoint]; + + [_deviceController asyncDispatchToMatterQueue:^{ + std::lock_guard lock(self->_lock); + if (self->_currentSubscriptionCallback) { + self->_currentSubscriptionCallback->ClearCachedAttributeState(static_cast(endpoint.unsignedLongLongValue)); + } + } errorHandler:nil]; } } @@ -3449,6 +3517,17 @@ - (void)_pruneClustersIn:(MTRDeviceDataValueDictionary)previousServerListValue } } [self _removeClusters:clusterPathsToRemove doRemoveFromDataStore:YES]; + + [_deviceController asyncDispatchToMatterQueue:^{ + std::lock_guard lock(self->_lock); + if (self->_currentSubscriptionCallback) { + for (NSNumber * cluster in toBeRemovedClusters) { + ConcreteClusterPath clusterPath(static_cast(endpointID.unsignedLongLongValue), + static_cast(cluster.unsignedLongLongValue)); + self->_currentSubscriptionCallback->ClearCachedAttributeState(clusterPath); + } + } + } errorHandler:nil]; } - (void)_pruneAttributesIn:(MTRDeviceDataValueDictionary)previousAttributeListValue @@ -3462,6 +3541,18 @@ - (void)_pruneAttributesIn:(MTRDeviceDataValueDictionary)previousAttributeListVa [toBeRemovedAttributes minusSet:attributesStillInCluster]; [self _removeAttributes:toBeRemovedAttributes fromCluster:clusterPath]; + + [_deviceController asyncDispatchToMatterQueue:^{ + std::lock_guard lock(self->_lock); + if (self->_currentSubscriptionCallback) { + for (NSNumber * attribute in toBeRemovedAttributes) { + ConcreteAttributePath attributePath(static_cast(clusterPath.endpoint.unsignedLongLongValue), + static_cast(clusterPath.cluster.unsignedLongLongValue), + static_cast(attribute.unsignedLongLongValue)); + self->_currentSubscriptionCallback->ClearCachedAttributeState(attributePath); + } + } + } errorHandler:nil]; } - (void)_pruneStoredDataForPath:(MTRAttributePath *)attributePath @@ -3625,7 +3716,9 @@ - (NSArray *)_getAttributesToReportWithReportedValues:(NSArray 0) { + MTR_LOG("%@ report from reported values %@", self, attributePathsToReport); + } return attributesToReport; } @@ -3712,14 +3805,21 @@ - (void)_storePersistedDeviceData } #ifdef DEBUG -- (MTRDeviceClusterData *)_getClusterDataForPath:(MTRClusterPath *)path +- (MTRDeviceClusterData *)unitTestGetClusterDataForPath:(MTRClusterPath *)path { std::lock_guard lock(_lock); return [[self _clusterDataForPath:path] copy]; } -- (BOOL)_clusterHasBeenPersisted:(MTRClusterPath *)path +- (NSSet *)unitTestGetPersistedClusters +{ + std::lock_guard lock(_lock); + + return [_persistedClusters copy]; +} + +- (BOOL)unitTestClusterHasBeenPersisted:(MTRClusterPath *)path { std::lock_guard lock(_lock); diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index cea281551384d0..2e4bb6d4fb0400 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -272,7 +272,7 @@ - (instancetype)initWithFactory:(MTRDeviceControllerFactory *)factory concurrentSubscriptionPoolSize = 1; } - MTR_LOG("Setting up pool size of MTRDeviceController with: %lu", static_cast(concurrentSubscriptionPoolSize)); + MTR_LOG("%@ Setting up pool size of MTRDeviceController with: %lu", self, static_cast(concurrentSubscriptionPoolSize)); _concurrentSubscriptionPool = [[MTRAsyncWorkQueue alloc] initWithContext:self width:concurrentSubscriptionPoolSize]; @@ -283,6 +283,11 @@ - (instancetype)initWithFactory:(MTRDeviceControllerFactory *)factory return self; } +- (NSString *)description +{ + return [NSString stringWithFormat:@"", self, _uniqueIdentifier]; +} + - (BOOL)isRunning { return _cppCommissioner != nullptr; @@ -290,11 +295,13 @@ - (BOOL)isRunning - (void)shutdown { + MTR_LOG("%@ shutdown called", self); if (_cppCommissioner == nullptr) { // Already shut down. return; } + MTR_LOG("Shutting down MTRDeviceController: %@", self); [self cleanupAfterStartup]; } @@ -306,6 +313,7 @@ - (void)cleanupAfterStartup // do the secure session shutdowns. Since we don't want to hold the lock // while calling out into arbitrary invalidation code, snapshot the list of // devices before we start invalidating. + MTR_LOG("cleanupAfterStartup MTRDeviceController: %@", self); os_unfair_lock_lock(&_deviceMapLock); NSEnumerator * devices = [_nodeIDToDeviceMap objectEnumerator]; [_nodeIDToDeviceMap removeAllObjects]; @@ -323,6 +331,7 @@ - (void)cleanupAfterStartup // in a very specific way that only MTRDeviceControllerFactory knows about. - (void)shutDownCppController { + MTR_LOG("shutDownCppController MTRDeviceController: %p", self); assertChipStackLockedByCurrentThread(); // Shut down all our endpoints. @@ -390,7 +399,7 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams { __block BOOL commissionerInitialized = NO; if ([self isRunning]) { - MTR_LOG_ERROR("Unexpected duplicate call to startup"); + MTR_LOG_ERROR("%@ Unexpected duplicate call to startup", self); return NO; } @@ -401,24 +410,24 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams if (startupParams.vendorID == nil || [startupParams.vendorID unsignedShortValue] == chip::VendorId::Common) { // Shouldn't be using the "standard" vendor ID for actual devices. - MTR_LOG_ERROR("%@ is not a valid vendorID to initialize a device controller with", startupParams.vendorID); + MTR_LOG_ERROR("%@ %@ is not a valid vendorID to initialize a device controller with", self, startupParams.vendorID); return; } if (startupParams.operationalCertificate == nil && startupParams.nodeID == nil) { - MTR_LOG_ERROR("Can't start a controller if we don't know what node id it is"); + MTR_LOG_ERROR("%@ Can't start a controller if we don't know what node id it is", self); return; } if ([startupParams keypairsMatchCertificates] == NO) { - MTR_LOG_ERROR("Provided keypairs do not match certificates"); + MTR_LOG_ERROR("%@ Provided keypairs do not match certificates", self); return; } if (startupParams.operationalCertificate != nil && startupParams.operationalKeypair == nil && (!startupParams.fabricIndex.HasValue() || !startupParams.keystore->HasOpKeypairForFabric(startupParams.fabricIndex.Value()))) { - MTR_LOG_ERROR("Have no operational keypair for our operational certificate"); + MTR_LOG_ERROR("%@ Have no operational keypair for our operational certificate", self); return; } @@ -581,9 +590,12 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams self->_storedFabricIndex = fabricIdx; commissionerInitialized = YES; + + MTR_LOG("%@ startup succeeded for nodeID 0x%016llX", self, self->_cppCommissioner->GetNodeId()); }); if (commissionerInitialized == NO) { + MTR_LOG_ERROR("%@ startup failed", self); [self cleanupAfterStartup]; return NO; } @@ -594,7 +606,7 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams // above. if (![self setOperationalCertificateIssuer:startupParams.operationalCertificateIssuer queue:startupParams.operationalCertificateIssuerQueue]) { - MTR_LOG_ERROR("operationalCertificateIssuer and operationalCertificateIssuerQueue must both be nil or both be non-nil"); + MTR_LOG_ERROR("%@ operationalCertificateIssuer and operationalCertificateIssuerQueue must both be nil or both be non-nil", self); [self cleanupAfterStartup]; return NO; } @@ -602,16 +614,29 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams if (_controllerDataStore) { // If the storage delegate supports the bulk read API, then a dictionary of nodeID => cluster data dictionary would be passed to the handler. Otherwise this would be a no-op, and stored attributes for MTRDevice objects will be loaded lazily in -deviceForNodeID:. [_controllerDataStore fetchAttributeDataForAllDevices:^(NSDictionary *> * _Nonnull clusterDataByNode) { - MTR_LOG("Loaded attribute values for %lu nodes from storage for controller uuid %@", static_cast(clusterDataByNode.count), self->_uniqueIdentifier); + MTR_LOG("%@ Loaded attribute values for %lu nodes from storage for controller uuid %@", self, static_cast(clusterDataByNode.count), self->_uniqueIdentifier); std::lock_guard lock(self->_deviceMapLock); + NSMutableArray * deviceList = [NSMutableArray array]; for (NSNumber * nodeID in clusterDataByNode) { NSDictionary * clusterData = clusterDataByNode[nodeID]; MTRDevice * device = [self _setupDeviceForNodeID:nodeID prefetchedClusterData:clusterData]; - MTR_LOG("Loaded %lu cluster data from storage for %@", static_cast(clusterData.count), device); + MTR_LOG("%@ Loaded %lu cluster data from storage for %@", self, static_cast(clusterData.count), device); + + [deviceList addObject:device]; } + +#define kSecondsToWaitBeforeAPIClientRetainsMTRDevice 60 + // Keep the devices retained for a while, in case API client doesn't immediately retain them. + // + // Note that this is just an optimization to avoid throwing the information away and immediately + // re-reading it from storage. + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (kSecondsToWaitBeforeAPIClientRetainsMTRDevice * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + MTR_LOG("%@ un-retain devices loaded at startup %lu", self, static_cast(deviceList.count)); + }); }]; } + MTR_LOG("MTRDeviceController startup: %@", self); return YES; } @@ -622,7 +647,7 @@ - (NSNumber *)controllerNodeID NSNumber * nodeID = [self syncRunOnWorkQueueWithReturnValue:block error:nil]; if (!nodeID) { - MTR_LOG_ERROR("A controller has no node id if it has not been started"); + MTR_LOG_ERROR("%@ A controller has no node id if it has not been started", self); } return nodeID; @@ -691,7 +716,7 @@ - (BOOL)setupCommissioningSessionWithDiscoveredDevice:(MTRCommissionableBrowserR newNodeID:(NSNumber *)newNodeID error:(NSError * __autoreleasing *)error { - MTR_LOG("Setting up commissioning session for already-discovered device %@ and device ID 0x%016llX with setup payload %@", discoveredDevice, newNodeID.unsignedLongLongValue, payload); + MTR_LOG("%@ Setting up commissioning session for already-discovered device %@ and device ID 0x%016llX with setup payload %@", self, discoveredDevice, newNodeID.unsignedLongLongValue, payload); [[MTRMetricsCollector sharedInstance] resetMetrics]; @@ -949,8 +974,7 @@ - (MTRBaseDevice *)deviceBeingCommissionedWithNodeID:(NSNumber *)nodeID error:(N }; MTRBaseDevice * device = [self syncRunOnWorkQueueWithReturnValue:block error:error]; - MTR_LOG("Getting device being commissioned with node ID 0x%016llX: %@ (error: %@)", - nodeID.unsignedLongLongValue, device, (error ? *error : nil)); + MTR_LOG("%@ Getting device being commissioned with node ID 0x%016llX: %@ (error: %@)", self, nodeID.unsignedLongLongValue, device, (error ? *error : nil)); return device; } @@ -980,7 +1004,7 @@ - (MTRDevice *)_setupDeviceForNodeID:(NSNumber *)nodeID prefetchedClusterData:(N } else if (_controllerDataStore) { // Load persisted cluster data if they exist. NSDictionary * clusterData = [_controllerDataStore getStoredClusterDataForNodeID:nodeID]; - MTR_LOG("Loaded %lu cluster data from storage for %@", static_cast(clusterData.count), deviceToReturn); + MTR_LOG("%@ Loaded %lu cluster data from storage for %@", self, static_cast(clusterData.count), deviceToReturn); if (clusterData.count) { [deviceToReturn setPersistedClusterData:clusterData]; } @@ -1019,7 +1043,7 @@ - (void)removeDevice:(MTRDevice *)device [deviceToRemove invalidate]; [_nodeIDToDeviceMap removeObjectForKey:nodeID]; } else { - MTR_LOG_ERROR("Error: Cannot remove device %p with nodeID %llu", device, nodeID.unsignedLongLongValue); + MTR_LOG_ERROR("%@ Error: Cannot remove device %p with nodeID %llu", self, device, nodeID.unsignedLongLongValue); } } @@ -1101,7 +1125,7 @@ - (NSData * _Nullable)attestationChallengeForDeviceID:(NSNumber *)deviceID chip::CommissioneeDeviceProxy * deviceProxy; auto errorCode = CHIP_NO_ERROR; - MATTER_LOG_METRIC_SCOPE(kMetricPASEVerifierForSetupCode, errorCode); + MATTER_LOG_METRIC_SCOPE(kMetricAttestationChallengeForDevice, errorCode); errorCode = self->_cppCommissioner->GetDeviceBeingCommissioned([deviceID unsignedLongLongValue], &deviceProxy); VerifyOrReturnValue(![MTRDeviceController checkForError:errorCode logMsg:kErrorGetCommissionee error:nil], nil); @@ -1127,7 +1151,7 @@ - (BOOL)addServerEndpoint:(MTRServerEndpoint *)endpoint } if (![endpoint associateWithController:self]) { - MTR_LOG_ERROR("Failed to associate MTRServerEndpoint with MTRDeviceController"); + MTR_LOG_ERROR("%@ Failed to associate MTRServerEndpoint with MTRDeviceController", self); [_factory removeServerEndpoint:endpoint]; return NO; } @@ -1135,11 +1159,11 @@ - (BOOL)addServerEndpoint:(MTRServerEndpoint *)endpoint [self asyncDispatchToMatterQueue:^() { [self->_serverEndpoints addObject:endpoint]; [endpoint registerMatterEndpoint]; - MTR_LOG("Added server endpoint %u to controller %@", static_cast(endpoint.endpointID.unsignedLongLongValue), + MTR_LOG("%@ Added server endpoint %u to controller %@", self, static_cast(endpoint.endpointID.unsignedLongLongValue), self->_uniqueIdentifier); } errorHandler:^(NSError * error) { - MTR_LOG_ERROR("Unexpected failure dispatching to Matter queue on running controller in addServerEndpoint, adding endpoint %u", + MTR_LOG_ERROR("%@ Unexpected failure dispatching to Matter queue on running controller in addServerEndpoint, adding endpoint %u", self, static_cast(endpoint.endpointID.unsignedLongLongValue)); }]; return YES; @@ -1163,7 +1187,7 @@ - (void)removeServerEndpointInternal:(MTRServerEndpoint *)endpoint queue:(dispat // tearing it down. [self asyncDispatchToMatterQueue:^() { [self removeServerEndpointOnMatterQueue:endpoint]; - MTR_LOG("Removed server endpoint %u from controller %@", static_cast(endpoint.endpointID.unsignedLongLongValue), + MTR_LOG("%@ Removed server endpoint %u from controller %@", self, static_cast(endpoint.endpointID.unsignedLongLongValue), self->_uniqueIdentifier); if (queue != nil && completion != nil) { dispatch_async(queue, completion); @@ -1171,7 +1195,7 @@ - (void)removeServerEndpointInternal:(MTRServerEndpoint *)endpoint queue:(dispat } errorHandler:^(NSError * error) { // Error means we got shut down, so the endpoint is removed now. - MTR_LOG("controller %@ already shut down, so endpoint %u has already been removed", self->_uniqueIdentifier, + MTR_LOG("%@ controller already shut down, so endpoint %u has already been removed", self, static_cast(endpoint.endpointID.unsignedLongLongValue)); if (queue != nil && completion != nil) { dispatch_async(queue, completion); @@ -1196,7 +1220,7 @@ - (BOOL)checkForInitError:(BOOL)condition logMsg:(NSString *)logMsg return NO; } - MTR_LOG_ERROR("Error: %@", logMsg); + MTR_LOG_ERROR("%@ Error: %@", self, logMsg); [self cleanup]; @@ -1217,7 +1241,7 @@ - (BOOL)checkForStartError:(CHIP_ERROR)errorCode logMsg:(NSString *)logMsg return NO; } - MTR_LOG_ERROR("Error(%" CHIP_ERROR_FORMAT "): %@", errorCode.Format(), logMsg); + MTR_LOG_ERROR("Error(%" CHIP_ERROR_FORMAT "): %@ %@", errorCode.Format(), self, logMsg); return YES; } @@ -1228,7 +1252,7 @@ + (BOOL)checkForError:(CHIP_ERROR)errorCode logMsg:(NSString *)logMsg error:(NSE return NO; } - MTR_LOG_ERROR("Error(%" CHIP_ERROR_FORMAT "): %s", errorCode.Format(), [logMsg UTF8String]); + MTR_LOG_ERROR("Error(%" CHIP_ERROR_FORMAT "): %@ %s", errorCode.Format(), self, [logMsg UTF8String]); if (error) { *error = [MTRError errorForCHIPErrorCode:errorCode]; } @@ -1247,7 +1271,7 @@ - (BOOL)checkIsRunning:(NSError * __autoreleasing *)error return YES; } - MTR_LOG_ERROR("Error: %s", [kErrorNotRunning UTF8String]); + MTR_LOG_ERROR("MTRDeviceController: %@ Error: %s", self, [kErrorNotRunning UTF8String]); if (error) { *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; } @@ -1257,15 +1281,12 @@ - (BOOL)checkIsRunning:(NSError * __autoreleasing *)error - (void)getSessionForNode:(chip::NodeId)nodeID completion:(MTRInternalDeviceConnectionCallback)completion { - // First check if MTRDevice exists from having loaded from storage, or created by a client. - // Do not use deviceForNodeID here, because we don't want to create the device if it does not already exist. - os_unfair_lock_lock(&_deviceMapLock); - MTRDevice * device = [_nodeIDToDeviceMap objectForKey:@(nodeID)]; - os_unfair_lock_unlock(&_deviceMapLock); + // Get the corresponding MTRDevice object to determine if the case/subscription pool is to be used + MTRDevice * device = [self deviceForNodeID:@(nodeID)]; // In the case that this device is known to use thread, queue this with subscription attempts as well, to // help with throttling Thread traffic. - if (device && [device deviceUsesThread]) { + if ([device deviceUsesThread]) { MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; [workItem setReadyHandler:^(id _Nonnull context, NSInteger retryCount, MTRAsyncWorkCompletionBlock _Nonnull workItemCompletion) { MTRInternalDeviceConnectionCallback completionWrapper = ^(chip::Messaging::ExchangeManager * _Nullable exchangeManager, @@ -1869,17 +1890,17 @@ - (MTRBaseDevice *)getDeviceBeingCommissioned:(uint64_t)deviceId error:(NSError - (BOOL)openPairingWindow:(uint64_t)deviceID duration:(NSUInteger)duration error:(NSError * __autoreleasing *)error { if (duration > UINT16_MAX) { - MTR_LOG_ERROR("Error: Duration %lu is too large. Max value %d", static_cast(duration), UINT16_MAX); + MTR_LOG_ERROR("%@ Error: Duration %lu is too large. Max value %d", self, static_cast(duration), UINT16_MAX); if (error) { *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INVALID_INTEGER_VALUE]; } return NO; } - __block CHIP_ERROR errorCode = CHIP_NO_ERROR; - MATTER_LOG_METRIC_SCOPE(kMetricOpenPairingWindow, errorCode); - auto block = ^BOOL { + CHIP_ERROR errorCode = CHIP_NO_ERROR; + MATTER_LOG_METRIC_SCOPE(kMetricOpenPairingWindow, errorCode); + errorCode = chip::Controller::AutoCommissioningWindowOpener::OpenBasicCommissioningWindow( self->_cppCommissioner, deviceID, chip::System::Clock::Seconds16(static_cast(duration))); return ![MTRDeviceController checkForError:errorCode logMsg:kErrorOpenPairingWindow error:error]; @@ -1895,7 +1916,7 @@ - (NSString *)openPairingWindowWithPIN:(uint64_t)deviceID error:(NSError * __autoreleasing *)error { if (duration > UINT16_MAX) { - MTR_LOG_ERROR("Error: Duration %lu is too large. Max value %d", static_cast(duration), UINT16_MAX); + MTR_LOG_ERROR("%@ Error: Duration %lu is too large. Max value %d", self, static_cast(duration), UINT16_MAX); if (error) { *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INVALID_INTEGER_VALUE]; } @@ -1903,7 +1924,7 @@ - (NSString *)openPairingWindowWithPIN:(uint64_t)deviceID } if (discriminator > 0xfff) { - MTR_LOG_ERROR("Error: Discriminator %lu is too large. Max value %d", static_cast(discriminator), 0xfff); + MTR_LOG_ERROR("%@ Error: Discriminator %lu is too large. Max value %d", self, static_cast(discriminator), 0xfff); if (error) { *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INVALID_INTEGER_VALUE]; } @@ -1914,7 +1935,7 @@ - (NSString *)openPairingWindowWithPIN:(uint64_t)deviceID MATTER_LOG_METRIC_SCOPE(kMetricOpenPairingWindow, errorCode); if (!chip::CanCastTo(setupPIN) || !chip::SetupPayload::IsValidSetupPIN(static_cast(setupPIN))) { - MTR_LOG_ERROR("Error: Setup pin %lu is not valid", static_cast(setupPIN)); + MTR_LOG_ERROR("%@ Error: Setup pin %lu is not valid", self, static_cast(setupPIN)); errorCode = CHIP_ERROR_INVALID_INTEGER_VALUE; if (error) { *error = [MTRError errorForCHIPErrorCode:errorCode]; @@ -1936,11 +1957,11 @@ - (NSString *)openPairingWindowWithPIN:(uint64_t)deviceID std::string outCode; if (CHIP_NO_ERROR != (errorCode = generator.payloadDecimalStringRepresentation(outCode))) { - MTR_LOG_ERROR("Failed to get decimal setup code"); + MTR_LOG_ERROR("%@ Failed to get decimal setup code", self); return nil; } - MTR_LOG_ERROR("Setup code is %s", outCode.c_str()); + MTR_LOG_ERROR("%@ Setup code is %s", self, outCode.c_str()); return [NSString stringWithCString:outCode.c_str() encoding:[NSString defaultCStringEncoding]]; }; diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.mm index a328b2a903627f..8d57a5b0a1927d 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.mm @@ -1011,6 +1011,7 @@ - (void)storeClusterData:(NSDictionary BOOL endpointIndexModified = NO; NSMutableArray * endpointIndexToStore; if (endpointIndex) { + MTR_LOG("No entry found for endpointIndex @ node 0x%016llX - creating", nodeID.unsignedLongLongValue); endpointIndexToStore = [endpointIndex mutableCopy]; } else { endpointIndexToStore = [NSMutableArray array]; @@ -1029,6 +1030,7 @@ - (void)storeClusterData:(NSDictionary BOOL clusterIndexModified = NO; NSMutableArray * clusterIndexToStore; if (clusterIndex) { + MTR_LOG("No entry found for clusterIndex @ node 0x%016llX endpoint %u - creating", nodeID.unsignedLongLongValue, endpointID.unsignedShortValue); clusterIndexToStore = [clusterIndex mutableCopy]; } else { clusterIndexToStore = [NSMutableArray array]; @@ -1074,6 +1076,7 @@ - (void)storeClusterData:(NSDictionary NSArray * nodeIndexToStore = nil; if (!nodeIndex) { // Ensure node index exists + MTR_LOG("No entry found for for nodeIndex - creating for node 0x%016llX", nodeID.unsignedLongLongValue); nodeIndexToStore = [NSArray arrayWithObject:nodeID]; } else if (![nodeIndex containsObject:nodeID]) { nodeIndexToStore = [nodeIndex arrayByAddingObject:nodeID]; diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm index 662a228bdd994e..18128249376e21 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm @@ -889,11 +889,10 @@ - (void)resetOperationalAdvertising // If we're not advertising, then there's no need to reset anything. VerifyOrReturn(_advertiseOperational); - // If there are no running controllers there will be no advertisements to reset. - { - std::lock_guard lock(_controllersLock); - VerifyOrReturn(_controllers.count > 0); - } + // Ensure the stack is running. We can't look at _controllers to determine this + // reliably because it gets updated early during controller startup from off-queue. + auto systemState = _controllerFactory->GetSystemState(); + VerifyOrReturn(systemState != nullptr && !systemState->IsShutDown()); // StartServer() is the only API we have for resetting DNS-SD advertising. // It sure would be nice if there were a "restart" that was a no-op if the diff --git a/src/darwin/Framework/CHIP/MTRDeviceStorageBehaviorConfiguration.mm b/src/darwin/Framework/CHIP/MTRDeviceStorageBehaviorConfiguration.mm index 4522c7e69b4ad6..6afa2358c83b06 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceStorageBehaviorConfiguration.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceStorageBehaviorConfiguration.mm @@ -75,7 +75,7 @@ - (void)checkValuesAndResetToDefaultIfNecessary // Sanity check all the values, and if any is out of range, reset to default values if ((_reportToPersistenceDelayTime <= 0) || (_reportToPersistenceDelayTimeMax <= 0) || (_reportToPersistenceDelayTimeMax < _reportToPersistenceDelayTime) || (_recentReportTimesMaxCount < 2) || (_timeBetweenReportsTooShortThreshold <= 0) || (_timeBetweenReportsTooShortMinThreshold <= 0) || (_timeBetweenReportsTooShortMinThreshold > _timeBetweenReportsTooShortThreshold) || (_reportToPersistenceDelayMaxMultiplier <= 1) || (_deviceReportingExcessivelyIntervalThreshold <= 0)) { - MTR_LOG_ERROR("%@ storage behavior: MTRDeviceStorageBehaviorConfiguration values out of bounds - resetting to default", self); + MTR_LOG("%@ storage behavior: MTRDeviceStorageBehaviorConfiguration values out of bounds - resetting to default", self); _reportToPersistenceDelayTime = kReportToPersistenceDelayTimeDefault; _reportToPersistenceDelayTimeMax = kReportToPersistenceDelayTimeMaxDefault; diff --git a/src/darwin/Framework/CHIP/MTRError_Internal.h b/src/darwin/Framework/CHIP/MTRError_Internal.h index c79cc17d95f198..af19f4888ff050 100644 --- a/src/darwin/Framework/CHIP/MTRError_Internal.h +++ b/src/darwin/Framework/CHIP/MTRError_Internal.h @@ -26,6 +26,10 @@ NS_ASSUME_NONNULL_BEGIN +#ifndef YES_NO +#define YES_NO(x) ((x) ? @"YES" : @"NO") +#endif + MTR_DIRECT_MEMBERS @interface MTRError : NSObject + (NSError *)errorWithCode:(MTRErrorCode)code; diff --git a/src/darwin/Framework/CHIP/MTRMetricKeys.h b/src/darwin/Framework/CHIP/MTRMetricKeys.h index d20ec3395656a4..42064b7f049394 100644 --- a/src/darwin/Framework/CHIP/MTRMetricKeys.h +++ b/src/darwin/Framework/CHIP/MTRMetricKeys.h @@ -61,8 +61,11 @@ constexpr Tracing::MetricKey kMetricDeviceBeingCommissioned = "dwnfw_dev_being_c // Tracks the request to generate PASE verifier for a given setup code constexpr Tracing::MetricKey kMetricPASEVerifierForSetupCode = "dwnfw_pase_verifier_for_code"; +// Tracks the request to get attestation challenge for a device +constexpr Tracing::MetricKey kMetricAttestationChallengeForDevice = "dwnfw_attestation_challenge_for_device"; + // Marks the request to open pairing window -constexpr Tracing::MetricKey kMetricOpenPairingWindow = "dwnfw_pase_verifier_for_code"; +constexpr Tracing::MetricKey kMetricOpenPairingWindow = "dwnfw_open_pairing_window"; // Device Vendor ID constexpr Tracing::MetricKey kMetricDeviceVendorID = "dwnfw_device_vendor_id"; diff --git a/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm b/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm index 5e4843312ba4ff..e191b15acc6cf0 100644 --- a/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm @@ -104,7 +104,7 @@ CHIP_ERROR Shutdown() VerifyOrReturnError(mExchangeMgr != nullptr, CHIP_ERROR_INCORRECT_STATE); mExchangeMgr->UnregisterUnsolicitedMessageHandlerForProtocol(Protocols::BDX::Id); - ResetState(); + ResetState(CHIP_ERROR_CANCELLED); mExchangeMgr = nullptr; mSystemLayer = nullptr; @@ -117,11 +117,11 @@ void ControllerShuttingDown(MTRDeviceController * controller) assertChipStackLockedByCurrentThread(); if (mInitialized && mFabricIndex.Value() == controller.fabricIndex) { - ResetState(); + ResetState(CHIP_ERROR_CANCELLED); } } - void ResetState() + void ResetState(CHIP_ERROR error) { assertChipStackLockedByCurrentThread(); if (mNodeId.HasValue() && mFabricIndex.HasValue()) { @@ -129,6 +129,23 @@ void ResetState() "Resetting state for OTA Provider; no longer providing an update for node id 0x" ChipLogFormatX64 ", fabric index %u", ChipLogValueX64(mNodeId.Value()), mFabricIndex.Value()); + + if (mTransferStarted) { + auto controller = [MTRDeviceControllerFactory.sharedInstance runningControllerForFabricIndex:mFabricIndex.Value()]; + if (controller) { + auto nodeId = @(mNodeId.Value()); + auto strongDelegate = mDelegate; + if ([strongDelegate respondsToSelector:@selector(handleBDXTransferSessionEndForNodeID:controller:error:)]) { + dispatch_async(mDelegateNotificationQueue, ^{ + [strongDelegate handleBDXTransferSessionEndForNodeID:nodeId + controller:controller + error:[MTRError errorForCHIPErrorCode:error]]; + }); + } + } else { + ChipLogError(Controller, "Not notifying delegate of BDX Transfer Session End, controller is not running"); + } + } } else { ChipLogProgress(Controller, "Resetting state for OTA Provider"); } @@ -153,6 +170,7 @@ void ResetState() mDelegateNotificationQueue = nil; mInitialized = false; + mTransferStarted = false; } private: @@ -162,7 +180,7 @@ void ResetState() static void HandleBdxInitReceivedTimeoutExpired(chip::System::Layer * systemLayer, void * state) { VerifyOrReturn(state != nullptr); - static_cast(state)->ResetState(); + static_cast(state)->ResetState(CHIP_ERROR_TIMEOUT); } CHIP_ERROR OnMessageToSend(TransferSession::OutputEvent & event) @@ -188,12 +206,12 @@ CHIP_ERROR OnMessageToSend(TransferSession::OutputEvent & event) if (err != CHIP_NO_ERROR) { mExchangeCtx->Close(); mExchangeCtx = nullptr; - ResetState(); - } else if (event.msgTypeData.HasMessageType(Protocols::SecureChannel::MsgType::StatusReport)) { + ResetState(err); + } else if (msgTypeData.HasMessageType(Protocols::SecureChannel::MsgType::StatusReport)) { // If the send was successful for a status report, since we are not expecting a response the exchange context is // already closed. We need to null out the reference to avoid having a dangling pointer. mExchangeCtx = nullptr; - ResetState(); + ResetState(CHIP_ERROR_INTERNAL); } return err; } @@ -258,8 +276,8 @@ CHIP_ERROR OnTransferSessionBegin(TransferSession::OutputEvent & event) }]; }; + mTransferStarted = true; auto nodeId = @(mNodeId.Value()); - auto strongDelegate = mDelegate; dispatch_async(mDelegateNotificationQueue, ^{ if ([strongDelegate respondsToSelector:@selector(handleBDXTransferSessionBeginForNodeID:controller:fileDesignator:offset:completion:)]) { @@ -294,20 +312,7 @@ CHIP_ERROR OnTransferSessionEnd(TransferSession::OutputEvent & event) error = CHIP_ERROR_INTERNAL; } - auto * controller = [[MTRDeviceControllerFactory sharedInstance] runningControllerForFabricIndex:mFabricIndex.Value()]; - VerifyOrReturnError(controller != nil, CHIP_ERROR_INCORRECT_STATE); - auto nodeId = @(mNodeId.Value()); - - auto strongDelegate = mDelegate; - if ([strongDelegate respondsToSelector:@selector(handleBDXTransferSessionEndForNodeID:controller:error:)]) { - dispatch_async(mDelegateNotificationQueue, ^{ - [strongDelegate handleBDXTransferSessionEndForNodeID:nodeId - controller:controller - error:[MTRError errorForCHIPErrorCode:error]]; - }); - } - - ResetState(); + ResetState(error); // will notify the delegate return CHIP_NO_ERROR; } @@ -438,7 +443,7 @@ CHIP_ERROR ConfigureState(chip::FabricIndex fabricIndex, chip::NodeId nodeId) VerifyOrReturnError(mFabricIndex.Value() == fabricIndex && mNodeId.Value() == nodeId, CHIP_ERROR_BUSY); // Reset stale connection from the same Node if exists. - ResetState(); + ResetState(CHIP_ERROR_CANCELLED); } auto * controller = [[MTRDeviceControllerFactory sharedInstance] runningControllerForFabricIndex:fabricIndex]; @@ -466,6 +471,7 @@ CHIP_ERROR ConfigureState(chip::FabricIndex fabricIndex, chip::NodeId nodeId) } bool mInitialized = false; + bool mTransferStarted = false; Optional mFabricIndex; Optional mNodeId; id mDelegate = nil; @@ -489,7 +495,7 @@ CHIP_ERROR ConfigureState(chip::FabricIndex fabricIndex, chip::NodeId nodeId) MTROTAProviderDelegateBridge::~MTROTAProviderDelegateBridge() { - gOtaSender->ResetState(); + gOtaSender->ResetState(CHIP_ERROR_CANCELLED); Clusters::OTAProvider::SetDelegate(kOtaProviderEndpoint, nullptr); } @@ -685,7 +691,7 @@ bool GetPeerNodeInfo(CommandHandler * commandHandler, const ConcreteCommandPath handle.Release(); // We need to reset state here to clean up any initialization we might have done including starting the BDX // timeout timer while preparing for transfer if any failure occurs afterwards. - gOtaSender->ResetState(); + gOtaSender->ResetState(err); return; } @@ -696,7 +702,7 @@ bool GetPeerNodeInfo(CommandHandler * commandHandler, const ConcreteCommandPath LogErrorOnFailure(err); handler->AddStatus(cachedCommandPath, StatusIB(err).mStatus); handle.Release(); - gOtaSender->ResetState(); + gOtaSender->ResetState(err); return; } delegateResponse.imageURI.SetValue(uri); diff --git a/src/darwin/Framework/CHIP/MTRUtilities.mm b/src/darwin/Framework/CHIP/MTRUtilities.mm index de85b498626495..e9698ab24d0b41 100644 --- a/src/darwin/Framework/CHIP/MTRUtilities.mm +++ b/src/darwin/Framework/CHIP/MTRUtilities.mm @@ -19,5 +19,16 @@ BOOL MTREqualObjects(id _Nullable a, id _Nullable b) { - return (a == nil) ? (b == nil) : [a isEqual:b]; + // Check if A is nil, and return based on B being nil (or not) + if (a == nil) { + return b == nil; + } + + // If B is nil at this point, we're not equal + if (b == nil) { + return NO; + } + + // Otherwise work on equality, given that we're both non nil + return [a isEqual:b]; } diff --git a/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt b/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt index 35d09c0f916431..1f5c8dd3404f6a 100644 --- a/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt @@ -107,53 +107,16 @@ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptio {{/unless}} {{/zcl_clusters}} -{{#zcl_clusters}} {{#zcl_enums}} -{{#*inline "enumDef"}} -typedef NS_ENUM({{asUnderlyingZclType name}}, {{objCEnumName clusterName enumName}}) { - {{#zcl_enum_items}} - {{#if (isSupported ../clusterName enum=../enumName enumValue=(asUpperCamelCase label preserveAcronyms=true))}} - {{objCEnumName ../clusterName ../enumName}}{{asUpperCamelCase label preserveAcronyms=true}} {{availability ../clusterName enum=../enumName enumValue=(asUpperCamelCase label preserveAcronyms=true) deprecationMessage=(concat "Please use " (objCEnumName (asUpperCamelCase ../../name preserveAcronyms=true) ../label) (asUpperCamelCase label preserveAcronyms=true))}} = {{asHex value 2}}, - {{/if}} - {{#*inline "oldNameItemDecl"}} - {{#if oldItemName}} - {{#if (isSupported ../clusterName enum=../enumName enumValue=oldItemName)}} - {{objCEnumName ../clusterName ../enumName}}{{objCEnumItemLabel oldItemName}} {{availability ../clusterName enum=../enumName enumValue=oldItemName deprecationMessage=(concat "Please use " (objCEnumName (asUpperCamelCase ../../name preserveAcronyms=true) ../label) (asUpperCamelCase label preserveAcronyms=true))}} = {{asHex value 2}}, - {{/if}} - {{/if}} - {{/inline}} - {{> oldNameItemDecl oldItemName=(oldName ../clusterName enum=../enumName enumValue=(asUpperCamelCase label preserveAcronyms=true))}} - {{/zcl_enum_items}} - {{!We had extra "Not Supported" values for DoorLockUserStatus/DoorLockUserType that we have to wedge in here manually for now.}} - {{#if (and (isStrEqual clusterName "DoorLock") - (or (isStrEqual enumName "UserTypeEnum") (isStrEqual enumName "UserStatusEnum")) - (isSupported clusterName enum=enumName enumValue="NotSupported"))}} - {{objCEnumName clusterName enumName}}{{objCEnumItemLabel "NotSupported"}} {{availability clusterName enum=enumName enumValue="NotSupported" deprecationMessage="This value is not part of the specification and will be removed"}} = 0xFF, - {{/if}} -} -{{/inline}} -{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) enum=(asUpperCamelCase label preserveAcronyms=true))}} -{{> enumDef name=name clusterName=(asUpperCamelCase ../name preserveAcronyms=true) enumName=(asUpperCamelCase label preserveAcronyms=true)}} {{availability (asUpperCamelCase ../name preserveAcronyms=true) enum=(asUpperCamelCase label preserveAcronyms=true) deprecationMessage="This enum is unused and will be removed"}}; -{{/if}} -{{! Takes the name of the enum to use as enumName. }} -{{#*inline "oldNameDecl"}} -{{#if (isSupported (compatClusterNameRemapping ../name) enum=enumName)}} +{{#if has_no_clusters}} +{{> enum_decl cluster="Globals" name=name enumLabel=label}} -{{> enumDef name=name clusterName=(compatClusterNameRemapping ../name) enumName=enumName}} {{availability (compatClusterNameRemapping ../name) enum=enumName deprecationMessage=(concat "Please use " (objCEnumName (asUpperCamelCase ../name preserveAcronyms=true) label))}}; {{/if}} -{{/inline}} -{{! Takes the old name of the enum, if any, as oldEnumName. }} -{{#*inline "oldNameCheck"}} -{{#if (or oldEnumName - (hasOldName (asUpperCamelCase ../name preserveAcronyms=true)))}} -{{#if oldEnumName}} -{{> oldNameDecl enumName=oldEnumName}} -{{else}} -{{> oldNameDecl enumName=(asUpperCamelCase label preserveAcronyms=true)}} -{{/if}} -{{/if}} -{{/inline}} -{{> oldNameCheck oldEnumName=(oldName (asUpperCamelCase ../name preserveAcronyms=true) enum=(asUpperCamelCase label preserveAcronyms=true))}} +{{/zcl_enums}} + +{{#zcl_clusters}} +{{#zcl_enums}} +{{> enum_decl cluster=../name name=name enumLabel=label}} {{/zcl_enums}} {{#zcl_bitmaps}} diff --git a/src/darwin/Framework/CHIP/templates/MTRStructsObjc-src.zapt b/src/darwin/Framework/CHIP/templates/MTRStructsObjc-src.zapt index 8c9372f87bc9ff..fee9de42e3c4af 100644 --- a/src/darwin/Framework/CHIP/templates/MTRStructsObjc-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRStructsObjc-src.zapt @@ -4,62 +4,15 @@ NS_ASSUME_NONNULL_BEGIN -{{#zcl_clusters}} {{#zcl_structs}} -{{#*inline "interfaceImpl"}} -@implementation {{interfaceName}} -- (instancetype)init -{ - if (self = [super init]) { - {{#zcl_struct_items}} - {{#if (isSupported (asUpperCamelCase parent.parent.name preserveAcronyms=true) struct=(asUpperCamelCase parent.name preserveAcronyms=true) structField=(asStructPropertyName label))}} - {{>init_struct_member label=label type=type cluster=parent.parent.name}} - {{/if}} - {{/zcl_struct_items}} - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone -{ - auto other = [[{{interfaceName}} alloc] init]; - - {{#zcl_struct_items}} - {{#if (isSupported (asUpperCamelCase parent.parent.name preserveAcronyms=true) struct=(asUpperCamelCase parent.name preserveAcronyms=true) structField=(asStructPropertyName label))}} - other.{{asStructPropertyName label}} = self.{{asStructPropertyName label}}; - {{/if}} - {{/zcl_struct_items}} - - return other; -} - -- (NSString *)description -{ - NSString *descriptionString = [NSString stringWithFormat:@"<%@: {{#zcl_struct_items~}} - {{~#if (isSupported (asUpperCamelCase parent.parent.name preserveAcronyms=true) struct=(asUpperCamelCase parent.name preserveAcronyms=true) structField=(asStructPropertyName label))~}} - {{~asStructPropertyName label}}:%@; {{!Just here to keep the preceding space}} - {{~/if~}} - {{~/zcl_struct_items}}>", NSStringFromClass([self class]){{#zcl_struct_items~}} - {{~#if (isSupported (asUpperCamelCase parent.parent.name preserveAcronyms=true) struct=(asUpperCamelCase parent.name preserveAcronyms=true) structField=(asStructPropertyName label))~}} - ,{{#if isArray}}_{{asStructPropertyName label}}{{else if (isOctetString type)}}[_{{asStructPropertyName label}} base64EncodedStringWithOptions:0]{{else}}_{{asStructPropertyName label}}{{/if}} - {{~/if~}} - {{~/zcl_struct_items}}]; - return descriptionString; -} -{{#zcl_struct_items}} -{{#if (and (hasOldName (asUpperCamelCase ../../name preserveAcronyms=true) struct=(asUpperCamelCase ../name preserveAcronyms=true) structField=(asStructPropertyName label)) - (isSupported (asUpperCamelCase ../../name preserveAcronyms=true) struct=(asUpperCamelCase ../name preserveAcronyms=true) structField=(oldName (asUpperCamelCase ../../name preserveAcronyms=true) struct=(asUpperCamelCase ../name preserveAcronyms=true) structField=(asStructPropertyName label))))}} - -{{> renamed_struct_field_impl cluster=../../name type=type newName=label oldName=(oldName (asUpperCamelCase ../../name preserveAcronyms=true) struct=(asUpperCamelCase ../name preserveAcronyms=true) structField=(asStructPropertyName label))}} +{{#if has_no_clusters}} +{{> struct_interface_impl cluster="Globals" struct=name}} {{/if}} -{{/zcl_struct_items}} - -@end -{{/inline}} +{{/zcl_structs}} -{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) struct=(asUpperCamelCase name preserveAcronyms=true))}} -{{> interfaceImpl interfaceName=(concat "MTR" (asUpperCamelCase parent.name preserveAcronyms=true) "Cluster" (asUpperCamelCase name preserveAcronyms=true))}} -{{/if}} +{{#zcl_clusters}} +{{#zcl_structs}} +{{> struct_interface_impl cluster=parent.name struct=name}} {{! Takes the name of the struct to use as structName. }} {{#*inline "oldNameImpl"}} diff --git a/src/darwin/Framework/CHIP/templates/MTRStructsObjc.zapt b/src/darwin/Framework/CHIP/templates/MTRStructsObjc.zapt index 5e8c2528007182..5daa532a11a87b 100644 --- a/src/darwin/Framework/CHIP/templates/MTRStructsObjc.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRStructsObjc.zapt @@ -4,36 +4,22 @@ NS_ASSUME_NONNULL_BEGIN -{{#zcl_clusters}} {{#zcl_structs}} -{{#*inline "interfaceDecl"}} -{{#zcl_struct_items}} -{{#if (isSupported ../cluster struct=../struct structField=(asStructPropertyName label))}} -{{> struct_field_decl cluster=../cluster type=type label=label}} {{availability (asUpperCamelCase ../cluster preserveAcronyms=true) struct=../struct structField=(asStructPropertyName label) deprecationMessage=(concat "Please use MTR" (asUpperCamelCase ../../name preserveAcronyms=true) "Cluster" (asUpperCamelCase ../name preserveAcronyms=true))}}; -{{/if}} -{{#if (hasOldName ../cluster struct=../struct structField=(asStructPropertyName label))}} -{{#if (isSupported ../cluster struct=../struct structField=(oldName ../cluster struct=../struct structField=(asStructPropertyName label)))}} -{{> struct_field_decl cluster=../cluster type=type label=(oldName ../cluster struct=../struct structField=(asStructPropertyName label))}} {{availability ../cluster struct=../struct structField=(oldName ../cluster struct=../struct structField=(asStructPropertyName label)) deprecationMessage=(concat "Please use " (asStructPropertyName label))}}; -{{/if}} +{{#if has_no_clusters}} +{{> struct_interface_decl cluster="Globals" originalCluster="Globals" struct=(asUpperCamelCase name preserveAcronyms=true) baseName="" deprecationMessage="This struct is unused and will be removed"}} {{/if}} -{{/zcl_struct_items}} -{{/inline}} -{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) struct=(asUpperCamelCase name preserveAcronyms=true))}} -{{availability (asUpperCamelCase parent.name preserveAcronyms=true) struct=(asUpperCamelCase name preserveAcronyms=true) deprecationMessage="This struct is unused and will be removed"}} -@interface MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}} : NSObject -{{> interfaceDecl cluster=(asUpperCamelCase parent.name preserveAcronyms=true) struct=(asUpperCamelCase name preserveAcronyms=true)}} -@end +{{/zcl_structs}} -{{/if}} +{{#zcl_clusters}} +{{#zcl_structs}} +{{> struct_interface_decl cluster=(asUpperCamelCase parent.name preserveAcronyms=true) originalCluster=parent.name struct=(asUpperCamelCase name preserveAcronyms=true) baseName="" deprecationMessage="This struct is unused and will be removed"}} {{! Takes the name of the struct to use as structName. }} {{#*inline "oldNameDecl"}} -{{#if (isSupported (compatClusterNameRemapping parent.name) struct=structName)}} -{{availability (compatClusterNameRemapping parent.name) struct=structName deprecationMessage=(concat "Please use MTR" (asUpperCamelCase parent.name preserveAcronyms=true) "Cluster" (asUpperCamelCase name preserveAcronyms=true))}} -@interface MTR{{compatClusterNameRemapping parent.name}}Cluster{{structName}} : MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}} -{{> interfaceDecl cluster=(compatClusterNameRemapping parent.name) struct=structName}} -@end - -{{/if}} +{{> struct_interface_decl cluster=(compatClusterNameRemapping parent.name) + originalCluster=parent.name + struct=structName + baseName=(concat "MTR" (asUpperCamelCase parent.name preserveAcronyms=true) "Cluster" (asUpperCamelCase name preserveAcronyms=true)) + deprecationMessage=(concat "Please use MTR" (asUpperCamelCase parent.name preserveAcronyms=true) "Cluster" (asUpperCamelCase name preserveAcronyms=true))}} {{/inline}} {{! Takes the old name of the struct, if any, as oldStructName. }} {{#*inline "oldNameCheck"}} diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index 4ca8533a55d561..98d9588260a460 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -9583,7 +9583,6 @@ - PresetsSchedulesEditable - TemperatureSetpointHoldPolicy - SetpointHoldExpiryTimestamp - - QueuedPreset - ActiveScheduleHandle UnitTesting: # Ideally none of UnitTesting would be exposed as public API, but @@ -9601,7 +9600,6 @@ - StartPresetsSchedulesEditRequest - CancelPresetsSchedulesEditRequest - CommitPresetsSchedulesRequest - - CancelSetActivePresetRequest - SetTemperatureSetpointHoldPolicy RVCOperationalState: # Targeting Spring 2024 Matter release @@ -9623,7 +9621,6 @@ - PresetStruct - PresetTypeStruct - ScheduleTypeStruct - - QueuedPresetStruct events: UnitTesting: # Ideally none of UnitTesting would be exposed as public API, but @@ -9670,7 +9667,6 @@ Thermostat: Feature: # Targeting Spring 2024 Matter release - - QueuedPresetsSupported - Setpoints - Presets - MatterScheduleConfiguration @@ -9689,13 +9685,53 @@ versions: "future" provisional: clusters: - # Targeting Fall 2024 + # Targeting 1.4 + - CommissionerControl + - EcosystemInformation - ServiceArea - ThreadBorderRouterManagement - ThreadNetworkDirectory + - WaterHeaterManagement + - WaterHeaterMode - WiFiNetworkManagement + attributes: + OccupancySensing: + # Targeting 1.4 + - HoldTime + - HoldTimeLimits + commands: + BridgedDeviceBasicInformation: + # Targeting 1.4 + - KeepActive + UnitTesting: + # Ideally none of UnitTesting would be exposed as public API, but + # for now just start doing that for new additions to it. + - StringEchoRequest + - StringEchoResponse + structs: + Globals: + # Test-only value + - TestGlobalStruct + OccupancySensing: + # Targeting 1.4 + - HoldTimeLimitsStruct + events: + BridgedDeviceBasicInformation: + # Targeting 1.4 + - ActiveChanged + enums: + Globals: + # Test-only value + - TestGlobalEnum + bitmaps: + BridgedDeviceBasicInformation: + # Targeting 1.4 + - Feature + OccupancySensing: + # Targeting 1.4 + - Feature bitmap values: Switch: Feature: - # Targeting Fall 2024 + # Targeting 1.4 - ActionSwitch diff --git a/src/darwin/Framework/CHIP/templates/partials/enum_decl.zapt b/src/darwin/Framework/CHIP/templates/partials/enum_decl.zapt new file mode 100644 index 00000000000000..8ea1431bf20350 --- /dev/null +++ b/src/darwin/Framework/CHIP/templates/partials/enum_decl.zapt @@ -0,0 +1,46 @@ +{{! Arguments: cluster (might be "Globals", is not case-canonicalized), name, enumLabel }} +{{#*inline "enumDef"}} +typedef NS_ENUM({{asUnderlyingZclType name}}, {{objCEnumName clusterName enumName}}) { + {{#zcl_enum_items}} + {{#if (isSupported ../clusterName enum=../enumName enumValue=(asUpperCamelCase label preserveAcronyms=true))}} + {{objCEnumName ../clusterName ../enumName}}{{asUpperCamelCase label preserveAcronyms=true}} {{availability ../clusterName enum=../enumName enumValue=(asUpperCamelCase label preserveAcronyms=true) deprecationMessage=(concat "Please use " (objCEnumName (asUpperCamelCase ../cluster preserveAcronyms=true) ../enumLabel) (asUpperCamelCase label preserveAcronyms=true))}} = {{asHex value 2}}, + {{/if}} + {{#*inline "oldNameItemDecl"}} + {{#if oldItemName}} + {{#if (isSupported ../clusterName enum=../enumName enumValue=oldItemName)}} + {{objCEnumName ../clusterName ../enumName}}{{objCEnumItemLabel oldItemName}} {{availability ../clusterName enum=../enumName enumValue=oldItemName deprecationMessage=(concat "Please use " (objCEnumName (asUpperCamelCase ../cluster preserveAcronyms=true) ../enumLabel) (asUpperCamelCase label preserveAcronyms=true))}} = {{asHex value 2}}, + {{/if}} + {{/if}} + {{/inline}} + {{> oldNameItemDecl oldItemName=(oldName ../clusterName enum=../enumName enumValue=(asUpperCamelCase label preserveAcronyms=true))}} + {{/zcl_enum_items}} + {{!We had extra "Not Supported" values for DoorLockUserStatus/DoorLockUserType that we have to wedge in here manually for now.}} + {{#if (and (isStrEqual clusterName "DoorLock") + (or (isStrEqual enumName "UserTypeEnum") (isStrEqual enumName "UserStatusEnum")) + (isSupported clusterName enum=enumName enumValue="NotSupported"))}} + {{objCEnumName clusterName enumName}}{{objCEnumItemLabel "NotSupported"}} {{availability clusterName enum=enumName enumValue="NotSupported" deprecationMessage="This value is not part of the specification and will be removed"}} = 0xFF, + {{/if}} +} +{{/inline}} +{{#if (isSupported (asUpperCamelCase cluster preserveAcronyms=true) enum=(asUpperCamelCase enumLabel preserveAcronyms=true))}} +{{> enumDef name=name clusterName=(asUpperCamelCase cluster preserveAcronyms=true) enumName=(asUpperCamelCase enumLabel preserveAcronyms=true)}} {{availability (asUpperCamelCase cluster preserveAcronyms=true) enum=(asUpperCamelCase enumLabel preserveAcronyms=true) deprecationMessage="This enum is unused and will be removed"}}; +{{/if}} +{{! Takes the name of the enum to use as enumName. }} +{{#*inline "oldNameDecl"}} +{{#if (isSupported (compatClusterNameRemapping cluster) enum=enumName)}} + +{{> enumDef name=name clusterName=(compatClusterNameRemapping cluster) enumName=enumName}} {{availability (compatClusterNameRemapping cluster) enum=enumName deprecationMessage=(concat "Please use " (objCEnumName (asUpperCamelCase cluster preserveAcronyms=true) enumLabel))}}; +{{/if}} +{{/inline}} +{{! Takes the old name of the enum, if any, as oldEnumName. }} +{{#*inline "oldNameCheck"}} +{{#if (or oldEnumName + (hasOldName (asUpperCamelCase cluster preserveAcronyms=true)))}} +{{#if oldEnumName}} +{{> oldNameDecl enumName=oldEnumName}} +{{else}} +{{> oldNameDecl enumName=(asUpperCamelCase enumLabel preserveAcronyms=true)}} +{{/if}} +{{/if}} +{{/inline}} +{{> oldNameCheck oldEnumName=(oldName (asUpperCamelCase cluster preserveAcronyms=true) enum=(asUpperCamelCase enumLabel preserveAcronyms=true))}} diff --git a/src/darwin/Framework/CHIP/templates/partials/struct_interface_decl.zapt b/src/darwin/Framework/CHIP/templates/partials/struct_interface_decl.zapt new file mode 100644 index 00000000000000..69ec6d38a11286 --- /dev/null +++ b/src/darwin/Framework/CHIP/templates/partials/struct_interface_decl.zapt @@ -0,0 +1,25 @@ +{{! Arguments: cluster (might be "Globals", is case-canonicalized already), originalCluster (the name before remapping and whatnot), struct, baseName (might be "" to indicate NSObject), deprecationMessage }} +{{#if (isSupported cluster struct=struct)}} +{{availability cluster struct=struct deprecationMessage=deprecationMessage}} +@interface {{#if (isStrEqual cluster "Globals") ~}} + MTRDataType{{struct}} +{{~else~}} + MTR{{cluster}}Cluster{{struct}} +{{~/if}} : {{#if (isStrEqual baseName "")~}} + NSObject +{{~else~}} + {{baseName}} +{{~/if}} +{{#zcl_struct_items}} +{{#if (isSupported ../cluster struct=../struct structField=(asStructPropertyName label))}} +{{> struct_field_decl cluster=../cluster type=type label=label}} {{availability ../cluster struct=../struct structField=(asStructPropertyName label) deprecationMessage=(concat "Please use MTR" (asUpperCamelCase ../originalCluster preserveAcronyms=true) "Cluster" (asUpperCamelCase ../name preserveAcronyms=true))}}; +{{/if}} +{{#if (hasOldName ../cluster struct=../struct structField=(asStructPropertyName label))}} +{{#if (isSupported ../cluster struct=../struct structField=(oldName ../cluster struct=../struct structField=(asStructPropertyName label)))}} +{{> struct_field_decl cluster=../cluster type=type label=(oldName ../cluster struct=../struct structField=(asStructPropertyName label))}} {{availability ../cluster struct=../struct structField=(oldName ../cluster struct=../struct structField=(asStructPropertyName label)) deprecationMessage=(concat "Please use " (asStructPropertyName label))}}; +{{/if}} +{{/if}} +{{/zcl_struct_items}} +@end + +{{/if}} diff --git a/src/darwin/Framework/CHIP/templates/partials/struct_interface_impl.zapt b/src/darwin/Framework/CHIP/templates/partials/struct_interface_impl.zapt new file mode 100644 index 00000000000000..15a2db222f73c2 --- /dev/null +++ b/src/darwin/Framework/CHIP/templates/partials/struct_interface_impl.zapt @@ -0,0 +1,57 @@ +{{! Arguments: cluster (might be "Globals", not case-canonicalized), struct }} +{{! Avoid uppercasing stuff all the time by wrapping the whole thing in an inline that takes cluster, + originalCluster, and struct, where cluster and struct are uppercased }} +{{#*inline "interfaceImpl"}} +{{#if (isSupported cluster struct=struct)}} +@implementation {{asObjectiveCClass struct cluster}} +- (instancetype)init +{ + if (self = [super init]) { + {{#zcl_struct_items}} + {{#if (isSupported ../cluster struct=../struct structField=(asStructPropertyName label))}} + {{>init_struct_member label=label type=type cluster=../originalCluster}} + {{/if}} + {{/zcl_struct_items}} + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[{{asObjectiveCClass struct cluster}} alloc] init]; + + {{#zcl_struct_items}} + {{#if (isSupported ../cluster struct=../struct structField=(asStructPropertyName label))}} + other.{{asStructPropertyName label}} = self.{{asStructPropertyName label}}; + {{/if}} + {{/zcl_struct_items}} + + return other; +} + +- (NSString *)description +{ + NSString *descriptionString = [NSString stringWithFormat:@"<%@: {{#zcl_struct_items~}} + {{~#if (isSupported ../cluster struct=../struct structField=(asStructPropertyName label))~}} + {{~asStructPropertyName label}}:%@; {{!Just here to keep the preceding space}} + {{~/if~}} + {{~/zcl_struct_items}}>", NSStringFromClass([self class]){{#zcl_struct_items~}} + {{~#if (isSupported ../cluster struct=../struct structField=(asStructPropertyName label))~}} + ,{{#if isArray}}_{{asStructPropertyName label}}{{else if (isOctetString type)}}[_{{asStructPropertyName label}} base64EncodedStringWithOptions:0]{{else}}_{{asStructPropertyName label}}{{/if}} + {{~/if~}} + {{~/zcl_struct_items}}]; + return descriptionString; +} +{{#zcl_struct_items}} +{{#if (and (hasOldName ../cluster struct=../struct structField=(asStructPropertyName label)) + (isSupported ../cluster struct=../struct structField=(oldName ../cluster struct=../struct structField=(asStructPropertyName label))))}} + +{{> renamed_struct_field_impl cluster=../originalCluster type=type newName=label oldName=(oldName ../cluster struct=../struct structField=(asStructPropertyName label))}} +{{/if}} +{{/zcl_struct_items}} + +@end + +{{/if}} +{{/inline}} +{{> interfaceImpl cluster=(asUpperCamelCase cluster preserveAcronyms=true) originalCluster=cluster struct=(asUpperCamelCase struct preserveAcronyms=true)}} diff --git a/src/darwin/Framework/CHIP/templates/templates.json b/src/darwin/Framework/CHIP/templates/templates.json index 83df8bdab40e63..df731d72ee2c4c 100644 --- a/src/darwin/Framework/CHIP/templates/templates.json +++ b/src/darwin/Framework/CHIP/templates/templates.json @@ -44,6 +44,18 @@ "name": "struct_field_decl", "path": "partials/struct_field_decl.zapt" }, + { + "name": "struct_interface_decl", + "path": "partials/struct_interface_decl.zapt" + }, + { + "name": "struct_interface_impl", + "path": "partials/struct_interface_impl.zapt" + }, + { + "name": "enum_decl", + "path": "partials/enum_decl.zapt" + }, { "name": "renamed_struct_field_impl", "path": "partials/renamed_struct_field_impl.zapt" diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 7785a04b904fa8..79dd1b729dc53f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -402,6 +402,12 @@ static BOOL AttributeIsSpecifiedInAccessControlCluster(AttributeId aAttributeId) case Attributes::AccessControlEntriesPerFabric::Id: { return YES; } + case Attributes::CommissioningARL::Id: { + return YES; + } + case Attributes::Arl::Id: { + return YES; + } case Attributes::GeneratedCommandList::Id: { return YES; } @@ -1851,6 +1857,9 @@ static BOOL AttributeIsSpecifiedInICDManagementCluster(AttributeId aAttributeId) case Attributes::OperatingMode::Id: { return YES; } + case Attributes::MaximumCheckInBackOff::Id: { + return YES; + } case Attributes::GeneratedCommandList::Id: { return YES; } @@ -3053,6 +3062,51 @@ static BOOL AttributeIsSpecifiedInElectricalEnergyMeasurementCluster(AttributeId } } } +static BOOL AttributeIsSpecifiedInWaterHeaterManagementCluster(AttributeId aAttributeId) +{ + using namespace Clusters::WaterHeaterManagement; + switch (aAttributeId) { + case Attributes::HeaterTypes::Id: { + return YES; + } + case Attributes::HeatDemand::Id: { + return YES; + } + case Attributes::TankVolume::Id: { + return YES; + } + case Attributes::EstimatedHeatRequired::Id: { + return YES; + } + case Attributes::TankPercentage::Id: { + return YES; + } + case Attributes::BoostState::Id: { + return YES; + } + case Attributes::GeneratedCommandList::Id: { + return YES; + } + case Attributes::AcceptedCommandList::Id: { + return YES; + } + case Attributes::EventList::Id: { + return YES; + } + case Attributes::AttributeList::Id: { + return YES; + } + case Attributes::FeatureMap::Id: { + return YES; + } + case Attributes::ClusterRevision::Id: { + return YES; + } + default: { + return NO; + } + } +} static BOOL AttributeIsSpecifiedInDemandResponseLoadControlCluster(AttributeId aAttributeId) { using namespace Clusters::DemandResponseLoadControl; @@ -3398,6 +3452,45 @@ static BOOL AttributeIsSpecifiedInEnergyEVSEModeCluster(AttributeId aAttributeId } } } +static BOOL AttributeIsSpecifiedInWaterHeaterModeCluster(AttributeId aAttributeId) +{ + using namespace Clusters::WaterHeaterMode; + switch (aAttributeId) { + case Attributes::SupportedModes::Id: { + return YES; + } + case Attributes::CurrentMode::Id: { + return YES; + } + case Attributes::StartUpMode::Id: { + return YES; + } + case Attributes::OnMode::Id: { + return YES; + } + case Attributes::GeneratedCommandList::Id: { + return YES; + } + case Attributes::AcceptedCommandList::Id: { + return YES; + } + case Attributes::EventList::Id: { + return YES; + } + case Attributes::AttributeList::Id: { + return YES; + } + case Attributes::FeatureMap::Id: { + return YES; + } + case Attributes::ClusterRevision::Id: { + return YES; + } + default: { + return NO; + } + } +} static BOOL AttributeIsSpecifiedInDeviceEnergyManagementModeCluster(AttributeId aAttributeId) { using namespace Clusters::DeviceEnergyManagementMode; @@ -4074,15 +4167,9 @@ static BOOL AttributeIsSpecifiedInThermostatCluster(AttributeId aAttributeId) case Attributes::PresetsSchedulesEditable::Id: { return YES; } - case Attributes::TemperatureSetpointHoldPolicy::Id: { - return YES; - } case Attributes::SetpointHoldExpiryTimestamp::Id: { return YES; } - case Attributes::QueuedPreset::Id: { - return YES; - } case Attributes::GeneratedCommandList::Id: { return YES; } @@ -5346,6 +5433,9 @@ static BOOL AttributeIsSpecifiedInWiFiNetworkManagementCluster(AttributeId aAttr case Attributes::Ssid::Id: { return YES; } + case Attributes::PassphraseSurrogate::Id: { + return YES; + } case Attributes::GeneratedCommandList::Id: { return YES; } @@ -5951,6 +6041,72 @@ static BOOL AttributeIsSpecifiedInContentAppObserverCluster(AttributeId aAttribu } } } +static BOOL AttributeIsSpecifiedInEcosystemInformationCluster(AttributeId aAttributeId) +{ + using namespace Clusters::EcosystemInformation; + switch (aAttributeId) { + case Attributes::RemovedOn::Id: { + return YES; + } + case Attributes::DeviceDirectory::Id: { + return YES; + } + case Attributes::LocationDirectory::Id: { + return YES; + } + case Attributes::GeneratedCommandList::Id: { + return YES; + } + case Attributes::AcceptedCommandList::Id: { + return YES; + } + case Attributes::EventList::Id: { + return YES; + } + case Attributes::AttributeList::Id: { + return YES; + } + case Attributes::FeatureMap::Id: { + return YES; + } + case Attributes::ClusterRevision::Id: { + return YES; + } + default: { + return NO; + } + } +} +static BOOL AttributeIsSpecifiedInCommissionerControlCluster(AttributeId aAttributeId) +{ + using namespace Clusters::CommissionerControl; + switch (aAttributeId) { + case Attributes::SupportedDeviceCategories::Id: { + return YES; + } + case Attributes::GeneratedCommandList::Id: { + return YES; + } + case Attributes::AcceptedCommandList::Id: { + return YES; + } + case Attributes::EventList::Id: { + return YES; + } + case Attributes::AttributeList::Id: { + return YES; + } + case Attributes::FeatureMap::Id: { + return YES; + } + case Attributes::ClusterRevision::Id: { + return YES; + } + default: { + return NO; + } + } +} static BOOL AttributeIsSpecifiedInElectricalMeasurementCluster(AttributeId aAttributeId) { using namespace Clusters::ElectricalMeasurement; @@ -6864,6 +7020,9 @@ BOOL MTRAttributeIsSpecified(ClusterId aClusterId, AttributeId aAttributeId) case Clusters::ElectricalEnergyMeasurement::Id: { return AttributeIsSpecifiedInElectricalEnergyMeasurementCluster(aAttributeId); } + case Clusters::WaterHeaterManagement::Id: { + return AttributeIsSpecifiedInWaterHeaterManagementCluster(aAttributeId); + } case Clusters::DemandResponseLoadControl::Id: { return AttributeIsSpecifiedInDemandResponseLoadControlCluster(aAttributeId); } @@ -6885,6 +7044,9 @@ BOOL MTRAttributeIsSpecified(ClusterId aClusterId, AttributeId aAttributeId) case Clusters::EnergyEvseMode::Id: { return AttributeIsSpecifiedInEnergyEVSEModeCluster(aAttributeId); } + case Clusters::WaterHeaterMode::Id: { + return AttributeIsSpecifiedInWaterHeaterModeCluster(aAttributeId); + } case Clusters::DeviceEnergyManagementMode::Id: { return AttributeIsSpecifiedInDeviceEnergyManagementModeCluster(aAttributeId); } @@ -7017,6 +7179,12 @@ BOOL MTRAttributeIsSpecified(ClusterId aClusterId, AttributeId aAttributeId) case Clusters::ContentAppObserver::Id: { return AttributeIsSpecifiedInContentAppObserverCluster(aAttributeId); } + case Clusters::EcosystemInformation::Id: { + return AttributeIsSpecifiedInEcosystemInformationCluster(aAttributeId); + } + case Clusters::CommissionerControl::Id: { + return AttributeIsSpecifiedInCommissionerControlCluster(aAttributeId); + } case Clusters::ElectricalMeasurement::Id: { return AttributeIsSpecifiedInElectricalMeasurementCluster(aAttributeId); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index d3780c91cf9eb4..3739afcb6d0886 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -1034,6 +1034,107 @@ static id _Nullable DecodeAttributeValueForAccessControlCluster(AttributeId aAtt value = [NSNumber numberWithUnsignedShort:cppValue]; return value; } + case Attributes::CommissioningARL::Id: { + using TypeInfo = Attributes::CommissioningARL::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRAccessControlClusterCommissioningAccessRestrictionEntryStruct * newElement_0; + newElement_0 = [MTRAccessControlClusterCommissioningAccessRestrictionEntryStruct new]; + newElement_0.endpoint = [NSNumber numberWithUnsignedShort:entry_0.endpoint]; + newElement_0.cluster = [NSNumber numberWithUnsignedInt:entry_0.cluster]; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.restrictions.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + MTRAccessControlClusterAccessRestrictionStruct * newElement_2; + newElement_2 = [MTRAccessControlClusterAccessRestrictionStruct new]; + newElement_2.type = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.type)]; + if (entry_2.id.IsNull()) { + newElement_2.id = nil; + } else { + newElement_2.id = [NSNumber numberWithUnsignedInt:entry_2.id.Value()]; + } + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.restrictions = array_2; + } + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::Arl::Id: { + using TypeInfo = Attributes::Arl::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRAccessControlClusterAccessRestrictionEntryStruct * newElement_0; + newElement_0 = [MTRAccessControlClusterAccessRestrictionEntryStruct new]; + newElement_0.endpoint = [NSNumber numberWithUnsignedShort:entry_0.endpoint]; + newElement_0.cluster = [NSNumber numberWithUnsignedInt:entry_0.cluster]; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.restrictions.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + MTRAccessControlClusterAccessRestrictionStruct * newElement_2; + newElement_2 = [MTRAccessControlClusterAccessRestrictionStruct new]; + newElement_2.type = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.type)]; + if (entry_2.id.IsNull()) { + newElement_2.id = nil; + } else { + newElement_2.id = [NSNumber numberWithUnsignedInt:entry_2.id.Value()]; + } + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.restrictions = array_2; + } + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } default: { break; } @@ -5113,6 +5214,17 @@ static id _Nullable DecodeAttributeValueForICDManagementCluster(AttributeId aAtt value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; return value; } + case Attributes::MaximumCheckInBackOff::Id: { + using TypeInfo = Attributes::MaximumCheckInBackOff::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } default: { break; } @@ -8350,6 +8462,84 @@ static id _Nullable DecodeAttributeValueForElectricalEnergyMeasurementCluster(At *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; return nil; } +static id _Nullable DecodeAttributeValueForWaterHeaterManagementCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::WaterHeaterManagement; + switch (aAttributeId) { + case Attributes::HeaterTypes::Id: { + using TypeInfo = Attributes::HeaterTypes::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; + return value; + } + case Attributes::HeatDemand::Id: { + using TypeInfo = Attributes::HeatDemand::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; + return value; + } + case Attributes::TankVolume::Id: { + using TypeInfo = Attributes::TankVolume::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::EstimatedHeatRequired::Id: { + using TypeInfo = Attributes::EstimatedHeatRequired::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithLongLong:cppValue]; + return value; + } + case Attributes::TankPercentage::Id: { + using TypeInfo = Attributes::TankPercentage::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::BoostState::Id: { + using TypeInfo = Attributes::BoostState::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; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} static id _Nullable DecodeAttributeValueForDemandResponseLoadControlCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::DemandResponseLoadControl; @@ -9741,6 +9931,114 @@ static id _Nullable DecodeAttributeValueForEnergyEVSEModeCluster(AttributeId aAt *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; return nil; } +static id _Nullable DecodeAttributeValueForWaterHeaterModeCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::WaterHeaterMode; + switch (aAttributeId) { + case Attributes::SupportedModes::Id: { + using TypeInfo = Attributes::SupportedModes::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRWaterHeaterModeClusterModeOptionStruct * newElement_0; + newElement_0 = [MTRWaterHeaterModeClusterModeOptionStruct new]; + newElement_0.label = AsString(entry_0.label); + if (newElement_0.label == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + newElement_0.mode = [NSNumber numberWithUnsignedChar:entry_0.mode]; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.modeTags.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + MTRWaterHeaterModeClusterModeTagStruct * newElement_2; + newElement_2 = [MTRWaterHeaterModeClusterModeTagStruct new]; + if (entry_2.mfgCode.HasValue()) { + newElement_2.mfgCode = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_2.mfgCode.Value())]; + } else { + newElement_2.mfgCode = nil; + } + newElement_2.value = [NSNumber numberWithUnsignedShort:entry_2.value]; + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.modeTags = array_2; + } + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::CurrentMode::Id: { + using TypeInfo = Attributes::CurrentMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::StartUpMode::Id: { + using TypeInfo = Attributes::StartUpMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::OnMode::Id: { + using TypeInfo = Attributes::OnMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} static id _Nullable DecodeAttributeValueForDeviceEnergyManagementModeCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::DeviceEnergyManagementMode; @@ -10848,7 +11146,7 @@ static id _Nullable DecodeAttributeValueForServiceAreaCluster(AttributeId aAttri if (entry_0.locationInfo.locationInfo.IsNull()) { newElement_0.locationInfo.locationInfo = nil; } else { - newElement_0.locationInfo.locationInfo = [MTRServiceAreaClusterHomeLocationStruct new]; + newElement_0.locationInfo.locationInfo = [MTRServiceAreaClusterLocationDescriptorStruct new]; newElement_0.locationInfo.locationInfo.locationName = AsString(entry_0.locationInfo.locationInfo.Value().locationName); if (newElement_0.locationInfo.locationInfo.locationName == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -12273,17 +12571,6 @@ static id _Nullable DecodeAttributeValueForThermostatCluster(AttributeId aAttrib value = [NSNumber numberWithBool:cppValue]; return value; } - case Attributes::TemperatureSetpointHoldPolicy::Id: { - using TypeInfo = Attributes::TemperatureSetpointHoldPolicy::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; - return value; - } case Attributes::SetpointHoldExpiryTimestamp::Id: { using TypeInfo = Attributes::SetpointHoldExpiryTimestamp::TypeInfo; TypeInfo::DecodableType cppValue; @@ -12299,31 +12586,6 @@ static id _Nullable DecodeAttributeValueForThermostatCluster(AttributeId aAttrib } return value; } - case Attributes::QueuedPreset::Id: { - using TypeInfo = Attributes::QueuedPreset::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - MTRThermostatClusterQueuedPresetStruct * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [MTRThermostatClusterQueuedPresetStruct new]; - if (cppValue.Value().presetHandle.IsNull()) { - value.presetHandle = nil; - } else { - value.presetHandle = AsData(cppValue.Value().presetHandle.Value()); - } - if (cppValue.Value().transitionTimestamp.IsNull()) { - value.transitionTimestamp = nil; - } else { - value.transitionTimestamp = [NSNumber numberWithUnsignedInt:cppValue.Value().transitionTimestamp.Value()]; - } - } - return value; - } default: { break; } @@ -15498,6 +15760,21 @@ static id _Nullable DecodeAttributeValueForWiFiNetworkManagementCluster(Attribut } return value; } + case Attributes::PassphraseSurrogate::Id: { + using TypeInfo = Attributes::PassphraseSurrogate::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } default: { break; } @@ -15593,11 +15870,11 @@ static id _Nullable DecodeAttributeValueForThreadNetworkDirectoryCluster(Attribu if (*aError != CHIP_NO_ERROR) { return nil; } - NSNumber * _Nullable value; + NSData * _Nullable value; if (cppValue.IsNull()) { value = nil; } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + value = AsData(cppValue.Value()); } return value; } @@ -15616,7 +15893,7 @@ static id _Nullable DecodeAttributeValueForThreadNetworkDirectoryCluster(Attribu auto & entry_0 = iter_0.GetValue(); MTRThreadNetworkDirectoryClusterThreadNetworkStruct * newElement_0; newElement_0 = [MTRThreadNetworkDirectoryClusterThreadNetworkStruct new]; - newElement_0.extendedPanID = [NSNumber numberWithUnsignedLongLong:entry_0.extendedPanID]; + newElement_0.extendedPanID = AsData(entry_0.extendedPanID); newElement_0.networkName = AsString(entry_0.networkName); if (newElement_0.networkName == nil) { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; @@ -15624,6 +15901,7 @@ static id _Nullable DecodeAttributeValueForThreadNetworkDirectoryCluster(Attribu return nil; } newElement_0.channel = [NSNumber numberWithUnsignedShort:entry_0.channel]; + newElement_0.activeTimestamp = [NSNumber numberWithUnsignedLongLong:entry_0.activeTimestamp]; [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -16864,6 +17142,191 @@ static id _Nullable DecodeAttributeValueForContentAppObserverCluster(AttributeId *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; return nil; } +static id _Nullable DecodeAttributeValueForEcosystemInformationCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::EcosystemInformation; + switch (aAttributeId) { + case Attributes::RemovedOn::Id: { + using TypeInfo = Attributes::RemovedOn::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::DeviceDirectory::Id: { + using TypeInfo = Attributes::DeviceDirectory::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTREcosystemInformationClusterEcosystemDeviceStruct * newElement_0; + newElement_0 = [MTREcosystemInformationClusterEcosystemDeviceStruct new]; + if (entry_0.deviceName.HasValue()) { + newElement_0.deviceName = AsString(entry_0.deviceName.Value()); + if (newElement_0.deviceName == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + } else { + newElement_0.deviceName = nil; + } + if (entry_0.deviceNameLastEdit.HasValue()) { + newElement_0.deviceNameLastEdit = [NSNumber numberWithUnsignedLongLong:entry_0.deviceNameLastEdit.Value()]; + } else { + newElement_0.deviceNameLastEdit = nil; + } + newElement_0.bridgedEndpoint = [NSNumber numberWithUnsignedShort:entry_0.bridgedEndpoint]; + newElement_0.originalEndpoint = [NSNumber numberWithUnsignedShort:entry_0.originalEndpoint]; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.deviceTypes.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + MTREcosystemInformationClusterDeviceTypeStruct * newElement_2; + newElement_2 = [MTREcosystemInformationClusterDeviceTypeStruct new]; + newElement_2.deviceType = [NSNumber numberWithUnsignedInt:entry_2.deviceType]; + newElement_2.revision = [NSNumber numberWithUnsignedShort:entry_2.revision]; + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.deviceTypes = array_2; + } + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.uniqueLocationIDs.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + NSString * newElement_2; + newElement_2 = AsString(entry_2); + if (newElement_2 == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.uniqueLocationIDs = array_2; + } + newElement_0.uniqueLocationIDsLastEdit = [NSNumber numberWithUnsignedLongLong:entry_0.uniqueLocationIDsLastEdit]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::LocationDirectory::Id: { + using TypeInfo = Attributes::LocationDirectory::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTREcosystemInformationClusterEcosystemLocationStruct * newElement_0; + newElement_0 = [MTREcosystemInformationClusterEcosystemLocationStruct new]; + newElement_0.uniqueLocationID = AsString(entry_0.uniqueLocationID); + if (newElement_0.uniqueLocationID == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + newElement_0.locationDescriptor = [MTREcosystemInformationClusterLocationDescriptorStruct new]; + newElement_0.locationDescriptor.locationName = AsString(entry_0.locationDescriptor.locationName); + if (newElement_0.locationDescriptor.locationName == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + if (entry_0.locationDescriptor.floorNumber.IsNull()) { + newElement_0.locationDescriptor.floorNumber = nil; + } else { + newElement_0.locationDescriptor.floorNumber = [NSNumber numberWithShort:entry_0.locationDescriptor.floorNumber.Value()]; + } + if (entry_0.locationDescriptor.areaType.IsNull()) { + newElement_0.locationDescriptor.areaType = nil; + } else { + newElement_0.locationDescriptor.areaType = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.locationDescriptor.areaType.Value())]; + } + newElement_0.locationDescriptorLastEdit = [NSNumber numberWithUnsignedLongLong:entry_0.locationDescriptorLastEdit]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForCommissionerControlCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::CommissionerControl; + switch (aAttributeId) { + case Attributes::SupportedDeviceCategories::Id: { + using TypeInfo = Attributes::SupportedDeviceCategories::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue.Raw()]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} static id _Nullable DecodeAttributeValueForElectricalMeasurementCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::ElectricalMeasurement; @@ -19929,6 +20392,9 @@ id _Nullable MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::T case Clusters::ElectricalEnergyMeasurement::Id: { return DecodeAttributeValueForElectricalEnergyMeasurementCluster(aPath.mAttributeId, aReader, aError); } + case Clusters::WaterHeaterManagement::Id: { + return DecodeAttributeValueForWaterHeaterManagementCluster(aPath.mAttributeId, aReader, aError); + } case Clusters::DemandResponseLoadControl::Id: { return DecodeAttributeValueForDemandResponseLoadControlCluster(aPath.mAttributeId, aReader, aError); } @@ -19950,6 +20416,9 @@ id _Nullable MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::T case Clusters::EnergyEvseMode::Id: { return DecodeAttributeValueForEnergyEVSEModeCluster(aPath.mAttributeId, aReader, aError); } + case Clusters::WaterHeaterMode::Id: { + return DecodeAttributeValueForWaterHeaterModeCluster(aPath.mAttributeId, aReader, aError); + } case Clusters::DeviceEnergyManagementMode::Id: { return DecodeAttributeValueForDeviceEnergyManagementModeCluster(aPath.mAttributeId, aReader, aError); } @@ -20082,6 +20551,12 @@ id _Nullable MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::T case Clusters::ContentAppObserver::Id: { return DecodeAttributeValueForContentAppObserverCluster(aPath.mAttributeId, aReader, aError); } + case Clusters::EcosystemInformation::Id: { + return DecodeAttributeValueForEcosystemInformationCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::CommissionerControl::Id: { + return DecodeAttributeValueForCommissionerControlCluster(aPath.mAttributeId, aReader, aError); + } case Clusters::ElectricalMeasurement::Id: { return DecodeAttributeValueForElectricalMeasurementCluster(aPath.mAttributeId, aReader, aError); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 979c1b92605c15..135d257b47def4 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -1007,6 +1007,13 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterAccessControl : MTRGenericBaseCluster +/** + * Command ReviewFabricRestrictions + * + * 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. + */ +- (void)reviewFabricRestrictionsWithParams:(MTRAccessControlClusterReviewFabricRestrictionsParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; + - (void)readAttributeACLWithParams:(MTRReadParams * _Nullable)params completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributeACLWithValue:(NSArray * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributeACLWithValue:(NSArray * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); @@ -1041,6 +1048,18 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); + (void)readAttributeAccessControlEntriesPerFabricWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); +- (void)readAttributeCommissioningARLWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeCommissioningARLWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeCommissioningARLWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeARLWithParams:(MTRReadParams * _Nullable)params completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeARLWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeARLWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished @@ -3670,6 +3689,13 @@ MTR_PROVISIONALLY_AVAILABLE MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRBaseClusterBridgedDeviceBasicInformation : MTRGenericBaseCluster +/** + * Command KeepActive + * + * The server SHALL attempt to keep the devices specified active for StayActiveDuration milliseconds when they are next active. + */ +- (void)keepActiveWithParams:(MTRBridgedDeviceBasicInformationClusterKeepActiveParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; + - (void)readAttributeVendorNameWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)subscribeAttributeVendorNameWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished @@ -4547,6 +4573,12 @@ MTR_PROVISIONALLY_AVAILABLE reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeOperatingModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)readAttributeMaximumCheckInBackOffWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeMaximumCheckInBackOffWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeMaximumCheckInBackOffWithClusterStateCache:(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 @@ -4936,8 +4968,8 @@ MTR_PROVISIONALLY_AVAILABLE /** * Cluster Laundry Dryer Controls * - * This cluster supports remotely monitoring and controling the different typs of - functionality available to a drying device, such as a laundry dryer. + * This cluster provides a way to access options associated with the operation of + a laundry dryer device type. */ MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterLaundryDryerControls : MTRGenericBaseCluster @@ -6625,7 +6657,7 @@ MTR_PROVISIONALLY_AVAILABLE /** * Command AddScene * - * Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' + * Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeID": VALUE, "Value*": VALUE}]}' */ - (void)addSceneWithParams:(MTRScenesManagementClusterAddSceneParams *)params completion:(void (^)(MTRScenesManagementClusterAddSceneResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; /** @@ -7502,6 +7534,118 @@ MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) @end +/** + * Cluster Water Heater Management + * + * This cluster is used to allow clients to control the operation of a hot water heating appliance so that it can be used with energy management. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRBaseClusterWaterHeaterManagement : MTRGenericBaseCluster + +/** + * Command Boost + * + * Allows a client to request that the water heater is put into a Boost state. + */ +- (void)boostWithParams:(MTRWaterHeaterManagementClusterBoostParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +/** + * Command CancelBoost + * + * Allows a client to cancel an ongoing Boost operation. + */ +- (void)cancelBoostWithParams:(MTRWaterHeaterManagementClusterCancelBoostParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)cancelBoostWithCompletion:(MTRStatusCompletion)completion + MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeHeaterTypesWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeHeaterTypesWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeHeaterTypesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeHeatDemandWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeHeatDemandWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeHeatDemandWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeTankVolumeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeTankVolumeWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeTankVolumeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeEstimatedHeatRequiredWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeEstimatedHeatRequiredWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeEstimatedHeatRequiredWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeTankPercentageWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeTankPercentageWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeTankPercentageWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeBoostStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeBoostStateWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeBoostStateWithClusterStateCache:(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 + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRBaseClusterWaterHeaterManagement (Availability) + +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Demand Response Load Control * @@ -7917,13 +8061,13 @@ MTR_PROVISIONALLY_AVAILABLE /** * Command EnableCharging * - * Allows a client to enable the EVSE to charge an EV. + * This command allows a client to enable the EVSE to charge an EV, */ - (void)enableChargingWithParams:(MTREnergyEVSEClusterEnableChargingParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; /** * Command EnableDischarging * - * Allows a client to enable the EVSE to discharge an EV. + * Upon receipt, this SHALL allow a client to enable the discharge of an EV, */ - (void)enableDischargingWithParams:(MTREnergyEVSEClusterEnableDischargingParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; /** @@ -7943,7 +8087,7 @@ MTR_PROVISIONALLY_AVAILABLE /** * Command GetTargets * - * Allows a client to retrieve the user specified charging targets. + * Allows a client to retrieve the current set of charging targets. */ - (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams * _Nullable)params completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)getTargetsWithCompletion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -8419,6 +8563,103 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster Water Heater Mode + * + * Attributes and commands for selecting a mode from a list of supported options. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRBaseClusterWaterHeaterMode : MTRGenericBaseCluster + +/** + * Command ChangeToMode + * + * This command is used to change device modes. + On receipt of this command the device SHALL respond with a ChangeToModeResponse command. + */ +- (void)changeToModeWithParams:(MTRWaterHeaterModeClusterChangeToModeParams *)params completion:(void (^)(MTRWaterHeaterModeClusterChangeToModeResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeSupportedModesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeSupportedModesWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeSupportedModesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeCurrentModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeCurrentModeWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeCurrentModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeStartUpModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeStartUpModeWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeStartUpModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeOnModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeOnModeWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeOnModeWithValue:(NSNumber * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeOnModeWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeOnModeWithClusterStateCache:(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 + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRBaseClusterWaterHeaterMode (Availability) + +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Device Energy Management Mode * @@ -9797,20 +10038,6 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - (void)commitPresetsSchedulesRequestWithParams:(MTRThermostatClusterCommitPresetsSchedulesRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)commitPresetsSchedulesRequestWithCompletion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -/** - * Command CancelSetActivePresetRequest - * - * This command is sent to cancel a queued preset. - */ -- (void)cancelSetActivePresetRequestWithParams:(MTRThermostatClusterCancelSetActivePresetRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)cancelSetActivePresetRequestWithCompletion:(MTRStatusCompletion)completion - MTR_PROVISIONALLY_AVAILABLE; -/** - * Command SetTemperatureSetpointHoldPolicy - * - * This command sets the set point hold policy. - */ -- (void)setTemperatureSetpointHoldPolicyWithParams:(MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeLocalTemperatureWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)subscribeAttributeLocalTemperatureWithParams:(MTRSubscribeParams *)params @@ -10230,24 +10457,12 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributePresetsSchedulesEditableWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)readAttributeTemperatureSetpointHoldPolicyWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeTemperatureSetpointHoldPolicyWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeTemperatureSetpointHoldPolicyWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - - (void)readAttributeSetpointHoldExpiryTimestampWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeSetpointHoldExpiryTimestampWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeSetpointHoldExpiryTimestampWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)readAttributeQueuedPresetWithCompletion:(void (^)(MTRThermostatClusterQueuedPresetStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeQueuedPresetWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(MTRThermostatClusterQueuedPresetStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeQueuedPresetWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRThermostatClusterQueuedPresetStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished @@ -13138,6 +13353,12 @@ MTR_PROVISIONALLY_AVAILABLE reportHandler:(void (^)(NSData * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeSSIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSData * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)readAttributePassphraseSurrogateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributePassphraseSurrogateWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributePassphraseSurrogateWithClusterStateCache:(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 @@ -13338,13 +13559,13 @@ MTR_PROVISIONALLY_AVAILABLE */ - (void)getOperationalDatasetWithParams:(MTRThreadNetworkDirectoryClusterGetOperationalDatasetParams *)params completion:(void (^)(MTRThreadNetworkDirectoryClusterOperationalDatasetResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)readAttributePreferredExtendedPanIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributePreferredExtendedPanIDWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributePreferredExtendedPanIDWithValue:(NSNumber * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)readAttributePreferredExtendedPanIDWithCompletion:(void (^)(NSData * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributePreferredExtendedPanIDWithValue:(NSData * _Nullable)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributePreferredExtendedPanIDWithValue:(NSData * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributePreferredExtendedPanIDWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributePreferredExtendedPanIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + reportHandler:(void (^)(NSData * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributePreferredExtendedPanIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSData * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeThreadNetworksWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeThreadNetworksWithParams:(MTRSubscribeParams *)params @@ -14867,6 +15088,165 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster Ecosystem Information + * + * Provides extended device information for all the logical devices represented by a Bridged Node. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRBaseClusterEcosystemInformation : MTRGenericBaseCluster + +- (void)readAttributeRemovedOnWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeRemovedOnWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeRemovedOnWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeDeviceDirectoryWithParams:(MTRReadParams * _Nullable)params completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeDeviceDirectoryWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeDeviceDirectoryWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeLocationDirectoryWithParams:(MTRReadParams * _Nullable)params completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeLocationDirectoryWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeLocationDirectoryWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _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 + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRBaseClusterEcosystemInformation (Availability) + +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + +/** + * Cluster Commissioner Control + * + * Supports the ability for clients to request the commissioning of themselves or other nodes onto a fabric which the cluster server can commission onto. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRBaseClusterCommissionerControl : MTRGenericBaseCluster + +/** + * Command RequestCommissioningApproval + * + * This command is sent by a client to request approval for a future CommissionNode call. + */ +- (void)requestCommissioningApprovalWithParams:(MTRCommissionerControlClusterRequestCommissioningApprovalParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +/** + * Command CommissionNode + * + * This command is sent by a client to request that the server begins commissioning a previously approved request. + */ +- (void)commissionNodeWithParams:(MTRCommissionerControlClusterCommissionNodeParams *)params completion:(void (^)(MTRCommissionerControlClusterReverseOpenCommissioningWindowParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeSupportedDeviceCategoriesWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeSupportedDeviceCategoriesWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeSupportedDeviceCategoriesWithClusterStateCache:(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 + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRBaseClusterCommissionerControl (Availability) + +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Electrical Measurement * @@ -16755,6 +17135,12 @@ MTR_DEPRECATED("Please use MTRBaseClusterUnitTesting", ios(16.1, 16.4), macos(13 @interface MTRBaseClusterTestCluster : MTRBaseClusterUnitTesting @end +typedef NS_ENUM(uint8_t, MTRDataTypeTestGlobalEnum) { + MTRDataTypeTestGlobalEnumSomeValue MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRDataTypeTestGlobalEnumSomeOtherValue MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRDataTypeTestGlobalEnumFinalValue MTR_PROVISIONALLY_AVAILABLE = 0x02, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint8_t, MTRIdentifyEffectIdentifier) { MTRIdentifyEffectIdentifierBlink MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x00, MTRIdentifyEffectIdentifierBreathe MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x01, @@ -16889,12 +17275,24 @@ typedef NS_ENUM(uint8_t, MTRAccessControlPrivilege) { MTRAccessControlPrivilegeAdminister MTR_DEPRECATED("Please use MTRAccessControlEntryPrivilegeAdminister", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) = 0x05, } MTR_DEPRECATED("Please use MTRAccessControlEntryPrivilege", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); +typedef NS_ENUM(uint8_t, MTRAccessControlAccessRestrictionType) { + MTRAccessControlAccessRestrictionTypeAttributeAccessForbidden MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRAccessControlAccessRestrictionTypeAttributeWriteForbidden MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRAccessControlAccessRestrictionTypeCommandForbidden MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRAccessControlAccessRestrictionTypeEventForbidden MTR_PROVISIONALLY_AVAILABLE = 0x03, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint8_t, MTRAccessControlChangeType) { MTRAccessControlChangeTypeChanged MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x00, MTRAccessControlChangeTypeAdded MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x01, MTRAccessControlChangeTypeRemoved MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x02, } MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); +typedef NS_OPTIONS(uint32_t, MTRAccessControlFeature) { + MTRAccessControlFeatureExtension MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRAccessControlFeatureManagedDevice MTR_PROVISIONALLY_AVAILABLE = 0x2, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint8_t, MTRActionsActionError) { MTRActionsActionErrorUnknown MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x00, MTRActionsActionErrorInterrupted MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) = 0x01, @@ -17713,6 +18111,10 @@ typedef NS_ENUM(uint8_t, MTRBridgedDeviceBasicInformationProductFinish) { MTRBridgedDeviceBasicInformationProductFinishFabric MTR_AVAILABLE(ios(17.0), macos(14.0), watchos(10.0), tvos(17.0)) = 0x05, } MTR_AVAILABLE(ios(17.0), macos(14.0), watchos(10.0), tvos(17.0)); +typedef NS_OPTIONS(uint32_t, MTRBridgedDeviceBasicInformationFeature) { + MTRBridgedDeviceBasicInformationFeatureBridgedICDSupport MTR_PROVISIONALLY_AVAILABLE = 0x100000, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_OPTIONS(uint32_t, MTRSwitchFeature) { MTRSwitchFeatureLatchingSwitch MTR_AVAILABLE(ios(16.2), macos(13.1), watchos(9.2), tvos(16.2)) = 0x1, MTRSwitchFeatureMomentarySwitch MTR_AVAILABLE(ios(16.2), macos(13.1), watchos(9.2), tvos(16.2)) = 0x2, @@ -17792,6 +18194,7 @@ typedef NS_OPTIONS(uint32_t, MTRICDManagementFeature) { MTRICDManagementFeatureCheckInProtocolSupport MTR_PROVISIONALLY_AVAILABLE = 0x1, MTRICDManagementFeatureUserActiveModeTrigger MTR_PROVISIONALLY_AVAILABLE = 0x2, MTRICDManagementFeatureLongIdleTimeSupport MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTRICDManagementFeatureDynamicSitLitSupport MTR_PROVISIONALLY_AVAILABLE = 0x8, } MTR_PROVISIONALLY_AVAILABLE; typedef NS_OPTIONS(uint32_t, MTRICDManagementUserActiveModeTriggerBitmap) { @@ -18231,6 +18634,32 @@ typedef NS_OPTIONS(uint32_t, MTRElectricalEnergyMeasurementFeature) { MTRElectricalEnergyMeasurementFeaturePeriodicEnergy MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) = 0x8, } MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)); +typedef NS_ENUM(uint8_t, MTRWaterHeaterManagementBoostState) { + MTRWaterHeaterManagementBoostStateInactive MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRWaterHeaterManagementBoostStateActive MTR_PROVISIONALLY_AVAILABLE = 0x01, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint32_t, MTRWaterHeaterManagementFeature) { + MTRWaterHeaterManagementFeatureEnergyManagement MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRWaterHeaterManagementFeatureTankPercent MTR_PROVISIONALLY_AVAILABLE = 0x2, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint8_t, MTRWaterHeaterManagementWaterHeaterDemandBitmap) { + MTRWaterHeaterManagementWaterHeaterDemandBitmapImmersionElement1 MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRWaterHeaterManagementWaterHeaterDemandBitmapImmersionElement2 MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTRWaterHeaterManagementWaterHeaterDemandBitmapHeatPump MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTRWaterHeaterManagementWaterHeaterDemandBitmapBoiler MTR_PROVISIONALLY_AVAILABLE = 0x8, + MTRWaterHeaterManagementWaterHeaterDemandBitmapOther MTR_PROVISIONALLY_AVAILABLE = 0x10, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint8_t, MTRWaterHeaterManagementWaterHeaterTypeBitmap) { + MTRWaterHeaterManagementWaterHeaterTypeBitmapImmersionElement1 MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRWaterHeaterManagementWaterHeaterTypeBitmapImmersionElement2 MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTRWaterHeaterManagementWaterHeaterTypeBitmapHeatPump MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTRWaterHeaterManagementWaterHeaterTypeBitmapBoiler MTR_PROVISIONALLY_AVAILABLE = 0x8, + MTRWaterHeaterManagementWaterHeaterTypeBitmapOther MTR_PROVISIONALLY_AVAILABLE = 0x10, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint8_t, MTRDemandResponseLoadControlCriticalityLevel) { MTRDemandResponseLoadControlCriticalityLevelUnknown MTR_PROVISIONALLY_AVAILABLE = 0x00, MTRDemandResponseLoadControlCriticalityLevelGreen MTR_PROVISIONALLY_AVAILABLE = 0x01, @@ -18461,6 +18890,7 @@ typedef NS_ENUM(uint8_t, MTREnergyEVSESupplyState) { MTREnergyEVSESupplyStateDischargingEnabled MTR_PROVISIONALLY_AVAILABLE = 0x02, MTREnergyEVSESupplyStateDisabledError MTR_PROVISIONALLY_AVAILABLE = 0x03, MTREnergyEVSESupplyStateDisabledDiagnostics MTR_PROVISIONALLY_AVAILABLE = 0x04, + MTREnergyEVSESupplyStateEnabled MTR_PROVISIONALLY_AVAILABLE = 0x05, } MTR_PROVISIONALLY_AVAILABLE; typedef NS_OPTIONS(uint32_t, MTREnergyEVSEFeature) { @@ -18510,6 +18940,16 @@ typedef NS_OPTIONS(uint32_t, MTREnergyEVSEModeFeature) { MTREnergyEVSEModeFeatureOnOff MTR_PROVISIONALLY_AVAILABLE = 0x1, } MTR_PROVISIONALLY_AVAILABLE; +typedef NS_ENUM(uint16_t, MTRWaterHeaterModeModeTag) { + MTRWaterHeaterModeModeTagOff MTR_PROVISIONALLY_AVAILABLE = 0x4000, + MTRWaterHeaterModeModeTagManual MTR_PROVISIONALLY_AVAILABLE = 0x4001, + MTRWaterHeaterModeModeTagTimed MTR_PROVISIONALLY_AVAILABLE = 0x4002, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint32_t, MTRWaterHeaterModeFeature) { + MTRWaterHeaterModeFeatureOnOff MTR_PROVISIONALLY_AVAILABLE = 0x1, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint16_t, MTRDeviceEnergyManagementModeModeTag) { MTRDeviceEnergyManagementModeModeTagNoOptimization MTR_PROVISIONALLY_AVAILABLE = 0x4000, MTRDeviceEnergyManagementModeModeTagDeviceOptimization MTR_PROVISIONALLY_AVAILABLE = 0x4001, @@ -19435,7 +19875,8 @@ typedef NS_ENUM(uint8_t, MTRThermostatPresetScenario) { MTRThermostatPresetScenarioSleep MTR_PROVISIONALLY_AVAILABLE = 0x03, MTRThermostatPresetScenarioWake MTR_PROVISIONALLY_AVAILABLE = 0x04, MTRThermostatPresetScenarioVacation MTR_PROVISIONALLY_AVAILABLE = 0x05, - MTRThermostatPresetScenarioUserDefined MTR_PROVISIONALLY_AVAILABLE = 0x06, + MTRThermostatPresetScenarioGoingToSleep MTR_PROVISIONALLY_AVAILABLE = 0x06, + MTRThermostatPresetScenarioUserDefined MTR_PROVISIONALLY_AVAILABLE = 0xFE, } MTR_PROVISIONALLY_AVAILABLE; typedef NS_ENUM(uint8_t, MTRThermostatSetpointChangeSource) { @@ -19514,7 +19955,6 @@ typedef NS_OPTIONS(uint32_t, MTRThermostatFeature) { MTRThermostatFeatureMatterScheduleConfiguration MTR_PROVISIONALLY_AVAILABLE = 0x80, MTRThermostatFeaturePresets MTR_PROVISIONALLY_AVAILABLE = 0x100, MTRThermostatFeatureSetpoints MTR_PROVISIONALLY_AVAILABLE = 0x200, - MTRThermostatFeatureQueuedPresetsSupported MTR_PROVISIONALLY_AVAILABLE = 0x400, } MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); typedef NS_OPTIONS(uint8_t, MTRThermostatHVACSystemTypeBitmap) { @@ -19593,11 +20033,6 @@ typedef NS_OPTIONS(uint16_t, MTRThermostatScheduleTypeFeaturesBitmap) { MTRThermostatScheduleTypeFeaturesBitmapSupportsOff MTR_PROVISIONALLY_AVAILABLE = 0x8, } MTR_PROVISIONALLY_AVAILABLE; -typedef NS_OPTIONS(uint8_t, MTRThermostatTemperatureSetpointHoldPolicyBitmap) { - MTRThermostatTemperatureSetpointHoldPolicyBitmapHoldDurationElapsed MTR_PROVISIONALLY_AVAILABLE = 0x1, - MTRThermostatTemperatureSetpointHoldPolicyBitmapHoldDurationElapsedOrPresetChanged MTR_PROVISIONALLY_AVAILABLE = 0x2, -} MTR_PROVISIONALLY_AVAILABLE; - typedef NS_ENUM(uint8_t, MTRFanControlAirflowDirection) { MTRFanControlAirflowDirectionForward MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) = 0x00, MTRFanControlAirflowDirectionReverse MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) = 0x01, @@ -20581,6 +21016,108 @@ typedef NS_ENUM(uint8_t, MTRContentAppObserverStatus) { MTRContentAppObserverStatusUnexpectedData MTR_PROVISIONALLY_AVAILABLE = 0x01, } MTR_PROVISIONALLY_AVAILABLE; +typedef NS_ENUM(uint8_t, MTREcosystemInformationAreaTypeTag) { + MTREcosystemInformationAreaTypeTagAisle MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTREcosystemInformationAreaTypeTagAttic MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTREcosystemInformationAreaTypeTagBackDoor MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTREcosystemInformationAreaTypeTagBackYard MTR_PROVISIONALLY_AVAILABLE = 0x03, + MTREcosystemInformationAreaTypeTagBalcony MTR_PROVISIONALLY_AVAILABLE = 0x04, + MTREcosystemInformationAreaTypeTagBallroom MTR_PROVISIONALLY_AVAILABLE = 0x05, + MTREcosystemInformationAreaTypeTagBathroom MTR_PROVISIONALLY_AVAILABLE = 0x06, + MTREcosystemInformationAreaTypeTagBedroom MTR_PROVISIONALLY_AVAILABLE = 0x07, + MTREcosystemInformationAreaTypeTagBorder MTR_PROVISIONALLY_AVAILABLE = 0x08, + MTREcosystemInformationAreaTypeTagBoxroom MTR_PROVISIONALLY_AVAILABLE = 0x09, + MTREcosystemInformationAreaTypeTagBreakfastRoom MTR_PROVISIONALLY_AVAILABLE = 0x0A, + MTREcosystemInformationAreaTypeTagCarport MTR_PROVISIONALLY_AVAILABLE = 0x0B, + MTREcosystemInformationAreaTypeTagCellar MTR_PROVISIONALLY_AVAILABLE = 0x0C, + MTREcosystemInformationAreaTypeTagCloakroom MTR_PROVISIONALLY_AVAILABLE = 0x0D, + MTREcosystemInformationAreaTypeTagCloset MTR_PROVISIONALLY_AVAILABLE = 0x0E, + MTREcosystemInformationAreaTypeTagConservatory MTR_PROVISIONALLY_AVAILABLE = 0x0F, + MTREcosystemInformationAreaTypeTagCorridor MTR_PROVISIONALLY_AVAILABLE = 0x10, + MTREcosystemInformationAreaTypeTagCraftRoom MTR_PROVISIONALLY_AVAILABLE = 0x11, + MTREcosystemInformationAreaTypeTagCupboard MTR_PROVISIONALLY_AVAILABLE = 0x12, + MTREcosystemInformationAreaTypeTagDeck MTR_PROVISIONALLY_AVAILABLE = 0x13, + MTREcosystemInformationAreaTypeTagDen MTR_PROVISIONALLY_AVAILABLE = 0x14, + MTREcosystemInformationAreaTypeTagDining MTR_PROVISIONALLY_AVAILABLE = 0x15, + MTREcosystemInformationAreaTypeTagDrawingRoom MTR_PROVISIONALLY_AVAILABLE = 0x16, + MTREcosystemInformationAreaTypeTagDressingRoom MTR_PROVISIONALLY_AVAILABLE = 0x17, + MTREcosystemInformationAreaTypeTagDriveway MTR_PROVISIONALLY_AVAILABLE = 0x18, + MTREcosystemInformationAreaTypeTagElevator MTR_PROVISIONALLY_AVAILABLE = 0x19, + MTREcosystemInformationAreaTypeTagEnsuite MTR_PROVISIONALLY_AVAILABLE = 0x1A, + MTREcosystemInformationAreaTypeTagEntrance MTR_PROVISIONALLY_AVAILABLE = 0x1B, + MTREcosystemInformationAreaTypeTagEntryway MTR_PROVISIONALLY_AVAILABLE = 0x1C, + MTREcosystemInformationAreaTypeTagFamilyRoom MTR_PROVISIONALLY_AVAILABLE = 0x1D, + MTREcosystemInformationAreaTypeTagFoyer MTR_PROVISIONALLY_AVAILABLE = 0x1E, + MTREcosystemInformationAreaTypeTagFrontDoor MTR_PROVISIONALLY_AVAILABLE = 0x1F, + MTREcosystemInformationAreaTypeTagFrontYard MTR_PROVISIONALLY_AVAILABLE = 0x20, + MTREcosystemInformationAreaTypeTagGameRoom MTR_PROVISIONALLY_AVAILABLE = 0x21, + MTREcosystemInformationAreaTypeTagGarage MTR_PROVISIONALLY_AVAILABLE = 0x22, + MTREcosystemInformationAreaTypeTagGarageDoor MTR_PROVISIONALLY_AVAILABLE = 0x23, + MTREcosystemInformationAreaTypeTagGarden MTR_PROVISIONALLY_AVAILABLE = 0x24, + MTREcosystemInformationAreaTypeTagGardenDoor MTR_PROVISIONALLY_AVAILABLE = 0x25, + MTREcosystemInformationAreaTypeTagGuestBathroom MTR_PROVISIONALLY_AVAILABLE = 0x26, + MTREcosystemInformationAreaTypeTagGuestBedroom MTR_PROVISIONALLY_AVAILABLE = 0x27, + MTREcosystemInformationAreaTypeTagGuestRestroom MTR_PROVISIONALLY_AVAILABLE = 0x28, + MTREcosystemInformationAreaTypeTagGuestRoom MTR_PROVISIONALLY_AVAILABLE = 0x29, + MTREcosystemInformationAreaTypeTagGym MTR_PROVISIONALLY_AVAILABLE = 0x2A, + MTREcosystemInformationAreaTypeTagHallway MTR_PROVISIONALLY_AVAILABLE = 0x2B, + MTREcosystemInformationAreaTypeTagHearthRoom MTR_PROVISIONALLY_AVAILABLE = 0x2C, + MTREcosystemInformationAreaTypeTagKidsRoom MTR_PROVISIONALLY_AVAILABLE = 0x2D, + MTREcosystemInformationAreaTypeTagKidsBedroom MTR_PROVISIONALLY_AVAILABLE = 0x2E, + MTREcosystemInformationAreaTypeTagKitchen MTR_PROVISIONALLY_AVAILABLE = 0x2F, + MTREcosystemInformationAreaTypeTagLarder MTR_PROVISIONALLY_AVAILABLE = 0x30, + MTREcosystemInformationAreaTypeTagLaundryRoom MTR_PROVISIONALLY_AVAILABLE = 0x31, + MTREcosystemInformationAreaTypeTagLawn MTR_PROVISIONALLY_AVAILABLE = 0x32, + MTREcosystemInformationAreaTypeTagLibrary MTR_PROVISIONALLY_AVAILABLE = 0x33, + MTREcosystemInformationAreaTypeTagLivingRoom MTR_PROVISIONALLY_AVAILABLE = 0x34, + MTREcosystemInformationAreaTypeTagLounge MTR_PROVISIONALLY_AVAILABLE = 0x35, + MTREcosystemInformationAreaTypeTagMediaTVRoom MTR_PROVISIONALLY_AVAILABLE = 0x36, + MTREcosystemInformationAreaTypeTagMudRoom MTR_PROVISIONALLY_AVAILABLE = 0x37, + MTREcosystemInformationAreaTypeTagMusicRoom MTR_PROVISIONALLY_AVAILABLE = 0x38, + MTREcosystemInformationAreaTypeTagNursery MTR_PROVISIONALLY_AVAILABLE = 0x39, + MTREcosystemInformationAreaTypeTagOffice MTR_PROVISIONALLY_AVAILABLE = 0x3A, + MTREcosystemInformationAreaTypeTagOutdoorKitchen MTR_PROVISIONALLY_AVAILABLE = 0x3B, + MTREcosystemInformationAreaTypeTagOutside MTR_PROVISIONALLY_AVAILABLE = 0x3C, + MTREcosystemInformationAreaTypeTagPantry MTR_PROVISIONALLY_AVAILABLE = 0x3D, + MTREcosystemInformationAreaTypeTagParkingLot MTR_PROVISIONALLY_AVAILABLE = 0x3E, + MTREcosystemInformationAreaTypeTagParlor MTR_PROVISIONALLY_AVAILABLE = 0x3F, + MTREcosystemInformationAreaTypeTagPatio MTR_PROVISIONALLY_AVAILABLE = 0x40, + MTREcosystemInformationAreaTypeTagPlayRoom MTR_PROVISIONALLY_AVAILABLE = 0x41, + MTREcosystemInformationAreaTypeTagPoolRoom MTR_PROVISIONALLY_AVAILABLE = 0x42, + MTREcosystemInformationAreaTypeTagPorch MTR_PROVISIONALLY_AVAILABLE = 0x43, + MTREcosystemInformationAreaTypeTagPrimaryBathroom MTR_PROVISIONALLY_AVAILABLE = 0x44, + MTREcosystemInformationAreaTypeTagPrimaryBedroom MTR_PROVISIONALLY_AVAILABLE = 0x45, + MTREcosystemInformationAreaTypeTagRamp MTR_PROVISIONALLY_AVAILABLE = 0x46, + MTREcosystemInformationAreaTypeTagReceptionRoom MTR_PROVISIONALLY_AVAILABLE = 0x47, + MTREcosystemInformationAreaTypeTagRecreationRoom MTR_PROVISIONALLY_AVAILABLE = 0x48, + MTREcosystemInformationAreaTypeTagRestroom MTR_PROVISIONALLY_AVAILABLE = 0x49, + MTREcosystemInformationAreaTypeTagRoof MTR_PROVISIONALLY_AVAILABLE = 0x4A, + MTREcosystemInformationAreaTypeTagSauna MTR_PROVISIONALLY_AVAILABLE = 0x4B, + MTREcosystemInformationAreaTypeTagScullery MTR_PROVISIONALLY_AVAILABLE = 0x4C, + MTREcosystemInformationAreaTypeTagSewingRoom MTR_PROVISIONALLY_AVAILABLE = 0x4D, + MTREcosystemInformationAreaTypeTagShed MTR_PROVISIONALLY_AVAILABLE = 0x4E, + MTREcosystemInformationAreaTypeTagSideDoor MTR_PROVISIONALLY_AVAILABLE = 0x4F, + MTREcosystemInformationAreaTypeTagSideYard MTR_PROVISIONALLY_AVAILABLE = 0x50, + MTREcosystemInformationAreaTypeTagSittingRoom MTR_PROVISIONALLY_AVAILABLE = 0x51, + MTREcosystemInformationAreaTypeTagSnug MTR_PROVISIONALLY_AVAILABLE = 0x52, + MTREcosystemInformationAreaTypeTagSpa MTR_PROVISIONALLY_AVAILABLE = 0x53, + MTREcosystemInformationAreaTypeTagStaircase MTR_PROVISIONALLY_AVAILABLE = 0x54, + MTREcosystemInformationAreaTypeTagSteamRoom MTR_PROVISIONALLY_AVAILABLE = 0x55, + MTREcosystemInformationAreaTypeTagStorageRoom MTR_PROVISIONALLY_AVAILABLE = 0x56, + MTREcosystemInformationAreaTypeTagStudio MTR_PROVISIONALLY_AVAILABLE = 0x57, + MTREcosystemInformationAreaTypeTagStudy MTR_PROVISIONALLY_AVAILABLE = 0x58, + MTREcosystemInformationAreaTypeTagSunRoom MTR_PROVISIONALLY_AVAILABLE = 0x59, + MTREcosystemInformationAreaTypeTagSwimmingPool MTR_PROVISIONALLY_AVAILABLE = 0x5A, + MTREcosystemInformationAreaTypeTagTerrace MTR_PROVISIONALLY_AVAILABLE = 0x5B, + MTREcosystemInformationAreaTypeTagUtilityRoom MTR_PROVISIONALLY_AVAILABLE = 0x5C, + MTREcosystemInformationAreaTypeTagWard MTR_PROVISIONALLY_AVAILABLE = 0x5D, + MTREcosystemInformationAreaTypeTagWorkshop MTR_PROVISIONALLY_AVAILABLE = 0x5E, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint32_t, MTRCommissionerControlSupportedDeviceCategoryBitmap) { + MTRCommissionerControlSupportedDeviceCategoryBitmapFabricSynchronization MTR_PROVISIONALLY_AVAILABLE = 0x1, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint8_t, MTRUnitTestingSimple) { MTRUnitTestingSimpleUnspecified MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00, MTRUnitTestingSimpleValueA MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x01, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 87398bcf63b53e..5abe4201d30f97 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -7742,6 +7742,31 @@ - (nullable instancetype)initWithDevice:(MTRBaseDevice *)device @implementation MTRBaseClusterAccessControl +- (void)reviewFabricRestrictionsWithParams:(MTRAccessControlClusterReviewFabricRestrictionsParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRAccessControlClusterReviewFabricRestrictionsParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = AccessControl::Commands::ReviewFabricRestrictions::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)readAttributeACLWithParams:(MTRReadParams * _Nullable)params completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = AccessControl::Attributes::Acl::TypeInfo; @@ -8094,6 +8119,78 @@ + (void)readAttributeAccessControlEntriesPerFabricWithClusterStateCache:(MTRClus completion:completion]; } +- (void)readAttributeCommissioningARLWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = AccessControl::Attributes::CommissioningARL::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeCommissioningARLWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = AccessControl::Attributes::CommissioningARL::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeCommissioningARLWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = AccessControl::Attributes::CommissioningARL::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeARLWithParams:(MTRReadParams * _Nullable)params completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = AccessControl::Attributes::Arl::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeARLWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = AccessControl::Attributes::Arl::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeARLWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = AccessControl::Attributes::Arl::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 = AccessControl::Attributes::GeneratedCommandList::TypeInfo; @@ -30658,6 +30755,31 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @implementation MTRBaseClusterBridgedDeviceBasicInformation +- (void)keepActiveWithParams:(MTRBridgedDeviceBasicInformationClusterKeepActiveParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRBridgedDeviceBasicInformationClusterKeepActiveParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = BridgedDeviceBasicInformation::Commands::KeepActive::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)readAttributeVendorNameWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = BridgedDeviceBasicInformation::Attributes::VendorName::TypeInfo; @@ -37398,6 +37520,42 @@ + (void)readAttributeOperatingModeWithClusterStateCache:(MTRClusterStateCacheCon completion:completion]; } +- (void)readAttributeMaximumCheckInBackOffWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = IcdManagement::Attributes::MaximumCheckInBackOff::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeMaximumCheckInBackOffWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = IcdManagement::Attributes::MaximumCheckInBackOff::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeMaximumCheckInBackOffWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = IcdManagement::Attributes::MaximumCheckInBackOff::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 = IcdManagement::Attributes::GeneratedCommandList::TypeInfo; @@ -51085,84 +51243,12 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end -@implementation MTRBaseClusterDemandResponseLoadControl - -- (void)registerLoadControlProgramRequestWithParams:(MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = DemandResponseLoadControl::Commands::RegisterLoadControlProgramRequest::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)unregisterLoadControlProgramRequestWithParams:(MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = DemandResponseLoadControl::Commands::UnregisterLoadControlProgramRequest::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)addLoadControlEventRequestWithParams:(MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; +@implementation MTRBaseClusterWaterHeaterManagement - using RequestType = DemandResponseLoadControl::Commands::AddLoadControlEventRequest::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)removeLoadControlEventRequestWithParams:(MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams *)params completion:(MTRStatusCompletion)completion +- (void)boostWithParams:(MTRWaterHeaterManagementClusterBoostParams *)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams + params = [[MTRWaterHeaterManagementClusterBoostParams alloc] init]; } @@ -51172,7 +51258,7 @@ - (void)removeLoadControlEventRequestWithParams:(MTRDemandResponseLoadControlClu auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = DemandResponseLoadControl::Commands::RemoveLoadControlEventRequest::Type; + using RequestType = WaterHeaterManagement::Commands::Boost::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) @@ -51183,14 +51269,14 @@ - (void)removeLoadControlEventRequestWithParams:(MTRDemandResponseLoadControlClu queue:self.callbackQueue completion:responseHandler]; } -- (void)clearLoadControlEventsRequestWithCompletion:(MTRStatusCompletion)completion +- (void)cancelBoostWithCompletion:(MTRStatusCompletion)completion { - [self clearLoadControlEventsRequestWithParams:nil completion:completion]; + [self cancelBoostWithParams:nil completion:completion]; } -- (void)clearLoadControlEventsRequestWithParams:(MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)cancelBoostWithParams:(MTRWaterHeaterManagementClusterCancelBoostParams * _Nullable)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams + params = [[MTRWaterHeaterManagementClusterCancelBoostParams alloc] init]; } @@ -51200,7 +51286,7 @@ - (void)clearLoadControlEventsRequestWithParams:(MTRDemandResponseLoadControlClu auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = DemandResponseLoadControl::Commands::ClearLoadControlEventsRequest::Type; + using RequestType = WaterHeaterManagement::Commands::CancelBoost::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) @@ -51212,81 +51298,9 @@ - (void)clearLoadControlEventsRequestWithParams:(MTRDemandResponseLoadControlClu completion:responseHandler]; } -- (void)readAttributeLoadControlProgramsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = DemandResponseLoadControl::Attributes::LoadControlPrograms::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)subscribeAttributeLoadControlProgramsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = DemandResponseLoadControl::Attributes::LoadControlPrograms::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeLoadControlProgramsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = DemandResponseLoadControl::Attributes::LoadControlPrograms::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - -- (void)readAttributeNumberOfLoadControlProgramsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfLoadControlPrograms::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)subscribeAttributeNumberOfLoadControlProgramsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfLoadControlPrograms::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeNumberOfLoadControlProgramsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfLoadControlPrograms::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - -- (void)readAttributeEventsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeHeaterTypesWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::Events::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::HeaterTypes::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51295,11 +51309,11 @@ - (void)readAttributeEventsWithCompletion:(void (^)(NSArray * _Nullable value, N completion:completion]; } -- (void)subscribeAttributeEventsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeHeaterTypesWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DemandResponseLoadControl::Attributes::Events::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::HeaterTypes::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51309,9 +51323,9 @@ - (void)subscribeAttributeEventsWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeEventsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeHeaterTypesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::Events::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::HeaterTypes::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -51320,9 +51334,9 @@ + (void)readAttributeEventsWithClusterStateCache:(MTRClusterStateCacheContainer completion:completion]; } -- (void)readAttributeActiveEventsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeHeatDemandWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::ActiveEvents::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::HeatDemand::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51331,11 +51345,11 @@ - (void)readAttributeActiveEventsWithCompletion:(void (^)(NSArray * _Nullable va completion:completion]; } -- (void)subscribeAttributeActiveEventsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeHeatDemandWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DemandResponseLoadControl::Attributes::ActiveEvents::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::HeatDemand::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51345,9 +51359,9 @@ - (void)subscribeAttributeActiveEventsWithParams:(MTRSubscribeParams * _Nonnull) subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeActiveEventsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeHeatDemandWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::ActiveEvents::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::HeatDemand::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -51356,9 +51370,9 @@ + (void)readAttributeActiveEventsWithClusterStateCache:(MTRClusterStateCacheCont completion:completion]; } -- (void)readAttributeNumberOfEventsPerProgramWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeTankVolumeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfEventsPerProgram::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::TankVolume::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51367,11 +51381,11 @@ - (void)readAttributeNumberOfEventsPerProgramWithCompletion:(void (^)(NSNumber * completion:completion]; } -- (void)subscribeAttributeNumberOfEventsPerProgramWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeTankVolumeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfEventsPerProgram::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::TankVolume::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51381,9 +51395,9 @@ - (void)subscribeAttributeNumberOfEventsPerProgramWithParams:(MTRSubscribeParams subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeNumberOfEventsPerProgramWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeTankVolumeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfEventsPerProgram::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::TankVolume::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -51392,9 +51406,9 @@ + (void)readAttributeNumberOfEventsPerProgramWithClusterStateCache:(MTRClusterSt completion:completion]; } -- (void)readAttributeNumberOfTransitionsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeEstimatedHeatRequiredWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfTransitions::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::EstimatedHeatRequired::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51403,11 +51417,11 @@ - (void)readAttributeNumberOfTransitionsWithCompletion:(void (^)(NSNumber * _Nul completion:completion]; } -- (void)subscribeAttributeNumberOfTransitionsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeEstimatedHeatRequiredWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfTransitions::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::EstimatedHeatRequired::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51417,9 +51431,9 @@ - (void)subscribeAttributeNumberOfTransitionsWithParams:(MTRSubscribeParams * _N subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeNumberOfTransitionsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeEstimatedHeatRequiredWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfTransitions::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::EstimatedHeatRequired::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -51428,9 +51442,9 @@ + (void)readAttributeNumberOfTransitionsWithClusterStateCache:(MTRClusterStateCa completion:completion]; } -- (void)readAttributeDefaultRandomStartWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeTankPercentageWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomStart::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::TankPercentage::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51439,39 +51453,11 @@ - (void)readAttributeDefaultRandomStartWithCompletion:(void (^)(NSNumber * _Null completion:completion]; } -- (void)writeAttributeDefaultRandomStartWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeDefaultRandomStartWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; -} -- (void)writeAttributeDefaultRandomStartWithValue:(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 = DemandResponseLoadControl::Attributes::DefaultRandomStart::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)subscribeAttributeDefaultRandomStartWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeTankPercentageWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomStart::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::TankPercentage::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51481,9 +51467,9 @@ - (void)subscribeAttributeDefaultRandomStartWithParams:(MTRSubscribeParams * _No subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeDefaultRandomStartWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeTankPercentageWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomStart::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::TankPercentage::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -51492,9 +51478,9 @@ + (void)readAttributeDefaultRandomStartWithClusterStateCache:(MTRClusterStateCac completion:completion]; } -- (void)readAttributeDefaultRandomDurationWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeBoostStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomDuration::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::BoostState::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51503,39 +51489,11 @@ - (void)readAttributeDefaultRandomDurationWithCompletion:(void (^)(NSNumber * _N completion:completion]; } -- (void)writeAttributeDefaultRandomDurationWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeDefaultRandomDurationWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; -} -- (void)writeAttributeDefaultRandomDurationWithValue:(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 = DemandResponseLoadControl::Attributes::DefaultRandomDuration::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)subscribeAttributeDefaultRandomDurationWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeBoostStateWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomDuration::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::BoostState::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51545,9 +51503,9 @@ - (void)subscribeAttributeDefaultRandomDurationWithParams:(MTRSubscribeParams * subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeDefaultRandomDurationWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeBoostStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomDuration::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::BoostState::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -51558,7 +51516,7 @@ + (void)readAttributeDefaultRandomDurationWithClusterStateCache:(MTRClusterState - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51571,7 +51529,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DemandResponseLoadControl::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51583,7 +51541,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -51594,7 +51552,7 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51607,7 +51565,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DemandResponseLoadControl::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51619,7 +51577,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -51630,7 +51588,7 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::EventList::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51643,7 +51601,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DemandResponseLoadControl::Attributes::EventList::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51655,7 +51613,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::EventList::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -51666,7 +51624,7 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::AttributeList::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51679,7 +51637,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DemandResponseLoadControl::Attributes::AttributeList::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51691,7 +51649,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::AttributeList::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -51702,7 +51660,7 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::FeatureMap::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51715,7 +51673,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DemandResponseLoadControl::Attributes::FeatureMap::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51727,7 +51685,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::FeatureMap::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -51738,7 +51696,7 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51751,7 +51709,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DemandResponseLoadControl::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51763,7 +51721,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DemandResponseLoadControl::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = WaterHeaterManagement::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -51774,12 +51732,12 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end -@implementation MTRBaseClusterMessages +@implementation MTRBaseClusterDemandResponseLoadControl -- (void)presentMessagesRequestWithParams:(MTRMessagesClusterPresentMessagesRequestParams *)params completion:(MTRStatusCompletion)completion +- (void)registerLoadControlProgramRequestWithParams:(MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams *)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTRMessagesClusterPresentMessagesRequestParams + params = [[MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams alloc] init]; } @@ -51789,7 +51747,7 @@ - (void)presentMessagesRequestWithParams:(MTRMessagesClusterPresentMessagesReque auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = Messages::Commands::PresentMessagesRequest::Type; + using RequestType = DemandResponseLoadControl::Commands::RegisterLoadControlProgramRequest::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) @@ -51800,10 +51758,10 @@ - (void)presentMessagesRequestWithParams:(MTRMessagesClusterPresentMessagesReque queue:self.callbackQueue completion:responseHandler]; } -- (void)cancelMessagesRequestWithParams:(MTRMessagesClusterCancelMessagesRequestParams *)params completion:(MTRStatusCompletion)completion +- (void)unregisterLoadControlProgramRequestWithParams:(MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams *)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTRMessagesClusterCancelMessagesRequestParams + params = [[MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams alloc] init]; } @@ -51813,7 +51771,7 @@ - (void)cancelMessagesRequestWithParams:(MTRMessagesClusterCancelMessagesRequest auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = Messages::Commands::CancelMessagesRequest::Type; + using RequestType = DemandResponseLoadControl::Commands::UnregisterLoadControlProgramRequest::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) @@ -51824,82 +51782,86 @@ - (void)cancelMessagesRequestWithParams:(MTRMessagesClusterCancelMessagesRequest queue:self.callbackQueue completion:responseHandler]; } - -- (void)readAttributeMessagesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)addLoadControlEventRequestWithParams:(MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams *)params completion:(MTRStatusCompletion)completion { - using TypeInfo = Messages::Attributes::Messages::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} + if (params == nil) { + params = [[MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams + alloc] init]; + } -- (void)subscribeAttributeMessagesWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = Messages::Attributes::Messages::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; -+ (void)readAttributeMessagesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = Messages::Attributes::Messages::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; -- (void)readAttributeActiveMessageIDsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = Messages::Attributes::ActiveMessageIDs::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil + using RequestType = DemandResponseLoadControl::Commands::AddLoadControlEventRequest::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:completion]; + completion:responseHandler]; } - -- (void)subscribeAttributeActiveMessageIDsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)removeLoadControlEventRequestWithParams:(MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams *)params completion:(MTRStatusCompletion)completion { - using TypeInfo = Messages::Attributes::ActiveMessageIDs::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} + if (params == nil) { + params = [[MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams + alloc] init]; + } -+ (void)readAttributeActiveMessageIDsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DemandResponseLoadControl::Commands::RemoveLoadControlEventRequest::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)clearLoadControlEventsRequestWithCompletion:(MTRStatusCompletion)completion { - using TypeInfo = Messages::Attributes::ActiveMessageIDs::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; + [self clearLoadControlEventsRequestWithParams:nil completion:completion]; +} +- (void)clearLoadControlEventsRequestWithParams:(MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DemandResponseLoadControl::Commands::ClearLoadControlEventsRequest::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)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeLoadControlProgramsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Messages::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::LoadControlPrograms::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51908,11 +51870,11 @@ - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nul completion:completion]; } -- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeLoadControlProgramsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = Messages::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::LoadControlPrograms::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51922,9 +51884,9 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeLoadControlProgramsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Messages::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::LoadControlPrograms::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -51933,9 +51895,9 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC completion:completion]; } -- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeNumberOfLoadControlProgramsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Messages::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfLoadControlPrograms::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51944,11 +51906,11 @@ - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Null completion:completion]; } -- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeNumberOfLoadControlProgramsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = Messages::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfLoadControlPrograms::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51958,9 +51920,9 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeNumberOfLoadControlProgramsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Messages::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfLoadControlPrograms::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -51969,9 +51931,9 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa completion:completion]; } -- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeEventsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Messages::Attributes::EventList::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::Events::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51980,11 +51942,11 @@ - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value completion:completion]; } -- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeEventsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = Messages::Attributes::EventList::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::Events::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -51994,9 +51956,9 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeEventsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Messages::Attributes::EventList::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::Events::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52005,9 +51967,9 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain completion:completion]; } -- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeActiveEventsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Messages::Attributes::AttributeList::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::ActiveEvents::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52016,11 +51978,11 @@ - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable v completion:completion]; } -- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeActiveEventsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = Messages::Attributes::AttributeList::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::ActiveEvents::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52030,9 +51992,9 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeActiveEventsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Messages::Attributes::AttributeList::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::ActiveEvents::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52041,9 +52003,9 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon completion:completion]; } -- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeNumberOfEventsPerProgramWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Messages::Attributes::FeatureMap::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfEventsPerProgram::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52052,11 +52014,11 @@ - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable val completion:completion]; } -- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeNumberOfEventsPerProgramWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = Messages::Attributes::FeatureMap::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfEventsPerProgram::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52066,9 +52028,9 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeNumberOfEventsPerProgramWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Messages::Attributes::FeatureMap::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfEventsPerProgram::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52077,9 +52039,9 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai completion:completion]; } -- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeNumberOfTransitionsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Messages::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfTransitions::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52088,11 +52050,11 @@ - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullabl completion:completion]; } -- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeNumberOfTransitionsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = Messages::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfTransitions::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52102,9 +52064,9 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeNumberOfTransitionsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Messages::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::NumberOfTransitions::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52113,231 +52075,114 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC completion:completion]; } -@end - -@implementation MTRBaseClusterDeviceEnergyManagement - -- (void)powerAdjustRequestWithParams:(MTRDeviceEnergyManagementClusterPowerAdjustRequestParams *)params completion:(MTRStatusCompletion)completion +- (void)readAttributeDefaultRandomStartWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - if (params == nil) { - params = [[MTRDeviceEnergyManagementClusterPowerAdjustRequestParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = DeviceEnergyManagement::Commands::PowerAdjustRequest::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil + using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomStart::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil queue:self.callbackQueue - completion:responseHandler]; + completion:completion]; } -- (void)cancelPowerAdjustRequestWithCompletion:(MTRStatusCompletion)completion + +- (void)writeAttributeDefaultRandomStartWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion { - [self cancelPowerAdjustRequestWithParams:nil completion:completion]; + [self writeAttributeDefaultRandomStartWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; } -- (void)cancelPowerAdjustRequestWithParams:(MTRDeviceEnergyManagementClusterCancelPowerAdjustRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)writeAttributeDefaultRandomStartWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion { - if (params == nil) { - params = [[MTRDeviceEnergyManagementClusterCancelPowerAdjustRequestParams - alloc] init]; - } + // Make a copy of params before we go async. + params = [params copy]; + value = [value copy]; - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; + 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); + } + } - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + ListFreer listFreer; + using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomStart::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.unsignedCharValue; - using RequestType = DeviceEnergyManagement::Commands::CancelPowerAdjustRequest::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]; + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); } -- (void)startTimeAdjustRequestWithParams:(MTRDeviceEnergyManagementClusterStartTimeAdjustRequestParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDeviceEnergyManagementClusterStartTimeAdjustRequestParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = DeviceEnergyManagement::Commands::StartTimeAdjustRequest::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)pauseRequestWithParams:(MTRDeviceEnergyManagementClusterPauseRequestParams *)params completion:(MTRStatusCompletion)completion +- (void)subscribeAttributeDefaultRandomStartWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - if (params == nil) { - params = [[MTRDeviceEnergyManagementClusterPauseRequestParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = DeviceEnergyManagement::Commands::PauseRequest::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]; + using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomStart::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; } -- (void)resumeRequestWithCompletion:(MTRStatusCompletion)completion + ++ (void)readAttributeDefaultRandomStartWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - [self resumeRequestWithParams:nil completion:completion]; + using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomStart::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; } -- (void)resumeRequestWithParams:(MTRDeviceEnergyManagementClusterResumeRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDeviceEnergyManagementClusterResumeRequestParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = DeviceEnergyManagement::Commands::ResumeRequest::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)modifyForecastRequestWithParams:(MTRDeviceEnergyManagementClusterModifyForecastRequestParams *)params completion:(MTRStatusCompletion)completion +- (void)readAttributeDefaultRandomDurationWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - if (params == nil) { - params = [[MTRDeviceEnergyManagementClusterModifyForecastRequestParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = DeviceEnergyManagement::Commands::ModifyForecastRequest::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil + using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomDuration::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil queue:self.callbackQueue - completion:responseHandler]; + completion:completion]; } -- (void)requestConstraintBasedForecastWithParams:(MTRDeviceEnergyManagementClusterRequestConstraintBasedForecastParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDeviceEnergyManagementClusterRequestConstraintBasedForecastParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = DeviceEnergyManagement::Commands::RequestConstraintBasedForecast::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)cancelRequestWithCompletion:(MTRStatusCompletion)completion +- (void)writeAttributeDefaultRandomDurationWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion { - [self cancelRequestWithParams:nil completion:completion]; + [self writeAttributeDefaultRandomDurationWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; } -- (void)cancelRequestWithParams:(MTRDeviceEnergyManagementClusterCancelRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)writeAttributeDefaultRandomDurationWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion { - if (params == nil) { - params = [[MTRDeviceEnergyManagementClusterCancelRequestParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; + // Make a copy of params before we go async. + params = [params copy]; + value = [value copy]; - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + 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); + } + } - using RequestType = DeviceEnergyManagement::Commands::CancelRequest::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]; -} + ListFreer listFreer; + using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomDuration::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.unsignedCharValue; -- (void)readAttributeESATypeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = DeviceEnergyManagement::Attributes::ESAType::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); } -- (void)subscribeAttributeESATypeWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeDefaultRandomDurationWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagement::Attributes::ESAType::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomDuration::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52347,9 +52192,9 @@ - (void)subscribeAttributeESATypeWithParams:(MTRSubscribeParams * _Nonnull)param subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeESATypeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeDefaultRandomDurationWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::ESAType::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::DefaultRandomDuration::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52358,9 +52203,9 @@ + (void)readAttributeESATypeWithClusterStateCache:(MTRClusterStateCacheContainer completion:completion]; } -- (void)readAttributeESACanGenerateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::ESACanGenerate::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52369,11 +52214,11 @@ - (void)readAttributeESACanGenerateWithCompletion:(void (^)(NSNumber * _Nullable completion:completion]; } -- (void)subscribeAttributeESACanGenerateWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagement::Attributes::ESACanGenerate::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52383,9 +52228,9 @@ - (void)subscribeAttributeESACanGenerateWithParams:(MTRSubscribeParams * _Nonnul subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeESACanGenerateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::ESACanGenerate::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52394,9 +52239,9 @@ + (void)readAttributeESACanGenerateWithClusterStateCache:(MTRClusterStateCacheCo completion:completion]; } -- (void)readAttributeESAStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::ESAState::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52405,11 +52250,11 @@ - (void)readAttributeESAStateWithCompletion:(void (^)(NSNumber * _Nullable value completion:completion]; } -- (void)subscribeAttributeESAStateWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagement::Attributes::ESAState::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52419,9 +52264,9 @@ - (void)subscribeAttributeESAStateWithParams:(MTRSubscribeParams * _Nonnull)para subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeESAStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::ESAState::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52430,9 +52275,9 @@ + (void)readAttributeESAStateWithClusterStateCache:(MTRClusterStateCacheContaine completion:completion]; } -- (void)readAttributeAbsMinPowerWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::AbsMinPower::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52441,11 +52286,11 @@ - (void)readAttributeAbsMinPowerWithCompletion:(void (^)(NSNumber * _Nullable va completion:completion]; } -- (void)subscribeAttributeAbsMinPowerWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagement::Attributes::AbsMinPower::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52455,9 +52300,9 @@ - (void)subscribeAttributeAbsMinPowerWithParams:(MTRSubscribeParams * _Nonnull)p subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeAbsMinPowerWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::AbsMinPower::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52466,9 +52311,9 @@ + (void)readAttributeAbsMinPowerWithClusterStateCache:(MTRClusterStateCacheConta completion:completion]; } -- (void)readAttributeAbsMaxPowerWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::AbsMaxPower::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52477,11 +52322,11 @@ - (void)readAttributeAbsMaxPowerWithCompletion:(void (^)(NSNumber * _Nullable va completion:completion]; } -- (void)subscribeAttributeAbsMaxPowerWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagement::Attributes::AbsMaxPower::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52491,9 +52336,9 @@ - (void)subscribeAttributeAbsMaxPowerWithParams:(MTRSubscribeParams * _Nonnull)p subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeAbsMaxPowerWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::AbsMaxPower::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52502,9 +52347,9 @@ + (void)readAttributeAbsMaxPowerWithClusterStateCache:(MTRClusterStateCacheConta completion:completion]; } -- (void)readAttributePowerAdjustmentCapabilityWithCompletion:(void (^)(MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::PowerAdjustmentCapability::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52513,11 +52358,11 @@ - (void)readAttributePowerAdjustmentCapabilityWithCompletion:(void (^)(MTRDevice completion:completion]; } -- (void)subscribeAttributePowerAdjustmentCapabilityWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagement::Attributes::PowerAdjustmentCapability::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52527,9 +52372,9 @@ - (void)subscribeAttributePowerAdjustmentCapabilityWithParams:(MTRSubscribeParam subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributePowerAdjustmentCapabilityWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::PowerAdjustmentCapability::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52538,9 +52383,9 @@ + (void)readAttributePowerAdjustmentCapabilityWithClusterStateCache:(MTRClusterS completion:completion]; } -- (void)readAttributeForecastWithCompletion:(void (^)(MTRDeviceEnergyManagementClusterForecastStruct * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::Forecast::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52549,11 +52394,11 @@ - (void)readAttributeForecastWithCompletion:(void (^)(MTRDeviceEnergyManagementC completion:completion]; } -- (void)subscribeAttributeForecastWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(MTRDeviceEnergyManagementClusterForecastStruct * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagement::Attributes::Forecast::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52563,9 +52408,9 @@ - (void)subscribeAttributeForecastWithParams:(MTRSubscribeParams * _Nonnull)para subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeForecastWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRDeviceEnergyManagementClusterForecastStruct * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::Forecast::TypeInfo; + using TypeInfo = DemandResponseLoadControl::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52574,9 +52419,62 @@ + (void)readAttributeForecastWithClusterStateCache:(MTRClusterStateCacheContaine completion:completion]; } -- (void)readAttributeOptOutStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +@end + +@implementation MTRBaseClusterMessages + +- (void)presentMessagesRequestWithParams:(MTRMessagesClusterPresentMessagesRequestParams *)params completion:(MTRStatusCompletion)completion { - using TypeInfo = DeviceEnergyManagement::Attributes::OptOutState::TypeInfo; + if (params == nil) { + params = [[MTRMessagesClusterPresentMessagesRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = Messages::Commands::PresentMessagesRequest::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)cancelMessagesRequestWithParams:(MTRMessagesClusterCancelMessagesRequestParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRMessagesClusterCancelMessagesRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = Messages::Commands::CancelMessagesRequest::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)readAttributeMessagesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = Messages::Attributes::Messages::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52585,11 +52483,11 @@ - (void)readAttributeOptOutStateWithCompletion:(void (^)(NSNumber * _Nullable va completion:completion]; } -- (void)subscribeAttributeOptOutStateWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeMessagesWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagement::Attributes::OptOutState::TypeInfo; + using TypeInfo = Messages::Attributes::Messages::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52599,9 +52497,45 @@ - (void)subscribeAttributeOptOutStateWithParams:(MTRSubscribeParams * _Nonnull)p subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeOptOutStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeMessagesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::OptOutState::TypeInfo; + using TypeInfo = Messages::Attributes::Messages::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeActiveMessageIDsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = Messages::Attributes::ActiveMessageIDs::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeActiveMessageIDsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = Messages::Attributes::ActiveMessageIDs::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeActiveMessageIDsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = Messages::Attributes::ActiveMessageIDs::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52612,7 +52546,7 @@ + (void)readAttributeOptOutStateWithClusterStateCache:(MTRClusterStateCacheConta - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = Messages::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52625,7 +52559,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagement::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = Messages::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52637,7 +52571,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = Messages::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52648,7 +52582,7 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = Messages::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52661,7 +52595,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagement::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = Messages::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52673,7 +52607,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = Messages::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52684,7 +52618,7 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::EventList::TypeInfo; + using TypeInfo = Messages::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52697,7 +52631,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagement::Attributes::EventList::TypeInfo; + using TypeInfo = Messages::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52709,7 +52643,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::EventList::TypeInfo; + using TypeInfo = Messages::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52720,7 +52654,7 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::AttributeList::TypeInfo; + using TypeInfo = Messages::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52733,7 +52667,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagement::Attributes::AttributeList::TypeInfo; + using TypeInfo = Messages::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52745,7 +52679,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::AttributeList::TypeInfo; + using TypeInfo = Messages::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52756,7 +52690,7 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::FeatureMap::TypeInfo; + using TypeInfo = Messages::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52769,7 +52703,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagement::Attributes::FeatureMap::TypeInfo; + using TypeInfo = Messages::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52781,7 +52715,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::FeatureMap::TypeInfo; + using TypeInfo = Messages::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52792,7 +52726,7 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = Messages::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52805,7 +52739,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagement::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = Messages::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -52817,7 +52751,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagement::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = Messages::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -52828,16 +52762,40 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end -@implementation MTRBaseClusterEnergyEVSE +@implementation MTRBaseClusterDeviceEnergyManagement -- (void)disableWithCompletion:(MTRStatusCompletion)completion +- (void)powerAdjustRequestWithParams:(MTRDeviceEnergyManagementClusterPowerAdjustRequestParams *)params completion:(MTRStatusCompletion)completion { - [self disableWithParams:nil completion:completion]; + if (params == nil) { + params = [[MTRDeviceEnergyManagementClusterPowerAdjustRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DeviceEnergyManagement::Commands::PowerAdjustRequest::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)disableWithParams:(MTREnergyEVSEClusterDisableParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)cancelPowerAdjustRequestWithCompletion:(MTRStatusCompletion)completion +{ + [self cancelPowerAdjustRequestWithParams:nil completion:completion]; +} +- (void)cancelPowerAdjustRequestWithParams:(MTRDeviceEnergyManagementClusterCancelPowerAdjustRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTREnergyEVSEClusterDisableParams + params = [[MTRDeviceEnergyManagementClusterCancelPowerAdjustRequestParams alloc] init]; } @@ -52846,11 +52804,8 @@ - (void)disableWithParams:(MTREnergyEVSEClusterDisableParams * _Nullable)params }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - using RequestType = EnergyEvse::Commands::Disable::Type; + using RequestType = DeviceEnergyManagement::Commands::CancelPowerAdjustRequest::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) @@ -52861,10 +52816,10 @@ - (void)disableWithParams:(MTREnergyEVSEClusterDisableParams * _Nullable)params queue:self.callbackQueue completion:responseHandler]; } -- (void)enableChargingWithParams:(MTREnergyEVSEClusterEnableChargingParams *)params completion:(MTRStatusCompletion)completion +- (void)startTimeAdjustRequestWithParams:(MTRDeviceEnergyManagementClusterStartTimeAdjustRequestParams *)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTREnergyEVSEClusterEnableChargingParams + params = [[MTRDeviceEnergyManagementClusterStartTimeAdjustRequestParams alloc] init]; } @@ -52873,11 +52828,8 @@ - (void)enableChargingWithParams:(MTREnergyEVSEClusterEnableChargingParams *)par }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - using RequestType = EnergyEvse::Commands::EnableCharging::Type; + using RequestType = DeviceEnergyManagement::Commands::StartTimeAdjustRequest::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) @@ -52888,10 +52840,10 @@ - (void)enableChargingWithParams:(MTREnergyEVSEClusterEnableChargingParams *)par queue:self.callbackQueue completion:responseHandler]; } -- (void)enableDischargingWithParams:(MTREnergyEVSEClusterEnableDischargingParams *)params completion:(MTRStatusCompletion)completion +- (void)pauseRequestWithParams:(MTRDeviceEnergyManagementClusterPauseRequestParams *)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTREnergyEVSEClusterEnableDischargingParams + params = [[MTRDeviceEnergyManagementClusterPauseRequestParams alloc] init]; } @@ -52900,11 +52852,8 @@ - (void)enableDischargingWithParams:(MTREnergyEVSEClusterEnableDischargingParams }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - using RequestType = EnergyEvse::Commands::EnableDischarging::Type; + using RequestType = DeviceEnergyManagement::Commands::PauseRequest::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) @@ -52915,14 +52864,14 @@ - (void)enableDischargingWithParams:(MTREnergyEVSEClusterEnableDischargingParams queue:self.callbackQueue completion:responseHandler]; } -- (void)startDiagnosticsWithCompletion:(MTRStatusCompletion)completion +- (void)resumeRequestWithCompletion:(MTRStatusCompletion)completion { - [self startDiagnosticsWithParams:nil completion:completion]; + [self resumeRequestWithParams:nil completion:completion]; } -- (void)startDiagnosticsWithParams:(MTREnergyEVSEClusterStartDiagnosticsParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)resumeRequestWithParams:(MTRDeviceEnergyManagementClusterResumeRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTREnergyEVSEClusterStartDiagnosticsParams + params = [[MTRDeviceEnergyManagementClusterResumeRequestParams alloc] init]; } @@ -52931,11 +52880,8 @@ - (void)startDiagnosticsWithParams:(MTREnergyEVSEClusterStartDiagnosticsParams * }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - using RequestType = EnergyEvse::Commands::StartDiagnostics::Type; + using RequestType = DeviceEnergyManagement::Commands::ResumeRequest::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) @@ -52946,10 +52892,10 @@ - (void)startDiagnosticsWithParams:(MTREnergyEVSEClusterStartDiagnosticsParams * queue:self.callbackQueue completion:responseHandler]; } -- (void)setTargetsWithParams:(MTREnergyEVSEClusterSetTargetsParams *)params completion:(MTRStatusCompletion)completion +- (void)modifyForecastRequestWithParams:(MTRDeviceEnergyManagementClusterModifyForecastRequestParams *)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTREnergyEVSEClusterSetTargetsParams + params = [[MTRDeviceEnergyManagementClusterModifyForecastRequestParams alloc] init]; } @@ -52958,11 +52904,8 @@ - (void)setTargetsWithParams:(MTREnergyEVSEClusterSetTargetsParams *)params comp }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - using RequestType = EnergyEvse::Commands::SetTargets::Type; + using RequestType = DeviceEnergyManagement::Commands::ModifyForecastRequest::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) @@ -52973,45 +52916,38 @@ - (void)setTargetsWithParams:(MTREnergyEVSEClusterSetTargetsParams *)params comp queue:self.callbackQueue completion:responseHandler]; } -- (void)getTargetsWithCompletion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion -{ - [self getTargetsWithParams:nil completion:completion]; -} -- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams * _Nullable)params completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion +- (void)requestConstraintBasedForecastWithParams:(MTRDeviceEnergyManagementClusterRequestConstraintBasedForecastParams *)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTREnergyEVSEClusterGetTargetsParams + params = [[MTRDeviceEnergyManagementClusterRequestConstraintBasedForecastParams alloc] init]; } auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(response, error); + completion(error); }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - using RequestType = EnergyEvse::Commands::GetTargets::Type; + using RequestType = DeviceEnergyManagement::Commands::RequestConstraintBasedForecast::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) commandPayload:params timedInvokeTimeout:timedInvokeTimeoutMs serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTREnergyEVSEClusterGetTargetsResponseParams.class + responseClass:nil queue:self.callbackQueue completion:responseHandler]; } -- (void)clearTargetsWithCompletion:(MTRStatusCompletion)completion +- (void)cancelRequestWithCompletion:(MTRStatusCompletion)completion { - [self clearTargetsWithParams:nil completion:completion]; + [self cancelRequestWithParams:nil completion:completion]; } -- (void)clearTargetsWithParams:(MTREnergyEVSEClusterClearTargetsParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)cancelRequestWithParams:(MTRDeviceEnergyManagementClusterCancelRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTREnergyEVSEClusterClearTargetsParams + params = [[MTRDeviceEnergyManagementClusterCancelRequestParams alloc] init]; } @@ -53020,11 +52956,8 @@ - (void)clearTargetsWithParams:(MTREnergyEVSEClusterClearTargetsParams * _Nullab }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - using RequestType = EnergyEvse::Commands::ClearTargets::Type; + using RequestType = DeviceEnergyManagement::Commands::CancelRequest::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) @@ -53036,9 +52969,9 @@ - (void)clearTargetsWithParams:(MTREnergyEVSEClusterClearTargetsParams * _Nullab completion:responseHandler]; } -- (void)readAttributeStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeESATypeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::State::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::ESAType::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53047,11 +52980,11 @@ - (void)readAttributeStateWithCompletion:(void (^)(NSNumber * _Nullable value, N completion:completion]; } -- (void)subscribeAttributeStateWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeESATypeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::State::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::ESAType::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53061,9 +52994,9 @@ - (void)subscribeAttributeStateWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeESATypeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::State::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::ESAType::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53072,9 +53005,9 @@ + (void)readAttributeStateWithClusterStateCache:(MTRClusterStateCacheContainer * completion:completion]; } -- (void)readAttributeSupplyStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeESACanGenerateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::SupplyState::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::ESACanGenerate::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53083,11 +53016,11 @@ - (void)readAttributeSupplyStateWithCompletion:(void (^)(NSNumber * _Nullable va completion:completion]; } -- (void)subscribeAttributeSupplyStateWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeESACanGenerateWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::SupplyState::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::ESACanGenerate::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53097,9 +53030,9 @@ - (void)subscribeAttributeSupplyStateWithParams:(MTRSubscribeParams * _Nonnull)p subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeSupplyStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeESACanGenerateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::SupplyState::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::ESACanGenerate::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53108,9 +53041,9 @@ + (void)readAttributeSupplyStateWithClusterStateCache:(MTRClusterStateCacheConta completion:completion]; } -- (void)readAttributeFaultStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeESAStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::FaultState::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::ESAState::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53119,11 +53052,11 @@ - (void)readAttributeFaultStateWithCompletion:(void (^)(NSNumber * _Nullable val completion:completion]; } -- (void)subscribeAttributeFaultStateWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeESAStateWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::FaultState::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::ESAState::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53133,9 +53066,9 @@ - (void)subscribeAttributeFaultStateWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeFaultStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeESAStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::FaultState::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::ESAState::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53144,9 +53077,9 @@ + (void)readAttributeFaultStateWithClusterStateCache:(MTRClusterStateCacheContai completion:completion]; } -- (void)readAttributeChargingEnabledUntilWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeAbsMinPowerWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::ChargingEnabledUntil::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::AbsMinPower::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53155,11 +53088,11 @@ - (void)readAttributeChargingEnabledUntilWithCompletion:(void (^)(NSNumber * _Nu completion:completion]; } -- (void)subscribeAttributeChargingEnabledUntilWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeAbsMinPowerWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::ChargingEnabledUntil::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::AbsMinPower::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53169,9 +53102,9 @@ - (void)subscribeAttributeChargingEnabledUntilWithParams:(MTRSubscribeParams * _ subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeChargingEnabledUntilWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeAbsMinPowerWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::ChargingEnabledUntil::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::AbsMinPower::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53180,9 +53113,9 @@ + (void)readAttributeChargingEnabledUntilWithClusterStateCache:(MTRClusterStateC completion:completion]; } -- (void)readAttributeDischargingEnabledUntilWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeAbsMaxPowerWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::DischargingEnabledUntil::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::AbsMaxPower::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53191,11 +53124,11 @@ - (void)readAttributeDischargingEnabledUntilWithCompletion:(void (^)(NSNumber * completion:completion]; } -- (void)subscribeAttributeDischargingEnabledUntilWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeAbsMaxPowerWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::DischargingEnabledUntil::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::AbsMaxPower::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53205,9 +53138,9 @@ - (void)subscribeAttributeDischargingEnabledUntilWithParams:(MTRSubscribeParams subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeDischargingEnabledUntilWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeAbsMaxPowerWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::DischargingEnabledUntil::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::AbsMaxPower::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53216,9 +53149,9 @@ + (void)readAttributeDischargingEnabledUntilWithClusterStateCache:(MTRClusterSta completion:completion]; } -- (void)readAttributeCircuitCapacityWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributePowerAdjustmentCapabilityWithCompletion:(void (^)(MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::CircuitCapacity::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::PowerAdjustmentCapability::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53227,11 +53160,11 @@ - (void)readAttributeCircuitCapacityWithCompletion:(void (^)(NSNumber * _Nullabl completion:completion]; } -- (void)subscribeAttributeCircuitCapacityWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributePowerAdjustmentCapabilityWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::CircuitCapacity::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::PowerAdjustmentCapability::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53241,9 +53174,9 @@ - (void)subscribeAttributeCircuitCapacityWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeCircuitCapacityWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributePowerAdjustmentCapabilityWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::CircuitCapacity::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::PowerAdjustmentCapability::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53252,9 +53185,9 @@ + (void)readAttributeCircuitCapacityWithClusterStateCache:(MTRClusterStateCacheC completion:completion]; } -- (void)readAttributeMinimumChargeCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeForecastWithCompletion:(void (^)(MTRDeviceEnergyManagementClusterForecastStruct * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::MinimumChargeCurrent::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::Forecast::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53263,11 +53196,11 @@ - (void)readAttributeMinimumChargeCurrentWithCompletion:(void (^)(NSNumber * _Nu completion:completion]; } -- (void)subscribeAttributeMinimumChargeCurrentWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeForecastWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRDeviceEnergyManagementClusterForecastStruct * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::MinimumChargeCurrent::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::Forecast::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53277,9 +53210,9 @@ - (void)subscribeAttributeMinimumChargeCurrentWithParams:(MTRSubscribeParams * _ subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeMinimumChargeCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeForecastWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRDeviceEnergyManagementClusterForecastStruct * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::MinimumChargeCurrent::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::Forecast::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53288,9 +53221,9 @@ + (void)readAttributeMinimumChargeCurrentWithClusterStateCache:(MTRClusterStateC completion:completion]; } -- (void)readAttributeMaximumChargeCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeOptOutStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::MaximumChargeCurrent::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::OptOutState::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53299,11 +53232,11 @@ - (void)readAttributeMaximumChargeCurrentWithCompletion:(void (^)(NSNumber * _Nu completion:completion]; } -- (void)subscribeAttributeMaximumChargeCurrentWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeOptOutStateWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::MaximumChargeCurrent::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::OptOutState::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53313,9 +53246,9 @@ - (void)subscribeAttributeMaximumChargeCurrentWithParams:(MTRSubscribeParams * _ subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeMaximumChargeCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeOptOutStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::MaximumChargeCurrent::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::OptOutState::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53324,9 +53257,9 @@ + (void)readAttributeMaximumChargeCurrentWithClusterStateCache:(MTRClusterStateC completion:completion]; } -- (void)readAttributeMaximumDischargeCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::MaximumDischargeCurrent::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53335,11 +53268,11 @@ - (void)readAttributeMaximumDischargeCurrentWithCompletion:(void (^)(NSNumber * completion:completion]; } -- (void)subscribeAttributeMaximumDischargeCurrentWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::MaximumDischargeCurrent::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53349,9 +53282,9 @@ - (void)subscribeAttributeMaximumDischargeCurrentWithParams:(MTRSubscribeParams subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeMaximumDischargeCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::MaximumDischargeCurrent::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53360,9 +53293,9 @@ + (void)readAttributeMaximumDischargeCurrentWithClusterStateCache:(MTRClusterSta completion:completion]; } -- (void)readAttributeUserMaximumChargeCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::UserMaximumChargeCurrent::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53371,39 +53304,11 @@ - (void)readAttributeUserMaximumChargeCurrentWithCompletion:(void (^)(NSNumber * completion:completion]; } -- (void)writeAttributeUserMaximumChargeCurrentWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeUserMaximumChargeCurrentWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; -} -- (void)writeAttributeUserMaximumChargeCurrentWithValue:(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 = EnergyEvse::Attributes::UserMaximumChargeCurrent::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.longLongValue; - - chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); - return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); - std::move(*bridge).DispatchAction(self.device); -} - -- (void)subscribeAttributeUserMaximumChargeCurrentWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::UserMaximumChargeCurrent::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53413,9 +53318,9 @@ - (void)subscribeAttributeUserMaximumChargeCurrentWithParams:(MTRSubscribeParams subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeUserMaximumChargeCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::UserMaximumChargeCurrent::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53424,9 +53329,9 @@ + (void)readAttributeUserMaximumChargeCurrentWithClusterStateCache:(MTRClusterSt completion:completion]; } -- (void)readAttributeRandomizationDelayWindowWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::RandomizationDelayWindow::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53435,39 +53340,11 @@ - (void)readAttributeRandomizationDelayWindowWithCompletion:(void (^)(NSNumber * completion:completion]; } -- (void)writeAttributeRandomizationDelayWindowWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeRandomizationDelayWindowWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; -} -- (void)writeAttributeRandomizationDelayWindowWithValue:(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 = EnergyEvse::Attributes::RandomizationDelayWindow::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; - - chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); - return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); - std::move(*bridge).DispatchAction(self.device); -} - -- (void)subscribeAttributeRandomizationDelayWindowWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::RandomizationDelayWindow::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53477,9 +53354,9 @@ - (void)subscribeAttributeRandomizationDelayWindowWithParams:(MTRSubscribeParams subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeRandomizationDelayWindowWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::RandomizationDelayWindow::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53488,9 +53365,9 @@ + (void)readAttributeRandomizationDelayWindowWithClusterStateCache:(MTRClusterSt completion:completion]; } -- (void)readAttributeNextChargeStartTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::NextChargeStartTime::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53499,11 +53376,11 @@ - (void)readAttributeNextChargeStartTimeWithCompletion:(void (^)(NSNumber * _Nul completion:completion]; } -- (void)subscribeAttributeNextChargeStartTimeWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::NextChargeStartTime::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53513,9 +53390,9 @@ - (void)subscribeAttributeNextChargeStartTimeWithParams:(MTRSubscribeParams * _N subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeNextChargeStartTimeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::NextChargeStartTime::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53524,9 +53401,9 @@ + (void)readAttributeNextChargeStartTimeWithClusterStateCache:(MTRClusterStateCa completion:completion]; } -- (void)readAttributeNextChargeTargetTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::NextChargeTargetTime::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53535,11 +53412,11 @@ - (void)readAttributeNextChargeTargetTimeWithCompletion:(void (^)(NSNumber * _Nu completion:completion]; } -- (void)subscribeAttributeNextChargeTargetTimeWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::NextChargeTargetTime::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53549,9 +53426,9 @@ - (void)subscribeAttributeNextChargeTargetTimeWithParams:(MTRSubscribeParams * _ subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeNextChargeTargetTimeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::NextChargeTargetTime::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53560,9 +53437,9 @@ + (void)readAttributeNextChargeTargetTimeWithClusterStateCache:(MTRClusterStateC completion:completion]; } -- (void)readAttributeNextChargeRequiredEnergyWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::NextChargeRequiredEnergy::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53571,11 +53448,11 @@ - (void)readAttributeNextChargeRequiredEnergyWithCompletion:(void (^)(NSNumber * completion:completion]; } -- (void)subscribeAttributeNextChargeRequiredEnergyWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::NextChargeRequiredEnergy::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53585,9 +53462,9 @@ - (void)subscribeAttributeNextChargeRequiredEnergyWithParams:(MTRSubscribeParams subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeNextChargeRequiredEnergyWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::NextChargeRequiredEnergy::TypeInfo; + using TypeInfo = DeviceEnergyManagement::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53596,9 +53473,219 @@ + (void)readAttributeNextChargeRequiredEnergyWithClusterStateCache:(MTRClusterSt completion:completion]; } -- (void)readAttributeNextChargeTargetSoCWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +@end + +@implementation MTRBaseClusterEnergyEVSE + +- (void)disableWithCompletion:(MTRStatusCompletion)completion { - using TypeInfo = EnergyEvse::Attributes::NextChargeTargetSoC::TypeInfo; + [self disableWithParams:nil completion:completion]; +} +- (void)disableWithParams:(MTREnergyEVSEClusterDisableParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTREnergyEVSEClusterDisableParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = EnergyEvse::Commands::Disable::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)enableChargingWithParams:(MTREnergyEVSEClusterEnableChargingParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTREnergyEVSEClusterEnableChargingParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = EnergyEvse::Commands::EnableCharging::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)enableDischargingWithParams:(MTREnergyEVSEClusterEnableDischargingParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTREnergyEVSEClusterEnableDischargingParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = EnergyEvse::Commands::EnableDischarging::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)startDiagnosticsWithCompletion:(MTRStatusCompletion)completion +{ + [self startDiagnosticsWithParams:nil completion:completion]; +} +- (void)startDiagnosticsWithParams:(MTREnergyEVSEClusterStartDiagnosticsParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTREnergyEVSEClusterStartDiagnosticsParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = EnergyEvse::Commands::StartDiagnostics::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)setTargetsWithParams:(MTREnergyEVSEClusterSetTargetsParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTREnergyEVSEClusterSetTargetsParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = EnergyEvse::Commands::SetTargets::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)getTargetsWithCompletion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + [self getTargetsWithParams:nil completion:completion]; +} +- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams * _Nullable)params completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTREnergyEVSEClusterGetTargetsParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = EnergyEvse::Commands::GetTargets::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTREnergyEVSEClusterGetTargetsResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)clearTargetsWithCompletion:(MTRStatusCompletion)completion +{ + [self clearTargetsWithParams:nil completion:completion]; +} +- (void)clearTargetsWithParams:(MTREnergyEVSEClusterClearTargetsParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTREnergyEVSEClusterClearTargetsParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = EnergyEvse::Commands::ClearTargets::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)readAttributeStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyEvse::Attributes::State::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53607,11 +53694,11 @@ - (void)readAttributeNextChargeTargetSoCWithCompletion:(void (^)(NSNumber * _Nul completion:completion]; } -- (void)subscribeAttributeNextChargeTargetSoCWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeStateWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::NextChargeTargetSoC::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::State::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53621,9 +53708,9 @@ - (void)subscribeAttributeNextChargeTargetSoCWithParams:(MTRSubscribeParams * _N subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeNextChargeTargetSoCWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::NextChargeTargetSoC::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::State::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53632,9 +53719,9 @@ + (void)readAttributeNextChargeTargetSoCWithClusterStateCache:(MTRClusterStateCa completion:completion]; } -- (void)readAttributeApproximateEVEfficiencyWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeSupplyStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::ApproximateEVEfficiency::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::SupplyState::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53643,44 +53730,11 @@ - (void)readAttributeApproximateEVEfficiencyWithCompletion:(void (^)(NSNumber * completion:completion]; } -- (void)writeAttributeApproximateEVEfficiencyWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeApproximateEVEfficiencyWithValue:(NSNumber * _Nullable) value params:nil completion:completion]; -} -- (void)writeAttributeApproximateEVEfficiencyWithValue:(NSNumber * _Nullable)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 = EnergyEvse::Attributes::ApproximateEVEfficiency::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = 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)subscribeAttributeApproximateEVEfficiencyWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeSupplyStateWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::ApproximateEVEfficiency::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::SupplyState::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53690,9 +53744,9 @@ - (void)subscribeAttributeApproximateEVEfficiencyWithParams:(MTRSubscribeParams subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeApproximateEVEfficiencyWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeSupplyStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::ApproximateEVEfficiency::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::SupplyState::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53701,9 +53755,9 @@ + (void)readAttributeApproximateEVEfficiencyWithClusterStateCache:(MTRClusterSta completion:completion]; } -- (void)readAttributeStateOfChargeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeFaultStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::StateOfCharge::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::FaultState::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53712,11 +53766,11 @@ - (void)readAttributeStateOfChargeWithCompletion:(void (^)(NSNumber * _Nullable completion:completion]; } -- (void)subscribeAttributeStateOfChargeWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeFaultStateWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::StateOfCharge::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::FaultState::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53726,9 +53780,9 @@ - (void)subscribeAttributeStateOfChargeWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeStateOfChargeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeFaultStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::StateOfCharge::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::FaultState::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53737,9 +53791,9 @@ + (void)readAttributeStateOfChargeWithClusterStateCache:(MTRClusterStateCacheCon completion:completion]; } -- (void)readAttributeBatteryCapacityWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeChargingEnabledUntilWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::BatteryCapacity::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::ChargingEnabledUntil::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53748,11 +53802,11 @@ - (void)readAttributeBatteryCapacityWithCompletion:(void (^)(NSNumber * _Nullabl completion:completion]; } -- (void)subscribeAttributeBatteryCapacityWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeChargingEnabledUntilWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::BatteryCapacity::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::ChargingEnabledUntil::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53762,9 +53816,9 @@ - (void)subscribeAttributeBatteryCapacityWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeBatteryCapacityWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeChargingEnabledUntilWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::BatteryCapacity::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::ChargingEnabledUntil::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53773,9 +53827,9 @@ + (void)readAttributeBatteryCapacityWithClusterStateCache:(MTRClusterStateCacheC completion:completion]; } -- (void)readAttributeVehicleIDWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeDischargingEnabledUntilWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::VehicleID::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::DischargingEnabledUntil::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53784,11 +53838,11 @@ - (void)readAttributeVehicleIDWithCompletion:(void (^)(NSString * _Nullable valu completion:completion]; } -- (void)subscribeAttributeVehicleIDWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeDischargingEnabledUntilWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::VehicleID::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::DischargingEnabledUntil::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53798,9 +53852,9 @@ - (void)subscribeAttributeVehicleIDWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeVehicleIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeDischargingEnabledUntilWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::VehicleID::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::DischargingEnabledUntil::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53809,9 +53863,9 @@ + (void)readAttributeVehicleIDWithClusterStateCache:(MTRClusterStateCacheContain completion:completion]; } -- (void)readAttributeSessionIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeCircuitCapacityWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::SessionID::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::CircuitCapacity::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53820,11 +53874,11 @@ - (void)readAttributeSessionIDWithCompletion:(void (^)(NSNumber * _Nullable valu completion:completion]; } -- (void)subscribeAttributeSessionIDWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeCircuitCapacityWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::SessionID::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::CircuitCapacity::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53834,9 +53888,9 @@ - (void)subscribeAttributeSessionIDWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeSessionIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeCircuitCapacityWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::SessionID::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::CircuitCapacity::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53845,9 +53899,9 @@ + (void)readAttributeSessionIDWithClusterStateCache:(MTRClusterStateCacheContain completion:completion]; } -- (void)readAttributeSessionDurationWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeMinimumChargeCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::SessionDuration::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::MinimumChargeCurrent::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53856,11 +53910,11 @@ - (void)readAttributeSessionDurationWithCompletion:(void (^)(NSNumber * _Nullabl completion:completion]; } -- (void)subscribeAttributeSessionDurationWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeMinimumChargeCurrentWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::SessionDuration::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::MinimumChargeCurrent::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53870,9 +53924,9 @@ - (void)subscribeAttributeSessionDurationWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeSessionDurationWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeMinimumChargeCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::SessionDuration::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::MinimumChargeCurrent::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53881,9 +53935,9 @@ + (void)readAttributeSessionDurationWithClusterStateCache:(MTRClusterStateCacheC completion:completion]; } -- (void)readAttributeSessionEnergyChargedWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeMaximumChargeCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::SessionEnergyCharged::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::MaximumChargeCurrent::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53892,11 +53946,11 @@ - (void)readAttributeSessionEnergyChargedWithCompletion:(void (^)(NSNumber * _Nu completion:completion]; } -- (void)subscribeAttributeSessionEnergyChargedWithParams:(MTRSubscribeParams * _Nonnull)params +- (void)subscribeAttributeMaximumChargeCurrentWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::SessionEnergyCharged::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::MaximumChargeCurrent::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53906,9 +53960,9 @@ - (void)subscribeAttributeSessionEnergyChargedWithParams:(MTRSubscribeParams * _ subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeSessionEnergyChargedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeMaximumChargeCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::SessionEnergyCharged::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::MaximumChargeCurrent::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53917,9 +53971,9 @@ + (void)readAttributeSessionEnergyChargedWithClusterStateCache:(MTRClusterStateC completion:completion]; } -- (void)readAttributeSessionEnergyDischargedWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeMaximumDischargeCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::SessionEnergyDischarged::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::MaximumDischargeCurrent::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53928,11 +53982,11 @@ - (void)readAttributeSessionEnergyDischargedWithCompletion:(void (^)(NSNumber * completion:completion]; } -- (void)subscribeAttributeSessionEnergyDischargedWithParams:(MTRSubscribeParams * _Nonnull)params +- (void)subscribeAttributeMaximumDischargeCurrentWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::SessionEnergyDischarged::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::MaximumDischargeCurrent::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53942,9 +53996,9 @@ - (void)subscribeAttributeSessionEnergyDischargedWithParams:(MTRSubscribeParams subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeSessionEnergyDischargedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeMaximumDischargeCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::SessionEnergyDischarged::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::MaximumDischargeCurrent::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53953,9 +54007,9 @@ + (void)readAttributeSessionEnergyDischargedWithClusterStateCache:(MTRClusterSta completion:completion]; } -- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeUserMaximumChargeCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::UserMaximumChargeCurrent::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53964,11 +54018,39 @@ - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nul completion:completion]; } -- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)writeAttributeUserMaximumChargeCurrentWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion { - using TypeInfo = EnergyEvse::Attributes::GeneratedCommandList::TypeInfo; + [self writeAttributeUserMaximumChargeCurrentWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; +} +- (void)writeAttributeUserMaximumChargeCurrentWithValue:(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 = EnergyEvse::Attributes::UserMaximumChargeCurrent::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.longLongValue; + + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); +} + +- (void)subscribeAttributeUserMaximumChargeCurrentWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyEvse::Attributes::UserMaximumChargeCurrent::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -53978,9 +54060,9 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeUserMaximumChargeCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::UserMaximumChargeCurrent::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -53989,9 +54071,9 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC completion:completion]; } -- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeRandomizationDelayWindowWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::RandomizationDelayWindow::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54000,11 +54082,39 @@ - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Null completion:completion]; } -- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)writeAttributeRandomizationDelayWindowWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion { - using TypeInfo = EnergyEvse::Attributes::AcceptedCommandList::TypeInfo; + [self writeAttributeRandomizationDelayWindowWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; +} +- (void)writeAttributeRandomizationDelayWindowWithValue:(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 = EnergyEvse::Attributes::RandomizationDelayWindow::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.unsignedIntValue; + + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); +} + +- (void)subscribeAttributeRandomizationDelayWindowWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyEvse::Attributes::RandomizationDelayWindow::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54014,9 +54124,9 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeRandomizationDelayWindowWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::RandomizationDelayWindow::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54025,9 +54135,9 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa completion:completion]; } -- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeNextChargeStartTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::EventList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::NextChargeStartTime::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54036,11 +54146,11 @@ - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value completion:completion]; } -- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeNextChargeStartTimeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::EventList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::NextChargeStartTime::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54050,9 +54160,9 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeNextChargeStartTimeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::EventList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::NextChargeStartTime::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54061,9 +54171,9 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain completion:completion]; } -- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeNextChargeTargetTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::AttributeList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::NextChargeTargetTime::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54072,11 +54182,11 @@ - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable v completion:completion]; } -- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeNextChargeTargetTimeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::AttributeList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::NextChargeTargetTime::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54086,9 +54196,9 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeNextChargeTargetTimeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::AttributeList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::NextChargeTargetTime::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54097,9 +54207,9 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon completion:completion]; } -- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeNextChargeRequiredEnergyWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::FeatureMap::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::NextChargeRequiredEnergy::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54108,11 +54218,11 @@ - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable val completion:completion]; } -- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeNextChargeRequiredEnergyWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::FeatureMap::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::NextChargeRequiredEnergy::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54122,9 +54232,9 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeNextChargeRequiredEnergyWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::FeatureMap::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::NextChargeRequiredEnergy::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54133,9 +54243,9 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai completion:completion]; } -- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeNextChargeTargetSoCWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::NextChargeTargetSoC::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54144,11 +54254,11 @@ - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullabl completion:completion]; } -- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeNextChargeTargetSoCWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvse::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::NextChargeTargetSoC::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54158,9 +54268,9 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeNextChargeTargetSoCWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvse::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::NextChargeTargetSoC::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54169,13 +54279,9 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC completion:completion]; } -@end - -@implementation MTRBaseClusterEnergyPreference - -- (void)readAttributeEnergyBalancesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeApproximateEVEfficiencyWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::EnergyBalances::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::ApproximateEVEfficiency::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54184,11 +54290,44 @@ - (void)readAttributeEnergyBalancesWithCompletion:(void (^)(NSArray * _Nullable completion:completion]; } -- (void)subscribeAttributeEnergyBalancesWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)writeAttributeApproximateEVEfficiencyWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion { - using TypeInfo = EnergyPreference::Attributes::EnergyBalances::TypeInfo; + [self writeAttributeApproximateEVEfficiencyWithValue:(NSNumber * _Nullable) value params:nil completion:completion]; +} +- (void)writeAttributeApproximateEVEfficiencyWithValue:(NSNumber * _Nullable)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 = EnergyEvse::Attributes::ApproximateEVEfficiency::TypeInfo; + TypeInfo::Type cppValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = 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)subscribeAttributeApproximateEVEfficiencyWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyEvse::Attributes::ApproximateEVEfficiency::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54198,9 +54337,9 @@ - (void)subscribeAttributeEnergyBalancesWithParams:(MTRSubscribeParams * _Nonnul subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeEnergyBalancesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeApproximateEVEfficiencyWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::EnergyBalances::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::ApproximateEVEfficiency::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54209,9 +54348,9 @@ + (void)readAttributeEnergyBalancesWithClusterStateCache:(MTRClusterStateCacheCo completion:completion]; } -- (void)readAttributeCurrentEnergyBalanceWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeStateOfChargeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::CurrentEnergyBalance::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::StateOfCharge::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54220,39 +54359,47 @@ - (void)readAttributeCurrentEnergyBalanceWithCompletion:(void (^)(NSNumber * _Nu completion:completion]; } -- (void)writeAttributeCurrentEnergyBalanceWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +- (void)subscribeAttributeStateOfChargeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - [self writeAttributeCurrentEnergyBalanceWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; + using TypeInfo = EnergyEvse::Attributes::StateOfCharge::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; } -- (void)writeAttributeCurrentEnergyBalanceWithValue:(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 = EnergyPreference::Attributes::CurrentEnergyBalance::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; ++ (void)readAttributeStateOfChargeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyEvse::Attributes::StateOfCharge::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); - return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); - std::move(*bridge).DispatchAction(self.device); +- (void)readAttributeBatteryCapacityWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyEvse::Attributes::BatteryCapacity::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; } -- (void)subscribeAttributeCurrentEnergyBalanceWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeBatteryCapacityWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyPreference::Attributes::CurrentEnergyBalance::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::BatteryCapacity::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54262,9 +54409,9 @@ - (void)subscribeAttributeCurrentEnergyBalanceWithParams:(MTRSubscribeParams * _ subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeCurrentEnergyBalanceWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeBatteryCapacityWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::CurrentEnergyBalance::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::BatteryCapacity::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54273,9 +54420,9 @@ + (void)readAttributeCurrentEnergyBalanceWithClusterStateCache:(MTRClusterStateC completion:completion]; } -- (void)readAttributeEnergyPrioritiesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeVehicleIDWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::EnergyPriorities::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::VehicleID::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54284,11 +54431,11 @@ - (void)readAttributeEnergyPrioritiesWithCompletion:(void (^)(NSArray * _Nullabl completion:completion]; } -- (void)subscribeAttributeEnergyPrioritiesWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeVehicleIDWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyPreference::Attributes::EnergyPriorities::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::VehicleID::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54298,9 +54445,9 @@ - (void)subscribeAttributeEnergyPrioritiesWithParams:(MTRSubscribeParams * _Nonn subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeEnergyPrioritiesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeVehicleIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::EnergyPriorities::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::VehicleID::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54309,9 +54456,9 @@ + (void)readAttributeEnergyPrioritiesWithClusterStateCache:(MTRClusterStateCache completion:completion]; } -- (void)readAttributeLowPowerModeSensitivitiesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeSessionIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::LowPowerModeSensitivities::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::SessionID::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54320,11 +54467,11 @@ - (void)readAttributeLowPowerModeSensitivitiesWithCompletion:(void (^)(NSArray * completion:completion]; } -- (void)subscribeAttributeLowPowerModeSensitivitiesWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeSessionIDWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyPreference::Attributes::LowPowerModeSensitivities::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::SessionID::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54334,9 +54481,9 @@ - (void)subscribeAttributeLowPowerModeSensitivitiesWithParams:(MTRSubscribeParam subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeLowPowerModeSensitivitiesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeSessionIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::LowPowerModeSensitivities::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::SessionID::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54345,9 +54492,9 @@ + (void)readAttributeLowPowerModeSensitivitiesWithClusterStateCache:(MTRClusterS completion:completion]; } -- (void)readAttributeCurrentLowPowerModeSensitivityWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeSessionDurationWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::CurrentLowPowerModeSensitivity::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::SessionDuration::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54356,39 +54503,83 @@ - (void)readAttributeCurrentLowPowerModeSensitivityWithCompletion:(void (^)(NSNu completion:completion]; } -- (void)writeAttributeCurrentLowPowerModeSensitivityWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +- (void)subscribeAttributeSessionDurationWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - [self writeAttributeCurrentLowPowerModeSensitivityWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; + using TypeInfo = EnergyEvse::Attributes::SessionDuration::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; } -- (void)writeAttributeCurrentLowPowerModeSensitivityWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion + ++ (void)readAttributeSessionDurationWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - // Make a copy of params before we go async. - params = [params copy]; - value = [value copy]; + using TypeInfo = EnergyEvse::Attributes::SessionDuration::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - 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); - } - } +- (void)readAttributeSessionEnergyChargedWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyEvse::Attributes::SessionEnergyCharged::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} - ListFreer listFreer; - using TypeInfo = EnergyPreference::Attributes::CurrentLowPowerModeSensitivity::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; +- (void)subscribeAttributeSessionEnergyChargedWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyEvse::Attributes::SessionEnergyCharged::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} - chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); - return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); - std::move(*bridge).DispatchAction(self.device); ++ (void)readAttributeSessionEnergyChargedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EnergyEvse::Attributes::SessionEnergyCharged::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; } -- (void)subscribeAttributeCurrentLowPowerModeSensitivityWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)readAttributeSessionEnergyDischargedWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::CurrentLowPowerModeSensitivity::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::SessionEnergyDischarged::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeSessionEnergyDischargedWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyEvse::Attributes::SessionEnergyDischarged::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54398,9 +54589,9 @@ - (void)subscribeAttributeCurrentLowPowerModeSensitivityWithParams:(MTRSubscribe subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeCurrentLowPowerModeSensitivityWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeSessionEnergyDischargedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::CurrentLowPowerModeSensitivity::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::SessionEnergyDischarged::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54411,7 +54602,7 @@ + (void)readAttributeCurrentLowPowerModeSensitivityWithClusterStateCache:(MTRClu - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54424,7 +54615,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyPreference::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54436,7 +54627,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54447,7 +54638,7 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54460,7 +54651,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyPreference::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54472,7 +54663,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54483,7 +54674,7 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::EventList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54496,7 +54687,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyPreference::Attributes::EventList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54508,7 +54699,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::EventList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54519,7 +54710,7 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::AttributeList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54532,7 +54723,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyPreference::Attributes::AttributeList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54544,7 +54735,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::AttributeList::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54555,7 +54746,7 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::FeatureMap::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54568,7 +54759,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyPreference::Attributes::FeatureMap::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54580,7 +54771,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::FeatureMap::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54591,7 +54782,7 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54604,7 +54795,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyPreference::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54616,7 +54807,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyPreference::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = EnergyEvse::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54627,11 +54818,11 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end -@implementation MTRBaseClusterPowerTopology +@implementation MTRBaseClusterEnergyPreference -- (void)readAttributeAvailableEndpointsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeEnergyBalancesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = PowerTopology::Attributes::AvailableEndpoints::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::EnergyBalances::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54640,11 +54831,11 @@ - (void)readAttributeAvailableEndpointsWithCompletion:(void (^)(NSArray * _Nulla completion:completion]; } -- (void)subscribeAttributeAvailableEndpointsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeEnergyBalancesWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = PowerTopology::Attributes::AvailableEndpoints::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::EnergyBalances::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54654,9 +54845,9 @@ - (void)subscribeAttributeAvailableEndpointsWithParams:(MTRSubscribeParams * _No subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeAvailableEndpointsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeEnergyBalancesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = PowerTopology::Attributes::AvailableEndpoints::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::EnergyBalances::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54665,9 +54856,9 @@ + (void)readAttributeAvailableEndpointsWithClusterStateCache:(MTRClusterStateCac completion:completion]; } -- (void)readAttributeActiveEndpointsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeCurrentEnergyBalanceWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = PowerTopology::Attributes::ActiveEndpoints::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::CurrentEnergyBalance::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54676,11 +54867,39 @@ - (void)readAttributeActiveEndpointsWithCompletion:(void (^)(NSArray * _Nullable completion:completion]; } -- (void)subscribeAttributeActiveEndpointsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)writeAttributeCurrentEnergyBalanceWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion { - using TypeInfo = PowerTopology::Attributes::ActiveEndpoints::TypeInfo; + [self writeAttributeCurrentEnergyBalanceWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; +} +- (void)writeAttributeCurrentEnergyBalanceWithValue:(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 = EnergyPreference::Attributes::CurrentEnergyBalance::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)subscribeAttributeCurrentEnergyBalanceWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyPreference::Attributes::CurrentEnergyBalance::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54690,9 +54909,9 @@ - (void)subscribeAttributeActiveEndpointsWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeActiveEndpointsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeCurrentEnergyBalanceWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = PowerTopology::Attributes::ActiveEndpoints::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::CurrentEnergyBalance::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54701,9 +54920,9 @@ + (void)readAttributeActiveEndpointsWithClusterStateCache:(MTRClusterStateCacheC completion:completion]; } -- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeEnergyPrioritiesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = PowerTopology::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::EnergyPriorities::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54712,11 +54931,11 @@ - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nul completion:completion]; } -- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeEnergyPrioritiesWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = PowerTopology::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::EnergyPriorities::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54726,9 +54945,9 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeEnergyPrioritiesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = PowerTopology::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::EnergyPriorities::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54737,9 +54956,9 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC completion:completion]; } -- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeLowPowerModeSensitivitiesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = PowerTopology::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::LowPowerModeSensitivities::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54748,11 +54967,11 @@ - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Null completion:completion]; } -- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeLowPowerModeSensitivitiesWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = PowerTopology::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::LowPowerModeSensitivities::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54762,9 +54981,9 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeLowPowerModeSensitivitiesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = PowerTopology::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::LowPowerModeSensitivities::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54773,9 +54992,9 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa completion:completion]; } -- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeCurrentLowPowerModeSensitivityWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = PowerTopology::Attributes::EventList::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::CurrentLowPowerModeSensitivity::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54784,11 +55003,39 @@ - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value completion:completion]; } -- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)writeAttributeCurrentLowPowerModeSensitivityWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion { - using TypeInfo = PowerTopology::Attributes::EventList::TypeInfo; + [self writeAttributeCurrentLowPowerModeSensitivityWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; +} +- (void)writeAttributeCurrentLowPowerModeSensitivityWithValue:(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 = EnergyPreference::Attributes::CurrentLowPowerModeSensitivity::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)subscribeAttributeCurrentLowPowerModeSensitivityWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EnergyPreference::Attributes::CurrentLowPowerModeSensitivity::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54798,9 +55045,9 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeCurrentLowPowerModeSensitivityWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = PowerTopology::Attributes::EventList::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::CurrentLowPowerModeSensitivity::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54809,9 +55056,9 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain completion:completion]; } -- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = PowerTopology::Attributes::AttributeList::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54820,11 +55067,11 @@ - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable v completion:completion]; } -- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = PowerTopology::Attributes::AttributeList::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54834,9 +55081,9 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = PowerTopology::Attributes::AttributeList::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54845,9 +55092,9 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon completion:completion]; } -- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = PowerTopology::Attributes::FeatureMap::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54856,11 +55103,11 @@ - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable val completion:completion]; } -- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = PowerTopology::Attributes::FeatureMap::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54870,9 +55117,9 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = PowerTopology::Attributes::FeatureMap::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54881,9 +55128,9 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai completion:completion]; } -- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = PowerTopology::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54892,11 +55139,11 @@ - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullabl completion:completion]; } -- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = PowerTopology::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54906,9 +55153,9 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = PowerTopology::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54917,38 +55164,9 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC completion:completion]; } -@end - -@implementation MTRBaseClusterEnergyEVSEMode - -- (void)changeToModeWithParams:(MTREnergyEVSEModeClusterChangeToModeParams *)params completion:(void (^)(MTREnergyEVSEModeClusterChangeToModeResponseParams * _Nullable data, NSError * _Nullable error))completion -{ - if (params == nil) { - params = [[MTREnergyEVSEModeClusterChangeToModeParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(response, error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = EnergyEvseMode::Commands::ChangeToMode::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTREnergyEVSEModeClusterChangeToModeResponseParams.class - queue:self.callbackQueue - completion:responseHandler]; -} - -- (void)readAttributeSupportedModesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::SupportedModes::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54957,11 +55175,11 @@ - (void)readAttributeSupportedModesWithCompletion:(void (^)(NSArray * _Nullable completion:completion]; } -- (void)subscribeAttributeSupportedModesWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvseMode::Attributes::SupportedModes::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54971,9 +55189,9 @@ - (void)subscribeAttributeSupportedModesWithParams:(MTRSubscribeParams * _Nonnul subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeSupportedModesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::SupportedModes::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -54982,9 +55200,9 @@ + (void)readAttributeSupportedModesWithClusterStateCache:(MTRClusterStateCacheCo completion:completion]; } -- (void)readAttributeCurrentModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::CurrentMode::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -54993,11 +55211,11 @@ - (void)readAttributeCurrentModeWithCompletion:(void (^)(NSNumber * _Nullable va completion:completion]; } -- (void)subscribeAttributeCurrentModeWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvseMode::Attributes::CurrentMode::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55007,9 +55225,9 @@ - (void)subscribeAttributeCurrentModeWithParams:(MTRSubscribeParams * _Nonnull)p subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeCurrentModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::CurrentMode::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55018,9 +55236,9 @@ + (void)readAttributeCurrentModeWithClusterStateCache:(MTRClusterStateCacheConta completion:completion]; } -- (void)readAttributeStartUpModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::StartUpMode::TypeInfo; + using TypeInfo = EnergyPreference::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55029,44 +55247,51 @@ - (void)readAttributeStartUpModeWithCompletion:(void (^)(NSNumber * _Nullable va completion:completion]; } -- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - [self writeAttributeStartUpModeWithValue:(NSNumber * _Nullable) value params:nil completion:completion]; + using TypeInfo = EnergyPreference::Attributes::ClusterRevision::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; } -- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion + ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - // Make a copy of params before we go async. - params = [params copy]; - value = [value copy]; + using TypeInfo = EnergyPreference::Attributes::ClusterRevision::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - 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); - } - } +@end - ListFreer listFreer; - using TypeInfo = EnergyEvseMode::Attributes::StartUpMode::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedCharValue; - } +@implementation MTRBaseClusterPowerTopology - chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); - return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); - std::move(*bridge).DispatchAction(self.device); +- (void)readAttributeAvailableEndpointsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = PowerTopology::Attributes::AvailableEndpoints::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; } -- (void)subscribeAttributeStartUpModeWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeAvailableEndpointsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvseMode::Attributes::StartUpMode::TypeInfo; + using TypeInfo = PowerTopology::Attributes::AvailableEndpoints::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55076,9 +55301,9 @@ - (void)subscribeAttributeStartUpModeWithParams:(MTRSubscribeParams * _Nonnull)p subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeStartUpModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeAvailableEndpointsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::StartUpMode::TypeInfo; + using TypeInfo = PowerTopology::Attributes::AvailableEndpoints::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55087,9 +55312,9 @@ + (void)readAttributeStartUpModeWithClusterStateCache:(MTRClusterStateCacheConta completion:completion]; } -- (void)readAttributeOnModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeActiveEndpointsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::OnMode::TypeInfo; + using TypeInfo = PowerTopology::Attributes::ActiveEndpoints::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55098,44 +55323,11 @@ - (void)readAttributeOnModeWithCompletion:(void (^)(NSNumber * _Nullable value, completion:completion]; } -- (void)writeAttributeOnModeWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeOnModeWithValue:(NSNumber * _Nullable) value params:nil completion:completion]; -} -- (void)writeAttributeOnModeWithValue:(NSNumber * _Nullable)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 = EnergyEvseMode::Attributes::OnMode::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = 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)subscribeAttributeOnModeWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeActiveEndpointsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvseMode::Attributes::OnMode::TypeInfo; + using TypeInfo = PowerTopology::Attributes::ActiveEndpoints::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55145,9 +55337,9 @@ - (void)subscribeAttributeOnModeWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeOnModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeActiveEndpointsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::OnMode::TypeInfo; + using TypeInfo = PowerTopology::Attributes::ActiveEndpoints::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55158,7 +55350,7 @@ + (void)readAttributeOnModeWithClusterStateCache:(MTRClusterStateCacheContainer - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = PowerTopology::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55171,7 +55363,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvseMode::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = PowerTopology::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55183,7 +55375,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = PowerTopology::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55194,7 +55386,7 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = PowerTopology::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55207,7 +55399,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvseMode::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = PowerTopology::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55219,7 +55411,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = PowerTopology::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55230,7 +55422,7 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::EventList::TypeInfo; + using TypeInfo = PowerTopology::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55243,7 +55435,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvseMode::Attributes::EventList::TypeInfo; + using TypeInfo = PowerTopology::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55255,7 +55447,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::EventList::TypeInfo; + using TypeInfo = PowerTopology::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55266,7 +55458,7 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::AttributeList::TypeInfo; + using TypeInfo = PowerTopology::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55279,7 +55471,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvseMode::Attributes::AttributeList::TypeInfo; + using TypeInfo = PowerTopology::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55291,7 +55483,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::AttributeList::TypeInfo; + using TypeInfo = PowerTopology::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55302,7 +55494,7 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::FeatureMap::TypeInfo; + using TypeInfo = PowerTopology::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55315,7 +55507,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvseMode::Attributes::FeatureMap::TypeInfo; + using TypeInfo = PowerTopology::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55327,7 +55519,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::FeatureMap::TypeInfo; + using TypeInfo = PowerTopology::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55338,7 +55530,7 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = PowerTopology::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55351,7 +55543,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = EnergyEvseMode::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = PowerTopology::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55363,7 +55555,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = EnergyEvseMode::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = PowerTopology::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55374,12 +55566,12 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end -@implementation MTRBaseClusterDeviceEnergyManagementMode +@implementation MTRBaseClusterEnergyEVSEMode -- (void)changeToModeWithParams:(MTRDeviceEnergyManagementModeClusterChangeToModeParams *)params completion:(void (^)(MTRDeviceEnergyManagementModeClusterChangeToModeResponseParams * _Nullable data, NSError * _Nullable error))completion +- (void)changeToModeWithParams:(MTREnergyEVSEModeClusterChangeToModeParams *)params completion:(void (^)(MTREnergyEVSEModeClusterChangeToModeResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { - params = [[MTRDeviceEnergyManagementModeClusterChangeToModeParams + params = [[MTREnergyEVSEModeClusterChangeToModeParams alloc] init]; } @@ -55389,21 +55581,21 @@ - (void)changeToModeWithParams:(MTRDeviceEnergyManagementModeClusterChangeToMode auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = DeviceEnergyManagementMode::Commands::ChangeToMode::Type; + using RequestType = EnergyEvseMode::Commands::ChangeToMode::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) commandPayload:params timedInvokeTimeout:timedInvokeTimeoutMs serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTRDeviceEnergyManagementModeClusterChangeToModeResponseParams.class + responseClass:MTREnergyEVSEModeClusterChangeToModeResponseParams.class queue:self.callbackQueue completion:responseHandler]; } - (void)readAttributeSupportedModesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::SupportedModes::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::SupportedModes::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55416,7 +55608,7 @@ - (void)subscribeAttributeSupportedModesWithParams:(MTRSubscribeParams * _Nonnul subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagementMode::Attributes::SupportedModes::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::SupportedModes::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55428,7 +55620,7 @@ - (void)subscribeAttributeSupportedModesWithParams:(MTRSubscribeParams * _Nonnul + (void)readAttributeSupportedModesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::SupportedModes::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::SupportedModes::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55439,7 +55631,7 @@ + (void)readAttributeSupportedModesWithClusterStateCache:(MTRClusterStateCacheCo - (void)readAttributeCurrentModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::CurrentMode::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::CurrentMode::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55452,7 +55644,7 @@ - (void)subscribeAttributeCurrentModeWithParams:(MTRSubscribeParams * _Nonnull)p subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagementMode::Attributes::CurrentMode::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::CurrentMode::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55464,7 +55656,7 @@ - (void)subscribeAttributeCurrentModeWithParams:(MTRSubscribeParams * _Nonnull)p + (void)readAttributeCurrentModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::CurrentMode::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::CurrentMode::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55475,7 +55667,7 @@ + (void)readAttributeCurrentModeWithClusterStateCache:(MTRClusterStateCacheConta - (void)readAttributeStartUpModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::StartUpMode::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::StartUpMode::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55503,7 +55695,7 @@ - (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value params:(M } ListFreer listFreer; - using TypeInfo = DeviceEnergyManagementMode::Attributes::StartUpMode::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::StartUpMode::TypeInfo; TypeInfo::Type cppValue; if (value == nil) { cppValue.SetNull(); @@ -55521,7 +55713,7 @@ - (void)subscribeAttributeStartUpModeWithParams:(MTRSubscribeParams * _Nonnull)p subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagementMode::Attributes::StartUpMode::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::StartUpMode::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55533,7 +55725,7 @@ - (void)subscribeAttributeStartUpModeWithParams:(MTRSubscribeParams * _Nonnull)p + (void)readAttributeStartUpModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::StartUpMode::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::StartUpMode::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55544,7 +55736,7 @@ + (void)readAttributeStartUpModeWithClusterStateCache:(MTRClusterStateCacheConta - (void)readAttributeOnModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::OnMode::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::OnMode::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55572,7 +55764,7 @@ - (void)writeAttributeOnModeWithValue:(NSNumber * _Nullable)value params:(MTRWri } ListFreer listFreer; - using TypeInfo = DeviceEnergyManagementMode::Attributes::OnMode::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::OnMode::TypeInfo; TypeInfo::Type cppValue; if (value == nil) { cppValue.SetNull(); @@ -55590,7 +55782,7 @@ - (void)subscribeAttributeOnModeWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagementMode::Attributes::OnMode::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::OnMode::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55602,7 +55794,7 @@ - (void)subscribeAttributeOnModeWithParams:(MTRSubscribeParams * _Nonnull)params + (void)readAttributeOnModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::OnMode::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::OnMode::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55613,7 +55805,7 @@ + (void)readAttributeOnModeWithClusterStateCache:(MTRClusterStateCacheContainer - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55626,7 +55818,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagementMode::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55638,7 +55830,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55649,7 +55841,7 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55662,7 +55854,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagementMode::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55674,7 +55866,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55685,7 +55877,7 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::EventList::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55698,7 +55890,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagementMode::Attributes::EventList::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55710,7 +55902,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::EventList::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55721,7 +55913,7 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::AttributeList::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55734,7 +55926,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagementMode::Attributes::AttributeList::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55746,7 +55938,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::AttributeList::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55757,7 +55949,7 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::FeatureMap::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55770,7 +55962,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagementMode::Attributes::FeatureMap::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55782,7 +55974,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::FeatureMap::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55793,7 +55985,7 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55806,7 +55998,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DeviceEnergyManagementMode::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -55818,7 +56010,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DeviceEnergyManagementMode::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = EnergyEvseMode::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -55829,562 +56021,390 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end -@implementation MTRBaseClusterDoorLock +@implementation MTRBaseClusterWaterHeaterMode -- (void)lockDoorWithCompletion:(MTRStatusCompletion)completion -{ - [self lockDoorWithParams:nil completion:completion]; -} -- (void)lockDoorWithParams:(MTRDoorLockClusterLockDoorParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)changeToModeWithParams:(MTRWaterHeaterModeClusterChangeToModeParams *)params completion:(void (^)(MTRWaterHeaterModeClusterChangeToModeResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { - params = [[MTRDoorLockClusterLockDoorParams + params = [[MTRWaterHeaterModeClusterChangeToModeParams alloc] init]; } auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); + completion(response, error); }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - using RequestType = DoorLock::Commands::LockDoor::Type; + using RequestType = WaterHeaterMode::Commands::ChangeToMode::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) commandPayload:params timedInvokeTimeout:timedInvokeTimeoutMs serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil + responseClass:MTRWaterHeaterModeClusterChangeToModeResponseParams.class queue:self.callbackQueue completion:responseHandler]; } -- (void)unlockDoorWithCompletion:(MTRStatusCompletion)completion + +- (void)readAttributeSupportedModesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - [self unlockDoorWithParams:nil completion:completion]; + using TypeInfo = WaterHeaterMode::Attributes::SupportedModes::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; } -- (void)unlockDoorWithParams:(MTRDoorLockClusterUnlockDoorParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDoorLockClusterUnlockDoorParams - alloc] init]; - } - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; +- (void)subscribeAttributeSupportedModesWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = WaterHeaterMode::Attributes::SupportedModes::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } ++ (void)readAttributeSupportedModesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WaterHeaterMode::Attributes::SupportedModes::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - using RequestType = DoorLock::Commands::UnlockDoor::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil +- (void)readAttributeCurrentModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WaterHeaterMode::Attributes::CurrentMode::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil queue:self.callbackQueue - completion:responseHandler]; + completion:completion]; } -- (void)unlockWithTimeoutWithParams:(MTRDoorLockClusterUnlockWithTimeoutParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDoorLockClusterUnlockWithTimeoutParams - alloc] init]; - } - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; +- (void)subscribeAttributeCurrentModeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = WaterHeaterMode::Attributes::CurrentMode::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } ++ (void)readAttributeCurrentModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WaterHeaterMode::Attributes::CurrentMode::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - using RequestType = DoorLock::Commands::UnlockWithTimeout::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil +- (void)readAttributeStartUpModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WaterHeaterMode::Attributes::StartUpMode::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil queue:self.callbackQueue - completion:responseHandler]; + completion:completion]; } -- (void)setWeekDayScheduleWithParams:(MTRDoorLockClusterSetWeekDayScheduleParams *)params completion:(MTRStatusCompletion)completion + +- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion { - if (params == nil) { - params = [[MTRDoorLockClusterSetWeekDayScheduleParams - alloc] init]; - } + [self writeAttributeStartUpModeWithValue:(NSNumber * _Nullable) value params:nil completion:completion]; +} +- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + // Make a copy of params before we go async. + params = [params copy]; + value = [value copy]; - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; + 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); + } + } - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + ListFreer listFreer; + using TypeInfo = WaterHeaterMode::Attributes::StartUpMode::TypeInfo; + TypeInfo::Type cppValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = value.unsignedCharValue; + } - using RequestType = DoorLock::Commands::SetWeekDaySchedule::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]; + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); } -- (void)getWeekDayScheduleWithParams:(MTRDoorLockClusterGetWeekDayScheduleParams *)params completion:(void (^)(MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable data, NSError * _Nullable error))completion -{ - if (params == nil) { - params = [[MTRDoorLockClusterGetWeekDayScheduleParams - alloc] init]; - } - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(response, error); - }; +- (void)subscribeAttributeStartUpModeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = WaterHeaterMode::Attributes::StartUpMode::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; ++ (void)readAttributeStartUpModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WaterHeaterMode::Attributes::StartUpMode::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - using RequestType = DoorLock::Commands::GetWeekDaySchedule::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTRDoorLockClusterGetWeekDayScheduleResponseParams.class +- (void)readAttributeOnModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WaterHeaterMode::Attributes::OnMode::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil queue:self.callbackQueue - completion:responseHandler]; + completion:completion]; } -- (void)clearWeekDayScheduleWithParams:(MTRDoorLockClusterClearWeekDayScheduleParams *)params completion:(MTRStatusCompletion)completion + +- (void)writeAttributeOnModeWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion { - if (params == nil) { - params = [[MTRDoorLockClusterClearWeekDayScheduleParams - alloc] init]; - } + [self writeAttributeOnModeWithValue:(NSNumber * _Nullable) value params:nil completion:completion]; +} +- (void)writeAttributeOnModeWithValue:(NSNumber * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + // Make a copy of params before we go async. + params = [params copy]; + value = [value copy]; - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; + 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); + } + } - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + ListFreer listFreer; + using TypeInfo = WaterHeaterMode::Attributes::OnMode::TypeInfo; + TypeInfo::Type cppValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = value.unsignedCharValue; + } - using RequestType = DoorLock::Commands::ClearWeekDaySchedule::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]; + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); } -- (void)setYearDayScheduleWithParams:(MTRDoorLockClusterSetYearDayScheduleParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDoorLockClusterSetYearDayScheduleParams - alloc] init]; - } - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; +- (void)subscribeAttributeOnModeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = WaterHeaterMode::Attributes::OnMode::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; ++ (void)readAttributeOnModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WaterHeaterMode::Attributes::OnMode::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - using RequestType = DoorLock::Commands::SetYearDaySchedule::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WaterHeaterMode::Attributes::GeneratedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil queue:self.callbackQueue - completion:responseHandler]; + completion:completion]; } -- (void)getYearDayScheduleWithParams:(MTRDoorLockClusterGetYearDayScheduleParams *)params completion:(void (^)(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable data, NSError * _Nullable error))completion -{ - if (params == nil) { - params = [[MTRDoorLockClusterGetYearDayScheduleParams - alloc] init]; - } - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(response, error); - }; +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = WaterHeaterMode::Attributes::GeneratedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WaterHeaterMode::Attributes::GeneratedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - using RequestType = DoorLock::Commands::GetYearDaySchedule::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTRDoorLockClusterGetYearDayScheduleResponseParams.class +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WaterHeaterMode::Attributes::AcceptedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil queue:self.callbackQueue - completion:responseHandler]; + completion:completion]; } -- (void)clearYearDayScheduleWithParams:(MTRDoorLockClusterClearYearDayScheduleParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDoorLockClusterClearYearDayScheduleParams - alloc] init]; - } - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = WaterHeaterMode::Attributes::AcceptedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WaterHeaterMode::Attributes::AcceptedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - using RequestType = DoorLock::Commands::ClearYearDaySchedule::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WaterHeaterMode::Attributes::EventList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil queue:self.callbackQueue - completion:responseHandler]; + completion:completion]; } -- (void)setHolidayScheduleWithParams:(MTRDoorLockClusterSetHolidayScheduleParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDoorLockClusterSetHolidayScheduleParams - alloc] init]; - } - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = WaterHeaterMode::Attributes::EventList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WaterHeaterMode::Attributes::EventList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - using RequestType = DoorLock::Commands::SetHolidaySchedule::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WaterHeaterMode::Attributes::AttributeList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil queue:self.callbackQueue - completion:responseHandler]; + completion:completion]; } -- (void)getHolidayScheduleWithParams:(MTRDoorLockClusterGetHolidayScheduleParams *)params completion:(void (^)(MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable data, NSError * _Nullable error))completion + +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - if (params == nil) { - params = [[MTRDoorLockClusterGetHolidayScheduleParams - alloc] init]; - } + using TypeInfo = WaterHeaterMode::Attributes::AttributeList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(response, error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = DoorLock::Commands::GetHolidaySchedule::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTRDoorLockClusterGetHolidayScheduleResponseParams.class - queue:self.callbackQueue - completion:responseHandler]; -} -- (void)clearHolidayScheduleWithParams:(MTRDoorLockClusterClearHolidayScheduleParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDoorLockClusterClearHolidayScheduleParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = DoorLock::Commands::ClearHolidaySchedule::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)setUserWithParams:(MTRDoorLockClusterSetUserParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDoorLockClusterSetUserParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - - using RequestType = DoorLock::Commands::SetUser::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)getUserWithParams:(MTRDoorLockClusterGetUserParams *)params completion:(void (^)(MTRDoorLockClusterGetUserResponseParams * _Nullable data, NSError * _Nullable error))completion -{ - if (params == nil) { - params = [[MTRDoorLockClusterGetUserParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(response, error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = DoorLock::Commands::GetUser::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTRDoorLockClusterGetUserResponseParams.class - queue:self.callbackQueue - completion:responseHandler]; -} -- (void)clearUserWithParams:(MTRDoorLockClusterClearUserParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDoorLockClusterClearUserParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - - using RequestType = DoorLock::Commands::ClearUser::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)setCredentialWithParams:(MTRDoorLockClusterSetCredentialParams *)params completion:(void (^)(MTRDoorLockClusterSetCredentialResponseParams * _Nullable data, NSError * _Nullable error))completion -{ - if (params == nil) { - params = [[MTRDoorLockClusterSetCredentialParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(response, error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - - using RequestType = DoorLock::Commands::SetCredential::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTRDoorLockClusterSetCredentialResponseParams.class - queue:self.callbackQueue - completion:responseHandler]; -} -- (void)getCredentialStatusWithParams:(MTRDoorLockClusterGetCredentialStatusParams *)params completion:(void (^)(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable data, NSError * _Nullable error))completion -{ - if (params == nil) { - params = [[MTRDoorLockClusterGetCredentialStatusParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(response, error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = DoorLock::Commands::GetCredentialStatus::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTRDoorLockClusterGetCredentialStatusResponseParams.class - queue:self.callbackQueue - completion:responseHandler]; -} -- (void)clearCredentialWithParams:(MTRDoorLockClusterClearCredentialParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDoorLockClusterClearCredentialParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - - using RequestType = DoorLock::Commands::ClearCredential::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)unboltDoorWithCompletion:(MTRStatusCompletion)completion -{ - [self unboltDoorWithParams:nil completion:completion]; -} -- (void)unboltDoorWithParams:(MTRDoorLockClusterUnboltDoorParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDoorLockClusterUnboltDoorParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - - using RequestType = DoorLock::Commands::UnboltDoor::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)setAliroReaderConfigWithParams:(MTRDoorLockClusterSetAliroReaderConfigParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRDoorLockClusterSetAliroReaderConfigParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - - using RequestType = DoorLock::Commands::SetAliroReaderConfig::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)clearAliroReaderConfigWithCompletion:(MTRStatusCompletion)completion -{ - [self clearAliroReaderConfigWithParams:nil completion:completion]; -} -- (void)clearAliroReaderConfigWithParams:(MTRDoorLockClusterClearAliroReaderConfigParams * _Nullable)params completion:(MTRStatusCompletion)completion ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - if (params == nil) { - params = [[MTRDoorLockClusterClearAliroReaderConfigParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - - using RequestType = DoorLock::Commands::ClearAliroReaderConfig::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]; + using TypeInfo = WaterHeaterMode::Attributes::AttributeList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; } -- (void)readAttributeLockStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::LockState::TypeInfo; + using TypeInfo = WaterHeaterMode::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56393,11 +56413,11 @@ - (void)readAttributeLockStateWithCompletion:(void (^)(NSNumber * _Nullable valu completion:completion]; } -- (void)subscribeAttributeLockStateWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DoorLock::Attributes::LockState::TypeInfo; + using TypeInfo = WaterHeaterMode::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56407,9 +56427,9 @@ - (void)subscribeAttributeLockStateWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeLockStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::LockState::TypeInfo; + using TypeInfo = WaterHeaterMode::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -56418,9 +56438,9 @@ + (void)readAttributeLockStateWithClusterStateCache:(MTRClusterStateCacheContain completion:completion]; } -- (void)readAttributeLockTypeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::LockType::TypeInfo; + using TypeInfo = WaterHeaterMode::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56429,11 +56449,11 @@ - (void)readAttributeLockTypeWithCompletion:(void (^)(NSNumber * _Nullable value completion:completion]; } -- (void)subscribeAttributeLockTypeWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DoorLock::Attributes::LockType::TypeInfo; + using TypeInfo = WaterHeaterMode::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56443,9 +56463,9 @@ - (void)subscribeAttributeLockTypeWithParams:(MTRSubscribeParams * _Nonnull)para subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeLockTypeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::LockType::TypeInfo; + using TypeInfo = WaterHeaterMode::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -56454,9 +56474,38 @@ + (void)readAttributeLockTypeWithClusterStateCache:(MTRClusterStateCacheContaine completion:completion]; } -- (void)readAttributeActuatorEnabledWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +@end + +@implementation MTRBaseClusterDeviceEnergyManagementMode + +- (void)changeToModeWithParams:(MTRDeviceEnergyManagementModeClusterChangeToModeParams *)params completion:(void (^)(MTRDeviceEnergyManagementModeClusterChangeToModeResponseParams * _Nullable data, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::ActuatorEnabled::TypeInfo; + if (params == nil) { + params = [[MTRDeviceEnergyManagementModeClusterChangeToModeParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DeviceEnergyManagementMode::Commands::ChangeToMode::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRDeviceEnergyManagementModeClusterChangeToModeResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)readAttributeSupportedModesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DeviceEnergyManagementMode::Attributes::SupportedModes::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56465,11 +56514,11 @@ - (void)readAttributeActuatorEnabledWithCompletion:(void (^)(NSNumber * _Nullabl completion:completion]; } -- (void)subscribeAttributeActuatorEnabledWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeSupportedModesWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DoorLock::Attributes::ActuatorEnabled::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::SupportedModes::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56479,9 +56528,9 @@ - (void)subscribeAttributeActuatorEnabledWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeActuatorEnabledWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeSupportedModesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::ActuatorEnabled::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::SupportedModes::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -56490,9 +56539,9 @@ + (void)readAttributeActuatorEnabledWithClusterStateCache:(MTRClusterStateCacheC completion:completion]; } -- (void)readAttributeDoorStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeCurrentModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::DoorState::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::CurrentMode::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56501,11 +56550,11 @@ - (void)readAttributeDoorStateWithCompletion:(void (^)(NSNumber * _Nullable valu completion:completion]; } -- (void)subscribeAttributeDoorStateWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeCurrentModeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DoorLock::Attributes::DoorState::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::CurrentMode::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56515,9 +56564,9 @@ - (void)subscribeAttributeDoorStateWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeDoorStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeCurrentModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::DoorState::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::CurrentMode::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -56526,9 +56575,9 @@ + (void)readAttributeDoorStateWithClusterStateCache:(MTRClusterStateCacheContain completion:completion]; } -- (void)readAttributeDoorOpenEventsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeStartUpModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::DoorOpenEvents::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::StartUpMode::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56537,11 +56586,11 @@ - (void)readAttributeDoorOpenEventsWithCompletion:(void (^)(NSNumber * _Nullable completion:completion]; } -- (void)writeAttributeDoorOpenEventsWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion { - [self writeAttributeDoorOpenEventsWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; + [self writeAttributeStartUpModeWithValue:(NSNumber * _Nullable) value params:nil completion:completion]; } -- (void)writeAttributeDoorOpenEventsWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion { // Make a copy of params before we go async. params = [params copy]; @@ -56556,20 +56605,25 @@ - (void)writeAttributeDoorOpenEventsWithValue:(NSNumber * _Nonnull)value params: } ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::DoorOpenEvents::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::StartUpMode::TypeInfo; TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = 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)subscribeAttributeDoorOpenEventsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeStartUpModeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DoorLock::Attributes::DoorOpenEvents::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::StartUpMode::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56579,9 +56633,9 @@ - (void)subscribeAttributeDoorOpenEventsWithParams:(MTRSubscribeParams * _Nonnul subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeDoorOpenEventsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeStartUpModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::DoorOpenEvents::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::StartUpMode::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -56590,9 +56644,9 @@ + (void)readAttributeDoorOpenEventsWithClusterStateCache:(MTRClusterStateCacheCo completion:completion]; } -- (void)readAttributeDoorClosedEventsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeOnModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::DoorClosedEvents::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::OnMode::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56601,11 +56655,11 @@ - (void)readAttributeDoorClosedEventsWithCompletion:(void (^)(NSNumber * _Nullab completion:completion]; } -- (void)writeAttributeDoorClosedEventsWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +- (void)writeAttributeOnModeWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion { - [self writeAttributeDoorClosedEventsWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; + [self writeAttributeOnModeWithValue:(NSNumber * _Nullable) value params:nil completion:completion]; } -- (void)writeAttributeDoorClosedEventsWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)writeAttributeOnModeWithValue:(NSNumber * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion { // Make a copy of params before we go async. params = [params copy]; @@ -56620,20 +56674,25 @@ - (void)writeAttributeDoorClosedEventsWithValue:(NSNumber * _Nonnull)value param } ListFreer listFreer; - using TypeInfo = DoorLock::Attributes::DoorClosedEvents::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::OnMode::TypeInfo; TypeInfo::Type cppValue; - cppValue = value.unsignedIntValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = 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)subscribeAttributeDoorClosedEventsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeOnModeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DoorLock::Attributes::DoorClosedEvents::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::OnMode::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56643,9 +56702,9 @@ - (void)subscribeAttributeDoorClosedEventsWithParams:(MTRSubscribeParams * _Nonn subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeDoorClosedEventsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeOnModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::DoorClosedEvents::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::OnMode::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -56654,9 +56713,9 @@ + (void)readAttributeDoorClosedEventsWithClusterStateCache:(MTRClusterStateCache completion:completion]; } -- (void)readAttributeOpenPeriodWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::OpenPeriod::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56665,39 +56724,11 @@ - (void)readAttributeOpenPeriodWithCompletion:(void (^)(NSNumber * _Nullable val completion:completion]; } -- (void)writeAttributeOpenPeriodWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeOpenPeriodWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; -} -- (void)writeAttributeOpenPeriodWithValue:(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 = DoorLock::Attributes::OpenPeriod::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)subscribeAttributeOpenPeriodWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DoorLock::Attributes::OpenPeriod::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56707,9 +56738,9 @@ - (void)subscribeAttributeOpenPeriodWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeOpenPeriodWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::OpenPeriod::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -56718,9 +56749,9 @@ + (void)readAttributeOpenPeriodWithClusterStateCache:(MTRClusterStateCacheContai completion:completion]; } -- (void)readAttributeNumberOfTotalUsersSupportedWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::NumberOfTotalUsersSupported::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56729,11 +56760,11 @@ - (void)readAttributeNumberOfTotalUsersSupportedWithCompletion:(void (^)(NSNumbe completion:completion]; } -- (void)subscribeAttributeNumberOfTotalUsersSupportedWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DoorLock::Attributes::NumberOfTotalUsersSupported::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56743,9 +56774,9 @@ - (void)subscribeAttributeNumberOfTotalUsersSupportedWithParams:(MTRSubscribePar subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeNumberOfTotalUsersSupportedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::NumberOfTotalUsersSupported::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -56754,9 +56785,9 @@ + (void)readAttributeNumberOfTotalUsersSupportedWithClusterStateCache:(MTRCluste completion:completion]; } -- (void)readAttributeNumberOfPINUsersSupportedWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = DoorLock::Attributes::NumberOfPINUsersSupported::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56765,11 +56796,11 @@ - (void)readAttributeNumberOfPINUsersSupportedWithCompletion:(void (^)(NSNumber completion:completion]; } -- (void)subscribeAttributeNumberOfPINUsersSupportedWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = DoorLock::Attributes::NumberOfPINUsersSupported::TypeInfo; + using TypeInfo = DeviceEnergyManagementMode::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -56779,7 +56810,1078 @@ - (void)subscribeAttributeNumberOfPINUsersSupportedWithParams:(MTRSubscribeParam subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeNumberOfPINUsersSupportedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DeviceEnergyManagementMode::Attributes::EventList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DeviceEnergyManagementMode::Attributes::AttributeList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DeviceEnergyManagementMode::Attributes::AttributeList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DeviceEnergyManagementMode::Attributes::AttributeList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DeviceEnergyManagementMode::Attributes::FeatureMap::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DeviceEnergyManagementMode::Attributes::FeatureMap::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DeviceEnergyManagementMode::Attributes::FeatureMap::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DeviceEnergyManagementMode::Attributes::ClusterRevision::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DeviceEnergyManagementMode::Attributes::ClusterRevision::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DeviceEnergyManagementMode::Attributes::ClusterRevision::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +@end + +@implementation MTRBaseClusterDoorLock + +- (void)lockDoorWithCompletion:(MTRStatusCompletion)completion +{ + [self lockDoorWithParams:nil completion:completion]; +} +- (void)lockDoorWithParams:(MTRDoorLockClusterLockDoorParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterLockDoorParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = DoorLock::Commands::LockDoor::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)unlockDoorWithCompletion:(MTRStatusCompletion)completion +{ + [self unlockDoorWithParams:nil completion:completion]; +} +- (void)unlockDoorWithParams:(MTRDoorLockClusterUnlockDoorParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterUnlockDoorParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = DoorLock::Commands::UnlockDoor::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)unlockWithTimeoutWithParams:(MTRDoorLockClusterUnlockWithTimeoutParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterUnlockWithTimeoutParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = DoorLock::Commands::UnlockWithTimeout::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)setWeekDayScheduleWithParams:(MTRDoorLockClusterSetWeekDayScheduleParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterSetWeekDayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DoorLock::Commands::SetWeekDaySchedule::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)getWeekDayScheduleWithParams:(MTRDoorLockClusterGetWeekDayScheduleParams *)params completion:(void (^)(MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterGetWeekDayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DoorLock::Commands::GetWeekDaySchedule::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRDoorLockClusterGetWeekDayScheduleResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)clearWeekDayScheduleWithParams:(MTRDoorLockClusterClearWeekDayScheduleParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterClearWeekDayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DoorLock::Commands::ClearWeekDaySchedule::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)setYearDayScheduleWithParams:(MTRDoorLockClusterSetYearDayScheduleParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterSetYearDayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DoorLock::Commands::SetYearDaySchedule::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)getYearDayScheduleWithParams:(MTRDoorLockClusterGetYearDayScheduleParams *)params completion:(void (^)(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterGetYearDayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DoorLock::Commands::GetYearDaySchedule::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRDoorLockClusterGetYearDayScheduleResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)clearYearDayScheduleWithParams:(MTRDoorLockClusterClearYearDayScheduleParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterClearYearDayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DoorLock::Commands::ClearYearDaySchedule::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)setHolidayScheduleWithParams:(MTRDoorLockClusterSetHolidayScheduleParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterSetHolidayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DoorLock::Commands::SetHolidaySchedule::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)getHolidayScheduleWithParams:(MTRDoorLockClusterGetHolidayScheduleParams *)params completion:(void (^)(MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterGetHolidayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DoorLock::Commands::GetHolidaySchedule::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRDoorLockClusterGetHolidayScheduleResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)clearHolidayScheduleWithParams:(MTRDoorLockClusterClearHolidayScheduleParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterClearHolidayScheduleParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DoorLock::Commands::ClearHolidaySchedule::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)setUserWithParams:(MTRDoorLockClusterSetUserParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterSetUserParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = DoorLock::Commands::SetUser::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)getUserWithParams:(MTRDoorLockClusterGetUserParams *)params completion:(void (^)(MTRDoorLockClusterGetUserResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterGetUserParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DoorLock::Commands::GetUser::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRDoorLockClusterGetUserResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)clearUserWithParams:(MTRDoorLockClusterClearUserParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterClearUserParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = DoorLock::Commands::ClearUser::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)setCredentialWithParams:(MTRDoorLockClusterSetCredentialParams *)params completion:(void (^)(MTRDoorLockClusterSetCredentialResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterSetCredentialParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = DoorLock::Commands::SetCredential::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRDoorLockClusterSetCredentialResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)getCredentialStatusWithParams:(MTRDoorLockClusterGetCredentialStatusParams *)params completion:(void (^)(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterGetCredentialStatusParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = DoorLock::Commands::GetCredentialStatus::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRDoorLockClusterGetCredentialStatusResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)clearCredentialWithParams:(MTRDoorLockClusterClearCredentialParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterClearCredentialParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = DoorLock::Commands::ClearCredential::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)unboltDoorWithCompletion:(MTRStatusCompletion)completion +{ + [self unboltDoorWithParams:nil completion:completion]; +} +- (void)unboltDoorWithParams:(MTRDoorLockClusterUnboltDoorParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterUnboltDoorParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = DoorLock::Commands::UnboltDoor::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)setAliroReaderConfigWithParams:(MTRDoorLockClusterSetAliroReaderConfigParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterSetAliroReaderConfigParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = DoorLock::Commands::SetAliroReaderConfig::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)clearAliroReaderConfigWithCompletion:(MTRStatusCompletion)completion +{ + [self clearAliroReaderConfigWithParams:nil completion:completion]; +} +- (void)clearAliroReaderConfigWithParams:(MTRDoorLockClusterClearAliroReaderConfigParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRDoorLockClusterClearAliroReaderConfigParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = DoorLock::Commands::ClearAliroReaderConfig::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)readAttributeLockStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::LockState::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeLockStateWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DoorLock::Attributes::LockState::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeLockStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::LockState::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeLockTypeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::LockType::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeLockTypeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DoorLock::Attributes::LockType::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeLockTypeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::LockType::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeActuatorEnabledWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::ActuatorEnabled::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeActuatorEnabledWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DoorLock::Attributes::ActuatorEnabled::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeActuatorEnabledWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::ActuatorEnabled::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeDoorStateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::DoorState::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeDoorStateWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DoorLock::Attributes::DoorState::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeDoorStateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::DoorState::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeDoorOpenEventsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::DoorOpenEvents::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)writeAttributeDoorOpenEventsWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +{ + [self writeAttributeDoorOpenEventsWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; +} +- (void)writeAttributeDoorOpenEventsWithValue:(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 = DoorLock::Attributes::DoorOpenEvents::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.unsignedIntValue; + + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); +} + +- (void)subscribeAttributeDoorOpenEventsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DoorLock::Attributes::DoorOpenEvents::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeDoorOpenEventsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::DoorOpenEvents::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeDoorClosedEventsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::DoorClosedEvents::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)writeAttributeDoorClosedEventsWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +{ + [self writeAttributeDoorClosedEventsWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; +} +- (void)writeAttributeDoorClosedEventsWithValue:(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 = DoorLock::Attributes::DoorClosedEvents::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.unsignedIntValue; + + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); +} + +- (void)subscribeAttributeDoorClosedEventsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DoorLock::Attributes::DoorClosedEvents::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeDoorClosedEventsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::DoorClosedEvents::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeOpenPeriodWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::OpenPeriod::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)writeAttributeOpenPeriodWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +{ + [self writeAttributeOpenPeriodWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; +} +- (void)writeAttributeOpenPeriodWithValue:(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 = DoorLock::Attributes::OpenPeriod::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)subscribeAttributeOpenPeriodWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DoorLock::Attributes::OpenPeriod::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeOpenPeriodWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::OpenPeriod::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeNumberOfTotalUsersSupportedWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::NumberOfTotalUsersSupported::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeNumberOfTotalUsersSupportedWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DoorLock::Attributes::NumberOfTotalUsersSupported::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeNumberOfTotalUsersSupportedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::NumberOfTotalUsersSupported::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeNumberOfPINUsersSupportedWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = DoorLock::Attributes::NumberOfPINUsersSupported::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeNumberOfPINUsersSupportedWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = DoorLock::Attributes::NumberOfPINUsersSupported::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeNumberOfPINUsersSupportedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = DoorLock::Attributes::NumberOfPINUsersSupported::TypeInfo; [clusterStateCacheContainer @@ -66968,58 +68070,6 @@ - (void)commitPresetsSchedulesRequestWithParams:(MTRThermostatClusterCommitPrese queue:self.callbackQueue completion:responseHandler]; } -- (void)cancelSetActivePresetRequestWithCompletion:(MTRStatusCompletion)completion -{ - [self cancelSetActivePresetRequestWithParams:nil completion:completion]; -} -- (void)cancelSetActivePresetRequestWithParams:(MTRThermostatClusterCancelSetActivePresetRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRThermostatClusterCancelSetActivePresetRequestParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = Thermostat::Commands::CancelSetActivePresetRequest::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)setTemperatureSetpointHoldPolicyWithParams:(MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = Thermostat::Commands::SetTemperatureSetpointHoldPolicy::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)readAttributeLocalTemperatureWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { @@ -70141,42 +71191,6 @@ + (void)readAttributePresetsSchedulesEditableWithClusterStateCache:(MTRClusterSt completion:completion]; } -- (void)readAttributeTemperatureSetpointHoldPolicyWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = Thermostat::Attributes::TemperatureSetpointHoldPolicy::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)subscribeAttributeTemperatureSetpointHoldPolicyWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = Thermostat::Attributes::TemperatureSetpointHoldPolicy::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeTemperatureSetpointHoldPolicyWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = Thermostat::Attributes::TemperatureSetpointHoldPolicy::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - - (void)readAttributeSetpointHoldExpiryTimestampWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = Thermostat::Attributes::SetpointHoldExpiryTimestamp::TypeInfo; @@ -70213,42 +71227,6 @@ + (void)readAttributeSetpointHoldExpiryTimestampWithClusterStateCache:(MTRCluste completion:completion]; } -- (void)readAttributeQueuedPresetWithCompletion:(void (^)(MTRThermostatClusterQueuedPresetStruct * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = Thermostat::Attributes::QueuedPreset::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)subscribeAttributeQueuedPresetWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(MTRThermostatClusterQueuedPresetStruct * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = Thermostat::Attributes::QueuedPreset::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeQueuedPresetWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRThermostatClusterQueuedPresetStruct * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = Thermostat::Attributes::QueuedPreset::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 = Thermostat::Attributes::GeneratedCommandList::TypeInfo; @@ -93550,6 +94528,42 @@ + (void)readAttributeSSIDWithClusterStateCache:(MTRClusterStateCacheContainer *) completion:completion]; } +- (void)readAttributePassphraseSurrogateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WiFiNetworkManagement::Attributes::PassphraseSurrogate::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributePassphraseSurrogateWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = WiFiNetworkManagement::Attributes::PassphraseSurrogate::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributePassphraseSurrogateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = WiFiNetworkManagement::Attributes::PassphraseSurrogate::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 = WiFiNetworkManagement::Attributes::GeneratedCommandList::TypeInfo; @@ -94341,9 +95355,6 @@ - (void)getOperationalDatasetWithParams:(MTRThreadNetworkDirectoryClusterGetOper }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } using RequestType = ThreadNetworkDirectory::Commands::GetOperationalDataset::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID @@ -94357,7 +95368,7 @@ - (void)getOperationalDatasetWithParams:(MTRThreadNetworkDirectoryClusterGetOper completion:responseHandler]; } -- (void)readAttributePreferredExtendedPanIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributePreferredExtendedPanIDWithCompletion:(void (^)(NSData * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID @@ -94368,11 +95379,11 @@ - (void)readAttributePreferredExtendedPanIDWithCompletion:(void (^)(NSNumber * _ completion:completion]; } -- (void)writeAttributePreferredExtendedPanIDWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion +- (void)writeAttributePreferredExtendedPanIDWithValue:(NSData * _Nullable)value completion:(MTRStatusCompletion)completion { - [self writeAttributePreferredExtendedPanIDWithValue:(NSNumber * _Nullable) value params:nil completion:completion]; + [self writeAttributePreferredExtendedPanIDWithValue:(NSData * _Nullable) value params:nil completion:completion]; } -- (void)writeAttributePreferredExtendedPanIDWithValue:(NSNumber * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)writeAttributePreferredExtendedPanIDWithValue:(NSData * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion { // Make a copy of params before we go async. params = [params copy]; @@ -94393,8 +95404,8 @@ - (void)writeAttributePreferredExtendedPanIDWithValue:(NSNumber * _Nullable)valu cppValue.SetNull(); } else { auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedLongLongValue; - } + nonNullValue_0 = AsByteSpan(value); + } chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); @@ -94403,7 +95414,7 @@ - (void)writeAttributePreferredExtendedPanIDWithValue:(NSNumber * _Nullable)valu - (void)subscribeAttributePreferredExtendedPanIDWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler + reportHandler:(void (^)(NSData * _Nullable value, NSError * _Nullable error))reportHandler { using TypeInfo = ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID @@ -94415,7 +95426,7 @@ - (void)subscribeAttributePreferredExtendedPanIDWithParams:(MTRSubscribeParams * subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributePreferredExtendedPanIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributePreferredExtendedPanIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSData * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::TypeInfo; [clusterStateCacheContainer @@ -98824,40 +99835,481 @@ - (nullable instancetype)initWithDevice:(MTRBaseDevice *)device @end -@implementation MTRBaseClusterLowPower +@implementation MTRBaseClusterLowPower + +- (void)sleepWithCompletion:(MTRStatusCompletion)completion +{ + [self sleepWithParams:nil completion:completion]; +} +- (void)sleepWithParams:(MTRLowPowerClusterSleepParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRLowPowerClusterSleepParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = LowPower::Commands::Sleep::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)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = LowPower::Attributes::GeneratedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = LowPower::Attributes::GeneratedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = LowPower::Attributes::GeneratedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = LowPower::Attributes::AcceptedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = LowPower::Attributes::AcceptedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = LowPower::Attributes::AcceptedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = LowPower::Attributes::EventList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = LowPower::Attributes::EventList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = LowPower::Attributes::EventList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = LowPower::Attributes::AttributeList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = LowPower::Attributes::AttributeList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = LowPower::Attributes::AttributeList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = LowPower::Attributes::FeatureMap::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = LowPower::Attributes::FeatureMap::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = LowPower::Attributes::FeatureMap::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = LowPower::Attributes::ClusterRevision::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = LowPower::Attributes::ClusterRevision::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = LowPower::Attributes::ClusterRevision::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +@end + +@implementation MTRBaseClusterLowPower (Deprecated) + +- (void)sleepWithParams:(MTRLowPowerClusterSleepParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler +{ + [self sleepWithParams:params completion: + completionHandler]; +} +- (void)sleepWithCompletionHandler:(MTRStatusCompletion)completionHandler +{ + [self sleepWithParams:nil completionHandler:completionHandler]; +} + +- (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeGeneratedCommandListWithCompletion: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} +- (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + MTRSubscribeParams * _Nullable subscribeParams = [params copy]; + if (subscribeParams == nil) { + subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; + } else { + subscribeParams.minInterval = minInterval; + subscribeParams.maxInterval = maxInterval; + } + [self subscribeAttributeGeneratedCommandListWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; +} ++ (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeGeneratedCommandListWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} + +- (void)readAttributeAcceptedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeAcceptedCommandListWithCompletion: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} +- (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + MTRSubscribeParams * _Nullable subscribeParams = [params copy]; + if (subscribeParams == nil) { + subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; + } else { + subscribeParams.minInterval = minInterval; + subscribeParams.maxInterval = maxInterval; + } + [self subscribeAttributeAcceptedCommandListWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; +} ++ (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeAcceptedCommandListWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} + +- (void)readAttributeAttributeListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeAttributeListWithCompletion: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} +- (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + MTRSubscribeParams * _Nullable subscribeParams = [params copy]; + if (subscribeParams == nil) { + subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; + } else { + subscribeParams.minInterval = minInterval; + subscribeParams.maxInterval = maxInterval; + } + [self subscribeAttributeAttributeListWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; +} ++ (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeAttributeListWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} + +- (void)readAttributeFeatureMapWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeFeatureMapWithCompletion: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} +- (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + MTRSubscribeParams * _Nullable subscribeParams = [params copy]; + if (subscribeParams == nil) { + subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; + } else { + subscribeParams.minInterval = minInterval; + subscribeParams.maxInterval = maxInterval; + } + [self subscribeAttributeFeatureMapWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; +} ++ (void)readAttributeFeatureMapWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeFeatureMapWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} + +- (void)readAttributeClusterRevisionWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeClusterRevisionWithCompletion: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} +- (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + MTRSubscribeParams * _Nullable subscribeParams = [params copy]; + if (subscribeParams == nil) { + subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; + } else { + subscribeParams.minInterval = minInterval; + subscribeParams.maxInterval = maxInterval; + } + [self subscribeAttributeClusterRevisionWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; +} ++ (void)readAttributeClusterRevisionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeClusterRevisionWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} + +- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device + endpoint:(uint16_t)endpoint + queue:(dispatch_queue_t)queue +{ + return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; +} + +@end + +@implementation MTRBaseClusterKeypadInput -- (void)sleepWithCompletion:(MTRStatusCompletion)completion -{ - [self sleepWithParams:nil completion:completion]; -} -- (void)sleepWithParams:(MTRLowPowerClusterSleepParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)sendKeyWithParams:(MTRKeypadInputClusterSendKeyParams *)params completion:(void (^)(MTRKeypadInputClusterSendKeyResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { - params = [[MTRLowPowerClusterSleepParams + params = [[MTRKeypadInputClusterSendKeyParams alloc] init]; } auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); + completion(response, error); }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = LowPower::Commands::Sleep::Type; + using RequestType = KeypadInput::Commands::SendKey::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) commandPayload:params timedInvokeTimeout:timedInvokeTimeoutMs serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil + responseClass:MTRKeypadInputClusterSendKeyResponseParams.class queue:self.callbackQueue completion:responseHandler]; } - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = LowPower::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = KeypadInput::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -98870,7 +100322,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = LowPower::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = KeypadInput::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -98882,7 +100334,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = LowPower::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = KeypadInput::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -98893,7 +100345,7 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = LowPower::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = KeypadInput::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -98906,7 +100358,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = LowPower::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = KeypadInput::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -98918,7 +100370,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = LowPower::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = KeypadInput::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -98929,7 +100381,7 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = LowPower::Attributes::EventList::TypeInfo; + using TypeInfo = KeypadInput::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -98942,7 +100394,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = LowPower::Attributes::EventList::TypeInfo; + using TypeInfo = KeypadInput::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -98954,7 +100406,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = LowPower::Attributes::EventList::TypeInfo; + using TypeInfo = KeypadInput::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -98965,7 +100417,7 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = LowPower::Attributes::AttributeList::TypeInfo; + using TypeInfo = KeypadInput::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -98978,7 +100430,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = LowPower::Attributes::AttributeList::TypeInfo; + using TypeInfo = KeypadInput::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -98990,7 +100442,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = LowPower::Attributes::AttributeList::TypeInfo; + using TypeInfo = KeypadInput::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -99001,7 +100453,7 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = LowPower::Attributes::FeatureMap::TypeInfo; + using TypeInfo = KeypadInput::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99014,7 +100466,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = LowPower::Attributes::FeatureMap::TypeInfo; + using TypeInfo = KeypadInput::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99026,7 +100478,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = LowPower::Attributes::FeatureMap::TypeInfo; + using TypeInfo = KeypadInput::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -99037,7 +100489,7 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = LowPower::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = KeypadInput::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99050,7 +100502,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = LowPower::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = KeypadInput::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99062,7 +100514,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = LowPower::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = KeypadInput::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -99073,16 +100525,15 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end -@implementation MTRBaseClusterLowPower (Deprecated) +@implementation MTRBaseClusterKeypadInput (Deprecated) -- (void)sleepWithParams:(MTRLowPowerClusterSleepParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler -{ - [self sleepWithParams:params completion: - completionHandler]; -} -- (void)sleepWithCompletionHandler:(MTRStatusCompletion)completionHandler +- (void)sendKeyWithParams:(MTRKeypadInputClusterSendKeyParams *)params completionHandler:(void (^)(MTRKeypadInputClusterSendKeyResponseParams * _Nullable data, NSError * _Nullable error))completionHandler { - [self sleepWithParams:nil completionHandler:completionHandler]; + [self sendKeyWithParams:params completion: + ^(MTRKeypadInputClusterSendKeyResponseParams * _Nullable data, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(data), error); + }]; } - (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler @@ -99269,12 +100720,12 @@ - (nullable instancetype)initWithDevice:(MTRBaseDevice *)device @end -@implementation MTRBaseClusterKeypadInput +@implementation MTRBaseClusterContentLauncher -- (void)sendKeyWithParams:(MTRKeypadInputClusterSendKeyParams *)params completion:(void (^)(MTRKeypadInputClusterSendKeyResponseParams * _Nullable data, NSError * _Nullable error))completion +- (void)launchContentWithParams:(MTRContentLauncherClusterLaunchContentParams *)params completion:(void (^)(MTRContentLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { - params = [[MTRKeypadInputClusterSendKeyParams + params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; } @@ -99284,21 +100735,145 @@ - (void)sendKeyWithParams:(MTRKeypadInputClusterSendKeyParams *)params completio auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = KeypadInput::Commands::SendKey::Type; + using RequestType = ContentLauncher::Commands::LaunchContent::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) commandPayload:params timedInvokeTimeout:timedInvokeTimeoutMs serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTRKeypadInputClusterSendKeyResponseParams.class + responseClass:MTRContentLauncherClusterLauncherResponseParams.class queue:self.callbackQueue completion:responseHandler]; } +- (void)launchURLWithParams:(MTRContentLauncherClusterLaunchURLParams *)params completion:(void (^)(MTRContentLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRContentLauncherClusterLaunchURLParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ContentLauncher::Commands::LaunchURL::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRContentLauncherClusterLauncherResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)readAttributeAcceptHeaderWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ContentLauncher::Attributes::AcceptHeader::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAcceptHeaderWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ContentLauncher::Attributes::AcceptHeader::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAcceptHeaderWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ContentLauncher::Attributes::AcceptHeader::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeSupportedStreamingProtocolsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)writeAttributeSupportedStreamingProtocolsWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +{ + [self writeAttributeSupportedStreamingProtocolsWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; +} +- (void)writeAttributeSupportedStreamingProtocolsWithValue:(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 = ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo; + TypeInfo::Type cppValue; + cppValue = static_cast>(value.unsignedIntValue); + + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); +} + +- (void)subscribeAttributeSupportedStreamingProtocolsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeSupportedStreamingProtocolsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ContentLauncher::Attributes::SupportedStreamingProtocols::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 = KeypadInput::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99311,7 +100886,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = KeypadInput::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99323,7 +100898,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = KeypadInput::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -99334,7 +100909,7 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = KeypadInput::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99347,7 +100922,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = KeypadInput::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99359,7 +100934,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = KeypadInput::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -99370,7 +100945,7 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = KeypadInput::Attributes::EventList::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99383,7 +100958,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = KeypadInput::Attributes::EventList::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99395,7 +100970,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = KeypadInput::Attributes::EventList::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -99406,7 +100981,7 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = KeypadInput::Attributes::AttributeList::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99419,7 +100994,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = KeypadInput::Attributes::AttributeList::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99431,7 +101006,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = KeypadInput::Attributes::AttributeList::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -99442,7 +101017,7 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = KeypadInput::Attributes::FeatureMap::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99455,7 +101030,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = KeypadInput::Attributes::FeatureMap::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99467,7 +101042,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = KeypadInput::Attributes::FeatureMap::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -99478,7 +101053,7 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = KeypadInput::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99491,7 +101066,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = KeypadInput::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99503,7 +101078,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = KeypadInput::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = ContentLauncher::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -99514,15 +101089,101 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end -@implementation MTRBaseClusterKeypadInput (Deprecated) +@implementation MTRBaseClusterContentLauncher (Deprecated) -- (void)sendKeyWithParams:(MTRKeypadInputClusterSendKeyParams *)params completionHandler:(void (^)(MTRKeypadInputClusterSendKeyResponseParams * _Nullable data, NSError * _Nullable error))completionHandler +- (void)launchContentWithParams:(MTRContentLauncherClusterLaunchContentParams *)params completionHandler:(void (^)(MTRContentLauncherClusterLaunchResponseParams * _Nullable data, NSError * _Nullable error))completionHandler { - [self sendKeyWithParams:params completion: - ^(MTRKeypadInputClusterSendKeyResponseParams * _Nullable data, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(data), error); - }]; + [self launchContentWithParams:params completion: + ^(MTRContentLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(data), error); + }]; +} +- (void)launchURLWithParams:(MTRContentLauncherClusterLaunchURLParams *)params completionHandler:(void (^)(MTRContentLauncherClusterLaunchResponseParams * _Nullable data, NSError * _Nullable error))completionHandler +{ + [self launchURLWithParams:params completion: + ^(MTRContentLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(data), error); + }]; +} + +- (void)readAttributeAcceptHeaderWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeAcceptHeaderWithCompletion: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} +- (void)subscribeAttributeAcceptHeaderWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + MTRSubscribeParams * _Nullable subscribeParams = [params copy]; + if (subscribeParams == nil) { + subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; + } else { + subscribeParams.minInterval = minInterval; + subscribeParams.maxInterval = maxInterval; + } + [self subscribeAttributeAcceptHeaderWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; +} ++ (void)readAttributeAcceptHeaderWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeAcceptHeaderWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} + +- (void)readAttributeSupportedStreamingProtocolsWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeSupportedStreamingProtocolsWithCompletion: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} +- (void)writeAttributeSupportedStreamingProtocolsWithValue:(NSNumber * _Nonnull)value completionHandler:(MTRStatusCompletion)completionHandler +{ + [self writeAttributeSupportedStreamingProtocolsWithValue:value params:nil completion:completionHandler]; +} +- (void)writeAttributeSupportedStreamingProtocolsWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler +{ + [self writeAttributeSupportedStreamingProtocolsWithValue:value params:params completion:completionHandler]; +} +- (void)subscribeAttributeSupportedStreamingProtocolsWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + MTRSubscribeParams * _Nullable subscribeParams = [params copy]; + if (subscribeParams == nil) { + subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; + } else { + subscribeParams.minInterval = minInterval; + subscribeParams.maxInterval = maxInterval; + } + [self subscribeAttributeSupportedStreamingProtocolsWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; +} ++ (void)readAttributeSupportedStreamingProtocolsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeSupportedStreamingProtocolsWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; } - (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler @@ -99709,60 +101370,60 @@ - (nullable instancetype)initWithDevice:(MTRBaseDevice *)device @end -@implementation MTRBaseClusterContentLauncher +@implementation MTRBaseClusterAudioOutput -- (void)launchContentWithParams:(MTRContentLauncherClusterLaunchContentParams *)params completion:(void (^)(MTRContentLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion +- (void)selectOutputWithParams:(MTRAudioOutputClusterSelectOutputParams *)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTRContentLauncherClusterLaunchContentParams + params = [[MTRAudioOutputClusterSelectOutputParams alloc] init]; } auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(response, error); + completion(error); }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = ContentLauncher::Commands::LaunchContent::Type; + using RequestType = AudioOutput::Commands::SelectOutput::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) commandPayload:params timedInvokeTimeout:timedInvokeTimeoutMs serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTRContentLauncherClusterLauncherResponseParams.class + responseClass:nil queue:self.callbackQueue completion:responseHandler]; } -- (void)launchURLWithParams:(MTRContentLauncherClusterLaunchURLParams *)params completion:(void (^)(MTRContentLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion +- (void)renameOutputWithParams:(MTRAudioOutputClusterRenameOutputParams *)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTRContentLauncherClusterLaunchURLParams + params = [[MTRAudioOutputClusterRenameOutputParams alloc] init]; } auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(response, error); + completion(error); }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = ContentLauncher::Commands::LaunchURL::Type; + using RequestType = AudioOutput::Commands::RenameOutput::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) commandPayload:params timedInvokeTimeout:timedInvokeTimeoutMs serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTRContentLauncherClusterLauncherResponseParams.class + responseClass:nil queue:self.callbackQueue completion:responseHandler]; } -- (void)readAttributeAcceptHeaderWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeOutputListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentLauncher::Attributes::AcceptHeader::TypeInfo; + using TypeInfo = AudioOutput::Attributes::OutputList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99771,11 +101432,11 @@ - (void)readAttributeAcceptHeaderWithCompletion:(void (^)(NSArray * _Nullable va completion:completion]; } -- (void)subscribeAttributeAcceptHeaderWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeOutputListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentLauncher::Attributes::AcceptHeader::TypeInfo; + using TypeInfo = AudioOutput::Attributes::OutputList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99785,9 +101446,9 @@ - (void)subscribeAttributeAcceptHeaderWithParams:(MTRSubscribeParams * _Nonnull) subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeAcceptHeaderWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeOutputListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentLauncher::Attributes::AcceptHeader::TypeInfo; + using TypeInfo = AudioOutput::Attributes::OutputList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -99796,9 +101457,9 @@ + (void)readAttributeAcceptHeaderWithClusterStateCache:(MTRClusterStateCacheCont completion:completion]; } -- (void)readAttributeSupportedStreamingProtocolsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeCurrentOutputWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo; + using TypeInfo = AudioOutput::Attributes::CurrentOutput::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99807,39 +101468,11 @@ - (void)readAttributeSupportedStreamingProtocolsWithCompletion:(void (^)(NSNumbe completion:completion]; } -- (void)writeAttributeSupportedStreamingProtocolsWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion -{ - [self writeAttributeSupportedStreamingProtocolsWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; -} -- (void)writeAttributeSupportedStreamingProtocolsWithValue:(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 = ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo; - TypeInfo::Type cppValue; - cppValue = static_cast>(value.unsignedIntValue); - - chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); - return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); - std::move(*bridge).DispatchAction(self.device); -} - -- (void)subscribeAttributeSupportedStreamingProtocolsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeCurrentOutputWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo; + using TypeInfo = AudioOutput::Attributes::CurrentOutput::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99849,9 +101482,9 @@ - (void)subscribeAttributeSupportedStreamingProtocolsWithParams:(MTRSubscribePar subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeSupportedStreamingProtocolsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeCurrentOutputWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo; + using TypeInfo = AudioOutput::Attributes::CurrentOutput::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -99862,7 +101495,7 @@ + (void)readAttributeSupportedStreamingProtocolsWithClusterStateCache:(MTRCluste - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentLauncher::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = AudioOutput::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99875,7 +101508,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentLauncher::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = AudioOutput::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99887,7 +101520,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentLauncher::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = AudioOutput::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -99898,7 +101531,7 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentLauncher::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = AudioOutput::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99911,7 +101544,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentLauncher::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = AudioOutput::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99923,7 +101556,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentLauncher::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = AudioOutput::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -99934,7 +101567,7 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentLauncher::Attributes::EventList::TypeInfo; + using TypeInfo = AudioOutput::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99947,7 +101580,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentLauncher::Attributes::EventList::TypeInfo; + using TypeInfo = AudioOutput::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99959,7 +101592,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentLauncher::Attributes::EventList::TypeInfo; + using TypeInfo = AudioOutput::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -99970,7 +101603,7 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentLauncher::Attributes::AttributeList::TypeInfo; + using TypeInfo = AudioOutput::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99983,7 +101616,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentLauncher::Attributes::AttributeList::TypeInfo; + using TypeInfo = AudioOutput::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -99995,7 +101628,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentLauncher::Attributes::AttributeList::TypeInfo; + using TypeInfo = AudioOutput::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -100006,7 +101639,7 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentLauncher::Attributes::FeatureMap::TypeInfo; + using TypeInfo = AudioOutput::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100019,7 +101652,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentLauncher::Attributes::FeatureMap::TypeInfo; + using TypeInfo = AudioOutput::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100031,7 +101664,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentLauncher::Attributes::FeatureMap::TypeInfo; + using TypeInfo = AudioOutput::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -100042,7 +101675,7 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentLauncher::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = AudioOutput::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100055,7 +101688,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentLauncher::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = AudioOutput::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100067,7 +101700,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentLauncher::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = AudioOutput::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -100078,37 +101711,31 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end -@implementation MTRBaseClusterContentLauncher (Deprecated) +@implementation MTRBaseClusterAudioOutput (Deprecated) -- (void)launchContentWithParams:(MTRContentLauncherClusterLaunchContentParams *)params completionHandler:(void (^)(MTRContentLauncherClusterLaunchResponseParams * _Nullable data, NSError * _Nullable error))completionHandler +- (void)selectOutputWithParams:(MTRAudioOutputClusterSelectOutputParams *)params completionHandler:(MTRStatusCompletion)completionHandler { - [self launchContentWithParams:params completion: - ^(MTRContentLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(data), error); - }]; + [self selectOutputWithParams:params completion: + completionHandler]; } -- (void)launchURLWithParams:(MTRContentLauncherClusterLaunchURLParams *)params completionHandler:(void (^)(MTRContentLauncherClusterLaunchResponseParams * _Nullable data, NSError * _Nullable error))completionHandler +- (void)renameOutputWithParams:(MTRAudioOutputClusterRenameOutputParams *)params completionHandler:(MTRStatusCompletion)completionHandler { - [self launchURLWithParams:params completion: - ^(MTRContentLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(data), error); - }]; + [self renameOutputWithParams:params completion: + completionHandler]; } -- (void)readAttributeAcceptHeaderWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +- (void)readAttributeOutputListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler { - [self readAttributeAcceptHeaderWithCompletion: + [self readAttributeOutputListWithCompletion: ^(NSArray * _Nullable value, NSError * _Nullable error) { // Cast is safe because subclass does not add any selectors. completionHandler(static_cast(value), error); }]; } -- (void)subscribeAttributeAcceptHeaderWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeOutputListWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { MTRSubscribeParams * _Nullable subscribeParams = [params copy]; if (subscribeParams == nil) { @@ -100117,41 +101744,33 @@ - (void)subscribeAttributeAcceptHeaderWithMinInterval:(NSNumber * _Nonnull)minIn subscribeParams.minInterval = minInterval; subscribeParams.maxInterval = maxInterval; } - [self subscribeAttributeAcceptHeaderWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSArray * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; + [self subscribeAttributeOutputListWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; } -+ (void)readAttributeAcceptHeaderWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler ++ (void)readAttributeOutputListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler { - [self readAttributeAcceptHeaderWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSArray * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; + [self readAttributeOutputListWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; } -- (void)readAttributeSupportedStreamingProtocolsWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +- (void)readAttributeCurrentOutputWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - [self readAttributeSupportedStreamingProtocolsWithCompletion: + [self readAttributeCurrentOutputWithCompletion: ^(NSNumber * _Nullable value, NSError * _Nullable error) { // Cast is safe because subclass does not add any selectors. completionHandler(static_cast(value), error); }]; } -- (void)writeAttributeSupportedStreamingProtocolsWithValue:(NSNumber * _Nonnull)value completionHandler:(MTRStatusCompletion)completionHandler -{ - [self writeAttributeSupportedStreamingProtocolsWithValue:value params:nil completion:completionHandler]; -} -- (void)writeAttributeSupportedStreamingProtocolsWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler -{ - [self writeAttributeSupportedStreamingProtocolsWithValue:value params:params completion:completionHandler]; -} -- (void)subscribeAttributeSupportedStreamingProtocolsWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeCurrentOutputWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { MTRSubscribeParams * _Nullable subscribeParams = [params copy]; if (subscribeParams == nil) { @@ -100160,19 +101779,19 @@ - (void)subscribeAttributeSupportedStreamingProtocolsWithMinInterval:(NSNumber * subscribeParams.minInterval = minInterval; subscribeParams.maxInterval = maxInterval; } - [self subscribeAttributeSupportedStreamingProtocolsWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; + [self subscribeAttributeCurrentOutputWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; } -+ (void)readAttributeSupportedStreamingProtocolsWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler ++ (void)readAttributeCurrentOutputWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - [self readAttributeSupportedStreamingProtocolsWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; + [self readAttributeCurrentOutputWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; } - (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler @@ -100359,60 +101978,96 @@ - (nullable instancetype)initWithDevice:(MTRBaseDevice *)device @end -@implementation MTRBaseClusterAudioOutput +@implementation MTRBaseClusterApplicationLauncher -- (void)selectOutputWithParams:(MTRAudioOutputClusterSelectOutputParams *)params completion:(MTRStatusCompletion)completion +- (void)launchAppWithCompletion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + [self launchAppWithParams:nil completion:completion]; +} +- (void)launchAppWithParams:(MTRApplicationLauncherClusterLaunchAppParams * _Nullable)params completion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { - params = [[MTRAudioOutputClusterSelectOutputParams + params = [[MTRApplicationLauncherClusterLaunchAppParams alloc] init]; } auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); + completion(response, error); }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = AudioOutput::Commands::SelectOutput::Type; + using RequestType = ApplicationLauncher::Commands::LaunchApp::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) commandPayload:params timedInvokeTimeout:timedInvokeTimeoutMs serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil + responseClass:MTRApplicationLauncherClusterLauncherResponseParams.class queue:self.callbackQueue completion:responseHandler]; } -- (void)renameOutputWithParams:(MTRAudioOutputClusterRenameOutputParams *)params completion:(MTRStatusCompletion)completion +- (void)stopAppWithCompletion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + [self stopAppWithParams:nil completion:completion]; +} +- (void)stopAppWithParams:(MTRApplicationLauncherClusterStopAppParams * _Nullable)params completion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { - params = [[MTRAudioOutputClusterRenameOutputParams + params = [[MTRApplicationLauncherClusterStopAppParams alloc] init]; } auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); + completion(response, error); }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = AudioOutput::Commands::RenameOutput::Type; + using RequestType = ApplicationLauncher::Commands::StopApp::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) commandPayload:params timedInvokeTimeout:timedInvokeTimeoutMs serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil + responseClass:MTRApplicationLauncherClusterLauncherResponseParams.class queue:self.callbackQueue completion:responseHandler]; } +- (void)hideAppWithCompletion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + [self hideAppWithParams:nil completion:completion]; +} +- (void)hideAppWithParams:(MTRApplicationLauncherClusterHideAppParams * _Nullable)params completion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRApplicationLauncherClusterHideAppParams + alloc] init]; + } -- (void)readAttributeOutputListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ApplicationLauncher::Commands::HideApp::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRApplicationLauncherClusterLauncherResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} + +- (void)readAttributeCatalogListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AudioOutput::Attributes::OutputList::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::CatalogList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100421,11 +102076,11 @@ - (void)readAttributeOutputListWithCompletion:(void (^)(NSArray * _Nullable valu completion:completion]; } -- (void)subscribeAttributeOutputListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeCatalogListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = AudioOutput::Attributes::OutputList::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::CatalogList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100435,9 +102090,9 @@ - (void)subscribeAttributeOutputListWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeOutputListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeCatalogListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AudioOutput::Attributes::OutputList::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::CatalogList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -100446,9 +102101,9 @@ + (void)readAttributeOutputListWithClusterStateCache:(MTRClusterStateCacheContai completion:completion]; } -- (void)readAttributeCurrentOutputWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeCurrentAppWithCompletion:(void (^)(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AudioOutput::Attributes::CurrentOutput::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::CurrentApp::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100457,11 +102112,49 @@ - (void)readAttributeCurrentOutputWithCompletion:(void (^)(NSNumber * _Nullable completion:completion]; } -- (void)subscribeAttributeCurrentOutputWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)writeAttributeCurrentAppWithValue:(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable)value completion:(MTRStatusCompletion)completion { - using TypeInfo = AudioOutput::Attributes::CurrentOutput::TypeInfo; + [self writeAttributeCurrentAppWithValue:(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable) value params:nil completion:completion]; +} +- (void)writeAttributeCurrentAppWithValue:(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable)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 = ApplicationLauncher::Attributes::CurrentApp::TypeInfo; + TypeInfo::Type cppValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0.application.catalogVendorID = value.application.catalogVendorID.unsignedShortValue; + nonNullValue_0.application.applicationID = AsCharSpan(value.application.applicationID); + if (value.endpoint != nil) { + auto & definedValue_2 = nonNullValue_0.endpoint.Emplace(); + definedValue_2 = value.endpoint.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)subscribeAttributeCurrentAppWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ApplicationLauncher::Attributes::CurrentApp::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100471,9 +102164,9 @@ - (void)subscribeAttributeCurrentOutputWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeCurrentOutputWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeCurrentAppWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AudioOutput::Attributes::CurrentOutput::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::CurrentApp::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -100484,7 +102177,7 @@ + (void)readAttributeCurrentOutputWithClusterStateCache:(MTRClusterStateCacheCon - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AudioOutput::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100497,7 +102190,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = AudioOutput::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100509,7 +102202,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AudioOutput::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -100520,7 +102213,7 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AudioOutput::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100533,7 +102226,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = AudioOutput::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100545,7 +102238,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AudioOutput::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -100556,7 +102249,7 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AudioOutput::Attributes::EventList::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100569,7 +102262,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = AudioOutput::Attributes::EventList::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100581,7 +102274,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AudioOutput::Attributes::EventList::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -100592,7 +102285,7 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AudioOutput::Attributes::AttributeList::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100605,7 +102298,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = AudioOutput::Attributes::AttributeList::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100617,7 +102310,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AudioOutput::Attributes::AttributeList::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -100628,7 +102321,7 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AudioOutput::Attributes::FeatureMap::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100641,7 +102334,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = AudioOutput::Attributes::FeatureMap::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100653,7 +102346,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AudioOutput::Attributes::FeatureMap::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -100664,7 +102357,7 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AudioOutput::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100677,7 +102370,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = AudioOutput::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -100689,7 +102382,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AudioOutput::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = ApplicationLauncher::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -100700,31 +102393,45 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end -@implementation MTRBaseClusterAudioOutput (Deprecated) +@implementation MTRBaseClusterApplicationLauncher (Deprecated) -- (void)selectOutputWithParams:(MTRAudioOutputClusterSelectOutputParams *)params completionHandler:(MTRStatusCompletion)completionHandler +- (void)launchAppWithParams:(MTRApplicationLauncherClusterLaunchAppParams * _Nullable)params completionHandler:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completionHandler { - [self selectOutputWithParams:params completion: - completionHandler]; + [self launchAppWithParams:params completion: + ^(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(data), error); + }]; } -- (void)renameOutputWithParams:(MTRAudioOutputClusterRenameOutputParams *)params completionHandler:(MTRStatusCompletion)completionHandler +- (void)stopAppWithParams:(MTRApplicationLauncherClusterStopAppParams * _Nullable)params completionHandler:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completionHandler { - [self renameOutputWithParams:params completion: - completionHandler]; + [self stopAppWithParams:params completion: + ^(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(data), error); + }]; +} +- (void)hideAppWithParams:(MTRApplicationLauncherClusterHideAppParams * _Nullable)params completionHandler:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completionHandler +{ + [self hideAppWithParams:params completion: + ^(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(data), error); + }]; } -- (void)readAttributeOutputListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +- (void)readAttributeCatalogListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler { - [self readAttributeOutputListWithCompletion: + [self readAttributeCatalogListWithCompletion: ^(NSArray * _Nullable value, NSError * _Nullable error) { // Cast is safe because subclass does not add any selectors. completionHandler(static_cast(value), error); }]; } -- (void)subscribeAttributeOutputListWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeCatalogListWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { MTRSubscribeParams * _Nullable subscribeParams = [params copy]; if (subscribeParams == nil) { @@ -100733,33 +102440,41 @@ - (void)subscribeAttributeOutputListWithMinInterval:(NSNumber * _Nonnull)minInte subscribeParams.minInterval = minInterval; subscribeParams.maxInterval = maxInterval; } - [self subscribeAttributeOutputListWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSArray * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; + [self subscribeAttributeCatalogListWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; } -+ (void)readAttributeOutputListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler ++ (void)readAttributeCatalogListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler { - [self readAttributeOutputListWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSArray * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; + [self readAttributeCatalogListWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; } -- (void)readAttributeCurrentOutputWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +- (void)readAttributeCurrentAppWithCompletionHandler:(void (^)(MTRApplicationLauncherClusterApplicationEP * _Nullable value, NSError * _Nullable error))completionHandler { - [self readAttributeCurrentOutputWithCompletion: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { + [self readAttributeCurrentAppWithCompletion: + ^(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value, NSError * _Nullable error) { // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); + completionHandler(static_cast(value), error); }]; } -- (void)subscribeAttributeCurrentOutputWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)writeAttributeCurrentAppWithValue:(MTRApplicationLauncherClusterApplicationEP * _Nullable)value completionHandler:(MTRStatusCompletion)completionHandler +{ + [self writeAttributeCurrentAppWithValue:value params:nil completion:completionHandler]; +} +- (void)writeAttributeCurrentAppWithValue:(MTRApplicationLauncherClusterApplicationEP * _Nullable)value params:(MTRWriteParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler +{ + [self writeAttributeCurrentAppWithValue:value params:params completion:completionHandler]; +} +- (void)subscribeAttributeCurrentAppWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(MTRApplicationLauncherClusterApplicationEP * _Nullable value, NSError * _Nullable error))reportHandler { MTRSubscribeParams * _Nullable subscribeParams = [params copy]; if (subscribeParams == nil) { @@ -100768,19 +102483,19 @@ - (void)subscribeAttributeCurrentOutputWithMinInterval:(NSNumber * _Nonnull)minI subscribeParams.minInterval = minInterval; subscribeParams.maxInterval = maxInterval; } - [self subscribeAttributeCurrentOutputWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; + [self subscribeAttributeCurrentAppWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; } -+ (void)readAttributeCurrentOutputWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler ++ (void)readAttributeCurrentAppWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(MTRApplicationLauncherClusterApplicationEP * _Nullable value, NSError * _Nullable error))completionHandler { - [self readAttributeCurrentOutputWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; + [self readAttributeCurrentAppWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; } - (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler @@ -100967,96 +102682,155 @@ - (nullable instancetype)initWithDevice:(MTRBaseDevice *)device @end -@implementation MTRBaseClusterApplicationLauncher +@implementation MTRBaseClusterApplicationBasic -- (void)launchAppWithCompletion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion +- (void)readAttributeVendorNameWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion { - [self launchAppWithParams:nil completion:completion]; + using TypeInfo = ApplicationBasic::Attributes::VendorName::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; } -- (void)launchAppWithParams:(MTRApplicationLauncherClusterLaunchAppParams * _Nullable)params completion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion -{ - if (params == nil) { - params = [[MTRApplicationLauncherClusterLaunchAppParams - alloc] init]; - } - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(response, error); - }; +- (void)subscribeAttributeVendorNameWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ApplicationBasic::Attributes::VendorName::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; ++ (void)readAttributeVendorNameWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ApplicationBasic::Attributes::VendorName::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - using RequestType = ApplicationLauncher::Commands::LaunchApp::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTRApplicationLauncherClusterLauncherResponseParams.class +- (void)readAttributeVendorIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ApplicationBasic::Attributes::VendorID::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil queue:self.callbackQueue - completion:responseHandler]; + completion:completion]; } -- (void)stopAppWithCompletion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion + +- (void)subscribeAttributeVendorIDWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - [self stopAppWithParams:nil completion:completion]; + using TypeInfo = ApplicationBasic::Attributes::VendorID::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; } -- (void)stopAppWithParams:(MTRApplicationLauncherClusterStopAppParams * _Nullable)params completion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion -{ - if (params == nil) { - params = [[MTRApplicationLauncherClusterStopAppParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(response, error); - }; - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; ++ (void)readAttributeVendorIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ApplicationBasic::Attributes::VendorID::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - using RequestType = ApplicationLauncher::Commands::StopApp::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTRApplicationLauncherClusterLauncherResponseParams.class +- (void)readAttributeApplicationNameWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ApplicationBasic::Attributes::ApplicationName::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil queue:self.callbackQueue - completion:responseHandler]; + completion:completion]; } -- (void)hideAppWithCompletion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion + +- (void)subscribeAttributeApplicationNameWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler { - [self hideAppWithParams:nil completion:completion]; + using TypeInfo = ApplicationBasic::Attributes::ApplicationName::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; } -- (void)hideAppWithParams:(MTRApplicationLauncherClusterHideAppParams * _Nullable)params completion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completion + ++ (void)readAttributeApplicationNameWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion { - if (params == nil) { - params = [[MTRApplicationLauncherClusterHideAppParams - alloc] init]; - } + using TypeInfo = ApplicationBasic::Attributes::ApplicationName::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(response, error); - }; +- (void)readAttributeProductIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ApplicationBasic::Attributes::ProductID::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; +- (void)subscribeAttributeProductIDWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ApplicationBasic::Attributes::ProductID::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} - using RequestType = ApplicationLauncher::Commands::HideApp::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTRApplicationLauncherClusterLauncherResponseParams.class - queue:self.callbackQueue - completion:responseHandler]; ++ (void)readAttributeProductIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ApplicationBasic::Attributes::ProductID::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; } -- (void)readAttributeCatalogListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeApplicationWithCompletion:(void (^)(MTRApplicationBasicClusterApplicationStruct * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::CatalogList::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::Application::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101065,11 +102839,11 @@ - (void)readAttributeCatalogListWithCompletion:(void (^)(NSArray * _Nullable val completion:completion]; } -- (void)subscribeAttributeCatalogListWithParams:(MTRSubscribeParams * _Nonnull)params +- (void)subscribeAttributeApplicationWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler + reportHandler:(void (^)(MTRApplicationBasicClusterApplicationStruct * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ApplicationLauncher::Attributes::CatalogList::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::Application::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101079,9 +102853,9 @@ - (void)subscribeAttributeCatalogListWithParams:(MTRSubscribeParams * _Nonnull)p subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeCatalogListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeApplicationWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRApplicationBasicClusterApplicationStruct * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::CatalogList::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::Application::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -101090,9 +102864,9 @@ + (void)readAttributeCatalogListWithClusterStateCache:(MTRClusterStateCacheConta completion:completion]; } -- (void)readAttributeCurrentAppWithCompletion:(void (^)(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeStatusWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::CurrentApp::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::Status::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101101,49 +102875,83 @@ - (void)readAttributeCurrentAppWithCompletion:(void (^)(MTRApplicationLauncherCl completion:completion]; } -- (void)writeAttributeCurrentAppWithValue:(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable)value completion:(MTRStatusCompletion)completion +- (void)subscribeAttributeStatusWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - [self writeAttributeCurrentAppWithValue:(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable) value params:nil completion:completion]; + using TypeInfo = ApplicationBasic::Attributes::Status::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; } -- (void)writeAttributeCurrentAppWithValue:(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion + ++ (void)readAttributeStatusWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - // Make a copy of params before we go async. - params = [params copy]; - value = [value copy]; + using TypeInfo = ApplicationBasic::Attributes::Status::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - 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); - } - } +- (void)readAttributeApplicationVersionWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ApplicationBasic::Attributes::ApplicationVersion::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} - ListFreer listFreer; - using TypeInfo = ApplicationLauncher::Attributes::CurrentApp::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0.application.catalogVendorID = value.application.catalogVendorID.unsignedShortValue; - nonNullValue_0.application.applicationID = AsCharSpan(value.application.applicationID); - if (value.endpoint != nil) { - auto & definedValue_2 = nonNullValue_0.endpoint.Emplace(); - definedValue_2 = value.endpoint.unsignedShortValue; - } - } +- (void)subscribeAttributeApplicationVersionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ApplicationBasic::Attributes::ApplicationVersion::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} - chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); - return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); - std::move(*bridge).DispatchAction(self.device); ++ (void)readAttributeApplicationVersionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ApplicationBasic::Attributes::ApplicationVersion::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; } -- (void)subscribeAttributeCurrentAppWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value, NSError * _Nullable error))reportHandler +- (void)readAttributeAllowedVendorListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::CurrentApp::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::AllowedVendorList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAllowedVendorListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ApplicationBasic::Attributes::AllowedVendorList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101153,9 +102961,9 @@ - (void)subscribeAttributeCurrentAppWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeCurrentAppWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeAllowedVendorListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::CurrentApp::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::AllowedVendorList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -101166,7 +102974,7 @@ + (void)readAttributeCurrentAppWithClusterStateCache:(MTRClusterStateCacheContai - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101179,7 +102987,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ApplicationLauncher::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101191,7 +102999,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -101202,7 +103010,7 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101215,7 +103023,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ApplicationLauncher::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101227,7 +103035,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -101238,7 +103046,7 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::EventList::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101251,7 +103059,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ApplicationLauncher::Attributes::EventList::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101263,7 +103071,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::EventList::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -101274,7 +103082,7 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::AttributeList::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101287,7 +103095,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ApplicationLauncher::Attributes::AttributeList::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101299,7 +103107,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::AttributeList::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -101310,7 +103118,7 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::FeatureMap::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101323,7 +103131,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ApplicationLauncher::Attributes::FeatureMap::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101335,7 +103143,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::FeatureMap::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -101346,7 +103154,7 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101359,7 +103167,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ApplicationLauncher::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101371,7 +103179,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationLauncher::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = ApplicationBasic::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -101380,47 +103188,162 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC completion:completion]; } -@end - -@implementation MTRBaseClusterApplicationLauncher (Deprecated) - -- (void)launchAppWithParams:(MTRApplicationLauncherClusterLaunchAppParams * _Nullable)params completionHandler:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completionHandler +@end + +@implementation MTRBaseClusterApplicationBasic (Deprecated) + +- (void)readAttributeVendorNameWithCompletionHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeVendorNameWithCompletion: + ^(NSString * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} +- (void)subscribeAttributeVendorNameWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler +{ + MTRSubscribeParams * _Nullable subscribeParams = [params copy]; + if (subscribeParams == nil) { + subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; + } else { + subscribeParams.minInterval = minInterval; + subscribeParams.maxInterval = maxInterval; + } + [self subscribeAttributeVendorNameWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSString * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; +} ++ (void)readAttributeVendorNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeVendorNameWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSString * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} + +- (void)readAttributeVendorIDWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeVendorIDWithCompletion: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} +- (void)subscribeAttributeVendorIDWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + MTRSubscribeParams * _Nullable subscribeParams = [params copy]; + if (subscribeParams == nil) { + subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; + } else { + subscribeParams.minInterval = minInterval; + subscribeParams.maxInterval = maxInterval; + } + [self subscribeAttributeVendorIDWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; +} ++ (void)readAttributeVendorIDWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeVendorIDWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} + +- (void)readAttributeApplicationNameWithCompletionHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeApplicationNameWithCompletion: + ^(NSString * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} +- (void)subscribeAttributeApplicationNameWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler +{ + MTRSubscribeParams * _Nullable subscribeParams = [params copy]; + if (subscribeParams == nil) { + subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; + } else { + subscribeParams.minInterval = minInterval; + subscribeParams.maxInterval = maxInterval; + } + [self subscribeAttributeApplicationNameWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSString * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; +} ++ (void)readAttributeApplicationNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeApplicationNameWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSString * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} + +- (void)readAttributeProductIDWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - [self launchAppWithParams:params completion: - ^(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(data), error); - }]; + [self readAttributeProductIDWithCompletion: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; } -- (void)stopAppWithParams:(MTRApplicationLauncherClusterStopAppParams * _Nullable)params completionHandler:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completionHandler +- (void)subscribeAttributeProductIDWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - [self stopAppWithParams:params completion: - ^(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(data), error); - }]; + MTRSubscribeParams * _Nullable subscribeParams = [params copy]; + if (subscribeParams == nil) { + subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; + } else { + subscribeParams.minInterval = minInterval; + subscribeParams.maxInterval = maxInterval; + } + [self subscribeAttributeProductIDWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; } -- (void)hideAppWithParams:(MTRApplicationLauncherClusterHideAppParams * _Nullable)params completionHandler:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error))completionHandler ++ (void)readAttributeProductIDWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - [self hideAppWithParams:params completion: - ^(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(data), error); - }]; + [self readAttributeProductIDWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; } -- (void)readAttributeCatalogListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +- (void)readAttributeApplicationWithCompletionHandler:(void (^)(MTRApplicationBasicClusterApplicationBasicApplication * _Nullable value, NSError * _Nullable error))completionHandler { - [self readAttributeCatalogListWithCompletion: - ^(NSArray * _Nullable value, NSError * _Nullable error) { + [self readAttributeApplicationWithCompletion: + ^(MTRApplicationBasicClusterApplicationStruct * _Nullable value, NSError * _Nullable error) { // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); + completionHandler(static_cast(value), error); }]; } -- (void)subscribeAttributeCatalogListWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval +- (void)subscribeAttributeApplicationWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval params:(MTRSubscribeParams * _Nullable)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler + reportHandler:(void (^)(MTRApplicationBasicClusterApplicationBasicApplication * _Nullable value, NSError * _Nullable error))reportHandler { MTRSubscribeParams * _Nullable subscribeParams = [params copy]; if (subscribeParams == nil) { @@ -101429,41 +103352,68 @@ - (void)subscribeAttributeCatalogListWithMinInterval:(NSNumber * _Nonnull)minInt subscribeParams.minInterval = minInterval; subscribeParams.maxInterval = maxInterval; } - [self subscribeAttributeCatalogListWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSArray * _Nullable value, NSError * _Nullable error) { + [self subscribeAttributeApplicationWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(MTRApplicationBasicClusterApplicationStruct * _Nullable value, NSError * _Nullable error) { // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); + reportHandler(static_cast(value), error); }]; } -+ (void)readAttributeCatalogListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler ++ (void)readAttributeApplicationWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(MTRApplicationBasicClusterApplicationBasicApplication * _Nullable value, NSError * _Nullable error))completionHandler { - [self readAttributeCatalogListWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSArray * _Nullable value, NSError * _Nullable error) { + [self readAttributeApplicationWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(MTRApplicationBasicClusterApplicationStruct * _Nullable value, NSError * _Nullable error) { // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); + completionHandler(static_cast(value), error); }]; } -- (void)readAttributeCurrentAppWithCompletionHandler:(void (^)(MTRApplicationLauncherClusterApplicationEP * _Nullable value, NSError * _Nullable error))completionHandler +- (void)readAttributeStatusWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - [self readAttributeCurrentAppWithCompletion: - ^(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value, NSError * _Nullable error) { + [self readAttributeStatusWithCompletion: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); + completionHandler(static_cast(value), error); }]; } -- (void)writeAttributeCurrentAppWithValue:(MTRApplicationLauncherClusterApplicationEP * _Nullable)value completionHandler:(MTRStatusCompletion)completionHandler +- (void)subscribeAttributeStatusWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - [self writeAttributeCurrentAppWithValue:value params:nil completion:completionHandler]; + MTRSubscribeParams * _Nullable subscribeParams = [params copy]; + if (subscribeParams == nil) { + subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; + } else { + subscribeParams.minInterval = minInterval; + subscribeParams.maxInterval = maxInterval; + } + [self subscribeAttributeStatusWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; } -- (void)writeAttributeCurrentAppWithValue:(MTRApplicationLauncherClusterApplicationEP * _Nullable)value params:(MTRWriteParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler ++ (void)readAttributeStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - [self writeAttributeCurrentAppWithValue:value params:params completion:completionHandler]; + [self readAttributeStatusWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; } -- (void)subscribeAttributeCurrentAppWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(MTRApplicationLauncherClusterApplicationEP * _Nullable value, NSError * _Nullable error))reportHandler + +- (void)readAttributeApplicationVersionWithCompletionHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeApplicationVersionWithCompletion: + ^(NSString * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} +- (void)subscribeAttributeApplicationVersionWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler { MTRSubscribeParams * _Nullable subscribeParams = [params copy]; if (subscribeParams == nil) { @@ -101472,19 +103422,54 @@ - (void)subscribeAttributeCurrentAppWithMinInterval:(NSNumber * _Nonnull)minInte subscribeParams.minInterval = minInterval; subscribeParams.maxInterval = maxInterval; } - [self subscribeAttributeCurrentAppWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; + [self subscribeAttributeApplicationVersionWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSString * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; } -+ (void)readAttributeCurrentAppWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(MTRApplicationLauncherClusterApplicationEP * _Nullable value, NSError * _Nullable error))completionHandler ++ (void)readAttributeApplicationVersionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completionHandler { - [self readAttributeCurrentAppWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; + [self readAttributeApplicationVersionWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSString * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} + +- (void)readAttributeAllowedVendorListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeAllowedVendorListWithCompletion: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} +- (void)subscribeAttributeAllowedVendorListWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + MTRSubscribeParams * _Nullable subscribeParams = [params copy]; + if (subscribeParams == nil) { + subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; + } else { + subscribeParams.minInterval = minInterval; + subscribeParams.maxInterval = maxInterval; + } + [self subscribeAttributeAllowedVendorListWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; +} ++ (void)readAttributeAllowedVendorListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeAllowedVendorListWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSArray * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; } - (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler @@ -101671,299 +103656,97 @@ - (nullable instancetype)initWithDevice:(MTRBaseDevice *)device @end -@implementation MTRBaseClusterApplicationBasic - -- (void)readAttributeVendorNameWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = ApplicationBasic::Attributes::VendorName::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)subscribeAttributeVendorNameWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = ApplicationBasic::Attributes::VendorName::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeVendorNameWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = ApplicationBasic::Attributes::VendorName::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - -- (void)readAttributeVendorIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = ApplicationBasic::Attributes::VendorID::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)subscribeAttributeVendorIDWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = ApplicationBasic::Attributes::VendorID::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeVendorIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = ApplicationBasic::Attributes::VendorID::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - -- (void)readAttributeApplicationNameWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = ApplicationBasic::Attributes::ApplicationName::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)subscribeAttributeApplicationNameWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = ApplicationBasic::Attributes::ApplicationName::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeApplicationNameWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = ApplicationBasic::Attributes::ApplicationName::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} +@implementation MTRBaseClusterAccountLogin -- (void)readAttributeProductIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)getSetupPINWithParams:(MTRAccountLoginClusterGetSetupPINParams *)params completion:(void (^)(MTRAccountLoginClusterGetSetupPINResponseParams * _Nullable data, NSError * _Nullable error))completion { - using TypeInfo = ApplicationBasic::Attributes::ProductID::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} + if (params == nil) { + params = [[MTRAccountLoginClusterGetSetupPINParams + alloc] init]; + } -- (void)subscribeAttributeProductIDWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = ApplicationBasic::Attributes::ProductID::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; -+ (void)readAttributeProductIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = ApplicationBasic::Attributes::ProductID::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } -- (void)readAttributeApplicationWithCompletion:(void (^)(MTRApplicationBasicClusterApplicationStruct * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = ApplicationBasic::Attributes::Application::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil + using RequestType = AccountLogin::Commands::GetSetupPIN::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRAccountLoginClusterGetSetupPINResponseParams.class queue:self.callbackQueue - completion:completion]; -} - -- (void)subscribeAttributeApplicationWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(MTRApplicationBasicClusterApplicationStruct * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = ApplicationBasic::Attributes::Application::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeApplicationWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRApplicationBasicClusterApplicationStruct * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = ApplicationBasic::Attributes::Application::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; + completion:responseHandler]; } - -- (void)readAttributeStatusWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)loginWithParams:(MTRAccountLoginClusterLoginParams *)params completion:(MTRStatusCompletion)completion { - using TypeInfo = ApplicationBasic::Attributes::Status::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} + if (params == nil) { + params = [[MTRAccountLoginClusterLoginParams + alloc] init]; + } -- (void)subscribeAttributeStatusWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = ApplicationBasic::Attributes::Status::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; -+ (void)readAttributeStatusWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = ApplicationBasic::Attributes::Status::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } -- (void)readAttributeApplicationVersionWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = ApplicationBasic::Attributes::ApplicationVersion::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil + using RequestType = AccountLogin::Commands::Login::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:completion]; -} - -- (void)subscribeAttributeApplicationVersionWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = ApplicationBasic::Attributes::ApplicationVersion::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeApplicationVersionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = ApplicationBasic::Attributes::ApplicationVersion::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; + completion:responseHandler]; } - -- (void)readAttributeAllowedVendorListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)logoutWithCompletion:(MTRStatusCompletion)completion { - using TypeInfo = ApplicationBasic::Attributes::AllowedVendorList::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; + [self logoutWithParams:nil completion:completion]; } - -- (void)subscribeAttributeAllowedVendorListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)logoutWithParams:(MTRAccountLoginClusterLogoutParams * _Nullable)params completion:(MTRStatusCompletion)completion { - using TypeInfo = ApplicationBasic::Attributes::AllowedVendorList::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} + if (params == nil) { + params = [[MTRAccountLoginClusterLogoutParams + alloc] init]; + } -+ (void)readAttributeAllowedVendorListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = ApplicationBasic::Attributes::AllowedVendorList::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + if (timedInvokeTimeoutMs == nil) { + timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); + } + + using RequestType = AccountLogin::Commands::Logout::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)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationBasic::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = AccountLogin::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101976,7 +103759,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ApplicationBasic::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = AccountLogin::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -101988,7 +103771,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationBasic::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = AccountLogin::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -101999,7 +103782,7 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationBasic::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = AccountLogin::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102012,7 +103795,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ApplicationBasic::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = AccountLogin::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102024,7 +103807,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationBasic::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = AccountLogin::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -102035,7 +103818,7 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationBasic::Attributes::EventList::TypeInfo; + using TypeInfo = AccountLogin::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102048,7 +103831,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ApplicationBasic::Attributes::EventList::TypeInfo; + using TypeInfo = AccountLogin::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102060,7 +103843,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationBasic::Attributes::EventList::TypeInfo; + using TypeInfo = AccountLogin::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -102071,7 +103854,7 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationBasic::Attributes::AttributeList::TypeInfo; + using TypeInfo = AccountLogin::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102084,7 +103867,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ApplicationBasic::Attributes::AttributeList::TypeInfo; + using TypeInfo = AccountLogin::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102096,7 +103879,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationBasic::Attributes::AttributeList::TypeInfo; + using TypeInfo = AccountLogin::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -102107,7 +103890,7 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationBasic::Attributes::FeatureMap::TypeInfo; + using TypeInfo = AccountLogin::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102120,7 +103903,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ApplicationBasic::Attributes::FeatureMap::TypeInfo; + using TypeInfo = AccountLogin::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102132,7 +103915,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationBasic::Attributes::FeatureMap::TypeInfo; + using TypeInfo = AccountLogin::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -102143,7 +103926,7 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationBasic::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = AccountLogin::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102156,7 +103939,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ApplicationBasic::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = AccountLogin::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102168,7 +103951,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ApplicationBasic::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = AccountLogin::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -102179,286 +103962,29 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end -@implementation MTRBaseClusterApplicationBasic (Deprecated) - -- (void)readAttributeVendorNameWithCompletionHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeVendorNameWithCompletion: - ^(NSString * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} -- (void)subscribeAttributeVendorNameWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler -{ - MTRSubscribeParams * _Nullable subscribeParams = [params copy]; - if (subscribeParams == nil) { - subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; - } else { - subscribeParams.minInterval = minInterval; - subscribeParams.maxInterval = maxInterval; - } - [self subscribeAttributeVendorNameWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSString * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; -} -+ (void)readAttributeVendorNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeVendorNameWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSString * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} - -- (void)readAttributeVendorIDWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeVendorIDWithCompletion: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} -- (void)subscribeAttributeVendorIDWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - MTRSubscribeParams * _Nullable subscribeParams = [params copy]; - if (subscribeParams == nil) { - subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; - } else { - subscribeParams.minInterval = minInterval; - subscribeParams.maxInterval = maxInterval; - } - [self subscribeAttributeVendorIDWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; -} -+ (void)readAttributeVendorIDWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeVendorIDWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} - -- (void)readAttributeApplicationNameWithCompletionHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeApplicationNameWithCompletion: - ^(NSString * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} -- (void)subscribeAttributeApplicationNameWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler -{ - MTRSubscribeParams * _Nullable subscribeParams = [params copy]; - if (subscribeParams == nil) { - subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; - } else { - subscribeParams.minInterval = minInterval; - subscribeParams.maxInterval = maxInterval; - } - [self subscribeAttributeApplicationNameWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSString * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; -} -+ (void)readAttributeApplicationNameWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeApplicationNameWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSString * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} - -- (void)readAttributeProductIDWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeProductIDWithCompletion: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} -- (void)subscribeAttributeProductIDWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - MTRSubscribeParams * _Nullable subscribeParams = [params copy]; - if (subscribeParams == nil) { - subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; - } else { - subscribeParams.minInterval = minInterval; - subscribeParams.maxInterval = maxInterval; - } - [self subscribeAttributeProductIDWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; -} -+ (void)readAttributeProductIDWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeProductIDWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} - -- (void)readAttributeApplicationWithCompletionHandler:(void (^)(MTRApplicationBasicClusterApplicationBasicApplication * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeApplicationWithCompletion: - ^(MTRApplicationBasicClusterApplicationStruct * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} -- (void)subscribeAttributeApplicationWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(MTRApplicationBasicClusterApplicationBasicApplication * _Nullable value, NSError * _Nullable error))reportHandler -{ - MTRSubscribeParams * _Nullable subscribeParams = [params copy]; - if (subscribeParams == nil) { - subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; - } else { - subscribeParams.minInterval = minInterval; - subscribeParams.maxInterval = maxInterval; - } - [self subscribeAttributeApplicationWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(MTRApplicationBasicClusterApplicationStruct * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; -} -+ (void)readAttributeApplicationWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(MTRApplicationBasicClusterApplicationBasicApplication * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeApplicationWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(MTRApplicationBasicClusterApplicationStruct * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} - -- (void)readAttributeStatusWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeStatusWithCompletion: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} -- (void)subscribeAttributeStatusWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - MTRSubscribeParams * _Nullable subscribeParams = [params copy]; - if (subscribeParams == nil) { - subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; - } else { - subscribeParams.minInterval = minInterval; - subscribeParams.maxInterval = maxInterval; - } - [self subscribeAttributeStatusWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; -} -+ (void)readAttributeStatusWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeStatusWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} +@implementation MTRBaseClusterAccountLogin (Deprecated) -- (void)readAttributeApplicationVersionWithCompletionHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeApplicationVersionWithCompletion: - ^(NSString * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} -- (void)subscribeAttributeApplicationVersionWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler -{ - MTRSubscribeParams * _Nullable subscribeParams = [params copy]; - if (subscribeParams == nil) { - subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; - } else { - subscribeParams.minInterval = minInterval; - subscribeParams.maxInterval = maxInterval; - } - [self subscribeAttributeApplicationVersionWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSString * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; -} -+ (void)readAttributeApplicationVersionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completionHandler +- (void)getSetupPINWithParams:(MTRAccountLoginClusterGetSetupPINParams *)params completionHandler:(void (^)(MTRAccountLoginClusterGetSetupPINResponseParams * _Nullable data, NSError * _Nullable error))completionHandler { - [self readAttributeApplicationVersionWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSString * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; + [self getSetupPINWithParams:params completion: + ^(MTRAccountLoginClusterGetSetupPINResponseParams * _Nullable data, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(data), error); + }]; } - -- (void)readAttributeAllowedVendorListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +- (void)loginWithParams:(MTRAccountLoginClusterLoginParams *)params completionHandler:(MTRStatusCompletion)completionHandler { - [self readAttributeAllowedVendorListWithCompletion: - ^(NSArray * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; + [self loginWithParams:params completion: + completionHandler]; } -- (void)subscribeAttributeAllowedVendorListWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)logoutWithParams:(MTRAccountLoginClusterLogoutParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler { - MTRSubscribeParams * _Nullable subscribeParams = [params copy]; - if (subscribeParams == nil) { - subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; - } else { - subscribeParams.minInterval = minInterval; - subscribeParams.maxInterval = maxInterval; - } - [self subscribeAttributeAllowedVendorListWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSArray * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; + [self logoutWithParams:params completion: + completionHandler]; } -+ (void)readAttributeAllowedVendorListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +- (void)logoutWithCompletionHandler:(MTRStatusCompletion)completionHandler { - [self readAttributeAllowedVendorListWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSArray * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; + [self logoutWithParams:nil completionHandler:completionHandler]; } - (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler @@ -102643,41 +104169,230 @@ - (nullable instancetype)initWithDevice:(MTRBaseDevice *)device return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; } -@end +@end + +@implementation MTRBaseClusterContentControl + +- (void)updatePINWithParams:(MTRContentControlClusterUpdatePINParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRContentControlClusterUpdatePINParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ContentControl::Commands::UpdatePIN::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)resetPINWithCompletion:(void (^)(MTRContentControlClusterResetPINResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + [self resetPINWithParams:nil completion:completion]; +} +- (void)resetPINWithParams:(MTRContentControlClusterResetPINParams * _Nullable)params completion:(void (^)(MTRContentControlClusterResetPINResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRContentControlClusterResetPINParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ContentControl::Commands::ResetPIN::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRContentControlClusterResetPINResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} +- (void)enableWithCompletion:(MTRStatusCompletion)completion +{ + [self enableWithParams:nil completion:completion]; +} +- (void)enableWithParams:(MTRContentControlClusterEnableParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRContentControlClusterEnableParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ContentControl::Commands::Enable::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)disableWithCompletion:(MTRStatusCompletion)completion +{ + [self disableWithParams:nil completion:completion]; +} +- (void)disableWithParams:(MTRContentControlClusterDisableParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRContentControlClusterDisableParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ContentControl::Commands::Disable::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)addBonusTimeWithCompletion:(MTRStatusCompletion)completion +{ + [self addBonusTimeWithParams:nil completion:completion]; +} +- (void)addBonusTimeWithParams:(MTRContentControlClusterAddBonusTimeParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRContentControlClusterAddBonusTimeParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ContentControl::Commands::AddBonusTime::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)setScreenDailyTimeWithParams:(MTRContentControlClusterSetScreenDailyTimeParams *)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRContentControlClusterSetScreenDailyTimeParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = ContentControl::Commands::SetScreenDailyTime::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)blockUnratedContentWithCompletion:(MTRStatusCompletion)completion +{ + [self blockUnratedContentWithParams:nil completion:completion]; +} +- (void)blockUnratedContentWithParams:(MTRContentControlClusterBlockUnratedContentParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRContentControlClusterBlockUnratedContentParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; -@implementation MTRBaseClusterAccountLogin + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; -- (void)getSetupPINWithParams:(MTRAccountLoginClusterGetSetupPINParams *)params completion:(void (^)(MTRAccountLoginClusterGetSetupPINResponseParams * _Nullable data, NSError * _Nullable error))completion + using RequestType = ContentControl::Commands::BlockUnratedContent::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)unblockUnratedContentWithCompletion:(MTRStatusCompletion)completion +{ + [self unblockUnratedContentWithParams:nil completion:completion]; +} +- (void)unblockUnratedContentWithParams:(MTRContentControlClusterUnblockUnratedContentParams * _Nullable)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTRAccountLoginClusterGetSetupPINParams + params = [[MTRContentControlClusterUnblockUnratedContentParams alloc] init]; } auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(response, error); + completion(error); }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - using RequestType = AccountLogin::Commands::GetSetupPIN::Type; + using RequestType = ContentControl::Commands::UnblockUnratedContent::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) commandPayload:params timedInvokeTimeout:timedInvokeTimeoutMs serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTRAccountLoginClusterGetSetupPINResponseParams.class + responseClass:nil queue:self.callbackQueue completion:responseHandler]; } -- (void)loginWithParams:(MTRAccountLoginClusterLoginParams *)params completion:(MTRStatusCompletion)completion +- (void)setOnDemandRatingThresholdWithParams:(MTRContentControlClusterSetOnDemandRatingThresholdParams *)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTRAccountLoginClusterLoginParams + params = [[MTRContentControlClusterSetOnDemandRatingThresholdParams alloc] init]; } @@ -102686,11 +104401,8 @@ - (void)loginWithParams:(MTRAccountLoginClusterLoginParams *)params completion:( }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - using RequestType = AccountLogin::Commands::Login::Type; + using RequestType = ContentControl::Commands::SetOnDemandRatingThreshold::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) @@ -102701,14 +104413,10 @@ - (void)loginWithParams:(MTRAccountLoginClusterLoginParams *)params completion:( queue:self.callbackQueue completion:responseHandler]; } -- (void)logoutWithCompletion:(MTRStatusCompletion)completion -{ - [self logoutWithParams:nil completion:completion]; -} -- (void)logoutWithParams:(MTRAccountLoginClusterLogoutParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)setScheduledContentRatingThresholdWithParams:(MTRContentControlClusterSetScheduledContentRatingThresholdParams *)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTRAccountLoginClusterLogoutParams + params = [[MTRContentControlClusterSetScheduledContentRatingThresholdParams alloc] init]; } @@ -102717,11 +104425,8 @@ - (void)logoutWithParams:(MTRAccountLoginClusterLogoutParams * _Nullable)params }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } - using RequestType = AccountLogin::Commands::Logout::Type; + using RequestType = ContentControl::Commands::SetScheduledContentRatingThreshold::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) @@ -102733,9 +104438,9 @@ - (void)logoutWithParams:(MTRAccountLoginClusterLogoutParams * _Nullable)params completion:responseHandler]; } -- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeEnabledWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AccountLogin::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = ContentControl::Attributes::Enabled::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102744,11 +104449,11 @@ - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nul completion:completion]; } -- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeEnabledWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = AccountLogin::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = ContentControl::Attributes::Enabled::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102758,9 +104463,9 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeEnabledWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AccountLogin::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = ContentControl::Attributes::Enabled::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -102769,9 +104474,9 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC completion:completion]; } -- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeOnDemandRatingsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AccountLogin::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = ContentControl::Attributes::OnDemandRatings::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102780,11 +104485,11 @@ - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Null completion:completion]; } -- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeOnDemandRatingsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = AccountLogin::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = ContentControl::Attributes::OnDemandRatings::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102794,9 +104499,9 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeOnDemandRatingsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AccountLogin::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = ContentControl::Attributes::OnDemandRatings::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -102805,9 +104510,9 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa completion:completion]; } -- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeOnDemandRatingThresholdWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AccountLogin::Attributes::EventList::TypeInfo; + using TypeInfo = ContentControl::Attributes::OnDemandRatingThreshold::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102816,11 +104521,11 @@ - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value completion:completion]; } -- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeOnDemandRatingThresholdWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = AccountLogin::Attributes::EventList::TypeInfo; + using TypeInfo = ContentControl::Attributes::OnDemandRatingThreshold::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102830,9 +104535,9 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeOnDemandRatingThresholdWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AccountLogin::Attributes::EventList::TypeInfo; + using TypeInfo = ContentControl::Attributes::OnDemandRatingThreshold::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -102841,9 +104546,9 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain completion:completion]; } -- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeScheduledContentRatingsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AccountLogin::Attributes::AttributeList::TypeInfo; + using TypeInfo = ContentControl::Attributes::ScheduledContentRatings::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102852,11 +104557,11 @@ - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable v completion:completion]; } -- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeScheduledContentRatingsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = AccountLogin::Attributes::AttributeList::TypeInfo; + using TypeInfo = ContentControl::Attributes::ScheduledContentRatings::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102866,9 +104571,9 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeScheduledContentRatingsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AccountLogin::Attributes::AttributeList::TypeInfo; + using TypeInfo = ContentControl::Attributes::ScheduledContentRatings::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -102877,9 +104582,9 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon completion:completion]; } -- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeScheduledContentRatingThresholdWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AccountLogin::Attributes::FeatureMap::TypeInfo; + using TypeInfo = ContentControl::Attributes::ScheduledContentRatingThreshold::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102888,11 +104593,11 @@ - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable val completion:completion]; } -- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeScheduledContentRatingThresholdWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = AccountLogin::Attributes::FeatureMap::TypeInfo; + using TypeInfo = ContentControl::Attributes::ScheduledContentRatingThreshold::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102902,9 +104607,9 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeScheduledContentRatingThresholdWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AccountLogin::Attributes::FeatureMap::TypeInfo; + using TypeInfo = ContentControl::Attributes::ScheduledContentRatingThreshold::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -102913,9 +104618,9 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai completion:completion]; } -- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeScreenDailyTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AccountLogin::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = ContentControl::Attributes::ScreenDailyTime::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102924,11 +104629,11 @@ - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullabl completion:completion]; } -- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params +- (void)subscribeAttributeScreenDailyTimeWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = AccountLogin::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = ContentControl::Attributes::ScreenDailyTime::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -102938,9 +104643,9 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeScreenDailyTimeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = AccountLogin::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = ContentControl::Attributes::ScreenDailyTime::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -102949,487 +104654,326 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC completion:completion]; } -@end - -@implementation MTRBaseClusterAccountLogin (Deprecated) - -- (void)getSetupPINWithParams:(MTRAccountLoginClusterGetSetupPINParams *)params completionHandler:(void (^)(MTRAccountLoginClusterGetSetupPINResponseParams * _Nullable data, NSError * _Nullable error))completionHandler -{ - [self getSetupPINWithParams:params completion: - ^(MTRAccountLoginClusterGetSetupPINResponseParams * _Nullable data, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(data), error); - }]; -} -- (void)loginWithParams:(MTRAccountLoginClusterLoginParams *)params completionHandler:(MTRStatusCompletion)completionHandler -{ - [self loginWithParams:params completion: - completionHandler]; -} -- (void)logoutWithParams:(MTRAccountLoginClusterLogoutParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler -{ - [self logoutWithParams:params completion: - completionHandler]; -} -- (void)logoutWithCompletionHandler:(MTRStatusCompletion)completionHandler +- (void)readAttributeRemainingScreenTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - [self logoutWithParams:nil completionHandler:completionHandler]; + using TypeInfo = ContentControl::Attributes::RemainingScreenTime::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; } -- (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeGeneratedCommandListWithCompletion: - ^(NSArray * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} -- (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler -{ - MTRSubscribeParams * _Nullable subscribeParams = [params copy]; - if (subscribeParams == nil) { - subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; - } else { - subscribeParams.minInterval = minInterval; - subscribeParams.maxInterval = maxInterval; - } - [self subscribeAttributeGeneratedCommandListWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSArray * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; -} -+ (void)readAttributeGeneratedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +- (void)subscribeAttributeRemainingScreenTimeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - [self readAttributeGeneratedCommandListWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSArray * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; + using TypeInfo = ContentControl::Attributes::RemainingScreenTime::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; } -- (void)readAttributeAcceptedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeAcceptedCommandListWithCompletion: - ^(NSArray * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} -- (void)subscribeAttributeAcceptedCommandListWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler -{ - MTRSubscribeParams * _Nullable subscribeParams = [params copy]; - if (subscribeParams == nil) { - subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; - } else { - subscribeParams.minInterval = minInterval; - subscribeParams.maxInterval = maxInterval; - } - [self subscribeAttributeAcceptedCommandListWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSArray * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; -} -+ (void)readAttributeAcceptedCommandListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler ++ (void)readAttributeRemainingScreenTimeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - [self readAttributeAcceptedCommandListWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSArray * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; + using TypeInfo = ContentControl::Attributes::RemainingScreenTime::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; } -- (void)readAttributeAttributeListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeAttributeListWithCompletion: - ^(NSArray * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} -- (void)subscribeAttributeAttributeListWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler -{ - MTRSubscribeParams * _Nullable subscribeParams = [params copy]; - if (subscribeParams == nil) { - subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; - } else { - subscribeParams.minInterval = minInterval; - subscribeParams.maxInterval = maxInterval; - } - [self subscribeAttributeAttributeListWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSArray * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; -} -+ (void)readAttributeAttributeListWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler +- (void)readAttributeBlockUnratedWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - [self readAttributeAttributeListWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSArray * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; + using TypeInfo = ContentControl::Attributes::BlockUnrated::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; } -- (void)readAttributeFeatureMapWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeFeatureMapWithCompletion: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} -- (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - MTRSubscribeParams * _Nullable subscribeParams = [params copy]; - if (subscribeParams == nil) { - subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; - } else { - subscribeParams.minInterval = minInterval; - subscribeParams.maxInterval = maxInterval; - } - [self subscribeAttributeFeatureMapWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; -} -+ (void)readAttributeFeatureMapWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +- (void)subscribeAttributeBlockUnratedWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - [self readAttributeFeatureMapWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; + using TypeInfo = ContentControl::Attributes::BlockUnrated::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; } -- (void)readAttributeClusterRevisionWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler ++ (void)readAttributeBlockUnratedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - [self readAttributeClusterRevisionWithCompletion: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; + using TypeInfo = ContentControl::Attributes::BlockUnrated::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; } -- (void)subscribeAttributeClusterRevisionWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler + +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - MTRSubscribeParams * _Nullable subscribeParams = [params copy]; - if (subscribeParams == nil) { - subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; - } else { - subscribeParams.minInterval = minInterval; - subscribeParams.maxInterval = maxInterval; - } - [self subscribeAttributeClusterRevisionWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; + using TypeInfo = ContentControl::Attributes::GeneratedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; } -+ (void)readAttributeClusterRevisionWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler + +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - [self readAttributeClusterRevisionWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; + using TypeInfo = ContentControl::Attributes::GeneratedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; } -- (nullable instancetype)initWithDevice:(MTRBaseDevice *)device - endpoint:(uint16_t)endpoint - queue:(dispatch_queue_t)queue ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; + using TypeInfo = ContentControl::Attributes::GeneratedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; } -@end - -@implementation MTRBaseClusterContentControl - -- (void)updatePINWithParams:(MTRContentControlClusterUpdatePINParams *)params completion:(MTRStatusCompletion)completion +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - if (params == nil) { - params = [[MTRContentControlClusterUpdatePINParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = ContentControl::Commands::UpdatePIN::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil + using TypeInfo = ContentControl::Attributes::AcceptedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil queue:self.callbackQueue - completion:responseHandler]; -} -- (void)resetPINWithCompletion:(void (^)(MTRContentControlClusterResetPINResponseParams * _Nullable data, NSError * _Nullable error))completion -{ - [self resetPINWithParams:nil completion:completion]; + completion:completion]; } -- (void)resetPINWithParams:(MTRContentControlClusterResetPINParams * _Nullable)params completion:(void (^)(MTRContentControlClusterResetPINResponseParams * _Nullable data, NSError * _Nullable error))completion -{ - if (params == nil) { - params = [[MTRContentControlClusterResetPINParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(response, error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = ContentControl::Commands::ResetPIN::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTRContentControlClusterResetPINResponseParams.class - queue:self.callbackQueue - completion:responseHandler]; -} -- (void)enableWithCompletion:(MTRStatusCompletion)completion -{ - [self enableWithParams:nil completion:completion]; -} -- (void)enableWithParams:(MTRContentControlClusterEnableParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - if (params == nil) { - params = [[MTRContentControlClusterEnableParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = ContentControl::Commands::Enable::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]; + using TypeInfo = ContentControl::Attributes::AcceptedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; } -- (void)disableWithCompletion:(MTRStatusCompletion)completion + ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - [self disableWithParams:nil completion:completion]; + using TypeInfo = ContentControl::Attributes::AcceptedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; } -- (void)disableWithParams:(MTRContentControlClusterDisableParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRContentControlClusterDisableParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = ContentControl::Commands::Disable::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ContentControl::Attributes::EventList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil queue:self.callbackQueue - completion:responseHandler]; + completion:completion]; } -- (void)addBonusTimeWithCompletion:(MTRStatusCompletion)completion + +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - [self addBonusTimeWithParams:nil completion:completion]; + using TypeInfo = ContentControl::Attributes::EventList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; } -- (void)addBonusTimeWithParams:(MTRContentControlClusterAddBonusTimeParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRContentControlClusterAddBonusTimeParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ContentControl::Attributes::EventList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - using RequestType = ContentControl::Commands::AddBonusTime::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ContentControl::Attributes::AttributeList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil queue:self.callbackQueue - completion:responseHandler]; + completion:completion]; } -- (void)setScreenDailyTimeWithParams:(MTRContentControlClusterSetScreenDailyTimeParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRContentControlClusterSetScreenDailyTimeParams - alloc] init]; - } - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ContentControl::Attributes::AttributeList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ContentControl::Attributes::AttributeList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - using RequestType = ContentControl::Commands::SetScreenDailyTime::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ContentControl::Attributes::FeatureMap::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil queue:self.callbackQueue - completion:responseHandler]; + completion:completion]; } -- (void)blockUnratedContentWithCompletion:(MTRStatusCompletion)completion + +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - [self blockUnratedContentWithParams:nil completion:completion]; + using TypeInfo = ContentControl::Attributes::FeatureMap::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; } -- (void)blockUnratedContentWithParams:(MTRContentControlClusterBlockUnratedContentParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRContentControlClusterBlockUnratedContentParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ContentControl::Attributes::FeatureMap::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - using RequestType = ContentControl::Commands::BlockUnratedContent::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ContentControl::Attributes::ClusterRevision::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil queue:self.callbackQueue - completion:responseHandler]; + completion:completion]; } -- (void)unblockUnratedContentWithCompletion:(MTRStatusCompletion)completion + +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - [self unblockUnratedContentWithParams:nil completion:completion]; + using TypeInfo = ContentControl::Attributes::ClusterRevision::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; } -- (void)unblockUnratedContentWithParams:(MTRContentControlClusterUnblockUnratedContentParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRContentControlClusterUnblockUnratedContentParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = ContentControl::Commands::UnblockUnratedContent::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)setOnDemandRatingThresholdWithParams:(MTRContentControlClusterSetOnDemandRatingThresholdParams *)params completion:(MTRStatusCompletion)completion ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - if (params == nil) { - params = [[MTRContentControlClusterSetOnDemandRatingThresholdParams - alloc] init]; - } + using TypeInfo = ContentControl::Attributes::ClusterRevision::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; +@end - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; +@implementation MTRBaseClusterContentAppObserver - using RequestType = ContentControl::Commands::SetOnDemandRatingThreshold::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)setScheduledContentRatingThresholdWithParams:(MTRContentControlClusterSetScheduledContentRatingThresholdParams *)params completion:(MTRStatusCompletion)completion +- (void)contentAppMessageWithParams:(MTRContentAppObserverClusterContentAppMessageParams *)params completion:(void (^)(MTRContentAppObserverClusterContentAppMessageResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { - params = [[MTRContentControlClusterSetScheduledContentRatingThresholdParams + params = [[MTRContentAppObserverClusterContentAppMessageParams alloc] init]; } auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); + completion(response, error); }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = ContentControl::Commands::SetScheduledContentRatingThreshold::Type; + using RequestType = ContentAppObserver::Commands::ContentAppMessage::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) commandPayload:params timedInvokeTimeout:timedInvokeTimeoutMs serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil + responseClass:MTRContentAppObserverClusterContentAppMessageResponseParams.class queue:self.callbackQueue completion:responseHandler]; } -- (void)readAttributeEnabledWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::Enabled::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103438,11 +104982,11 @@ - (void)readAttributeEnabledWithCompletion:(void (^)(NSNumber * _Nullable value, completion:completion]; } -- (void)subscribeAttributeEnabledWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentControl::Attributes::Enabled::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103452,9 +104996,9 @@ - (void)subscribeAttributeEnabledWithParams:(MTRSubscribeParams * _Nonnull)param subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeEnabledWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::Enabled::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -103463,9 +105007,9 @@ + (void)readAttributeEnabledWithClusterStateCache:(MTRClusterStateCacheContainer completion:completion]; } -- (void)readAttributeOnDemandRatingsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::OnDemandRatings::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103474,11 +105018,11 @@ - (void)readAttributeOnDemandRatingsWithCompletion:(void (^)(NSArray * _Nullable completion:completion]; } -- (void)subscribeAttributeOnDemandRatingsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentControl::Attributes::OnDemandRatings::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103488,9 +105032,9 @@ - (void)subscribeAttributeOnDemandRatingsWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeOnDemandRatingsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::OnDemandRatings::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -103499,9 +105043,9 @@ + (void)readAttributeOnDemandRatingsWithClusterStateCache:(MTRClusterStateCacheC completion:completion]; } -- (void)readAttributeOnDemandRatingThresholdWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::OnDemandRatingThreshold::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103510,11 +105054,11 @@ - (void)readAttributeOnDemandRatingThresholdWithCompletion:(void (^)(NSString * completion:completion]; } -- (void)subscribeAttributeOnDemandRatingThresholdWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentControl::Attributes::OnDemandRatingThreshold::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103524,9 +105068,9 @@ - (void)subscribeAttributeOnDemandRatingThresholdWithParams:(MTRSubscribeParams subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeOnDemandRatingThresholdWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::OnDemandRatingThreshold::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -103535,9 +105079,9 @@ + (void)readAttributeOnDemandRatingThresholdWithClusterStateCache:(MTRClusterSta completion:completion]; } -- (void)readAttributeScheduledContentRatingsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::ScheduledContentRatings::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103546,11 +105090,11 @@ - (void)readAttributeScheduledContentRatingsWithCompletion:(void (^)(NSArray * _ completion:completion]; } -- (void)subscribeAttributeScheduledContentRatingsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentControl::Attributes::ScheduledContentRatings::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103560,9 +105104,9 @@ - (void)subscribeAttributeScheduledContentRatingsWithParams:(MTRSubscribeParams subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeScheduledContentRatingsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::ScheduledContentRatings::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -103571,9 +105115,9 @@ + (void)readAttributeScheduledContentRatingsWithClusterStateCache:(MTRClusterSta completion:completion]; } -- (void)readAttributeScheduledContentRatingThresholdWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::ScheduledContentRatingThreshold::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103582,11 +105126,11 @@ - (void)readAttributeScheduledContentRatingThresholdWithCompletion:(void (^)(NSS completion:completion]; } -- (void)subscribeAttributeScheduledContentRatingThresholdWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentControl::Attributes::ScheduledContentRatingThreshold::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103596,9 +105140,9 @@ - (void)subscribeAttributeScheduledContentRatingThresholdWithParams:(MTRSubscrib subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeScheduledContentRatingThresholdWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::ScheduledContentRatingThreshold::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -103607,9 +105151,9 @@ + (void)readAttributeScheduledContentRatingThresholdWithClusterStateCache:(MTRCl completion:completion]; } -- (void)readAttributeScreenDailyTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::ScreenDailyTime::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103618,11 +105162,11 @@ - (void)readAttributeScreenDailyTimeWithCompletion:(void (^)(NSNumber * _Nullabl completion:completion]; } -- (void)subscribeAttributeScreenDailyTimeWithParams:(MTRSubscribeParams * _Nonnull)params +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentControl::Attributes::ScreenDailyTime::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103632,9 +105176,9 @@ - (void)subscribeAttributeScreenDailyTimeWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeScreenDailyTimeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::ScreenDailyTime::TypeInfo; + using TypeInfo = ContentAppObserver::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -103643,9 +105187,13 @@ + (void)readAttributeScreenDailyTimeWithClusterStateCache:(MTRClusterStateCacheC completion:completion]; } -- (void)readAttributeRemainingScreenTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +@end + +@implementation MTRBaseClusterEcosystemInformation + +- (void)readAttributeRemovedOnWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::RemainingScreenTime::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::RemovedOn::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103654,11 +105202,11 @@ - (void)readAttributeRemainingScreenTimeWithCompletion:(void (^)(NSNumber * _Nul completion:completion]; } -- (void)subscribeAttributeRemainingScreenTimeWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeRemovedOnWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentControl::Attributes::RemainingScreenTime::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::RemovedOn::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103668,9 +105216,9 @@ - (void)subscribeAttributeRemainingScreenTimeWithParams:(MTRSubscribeParams * _N subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeRemainingScreenTimeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeRemovedOnWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::RemainingScreenTime::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::RemovedOn::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -103679,22 +105227,22 @@ + (void)readAttributeRemainingScreenTimeWithClusterStateCache:(MTRClusterStateCa completion:completion]; } -- (void)readAttributeBlockUnratedWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeDeviceDirectoryWithParams:(MTRReadParams * _Nullable)params completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::BlockUnrated::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::DeviceDirectory::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) - params:nil + params:params queue:self.callbackQueue completion:completion]; } -- (void)subscribeAttributeBlockUnratedWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeDeviceDirectoryWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentControl::Attributes::BlockUnrated::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::DeviceDirectory::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103704,9 +105252,45 @@ - (void)subscribeAttributeBlockUnratedWithParams:(MTRSubscribeParams * _Nonnull) subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeBlockUnratedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeDeviceDirectoryWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::BlockUnrated::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::DeviceDirectory::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeLocationDirectoryWithParams:(MTRReadParams * _Nullable)params completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EcosystemInformation::Attributes::LocationDirectory::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeLocationDirectoryWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = EcosystemInformation::Attributes::LocationDirectory::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeLocationDirectoryWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = EcosystemInformation::Attributes::LocationDirectory::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -103717,7 +105301,7 @@ + (void)readAttributeBlockUnratedWithClusterStateCache:(MTRClusterStateCacheCont - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103730,7 +105314,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentControl::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103742,7 +105326,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -103753,7 +105337,7 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103766,7 +105350,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentControl::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103778,7 +105362,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -103789,7 +105373,7 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::EventList::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103802,7 +105386,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentControl::Attributes::EventList::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103814,7 +105398,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::EventList::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -103825,7 +105409,7 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::AttributeList::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103838,7 +105422,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentControl::Attributes::AttributeList::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103850,7 +105434,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::AttributeList::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -103861,7 +105445,7 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::FeatureMap::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103874,7 +105458,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentControl::Attributes::FeatureMap::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103886,7 +105470,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::FeatureMap::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -103897,7 +105481,7 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103910,7 +105494,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentControl::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103922,7 +105506,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentControl::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = EcosystemInformation::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -103933,12 +105517,36 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end -@implementation MTRBaseClusterContentAppObserver +@implementation MTRBaseClusterCommissionerControl -- (void)contentAppMessageWithParams:(MTRContentAppObserverClusterContentAppMessageParams *)params completion:(void (^)(MTRContentAppObserverClusterContentAppMessageResponseParams * _Nullable data, NSError * _Nullable error))completion +- (void)requestCommissioningApprovalWithParams:(MTRCommissionerControlClusterRequestCommissioningApprovalParams *)params completion:(MTRStatusCompletion)completion { if (params == nil) { - params = [[MTRContentAppObserverClusterContentAppMessageParams + params = [[MTRCommissionerControlClusterRequestCommissioningApprovalParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = CommissionerControl::Commands::RequestCommissioningApproval::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)commissionNodeWithParams:(MTRCommissionerControlClusterCommissionNodeParams *)params completion:(void (^)(MTRCommissionerControlClusterReverseOpenCommissioningWindowParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRCommissionerControlClusterCommissionNodeParams alloc] init]; } @@ -103948,21 +105556,57 @@ - (void)contentAppMessageWithParams:(MTRContentAppObserverClusterContentAppMessa auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = ContentAppObserver::Commands::ContentAppMessage::Type; + using RequestType = CommissionerControl::Commands::CommissionNode::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) commandPayload:params timedInvokeTimeout:timedInvokeTimeoutMs serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:MTRContentAppObserverClusterContentAppMessageResponseParams.class + responseClass:MTRCommissionerControlClusterReverseOpenCommissioningWindowParams.class queue:self.callbackQueue completion:responseHandler]; } +- (void)readAttributeSupportedDeviceCategoriesWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = CommissionerControl::Attributes::SupportedDeviceCategories::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeSupportedDeviceCategoriesWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = CommissionerControl::Attributes::SupportedDeviceCategories::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeSupportedDeviceCategoriesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = CommissionerControl::Attributes::SupportedDeviceCategories::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 = ContentAppObserver::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::GeneratedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103975,7 +105619,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentAppObserver::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::GeneratedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -103987,7 +105631,7 @@ - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentAppObserver::Attributes::GeneratedCommandList::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::GeneratedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -103998,7 +105642,7 @@ + (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateC - (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentAppObserver::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::AcceptedCommandList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -104011,7 +105655,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentAppObserver::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::AcceptedCommandList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -104023,7 +105667,7 @@ - (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _N + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentAppObserver::Attributes::AcceptedCommandList::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::AcceptedCommandList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -104034,7 +105678,7 @@ + (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCa - (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentAppObserver::Attributes::EventList::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::EventList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -104047,7 +105691,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentAppObserver::Attributes::EventList::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::EventList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -104059,7 +105703,7 @@ - (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)par + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentAppObserver::Attributes::EventList::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::EventList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -104070,7 +105714,7 @@ + (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContain - (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentAppObserver::Attributes::AttributeList::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::AttributeList::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -104083,7 +105727,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentAppObserver::Attributes::AttributeList::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::AttributeList::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -104095,7 +105739,7 @@ - (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentAppObserver::Attributes::AttributeList::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::AttributeList::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -104106,7 +105750,7 @@ + (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheCon - (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentAppObserver::Attributes::FeatureMap::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::FeatureMap::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -104119,7 +105763,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentAppObserver::Attributes::FeatureMap::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::FeatureMap::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -104131,7 +105775,7 @@ - (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)pa + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentAppObserver::Attributes::FeatureMap::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::FeatureMap::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -104142,7 +105786,7 @@ + (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContai - (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentAppObserver::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::ClusterRevision::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -104155,7 +105799,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = ContentAppObserver::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::ClusterRevision::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -104167,7 +105811,7 @@ - (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnu + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = ContentAppObserver::Attributes::ClusterRevision::TypeInfo; + using TypeInfo = CommissionerControl::Attributes::ClusterRevision::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 2b9d4fbba701d5..d6c909120baab5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -151,6 +151,7 @@ typedef NS_ENUM(uint32_t, MTRClusterIDType) { MTRClusterIDTypeValveConfigurationAndControlID MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) = 0x00000081, MTRClusterIDTypeElectricalPowerMeasurementID MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) = 0x00000090, MTRClusterIDTypeElectricalEnergyMeasurementID MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) = 0x00000091, + MTRClusterIDTypeWaterHeaterManagementID MTR_PROVISIONALLY_AVAILABLE = 0x00000094, MTRClusterIDTypeDemandResponseLoadControlID MTR_PROVISIONALLY_AVAILABLE = 0x00000096, MTRClusterIDTypeMessagesID MTR_PROVISIONALLY_AVAILABLE = 0x00000097, MTRClusterIDTypeDeviceEnergyManagementID MTR_PROVISIONALLY_AVAILABLE = 0x00000098, @@ -158,6 +159,7 @@ typedef NS_ENUM(uint32_t, MTRClusterIDType) { MTRClusterIDTypeEnergyPreferenceID MTR_PROVISIONALLY_AVAILABLE = 0x0000009B, MTRClusterIDTypePowerTopologyID MTR_PROVISIONALLY_AVAILABLE = 0x0000009C, MTRClusterIDTypeEnergyEVSEModeID MTR_PROVISIONALLY_AVAILABLE = 0x0000009D, + MTRClusterIDTypeWaterHeaterModeID MTR_PROVISIONALLY_AVAILABLE = 0x0000009E, MTRClusterIDTypeDeviceEnergyManagementModeID MTR_PROVISIONALLY_AVAILABLE = 0x0000009F, MTRClusterIDTypeDoorLockID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000101, MTRClusterIDTypeWindowCoveringID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000102, @@ -202,6 +204,8 @@ typedef NS_ENUM(uint32_t, MTRClusterIDType) { MTRClusterIDTypeAccountLoginID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x0000050E, MTRClusterIDTypeContentControlID MTR_PROVISIONALLY_AVAILABLE = 0x0000050F, MTRClusterIDTypeContentAppObserverID MTR_PROVISIONALLY_AVAILABLE = 0x00000510, + MTRClusterIDTypeEcosystemInformationID MTR_PROVISIONALLY_AVAILABLE = 0x00000750, + MTRClusterIDTypeCommissionerControlID MTR_PROVISIONALLY_AVAILABLE = 0x00000751, MTRClusterIDTypeElectricalMeasurementID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000B04, MTRClusterIDTypeUnitTestingID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0xFFF1FC05, MTRClusterIDTypeSampleMEIID MTR_PROVISIONALLY_AVAILABLE = 0xFFF1FC20, @@ -654,6 +658,8 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterAccessControlAttributeSubjectsPerAccessControlEntryID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000002, MTRAttributeIDTypeClusterAccessControlAttributeTargetsPerAccessControlEntryID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000003, MTRAttributeIDTypeClusterAccessControlAttributeAccessControlEntriesPerFabricID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000004, + MTRAttributeIDTypeClusterAccessControlAttributeCommissioningARLID MTR_PROVISIONALLY_AVAILABLE = 0x00000005, + MTRAttributeIDTypeClusterAccessControlAttributeARLID MTR_PROVISIONALLY_AVAILABLE = 0x00000006, MTRAttributeIDTypeClusterAccessControlAttributeGeneratedCommandListID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterAccessControlAttributeAcceptedCommandListID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, MTRAttributeIDTypeClusterAccessControlAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, @@ -2216,6 +2222,7 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterICDManagementAttributeUserActiveModeTriggerHintID MTR_PROVISIONALLY_AVAILABLE = 0x00000006, MTRAttributeIDTypeClusterICDManagementAttributeUserActiveModeTriggerInstructionID MTR_PROVISIONALLY_AVAILABLE = 0x00000007, MTRAttributeIDTypeClusterICDManagementAttributeOperatingModeID MTR_PROVISIONALLY_AVAILABLE = 0x00000008, + MTRAttributeIDTypeClusterICDManagementAttributeMaximumCheckInBackOffID MTR_PROVISIONALLY_AVAILABLE = 0x00000009, MTRAttributeIDTypeClusterICDManagementAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterICDManagementAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, MTRAttributeIDTypeClusterICDManagementAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, @@ -2624,6 +2631,20 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeFeatureMapID MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) = MTRAttributeIDTypeGlobalAttributeFeatureMapID, MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeClusterRevisionID MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster WaterHeaterManagement attributes + MTRAttributeIDTypeClusterWaterHeaterManagementAttributeHeaterTypesID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRAttributeIDTypeClusterWaterHeaterManagementAttributeHeatDemandID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRAttributeIDTypeClusterWaterHeaterManagementAttributeTankVolumeID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRAttributeIDTypeClusterWaterHeaterManagementAttributeEstimatedHeatRequiredID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + MTRAttributeIDTypeClusterWaterHeaterManagementAttributeTankPercentageID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, + MTRAttributeIDTypeClusterWaterHeaterManagementAttributeBoostStateID MTR_PROVISIONALLY_AVAILABLE = 0x00000005, + MTRAttributeIDTypeClusterWaterHeaterManagementAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, + MTRAttributeIDTypeClusterWaterHeaterManagementAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, + MTRAttributeIDTypeClusterWaterHeaterManagementAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, + MTRAttributeIDTypeClusterWaterHeaterManagementAttributeAttributeListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAttributeListID, + MTRAttributeIDTypeClusterWaterHeaterManagementAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, + MTRAttributeIDTypeClusterWaterHeaterManagementAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster DemandResponseLoadControl attributes MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeLoadControlProgramsID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeNumberOfLoadControlProgramsID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, @@ -2732,6 +2753,18 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterEnergyEVSEModeAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, MTRAttributeIDTypeClusterEnergyEVSEModeAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster WaterHeaterMode attributes + MTRAttributeIDTypeClusterWaterHeaterModeAttributeSupportedModesID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRAttributeIDTypeClusterWaterHeaterModeAttributeCurrentModeID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRAttributeIDTypeClusterWaterHeaterModeAttributeStartUpModeID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRAttributeIDTypeClusterWaterHeaterModeAttributeOnModeID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + MTRAttributeIDTypeClusterWaterHeaterModeAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, + MTRAttributeIDTypeClusterWaterHeaterModeAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, + MTRAttributeIDTypeClusterWaterHeaterModeAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, + MTRAttributeIDTypeClusterWaterHeaterModeAttributeAttributeListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAttributeListID, + MTRAttributeIDTypeClusterWaterHeaterModeAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, + MTRAttributeIDTypeClusterWaterHeaterModeAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster DeviceEnergyManagementMode attributes MTRAttributeIDTypeClusterDeviceEnergyManagementModeAttributeSupportedModesID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTRAttributeIDTypeClusterDeviceEnergyManagementModeAttributeCurrentModeID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, @@ -3456,9 +3489,7 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterThermostatAttributePresetsID MTR_PROVISIONALLY_AVAILABLE = 0x00000050, MTRAttributeIDTypeClusterThermostatAttributeSchedulesID MTR_PROVISIONALLY_AVAILABLE = 0x00000051, MTRAttributeIDTypeClusterThermostatAttributePresetsSchedulesEditableID MTR_PROVISIONALLY_AVAILABLE = 0x00000052, - MTRAttributeIDTypeClusterThermostatAttributeTemperatureSetpointHoldPolicyID MTR_PROVISIONALLY_AVAILABLE = 0x00000053, - MTRAttributeIDTypeClusterThermostatAttributeSetpointHoldExpiryTimestampID MTR_PROVISIONALLY_AVAILABLE = 0x00000054, - MTRAttributeIDTypeClusterThermostatAttributeQueuedPresetID MTR_PROVISIONALLY_AVAILABLE = 0x00000055, + MTRAttributeIDTypeClusterThermostatAttributeSetpointHoldExpiryTimestampID MTR_PROVISIONALLY_AVAILABLE = 0x00000053, MTRAttributeIDTypeClusterThermostatAttributeGeneratedCommandListID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterThermostatAttributeAcceptedCommandListID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, MTRAttributeIDTypeClusterThermostatAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, @@ -4382,7 +4413,8 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterRadonConcentrationMeasurementAttributeClusterRevisionID MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, // Cluster WiFiNetworkManagement attributes - MTRAttributeIDTypeClusterWiFiNetworkManagementAttributeSSIDID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRAttributeIDTypeClusterWiFiNetworkManagementAttributeSSIDID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRAttributeIDTypeClusterWiFiNetworkManagementAttributePassphraseSurrogateID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, MTRAttributeIDTypeClusterWiFiNetworkManagementAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterWiFiNetworkManagementAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, MTRAttributeIDTypeClusterWiFiNetworkManagementAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, @@ -4395,7 +4427,7 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterThreadBorderRouterManagementAttributeBorderAgentIDID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, MTRAttributeIDTypeClusterThreadBorderRouterManagementAttributeThreadVersionID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, MTRAttributeIDTypeClusterThreadBorderRouterManagementAttributeInterfaceEnabledID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, - MTRAttributeIDTypeClusterThreadBorderRouterManagementAttributeActiveDatasetTimestampID MTR_PROVISIONALLY_AVAILABLE = 0x00000005, + MTRAttributeIDTypeClusterThreadBorderRouterManagementAttributeActiveDatasetTimestampID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, MTRAttributeIDTypeClusterThreadBorderRouterManagementAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterThreadBorderRouterManagementAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, MTRAttributeIDTypeClusterThreadBorderRouterManagementAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, @@ -4859,6 +4891,26 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterContentAppObserverAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, MTRAttributeIDTypeClusterContentAppObserverAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster EcosystemInformation attributes + MTRAttributeIDTypeClusterEcosystemInformationAttributeRemovedOnID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRAttributeIDTypeClusterEcosystemInformationAttributeDeviceDirectoryID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRAttributeIDTypeClusterEcosystemInformationAttributeLocationDirectoryID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRAttributeIDTypeClusterEcosystemInformationAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, + MTRAttributeIDTypeClusterEcosystemInformationAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, + MTRAttributeIDTypeClusterEcosystemInformationAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, + MTRAttributeIDTypeClusterEcosystemInformationAttributeAttributeListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAttributeListID, + MTRAttributeIDTypeClusterEcosystemInformationAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, + MTRAttributeIDTypeClusterEcosystemInformationAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + + // Cluster CommissionerControl attributes + MTRAttributeIDTypeClusterCommissionerControlAttributeSupportedDeviceCategoriesID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRAttributeIDTypeClusterCommissionerControlAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, + MTRAttributeIDTypeClusterCommissionerControlAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, + MTRAttributeIDTypeClusterCommissionerControlAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, + MTRAttributeIDTypeClusterCommissionerControlAttributeAttributeListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAttributeListID, + MTRAttributeIDTypeClusterCommissionerControlAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, + MTRAttributeIDTypeClusterCommissionerControlAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster ElectricalMeasurement deprecated attribute names MTRClusterElectricalMeasurementAttributeMeasurementTypeID MTR_DEPRECATED("Please use MTRAttributeIDTypeClusterElectricalMeasurementAttributeMeasurementTypeID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) @@ -5889,6 +5941,12 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { MTRCommandIDTypeClusterLevelControlCommandStopWithOnOffID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000007, MTRCommandIDTypeClusterLevelControlCommandMoveToClosestFrequencyID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000008, + // Cluster AccessControl deprecated command id names + + // Cluster AccessControl commands + MTRCommandIDTypeClusterAccessControlCommandReviewFabricRestrictionsID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRCommandIDTypeClusterAccessControlCommandReviewFabricRestrictionsResponseID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + // Cluster Actions deprecated command id names MTRClusterActionsCommandInstantActionID MTR_DEPRECATED("Please use MTRCommandIDTypeClusterActionsCommandInstantActionID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) @@ -6120,6 +6178,11 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { MTRCommandIDTypeClusterTimeSynchronizationCommandSetDSTOffsetID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, MTRCommandIDTypeClusterTimeSynchronizationCommandSetDefaultNTPID MTR_PROVISIONALLY_AVAILABLE = 0x00000005, + // Cluster BridgedDeviceBasic deprecated command id names + + // Cluster BridgedDeviceBasicInformation commands + MTRCommandIDTypeClusterBridgedDeviceBasicInformationCommandKeepActiveID MTR_PROVISIONALLY_AVAILABLE = 0x00000080, + // Cluster AdministratorCommissioning deprecated command id names MTRClusterAdministratorCommissioningCommandOpenCommissioningWindowID MTR_DEPRECATED("Please use MTRCommandIDTypeClusterAdministratorCommissioningCommandOpenCommissioningWindowID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) @@ -6326,6 +6389,10 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { MTRCommandIDTypeClusterValveConfigurationAndControlCommandOpenID MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) = 0x00000000, MTRCommandIDTypeClusterValveConfigurationAndControlCommandCloseID MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) = 0x00000001, + // Cluster WaterHeaterManagement commands + MTRCommandIDTypeClusterWaterHeaterManagementCommandBoostID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRCommandIDTypeClusterWaterHeaterManagementCommandCancelBoostID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + // Cluster DemandResponseLoadControl commands MTRCommandIDTypeClusterDemandResponseLoadControlCommandRegisterLoadControlProgramRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTRCommandIDTypeClusterDemandResponseLoadControlCommandUnregisterLoadControlProgramRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, @@ -6361,6 +6428,10 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { MTRCommandIDTypeClusterEnergyEVSEModeCommandChangeToModeID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTRCommandIDTypeClusterEnergyEVSEModeCommandChangeToModeResponseID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + // Cluster WaterHeaterMode commands + MTRCommandIDTypeClusterWaterHeaterModeCommandChangeToModeID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRCommandIDTypeClusterWaterHeaterModeCommandChangeToModeResponseID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + // Cluster DeviceEnergyManagementMode commands MTRCommandIDTypeClusterDeviceEnergyManagementModeCommandChangeToModeID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTRCommandIDTypeClusterDeviceEnergyManagementModeCommandChangeToModeResponseID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, @@ -6546,8 +6617,6 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { MTRCommandIDTypeClusterThermostatCommandStartPresetsSchedulesEditRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000007, MTRCommandIDTypeClusterThermostatCommandCancelPresetsSchedulesEditRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000008, MTRCommandIDTypeClusterThermostatCommandCommitPresetsSchedulesRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000009, - MTRCommandIDTypeClusterThermostatCommandCancelSetActivePresetRequestID MTR_PROVISIONALLY_AVAILABLE = 0x0000000A, - MTRCommandIDTypeClusterThermostatCommandSetTemperatureSetpointHoldPolicyID MTR_PROVISIONALLY_AVAILABLE = 0x0000000B, // Cluster FanControl deprecated command id names @@ -6641,9 +6710,9 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { // Cluster ThreadBorderRouterManagement commands MTRCommandIDTypeClusterThreadBorderRouterManagementCommandGetActiveDatasetRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTRCommandIDTypeClusterThreadBorderRouterManagementCommandGetPendingDatasetRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, - MTRCommandIDTypeClusterThreadBorderRouterManagementCommandDatasetResponseID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, - MTRCommandIDTypeClusterThreadBorderRouterManagementCommandSetActiveDatasetRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, - MTRCommandIDTypeClusterThreadBorderRouterManagementCommandSetPendingDatasetRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000005, + MTRCommandIDTypeClusterThreadBorderRouterManagementCommandDatasetResponseID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRCommandIDTypeClusterThreadBorderRouterManagementCommandSetActiveDatasetRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + MTRCommandIDTypeClusterThreadBorderRouterManagementCommandSetPendingDatasetRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, // Cluster ThreadNetworkDirectory commands MTRCommandIDTypeClusterThreadNetworkDirectoryCommandAddNetworkID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, @@ -6867,6 +6936,11 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { MTRCommandIDTypeClusterContentAppObserverCommandContentAppMessageID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTRCommandIDTypeClusterContentAppObserverCommandContentAppMessageResponseID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + // Cluster CommissionerControl commands + MTRCommandIDTypeClusterCommissionerControlCommandRequestCommissioningApprovalID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRCommandIDTypeClusterCommissionerControlCommandCommissionNodeID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRCommandIDTypeClusterCommissionerControlCommandReverseOpenCommissioningWindowID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + // Cluster ElectricalMeasurement deprecated command id names MTRClusterElectricalMeasurementCommandGetProfileInfoResponseCommandID MTR_DEPRECATED("Please use MTRCommandIDTypeClusterElectricalMeasurementCommandGetProfileInfoResponseCommandID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) @@ -7056,6 +7130,8 @@ typedef NS_ENUM(uint32_t, MTREventIDType) { // Cluster AccessControl events MTREventIDTypeClusterAccessControlEventAccessControlEntryChangedID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000000, MTREventIDTypeClusterAccessControlEventAccessControlExtensionChangedID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000001, + MTREventIDTypeClusterAccessControlEventAccessRestrictionEntryChangedID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTREventIDTypeClusterAccessControlEventFabricRestrictionReviewUpdateID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, // Cluster Actions deprecated event names MTRClusterActionsEventStateChangedID @@ -7196,6 +7272,7 @@ typedef NS_ENUM(uint32_t, MTREventIDType) { MTREventIDTypeClusterBridgedDeviceBasicInformationEventShutDownID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000001, MTREventIDTypeClusterBridgedDeviceBasicInformationEventLeaveID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000002, MTREventIDTypeClusterBridgedDeviceBasicInformationEventReachableChangedID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000003, + MTREventIDTypeClusterBridgedDeviceBasicInformationEventActiveChangedID MTR_PROVISIONALLY_AVAILABLE = 0x00000080, // Cluster Switch deprecated event names MTRClusterSwitchEventSwitchLatchedID @@ -7401,9 +7478,6 @@ typedef NS_ENUM(uint32_t, MTREventIDType) { MTREventIDTypeClusterPumpConfigurationAndControlEventAirDetectionID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x0000000F, MTREventIDTypeClusterPumpConfigurationAndControlEventTurbineOperationID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000010, - // Cluster ThreadNetworkDirectory events - MTREventIDTypeClusterThreadNetworkDirectoryEventNetworkChangedID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, - // Cluster TargetNavigator deprecated event names // Cluster TargetNavigator events @@ -7422,6 +7496,9 @@ typedef NS_ENUM(uint32_t, MTREventIDType) { // Cluster ContentControl events MTREventIDTypeClusterContentControlEventRemainingScreenTimeExpiredID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + // Cluster CommissionerControl events + MTREventIDTypeClusterCommissionerControlEventCommissioningRequestResultID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + // Cluster TestCluster deprecated event names MTRClusterTestClusterEventTestEventID MTR_DEPRECATED("Please use MTREventIDTypeClusterUnitTestingEventTestEventID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index 48b47328a79ebb..4f23f2864a7397 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -219,6 +219,9 @@ case MTRClusterIDTypeElectricalEnergyMeasurementID: result = @"ElectricalEnergyMeasurement"; break; + case MTRClusterIDTypeWaterHeaterManagementID: + result = @"WaterHeaterManagement"; + break; case MTRClusterIDTypeDemandResponseLoadControlID: result = @"DemandResponseLoadControl"; break; @@ -240,6 +243,9 @@ case MTRClusterIDTypeEnergyEVSEModeID: result = @"EnergyEVSEMode"; break; + case MTRClusterIDTypeWaterHeaterModeID: + result = @"WaterHeaterMode"; + break; case MTRClusterIDTypeDeviceEnergyManagementModeID: result = @"DeviceEnergyManagementMode"; break; @@ -372,6 +378,12 @@ case MTRClusterIDTypeContentAppObserverID: result = @"ContentAppObserver"; break; + case MTRClusterIDTypeEcosystemInformationID: + result = @"EcosystemInformation"; + break; + case MTRClusterIDTypeCommissionerControlID: + result = @"CommissionerControl"; + break; case MTRClusterIDTypeElectricalMeasurementID: result = @"ElectricalMeasurement"; break; @@ -885,6 +897,14 @@ result = @"AccessControlEntriesPerFabric"; break; + case MTRAttributeIDTypeClusterAccessControlAttributeCommissioningARLID: + result = @"CommissioningARL"; + break; + + case MTRAttributeIDTypeClusterAccessControlAttributeARLID: + result = @"ARL"; + break; + case MTRAttributeIDTypeClusterAccessControlAttributeGeneratedCommandListID: result = @"GeneratedCommandList"; break; @@ -2763,6 +2783,10 @@ result = @"OperatingMode"; break; + case MTRAttributeIDTypeClusterICDManagementAttributeMaximumCheckInBackOffID: + result = @"MaximumCheckInBackOff"; + break; + case MTRAttributeIDTypeClusterICDManagementAttributeGeneratedCommandListID: result = @"GeneratedCommandList"; break; @@ -4310,6 +4334,64 @@ break; } + case MTRClusterIDTypeWaterHeaterManagementID: + + switch (attributeID) { + + // Cluster WaterHeaterManagement attributes + case MTRAttributeIDTypeClusterWaterHeaterManagementAttributeHeaterTypesID: + result = @"HeaterTypes"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterManagementAttributeHeatDemandID: + result = @"HeatDemand"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterManagementAttributeTankVolumeID: + result = @"TankVolume"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterManagementAttributeEstimatedHeatRequiredID: + result = @"EstimatedHeatRequired"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterManagementAttributeTankPercentageID: + result = @"TankPercentage"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterManagementAttributeBoostStateID: + result = @"BoostState"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterManagementAttributeGeneratedCommandListID: + result = @"GeneratedCommandList"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterManagementAttributeAcceptedCommandListID: + result = @"AcceptedCommandList"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterManagementAttributeEventListID: + result = @"EventList"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterManagementAttributeAttributeListID: + result = @"AttributeList"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterManagementAttributeFeatureMapID: + result = @"FeatureMap"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterManagementAttributeClusterRevisionID: + result = @"ClusterRevision"; + break; + + default: + result = [NSString stringWithFormat:@"", attributeID]; + break; + } + case MTRClusterIDTypeDemandResponseLoadControlID: switch (attributeID) { @@ -4756,6 +4838,56 @@ break; } + case MTRClusterIDTypeWaterHeaterModeID: + + switch (attributeID) { + + // Cluster WaterHeaterMode attributes + case MTRAttributeIDTypeClusterWaterHeaterModeAttributeSupportedModesID: + result = @"SupportedModes"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterModeAttributeCurrentModeID: + result = @"CurrentMode"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterModeAttributeStartUpModeID: + result = @"StartUpMode"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterModeAttributeOnModeID: + result = @"OnMode"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterModeAttributeGeneratedCommandListID: + result = @"GeneratedCommandList"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterModeAttributeAcceptedCommandListID: + result = @"AcceptedCommandList"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterModeAttributeEventListID: + result = @"EventList"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterModeAttributeAttributeListID: + result = @"AttributeList"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterModeAttributeFeatureMapID: + result = @"FeatureMap"; + break; + + case MTRAttributeIDTypeClusterWaterHeaterModeAttributeClusterRevisionID: + result = @"ClusterRevision"; + break; + + default: + result = [NSString stringWithFormat:@"", attributeID]; + break; + } + case MTRClusterIDTypeDeviceEnergyManagementModeID: switch (attributeID) { @@ -5645,18 +5777,10 @@ result = @"PresetsSchedulesEditable"; break; - case MTRAttributeIDTypeClusterThermostatAttributeTemperatureSetpointHoldPolicyID: - result = @"TemperatureSetpointHoldPolicy"; - break; - case MTRAttributeIDTypeClusterThermostatAttributeSetpointHoldExpiryTimestampID: result = @"SetpointHoldExpiryTimestamp"; break; - case MTRAttributeIDTypeClusterThermostatAttributeQueuedPresetID: - result = @"QueuedPreset"; - break; - case MTRAttributeIDTypeClusterThermostatAttributeGeneratedCommandListID: result = @"GeneratedCommandList"; break; @@ -7299,6 +7423,10 @@ result = @"SSID"; break; + case MTRAttributeIDTypeClusterWiFiNetworkManagementAttributePassphraseSurrogateID: + result = @"PassphraseSurrogate"; + break; + case MTRAttributeIDTypeClusterWiFiNetworkManagementAttributeGeneratedCommandListID: result = @"GeneratedCommandList"; break; @@ -8072,6 +8200,90 @@ break; } + case MTRClusterIDTypeEcosystemInformationID: + + switch (attributeID) { + + // Cluster EcosystemInformation attributes + case MTRAttributeIDTypeClusterEcosystemInformationAttributeRemovedOnID: + result = @"RemovedOn"; + break; + + case MTRAttributeIDTypeClusterEcosystemInformationAttributeDeviceDirectoryID: + result = @"DeviceDirectory"; + break; + + case MTRAttributeIDTypeClusterEcosystemInformationAttributeLocationDirectoryID: + result = @"LocationDirectory"; + break; + + case MTRAttributeIDTypeClusterEcosystemInformationAttributeGeneratedCommandListID: + result = @"GeneratedCommandList"; + break; + + case MTRAttributeIDTypeClusterEcosystemInformationAttributeAcceptedCommandListID: + result = @"AcceptedCommandList"; + break; + + case MTRAttributeIDTypeClusterEcosystemInformationAttributeEventListID: + result = @"EventList"; + break; + + case MTRAttributeIDTypeClusterEcosystemInformationAttributeAttributeListID: + result = @"AttributeList"; + break; + + case MTRAttributeIDTypeClusterEcosystemInformationAttributeFeatureMapID: + result = @"FeatureMap"; + break; + + case MTRAttributeIDTypeClusterEcosystemInformationAttributeClusterRevisionID: + result = @"ClusterRevision"; + break; + + default: + result = [NSString stringWithFormat:@"", attributeID]; + break; + } + + case MTRClusterIDTypeCommissionerControlID: + + switch (attributeID) { + + // Cluster CommissionerControl attributes + case MTRAttributeIDTypeClusterCommissionerControlAttributeSupportedDeviceCategoriesID: + result = @"SupportedDeviceCategories"; + break; + + case MTRAttributeIDTypeClusterCommissionerControlAttributeGeneratedCommandListID: + result = @"GeneratedCommandList"; + break; + + case MTRAttributeIDTypeClusterCommissionerControlAttributeAcceptedCommandListID: + result = @"AcceptedCommandList"; + break; + + case MTRAttributeIDTypeClusterCommissionerControlAttributeEventListID: + result = @"EventList"; + break; + + case MTRAttributeIDTypeClusterCommissionerControlAttributeAttributeListID: + result = @"AttributeList"; + break; + + case MTRAttributeIDTypeClusterCommissionerControlAttributeFeatureMapID: + result = @"FeatureMap"; + break; + + case MTRAttributeIDTypeClusterCommissionerControlAttributeClusterRevisionID: + result = @"ClusterRevision"; + break; + + default: + result = [NSString stringWithFormat:@"", attributeID]; + break; + } + case MTRClusterIDTypeElectricalMeasurementID: switch (attributeID) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 39024834ce0b37..31af660ff48bdd 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -510,6 +510,8 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterAccessControl : MTRGenericCluster +- (void)reviewFabricRestrictionsWithParams:(MTRAccessControlClusterReviewFabricRestrictionsParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; + - (NSDictionary * _Nullable)readAttributeACLWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributeACLWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributeACLWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); @@ -524,6 +526,10 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - (NSDictionary * _Nullable)readAttributeAccessControlEntriesPerFabricWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); +- (NSDictionary * _Nullable)readAttributeCommissioningARLWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeARLWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); - (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); @@ -544,8 +550,8 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterAccessControl (Availability) /** - * The queue is currently unused, but may be used in the future for calling completions - * for command invocations if commands are added to this cluster. + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID @@ -1699,6 +1705,8 @@ MTR_PROVISIONALLY_AVAILABLE MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRClusterBridgedDeviceBasicInformation : MTRGenericCluster +- (void)keepActiveWithParams:(MTRBridgedDeviceBasicInformationClusterKeepActiveParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; + - (NSDictionary * _Nullable)readAttributeVendorNameWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (NSDictionary * _Nullable)readAttributeVendorIDWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); @@ -1753,8 +1761,8 @@ MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRClusterBridgedDeviceBasicInformation (Availability) /** - * The queue is currently unused, but may be used in the future for calling completions - * for command invocations if commands are added to this cluster. + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID @@ -2110,6 +2118,8 @@ MTR_PROVISIONALLY_AVAILABLE - (NSDictionary * _Nullable)readAttributeOperatingModeWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (NSDictionary * _Nullable)readAttributeMaximumCheckInBackOffWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; @@ -2301,8 +2311,8 @@ MTR_PROVISIONALLY_AVAILABLE /** * Cluster Laundry Dryer Controls - * This cluster supports remotely monitoring and controling the different typs of - functionality available to a drying device, such as a laundry dryer. + * This cluster provides a way to access options associated with the operation of + a laundry dryer device type. */ MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterLaundryDryerControls : MTRGenericCluster @@ -3550,6 +3560,59 @@ MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) @end +/** + * Cluster Water Heater Management + * This cluster is used to allow clients to control the operation of a hot water heating appliance so that it can be used with energy management. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClusterWaterHeaterManagement : MTRGenericCluster + +- (void)boostWithParams:(MTRWaterHeaterManagementClusterBoostParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)cancelBoostWithParams:(MTRWaterHeaterManagementClusterCancelBoostParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)cancelBoostWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion + MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeHeaterTypesWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeHeatDemandWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeTankVolumeWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeEstimatedHeatRequiredWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeTankPercentageWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeBoostStateWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRClusterWaterHeaterManagement (Availability) + +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Demand Response Load Control * This cluster provides an interface to the functionality of Smart Energy Demand Response and Load Control. @@ -3968,6 +4031,56 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster Water Heater Mode + * Attributes and commands for selecting a mode from a list of supported options. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClusterWaterHeaterMode : MTRGenericCluster + +- (void)changeToModeWithParams:(MTRWaterHeaterModeClusterChangeToModeParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRWaterHeaterModeClusterChangeToModeResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeSupportedModesWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeCurrentModeWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeStartUpModeWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeStartUpModeWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeStartUpModeWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeOnModeWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeOnModeWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeOnModeWithValue:(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; + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRClusterWaterHeaterMode (Availability) + +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Device Energy Management Mode * Attributes and commands for selecting a mode from a list of supported options. @@ -4544,10 +4657,6 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - (void)commitPresetsSchedulesRequestWithParams:(MTRThermostatClusterCommitPresetsSchedulesRequestParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)commitPresetsSchedulesRequestWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)cancelSetActivePresetRequestWithParams:(MTRThermostatClusterCancelSetActivePresetRequestParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)cancelSetActivePresetRequestWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion - MTR_PROVISIONALLY_AVAILABLE; -- (void)setTemperatureSetpointHoldPolicyWithParams:(MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeLocalTemperatureWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); @@ -4727,12 +4836,8 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - (NSDictionary * _Nullable)readAttributePresetsSchedulesEditableWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (NSDictionary * _Nullable)readAttributeTemperatureSetpointHoldPolicyWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - - (NSDictionary * _Nullable)readAttributeSetpointHoldExpiryTimestampWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (NSDictionary * _Nullable)readAttributeQueuedPresetWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); - (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); @@ -6065,6 +6170,8 @@ MTR_PROVISIONALLY_AVAILABLE - (NSDictionary * _Nullable)readAttributeSSIDWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (NSDictionary * _Nullable)readAttributePassphraseSurrogateWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; @@ -6895,6 +7002,89 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster Ecosystem Information + * Provides extended device information for all the logical devices represented by a Bridged Node. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClusterEcosystemInformation : MTRGenericCluster + +- (NSDictionary * _Nullable)readAttributeRemovedOnWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeDeviceDirectoryWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeLocationDirectoryWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRClusterEcosystemInformation (Availability) + +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ +- (instancetype _Nullable)initWithDevice:(MTRDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + +/** + * Cluster Commissioner Control + * Supports the ability for clients to request the commissioning of themselves or other nodes onto a fabric which the cluster server can commission onto. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClusterCommissionerControl : MTRGenericCluster + +- (void)requestCommissioningApprovalWithParams:(MTRCommissionerControlClusterRequestCommissioningApprovalParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)commissionNodeWithParams:(MTRCommissionerControlClusterCommissionNodeParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRCommissionerControlClusterReverseOpenCommissioningWindowParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeSupportedDeviceCategoriesWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRClusterCommissionerControl (Availability) + +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Electrical Measurement * Attributes related to the electrical properties of a device. This cluster is used by power outlets and other devices that need to provide instantaneous data as opposed to metrology data which should be retrieved from the metering cluster.. diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 50a659cc520bb1..234021b2e21680 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -1617,6 +1617,33 @@ - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint q @implementation MTRClusterAccessControl +- (void)reviewFabricRestrictionsWithParams:(MTRAccessControlClusterReviewFabricRestrictionsParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRAccessControlClusterReviewFabricRestrictionsParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = AccessControl::Commands::ReviewFabricRestrictions::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)readAttributeACLWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeAccessControlID) attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeACLID) params:params]; @@ -1664,6 +1691,16 @@ - (void)writeAttributeExtensionWithValue:(NSDictionary *)dataVal return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeAccessControlID) attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeAccessControlEntriesPerFabricID) params:params]; } +- (NSDictionary * _Nullable)readAttributeCommissioningARLWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeAccessControlID) attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeCommissioningARLID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeARLWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeAccessControlID) attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeARLID) params:params]; +} + - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeAccessControlID) attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeGeneratedCommandListID) params:params]; @@ -4944,6 +4981,33 @@ - (void)setDefaultNTPWithParams:(MTRTimeSynchronizationClusterSetDefaultNTPParam @implementation MTRClusterBridgedDeviceBasicInformation +- (void)keepActiveWithParams:(MTRBridgedDeviceBasicInformationClusterKeepActiveParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRBridgedDeviceBasicInformationClusterKeepActiveParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = BridgedDeviceBasicInformation::Commands::KeepActive::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)readAttributeVendorNameWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeBridgedDeviceBasicInformationID) attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicInformationAttributeVendorNameID) params:params]; @@ -6152,6 +6216,11 @@ - (void)stayActiveRequestWithParams:(MTRICDManagementClusterStayActiveRequestPar return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeICDManagementID) attributeID:@(MTRAttributeIDTypeClusterICDManagementAttributeOperatingModeID) params:params]; } +- (NSDictionary * _Nullable)readAttributeMaximumCheckInBackOffWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeICDManagementID) attributeID:@(MTRAttributeIDTypeClusterICDManagementAttributeMaximumCheckInBackOffID) params:params]; +} + - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeICDManagementID) attributeID:@(MTRAttributeIDTypeClusterICDManagementAttributeGeneratedCommandListID) params:params]; @@ -9285,6 +9354,128 @@ @implementation MTRClusterElectricalEnergyMeasurement @end +@implementation MTRClusterWaterHeaterManagement + +- (void)boostWithParams:(MTRWaterHeaterManagementClusterBoostParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRWaterHeaterManagementClusterBoostParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = WaterHeaterManagement::Commands::Boost::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)cancelBoostWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + [self cancelBoostWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; +} +- (void)cancelBoostWithParams:(MTRWaterHeaterManagementClusterCancelBoostParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRWaterHeaterManagementClusterCancelBoostParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = WaterHeaterManagement::Commands::CancelBoost::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)readAttributeHeaterTypesWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterManagementID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterManagementAttributeHeaterTypesID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeHeatDemandWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterManagementID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterManagementAttributeHeatDemandID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeTankVolumeWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterManagementID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterManagementAttributeTankVolumeID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeEstimatedHeatRequiredWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterManagementID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterManagementAttributeEstimatedHeatRequiredID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeTankPercentageWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterManagementID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterManagementAttributeTankPercentageID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeBoostStateWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterManagementID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterManagementAttributeBoostStateID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterManagementID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterManagementAttributeGeneratedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterManagementID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterManagementAttributeAcceptedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterManagementID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterManagementAttributeEventListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterManagementID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterManagementAttributeAttributeListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterManagementID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterManagementAttributeFeatureMapID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterManagementID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterManagementAttributeClusterRevisionID) params:params]; +} + +@end + @implementation MTRClusterDemandResponseLoadControl - (void)registerLoadControlProgramRequestWithParams:(MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion @@ -10556,6 +10747,109 @@ - (void)writeAttributeOnModeWithValue:(NSDictionary *)dataValueD @end +@implementation MTRClusterWaterHeaterMode + +- (void)changeToModeWithParams:(MTRWaterHeaterModeClusterChangeToModeParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRWaterHeaterModeClusterChangeToModeResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRWaterHeaterModeClusterChangeToModeParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = WaterHeaterMode::Commands::ChangeToMode::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRWaterHeaterModeClusterChangeToModeResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} + +- (NSDictionary * _Nullable)readAttributeSupportedModesWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterModeID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterModeAttributeSupportedModesID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeCurrentModeWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterModeID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterModeAttributeCurrentModeID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeStartUpModeWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterModeID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterModeAttributeStartUpModeID) params:params]; +} + +- (void)writeAttributeStartUpModeWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +{ + [self writeAttributeStartUpModeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; +} +- (void)writeAttributeStartUpModeWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +{ + NSNumber * timedWriteTimeout = params.timedWriteTimeout; + + [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterModeID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterModeAttributeStartUpModeID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; +} + +- (NSDictionary * _Nullable)readAttributeOnModeWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterModeID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterModeAttributeOnModeID) params:params]; +} + +- (void)writeAttributeOnModeWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +{ + [self writeAttributeOnModeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; +} +- (void)writeAttributeOnModeWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +{ + NSNumber * timedWriteTimeout = params.timedWriteTimeout; + + [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterModeID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterModeAttributeOnModeID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; +} + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterModeID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterModeAttributeGeneratedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterModeID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterModeAttributeAcceptedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterModeID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterModeAttributeEventListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterModeID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterModeAttributeAttributeListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterModeID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterModeAttributeFeatureMapID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWaterHeaterModeID) attributeID:@(MTRAttributeIDTypeClusterWaterHeaterModeAttributeClusterRevisionID) params:params]; +} + +@end + @implementation MTRClusterDeviceEnergyManagementMode - (void)changeToModeWithParams:(MTRDeviceEnergyManagementModeClusterChangeToModeParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRDeviceEnergyManagementModeClusterChangeToModeResponseParams * _Nullable data, NSError * _Nullable error))completion @@ -13070,64 +13364,6 @@ - (void)commitPresetsSchedulesRequestWithParams:(MTRThermostatClusterCommitPrese completion:responseHandler]; } -- (void)cancelSetActivePresetRequestWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion -{ - [self cancelSetActivePresetRequestWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; -} -- (void)cancelSetActivePresetRequestWithParams:(MTRThermostatClusterCancelSetActivePresetRequestParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRThermostatClusterCancelSetActivePresetRequestParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = Thermostat::Commands::CancelSetActivePresetRequest::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)setTemperatureSetpointHoldPolicyWithParams:(MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = Thermostat::Commands::SetTemperatureSetpointHoldPolicy::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)readAttributeLocalTemperatureWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeLocalTemperatureID) params:params]; @@ -13747,21 +13983,11 @@ - (void)writeAttributeSchedulesWithValue:(NSDictionary *)dataVal return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributePresetsSchedulesEditableID) params:params]; } -- (NSDictionary * _Nullable)readAttributeTemperatureSetpointHoldPolicyWithParams:(MTRReadParams * _Nullable)params -{ - return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeTemperatureSetpointHoldPolicyID) params:params]; -} - - (NSDictionary * _Nullable)readAttributeSetpointHoldExpiryTimestampWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeSetpointHoldExpiryTimestampID) params:params]; } -- (NSDictionary * _Nullable)readAttributeQueuedPresetWithParams:(MTRReadParams * _Nullable)params -{ - return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeQueuedPresetID) params:params]; -} - - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeGeneratedCommandListID) params:params]; @@ -16949,6 +17175,11 @@ - (void)networkPassphraseRequestWithParams:(MTRWiFiNetworkManagementClusterNetwo return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWiFiNetworkManagementID) attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkManagementAttributeSSIDID) params:params]; } +- (NSDictionary * _Nullable)readAttributePassphraseSurrogateWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWiFiNetworkManagementID) attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkManagementAttributePassphraseSurrogateID) params:params]; +} + - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeWiFiNetworkManagementID) attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkManagementAttributeGeneratedCommandListID) params:params]; @@ -17230,9 +17461,6 @@ - (void)getOperationalDatasetWithParams:(MTRThreadNetworkDirectoryClusterGetOper }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - if (timedInvokeTimeoutMs == nil) { - timedInvokeTimeoutMs = @(MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS); - } using RequestType = ThreadNetworkDirectory::Commands::GetOperationalDataset::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID @@ -19784,6 +20012,148 @@ - (void)contentAppMessageWithParams:(MTRContentAppObserverClusterContentAppMessa @end +@implementation MTRClusterEcosystemInformation + +- (NSDictionary * _Nullable)readAttributeRemovedOnWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEcosystemInformationID) attributeID:@(MTRAttributeIDTypeClusterEcosystemInformationAttributeRemovedOnID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeDeviceDirectoryWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEcosystemInformationID) attributeID:@(MTRAttributeIDTypeClusterEcosystemInformationAttributeDeviceDirectoryID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeLocationDirectoryWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEcosystemInformationID) attributeID:@(MTRAttributeIDTypeClusterEcosystemInformationAttributeLocationDirectoryID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEcosystemInformationID) attributeID:@(MTRAttributeIDTypeClusterEcosystemInformationAttributeGeneratedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEcosystemInformationID) attributeID:@(MTRAttributeIDTypeClusterEcosystemInformationAttributeAcceptedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEcosystemInformationID) attributeID:@(MTRAttributeIDTypeClusterEcosystemInformationAttributeEventListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEcosystemInformationID) attributeID:@(MTRAttributeIDTypeClusterEcosystemInformationAttributeAttributeListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEcosystemInformationID) attributeID:@(MTRAttributeIDTypeClusterEcosystemInformationAttributeFeatureMapID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeEcosystemInformationID) attributeID:@(MTRAttributeIDTypeClusterEcosystemInformationAttributeClusterRevisionID) params:params]; +} + +@end + +@implementation MTRClusterCommissionerControl + +- (void)requestCommissioningApprovalWithParams:(MTRCommissionerControlClusterRequestCommissioningApprovalParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +{ + if (params == nil) { + params = [[MTRCommissionerControlClusterRequestCommissioningApprovalParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = CommissionerControl::Commands::RequestCommissioningApproval::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)commissionNodeWithParams:(MTRCommissionerControlClusterCommissionNodeParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRCommissionerControlClusterReverseOpenCommissioningWindowParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRCommissionerControlClusterCommissionNodeParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = CommissionerControl::Commands::CommissionNode::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRCommissionerControlClusterReverseOpenCommissioningWindowParams.class + queue:self.callbackQueue + completion:responseHandler]; +} + +- (NSDictionary * _Nullable)readAttributeSupportedDeviceCategoriesWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCommissionerControlID) attributeID:@(MTRAttributeIDTypeClusterCommissionerControlAttributeSupportedDeviceCategoriesID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCommissionerControlID) attributeID:@(MTRAttributeIDTypeClusterCommissionerControlAttributeGeneratedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCommissionerControlID) attributeID:@(MTRAttributeIDTypeClusterCommissionerControlAttributeAcceptedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCommissionerControlID) attributeID:@(MTRAttributeIDTypeClusterCommissionerControlAttributeEventListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCommissionerControlID) attributeID:@(MTRAttributeIDTypeClusterCommissionerControlAttributeAttributeListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCommissionerControlID) attributeID:@(MTRAttributeIDTypeClusterCommissionerControlAttributeFeatureMapID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeCommissionerControlID) attributeID:@(MTRAttributeIDTypeClusterCommissionerControlAttributeClusterRevisionID) params:params]; +} + +@end + @implementation MTRClusterElectricalMeasurement - (void)getProfileInfoCommandWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index 28051bd2275600..4e48aacecef932 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -942,6 +942,55 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRAccessControlClusterReviewFabricRestrictionsParams : NSObject + +@property (nonatomic, copy) NSArray * _Nonnull arl 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 MTRAccessControlClusterReviewFabricRestrictionsResponseParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull token MTR_PROVISIONALLY_AVAILABLE; + +/** + * Initialize an MTRAccessControlClusterReviewFabricRestrictionsResponseParams with a response-value dictionary + * of the sort that MTRDeviceResponseHandler would receive. + * + * Will return nil and hand out an error if the response-value dictionary is not + * a command data response or is not the right command response. + * + * Will return nil and hand out an error if the data response does not match the known + * schema for this command. + */ +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRActionsClusterInstantActionParams : NSObject @@ -2915,6 +2964,36 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRBridgedDeviceBasicInformationClusterKeepActiveParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull stayActiveDuration 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_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRAdministratorCommissioningClusterOpenCommissioningWindowParams : NSObject @@ -5362,6 +5441,74 @@ MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) @property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRWaterHeaterManagementClusterBoostParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull duration MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable oneShot MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable emergencyBoost MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable temporarySetpoint MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable targetPercentage MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable targetReheat 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 MTRWaterHeaterManagementClusterCancelBoostParams : NSObject +/** + * 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 MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams : NSObject @@ -6110,6 +6257,57 @@ MTR_PROVISIONALLY_AVAILABLE error:(NSError * __autoreleasing *)error MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRWaterHeaterModeClusterChangeToModeParams : NSObject + +@property (nonatomic, copy, getter=getNewMode) NSNumber * _Nonnull newMode 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 MTRWaterHeaterModeClusterChangeToModeResponseParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull status MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSString * _Nullable statusText MTR_PROVISIONALLY_AVAILABLE; + +/** + * Initialize an MTRWaterHeaterModeClusterChangeToModeResponseParams with a response-value dictionary + * of the sort that MTRDeviceResponseHandler would receive. + * + * Will return nil and hand out an error if the response-value dictionary is not + * a command data response or is not the right command response. + * + * Will return nil and hand out an error if the data response does not match the known + * schema for this command. + */ +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTRDeviceEnergyManagementModeClusterChangeToModeParams : NSObject @@ -7689,8 +7887,6 @@ MTR_PROVISIONALLY_AVAILABLE @interface MTRThermostatClusterSetActivePresetRequestParams : NSObject @property (nonatomic, copy) NSData * _Nonnull presetHandle MTR_PROVISIONALLY_AVAILABLE; - -@property (nonatomic, copy) NSNumber * _Nullable delayMinutes MTR_PROVISIONALLY_AVAILABLE; /** * Controls whether the command is a timed command (using Timed Invoke). * @@ -7803,64 +7999,6 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; @end -MTR_PROVISIONALLY_AVAILABLE -@interface MTRThermostatClusterCancelSetActivePresetRequestParams : NSObject -/** - * 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 MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams : NSObject - -@property (nonatomic, copy) NSNumber * _Nonnull temperatureSetpointHoldPolicy 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_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) @interface MTRFanControlClusterStepParams : NSObject @@ -8831,7 +8969,7 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRThreadNetworkDirectoryClusterRemoveNetworkParams : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull extendedPanID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSData * _Nonnull extendedPanID MTR_PROVISIONALLY_AVAILABLE; /** * Controls whether the command is a timed command (using Timed Invoke). * @@ -8861,7 +8999,7 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRThreadNetworkDirectoryClusterGetOperationalDatasetParams : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull extendedPanID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSData * _Nonnull extendedPanID MTR_PROVISIONALLY_AVAILABLE; /** * Controls whether the command is a timed command (using Timed Invoke). * @@ -10737,6 +10875,105 @@ MTR_PROVISIONALLY_AVAILABLE error:(NSError * __autoreleasing *)error MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRCommissionerControlClusterRequestCommissioningApprovalParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull requestId MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nonnull vendorId MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nonnull productId MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSString * _Nullable label 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 MTRCommissionerControlClusterCommissionNodeParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull requestId MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nonnull responseTimeoutSeconds MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSData * _Nullable ipAddress MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable port 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 MTRCommissionerControlClusterReverseOpenCommissioningWindowParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull commissioningTimeout MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSData * _Nonnull pakePasscodeVerifier MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nonnull discriminator MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nonnull iterations MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSData * _Nonnull salt MTR_PROVISIONALLY_AVAILABLE; + +/** + * Initialize an MTRCommissionerControlClusterReverseOpenCommissioningWindowParams with a response-value dictionary + * of the sort that MTRDeviceResponseHandler would receive. + * + * Will return nil and hand out an error if the response-value dictionary is not + * a command data response or is not the right command response. + * + * Will return nil and hand out an error if the data response does not match the known + * schema for this command. + */ +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRElectricalMeasurementClusterGetProfileInfoResponseCommandParams : NSObject diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 01a7844ada5f32..2302daefbc7b75 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -2511,6 +2511,191 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end +@implementation MTRAccessControlClusterReviewFabricRestrictionsParams +- (instancetype)init +{ + if (self = [super init]) { + + _arl = [NSArray array]; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRAccessControlClusterReviewFabricRestrictionsParams alloc] init]; + + other.arl = self.arl; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: arl:%@; >", NSStringFromClass([self class]), _arl]; + return descriptionString; +} + +@end + +@implementation MTRAccessControlClusterReviewFabricRestrictionsParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::AccessControl::Commands::ReviewFabricRestrictions::Type encodableStruct; + ListFreer listFreer; + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.arl.count != 0) { + auto * listHolder_0 = new ListHolder(self.arl.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.arl.count; ++i_0) { + if (![self.arl[i_0] isKindOfClass:[MTRAccessControlClusterAccessRestrictionStruct class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (MTRAccessControlClusterAccessRestrictionStruct *) self.arl[i_0]; + listHolder_0->mList[i_0].type = static_castmList[i_0].type)>>(element_0.type.unsignedCharValue); + if (element_0.id == nil) { + listHolder_0->mList[i_0].id.SetNull(); + } else { + auto & nonNullValue_2 = listHolder_0->mList[i_0].id.SetNonNull(); + nonNullValue_2 = element_0.id.unsignedIntValue; + } + } + encodableStruct.arl = ListType_0(listHolder_0->mList, self.arl.count); + } else { + encodableStruct.arl = ListType_0(); + } + } + } + + 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 MTRAccessControlClusterReviewFabricRestrictionsResponseParams +- (instancetype)init +{ + if (self = [super init]) { + + _token = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRAccessControlClusterReviewFabricRestrictionsResponseParams alloc] init]; + + other.token = self.token; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: token:%@; >", NSStringFromClass([self class]), _token]; + return descriptionString; +} + +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error +{ + if (!(self = [super init])) { + return nil; + } + + using DecodableType = chip::app::Clusters::AccessControl::Commands::ReviewFabricRestrictionsResponse::DecodableType; + chip::System::PacketBufferHandle buffer = [MTRBaseDevice _responseDataForCommand:responseValue + clusterID:DecodableType::GetClusterId() + commandID:DecodableType::GetCommandId() + error:error]; + if (buffer.IsNull()) { + return nil; + } + + chip::TLV::TLVReader reader; + reader.Init(buffer->Start(), buffer->DataLength()); + + CHIP_ERROR err = reader.Next(chip::TLV::AnonymousTag()); + if (err == CHIP_NO_ERROR) { + DecodableType decodedStruct; + err = chip::app::DataModel::Decode(reader, decodedStruct); + if (err == CHIP_NO_ERROR) { + err = [self _setFieldsFromDecodableStruct:decodedStruct]; + if (err == CHIP_NO_ERROR) { + return self; + } + } + } + + NSString * errorStr = [NSString stringWithFormat:@"Command payload decoding failed: %s", err.AsString()]; + MTR_LOG_ERROR("%s", errorStr.UTF8String); + if (error != nil) { + NSDictionary * userInfo = @{ NSLocalizedFailureReasonErrorKey : NSLocalizedString(errorStr, nil) }; + *error = [NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeSchemaMismatch userInfo:userInfo]; + } + return nil; +} + +@end + +@implementation MTRAccessControlClusterReviewFabricRestrictionsResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::AccessControl::Commands::ReviewFabricRestrictionsResponse::DecodableType &)decodableStruct +{ + { + self.token = [NSNumber numberWithUnsignedLongLong:decodableStruct.token]; + } + return CHIP_NO_ERROR; +} + +@end + @implementation MTRActionsClusterInstantActionParams - (instancetype)init { @@ -7556,6 +7741,85 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end +@implementation MTRBridgedDeviceBasicInformationClusterKeepActiveParams +- (instancetype)init +{ + if (self = [super init]) { + + _stayActiveDuration = @(0); + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRBridgedDeviceBasicInformationClusterKeepActiveParams alloc] init]; + + other.stayActiveDuration = self.stayActiveDuration; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: stayActiveDuration:%@; >", NSStringFromClass([self class]), _stayActiveDuration]; + return descriptionString; +} + +@end + +@implementation MTRBridgedDeviceBasicInformationClusterKeepActiveParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::BridgedDeviceBasicInformation::Commands::KeepActive::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.stayActiveDuration = self.stayActiveDuration.unsignedIntValue; + } + + 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 MTRAdministratorCommissioningClusterOpenCommissioningWindowParams - (instancetype)init { @@ -13068,13 +13332,44 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } listFreer.add(listHolder_2); for (size_t i_2 = 0; i_2 < element_0.attributeValueList.count; ++i_2) { - if (![element_0.attributeValueList[i_2] isKindOfClass:[MTRScenesManagementClusterAttributeValuePair class]]) { + if (![element_0.attributeValueList[i_2] isKindOfClass:[MTRScenesManagementClusterAttributeValuePairStruct class]]) { // Wrong kind of value. return CHIP_ERROR_INVALID_ARGUMENT; } - auto element_2 = (MTRScenesManagementClusterAttributeValuePair *) element_0.attributeValueList[i_2]; + auto element_2 = (MTRScenesManagementClusterAttributeValuePairStruct *) element_0.attributeValueList[i_2]; listHolder_2->mList[i_2].attributeID = element_2.attributeID.unsignedIntValue; - listHolder_2->mList[i_2].attributeValue = element_2.attributeValue.unsignedIntValue; + if (element_2.valueUnsigned8 != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].valueUnsigned8.Emplace(); + definedValue_4 = element_2.valueUnsigned8.unsignedCharValue; + } + if (element_2.valueSigned8 != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].valueSigned8.Emplace(); + definedValue_4 = element_2.valueSigned8.charValue; + } + if (element_2.valueUnsigned16 != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].valueUnsigned16.Emplace(); + definedValue_4 = element_2.valueUnsigned16.unsignedShortValue; + } + if (element_2.valueSigned16 != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].valueSigned16.Emplace(); + definedValue_4 = element_2.valueSigned16.shortValue; + } + if (element_2.valueUnsigned32 != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].valueUnsigned32.Emplace(); + definedValue_4 = element_2.valueUnsigned32.unsignedIntValue; + } + if (element_2.valueSigned32 != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].valueSigned32.Emplace(); + definedValue_4 = element_2.valueSigned32.intValue; + } + if (element_2.valueUnsigned64 != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].valueUnsigned64.Emplace(); + definedValue_4 = element_2.valueUnsigned64.unsignedLongLongValue; + } + if (element_2.valueSigned64 != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].valueSigned64.Emplace(); + definedValue_4 = element_2.valueSigned64.longLongValue; + } } listHolder_0->mList[i_0].attributeValueList = ListType_2(listHolder_2->mList, element_0.attributeValueList.count); } else { @@ -13431,10 +13726,49 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ScenesMa auto iter_3 = entry_1.attributeValueList.begin(); while (iter_3.Next()) { auto & entry_3 = iter_3.GetValue(); - MTRScenesManagementClusterAttributeValuePair * newElement_3; - newElement_3 = [MTRScenesManagementClusterAttributeValuePair new]; + MTRScenesManagementClusterAttributeValuePairStruct * newElement_3; + newElement_3 = [MTRScenesManagementClusterAttributeValuePairStruct new]; newElement_3.attributeID = [NSNumber numberWithUnsignedInt:entry_3.attributeID]; - newElement_3.attributeValue = [NSNumber numberWithUnsignedInt:entry_3.attributeValue]; + if (entry_3.valueUnsigned8.HasValue()) { + newElement_3.valueUnsigned8 = [NSNumber numberWithUnsignedChar:entry_3.valueUnsigned8.Value()]; + } else { + newElement_3.valueUnsigned8 = nil; + } + if (entry_3.valueSigned8.HasValue()) { + newElement_3.valueSigned8 = [NSNumber numberWithChar:entry_3.valueSigned8.Value()]; + } else { + newElement_3.valueSigned8 = nil; + } + if (entry_3.valueUnsigned16.HasValue()) { + newElement_3.valueUnsigned16 = [NSNumber numberWithUnsignedShort:entry_3.valueUnsigned16.Value()]; + } else { + newElement_3.valueUnsigned16 = nil; + } + if (entry_3.valueSigned16.HasValue()) { + newElement_3.valueSigned16 = [NSNumber numberWithShort:entry_3.valueSigned16.Value()]; + } else { + newElement_3.valueSigned16 = nil; + } + if (entry_3.valueUnsigned32.HasValue()) { + newElement_3.valueUnsigned32 = [NSNumber numberWithUnsignedInt:entry_3.valueUnsigned32.Value()]; + } else { + newElement_3.valueUnsigned32 = nil; + } + if (entry_3.valueSigned32.HasValue()) { + newElement_3.valueSigned32 = [NSNumber numberWithInt:entry_3.valueSigned32.Value()]; + } else { + newElement_3.valueSigned32 = nil; + } + if (entry_3.valueUnsigned64.HasValue()) { + newElement_3.valueUnsigned64 = [NSNumber numberWithUnsignedLongLong:entry_3.valueUnsigned64.Value()]; + } else { + newElement_3.valueUnsigned64 = nil; + } + if (entry_3.valueSigned64.HasValue()) { + newElement_3.valueSigned64 = [NSNumber numberWithLongLong:entry_3.valueSigned64.Value()]; + } else { + newElement_3.valueSigned64 = nil; + } [array_3 addObject:newElement_3]; } CHIP_ERROR err = iter_3.GetStatus(); @@ -14940,7 +15274,204 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end -@implementation MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams +@implementation MTRWaterHeaterManagementClusterBoostParams +- (instancetype)init +{ + if (self = [super init]) { + + _duration = @(0); + + _oneShot = nil; + + _emergencyBoost = nil; + + _temporarySetpoint = nil; + + _targetPercentage = nil; + + _targetReheat = nil; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRWaterHeaterManagementClusterBoostParams alloc] init]; + + other.duration = self.duration; + other.oneShot = self.oneShot; + other.emergencyBoost = self.emergencyBoost; + other.temporarySetpoint = self.temporarySetpoint; + other.targetPercentage = self.targetPercentage; + other.targetReheat = self.targetReheat; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: duration:%@; oneShot:%@; emergencyBoost:%@; temporarySetpoint:%@; targetPercentage:%@; targetReheat:%@; >", NSStringFromClass([self class]), _duration, _oneShot, _emergencyBoost, _temporarySetpoint, _targetPercentage, _targetReheat]; + return descriptionString; +} + +@end + +@implementation MTRWaterHeaterManagementClusterBoostParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::WaterHeaterManagement::Commands::Boost::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.duration = self.duration.unsignedIntValue; + } + { + if (self.oneShot != nil) { + auto & definedValue_0 = encodableStruct.oneShot.Emplace(); + definedValue_0 = self.oneShot.boolValue; + } + } + { + if (self.emergencyBoost != nil) { + auto & definedValue_0 = encodableStruct.emergencyBoost.Emplace(); + definedValue_0 = self.emergencyBoost.boolValue; + } + } + { + if (self.temporarySetpoint != nil) { + auto & definedValue_0 = encodableStruct.temporarySetpoint.Emplace(); + definedValue_0 = self.temporarySetpoint.shortValue; + } + } + { + if (self.targetPercentage != nil) { + auto & definedValue_0 = encodableStruct.targetPercentage.Emplace(); + definedValue_0 = self.targetPercentage.unsignedCharValue; + } + } + { + if (self.targetReheat != nil) { + auto & definedValue_0 = encodableStruct.targetReheat.Emplace(); + definedValue_0 = self.targetReheat.unsignedCharValue; + } + } + + 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 MTRWaterHeaterManagementClusterCancelBoostParams +- (instancetype)init +{ + if (self = [super init]) { + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRWaterHeaterManagementClusterCancelBoostParams alloc] init]; + + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; + return descriptionString; +} + +@end + +@implementation MTRWaterHeaterManagementClusterCancelBoostParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::WaterHeaterManagement::Commands::CancelBoost::Type encodableStruct; + ListFreer listFreer; + + 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 MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams - (instancetype)init { if (self = [super init]) { @@ -17323,7 +17854,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::EnergyEv @end -@implementation MTRDeviceEnergyManagementModeClusterChangeToModeParams +@implementation MTRWaterHeaterModeClusterChangeToModeParams - (instancetype)init { if (self = [super init]) { @@ -17337,7 +17868,7 @@ - (instancetype)init - (id)copyWithZone:(NSZone * _Nullable)zone; { - auto other = [[MTRDeviceEnergyManagementModeClusterChangeToModeParams alloc] init]; + auto other = [[MTRWaterHeaterModeClusterChangeToModeParams alloc] init]; other.newMode = self.newMode; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; @@ -17354,11 +17885,11 @@ - (NSString *)description @end -@implementation MTRDeviceEnergyManagementModeClusterChangeToModeParams (InternalMethods) +@implementation MTRWaterHeaterModeClusterChangeToModeParams (InternalMethods) - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader { - chip::app::Clusters::DeviceEnergyManagementMode::Commands::ChangeToMode::Type encodableStruct; + chip::app::Clusters::WaterHeaterMode::Commands::ChangeToMode::Type encodableStruct; ListFreer listFreer; { encodableStruct.newMode = self.newMode.unsignedCharValue; @@ -17402,7 +17933,7 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end -@implementation MTRDeviceEnergyManagementModeClusterChangeToModeResponseParams +@implementation MTRWaterHeaterModeClusterChangeToModeResponseParams - (instancetype)init { if (self = [super init]) { @@ -17416,7 +17947,7 @@ - (instancetype)init - (id)copyWithZone:(NSZone * _Nullable)zone; { - auto other = [[MTRDeviceEnergyManagementModeClusterChangeToModeResponseParams alloc] init]; + auto other = [[MTRWaterHeaterModeClusterChangeToModeResponseParams alloc] init]; other.status = self.status; other.statusText = self.statusText; @@ -17437,7 +17968,7 @@ - (nullable instancetype)initWithResponseValue:(NSDictionary *)r return nil; } - using DecodableType = chip::app::Clusters::DeviceEnergyManagementMode::Commands::ChangeToModeResponse::DecodableType; + using DecodableType = chip::app::Clusters::WaterHeaterMode::Commands::ChangeToModeResponse::DecodableType; chip::System::PacketBufferHandle buffer = [MTRBaseDevice _responseDataForCommand:responseValue clusterID:DecodableType::GetClusterId() commandID:DecodableType::GetCommandId() @@ -17472,9 +18003,9 @@ - (nullable instancetype)initWithResponseValue:(NSDictionary *)r @end -@implementation MTRDeviceEnergyManagementModeClusterChangeToModeResponseParams (InternalMethods) +@implementation MTRWaterHeaterModeClusterChangeToModeResponseParams (InternalMethods) -- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DeviceEnergyManagementMode::Commands::ChangeToModeResponse::DecodableType &)decodableStruct +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::WaterHeaterMode::Commands::ChangeToModeResponse::DecodableType &)decodableStruct { { self.status = [NSNumber numberWithUnsignedChar:decodableStruct.status]; @@ -17495,12 +18026,12 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DeviceEn @end -@implementation MTRDoorLockClusterLockDoorParams +@implementation MTRDeviceEnergyManagementModeClusterChangeToModeParams - (instancetype)init { if (self = [super init]) { - _pinCode = nil; + _newMode = @(0); _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -17509,9 +18040,9 @@ - (instancetype)init - (id)copyWithZone:(NSZone * _Nullable)zone; { - auto other = [[MTRDoorLockClusterLockDoorParams alloc] init]; + auto other = [[MTRDeviceEnergyManagementModeClusterChangeToModeParams alloc] init]; - other.pinCode = self.pinCode; + other.newMode = self.newMode; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; @@ -17520,23 +18051,20 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: pinCode:%@; >", NSStringFromClass([self class]), [_pinCode base64EncodedStringWithOptions:0]]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: newMode:%@; >", NSStringFromClass([self class]), _newMode]; return descriptionString; } @end -@implementation MTRDoorLockClusterLockDoorParams (InternalMethods) +@implementation MTRDeviceEnergyManagementModeClusterChangeToModeParams (InternalMethods) - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader { - chip::app::Clusters::DoorLock::Commands::LockDoor::Type encodableStruct; + chip::app::Clusters::DeviceEnergyManagementMode::Commands::ChangeToMode::Type encodableStruct; ListFreer listFreer; { - if (self.pinCode != nil) { - auto & definedValue_0 = encodableStruct.PINCode.Emplace(); - definedValue_0 = AsByteSpan(self.pinCode); - } + encodableStruct.newMode = self.newMode.unsignedCharValue; } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -17577,66 +18105,241 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end -@implementation MTRDoorLockClusterUnlockDoorParams +@implementation MTRDeviceEnergyManagementModeClusterChangeToModeResponseParams - (instancetype)init { if (self = [super init]) { - _pinCode = nil; - _timedInvokeTimeoutMs = nil; - _serverSideProcessingTimeout = nil; + _status = @(0); + + _statusText = nil; } return self; } - (id)copyWithZone:(NSZone * _Nullable)zone; { - auto other = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; + auto other = [[MTRDeviceEnergyManagementModeClusterChangeToModeResponseParams alloc] init]; - other.pinCode = self.pinCode; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + other.status = self.status; + other.statusText = self.statusText; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: pinCode:%@; >", NSStringFromClass([self class]), [_pinCode base64EncodedStringWithOptions:0]]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: status:%@; statusText:%@; >", NSStringFromClass([self class]), _status, _statusText]; return descriptionString; } -@end - -@implementation MTRDoorLockClusterUnlockDoorParams (InternalMethods) - -- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error { - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type encodableStruct; - ListFreer listFreer; - { - if (self.pinCode != nil) { - auto & definedValue_0 = encodableStruct.PINCode.Emplace(); - definedValue_0 = AsByteSpan(self.pinCode); - } + if (!(self = [super init])) { + return nil; } - auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + using DecodableType = chip::app::Clusters::DeviceEnergyManagementMode::Commands::ChangeToModeResponse::DecodableType; + chip::System::PacketBufferHandle buffer = [MTRBaseDevice _responseDataForCommand:responseValue + clusterID:DecodableType::GetClusterId() + commandID:DecodableType::GetCommandId() + error:error]; if (buffer.IsNull()) { - return CHIP_ERROR_NO_MEMORY; + return nil; } - 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)); + chip::TLV::TLVReader reader; + reader.Init(buffer->Start(), buffer->DataLength()); - reader.Init(std::move(buffer)); - return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); -} + CHIP_ERROR err = reader.Next(chip::TLV::AnonymousTag()); + if (err == CHIP_NO_ERROR) { + DecodableType decodedStruct; + err = chip::app::DataModel::Decode(reader, decodedStruct); + if (err == CHIP_NO_ERROR) { + err = [self _setFieldsFromDecodableStruct:decodedStruct]; + if (err == CHIP_NO_ERROR) { + return self; + } + } + } + + NSString * errorStr = [NSString stringWithFormat:@"Command payload decoding failed: %s", err.AsString()]; + MTR_LOG_ERROR("%s", errorStr.UTF8String); + if (error != nil) { + NSDictionary * userInfo = @{ NSLocalizedFailureReasonErrorKey : NSLocalizedString(errorStr, nil) }; + *error = [NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeSchemaMismatch userInfo:userInfo]; + } + return nil; +} + +@end + +@implementation MTRDeviceEnergyManagementModeClusterChangeToModeResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::DeviceEnergyManagementMode::Commands::ChangeToModeResponse::DecodableType &)decodableStruct +{ + { + self.status = [NSNumber numberWithUnsignedChar:decodableStruct.status]; + } + { + if (decodableStruct.statusText.HasValue()) { + self.statusText = AsString(decodableStruct.statusText.Value()); + if (self.statusText == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + return err; + } + } else { + self.statusText = nil; + } + } + return CHIP_NO_ERROR; +} + +@end + +@implementation MTRDoorLockClusterLockDoorParams +- (instancetype)init +{ + if (self = [super init]) { + + _pinCode = nil; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRDoorLockClusterLockDoorParams alloc] init]; + + other.pinCode = self.pinCode; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: pinCode:%@; >", NSStringFromClass([self class]), [_pinCode base64EncodedStringWithOptions:0]]; + return descriptionString; +} + +@end + +@implementation MTRDoorLockClusterLockDoorParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::LockDoor::Type encodableStruct; + ListFreer listFreer; + { + if (self.pinCode != nil) { + auto & definedValue_0 = encodableStruct.PINCode.Emplace(); + definedValue_0 = AsByteSpan(self.pinCode); + } + } + + 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 MTRDoorLockClusterUnlockDoorParams +- (instancetype)init +{ + if (self = [super init]) { + + _pinCode = nil; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; + + other.pinCode = self.pinCode; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: pinCode:%@; >", NSStringFromClass([self class]), [_pinCode base64EncodedStringWithOptions:0]]; + return descriptionString; +} + +@end + +@implementation MTRDoorLockClusterUnlockDoorParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type encodableStruct; + ListFreer listFreer; + { + if (self.pinCode != nil) { + auto & definedValue_0 = encodableStruct.PINCode.Emplace(); + definedValue_0 = AsByteSpan(self.pinCode); + } + } + + 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 { @@ -21840,8 +22543,6 @@ - (instancetype)init if (self = [super init]) { _presetHandle = [NSData data]; - - _delayMinutes = nil; _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -21853,7 +22554,6 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; auto other = [[MTRThermostatClusterSetActivePresetRequestParams alloc] init]; other.presetHandle = self.presetHandle; - other.delayMinutes = self.delayMinutes; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; @@ -21862,7 +22562,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: presetHandle:%@; delayMinutes:%@; >", NSStringFromClass([self class]), [_presetHandle base64EncodedStringWithOptions:0], _delayMinutes]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: presetHandle:%@; >", NSStringFromClass([self class]), [_presetHandle base64EncodedStringWithOptions:0]]; return descriptionString; } @@ -21877,12 +22577,6 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader { encodableStruct.presetHandle = AsByteSpan(self.presetHandle); } - { - if (self.delayMinutes != nil) { - auto & definedValue_0 = encodableStruct.delayMinutes.Emplace(); - definedValue_0 = self.delayMinutes.unsignedShortValue; - } - } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); if (buffer.IsNull()) { @@ -22147,10 +22841,16 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end -@implementation MTRThermostatClusterCancelSetActivePresetRequestParams +@implementation MTRFanControlClusterStepParams - (instancetype)init { if (self = [super init]) { + + _direction = @(0); + + _wrap = nil; + + _lowestOff = nil; _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -22159,8 +22859,11 @@ - (instancetype)init - (id)copyWithZone:(NSZone * _Nullable)zone; { - auto other = [[MTRThermostatClusterCancelSetActivePresetRequestParams alloc] init]; + auto other = [[MTRFanControlClusterStepParams alloc] init]; + other.direction = self.direction; + other.wrap = self.wrap; + other.lowestOff = self.lowestOff; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; @@ -22169,18 +22872,33 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: direction:%@; wrap:%@; lowestOff:%@; >", NSStringFromClass([self class]), _direction, _wrap, _lowestOff]; return descriptionString; } @end -@implementation MTRThermostatClusterCancelSetActivePresetRequestParams (InternalMethods) +@implementation MTRFanControlClusterStepParams (InternalMethods) - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader { - chip::app::Clusters::Thermostat::Commands::CancelSetActivePresetRequest::Type encodableStruct; + chip::app::Clusters::FanControl::Commands::Step::Type encodableStruct; ListFreer listFreer; + { + encodableStruct.direction = static_cast>(self.direction.unsignedCharValue); + } + { + if (self.wrap != nil) { + auto & definedValue_0 = encodableStruct.wrap.Emplace(); + definedValue_0 = self.wrap.boolValue; + } + } + { + if (self.lowestOff != nil) { + auto & definedValue_0 = encodableStruct.lowestOff.Emplace(); + definedValue_0 = self.lowestOff.boolValue; + } + } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); if (buffer.IsNull()) { @@ -22220,12 +22938,20 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end -@implementation MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams +@implementation MTRColorControlClusterMoveToHueParams - (instancetype)init { if (self = [super init]) { - _temperatureSetpointHoldPolicy = @(0); + _hue = @(0); + + _direction = @(0); + + _transitionTime = @(0); + + _optionsMask = @(0); + + _optionsOverride = @(0); _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -22234,9 +22960,13 @@ - (instancetype)init - (id)copyWithZone:(NSZone * _Nullable)zone; { - auto other = [[MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams alloc] init]; + auto other = [[MTRColorControlClusterMoveToHueParams alloc] init]; - other.temperatureSetpointHoldPolicy = self.temperatureSetpointHoldPolicy; + other.hue = self.hue; + other.direction = self.direction; + other.transitionTime = self.transitionTime; + other.optionsMask = self.optionsMask; + other.optionsOverride = self.optionsOverride; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; @@ -22245,20 +22975,32 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: temperatureSetpointHoldPolicy:%@; >", NSStringFromClass([self class]), _temperatureSetpointHoldPolicy]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: hue:%@; direction:%@; transitionTime:%@; optionsMask:%@; optionsOverride:%@; >", NSStringFromClass([self class]), _hue, _direction, _transitionTime, _optionsMask, _optionsOverride]; return descriptionString; } @end -@implementation MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams (InternalMethods) +@implementation MTRColorControlClusterMoveToHueParams (InternalMethods) - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader { - chip::app::Clusters::Thermostat::Commands::SetTemperatureSetpointHoldPolicy::Type encodableStruct; + chip::app::Clusters::ColorControl::Commands::MoveToHue::Type encodableStruct; ListFreer listFreer; { - encodableStruct.temperatureSetpointHoldPolicy = static_cast>(self.temperatureSetpointHoldPolicy.unsignedCharValue); + encodableStruct.hue = self.hue.unsignedCharValue; + } + { + encodableStruct.direction = static_cast>(self.direction.unsignedCharValue); + } + { + encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; + } + { + encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; + } + { + encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -22299,16 +23041,18 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end -@implementation MTRFanControlClusterStepParams +@implementation MTRColorControlClusterMoveHueParams - (instancetype)init { if (self = [super init]) { - _direction = @(0); + _moveMode = @(0); - _wrap = nil; + _rate = @(0); - _lowestOff = nil; + _optionsMask = @(0); + + _optionsOverride = @(0); _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -22317,209 +23061,7 @@ - (instancetype)init - (id)copyWithZone:(NSZone * _Nullable)zone; { - auto other = [[MTRFanControlClusterStepParams alloc] init]; - - other.direction = self.direction; - other.wrap = self.wrap; - other.lowestOff = self.lowestOff; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; - - return other; -} - -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: direction:%@; wrap:%@; lowestOff:%@; >", NSStringFromClass([self class]), _direction, _wrap, _lowestOff]; - return descriptionString; -} - -@end - -@implementation MTRFanControlClusterStepParams (InternalMethods) - -- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader -{ - chip::app::Clusters::FanControl::Commands::Step::Type encodableStruct; - ListFreer listFreer; - { - encodableStruct.direction = static_cast>(self.direction.unsignedCharValue); - } - { - if (self.wrap != nil) { - auto & definedValue_0 = encodableStruct.wrap.Emplace(); - definedValue_0 = self.wrap.boolValue; - } - } - { - if (self.lowestOff != nil) { - auto & definedValue_0 = encodableStruct.lowestOff.Emplace(); - definedValue_0 = self.lowestOff.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 MTRColorControlClusterMoveToHueParams -- (instancetype)init -{ - if (self = [super init]) { - - _hue = @(0); - - _direction = @(0); - - _transitionTime = @(0); - - _optionsMask = @(0); - - _optionsOverride = @(0); - _timedInvokeTimeoutMs = nil; - _serverSideProcessingTimeout = nil; - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTRColorControlClusterMoveToHueParams alloc] init]; - - other.hue = self.hue; - other.direction = self.direction; - other.transitionTime = self.transitionTime; - other.optionsMask = self.optionsMask; - other.optionsOverride = self.optionsOverride; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; - - return other; -} - -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: hue:%@; direction:%@; transitionTime:%@; optionsMask:%@; optionsOverride:%@; >", NSStringFromClass([self class]), _hue, _direction, _transitionTime, _optionsMask, _optionsOverride]; - return descriptionString; -} - -@end - -@implementation MTRColorControlClusterMoveToHueParams (InternalMethods) - -- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader -{ - chip::app::Clusters::ColorControl::Commands::MoveToHue::Type encodableStruct; - ListFreer listFreer; - { - encodableStruct.hue = self.hue.unsignedCharValue; - } - { - encodableStruct.direction = static_cast>(self.direction.unsignedCharValue); - } - { - encodableStruct.transitionTime = self.transitionTime.unsignedShortValue; - } - { - encodableStruct.optionsMask = self.optionsMask.unsignedCharValue; - } - { - encodableStruct.optionsOverride = self.optionsOverride.unsignedCharValue; - } - - 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 MTRColorControlClusterMoveHueParams -- (instancetype)init -{ - if (self = [super init]) { - - _moveMode = @(0); - - _rate = @(0); - - _optionsMask = @(0); - - _optionsOverride = @(0); - _timedInvokeTimeoutMs = nil; - _serverSideProcessingTimeout = nil; - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTRColorControlClusterMoveHueParams alloc] init]; + auto other = [[MTRColorControlClusterMoveHueParams alloc] init]; other.moveMode = self.moveMode; other.rate = self.rate; @@ -24969,7 +25511,7 @@ - (instancetype)init { if (self = [super init]) { - _extendedPanID = @(0); + _extendedPanID = [NSData data]; _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -24989,7 +25531,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: extendedPanID:%@; >", NSStringFromClass([self class]), _extendedPanID]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: extendedPanID:%@; >", NSStringFromClass([self class]), [_extendedPanID base64EncodedStringWithOptions:0]]; return descriptionString; } @@ -25002,7 +25544,7 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader chip::app::Clusters::ThreadNetworkDirectory::Commands::RemoveNetwork::Type encodableStruct; ListFreer listFreer; { - encodableStruct.extendedPanID = self.extendedPanID.unsignedLongLongValue; + encodableStruct.extendedPanID = AsByteSpan(self.extendedPanID); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -25048,7 +25590,7 @@ - (instancetype)init { if (self = [super init]) { - _extendedPanID = @(0); + _extendedPanID = [NSData data]; _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -25068,7 +25610,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: extendedPanID:%@; >", NSStringFromClass([self class]), _extendedPanID]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: extendedPanID:%@; >", NSStringFromClass([self class]), [_extendedPanID base64EncodedStringWithOptions:0]]; return descriptionString; } @@ -25081,7 +25623,7 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader chip::app::Clusters::ThreadNetworkDirectory::Commands::GetOperationalDataset::Type encodableStruct; ListFreer listFreer; { - encodableStruct.extendedPanID = self.extendedPanID.unsignedLongLongValue; + encodableStruct.extendedPanID = AsByteSpan(self.extendedPanID); } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -30766,6 +31308,312 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ContentA @end +@implementation MTRCommissionerControlClusterRequestCommissioningApprovalParams +- (instancetype)init +{ + if (self = [super init]) { + + _requestId = @(0); + + _vendorId = @(0); + + _productId = @(0); + + _label = nil; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRCommissionerControlClusterRequestCommissioningApprovalParams alloc] init]; + + other.requestId = self.requestId; + other.vendorId = self.vendorId; + other.productId = self.productId; + other.label = self.label; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: requestId:%@; vendorId:%@; productId:%@; label:%@; >", NSStringFromClass([self class]), _requestId, _vendorId, _productId, _label]; + return descriptionString; +} + +@end + +@implementation MTRCommissionerControlClusterRequestCommissioningApprovalParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::CommissionerControl::Commands::RequestCommissioningApproval::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.requestId = self.requestId.unsignedLongLongValue; + } + { + encodableStruct.vendorId = static_cast>(self.vendorId.unsignedShortValue); + } + { + encodableStruct.productId = self.productId.unsignedShortValue; + } + { + if (self.label != nil) { + auto & definedValue_0 = encodableStruct.label.Emplace(); + definedValue_0 = AsCharSpan(self.label); + } + } + + 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 MTRCommissionerControlClusterCommissionNodeParams +- (instancetype)init +{ + if (self = [super init]) { + + _requestId = @(0); + + _responseTimeoutSeconds = @(0); + + _ipAddress = nil; + + _port = nil; + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRCommissionerControlClusterCommissionNodeParams alloc] init]; + + other.requestId = self.requestId; + other.responseTimeoutSeconds = self.responseTimeoutSeconds; + other.ipAddress = self.ipAddress; + other.port = self.port; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: requestId:%@; responseTimeoutSeconds:%@; ipAddress:%@; port:%@; >", NSStringFromClass([self class]), _requestId, _responseTimeoutSeconds, [_ipAddress base64EncodedStringWithOptions:0], _port]; + return descriptionString; +} + +@end + +@implementation MTRCommissionerControlClusterCommissionNodeParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::CommissionerControl::Commands::CommissionNode::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.requestId = self.requestId.unsignedLongLongValue; + } + { + encodableStruct.responseTimeoutSeconds = self.responseTimeoutSeconds.unsignedShortValue; + } + { + if (self.ipAddress != nil) { + auto & definedValue_0 = encodableStruct.ipAddress.Emplace(); + definedValue_0 = AsByteSpan(self.ipAddress); + } + } + { + if (self.port != nil) { + auto & definedValue_0 = encodableStruct.port.Emplace(); + definedValue_0 = self.port.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 MTRCommissionerControlClusterReverseOpenCommissioningWindowParams +- (instancetype)init +{ + if (self = [super init]) { + + _commissioningTimeout = @(0); + + _pakePasscodeVerifier = [NSData data]; + + _discriminator = @(0); + + _iterations = @(0); + + _salt = [NSData data]; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRCommissionerControlClusterReverseOpenCommissioningWindowParams alloc] init]; + + other.commissioningTimeout = self.commissioningTimeout; + other.pakePasscodeVerifier = self.pakePasscodeVerifier; + other.discriminator = self.discriminator; + other.iterations = self.iterations; + other.salt = self.salt; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: commissioningTimeout:%@; pakePasscodeVerifier:%@; discriminator:%@; iterations:%@; salt:%@; >", NSStringFromClass([self class]), _commissioningTimeout, [_pakePasscodeVerifier base64EncodedStringWithOptions:0], _discriminator, _iterations, [_salt base64EncodedStringWithOptions:0]]; + return descriptionString; +} + +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error +{ + if (!(self = [super init])) { + return nil; + } + + using DecodableType = chip::app::Clusters::CommissionerControl::Commands::ReverseOpenCommissioningWindow::DecodableType; + chip::System::PacketBufferHandle buffer = [MTRBaseDevice _responseDataForCommand:responseValue + clusterID:DecodableType::GetClusterId() + commandID:DecodableType::GetCommandId() + error:error]; + if (buffer.IsNull()) { + return nil; + } + + chip::TLV::TLVReader reader; + reader.Init(buffer->Start(), buffer->DataLength()); + + CHIP_ERROR err = reader.Next(chip::TLV::AnonymousTag()); + if (err == CHIP_NO_ERROR) { + DecodableType decodedStruct; + err = chip::app::DataModel::Decode(reader, decodedStruct); + if (err == CHIP_NO_ERROR) { + err = [self _setFieldsFromDecodableStruct:decodedStruct]; + if (err == CHIP_NO_ERROR) { + return self; + } + } + } + + NSString * errorStr = [NSString stringWithFormat:@"Command payload decoding failed: %s", err.AsString()]; + MTR_LOG_ERROR("%s", errorStr.UTF8String); + if (error != nil) { + NSDictionary * userInfo = @{ NSLocalizedFailureReasonErrorKey : NSLocalizedString(errorStr, nil) }; + *error = [NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeSchemaMismatch userInfo:userInfo]; + } + return nil; +} + +@end + +@implementation MTRCommissionerControlClusterReverseOpenCommissioningWindowParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::CommissionerControl::Commands::ReverseOpenCommissioningWindow::DecodableType &)decodableStruct +{ + { + self.commissioningTimeout = [NSNumber numberWithUnsignedShort:decodableStruct.commissioningTimeout]; + } + { + self.pakePasscodeVerifier = AsData(decodableStruct.PAKEPasscodeVerifier); + } + { + self.discriminator = [NSNumber numberWithUnsignedShort:decodableStruct.discriminator]; + } + { + self.iterations = [NSNumber numberWithUnsignedInt:decodableStruct.iterations]; + } + { + self.salt = AsData(decodableStruct.salt); + } + return CHIP_NO_ERROR; +} + +@end + @implementation MTRElectricalMeasurementClusterGetProfileInfoResponseCommandParams - (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 963560ada35033..10eca7777ca0da 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h @@ -184,6 +184,18 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface MTRAccessControlClusterReviewFabricRestrictionsParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRAccessControlClusterReviewFabricRestrictionsResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::AccessControl::Commands::ReviewFabricRestrictionsResponse::DecodableType &)decodableStruct; + +@end + @interface MTRActionsClusterInstantActionParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @@ -496,6 +508,12 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface MTRBridgedDeviceBasicInformationClusterKeepActiveParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRAdministratorCommissioningClusterOpenCommissioningWindowParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @@ -1000,6 +1018,18 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface MTRWaterHeaterManagementClusterBoostParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRWaterHeaterManagementClusterCancelBoostParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @@ -1150,6 +1180,18 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface MTRWaterHeaterModeClusterChangeToModeParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRWaterHeaterModeClusterChangeToModeResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::WaterHeaterMode::Commands::ChangeToModeResponse::DecodableType &)decodableStruct; + +@end + @interface MTRDeviceEnergyManagementModeClusterChangeToModeParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @@ -1462,18 +1504,6 @@ NS_ASSUME_NONNULL_BEGIN @end -@interface MTRThermostatClusterCancelSetActivePresetRequestParams (InternalMethods) - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; - -@end - -@interface MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams (InternalMethods) - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; - -@end - @interface MTRFanControlClusterStepParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @@ -2008,6 +2038,24 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface MTRCommissionerControlClusterRequestCommissioningApprovalParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRCommissionerControlClusterCommissionNodeParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + +@interface MTRCommissionerControlClusterReverseOpenCommissioningWindowParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::CommissionerControl::Commands::ReverseOpenCommissioningWindow::DecodableType &)decodableStruct; + +@end + @interface MTRElectricalMeasurementClusterGetProfileInfoResponseCommandParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::ElectricalMeasurement::Commands::GetProfileInfoResponseCommand::DecodableType &)decodableStruct; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm index 1b96c8c41201d5..6dc2c38f8447ef 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm @@ -608,6 +608,15 @@ static BOOL CommandNeedsTimedInvokeInElectricalEnergyMeasurementCluster(Attribut } } } +static BOOL CommandNeedsTimedInvokeInWaterHeaterManagementCluster(AttributeId aAttributeId) +{ + using namespace Clusters::WaterHeaterManagement; + switch (aAttributeId) { + default: { + return NO; + } + } +} static BOOL CommandNeedsTimedInvokeInDemandResponseLoadControlCluster(AttributeId aAttributeId) { using namespace Clusters::DemandResponseLoadControl; @@ -692,6 +701,15 @@ static BOOL CommandNeedsTimedInvokeInEnergyEVSEModeCluster(AttributeId aAttribut } } } +static BOOL CommandNeedsTimedInvokeInWaterHeaterModeCluster(AttributeId aAttributeId) +{ + using namespace Clusters::WaterHeaterMode; + switch (aAttributeId) { + default: { + return NO; + } + } +} static BOOL CommandNeedsTimedInvokeInDeviceEnergyManagementModeCluster(AttributeId aAttributeId) { using namespace Clusters::DeviceEnergyManagementMode; @@ -993,9 +1011,6 @@ static BOOL CommandNeedsTimedInvokeInThreadNetworkDirectoryCluster(AttributeId a case Commands::RemoveNetwork::Id: { return YES; } - case Commands::GetOperationalDataset::Id: { - return YES; - } default: { return NO; } @@ -1136,6 +1151,24 @@ static BOOL CommandNeedsTimedInvokeInContentAppObserverCluster(AttributeId aAttr } } } +static BOOL CommandNeedsTimedInvokeInEcosystemInformationCluster(AttributeId aAttributeId) +{ + using namespace Clusters::EcosystemInformation; + switch (aAttributeId) { + default: { + return NO; + } + } +} +static BOOL CommandNeedsTimedInvokeInCommissionerControlCluster(AttributeId aAttributeId) +{ + using namespace Clusters::CommissionerControl; + switch (aAttributeId) { + default: { + return NO; + } + } +} static BOOL CommandNeedsTimedInvokeInElectricalMeasurementCluster(AttributeId aAttributeId) { using namespace Clusters::ElectricalMeasurement; @@ -1365,6 +1398,9 @@ BOOL MTRCommandNeedsTimedInvoke(NSNumber * _Nonnull aClusterID, NSNumber * _Nonn case Clusters::ElectricalEnergyMeasurement::Id: { return CommandNeedsTimedInvokeInElectricalEnergyMeasurementCluster(commandID); } + case Clusters::WaterHeaterManagement::Id: { + return CommandNeedsTimedInvokeInWaterHeaterManagementCluster(commandID); + } case Clusters::DemandResponseLoadControl::Id: { return CommandNeedsTimedInvokeInDemandResponseLoadControlCluster(commandID); } @@ -1386,6 +1422,9 @@ BOOL MTRCommandNeedsTimedInvoke(NSNumber * _Nonnull aClusterID, NSNumber * _Nonn case Clusters::EnergyEvseMode::Id: { return CommandNeedsTimedInvokeInEnergyEVSEModeCluster(commandID); } + case Clusters::WaterHeaterMode::Id: { + return CommandNeedsTimedInvokeInWaterHeaterModeCluster(commandID); + } case Clusters::DeviceEnergyManagementMode::Id: { return CommandNeedsTimedInvokeInDeviceEnergyManagementModeCluster(commandID); } @@ -1518,6 +1557,12 @@ BOOL MTRCommandNeedsTimedInvoke(NSNumber * _Nonnull aClusterID, NSNumber * _Nonn case Clusters::ContentAppObserver::Id: { return CommandNeedsTimedInvokeInContentAppObserverCluster(commandID); } + case Clusters::EcosystemInformation::Id: { + return CommandNeedsTimedInvokeInEcosystemInformationCluster(commandID); + } + case Clusters::CommissionerControl::Id: { + return CommandNeedsTimedInvokeInCommissionerControlCluster(commandID); + } case Clusters::ElectricalMeasurement::Id: { return CommandNeedsTimedInvokeInElectricalMeasurementCluster(commandID); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index 8de4f7c5966b50..4d70a00ee32937 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -304,6 +304,73 @@ static id _Nullable DecodeEventPayloadForAccessControlCluster(EventId aEventId, return value; } + case Events::AccessRestrictionEntryChanged::Id: { + Events::AccessRestrictionEntryChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRAccessControlClusterAccessRestrictionEntryChangedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex]; + value.fabricIndex = memberValue; + } while (0); + + return value; + } + case Events::FabricRestrictionReviewUpdate::Id: { + Events::FabricRestrictionReviewUpdate::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRAccessControlClusterFabricRestrictionReviewUpdateEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.token]; + value.token = memberValue; + } while (0); + do { + NSString * _Nullable memberValue; + if (cppValue.instruction.IsNull()) { + memberValue = nil; + } else { + memberValue = AsString(cppValue.instruction.Value()); + if (memberValue == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + } + value.instruction = memberValue; + } while (0); + do { + NSString * _Nullable memberValue; + if (cppValue.redirectURL.IsNull()) { + memberValue = nil; + } else { + memberValue = AsString(cppValue.redirectURL.Value()); + if (memberValue == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + } + value.redirectURL = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex]; + value.fabricIndex = memberValue; + } while (0); + + return value; + } default: { break; } @@ -1382,6 +1449,23 @@ static id _Nullable DecodeEventPayloadForBridgedDeviceBasicInformationCluster(Ev return value; } + case Events::ActiveChanged::Id: { + Events::ActiveChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRBridgedDeviceBasicInformationClusterActiveChangedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.promisedActiveDuration]; + value.promisedActiveDuration = memberValue; + } while (0); + + return value; + } default: { break; } @@ -2719,6 +2803,18 @@ static id _Nullable DecodeEventPayloadForElectricalEnergyMeasurementCluster(Even *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; return nil; } +static id _Nullable DecodeEventPayloadForWaterHeaterManagementCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::WaterHeaterManagement; + switch (aEventId) { + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} static id _Nullable DecodeEventPayloadForDemandResponseLoadControlCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::DemandResponseLoadControl; @@ -3144,6 +3240,15 @@ static id _Nullable DecodeEventPayloadForEnergyEVSECluster(EventId aEventId, TLV memberValue = [NSNumber numberWithLongLong:cppValue.maximumCurrent]; value.maximumCurrent = memberValue; } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.maximumDischargeCurrent.HasValue()) { + memberValue = [NSNumber numberWithLongLong:cppValue.maximumDischargeCurrent.Value()]; + } else { + memberValue = nil; + } + value.maximumDischargeCurrent = memberValue; + } while (0); return value; } @@ -3176,6 +3281,15 @@ static id _Nullable DecodeEventPayloadForEnergyEVSECluster(EventId aEventId, TLV memberValue = [NSNumber numberWithLongLong:cppValue.energyTransferred]; value.energyTransferred = memberValue; } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.energyDischarged.HasValue()) { + memberValue = [NSNumber numberWithLongLong:cppValue.energyDischarged.Value()]; + } else { + memberValue = nil; + } + value.energyDischarged = memberValue; + } while (0); return value; } @@ -3276,6 +3390,18 @@ static id _Nullable DecodeEventPayloadForEnergyEVSEModeCluster(EventId aEventId, *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; return nil; } +static id _Nullable DecodeEventPayloadForWaterHeaterModeCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::WaterHeaterMode; + switch (aEventId) { + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} static id _Nullable DecodeEventPayloadForDeviceEnergyManagementModeCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::DeviceEnergyManagementMode; @@ -4075,23 +4201,6 @@ static id _Nullable DecodeEventPayloadForThreadNetworkDirectoryCluster(EventId a { using namespace Clusters::ThreadNetworkDirectory; switch (aEventId) { - case Events::NetworkChanged::Id: { - Events::NetworkChanged::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRThreadNetworkDirectoryClusterNetworkChangedEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.extendedPanID]; - value.extendedPanID = memberValue; - } while (0); - - return value; - } default: { break; } @@ -4416,6 +4525,62 @@ static id _Nullable DecodeEventPayloadForContentAppObserverCluster(EventId aEven *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; return nil; } +static id _Nullable DecodeEventPayloadForEcosystemInformationCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::EcosystemInformation; + switch (aEventId) { + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForCommissionerControlCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::CommissionerControl; + switch (aEventId) { + case Events::CommissioningRequestResult::Id: { + Events::CommissioningRequestResult::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRCommissionerControlClusterCommissioningRequestResultEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.requestId]; + value.requestId = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.clientNodeId]; + value.clientNodeId = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.statusCode]; + value.statusCode = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex]; + value.fabricIndex = memberValue; + } while (0); + + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} static id _Nullable DecodeEventPayloadForElectricalMeasurementCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::ElectricalMeasurement; @@ -4802,6 +4967,9 @@ id _Nullable MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVRead case Clusters::ElectricalEnergyMeasurement::Id: { return DecodeEventPayloadForElectricalEnergyMeasurementCluster(aPath.mEventId, aReader, aError); } + case Clusters::WaterHeaterManagement::Id: { + return DecodeEventPayloadForWaterHeaterManagementCluster(aPath.mEventId, aReader, aError); + } case Clusters::DemandResponseLoadControl::Id: { return DecodeEventPayloadForDemandResponseLoadControlCluster(aPath.mEventId, aReader, aError); } @@ -4823,6 +4991,9 @@ id _Nullable MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVRead case Clusters::EnergyEvseMode::Id: { return DecodeEventPayloadForEnergyEVSEModeCluster(aPath.mEventId, aReader, aError); } + case Clusters::WaterHeaterMode::Id: { + return DecodeEventPayloadForWaterHeaterModeCluster(aPath.mEventId, aReader, aError); + } case Clusters::DeviceEnergyManagementMode::Id: { return DecodeEventPayloadForDeviceEnergyManagementModeCluster(aPath.mEventId, aReader, aError); } @@ -4955,6 +5126,12 @@ id _Nullable MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVRead case Clusters::ContentAppObserver::Id: { return DecodeEventPayloadForContentAppObserverCluster(aPath.mEventId, aReader, aError); } + case Clusters::EcosystemInformation::Id: { + return DecodeEventPayloadForEcosystemInformationCluster(aPath.mEventId, aReader, aError); + } + case Clusters::CommissionerControl::Id: { + return DecodeEventPayloadForCommissionerControlCluster(aPath.mEventId, aReader, aError); + } case Clusters::ElectricalMeasurement::Id: { return DecodeEventPayloadForElectricalMeasurementCluster(aPath.mEventId, aReader, aError); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 74a621dd01df9c..3a11fc91e44536 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -19,6 +19,13 @@ NS_ASSUME_NONNULL_BEGIN +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDataTypeTestGlobalStruct : NSObject +@property (nonatomic, copy) NSString * _Nonnull name MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable myBitmap MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable myEnum MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_AVAILABLE(ios(16.2), macos(13.1), watchos(9.2), tvos(16.2)) @interface MTRDescriptorClusterDeviceTypeStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull deviceType MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); @@ -48,6 +55,27 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @property (nonatomic, copy) NSNumber * _Nonnull fabricIndex MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRAccessControlClusterAccessRestrictionStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull type MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable id MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRAccessControlClusterCommissioningAccessRestrictionEntryStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull endpoint MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull cluster MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nonnull restrictions MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRAccessControlClusterAccessRestrictionEntryStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull endpoint MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull cluster MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nonnull restrictions MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull fabricIndex MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_AVAILABLE(ios(17.0), macos(14.0), watchos(10.0), tvos(17.0)) @interface MTRAccessControlClusterAccessControlTargetStruct : NSObject @property (nonatomic, copy) NSNumber * _Nullable cluster MTR_AVAILABLE(ios(17.0), macos(14.0), watchos(10.0), tvos(17.0)); @@ -110,6 +138,19 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @property (nonatomic, copy) NSNumber * _Nonnull fabricIndex MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRAccessControlClusterAccessRestrictionEntryChangedEvent : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull fabricIndex MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRAccessControlClusterFabricRestrictionReviewUpdateEvent : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull token MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSString * _Nullable instruction MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSString * _Nullable redirectURL MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull fabricIndex MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRActionsClusterActionStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull actionID MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); @@ -649,6 +690,11 @@ MTR_DEPRECATED("Please use MTRBridgedDeviceBasicInformationClusterReachableChang @property (nonatomic, copy) NSNumber * _Nonnull reachableNewValue MTR_DEPRECATED("Please use MTRBridgedDeviceBasicInformationClusterReachableChangedEvent", ios(16.1, 17.0), macos(13.0, 14.0), watchos(9.1, 10.0), tvos(16.1, 17.0)); @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRBridgedDeviceBasicInformationClusterActiveChangedEvent : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull promisedActiveDuration MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRSwitchClusterSwitchLatchedEvent : NSObject @property (nonatomic, copy, getter=getNewPosition) NSNumber * _Nonnull newPosition MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); @@ -1017,9 +1063,16 @@ MTR_AVAILABLE(ios(17.4), macos(14.4), watchos(10.4), tvos(17.4)) @end MTR_PROVISIONALLY_AVAILABLE -@interface MTRScenesManagementClusterAttributeValuePair : NSObject +@interface MTRScenesManagementClusterAttributeValuePairStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull attributeID MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nonnull attributeValue MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valueUnsigned8 MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valueSigned8 MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valueUnsigned16 MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valueSigned16 MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valueUnsigned32 MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valueSigned32 MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valueUnsigned64 MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable valueSigned64 MTR_PROVISIONALLY_AVAILABLE; @end MTR_PROVISIONALLY_AVAILABLE @@ -1403,6 +1456,7 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nonnull sessionID MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nonnull state MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nonnull maximumCurrent MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable maximumDischargeCurrent MTR_PROVISIONALLY_AVAILABLE; @end MTR_PROVISIONALLY_AVAILABLE @@ -1411,6 +1465,7 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nonnull state MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nonnull reason MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nonnull energyTransferred MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable energyDischarged MTR_PROVISIONALLY_AVAILABLE; @end MTR_PROVISIONALLY_AVAILABLE @@ -1445,6 +1500,19 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSArray * _Nonnull modeTags MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRWaterHeaterModeClusterModeTagStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nullable mfgCode MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull value MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRWaterHeaterModeClusterModeOptionStruct : NSObject +@property (nonatomic, copy) NSString * _Nonnull label MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull mode MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nonnull modeTags MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTRDeviceEnergyManagementModeClusterModeTagStruct : NSObject @property (nonatomic, copy) NSNumber * _Nullable mfgCode MTR_PROVISIONALLY_AVAILABLE; @@ -1513,7 +1581,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @end MTR_PROVISIONALLY_AVAILABLE -@interface MTRServiceAreaClusterHomeLocationStruct : NSObject +@interface MTRServiceAreaClusterLocationDescriptorStruct : NSObject @property (nonatomic, copy) NSString * _Nonnull locationName MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable floorNumber MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable areaType MTR_PROVISIONALLY_AVAILABLE; @@ -1521,7 +1589,7 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRServiceAreaClusterLocationInfoStruct : NSObject -@property (nonatomic, copy) MTRServiceAreaClusterHomeLocationStruct * _Nullable locationInfo MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRServiceAreaClusterLocationDescriptorStruct * _Nullable locationInfo MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable landmarkTag MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable positionTag MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable surfaceTag MTR_PROVISIONALLY_AVAILABLE; @@ -1653,12 +1721,6 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nonnull presetTypeFeatures MTR_PROVISIONALLY_AVAILABLE; @end -MTR_PROVISIONALLY_AVAILABLE -@interface MTRThermostatClusterQueuedPresetStruct : NSObject -@property (nonatomic, copy) NSData * _Nullable presetHandle MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nullable transitionTimestamp MTR_PROVISIONALLY_AVAILABLE; -@end - MTR_PROVISIONALLY_AVAILABLE @interface MTRThermostatClusterScheduleTypeStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull systemMode MTR_PROVISIONALLY_AVAILABLE; @@ -1689,14 +1751,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRThreadNetworkDirectoryClusterThreadNetworkStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull extendedPanID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSData * _Nonnull extendedPanID MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSString * _Nonnull networkName MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nonnull channel MTR_PROVISIONALLY_AVAILABLE; -@end - -MTR_PROVISIONALLY_AVAILABLE -@interface MTRThreadNetworkDirectoryClusterNetworkChangedEvent : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull extendedPanID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull activeTimestamp MTR_PROVISIONALLY_AVAILABLE; @end MTR_PROVISIONALLY_AVAILABLE @@ -2030,6 +2088,47 @@ MTR_PROVISIONALLY_AVAILABLE @interface MTRContentControlClusterRemainingScreenTimeExpiredEvent : NSObject @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTREcosystemInformationClusterLocationDescriptorStruct : NSObject +@property (nonatomic, copy) NSString * _Nonnull locationName MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable floorNumber MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable areaType MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTREcosystemInformationClusterEcosystemLocationStruct : NSObject +@property (nonatomic, copy) NSString * _Nonnull uniqueLocationID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTREcosystemInformationClusterLocationDescriptorStruct * _Nonnull locationDescriptor MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull locationDescriptorLastEdit MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull fabricIndex MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTREcosystemInformationClusterDeviceTypeStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull deviceType MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull revision MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTREcosystemInformationClusterEcosystemDeviceStruct : NSObject +@property (nonatomic, copy) NSString * _Nullable deviceName MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable deviceNameLastEdit MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull bridgedEndpoint MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull originalEndpoint MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nonnull deviceTypes MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nonnull uniqueLocationIDs MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull uniqueLocationIDsLastEdit MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull fabricIndex MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRCommissionerControlClusterCommissioningRequestResultEvent : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull requestId MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull clientNodeId MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull statusCode MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull fabricIndex MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRUnitTestingClusterSimpleStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull a MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 5dca49be4900cf..94a6b90dfeac88 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -19,6 +19,39 @@ NS_ASSUME_NONNULL_BEGIN +@implementation MTRDataTypeTestGlobalStruct +- (instancetype)init +{ + if (self = [super init]) { + + _name = @""; + + _myBitmap = nil; + + _myEnum = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRDataTypeTestGlobalStruct alloc] init]; + + other.name = self.name; + other.myBitmap = self.myBitmap; + other.myEnum = self.myEnum; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: name:%@; myBitmap:%@; myEnum:%@; >", NSStringFromClass([self class]), _name, _myBitmap, _myEnum]; + return descriptionString; +} + +@end + @implementation MTRDescriptorClusterDeviceTypeStruct - (instancetype)init { @@ -138,6 +171,105 @@ - (NSString *)description @end +@implementation MTRAccessControlClusterAccessRestrictionStruct +- (instancetype)init +{ + if (self = [super init]) { + + _type = @(0); + + _id = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRAccessControlClusterAccessRestrictionStruct alloc] init]; + + other.type = self.type; + other.id = self.id; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: type:%@; id:%@; >", NSStringFromClass([self class]), _type, _id]; + return descriptionString; +} + +@end + +@implementation MTRAccessControlClusterCommissioningAccessRestrictionEntryStruct +- (instancetype)init +{ + if (self = [super init]) { + + _endpoint = @(0); + + _cluster = @(0); + + _restrictions = [NSArray array]; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRAccessControlClusterCommissioningAccessRestrictionEntryStruct alloc] init]; + + other.endpoint = self.endpoint; + other.cluster = self.cluster; + other.restrictions = self.restrictions; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: endpoint:%@; cluster:%@; restrictions:%@; >", NSStringFromClass([self class]), _endpoint, _cluster, _restrictions]; + return descriptionString; +} + +@end + +@implementation MTRAccessControlClusterAccessRestrictionEntryStruct +- (instancetype)init +{ + if (self = [super init]) { + + _endpoint = @(0); + + _cluster = @(0); + + _restrictions = [NSArray array]; + + _fabricIndex = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRAccessControlClusterAccessRestrictionEntryStruct alloc] init]; + + other.endpoint = self.endpoint; + other.cluster = self.cluster; + other.restrictions = self.restrictions; + other.fabricIndex = self.fabricIndex; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: endpoint:%@; cluster:%@; restrictions:%@; fabricIndex:%@; >", NSStringFromClass([self class]), _endpoint, _cluster, _restrictions, _fabricIndex]; + return descriptionString; +} + +@end + @implementation MTRAccessControlClusterAccessControlTargetStruct - (instancetype)init { @@ -337,6 +469,69 @@ - (NSString *)description @end +@implementation MTRAccessControlClusterAccessRestrictionEntryChangedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _fabricIndex = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRAccessControlClusterAccessRestrictionEntryChangedEvent alloc] init]; + + other.fabricIndex = self.fabricIndex; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: fabricIndex:%@; >", NSStringFromClass([self class]), _fabricIndex]; + return descriptionString; +} + +@end + +@implementation MTRAccessControlClusterFabricRestrictionReviewUpdateEvent +- (instancetype)init +{ + if (self = [super init]) { + + _token = @(0); + + _instruction = nil; + + _redirectURL = nil; + + _fabricIndex = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRAccessControlClusterFabricRestrictionReviewUpdateEvent alloc] init]; + + other.token = self.token; + other.instruction = self.instruction; + other.redirectURL = self.redirectURL; + other.fabricIndex = self.fabricIndex; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: token:%@; instruction:%@; redirectURL:%@; fabricIndex:%@; >", NSStringFromClass([self class]), _token, _instruction, _redirectURL, _fabricIndex]; + return descriptionString; +} + +@end + @implementation MTRActionsClusterActionStruct - (instancetype)init { @@ -2246,6 +2441,33 @@ @implementation MTRBridgedDeviceBasicClusterReachableChangedEvent : MTRBridgedDe @dynamic reachableNewValue; @end +@implementation MTRBridgedDeviceBasicInformationClusterActiveChangedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _promisedActiveDuration = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRBridgedDeviceBasicInformationClusterActiveChangedEvent alloc] init]; + + other.promisedActiveDuration = self.promisedActiveDuration; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: promisedActiveDuration:%@; >", NSStringFromClass([self class]), _promisedActiveDuration]; + return descriptionString; +} + +@end + @implementation MTRSwitchClusterSwitchLatchedEvent - (instancetype)init { @@ -4024,31 +4246,52 @@ - (NSString *)description @end -@implementation MTRScenesManagementClusterAttributeValuePair +@implementation MTRScenesManagementClusterAttributeValuePairStruct - (instancetype)init { if (self = [super init]) { _attributeID = @(0); - _attributeValue = @(0); + _valueUnsigned8 = nil; + + _valueSigned8 = nil; + + _valueUnsigned16 = nil; + + _valueSigned16 = nil; + + _valueUnsigned32 = nil; + + _valueSigned32 = nil; + + _valueUnsigned64 = nil; + + _valueSigned64 = nil; } return self; } - (id)copyWithZone:(NSZone * _Nullable)zone { - auto other = [[MTRScenesManagementClusterAttributeValuePair alloc] init]; + auto other = [[MTRScenesManagementClusterAttributeValuePairStruct alloc] init]; other.attributeID = self.attributeID; - other.attributeValue = self.attributeValue; + other.valueUnsigned8 = self.valueUnsigned8; + other.valueSigned8 = self.valueSigned8; + other.valueUnsigned16 = self.valueUnsigned16; + other.valueSigned16 = self.valueSigned16; + other.valueUnsigned32 = self.valueUnsigned32; + other.valueSigned32 = self.valueSigned32; + other.valueUnsigned64 = self.valueUnsigned64; + other.valueSigned64 = self.valueSigned64; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: attributeID:%@; attributeValue:%@; >", NSStringFromClass([self class]), _attributeID, _attributeValue]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: attributeID:%@; valueUnsigned8:%@; valueSigned8:%@; valueUnsigned16:%@; valueSigned16:%@; valueUnsigned32:%@; valueSigned32:%@; valueUnsigned64:%@; valueSigned64:%@; >", NSStringFromClass([self class]), _attributeID, _valueUnsigned8, _valueSigned8, _valueUnsigned16, _valueSigned16, _valueUnsigned32, _valueSigned32, _valueUnsigned64, _valueSigned64]; return descriptionString; } @@ -5766,6 +6009,8 @@ - (instancetype)init _state = @(0); _maximumCurrent = @(0); + + _maximumDischargeCurrent = nil; } return self; } @@ -5777,13 +6022,14 @@ - (id)copyWithZone:(NSZone * _Nullable)zone other.sessionID = self.sessionID; other.state = self.state; other.maximumCurrent = self.maximumCurrent; + other.maximumDischargeCurrent = self.maximumDischargeCurrent; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: sessionID:%@; state:%@; maximumCurrent:%@; >", NSStringFromClass([self class]), _sessionID, _state, _maximumCurrent]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: sessionID:%@; state:%@; maximumCurrent:%@; maximumDischargeCurrent:%@; >", NSStringFromClass([self class]), _sessionID, _state, _maximumCurrent, _maximumDischargeCurrent]; return descriptionString; } @@ -5801,6 +6047,8 @@ - (instancetype)init _reason = @(0); _energyTransferred = @(0); + + _energyDischarged = nil; } return self; } @@ -5813,13 +6061,14 @@ - (id)copyWithZone:(NSZone * _Nullable)zone other.state = self.state; other.reason = self.reason; other.energyTransferred = self.energyTransferred; + other.energyDischarged = self.energyDischarged; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: sessionID:%@; state:%@; reason:%@; energyTransferred:%@; >", NSStringFromClass([self class]), _sessionID, _state, _reason, _energyTransferred]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: sessionID:%@; state:%@; reason:%@; energyTransferred:%@; energyDischarged:%@; >", NSStringFromClass([self class]), _sessionID, _state, _reason, _energyTransferred, _energyDischarged]; return descriptionString; } @@ -5981,6 +6230,69 @@ - (NSString *)description @end +@implementation MTRWaterHeaterModeClusterModeTagStruct +- (instancetype)init +{ + if (self = [super init]) { + + _mfgCode = nil; + + _value = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRWaterHeaterModeClusterModeTagStruct alloc] init]; + + other.mfgCode = self.mfgCode; + other.value = self.value; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: mfgCode:%@; value:%@; >", NSStringFromClass([self class]), _mfgCode, _value]; + return descriptionString; +} + +@end + +@implementation MTRWaterHeaterModeClusterModeOptionStruct +- (instancetype)init +{ + if (self = [super init]) { + + _label = @""; + + _mode = @(0); + + _modeTags = [NSArray array]; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRWaterHeaterModeClusterModeOptionStruct alloc] init]; + + other.label = self.label; + other.mode = self.mode; + other.modeTags = self.modeTags; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: label:%@; mode:%@; modeTags:%@; >", NSStringFromClass([self class]), _label, _mode, _modeTags]; + return descriptionString; +} + +@end + @implementation MTRDeviceEnergyManagementModeClusterModeTagStruct - (instancetype)init { @@ -6265,7 +6577,7 @@ - (NSString *)description @end -@implementation MTRServiceAreaClusterHomeLocationStruct +@implementation MTRServiceAreaClusterLocationDescriptorStruct - (instancetype)init { if (self = [super init]) { @@ -6281,7 +6593,7 @@ - (instancetype)init - (id)copyWithZone:(NSZone * _Nullable)zone { - auto other = [[MTRServiceAreaClusterHomeLocationStruct alloc] init]; + auto other = [[MTRServiceAreaClusterLocationDescriptorStruct alloc] init]; other.locationName = self.locationName; other.floorNumber = self.floorNumber; @@ -6983,36 +7295,6 @@ - (NSString *)description @end -@implementation MTRThermostatClusterQueuedPresetStruct -- (instancetype)init -{ - if (self = [super init]) { - - _presetHandle = nil; - - _transitionTimestamp = nil; - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone -{ - auto other = [[MTRThermostatClusterQueuedPresetStruct alloc] init]; - - other.presetHandle = self.presetHandle; - other.transitionTimestamp = self.transitionTimestamp; - - return other; -} - -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: presetHandle:%@; transitionTimestamp:%@; >", NSStringFromClass([self class]), [_presetHandle base64EncodedStringWithOptions:0], _transitionTimestamp]; - return descriptionString; -} - -@end - @implementation MTRThermostatClusterScheduleTypeStruct - (instancetype)init { @@ -7123,11 +7405,13 @@ - (instancetype)init { if (self = [super init]) { - _extendedPanID = @(0); + _extendedPanID = [NSData data]; _networkName = @""; _channel = @(0); + + _activeTimestamp = @(0); } return self; } @@ -7139,40 +7423,14 @@ - (id)copyWithZone:(NSZone * _Nullable)zone other.extendedPanID = self.extendedPanID; other.networkName = self.networkName; other.channel = self.channel; + other.activeTimestamp = self.activeTimestamp; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: extendedPanID:%@; networkName:%@; channel:%@; >", NSStringFromClass([self class]), _extendedPanID, _networkName, _channel]; - return descriptionString; -} - -@end - -@implementation MTRThreadNetworkDirectoryClusterNetworkChangedEvent -- (instancetype)init -{ - if (self = [super init]) { - - _extendedPanID = @(0); - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone -{ - auto other = [[MTRThreadNetworkDirectoryClusterNetworkChangedEvent alloc] init]; - - other.extendedPanID = self.extendedPanID; - - return other; -} - -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: extendedPanID:%@; >", NSStringFromClass([self class]), _extendedPanID]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: extendedPanID:%@; networkName:%@; channel:%@; activeTimestamp:%@; >", NSStringFromClass([self class]), [_extendedPanID base64EncodedStringWithOptions:0], _networkName, _channel, _activeTimestamp]; return descriptionString; } @@ -8364,6 +8622,189 @@ - (NSString *)description @end +@implementation MTREcosystemInformationClusterLocationDescriptorStruct +- (instancetype)init +{ + if (self = [super init]) { + + _locationName = @""; + + _floorNumber = nil; + + _areaType = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTREcosystemInformationClusterLocationDescriptorStruct alloc] init]; + + other.locationName = self.locationName; + other.floorNumber = self.floorNumber; + other.areaType = self.areaType; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: locationName:%@; floorNumber:%@; areaType:%@; >", NSStringFromClass([self class]), _locationName, _floorNumber, _areaType]; + return descriptionString; +} + +@end + +@implementation MTREcosystemInformationClusterEcosystemLocationStruct +- (instancetype)init +{ + if (self = [super init]) { + + _uniqueLocationID = @""; + + _locationDescriptor = [MTREcosystemInformationClusterLocationDescriptorStruct new]; + + _locationDescriptorLastEdit = @(0); + + _fabricIndex = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTREcosystemInformationClusterEcosystemLocationStruct alloc] init]; + + other.uniqueLocationID = self.uniqueLocationID; + other.locationDescriptor = self.locationDescriptor; + other.locationDescriptorLastEdit = self.locationDescriptorLastEdit; + other.fabricIndex = self.fabricIndex; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: uniqueLocationID:%@; locationDescriptor:%@; locationDescriptorLastEdit:%@; fabricIndex:%@; >", NSStringFromClass([self class]), _uniqueLocationID, _locationDescriptor, _locationDescriptorLastEdit, _fabricIndex]; + return descriptionString; +} + +@end + +@implementation MTREcosystemInformationClusterDeviceTypeStruct +- (instancetype)init +{ + if (self = [super init]) { + + _deviceType = @(0); + + _revision = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTREcosystemInformationClusterDeviceTypeStruct alloc] init]; + + other.deviceType = self.deviceType; + other.revision = self.revision; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: deviceType:%@; revision:%@; >", NSStringFromClass([self class]), _deviceType, _revision]; + return descriptionString; +} + +@end + +@implementation MTREcosystemInformationClusterEcosystemDeviceStruct +- (instancetype)init +{ + if (self = [super init]) { + + _deviceName = nil; + + _deviceNameLastEdit = nil; + + _bridgedEndpoint = @(0); + + _originalEndpoint = @(0); + + _deviceTypes = [NSArray array]; + + _uniqueLocationIDs = [NSArray array]; + + _uniqueLocationIDsLastEdit = @(0); + + _fabricIndex = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTREcosystemInformationClusterEcosystemDeviceStruct alloc] init]; + + other.deviceName = self.deviceName; + other.deviceNameLastEdit = self.deviceNameLastEdit; + other.bridgedEndpoint = self.bridgedEndpoint; + other.originalEndpoint = self.originalEndpoint; + other.deviceTypes = self.deviceTypes; + other.uniqueLocationIDs = self.uniqueLocationIDs; + other.uniqueLocationIDsLastEdit = self.uniqueLocationIDsLastEdit; + other.fabricIndex = self.fabricIndex; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: deviceName:%@; deviceNameLastEdit:%@; bridgedEndpoint:%@; originalEndpoint:%@; deviceTypes:%@; uniqueLocationIDs:%@; uniqueLocationIDsLastEdit:%@; fabricIndex:%@; >", NSStringFromClass([self class]), _deviceName, _deviceNameLastEdit, _bridgedEndpoint, _originalEndpoint, _deviceTypes, _uniqueLocationIDs, _uniqueLocationIDsLastEdit, _fabricIndex]; + return descriptionString; +} + +@end + +@implementation MTRCommissionerControlClusterCommissioningRequestResultEvent +- (instancetype)init +{ + if (self = [super init]) { + + _requestId = @(0); + + _clientNodeId = @(0); + + _statusCode = @(0); + + _fabricIndex = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRCommissionerControlClusterCommissioningRequestResultEvent alloc] init]; + + other.requestId = self.requestId; + other.clientNodeId = self.clientNodeId; + other.statusCode = self.statusCode; + other.fabricIndex = self.fabricIndex; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: requestId:%@; clientNodeId:%@; statusCode:%@; fabricIndex:%@; >", NSStringFromClass([self class]), _requestId, _clientNodeId, _statusCode, _fabricIndex]; + return descriptionString; +} + +@end + @implementation MTRUnitTestingClusterSimpleStruct - (instancetype)init { diff --git a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m index 132ab263cf30f6..da059fc505de8c 100644 --- a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m @@ -1898,6 +1898,20 @@ - (void)test020_ReadMultipleAttributes MTRBaseDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); + // Get the list of endpoints from the device. Endpoint 0 we have to add explicitly, since it's + // not in its own PartsList. + XCTestExpectation * descriptorReadExpectation = [self expectationWithDescription:@"read PartsList from endpoint 0"]; + __auto_type * descriptorCluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(0) queue:queue]; + __block NSMutableArray * endpointList = [NSMutableArray arrayWithObject:@0]; + [descriptorCluster readAttributePartsListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + XCTAssertNil(error); + XCTAssertNotNil(value); + [endpointList addObjectsFromArray:value]; + [descriptorReadExpectation fulfill]; + }]; + + [self waitForExpectations:@[ descriptorReadExpectation ] timeout:kTimeoutInSeconds]; + NSArray * attributePaths = @[ [MTRAttributeRequestPath requestPathWithEndpointID:nil clusterID:@29 attributeID:@0], [MTRAttributeRequestPath requestPathWithEndpointID:nil clusterID:@29 attributeID:@1], @@ -2028,8 +2042,7 @@ - (void)test020_ReadMultipleAttributes MTRAttributePath * path = result[@"attributePath"]; if ([path.attribute unsignedIntegerValue] < 4) { XCTAssertEqualObjects(path.cluster, @29); - __auto_type endpoint = [path.endpoint unsignedShortValue]; - XCTAssertTrue(endpoint == 0 || endpoint == 1 || endpoint == 2); + XCTAssertTrue([endpointList containsObject:path.endpoint]); } else { XCTAssertEqualObjects(path.cluster, @40); XCTAssertEqualObjects(path.endpoint, @0); @@ -2041,10 +2054,10 @@ - (void)test020_ReadMultipleAttributes XCTFail("Unexpected result dictionary %@", result); } } - // Our test application has 3 endpoints. We have a descriptor on each one, - // so that's 4 results per endpoint, and we only have Basic Information on - // endpoint 0, so that's 4 more results. - XCTAssertEqual(attributeResultCount, 3 * 4 + 4); + // We have a descriptor on each endpoint, so that's 4 results per endpoint, + // and we only have Basic Information on endpoint 0, so that's 4 more + // results. + XCTAssertEqual(attributeResultCount, endpointList.count * 4 + 4); XCTAssertEqual(eventResultCount, [eventPaths count]); [expectation fulfill]; @@ -2061,11 +2074,11 @@ - (void)test021_ReadMultipleWildcardPathsIncludeUnsupportedAttribute // Read the PartList of descriptor on endpoint 0 to find out how many endpoints there are. XCTestExpectation * descriptorReadExpectation = [self expectationWithDescription:@"read PartsList from endpoint 0"]; __auto_type * descriptorCluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(0) queue:queue]; - __block size_t endpointCount = 0; + __block NSMutableArray * endpointList = [NSMutableArray arrayWithObject:@0]; [descriptorCluster readAttributePartsListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { XCTAssertNil(error); XCTAssertNotNil(value); - endpointCount = value.count + 1; // Include endpoint 0 + [endpointList addObjectsFromArray:value]; [descriptorReadExpectation fulfill]; }]; @@ -2103,14 +2116,13 @@ - (void)test021_ReadMultipleWildcardPathsIncludeUnsupportedAttribute // and we only have Basic Information on endpoint 0, so that's 4 more // results. Note that there are no results for failAttributeID, because we // used a wildcard path and hence it got ignored. - XCTAssertEqual(resultArray.count, endpointCount * 4 + 4); + XCTAssertEqual(resultArray.count, endpointList.count * 4 + 4); for (NSDictionary * result in resultArray) { MTRAttributePath * path = result[@"attributePath"]; if ([path.attribute unsignedIntegerValue] < 4) { XCTAssertEqualObjects(path.cluster, @29); - __auto_type endpoint = [path.endpoint unsignedShortValue]; - XCTAssertTrue(endpoint == 0 || endpoint == 1 || endpoint == 2); + XCTAssertTrue([endpointList containsObject:path.endpoint]); } else { XCTAssertEqualObjects(path.cluster, @40); XCTAssertEqualObjects(path.endpoint, @0); @@ -3171,7 +3183,7 @@ + (void)checkAttributeReportTriggersConfigurationChanged:(MTRAttributeIDType)att XCTestExpectation * gotAttributeReportExpectation = [testcase expectationWithDescription:@"Attribute report has been received"]; XCTestExpectation * gotAttributeReportEndExpectation = [testcase expectationWithDescription:@"Attribute report has ended"]; - XCTestExpectation * deviceConfigurationChangedExpectation = [testcase expectationWithDescription:@"Device configuration changed was receieved"]; + XCTestExpectation * deviceConfigurationChangedExpectation = [testcase expectationWithDescription:@"Device configuration changed was received"]; deviceConfigurationChangedExpectation.inverted = !expectConfigurationChanged; __block unsigned attributeReportsReceived = 0; @@ -3252,13 +3264,22 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged // attribute list and cluster revision for the Identify cluster, accepted commands list for oven cavity operational state ID cluster and // feature map for groups ID cluster. __block NSNumber * dataVersionForPartsList; + __block NSMutableArray *> * valueForPartsList; + __block NSNumber * endpointForPartsList; __block NSNumber * dataVersionForDeviceTypesList; + __block NSNumber * endpointForDeviceTypeList; __block NSNumber * dataVersionForServerList; + __block NSNumber * endpointForServerList; __block NSNumber * dataVersionForAcceptedCommandList; + __block NSNumber * endpointForAcceptedCommandList; __block NSNumber * dataVersionForAttributeList; + __block NSNumber * endpointForAttributeList; __block NSNumber * dataVersionForClusterRevision; + __block NSNumber * endpointForClusterRevision; __block NSNumber * dataVersionForFeatureMap; + __block NSNumber * endpointForFeatureMap; __block NSNumber * dataVersionForPowerConfigurationSources; + __block NSNumber * endpointForPowerConfigurationSources; delegate.onAttributeDataReceived = ^(NSArray *> * attributeReport) { attributeReportsReceived += attributeReport.count; @@ -3268,20 +3289,24 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged MTRAttributePath * attributePath = attributeDict[MTRAttributePathKey]; XCTAssertNotNil(attributePath); - if (attributePath.cluster.unsignedLongValue == MTRClusterIDTypeDescriptorID) { + if (attributePath.cluster.unsignedLongValue == MTRClusterIDTypeDescriptorID && attributePath.endpoint.unsignedLongValue == 0) { NSDictionary * data = attributeDict[MTRDataKey]; XCTAssertNotNil(data); switch (attributePath.attribute.unsignedLongValue) { case MTRAttributeIDTypeClusterDescriptorAttributePartsListID: { dataVersionForPartsList = data[MTRDataVersionKey]; + valueForPartsList = [data[MTRValueKey] mutableCopy]; + endpointForPartsList = attributePath.endpoint; break; } case MTRAttributeIDTypeClusterDescriptorAttributeDeviceTypeListID: { dataVersionForDeviceTypesList = data[MTRDataVersionKey]; + endpointForDeviceTypeList = attributePath.endpoint; break; } case MTRAttributeIDTypeClusterDescriptorAttributeServerListID: { dataVersionForServerList = data[MTRDataVersionKey]; + endpointForServerList = attributePath.endpoint; break; } } @@ -3291,10 +3316,12 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged switch (attributePath.attribute.unsignedLongValue) { case MTRAttributeIDTypeGlobalAttributeAttributeListID: { dataVersionForAttributeList = data[MTRDataVersionKey]; + endpointForAttributeList = attributePath.endpoint; break; } case MTRAttributeIDTypeGlobalAttributeClusterRevisionID: { dataVersionForClusterRevision = data[MTRDataVersionKey]; + endpointForClusterRevision = attributePath.endpoint; break; } } @@ -3302,14 +3329,17 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged NSDictionary * data = attributeDict[MTRDataKey]; XCTAssertNotNil(data); dataVersionForAcceptedCommandList = data[MTRDataVersionKey]; + endpointForAcceptedCommandList = attributePath.endpoint; } else if (attributePath.cluster.unsignedLongValue == MTRClusterIDTypeGroupsID && attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeGlobalAttributeFeatureMapID) { NSDictionary * data = attributeDict[MTRDataKey]; XCTAssertNotNil(data); dataVersionForFeatureMap = data[MTRDataVersionKey]; + endpointForFeatureMap = attributePath.endpoint; } else if (attributePath.cluster.unsignedLongValue == MTRClusterIDTypePowerSourceConfigurationID && attributePath.attribute.unsignedLongValue == MTRAttributeIDTypeClusterPowerSourceConfigurationAttributeSourcesID) { NSDictionary * data = attributeDict[MTRDataKey]; XCTAssertNotNil(data); dataVersionForPowerConfigurationSources = data[MTRDataVersionKey]; + endpointForPowerConfigurationSources = attributePath.endpoint; } } }; @@ -3342,37 +3372,30 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged // Test attribute path - endpointId = 0, clusterId = descriptor, attributeId = parts list. dataVersionForPartsList = [NSNumber numberWithUnsignedLongLong:(dataVersionForPartsList.unsignedLongLongValue + 1)]; - NSArray *> * unsignedIntegerArrayValue = @[ - @{ + // Figure out an endpoint ID (not 0) we can add to PartsList. + for (unsigned i = 1; true; ++i) { + __auto_type unsignedIntegerValue = @{ MTRDataKey : @ { MTRTypeKey : MTRUnsignedIntegerValueType, - MTRValueKey : @1, - } - }, - @{ - MTRDataKey : @ { - MTRTypeKey : MTRUnsignedIntegerValueType, - MTRValueKey : @2, + MTRValueKey : @(i), } - }, - @{ - MTRDataKey : @ { - MTRTypeKey : MTRUnsignedIntegerValueType, - MTRValueKey : @3, - } - }, - ]; + }; + if (![valueForPartsList containsObject:unsignedIntegerValue]) { + [valueForPartsList addObject:unsignedIntegerValue]; + break; + } + } NSArray *> * attributeReport = @[ @{ - MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(MTRClusterIDTypeDescriptorID) attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributePartsListID)], + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:endpointForPartsList clusterID:@(MTRClusterIDTypeDescriptorID) attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributePartsListID)], MTRDataKey : @ { MTRDataVersionKey : dataVersionForPartsList, MTRTypeKey : MTRArrayValueType, - MTRValueKey : unsignedIntegerArrayValue, + MTRValueKey : valueForPartsList, } } ]; - [MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeClusterDescriptorAttributePartsListID clusterId:MTRClusterIDTypeDescriptorID endpointId:@(0) device:device delegate:delegate dataVersion:dataVersionForPartsList attributeReport:attributeReport testcase:self expectConfigurationChanged:YES]; + [MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeClusterDescriptorAttributePartsListID clusterId:MTRClusterIDTypeDescriptorID endpointId:endpointForPartsList device:device delegate:delegate dataVersion:dataVersionForPartsList attributeReport:attributeReport testcase:self expectConfigurationChanged:YES]; // Test attribute path - endpointId = 0, clusterId = descriptor, attributeId = device types list. dataVersionForDeviceTypesList = [NSNumber numberWithUnsignedLongLong:(dataVersionForDeviceTypesList.unsignedLongLongValue + 1)]; @@ -3401,7 +3424,7 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged ]; attributeReport = @[ @{ - MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(MTRClusterIDTypeDescriptorID) attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributeDeviceTypeListID)], + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:endpointForDeviceTypeList clusterID:@(MTRClusterIDTypeDescriptorID) attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributeDeviceTypeListID)], MTRDataKey : @ { MTRDataVersionKey : dataVersionForDeviceTypesList, MTRTypeKey : MTRArrayValueType, @@ -3409,12 +3432,34 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged } } ]; - [MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeClusterDescriptorAttributeDeviceTypeListID clusterId:MTRClusterIDTypeDescriptorID endpointId:@(0) device:device delegate:delegate dataVersion:dataVersionForDeviceTypesList attributeReport:attributeReport testcase:self expectConfigurationChanged:YES]; + // unsignedIntegerArrayValue is used for a variety of tests below. + NSArray *> * unsignedIntegerArrayValue = @[ + @{ + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @1, + } + }, + @{ + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @2, + } + }, + @{ + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @3, + } + }, + ]; + + [MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeClusterDescriptorAttributeDeviceTypeListID clusterId:MTRClusterIDTypeDescriptorID endpointId:endpointForDeviceTypeList device:device delegate:delegate dataVersion:dataVersionForDeviceTypesList attributeReport:attributeReport testcase:self expectConfigurationChanged:YES]; // Test attribute path - endpointId = 0, clusterId = descriptor, attributeId = server list. dataVersionForServerList = [NSNumber numberWithUnsignedLongLong:(dataVersionForServerList.unsignedLongLongValue + 1)]; attributeReport = @[ @{ - MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(MTRClusterIDTypeDescriptorID) attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributeServerListID)], + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:endpointForServerList clusterID:@(MTRClusterIDTypeDescriptorID) attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributeServerListID)], MTRDataKey : @ { MTRDataVersionKey : dataVersionForServerList, MTRTypeKey : MTRArrayValueType, @@ -3422,12 +3467,12 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged } } ]; - [MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeClusterDescriptorAttributeServerListID clusterId:MTRClusterIDTypeDescriptorID endpointId:@(0) device:device delegate:delegate dataVersion:dataVersionForServerList attributeReport:attributeReport testcase:self expectConfigurationChanged:YES]; + [MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeClusterDescriptorAttributeServerListID clusterId:MTRClusterIDTypeDescriptorID endpointId:endpointForServerList device:device delegate:delegate dataVersion:dataVersionForServerList attributeReport:attributeReport testcase:self expectConfigurationChanged:YES]; // Test attribute path - endpointId = 1, clusterId = ovencavityoperationalstateID, attributeId = accepted command list. dataVersionForAcceptedCommandList = [NSNumber numberWithUnsignedLongLong:(dataVersionForAcceptedCommandList.unsignedLongLongValue + 1)]; attributeReport = @[ @{ - MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(1) clusterID:@(MTRClusterIDTypeOvenCavityOperationalStateID) attributeID:@(MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID)], + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:endpointForAcceptedCommandList clusterID:@(MTRClusterIDTypeOvenCavityOperationalStateID) attributeID:@(MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID)], MTRDataKey : @ { MTRDataVersionKey : dataVersionForAcceptedCommandList, MTRTypeKey : MTRArrayValueType, @@ -3435,12 +3480,12 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged } } ]; - [MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID clusterId:MTRClusterIDTypeOvenCavityOperationalStateID endpointId:@(1) device:device delegate:delegate dataVersion:dataVersionForAcceptedCommandList attributeReport:attributeReport testcase:self expectConfigurationChanged:YES]; + [MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID clusterId:MTRClusterIDTypeOvenCavityOperationalStateID endpointId:endpointForAcceptedCommandList device:device delegate:delegate dataVersion:dataVersionForAcceptedCommandList attributeReport:attributeReport testcase:self expectConfigurationChanged:YES]; // Test attribute path - endpointId = 0, clusterId = identify, attributeId = attribute list. dataVersionForAttributeList = [NSNumber numberWithUnsignedLongLong:(dataVersionForAttributeList.unsignedLongLongValue + 1)]; attributeReport = @[ @{ - MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(MTRClusterIDTypeIdentifyID) attributeID:@(MTRAttributeIDTypeGlobalAttributeAttributeListID)], + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:endpointForAttributeList clusterID:@(MTRClusterIDTypeIdentifyID) attributeID:@(MTRAttributeIDTypeGlobalAttributeAttributeListID)], MTRDataKey : @ { MTRDataVersionKey : dataVersionForAttributeList, MTRTypeKey : MTRArrayValueType, @@ -3448,12 +3493,12 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged } } ]; - [MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeGlobalAttributeAttributeListID clusterId:MTRClusterIDTypeIdentifyID endpointId:@(0) device:device delegate:delegate dataVersion:dataVersionForAttributeList attributeReport:attributeReport testcase:self expectConfigurationChanged:YES]; + [MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeGlobalAttributeAttributeListID clusterId:MTRClusterIDTypeIdentifyID endpointId:endpointForAttributeList device:device delegate:delegate dataVersion:dataVersionForAttributeList attributeReport:attributeReport testcase:self expectConfigurationChanged:YES]; // Test attribute path - endpointId = 0, clusterId = identify, attributeId = cluster revision. dataVersionForClusterRevision = [NSNumber numberWithUnsignedLongLong:(dataVersionForClusterRevision.unsignedLongLongValue + 1)]; attributeReport = @[ @{ - MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(MTRClusterIDTypeIdentifyID) attributeID:@(MTRAttributeIDTypeGlobalAttributeClusterRevisionID)], + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:endpointForClusterRevision clusterID:@(MTRClusterIDTypeIdentifyID) attributeID:@(MTRAttributeIDTypeGlobalAttributeClusterRevisionID)], MTRDataKey : @ { MTRDataVersionKey : dataVersionForClusterRevision, MTRTypeKey : MTRUnsignedIntegerValueType, @@ -3461,12 +3506,12 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged } } ]; - [MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeGlobalAttributeClusterRevisionID clusterId:MTRClusterIDTypeIdentifyID endpointId:@(0) device:device delegate:delegate dataVersion:dataVersionForClusterRevision attributeReport:attributeReport testcase:self expectConfigurationChanged:YES]; + [MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeGlobalAttributeClusterRevisionID clusterId:MTRClusterIDTypeIdentifyID endpointId:endpointForClusterRevision device:device delegate:delegate dataVersion:dataVersionForClusterRevision attributeReport:attributeReport testcase:self expectConfigurationChanged:YES]; // Test attribute path - endpointId = 0, clusterId = groupsID, attributeId = feature map. dataVersionForFeatureMap = [NSNumber numberWithUnsignedLongLong:(dataVersionForFeatureMap.unsignedLongLongValue + 1)]; attributeReport = @[ @{ - MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(MTRClusterIDTypeGroupsID) attributeID:@(MTRAttributeIDTypeGlobalAttributeFeatureMapID)], + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:endpointForFeatureMap clusterID:@(MTRClusterIDTypeGroupsID) attributeID:@(MTRAttributeIDTypeGlobalAttributeFeatureMapID)], MTRDataKey : @ { MTRDataVersionKey : dataVersionForFeatureMap, MTRTypeKey : MTRUnsignedIntegerValueType, @@ -3474,12 +3519,12 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged } } ]; - [MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeGlobalAttributeFeatureMapID clusterId:MTRClusterIDTypeGroupsID endpointId:@(0) device:device delegate:delegate dataVersion:dataVersionForFeatureMap attributeReport:attributeReport testcase:self expectConfigurationChanged:YES]; + [MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeGlobalAttributeFeatureMapID clusterId:MTRClusterIDTypeGroupsID endpointId:endpointForFeatureMap device:device delegate:delegate dataVersion:dataVersionForFeatureMap attributeReport:attributeReport testcase:self expectConfigurationChanged:YES]; // Test attribute path that doesn't cause a device configuration changed - endpointId = 1, clusterId = power source configuration, attributeId = sources. dataVersionForPowerConfigurationSources = [NSNumber numberWithUnsignedLongLong:(dataVersionForPowerConfigurationSources.unsignedLongLongValue + 1)]; attributeReport = @[ @{ - MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(MTRClusterIDTypePowerSourceConfigurationID) attributeID:@(MTRAttributeIDTypeClusterPowerSourceConfigurationAttributeSourcesID)], + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:endpointForPowerConfigurationSources clusterID:@(MTRClusterIDTypePowerSourceConfigurationID) attributeID:@(MTRAttributeIDTypeClusterPowerSourceConfigurationAttributeSourcesID)], MTRDataKey : @ { MTRDataVersionKey : dataVersionForPowerConfigurationSources, MTRTypeKey : MTRArrayValueType, @@ -3487,7 +3532,7 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged } } ]; - [MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeClusterPowerSourceConfigurationAttributeSourcesID clusterId:MTRClusterIDTypePowerSourceConfigurationID endpointId:@(0) device:device delegate:delegate dataVersion:dataVersionForPowerConfigurationSources attributeReport:attributeReport testcase:self expectConfigurationChanged:NO]; + [MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeClusterPowerSourceConfigurationAttributeSourcesID clusterId:MTRClusterIDTypePowerSourceConfigurationID endpointId:endpointForPowerConfigurationSources device:device delegate:delegate dataVersion:dataVersionForPowerConfigurationSources attributeReport:attributeReport testcase:self expectConfigurationChanged:NO]; NSArray *> * newUnsignedIntegerArrayValue = @[ @{ @@ -3510,7 +3555,7 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged dataVersionForPowerConfigurationSources = [NSNumber numberWithUnsignedLongLong:(dataVersionForPowerConfigurationSources.unsignedLongLongValue + 1)]; attributeReport = @[ @{ - MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(MTRClusterIDTypeIdentifyID) attributeID:@(MTRAttributeIDTypeGlobalAttributeAttributeListID)], + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:endpointForAttributeList clusterID:@(MTRClusterIDTypeIdentifyID) attributeID:@(MTRAttributeIDTypeGlobalAttributeAttributeListID)], MTRDataKey : @ { MTRDataVersionKey : dataVersionForAttributeList, MTRTypeKey : MTRArrayValueType, @@ -3518,7 +3563,7 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged } }, @{ - MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(MTRClusterIDTypeGroupsID) attributeID:@(MTRAttributeIDTypeGlobalAttributeFeatureMapID)], + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:endpointForFeatureMap clusterID:@(MTRClusterIDTypeGroupsID) attributeID:@(MTRAttributeIDTypeGlobalAttributeFeatureMapID)], MTRDataKey : @ { MTRDataVersionKey : dataVersionForFeatureMap, MTRTypeKey : MTRUnsignedIntegerValueType, @@ -3526,7 +3571,7 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged } }, @{ - MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(MTRClusterIDTypePowerSourceConfigurationID) attributeID:@(MTRAttributeIDTypeClusterPowerSourceConfigurationAttributeSourcesID)], + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:endpointForPowerConfigurationSources clusterID:@(MTRClusterIDTypePowerSourceConfigurationID) attributeID:@(MTRAttributeIDTypeClusterPowerSourceConfigurationAttributeSourcesID)], MTRDataKey : @ { MTRDataVersionKey : dataVersionForPowerConfigurationSources, MTRTypeKey : MTRArrayValueType, diff --git a/src/darwin/Framework/CHIPTests/MTROTAProviderTests.m b/src/darwin/Framework/CHIPTests/MTROTAProviderTests.m index 3998a84a140863..3c8cad690ad83b 100644 --- a/src/darwin/Framework/CHIPTests/MTROTAProviderTests.m +++ b/src/darwin/Framework/CHIPTests/MTROTAProviderTests.m @@ -818,6 +818,7 @@ - (void)test003_ReceiveQueryImageRequestWhileHandlingBDX_RespondImplicitBusy XCTestExpectation * queryExpectation1 = [self expectationWithDescription:@"handleQueryImageForNodeID called first time"]; XCTestExpectation * queryExpectation2 = [self expectationWithDescription:@"handleQueryImageForNodeID called second time"]; XCTestExpectation * queryExpectation3 = [self expectationWithDescription:@"handleQueryImageForNodeID called third time"]; + XCTestExpectation * transferEndExpectation = [self expectationWithDescription:@"handleBDXTransferSessionEndForNodeID called"]; const uint16_t busyDelay = 1; // 1 second NSString * fakeImageURI = @"No such image, really"; @@ -825,6 +826,7 @@ - (void)test003_ReceiveQueryImageRequestWhileHandlingBDX_RespondImplicitBusy __block QueryImageHandler handleThirdQuery; sOTAProviderDelegate.queryImageHandler = ^(NSNumber * nodeID, MTRDeviceController * controller, MTROTASoftwareUpdateProviderClusterQueryImageParams * params, QueryImageCompletion completion) { + [queryExpectation1 fulfill]; XCTAssertEqualObjects(nodeID, @(kDeviceId1)); XCTAssertEqual(controller, sController); [sOTAProviderDelegate respondAvailableWithDelay:@(0) @@ -833,23 +835,32 @@ - (void)test003_ReceiveQueryImageRequestWhileHandlingBDX_RespondImplicitBusy softwareVersion:kUpdatedSoftwareVersion_5 softwareVersionString:kUpdatedSoftwareVersionString_5 completion:completion]; - [queryExpectation1 fulfill]; }; sOTAProviderDelegate.transferBeginHandler = ^(NSNumber * nodeID, MTRDeviceController * controller, NSString * fileDesignator, NSNumber * offset, MTRStatusCompletion outerCompletion) { + sOTAProviderDelegate.transferBeginHandler = nil; + // Now that we've begun a transfer, we expect to be told when it ends, even if it's due to an error + sOTAProviderDelegate.transferEndHandler = ^(NSNumber * nodeID, MTRDeviceController * controller, NSError * _Nullable error) { + [transferEndExpectation fulfill]; + sOTAProviderDelegate.transferEndHandler = nil; + XCTAssertEqualObjects(nodeID, @(kDeviceId1)); + XCTAssertIdentical(controller, sController); + XCTAssertNotNil(error); // we cancelled the transfer, so there should be an error + }; + XCTAssertEqualObjects(nodeID, @(kDeviceId1)); - XCTAssertEqual(controller, sController); + XCTAssertIdentical(controller, sController); // Don't actually respond until the second requestor has queried us for // an image. We need to reset queryImageHandler here, so we can close // over outerCompletion. sOTAProviderDelegate.queryImageHandler = ^(NSNumber * nodeID, MTRDeviceController * controller, MTROTASoftwareUpdateProviderClusterQueryImageParams * params, QueryImageCompletion innerCompletion) { + [queryExpectation2 fulfill]; sOTAProviderDelegate.queryImageHandler = handleThirdQuery; - sOTAProviderDelegate.transferBeginHandler = nil; XCTAssertEqualObjects(nodeID, @(kDeviceId2)); - XCTAssertEqual(controller, sController); + XCTAssertIdentical(controller, sController); // We respond UpdateAvailable, but since we are in the middle of // handling OTA for device1 we expect the requestor to get Busy and @@ -860,8 +871,9 @@ - (void)test003_ReceiveQueryImageRequestWhileHandlingBDX_RespondImplicitBusy softwareVersion:kUpdatedSoftwareVersion_5 softwareVersionString:kUpdatedSoftwareVersionString_5 completion:innerCompletion]; + + // Cancel the transfer with device1 [sOTAProviderDelegate respondErrorWithCompletion:outerCompletion]; - [queryExpectation2 fulfill]; }; announceResponseExpectation2 = [self announceProviderToDevice:device2]; @@ -869,11 +881,11 @@ - (void)test003_ReceiveQueryImageRequestWhileHandlingBDX_RespondImplicitBusy handleThirdQuery = ^(NSNumber * nodeID, MTRDeviceController * controller, MTROTASoftwareUpdateProviderClusterQueryImageParams * params, QueryImageCompletion completion) { + [queryExpectation3 fulfill]; XCTAssertEqualObjects(nodeID, @(kDeviceId2)); - XCTAssertEqual(controller, sController); + XCTAssertIdentical(controller, sController); [sOTAProviderDelegate respondNotAvailableWithCompletion:completion]; - [queryExpectation3 fulfill]; }; // Advertise ourselves as an OTA provider. @@ -881,7 +893,7 @@ - (void)test003_ReceiveQueryImageRequestWhileHandlingBDX_RespondImplicitBusy // Make sure we get our queries in order. Give it a bit more time, because // there will be a delay between the two queries. - [self waitForExpectations:@[ queryExpectation1, queryExpectation2, queryExpectation3 ] + [self waitForExpectations:@[ queryExpectation1, queryExpectation2, transferEndExpectation, queryExpectation3 ] timeout:(kTimeoutInSeconds + busyDelay * 3) enforceOrder:YES]; diff --git a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m index ced79aadb78b82..db8bd300df94e1 100644 --- a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m +++ b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m @@ -2508,11 +2508,12 @@ - (void)testDataStorageUpdatesWhenRemovingEndpoints __block NSNumber * rootEndpoint = @0; // This test will do the following - - // 1. Get the data version and attribute value of the parts list for endpoint 0 to inject a fake report. The attribute report will delete endpoint 2. + // 1. Get the data version and attribute value of the parts list for endpoint 0 to inject a fake report. + // The injected attribute report will delete endpoint 2. // That should cause the endpoint and its corresponding clusters to be removed from data storage. - // 2. The data store is populated with cluster index and cluster data for endpoints 0, 1 and 2 initially. + // 2. The data store is populated with cluster index and cluster data for the set of endpoints in our test app initially. // 3. After the fake attribute report is injected with deleted endpoint 2, make sure the data store is still populated with cluster index and cluster data - // for endpoints 0 and 1 but not 2. + // for all the other endpoints. __block MTRDeviceDataValueDictionary testDataForPartsList; __block id testClusterDataValueForPartsList; delegate.onAttributeDataReceived = ^(NSArray *> * attributeReport) { @@ -2534,18 +2535,21 @@ - (void)testDataStorageUpdatesWhenRemovingEndpoints }; __block NSMutableDictionary *> * initialClusterIndex = [[NSMutableDictionary alloc] init]; - __block NSMutableArray * testEndpoints; + // Some of the places we get endpoint lists get them from enumerating dictionary keys, which + // means order is not guaranteed. Make sure we compare sets of endpoints, not arrays, to + // account for that. + __block NSSet * testEndpoints; delegate.onReportEnd = ^{ XCTAssertNotNil(dataVersionForPartsList); XCTAssertNotNil(testClusterDataValueForPartsList); - testEndpoints = [self getEndpointArrayFromPartsList:testDataForPartsList forDevice:device]; + testEndpoints = [NSSet setWithArray:[self getEndpointArrayFromPartsList:testDataForPartsList forDevice:device]]; - // Make sure that the cluster data in the data storage is populated with cluster index and cluster data for endpoints 0, 1 and 2. + // Make sure that the cluster data in the data storage is populated with cluster index and cluster data for our endpoints. // We do not need to check _persistedClusterData here. _persistedClusterData will be paged in from storage when needed so // just checking data storage should suffice here. dispatch_sync(self->_storageQueue, ^{ - XCTAssertTrue([[controller.controllerDataStore _fetchEndpointIndexForNodeID:deviceID] isEqualToArray:testEndpoints]); + XCTAssertEqualObjects([NSSet setWithArray:[controller.controllerDataStore _fetchEndpointIndexForNodeID:deviceID]], testEndpoints); // Populate the initialClusterIndex to use as a reference for all cluster paths later. for (NSNumber * endpoint in testEndpoints) { @@ -2568,8 +2572,9 @@ - (void)testDataStorageUpdatesWhenRemovingEndpoints // Inject a fake attribute report deleting endpoint 2 from the parts list at the root endpoint. dataVersionForPartsList = [NSNumber numberWithUnsignedLongLong:(dataVersionForPartsList.unsignedLongLongValue + 1)]; - // Delete endpoint 2 from the attribute value in parts list. + // Delete our to-be-deleted endpoint from the attribute value in parts list. Make sure it's in the list to start with. NSNumber * toBeDeletedEndpoint = @2; + XCTAssertTrue([testEndpoints containsObject:toBeDeletedEndpoint]); id endpointData = @{ MTRDataKey : @ { @@ -2578,6 +2583,7 @@ - (void)testDataStorageUpdatesWhenRemovingEndpoints } }; + XCTAssertTrue([testClusterDataValueForPartsList containsObject:endpointData]); [testClusterDataValueForPartsList removeObject:endpointData]; NSArray *> * attributeReport = @[ @{ @@ -2612,13 +2618,13 @@ - (void)testDataStorageUpdatesWhenRemovingEndpoints delegate.onReportEnd = ^{ XCTAssertNotNil(testClusterDataValueForPartsList); - testEndpoints = [self getEndpointArrayFromPartsList:testDataForPartsList forDevice:device]; + testEndpoints = [NSSet setWithArray:[self getEndpointArrayFromPartsList:testDataForPartsList forDevice:device]]; - // Make sure that the cluster data in the data storage for endpoints 0 and 1 are present but not for endpoint 2. + // Make sure that the cluster data is removed from the data storage for the endpoint we deleted, but still there for the others. // We do not need to check _persistedClusterData here. _persistedClusterData will be paged in from storage when needed so // just checking data storage should suffice here. dispatch_sync(self->_storageQueue, ^{ - XCTAssertTrue([[controller.controllerDataStore _fetchEndpointIndexForNodeID:deviceID] isEqualToArray:testEndpoints]); + XCTAssertEqualObjects([NSSet setWithArray:[controller.controllerDataStore _fetchEndpointIndexForNodeID:deviceID]], testEndpoints); for (NSNumber * endpoint in testEndpoints) { XCTAssertNotNil(initialClusterIndex); for (NSNumber * cluster in [initialClusterIndex objectForKey:endpoint]) { @@ -2828,7 +2834,7 @@ - (void)testDataStorageUpdatesWhenRemovingAttributes MTRClusterPath * path = [MTRClusterPath clusterPathWithEndpointID:testEndpoint clusterID:cluster]; if ([cluster isEqualToNumber:@(MTRClusterIDTypeIdentifyID)]) { - MTRDeviceClusterData * data = [device _getClusterDataForPath:path]; + MTRDeviceClusterData * data = [device unitTestGetClusterDataForPath:path]; XCTAssertNotNil(data); XCTAssertNotNil(data.attributes); @@ -2891,7 +2897,7 @@ - (void)testDataStorageUpdatesWhenRemovingAttributes MTRClusterPath * path = [MTRClusterPath clusterPathWithEndpointID:testEndpoint clusterID:cluster]; if ([cluster isEqualToNumber:@(MTRClusterIDTypeIdentifyID)]) { - MTRDeviceClusterData * data = [device _getClusterDataForPath:path]; + MTRDeviceClusterData * data = [device unitTestGetClusterDataForPath:path]; XCTAssertNotNil(data); XCTAssertNotNil(data.attributes); @@ -2931,4 +2937,128 @@ - (void)testDataStorageUpdatesWhenRemovingAttributes XCTAssertFalse([controller isRunning]); } +// Run the test here since detectLeaks is set, and subscription reset needs to not cause leaks +- (void)testMTRDeviceResetSubscription +{ + __auto_type * storageDelegate = [[MTRTestPerControllerStorageWithBulkReadWrite alloc] initWithControllerID:[NSUUID UUID]]; + + __auto_type * factory = [MTRDeviceControllerFactory sharedInstance]; + XCTAssertNotNil(factory); + + __auto_type queue = dispatch_get_main_queue(); + + __auto_type * rootKeys = [[MTRTestKeys alloc] init]; + XCTAssertNotNil(rootKeys); + + __auto_type * operationalKeys = [[MTRTestKeys alloc] init]; + XCTAssertNotNil(operationalKeys); + + NSNumber * nodeID = @(333); + NSNumber * fabricID = @(444); + + NSError * error; + + MTRPerControllerStorageTestsCertificateIssuer * certificateIssuer; + MTRDeviceController * controller = [self startControllerWithRootKeys:rootKeys + operationalKeys:operationalKeys + fabricID:fabricID + nodeID:nodeID + storage:storageDelegate + error:&error + certificateIssuer:&certificateIssuer]; + XCTAssertNil(error); + XCTAssertNotNil(controller); + XCTAssertTrue([controller isRunning]); + + XCTAssertEqualObjects(controller.controllerNodeID, nodeID); + + // Now commission the device, to test that that works. + NSNumber * deviceID = @(22); + certificateIssuer.nextNodeID = deviceID; + [self commissionWithController:controller newNodeID:deviceID]; + + // We should have established CASE using our operational key. + XCTAssertEqual(operationalKeys.signatureCount, 1); + + __auto_type * device = [MTRDevice deviceWithNodeID:deviceID controller:controller]; + __auto_type * delegate = [[MTRDeviceTestDelegate alloc] init]; + + XCTestExpectation * subscriptionExpectation1 = [self expectationWithDescription:@"Subscription has been set up 1"]; + + delegate.onReportEnd = ^{ + [subscriptionExpectation1 fulfill]; + }; + + [device setDelegate:delegate queue:queue]; + + [self waitForExpectations:@[ subscriptionExpectation1 ] timeout:60]; + + // Test 1: test that subscription reset works + + XCTestExpectation * subscriptionExpectation2 = [self expectationWithDescription:@"Subscription has been set up 2"]; + + __weak __auto_type weakDelegate = delegate; + delegate.onReportEnd = ^{ + [subscriptionExpectation2 fulfill]; + // reset callback so expectation not fulfilled twice + __strong __auto_type strongDelegate = weakDelegate; + strongDelegate.onReportEnd = nil; + }; + + // clear cluster data before reset + NSUInteger attributeCountBeforeReset = [device unitTestAttributeCount]; + [device unitTestClearClusterData]; + + [device unitTestResetSubscription]; + + [self waitForExpectations:@[ subscriptionExpectation2 ] timeout:60]; + + // check that in-memory cache has recovered + NSUInteger attributeCountAfterReset = [device unitTestAttributeCount]; + XCTAssertEqual(attributeCountBeforeReset, attributeCountAfterReset); + + // Test 2: simulate a cache purge and loss of storage, to see: + // * that subscription reestablishes + // * the cache is restored + [device unitTestClearClusterData]; + [controller.controllerDataStore clearAllStoredClusterData]; + + NSDictionary * storedClusterData = [controller.controllerDataStore getStoredClusterDataForNodeID:deviceID]; + XCTAssertEqual(storedClusterData.count, 0); + + XCTestExpectation * subscriptionExpectation3 = [self expectationWithDescription:@"Subscription has been set up 3"]; + delegate.onReportEnd = ^{ + [subscriptionExpectation3 fulfill]; + // reset callback so expectation not fulfilled twice + __strong __auto_type strongDelegate = weakDelegate; + strongDelegate.onReportEnd = nil; + }; + + // now get list of clusters, and call clusterDataForPath: to trigger the reset + NSSet * persistedClusters = [device unitTestGetPersistedClusters]; + MTRDeviceClusterData * data = [device unitTestGetClusterDataForPath:persistedClusters.anyObject]; + XCTAssertNil(data); + + // Also call clusterDataForPath: repeatedly to verify in logs that subscription is reset only once + for (MTRClusterPath * path in persistedClusters) { + MTRDeviceClusterData * data = [device unitTestGetClusterDataForPath:path]; + (void) data; // do not assert nil because subscription may happen during this time and already fill in the cache + } + + [self waitForExpectations:@[ subscriptionExpectation3 ] timeout:60]; + + // Verify that after report ends all the cluster data is back + for (MTRClusterPath * path in persistedClusters) { + MTRDeviceClusterData * data = [device unitTestGetClusterDataForPath:path]; + XCTAssertNotNil(data); + } + + // Reset our commissionee. + __auto_type * baseDevice = [MTRBaseDevice deviceWithNodeID:deviceID controller:controller]; + ResetCommissionee(baseDevice, queue, self, kTimeoutInSeconds); + + [controller shutdown]; + XCTAssertFalse([controller isRunning]); +} + @end diff --git a/src/darwin/Framework/CHIPTests/MTRSwiftDeviceTests.swift b/src/darwin/Framework/CHIPTests/MTRSwiftDeviceTests.swift index 398b03a0b4390f..1e1ee92e480ad4 100644 --- a/src/darwin/Framework/CHIPTests/MTRSwiftDeviceTests.swift +++ b/src/darwin/Framework/CHIPTests/MTRSwiftDeviceTests.swift @@ -92,6 +92,14 @@ class MTRSwiftDeviceTestDelegate : NSObject, MTRDeviceDelegate { return 2; // seconds } + @objc func unitTestSuppressTimeBasedReachabilityChanges(_ device : MTRDevice) -> Bool + { + // Allowing time-based reachability changes just makes the tests + // non-deterministic and can lead to random failures. Suppress them + // unconditionally for now. If we ever add tests that try to exercise that + // codepath, we can make this configurable. + return true; + } } class MTRSwiftDeviceTests : XCTestCase { diff --git a/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h b/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h index 0705cb89cb1ff6..46d6c61e950f2d 100644 --- a/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h +++ b/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestDeclarations.h @@ -47,8 +47,6 @@ NS_ASSUME_NONNULL_BEGIN @interface MTRDevice (Test) - (BOOL)_attributeDataValue:(NSDictionary *)one isEqualToDataValue:(NSDictionary *)theOther; -- (MTRDeviceClusterData *)_getClusterDataForPath:(MTRClusterPath *)path; -- (BOOL)_clusterHasBeenPersisted:(MTRClusterPath *)path; - (NSMutableArray *)arrayOfNumbersFromAttributeValue:(MTRDeviceDataValueDictionary)dataDictionary; @end @@ -79,6 +77,10 @@ NS_ASSUME_NONNULL_BEGIN deviceReportingExcessivelyIntervalThreshold:(NSTimeInterval)deviceReportingExcessivelyIntervalThreshold; - (void)unitTestSetMostRecentReportTimes:(NSMutableArray *)mostRecentReportTimes; - (NSUInteger)unitTestNonnullDelegateCount; +- (void)unitTestResetSubscription; +- (MTRDeviceClusterData *)unitTestGetClusterDataForPath:(MTRClusterPath *)path; +- (NSSet *)unitTestGetPersistedClusters; +- (BOOL)unitTestClusterHasBeenPersisted:(MTRClusterPath *)path; @end #endif diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index df5949868d0012..b23605ce2eaa4e 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -1626,6 +1626,7 @@ B2E0D7B2245B0B5C003C5B48 /* MTRManualSetupPayloadParser.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 */, @@ -1671,7 +1672,6 @@ 514C7A022B64223400DD6D7B /* MTRServerEndpoint_Internal.h in Headers */, 511913FC28C100EF009235E9 /* MTRBaseSubscriptionCallback.h in Headers */, 51565CB12A7AD77600469F18 /* MTRDeviceControllerDataStore.h in Headers */, - 3D4733B32BE2D1DA003DC19B /* MTRUtilities.h in Headers */, 3D843713294977000070D20A /* NSDataSpanConversion.h in Headers */, 991DC08B247704DC00C13860 /* MTRLogging_Internal.h in Headers */, 51FE723F2ACDEF3E00437032 /* MTRCommandPayloadExtensions_Internal.h in Headers */, diff --git a/src/include/platform/CHIPDeviceConfig.h b/src/include/platform/CHIPDeviceConfig.h index 49a94d75c23fcc..bc13696c8c36a2 100644 --- a/src/include/platform/CHIPDeviceConfig.h +++ b/src/include/platform/CHIPDeviceConfig.h @@ -425,6 +425,15 @@ #define CHIP_DEVICE_CONFIG_WIFI_STATION_IF_NAME "wlan0" #endif +/** + * CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + * + * Enable support for commissioning using Wi-Fi Public Action Frame as the transport. + */ +#ifndef CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +#define CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF 0 +#endif + // -------------------- WiFi AP Configuration -------------------- /** diff --git a/src/include/platform/CHIPDeviceEvent.h b/src/include/platform/CHIPDeviceEvent.h index 437b20e670284f..09f4c46b652920 100644 --- a/src/include/platform/CHIPDeviceEvent.h +++ b/src/include/platform/CHIPDeviceEvent.h @@ -281,7 +281,9 @@ enum InternalEventTypes * This event should populate CHIPoBLEConnectionError structure. */ kCHIPoBLEConnectionError, - kCHIPoBLENotifyConfirm + kCHIPoBLENotifyConfirm, + kCHIPoWiFiPAFWriteReceived, + kCHIPoWiFiPAFConnected, }; static_assert(kEventTypeNotSet == 0, "kEventTypeNotSet must be defined as 0"); @@ -491,6 +493,12 @@ struct ChipDeviceEvent final { BLE_CONNECTION_OBJECT ConId; } CHIPoBLENotifyConfirm; +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + struct + { + chip::System::PacketBuffer * Data; + } CHIPoWiFiPAFWriteReceived; +#endif struct { bool RoleChanged : 1; diff --git a/src/include/platform/ConnectivityManager.h b/src/include/platform/ConnectivityManager.h index 817019b3c1c63c..209d7484b92bda 100644 --- a/src/include/platform/ConnectivityManager.h +++ b/src/include/platform/ConnectivityManager.h @@ -35,6 +35,9 @@ #if INET_CONFIG_ENABLE_TCP_ENDPOINT #include #endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +#include +#endif namespace chip { @@ -171,6 +174,19 @@ class ConnectivityManager bool IsWiFiStationProvisioned(); void ClearWiFiStationProvision(); CHIP_ERROR GetAndLogWiFiStatsCounters(); +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + struct WiFiPAFAdvertiseParam; + + CHIP_ERROR SetWiFiPAFAdvertisingEnabled(WiFiPAFAdvertiseParam & args); + typedef void (*OnConnectionCompleteFunct)(void * appState); + typedef void (*OnConnectionErrorFunct)(void * appState, CHIP_ERROR err); + CHIP_ERROR WiFiPAFConnect(const SetupDiscriminator & connDiscriminator, void * appState, OnConnectionCompleteFunct onSuccess, + OnConnectionErrorFunct onError); + CHIP_ERROR WiFiPAFCancelConnect(); + CHIP_ERROR WiFiPAFSend(System::PacketBufferHandle && msgBuf); + Transport::WiFiPAFBase * GetWiFiPAF(); + void SetWiFiPAF(Transport::WiFiPAFBase * pmWiFiPAF); +#endif // WiFi AP methods WiFiAPMode GetWiFiAPMode(); @@ -268,6 +284,16 @@ struct ConnectivityManager::SEDIntervalsConfig System::Clock::Milliseconds32 IdleIntervalMS; }; +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +struct ConnectivityManager::WiFiPAFAdvertiseParam +{ + /* To enable/disable WiFiPAF Commissioning */ + bool enable; + /* The optional commands */ + const char * ExtCmds; +}; +#endif + /** * Returns a reference to the public interface of the ConnectivityManager singleton object. * @@ -407,6 +433,29 @@ inline CHIP_ERROR ConnectivityManager::GetAndLogWiFiStatsCounters() return static_cast(this)->_GetAndLogWiFiStatsCounters(); } +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +inline CHIP_ERROR ConnectivityManager::SetWiFiPAFAdvertisingEnabled(WiFiPAFAdvertiseParam & args) +{ + return static_cast(this)->_SetWiFiPAFAdvertisingEnabled(args); +} + +inline CHIP_ERROR ConnectivityManager::WiFiPAFConnect(const SetupDiscriminator & connDiscriminator, void * appState, + OnConnectionCompleteFunct onSuccess, OnConnectionErrorFunct onError) +{ + return static_cast(this)->_WiFiPAFConnect(connDiscriminator, appState, onSuccess, onError); +} + +inline CHIP_ERROR ConnectivityManager::WiFiPAFCancelConnect() +{ + return static_cast(this)->_WiFiPAFCancelConnect(); +} + +inline CHIP_ERROR ConnectivityManager::WiFiPAFSend(chip::System::PacketBufferHandle && msgBuf) +{ + return static_cast(this)->_WiFiPAFSend(std::move(msgBuf)); +} +#endif + inline bool ConnectivityManager::IsThreadEnabled() { return static_cast(this)->_IsThreadEnabled(); @@ -451,6 +500,18 @@ inline void ConnectivityManager::ResetThreadNetworkDiagnosticsCounts() static_cast(this)->_ResetThreadNetworkDiagnosticsCounts(); } +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +inline Transport::WiFiPAFBase * ConnectivityManager::GetWiFiPAF() +{ + return static_cast(this)->_GetWiFiPAF(); +} + +inline void ConnectivityManager::SetWiFiPAF(Transport::WiFiPAFBase * pWiFiPAF) +{ + return static_cast(this)->_SetWiFiPAF(pWiFiPAF); +} +#endif + inline Ble::BleLayer * ConnectivityManager::GetBleLayer() { return static_cast(this)->_GetBleLayer(); diff --git a/src/inet/tests/BUILD.gn b/src/inet/tests/BUILD.gn index 151b08b7c18838..376693a15c205c 100755 --- a/src/inet/tests/BUILD.gn +++ b/src/inet/tests/BUILD.gn @@ -71,6 +71,7 @@ if (chip_build_tests) { ":helpers", "${chip_root}/src/inet", "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", ] test_sources = [ "TestBasicPacketFilters.cpp", diff --git a/src/inet/tests/TestBasicPacketFilters.cpp b/src/inet/tests/TestBasicPacketFilters.cpp index 162fe5272d4b94..69494e48f35b78 100644 --- a/src/inet/tests/TestBasicPacketFilters.cpp +++ b/src/inet/tests/TestBasicPacketFilters.cpp @@ -18,11 +18,12 @@ #include #include -#include +#include #include #include #include +#include #include #include #include diff --git a/src/inet/tests/TestInetAddress.cpp b/src/inet/tests/TestInetAddress.cpp index 1b7e7bdfbefd40..900ce2d829b873 100644 --- a/src/inet/tests/TestInetAddress.cpp +++ b/src/inet/tests/TestInetAddress.cpp @@ -26,10 +26,11 @@ #include -#include +#include #include #include +#include #if CHIP_SYSTEM_CONFIG_USE_LWIP #include diff --git a/src/inet/tests/TestInetEndPoint.cpp b/src/inet/tests/TestInetEndPoint.cpp index 3e6f613a4cb179..10209c0ba9b50f 100644 --- a/src/inet/tests/TestInetEndPoint.cpp +++ b/src/inet/tests/TestInetEndPoint.cpp @@ -29,11 +29,12 @@ #include #include -#include +#include #include #include #include +#include #include #include #include diff --git a/src/inet/tests/TestInetErrorStr.cpp b/src/inet/tests/TestInetErrorStr.cpp index 8e92a040d8567b..60f88a6a5e4767 100644 --- a/src/inet/tests/TestInetErrorStr.cpp +++ b/src/inet/tests/TestInetErrorStr.cpp @@ -28,10 +28,11 @@ #include #include -#include +#include #include #include +#include #include using namespace chip; diff --git a/src/lib/address_resolve/AddressResolve.h b/src/lib/address_resolve/AddressResolve.h index 7dffeed01ed1d8..0d6f8ab719519d 100644 --- a/src/lib/address_resolve/AddressResolve.h +++ b/src/lib/address_resolve/AddressResolve.h @@ -33,7 +33,8 @@ struct ResolveResult { Transport::PeerAddress address; ReliableMessageProtocolConfig mrpRemoteConfig; - bool supportsTcp = false; + bool supportsTcpServer = false; + bool supportsTcpClient = false; bool isICDOperatingAsLIT = false; ResolveResult() : address(Transport::Type::kUdp), mrpRemoteConfig(GetDefaultMRPConfig()) {} diff --git a/src/lib/address_resolve/AddressResolve_DefaultImpl.cpp b/src/lib/address_resolve/AddressResolve_DefaultImpl.cpp index 5a9651ff76ba3d..9888c96e721265 100644 --- a/src/lib/address_resolve/AddressResolve_DefaultImpl.cpp +++ b/src/lib/address_resolve/AddressResolve_DefaultImpl.cpp @@ -47,13 +47,16 @@ void NodeLookupHandle::LookupResult(const ResolveResult & result) char addr_string[Transport::PeerAddress::kMaxToStringSize]; result.address.ToString(addr_string); + const PeerId peerId = GetRequest().GetPeerId(); if (success) { - ChipLogProgress(Discovery, "%s: new best score: %u", addr_string, to_underlying(score)); + ChipLogProgress(Discovery, "%s: new best score: %u (for " ChipLogFormatPeerId ")", addr_string, to_underlying(score), + ChipLogValuePeerId(peerId)); } else { - ChipLogProgress(Discovery, "%s: score has not improved: %u", addr_string, to_underlying(score)); + ChipLogProgress(Discovery, "%s: score has not improved: %u (for " ChipLogFormatPeerId ")", addr_string, + to_underlying(score), ChipLogValuePeerId(peerId)); } #endif } @@ -287,8 +290,9 @@ void Resolver::OnOperationalNodeResolved(const Dnssd::ResolvedNodeData & nodeDat result.address.SetPort(nodeData.resolutionData.port); result.address.SetInterface(nodeData.resolutionData.interfaceId); - result.mrpRemoteConfig = nodeData.resolutionData.GetRemoteMRPConfig(); - result.supportsTcp = nodeData.resolutionData.supportsTcp; + result.mrpRemoteConfig = nodeData.resolutionData.GetRemoteMRPConfig(); + result.supportsTcpClient = nodeData.resolutionData.supportsTcpClient; + result.supportsTcpServer = nodeData.resolutionData.supportsTcpServer; if (nodeData.resolutionData.isICDOperatingAsLIT.has_value()) { diff --git a/src/lib/address_resolve/tests/BUILD.gn b/src/lib/address_resolve/tests/BUILD.gn index 994833f21a0020..9521e6f7b27c6d 100644 --- a/src/lib/address_resolve/tests/BUILD.gn +++ b/src/lib/address_resolve/tests/BUILD.gn @@ -28,6 +28,7 @@ chip_test_suite("tests") { public_deps = [ "${chip_root}/src/lib/address_resolve", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/protocols", ] } diff --git a/src/lib/address_resolve/tests/TestAddressResolve_DefaultImpl.cpp b/src/lib/address_resolve/tests/TestAddressResolve_DefaultImpl.cpp index 74dc3bd81b29d2..266939fa3f5d3b 100644 --- a/src/lib/address_resolve/tests/TestAddressResolve_DefaultImpl.cpp +++ b/src/lib/address_resolve/tests/TestAddressResolve_DefaultImpl.cpp @@ -13,9 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include + +#include #include +#include using namespace chip; using namespace chip::AddressResolve; diff --git a/src/lib/address_resolve/tool.cpp b/src/lib/address_resolve/tool.cpp index 8423649ca928a0..53d01b4011806f 100644 --- a/src/lib/address_resolve/tool.cpp +++ b/src/lib/address_resolve/tool.cpp @@ -56,7 +56,8 @@ class PrintOutNodeListener : public chip::AddressResolve::NodeListener result.address.ToString(addr_string); ChipLogProgress(Discovery, "Resolve completed: %s", addr_string); - ChipLogProgress(Discovery, " Supports TCP: %s", result.supportsTcp ? "YES" : "NO"); + ChipLogProgress(Discovery, " Supports TCP Client: %s", result.supportsTcpClient ? "YES" : "NO"); + ChipLogProgress(Discovery, " Supports TCP Server: %s", result.supportsTcpServer ? "YES" : "NO"); ChipLogProgress(Discovery, " MRP IDLE retransmit timeout: %u ms", result.mrpRemoteConfig.mIdleRetransTimeout.count()); ChipLogProgress(Discovery, " MRP ACTIVE retransmit timeout: %u ms", result.mrpRemoteConfig.mActiveRetransTimeout.count()); ChipLogProgress(Discovery, " MRP ACTIVE Threshold time: %u ms", result.mrpRemoteConfig.mActiveThresholdTime.count()); diff --git a/src/lib/asn1/tests/BUILD.gn b/src/lib/asn1/tests/BUILD.gn index 83c3ec8d3d9e43..a6b2d1a5a71248 100644 --- a/src/lib/asn1/tests/BUILD.gn +++ b/src/lib/asn1/tests/BUILD.gn @@ -25,6 +25,7 @@ chip_test_suite("tests") { public_deps = [ "${chip_root}/src/lib/asn1", "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/platform", ] diff --git a/src/lib/asn1/tests/TestASN1.cpp b/src/lib/asn1/tests/TestASN1.cpp index db8b1ae8ccf595..6633867895e74a 100644 --- a/src/lib/asn1/tests/TestASN1.cpp +++ b/src/lib/asn1/tests/TestASN1.cpp @@ -24,14 +24,16 @@ * decode interfaces. * */ -#include #include #include #include +#include + #include #include +#include #include using namespace chip; diff --git a/src/lib/core/CHIPConfig.h b/src/lib/core/CHIPConfig.h index 2de6a662ee8c4d..e9c317dfc79d5c 100644 --- a/src/lib/core/CHIPConfig.h +++ b/src/lib/core/CHIPConfig.h @@ -1624,6 +1624,15 @@ extern const char CHIP_NON_PRODUCTION_MARKER[]; #define CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC 2 #endif +/** + * @def CHIP_CONFIG_ICD_MAXIMUM_CHECK_IN_BACKOFF + * + * @brief Default value for the ICD Management cluster MaximumCheckInBackoff attribute, in seconds + */ +#ifndef CHIP_CONFIG_ICD_MAXIMUM_CHECK_IN_BACKOFF_SEC +#define CHIP_CONFIG_ICD_MAXIMUM_CHECK_IN_BACKOFF_SEC CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC +#endif + /** * @name Configuation for resuming subscriptions that timed out * @@ -1702,6 +1711,24 @@ extern const char CHIP_NON_PRODUCTION_MARKER[]; #define CHIP_CONFIG_MAX_ICD_CLIENTS_INFO_STORAGE_CONCURRENT_ITERATORS 1 #endif +/** + * @def CHIP_CONFIG_MAX_THREAD_NETWORK_DIRECTORY_STORAGE_CAPACITY + * + * Defines the number of networks the default ThreadNetworkDirectoryStorage implementation will store. + */ +#ifndef CHIP_CONFIG_MAX_THREAD_NETWORK_DIRECTORY_STORAGE_CAPACITY +#define CHIP_CONFIG_MAX_THREAD_NETWORK_DIRECTORY_STORAGE_CAPACITY (CHIP_CONFIG_MAX_FABRICS * 2) +#endif + +/** + * @def CHIP_CONFIG_MAX_THREAD_NETWORK_DIRECTORY_STORAGE_CONCURRENT_ITERATORS + * + * Defines the number of ThreadNetworkDirectoryStorage iterators that can be allocated at any one time. + */ +#ifndef CHIP_CONFIG_MAX_THREAD_NETWORK_DIRECTORY_STORAGE_CONCURRENT_ITERATORS +#define CHIP_CONFIG_MAX_THREAD_NETWORK_DIRECTORY_STORAGE_CONCURRENT_ITERATORS 1 +#endif + /** * @def CHIP_CONFIG_COMMAND_SENDER_BUILTIN_SUPPORT_FOR_BATCHED_COMMANDS * diff --git a/src/lib/core/CHIPError.h b/src/lib/core/CHIPError.h index b49088247e126c..23d83d868ea3df 100644 --- a/src/lib/core/CHIPError.h +++ b/src/lib/core/CHIPError.h @@ -1702,18 +1702,18 @@ using CHIP_ERROR = ::chip::ChipError; */ #define CHIP_ERROR_IM_STATUS_CODE_RECEIVED CHIP_CORE_ERROR(0xca) -// AVAILABLEL 0xcb -// AVAILABLEL 0xcc -// AVAILABLEL 0xcd -// AVAILABLEL 0xce -// AVAILABLEL 0xcf -// AVAILABLEL 0xd0 -// AVAILABLEL 0xd1 -// AVAILABLEL 0xd2 -// AVAILABLEL 0xd3 -// AVAILABLEL 0xd4 -// AVAILABLEL 0xd5 -// AVAILABLEL 0xd6 +// AVAILABLE 0xcb +// AVAILABLE 0xcc +// AVAILABLE 0xcd +// AVAILABLE 0xce +// AVAILABLE 0xcf +// AVAILABLE 0xd0 +// AVAILABLE 0xd1 +// AVAILABLE 0xd2 +// AVAILABLE 0xd3 +// AVAILABLE 0xd4 +// AVAILABLE 0xd5 +// AVAILABLE 0xd6 /** * @def CHIP_ERROR_IM_MALFORMED_DATA_VERSION_FILTER_IB diff --git a/src/lib/core/tests/BUILD.gn b/src/lib/core/tests/BUILD.gn index 94a6ace3636be1..eb17707dec1755 100644 --- a/src/lib/core/tests/BUILD.gn +++ b/src/lib/core/tests/BUILD.gn @@ -43,6 +43,7 @@ chip_test_suite("tests") { public_deps = [ "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/core:vectortlv", "${chip_root}/src/lib/support:test_utils", "${chip_root}/src/platform", diff --git a/src/lib/core/tests/TestCATValues.cpp b/src/lib/core/tests/TestCATValues.cpp index a8563905ecb648..6e96610393357f 100644 --- a/src/lib/core/tests/TestCATValues.cpp +++ b/src/lib/core/tests/TestCATValues.cpp @@ -16,9 +16,10 @@ * limitations under the License. */ -#include +#include #include +#include using namespace chip; diff --git a/src/lib/core/tests/TestCHIPCallback.cpp b/src/lib/core/tests/TestCHIPCallback.cpp index 88483dce445bc1..383aef254b140f 100644 --- a/src/lib/core/tests/TestCHIPCallback.cpp +++ b/src/lib/core/tests/TestCHIPCallback.cpp @@ -21,9 +21,11 @@ * This file implements a test for CHIP Callback * */ -#include + +#include #include +#include #include #include diff --git a/src/lib/core/tests/TestCHIPError.cpp b/src/lib/core/tests/TestCHIPError.cpp index ba0c25906623a8..f9dbbd9eb2a710 100644 --- a/src/lib/core/tests/TestCHIPError.cpp +++ b/src/lib/core/tests/TestCHIPError.cpp @@ -18,9 +18,9 @@ #include -#include +#include -#include +#include namespace chip { namespace { diff --git a/src/lib/core/tests/TestCHIPErrorStr.cpp b/src/lib/core/tests/TestCHIPErrorStr.cpp index 295dc895fc52fb..d466eb281fe0fb 100644 --- a/src/lib/core/tests/TestCHIPErrorStr.cpp +++ b/src/lib/core/tests/TestCHIPErrorStr.cpp @@ -28,10 +28,11 @@ #include #include -#include +#include #include #include +#include using namespace chip; diff --git a/src/lib/core/tests/TestGroupedCallbackList.cpp b/src/lib/core/tests/TestGroupedCallbackList.cpp index da09d162ce1d00..f2d85ec13bf168 100644 --- a/src/lib/core/tests/TestGroupedCallbackList.cpp +++ b/src/lib/core/tests/TestGroupedCallbackList.cpp @@ -16,9 +16,10 @@ * limitations under the License. */ -#include +#include #include +#include #include #include diff --git a/src/lib/core/tests/TestOTAImageHeader.cpp b/src/lib/core/tests/TestOTAImageHeader.cpp index 8413dbdce36f0e..bee9da3978bed0 100644 --- a/src/lib/core/tests/TestOTAImageHeader.cpp +++ b/src/lib/core/tests/TestOTAImageHeader.cpp @@ -16,9 +16,10 @@ * limitations under the License. */ -#include +#include -#include +#include +#include using namespace chip; diff --git a/src/lib/core/tests/TestOptional.cpp b/src/lib/core/tests/TestOptional.cpp index 9a0e95f1db8da2..e57657464369bd 100644 --- a/src/lib/core/tests/TestOptional.cpp +++ b/src/lib/core/tests/TestOptional.cpp @@ -28,11 +28,12 @@ #include #include +#include + #include +#include #include -#include - using namespace chip; struct Count diff --git a/src/lib/core/tests/TestReferenceCounted.cpp b/src/lib/core/tests/TestReferenceCounted.cpp index 4f3c3cd4182a3c..fc7d01e537bf61 100644 --- a/src/lib/core/tests/TestReferenceCounted.cpp +++ b/src/lib/core/tests/TestReferenceCounted.cpp @@ -27,9 +27,10 @@ #include #include -#include +#include -#include +#include +#include using namespace chip; diff --git a/src/lib/core/tests/TestTLV.cpp b/src/lib/core/tests/TestTLV.cpp index d7861291a56c73..a12411444385d0 100644 --- a/src/lib/core/tests/TestTLV.cpp +++ b/src/lib/core/tests/TestTLV.cpp @@ -23,21 +23,21 @@ * */ -#include #include +#include + #include +#include #include #include #include #include #include - #include #include #include #include - #include #include diff --git a/src/lib/core/tests/TestTLVVectorWriter.cpp b/src/lib/core/tests/TestTLVVectorWriter.cpp index d2b604fa7e876f..01c2a445a52de9 100644 --- a/src/lib/core/tests/TestTLVVectorWriter.cpp +++ b/src/lib/core/tests/TestTLVVectorWriter.cpp @@ -16,19 +16,19 @@ * limitations under the License. */ -#include - -#include - #include #include #include #include +#include + #include #include +#include #include #include +#include #include #include diff --git a/src/lib/dnssd/Advertiser.h b/src/lib/dnssd/Advertiser.h index 02888181f98181..88b86ef871b91d 100644 --- a/src/lib/dnssd/Advertiser.h +++ b/src/lib/dnssd/Advertiser.h @@ -55,6 +55,14 @@ enum class ICDModeAdvertise : uint8_t kLIT, // The ICD is currently operating as a LIT. ICD=1 in DNS-SD key/value pairs. }; +enum class TCPModeAdvertise : uint16_t +{ + kNone = 0, // The device does not support TCP. + kTCPClient = 1 << 1, // The device supports the TCP client. + kTCPServer = 1 << 2, // The device supports the TCP server. + kTCPClientServer = (kTCPClient | kTCPServer), // The device supports both the TCP client and server. +}; + template class BaseAdvertisingParams { @@ -102,13 +110,12 @@ class BaseAdvertisingParams } const std::optional & GetLocalMRPConfig() const { return mLocalMRPConfig; } - // NOTE: The SetTcpSupported API is deprecated and not compliant with 1.3. T flag should not be set. - Derived & SetTcpSupported(std::optional tcpSupported) + Derived & SetTCPSupportModes(TCPModeAdvertise tcpSupportModes) { - mTcpSupported = tcpSupported; + mTcpSupportModes = tcpSupportModes; return *reinterpret_cast(this); } - std::optional GetTcpSupported() const { return mTcpSupported; } + TCPModeAdvertise GetTCPSupportModes() const { return mTcpSupportModes; } Derived & SetICDModeToAdvertise(ICDModeAdvertise operatingMode) { @@ -124,7 +131,7 @@ class BaseAdvertisingParams uint8_t mMacStorage[kMaxMacSize] = {}; size_t mMacLength = 0; std::optional mLocalMRPConfig; - std::optional mTcpSupported; + TCPModeAdvertise mTcpSupportModes = TCPModeAdvertise::kNone; ICDModeAdvertise mICDModeAdvertise = ICDModeAdvertise::kNone; }; diff --git a/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp b/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp index 5ca002673cd4c9..ce46137c9a00e2 100644 --- a/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp +++ b/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp @@ -278,10 +278,10 @@ class AdvertiserMinMdns : public ServiceAdvertiser, } } - if (const auto & tcpSupported = params.GetTcpSupported(); tcpSupported.has_value()) + if (params.GetTCPSupportModes() != TCPModeAdvertise::kNone) { - size_t writtenCharactersNumber = - static_cast(snprintf(storage.tcpSupportedBuf, sizeof(storage.tcpSupportedBuf), "T=%d", *tcpSupported)); + size_t writtenCharactersNumber = static_cast(snprintf(storage.tcpSupportedBuf, sizeof(storage.tcpSupportedBuf), + "T=%d", static_cast(params.GetTCPSupportModes()))); VerifyOrReturnError((writtenCharactersNumber > 0) && (writtenCharactersNumber < sizeof(storage.tcpSupportedBuf)), CHIP_ERROR_INVALID_STRING_LENGTH); txtFields[numTxtFields++] = storage.tcpSupportedBuf; diff --git a/src/lib/dnssd/Discovery_ImplPlatform.cpp b/src/lib/dnssd/Discovery_ImplPlatform.cpp index beb733b1276a3f..e214aed4f80da6 100644 --- a/src/lib/dnssd/Discovery_ImplPlatform.cpp +++ b/src/lib/dnssd/Discovery_ImplPlatform.cpp @@ -240,7 +240,8 @@ CHIP_ERROR CopyTxtRecord(TxtFieldKey key, char * buffer, size_t bufferLen, const switch (key) { case TxtFieldKey::kTcpSupported: - return CopyTextRecordValue(buffer, bufferLen, params.GetTcpSupported()); + VerifyOrReturnError(params.GetTCPSupportModes() != TCPModeAdvertise::kNone, CHIP_ERROR_UNINITIALIZED); + return CopyTextRecordValue(buffer, bufferLen, to_underlying(params.GetTCPSupportModes())); case TxtFieldKey::kSessionIdleInterval: #if CHIP_CONFIG_ENABLE_ICD_SERVER // A ICD operating as a LIT should not advertise its slow polling interval diff --git a/src/lib/dnssd/TxtFields.cpp b/src/lib/dnssd/TxtFields.cpp index 6ac2cfa19e8ece..20ca450b8734b5 100644 --- a/src/lib/dnssd/TxtFields.cpp +++ b/src/lib/dnssd/TxtFields.cpp @@ -38,6 +38,9 @@ namespace Dnssd { namespace Internal { +constexpr uint8_t kTCPClient = 1; +constexpr uint8_t kTCPServer = 2; + namespace { char SafeToLower(uint8_t ch) @@ -276,9 +279,13 @@ void FillNodeDataFromTxt(const ByteSpan & key, const ByteSpan & value, CommonRes case TxtFieldKey::kSessionActiveThreshold: nodeData.mrpRetryActiveThreshold = Internal::GetRetryActiveThreshold(value); break; - case TxtFieldKey::kTcpSupported: - nodeData.supportsTcp = Internal::MakeBoolFromAsciiDecimal(value); + case TxtFieldKey::kTcpSupported: { + // bit 0 is reserved and deprecated + uint8_t support = Internal::MakeU8FromAsciiDecimal(value); + nodeData.supportsTcpClient = (support & (1 << Internal::kTCPClient)) != 0; + nodeData.supportsTcpServer = (support & (1 << Internal::kTCPServer)) != 0; break; + } case TxtFieldKey::kLongIdleTimeICD: nodeData.isICDOperatingAsLIT = Internal::MakeOptionalBoolFromAsciiDecimal(value); break; diff --git a/src/lib/dnssd/Types.h b/src/lib/dnssd/Types.h index 1b9b19c0ad1bcc..60a265e46e425e 100644 --- a/src/lib/dnssd/Types.h +++ b/src/lib/dnssd/Types.h @@ -90,7 +90,8 @@ struct CommonResolutionData uint16_t port = 0; char hostName[kHostNameMaxLength + 1] = {}; - bool supportsTcp = false; + bool supportsTcpClient = false; + bool supportsTcpServer = false; std::optional isICDOperatingAsLIT; std::optional mrpRetryIntervalIdle; std::optional mrpRetryIntervalActive; @@ -131,7 +132,8 @@ struct CommonResolutionData isICDOperatingAsLIT = std::nullopt; numIPs = 0; port = 0; - supportsTcp = false; + supportsTcpClient = false; + supportsTcpServer = false; interfaceId = Inet::InterfaceId::Null(); for (auto & addr : ipAddress) { @@ -181,7 +183,8 @@ struct CommonResolutionData { ChipLogDetail(Discovery, "\tMrp Active Threshold: not present"); } - ChipLogDetail(Discovery, "\tTCP Supported: %d", supportsTcp); + ChipLogDetail(Discovery, "\tTCP Client Supported: %d", supportsTcpClient); + ChipLogDetail(Discovery, "\tTCP Server Supported: %d", supportsTcpServer); if (isICDOperatingAsLIT.has_value()) { ChipLogDetail(Discovery, "\tThe ICD operates in %s", *isICDOperatingAsLIT ? "LIT" : "SIT"); diff --git a/src/lib/dnssd/minimal_mdns/core/tests/BUILD.gn b/src/lib/dnssd/minimal_mdns/core/tests/BUILD.gn index 39b59bb999c9ad..9a84057e18cd66 100644 --- a/src/lib/dnssd/minimal_mdns/core/tests/BUILD.gn +++ b/src/lib/dnssd/minimal_mdns/core/tests/BUILD.gn @@ -41,6 +41,7 @@ chip_test_suite("tests") { public_deps = [ ":support", "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/dnssd/minimal_mdns/core", ] } diff --git a/src/lib/dnssd/minimal_mdns/core/tests/TestFlatAllocatedQName.cpp b/src/lib/dnssd/minimal_mdns/core/tests/TestFlatAllocatedQName.cpp index c9ab4f222ef6f0..5ae56f46a8e2a6 100644 --- a/src/lib/dnssd/minimal_mdns/core/tests/TestFlatAllocatedQName.cpp +++ b/src/lib/dnssd/minimal_mdns/core/tests/TestFlatAllocatedQName.cpp @@ -14,8 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include +#include + +#include #include namespace { diff --git a/src/lib/dnssd/minimal_mdns/core/tests/TestHeapQName.cpp b/src/lib/dnssd/minimal_mdns/core/tests/TestHeapQName.cpp index 22287751ac5f05..7857ce4335b1bd 100644 --- a/src/lib/dnssd/minimal_mdns/core/tests/TestHeapQName.cpp +++ b/src/lib/dnssd/minimal_mdns/core/tests/TestHeapQName.cpp @@ -16,8 +16,9 @@ * limitations under the License. */ -#include +#include +#include #include #include diff --git a/src/lib/dnssd/minimal_mdns/core/tests/TestQName.cpp b/src/lib/dnssd/minimal_mdns/core/tests/TestQName.cpp index 46c0b517162133..26bed1aea129b4 100644 --- a/src/lib/dnssd/minimal_mdns/core/tests/TestQName.cpp +++ b/src/lib/dnssd/minimal_mdns/core/tests/TestQName.cpp @@ -16,8 +16,9 @@ * limitations under the License. */ -#include +#include +#include #include namespace { diff --git a/src/lib/dnssd/minimal_mdns/core/tests/TestRecordWriter.cpp b/src/lib/dnssd/minimal_mdns/core/tests/TestRecordWriter.cpp index f8dbc220978c87..6f0885932bcb1b 100644 --- a/src/lib/dnssd/minimal_mdns/core/tests/TestRecordWriter.cpp +++ b/src/lib/dnssd/minimal_mdns/core/tests/TestRecordWriter.cpp @@ -16,8 +16,9 @@ * limitations under the License. */ -#include +#include +#include #include namespace { diff --git a/src/lib/dnssd/minimal_mdns/records/tests/BUILD.gn b/src/lib/dnssd/minimal_mdns/records/tests/BUILD.gn index 90a73141ff61d0..243da1423a08a2 100644 --- a/src/lib/dnssd/minimal_mdns/records/tests/BUILD.gn +++ b/src/lib/dnssd/minimal_mdns/records/tests/BUILD.gn @@ -32,6 +32,7 @@ chip_test_suite("tests") { public_deps = [ "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/dnssd/minimal_mdns/records", ] } diff --git a/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecord.cpp b/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecord.cpp index 3139635c54a56b..c828d23b2f934b 100644 --- a/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecord.cpp +++ b/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecord.cpp @@ -16,8 +16,9 @@ * limitations under the License. */ -#include +#include +#include #include namespace { diff --git a/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecordIP.cpp b/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecordIP.cpp index c79507d2f454e6..bff8a50d9da1d5 100644 --- a/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecordIP.cpp +++ b/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecordIP.cpp @@ -16,8 +16,9 @@ * limitations under the License. */ -#include +#include +#include #include namespace { diff --git a/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecordPtr.cpp b/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecordPtr.cpp index 52cab32b727fd0..adbfd6aba1359b 100644 --- a/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecordPtr.cpp +++ b/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecordPtr.cpp @@ -15,8 +15,9 @@ * limitations under the License. */ -#include +#include +#include #include namespace { diff --git a/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecordSrv.cpp b/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecordSrv.cpp index b213f11efd32cc..8bab8b856edac9 100644 --- a/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecordSrv.cpp +++ b/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecordSrv.cpp @@ -15,8 +15,9 @@ * limitations under the License. */ -#include +#include +#include #include namespace { diff --git a/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecordTxt.cpp b/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecordTxt.cpp index f77066b8361fdc..f97ba2dc0a0329 100644 --- a/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecordTxt.cpp +++ b/src/lib/dnssd/minimal_mdns/records/tests/TestResourceRecordTxt.cpp @@ -15,8 +15,9 @@ * limitations under the License. */ -#include +#include +#include #include namespace { diff --git a/src/lib/dnssd/minimal_mdns/responders/tests/BUILD.gn b/src/lib/dnssd/minimal_mdns/responders/tests/BUILD.gn index 940cc82698e14a..3c8437c068cc84 100644 --- a/src/lib/dnssd/minimal_mdns/responders/tests/BUILD.gn +++ b/src/lib/dnssd/minimal_mdns/responders/tests/BUILD.gn @@ -30,6 +30,7 @@ chip_test_suite("tests") { public_deps = [ "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/dnssd/minimal_mdns", "${chip_root}/src/lib/dnssd/minimal_mdns:default_policy", "${chip_root}/src/lib/dnssd/minimal_mdns/responders", diff --git a/src/lib/dnssd/minimal_mdns/responders/tests/TestIPResponder.cpp b/src/lib/dnssd/minimal_mdns/responders/tests/TestIPResponder.cpp index b24f2bedd4a1a8..691a458c9343d6 100644 --- a/src/lib/dnssd/minimal_mdns/responders/tests/TestIPResponder.cpp +++ b/src/lib/dnssd/minimal_mdns/responders/tests/TestIPResponder.cpp @@ -18,11 +18,12 @@ #include +#include + +#include #include #include -#include - namespace { using namespace chip; diff --git a/src/lib/dnssd/minimal_mdns/responders/tests/TestPtrResponder.cpp b/src/lib/dnssd/minimal_mdns/responders/tests/TestPtrResponder.cpp index f1c2ba6f9e25c2..b10e19a0ad0407 100644 --- a/src/lib/dnssd/minimal_mdns/responders/tests/TestPtrResponder.cpp +++ b/src/lib/dnssd/minimal_mdns/responders/tests/TestPtrResponder.cpp @@ -18,11 +18,12 @@ #include +#include + +#include #include #include -#include - namespace { using namespace chip; diff --git a/src/lib/dnssd/minimal_mdns/responders/tests/TestQueryResponder.cpp b/src/lib/dnssd/minimal_mdns/responders/tests/TestQueryResponder.cpp index bf0ff0413e38f6..80d0029ffa78d4 100644 --- a/src/lib/dnssd/minimal_mdns/responders/tests/TestQueryResponder.cpp +++ b/src/lib/dnssd/minimal_mdns/responders/tests/TestQueryResponder.cpp @@ -18,9 +18,10 @@ #include -#include +#include -#include +#include +#include namespace { diff --git a/src/lib/dnssd/minimal_mdns/tests/BUILD.gn b/src/lib/dnssd/minimal_mdns/tests/BUILD.gn index 17f9868609748c..47e83650d41acc 100644 --- a/src/lib/dnssd/minimal_mdns/tests/BUILD.gn +++ b/src/lib/dnssd/minimal_mdns/tests/BUILD.gn @@ -37,6 +37,7 @@ chip_test_suite("tests") { public_deps = [ "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/dnssd", "${chip_root}/src/lib/dnssd/minimal_mdns", "${chip_root}/src/transport/raw/tests:helpers", diff --git a/src/lib/dnssd/minimal_mdns/tests/CheckOnlyServer.h b/src/lib/dnssd/minimal_mdns/tests/CheckOnlyServer.h index 1aabc6738d00e6..fe85abdbf53179 100644 --- a/src/lib/dnssd/minimal_mdns/tests/CheckOnlyServer.h +++ b/src/lib/dnssd/minimal_mdns/tests/CheckOnlyServer.h @@ -22,6 +22,9 @@ #include #include +#include + +#include #include #include #include @@ -31,8 +34,6 @@ #include #include -#include - namespace mdns { namespace Minimal { namespace test { diff --git a/src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp b/src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp index c868939573f1c7..ea85f74d2be11a 100644 --- a/src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp +++ b/src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp @@ -20,6 +20,9 @@ #include #include +#include + +#include #include #include #include @@ -33,8 +36,6 @@ #include #include -#include - namespace { using namespace std; @@ -80,7 +81,8 @@ OperationalAdvertisingParameters operationalParams1 = .SetPort(CHIP_PORT) .EnableIpV4(true) .SetLocalMRPConfig(std::make_optional( - 32_ms32, 30_ms32)); // Match SII, SAI. SAT not provided so it uses default 4000ms + 32_ms32, 30_ms32)) // Match SII, SAI. SAT not provided so it uses default 4000ms + .SetTCPSupportModes(chip::Dnssd::TCPModeAdvertise::kTCPClientServer); OperationalAdvertisingParameters operationalParams2 = OperationalAdvertisingParameters().SetPeerId(kPeerId2).SetMac(ByteSpan(kMac)).SetPort(CHIP_PORT).EnableIpV4(true); OperationalAdvertisingParameters operationalParams3 = @@ -91,7 +93,7 @@ OperationalAdvertisingParameters operationalParams5 = OperationalAdvertisingParameters().SetPeerId(kPeerId5).SetMac(ByteSpan(kMac)).SetPort(CHIP_PORT).EnableIpV4(true); OperationalAdvertisingParameters operationalParams6 = OperationalAdvertisingParameters().SetPeerId(kPeerId6).SetMac(ByteSpan(kMac)).SetPort(CHIP_PORT).EnableIpV4(true); -const QNamePart txtOperational1Parts[] = { "SII=32", "SAI=30", "SAT=4000" }; +const QNamePart txtOperational1Parts[] = { "SII=32", "SAI=30", "SAT=4000", "T=6" }; PtrResourceRecord ptrOperationalService = PtrResourceRecord(kDnsSdQueryName, kMatterOperationalQueryName); PtrResourceRecord ptrOperational1 = PtrResourceRecord(kMatterOperationalQueryName, kInstanceName1); SrvResourceRecord srvOperational1 = SrvResourceRecord(kInstanceName1, kHostnameName, CHIP_PORT); diff --git a/src/lib/dnssd/minimal_mdns/tests/TestMinimalMdnsAllocator.cpp b/src/lib/dnssd/minimal_mdns/tests/TestMinimalMdnsAllocator.cpp index f571e81fcf27d1..41577dc4797f1a 100644 --- a/src/lib/dnssd/minimal_mdns/tests/TestMinimalMdnsAllocator.cpp +++ b/src/lib/dnssd/minimal_mdns/tests/TestMinimalMdnsAllocator.cpp @@ -16,8 +16,9 @@ * limitations under the License. */ -#include +#include +#include #include using namespace chip; diff --git a/src/lib/dnssd/minimal_mdns/tests/TestQueryReplyFilter.cpp b/src/lib/dnssd/minimal_mdns/tests/TestQueryReplyFilter.cpp index 234b6876c6b7fe..769bcfaa8f8eae 100644 --- a/src/lib/dnssd/minimal_mdns/tests/TestQueryReplyFilter.cpp +++ b/src/lib/dnssd/minimal_mdns/tests/TestQueryReplyFilter.cpp @@ -14,8 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include +#include + +#include #include namespace { diff --git a/src/lib/dnssd/minimal_mdns/tests/TestRecordData.cpp b/src/lib/dnssd/minimal_mdns/tests/TestRecordData.cpp index 295ed2296215bf..dcd48959be01ea 100644 --- a/src/lib/dnssd/minimal_mdns/tests/TestRecordData.cpp +++ b/src/lib/dnssd/minimal_mdns/tests/TestRecordData.cpp @@ -14,12 +14,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include #include #include -#include +#include + +#include namespace { diff --git a/src/lib/dnssd/minimal_mdns/tests/TestResponseSender.cpp b/src/lib/dnssd/minimal_mdns/tests/TestResponseSender.cpp index e248a647bf2f6d..abfceb52080f13 100644 --- a/src/lib/dnssd/minimal_mdns/tests/TestResponseSender.cpp +++ b/src/lib/dnssd/minimal_mdns/tests/TestResponseSender.cpp @@ -14,13 +14,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include #include #include -#include +#include +#include #include #include #include @@ -28,7 +30,6 @@ #include #include #include - #include namespace { diff --git a/src/lib/dnssd/platform/tests/BUILD.gn b/src/lib/dnssd/platform/tests/BUILD.gn index 966923eebae998..b28ba928c6e827 100644 --- a/src/lib/dnssd/platform/tests/BUILD.gn +++ b/src/lib/dnssd/platform/tests/BUILD.gn @@ -22,6 +22,9 @@ chip_test_suite("tests") { if (chip_device_platform == "fake") { test_sources = [ "TestPlatform.cpp" ] - public_deps = [ "${chip_root}/src/lib/dnssd" ] + public_deps = [ + "${chip_root}/src/lib/core:string-builder-adapters", + "${chip_root}/src/lib/dnssd", + ] } } diff --git a/src/lib/dnssd/platform/tests/TestPlatform.cpp b/src/lib/dnssd/platform/tests/TestPlatform.cpp index 324863a948902d..5494bbcc3d402c 100644 --- a/src/lib/dnssd/platform/tests/TestPlatform.cpp +++ b/src/lib/dnssd/platform/tests/TestPlatform.cpp @@ -16,15 +16,15 @@ * limitations under the License. */ +#include + #include +#include #include - #include #include #include -#include - #if CHIP_DEVICE_LAYER_TARGET_FAKE != 1 #error "This test is designed for use only with the fake platform" #endif diff --git a/src/lib/dnssd/tests/BUILD.gn b/src/lib/dnssd/tests/BUILD.gn index cdcb4bab0e27a1..e8ab101ae8e09f 100644 --- a/src/lib/dnssd/tests/BUILD.gn +++ b/src/lib/dnssd/tests/BUILD.gn @@ -25,7 +25,10 @@ chip_test_suite("tests") { "TestTxtFields.cpp", ] - public_deps = [ "${chip_root}/src/lib/dnssd" ] + public_deps = [ + "${chip_root}/src/lib/core:string-builder-adapters", + "${chip_root}/src/lib/dnssd", + ] if (chip_mdns == "minimal") { test_sources += [ diff --git a/src/lib/dnssd/tests/TestActiveResolveAttempts.cpp b/src/lib/dnssd/tests/TestActiveResolveAttempts.cpp index 6d778808f3e669..308cede6957103 100644 --- a/src/lib/dnssd/tests/TestActiveResolveAttempts.cpp +++ b/src/lib/dnssd/tests/TestActiveResolveAttempts.cpp @@ -14,9 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include -#include +#include + +#include +#include namespace { diff --git a/src/lib/dnssd/tests/TestIncrementalResolve.cpp b/src/lib/dnssd/tests/TestIncrementalResolve.cpp index 053d0dd96856ee..930b837fbbfbbb 100644 --- a/src/lib/dnssd/tests/TestIncrementalResolve.cpp +++ b/src/lib/dnssd/tests/TestIncrementalResolve.cpp @@ -20,6 +20,9 @@ #include +#include + +#include #include #include #include @@ -29,8 +32,6 @@ #include #include -#include - using namespace chip; using namespace chip::Dnssd; using namespace mdns::Minimal; @@ -308,7 +309,8 @@ TEST(TestIncrementalResolve, TestParseOperational) EXPECT_FALSE(nodeData.operationalData.hasZeroTTL); EXPECT_EQ(nodeData.resolutionData.numIPs, 1u); EXPECT_EQ(nodeData.resolutionData.port, 0x1234); - EXPECT_FALSE(nodeData.resolutionData.supportsTcp); + EXPECT_FALSE(nodeData.resolutionData.supportsTcpServer); + EXPECT_FALSE(nodeData.resolutionData.supportsTcpClient); EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalActive().has_value()); EXPECT_EQ(nodeData.resolutionData.GetMrpRetryIntervalIdle(), std::make_optional(chip::System::Clock::Milliseconds32(23))); @@ -396,7 +398,8 @@ TEST(TestIncrementalResolve, TestParseCommissionable) // validate data as it was passed in EXPECT_EQ(nodeData.numIPs, 2u); EXPECT_EQ(nodeData.port, 0x1234); - EXPECT_FALSE(nodeData.supportsTcp); + EXPECT_FALSE(nodeData.supportsTcpClient); + EXPECT_FALSE(nodeData.supportsTcpServer); EXPECT_EQ(nodeData.GetMrpRetryIntervalActive(), std::make_optional(chip::System::Clock::Milliseconds32(321))); EXPECT_FALSE(nodeData.GetMrpRetryIntervalIdle().has_value()); diff --git a/src/lib/dnssd/tests/TestServiceNaming.cpp b/src/lib/dnssd/tests/TestServiceNaming.cpp index 0fa26723dab779..485595ab7d8410 100644 --- a/src/lib/dnssd/tests/TestServiceNaming.cpp +++ b/src/lib/dnssd/tests/TestServiceNaming.cpp @@ -20,7 +20,9 @@ #include -#include +#include + +#include using namespace chip; using namespace chip::Dnssd; diff --git a/src/lib/dnssd/tests/TestTxtFields.cpp b/src/lib/dnssd/tests/TestTxtFields.cpp index b80f1c0682ef32..3de62f235be98b 100644 --- a/src/lib/dnssd/tests/TestTxtFields.cpp +++ b/src/lib/dnssd/tests/TestTxtFields.cpp @@ -22,9 +22,10 @@ #include #include -#include +#include -#include +#include +#include using namespace chip; using namespace chip::Dnssd; @@ -306,7 +307,8 @@ bool NodeDataIsEmpty(const CommissionNodeData & node) if (node.longDiscriminator != 0 || node.vendorId != 0 || node.productId != 0 || node.commissioningMode != 0 || node.deviceType != 0 || node.rotatingIdLen != 0 || node.pairingHint != 0 || node.mrpRetryIntervalIdle.has_value() || node.mrpRetryIntervalActive.has_value() || node.mrpRetryActiveThreshold.has_value() || - node.isICDOperatingAsLIT.has_value() || node.supportsTcp || node.supportsCommissionerGeneratedPasscode != 0) + node.isICDOperatingAsLIT.has_value() || node.supportsTcpServer || node.supportsTcpClient || + node.supportsCommissionerGeneratedPasscode != 0) { return false; } @@ -412,8 +414,8 @@ bool NodeDataIsEmpty(const ResolvedNodeData & nodeData) { return nodeData.operationalData.peerId == PeerId{} && nodeData.resolutionData.numIPs == 0 && nodeData.resolutionData.port == 0 && !nodeData.resolutionData.mrpRetryIntervalIdle.has_value() && - !nodeData.resolutionData.mrpRetryIntervalActive.has_value() && !nodeData.resolutionData.supportsTcp && - !nodeData.resolutionData.isICDOperatingAsLIT.has_value(); + !nodeData.resolutionData.mrpRetryIntervalActive.has_value() && !nodeData.resolutionData.supportsTcpClient && + !nodeData.resolutionData.supportsTcpServer && !nodeData.resolutionData.isICDOperatingAsLIT.has_value(); } void ResetRetryIntervalIdle(DiscoveredNodeData & nodeData) @@ -644,27 +646,80 @@ void DiscoveredTxtFieldTcpSupport() nodeData.Set(); CommonResolutionData & resolutionData = nodeData.Get(); - // True + // Neither TCP Client nor TCP Server are enabled + strcpy(key, "T"); + strcpy(val, "0"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_FALSE(nodeData.Get().supportsTcpServer); + EXPECT_FALSE(nodeData.Get().supportsTcpClient); + + // Neither TCP Client nor TCP Server are enabled - ignoring first bit strcpy(key, "T"); strcpy(val, "1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(nodeData.Get().supportsTcp); + EXPECT_FALSE(nodeData.Get().supportsTcpServer); + EXPECT_FALSE(nodeData.Get().supportsTcpClient); - // Test no other fields were populated - nodeData.Get().supportsTcp = false; - EXPECT_TRUE(NodeDataIsEmpty(nodeData.Get())); + // Supporting TCP Client only + strcpy(key, "T"); + strcpy(val, "2"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().supportsTcpClient); + EXPECT_FALSE(nodeData.Get().supportsTcpServer); - // False + // Supporting TCP Client only - ignoring first bit strcpy(key, "T"); - strcpy(val, "0"); + strcpy(val, "3"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().supportsTcpClient); + EXPECT_FALSE(nodeData.Get().supportsTcpServer); + + // Supporting TCP Server only + strcpy(key, "T"); + strcpy(val, "4"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(nodeData.Get().supportsTcp == false); + EXPECT_FALSE(nodeData.Get().supportsTcpClient); + EXPECT_TRUE(nodeData.Get().supportsTcpServer); - // Invalid value, stil false + // Supporting TCP Server only - ignoring first bit + strcpy(key, "T"); + strcpy(val, "5"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_FALSE(nodeData.Get().supportsTcpClient); + EXPECT_TRUE(nodeData.Get().supportsTcpServer); + + // Supporting TCP Server and Client + strcpy(key, "T"); + strcpy(val, "6"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().supportsTcpClient); + EXPECT_TRUE(nodeData.Get().supportsTcpServer); + + // Supporting TCP Server and Client - ignoring first bit + strcpy(key, "T"); + strcpy(val, "7"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().supportsTcpClient); + EXPECT_TRUE(nodeData.Get().supportsTcpServer); + + // Invalid value, means neither TCP Client or Server are enabled + strcpy(key, "T"); + strcpy(val, "8"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_FALSE(nodeData.Get().supportsTcpClient); + EXPECT_FALSE(nodeData.Get().supportsTcpServer); + + // Invalid value, means neither TCP Client or Server are enabled strcpy(key, "T"); strcpy(val, "asdf"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(nodeData.Get().supportsTcp == false); + EXPECT_FALSE(nodeData.Get().supportsTcpClient); + EXPECT_FALSE(nodeData.Get().supportsTcpServer); + + // Test no other fields were populated + nodeData.Get().supportsTcpClient = false; + nodeData.Get().supportsTcpServer = false; + EXPECT_TRUE(NodeDataIsEmpty(nodeData.Get())); } // Test ICD (ICD operation Mode) @@ -979,27 +1034,80 @@ void TxtFieldTcpSupport() char val[8]; NodeData nodeData; - // True + // Neither TCP Client nor TCP Server are enabled + strcpy(key, "T"); + strcpy(val, "0"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); + EXPECT_FALSE(nodeData.resolutionData.supportsTcpServer); + EXPECT_FALSE(nodeData.resolutionData.supportsTcpClient); + + // Neither TCP Client nor TCP Server are enabled - ignoring first bit strcpy(key, "T"); strcpy(val, "1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_TRUE(nodeData.resolutionData.supportsTcp); + EXPECT_FALSE(nodeData.resolutionData.supportsTcpServer); + EXPECT_FALSE(nodeData.resolutionData.supportsTcpClient); - // Test no other fields were populated - nodeData.resolutionData.supportsTcp = false; - EXPECT_TRUE(NodeDataIsEmpty(nodeData)); + // Supporting TCP Client only + strcpy(key, "T"); + strcpy(val, "2"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); + EXPECT_FALSE(nodeData.resolutionData.supportsTcpServer); + EXPECT_TRUE(nodeData.resolutionData.supportsTcpClient); - // False + // Supporting TCP Client only - ignoring first bit strcpy(key, "T"); - strcpy(val, "0"); + strcpy(val, "3"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); + EXPECT_FALSE(nodeData.resolutionData.supportsTcpServer); + EXPECT_TRUE(nodeData.resolutionData.supportsTcpClient); + + // Supporting TCP Server only + strcpy(key, "T"); + strcpy(val, "4"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); + EXPECT_TRUE(nodeData.resolutionData.supportsTcpServer); + EXPECT_FALSE(nodeData.resolutionData.supportsTcpClient); + + // Supporting TCP Server only - ignoring first bit + strcpy(key, "T"); + strcpy(val, "5"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); + EXPECT_TRUE(nodeData.resolutionData.supportsTcpServer); + EXPECT_FALSE(nodeData.resolutionData.supportsTcpClient); + + // Supporting TCP Server and Client + strcpy(key, "T"); + strcpy(val, "6"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); + EXPECT_TRUE(nodeData.resolutionData.supportsTcpServer); + EXPECT_TRUE(nodeData.resolutionData.supportsTcpClient); + + // Supporting TCP Server and Client - ignoring first bit + strcpy(key, "T"); + strcpy(val, "7"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); + EXPECT_TRUE(nodeData.resolutionData.supportsTcpServer); + EXPECT_TRUE(nodeData.resolutionData.supportsTcpClient); + + // Invalid value, means neither TCP Client or Server are enabled + strcpy(key, "T"); + strcpy(val, "8"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_EQ(nodeData.resolutionData.supportsTcp, false); + EXPECT_FALSE(nodeData.resolutionData.supportsTcpClient); + EXPECT_FALSE(nodeData.resolutionData.supportsTcpServer); - // Invalid value, stil false + // Invalid value, means neither TCP Client or Server are enabled strcpy(key, "T"); strcpy(val, "asdf"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_EQ(nodeData.resolutionData.supportsTcp, false); + EXPECT_FALSE(nodeData.resolutionData.supportsTcpClient); + EXPECT_FALSE(nodeData.resolutionData.supportsTcpServer); + + // Test no other fields were populated + nodeData.resolutionData.supportsTcpServer = false; + nodeData.resolutionData.supportsTcpClient = false; + EXPECT_TRUE(NodeDataIsEmpty(nodeData)); } TEST(TestTxtFields, TxtDiscoveredFieldTcpSupport) diff --git a/src/lib/format/tests/BUILD.gn b/src/lib/format/tests/BUILD.gn index 1001a3bd9e77d4..840a2eede60c78 100644 --- a/src/lib/format/tests/BUILD.gn +++ b/src/lib/format/tests/BUILD.gn @@ -36,6 +36,7 @@ chip_test_suite("tests") { public_deps = [ "${chip_root}/src/controller/data_model:cluster-tlv-metadata", "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/format:flat-tree", "${chip_root}/src/lib/format:protocol-decoder", "${chip_root}/src/lib/format:protocol-tlv-metadata", diff --git a/src/lib/format/tests/TestDecoding.cpp b/src/lib/format/tests/TestDecoding.cpp index ae5c2efc553fb6..2fc7cf8f59fd6c 100644 --- a/src/lib/format/tests/TestDecoding.cpp +++ b/src/lib/format/tests/TestDecoding.cpp @@ -14,15 +14,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include + +#include #include #include #include - #include #include -#include - #include "sample_data.h" namespace { diff --git a/src/lib/format/tests/TestFlatTree.cpp b/src/lib/format/tests/TestFlatTree.cpp index fcf8e2713bf6b5..05f401b7d8232d 100644 --- a/src/lib/format/tests/TestFlatTree.cpp +++ b/src/lib/format/tests/TestFlatTree.cpp @@ -14,15 +14,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include - -#include #include - #include -#include +#include + +#include +#include +#include namespace { diff --git a/src/lib/format/tests/TestFlatTreePosition.cpp b/src/lib/format/tests/TestFlatTreePosition.cpp index cf5a26e6c8662f..b578f68583cbd2 100644 --- a/src/lib/format/tests/TestFlatTreePosition.cpp +++ b/src/lib/format/tests/TestFlatTreePosition.cpp @@ -14,17 +14,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include -#include - -#include #include #include #include -#include +#include + +#include +#include +#include +#include namespace { diff --git a/src/lib/shell/MainLoopDefault.cpp b/src/lib/shell/MainLoopDefault.cpp index c83fc96e4a1413..dba76397927f2c 100644 --- a/src/lib/shell/MainLoopDefault.cpp +++ b/src/lib/shell/MainLoopDefault.cpp @@ -168,13 +168,7 @@ void ProcessShellLine(intptr_t args) if (retval != CHIP_NO_ERROR) { - char errorStr[160]; - bool errorStrFound = FormatCHIPError(errorStr, sizeof(errorStr), retval); - if (!errorStrFound) - { - errorStr[0] = 0; - } - streamer_printf(streamer_get(), "Error %s: %s\r\n", argv[0], errorStr); + streamer_printf(streamer_get(), "Error %s: %" CHIP_ERROR_FORMAT "\r\n", argv[0], retval.Format()); } else { diff --git a/src/lib/shell/MainLoopZephyr.cpp b/src/lib/shell/MainLoopZephyr.cpp index 84fca4ef9d29af..108ed2e4385ad7 100644 --- a/src/lib/shell/MainLoopZephyr.cpp +++ b/src/lib/shell/MainLoopZephyr.cpp @@ -91,7 +91,7 @@ int ExecCommandInShellThread(const struct shell * shell, size_t argc, char ** ar return error == CHIP_NO_ERROR ? 0 : -ENOEXEC; } -int RegisterCommands() +int RegisterMatterCommands() { Shell::Engine::Root().RegisterDefaultCommands(); return 0; @@ -99,7 +99,7 @@ int RegisterCommands() } // namespace -SYS_INIT(RegisterCommands, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +SYS_INIT(RegisterMatterCommands, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); SHELL_CMD_ARG_REGISTER(matter, NULL, "Matter commands", ExecCommandInShellThread, 1, CHIP_SHELL_MAX_TOKENS); namespace chip { diff --git a/src/lib/shell/commands/Config.cpp b/src/lib/shell/commands/Config.cpp index e1452f9b35ba67..cf5ac39e07983f 100644 --- a/src/lib/shell/commands/Config.cpp +++ b/src/lib/shell/commands/Config.cpp @@ -142,7 +142,7 @@ static CHIP_ERROR ConfigSetSetupDiscriminator(char * argv) } else { - streamer_printf(sout, "Setup discriminator setting failed with code: %d\r\n", error); + streamer_printf(sout, "Setup discriminator setting failed with code: %d\r\n", error.AsInteger()); } return error; diff --git a/src/lib/shell/commands/Dns.cpp b/src/lib/shell/commands/Dns.cpp index 50be591ddfeaee..18e0841dccce83 100644 --- a/src/lib/shell/commands/Dns.cpp +++ b/src/lib/shell/commands/Dns.cpp @@ -51,7 +51,8 @@ class DnsShellResolverDelegate : public Dnssd::DiscoverNodeDelegate, public Addr result.address.ToString(addr_string); streamer_printf(streamer_get(), "Resolve completed: %s\r\n", addr_string); - streamer_printf(streamer_get(), " Supports TCP: %s\r\n", result.supportsTcp ? "YES" : "NO"); + streamer_printf(streamer_get(), " Supports TCP Client: %s\r\n", result.supportsTcpClient ? "YES" : "NO"); + streamer_printf(streamer_get(), " Supports TCP Server: %s\r\n", result.supportsTcpServer ? "YES" : "NO"); streamer_printf(streamer_get(), " MRP IDLE retransmit timeout: %u ms\r\n", result.mrpRemoteConfig.mIdleRetransTimeout.count()); streamer_printf(streamer_get(), " MRP ACTIVE retransmit timeout: %u ms\r\n", @@ -121,20 +122,22 @@ class DnsShellResolverDelegate : public Dnssd::DiscoverNodeDelegate, public Addr auto retryInterval = nodeData.GetMrpRetryIntervalIdle(); if (retryInterval.has_value()) - streamer_printf(streamer_get(), " MRP retry interval (idle): %" PRIu32 "ms\r\n", *retryInterval); + streamer_printf(streamer_get(), " MRP retry interval (idle): %" PRIu32 "ms\r\n", retryInterval->count()); retryInterval = nodeData.GetMrpRetryIntervalActive(); if (retryInterval.has_value()) - streamer_printf(streamer_get(), " MRP retry interval (active): %" PRIu32 "ms\r\n", *retryInterval); + streamer_printf(streamer_get(), " MRP retry interval (active): %" PRIu32 "ms\r\n", retryInterval->count()); auto activeThreshold = nodeData.GetMrpRetryActiveThreshold(); if (activeThreshold.has_value()) { - streamer_printf(streamer_get(), " MRP retry active threshold time: %" PRIu32 "ms\r\n", *activeThreshold); + streamer_printf(streamer_get(), " MRP retry active threshold time: %" PRIu32 "ms\r\n", activeThreshold->count()); } - streamer_printf(streamer_get(), " Supports TCP: %s\r\n", nodeData.supportsTcp ? "yes" : "no"); + + streamer_printf(streamer_get(), " Supports TCP Client: %s\r\n", nodeData.supportsTcpClient ? "yes" : "no"); + streamer_printf(streamer_get(), " Supports TCP Server: %s\r\n", nodeData.supportsTcpServer ? "yes" : "no"); if (nodeData.isICDOperatingAsLIT.has_value()) { diff --git a/src/lib/shell/commands/OnboardingCodes.cpp b/src/lib/shell/commands/OnboardingCodes.cpp index 1e17812d183a3f..a08a63be68770f 100644 --- a/src/lib/shell/commands/OnboardingCodes.cpp +++ b/src/lib/shell/commands/OnboardingCodes.cpp @@ -128,6 +128,13 @@ static CHIP_ERROR RendezvousStringToFlag(char * str, chip::RendezvousInformation *aRendezvousFlags = chip::RendezvousInformationFlag::kOnNetwork; return CHIP_NO_ERROR; } +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + if (strcmp(str, "wifipaf") == 0) + { + *aRendezvousFlags = chip::RendezvousInformationFlag::kWiFiPAF; + return CHIP_NO_ERROR; + } +#endif return CHIP_ERROR_INVALID_ARGUMENT; } diff --git a/src/lib/shell/tests/BUILD.gn b/src/lib/shell/tests/BUILD.gn index 0b5f7d5fd43222..9b71114424d8de 100644 --- a/src/lib/shell/tests/BUILD.gn +++ b/src/lib/shell/tests/BUILD.gn @@ -29,6 +29,7 @@ chip_test_suite("tests") { public_deps = [ "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/shell", ] } diff --git a/src/lib/shell/tests/TestShellStreamerStdio.cpp b/src/lib/shell/tests/TestShellStreamerStdio.cpp index dde770c950183c..b71ebaf80ae50d 100644 --- a/src/lib/shell/tests/TestShellStreamerStdio.cpp +++ b/src/lib/shell/tests/TestShellStreamerStdio.cpp @@ -15,8 +15,9 @@ * limitations under the License. */ -#include +#include +#include #include #include diff --git a/src/lib/shell/tests/TestShellTokenizeLine.cpp b/src/lib/shell/tests/TestShellTokenizeLine.cpp index 8ed6c0eecde779..64bb301dc52141 100644 --- a/src/lib/shell/tests/TestShellTokenizeLine.cpp +++ b/src/lib/shell/tests/TestShellTokenizeLine.cpp @@ -15,8 +15,9 @@ * limitations under the License. */ -#include +#include +#include #include // Include entire C++ file to have access to functions-under-test diff --git a/src/lib/support/BUILD.gn b/src/lib/support/BUILD.gn index 0d932e8af4153d..27f52465858b1d 100644 --- a/src/lib/support/BUILD.gn +++ b/src/lib/support/BUILD.gn @@ -299,7 +299,7 @@ static_library("support") { # Android has no 'platform' that provides logging if (current_os == "android") { - public_deps += [ "${chip_root}/src/platform/logging:android" ] + public_deps += [ "${chip_root}/src/platform/android:logging" ] } if (current_os == "mac" || current_os == "ios") { diff --git a/src/lib/support/CodeUtils.h b/src/lib/support/CodeUtils.h index 500804bc94912d..800123aa456851 100644 --- a/src/lib/support/CodeUtils.h +++ b/src/lib/support/CodeUtils.h @@ -392,6 +392,19 @@ constexpr inline const _T & max(const _T & a, const _T & b) */ #define SuccessOrExit(error) nlEXPECT(::chip::ChipError::IsSuccess((error)), exit) +/** + * @def SuccessOrExitAction(error, anAction) + * + * @brief + * This checks for the specified error, which is expected to + * commonly be successful (CHIP_NO_ERROR), and both executes + * @a anAction and branches to the local label 'exit' if the + * status is unsuccessful. + * + * @param[in] error A ChipError object to be evaluated against success (CHIP_NO_ERROR). + */ +#define SuccessOrExitAction(error, action) nlEXPECT_ACTION(::chip::ChipError::IsSuccess((error)), exit, action) + /** * @def VerifyOrExit(aCondition, anAction) * diff --git a/src/lib/support/CommonIterator.h b/src/lib/support/CommonIterator.h index fc799c33b233eb..0eec391a40e777 100644 --- a/src/lib/support/CommonIterator.h +++ b/src/lib/support/CommonIterator.h @@ -46,7 +46,7 @@ class CommonIterator virtual bool Next(T & item) = 0; /** * Release the memory allocated by this iterator. - * Must be called before the iterator goes out of scope in the iterator was dynamically allocated. + * Must be called before the iterator goes out of scope if the iterator was dynamically allocated. */ virtual void Release() = 0; diff --git a/src/lib/support/DefaultStorageKeyAllocator.h b/src/lib/support/DefaultStorageKeyAllocator.h index 04825c9ca4d719..9ed8a2f56cfd77 100644 --- a/src/lib/support/DefaultStorageKeyAllocator.h +++ b/src/lib/support/DefaultStorageKeyAllocator.h @@ -193,6 +193,17 @@ class DefaultStorageKeyAllocator return StorageKeyName::Formatted("f/%x/icd/%x", fabric, index); } + // Thread Network Directory + + static StorageKeyName ThreadNetworkDirectoryIndex() { return StorageKeyName::FromConst("g/tnd/i"); } + static StorageKeyName ThreadNetworkDirectoryDataset(uint64_t extendedPanId) + { + return StorageKeyName::Formatted("g/tnd/n/%08" PRIx32 "%08" PRIx32, // some platforms can't format uint64 + static_cast(extendedPanId >> 32), static_cast(extendedPanId)); + } + + // OTA + static StorageKeyName OTADefaultProviders() { return StorageKeyName::FromConst("g/o/dp"); } static StorageKeyName OTACurrentProvider() { return StorageKeyName::FromConst("g/o/cp"); } static StorageKeyName OTAUpdateToken() { return StorageKeyName::FromConst("g/o/ut"); } diff --git a/src/lib/support/Span.h b/src/lib/support/Span.h index a6f63c7c59f33e..2e6627d937e560 100644 --- a/src/lib/support/Span.h +++ b/src/lib/support/Span.h @@ -364,6 +364,8 @@ using ByteSpan = Span; using MutableByteSpan = Span; template using FixedByteSpan = FixedSpan; +template +using MutableFixedByteSpan = FixedSpan; using CharSpan = Span; using MutableCharSpan = Span; diff --git a/src/lib/support/TestPersistentStorageDelegate.h b/src/lib/support/TestPersistentStorageDelegate.h index 8d3bfd63e11bb2..7dc1c06008c77c 100644 --- a/src/lib/support/TestPersistentStorageDelegate.h +++ b/src/lib/support/TestPersistentStorageDelegate.h @@ -134,6 +134,11 @@ class TestPersistentStorageDelegate : public PersistentStorageDelegate */ virtual void AddPoisonKey(const std::string & key) { mPoisonKeys.insert(key); } + /** + * Allows subsequent writes to be rejected for unit testing purposes. + */ + virtual void SetRejectWrites(bool rejectWrites) { mRejectWrites = rejectWrites; } + /** * @brief Clear all "poison keys" * @@ -233,8 +238,8 @@ class TestPersistentStorageDelegate : public PersistentStorageDelegate virtual CHIP_ERROR SyncSetKeyValueInternal(const char * key, const void * value, uint16_t size) { - // Make sure poison keys are not accessed - if (mPoisonKeys.find(std::string(key)) != mPoisonKeys.end()) + // Make sure writes are allowed and poison keys are not accessed + if (mRejectWrites || mPoisonKeys.find(std::string(key)) != mPoisonKeys.end()) { return CHIP_ERROR_PERSISTED_STORAGE_FAILED; } @@ -259,8 +264,8 @@ class TestPersistentStorageDelegate : public PersistentStorageDelegate virtual CHIP_ERROR SyncDeleteKeyValueInternal(const char * key) { - // Make sure poison keys are not accessed - if (mPoisonKeys.find(std::string(key)) != mPoisonKeys.end()) + // Make sure writes are allowed and poison keys are not accessed + if (mRejectWrites || mPoisonKeys.find(std::string(key)) != mPoisonKeys.end()) { return CHIP_ERROR_PERSISTED_STORAGE_FAILED; } @@ -273,6 +278,7 @@ class TestPersistentStorageDelegate : public PersistentStorageDelegate std::map> mStorage; std::set mPoisonKeys; + bool mRejectWrites = false; LoggingLevel mLoggingLevel = LoggingLevel::kDisabled; }; diff --git a/src/lib/support/ThreadOperationalDataset.cpp b/src/lib/support/ThreadOperationalDataset.cpp index 70db620f8b24bc..1c11712166cfa4 100644 --- a/src/lib/support/ThreadOperationalDataset.cpp +++ b/src/lib/support/ThreadOperationalDataset.cpp @@ -15,11 +15,13 @@ * limitations under the License. */ -#include -#include - #include +#include + +#include +#include + namespace chip { namespace Thread { @@ -37,9 +39,11 @@ namespace Thread { class ThreadTLV final { static constexpr uint8_t kLengthEscape = 0xff; ///< This length value indicates the actual length is of two-bytes length, which - ///< not allowed in Thread Operational Dataset TLVs. + ///< is not allowed in Thread Operational Dataset TLVs. public: + static constexpr uint8_t kMaxLength = kLengthEscape - 1; + enum : uint8_t { kChannel = 0, @@ -49,7 +53,9 @@ class ThreadTLV final kPSKc = 4, kMasterKey = 5, kMeshLocalPrefix = 7, + kSecurityPolicy = 12, kActiveTimestamp = 14, + kChannelMask = 53, }; uint8_t GetSize() const { return static_cast(sizeof(*this) + GetLength()); } @@ -70,7 +76,7 @@ class ThreadTLV final mLength = aLength; } - const void * GetValue() const + const uint8_t * GetValue() const { assert(mLength != kLengthEscape); @@ -79,75 +85,44 @@ class ThreadTLV final return reinterpret_cast(this) + sizeof(*this); } - void * GetValue() { return const_cast(const_cast(this)->GetValue()); } + uint8_t * GetValue() { return const_cast(const_cast(this)->GetValue()); } + + ByteSpan GetValueAsSpan() const { return ByteSpan(static_cast(GetValue()), GetLength()); } void Get64(uint64_t & aValue) const { assert(GetLength() >= sizeof(aValue)); - - const uint8_t * p = reinterpret_cast(GetValue()); - aValue = // - (static_cast(p[0]) << 56) | // - (static_cast(p[1]) << 48) | // - (static_cast(p[2]) << 40) | // - (static_cast(p[3]) << 32) | // - (static_cast(p[4]) << 24) | // - (static_cast(p[5]) << 16) | // - (static_cast(p[6]) << 8) | // - (static_cast(p[7])); + aValue = Encoding::BigEndian::Get64(GetValue()); } - void Get16(uint16_t & aValue) const + void Get32(uint32_t & aValue) const { assert(GetLength() >= sizeof(aValue)); - - const uint8_t * p = static_cast(GetValue()); - - aValue = static_cast(p[0] << 8 | p[1]); + aValue = Encoding::BigEndian::Get32(GetValue()); } - void Get8(uint8_t & aValue) const + void Get16(uint16_t & aValue) const { assert(GetLength() >= sizeof(aValue)); - aValue = *static_cast(GetValue()); + aValue = Encoding::BigEndian::Get16(GetValue()); } void Set64(uint64_t aValue) { - uint8_t * value = static_cast(GetValue()); - SetLength(sizeof(aValue)); - - value[0] = static_cast((aValue >> 56) & 0xff); - value[1] = static_cast((aValue >> 48) & 0xff); - value[2] = static_cast((aValue >> 40) & 0xff); - value[3] = static_cast((aValue >> 32) & 0xff); - value[4] = static_cast((aValue >> 24) & 0xff); - value[5] = static_cast((aValue >> 16) & 0xff); - value[6] = static_cast((aValue >> 8) & 0xff); - value[7] = static_cast(aValue & 0xff); + Encoding::BigEndian::Put64(GetValue(), aValue); } - void Set16(uint16_t aValue) + void Set32(uint32_t aValue) { - uint8_t * value = static_cast(GetValue()); - SetLength(sizeof(aValue)); - - value[0] = static_cast(aValue >> 8); - value[1] = static_cast(aValue & 0xff); + Encoding::BigEndian::Put32(GetValue(), aValue); } - void Set8(uint8_t aValue) - { - SetLength(sizeof(aValue)); - *static_cast(GetValue()) = aValue; - } - - void Set8(int8_t aValue) + void Set16(uint16_t aValue) { SetLength(sizeof(aValue)); - *static_cast(GetValue()) = aValue; + Encoding::BigEndian::Put16(GetValue(), aValue); } void SetValue(const void * aValue, uint8_t aLength) @@ -156,6 +131,8 @@ class ThreadTLV final memcpy(GetValue(), aValue, aLength); } + void SetValue(const ByteSpan & aValue) { SetValue(aValue.data(), static_cast(aValue.size())); } + const ThreadTLV * GetNext() const { static_assert(alignof(ThreadTLV) == 1, "Wrong alignment for ThreadTLV header"); @@ -218,24 +195,16 @@ CHIP_ERROR OperationalDataset::Init(ByteSpan aData) CHIP_ERROR OperationalDataset::GetActiveTimestamp(uint64_t & aActiveTimestamp) const { const ThreadTLV * tlv = Locate(ThreadTLV::kActiveTimestamp); - - if (tlv != nullptr) - { - tlv->Get64(aActiveTimestamp); - return CHIP_NO_ERROR; - } - - return CHIP_ERROR_TLV_TAG_NOT_FOUND; + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_TLV_TAG_NOT_FOUND); + VerifyOrReturnError(tlv->GetLength() == sizeof(aActiveTimestamp), CHIP_ERROR_INVALID_TLV_ELEMENT); + tlv->Get64(aActiveTimestamp); + return CHIP_NO_ERROR; } CHIP_ERROR OperationalDataset::SetActiveTimestamp(uint64_t aActiveTimestamp) { ThreadTLV * tlv = MakeRoom(ThreadTLV::kActiveTimestamp, sizeof(*tlv) + sizeof(aActiveTimestamp)); - - if (tlv == nullptr) - { - return CHIP_ERROR_NO_MEMORY; - } + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_NO_MEMORY); tlv->Set64(aActiveTimestamp); @@ -247,26 +216,19 @@ CHIP_ERROR OperationalDataset::SetActiveTimestamp(uint64_t aActiveTimestamp) CHIP_ERROR OperationalDataset::GetChannel(uint16_t & aChannel) const { const ThreadTLV * tlv = Locate(ThreadTLV::kChannel); - - if (tlv != nullptr) - { - const uint8_t * value = reinterpret_cast(tlv->GetValue()); - aChannel = static_cast((value[1] << 8) | value[2]); - return CHIP_NO_ERROR; - } - - return CHIP_ERROR_TLV_TAG_NOT_FOUND; + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_TLV_TAG_NOT_FOUND); + VerifyOrReturnError(tlv->GetLength() == 3, CHIP_ERROR_INVALID_TLV_ELEMENT); + // Note: The channel page (byte 0) is not returned + const uint8_t * value = tlv->GetValue(); + aChannel = static_cast((value[1] << 8) | value[2]); + return CHIP_NO_ERROR; } CHIP_ERROR OperationalDataset::SetChannel(uint16_t aChannel) { uint8_t value[] = { 0, static_cast(aChannel >> 8), static_cast(aChannel & 0xff) }; ThreadTLV * tlv = MakeRoom(ThreadTLV::kChannel, sizeof(*tlv) + sizeof(value)); - - if (tlv == nullptr) - { - return CHIP_ERROR_NO_MEMORY; - } + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_NO_MEMORY); tlv->SetValue(value, sizeof(value)); @@ -278,43 +240,33 @@ CHIP_ERROR OperationalDataset::SetChannel(uint16_t aChannel) CHIP_ERROR OperationalDataset::GetExtendedPanId(uint8_t (&aExtendedPanId)[kSizeExtendedPanId]) const { ByteSpan extPanIdSpan; - CHIP_ERROR error = GetExtendedPanIdAsByteSpan(extPanIdSpan); - - if (error != CHIP_NO_ERROR) - { - return error; - } - + ReturnErrorOnFailure(GetExtendedPanIdAsByteSpan(extPanIdSpan)); memcpy(aExtendedPanId, extPanIdSpan.data(), extPanIdSpan.size()); return CHIP_NO_ERROR; } +CHIP_ERROR OperationalDataset::GetExtendedPanId(uint64_t & extendedPanId) const +{ + ByteSpan extPanIdSpan; + ReturnErrorOnFailure(GetExtendedPanIdAsByteSpan(extPanIdSpan)); + VerifyOrDie(extPanIdSpan.size() == sizeof(extendedPanId)); + extendedPanId = Encoding::BigEndian::Get64(extPanIdSpan.data()); + return CHIP_NO_ERROR; +} + CHIP_ERROR OperationalDataset::GetExtendedPanIdAsByteSpan(ByteSpan & span) const { const ThreadTLV * tlv = Locate(ThreadTLV::kExtendedPanId); - - if (tlv == nullptr) - { - return CHIP_ERROR_TLV_TAG_NOT_FOUND; - } - - if (tlv->GetLength() != kSizeExtendedPanId) - { - return CHIP_ERROR_INVALID_TLV_ELEMENT; - } - - span = ByteSpan(static_cast(tlv->GetValue()), tlv->GetLength()); + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_TLV_TAG_NOT_FOUND); + VerifyOrReturnError(tlv->GetLength() == kSizeExtendedPanId, CHIP_ERROR_INVALID_TLV_ELEMENT); + span = tlv->GetValueAsSpan(); return CHIP_NO_ERROR; } CHIP_ERROR OperationalDataset::SetExtendedPanId(const uint8_t (&aExtendedPanId)[kSizeExtendedPanId]) { ThreadTLV * tlv = MakeRoom(ThreadTLV::kExtendedPanId, sizeof(*tlv) + sizeof(aExtendedPanId)); - - if (tlv == nullptr) - { - return CHIP_ERROR_NO_MEMORY; - } + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_NO_MEMORY); tlv->SetValue(aExtendedPanId, sizeof(aExtendedPanId)); @@ -328,24 +280,16 @@ CHIP_ERROR OperationalDataset::SetExtendedPanId(const uint8_t (&aExtendedPanId)[ CHIP_ERROR OperationalDataset::GetMasterKey(uint8_t (&aMasterKey)[kSizeMasterKey]) const { const ThreadTLV * tlv = Locate(ThreadTLV::kMasterKey); - - if (tlv != nullptr) - { - memcpy(aMasterKey, tlv->GetValue(), sizeof(aMasterKey)); - return CHIP_NO_ERROR; - } - - return CHIP_ERROR_TLV_TAG_NOT_FOUND; + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_TLV_TAG_NOT_FOUND); + VerifyOrReturnError(tlv->GetLength() == sizeof(aMasterKey), CHIP_ERROR_INVALID_TLV_ELEMENT); + memcpy(aMasterKey, tlv->GetValue(), sizeof(aMasterKey)); + return CHIP_NO_ERROR; } CHIP_ERROR OperationalDataset::SetMasterKey(const uint8_t (&aMasterKey)[kSizeMasterKey]) { ThreadTLV * tlv = MakeRoom(ThreadTLV::kMasterKey, sizeof(*tlv) + sizeof(aMasterKey)); - - if (tlv == nullptr) - { - return CHIP_ERROR_NO_MEMORY; - } + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_NO_MEMORY); tlv->SetValue(aMasterKey, sizeof(aMasterKey)); @@ -359,24 +303,16 @@ CHIP_ERROR OperationalDataset::SetMasterKey(const uint8_t (&aMasterKey)[kSizeMas CHIP_ERROR OperationalDataset::GetMeshLocalPrefix(uint8_t (&aMeshLocalPrefix)[kSizeMeshLocalPrefix]) const { const ThreadTLV * tlv = Locate(ThreadTLV::kMeshLocalPrefix); - - if (tlv != nullptr) - { - memcpy(aMeshLocalPrefix, tlv->GetValue(), sizeof(aMeshLocalPrefix)); - return CHIP_NO_ERROR; - } - - return CHIP_ERROR_TLV_TAG_NOT_FOUND; + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_TLV_TAG_NOT_FOUND); + VerifyOrReturnError(tlv->GetLength() == sizeof(aMeshLocalPrefix), CHIP_ERROR_INVALID_TLV_ELEMENT); + memcpy(aMeshLocalPrefix, tlv->GetValue(), sizeof(aMeshLocalPrefix)); + return CHIP_NO_ERROR; } CHIP_ERROR OperationalDataset::SetMeshLocalPrefix(const uint8_t (&aMeshLocalPrefix)[kSizeMeshLocalPrefix]) { ThreadTLV * tlv = MakeRoom(ThreadTLV::kMeshLocalPrefix, sizeof(*tlv) + sizeof(aMeshLocalPrefix)); - - if (tlv == nullptr) - { - return CHIP_ERROR_NO_MEMORY; - } + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_NO_MEMORY); tlv->SetValue(aMeshLocalPrefix, sizeof(aMeshLocalPrefix)); @@ -388,32 +324,21 @@ CHIP_ERROR OperationalDataset::SetMeshLocalPrefix(const uint8_t (&aMeshLocalPref CHIP_ERROR OperationalDataset::GetNetworkName(char (&aNetworkName)[kSizeNetworkName + 1]) const { const ThreadTLV * tlv = Locate(ThreadTLV::kNetworkName); - - if (tlv != nullptr) - { - memcpy(aNetworkName, tlv->GetValue(), tlv->GetLength()); - aNetworkName[tlv->GetLength()] = '\0'; - return CHIP_NO_ERROR; - } - - return CHIP_ERROR_TLV_TAG_NOT_FOUND; + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_TLV_TAG_NOT_FOUND); + VerifyOrReturnError(tlv->GetLength() <= kSizeNetworkName, CHIP_ERROR_INVALID_TLV_ELEMENT); + memcpy(aNetworkName, tlv->GetValue(), tlv->GetLength()); + aNetworkName[tlv->GetLength()] = '\0'; + return CHIP_NO_ERROR; } CHIP_ERROR OperationalDataset::SetNetworkName(const char * aNetworkName) { + VerifyOrReturnError(aNetworkName != nullptr, CHIP_ERROR_INVALID_ARGUMENT); size_t len = strlen(aNetworkName); + VerifyOrReturnError(0 < len && len <= kSizeNetworkName, CHIP_ERROR_INVALID_STRING_LENGTH); - if (len > kSizeNetworkName || len == 0) - { - return CHIP_ERROR_INVALID_STRING_LENGTH; - } - - ThreadTLV * tlv = MakeRoom(ThreadTLV::kNetworkName, static_cast(sizeof(*tlv) + static_cast(len))); - - if (tlv == nullptr) - { - return CHIP_ERROR_NO_MEMORY; - } + ThreadTLV * tlv = MakeRoom(ThreadTLV::kNetworkName, sizeof(*tlv) + len); + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_NO_MEMORY); tlv->SetValue(aNetworkName, static_cast(len)); @@ -425,24 +350,16 @@ CHIP_ERROR OperationalDataset::SetNetworkName(const char * aNetworkName) CHIP_ERROR OperationalDataset::GetPanId(uint16_t & aPanId) const { const ThreadTLV * tlv = Locate(ThreadTLV::kPanId); - - if (tlv != nullptr) - { - tlv->Get16(aPanId); - return CHIP_NO_ERROR; - } - - return CHIP_ERROR_TLV_TAG_NOT_FOUND; + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_TLV_TAG_NOT_FOUND); + VerifyOrReturnError(tlv->GetLength() == sizeof(aPanId), CHIP_ERROR_INVALID_TLV_ELEMENT); + tlv->Get16(aPanId); + return CHIP_NO_ERROR; } CHIP_ERROR OperationalDataset::SetPanId(uint16_t aPanId) { ThreadTLV * tlv = MakeRoom(ThreadTLV::kPanId, sizeof(*tlv) + sizeof(aPanId)); - - if (tlv == nullptr) - { - return CHIP_ERROR_NO_MEMORY; - } + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_NO_MEMORY); tlv->Set16(aPanId); @@ -454,24 +371,16 @@ CHIP_ERROR OperationalDataset::SetPanId(uint16_t aPanId) CHIP_ERROR OperationalDataset::GetPSKc(uint8_t (&aPSKc)[kSizePSKc]) const { const ThreadTLV * tlv = Locate(ThreadTLV::kPSKc); - - if (tlv != nullptr) - { - memcpy(aPSKc, tlv->GetValue(), sizeof(aPSKc)); - return CHIP_NO_ERROR; - } - - return CHIP_ERROR_TLV_TAG_NOT_FOUND; + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_TLV_TAG_NOT_FOUND); + VerifyOrReturnError(tlv->GetLength() == sizeof(aPSKc), CHIP_ERROR_INVALID_TLV_ELEMENT); + memcpy(aPSKc, tlv->GetValue(), sizeof(aPSKc)); + return CHIP_NO_ERROR; } CHIP_ERROR OperationalDataset::SetPSKc(const uint8_t (&aPSKc)[kSizePSKc]) { ThreadTLV * tlv = MakeRoom(ThreadTLV::kPSKc, sizeof(*tlv) + sizeof(aPSKc)); - - if (tlv == nullptr) - { - return CHIP_ERROR_NO_MEMORY; - } + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_NO_MEMORY); tlv->SetValue(aPSKc, sizeof(aPSKc)); @@ -480,6 +389,43 @@ CHIP_ERROR OperationalDataset::SetPSKc(const uint8_t (&aPSKc)[kSizePSKc]) return CHIP_NO_ERROR; } +CHIP_ERROR OperationalDataset::GetChannelMask(ByteSpan & aChannelMask) const +{ + const ThreadTLV * tlv = Locate(ThreadTLV::kChannelMask); + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_TLV_TAG_NOT_FOUND); + VerifyOrReturnError(tlv->GetLength() > 0, CHIP_ERROR_INVALID_TLV_ELEMENT); + aChannelMask = tlv->GetValueAsSpan(); + return CHIP_NO_ERROR; +} + +CHIP_ERROR OperationalDataset::SetChannelMask(ByteSpan aChannelMask) +{ + VerifyOrReturnError(0 < aChannelMask.size() && aChannelMask.size() < ThreadTLV::kMaxLength, CHIP_ERROR_INVALID_ARGUMENT); + ThreadTLV * tlv = MakeRoom(ThreadTLV::kChannelMask, sizeof(*tlv) + aChannelMask.size()); + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_NO_MEMORY); + tlv->SetValue(aChannelMask); + mLength = static_cast(mLength + tlv->GetSize()); + return CHIP_NO_ERROR; +} + +CHIP_ERROR OperationalDataset::GetSecurityPolicy(uint32_t & aSecurityPolicy) const +{ + const ThreadTLV * tlv = Locate(ThreadTLV::kSecurityPolicy); + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_TLV_TAG_NOT_FOUND); + VerifyOrReturnError(tlv->GetLength() == sizeof(aSecurityPolicy), CHIP_ERROR_INVALID_TLV_ELEMENT); + tlv->Get32(aSecurityPolicy); + return CHIP_NO_ERROR; +} + +CHIP_ERROR OperationalDataset::SetSecurityPolicy(uint32_t aSecurityPolicy) +{ + ThreadTLV * tlv = MakeRoom(ThreadTLV::kSecurityPolicy, sizeof(*tlv) + sizeof(aSecurityPolicy)); + VerifyOrReturnError(tlv != nullptr, CHIP_ERROR_NO_MEMORY); + tlv->Set32(aSecurityPolicy); + mLength = static_cast(mLength + tlv->GetSize()); + return CHIP_NO_ERROR; +} + void OperationalDataset::UnsetMasterKey() { Remove(ThreadTLV::kMasterKey); @@ -533,7 +479,7 @@ void OperationalDataset::Remove(uint8_t aType) } } -ThreadTLV * OperationalDataset::MakeRoom(uint8_t aType, uint8_t aSize) +ThreadTLV * OperationalDataset::MakeRoom(uint8_t aType, size_t aSize) { ThreadTLV * tlv = Locate(aType); diff --git a/src/lib/support/ThreadOperationalDataset.h b/src/lib/support/ThreadOperationalDataset.h index e4de3ddaa8d2c5..5cd57df6a79db6 100644 --- a/src/lib/support/ThreadOperationalDataset.h +++ b/src/lib/support/ThreadOperationalDataset.h @@ -54,7 +54,6 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully initialized the dataset. * @retval CHIP_ERROR_INVALID_ARGUMENT The dataset length @p aLength is too long or @p data is corrupted. - * */ CHIP_ERROR Init(ByteSpan aData); @@ -65,7 +64,7 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully retrieved the active timestamp. * @retval CHIP_ERROR_TLV_TAG_NOT_FOUND Thread active timestamp is not present in the dataset. - * + * @retval CHIP_ERROR_INVALID_TLV_ELEMENT If the TLV element is invalid. */ CHIP_ERROR GetActiveTimestamp(uint64_t & aActiveTimestamp) const; @@ -76,7 +75,6 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully set the active timestamp. * @retval CHIP_ERROR_NO_MEMORY Insufficient memory in the dataset for setting Thread active timestamp. - * */ CHIP_ERROR SetActiveTimestamp(uint64_t aActiveTimestamp); @@ -87,7 +85,7 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully retrieved the channel. * @retval CHIP_ERROR_TLV_TAG_NOT_FOUND Thread channel is not present in the dataset. - * + * @retval CHIP_ERROR_INVALID_TLV_ELEMENT If the TLV element is invalid. */ CHIP_ERROR GetChannel(uint16_t & aChannel) const; @@ -98,7 +96,6 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully set the channel. * @retval CHIP_ERROR_NO_MEMORY Insufficient memory in the dataset for setting Thread channel. - * */ CHIP_ERROR SetChannel(uint16_t aChannel); @@ -109,19 +106,29 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully retrieved the extended PAN ID. * @retval CHIP_ERROR_TLV_TAG_NOT_FOUND Thread extended PAN ID is not present in the dataset. - * + * @retval CHIP_ERROR_INVALID_TLV_ELEMENT If the TLV element is invalid. */ CHIP_ERROR GetExtendedPanId(uint8_t (&aExtendedPanId)[kSizeExtendedPanId]) const; + /** + * This method retrieves the Thread extended PAN ID from the dataset, interpreted as a big endian number. + * @retval CHIP_NO_ERROR Successfully retrieved the extended PAN ID. + * @retval CHIP_ERROR_TLV_TAG_NOT_FOUND Thread extended PAN ID is not present in the dataset. + */ + CHIP_ERROR GetExtendedPanId(uint64_t & extendedPanId) const; + /** * This method returns a const ByteSpan to the extended PAN ID in the dataset. * This can be used to pass the extended PAN ID to a cluster command without the use of external memory. * + * Note: The returned span points into storage managed by this class, + * and must not be dereferenced beyond the lifetime of this object. + * * @param[out] span A reference to receive the location of the extended PAN ID. * * @retval CHIP_NO_ERROR Successfully retrieved the extended PAN ID. * @retval CHIP_ERROR_TLV_TAG_NOT_FOUND Thread extended PAN ID is not present in the dataset. - * + * @retval CHIP_ERROR_INVALID_TLV_ELEMENT If the TLV element is invalid. */ CHIP_ERROR GetExtendedPanIdAsByteSpan(ByteSpan & span) const; @@ -132,7 +139,6 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully set the extended PAN ID. * @retval CHIP_ERROR_NO_MEMORY Insufficient memory in the dataset for setting Thread extended PAN ID. - * */ CHIP_ERROR SetExtendedPanId(const uint8_t (&aExtendedPanId)[kSizeExtendedPanId]); @@ -143,7 +149,7 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully retrieved the master key. * @retval CHIP_ERROR_TLV_TAG_NOT_FOUND Thread master key is not present in the dataset. - * + * @retval CHIP_ERROR_INVALID_TLV_ELEMENT If the TLV element is invalid. */ CHIP_ERROR GetMasterKey(uint8_t (&aMasterKey)[kSizeMasterKey]) const; @@ -154,13 +160,11 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully set the master key. * @retval CHIP_ERROR_NO_MEMORY Insufficient memory in the dataset for setting Thread master key. - * */ CHIP_ERROR SetMasterKey(const uint8_t (&aMasterKey)[kSizeMasterKey]); /** * This method unsets Thread master key to the dataset. - * */ void UnsetMasterKey(void); @@ -171,7 +175,7 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully retrieved the mesh local prefix. * @retval CHIP_ERROR_TLV_TAG_NOT_FOUND Thread mesh local prefix is not present in the dataset. - * + * @retval CHIP_ERROR_INVALID_TLV_ELEMENT If the TLV element is invalid. */ CHIP_ERROR GetMeshLocalPrefix(uint8_t (&aMeshLocalPrefix)[kSizeMeshLocalPrefix]) const; @@ -182,7 +186,6 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully set the Thread mesh local prefix. * @retval CHIP_ERROR_NO_MEMORY Insufficient memory in the dataset for setting Thread mesh local prefix. - * */ CHIP_ERROR SetMeshLocalPrefix(const uint8_t (&aMeshLocalPrefix)[kSizeMeshLocalPrefix]); @@ -193,7 +196,7 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully retrieved the network name. * @retval CHIP_ERROR_TLV_TAG_NOT_FOUND Thread network name is not present in the dataset. - * + * @retval CHIP_ERROR_INVALID_TLV_ELEMENT If the TLV element is invalid. */ CHIP_ERROR GetNetworkName(char (&aNetworkName)[kSizeNetworkName + 1]) const; @@ -204,7 +207,6 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully set the network name. * @retval CHIP_ERROR_NO_MEMORY Insufficient memory in the dataset for setting Thread network name. - * */ CHIP_ERROR SetNetworkName(const char * aNetworkName); @@ -215,7 +217,7 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully retrieved the PAN ID. * @retval CHIP_ERROR_TLV_TAG_NOT_FOUND Thread PAN ID is not present in the dataset. - * + * @retval CHIP_ERROR_INVALID_TLV_ELEMENT If the TLV element is invalid. */ CHIP_ERROR GetPanId(uint16_t & aPanId) const; @@ -226,7 +228,6 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully set the PAN ID. * @retval CHIP_ERROR_NO_MEMORY Insufficient memory in the dataset for setting Thread PAN ID. - * */ CHIP_ERROR SetPanId(uint16_t aPanId); @@ -237,7 +238,7 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully retrieved the PSKc. * @retval CHIP_ERROR_TLV_TAG_NOT_FOUND Thread PSKc is not present in the dataset. - * + * @retval CHIP_ERROR_INVALID_TLV_ELEMENT If the TLV element is invalid. */ CHIP_ERROR GetPSKc(uint8_t (&aPSKc)[kSizePSKc]) const; @@ -248,16 +249,51 @@ class OperationalDataset * * @retval CHIP_NO_ERROR Successfully set the PSKc. * @retval CHIP_ERROR_NO_MEMORY Insufficient memory in the dataset for setting Thread PSKc. - * */ CHIP_ERROR SetPSKc(const uint8_t (&aPSKc)[kSizePSKc]); /** * This method unsets Thread PSKc to the dataset. - * */ void UnsetPSKc(void); + /** + * Returns ByteSpan pointing to the channel mask within the dataset. + * + * Note: The returned span points into storage managed by this class, + * and must not be dereferenced beyond the lifetime of this object. + * + * @retval CHIP_NO_ERROR on success. + * @retval CHIP_ERROR_TLV_TAG_NOT_FOUND if the channel mask is not present in the dataset. + * @retval CHIP_ERROR_INVALID_TLV_ELEMENT if the TLV element is invalid. + */ + CHIP_ERROR GetChannelMask(ByteSpan & aChannelMask) const; + + /** + * This method sets the channel mask within the dataset. + * + * @retval CHIP_NO_ERROR on success. + * @retval CHIP_ERROR_NO_MEMORY if there is insufficient space within the dataset. + */ + CHIP_ERROR SetChannelMask(ByteSpan aChannelMask); + + /** + * Retrieves the security policy from the dataset. + * + * @retval CHIP_NO_ERROR on success. + * @retval CHIP_ERROR_TLV_TAG_NOT_FOUND if no security policy is present in the dataset. + * @retval CHIP_ERROR_INVALID_TLV_ELEMENT if the TLV element is invalid. + */ + CHIP_ERROR GetSecurityPolicy(uint32_t & aSecurityPolicy) const; + + /** + * This method sets the security policy within the dataset. + * + * @retval CHIP_NO_ERROR on success. + * @retval CHIP_ERROR_NO_MEMORY if there is insufficient space within the dataset. + */ + CHIP_ERROR SetSecurityPolicy(uint32_t aSecurityPolicy); + /** * This method clears all data stored in the dataset. */ @@ -265,7 +301,6 @@ class OperationalDataset /** * This method checks if the dataset is ready for creating Thread network. - * */ bool IsCommissioned(void) const; @@ -278,7 +313,6 @@ class OperationalDataset * This method checks whether @p aData is formatted as ThreadTLVs. * * @note This method doesn't verify ThreadTLV values are valid. - * */ static bool IsValid(ByteSpan aData); @@ -296,12 +330,12 @@ class OperationalDataset ThreadTLV & End(void) { return const_cast(const_cast(this)->End()); } void Remove(uint8_t aType); void Remove(ThreadTLV & aTlv); - ThreadTLV * MakeRoom(uint8_t aType, uint8_t aSize); + ThreadTLV * MakeRoom(uint8_t aType, size_t aSize); bool Has(uint8_t aType) const { return Locate(aType) != nullptr; } uint8_t mData[kSizeOperationalDataset]; - uint8_t mLength; + uint8_t mLength = 0; }; } // namespace Thread -}; // namespace chip +} // namespace chip diff --git a/src/lib/support/tests/BUILD.gn b/src/lib/support/tests/BUILD.gn index 659ba00d0395ff..c6bfddb9269a7a 100644 --- a/src/lib/support/tests/BUILD.gn +++ b/src/lib/support/tests/BUILD.gn @@ -88,6 +88,7 @@ chip_test_suite("tests") { public_deps = [ "${chip_root}/src/credentials", "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/support:static-support", "${chip_root}/src/lib/support:testing", "${chip_root}/src/lib/support/jsontlv", diff --git a/src/lib/support/tests/TestBitMask.cpp b/src/lib/support/tests/TestBitMask.cpp index f19c90fb2e20af..7d7798a4fa85ee 100644 --- a/src/lib/support/tests/TestBitMask.cpp +++ b/src/lib/support/tests/TestBitMask.cpp @@ -14,13 +14,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include + #include #include #include #include +#include + +#include + using namespace chip; namespace { diff --git a/src/lib/support/tests/TestBufferReader.cpp b/src/lib/support/tests/TestBufferReader.cpp index 6d14c3973f58ed..97db9cf09737b9 100644 --- a/src/lib/support/tests/TestBufferReader.cpp +++ b/src/lib/support/tests/TestBufferReader.cpp @@ -22,11 +22,13 @@ * */ -#include -#include - #include +#include + +#include +#include + using namespace chip; using namespace chip::Encoding::LittleEndian; diff --git a/src/lib/support/tests/TestBufferWriter.cpp b/src/lib/support/tests/TestBufferWriter.cpp index e5d8951d4cf152..1be61f35ad206d 100644 --- a/src/lib/support/tests/TestBufferWriter.cpp +++ b/src/lib/support/tests/TestBufferWriter.cpp @@ -14,9 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include -#include +#include + +#include +#include namespace { diff --git a/src/lib/support/tests/TestBytesCircularBuffer.cpp b/src/lib/support/tests/TestBytesCircularBuffer.cpp index 90305e0cf8590a..4ee192b652649e 100644 --- a/src/lib/support/tests/TestBytesCircularBuffer.cpp +++ b/src/lib/support/tests/TestBytesCircularBuffer.cpp @@ -23,8 +23,9 @@ #include #include -#include +#include +#include #include namespace { diff --git a/src/lib/support/tests/TestBytesToHex.cpp b/src/lib/support/tests/TestBytesToHex.cpp index 1e304811b5e42b..7384958befd415 100644 --- a/src/lib/support/tests/TestBytesToHex.cpp +++ b/src/lib/support/tests/TestBytesToHex.cpp @@ -20,13 +20,15 @@ #include #include -#include +#include +#include #include #include #include #include #include + namespace { using namespace chip; diff --git a/src/lib/support/tests/TestCHIPArgParser.cpp b/src/lib/support/tests/TestCHIPArgParser.cpp index 426758aff1e5c8..f7bcc84fbaf3d6 100644 --- a/src/lib/support/tests/TestCHIPArgParser.cpp +++ b/src/lib/support/tests/TestCHIPArgParser.cpp @@ -22,9 +22,10 @@ #include #include -#include +#include #include +#include #include #include #include diff --git a/src/lib/support/tests/TestCHIPCounter.cpp b/src/lib/support/tests/TestCHIPCounter.cpp index b2c5e21b5038c2..f84ce7e50e0c18 100644 --- a/src/lib/support/tests/TestCHIPCounter.cpp +++ b/src/lib/support/tests/TestCHIPCounter.cpp @@ -18,8 +18,9 @@ #include -#include +#include +#include #include using namespace chip; diff --git a/src/lib/support/tests/TestCHIPMem.cpp b/src/lib/support/tests/TestCHIPMem.cpp index c19d356abfeceb..6f4aa8aa6bcfdb 100644 --- a/src/lib/support/tests/TestCHIPMem.cpp +++ b/src/lib/support/tests/TestCHIPMem.cpp @@ -29,8 +29,9 @@ #include #include -#include +#include +#include #include #include diff --git a/src/lib/support/tests/TestCHIPMemString.cpp b/src/lib/support/tests/TestCHIPMemString.cpp index 10101bd193c0f6..11409d18dc6f69 100644 --- a/src/lib/support/tests/TestCHIPMemString.cpp +++ b/src/lib/support/tests/TestCHIPMemString.cpp @@ -22,8 +22,9 @@ #include #include -#include +#include +#include #include #include #include diff --git a/src/lib/support/tests/TestDefer.cpp b/src/lib/support/tests/TestDefer.cpp index 9b5159bf557830..d0b65fe9cb10c5 100644 --- a/src/lib/support/tests/TestDefer.cpp +++ b/src/lib/support/tests/TestDefer.cpp @@ -20,7 +20,9 @@ #include -#include +#include + +#include namespace { diff --git a/src/lib/support/tests/TestErrorStr.cpp b/src/lib/support/tests/TestErrorStr.cpp index 49ae9f5a9b40ac..809d69b302af0b 100644 --- a/src/lib/support/tests/TestErrorStr.cpp +++ b/src/lib/support/tests/TestErrorStr.cpp @@ -19,10 +19,11 @@ #include #include -#include +#include #include #include +#include using namespace chip; diff --git a/src/lib/support/tests/TestFixedBufferAllocator.cpp b/src/lib/support/tests/TestFixedBufferAllocator.cpp index c5c588041ef65c..a2e30ba7464d3b 100644 --- a/src/lib/support/tests/TestFixedBufferAllocator.cpp +++ b/src/lib/support/tests/TestFixedBufferAllocator.cpp @@ -19,7 +19,10 @@ #include #include -#include + +#include + +#include using namespace chip; diff --git a/src/lib/support/tests/TestFold.cpp b/src/lib/support/tests/TestFold.cpp index 48dbb454dfac3b..b8b1b813c191d0 100644 --- a/src/lib/support/tests/TestFold.cpp +++ b/src/lib/support/tests/TestFold.cpp @@ -16,12 +16,15 @@ * limitations under the License. */ -#include -#include - #include #include #include + +#include + +#include +#include + using namespace chip; namespace { diff --git a/src/lib/support/tests/TestIniEscaping.cpp b/src/lib/support/tests/TestIniEscaping.cpp index 90570add67b18d..61c7db20130150 100644 --- a/src/lib/support/tests/TestIniEscaping.cpp +++ b/src/lib/support/tests/TestIniEscaping.cpp @@ -16,10 +16,13 @@ * limitations under the License. */ -#include -#include #include +#include + +#include +#include + using namespace chip; using namespace chip::IniEscaping; diff --git a/src/lib/support/tests/TestIntrusiveList.cpp b/src/lib/support/tests/TestIntrusiveList.cpp index 50ace6a561e699..6e89b3e344c11e 100644 --- a/src/lib/support/tests/TestIntrusiveList.cpp +++ b/src/lib/support/tests/TestIntrusiveList.cpp @@ -18,8 +18,9 @@ #include #include -#include +#include +#include #include namespace { diff --git a/src/lib/support/tests/TestJsonToTlv.cpp b/src/lib/support/tests/TestJsonToTlv.cpp index 9bc8696fd88621..6499e1dfa573aa 100644 --- a/src/lib/support/tests/TestJsonToTlv.cpp +++ b/src/lib/support/tests/TestJsonToTlv.cpp @@ -17,16 +17,18 @@ #include -#include +#include #include #include #include +#include #include #include #include #include #include + namespace { using namespace chip::Encoding; diff --git a/src/lib/support/tests/TestJsonToTlvToJson.cpp b/src/lib/support/tests/TestJsonToTlvToJson.cpp index 665df4dcb30cab..3321ed8f9ee2e2 100644 --- a/src/lib/support/tests/TestJsonToTlvToJson.cpp +++ b/src/lib/support/tests/TestJsonToTlvToJson.cpp @@ -18,11 +18,12 @@ #include #include -#include +#include #include #include #include +#include #include #include #include diff --git a/src/lib/support/tests/TestPersistedCounter.cpp b/src/lib/support/tests/TestPersistedCounter.cpp index 3d9b13583e49a0..a743369537ae91 100644 --- a/src/lib/support/tests/TestPersistedCounter.cpp +++ b/src/lib/support/tests/TestPersistedCounter.cpp @@ -23,8 +23,10 @@ * */ -#include +#include + #include +#include #include #include #include diff --git a/src/lib/support/tests/TestPool.cpp b/src/lib/support/tests/TestPool.cpp index da76d7ebb70d7b..84eea0c3e3bef7 100644 --- a/src/lib/support/tests/TestPool.cpp +++ b/src/lib/support/tests/TestPool.cpp @@ -25,11 +25,13 @@ #include -#include +#include +#include #include #include #include + namespace chip { template diff --git a/src/lib/support/tests/TestPrivateHeap.cpp b/src/lib/support/tests/TestPrivateHeap.cpp index f808c16cb8e5f6..2a68bb9c925021 100644 --- a/src/lib/support/tests/TestPrivateHeap.cpp +++ b/src/lib/support/tests/TestPrivateHeap.cpp @@ -18,8 +18,9 @@ #include -#include +#include +#include #include namespace { diff --git a/src/lib/support/tests/TestSafeInt.cpp b/src/lib/support/tests/TestSafeInt.cpp index 1464c0e9735b8c..298b23071e5709 100644 --- a/src/lib/support/tests/TestSafeInt.cpp +++ b/src/lib/support/tests/TestSafeInt.cpp @@ -22,7 +22,9 @@ * */ -#include +#include + +#include #include using namespace chip; diff --git a/src/lib/support/tests/TestSafeString.cpp b/src/lib/support/tests/TestSafeString.cpp index 09e7d89e4054f7..6fe71cb5df723a 100644 --- a/src/lib/support/tests/TestSafeString.cpp +++ b/src/lib/support/tests/TestSafeString.cpp @@ -22,8 +22,9 @@ * */ -#include +#include +#include #include using namespace chip; diff --git a/src/lib/support/tests/TestScoped.cpp b/src/lib/support/tests/TestScoped.cpp index fef70a443dcfb1..f89a374e8ee601 100644 --- a/src/lib/support/tests/TestScoped.cpp +++ b/src/lib/support/tests/TestScoped.cpp @@ -18,8 +18,9 @@ #include -#include +#include +#include #include namespace { diff --git a/src/lib/support/tests/TestScopedBuffer.cpp b/src/lib/support/tests/TestScopedBuffer.cpp index c7ec072726c2be..123dca1d2456a7 100644 --- a/src/lib/support/tests/TestScopedBuffer.cpp +++ b/src/lib/support/tests/TestScopedBuffer.cpp @@ -16,8 +16,9 @@ * limitations under the License. */ -#include +#include +#include #include namespace { diff --git a/src/lib/support/tests/TestSorting.cpp b/src/lib/support/tests/TestSorting.cpp index 1d04604c110fd5..459f41d53b72a7 100644 --- a/src/lib/support/tests/TestSorting.cpp +++ b/src/lib/support/tests/TestSorting.cpp @@ -20,8 +20,9 @@ #include #include -#include +#include +#include #include #include diff --git a/src/lib/support/tests/TestSpan.cpp b/src/lib/support/tests/TestSpan.cpp index 6849138861065c..4813bc460b6be3 100644 --- a/src/lib/support/tests/TestSpan.cpp +++ b/src/lib/support/tests/TestSpan.cpp @@ -24,8 +24,9 @@ #include -#include +#include +#include #include using namespace chip; diff --git a/src/lib/support/tests/TestStateMachine.cpp b/src/lib/support/tests/TestStateMachine.cpp index 4b6af3a73d85cf..3d282b5e5c6e76 100644 --- a/src/lib/support/tests/TestStateMachine.cpp +++ b/src/lib/support/tests/TestStateMachine.cpp @@ -16,8 +16,9 @@ * limitations under the License. */ -#include +#include +#include #include #include diff --git a/src/lib/support/tests/TestStaticSupportSmartPtr.cpp b/src/lib/support/tests/TestStaticSupportSmartPtr.cpp index 5ffe1cee4d284b..9110c6005b544e 100644 --- a/src/lib/support/tests/TestStaticSupportSmartPtr.cpp +++ b/src/lib/support/tests/TestStaticSupportSmartPtr.cpp @@ -18,8 +18,9 @@ #include -#include +#include +#include #include #include diff --git a/src/lib/support/tests/TestStringBuilder.cpp b/src/lib/support/tests/TestStringBuilder.cpp index 2f4ad518da3dd1..3b0a3299a80c80 100644 --- a/src/lib/support/tests/TestStringBuilder.cpp +++ b/src/lib/support/tests/TestStringBuilder.cpp @@ -14,9 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include -#include +#include + +#include +#include namespace { diff --git a/src/lib/support/tests/TestStringSplitter.cpp b/src/lib/support/tests/TestStringSplitter.cpp index c8dd1e9f802c47..1301049890ac3b 100644 --- a/src/lib/support/tests/TestStringSplitter.cpp +++ b/src/lib/support/tests/TestStringSplitter.cpp @@ -14,9 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include + +#include #include -#include namespace { using namespace chip; diff --git a/src/lib/support/tests/TestTestPersistentStorageDelegate.cpp b/src/lib/support/tests/TestTestPersistentStorageDelegate.cpp index a53f43c0febaaa..f9d403e3d920b0 100644 --- a/src/lib/support/tests/TestTestPersistentStorageDelegate.cpp +++ b/src/lib/support/tests/TestTestPersistentStorageDelegate.cpp @@ -16,15 +16,16 @@ * limitations under the License. */ -#include -#include - #include #include #include #include -#include +#include + +#include +#include +#include using namespace chip; diff --git a/src/lib/support/tests/TestThreadOperationalDataset.cpp b/src/lib/support/tests/TestThreadOperationalDataset.cpp index d9e13c8c25705f..2ea4d3c99eba30 100644 --- a/src/lib/support/tests/TestThreadOperationalDataset.cpp +++ b/src/lib/support/tests/TestThreadOperationalDataset.cpp @@ -15,8 +15,9 @@ * limitations under the License. */ -#include +#include +#include #include #include @@ -30,11 +31,9 @@ class TestThreadOperationalDataset : public ::testing::Test static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } - static Thread::OperationalDataset dataset; + Thread::OperationalDataset dataset; }; -Thread::OperationalDataset TestThreadOperationalDataset::dataset; - TEST_F(TestThreadOperationalDataset, TestInit) { @@ -103,6 +102,10 @@ TEST_F(TestThreadOperationalDataset, TestMasterKey) EXPECT_EQ(dataset.SetMasterKey(kMasterKey), CHIP_NO_ERROR); EXPECT_EQ(dataset.GetMasterKey(masterKey), CHIP_NO_ERROR); EXPECT_EQ(memcmp(masterKey, kMasterKey, sizeof(kMasterKey)), 0); + + dataset.UnsetMasterKey(); + EXPECT_EQ(dataset.GetMasterKey(masterKey), CHIP_ERROR_TLV_TAG_NOT_FOUND); + EXPECT_EQ(dataset.SetMasterKey(masterKey), CHIP_NO_ERROR); } TEST_F(TestThreadOperationalDataset, TestMeshLocalPrefix) @@ -129,6 +132,7 @@ TEST_F(TestThreadOperationalDataset, TestNetworkName) EXPECT_EQ(dataset.SetNetworkName("0123456789abcdef"), CHIP_NO_ERROR); EXPECT_EQ(dataset.SetNetworkName("0123456789abcdefg"), CHIP_ERROR_INVALID_STRING_LENGTH); EXPECT_EQ(dataset.SetNetworkName(""), CHIP_ERROR_INVALID_STRING_LENGTH); + EXPECT_EQ(dataset.SetNetworkName(nullptr), CHIP_ERROR_INVALID_ARGUMENT); } TEST_F(TestThreadOperationalDataset, TestPanId) @@ -152,25 +156,7 @@ TEST_F(TestThreadOperationalDataset, TestPSKc) EXPECT_EQ(dataset.SetPSKc(kPSKc), CHIP_NO_ERROR); EXPECT_EQ(dataset.GetPSKc(pskc), CHIP_NO_ERROR); EXPECT_FALSE(memcmp(pskc, kPSKc, sizeof(kPSKc))); -} - -TEST_F(TestThreadOperationalDataset, TestUnsetMasterKey) -{ - - uint8_t masterKey[Thread::kSizeMasterKey] = { 0 }; - - EXPECT_EQ(dataset.GetMasterKey(masterKey), CHIP_NO_ERROR); - dataset.UnsetMasterKey(); - EXPECT_EQ(dataset.GetMasterKey(masterKey), CHIP_ERROR_TLV_TAG_NOT_FOUND); - EXPECT_EQ(dataset.SetMasterKey(masterKey), CHIP_NO_ERROR); -} - -TEST_F(TestThreadOperationalDataset, TestUnsetPSKc) -{ - - uint8_t pskc[Thread::kSizePSKc] = { 0 }; - EXPECT_EQ(dataset.GetPSKc(pskc), CHIP_NO_ERROR); dataset.UnsetPSKc(); EXPECT_EQ(dataset.GetPSKc(pskc), CHIP_ERROR_TLV_TAG_NOT_FOUND); EXPECT_EQ(dataset.SetPSKc(pskc), CHIP_NO_ERROR); @@ -178,45 +164,19 @@ TEST_F(TestThreadOperationalDataset, TestUnsetPSKc) TEST_F(TestThreadOperationalDataset, TestClear) { - - { - uint64_t activeTimestamp; - EXPECT_EQ(dataset.GetActiveTimestamp(activeTimestamp), CHIP_NO_ERROR); - } - - { - uint16_t channel; - EXPECT_EQ(dataset.GetChannel(channel), CHIP_NO_ERROR); - } - - { - uint8_t extendedPanId[Thread::kSizeExtendedPanId] = { 0 }; - EXPECT_EQ(dataset.GetExtendedPanId(extendedPanId), CHIP_NO_ERROR); - } - { + EXPECT_EQ(dataset.SetActiveTimestamp(123), CHIP_NO_ERROR); + EXPECT_EQ(dataset.SetChannel(5), CHIP_NO_ERROR); + uint8_t extendedPanId[Thread::kSizeExtendedPanId] = { 1, 2, 3, 4, 5, 6, 7, 8 }; + EXPECT_EQ(dataset.SetExtendedPanId(extendedPanId), CHIP_NO_ERROR); uint8_t masterKey[Thread::kSizeMasterKey] = { 0 }; - EXPECT_EQ(dataset.GetMasterKey(masterKey), CHIP_NO_ERROR); - } - - { + EXPECT_EQ(dataset.SetMasterKey(masterKey), CHIP_NO_ERROR); uint8_t meshLocalPrefix[Thread::kSizeMeshLocalPrefix] = { 0 }; - EXPECT_EQ(dataset.GetMeshLocalPrefix(meshLocalPrefix), CHIP_NO_ERROR); - } - - { - char networkName[Thread::kSizeNetworkName + 1] = { 0 }; - EXPECT_EQ(dataset.GetNetworkName(networkName), CHIP_NO_ERROR); - } - - { - uint16_t panid; - EXPECT_EQ(dataset.GetPanId(panid), CHIP_NO_ERROR); - } - - { + EXPECT_EQ(dataset.SetMeshLocalPrefix(meshLocalPrefix), CHIP_NO_ERROR); + EXPECT_EQ(dataset.SetNetworkName("w00tw00t"), CHIP_NO_ERROR); + EXPECT_EQ(dataset.SetPanId(0x4242), CHIP_NO_ERROR); uint8_t pskc[Thread::kSizePSKc] = { 0 }; - EXPECT_EQ(dataset.GetPSKc(pskc), CHIP_NO_ERROR); + EXPECT_EQ(dataset.SetPSKc(pskc), CHIP_NO_ERROR); } dataset.Clear(); @@ -262,4 +222,118 @@ TEST_F(TestThreadOperationalDataset, TestClear) } } +TEST_F(TestThreadOperationalDataset, TestExampleDataset) +{ + const uint8_t example[] = { + 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // Active Timestamp 1 + 0x00, 0x03, 0x00, 0x00, 0x0f, // Channel 15 + 0x35, 0x04, 0x07, 0xff, 0xf8, 0x00, // Channel Mask 0x07fff800 + 0x02, 0x08, 0x39, 0x75, 0x8e, 0xc8, 0x14, 0x4b, 0x07, 0xfb, // Ext PAN ID 39758ec8144b07fb + 0x07, 0x08, 0xfd, 0xf1, 0xf1, 0xad, 0xd0, 0x79, 0x7d, 0xc0, // Mesh Local Prefix fdf1:f1ad:d079:7dc0::/64 + 0x05, 0x10, 0xf3, 0x66, 0xce, 0xc7, 0xa4, 0x46, 0xba, 0xb9, 0x78, 0xd9, 0x0d, 0x27, 0xab, 0xe3, 0x8f, 0x23, // Network Key + 0x03, 0x0f, 0x4f, 0x70, 0x65, 0x6e, 0x54, 0x68, 0x72, 0x65, 0x61, 0x64, 0x2d, 0x35, 0x39, 0x33, 0x38, // "OpenThread-5938" + 0x01, 0x02, 0x59, 0x38, // PAN ID : 0x5938 + 0x04, 0x10, 0x3c, 0xa6, 0x7c, 0x96, 0x9e, 0xfb, 0x0d, 0x0c, 0x74, 0xa4, 0xd8, 0xee, 0x92, 0x3b, 0x57, 0x6c, // PKSc + 0x0c, 0x04, 0x02, 0xa0, 0xf7, 0xf8, // Security Policy + }; + EXPECT_EQ(dataset.Init(ByteSpan(example)), CHIP_NO_ERROR); + + uint64_t activeTimestamp; + EXPECT_EQ(dataset.GetActiveTimestamp(activeTimestamp), CHIP_NO_ERROR); + EXPECT_EQ(activeTimestamp, 1u); + + uint16_t channel; + EXPECT_EQ(dataset.GetChannel(channel), CHIP_NO_ERROR); + EXPECT_EQ(channel, 15u); + + uint8_t extPanId[Thread::kSizeExtendedPanId]; + EXPECT_EQ(dataset.GetExtendedPanId(extPanId), CHIP_NO_ERROR); + const uint8_t expectedExtPanId[] = { 0x39, 0x75, 0x8e, 0xc8, 0x14, 0x4b, 0x07, 0xfb }; + EXPECT_TRUE(ByteSpan(extPanId).data_equal(ByteSpan(expectedExtPanId))); + + uint8_t meshLocalPrefix[Thread::kSizeMeshLocalPrefix]; + EXPECT_EQ(dataset.GetMeshLocalPrefix(meshLocalPrefix), CHIP_NO_ERROR); + const uint8_t expectedMeshLocalPrefix[] = { 0xfd, 0xf1, 0xf1, 0xad, 0xd0, 0x79, 0x7d, 0xc0 }; + EXPECT_TRUE(ByteSpan(meshLocalPrefix).data_equal(ByteSpan(expectedMeshLocalPrefix))); + + uint8_t masterKey[Thread::kSizeMasterKey]; + EXPECT_EQ(dataset.GetMasterKey(masterKey), CHIP_NO_ERROR); + const uint8_t expectedMasterKey[] = { 0xf3, 0x66, 0xce, 0xc7, 0xa4, 0x46, 0xba, 0xb9, + 0x78, 0xd9, 0x0d, 0x27, 0xab, 0xe3, 0x8f, 0x23 }; + EXPECT_TRUE(ByteSpan(masterKey).data_equal(ByteSpan(expectedMasterKey))); + + char networkName[Thread::kSizeNetworkName + 1]; + EXPECT_EQ(dataset.GetNetworkName(networkName), CHIP_NO_ERROR); + EXPECT_EQ(strncmp(networkName, "OpenThread-5938", sizeof(networkName)), 0); + + uint16_t panId; + EXPECT_EQ(dataset.GetPanId(panId), CHIP_NO_ERROR); + EXPECT_EQ(panId, 0x5938u); + + uint8_t pksc[Thread::kSizePSKc]; + EXPECT_EQ(dataset.GetPSKc(pksc), CHIP_NO_ERROR); + const uint8_t expectedPksc[] = { + 0x3c, 0xa6, 0x7c, 0x96, 0x9e, 0xfb, 0x0d, 0x0c, 0x74, 0xa4, 0xd8, 0xee, 0x92, 0x3b, 0x57, 0x6c + }; + EXPECT_TRUE(ByteSpan(pksc).data_equal(ByteSpan(expectedPksc))); + + ByteSpan channelMask; + EXPECT_EQ(dataset.GetChannelMask(channelMask), CHIP_NO_ERROR); + const uint8_t expectedChannelMask[] = { 0x07, 0xff, 0xf8, 0x00 }; + EXPECT_TRUE(channelMask.data_equal(ByteSpan(expectedChannelMask))); + + uint32_t securityPolicy; + EXPECT_EQ(dataset.GetSecurityPolicy(securityPolicy), CHIP_NO_ERROR); + EXPECT_EQ(securityPolicy, 0x02a0f7f8u); +} + +TEST_F(TestThreadOperationalDataset, TestInvalidExampleDataset) +{ + const uint8_t invalid[] = { + 0x0e, 0x01, 0x01, // Active Timestamp + 0x00, 0x01, 0x0f, // Channel + 0x35, 0x00, // Channel Mask + 0x02, 0x09, 0x39, 0x75, 0x8e, 0xc8, 0x14, 0x4b, 0x07, 0xfb, 0xff, // Ext PAN ID + 0x07, 0x01, 0x01, // Mesh Local Prefix + 0x05, 0x0f, 0xf3, 0x66, 0xce, 0xc7, 0xa4, 0x46, 0xba, 0xb9, 0x78, 0xd9, 0x0d, 0x27, 0xab, 0xe3, 0x8f, // Network Key + 0x03, 0x11, 0x4f, 0x70, 0x65, 0x6e, 0x54, 0x68, 0x72, 0x65, 0x61, 0x64, 0x2d, 0x35, 0x39, 0x33, 0x38, 0xff, 0xff, // Name + 0x01, 0x01, 0xff, // PAN ID + 0x04, 0x01, 0x3c, // PKSc + 0x0c, 0x01, 0x01, // Security Policy + }; + + // The overall TLV structure is valid, but all TLVs have invalid sizes + EXPECT_EQ(dataset.Init(ByteSpan(invalid)), CHIP_NO_ERROR); + + uint64_t activeTimestamp; + EXPECT_EQ(dataset.GetActiveTimestamp(activeTimestamp), CHIP_ERROR_INVALID_TLV_ELEMENT); + + uint16_t channel; + EXPECT_EQ(dataset.GetChannel(channel), CHIP_ERROR_INVALID_TLV_ELEMENT); + + ByteSpan extPanId; + EXPECT_EQ(dataset.GetExtendedPanIdAsByteSpan(extPanId), CHIP_ERROR_INVALID_TLV_ELEMENT); + + uint8_t meshLocalPrefix[Thread::kSizeMeshLocalPrefix]; + EXPECT_EQ(dataset.GetMeshLocalPrefix(meshLocalPrefix), CHIP_ERROR_INVALID_TLV_ELEMENT); + + uint8_t masterKey[Thread::kSizeMasterKey]; + EXPECT_EQ(dataset.GetMasterKey(masterKey), CHIP_ERROR_INVALID_TLV_ELEMENT); + + char networkName[Thread::kSizeNetworkName + 1]; + EXPECT_EQ(dataset.GetNetworkName(networkName), CHIP_ERROR_INVALID_TLV_ELEMENT); + + uint16_t panId; + EXPECT_EQ(dataset.GetPanId(panId), CHIP_ERROR_INVALID_TLV_ELEMENT); + + uint8_t pksc[Thread::kSizePSKc]; + EXPECT_EQ(dataset.GetPSKc(pksc), CHIP_ERROR_INVALID_TLV_ELEMENT); + + ByteSpan channelMask; + EXPECT_EQ(dataset.GetChannelMask(channelMask), CHIP_ERROR_INVALID_TLV_ELEMENT); + + uint32_t securityPolicy; + EXPECT_EQ(dataset.GetSecurityPolicy(securityPolicy), CHIP_ERROR_INVALID_TLV_ELEMENT); +} + } // namespace diff --git a/src/lib/support/tests/TestTimeUtils.cpp b/src/lib/support/tests/TestTimeUtils.cpp index 7d0a69709b8bc4..1b3140399e3c77 100644 --- a/src/lib/support/tests/TestTimeUtils.cpp +++ b/src/lib/support/tests/TestTimeUtils.cpp @@ -29,8 +29,9 @@ #include #include -#include +#include +#include #include #include diff --git a/src/lib/support/tests/TestTlvJson.cpp b/src/lib/support/tests/TestTlvJson.cpp index 83b538dad4a755..a845f5fd08be58 100644 --- a/src/lib/support/tests/TestTlvJson.cpp +++ b/src/lib/support/tests/TestTlvJson.cpp @@ -15,11 +15,12 @@ * limitations under the License. */ -#include +#include #include #include #include +#include #include #include #include diff --git a/src/lib/support/tests/TestTlvToJson.cpp b/src/lib/support/tests/TestTlvToJson.cpp index b313b843616671..4fd807303c251a 100644 --- a/src/lib/support/tests/TestTlvToJson.cpp +++ b/src/lib/support/tests/TestTlvToJson.cpp @@ -17,11 +17,12 @@ #include -#include +#include #include #include #include +#include #include #include #include diff --git a/src/lib/support/tests/TestUtf8.cpp b/src/lib/support/tests/TestUtf8.cpp index dd078804c1ed5d..1a1062630c2ac5 100644 --- a/src/lib/support/tests/TestUtf8.cpp +++ b/src/lib/support/tests/TestUtf8.cpp @@ -17,10 +17,12 @@ * limitations under the License. */ -#include - #include -#include + +#include + +#include +#include namespace { diff --git a/src/lib/support/tests/TestVariant.cpp b/src/lib/support/tests/TestVariant.cpp index cd51d252dd3a0c..cc8e3031306e73 100644 --- a/src/lib/support/tests/TestVariant.cpp +++ b/src/lib/support/tests/TestVariant.cpp @@ -18,8 +18,9 @@ #include -#include +#include +#include #include namespace { diff --git a/src/lib/support/tests/TestZclString.cpp b/src/lib/support/tests/TestZclString.cpp index 13174248af62d7..cecede7fdf53e5 100644 --- a/src/lib/support/tests/TestZclString.cpp +++ b/src/lib/support/tests/TestZclString.cpp @@ -26,8 +26,9 @@ #include #include -#include +#include +#include #include #include #include diff --git a/src/messaging/ExchangeMgr.cpp b/src/messaging/ExchangeMgr.cpp index bf92fa22f54985..0e41593b08afea 100644 --- a/src/messaging/ExchangeMgr.cpp +++ b/src/messaging/ExchangeMgr.cpp @@ -215,16 +215,23 @@ void ExchangeManager::OnMessageReceived(const PacketHeader & packetHeader, const } } + // Work around pigweed not allowing more than 14 format args in a log + // message when using tokenized logs. + char typeStr[4 + 1 + 2 + 1]; + snprintf(typeStr, sizeof(typeStr), "%04X:%02X", payloadHeader.GetProtocolID().GetProtocolId(), payloadHeader.GetMessageType()); + // // Legend that can be used to decode this log line can be found in README.md // - ChipLogProgress(ExchangeManager, - ">>> [E:" ChipLogFormatExchangeId " S:%u M:" ChipLogFormatMessageCounter - "%s] (%s) Msg RX from %u:" ChipLogFormatX64 " [%04X] --- Type %04x:%02x (%s:%s)", - ChipLogValueExchangeIdFromReceivedHeader(payloadHeader), session->SessionIdForLogging(), - packetHeader.GetMessageCounter(), ackBuf, Transport::GetSessionTypeString(session), session->GetFabricIndex(), - ChipLogValueX64(session->GetPeer().GetNodeId()), static_cast(compressedFabricId), - payloadHeader.GetProtocolID().GetProtocolId(), payloadHeader.GetMessageType(), protocolName, msgTypeName); + ChipLogProgress( + ExchangeManager, + ">>> [E:" ChipLogFormatExchangeId " S:%u M:" ChipLogFormatMessageCounter "%s] (%s) Msg RX from %u:" ChipLogFormatX64 + " [%04X] --- Type %s (%s:%s) (B:%u)", + ChipLogValueExchangeIdFromReceivedHeader(payloadHeader), session->SessionIdForLogging(), packetHeader.GetMessageCounter(), + ackBuf, Transport::GetSessionTypeString(session), session->GetFabricIndex(), + ChipLogValueX64(session->GetPeer().GetNodeId()), static_cast(compressedFabricId), typeStr, protocolName, + msgTypeName, + static_cast(msgBuf->TotalLength() + packetHeader.EncodeSizeBytes() + payloadHeader.EncodeSizeBytes())); #endif MessageFlags msgFlags; diff --git a/src/messaging/README.md b/src/messaging/README.md index bfb379e22aa49c..b439a45de6b840 100644 --- a/src/messaging/README.md +++ b/src/messaging/README.md @@ -16,7 +16,7 @@ will be expanded are denoted with `$` . Unless specified, numerical values are represented in decimal notation. ``` -<<< [E:$exchange_id S:$session_id M:$msg_id (Ack: $ack_msg_id)] ($msg_category) Msg TX to $fabric_index:$destination [$compressed_fabric_id] [$peer_address] --- Type $protocol_id:$msg_type ($protocol_name:$msg_type_name) +<<< [E:$exchange_id S:$session_id M:$msg_id (Ack: $ack_msg_id)] ($msg_category) Msg TX to $fabric_index:$destination [$compressed_fabric_id] [$peer_address] --- Type $protocol_id:$msg_type ($protocol_name:$msg_type_name) (B:$size) ``` | Field | Description | @@ -34,6 +34,7 @@ Unless specified, numerical values are represented in decimal notation. | msg_type | 8-bit message type ID (in hex) | | protocol_name | If available, a logical name for the protocol | | msg_type_name | If available, a logical name for the message type | +| size | Size, in bytes, of the message being transmitted. Includes the Matter payload header and packet header but not transport headers | #### Examples: @@ -65,7 +66,7 @@ will be expanded are denoted with `$` . Unless specified, numerical values are represented in decimal notation. ``` ->>> [E:$exchange_id M: $msg_id (Ack: $ack_msg_id)] ($msg_category) Msg RX from $fabric_index:$source [$compressed_fabric_id] --- Type $protocol_id:$msg_type ($protocol_name:$msg_type_name) +>>> [E:$exchange_id M: $msg_id (Ack: $ack_msg_id)] ($msg_category) Msg RX from $fabric_index:$source [$compressed_fabric_id] --- Type $protocol_id:$msg_type ($protocol_name:$msg_type_name) (B:$size) ``` This has a similar legend to that for transmission except `$source` denotes the diff --git a/src/messaging/tests/BUILD.gn b/src/messaging/tests/BUILD.gn index 3232796aabe7e1..24e3f47e6806ae 100644 --- a/src/messaging/tests/BUILD.gn +++ b/src/messaging/tests/BUILD.gn @@ -32,6 +32,7 @@ static_library("helpers") { deps = [ "${chip_root}/src/credentials/tests:cert_test_vectors", "${chip_root}/src/lib/support:testing", + "${chip_root}/src/lib/support/tests:pw-test-macros", "${chip_root}/src/messaging", "${chip_root}/src/protocols", "${chip_root}/src/transport", @@ -64,6 +65,7 @@ chip_test_suite("tests") { ":helpers", "${chip_root}/src/inet/tests:helpers", "${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/messaging", diff --git a/src/messaging/tests/MessagingContext.cpp b/src/messaging/tests/MessagingContext.cpp index 909bc90f443575..c390f99096bb03 100644 --- a/src/messaging/tests/MessagingContext.cpp +++ b/src/messaging/tests/MessagingContext.cpp @@ -31,34 +31,34 @@ using namespace TestCerts; CHIP_ERROR MessagingContext::Init(TransportMgrBase * transport, IOContext * ioContext) { - VerifyOrReturnError(mInitialized == false, CHIP_ERROR_INTERNAL); - mInitialized = true; + VerifyOrReturnError(mpData->mInitialized == false, CHIP_ERROR_INTERNAL); + mpData->mInitialized = true; - mIOContext = ioContext; - mTransport = transport; + mpData->mIOContext = ioContext; + mpData->mTransport = transport; ReturnErrorOnFailure(PlatformMemoryUser::Init()); // Make sure the storage is clean, so we will not reuse any stale data. - mStorage.ClearStorage(); + mpData->mStorage.ClearStorage(); - ReturnErrorOnFailure(mOpKeyStore.Init(&mStorage)); - ReturnErrorOnFailure(mOpCertStore.Init(&mStorage)); + ReturnErrorOnFailure(mpData->mOpKeyStore.Init(&mpData->mStorage)); + ReturnErrorOnFailure(mpData->mOpCertStore.Init(&mpData->mStorage)); chip::FabricTable::InitParams initParams; - initParams.storage = &mStorage; - initParams.operationalKeystore = &mOpKeyStore; - initParams.opCertStore = &mOpCertStore; + initParams.storage = &mpData->mStorage; + initParams.operationalKeystore = &mpData->mOpKeyStore; + initParams.opCertStore = &mpData->mOpCertStore; - ReturnErrorOnFailure(mFabricTable.Init(initParams)); + ReturnErrorOnFailure(mpData->mFabricTable.Init(initParams)); - ReturnErrorOnFailure( - mSessionManager.Init(&GetSystemLayer(), transport, &mMessageCounterManager, &mStorage, &mFabricTable, mSessionKeystore)); + ReturnErrorOnFailure(mpData->mSessionManager.Init(&GetSystemLayer(), transport, &mpData->mMessageCounterManager, + &mpData->mStorage, &mpData->mFabricTable, mpData->mSessionKeystore)); - ReturnErrorOnFailure(mExchangeManager.Init(&mSessionManager)); - ReturnErrorOnFailure(mMessageCounterManager.Init(&mExchangeManager)); + ReturnErrorOnFailure(mpData->mExchangeManager.Init(&mpData->mSessionManager)); + ReturnErrorOnFailure(mpData->mMessageCounterManager.Init(&mpData->mExchangeManager)); - if (mInitializeNodes) + if (mpData->mInitializeNodes) { ReturnErrorOnFailure(CreateAliceFabric()); ReturnErrorOnFailure(CreateBobFabric()); @@ -80,15 +80,15 @@ CHIP_ERROR MessagingContext::Init(TransportMgrBase * transport, IOContext * ioCo // Shutdown all layers, finalize operations void MessagingContext::Shutdown() { - VerifyOrDie(mInitialized); - mInitialized = false; + VerifyOrDie(mpData->mInitialized); + mpData->mInitialized = false; - mMessageCounterManager.Shutdown(); - mExchangeManager.Shutdown(); - mSessionManager.Shutdown(); - mFabricTable.Shutdown(); - mOpCertStore.Finish(); - mOpKeyStore.Finish(); + mpData->mMessageCounterManager.Shutdown(); + mpData->mExchangeManager.Shutdown(); + mpData->mSessionManager.Shutdown(); + mpData->mFabricTable.Shutdown(); + mpData->mOpCertStore.Finish(); + mpData->mOpKeyStore.Finish(); // Reset the default additional MRP backoff. Messaging::ReliableMessageMgr::SetAdditionalMRPBackoffTime(NullOptional); @@ -96,7 +96,7 @@ void MessagingContext::Shutdown() CHIP_ERROR MessagingContext::InitFromExisting(const MessagingContext & existing) { - return Init(existing.mTransport, existing.mIOContext); + return Init(existing.mpData->mTransport, existing.mpData->mIOContext); } void MessagingContext::ShutdownAndRestoreExisting(MessagingContext & existing) @@ -104,7 +104,7 @@ void MessagingContext::ShutdownAndRestoreExisting(MessagingContext & existing) Shutdown(); // Point the transport back to the original session manager, since we had // pointed it to ours. - existing.mTransport->SetSessionManager(&existing.GetSecureSessionManager()); + existing.mpData->mTransport->SetSessionManager(&existing.GetSecureSessionManager()); } using namespace System::Clock::Literals; @@ -116,10 +116,10 @@ void MessagingContext::SetMRPMode(MRPMode mode) { if (mode == MRPMode::kDefault) { - mSessionBobToAlice->AsSecureSession()->SetRemoteSessionParameters(GetDefaultMRPConfig()); - mSessionAliceToBob->AsSecureSession()->SetRemoteSessionParameters(GetDefaultMRPConfig()); - mSessionCharlieToDavid->AsSecureSession()->SetRemoteSessionParameters(GetDefaultMRPConfig()); - mSessionDavidToCharlie->AsSecureSession()->SetRemoteSessionParameters(GetDefaultMRPConfig()); + mpData->mSessionBobToAlice->AsSecureSession()->SetRemoteSessionParameters(GetDefaultMRPConfig()); + mpData->mSessionAliceToBob->AsSecureSession()->SetRemoteSessionParameters(GetDefaultMRPConfig()); + mpData->mSessionCharlieToDavid->AsSecureSession()->SetRemoteSessionParameters(GetDefaultMRPConfig()); + mpData->mSessionDavidToCharlie->AsSecureSession()->SetRemoteSessionParameters(GetDefaultMRPConfig()); #if CONFIG_BUILD_FOR_HOST_UNIT_TEST ClearLocalMRPConfigOverride(); @@ -143,168 +143,174 @@ void MessagingContext::SetMRPMode(MRPMode mode) VerifyOrDie(false); #endif - mSessionBobToAlice->AsSecureSession()->SetRemoteSessionParameters(ReliableMessageProtocolConfig( + mpData->mSessionBobToAlice->AsSecureSession()->SetRemoteSessionParameters(ReliableMessageProtocolConfig( MessagingContext::kResponsiveIdleRetransTimeout, MessagingContext::kResponsiveActiveRetransTimeout)); - mSessionAliceToBob->AsSecureSession()->SetRemoteSessionParameters(ReliableMessageProtocolConfig( + mpData->mSessionAliceToBob->AsSecureSession()->SetRemoteSessionParameters(ReliableMessageProtocolConfig( MessagingContext::kResponsiveIdleRetransTimeout, MessagingContext::kResponsiveActiveRetransTimeout)); - mSessionCharlieToDavid->AsSecureSession()->SetRemoteSessionParameters(ReliableMessageProtocolConfig( + mpData->mSessionCharlieToDavid->AsSecureSession()->SetRemoteSessionParameters(ReliableMessageProtocolConfig( MessagingContext::kResponsiveIdleRetransTimeout, MessagingContext::kResponsiveActiveRetransTimeout)); - mSessionDavidToCharlie->AsSecureSession()->SetRemoteSessionParameters(ReliableMessageProtocolConfig( + mpData->mSessionDavidToCharlie->AsSecureSession()->SetRemoteSessionParameters(ReliableMessageProtocolConfig( MessagingContext::kResponsiveIdleRetransTimeout, MessagingContext::kResponsiveActiveRetransTimeout)); } } CHIP_ERROR MessagingContext::CreateAliceFabric() { - return mFabricTable.AddNewFabricForTestIgnoringCollisions(GetRootACertAsset().mCert, GetIAA1CertAsset().mCert, - GetNodeA1CertAsset().mCert, GetNodeA1CertAsset().mKey, - &mAliceFabricIndex); + return mpData->mFabricTable.AddNewFabricForTestIgnoringCollisions(GetRootACertAsset().mCert, GetIAA1CertAsset().mCert, + GetNodeA1CertAsset().mCert, GetNodeA1CertAsset().mKey, + &mpData->mAliceFabricIndex); } CHIP_ERROR MessagingContext::CreateBobFabric() { - return mFabricTable.AddNewFabricForTestIgnoringCollisions(GetRootACertAsset().mCert, GetIAA1CertAsset().mCert, - GetNodeA2CertAsset().mCert, GetNodeA2CertAsset().mKey, - &mBobFabricIndex); + return mpData->mFabricTable.AddNewFabricForTestIgnoringCollisions(GetRootACertAsset().mCert, GetIAA1CertAsset().mCert, + GetNodeA2CertAsset().mCert, GetNodeA2CertAsset().mKey, + &mpData->mBobFabricIndex); } CHIP_ERROR MessagingContext::CreateSessionBobToAlice() { - return mSessionManager.InjectPaseSessionWithTestKey(mSessionBobToAlice, kBobKeyId, GetAliceFabric()->GetNodeId(), kAliceKeyId, - mBobFabricIndex, mAliceAddress, CryptoContext::SessionRole::kInitiator); + return mpData->mSessionManager.InjectPaseSessionWithTestKey(mpData->mSessionBobToAlice, kBobKeyId, + GetAliceFabric()->GetNodeId(), kAliceKeyId, mpData->mBobFabricIndex, + mpData->mAliceAddress, CryptoContext::SessionRole::kInitiator); } CHIP_ERROR MessagingContext::CreateCASESessionBobToAlice() { - return mSessionManager.InjectCaseSessionWithTestKey(mSessionBobToAlice, kBobKeyId, kAliceKeyId, GetBobFabric()->GetNodeId(), - GetAliceFabric()->GetNodeId(), mBobFabricIndex, mAliceAddress, - CryptoContext::SessionRole::kInitiator); + return mpData->mSessionManager.InjectCaseSessionWithTestKey( + mpData->mSessionBobToAlice, kBobKeyId, kAliceKeyId, GetBobFabric()->GetNodeId(), GetAliceFabric()->GetNodeId(), + mpData->mBobFabricIndex, mpData->mAliceAddress, CryptoContext::SessionRole::kInitiator); } CHIP_ERROR MessagingContext::CreateCASESessionBobToAlice(const CATValues & cats) { - return mSessionManager.InjectCaseSessionWithTestKey(mSessionBobToAlice, kBobKeyId, kAliceKeyId, GetBobFabric()->GetNodeId(), - GetAliceFabric()->GetNodeId(), mBobFabricIndex, mAliceAddress, - CryptoContext::SessionRole::kInitiator, cats); + return mpData->mSessionManager.InjectCaseSessionWithTestKey( + mpData->mSessionBobToAlice, kBobKeyId, kAliceKeyId, GetBobFabric()->GetNodeId(), GetAliceFabric()->GetNodeId(), + mpData->mBobFabricIndex, mpData->mAliceAddress, CryptoContext::SessionRole::kInitiator, cats); } CHIP_ERROR MessagingContext::CreateSessionAliceToBob() { - return mSessionManager.InjectPaseSessionWithTestKey(mSessionAliceToBob, kAliceKeyId, GetBobFabric()->GetNodeId(), kBobKeyId, - mAliceFabricIndex, mBobAddress, CryptoContext::SessionRole::kResponder); + return mpData->mSessionManager.InjectPaseSessionWithTestKey(mpData->mSessionAliceToBob, kAliceKeyId, + GetBobFabric()->GetNodeId(), kBobKeyId, mpData->mAliceFabricIndex, + mpData->mBobAddress, CryptoContext::SessionRole::kResponder); } CHIP_ERROR MessagingContext::CreateCASESessionAliceToBob() { - return mSessionManager.InjectCaseSessionWithTestKey(mSessionAliceToBob, kAliceKeyId, kBobKeyId, GetAliceFabric()->GetNodeId(), - GetBobFabric()->GetNodeId(), mAliceFabricIndex, mBobAddress, - CryptoContext::SessionRole::kResponder); + return mpData->mSessionManager.InjectCaseSessionWithTestKey( + mpData->mSessionAliceToBob, kAliceKeyId, kBobKeyId, GetAliceFabric()->GetNodeId(), GetBobFabric()->GetNodeId(), + mpData->mAliceFabricIndex, mpData->mBobAddress, CryptoContext::SessionRole::kResponder); } CHIP_ERROR MessagingContext::CreateCASESessionAliceToBob(const CATValues & cats) { - return mSessionManager.InjectCaseSessionWithTestKey(mSessionAliceToBob, kAliceKeyId, kBobKeyId, GetAliceFabric()->GetNodeId(), - GetBobFabric()->GetNodeId(), mAliceFabricIndex, mBobAddress, - CryptoContext::SessionRole::kResponder, cats); + return mpData->mSessionManager.InjectCaseSessionWithTestKey( + mpData->mSessionAliceToBob, kAliceKeyId, kBobKeyId, GetAliceFabric()->GetNodeId(), GetBobFabric()->GetNodeId(), + mpData->mAliceFabricIndex, mpData->mBobAddress, CryptoContext::SessionRole::kResponder, cats); } CHIP_ERROR MessagingContext::CreatePASESessionCharlieToDavid() { - return mSessionManager.InjectPaseSessionWithTestKey(mSessionCharlieToDavid, kCharlieKeyId, 0xdeadbeef, kDavidKeyId, - kUndefinedFabricIndex, mDavidAddress, - CryptoContext::SessionRole::kInitiator); + return mpData->mSessionManager.InjectPaseSessionWithTestKey(mpData->mSessionCharlieToDavid, kCharlieKeyId, 0xdeadbeef, + kDavidKeyId, kUndefinedFabricIndex, mpData->mDavidAddress, + CryptoContext::SessionRole::kInitiator); } CHIP_ERROR MessagingContext::CreatePASESessionDavidToCharlie() { - return mSessionManager.InjectPaseSessionWithTestKey(mSessionDavidToCharlie, kDavidKeyId, 0xcafe, kCharlieKeyId, - kUndefinedFabricIndex, mCharlieAddress, - CryptoContext::SessionRole::kResponder); + return mpData->mSessionManager.InjectPaseSessionWithTestKey(mpData->mSessionDavidToCharlie, kDavidKeyId, 0xcafe, kCharlieKeyId, + kUndefinedFabricIndex, mpData->mCharlieAddress, + CryptoContext::SessionRole::kResponder); } CHIP_ERROR MessagingContext::CreateSessionBobToFriends() { - mSessionBobToFriends.Emplace(GetFriendsGroupId(), mBobFabricIndex); + mpData->mSessionBobToFriends.Emplace(GetFriendsGroupId(), mpData->mBobFabricIndex); return CHIP_NO_ERROR; } SessionHandle MessagingContext::GetSessionBobToAlice() { - auto sessionHandle = mSessionBobToAlice.Get(); + auto sessionHandle = mpData->mSessionBobToAlice.Get(); return std::move(sessionHandle.Value()); } SessionHandle MessagingContext::GetSessionAliceToBob() { - auto sessionHandle = mSessionAliceToBob.Get(); + auto sessionHandle = mpData->mSessionAliceToBob.Get(); return std::move(sessionHandle.Value()); } SessionHandle MessagingContext::GetSessionCharlieToDavid() { - auto sessionHandle = mSessionCharlieToDavid.Get(); + auto sessionHandle = mpData->mSessionCharlieToDavid.Get(); return std::move(sessionHandle.Value()); } SessionHandle MessagingContext::GetSessionDavidToCharlie() { - auto sessionHandle = mSessionDavidToCharlie.Get(); + auto sessionHandle = mpData->mSessionDavidToCharlie.Get(); return std::move(sessionHandle.Value()); } SessionHandle MessagingContext::GetSessionBobToFriends() { - return SessionHandle(mSessionBobToFriends.Value()); + return SessionHandle(mpData->mSessionBobToFriends.Value()); } void MessagingContext::ExpireSessionBobToAlice() { - if (mSessionBobToAlice) + if (mpData->mSessionBobToAlice) { - mSessionBobToAlice.Get().Value()->AsSecureSession()->MarkForEviction(); + mpData->mSessionBobToAlice.Get().Value()->AsSecureSession()->MarkForEviction(); } } void MessagingContext::ExpireSessionAliceToBob() { - if (mSessionAliceToBob) + if (mpData->mSessionAliceToBob) { - mSessionAliceToBob.Get().Value()->AsSecureSession()->MarkForEviction(); + mpData->mSessionAliceToBob.Get().Value()->AsSecureSession()->MarkForEviction(); } } void MessagingContext::ExpireSessionBobToFriends() { - mSessionBobToFriends.ClearValue(); + mpData->mSessionBobToFriends.ClearValue(); } Messaging::ExchangeContext * MessagingContext::NewUnauthenticatedExchangeToAlice(Messaging::ExchangeDelegate * delegate) { - return mExchangeManager.NewContext( - mSessionManager.CreateUnauthenticatedSession(mAliceAddress, GetLocalMRPConfig().ValueOr(GetDefaultMRPConfig())).Value(), + return mpData->mExchangeManager.NewContext( + mpData->mSessionManager + .CreateUnauthenticatedSession(mpData->mAliceAddress, GetLocalMRPConfig().ValueOr(GetDefaultMRPConfig())) + .Value(), delegate); } Messaging::ExchangeContext * MessagingContext::NewUnauthenticatedExchangeToBob(Messaging::ExchangeDelegate * delegate) { - return mExchangeManager.NewContext( - mSessionManager.CreateUnauthenticatedSession(mBobAddress, GetLocalMRPConfig().ValueOr(GetDefaultMRPConfig())).Value(), + return mpData->mExchangeManager.NewContext( + mpData->mSessionManager + .CreateUnauthenticatedSession(mpData->mBobAddress, GetLocalMRPConfig().ValueOr(GetDefaultMRPConfig())) + .Value(), delegate); } Messaging::ExchangeContext * MessagingContext::NewExchangeToAlice(Messaging::ExchangeDelegate * delegate, bool isInitiator) { - return mExchangeManager.NewContext(GetSessionBobToAlice(), delegate, isInitiator); + return mpData->mExchangeManager.NewContext(GetSessionBobToAlice(), delegate, isInitiator); } Messaging::ExchangeContext * MessagingContext::NewExchangeToBob(Messaging::ExchangeDelegate * delegate, bool isInitiator) { - return mExchangeManager.NewContext(GetSessionAliceToBob(), delegate, isInitiator); + return mpData->mExchangeManager.NewContext(GetSessionAliceToBob(), delegate, isInitiator); } -LoopbackTransportManager LoopbackMessagingContext::sLoopbackTransportManager; +LoopbackTransportManager * LoopbackMessagingContext::spLoopbackTransportManager = nullptr; -UDPTransportManager UDPMessagingContext::sUDPTransportManager; +UDPTransportManager * UDPMessagingContext::spUDPTransportManager = nullptr; void MessageCapturer::OnMessageReceived(const PacketHeader & packetHeader, const PayloadHeader & payloadHeader, const SessionHandle & session, DuplicateMessage isDuplicate, diff --git a/src/messaging/tests/MessagingContext.h b/src/messaging/tests/MessagingContext.h index f0e950a2cfc2a9..2b3058a8771515 100644 --- a/src/messaging/tests/MessagingContext.h +++ b/src/messaging/tests/MessagingContext.h @@ -16,6 +16,8 @@ */ #pragma once +#include + #include #include #include @@ -92,16 +94,10 @@ class MessagingContext : public PlatformMemoryUser static constexpr System::Clock::Timeout kResponsiveIdleRetransTimeout = System::Clock::Milliseconds32(10); static constexpr System::Clock::Timeout kResponsiveActiveRetransTimeout = System::Clock::Milliseconds32(10); - MessagingContext() : - mInitialized(false), mAliceAddress(Transport::PeerAddress::UDP(GetAddress(), CHIP_PORT + 1)), - mBobAddress(LoopbackTransport::LoopbackPeer(mAliceAddress)) - {} - // TODO Replace VerifyOrDie with Pigweed assert after transition app/tests to Pigweed. - // TODO Currently src/app/icd/server/tests is using MessagingConetext as dependency. - ~MessagingContext() { VerifyOrDie(mInitialized == false); } + MessagingContext() : mpData(std::make_unique()) {} // Whether Alice and Bob are initialized, must be called before Init - void ConfigInitializeNodes(bool initializeNodes) { mInitializeNodes = initializeNodes; } + void ConfigInitializeNodes(bool initializeNodes) { mpData->mInitializeNodes = initializeNodes; } /// Initialize the underlying layers and test suite pointer CHIP_ERROR Init(TransportMgrBase * transport, IOContext * io); @@ -128,18 +124,18 @@ class MessagingContext : public PlatformMemoryUser static const uint16_t kAliceKeyId = 2; static const uint16_t kCharlieKeyId = 3; static const uint16_t kDavidKeyId = 4; - GroupId GetFriendsGroupId() const { return mFriendsGroupId; } + GroupId GetFriendsGroupId() const { return mpData->mFriendsGroupId; } - SessionManager & GetSecureSessionManager() { return mSessionManager; } - Messaging::ExchangeManager & GetExchangeManager() { return mExchangeManager; } - secure_channel::MessageCounterManager & GetMessageCounterManager() { return mMessageCounterManager; } - FabricTable & GetFabricTable() { return mFabricTable; } - Crypto::DefaultSessionKeystore & GetSessionKeystore() { return mSessionKeystore; } + SessionManager & GetSecureSessionManager() { return mpData->mSessionManager; } + Messaging::ExchangeManager & GetExchangeManager() { return mpData->mExchangeManager; } + secure_channel::MessageCounterManager & GetMessageCounterManager() { return mpData->mMessageCounterManager; } + FabricTable & GetFabricTable() { return mpData->mFabricTable; } + Crypto::DefaultSessionKeystore & GetSessionKeystore() { return mpData->mSessionKeystore; } - FabricIndex GetAliceFabricIndex() { return mAliceFabricIndex; } - FabricIndex GetBobFabricIndex() { return mBobFabricIndex; } - const FabricInfo * GetAliceFabric() { return mFabricTable.FindFabricWithIndex(mAliceFabricIndex); } - const FabricInfo * GetBobFabric() { return mFabricTable.FindFabricWithIndex(mBobFabricIndex); } + FabricIndex GetAliceFabricIndex() { return mpData->mAliceFabricIndex; } + FabricIndex GetBobFabricIndex() { return mpData->mBobFabricIndex; } + const FabricInfo * GetAliceFabric() { return mpData->mFabricTable.FindFabricWithIndex(mpData->mAliceFabricIndex); } + const FabricInfo * GetBobFabric() { return mpData->mFabricTable.FindFabricWithIndex(mpData->mBobFabricIndex); } CHIP_ERROR CreateSessionBobToAlice(); // Creates PASE session CHIP_ERROR CreateCASESessionBobToAlice(); @@ -166,8 +162,8 @@ class MessagingContext : public PlatformMemoryUser CHIP_ERROR CreateAliceFabric(); CHIP_ERROR CreateBobFabric(); - const Transport::PeerAddress & GetAliceAddress() { return mAliceAddress; } - const Transport::PeerAddress & GetBobAddress() { return mBobAddress; } + const Transport::PeerAddress & GetAliceAddress() { return mpData->mAliceAddress; } + const Transport::PeerAddress & GetBobAddress() { return mpData->mBobAddress; } Messaging::ExchangeContext * NewUnauthenticatedExchangeToAlice(Messaging::ExchangeDelegate * delegate); Messaging::ExchangeContext * NewUnauthenticatedExchangeToBob(Messaging::ExchangeDelegate * delegate); @@ -175,126 +171,149 @@ class MessagingContext : public PlatformMemoryUser Messaging::ExchangeContext * NewExchangeToAlice(Messaging::ExchangeDelegate * delegate, bool isInitiator = true); Messaging::ExchangeContext * NewExchangeToBob(Messaging::ExchangeDelegate * delegate, bool isInitiator = true); - System::Layer & GetSystemLayer() { return mIOContext->GetSystemLayer(); } + System::Layer & GetSystemLayer() { return mpData->mIOContext->GetSystemLayer(); } private: - bool mInitializeNodes = true; - bool mInitialized; - FabricTable mFabricTable; - - SessionManager mSessionManager; - Messaging::ExchangeManager mExchangeManager; - secure_channel::MessageCounterManager mMessageCounterManager; - IOContext * mIOContext; - TransportMgrBase * mTransport; // Only needed for InitFromExisting. - chip::TestPersistentStorageDelegate mStorage; // for SessionManagerInit - chip::PersistentStorageOperationalKeystore mOpKeyStore; - chip::Credentials::PersistentStorageOpCertStore mOpCertStore; - chip::Crypto::DefaultSessionKeystore mSessionKeystore; - - FabricIndex mAliceFabricIndex = kUndefinedFabricIndex; - FabricIndex mBobFabricIndex = kUndefinedFabricIndex; - GroupId mFriendsGroupId = 0x0101; - Transport::PeerAddress mAliceAddress; - Transport::PeerAddress mBobAddress; - Transport::PeerAddress mCharlieAddress; - Transport::PeerAddress mDavidAddress; - SessionHolder mSessionAliceToBob; - SessionHolder mSessionBobToAlice; - SessionHolder mSessionCharlieToDavid; - SessionHolder mSessionDavidToCharlie; - Optional mSessionBobToFriends; + // These members are encapsulated in a struct which is allocated upon construction of MessagingContext and freed upon + // destruction of MessagingContext. This is done to save stack space. + struct MessagingContextData + { + MessagingContextData() : + mAliceAddress(Transport::PeerAddress::UDP(GetAddress(), CHIP_PORT + 1)), + mBobAddress(LoopbackTransport::LoopbackPeer(mAliceAddress)) + {} + ~MessagingContextData() { EXPECT_FALSE(mInitialized); } + + bool mInitializeNodes = true; + bool mInitialized = false; + FabricTable mFabricTable; + + SessionManager mSessionManager; + Messaging::ExchangeManager mExchangeManager; + secure_channel::MessageCounterManager mMessageCounterManager; + IOContext * mIOContext = nullptr; + TransportMgrBase * mTransport = nullptr; // Only needed for InitFromExisting. + chip::TestPersistentStorageDelegate mStorage; // for SessionManagerInit + chip::PersistentStorageOperationalKeystore mOpKeyStore; + chip::Credentials::PersistentStorageOpCertStore mOpCertStore; + chip::Crypto::DefaultSessionKeystore mSessionKeystore; + + FabricIndex mAliceFabricIndex = kUndefinedFabricIndex; + FabricIndex mBobFabricIndex = kUndefinedFabricIndex; + GroupId mFriendsGroupId = 0x0101; + Transport::PeerAddress mAliceAddress; + Transport::PeerAddress mBobAddress; + Transport::PeerAddress mCharlieAddress; + Transport::PeerAddress mDavidAddress; + SessionHolder mSessionAliceToBob; + SessionHolder mSessionBobToAlice; + SessionHolder mSessionCharlieToDavid; + SessionHolder mSessionDavidToCharlie; + Optional mSessionBobToFriends; + }; + std::unique_ptr mpData; }; // LoopbackMessagingContext enriches MessagingContext with an async loopback transport -class LoopbackMessagingContext : public MessagingContext +class LoopbackMessagingContext : public ::testing::Test, public MessagingContext { public: virtual ~LoopbackMessagingContext() {} - // These functions wrap sLoopbackTransportManager methods - static auto & GetSystemLayer() { return sLoopbackTransportManager.GetSystemLayer(); } - static auto & GetLoopback() { return sLoopbackTransportManager.GetLoopback(); } - static auto & GetTransportMgr() { return sLoopbackTransportManager.GetTransportMgr(); } - static auto & GetIOContext() { return sLoopbackTransportManager.GetIOContext(); } + // 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 sLoopbackTransportManager.DrainAndServiceIO(args...); + return spLoopbackTransportManager->DrainAndServiceIO(args...); } // Performs shared setup for all tests in the test suite static void SetUpTestSuite() { - CHIP_ERROR err = CHIP_NO_ERROR; - // TODO: use ASSERT_EQ, once transition to pw_unit_test is complete - VerifyOrDieWithMsg((err = chip::Platform::MemoryInit()) == CHIP_NO_ERROR, AppServer, - "Init CHIP memory failed: %" CHIP_ERROR_FORMAT, err.Format()); - VerifyOrDieWithMsg((err = sLoopbackTransportManager.Init()) == CHIP_NO_ERROR, AppServer, - "Init LoopbackTransportManager failed: %" CHIP_ERROR_FORMAT, err.Format()); + // Initialize memory. + ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); + // Instantiate the LoopbackTransportManager. + ASSERT_EQ(spLoopbackTransportManager, nullptr); + spLoopbackTransportManager = new 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() { - sLoopbackTransportManager.Shutdown(); + // 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 - virtual void SetUp() - { - CHIP_ERROR err = CHIP_NO_ERROR; - VerifyOrDieWithMsg((err = MessagingContext::Init(&GetTransportMgr(), &GetIOContext())) == CHIP_NO_ERROR, AppServer, - "Init MessagingContext failed: %" CHIP_ERROR_FORMAT, err.Format()); - } + virtual void SetUp() { ASSERT_EQ(MessagingContext::Init(&GetTransportMgr(), &GetIOContext()), CHIP_NO_ERROR); } // Performs teardown for each individual test in the test suite virtual void TearDown() { MessagingContext::Shutdown(); } - static LoopbackTransportManager sLoopbackTransportManager; + static LoopbackTransportManager * spLoopbackTransportManager; }; // UDPMessagingContext enriches MessagingContext with an UDP transport -class UDPMessagingContext : public MessagingContext +class UDPMessagingContext : public ::testing::Test, public MessagingContext { public: virtual ~UDPMessagingContext() {} - static auto & GetSystemLayer() { return sUDPTransportManager.GetSystemLayer(); } - static auto & GetTransportMgr() { return sUDPTransportManager.GetTransportMgr(); } - static auto & GetIOContext() { return sUDPTransportManager.GetIOContext(); } + static auto & GetSystemLayer() { return spUDPTransportManager->GetSystemLayer(); } + static auto & GetTransportMgr() { return spUDPTransportManager->GetTransportMgr(); } + static auto & GetIOContext() { return spUDPTransportManager->GetIOContext(); } // Performs shared setup for all tests in the test suite static void SetUpTestSuite() { - CHIP_ERROR err = CHIP_NO_ERROR; - VerifyOrDieWithMsg((err = chip::Platform::MemoryInit()) == CHIP_NO_ERROR, AppServer, - "Init CHIP memory failed: %" CHIP_ERROR_FORMAT, err.Format()); - VerifyOrDieWithMsg((err = sUDPTransportManager.Init()) == CHIP_NO_ERROR, AppServer, - "Init UDPTransportManager failed: %" CHIP_ERROR_FORMAT, err.Format()); + // Initialize memory. + ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); + // Instantiate the UDPTransportManager. + ASSERT_EQ(spUDPTransportManager, nullptr); + spUDPTransportManager = new UDPTransportManager(); + ASSERT_NE(spUDPTransportManager, nullptr); + // Initialize the UDPTransportManager. + ASSERT_EQ(spUDPTransportManager->Init(), CHIP_NO_ERROR); } // Performs shared teardown for all tests in the test suite static void TearDownTestSuite() { - sUDPTransportManager.Shutdown(); + // Shutdown the UDPTransportManager. + spUDPTransportManager->Shutdown(); + // Destroy the UDPTransportManager. + if (spUDPTransportManager != nullptr) + { + delete spUDPTransportManager; + spUDPTransportManager = nullptr; + } + // Shutdown memory. chip::Platform::MemoryShutdown(); } // Performs setup for each individual test in the test suite - virtual void SetUp() - { - CHIP_ERROR err = CHIP_NO_ERROR; - VerifyOrDieWithMsg((err = MessagingContext::Init(&GetTransportMgr(), &GetIOContext())) == CHIP_NO_ERROR, AppServer, - "Init MessagingContext failed: %" CHIP_ERROR_FORMAT, err.Format()); - } + virtual void SetUp() { ASSERT_EQ(MessagingContext::Init(&GetTransportMgr(), &GetIOContext()), CHIP_NO_ERROR); } // Performs teardown for each individual test in the test suite virtual void TearDown() { MessagingContext::Shutdown(); } - static UDPTransportManager sUDPTransportManager; + static UDPTransportManager * spUDPTransportManager; }; // Class that can be used to capture decrypted message traffic in tests using diff --git a/src/messaging/tests/TestAbortExchangesForFabric.cpp b/src/messaging/tests/TestAbortExchangesForFabric.cpp index 8f8eb825553bf5..6bf161bc157d26 100644 --- a/src/messaging/tests/TestAbortExchangesForFabric.cpp +++ b/src/messaging/tests/TestAbortExchangesForFabric.cpp @@ -21,9 +21,10 @@ * one) for a fabric. */ -#include +#include #include +#include #include #include #include @@ -48,12 +49,8 @@ using namespace chip::System; using namespace chip::System::Clock::Literals; using namespace chip::Protocols; -struct TestAbortExchangesForFabric : public chip::Test::LoopbackMessagingContext, public ::testing::Test +struct TestAbortExchangesForFabric : public chip::Test::LoopbackMessagingContext { - static void SetUpTestSuite() { chip::Test::LoopbackMessagingContext::SetUpTestSuite(); } - - static void TearDownTestSuite() { chip::Test::LoopbackMessagingContext::TearDownTestSuite(); } - void SetUp() override { #if CHIP_CRYPTO_PSA @@ -62,8 +59,6 @@ struct TestAbortExchangesForFabric : public chip::Test::LoopbackMessagingContext chip::Test::LoopbackMessagingContext::SetUp(); } - void TearDown() override { chip::Test::LoopbackMessagingContext::TearDown(); } - void CommonCheckAbortAllButOneExchange(bool dropResponseMessages); }; diff --git a/src/messaging/tests/TestExchange.cpp b/src/messaging/tests/TestExchange.cpp index 7c0257d3093d3f..f221c999ac4e22 100644 --- a/src/messaging/tests/TestExchange.cpp +++ b/src/messaging/tests/TestExchange.cpp @@ -17,9 +17,10 @@ #include #include -#include +#include #include +#include #include #include #include @@ -43,10 +44,8 @@ using namespace chip::Messaging; class MockExchangeDelegate; -struct TestExchange : public Test::LoopbackMessagingContext, public ::testing::Test +struct TestExchange : public Test::LoopbackMessagingContext { - // TODO Add TearDown function when changing test framework to Pigweed to make it more clear how it works. - // Currently, the TearDown function is from LoopbackMessagingContext void SetUp() override { #if CHIP_CRYPTO_PSA @@ -55,12 +54,6 @@ struct TestExchange : public Test::LoopbackMessagingContext, public ::testing::T chip::Test::LoopbackMessagingContext::SetUp(); } - void TearDown() override { chip::Test::LoopbackMessagingContext::TearDown(); } - - static void SetUpTestSuite() { chip::Test::LoopbackMessagingContext::SetUpTestSuite(); } - - static void TearDownTestSuite() { chip::Test::LoopbackMessagingContext::TearDownTestSuite(); } - template void DoRoundTripTest(MockExchangeDelegate & delegate1, MockExchangeDelegate & delegate2, uint8_t requestMessageType, uint8_t responseMessageType, AfterRequestChecker && afterRequestChecker, diff --git a/src/messaging/tests/TestExchangeHolder.cpp b/src/messaging/tests/TestExchangeHolder.cpp index 35f0856cfede24..cafac38bdcb726 100644 --- a/src/messaging/tests/TestExchangeHolder.cpp +++ b/src/messaging/tests/TestExchangeHolder.cpp @@ -21,10 +21,11 @@ * one) for a fabric. */ -#include +#include #include "messaging/ExchangeDelegate.h" #include "system/SystemClock.h" +#include #include #include #include @@ -68,16 +69,7 @@ using namespace chip::Messaging; using namespace chip::System; using namespace chip::Protocols; -struct TestExchangeHolder : public chip::Test::LoopbackMessagingContext, public ::testing::Test -{ - static void SetUpTestSuite() { chip::Test::LoopbackMessagingContext::SetUpTestSuite(); } - - static void TearDownTestSuite() { chip::Test::LoopbackMessagingContext::TearDownTestSuite(); } - - void SetUp() override { chip::Test::LoopbackMessagingContext::SetUp(); } - - void TearDown() override { chip::Test::LoopbackMessagingContext::TearDown(); } -}; +using TestExchangeHolder = chip::Test::LoopbackMessagingContext; class MockProtocolResponder : public ExchangeDelegate, public Messaging::UnsolicitedMessageHandler { diff --git a/src/messaging/tests/TestExchangeMgr.cpp b/src/messaging/tests/TestExchangeMgr.cpp index 975078ede9bd78..679a8cc4050d05 100644 --- a/src/messaging/tests/TestExchangeMgr.cpp +++ b/src/messaging/tests/TestExchangeMgr.cpp @@ -23,9 +23,10 @@ #include #include -#include +#include #include +#include #include #include #include @@ -47,12 +48,8 @@ using namespace chip::Inet; using namespace chip::Transport; using namespace chip::Messaging; -struct TestExchangeMgr : public chip::Test::LoopbackMessagingContext, public ::testing::Test +struct TestExchangeMgr : public chip::Test::LoopbackMessagingContext { - static void SetUpTestSuite() { chip::Test::LoopbackMessagingContext::SetUpTestSuite(); } - - static void TearDownTestSuite() { chip::Test::LoopbackMessagingContext::TearDownTestSuite(); } - void SetUp() override { #if CHIP_CRYPTO_PSA @@ -60,8 +57,6 @@ struct TestExchangeMgr : public chip::Test::LoopbackMessagingContext, public ::t #endif chip::Test::LoopbackMessagingContext::SetUp(); } - - void TearDown() override { chip::Test::LoopbackMessagingContext::TearDown(); } }; enum : uint8_t diff --git a/src/messaging/tests/TestMessagingLayer.cpp b/src/messaging/tests/TestMessagingLayer.cpp index 4e52cb96972ea6..2f16cd97cc51a0 100644 --- a/src/messaging/tests/TestMessagingLayer.cpp +++ b/src/messaging/tests/TestMessagingLayer.cpp @@ -23,9 +23,10 @@ #include #include -#include +#include #include +#include #include #include #include @@ -47,18 +48,7 @@ using namespace chip::Messaging; using namespace chip::Protocols; using namespace chip::System::Clock::Literals; -using TestContext = Test::UDPMessagingContext; - -struct TestMessagingLayer : public chip::Test::UDPMessagingContext, public ::testing::Test -{ - static void SetUpTestSuite() { chip::Test::UDPMessagingContext::SetUpTestSuite(); } - static void TearDownTestSuite() { chip::Test::UDPMessagingContext::TearDownTestSuite(); } - - // Performs setup for each individual test in the test suite - void SetUp() override { chip::Test::UDPMessagingContext::SetUp(); } - - void TearDown() override { chip::Test::UDPMessagingContext::TearDown(); } -}; +using TestMessagingLayer = chip::Test::UDPMessagingContext; // The message timeout value in milliseconds. constexpr System::Clock::Timeout kMessageTimeout = System::Clock::Milliseconds32(100); diff --git a/src/messaging/tests/TestReliableMessageProtocol.cpp b/src/messaging/tests/TestReliableMessageProtocol.cpp index d965c172a1c010..68b6ed2852d377 100644 --- a/src/messaging/tests/TestReliableMessageProtocol.cpp +++ b/src/messaging/tests/TestReliableMessageProtocol.cpp @@ -23,10 +23,11 @@ */ #include -#include +#include #include #include +#include #include #include #include @@ -60,12 +61,9 @@ using namespace chip::System::Clock::Literals; const char PAYLOAD[] = "Hello!"; -class TestReliableMessageProtocol : public chip::Test::LoopbackMessagingContext, public ::testing::Test +class TestReliableMessageProtocol : public chip::Test::LoopbackMessagingContext { public: - static void SetUpTestSuite() { chip::Test::LoopbackMessagingContext::SetUpTestSuite(); } - static void TearDownTestSuite() { chip::Test::LoopbackMessagingContext::TearDownTestSuite(); } - // Performs setup for each individual test in the test suite void SetUp() override { @@ -76,8 +74,6 @@ class TestReliableMessageProtocol : public chip::Test::LoopbackMessagingContext, GetSessionAliceToBob()->AsSecureSession()->SetRemoteSessionParameters(GetLocalMRPConfig().ValueOr(GetDefaultMRPConfig())); GetSessionBobToAlice()->AsSecureSession()->SetRemoteSessionParameters(GetLocalMRPConfig().ValueOr(GetDefaultMRPConfig())); } - - void TearDown() override { chip::Test::LoopbackMessagingContext::TearDown(); } }; class MockAppDelegate : public UnsolicitedMessageHandler, public ExchangeDelegate @@ -502,7 +498,6 @@ TEST_F(TestReliableMessageProtocol, CheckResendApplicationMessage) TEST_F(TestReliableMessageProtocol, CheckCloseExchangeAndResendApplicationMessage) { - chip::System::PacketBufferHandle buffer = chip::MessagePacketBuffer::NewWithData(PAYLOAD, sizeof(PAYLOAD)); EXPECT_FALSE(buffer.IsNull()); @@ -561,7 +556,6 @@ TEST_F(TestReliableMessageProtocol, CheckCloseExchangeAndResendApplicationMessag TEST_F(TestReliableMessageProtocol, CheckFailedMessageRetainOnSend) { - chip::System::PacketBufferHandle buffer = chip::MessagePacketBuffer::NewWithData(PAYLOAD, sizeof(PAYLOAD)); EXPECT_FALSE(buffer.IsNull()); @@ -854,23 +848,18 @@ TEST_F(TestReliableMessageProtocol, CheckDuplicateOldMessageClosedExchange) TEST_F(TestReliableMessageProtocol, CheckResendSessionEstablishmentMessageWithPeerExchange) { - // Making this static to reduce stack usage, as some platforms have limits on stack size. - static chip::Test::MessagingContext ctx; - CHIP_ERROR err = ctx.InitFromExisting(*this); - EXPECT_EQ(err, CHIP_NO_ERROR); - chip::System::PacketBufferHandle buffer = chip::MessagePacketBuffer::NewWithData(PAYLOAD, sizeof(PAYLOAD)); ASSERT_FALSE(buffer.IsNull()); MockSessionEstablishmentDelegate mockReceiver; - err = ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Echo::MsgType::EchoRequest, &mockReceiver); + CHIP_ERROR err = GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Echo::MsgType::EchoRequest, &mockReceiver); EXPECT_EQ(err, CHIP_NO_ERROR); MockSessionEstablishmentDelegate mockSender; - ExchangeContext * exchange = ctx.NewUnauthenticatedExchangeToAlice(&mockSender); + ExchangeContext * exchange = NewUnauthenticatedExchangeToAlice(&mockSender); ASSERT_NE(exchange, nullptr); - ReliableMessageMgr * rm = ctx.GetExchangeManager().GetReliableMessageMgr(); + ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); ASSERT_NE(rm, nullptr); exchange->GetSessionHandle()->AsUnauthenticatedSession()->SetRemoteSessionParameters(ReliableMessageProtocolConfig({ @@ -907,10 +896,8 @@ TEST_F(TestReliableMessageProtocol, CheckResendSessionEstablishmentMessageWithPe EXPECT_EQ(rm->TestGetCountRetransTable(), 0); EXPECT_TRUE(mockReceiver.IsOnMessageReceivedCalled); - err = ctx.GetExchangeManager().UnregisterUnsolicitedMessageHandlerForType(Echo::MsgType::EchoRequest); + err = GetExchangeManager().UnregisterUnsolicitedMessageHandlerForType(Echo::MsgType::EchoRequest); EXPECT_EQ(err, CHIP_NO_ERROR); - - ctx.ShutdownAndRestoreExisting(*this); } TEST_F(TestReliableMessageProtocol, CheckDuplicateMessage) diff --git a/src/messaging/tests/java/BUILD.gn b/src/messaging/tests/java/BUILD.gn index b04e48c2224060..2a1ae118670852 100644 --- a/src/messaging/tests/java/BUILD.gn +++ b/src/messaging/tests/java/BUILD.gn @@ -36,7 +36,11 @@ shared_library("jni") { defines = [ "JAVA_MATTER_CONTROLLER_TEST" ] include_dirs = java_matter_controller_dependent_paths - deps += [ "${chip_root}/src/platform/Linux" ] + if (current_os == "mac") { + deps += [ "${chip_root}/src/platform/Darwin" ] + } else { + deps += [ "${chip_root}/src/platform/Linux" ] + } cflags = [ "-Wno-unknown-pragmas" ] diff --git a/src/platform/ASR/BLEManagerImpl.cpp b/src/platform/ASR/BLEManagerImpl.cpp index 012fb54f8718dc..e06968111b674c 100644 --- a/src/platform/ASR/BLEManagerImpl.cpp +++ b/src/platform/ASR/BLEManagerImpl.cpp @@ -284,25 +284,27 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) } } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { log_i("%s:%s:%d\r\n", "BLEManagerImpl", __func__, __LINE__); ChipLogProgress(DeviceLayer, "BLEManagerImpl::SubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { log_i("%s:%s:%d\r\n", "BLEManagerImpl", __func__, __LINE__); ChipLogProgress(DeviceLayer, "BLEManagerImpl::UnsubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { log_i("%s:%s:%d\r\n", "BLEManagerImpl", __func__, __LINE__); matter_close_connection(conId); - return true; + return CHIP_NO_ERROR; } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -324,8 +326,8 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const } } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle data) { CHIP_ERROR err = CHIP_NO_ERROR; CHIPoBLEConState * conState = GetConnectionState(conId); @@ -335,20 +337,15 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU matter_tx_char_send_indication(conId, data->DataLength(), data->Start()); exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "BLEManagerImpl::SendIndication() failed: %s", ErrorStr(err)); - return false; - } - return true; + return err; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle data) { log_i("%s:%s:%d\r\n", "BLEManagerImpl", __func__, __LINE__); ChipLogError(DeviceLayer, "BLEManagerImpl::SendWriteRequest() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) {} diff --git a/src/platform/ASR/BLEManagerImpl.h b/src/platform/ASR/BLEManagerImpl.h index 71198f4679791d..7e4ab99bd285a8 100644 --- a/src/platform/ASR/BLEManagerImpl.h +++ b/src/platform/ASR/BLEManagerImpl.h @@ -53,16 +53,16 @@ class BLEManagerImpl final : public BLEManager, // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle data) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle data) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle data) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle data) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/Ameba/BLEManagerImpl.cpp b/src/platform/Ameba/BLEManagerImpl.cpp index 72367e1ee1d0bf..f0bbecb42019e5 100644 --- a/src/platform/Ameba/BLEManagerImpl.cpp +++ b/src/platform/Ameba/BLEManagerImpl.cpp @@ -511,19 +511,21 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) } } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::SubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::UnsubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { CHIP_ERROR err; ChipLogProgress(DeviceLayer, "Closing BLE GATT connection (con %u)", conId); @@ -543,7 +545,7 @@ bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) mFlags.Clear(Flags::kAdvertisingConfigured); PlatformMgr().ScheduleWork(DriveBLEState, 0); - return (err == CHIP_NO_ERROR); + return err; } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -557,11 +559,11 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const return mtu; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { ChipLogError(DeviceLayer, "BLEManagerImpl::SendWriteRequest() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) @@ -569,8 +571,8 @@ void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) // Nothing to do } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle data) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -583,12 +585,7 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU #endif exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "BLEManagerImpl::SendIndication() failed: %s", ErrorStr(err)); - return false; - } - return true; + return err; } /******************************************************************************* diff --git a/src/platform/Ameba/BLEManagerImpl.h b/src/platform/Ameba/BLEManagerImpl.h index 06e44f8475a887..9081b2bfb3026d 100644 --- a/src/platform/Ameba/BLEManagerImpl.h +++ b/src/platform/Ameba/BLEManagerImpl.h @@ -63,16 +63,16 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index 474e3c17ce284b..38becc7ede7471 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -140,6 +140,7 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { "CHIP_USE_TRANSITIONAL_COMMISSIONABLE_DATA_PROVIDER=${chip_use_transitional_commissionable_data_provider}", "CHIP_USE_TRANSITIONAL_DEVICE_INSTANCE_INFO_PROVIDER=${chip_use_transitional_device_instance_info_provider}", "CHIP_DEVICE_CONFIG_ENABLE_DYNAMIC_MRP_CONFIG=${chip_device_config_enable_dynamic_mrp_config}", + "CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF=${chip_device_config_enable_wifipaf}", ] if (chip_device_platform == "linux" || chip_device_platform == "darwin" || diff --git a/src/platform/Beken/BLEManagerImpl.cpp b/src/platform/Beken/BLEManagerImpl.cpp index bf1a0dc70e007e..555fbfc7086e11 100644 --- a/src/platform/Beken/BLEManagerImpl.cpp +++ b/src/platform/Beken/BLEManagerImpl.cpp @@ -539,19 +539,21 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) } } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::SubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::UnsubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { CHIP_ERROR err; ChipLogProgress(DeviceLayer, "Closing BLE GATT connection (con %u)", conId); @@ -576,7 +578,7 @@ bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) ChipLogError(DeviceLayer, "bk_ble_disconnect() failed: %s", ErrorStr(err)); } - return false; + return err; } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -585,11 +587,11 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const return (conState != NULL) ? conState->mtu : 0; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { ChipLogError(DeviceLayer, "BLEManagerImpl::SendWriteRequest() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) @@ -597,8 +599,8 @@ void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) // Nothing to do } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle data) { CHIP_ERROR err = CHIP_NO_ERROR; int ret; @@ -607,13 +609,7 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU ret = bk_ble_send_noti_value(conId, data->DataLength(), data->Start(), 0, SVR_FFF6_TX_VALUE); err = MapBLEError(ret); exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "BLEManagerImpl::SendIndication() failed: %s", ErrorStr(err)); - return false; - } - - return true; + return err; } /******************************************************************************* diff --git a/src/platform/Beken/BLEManagerImpl.h b/src/platform/Beken/BLEManagerImpl.h index d8789481db4d38..ba52a4e26d271d 100644 --- a/src/platform/Beken/BLEManagerImpl.h +++ b/src/platform/Beken/BLEManagerImpl.h @@ -58,16 +58,16 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/Darwin/BlePlatformDelegate.h b/src/platform/Darwin/BlePlatformDelegate.h index 15ff40e976fd47..d53f9007ca1b59 100644 --- a/src/platform/Darwin/BlePlatformDelegate.h +++ b/src/platform/Darwin/BlePlatformDelegate.h @@ -30,14 +30,16 @@ namespace Internal { class BlePlatformDelegateImpl : public Ble::BlePlatformDelegate { public: - virtual bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId); - virtual bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId); - virtual bool CloseConnection(BLE_CONNECTION_OBJECT connObj); - virtual uint16_t GetMTU(BLE_CONNECTION_OBJECT connObj) const; - virtual bool SendIndication(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf); - virtual bool SendWriteRequest(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf); + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, + const ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, + const ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT connObj) override; + uint16_t GetMTU(BLE_CONNECTION_OBJECT connObj) const override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) override; }; } // namespace Internal diff --git a/src/platform/Darwin/BlePlatformDelegateImpl.mm b/src/platform/Darwin/BlePlatformDelegateImpl.mm index d6e12ecf15a11a..d967ea41d2a686 100644 --- a/src/platform/Darwin/BlePlatformDelegateImpl.mm +++ b/src/platform/Darwin/BlePlatformDelegateImpl.mm @@ -38,13 +38,13 @@ namespace chip { namespace DeviceLayer { namespace Internal { - bool BlePlatformDelegateImpl::SubscribeCharacteristic( + CHIP_ERROR BlePlatformDelegateImpl::SubscribeCharacteristic( BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId) { - bool found = false; + CHIP_ERROR err = BLE_ERROR_GATT_SUBSCRIBE_FAILED; if (nullptr == svcId || nullptr == charId) { - return found; + return err; } CBUUID * serviceId = [MTRUUIDHelper GetShortestServiceUUID:svcId]; @@ -55,7 +55,7 @@ if ([service.UUID.data isEqualToData:serviceId.data]) { for (CBCharacteristic * characteristic in service.characteristics) { if ([characteristic.UUID.data isEqualToData:characteristicId.data]) { - found = true; + err = CHIP_NO_ERROR; [peripheral setNotifyValue:true forCharacteristic:characteristic]; break; } @@ -63,15 +63,15 @@ } } - return found; + return err; } - bool BlePlatformDelegateImpl::UnsubscribeCharacteristic( + CHIP_ERROR BlePlatformDelegateImpl::UnsubscribeCharacteristic( BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId) { - bool found = false; + CHIP_ERROR err = BLE_ERROR_GATT_UNSUBSCRIBE_FAILED; if (nullptr == svcId || nullptr == charId) { - return found; + return err; } CBUUID * serviceId = [MTRUUIDHelper GetShortestServiceUUID:svcId]; @@ -83,7 +83,7 @@ if ([service.UUID.data isEqualToData:serviceId.data]) { for (CBCharacteristic * characteristic in service.characteristics) { if ([characteristic.UUID.data isEqualToData:characteristicId.data]) { - found = true; + err = CHIP_NO_ERROR; [peripheral setNotifyValue:false forCharacteristic:characteristic]; break; } @@ -91,10 +91,10 @@ } } - return found; + return err; } - bool BlePlatformDelegateImpl::CloseConnection(BLE_CONNECTION_OBJECT connObj) + CHIP_ERROR BlePlatformDelegateImpl::CloseConnection(BLE_CONNECTION_OBJECT connObj) { CBPeripheral * peripheral = (__bridge CBPeripheral *) connObj; @@ -103,7 +103,7 @@ if (manager != nil) [manager cancelPeripheralConnection:peripheral]; - return true; + return CHIP_NO_ERROR; } uint16_t BlePlatformDelegateImpl::GetMTU(BLE_CONNECTION_OBJECT connObj) const @@ -117,18 +117,18 @@ return mtuLength; } - bool BlePlatformDelegateImpl::SendIndication( + CHIP_ERROR BlePlatformDelegateImpl::SendIndication( BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId, PacketBufferHandle pBuf) { - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } - bool BlePlatformDelegateImpl::SendWriteRequest( + CHIP_ERROR BlePlatformDelegateImpl::SendWriteRequest( BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId, PacketBufferHandle pBuf) { - bool found = false; + CHIP_ERROR err = BLE_ERROR_GATT_WRITE_FAILED; if (nullptr == svcId || nullptr == charId || pBuf.IsNull()) { - return found; + return err; } CBUUID * serviceId = [MTRUUIDHelper GetShortestServiceUUID:svcId]; @@ -140,7 +140,7 @@ if ([service.UUID.data isEqualToData:serviceId.data]) { for (CBCharacteristic * characteristic in service.characteristics) { if ([characteristic.UUID.data isEqualToData:characteristicId.data]) { - found = true; + err = CHIP_NO_ERROR; [peripheral writeValue:data forCharacteristic:characteristic type:CBCharacteristicWriteWithResponse]; break; } @@ -151,7 +151,7 @@ // Going out of scope releases delegate's reference to pBuf. pBuf will be freed when both platform delegate and Chip // stack free their references to it. We release pBuf's reference here since its payload bytes were copied into a new // NSData object - return found; + return err; } } // namespace Internal diff --git a/src/platform/ESP32/BLEManagerImpl.h b/src/platform/ESP32/BLEManagerImpl.h index 2bed34902002c1..eeed125012b00f 100644 --- a/src/platform/ESP32/BLEManagerImpl.h +++ b/src/platform/ESP32/BLEManagerImpl.h @@ -171,16 +171,16 @@ class BLEManagerImpl final : public BLEManager, // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/ESP32/BUILD.gn b/src/platform/ESP32/BUILD.gn index e835896fb59092..587388e3f969be 100644 --- a/src/platform/ESP32/BUILD.gn +++ b/src/platform/ESP32/BUILD.gn @@ -172,6 +172,12 @@ static_library("ESP32") { "../OpenThread/OpenThreadDnssdImpl.h", ] } + if (chip_openthread_border_router) { + sources += [ + "../OpenThread/GenericThreadBorderRouterDelegate.cpp", + "../OpenThread/GenericThreadBorderRouterDelegate.h", + ] + } configs -= [ "${chip_root}/build/config/compiler:warnings_default" ] } diff --git a/src/platform/ESP32/CHIPDevicePlatformConfig.h b/src/platform/ESP32/CHIPDevicePlatformConfig.h index e347df109d1e3a..dc4f380c262fb5 100644 --- a/src/platform/ESP32/CHIPDevicePlatformConfig.h +++ b/src/platform/ESP32/CHIPDevicePlatformConfig.h @@ -50,6 +50,9 @@ #ifdef CONFIG_ENABLE_MATTER_OVER_THREAD #define CHIP_DEVICE_CONFIG_ENABLE_THREAD CONFIG_ENABLE_MATTER_OVER_THREAD +#ifndef CONFIG_THREAD_NETWORK_COMMISSIONING_DRIVER +#define _NO_NETWORK_COMMISSIONING_DRIVER_ 1 +#endif #else #define CHIP_DEVICE_CONFIG_ENABLE_THREAD 0 #endif // CONFIG_ENABLE_MATTER_OVER_THREAD @@ -164,3 +167,15 @@ #define CHIP_DEVICE_CONFIG_BG_TASK_PRIORITY CONFIG_BG_CHIP_TASK_PRIORITY #define CHIP_DEVICE_CONFIG_BG_MAX_EVENT_QUEUE_SIZE CONFIG_BG_MAX_EVENT_QUEUE_SIZE #define CHIP_DEVICE_CONFIG_BG_TASK_STACK_SIZE CONFIG_BG_CHIP_TASK_STACK_SIZE + +#ifdef CONFIG_WIFI_NETWORK_COMMISSIONING_DRIVER +#define CHIP_DEVICE_CONFIG_WIFI_NETWORK_DRIVER CONFIG_WIFI_NETWORK_COMMISSIONING_DRIVER +#else +#define CHIP_DEVICE_CONFIG_WIFI_NETWORK_DRIVER 0 +#endif // CONFIG_WIFI_NETWORK_COMMISSIONING_DRIVER + +#ifdef CONFIG_ETHERNET_NETWORK_COMMISSIONING_DRIVER +#define CHIP_DEVICE_CONFIG_ETHERNET_NETWORK_DRIVER CONFIG_ETHERNET_NETWORK_COMMISSIONING_DRIVER +#else +#define CHIP_DEVICE_CONFIG_ETHERNET_NETWORK_DRIVER 0 +#endif // CONFIG_ETHERNET_NETWORK_COMMISSIONING_DRIVER diff --git a/src/platform/ESP32/ConnectivityManagerImpl.cpp b/src/platform/ESP32/ConnectivityManagerImpl.cpp index 85146257ebe985..2b042a5d5c2fcb 100644 --- a/src/platform/ESP32/ConnectivityManagerImpl.cpp +++ b/src/platform/ESP32/ConnectivityManagerImpl.cpp @@ -39,9 +39,11 @@ #include #endif +#include #include #include #include +#include #include using namespace ::chip; @@ -53,6 +55,18 @@ namespace chip { namespace DeviceLayer { ConnectivityManagerImpl ConnectivityManagerImpl::sInstance; + +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI && CHIP_DEVICE_CONFIG_WIFI_NETWORK_DRIVER +app::Clusters::NetworkCommissioning::Instance + sWiFiNetworkCommissioningInstance(CONFIG_WIFI_NETWORK_ENDPOINT_ID /* Endpoint Id */, + &(NetworkCommissioning::ESPWiFiDriver::GetInstance())); +#endif + +#if CHIP_DEVICE_CONFIG_ENABLE_ETHERNET && CHIP_DEVICE_CONFIG_ETHERNET_NETWORK_DRIVER +app::Clusters::NetworkCommissioning::Instance + sEthernetNetworkCommissioningInstance(CONFIG_ETHERNET_NETWORK_ENDPOINT_ID /* Endpoint Id */, + &(NetworkCommissioning::ESPEthernetDriver::GetInstance())); +#endif // ==================== ConnectivityManager Platform Internal Methods ==================== CHIP_ERROR ConnectivityManagerImpl::_Init() @@ -62,10 +76,30 @@ CHIP_ERROR ConnectivityManagerImpl::_Init() #endif #if CHIP_DEVICE_CONFIG_ENABLE_WIFI InitWiFi(); +#if CHIP_DEVICE_CONFIG_WIFI_NETWORK_DRIVER + sWiFiNetworkCommissioningInstance.Init(); +#endif // CHIP_DEVICE_CONFIG_WIFI_NETWORK_DRIVER #endif #if CHIP_DEVICE_CONFIG_ENABLE_ETHERNET InitEthernet(); +#if CHIP_DEVICE_CONFIG_ETHERNET_NETWORK_DRIVER + sEthernetNetworkCommissioningInstance.Init(); +#endif // CHIP_DEVICE_CONFIG_ETHERNET_NETWORK_DRIVER #endif + +#if defined(CONFIG_WIFI_NETWORK_ENDPOINT_ID) && defined(CONFIG_THREAD_NETWORK_ENDPOINT_ID) + static_assert(CONFIG_WIFI_NETWORK_ENDPOINT_ID != CONFIG_THREAD_NETWORK_ENDPOINT_ID, + "Wi-Fi network endpoint id and Thread network endpoint id should not be the same."); +#endif +#if defined(CONFIG_WIFI_NETWORK_ENDPOINT_ID) && defined(CONFIG_ETHERNET_NETWORK_ENDPOINT_ID) + static_assert(CONFIG_WIFI_NETWORK_ENDPOINT_ID != CONFIG_ETHERNET_NETWORK_ENDPOINT_ID, + "Wi-Fi network endpoint id and Ethernet network endpoint id should not be the same."); +#endif +#if defined(CONFIG_THREAD_NETWORK_ENDPOINT_ID) && defined(CONFIG_ETHERNET_NETWORK_ENDPOINT_ID) + static_assert(CONFIG_THREAD_NETWORK_ENDPOINT_ID != CONFIG_ETHERNET_NETWORK_ENDPOINT_ID, + "Thread network endpoint id and Ethernet network endpoint id should not be the same."); +#endif + return CHIP_NO_ERROR; } diff --git a/src/platform/ESP32/ESP32Config.cpp b/src/platform/ESP32/ESP32Config.cpp index 04e02f63004207..c94de5c04b85b2 100644 --- a/src/platform/ESP32/ESP32Config.cpp +++ b/src/platform/ESP32/ESP32Config.cpp @@ -77,6 +77,9 @@ const ESP32Config::Key ESP32Config::kConfigKey_ProductURL = { kConfig const ESP32Config::Key ESP32Config::kConfigKey_SupportedCalTypes = { kConfigNamespace_ChipFactory, "cal-types" }; const ESP32Config::Key ESP32Config::kConfigKey_SupportedLocaleSize = { kConfigNamespace_ChipFactory, "locale-sz" }; const ESP32Config::Key ESP32Config::kConfigKey_RotatingDevIdUniqueId = { kConfigNamespace_ChipFactory, "rd-id-uid" }; +const ESP32Config::Key ESP32Config::kConfigKey_ProductFinish = { kConfigNamespace_ChipFactory, "product-finish" }; +const ESP32Config::Key ESP32Config::kConfigKey_ProductColor = { kConfigNamespace_ChipFactory, "product-color" }; +const ESP32Config::Key ESP32Config::kConfigKey_PartNumber = { kConfigNamespace_ChipFactory, "part-number" }; const ESP32Config::Key ESP32Config::kConfigKey_LocationCapability = { kConfigNamespace_ChipFactory, "loc-capability" }; // Keys stored in the chip-config namespace diff --git a/src/platform/ESP32/ESP32Config.h b/src/platform/ESP32/ESP32Config.h index 5804f53105c20c..218f2354b2b358 100644 --- a/src/platform/ESP32/ESP32Config.h +++ b/src/platform/ESP32/ESP32Config.h @@ -75,10 +75,13 @@ class ESP32Config static const Key kConfigKey_ProductId; static const Key kConfigKey_ProductName; static const Key kConfigKey_ProductLabel; + static const Key kConfigKey_PartNumber; static const Key kConfigKey_ProductURL; static const Key kConfigKey_SupportedCalTypes; static const Key kConfigKey_SupportedLocaleSize; static const Key kConfigKey_RotatingDevIdUniqueId; + static const Key kConfigKey_ProductFinish; + static const Key kConfigKey_ProductColor; static const Key kConfigKey_LocationCapability; // CHIP Config keys diff --git a/src/platform/ESP32/ESP32FactoryDataProvider.cpp b/src/platform/ESP32/ESP32FactoryDataProvider.cpp index 4ff4f9d2d29678..ace2a087de144b 100644 --- a/src/platform/ESP32/ESP32FactoryDataProvider.cpp +++ b/src/platform/ESP32/ESP32FactoryDataProvider.cpp @@ -98,11 +98,15 @@ CHIP_ERROR ESP32FactoryDataProvider::GetSpake2pVerifier(MutableByteSpan & verifi CHIP_ERROR ESP32FactoryDataProvider::GetCertificationDeclaration(MutableByteSpan & outBuffer) { +#ifdef CONFIG_ENABLE_SET_CERT_DECLARATION_API + return CopySpanToMutableSpan(mCD, outBuffer); +#else size_t certSize; ReturnErrorOnFailure( ESP32Config::ReadConfigValueBin(ESP32Config::kConfigKey_CertDeclaration, outBuffer.data(), outBuffer.size(), certSize)); outBuffer.reduce_size(certSize); return CHIP_NO_ERROR; +#endif // CONFIG_ENABLE_SET_CERT_DECLARATION_API } CHIP_ERROR ESP32FactoryDataProvider::GetFirmwareInformation(MutableByteSpan & out_firmware_info_buffer) @@ -123,15 +127,11 @@ CHIP_ERROR ESP32FactoryDataProvider::GetDeviceAttestationCert(MutableByteSpan & CHIP_ERROR ESP32FactoryDataProvider::GetProductAttestationIntermediateCert(MutableByteSpan & outBuffer) { -#ifdef CONFIG_ENABLE_SET_CERT_DECLARATION_API - return CopySpanToMutableSpan(mCD, outBuffer); -#else size_t certSize; ReturnErrorOnFailure( ESP32Config::ReadConfigValueBin(ESP32Config::kConfigKey_PAICert, outBuffer.data(), outBuffer.size(), certSize)); outBuffer.reduce_size(certSize); return CHIP_NO_ERROR; -#endif // CONFIG_ENABLE_SET_CERT_DECLARATION_API } CHIP_ERROR ESP32FactoryDataProvider::SignWithDeviceAttestationKey(const ByteSpan & messageToSign, MutableByteSpan & outSignBuffer) @@ -245,6 +245,32 @@ CHIP_ERROR ESP32FactoryDataProvider::GetManufacturingDate(uint16_t & year, uint8 return GenericDeviceInstanceInfoProvider::GetManufacturingDate(year, month, day); } +CHIP_ERROR ESP32FactoryDataProvider::GetProductFinish(app::Clusters::BasicInformation::ProductFinishEnum * finish) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + uint32_t productFinish = 0; + + err = ESP32Config::ReadConfigValue(ESP32Config::kConfigKey_ProductFinish, productFinish); + ReturnErrorCodeIf(err != CHIP_NO_ERROR, CHIP_ERROR_NOT_IMPLEMENTED); + + *finish = static_cast(productFinish); + + return err; +} + +CHIP_ERROR ESP32FactoryDataProvider::GetProductPrimaryColor(app::Clusters::BasicInformation::ColorEnum * primaryColor) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + uint32_t color = 0; + + err = ESP32Config::ReadConfigValue(ESP32Config::kConfigKey_ProductColor, color); + ReturnErrorCodeIf(err != CHIP_NO_ERROR, CHIP_ERROR_NOT_IMPLEMENTED); + + *primaryColor = static_cast(color); + + return err; +} + CHIP_ERROR ESP32FactoryDataProvider::GetHardwareVersion(uint16_t & hardwareVersion) { return GenericDeviceInstanceInfoProvider::GetHardwareVersion(hardwareVersion); @@ -252,7 +278,12 @@ CHIP_ERROR ESP32FactoryDataProvider::GetHardwareVersion(uint16_t & hardwareVersi CHIP_ERROR ESP32FactoryDataProvider::GetPartNumber(char * buf, size_t bufSize) { - return GenericDeviceInstanceInfoProvider::GetPartNumber(buf, bufSize); + CHIP_ERROR err = ESP32Config::ReadConfigValueStr(ESP32Config::kConfigKey_PartNumber, buf, bufSize, bufSize); + if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) + { + return CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND; + } + return err; } #endif // CHIP_DEVICE_CONFIG_ENABLE_DEVICE_INSTANCE_INFO_PROVIDER diff --git a/src/platform/ESP32/ESP32FactoryDataProvider.h b/src/platform/ESP32/ESP32FactoryDataProvider.h index 1d78f2c2e8fa0b..08227ed4ed143b 100644 --- a/src/platform/ESP32/ESP32FactoryDataProvider.h +++ b/src/platform/ESP32/ESP32FactoryDataProvider.h @@ -96,6 +96,8 @@ class ESP32FactoryDataProvider : public CommissionableDataProvider, CHIP_ERROR GetManufacturingDate(uint16_t & year, uint8_t & month, uint8_t & day) override; CHIP_ERROR GetPartNumber(char * buf, size_t bufSize) override; CHIP_ERROR GetHardwareVersion(uint16_t & hardwareVersion) override; + CHIP_ERROR GetProductFinish(app::Clusters::BasicInformation::ProductFinishEnum * finish) override; + CHIP_ERROR GetProductPrimaryColor(app::Clusters::BasicInformation::ColorEnum * primaryColor) override; #endif // CHIP_DEVICE_CONFIG_ENABLE_DEVICE_INSTANCE_INFO_PROVIDER private: diff --git a/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp b/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp index 07c02647055ca8..f542af93b6f848 100644 --- a/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp +++ b/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp @@ -737,7 +737,8 @@ void BLEManagerImpl::ConnectDevice(esp_bd_addr_t & addr, esp_ble_addr_type_t add } #endif -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { #ifdef CONFIG_ENABLE_ESP32_BLE_CONTROLLER uint8_t value[2]; @@ -752,20 +753,21 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const { ChipLogError(Ble, "esp_ble_gattc_get_descr_by_char_handle failed: %d", rc); esp_ble_gattc_close(chip_ctrl_gattc_if, conId); - return false; + return BLE_ERROR_GATT_SUBSCRIBE_FAILED; } ChipDeviceEvent event; event.Type = DeviceEventType::kPlatformESP32BLESubscribeOpComplete; event.Platform.BLESubscribeOpComplete.mConnection = conId; event.Platform.BLESubscribeOpComplete.mIsSubscribed = true; PlatformMgr().PostEventOrDie(&event); - return true; + return CHIP_NO_ERROR; #else - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; #endif } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { #ifdef CONFIG_ENABLE_ESP32_BLE_CONTROLLER uint8_t value[2]; @@ -780,20 +782,20 @@ bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, cons { ChipLogError(Ble, "ble_gattc_write_flat failed: %d", rc); esp_ble_gattc_close(chip_ctrl_gattc_if, conId); - return false; + return BLE_ERROR_GATT_UNSUBSCRIBE_FAILED; } ChipDeviceEvent event; event.Type = DeviceEventType::kPlatformESP32BLESubscribeOpComplete; event.Platform.BLESubscribeOpComplete.mConnection = conId; event.Platform.BLESubscribeOpComplete.mIsSubscribed = false; PlatformMgr().PostEventOrDie(&event); - return true; + return CHIP_NO_ERROR; #else - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; #endif } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { CHIP_ERROR err; @@ -816,7 +818,7 @@ bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) PlatformMgr().ScheduleWork(DriveBLEState, 0); #endif - return (err == CHIP_NO_ERROR); + return err; } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -825,8 +827,8 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const return (conState != NULL) ? conState->MTU : 0; } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle data) { CHIP_ERROR err = CHIP_NO_ERROR; CHIPoBLEConState * conState = GetConnectionState(conId); @@ -854,16 +856,11 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU conState->PendingIndBuf = std::move(data); exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "BLEManagerImpl::SendIndication() failed: %s", ErrorStr(err)); - return false; - } - return true; + return err; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { #ifdef CONFIG_ENABLE_ESP32_BLE_CONTROLLER ChipLogProgress(Ble, "In send write request\n"); @@ -875,15 +872,15 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBle if (rc != 0) { ChipLogError(Ble, "ble_gattc_write_flat failed: %d", rc); - return false; + return BLE_ERROR_GATT_WRITE_FAILED; } ChipDeviceEvent event; event.Type = DeviceEventType::kPlatformESP32BLEWriteComplete; event.Platform.BLEWriteComplete.mConnection = conId; PlatformMgr().PostEventOrDie(&event); - return true; + return CHIP_NO_ERROR; #else - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; #endif } diff --git a/src/platform/ESP32/nimble/BLEManagerImpl.cpp b/src/platform/ESP32/nimble/BLEManagerImpl.cpp index c581d1fd6d6290..4f6ab4f73f7200 100644 --- a/src/platform/ESP32/nimble/BLEManagerImpl.cpp +++ b/src/platform/ESP32/nimble/BLEManagerImpl.cpp @@ -484,7 +484,8 @@ static int OnSubscribeCharComplete(uint16_t conn_handle, const struct ble_gatt_e } #endif -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { #ifdef CONFIG_ENABLE_ESP32_BLE_CONTROLLER const struct peer_dsc * dsc; @@ -493,7 +494,7 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const struct peer * peer = peer_find(conId); if (peer == nullptr) { - return false; + return BLE_ERROR_GATT_SUBSCRIBE_FAILED; } dsc = peer_dsc_find_uuid(peer, (ble_uuid_t *) (&ShortUUID_CHIPoBLEService), (ble_uuid_t *) (&UUID_CHIPoBLEChar_TX), @@ -503,7 +504,7 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const { ChipLogError(Ble, "Peer does not have CCCD"); ble_gap_terminate(peer->conn_handle, BLE_ERR_REM_USER_CONN_TERM); - return false; + return BLE_ERROR_GATT_SUBSCRIBE_FAILED; } value[0] = 0x02; @@ -514,15 +515,16 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const { ChipLogError(Ble, "ble_gattc_write_flat failed: %d", rc); ble_gap_terminate(peer->conn_handle, BLE_ERR_REM_USER_CONN_TERM); - return false; + return BLE_ERROR_GATT_SUBSCRIBE_FAILED; } - return true; + return CHIP_NO_ERROR; #else - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; #endif } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { #ifdef CONFIG_ENABLE_ESP32_BLE_CONTROLLER const struct peer_dsc * dsc; @@ -531,7 +533,7 @@ bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, cons struct peer * peer = peer_find(conId); if (peer == nullptr) { - return false; + return BLE_ERROR_GATT_UNSUBSCRIBE_FAILED; } dsc = peer_dsc_find_uuid(peer, (ble_uuid_t *) (&ShortUUID_CHIPoBLEService), (ble_uuid_t *) (&UUID_CHIPoBLEChar_TX), @@ -541,7 +543,7 @@ bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, cons { ChipLogError(Ble, "Peer does not have CCCD"); ble_gap_terminate(peer->conn_handle, BLE_ERR_REM_USER_CONN_TERM); - return false; + return BLE_ERROR_GATT_UNSUBSCRIBE_FAILED; } value[0] = 0x00; @@ -552,15 +554,15 @@ bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, cons { ChipLogError(Ble, "ble_gattc_write_flat failed: %d", rc); ble_gap_terminate(peer->conn_handle, BLE_ERR_REM_USER_CONN_TERM); - return false; + return BLE_ERROR_GATT_UNSUBSCRIBE_FAILED; } - return true; + return CHIP_NO_ERROR; #else - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; #endif } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { CHIP_ERROR err; @@ -580,7 +582,7 @@ bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) PlatformMgr().ScheduleWork(DriveBLEState, 0); #endif - return (err == CHIP_NO_ERROR); + return err; } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -588,8 +590,8 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const return ble_att_mtu(conId); } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - chip::System::PacketBufferHandle data) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + chip::System::PacketBufferHandle data) { CHIP_ERROR err = CHIP_NO_ERROR; struct os_mbuf * om; @@ -618,12 +620,7 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU } exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "BLEManagerImpl::SendIndication() failed: %s", ErrorStr(err)); - return false; - } - return true; + return err; } #ifdef CONFIG_ENABLE_ESP32_BLE_CONTROLLER @@ -643,8 +640,8 @@ static int OnWriteComplete(uint16_t conn_handle, const struct ble_gatt_error * e } #endif -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - chip::System::PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + chip::System::PacketBufferHandle pBuf) { #ifdef CONFIG_ENABLE_ESP32_BLE_CONTROLLER const struct peer_chr * chr; @@ -656,7 +653,7 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBle { ChipLogError(Ble, "Peer does not have RX characteristic"); ble_gap_terminate(peer->conn_handle, BLE_ERR_REM_USER_CONN_TERM); - return false; + return BLE_ERROR_GATT_WRITE_FAILED; } if (pBuf->DataLength() > UINT16_MAX) @@ -670,11 +667,11 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBle { ChipLogError(Ble, "ble_gattc_write_flat failed: %d", rc); ble_gap_terminate(peer->conn_handle, BLE_ERR_REM_USER_CONN_TERM); - return false; + return BLE_ERROR_GATT_WRITE_FAILED; } - return true; + return CHIP_NO_ERROR; #else - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; #endif } @@ -1749,10 +1746,12 @@ void BLEManagerImpl::DriveBLEState(intptr_t arg) #ifdef CONFIG_ENABLE_ESP32_BLE_CONTROLLER CHIP_ERROR BLEManagerImpl::HandleRXNotify(struct ble_gap_event * ble_event) { - uint8_t * data = OS_MBUF_DATA(ble_event->notify_rx.om, uint8_t *); size_t dataLen = OS_MBUF_PKTLEN(ble_event->notify_rx.om); - System::PacketBufferHandle buf = System::PacketBufferHandle::NewWithData(data, dataLen); + System::PacketBufferHandle buf = System::PacketBufferHandle::New(dataLen, 0); VerifyOrReturnError(!buf.IsNull(), CHIP_ERROR_NO_MEMORY); + VerifyOrExit(buf->AvailableDataLength() >= data_len, err = CHIP_ERROR_BUFFER_TOO_SMALL); + ble_hs_mbuf_to_flat(ble_event->notify_rx.om, buf->Start(), data_len, NULL); + buf->SetDataLength(data_len); ChipLogDetail(DeviceLayer, "Indication received, conn = %d", ble_event->notify_rx.conn_handle); diff --git a/src/platform/Infineon/CYW30739/BLEManagerImpl.cpp b/src/platform/Infineon/CYW30739/BLEManagerImpl.cpp index afc0be2f9410e7..7afeb59b69e172 100644 --- a/src/platform/Infineon/CYW30739/BLEManagerImpl.cpp +++ b/src/platform/Infineon/CYW30739/BLEManagerImpl.cpp @@ -226,30 +226,30 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) } } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::SubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::UnsubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { ChipLogProgress(DeviceLayer, "Closing BLE GATT connection (con %u)", conId); // Initiate a GAP disconnect. wiced_bt_gatt_status_t gatt_err = wiced_bt_gatt_disconnect((uint16_t) conId); - if (gatt_err != WICED_BT_GATT_SUCCESS) - { - ChipLogError(DeviceLayer, "wiced_bt_gatt_disconnect() failed: %d", gatt_err); - } + VerifyOrReturnError(gatt_err == WICED_BT_GATT_SUCCESS, CHIP_ERROR_INTERNAL, + ChipLogError(DeviceLayer, "wiced_bt_gatt_disconnect() failed: %d", gatt_err)); - return (gatt_err == WICED_BT_GATT_SUCCESS); + return CHIP_NO_ERROR; } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -269,8 +269,8 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const } } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle data) { CHIP_ERROR err = CHIP_NO_ERROR; uint16_t dataLen = data->DataLength(); @@ -288,17 +288,16 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU if (gatt_err != WICED_BT_GATT_SUCCESS) { ChipLogError(DeviceLayer, "BLEManagerImpl::SendIndication() failed: %d", gatt_err); - return false; + return BLE_ERROR_GATT_INDICATE_FAILED; } - return err == CHIP_NO_ERROR; + return err; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle data) { - ChipLogError(DeviceLayer, "BLEManagerImpl::SendWriteRequest() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) {} diff --git a/src/platform/Infineon/CYW30739/BLEManagerImpl.h b/src/platform/Infineon/CYW30739/BLEManagerImpl.h index 1d452267d0b989..90a3b3ef2d6dab 100644 --- a/src/platform/Infineon/CYW30739/BLEManagerImpl.h +++ b/src/platform/Infineon/CYW30739/BLEManagerImpl.h @@ -68,16 +68,16 @@ class BLEManagerImpl final : public BLEManager, // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle data) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle data) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle data) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle data) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/Infineon/PSOC6/BLEManagerImpl.cpp b/src/platform/Infineon/PSOC6/BLEManagerImpl.cpp index ea896cdf62cf38..c5e6f3df4fdf15 100644 --- a/src/platform/Infineon/PSOC6/BLEManagerImpl.cpp +++ b/src/platform/Infineon/PSOC6/BLEManagerImpl.cpp @@ -270,30 +270,30 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) } } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::SubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::UnsubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { ChipLogProgress(DeviceLayer, "Closing BLE GATT connection (con %u)", conId); // Initiate a GAP disconnect. wiced_bt_gatt_status_t gatt_err = wiced_bt_gatt_disconnect((uint16_t) conId); - if (gatt_err != WICED_BT_GATT_SUCCESS) - { - ChipLogError(DeviceLayer, "wiced_bt_gatt_disconnect() failed: %d", gatt_err); - } + VerifyOrReturnError(gatt_err == WICED_BT_GATT_SUCCESS, CHIP_ERROR_INTERNAL, + ChipLogError(DeviceLayer, "wiced_bt_gatt_disconnect() failed: %d", gatt_err)); - return (gatt_err == WICED_BT_GATT_SUCCESS); + return CHIP_NO_ERROR; } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -313,8 +313,8 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const } } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle data) { CHIP_ERROR err = CHIP_NO_ERROR; uint16_t dataLen = data->DataLength(); @@ -335,17 +335,16 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU if (gatt_err != WICED_BT_GATT_SUCCESS) { ChipLogError(DeviceLayer, "BLEManagerImpl::SendIndication() failed: %d", gatt_err); - return false; + return BLE_ERROR_GATT_INDICATE_FAILED; } - return err == CHIP_NO_ERROR; + return err; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle data) { - ChipLogError(DeviceLayer, "BLEManagerImpl::SendWriteRequest() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) {} diff --git a/src/platform/Infineon/PSOC6/BLEManagerImpl.h b/src/platform/Infineon/PSOC6/BLEManagerImpl.h index 266dc7db7eab00..ae8da4b930b230 100644 --- a/src/platform/Infineon/PSOC6/BLEManagerImpl.h +++ b/src/platform/Infineon/PSOC6/BLEManagerImpl.h @@ -65,16 +65,16 @@ class BLEManagerImpl final : public BLEManager, // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle data) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle data) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle data) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle data) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/Infineon/PSOC6/BUILD.gn b/src/platform/Infineon/PSOC6/BUILD.gn index bc048a31d3a9b7..3fd150eeeaae13 100644 --- a/src/platform/Infineon/PSOC6/BUILD.gn +++ b/src/platform/Infineon/PSOC6/BUILD.gn @@ -48,10 +48,10 @@ static_library("PSOC6") { "NetworkCommissioningWiFiDriver.cpp", "OTAImageProcessorImpl.cpp", "OTAImageProcessorImpl.h", - "P6Config.cpp", - "P6Config.h", - "P6Utils.cpp", - "P6Utils.h", + "PSOC6Config.cpp", + "PSOC6Config.h", + "PSOC6Utils.cpp", + "PSOC6Utils.h", "PlatformManagerImpl.cpp", "PlatformManagerImpl.h", "SystemPlatformConfig.h", diff --git a/src/platform/Infineon/PSOC6/ConfigurationManagerImpl.cpp b/src/platform/Infineon/PSOC6/ConfigurationManagerImpl.cpp index 67ed7f1d8eab4b..220caf0bdddc2f 100644 --- a/src/platform/Infineon/PSOC6/ConfigurationManagerImpl.cpp +++ b/src/platform/Infineon/PSOC6/ConfigurationManagerImpl.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include namespace chip { @@ -48,13 +48,13 @@ CHIP_ERROR ConfigurationManagerImpl::Init() uint32_t rebootCount; // Save out software version on first boot - if (!P6Config::ConfigValueExists(P6Config::kConfigKey_SoftwareVersion)) + if (!PSOC6Config::ConfigValueExists(PSOC6Config::kConfigKey_SoftwareVersion)) { err = StoreSoftwareVersion(CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); SuccessOrExit(err); } - if (P6Config::ConfigValueExists(P6Config::kCounterKey_RebootCount)) + if (PSOC6Config::ConfigValueExists(PSOC6Config::kCounterKey_RebootCount)) { err = GetRebootCount(rebootCount); SuccessOrExit(err); @@ -69,14 +69,14 @@ CHIP_ERROR ConfigurationManagerImpl::Init() SuccessOrExit(err); } - if (!P6Config::ConfigValueExists(P6Config::kCounterKey_TotalOperationalHours)) + if (!PSOC6Config::ConfigValueExists(PSOC6Config::kCounterKey_TotalOperationalHours)) { err = StoreTotalOperationalHours(0); SuccessOrExit(err); } // Initialize the generic implementation base class. - err = Internal::GenericConfigurationManagerImpl::Init(); + err = Internal::GenericConfigurationManagerImpl::Init(); VerifyOrReturnError(CHIP_NO_ERROR == err, err); exit: @@ -85,32 +85,32 @@ CHIP_ERROR ConfigurationManagerImpl::Init() CHIP_ERROR ConfigurationManagerImpl::GetRebootCount(uint32_t & rebootCount) { - return ReadConfigValue(P6Config::kCounterKey_RebootCount, rebootCount); + return ReadConfigValue(PSOC6Config::kCounterKey_RebootCount, rebootCount); } CHIP_ERROR ConfigurationManagerImpl::StoreRebootCount(uint32_t rebootCount) { - return WriteConfigValue(P6Config::kCounterKey_RebootCount, rebootCount); + return WriteConfigValue(PSOC6Config::kCounterKey_RebootCount, rebootCount); } CHIP_ERROR ConfigurationManagerImpl::GetSoftwareVersion(uint32_t & softwareVer) { - return ReadConfigValue(P6Config::kConfigKey_SoftwareVersion, softwareVer); + return ReadConfigValue(PSOC6Config::kConfigKey_SoftwareVersion, softwareVer); } CHIP_ERROR ConfigurationManagerImpl::StoreSoftwareVersion(uint32_t softwareVer) { - return WriteConfigValue(P6Config::kConfigKey_SoftwareVersion, softwareVer); + return WriteConfigValue(PSOC6Config::kConfigKey_SoftwareVersion, softwareVer); } CHIP_ERROR ConfigurationManagerImpl::GetTotalOperationalHours(uint32_t & totalOperationalHours) { - return ReadConfigValue(P6Config::kCounterKey_TotalOperationalHours, totalOperationalHours); + return ReadConfigValue(PSOC6Config::kCounterKey_TotalOperationalHours, totalOperationalHours); } CHIP_ERROR ConfigurationManagerImpl::StoreTotalOperationalHours(uint32_t totalOperationalHours) { - return WriteConfigValue(P6Config::kCounterKey_TotalOperationalHours, totalOperationalHours); + return WriteConfigValue(PSOC6Config::kCounterKey_TotalOperationalHours, totalOperationalHours); } CHIP_ERROR ConfigurationManagerImpl::GetPrimaryWiFiMACAddress(uint8_t * buf) @@ -163,62 +163,62 @@ CHIP_ERROR ConfigurationManagerImpl::WritePersistedStorageValue(::chip::Platform CHIP_ERROR ConfigurationManagerImpl::ReadConfigValue(Key key, bool & val) { - return P6Config::ReadConfigValue(key, val); + return PSOC6Config::ReadConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::ReadConfigValue(Key key, uint32_t & val) { - return P6Config::ReadConfigValue(key, val); + return PSOC6Config::ReadConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::ReadConfigValue(Key key, uint64_t & val) { - return P6Config::ReadConfigValue(key, val); + return PSOC6Config::ReadConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen) { - return P6Config::ReadConfigValueStr(key, buf, bufSize, outLen); + return PSOC6Config::ReadConfigValueStr(key, buf, bufSize, outLen); } CHIP_ERROR ConfigurationManagerImpl::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen) { - return P6Config::ReadConfigValueBin(key, buf, bufSize, outLen); + return PSOC6Config::ReadConfigValueBin(key, buf, bufSize, outLen); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValue(Key key, bool val) { - return P6Config::WriteConfigValue(key, val); + return PSOC6Config::WriteConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValue(Key key, uint32_t val) { - return P6Config::WriteConfigValue(key, val); + return PSOC6Config::WriteConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValue(Key key, uint64_t val) { - return P6Config::WriteConfigValue(key, val); + return PSOC6Config::WriteConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValueStr(Key key, const char * str) { - return P6Config::WriteConfigValueStr(key, str); + return PSOC6Config::WriteConfigValueStr(key, str); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValueStr(Key key, const char * str, size_t strLen) { - return P6Config::WriteConfigValueStr(key, str, strLen); + return PSOC6Config::WriteConfigValueStr(key, str, strLen); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen) { - return P6Config::WriteConfigValueBin(key, data, dataLen); + return PSOC6Config::WriteConfigValueBin(key, data, dataLen); } void ConfigurationManagerImpl::RunConfigUnitTest(void) { - P6Config::RunConfigUnitTest(); + PSOC6Config::RunConfigUnitTest(); } void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) @@ -227,7 +227,7 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) ChipLogProgress(DeviceLayer, "Performing factory reset"); - err = P6Config::FactoryResetConfig(); + err = PSOC6Config::FactoryResetConfig(); if (err != CHIP_NO_ERROR) { ChipLogError(DeviceLayer, "FactoryResetConfig() failed: %s", ErrorStr(err)); diff --git a/src/platform/Infineon/PSOC6/ConfigurationManagerImpl.h b/src/platform/Infineon/PSOC6/ConfigurationManagerImpl.h index 1327b3bc546214..4ad9fef2c55a92 100644 --- a/src/platform/Infineon/PSOC6/ConfigurationManagerImpl.h +++ b/src/platform/Infineon/PSOC6/ConfigurationManagerImpl.h @@ -27,7 +27,7 @@ #include -#include "P6Config.h" +#include "PSOC6Config.h" namespace chip { namespace DeviceLayer { @@ -35,7 +35,7 @@ namespace DeviceLayer { /** * Concrete implementation of the ConfigurationManager singleton object for the PSoC6 platform. */ -class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl +class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImpl { public: CHIP_ERROR GetRebootCount(uint32_t & rebootCount) override; diff --git a/src/platform/Infineon/PSOC6/ConnectivityManagerImpl.cpp b/src/platform/Infineon/PSOC6/ConnectivityManagerImpl.cpp index b78f6fe757286b..a2f7fae9f32604 100644 --- a/src/platform/Infineon/PSOC6/ConnectivityManagerImpl.cpp +++ b/src/platform/Infineon/PSOC6/ConnectivityManagerImpl.cpp @@ -35,15 +35,17 @@ #include #include -#include +#include #include +#include "cy_network_mw_core.h" +#include "cy_nw_helper.h" + #include #include #include #include -#include "cy_network_mw_core.h" #include "lwip/opt.h" #include #include @@ -55,6 +57,7 @@ using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::System; +using namespace ::chip::TLV; namespace chip { namespace DeviceLayer { @@ -64,7 +67,7 @@ ConnectivityManagerImpl ConnectivityManagerImpl::sInstance; ConnectivityManager::WiFiStationMode ConnectivityManagerImpl::_GetWiFiStationMode(void) { uint32_t curWiFiMode; - mWiFiStationMode = (Internal::P6Utils::wifi_get_mode(curWiFiMode) == CHIP_NO_ERROR && + mWiFiStationMode = (Internal::PSOC6Utils::wifi_get_mode(curWiFiMode) == CHIP_NO_ERROR && (curWiFiMode == WIFI_MODE_APSTA || curWiFiMode == WIFI_MODE_STA)) ? kWiFiStationMode_Enabled : kWiFiStationMode_Disabled; @@ -103,7 +106,7 @@ bool ConnectivityManagerImpl::_IsWiFiStationEnabled(void) bool ConnectivityManagerImpl::_IsWiFiStationProvisioned(void) { - return Internal::P6Utils::IsStationProvisioned(); + return Internal::PSOC6Utils::IsStationProvisioned(); } void ConnectivityManagerImpl::_ClearWiFiStationProvision(void) @@ -113,7 +116,7 @@ void ConnectivityManagerImpl::_ClearWiFiStationProvision(void) wifi_config_t stationConfig; memset(&stationConfig, 0, sizeof(stationConfig)); - Internal::P6Utils::p6_wifi_set_config(WIFI_IF_STA, &stationConfig); + Internal::PSOC6Utils::p6_wifi_set_config(WIFI_IF_STA, &stationConfig); DeviceLayer::SystemLayer().ScheduleWork(DriveStationState, NULL); DeviceLayer::SystemLayer().ScheduleWork(DriveAPState, NULL); @@ -210,8 +213,8 @@ CHIP_ERROR ConnectivityManagerImpl::_Init() mWiFiAPIdleTimeout = System::Clock::Milliseconds32(CHIP_DEVICE_CONFIG_WIFI_AP_IDLE_TIMEOUT); mFlags.SetRaw(0); - // Ensure that P6 station mode is enabled. - err = Internal::P6Utils::EnableStationMode(); + // Ensure that PSOC6 station mode is enabled. + err = Internal::PSOC6Utils::EnableStationMode(); SuccessOrExit(err); // If there is no persistent station provision... if (!IsWiFiStationProvisioned()) @@ -230,7 +233,7 @@ CHIP_ERROR ConnectivityManagerImpl::_Init() memcpy(wifiConfig.sta.password, CHIP_DEVICE_CONFIG_DEFAULT_STA_PASSWORD, min(strlen(CHIP_DEVICE_CONFIG_DEFAULT_STA_PASSWORD), sizeof(wifiConfig.sta.password))); wifiConfig.sta.security = CHIP_DEVICE_CONFIG_DEFAULT_STA_SECURITY; - err = Internal::P6Utils::p6_wifi_set_config(WIFI_IF_STA, &wifiConfig); + err = Internal::PSOC6Utils::p6_wifi_set_config(WIFI_IF_STA, &wifiConfig); SuccessOrExit(err); // Enable WiFi station mode. @@ -247,7 +250,7 @@ CHIP_ERROR ConnectivityManagerImpl::_Init() ReturnErrorOnFailure(SetWiFiStationMode(kWiFiStationMode_Enabled)); } // Force AP mode off for now. - err = Internal::P6Utils::SetAPMode(false); + err = Internal::PSOC6Utils::SetAPMode(false); SuccessOrExit(err); // Queue work items to bootstrap the station state machines once the Chip event loop is running. @@ -375,10 +378,10 @@ CHIP_ERROR ConnectivityManagerImpl::ConfigureWiFiAP() wifiConfig.ap.ip_settings.gateway = ap_mode_ip_settings.gateway; ChipLogProgress(DeviceLayer, "Configuring WiFi AP: SSID %s, channel %u", wifiConfig.ap.ssid, wifiConfig.ap.channel); - err = Internal::P6Utils::p6_wifi_set_config(WIFI_IF_AP, &wifiConfig); + err = Internal::PSOC6Utils::p6_wifi_set_config(WIFI_IF_AP, &wifiConfig); SuccessOrExit(err); - err = Internal::P6Utils::p6_start_ap(); + err = Internal::PSOC6Utils::p6_start_ap(); if (err != CHIP_NO_ERROR) { ChipLogError(DeviceLayer, "p6_start_ap failed: %s", chip::ErrorStr(err)); @@ -394,8 +397,8 @@ void ConnectivityManagerImpl::DriveAPState() WiFiAPState targetState; bool APModeEnabled; - // Determine if AP mode is currently enabled in the P6 WiFi layer. - err = Internal::P6Utils::IsAPEnabled(APModeEnabled); + // Determine if AP mode is currently enabled in the PSOC6 WiFi layer. + err = Internal::PSOC6Utils::IsAPEnabled(APModeEnabled); SuccessOrExit(err); // Adjust the Connectivity Manager's AP state to match the state in the WiFi layer. @@ -470,13 +473,13 @@ void ConnectivityManagerImpl::DriveAPState() { // If the target state is 'Active' and the current state is NOT 'Activating', enable // and configure the AP interface, and then enter the 'Activating' state. Eventually - // a SYSTEM_EVENT_AP_START event will be received from the P6 WiFi layer which will + // a SYSTEM_EVENT_AP_START event will be received from the PSOC6 WiFi layer which will // cause the state to transition to 'Active'. if (targetState == kWiFiAPState_Active) { if (mWiFiAPState != kWiFiAPState_Active) { - err = Internal::P6Utils::SetAPMode(true); + err = Internal::PSOC6Utils::SetAPMode(true); SuccessOrExit(err); err = ConfigureWiFiAP(); SuccessOrExit(err); @@ -491,9 +494,9 @@ void ConnectivityManagerImpl::DriveAPState() { if (mWiFiAPState != kWiFiAPState_Deactivating) { - err = Internal::P6Utils::SetAPMode(false); + err = Internal::PSOC6Utils::SetAPMode(false); SuccessOrExit(err); - err = Internal::P6Utils::p6_stop_ap(); + err = Internal::PSOC6Utils::p6_stop_ap(); SuccessOrExit(err); ChangeWiFiAPState(kWiFiAPState_Deactivating); } @@ -505,8 +508,8 @@ void ConnectivityManagerImpl::DriveAPState() if (err != CHIP_NO_ERROR && mWiFiAPMode != kWiFiAPMode_ApplicationControlled) { SetWiFiAPMode(kWiFiAPMode_Disabled); - Internal::P6Utils::SetAPMode(false); - Internal::P6Utils::p6_stop_ap(); + Internal::PSOC6Utils::SetAPMode(false); + Internal::PSOC6Utils::p6_stop_ap(); } } @@ -518,17 +521,17 @@ void ConnectivityManagerImpl::DriveStationState() // If the station interface is NOT under application control... if (mWiFiStationMode != kWiFiStationMode_ApplicationControlled) { - // Ensure that the P6 WiFi layer is started. + // Ensure that the PSOC6 WiFi layer is started. err = WiFi_init(); SuccessOrExit(err); - // Ensure that station mode is enabled in the P6 WiFi layer. - err = Internal::P6Utils::EnableStationMode(); + // Ensure that station mode is enabled in the PSOC6 WiFi layer. + err = Internal::PSOC6Utils::EnableStationMode(); SuccessOrExit(err); } - // Determine if the P6 WiFi layer thinks the station interface is currently connected. - err = Internal::P6Utils::IsStationConnected(stationConnected); + // Determine if the PSOC6 WiFi layer thinks the station interface is currently connected. + err = Internal::PSOC6Utils::IsStationConnected(stationConnected); SuccessOrExit(err); // If the station interface is currently connected ... if (stationConnected) @@ -549,7 +552,7 @@ void ConnectivityManagerImpl::DriveStationState() (mWiFiStationMode != kWiFiStationMode_Enabled || !IsWiFiStationProvisioned())) { ChipLogProgress(DeviceLayer, "Disconnecting WiFi station interface"); - err = Internal::P6Utils::p6_wifi_disconnect(); + err = Internal::PSOC6Utils::p6_wifi_disconnect(); if (err != CHIP_NO_ERROR) { ChipLogError(DeviceLayer, "p6_wifi_disconnect() failed: %s", chip::ErrorStr(err)); @@ -593,7 +596,7 @@ void ConnectivityManagerImpl::DriveStationState() { ChangeWiFiStationState(kWiFiStationState_Connecting); ChipLogProgress(DeviceLayer, "Attempting to connect WiFi station interface"); - err = Internal::P6Utils::p6_wifi_connect(); + err = Internal::PSOC6Utils::p6_wifi_connect(); if (err != CHIP_NO_ERROR) { ChipLogError(DeviceLayer, "p6_wifi_connect() failed: %s", chip::ErrorStr(err)); @@ -632,7 +635,7 @@ void ConnectivityManagerImpl::UpdateInternetConnectivityState(void) struct netif * net_interface = NULL; IPAddress addr; bool stationConnected; - Internal::P6Utils::IsStationConnected(stationConnected); + Internal::PSOC6Utils::IsStationConnected(stationConnected); ChipLogProgress(DeviceLayer, "UpdateInternetConnectivityState"); // If the WiFi station is currently in the connected state... @@ -705,7 +708,7 @@ CHIP_ERROR ConnectivityManagerImpl::WiFi_init(void) { CHIP_ERROR err = CHIP_NO_ERROR; cy_rslt_t result = CY_RSLT_SUCCESS; - err = Internal::P6Utils::StartWiFiLayer(); + err = Internal::PSOC6Utils::StartWiFiLayer(); SuccessOrExit(err); /* Register event callback */ if (eventcallback == false) @@ -726,7 +729,7 @@ CHIP_ERROR ConnectivityManagerImpl::WiFi_init(void) CHIP_ERROR ConnectivityManagerImpl::ping_thread() { CHIP_ERROR err = CHIP_NO_ERROR; - err = Internal::P6Utils::ping_init(); + err = Internal::PSOC6Utils::ping_init(); return err; } diff --git a/src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.cpp b/src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.cpp index b09fd83cecc5df..0abd1cba0dd5ad 100644 --- a/src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.cpp +++ b/src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.cpp @@ -1,6 +1,7 @@ /* * * Copyright (c) 2021-2022 Project CHIP Authors + * Copyright (c) 2024 Infineon Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,18 +19,19 @@ /** * @file * Provides an implementation of the DiagnosticDataProvider object - * for P6 platform. + * for PSOC6 platform. */ #include #include "cy_network_mw_core.h" +#include "cy_nw_helper.h" #include "cyhal_system.h" #include #include #include #include -#include +#include namespace chip { namespace DeviceLayer { @@ -43,7 +45,7 @@ DiagnosticDataProviderImpl & DiagnosticDataProviderImpl::GetDefaultInstance() CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapFree(uint64_t & currentHeapFree) { heap_info_t heap; - Internal::P6Utils::heap_usage(&heap); + Internal::PSOC6Utils::heap_usage(&heap); currentHeapFree = static_cast(heap.HeapFree); return CHIP_NO_ERROR; } @@ -52,7 +54,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapUsed(uint64_t & currentHeap { // Calculate the Heap used based on Total heap - Free heap heap_info_t heap; - Internal::P6Utils::heap_usage(&heap); + Internal::PSOC6Utils::heap_usage(&heap); currentHeapUsed = static_cast(heap.HeapUsed); return CHIP_NO_ERROR; } @@ -60,7 +62,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapUsed(uint64_t & currentHeap CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark) { heap_info_t heap; - Internal::P6Utils::heap_usage(&heap); + Internal::PSOC6Utils::heap_usage(&heap); currentHeapHighWatermark = static_cast(heap.HeapMax); return CHIP_NO_ERROR; } @@ -506,7 +508,7 @@ void DiagnosticDataProviderImpl::xtlv_buffer_parsing(const uint8_t * tlv_buf, ui wl_cnt_ge40mcst_v1_t cnt_ge40; /* parse the tlv buffer and populate the cnt and cnt_ge40 buffer with the counter values */ - Internal::P6Utils::unpack_xtlv_buf(tlv_buf, buflen, &cnt, &cnt_ge40); + Internal::PSOC6Utils::unpack_xtlv_buf(tlv_buf, buflen, &cnt, &cnt_ge40); /* Read the counter based on the Counttype passed */ ReadCounters(Counttype, count, &cnt, &cnt_ge40); @@ -571,17 +573,20 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetThreadMetrics(ThreadMetrics ** threadM { ThreadMetrics * thread = (ThreadMetrics *) pvPortMalloc(sizeof(ThreadMetrics)); - Platform::CopyString(thread->NameBuf, taskStatusArray[x].pcTaskName); - thread->name.Emplace(CharSpan::fromCharString(thread->NameBuf)); - thread->id = taskStatusArray[x].xTaskNumber; + if (thread != NULL) + { + Platform::CopyString(thread->NameBuf, taskStatusArray[x].pcTaskName); + thread->name.Emplace(CharSpan::fromCharString(thread->NameBuf)); + thread->id = taskStatusArray[x].xTaskNumber; - thread->stackFreeMinimum.Emplace(taskStatusArray[x].usStackHighWaterMark); - /* Unsupported metrics */ - thread->stackSize.Emplace(0); - thread->stackFreeCurrent.Emplace(0); + thread->stackFreeMinimum.Emplace(taskStatusArray[x].usStackHighWaterMark); + /* Unsupported metrics */ + thread->stackSize.Emplace(0); + thread->stackFreeCurrent.Emplace(0); - thread->Next = head; - head = thread; + thread->Next = head; + head = thread; + } } *threadMetricsOut = head; diff --git a/src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.h b/src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.h index f3e625d787a9e5..2d02050a9ddb68 100644 --- a/src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.h +++ b/src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.h @@ -31,7 +31,7 @@ #include "whd_wlioctl.h" #include #include -#include +#include #define PHYRATE_KPBS_BYTES_PER_SEC 125 diff --git a/src/platform/Infineon/PSOC6/KeyValueStoreManagerImpl.cpp b/src/platform/Infineon/PSOC6/KeyValueStoreManagerImpl.cpp index e38d41e47fc61a..fe60d50a2823ae 100644 --- a/src/platform/Infineon/PSOC6/KeyValueStoreManagerImpl.cpp +++ b/src/platform/Infineon/PSOC6/KeyValueStoreManagerImpl.cpp @@ -18,7 +18,7 @@ /** * @file - * Platform-specific key value storage implementation for P6 + * Platform-specific key value storage implementation for PSOC6 */ #include "cy_result.h" diff --git a/src/platform/Infineon/PSOC6/KeyValueStoreManagerImpl.h b/src/platform/Infineon/PSOC6/KeyValueStoreManagerImpl.h index 62bead34c37033..5300d06d8ce014 100644 --- a/src/platform/Infineon/PSOC6/KeyValueStoreManagerImpl.h +++ b/src/platform/Infineon/PSOC6/KeyValueStoreManagerImpl.h @@ -18,7 +18,7 @@ /** * @file - * Platform-specific key value storage implementation for P6. + * Platform-specific key value storage implementation for PSOC6. * */ @@ -71,7 +71,7 @@ inline KeyValueStoreManager & KeyValueStoreMgr(void) * Returns the platform-specific implementation of the KeyValueStoreManager singleton object. * * Chip applications can use this to gain access to features of the KeyValueStoreManager - * that are specific to the P6 platform. + * that are specific to the PSOC6 platform. */ inline KeyValueStoreManagerImpl & KeyValueStoreMgrImpl(void) { diff --git a/src/platform/Infineon/PSOC6/Logging.cpp b/src/platform/Infineon/PSOC6/Logging.cpp index ab6af699ac3a17..14d824f63229ec 100644 --- a/src/platform/Infineon/PSOC6/Logging.cpp +++ b/src/platform/Infineon/PSOC6/Logging.cpp @@ -25,7 +25,7 @@ namespace Platform { */ void LogV(const char * module, uint8_t category, const char * msg, va_list v) { -#if P6_LOG_ENABLED && _CHIP_USE_LOGGING +#if PSOC6_LOG_ENABLED && _CHIP_USE_LOGGING printf("CHIP:%s: ", module); vprintf(msg, v); printf("\n"); @@ -34,11 +34,11 @@ void LogV(const char * module, uint8_t category, const char * msg, va_list v) #endif } -extern "C" void P6Log(const char * aFormat, ...) +extern "C" void PSOC6Log(const char * aFormat, ...) { va_list v; va_start(v, aFormat); - LogV("P6", chip::Logging::kLogCategory_Progress, aFormat, v); + LogV("PSOC6", chip::Logging::kLogCategory_Progress, aFormat, v); va_end(v); } diff --git a/src/platform/Infineon/PSOC6/NetworkCommissioningWiFiDriver.cpp b/src/platform/Infineon/PSOC6/NetworkCommissioningWiFiDriver.cpp index 7fe0c1aaebb099..edeb39f588abf9 100644 --- a/src/platform/Infineon/PSOC6/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/Infineon/PSOC6/NetworkCommissioningWiFiDriver.cpp @@ -19,8 +19,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -140,11 +140,11 @@ CHIP_ERROR P6WiFiDriver::ConnectWiFiNetwork(const char * ssid, uint8_t ssidLen, ReturnErrorOnFailure(ConnectivityMgr().SetWiFiStationMode(ConnectivityManager::kWiFiStationMode_Disabled)); // Set the wifi configuration wifi_config_t wifi_config; - chip::DeviceLayer::Internal::P6Utils::populate_wifi_config_t( + chip::DeviceLayer::Internal::PSOC6Utils::populate_wifi_config_t( &wifi_config, WIFI_IF_STA, (const cy_wcm_ssid_t *) ssid, (const cy_wcm_passphrase_t *) key, (keyLen) ? CHIP_DEVICE_CONFIG_DEFAULT_STA_SECURITY : CY_WCM_SECURITY_OPEN); - err = chip::DeviceLayer::Internal::P6Utils::p6_wifi_set_config(WIFI_IF_STA, &wifi_config); + err = chip::DeviceLayer::Internal::PSOC6Utils::p6_wifi_set_config(WIFI_IF_STA, &wifi_config); SuccessOrExit(err); ReturnErrorOnFailure(ConnectivityMgr().SetWiFiStationMode(ConnectivityManager::kWiFiStationMode_Disabled)); @@ -173,7 +173,7 @@ void P6WiFiDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * callback VerifyOrExit(NetworkMatch(mStagingNetwork, networkId), networkingStatus = Status::kNetworkIDNotFound); VerifyOrExit(mpConnectCallback == nullptr, networkingStatus = Status::kUnknownError); - ChipLogProgress(NetworkProvisioning, "P6 NetworkCommissioningDelegate: SSID: %s", mStagingNetwork.ssid); + ChipLogProgress(NetworkProvisioning, "PSOC6 NetworkCommissioningDelegate: SSID: %s", mStagingNetwork.ssid); err = ConnectWiFiNetwork(reinterpret_cast(mStagingNetwork.ssid), mStagingNetwork.ssidLen, reinterpret_cast(mStagingNetwork.credentials), mStagingNetwork.credentialsLen); mpConnectCallback = callback; @@ -353,7 +353,7 @@ void P6WiFiDriver::OnNetworkStatusChange() { Network configuredNetwork; bool staEnabled = false, staConnected = false; - VerifyOrReturn(P6Utils::IsStationEnabled(staEnabled) == CHIP_NO_ERROR); + VerifyOrReturn(PSOC6Utils::IsStationEnabled(staEnabled) == CHIP_NO_ERROR); VerifyOrReturn(staEnabled && mpStatusChangeCallback != nullptr); CHIP_ERROR err = GetConnectedNetwork(configuredNetwork); if (err != CHIP_NO_ERROR) @@ -361,7 +361,7 @@ void P6WiFiDriver::OnNetworkStatusChange() ChipLogError(DeviceLayer, "Failed to get configured network when updating network status: %s", err.AsString()); return; } - VerifyOrReturn(P6Utils::IsStationConnected(staConnected) == CHIP_NO_ERROR); + VerifyOrReturn(PSOC6Utils::IsStationConnected(staConnected) == CHIP_NO_ERROR); if (staConnected) { mpStatusChangeCallback->OnNetworkingStatusChange( diff --git a/src/platform/Infineon/PSOC6/OTAImageProcessorImpl.cpp b/src/platform/Infineon/PSOC6/OTAImageProcessorImpl.cpp index b1cf7001bd2d38..d47434a80d4fb0 100644 --- a/src/platform/Infineon/PSOC6/OTAImageProcessorImpl.cpp +++ b/src/platform/Infineon/PSOC6/OTAImageProcessorImpl.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #include using namespace ::chip::DeviceLayer::Internal; @@ -153,7 +152,7 @@ void OTAImageProcessorImpl::HandlePrepareDownload(intptr_t context) } /* Initialize SMIF subsystem for OTA Image download */ - ota_smif_initialize(); + cy_ota_mem_init(); // Open and erase secondary flash area to prepare if (flash_area_open(FLASH_AREA_IMAGE_SECONDARY(0), &(imageProcessor->mFlashArea)) != 0) @@ -187,7 +186,7 @@ void OTAImageProcessorImpl::HandleFinalize(intptr_t context) flash_area_close(imageProcessor->mFlashArea); ChipLogProgress(SoftwareUpdate, "Setting boot pending"); - int ret = boot_set_pending(0, 1); + int ret = flash_area_boot_set_pending(0, 1); if (ret != 0) { diff --git a/src/platform/Infineon/PSOC6/OTAImageProcessorImpl.h b/src/platform/Infineon/PSOC6/OTAImageProcessorImpl.h index e1ec3d50e9806c..3ac4f418008d40 100644 --- a/src/platform/Infineon/PSOC6/OTAImageProcessorImpl.h +++ b/src/platform/Infineon/PSOC6/OTAImageProcessorImpl.h @@ -26,11 +26,10 @@ #ifdef P6_OTA extern "C" { -#include "bootutil/bootutil.h" -#include "cy_flash_psoc6.h" +#include "cy_ota_flash.h" #include "flash_map_backend.h" #include "flash_qspi.h" -#include "sysflash/sysflash.h" +#include "sysflash.h" } namespace chip { diff --git a/src/platform/Infineon/PSOC6/P6Config.cpp b/src/platform/Infineon/PSOC6/PSOC6Config.cpp similarity index 52% rename from src/platform/Infineon/PSOC6/P6Config.cpp rename to src/platform/Infineon/PSOC6/PSOC6Config.cpp index 2ef8a5ed038476..1c040811686fa3 100644 --- a/src/platform/Infineon/PSOC6/P6Config.cpp +++ b/src/platform/Infineon/PSOC6/PSOC6Config.cpp @@ -20,21 +20,21 @@ /** * @file - * Utilities for interacting with the the P6 key-value store. + * Utilities for interacting with the the PSOC6 key-value store. */ /* this file behaves like a config.h, comes first */ #include #include -#include +#include #include #include #include #include #include -#include +#include namespace chip { namespace DeviceLayer { @@ -43,57 +43,57 @@ namespace Internal { // *** CAUTION ***: Changing the names or namespaces of these values will *break* existing devices. // Namespaces used to store device configuration information. -const char P6Config::kConfigNamespace_ChipFactory[] = "chip-factory"; -const char P6Config::kConfigNamespace_ChipConfig[] = "chip-config"; -const char P6Config::kConfigNamespace_ChipCounters[] = "chip-counters"; +const char PSOC6Config::kConfigNamespace_ChipFactory[] = "chip-factory"; +const char PSOC6Config::kConfigNamespace_ChipConfig[] = "chip-config"; +const char PSOC6Config::kConfigNamespace_ChipCounters[] = "chip-counters"; // Keys stored in the chip-factory namespace -const P6Config::Key P6Config::kConfigKey_SerialNum = { kConfigNamespace_ChipFactory, "serial-num" }; -const P6Config::Key P6Config::kConfigKey_MfrDeviceId = { kConfigNamespace_ChipFactory, "device-id" }; -const P6Config::Key P6Config::kConfigKey_MfrDeviceCert = { kConfigNamespace_ChipFactory, "device-cert" }; -const P6Config::Key P6Config::kConfigKey_MfrDeviceICACerts = { kConfigNamespace_ChipFactory, "device-ca-certs" }; -const P6Config::Key P6Config::kConfigKey_MfrDevicePrivateKey = { kConfigNamespace_ChipFactory, "device-key" }; -const P6Config::Key P6Config::kConfigKey_SoftwareVersion = { kConfigNamespace_ChipFactory, "software-ver" }; -const P6Config::Key P6Config::kConfigKey_HardwareVersion = { kConfigNamespace_ChipFactory, "hardware-ver" }; -const P6Config::Key P6Config::kConfigKey_ManufacturingDate = { kConfigNamespace_ChipFactory, "mfg-date" }; -const P6Config::Key P6Config::kConfigKey_SetupPinCode = { kConfigNamespace_ChipFactory, "pin-code" }; -const P6Config::Key P6Config::kConfigKey_SetupDiscriminator = { kConfigNamespace_ChipFactory, "discriminator" }; -const P6Config::Key P6Config::kConfigKey_Spake2pIterationCount = { kConfigNamespace_ChipFactory, "iteration-count" }; -const P6Config::Key P6Config::kConfigKey_Spake2pSalt = { kConfigNamespace_ChipFactory, "salt" }; -const P6Config::Key P6Config::kConfigKey_Spake2pVerifier = { kConfigNamespace_ChipFactory, "verifier" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_SerialNum = { kConfigNamespace_ChipFactory, "serial-num" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_MfrDeviceId = { kConfigNamespace_ChipFactory, "device-id" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_MfrDeviceCert = { kConfigNamespace_ChipFactory, "device-cert" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_MfrDeviceICACerts = { kConfigNamespace_ChipFactory, "device-ca-certs" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_MfrDevicePrivateKey = { kConfigNamespace_ChipFactory, "device-key" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_SoftwareVersion = { kConfigNamespace_ChipFactory, "software-ver" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_HardwareVersion = { kConfigNamespace_ChipFactory, "hardware-ver" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_ManufacturingDate = { kConfigNamespace_ChipFactory, "mfg-date" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_SetupPinCode = { kConfigNamespace_ChipFactory, "pin-code" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_SetupDiscriminator = { kConfigNamespace_ChipFactory, "discriminator" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_Spake2pIterationCount = { kConfigNamespace_ChipFactory, "iteration-count" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_Spake2pSalt = { kConfigNamespace_ChipFactory, "salt" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_Spake2pVerifier = { kConfigNamespace_ChipFactory, "verifier" }; // Keys stored in the chip-config namespace -const P6Config::Key P6Config::kConfigKey_ServiceConfig = { kConfigNamespace_ChipConfig, "service-config" }; -const P6Config::Key P6Config::kConfigKey_PairedAccountId = { kConfigNamespace_ChipConfig, "account-id" }; -const P6Config::Key P6Config::kConfigKey_ServiceId = { kConfigNamespace_ChipConfig, "service-id" }; -const P6Config::Key P6Config::kConfigKey_LastUsedEpochKeyId = { kConfigNamespace_ChipConfig, "last-ek-id" }; -const P6Config::Key P6Config::kConfigKey_FailSafeArmed = { kConfigNamespace_ChipConfig, "fail-safe-armed" }; -const P6Config::Key P6Config::kConfigKey_WiFiStationSecType = { kConfigNamespace_ChipConfig, "sta-sec-type" }; -const P6Config::Key P6Config::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" }; -const P6Config::Key P6Config::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" }; -const P6Config::Key P6Config::kConfigKey_WiFiSSID = { kConfigNamespace_ChipConfig, "wifi-ssid" }; -const P6Config::Key P6Config::kConfigKey_WiFiPassword = { kConfigNamespace_ChipConfig, "wifi-password" }; -const P6Config::Key P6Config::kConfigKey_WiFiSecurity = { kConfigNamespace_ChipConfig, "wifi-security" }; -const P6Config::Key P6Config::kConfigKey_WiFiMode = { kConfigNamespace_ChipConfig, "wifimode" }; -const P6Config::Key P6Config::kConfigKey_UniqueId = { kConfigNamespace_ChipConfig, "unique-id" }; -const P6Config::Key P6Config::kConfigKey_LockUser = { kConfigNamespace_ChipConfig, "lock-user" }; -const P6Config::Key P6Config::kConfigKey_Credential = { kConfigNamespace_ChipConfig, "credential" }; -const P6Config::Key P6Config::kConfigKey_LockUserName = { kConfigNamespace_ChipConfig, "lock-user-name" }; -const P6Config::Key P6Config::kConfigKey_CredentialData = { kConfigNamespace_ChipConfig, "credential-data" }; -const P6Config::Key P6Config::kConfigKey_UserCredentials = { kConfigNamespace_ChipConfig, "user-credentials" }; -const P6Config::Key P6Config::kConfigKey_WeekDaySchedules = { kConfigNamespace_ChipConfig, "weekday-schedules" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_ServiceConfig = { kConfigNamespace_ChipConfig, "service-config" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_PairedAccountId = { kConfigNamespace_ChipConfig, "account-id" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_ServiceId = { kConfigNamespace_ChipConfig, "service-id" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_LastUsedEpochKeyId = { kConfigNamespace_ChipConfig, "last-ek-id" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_FailSafeArmed = { kConfigNamespace_ChipConfig, "fail-safe-armed" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_WiFiStationSecType = { kConfigNamespace_ChipConfig, "sta-sec-type" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_WiFiSSID = { kConfigNamespace_ChipConfig, "wifi-ssid" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_WiFiPassword = { kConfigNamespace_ChipConfig, "wifi-password" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_WiFiSecurity = { kConfigNamespace_ChipConfig, "wifi-security" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_WiFiMode = { kConfigNamespace_ChipConfig, "wifimode" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_UniqueId = { kConfigNamespace_ChipConfig, "unique-id" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_LockUser = { kConfigNamespace_ChipConfig, "lock-user" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_Credential = { kConfigNamespace_ChipConfig, "credential" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_LockUserName = { kConfigNamespace_ChipConfig, "lock-user-name" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_CredentialData = { kConfigNamespace_ChipConfig, "credential-data" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_UserCredentials = { kConfigNamespace_ChipConfig, "user-credentials" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_WeekDaySchedules = { kConfigNamespace_ChipConfig, "weekday-schedules" }; ; -const P6Config::Key P6Config::kConfigKey_YearDaySchedules = { kConfigNamespace_ChipConfig, "yearday-schedules" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_YearDaySchedules = { kConfigNamespace_ChipConfig, "yearday-schedules" }; ; -const P6Config::Key P6Config::kConfigKey_HolidaySchedules = { kConfigNamespace_ChipConfig, "holiday-schedules" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_HolidaySchedules = { kConfigNamespace_ChipConfig, "holiday-schedules" }; ; // Keys stored in the Chip-counters namespace -const P6Config::Key P6Config::kCounterKey_RebootCount = { kConfigNamespace_ChipCounters, "reboot-count" }; -const P6Config::Key P6Config::kCounterKey_UpTime = { kConfigNamespace_ChipCounters, "up-time" }; -const P6Config::Key P6Config::kCounterKey_TotalOperationalHours = { kConfigNamespace_ChipCounters, "total-hours" }; +const PSOC6Config::Key PSOC6Config::kCounterKey_RebootCount = { kConfigNamespace_ChipCounters, "reboot-count" }; +const PSOC6Config::Key PSOC6Config::kCounterKey_UpTime = { kConfigNamespace_ChipCounters, "up-time" }; +const PSOC6Config::Key PSOC6Config::kCounterKey_TotalOperationalHours = { kConfigNamespace_ChipCounters, "total-hours" }; -CHIP_ERROR P6Config::ReadConfigValue(Key key, bool & val) +CHIP_ERROR PSOC6Config::ReadConfigValue(Key key, bool & val) { bool in; char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 }; @@ -107,7 +107,7 @@ CHIP_ERROR P6Config::ReadConfigValue(Key key, bool & val) return err; } -CHIP_ERROR P6Config::ReadConfigValue(Key key, uint32_t & val) +CHIP_ERROR PSOC6Config::ReadConfigValue(Key key, uint32_t & val) { uint32_t in; char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 }; @@ -121,7 +121,7 @@ CHIP_ERROR P6Config::ReadConfigValue(Key key, uint32_t & val) return err; } -CHIP_ERROR P6Config::ReadConfigValue(Key key, uint64_t & val) +CHIP_ERROR PSOC6Config::ReadConfigValue(Key key, uint64_t & val) { uint64_t in; char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 }; @@ -135,7 +135,7 @@ CHIP_ERROR P6Config::ReadConfigValue(Key key, uint64_t & val) return err; } -CHIP_ERROR P6Config::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen) +CHIP_ERROR PSOC6Config::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen) { char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 }; key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE); @@ -147,7 +147,7 @@ CHIP_ERROR P6Config::ReadConfigValueStr(Key key, char * buf, size_t bufSize, siz return err; } -CHIP_ERROR P6Config::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen) +CHIP_ERROR PSOC6Config::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen) { char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 }; key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE); @@ -159,28 +159,28 @@ CHIP_ERROR P6Config::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, return err; } -CHIP_ERROR P6Config::WriteConfigValue(Key key, bool val) +CHIP_ERROR PSOC6Config::WriteConfigValue(Key key, bool val) { char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 }; key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE); return PersistedStorage::KeyValueStoreMgr().Put(key_str, static_cast(&val), sizeof(bool)); } -CHIP_ERROR P6Config::WriteConfigValue(Key key, uint32_t val) +CHIP_ERROR PSOC6Config::WriteConfigValue(Key key, uint32_t val) { char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 }; key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE); return PersistedStorage::KeyValueStoreMgr().Put(key_str, static_cast(&val), 4); } -CHIP_ERROR P6Config::WriteConfigValue(Key key, uint64_t val) +CHIP_ERROR PSOC6Config::WriteConfigValue(Key key, uint64_t val) { char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 }; key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE); return PersistedStorage::KeyValueStoreMgr().Put(key_str, static_cast(&val), 8); } -CHIP_ERROR P6Config::WriteConfigValueStr(Key key, const char * str) +CHIP_ERROR PSOC6Config::WriteConfigValueStr(Key key, const char * str) { size_t size = strlen(str) + 1; char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 }; @@ -188,27 +188,27 @@ CHIP_ERROR P6Config::WriteConfigValueStr(Key key, const char * str) return PersistedStorage::KeyValueStoreMgr().Put(key_str, str, size); } -CHIP_ERROR P6Config::WriteConfigValueStr(Key key, const char * str, size_t strLen) +CHIP_ERROR PSOC6Config::WriteConfigValueStr(Key key, const char * str, size_t strLen) { char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 }; key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE); return PersistedStorage::KeyValueStoreMgr().Put(key_str, str, strLen); } -CHIP_ERROR P6Config::WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen) +CHIP_ERROR PSOC6Config::WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen) { char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 }; key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE); return PersistedStorage::KeyValueStoreMgr().Put(key_str, data, dataLen); } -CHIP_ERROR P6Config::ClearConfigValue(Key key) +CHIP_ERROR PSOC6Config::ClearConfigValue(Key key) { char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 }; key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE); return PersistedStorage::KeyValueStoreMgr().Delete(key_str); } -bool P6Config::ConfigValueExists(Key key) +bool PSOC6Config::ConfigValueExists(Key key) { char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 }; key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE); @@ -221,7 +221,7 @@ bool P6Config::ConfigValueExists(Key key) } // Clear out keys in config namespace -CHIP_ERROR P6Config::FactoryResetConfig(void) +CHIP_ERROR PSOC6Config::FactoryResetConfig(void) { CHIP_ERROR err = CHIP_NO_ERROR; const Key * config_keys[] = { &kConfigKey_ServiceConfig, &kConfigKey_PairedAccountId, &kConfigKey_ServiceId, @@ -249,7 +249,7 @@ CHIP_ERROR P6Config::FactoryResetConfig(void) return CHIP_NO_ERROR; } -void P6Config::RunConfigUnitTest() {} +void PSOC6Config::RunConfigUnitTest() {} } // namespace Internal } // namespace DeviceLayer diff --git a/src/platform/Infineon/PSOC6/P6Config.h b/src/platform/Infineon/PSOC6/PSOC6Config.h similarity index 93% rename from src/platform/Infineon/PSOC6/P6Config.h rename to src/platform/Infineon/PSOC6/PSOC6Config.h index 7e62fd6e66b772..17fa896346c348 100644 --- a/src/platform/Infineon/PSOC6/P6Config.h +++ b/src/platform/Infineon/PSOC6/PSOC6Config.h @@ -20,7 +20,7 @@ /** * @file - * Utilities for interacting with the the P6 key-value store. + * Utilities for interacting with the the PSOC6 key-value store. */ #pragma once @@ -35,12 +35,12 @@ namespace DeviceLayer { namespace Internal { /** - * Provides functions and definitions for accessing device configuration information on the P6. + * Provides functions and definitions for accessing device configuration information on the PSOC6. * * This class is designed to be mixed-in to concrete implementation classes as a means to * provide access to configuration information to generic base classes. */ -class P6Config +class PSOC6Config { public: struct Key; @@ -114,7 +114,7 @@ class P6Config static void RunConfigUnitTest(void); }; -struct P6Config::Key +struct PSOC6Config::Key { const char * Namespace; const char * Name; @@ -124,7 +124,7 @@ struct P6Config::Key bool operator==(const Key & other) const; }; -inline CHIP_ERROR P6Config::Key::to_str(char * buf, size_t buf_size) const +inline CHIP_ERROR PSOC6Config::Key::to_str(char * buf, size_t buf_size) const { if (buf_size < len() + 1) { @@ -139,14 +139,14 @@ inline CHIP_ERROR P6Config::Key::to_str(char * buf, size_t buf_size) const } // Length of key str (not including terminating null char) -inline size_t P6Config::Key::len() const +inline size_t PSOC6Config::Key::len() const { // + 1 for separating ';' size_t out_size = strlen(Namespace) + strlen(Name) + 1; return out_size; } -inline bool P6Config::Key::operator==(const Key & other) const +inline bool PSOC6Config::Key::operator==(const Key & other) const { return strcmp(Namespace, other.Namespace) == 0 && strcmp(Name, other.Name) == 0; } diff --git a/src/platform/Infineon/PSOC6/P6Utils.cpp b/src/platform/Infineon/PSOC6/PSOC6Utils.cpp similarity index 85% rename from src/platform/Infineon/PSOC6/P6Utils.cpp rename to src/platform/Infineon/PSOC6/PSOC6Utils.cpp index 2964cc4b5dfa5b..c65a29f6a96475 100644 --- a/src/platform/Infineon/PSOC6/P6Utils.cpp +++ b/src/platform/Infineon/PSOC6/PSOC6Utils.cpp @@ -19,17 +19,18 @@ /** * @file - * General utility methods for the P6 platform. + * General utility methods for the PSOC6 platform. */ /* this file behaves like a config.h, comes first */ #include #include "cy_network_mw_core.h" +#include "cy_nw_helper.h" #include #include #include #include -#include +#include #include "lwip/icmp.h" #include "lwip/inet.h" @@ -43,7 +44,7 @@ #include "lwip/sys.h" #include "lwip/timeouts.h" #include -#include +#include using namespace ::chip::DeviceLayer::Internal; using chip::DeviceLayer::Internal::DeviceNetworkInfo; @@ -96,39 +97,39 @@ typedef struct uint8_t data[PING_DATA_SIZE]; } icmp_packet_t; -CHIP_ERROR P6Utils::IsAPEnabled(bool & apEnabled) +CHIP_ERROR PSOC6Utils::IsAPEnabled(bool & apEnabled) { apEnabled = (WiFiMode == WIFI_MODE_AP || WiFiMode == WIFI_MODE_APSTA); return CHIP_NO_ERROR; } -CHIP_ERROR P6Utils::IsStationEnabled(bool & staEnabled) +CHIP_ERROR PSOC6Utils::IsStationEnabled(bool & staEnabled) { staEnabled = (WiFiMode == WIFI_MODE_STA || WiFiMode == WIFI_MODE_APSTA); return CHIP_NO_ERROR; } -bool P6Utils::IsStationProvisioned(void) +bool PSOC6Utils::IsStationProvisioned(void) { wifi_config_t stationConfig; return (p6_wifi_get_config(WIFI_IF_STA, &stationConfig) == CHIP_NO_ERROR && strlen((const char *) stationConfig.sta.ssid) != 0); } -CHIP_ERROR P6Utils::IsStationConnected(bool & connected) +CHIP_ERROR PSOC6Utils::IsStationConnected(bool & connected) { CHIP_ERROR err = CHIP_NO_ERROR; connected = cy_wcm_is_connected_to_ap(); return err; } -CHIP_ERROR P6Utils::StartWiFiLayer(void) +CHIP_ERROR PSOC6Utils::StartWiFiLayer(void) { CHIP_ERROR err = CHIP_NO_ERROR; cy_rslt_t result = CY_RSLT_SUCCESS; cy_wcm_config_t wcm_config; wcm_config.interface = CY_WCM_INTERFACE_TYPE_AP_STA; - ChipLogProgress(DeviceLayer, "Starting P6 WiFi layer"); + ChipLogProgress(DeviceLayer, "Starting PSOC6 WiFi layer"); if (wcm_init_done == false) { @@ -136,7 +137,7 @@ CHIP_ERROR P6Utils::StartWiFiLayer(void) if (result != CY_RSLT_SUCCESS) { err = CHIP_ERROR_INTERNAL; - ChipLogError(DeviceLayer, "StartWiFiLayer() P6 Wi-Fi Started Failed: %s", chip::ErrorStr(err)); + ChipLogError(DeviceLayer, "StartWiFiLayer() PSOC6 Wi-Fi Started Failed: %s", chip::ErrorStr(err)); SuccessOrExit(err); } wcm_init_done = true; @@ -146,7 +147,7 @@ CHIP_ERROR P6Utils::StartWiFiLayer(void) return err; } -CHIP_ERROR P6Utils::EnableStationMode(void) +CHIP_ERROR PSOC6Utils::EnableStationMode(void) { CHIP_ERROR err = CHIP_NO_ERROR; ChipLogProgress(DeviceLayer, "EnableStationMode"); @@ -163,7 +164,7 @@ CHIP_ERROR P6Utils::EnableStationMode(void) return err; } -CHIP_ERROR P6Utils::SetAPMode(bool enabled) +CHIP_ERROR PSOC6Utils::SetAPMode(bool enabled) { CHIP_ERROR err = CHIP_NO_ERROR; ChipLogProgress(DeviceLayer, "SetAPMode"); @@ -193,7 +194,7 @@ CHIP_ERROR P6Utils::SetAPMode(bool enabled) return err; } -const char * P6Utils::WiFiModeToStr(wifi_mode_t wifiMode) +const char * PSOC6Utils::WiFiModeToStr(wifi_mode_t wifiMode) { switch (wifiMode) { @@ -210,49 +211,49 @@ const char * P6Utils::WiFiModeToStr(wifi_mode_t wifiMode) } } -CHIP_ERROR P6Utils::GetWiFiSSID(char * buf, size_t bufSize) +CHIP_ERROR PSOC6Utils::GetWiFiSSID(char * buf, size_t bufSize) { size_t num = 0; - return P6Config::ReadConfigValueStr(P6Config::kConfigKey_WiFiSSID, buf, bufSize, num); + return PSOC6Config::ReadConfigValueStr(PSOC6Config::kConfigKey_WiFiSSID, buf, bufSize, num); } -CHIP_ERROR P6Utils::StoreWiFiSSID(char * buf, size_t size) +CHIP_ERROR PSOC6Utils::StoreWiFiSSID(char * buf, size_t size) { - return P6Config::WriteConfigValueStr(P6Config::kConfigKey_WiFiSSID, buf, size); + return PSOC6Config::WriteConfigValueStr(PSOC6Config::kConfigKey_WiFiSSID, buf, size); } -CHIP_ERROR P6Utils::GetWiFiPassword(char * buf, size_t bufSize) +CHIP_ERROR PSOC6Utils::GetWiFiPassword(char * buf, size_t bufSize) { size_t num = 0; - return P6Config::ReadConfigValueStr(P6Config::kConfigKey_WiFiPassword, buf, bufSize, num); + return PSOC6Config::ReadConfigValueStr(PSOC6Config::kConfigKey_WiFiPassword, buf, bufSize, num); } -CHIP_ERROR P6Utils::StoreWiFiPassword(char * buf, size_t size) +CHIP_ERROR PSOC6Utils::StoreWiFiPassword(char * buf, size_t size) { - return P6Config::WriteConfigValueStr(P6Config::kConfigKey_WiFiPassword, buf, size); + return PSOC6Config::WriteConfigValueStr(PSOC6Config::kConfigKey_WiFiPassword, buf, size); } -CHIP_ERROR P6Utils::GetWiFiSecurityCode(uint32_t & security) +CHIP_ERROR PSOC6Utils::GetWiFiSecurityCode(uint32_t & security) { - return P6Config::ReadConfigValue(P6Config::kConfigKey_WiFiSecurity, security); + return PSOC6Config::ReadConfigValue(PSOC6Config::kConfigKey_WiFiSecurity, security); } -CHIP_ERROR P6Utils::StoreWiFiSecurityCode(uint32_t security) +CHIP_ERROR PSOC6Utils::StoreWiFiSecurityCode(uint32_t security) { - return P6Config::WriteConfigValue(P6Config::kConfigKey_WiFiSecurity, security); + return PSOC6Config::WriteConfigValue(PSOC6Config::kConfigKey_WiFiSecurity, security); } -CHIP_ERROR P6Utils::wifi_get_mode(uint32_t & mode) +CHIP_ERROR PSOC6Utils::wifi_get_mode(uint32_t & mode) { - return P6Config::ReadConfigValue(P6Config::kConfigKey_WiFiMode, mode); + return PSOC6Config::ReadConfigValue(PSOC6Config::kConfigKey_WiFiMode, mode); } -CHIP_ERROR P6Utils::wifi_set_mode(uint32_t mode) +CHIP_ERROR PSOC6Utils::wifi_set_mode(uint32_t mode) { - return P6Config::WriteConfigValue(P6Config::kConfigKey_WiFiMode, mode); + return PSOC6Config::WriteConfigValue(PSOC6Config::kConfigKey_WiFiMode, mode); } -CHIP_ERROR P6Utils::p6_wifi_set_config(wifi_interface_t interface, wifi_config_t * conf) +CHIP_ERROR PSOC6Utils::p6_wifi_set_config(wifi_interface_t interface, wifi_config_t * conf) { CHIP_ERROR err = CHIP_NO_ERROR; if (interface == WIFI_IF_STA) @@ -281,15 +282,15 @@ CHIP_ERROR P6Utils::p6_wifi_set_config(wifi_interface_t interface, wifi_config_t return err; } -CHIP_ERROR P6Utils::p6_wifi_get_config(wifi_interface_t interface, wifi_config_t * conf) +CHIP_ERROR PSOC6Utils::p6_wifi_get_config(wifi_interface_t interface, wifi_config_t * conf) { uint32 code = 0; CHIP_ERROR err = CHIP_NO_ERROR; if (interface == WIFI_IF_STA) { - if (P6Config::ConfigValueExists(P6Config::kConfigKey_WiFiSSID) && - P6Config::ConfigValueExists(P6Config::kConfigKey_WiFiPassword) && - P6Config::ConfigValueExists(P6Config::kConfigKey_WiFiSecurity)) + if (PSOC6Config::ConfigValueExists(PSOC6Config::kConfigKey_WiFiSSID) && + PSOC6Config::ConfigValueExists(PSOC6Config::kConfigKey_WiFiPassword) && + PSOC6Config::ConfigValueExists(PSOC6Config::kConfigKey_WiFiSecurity)) { /* Retrieve Wi-Fi Configurations from Storage */ err = GetWiFiSSID((char *) conf->sta.ssid, sizeof(conf->sta.ssid)); @@ -320,7 +321,7 @@ CHIP_ERROR P6Utils::p6_wifi_get_config(wifi_interface_t interface, wifi_config_t return err; } -CHIP_ERROR P6Utils::GetWiFiStationProvision(Internal::DeviceNetworkInfo & netInfo, bool includeCredentials) +CHIP_ERROR PSOC6Utils::GetWiFiStationProvision(Internal::DeviceNetworkInfo & netInfo, bool includeCredentials) { CHIP_ERROR err = CHIP_NO_ERROR; wifi_config_t stationConfig; @@ -350,7 +351,7 @@ CHIP_ERROR P6Utils::GetWiFiStationProvision(Internal::DeviceNetworkInfo & netInf return err; } -CHIP_ERROR P6Utils::SetWiFiStationProvision(const Internal::DeviceNetworkInfo & netInfo) +CHIP_ERROR PSOC6Utils::SetWiFiStationProvision(const Internal::DeviceNetworkInfo & netInfo) { CHIP_ERROR err = CHIP_NO_ERROR; wifi_config_t wifiConfig; @@ -358,9 +359,9 @@ CHIP_ERROR P6Utils::SetWiFiStationProvision(const Internal::DeviceNetworkInfo & char wifiSSID[kMaxWiFiSSIDLength + 1]; size_t netInfoSSIDLen = strlen(netInfo.WiFiSSID); - // Ensure that P6 station mode is enabled. This is required before p6_wifi_set_config + // Ensure that PSOC6 station mode is enabled. This is required before p6_wifi_set_config // can be called. - err = P6Utils::EnableStationMode(); + err = PSOC6Utils::EnableStationMode(); SuccessOrExit(err); // Enforce that wifiSSID is null terminated before copying it @@ -374,10 +375,10 @@ CHIP_ERROR P6Utils::SetWiFiStationProvision(const Internal::DeviceNetworkInfo & wifiSSID[kMaxWiFiSSIDLength] = '\0'; } - // Initialize an P6 wifi_config_t structure based on the new provision information. + // Initialize an PSOC6 wifi_config_t structure based on the new provision information. populate_wifi_config_t(&wifiConfig, WIFI_IF_STA, (cy_wcm_ssid_t *) wifiSSID, (cy_wcm_passphrase_t *) netInfo.WiFiKey); - // Configure the P6 WiFi interface. + // Configure the PSOC6 WiFi interface. ReturnLogErrorOnFailure(p6_wifi_set_config(WIFI_IF_STA, &wifiConfig)); ChipLogProgress(DeviceLayer, "WiFi station provision set (SSID: %s)", netInfo.WiFiSSID); @@ -386,18 +387,18 @@ CHIP_ERROR P6Utils::SetWiFiStationProvision(const Internal::DeviceNetworkInfo & return err; } -CHIP_ERROR P6Utils::ClearWiFiStationProvision(void) +CHIP_ERROR PSOC6Utils::ClearWiFiStationProvision(void) { CHIP_ERROR err = CHIP_NO_ERROR; wifi_config_t stationConfig; ChipLogProgress(DeviceLayer, "ClearWiFiStationProvision"); - // Clear the P6 WiFi station configuration. + // Clear the PSOC6 WiFi station configuration. memset(&stationConfig.sta, 0, sizeof(stationConfig.sta)); ReturnLogErrorOnFailure(p6_wifi_set_config(WIFI_IF_STA, &stationConfig)); return err; } -CHIP_ERROR P6Utils::p6_wifi_disconnect(void) +CHIP_ERROR PSOC6Utils::p6_wifi_disconnect(void) { CHIP_ERROR err = CHIP_NO_ERROR; cy_rslt_t result = CY_RSLT_SUCCESS; @@ -411,7 +412,7 @@ CHIP_ERROR P6Utils::p6_wifi_disconnect(void) return err; } -CHIP_ERROR P6Utils::p6_wifi_connect(void) +CHIP_ERROR PSOC6Utils::p6_wifi_connect(void) { CHIP_ERROR err = CHIP_NO_ERROR; cy_rslt_t result = CY_RSLT_SUCCESS; @@ -445,7 +446,7 @@ static const cy_wcm_ip_setting_t ap_mode_ip_settings2 = { INITIALISER_IPV4_ADDRESS1(.netmask, MAKE_IPV4_ADDRESS1(255, 255, 255, 0)), }; -CHIP_ERROR P6Utils::p6_start_ap(void) +CHIP_ERROR PSOC6Utils::p6_start_ap(void) { CHIP_ERROR err = CHIP_NO_ERROR; cy_rslt_t result = CY_RSLT_SUCCESS; @@ -481,7 +482,7 @@ CHIP_ERROR P6Utils::p6_start_ap(void) return err; } -CHIP_ERROR P6Utils::p6_stop_ap(void) +CHIP_ERROR PSOC6Utils::p6_stop_ap(void) { CHIP_ERROR err = CHIP_NO_ERROR; cy_rslt_t result = CY_RSLT_SUCCESS; @@ -495,8 +496,8 @@ CHIP_ERROR P6Utils::p6_stop_ap(void) return err; } -void P6Utils::populate_wifi_config_t(wifi_config_t * wifi_config, wifi_interface_t interface, const cy_wcm_ssid_t * ssid, - const cy_wcm_passphrase_t * password, cy_wcm_security_t security) +void PSOC6Utils::populate_wifi_config_t(wifi_config_t * wifi_config, wifi_interface_t interface, const cy_wcm_ssid_t * ssid, + const cy_wcm_passphrase_t * password, cy_wcm_security_t security) { CY_ASSERT(wifi_config != NULL); @@ -723,7 +724,7 @@ void ping_raw(void) } #endif -CHIP_ERROR P6Utils::ping_init(void) +CHIP_ERROR PSOC6Utils::ping_init(void) { CHIP_ERROR err = CHIP_NO_ERROR; struct netif * net_interface = NULL; @@ -819,7 +820,7 @@ static void xtlv_unpack_xtlv(const xtlv_t * xtlv, uint16_t * type, uint16_t * le } } -void P6Utils::unpack_xtlv_buf(const uint8_t * tlv_buf, uint16_t buflen, wl_cnt_ver_30_t * cnt, wl_cnt_ge40mcst_v1_t * cnt_ge40) +void PSOC6Utils::unpack_xtlv_buf(const uint8_t * tlv_buf, uint16_t buflen, wl_cnt_ver_30_t * cnt, wl_cnt_ge40mcst_v1_t * cnt_ge40) { uint16_t len; uint16_t type; @@ -853,7 +854,7 @@ void P6Utils::unpack_xtlv_buf(const uint8_t * tlv_buf, uint16_t buflen, wl_cnt_v } } -/* Get the Heap total size for P6 Linker file */ +/* Get the Heap total size for PSOC6 Linker file */ uint32_t get_heap_total() { extern uint8_t __HeapBase; /* Symbol exported by the linker. */ @@ -865,7 +866,7 @@ uint32_t get_heap_total() } /* Populate Heap info based on heap total size and Current Heap usage */ -void P6Utils::heap_usage(heap_info_t * heap) +void PSOC6Utils::heap_usage(heap_info_t * heap) { struct mallinfo mall_info = mallinfo(); diff --git a/src/platform/Infineon/PSOC6/P6Utils.h b/src/platform/Infineon/PSOC6/PSOC6Utils.h similarity index 99% rename from src/platform/Infineon/PSOC6/P6Utils.h rename to src/platform/Infineon/PSOC6/PSOC6Utils.h index c313e963576215..fbb28c4c0e5e7a 100644 --- a/src/platform/Infineon/PSOC6/P6Utils.h +++ b/src/platform/Infineon/PSOC6/PSOC6Utils.h @@ -187,7 +187,7 @@ namespace chip { namespace DeviceLayer { namespace Internal { -class P6Utils +class PSOC6Utils { public: static CHIP_ERROR IsAPEnabled(bool & apEnabled); diff --git a/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_P256_trustm.cpp b/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_P256_trustm.cpp index 895b53222672b4..23856be89d93c1 100644 --- a/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_P256_trustm.cpp +++ b/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_P256_trustm.cpp @@ -277,8 +277,7 @@ CHIP_ERROR P256PublicKey::ECDSA_validate_hash_signature(const uint8_t * hash, si size_t signature_trustm_len = sizeof(signature_trustm); MutableByteSpan out_der_sig_span(signature_trustm, signature_trustm_len); - uint8_t hash_length_u8 = static_cast(hash_length); - uint16_t signature_trustm_len_u16 = static_cast(signature_trustm_len); + uint8_t hash_length_u8 = static_cast(hash_length); VerifyOrReturnError(hash != nullptr, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(hash_length > 0, CHIP_ERROR_INVALID_ARGUMENT); @@ -292,7 +291,7 @@ CHIP_ERROR P256PublicKey::ECDSA_validate_hash_signature(const uint8_t * hash, si signature_trustm_len = out_der_sig_span.size(); // ECC verify - return_status = trustm_ecdsa_verify((uint8_t *) hash, hash_length_u8, (uint8_t *) signature_trustm, signature_trustm_len_u16, + return_status = trustm_ecdsa_verify((uint8_t *) hash, hash_length_u8, (uint8_t *) signature_trustm, signature_trustm_len, (uint8_t *) bytes, (uint8_t) kP256_PublicKey_Length); VerifyOrExit(return_status == OPTIGA_LIB_SUCCESS, error = CHIP_ERROR_INTERNAL); diff --git a/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_utils_trustm.cpp b/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_utils_trustm.cpp index be25fd89b824d6..4623c3f852ff18 100644 --- a/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_utils_trustm.cpp +++ b/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_utils_trustm.cpp @@ -36,9 +36,9 @@ #include "pal_os_timer.h" #include -optiga_crypt_t * p_local_crypt = NULL; -optiga_util_t * p_local_util = NULL; -static bool trustm_isOpen = false; +optiga_crypt_t * me_crypt = NULL; +optiga_util_t * me_util = NULL; +static bool trustm_isOpen = false; #define ENABLE_HMAC_MULTI_STEP (0) #define OPTIGA_UTIL_DER_BITSTRING_TAG (0x03) #define OPTIGA_UTIL_DER_NUM_UNUSED_BITS (0x00) @@ -55,10 +55,7 @@ static bool trustm_isOpen = false; void vApplicationTickHook(void); -void vApplicationTickHook(void) -{ - pal_os_event_trigger_registered_callback(); -} +void vApplicationTickHook(void) {} #define WAIT_FOR_COMPLETION(ret) \ if (OPTIGA_LIB_SUCCESS != ret) \ @@ -67,9 +64,7 @@ void vApplicationTickHook(void) } \ while (optiga_lib_status == OPTIGA_LIB_BUSY) \ { \ - pal_os_event_trigger_registered_callback(); \ } \ - \ if (OPTIGA_LIB_SUCCESS != optiga_lib_status) \ { \ ret = optiga_lib_status; \ @@ -113,7 +108,6 @@ static void optiga_crypt_callback(void * context, optiga_lib_status_t return_sta static bool init = false; void trustm_Open(void) { - optiga_lib_status_t xResult; uint16_t dOptigaOID = 0xE0C4; // Maximum Power, Minimum Current limitation uint8_t cCurrentLimit = 15; @@ -123,75 +117,74 @@ void trustm_Open(void) optiga_lib_status_t return_status; do { - /** - * 1. Create OPTIGA Crypt Instance - */ - p_local_crypt = optiga_crypt_create(0, optiga_crypt_callback, NULL); - if (NULL == p_local_crypt) + // Create Optiga crypt instance + if (me_crypt == NULL) { - break; + me_crypt = optiga_crypt_create(0, optiga_crypt_callback, NULL); + if (NULL == me_crypt) + { + break; + } } - // printf("trustm created crypt Instance \r\n"); - /** - * 1. Create OPTIGA Util Instance - */ - p_local_util = optiga_util_create(0, optiga_util_callback, NULL); - if (NULL == p_local_util) + else { - break; + printf("Error: me_crypt already initialised\n"); + } + // Create Optiga Util instance + if (me_util == NULL) + { + me_util = optiga_util_create(0, optiga_util_callback, NULL); + if (NULL == me_util) + { + break; + } + } + else + { + printf("Error: me_crypt already initialised\n"); } - // printf("trustm created util Instance \r\n"); /** * Open the application on OPTIGA which is a precondition to perform any other operations * using optiga_util_open_application */ optiga_lib_status = OPTIGA_LIB_BUSY; - return_status = optiga_util_open_application(p_local_util, 0); // skip restore - while (optiga_lib_status == OPTIGA_LIB_BUSY) - - // Only run once for initialisation - if (init) - { - xResult = optiga_util_write_data(p_local_util, dOptigaOID, OPTIGA_UTIL_WRITE_ONLY, 0, &cCurrentLimit, 1); - - if (OPTIGA_LIB_SUCCESS != xResult) - { - break; - } - while (optiga_lib_status == OPTIGA_LIB_BUSY) - ; - // Set init to true - init = true; - } - + return_status = optiga_util_open_application(me_util, 0); // skip restore if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_util_open_application api returns error !!! - printf("optiga_util_open_application api returns error !!!\n"); + printf("optiga_util_open_application api returns error %02X\n", return_status); break; } + // Wait until the optiga_util_open_application is completed + WAIT_FOR_COMPLETION(return_status); - while (optiga_lib_status == OPTIGA_LIB_BUSY) - ; - if (OPTIGA_LIB_SUCCESS != optiga_lib_status) + if (OPTIGA_LIB_SUCCESS != return_status) { // optiga_util_open_application failed printf("optiga_util_open_application failed\n"); break; } + trustm_isOpen = true; - // printf("trustm open application successful \r\n"); - + // Only run once for initialisation + if (!init) + { + optiga_lib_status = OPTIGA_LIB_BUSY; + return_status = optiga_util_write_data(me_util, dOptigaOID, OPTIGA_UTIL_ERASE_AND_WRITE, 0, &cCurrentLimit, 1); + if (OPTIGA_LIB_SUCCESS != return_status) + { + printf("optiga_util_write_data api returns error %02X\n", return_status); + break; + } + WAIT_FOR_COMPLETION(return_status); + if (OPTIGA_LIB_SUCCESS != return_status) + { + printf("optiga_util_write_data returns error\n"); + break; + } + // Set init to true + init = true; + } } while (0); - - // p_local_util and p_local_crypt instance can be destroyed - // if no close_application w.r.t hibernate is required to be performed - if (p_local_util || p_local_crypt) - { - optiga_util_destroy(p_local_util); - optiga_crypt_destroy(p_local_crypt); - } - trustm_isOpen = true; } } @@ -206,19 +199,28 @@ void trustm_close(void) * using optiga_util_close_application */ optiga_lib_status = OPTIGA_LIB_BUSY; - return_status = optiga_util_close_application(p_local_util, 0); + return_status = optiga_util_close_application(me_util, 0); if (OPTIGA_LIB_SUCCESS != return_status) + { + printf("optiga_util_close_application api returns error %02X\n", return_status); break; + } + + WAIT_FOR_COMPLETION(return_status); - while (optiga_lib_status == OPTIGA_LIB_BUSY) + if (OPTIGA_LIB_SUCCESS != return_status) { - pal_os_event_trigger_registered_callback(); + // optiga_util_close_application failed + printf("optiga_util_close_application failed\n"); + break; } // destroy util and crypt instances - optiga_util_destroy(p_local_util); - optiga_crypt_destroy(p_local_crypt); + optiga_util_destroy(me_util); + optiga_crypt_destroy(me_crypt); pal_os_event_destroy(NULL); + me_util = NULL; + me_crypt = NULL; trustm_isOpen = false; return_status = OPTIGA_LIB_SUCCESS; } while (0); @@ -232,37 +234,25 @@ void read_certificate_from_optiga(uint16_t optiga_oid, char * cert_pem, uint16_t uint16_t size_to_copy = 0; optiga_lib_status_t return_status; - optiga_util_t * me_util = NULL; uint8_t ifx_cert_hex[1024]; uint16_t ifx_cert_hex_len = sizeof(ifx_cert_hex); do { - // Create an instance of optiga_util to read the certificate from OPTIGA. - me_util = optiga_util_create(0, optiga_util_callback, NULL); - if (!me_util) - { - optiga_lib_print_message("optiga_util_create failed !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); - break; - } optiga_lib_status = OPTIGA_LIB_BUSY; return_status = optiga_util_read_data(me_util, optiga_oid, 0, ifx_cert_hex, &ifx_cert_hex_len); if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_util_read_data api returns error !!! - optiga_lib_print_message("optiga_util_read_data api returns error !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + printf("optiga_util_read_data api returns error %02X\n", return_status); break; } - - while (optiga_lib_status == OPTIGA_LIB_BUSY) - ; - if (OPTIGA_LIB_SUCCESS != optiga_lib_status) + WAIT_FOR_COMPLETION(return_status); + if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_util_read_data failed - optiga_lib_print_message("optiga_util_read_data failed", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + // optiga_util_read_data returns error + printf("read_certificate_from_optiga failed\n"); break; } - // convert to PEM format // If the first byte is TLS Identity Tag, than we need to skip 9 first bytes offset_to_read = ifx_cert_hex[0] == 0xc0 ? 9 : 0; @@ -292,113 +282,52 @@ void read_certificate_from_optiga(uint16_t optiga_oid, char * cert_pem, uint16_t *cert_pem_length = offset_to_write + 27; } while (0); - - // me_util instance to be destroyed - if (me_util) - { - optiga_util_destroy(me_util); - } } + void write_data(uint16_t optiga_oid, const uint8_t * p_data, uint16_t length) { - optiga_util_t * me_util = NULL; optiga_lib_status_t return_status; do { - // Create an instance of optiga_util to open the application on OPTIGA. - me_util = optiga_util_create(0, optiga_util_callback, NULL); - if (!me_util) + optiga_lib_status = OPTIGA_LIB_BUSY; + return_status = optiga_util_write_data(me_util, optiga_oid, OPTIGA_UTIL_ERASE_AND_WRITE, 0, p_data, length); + if (OPTIGA_LIB_SUCCESS != return_status) { - optiga_lib_print_message("optiga_util_create failed !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + printf("optiga_util_write_data api returns error %02X\n", return_status); break; } + WAIT_FOR_COMPLETION(return_status); - optiga_lib_status = OPTIGA_LIB_BUSY; - return_status = optiga_util_write_data(me_util, optiga_oid, OPTIGA_UTIL_ERASE_AND_WRITE, 0, p_data, length); + if (OPTIGA_LIB_SUCCESS != return_status) { - if (OPTIGA_LIB_SUCCESS != return_status) - { - optiga_lib_print_message("optiga_util_wirte_data api returns error !!!", OPTIGA_UTIL_SERVICE, - OPTIGA_UTIL_SERVICE_COLOR); - break; - } - - while (OPTIGA_LIB_BUSY == optiga_lib_status) - { - // Wait until the optiga_util_write_data operation is completed - } - - if (OPTIGA_LIB_SUCCESS != optiga_lib_status) - { - optiga_lib_print_message("optiga_util_write_data failed", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); - return_status = optiga_lib_status; - break; - } - else - { - optiga_lib_print_message("optiga_util_write_data successful", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); - } + printf("write_data failed\n"); + return_status = optiga_lib_status; + break; } } while (0); - - // me_util instance can be destroyed - // if no close_application w.r.t hibernate is required to be performed - if (me_util) - { - optiga_util_destroy(me_util); - } } void write_metadata(uint16_t optiga_oid, const uint8_t * p_data, uint8_t length) { - optiga_util_t * me_util = NULL; optiga_lib_status_t return_status; do { - // Create an instance of optiga_util to open the application on OPTIGA. - me_util = optiga_util_create(0, optiga_util_callback, NULL); - if (!me_util) + optiga_lib_status = OPTIGA_LIB_BUSY; + return_status = optiga_util_write_metadata(me_util, optiga_oid, p_data, length); + if (OPTIGA_LIB_SUCCESS != return_status) { - optiga_lib_print_message("optiga_util_create failed !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + printf("optiga_util_write_metadata api returns error %02X\n", return_status); break; } - - optiga_lib_status = OPTIGA_LIB_BUSY; - return_status = optiga_util_write_metadata(me_util, optiga_oid, p_data, length); + WAIT_FOR_COMPLETION(return_status); + if (OPTIGA_LIB_SUCCESS != return_status) { - if (OPTIGA_LIB_SUCCESS != return_status) - { - optiga_lib_print_message("optiga_util_wirte_data api returns error !!!", OPTIGA_UTIL_SERVICE, - OPTIGA_UTIL_SERVICE_COLOR); - break; - } - - while (OPTIGA_LIB_BUSY == optiga_lib_status) - { - // Wait until the optiga_util_write_metadata operation is completed - } - - if (OPTIGA_LIB_SUCCESS != optiga_lib_status) - { - optiga_lib_print_message("optiga_util_write_metadata failed", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); - return_status = optiga_lib_status; - break; - } - else - { - optiga_lib_print_message("optiga_util_write_metadata successful", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); - } + printf("optiga_util_write_metadata failed\n"); + break; } } while (0); - - // me_util instance can be destroyed - // if no close_application w.r.t hibernate is required to be performed - if (me_util) - { - optiga_util_destroy(me_util); - } } optiga_lib_status_t deriveKey_HKDF(const uint8_t * salt, uint16_t salt_length, const uint8_t * info, uint16_t info_length, @@ -408,39 +337,22 @@ optiga_lib_status_t deriveKey_HKDF(const uint8_t * salt, uint16_t salt_length, c do { - // Create an instance of optiga_crypt_t - p_local_crypt = optiga_crypt_create(0, optiga_crypt_callback, NULL); - if (NULL == p_local_crypt) - { - optiga_lib_print_message("optiga_crypt_create failed !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); - break; - } - optiga_lib_status = OPTIGA_LIB_BUSY; - return_status = optiga_crypt_hkdf(p_local_crypt, OPTIGA_HKDF_SHA_256, TRUSTM_HKDF_OID_KEY, /* Input secret OID */ + return_status = optiga_crypt_hkdf(me_crypt, OPTIGA_HKDF_SHA_256, TRUSTM_HKDF_OID_KEY, /* Input secret OID */ salt, salt_length, info, info_length, derived_key_length, TRUE, derived_key); if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_crypt_hkdf api returns error !!! - optiga_lib_print_message("optiga_crypt_hkdf api returns error !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + printf("optiga_crypt_hkdf api returns error %02X\n", return_status); break; } - - while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) - ; - - if (OPTIGA_LIB_SUCCESS != optiga_lib_status) + WAIT_FOR_COMPLETION(return_status); + if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_crypt_hkdf failed - optiga_lib_print_message("optiga_crypt_hkdf failed", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + printf("optiga_crypt_hkdf failed\n"); break; } } while (0); - if (p_local_crypt) - { - optiga_crypt_destroy(p_local_crypt); - } return return_status; } @@ -451,25 +363,24 @@ optiga_lib_status_t hmac_sha256(optiga_hmac_type_t type, const uint8_t * input_d do { - // Create an instance of optiga_crypt_t - p_local_crypt = optiga_crypt_create(0, optiga_crypt_callback, NULL); - if (NULL == p_local_crypt) - { - optiga_lib_print_message("optiga_crypt_create failed !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); - break; - } - - return_status = OPTIGA_LIB_BUSY; + optiga_lib_status = OPTIGA_LIB_BUSY; #if ENABLE_HMAC_MULTI_STEP // If the size is less than the max length supported if (input_data_length <= MAX_MAC_DATA_LEN) { - return_status = - optiga_crypt_hmac(p_local_crypt, type, TRUSTM_HMAC_OID_KEY, input_data, input_data_length, mac, mac_length); + return_status = optiga_crypt_hmac(me_crypt, type, TRUSTM_HMAC_OID_KEY, input_data, input_data_length, mac, mac_length); if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_crypt_hmac api returns error !!! - optiga_lib_print_message("optiga_crypt_hmac api returns error !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + // optiga_crypt_hmac returns error !!! + printf("optiga_crypt_hmac api error %02X\n", return_status); + break; + } + + WAIT_FOR_COMPLETION(return_status); + if (OPTIGA_LIB_SUCCESS != return_status) + { + // optiga_crypt_hmac returns error !!! + printf("optiga_crypt_hmac returns error\n"); break; } } @@ -479,13 +390,18 @@ optiga_lib_status_t hmac_sha256(optiga_hmac_type_t type, const uint8_t * input_d uint32_t dataLenTemp = 0; uint32_t remainingLen = input_data_length; // Start the HMAC Operation - return_status = optiga_crypt_hmac_start(p_local_crypt, type, TRUSTM_HMAC_OID_KEY, input_data, MAX_MAC_DATA_LEN); - + return_status = optiga_crypt_hmac_start(me_crypt, type, TRUSTM_HMAC_OID_KEY, input_data, MAX_MAC_DATA_LEN); + if (OPTIGA_LIB_SUCCESS != return_status) + { + // optiga_crypt_hmac returns error !!! + printf("optiga_crypt_hmac_start api error %02X\n", return_status); + break; + } + WAIT_FOR_COMPLETION(return_status); if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_crypt_hmac_start api returns error !!! - optiga_lib_print_message("optiga_crypt_hmac_start api returns error !!!", OPTIGA_UTIL_SERVICE, - OPTIGA_UTIL_SERVICE_COLOR); + // optiga_crypt_hmac_start returns error !!! + printf("optiga_crypt_hmac_start returns error\n"); break; } remainingLen = input_data_length - MAX_MAC_DATA_LEN; @@ -496,18 +412,21 @@ optiga_lib_status_t hmac_sha256(optiga_hmac_type_t type, const uint8_t * input_d if (remainingLen > MAX_MAC_DATA_LEN) { - return_status = OPTIGA_LIB_BUSY; - // printf("HMAC Update\n"); - // Continue HMAC operation on input data + optiga_lib_status = OPTIGA_LIB_BUSY; return_status = - optiga_crypt_hmac_update(p_local_crypt, (input_data + (input_data_length - remainingLen)), dataLenTemp); + optiga_crypt_hmac_update(me_crypt, (input_data + (input_data_length - remainingLen)), dataLenTemp); + if (OPTIGA_LIB_SUCCESS != return_status) + { + // optiga_crypt_hmac_update returns error !!! + printf("optiga_crypt_hmac_update api error %02X\n", return_status); + break; + } + WAIT_FOR_COMPLETION(return_status); remainingLen = remainingLen - dataLenTemp; - if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_crypt_hmac_update api returns error !!! - optiga_lib_print_message("optiga_crypt_hmac_update api returns error !!!", OPTIGA_UTIL_SERVICE, - OPTIGA_UTIL_SERVICE_COLOR); + // optiga_crypt_hmac_update returns error !!! + printf("optiga_crypt_hmac_update returns error\n"); break; } } @@ -515,15 +434,20 @@ optiga_lib_status_t hmac_sha256(optiga_hmac_type_t type, const uint8_t * input_d { // End HMAC sequence and return the MAC generated // printf("HMAC Finalize\n"); - return_status = OPTIGA_LIB_BUSY; - return_status = optiga_crypt_hmac_finalize(p_local_crypt, (input_data + (input_data_length - remainingLen)), - dataLenTemp, mac, mac_length); - + optiga_lib_status = OPTIGA_LIB_BUSY; + return_status = optiga_crypt_hmac_finalize(me_crypt, (input_data + (input_data_length - remainingLen)), + dataLenTemp, mac, mac_length); if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_crypt_hmac_finalize api returns error !!! - optiga_lib_print_message("optiga_crypt_hmac_finalize api returns error !!!", OPTIGA_UTIL_SERVICE, - OPTIGA_UTIL_SERVICE_COLOR); + // optiga_crypt_hmac_finalize returns error !!! + printf("optiga_crypt_hmac_finalize api error %02X\n", return_status); + break; + } + WAIT_FOR_COMPLETION(return_status); + if (OPTIGA_LIB_SUCCESS != return_status) + { + // optiga_crypt_hmac_finalize returns error !!! + printf("optiga_crypt_hmac_finalize returns error\n"); break; } } @@ -531,70 +455,48 @@ optiga_lib_status_t hmac_sha256(optiga_hmac_type_t type, const uint8_t * input_d } #else - return_status = optiga_crypt_hmac(p_local_crypt, type, TRUSTM_HMAC_OID_KEY, input_data, input_data_length, mac, mac_length); - // printf("Output Length %ld Input Length %ld \n", *mac_length, input_data_length); + return_status = optiga_crypt_hmac(me_crypt, type, TRUSTM_HMAC_OID_KEY, input_data, input_data_length, mac, mac_length); if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_crypt_hmac api returns error !!! - optiga_lib_print_message("optiga_crypt_hmac api returns error !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + // optiga_crypt_hmac returns error !!! + printf("optiga_crypt_hmac api error %02X\n", return_status); break; } - - while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) - ; - - if (OPTIGA_LIB_SUCCESS != optiga_lib_status) + WAIT_FOR_COMPLETION(return_status); + if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_crypt_hkdf failed - optiga_lib_print_message("optiga_crypt_hkdf failed", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + // optiga_crypt_hmac returns error !!! + printf("optiga_crypt_hmac returns error\n"); break; } #endif } while (0); - if (p_local_crypt) - { - optiga_crypt_destroy(p_local_crypt); - } return return_status; } + optiga_lib_status_t optiga_crypt_rng(uint8_t * random_data, uint16_t random_data_length) { optiga_lib_status_t return_status; do { - // Create an instance of optiga_crypt_t - p_local_crypt = optiga_crypt_create(0, optiga_crypt_callback, NULL); - if (NULL == p_local_crypt) - { - optiga_lib_print_message("optiga_crypt_create failed !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); - break; - } - - return_status = OPTIGA_LIB_BUSY; - return_status = optiga_crypt_random(p_local_crypt, OPTIGA_RNG_TYPE_DRNG, random_data, random_data_length); + optiga_lib_status = OPTIGA_LIB_BUSY; + return_status = optiga_crypt_random(me_crypt, OPTIGA_RNG_TYPE_DRNG, random_data, random_data_length); if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_crypt_random api returns error !!! - optiga_lib_print_message("optiga_crypt_random api returns error !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + // optiga_crypt_random returns error !!! + printf("optiga_crypt_random api error %02X\n", return_status); break; } - - while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) - ; - - if (OPTIGA_LIB_SUCCESS != optiga_lib_status) + WAIT_FOR_COMPLETION(return_status); + if (OPTIGA_LIB_SUCCESS != return_status) { // optiga_crypt_random failed - optiga_lib_print_message("optiga_crypt_random failed", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + printf("optiga_crypt_random returns error\n"); break; } } while (0); - if (p_local_crypt) - { - optiga_crypt_destroy(p_local_crypt); - } return return_status; } optiga_lib_status_t trustm_ecc_keygen(uint16_t optiga_key_id, uint8_t key_type, optiga_ecc_curve_t curve_id, uint8_t * pubkey, @@ -610,35 +512,24 @@ optiga_lib_status_t trustm_ecc_keygen(uint16_t optiga_key_id, uint8_t key_type, } do { - // Create an instance of optiga_crypt_t - p_local_crypt = optiga_crypt_create(0, optiga_crypt_callback, NULL); - if (NULL == p_local_crypt) + optiga_lib_status = OPTIGA_LIB_BUSY; + return_status = + optiga_crypt_ecc_generate_keypair(me_crypt, curve_id, key_type, FALSE, &optiga_key_id, (pubkey + i), pubkey_length); + if (OPTIGA_LIB_SUCCESS != return_status) { - optiga_lib_print_message("optiga_crypt_create failed !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + // optiga_crypt_ecc_generate_keypair api returns error !!! + printf("optiga_crypt_ecc_generate_keypair api error %02X\n", return_status); break; } - - optiga_lib_status = OPTIGA_LIB_BUSY; - return_status = optiga_crypt_ecc_generate_keypair(p_local_crypt, curve_id, key_type, FALSE, &optiga_key_id, (pubkey + i), - pubkey_length); + WAIT_FOR_COMPLETION(return_status); if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_crypt_ecc_generate_keypair api returns error !!! - optiga_lib_print_message("optiga_crypt_ecc_generate_keypair api returns error !!!", OPTIGA_UTIL_SERVICE, - OPTIGA_UTIL_SERVICE_COLOR); + // optiga_crypt_ecc_generate_keypair returns error !!! + printf("optiga_crypt_ecc_generate_keypair returns error\n"); break; } - - while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) - ; - } while (0); - if (p_local_crypt) - { - optiga_crypt_destroy(p_local_crypt); - } - *pubkey_length += sizeof(header256); return return_status; } @@ -648,32 +539,22 @@ void trustmGetKey(uint16_t optiga_oid, uint8_t * pubkey, uint16_t * pubkeyLen) uint16_t offset = 0; do { - // Create an instance of optiga_crypt_t - p_local_util = optiga_util_create(0, optiga_util_callback, NULL); - if (NULL == p_local_util) + optiga_lib_status = OPTIGA_LIB_BUSY; + return_status = optiga_util_read_data(me_util, optiga_oid, offset, pubkey, pubkeyLen); + if (OPTIGA_LIB_SUCCESS != return_status) { - optiga_lib_print_message("optiga_util_create failed !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + // optiga_util_read_data api returns error !!! + printf("optiga_util_read_data api error %02X\n", return_status); break; } - - optiga_lib_status = OPTIGA_LIB_BUSY; - return_status = optiga_util_read_data(p_local_util, optiga_oid, offset, pubkey, pubkeyLen); + WAIT_FOR_COMPLETION(return_status); if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_util_read_pubkey api returns error !!! - optiga_lib_print_message("optiga_util_read_pubkey returns error !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + // optiga_util_read_pubkey returns error !!! + printf("optiga_util_read_pubkey returns error\n"); break; } - - while (optiga_lib_status == OPTIGA_LIB_BUSY) - ; - } while (0); - - if (p_local_util) - { - optiga_util_destroy(p_local_util); - } } optiga_lib_status_t trustm_hash(uint8_t * msg, uint16_t msg_length, uint8_t * digest, uint8_t digest_length) { @@ -681,34 +562,25 @@ optiga_lib_status_t trustm_hash(uint8_t * msg, uint16_t msg_length, uint8_t * di hash_data_from_host_t hash_data_host; do { - // Create an instance of optiga_crypt_t - p_local_crypt = optiga_crypt_create(0, optiga_crypt_callback, NULL); - if (NULL == p_local_crypt) - { - optiga_lib_print_message("optiga_crypt_create failed !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); - break; - } hash_data_host.buffer = msg; hash_data_host.length = msg_length; optiga_lib_status = OPTIGA_LIB_BUSY; - return_status = optiga_crypt_hash(p_local_crypt, OPTIGA_HASH_TYPE_SHA_256, OPTIGA_CRYPT_HOST_DATA, &hash_data_host, digest); - + return_status = optiga_crypt_hash(me_crypt, OPTIGA_HASH_TYPE_SHA_256, OPTIGA_CRYPT_HOST_DATA, &hash_data_host, digest); if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_crypt_ecdsa_sign api returns error !!! - optiga_lib_print_message("optiga_crypt_hash api returns error !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + // optiga_crypt_hash api returns error !!! + printf("optiga_crypt_hash api error %02X\n", return_status); + break; + } + WAIT_FOR_COMPLETION(return_status); + if (OPTIGA_LIB_SUCCESS != return_status) + { + // optiga_crypt_hash api returns error !!! + printf("optiga_crypt_hash returns error\n"); break; } - - while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) - ; - } while (0); - if (p_local_crypt) - { - optiga_crypt_destroy(p_local_crypt); - } return return_status; } optiga_lib_status_t trustm_ecdsa_sign(optiga_key_id_t optiga_key_id, uint8_t * digest, uint8_t digest_length, uint8_t * signature, @@ -718,26 +590,21 @@ optiga_lib_status_t trustm_ecdsa_sign(optiga_key_id_t optiga_key_id, uint8_t * d int i; do { - // Create an instance of optiga_crypt_t - p_local_crypt = optiga_crypt_create(0, optiga_crypt_callback, NULL); - if (NULL == p_local_crypt) + optiga_lib_status = OPTIGA_LIB_BUSY; + return_status = optiga_crypt_ecdsa_sign(me_crypt, digest, digest_length, optiga_key_id, signature, signature_length); + if (OPTIGA_LIB_SUCCESS != return_status) { - optiga_lib_print_message("optiga_crypt_create failed !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + // optiga_crypt_ecdsa_sign api returns error !!! + printf("optiga_crypt_ecdsa_sign api error %02X\n", return_status); break; } - optiga_lib_status = OPTIGA_LIB_BUSY; - return_status = optiga_crypt_ecdsa_sign(p_local_crypt, digest, digest_length, optiga_key_id, signature, signature_length); + WAIT_FOR_COMPLETION(return_status); if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_crypt_ecdsa_sign api returns error !!! - optiga_lib_print_message("optiga_crypt_ecdsa_sign api returns error !!!", OPTIGA_UTIL_SERVICE, - OPTIGA_UTIL_SERVICE_COLOR); + // optiga_crypt_ecdsa_sign returns error !!! + printf("optiga_crypt_ecdsa_sign returns error\n"); break; } - - while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) - ; - for (i = (*signature_length - 1); i >= 0; i--) { signature[i + 2] = signature[i]; @@ -749,23 +616,18 @@ optiga_lib_status_t trustm_ecdsa_sign(optiga_key_id_t optiga_key_id, uint8_t * d } while (0); - if (p_local_crypt) - { - optiga_crypt_destroy(p_local_crypt); - } return return_status; } + void ecc_pub_key_bit(uint8_t * q_buffer, uint8_t q_length, uint8_t * pub_key_buffer, uint16_t * pub_key_length) { -#define OPTIGA_UTIL_ECC_DER_ADDITIONAL_LENGTH (0x02) +#define OPTIGA_UTIL_ECC_DER_ADDITIONAL_LENGTH (0x01) uint16_t index = 0; pub_key_buffer[index++] = OPTIGA_UTIL_DER_BITSTRING_TAG; pub_key_buffer[index++] = q_length + OPTIGA_UTIL_ECC_DER_ADDITIONAL_LENGTH; pub_key_buffer[index++] = OPTIGA_UTIL_DER_NUM_UNUSED_BITS; - // Compression format. Supports only 04 [uncompressed] - pub_key_buffer[index++] = 0x04; pal_os_memcpy(&pub_key_buffer[index], q_buffer, q_length); index += q_length; @@ -781,44 +643,36 @@ optiga_lib_status_t trustm_ecdsa_verify(uint8_t * digest, uint8_t digest_length, uint8_t ecc_public_key[70] = { 0x00 }; uint16_t i; uint16_t ecc_public_key_length = 0; + ecc_pub_key_bit(ecc_pubkey, ecc_pubkey_length, ecc_public_key, &ecc_public_key_length); public_key_from_host_t public_key_details = { ecc_public_key, ecc_public_key_length, (uint8_t) OPTIGA_ECC_CURVE_NIST_P_256 }; do { - // Create an instance of optiga_crypt_t - p_local_crypt = optiga_crypt_create(0, optiga_crypt_callback, NULL); - - if (NULL == p_local_crypt) - { - optiga_lib_print_message("optiga_crypt_create failed !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); - break; - } signature_length = signature[1]; for (i = 0; i < signature_length; i++) { signature[i] = signature[i + 2]; } - return_status = OPTIGA_LIB_BUSY; - return_status = optiga_crypt_ecdsa_verify(p_local_crypt, digest, digest_length, signature, signature_length, - OPTIGA_CRYPT_HOST_DATA, &public_key_details); + + optiga_lib_status = OPTIGA_LIB_BUSY; + return_status = optiga_crypt_ecdsa_verify(me_crypt, digest, digest_length, signature, signature_length, + OPTIGA_CRYPT_HOST_DATA, &public_key_details); if (OPTIGA_LIB_SUCCESS != return_status) { // optiga_crypt_ecdsa_verify api returns error !!! - optiga_lib_print_message("optiga_crypt_ecdsa_verify api returns error !!!", OPTIGA_UTIL_SERVICE, - OPTIGA_UTIL_SERVICE_COLOR); + printf("optiga_crypt_ecdsa_verify api error %02X\n", return_status); + break; + } + WAIT_FOR_COMPLETION(return_status); + if (OPTIGA_LIB_SUCCESS != return_status) + { + // optiga_crypt_ecdsa_verify returns error !!! + printf("optiga_crypt_ecdsa_verify returns error\n"); break; } - - while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) - ; - } while (0); - if (p_local_crypt) - { - optiga_crypt_destroy(p_local_crypt); - } return return_status; } @@ -834,40 +688,35 @@ CHIP_ERROR trustmGetCertificate(uint16_t optiga_oid, uint8_t * buf, uint16_t * b trustm_Open(); do { - // Create an instance of optiga_util to read the certificate from OPTIGA. - p_local_util = optiga_util_create(0, optiga_util_callback, NULL); - if (!p_local_util) - { - optiga_lib_print_message("optiga_util_create failed !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); - break; - } optiga_lib_status = OPTIGA_LIB_BUSY; - return_status = optiga_util_read_data(p_local_util, optiga_oid, 0, ifx_cert_hex, &ifx_cert_hex_len); + return_status = optiga_util_read_data(me_util, optiga_oid, 0, ifx_cert_hex, &ifx_cert_hex_len); if (OPTIGA_LIB_SUCCESS != return_status) { // optiga_util_read_data api returns error !!! - optiga_lib_print_message("optiga_util_read_data api returns error !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + printf("optiga_util_read_data api error %02X\n", return_status); break; } - while (optiga_lib_status == OPTIGA_LIB_BUSY) - ; - if (OPTIGA_LIB_SUCCESS != optiga_lib_status) + WAIT_FOR_COMPLETION(return_status); + if (OPTIGA_LIB_SUCCESS != return_status) { // optiga_util_read_data failed - optiga_lib_print_message("optiga_util_read_data failed", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + printf("trustmGetCertificate failed\n"); break; } - memcpy(buf, ifx_cert_hex, ifx_cert_hex_len); *buflen = ifx_cert_hex_len; } while (0); - if (p_local_util) + if (return_status == OPTIGA_LIB_SUCCESS) + { + return CHIP_NO_ERROR; + } + else { - optiga_util_destroy(p_local_util); + return CHIP_ERROR_INTERNAL; } - return CHIP_NO_ERROR; } + optiga_lib_status_t trustm_ecdh_derive_secret(optiga_key_id_t optiga_key_id, uint8_t * public_key, uint16_t public_key_length, uint8_t * shared_secret, uint8_t shared_secret_length) { @@ -879,33 +728,23 @@ optiga_lib_status_t trustm_ecdh_derive_secret(optiga_key_id_t optiga_key_id, uin }; do { - // Create an instance of optiga_crypt_t - p_local_crypt = optiga_crypt_create(0, optiga_crypt_callback, NULL); - - if (NULL == p_local_crypt) + optiga_lib_status = OPTIGA_LIB_BUSY; + return_status = optiga_crypt_ecdh(me_crypt, optiga_key_id, &public_key_details, TRUE, shared_secret); + if (OPTIGA_LIB_SUCCESS != return_status) { - optiga_lib_print_message("optiga_crypt_create failed !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + // optiga_util_read_data api returns error !!! + printf("optiga_crypt_ecdh api error %02X\n", return_status); break; } - - optiga_lib_status = OPTIGA_LIB_BUSY; - return_status = optiga_crypt_ecdh(p_local_crypt, optiga_key_id, &public_key_details, TRUE, shared_secret); + WAIT_FOR_COMPLETION(return_status); if (OPTIGA_LIB_SUCCESS != return_status) { - // optiga_crypt_ecdh api returns error !!! - optiga_lib_print_message("optiga_crypt_ecdh api returns error !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + // optiga_crypt_ecdh returns error !!! + printf("optiga_crypt_ecdh returns error\n"); break; } - - while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) - ; - } while (0); - if (p_local_crypt) - { - optiga_crypt_destroy(p_local_crypt); - } return return_status; } @@ -921,37 +760,40 @@ optiga_lib_status_t trustm_PBKDF2_HMAC(const unsigned char * salt, size_t slen, unsigned char * out_p = output; do { - // Create an instance of optiga_crypt_t - p_local_crypt = optiga_crypt_create(0, optiga_crypt_callback, NULL); - if (NULL == p_local_crypt) + // Calculate U1, U1 ends up in work + optiga_lib_status = OPTIGA_LIB_BUSY; + return_status = + optiga_crypt_hmac(me_crypt, OPTIGA_HMAC_SHA_256, TRUSTM_HMAC_OID_KEY, salt, (uint32_t) slen, work, &work_len); + if (OPTIGA_LIB_SUCCESS != return_status) { - optiga_lib_print_message("optiga_crypt_create failed!!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + // optiga_crypt_hmac api returns error !!! + printf("optiga_crypt_hmac api 1 error %02X\n", return_status); break; } - - // Calculate U1, U1 ends up in work - return_status = - optiga_crypt_hmac(p_local_crypt, OPTIGA_HMAC_SHA_256, TRUSTM_HMAC_OID_KEY, salt, (uint32_t) slen, work, &work_len); - + WAIT_FOR_COMPLETION(return_status); if (OPTIGA_LIB_SUCCESS != return_status) { - optiga_lib_print_message("optiga_crypt_hmac api returns error!!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + printf("optiga_crypt_hmac 1 returns error\n"); break; } - return_status = OPTIGA_LIB_BUSY; memcpy(md1, work, md1_len); for (unsigned int i = 1; i < iteration_count; i++) { + optiga_lib_status = OPTIGA_LIB_BUSY; // Calculated subsequent U, which ends up in md1 - return_status = optiga_crypt_hmac(p_local_crypt, OPTIGA_HMAC_SHA_256, TRUSTM_HMAC_OID_KEY, md1, md1_len, md1, &md1_len); - + return_status = optiga_crypt_hmac(me_crypt, OPTIGA_HMAC_SHA_256, TRUSTM_HMAC_OID_KEY, md1, md1_len, md1, &md1_len); if (OPTIGA_LIB_SUCCESS != return_status) { - optiga_lib_print_message("optiga_crypt_hmac api returns error!!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); + // optiga_crypt_hmac api returns error !!! + printf("optiga_crypt_hmac api 2 error %02X\n", return_status); + break; + } + WAIT_FOR_COMPLETION(return_status); + if (OPTIGA_LIB_SUCCESS != return_status) + { + printf("optiga_crypt_hmac 2 returns error\n"); break; } - return_status = OPTIGA_LIB_BUSY; - // U1 xor U2 for (int j = 0; j < (int) md1_len; j++) { @@ -959,25 +801,8 @@ optiga_lib_status_t trustm_PBKDF2_HMAC(const unsigned char * salt, size_t slen, } } - while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) - ; - - if (OPTIGA_LIB_SUCCESS != optiga_lib_status) - - { - - // optiga_crypt_hkdf failed - - optiga_lib_print_message("optiga_crypt_pbkdf_hmac failed failed", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); - - break; - } memcpy(out_p, work, key_length); } while (0); - if (p_local_crypt) - { - optiga_crypt_destroy(p_local_crypt); - } return return_status; } diff --git a/src/platform/Linux/BLEManagerImpl.cpp b/src/platform/Linux/BLEManagerImpl.cpp index 2ff3136935b99e..e2070c6978ea70 100644 --- a/src/platform/Linux/BLEManagerImpl.cpp +++ b/src/platform/Linux/BLEManagerImpl.cpp @@ -355,9 +355,10 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const return mtu; } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { - bool result = false; + CHIP_ERROR err = BLE_ERROR_GATT_SUBSCRIBE_FAILED; VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); @@ -365,17 +366,16 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipLogError(DeviceLayer, "SubscribeCharacteristic() called with invalid service ID")); VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID), ChipLogError(DeviceLayer, "SubscribeCharacteristic() called with invalid characteristic ID")); - - VerifyOrExit(conId->SubscribeCharacteristic() == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "SubscribeCharacteristic() failed")); - result = true; + err = conId->SubscribeCharacteristic(); exit: - return result; + return err; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { - bool result = false; + CHIP_ERROR err = BLE_ERROR_GATT_UNSUBSCRIBE_FAILED; VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); @@ -383,48 +383,42 @@ bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, cons ChipLogError(DeviceLayer, "UnsubscribeCharacteristic() called with invalid service ID")); VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID), ChipLogError(DeviceLayer, "UnsubscribeCharacteristic() called with invalid characteristic ID")); - - VerifyOrExit(conId->UnsubscribeCharacteristic() == CHIP_NO_ERROR, - ChipLogError(DeviceLayer, "UnsubscribeCharacteristic() failed")); - result = true; + err = conId->UnsubscribeCharacteristic(); exit: - return result; + return err; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { - bool result = false; + CHIP_ERROR err = CHIP_ERROR_INTERNAL; VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); ChipLogProgress(DeviceLayer, "Closing BLE GATT connection (con %p)", conId); - - VerifyOrExit(conId->CloseConnection() == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "CloseConnection() failed")); - result = true; + err = conId->CloseConnection(); exit: - return result; + return err; } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - chip::System::PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + chip::System::PacketBufferHandle pBuf) { - bool result = false; + CHIP_ERROR err = BLE_ERROR_GATT_INDICATE_FAILED; VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); - VerifyOrExit(conId->SendIndication(std::move(pBuf)) == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "SendIndication() failed")); - result = true; + err = conId->SendIndication(std::move(pBuf)); exit: - return result; + return err; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - chip::System::PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId, chip::System::PacketBufferHandle pBuf) { - bool result = false; + CHIP_ERROR err = BLE_ERROR_GATT_WRITE_FAILED; VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); @@ -432,12 +426,10 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::Ch ChipLogError(DeviceLayer, "SendWriteRequest() called with invalid service ID")); VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_1_UUID), ChipLogError(DeviceLayer, "SendWriteRequest() called with invalid characteristic ID")); - - VerifyOrExit(conId->SendWriteRequest(std::move(pBuf)) == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "SendWriteRequest() failed")); - result = true; + err = conId->SendWriteRequest(std::move(pBuf)); exit: - return result; + return err; } void BLEManagerImpl::HandleNewConnection(BLE_CONNECTION_OBJECT conId) diff --git a/src/platform/Linux/BLEManagerImpl.h b/src/platform/Linux/BLEManagerImpl.h index 97da171b641ace..e216a09b8e46f1 100644 --- a/src/platform/Linux/BLEManagerImpl.h +++ b/src/platform/Linux/BLEManagerImpl.h @@ -117,16 +117,16 @@ class BLEManagerImpl final : public BLEManager, // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/Linux/ConnectivityManagerImpl.cpp b/src/platform/Linux/ConnectivityManagerImpl.cpp index cd3922baaf2b02..0ba16f90d874a9 100644 --- a/src/platform/Linux/ConnectivityManagerImpl.cpp +++ b/src/platform/Linux/ConnectivityManagerImpl.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -64,6 +65,9 @@ #include #include #include +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +#include +#endif #endif using namespace ::chip; @@ -152,6 +156,22 @@ void ConnectivityManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) #if CHIP_DEVICE_CONFIG_ENABLE_THREAD GenericConnectivityManagerImpl_Thread::_OnPlatformEvent(event); #endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + switch (event->Type) + { + case DeviceEventType::kCHIPoWiFiPAFWriteReceived: + ChipLogProgress(DeviceLayer, "WiFi-PAF: event: kCHIPoWiFiPAFWriteReceived"); + _GetWiFiPAF()->OnWiFiPAFMessageReceived(System::PacketBufferHandle::Adopt(event->CHIPoWiFiPAFWriteReceived.Data)); + break; + case DeviceEventType::kCHIPoWiFiPAFConnected: + ChipLogProgress(DeviceLayer, "WiFi-PAF: event: kCHIPoWiFiPAFConnected"); + if (mOnPafSubscribeComplete != nullptr) + { + mOnPafSubscribeComplete(mAppState); + } + break; + } +#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF } #if CHIP_DEVICE_CONFIG_ENABLE_WPA @@ -797,6 +817,113 @@ bool ConnectivityManagerImpl::IsWiFiManagementStarted() return ret; } +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +const char srv_name[] = "_matterc._udp"; +/* + NAN-USD Service Protocol Type: ref: Table 58 of Wi-Fi Aware Specificaiton +*/ +#define MAX_PAF_PUBLISH_SSI_BUFLEN 512 +#define MAX_PAF_TX_SSI_BUFLEN 2048 +#define NAN_SRV_PROTO_MATTER 3 +#define NAM_PUBLISH_PERIOD 300u +#define NAN_PUBLISH_SSI_TAG " ssi=" + +#pragma pack(push, 1) +struct PAFPublishSSI +{ + uint8_t DevOpCode; + uint16_t DevInfo; + uint16_t ProductId; + uint16_t VendorId; +}; +#pragma pack(pop) +CHIP_ERROR ConnectivityManagerImpl::_WiFiPAFPublish(ConnectivityManager::WiFiPAFAdvertiseParam & InArgs) +{ + CHIP_ERROR ret; + GAutoPtr err; + gchar args[MAX_PAF_PUBLISH_SSI_BUFLEN]; + gint publish_id; + size_t req_len; + + snprintf(args, sizeof(args), "service_name=%s srv_proto_type=%u ttl=%u ", srv_name, NAN_SRV_PROTO_MATTER, NAM_PUBLISH_PERIOD); + req_len = strlen(args) + strlen(InArgs.ExtCmds); + if ((InArgs.ExtCmds != nullptr) && (MAX_PAF_PUBLISH_SSI_BUFLEN > req_len)) + { + strcat(args, InArgs.ExtCmds); + } + else + { + ChipLogError(DeviceLayer, "Input cmd is too long: limit:%d, req: %lu", MAX_PAF_PUBLISH_SSI_BUFLEN, req_len); + } + + struct PAFPublishSSI PafPublish_ssi; + VerifyOrReturnError( + (strlen(args) + strlen(NAN_PUBLISH_SSI_TAG) + (sizeof(struct PAFPublishSSI) * 2) < MAX_PAF_PUBLISH_SSI_BUFLEN), + CHIP_ERROR_BUFFER_TOO_SMALL); + PafPublish_ssi.DevOpCode = 0; + VerifyOrDie(DeviceLayer::GetCommissionableDataProvider()->GetSetupDiscriminator(PafPublish_ssi.DevInfo) == CHIP_NO_ERROR); + if (DeviceLayer::GetDeviceInstanceInfoProvider()->GetProductId(PafPublish_ssi.ProductId) != CHIP_NO_ERROR) + { + PafPublish_ssi.ProductId = 0; + } + if (DeviceLayer::GetDeviceInstanceInfoProvider()->GetVendorId(PafPublish_ssi.VendorId) != CHIP_NO_ERROR) + { + PafPublish_ssi.VendorId = 0; + } + if (MAX_PAF_PUBLISH_SSI_BUFLEN > strlen(args) + strlen(NAN_PUBLISH_SSI_TAG)) + { + strcat(args, NAN_PUBLISH_SSI_TAG); + } + ret = Encoding::BytesToUppercaseHexString((uint8_t *) &PafPublish_ssi, sizeof(PafPublish_ssi), &args[strlen(args)], + MAX_PAF_PUBLISH_SSI_BUFLEN - strlen(args)); + VerifyOrReturnError(ret == CHIP_NO_ERROR, ret); + ChipLogProgress(DeviceLayer, "WiFi-PAF: publish: [%s]", args); + wpa_fi_w1_wpa_supplicant1_interface_call_nanpublish_sync(mWpaSupplicant.iface, args, &publish_id, nullptr, &err.GetReceiver()); + ChipLogProgress(DeviceLayer, "WiFi-PAF: publish_id: %d ! ", publish_id); + + g_signal_connect(mWpaSupplicant.iface, "nan-receive", + G_CALLBACK(+[](WpaFiW1Wpa_supplicant1Interface * proxy, GVariant * obj, ConnectivityManagerImpl * self) { + return self->OnNanReceive(obj); + }), + this); + return CHIP_NO_ERROR; +} + +CHIP_ERROR ConnectivityManagerImpl::_WiFiPAFCancelPublish() +{ + GAutoPtr err; + gchar args[MAX_PAF_PUBLISH_SSI_BUFLEN]; + + ChipLogProgress(DeviceLayer, "WiFi-PAF: cancel publish_id: %d ! ", mpaf_info.peer_publish_id); + snprintf(args, sizeof(args), "publish_id=%d", mpaf_info.peer_publish_id); + wpa_fi_w1_wpa_supplicant1_interface_call_nancancel_publish_sync(mWpaSupplicant.iface, args, nullptr, &err.GetReceiver()); + return CHIP_NO_ERROR; +} + +CHIP_ERROR ConnectivityManagerImpl::_SetWiFiPAFAdvertisingEnabled(WiFiPAFAdvertiseParam & args) +{ + if (args.enable == true) + { + return _WiFiPAFPublish(args); + } + else + { + return _WiFiPAFCancelPublish(); + } +} + +Transport::WiFiPAFBase * ConnectivityManagerImpl::_GetWiFiPAF() +{ + return pmWiFiPAF; +} + +void ConnectivityManagerImpl::_SetWiFiPAF(Transport::WiFiPAFBase * pWiFiPAF) +{ + pmWiFiPAF = pWiFiPAF; + return; +} +#endif + void ConnectivityManagerImpl::StartNonConcurrentWiFiManagement() { StartWiFiManagement(); @@ -1226,6 +1353,229 @@ CHIP_ERROR ConnectivityManagerImpl::ConnectWiFiNetworkWithPDCAsync( return _ConnectWiFiNetworkAsync(args, connectCallback); } #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI_PDC +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +/* + NAN-USD Service Protocol Type: ref: Table 58 of Wi-Fi Aware Specificaiton +*/ +#define MAX_PAF_SUBSCRIBE_SSI_BUFLEN 128 +#define NAN_SRV_PROTO_MATTER 3 +#define NAM_SUBSCRIBE_PERIOD 30u +void ConnectivityManagerImpl::OnDiscoveryResult(gboolean success, GVariant * discov_info) +{ + ChipLogProgress(Controller, "WiFi-PAF: OnDiscoveryResult, %d", success); + + std::lock_guard lock(mWpaSupplicantMutex); + if (g_variant_n_children(discov_info) == 0) + { + return; + } + + if (success == true) + { + GAutoPtr dataValue(g_variant_lookup_value(discov_info, "discov_info", G_VARIANT_TYPE_BYTESTRING)); + size_t bufferLen; + auto buffer = g_variant_get_fixed_array(dataValue.get(), &bufferLen, sizeof(uint8_t)); + if (((struct wpa_dbus_discov_info *) buffer)->subscribe_id == mpaf_info.subscribe_id) + { + return; + } + memcpy(&mpaf_info, buffer, sizeof(struct wpa_dbus_discov_info)); + ChipLogProgress(DeviceLayer, "WiFi-PAF: subscribe_id: %u", mpaf_info.subscribe_id); + ChipLogProgress(DeviceLayer, "WiFi-PAF: peer_publish_id: %u", mpaf_info.peer_publish_id); + ChipLogProgress(DeviceLayer, "WiFi-PAF: peer_addr: [%02x:%02x:%02x:%02x:%02x:%02x]", mpaf_info.peer_addr[0], + mpaf_info.peer_addr[1], mpaf_info.peer_addr[2], mpaf_info.peer_addr[3], mpaf_info.peer_addr[4], + mpaf_info.peer_addr[5]); + GetWiFiPAF()->SetWiFiPAFState(Transport::WiFiPAFBase::State::kConnected); + + // Read the ssi + GAutoPtr ssiValue(g_variant_lookup_value(discov_info, "ssi", G_VARIANT_TYPE_BYTESTRING)); + size_t ssiBufLen; + g_variant_get_fixed_array(ssiValue.get(), &ssiBufLen, sizeof(uint8_t)); + + ChipDeviceEvent event; + event.Type = DeviceEventType::kCHIPoWiFiPAFConnected; + PlatformMgr().PostEventOrDie(&event); + } + else + { + GetWiFiPAF()->SetWiFiPAFState(Transport::WiFiPAFBase::State::kInitialized); + if (mOnPafSubscribeError != nullptr) + { + mOnPafSubscribeError(mAppState, CHIP_ERROR_TIMEOUT); + } + } + + return; +} + +void ConnectivityManagerImpl::OnNanReceive(GVariant * obj) +{ + if (g_variant_n_children(obj) == 0) + { + return; + } + // Read the rx_info + GAutoPtr dataValueInfo(g_variant_lookup_value(obj, "nanrx_info", G_VARIANT_TYPE_BYTESTRING)); + size_t infoBufferLen; + auto infoBuffer = g_variant_get_fixed_array(dataValueInfo.get(), &infoBufferLen, sizeof(uint8_t)); + + memcpy(&mpaf_nanrx_info, infoBuffer, sizeof(struct wpa_dbus_nanrx_info)); + mpaf_info.subscribe_id = mpaf_nanrx_info.id; + mpaf_info.peer_publish_id = mpaf_nanrx_info.peer_id; + memcpy(mpaf_info.peer_addr, mpaf_nanrx_info.peer_addr, 6); + if (mpaf_nanrx_info.ssi_len == 0) + { + return; + } + // Read the rx_data + GAutoPtr dataValue(g_variant_lookup_value(obj, "ssi", G_VARIANT_TYPE_BYTESTRING)); + size_t bufferLen; + System::PacketBufferHandle buf; + auto rxbuf = g_variant_get_fixed_array(dataValue.get(), &bufferLen, sizeof(uint8_t)); + ChipLogProgress(DeviceLayer, "WiFi-PAF: wpa_supplicant: nan-rx: [len: %lu]", bufferLen); + buf = System::PacketBufferHandle::NewWithData(rxbuf, bufferLen); + + // Post an event to the Chip queue to deliver the data into the Chip stack. + ChipDeviceEvent event; + event.Type = DeviceEventType::kCHIPoWiFiPAFWriteReceived; + event.CHIPoWiFiPAFWriteReceived.Data = std::move(buf).UnsafeRelease(); + PlatformMgr().PostEventOrDie(&event); + + return; +} + +void ConnectivityManagerImpl::OnNanSubscribeTerminated(gint term_subscribe_id, gint reason) +{ + ChipLogProgress(Controller, "WiFi-PAF: Subscription terminated (%d, %d)", term_subscribe_id, reason); + if (mpresubscribe_id == (uint32_t) term_subscribe_id) + { + mpresubscribe_id = 0; + } + if (mpaf_info.subscribe_id == (uint32_t) term_subscribe_id) + { + mpaf_info.subscribe_id = 0; + } + return; +} + +CHIP_ERROR ConnectivityManagerImpl::_WiFiPAFConnect(const SetupDiscriminator & connDiscriminator, void * appState, + OnConnectionCompleteFunct onSuccess, OnConnectionErrorFunct onError) +{ + ChipLogProgress(Controller, "WiFi-PAF: Try to subscribe the NAN-USD devices"); + gchar args[MAX_PAF_SUBSCRIBE_SSI_BUFLEN]; + gint subscribe_id; + snprintf(args, sizeof(args), "service_name=%s srv_proto_type=%u ttl=%u ", srv_name, NAN_SRV_PROTO_MATTER, NAM_SUBSCRIBE_PERIOD); + GAutoPtr err; + CHIP_ERROR ret; + struct PAFPublishSSI PafPublish_ssi; + + VerifyOrReturnError( + (strlen(args) + strlen(NAN_PUBLISH_SSI_TAG) + (sizeof(struct PAFPublishSSI) * 2) < MAX_PAF_PUBLISH_SSI_BUFLEN), + CHIP_ERROR_BUFFER_TOO_SMALL); + mAppState = appState; + PafPublish_ssi.DevOpCode = 0; + PafPublish_ssi.DevInfo = connDiscriminator.GetLongValue(); + if (DeviceLayer::GetDeviceInstanceInfoProvider()->GetProductId(PafPublish_ssi.ProductId) != CHIP_NO_ERROR) + { + PafPublish_ssi.ProductId = 0; + } + if (DeviceLayer::GetDeviceInstanceInfoProvider()->GetVendorId(PafPublish_ssi.VendorId) != CHIP_NO_ERROR) + { + PafPublish_ssi.VendorId = 0; + } + strcat(args, NAN_PUBLISH_SSI_TAG); + ret = Encoding::BytesToUppercaseHexString((uint8_t *) &PafPublish_ssi, sizeof(PafPublish_ssi), &args[strlen(args)], + MAX_PAF_PUBLISH_SSI_BUFLEN - strlen(args)); + VerifyOrReturnError(ret == CHIP_NO_ERROR, ret); + ChipLogProgress(DeviceLayer, "WiFi-PAF: subscribe: [%s]", args); + + wpa_fi_w1_wpa_supplicant1_interface_call_nansubscribe_sync(mWpaSupplicant.iface, args, &subscribe_id, nullptr, + &err.GetReceiver()); + ChipLogProgress(DeviceLayer, "WiFi-PAF: subscribe_id: [%d]", subscribe_id); + mpresubscribe_id = subscribe_id; + mOnPafSubscribeComplete = onSuccess; + mOnPafSubscribeError = onError; + g_signal_connect(mWpaSupplicant.iface, "nan-discoveryresult", + G_CALLBACK(+[](WpaFiW1Wpa_supplicant1Interface * proxy, gboolean success, GVariant * obj, + ConnectivityManagerImpl * self) { return self->OnDiscoveryResult(success, obj); }), + this); + + g_signal_connect(mWpaSupplicant.iface, "nan-receive", + G_CALLBACK(+[](WpaFiW1Wpa_supplicant1Interface * proxy, GVariant * obj, ConnectivityManagerImpl * self) { + return self->OnNanReceive(obj); + }), + this); + + g_signal_connect( + mWpaSupplicant.iface, "nan-subscribeterminated", + G_CALLBACK(+[](WpaFiW1Wpa_supplicant1Interface * proxy, gint term_subscribe_id, gint reason, + ConnectivityManagerImpl * self) { return self->OnNanSubscribeTerminated(term_subscribe_id, reason); }), + this); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR ConnectivityManagerImpl::_WiFiPAFCancelConnect() +{ + if (mpresubscribe_id == 0) + { + return CHIP_NO_ERROR; + } + GAutoPtr err; + gchar args[MAX_PAF_PUBLISH_SSI_BUFLEN]; + + snprintf(args, sizeof(args), "subscribe_id=%d", mpresubscribe_id); + wpa_fi_w1_wpa_supplicant1_interface_call_nancancel_subscribe_sync(mWpaSupplicant.iface, args, nullptr, &err.GetReceiver()); + return CHIP_NO_ERROR; +} + +CHIP_ERROR ConnectivityManagerImpl::_WiFiPAFSend(System::PacketBufferHandle && msgBuf) +{ + ChipLogProgress(Controller, "WiFi-PAF: sending PAF Follow-up packets, (%lu)", msgBuf->DataLength()); + CHIP_ERROR ret = CHIP_NO_ERROR; + + if (msgBuf.IsNull()) + { + ChipLogError(Controller, "WiFi-PAF: Invalid Packet (%lu)", msgBuf->DataLength()); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + // Ensure outgoing message fits in a single contiguous packet buffer, as currently required by the + // message fragmentation and reassembly engine. + if (msgBuf->HasChainedBuffer()) + { + msgBuf->CompactHead(); + + if (msgBuf->HasChainedBuffer()) + { + ret = CHIP_ERROR_OUTBOUND_MESSAGE_TOO_BIG; + ChipLogError(Controller, "WiFi-PAF: Outbound message too big (%lu), skip temporally", msgBuf->DataLength()); + return ret; + } + } + + // ================================================================================================================ + // Send the packets + GAutoPtr err; + gchar args[MAX_PAF_TX_SSI_BUFLEN]; + + snprintf(args, sizeof(args), "handle=%u req_instance_id=%u address=%02x:%02x:%02x:%02x:%02x:%02x ssi=", mpaf_info.subscribe_id, + mpaf_info.peer_publish_id, mpaf_info.peer_addr[0], mpaf_info.peer_addr[1], mpaf_info.peer_addr[2], + mpaf_info.peer_addr[3], mpaf_info.peer_addr[4], mpaf_info.peer_addr[5]); + + ChipLogProgress(Controller, "===> %s(), (%lu, %u)", __FUNCTION__, (strlen(args) + msgBuf->DataLength()), MAX_PAF_TX_SSI_BUFLEN) + VerifyOrReturnError((strlen(args) + msgBuf->DataLength() < MAX_PAF_TX_SSI_BUFLEN), CHIP_ERROR_BUFFER_TOO_SMALL); + + ret = chip::Encoding::BytesToUppercaseHexString(msgBuf->Start(), msgBuf->DataLength(), &args[strlen(args)], + MAX_PAF_TX_SSI_BUFLEN - strlen(args)); + VerifyOrReturnError(ret == CHIP_NO_ERROR, ret); + ChipLogProgress(DeviceLayer, "WiFi-PAF: ssi: [%s]", args); + wpa_fi_w1_wpa_supplicant1_interface_call_nantransmit_sync(mWpaSupplicant.iface, args, nullptr, &err.GetReceiver()); + ChipLogProgress(Controller, "WiFi-PAF: Outbound message (%lu) done", msgBuf->DataLength()); + return ret; +} + +#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF void ConnectivityManagerImpl::_ConnectWiFiNetworkAsyncCallback(GObject * sourceObject, GAsyncResult * res) { @@ -1471,7 +1821,7 @@ CHIP_ERROR ConnectivityManagerImpl::GetConfiguredNetwork(NetworkCommissioning::N const gchar * networkPath = wpa_fi_w1_wpa_supplicant1_interface_get_current_network(mWpaSupplicant.iface); // wpa_supplicant DBus API: if network path of current network is "/", means no networks is currently selected. - if (strcmp(networkPath, "/") == 0) + if ((networkPath == nullptr) || (strcmp(networkPath, "/") == 0)) { return CHIP_ERROR_KEY_NOT_FOUND; } diff --git a/src/platform/Linux/ConnectivityManagerImpl.h b/src/platform/Linux/ConnectivityManagerImpl.h index ee5978faf6ff70..2025f228532961 100644 --- a/src/platform/Linux/ConnectivityManagerImpl.h +++ b/src/platform/Linux/ConnectivityManagerImpl.h @@ -48,6 +48,9 @@ #include #include +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF +#include +#endif #endif #include @@ -137,6 +140,17 @@ class ConnectivityManagerImpl final : public ConnectivityManager, const Crypto::P256Keypair & clientIdentityKeypair, NetworkCommissioning::Internal::WirelessDriver::ConnectCallback * connectCallback); #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI_PDC +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + CHIP_ERROR _WiFiPAFConnect(const SetupDiscriminator & connDiscriminator, void * appState, OnConnectionCompleteFunct onSuccess, + OnConnectionErrorFunct onError); + CHIP_ERROR _WiFiPAFCancelConnect(); + void OnDiscoveryResult(gboolean success, GVariant * obj); + void OnNanReceive(GVariant * obj); + void OnNanSubscribeTerminated(gint term_subscribe_id, gint reason); + CHIP_ERROR _WiFiPAFSend(chip::System::PacketBufferHandle && msgBuf); + Transport::WiFiPAFBase * _GetWiFiPAF(); + void _SetWiFiPAF(Transport::WiFiPAFBase * pWiFiPAF); +#endif void PostNetworkConnect(); CHIP_ERROR CommitConfig(); @@ -215,6 +229,33 @@ class ConnectivityManagerImpl final : public ConnectivityManager, void _OnWpaInterfaceReady(GObject * sourceObject, GAsyncResult * res); void _OnWpaInterfaceProxyReady(GObject * sourceObject, GAsyncResult * res); void _OnWpaBssProxyReady(GObject * sourceObject, GAsyncResult * res); +#if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF + struct wpa_dbus_discov_info + { + uint32_t subscribe_id; + uint32_t peer_publish_id; + uint8_t peer_addr[6]; + uint32_t ssi_len; + }; + uint32_t mpresubscribe_id; + struct wpa_dbus_discov_info mpaf_info; + struct wpa_dbus_nanrx_info + { + uint32_t id; + uint32_t peer_id; + uint8_t peer_addr[6]; + uint32_t ssi_len; + }; + struct wpa_dbus_nanrx_info mpaf_nanrx_info; + + OnConnectionCompleteFunct mOnPafSubscribeComplete; + OnConnectionErrorFunct mOnPafSubscribeError; + Transport::WiFiPAFBase * pmWiFiPAF; + void * mAppState; + CHIP_ERROR _SetWiFiPAFAdvertisingEnabled(WiFiPAFAdvertiseParam & args); + CHIP_ERROR _WiFiPAFPublish(WiFiPAFAdvertiseParam & args); + CHIP_ERROR _WiFiPAFCancelPublish(); +#endif bool _GetBssInfo(const gchar * bssPath, NetworkCommissioning::WiFiScanResponse & result); diff --git a/src/platform/Linux/dbus/wpa/DBusWpaInterface.xml b/src/platform/Linux/dbus/wpa/DBusWpaInterface.xml index ef86bdd3b17032..721ca0033cca09 100644 --- a/src/platform/Linux/dbus/wpa/DBusWpaInterface.xml +++ b/src/platform/Linux/dbus/wpa/DBusWpaInterface.xml @@ -56,6 +56,23 @@ + + + + + + + + + + + + + + + + + @@ -92,6 +109,21 @@ + + + + + + + + + + + + + + + diff --git a/src/platform/NuttX/BLEManagerImpl.cpp b/src/platform/NuttX/BLEManagerImpl.cpp index 8502fd861fa307..f28308dd86fc6a 100644 --- a/src/platform/NuttX/BLEManagerImpl.cpp +++ b/src/platform/NuttX/BLEManagerImpl.cpp @@ -345,9 +345,10 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const return mtu; } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { - bool result = false; + CHIP_ERROR err = BLE_ERROR_GATT_SUBSCRIBE_FAILED; VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); @@ -355,17 +356,16 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipLogError(DeviceLayer, "SubscribeCharacteristic() called with invalid service ID")); VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID), ChipLogError(DeviceLayer, "SubscribeCharacteristic() called with invalid characteristic ID")); - - VerifyOrExit(conId->SubscribeCharacteristic() == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "SubscribeCharacteristic() failed")); - result = true; + err = conId->SubscribeCharacteristic(); exit: - return result; + return err; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { - bool result = false; + CHIP_ERROR err = BLE_ERROR_GATT_UNSUBSCRIBE_FAILED; VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); @@ -373,48 +373,42 @@ bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, cons ChipLogError(DeviceLayer, "UnsubscribeCharacteristic() called with invalid service ID")); VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID), ChipLogError(DeviceLayer, "UnsubscribeCharacteristic() called with invalid characteristic ID")); - - VerifyOrExit(conId->UnsubscribeCharacteristic() == CHIP_NO_ERROR, - ChipLogError(DeviceLayer, "UnsubscribeCharacteristic() failed")); - result = true; + err = conId->UnsubscribeCharacteristic(); exit: - return result; + return err; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { - bool result = false; + CHIP_ERROR err = CHIP_ERROR_INTERNAL; VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); ChipLogProgress(DeviceLayer, "Closing BLE GATT connection (con %p)", conId); - - VerifyOrExit(conId->CloseConnection() == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "CloseConnection() failed")); - result = true; + err = conId->CloseConnection(); exit: - return result; + return err; } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - chip::System::PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + chip::System::PacketBufferHandle pBuf) { - bool result = false; + CHIP_ERROR err = BLE_ERROR_GATT_INDICATE_FAILED; VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); - VerifyOrExit(conId->SendIndication(std::move(pBuf)) == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "SendIndication() failed")); - result = true; + err = conId->SendIndication(std::move(pBuf)); exit: - return result; + return err; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - chip::System::PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId, chip::System::PacketBufferHandle pBuf) { - bool result = false; + CHIP_ERROR err = BLE_ERROR_GATT_WRITE_FAILED; VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); @@ -422,12 +416,10 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::Ch ChipLogError(DeviceLayer, "SendWriteRequest() called with invalid service ID")); VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_1_UUID), ChipLogError(DeviceLayer, "SendWriteRequest() called with invalid characteristic ID")); - - VerifyOrExit(conId->SendWriteRequest(std::move(pBuf)) == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "SendWriteRequest() failed")); - result = true; + err = conId->SendWriteRequest(std::move(pBuf)); exit: - return result; + return err; } void BLEManagerImpl::HandleNewConnection(BLE_CONNECTION_OBJECT conId) diff --git a/src/platform/NuttX/BLEManagerImpl.h b/src/platform/NuttX/BLEManagerImpl.h index e22c83978fafa8..f6f6db6c3a3b3f 100644 --- a/src/platform/NuttX/BLEManagerImpl.h +++ b/src/platform/NuttX/BLEManagerImpl.h @@ -116,16 +116,16 @@ class BLEManagerImpl final : public BLEManager, // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/OpenThread/GenericThreadBorderRouterDelegate.cpp b/src/platform/OpenThread/GenericThreadBorderRouterDelegate.cpp new file mode 100644 index 00000000000000..e1efc5357520af --- /dev/null +++ b/src/platform/OpenThread/GenericThreadBorderRouterDelegate.cpp @@ -0,0 +1,224 @@ +/* + * + * 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 "GenericThreadBorderRouterDelegate.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { + +namespace ThreadBorderRouterManagement { + +class ScopedThreadLock +{ +public: + ScopedThreadLock() { DeviceLayer::ThreadStackMgr().LockThreadStack(); } + ~ScopedThreadLock() { DeviceLayer::ThreadStackMgr().UnlockThreadStack(); } +}; + +CHIP_ERROR GenericOpenThreadBorderRouterDelegate::Init(AttributeChangeCallback * callback) +{ + mpActivateDatasetCallback = nullptr; + mpAttributeChangeCallback = callback; + ReturnErrorOnFailure(DeviceLayer::PlatformMgrImpl().AddEventHandler(OnPlatformEventHandler, reinterpret_cast(this))); + // When the Thread Border Router is reboot during SetActiveDataset, we need to revert the active dateset. + RevertActiveDataset(); + return CHIP_NO_ERROR; +} + +CHIP_ERROR GenericOpenThreadBorderRouterDelegate::GetBorderAgentId(MutableByteSpan & borderAgentIdSpan) +{ + otInstance * otInst = DeviceLayer::ThreadStackMgrImpl().OTInstance(); + VerifyOrReturnError(otInst, CHIP_ERROR_INCORRECT_STATE); + otBorderAgentId borderAgentId; + if (borderAgentIdSpan.size() != sizeof(borderAgentId.mId)) + { + return CHIP_ERROR_INVALID_ARGUMENT; + } + otError otErr = OT_ERROR_NONE; + { + ScopedThreadLock threadLock; + otErr = otBorderAgentGetId(otInst, &borderAgentId); + } + if (otErr == OT_ERROR_NONE) + { + CopySpanToMutableSpan(ByteSpan(borderAgentId.mId), borderAgentIdSpan); + return CHIP_NO_ERROR; + } + return DeviceLayer::Internal::MapOpenThreadError(otErr); +} + +uint16_t GenericOpenThreadBorderRouterDelegate::GetThreadVersion() +{ + return otThreadGetVersion(); +} + +bool GenericOpenThreadBorderRouterDelegate::GetInterfaceEnabled() +{ + otInstance * otInst = DeviceLayer::ThreadStackMgrImpl().OTInstance(); + VerifyOrReturnValue(otInst, false); + ScopedThreadLock threadLock; + return otIp6IsEnabled(otInst); +} + +CHIP_ERROR GenericOpenThreadBorderRouterDelegate::GetDataset(Thread::OperationalDataset & dataset, DatasetType type) +{ + otInstance * otInst = DeviceLayer::ThreadStackMgrImpl().OTInstance(); + VerifyOrReturnError(otInst, CHIP_ERROR_INCORRECT_STATE); + + otError otErr = OT_ERROR_NONE; + otOperationalDatasetTlvs datasetTlvs; + { + ScopedThreadLock threadLock; + if (type == DatasetType::kActive) + { + otErr = otDatasetGetActiveTlvs(otInst, &datasetTlvs); + } + else + { + otErr = otDatasetGetPendingTlvs(otInst, &datasetTlvs); + } + } + if (otErr == OT_ERROR_NONE) + { + return dataset.Init(ByteSpan(datasetTlvs.mTlvs, datasetTlvs.mLength)); + } + return DeviceLayer::Internal::MapOpenThreadError(otErr); +} + +void GenericOpenThreadBorderRouterDelegate::SetActiveDataset(const Thread::OperationalDataset & activeDataset, uint32_t sequenceNum, + ActivateDatasetCallback * callback) +{ + // This function will never be invoked when there is an Active Dataset already configured. + CHIP_ERROR err = SaveActiveDatasetConfigured(false); + if (err == CHIP_NO_ERROR) + { + err = DeviceLayer::ThreadStackMgrImpl().AttachToThreadNetwork(activeDataset, nullptr); + } + if (err != CHIP_NO_ERROR) + { + callback->OnActivateDatasetComplete(sequenceNum, err); + return; + } + mSequenceNum = sequenceNum; + mpActivateDatasetCallback = callback; +} + +void GenericOpenThreadBorderRouterDelegate::OnPlatformEventHandler(const DeviceLayer::ChipDeviceEvent * event, intptr_t arg) +{ + GenericOpenThreadBorderRouterDelegate * delegate = reinterpret_cast(arg); + if (delegate) + { + if ((event->Type == DeviceLayer::DeviceEventType::kThreadConnectivityChange) && + (event->ThreadConnectivityChange.Result == DeviceLayer::kConnectivity_Established) && + delegate->mpActivateDatasetCallback) + { + delegate->mpActivateDatasetCallback->OnActivateDatasetComplete(delegate->mSequenceNum, CHIP_NO_ERROR); + delegate->mpActivateDatasetCallback = nullptr; + } + } + if (event->Type == DeviceLayer::DeviceEventType::kThreadStateChange) + { + if (event->ThreadStateChange.OpenThread.Flags & OT_CHANGED_THREAD_NETIF_STATE) + { + DeviceLayer::SystemLayer().ScheduleLambda( + [delegate]() { delegate->mpAttributeChangeCallback->ReportAttributeChanged(Attributes::InterfaceEnabled::Id); }); + } + if (event->ThreadStateChange.OpenThread.Flags & OT_CHANGED_ACTIVE_DATASET) + { + DeviceLayer::SystemLayer().ScheduleLambda([delegate]() { + delegate->mpAttributeChangeCallback->ReportAttributeChanged(Attributes::ActiveDatasetTimestamp::Id); + }); + } + } +} + +CHIP_ERROR GenericOpenThreadBorderRouterDelegate::SaveActiveDatasetConfigured(bool configured) +{ + VerifyOrReturnError(mStorage, CHIP_ERROR_INTERNAL); + return mStorage->SyncSetKeyValue(kFailsafeActiveDatasetConfigured, &configured, sizeof(bool)); +} + +CHIP_ERROR GenericOpenThreadBorderRouterDelegate::CommitActiveDataset() +{ + return SaveActiveDatasetConfigured(DeviceLayer::ThreadStackMgrImpl().IsThreadAttached()); +} + +CHIP_ERROR GenericOpenThreadBorderRouterDelegate::RevertActiveDataset() +{ + // The FailSafe Timer is triggered and the previous command request should be handled, so reset the callback. + mpActivateDatasetCallback = nullptr; + bool activeDatasetConfigured = true; + uint16_t activeDatasetConfiguredLen = sizeof(bool); + VerifyOrReturnError(mStorage, CHIP_ERROR_INTERNAL); + mStorage->SyncGetKeyValue(kFailsafeActiveDatasetConfigured, &activeDatasetConfigured, activeDatasetConfiguredLen); + VerifyOrDie(activeDatasetConfiguredLen == sizeof(bool)); + if (!activeDatasetConfigured) + { + // The active dataset should be no configured after calling this function, so we will try to attach an empty Thread dataset + // and that will clear the one stored in the Thread stack since the SetActiveDataset operation fails and FailSafe timer is + // triggered. + Thread::OperationalDataset emptyDataset = {}; + CHIP_ERROR err = DeviceLayer::ThreadStackMgrImpl().AttachToThreadNetwork(emptyDataset, nullptr); + SaveActiveDatasetConfigured(false); + return err; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR GenericOpenThreadBorderRouterDelegate::SetPendingDataset(const Thread::OperationalDataset & pendingDataset) +{ + otInstance * otInst = DeviceLayer::ThreadStackMgrImpl().OTInstance(); + VerifyOrReturnError(otInst, CHIP_ERROR_INCORRECT_STATE); + + otOperationalDatasetTlvs datasetTlvs; + memcpy(datasetTlvs.mTlvs, pendingDataset.AsByteSpan().data(), pendingDataset.AsByteSpan().size()); + datasetTlvs.mLength = pendingDataset.AsByteSpan().size(); + { + ScopedThreadLock threadLock; + ReturnErrorCodeIf(otDatasetSetPendingTlvs(otInst, &datasetTlvs) != OT_ERROR_NONE, CHIP_ERROR_INTERNAL); + } + return CHIP_NO_ERROR; +} + +} // namespace ThreadBorderRouterManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/platform/OpenThread/GenericThreadBorderRouterDelegate.h b/src/platform/OpenThread/GenericThreadBorderRouterDelegate.h new file mode 100644 index 00000000000000..079f1bd6e38edd --- /dev/null +++ b/src/platform/OpenThread/GenericThreadBorderRouterDelegate.h @@ -0,0 +1,104 @@ +/* + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { + +namespace ThreadBorderRouterManagement { + +class GenericOpenThreadBorderRouterDelegate : public Delegate +{ +public: + static constexpr char kFailsafeActiveDatasetConfigured[] = "g/fs/tbradc"; + GenericOpenThreadBorderRouterDelegate(PersistentStorageDelegate * storage) : mStorage(storage) {} + ~GenericOpenThreadBorderRouterDelegate() = default; + + CHIP_ERROR Init(AttributeChangeCallback * callback) override; + + bool GetPanChangeSupported() override { return true; } + + void GetBorderRouterName(MutableCharSpan & borderRouterName) override + { + CopyCharSpanToMutableCharSpan(CharSpan(mThreadBorderRouterName, strlen(mThreadBorderRouterName)), borderRouterName); + } + + CHIP_ERROR GetBorderAgentId(MutableByteSpan & borderAgentId) override; + + uint16_t GetThreadVersion() override; + + bool GetInterfaceEnabled() override; + + CHIP_ERROR GetDataset(Thread::OperationalDataset & dataset, DatasetType type) override; + + void SetActiveDataset(const Thread::OperationalDataset & activeDataset, uint32_t sequenceNum, + ActivateDatasetCallback * callback) override; + + CHIP_ERROR CommitActiveDataset() override; + + CHIP_ERROR RevertActiveDataset() override; + + CHIP_ERROR SetPendingDataset(const Thread::OperationalDataset & pendingDataset) override; + + static void OnPlatformEventHandler(const DeviceLayer::ChipDeviceEvent * event, intptr_t arg); + + void SetThreadBorderRouterName(const CharSpan & name) + { + MutableCharSpan borderRouterName(mThreadBorderRouterName); + CopyCharSpanToMutableCharSpan(name, borderRouterName); + if (mpAttributeChangeCallback) + { + DeviceLayer::SystemLayer().ScheduleLambda( + [this]() { mpAttributeChangeCallback->ReportAttributeChanged(Attributes::BorderRouterName::Id); }); + } + } + + void NotifyBorderAgentIdChanged() + { + if (mpAttributeChangeCallback) + { + // OpenThread doesn't have callback or event for BorderAgentId change, we can only change the BorderAgentId with + // otBorderAgentSetId(). Please call this function with otBorderAgentSetId(). + DeviceLayer::SystemLayer().ScheduleLambda( + [this]() { mpAttributeChangeCallback->ReportAttributeChanged(Attributes::BorderAgentID::Id); }); + } + } + +private: + CHIP_ERROR SaveActiveDatasetConfigured(bool configured); + ActivateDatasetCallback * mpActivateDatasetCallback = nullptr; + uint32_t mSequenceNum = 0; + char mThreadBorderRouterName[kBorderRouterNameMaxLength + 1]; + PersistentStorageDelegate * mStorage; + AttributeChangeCallback * mpAttributeChangeCallback = nullptr; +}; +} // namespace ThreadBorderRouterManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h index 317bff7c05403e..c45ff84bb0f26e 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h @@ -142,6 +142,7 @@ class GenericThreadStackManagerImpl_OpenThread // ===== Members available to the implementation subclass. + CHIP_ERROR ConfigureThreadStack(otInstance * otInst); CHIP_ERROR DoInit(otInstance * otInst); bool IsThreadAttachedNoLock(void); bool IsThreadInterfaceUpNoLock(void); diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp index 876cb54385efe6..61452f5ff0ec90 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp @@ -1088,29 +1088,21 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_GetPollPeriod(u return CHIP_NO_ERROR; } +/** + * @brief Helper that sets callbacks for OpenThread state changes and configures the Thread stack. + * Assigns mOTInst to an instance, and configures the OT stack on a device by setting state change callbacks enabling features + * for IPv6 address configuration, enabling the Thread network if necessary, and handling SRP if enabled. + * Allows for the configuration of the Thread stack on a device where the instance and the otCLI are already initialised. + * + * @param otInst Pointer to the OT instance + * @return CHIP_ERROR OpenThread error mapped to CHIP_ERROR + */ template -CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::DoInit(otInstance * otInst) +CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::ConfigureThreadStack(otInstance * otInst) { CHIP_ERROR err = CHIP_NO_ERROR; otError otErr = OT_ERROR_NONE; - // Arrange for OpenThread errors to be translated to text. - RegisterOpenThreadErrorFormatter(); - - mOTInst = NULL; - - // If an OpenThread instance hasn't been supplied, call otInstanceInitSingle() to - // create or acquire a singleton instance of OpenThread. - if (otInst == NULL) - { - otInst = otInstanceInitSingle(); - VerifyOrExit(otInst != NULL, err = MapOpenThreadError(OT_ERROR_FAILED)); - } - -#if !defined(PW_RPC_ENABLED) && CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI - otAppCliInit(otInst); -#endif - mOTInst = otInst; // Arrange for OpenThread to call the OnOpenThreadStateChange method whenever a @@ -1146,14 +1138,42 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::DoInit(otInstanc } #endif - initNetworkCommissioningThreadDriver(); - exit: ChipLogProgress(DeviceLayer, "OpenThread started: %s", otThreadErrorToString(otErr)); return err; } +template +CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::DoInit(otInstance * otInst) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + // Arrange for OpenThread errors to be translated to text. + RegisterOpenThreadErrorFormatter(); + + mOTInst = NULL; + + // If an OpenThread instance hasn't been supplied, call otInstanceInitSingle() to + // create or acquire a singleton instance of OpenThread. + if (otInst == NULL) + { + otInst = otInstanceInitSingle(); + VerifyOrExit(otInst != NULL, err = MapOpenThreadError(OT_ERROR_FAILED)); + } + +#if !defined(PW_RPC_ENABLED) && CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI + otAppCliInit(otInst); +#endif + + err = ConfigureThreadStack(otInst); + + initNetworkCommissioningThreadDriver(); + +exit: + return err; +} + template bool GenericThreadStackManagerImpl_OpenThread::IsThreadAttachedNoLock(void) { diff --git a/src/platform/Tizen/BLEManagerImpl.cpp b/src/platform/Tizen/BLEManagerImpl.cpp index 116878e67e8cff..046d687c5012f5 100644 --- a/src/platform/Tizen/BLEManagerImpl.cpp +++ b/src/platform/Tizen/BLEManagerImpl.cpp @@ -1168,10 +1168,10 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const return (conId != BLE_CONNECTION_UNINITIALIZED) ? static_cast(conId->mtu) : 0; } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) { - int ret; + int ret = TIZEN_ERROR_INVALID_PARAMETER; ChipLogProgress(DeviceLayer, "SubscribeCharacteristic"); @@ -1190,16 +1190,15 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipLogError(DeviceLayer, "bt_gatt_client_set_characteristic_value_changed_cb() failed: %s", get_error_message(ret))); NotifySubscribeOpComplete(conId, true); - return true; exit: - return false; + return TizenToChipError(ret); } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) { - int ret; + int ret = TIZEN_ERROR_INVALID_PARAMETER; ChipLogProgress(DeviceLayer, "UnSubscribeCharacteristic"); @@ -1218,15 +1217,14 @@ bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, cons ChipLogError(DeviceLayer, "bt_gatt_client_unset_characteristic_value_changed_cb() failed: %s", get_error_message(ret))); NotifySubscribeOpComplete(conId, false); - return true; exit: - return false; + return TizenToChipError(ret); } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { - int ret; + int ret = TIZEN_ERROR_INVALID_PARAMETER; ChipLogProgress(DeviceLayer, "Close BLE Connection"); @@ -1238,16 +1236,15 @@ bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_disconnect() failed: %s", get_error_message(ret))); RemoveConnectionData(conId->peerAddr); - return true; exit: - return false; + return TizenToChipError(ret); } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId, System::PacketBufferHandle pBuf) { - int ret; + int ret = TIZEN_ERROR_INVALID_PARAMETER; conId = static_cast(g_hash_table_lookup(mConnectionMap, conId->peerAddr)); VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "Failed to find connection info")); @@ -1269,16 +1266,15 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::Chip VerifyOrExit( ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_notify_characteristic_changed_value() failed: %s", get_error_message(ret))); - return true; exit: - return false; + return TizenToChipError(ret); } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId, System::PacketBufferHandle pBuf) { - int ret; + int ret = TIZEN_ERROR_INVALID_PARAMETER; VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "Invalid Connection")); VerifyOrExit(Ble::UUIDsMatch(svcId, &Ble::CHIP_BLE_SVC_ID), @@ -1296,9 +1292,9 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::Ch ret = bt_gatt_client_write_value(conId->gattCharC1Handle, WriteCompletedCb, conId); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_client_write_value() failed: %s", get_error_message(ret))); - return true; + exit: - return false; + return TizenToChipError(ret); } void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) {} diff --git a/src/platform/Tizen/BLEManagerImpl.h b/src/platform/Tizen/BLEManagerImpl.h index 013aa24e78c03d..c8ba6438167e01 100644 --- a/src/platform/Tizen/BLEManagerImpl.h +++ b/src/platform/Tizen/BLEManagerImpl.h @@ -114,16 +114,16 @@ class BLEManagerImpl final : public BLEManager, // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/Zephyr/BLEManagerImpl.cpp b/src/platform/Zephyr/BLEManagerImpl.cpp index ae8ca1df7d408f..7af097195c6e27 100644 --- a/src/platform/Zephyr/BLEManagerImpl.cpp +++ b/src/platform/Zephyr/BLEManagerImpl.cpp @@ -740,10 +740,10 @@ uint16_t BLEManagerImpl::_NumConnections(void) return mMatterConnNum; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { ChipLogProgress(DeviceLayer, "Closing BLE GATT connection (ConnId %02x)", bt_conn_index(conId)); - return bt_conn_disconnect(conId, BT_HCI_ERR_REMOTE_USER_TERM_CONN) == 0; + return MapErrorZephyr(bt_conn_disconnect(conId, BT_HCI_ERR_REMOTE_USER_TERM_CONN)); } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -751,20 +751,22 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const return bt_gatt_get_mtu(conId); } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogDetail(DeviceLayer, "BLE central not implemented"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogDetail(DeviceLayer, "BLE central not implemented"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { CHIP_ERROR err = CHIP_NO_ERROR; int status = 0; @@ -787,19 +789,14 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU VerifyOrExit(status == 0, err = MapErrorZephyr(status)); exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "BLEManagerImpl::SendIndication() failed: %" CHIP_ERROR_FORMAT, err.Format()); - } - - return err == CHIP_NO_ERROR; + return err; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { ChipLogDetail(DeviceLayer, "BLE central not implemented"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) diff --git a/src/platform/Zephyr/BLEManagerImpl.h b/src/platform/Zephyr/BLEManagerImpl.h index 3be23dd2126a99..8c09ed457f94b2 100644 --- a/src/platform/Zephyr/BLEManagerImpl.h +++ b/src/platform/Zephyr/BLEManagerImpl.h @@ -63,14 +63,15 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId); - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId); - bool CloseConnection(BLE_CONNECTION_OBJECT conId); - uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf); - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf); + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; + uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/Zephyr/SysHeapMalloc.cpp b/src/platform/Zephyr/SysHeapMalloc.cpp index d4f65b05459615..fbd7ba09fc2493 100644 --- a/src/platform/Zephyr/SysHeapMalloc.cpp +++ b/src/platform/Zephyr/SysHeapMalloc.cpp @@ -30,9 +30,6 @@ extern "C" { #include #include -// Construct name of the given function wrapped with the `--wrap=symbol` GCC option. -#define WRAP(f) __wrap_##f - using namespace chip; namespace { @@ -67,7 +64,7 @@ LockGuard::~LockGuard() } } -int initHeap() +int InitSysHeapMalloc() { sys_heap_init(&sHeap, sHeapMemory, sizeof(sHeapMemory)); return 0; @@ -77,7 +74,7 @@ int initHeap() // Initialize the heap in the POST_KERNEL phase to make sure that it is ready even before // C++ static constructors are called (which happens prior to the APPLICATION initialization phase). -SYS_INIT(initHeap, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +SYS_INIT(InitSysHeapMalloc, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); namespace chip { namespace DeviceLayer { @@ -99,7 +96,7 @@ void * Calloc(size_t num, size_t size) return nullptr; } - void * mem = malloc(totalSize); + void * mem = Malloc(totalSize); if (mem) { @@ -156,27 +153,37 @@ void ResetMaxStats() extern "C" { -void * WRAP(malloc)(size_t size) __attribute((alias("_ZN4chip11DeviceLayer6Malloc6MallocEj"))); -void * WRAP(calloc)(size_t num, size_t size) __attribute((alias("_ZN4chip11DeviceLayer6Malloc6CallocEjj"))); -void * WRAP(realloc)(void * mem, size_t size) __attribute((alias("_ZN4chip11DeviceLayer6Malloc7ReallocEPvj"))); -void WRAP(free)(void * mem) __attribute((alias("_ZN4chip11DeviceLayer6Malloc4FreeEPv"))); +// Construct the name of a function wrapped with the `--wrap=symbol` GCC option. +#define WRAP(f) __wrap_##f + +// Define a function as an alias of another function. +#define ALIAS(f) __attribute((alias(f))) + +// Mark a function as externally visible so that it is not optimized-away even +// if LTO or whole-program optimization is enabled. +#define EXTERNALLY_VISIBLE __attribute((externally_visible)) + +EXTERNALLY_VISIBLE void * WRAP(malloc)(size_t size) ALIAS("_ZN4chip11DeviceLayer6Malloc6MallocEj"); +EXTERNALLY_VISIBLE void * WRAP(calloc)(size_t num, size_t size) ALIAS("_ZN4chip11DeviceLayer6Malloc6CallocEjj"); +EXTERNALLY_VISIBLE void * WRAP(realloc)(void * mem, size_t size) ALIAS("_ZN4chip11DeviceLayer6Malloc7ReallocEPvj"); +EXTERNALLY_VISIBLE void WRAP(free)(void * mem) ALIAS("_ZN4chip11DeviceLayer6Malloc4FreeEPv"); -void * WRAP(_malloc_r)(_reent *, size_t size) +EXTERNALLY_VISIBLE void * WRAP(_malloc_r)(_reent *, size_t size) { return WRAP(malloc)(size); } -void * WRAP(_calloc_r)(_reent *, size_t num, size_t size) +EXTERNALLY_VISIBLE void * WRAP(_calloc_r)(_reent *, size_t num, size_t size) { return WRAP(calloc)(num, size); } -void * WRAP(_realloc_r)(_reent *, void * mem, size_t size) +EXTERNALLY_VISIBLE void * WRAP(_realloc_r)(_reent *, void * mem, size_t size) { return WRAP(realloc)(mem, size); } -void WRAP(_free_r)(_reent *, void * mem) +EXTERNALLY_VISIBLE void WRAP(_free_r)(_reent *, void * mem) { WRAP(free)(mem); } diff --git a/src/platform/android/BLEManagerImpl.cpp b/src/platform/android/BLEManagerImpl.cpp index 8b0429e84a8af8..89653cfc427f53 100644 --- a/src/platform/android/BLEManagerImpl.cpp +++ b/src/platform/android/BLEManagerImpl.cpp @@ -218,7 +218,8 @@ BleLayer * BLEManagerImpl::_GetBleLayer() // ===== start implement virtual methods on BlePlatformDelegate. -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { chip::DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; @@ -226,7 +227,6 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const jbyteArray svcIdObj; jbyteArray charIdObj; intptr_t tmpConnObj; - bool rc = false; ChipLogProgress(DeviceLayer, "Received SubscribeCharacteristic"); @@ -242,22 +242,23 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const env->ExceptionClear(); tmpConnObj = reinterpret_cast(conId); - rc = (bool) env->CallBooleanMethod(mBLEManagerObject.ObjectRef(), mOnSubscribeCharacteristicMethod, - static_cast(tmpConnObj), svcIdObj, charIdObj); + VerifyOrExit(env->CallBooleanMethod(mBLEManagerObject.ObjectRef(), mOnSubscribeCharacteristicMethod, + static_cast(tmpConnObj), svcIdObj, charIdObj), + err = BLE_ERROR_GATT_SUBSCRIBE_FAILED); VerifyOrExit(!env->ExceptionCheck(), err = CHIP_JNI_ERROR_EXCEPTION_THROWN); exit: if (err != CHIP_NO_ERROR) { JniReferences::GetInstance().ReportError(env, err, __FUNCTION__); - rc = false; } env->ExceptionClear(); - return rc; + return err; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { chip::DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; @@ -265,7 +266,6 @@ bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, cons jbyteArray svcIdObj; jbyteArray charIdObj; intptr_t tmpConnObj; - bool rc = false; ChipLogProgress(DeviceLayer, "Received UnsubscribeCharacteristic"); @@ -281,28 +281,27 @@ bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, cons env->ExceptionClear(); tmpConnObj = reinterpret_cast(conId); - rc = (bool) env->CallBooleanMethod(mBLEManagerObject.ObjectRef(), mOnUnsubscribeCharacteristicMethod, - static_cast(tmpConnObj), svcIdObj, charIdObj); + VerifyOrExit(env->CallBooleanMethod(mBLEManagerObject.ObjectRef(), mOnUnsubscribeCharacteristicMethod, + static_cast(tmpConnObj), svcIdObj, charIdObj), + err = BLE_ERROR_GATT_UNSUBSCRIBE_FAILED); VerifyOrExit(!env->ExceptionCheck(), err = CHIP_JNI_ERROR_EXCEPTION_THROWN); exit: if (err != CHIP_NO_ERROR) { JniReferences::GetInstance().ReportError(env, err, __FUNCTION__); - rc = false; } env->ExceptionClear(); - return rc; + return err; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { chip::DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); intptr_t tmpConnObj; - bool rc = false; ChipLogProgress(DeviceLayer, "Received CloseConnection"); @@ -312,17 +311,17 @@ bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) env->ExceptionClear(); tmpConnObj = reinterpret_cast(conId); - rc = (bool) env->CallBooleanMethod(mBLEManagerObject.ObjectRef(), mOnCloseConnectionMethod, static_cast(tmpConnObj)); + VerifyOrExit(env->CallBooleanMethod(mBLEManagerObject.ObjectRef(), mOnCloseConnectionMethod, static_cast(tmpConnObj)), + err = CHIP_ERROR_INTERNAL); VerifyOrExit(!env->ExceptionCheck(), err = CHIP_JNI_ERROR_EXCEPTION_THROWN); exit: if (err != CHIP_NO_ERROR) { JniReferences::GetInstance().ReportError(env, err, __FUNCTION__); - rc = false; } env->ExceptionClear(); - return rc; + return err; } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -355,14 +354,14 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const return mtu; } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - chip::System::PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + chip::System::PacketBufferHandle pBuf) { - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - chip::System::PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId, chip::System::PacketBufferHandle pBuf) { chip::DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; @@ -371,7 +370,6 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::Ch jbyteArray charIdObj; jbyteArray characteristicDataObj; intptr_t tmpConnObj; - bool rc = false; ChipLogProgress(DeviceLayer, "Received SendWriteRequest"); VerifyOrExit(mBLEManagerObject.HasValidObjectRef(), err = CHIP_ERROR_INCORRECT_STATE); @@ -391,19 +389,19 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::Ch env->ExceptionClear(); tmpConnObj = reinterpret_cast(conId); - rc = (bool) env->CallBooleanMethod(mBLEManagerObject.ObjectRef(), mOnSendWriteRequestMethod, static_cast(tmpConnObj), - svcIdObj, charIdObj, characteristicDataObj); + VerifyOrExit(env->CallBooleanMethod(mBLEManagerObject.ObjectRef(), mOnSendWriteRequestMethod, static_cast(tmpConnObj), + svcIdObj, charIdObj, characteristicDataObj), + err = BLE_ERROR_GATT_WRITE_FAILED); VerifyOrExit(!env->ExceptionCheck(), err = CHIP_JNI_ERROR_EXCEPTION_THROWN); exit: if (err != CHIP_NO_ERROR) { JniReferences::GetInstance().ReportError(env, err, __FUNCTION__); - rc = false; } env->ExceptionClear(); - return rc; + return err; } // ===== end implement virtual methods on BlePlatformDelegate. diff --git a/src/platform/android/BLEManagerImpl.h b/src/platform/android/BLEManagerImpl.h index a782ee8d06bd16..0642571782c30c 100644 --- a/src/platform/android/BLEManagerImpl.h +++ b/src/platform/android/BLEManagerImpl.h @@ -72,16 +72,16 @@ class BLEManagerImpl final : public BLEManager, // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/android/BUILD.gn b/src/platform/android/BUILD.gn index a6e1fd6b524816..aa6f59ab5110e4 100644 --- a/src/platform/android/BUILD.gn +++ b/src/platform/android/BUILD.gn @@ -36,6 +36,19 @@ source_set("tracing") { ] } +static_library("logging") { + sources = [ "Logging.cpp" ] + deps = [ + "${chip_root}/src/lib/core:chip_config_header", + "${chip_root}/src/lib/support:attributes", + "${chip_root}/src/lib/support:logging_constants", + "${chip_root}/src/platform:platform_config_header", + "${chip_root}/src/platform/logging:headers", + ] + + libs = [ "log" ] +} + static_library("android") { output_name = "libAndroidPlatform" diff --git a/src/platform/logging/impl/android/Logging.cpp b/src/platform/android/Logging.cpp similarity index 100% rename from src/platform/logging/impl/android/Logging.cpp rename to src/platform/android/Logging.cpp diff --git a/src/platform/bouffalolab/common/BLEManagerImpl.cpp b/src/platform/bouffalolab/common/BLEManagerImpl.cpp index eaf64c2021bec1..7731828c314ca3 100644 --- a/src/platform/bouffalolab/common/BLEManagerImpl.cpp +++ b/src/platform/bouffalolab/common/BLEManagerImpl.cpp @@ -625,10 +625,10 @@ uint16_t BLEManagerImpl::_NumConnections(void) return mGAPConns; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { ChipLogProgress(DeviceLayer, "Closing BLE GATT connection (ConnId %02x)", bt_conn_index((bt_conn *) conId)); - return bt_conn_disconnect((bt_conn *) conId, BT_HCI_ERR_REMOTE_USER_TERM_CONN) == 0; + return MapErrorZephyr(bt_conn_disconnect((bt_conn *) conId, BT_HCI_ERR_REMOTE_USER_TERM_CONN)); } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -636,20 +636,22 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const return bt_gatt_get_mtu((bt_conn *) conId); } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogError(DeviceLayer, "%s: NOT IMPLEMENTED", __PRETTY_FUNCTION__); - return true; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogError(DeviceLayer, "%s: NOT IMPLEMENTED", __PRETTY_FUNCTION__); - return true; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { CHIP_ERROR err = CHIP_NO_ERROR; int status = 0; @@ -676,18 +678,17 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU exit: if (err != CHIP_NO_ERROR) { - ChipLogError(DeviceLayer, "BLEManagerImpl::SendIndication() failed: %." CHIP_ERROR_FORMAT, err.Format()); ChipLogError(DeviceLayer, "BLEManagerImpl::SendIndication() failed: %d", status); } - return err == CHIP_NO_ERROR; + return err; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { ChipLogError(DeviceLayer, "%s: NOT IMPLEMENTED", __PRETTY_FUNCTION__); - return true; + return CHIP_ERROR_NOT_IMPLEMENTED; } void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) diff --git a/src/platform/bouffalolab/common/BLEManagerImpl.h b/src/platform/bouffalolab/common/BLEManagerImpl.h index 630a726fe9ac4e..d5f3b56b66551a 100644 --- a/src/platform/bouffalolab/common/BLEManagerImpl.h +++ b/src/platform/bouffalolab/common/BLEManagerImpl.h @@ -60,14 +60,15 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId); - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId); - bool CloseConnection(BLE_CONNECTION_OBJECT conId); - uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf); - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf); + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; + uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/cc13xx_26xx/BLEManagerImpl.cpp b/src/platform/cc13xx_26xx/BLEManagerImpl.cpp index 7cc761f16d3b35..fc0a6af0beea94 100644 --- a/src/platform/cc13xx_26xx/BLEManagerImpl.cpp +++ b/src/platform/cc13xx_26xx/BLEManagerImpl.cpp @@ -260,12 +260,14 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) } // ===== Members that implement virtual methods on BlePlatformDelegate. -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { void * pMsg = (void *) ICall_malloc(sizeof(void *)); pMsg = (void *) conId; - return (EnqueueEvtHdrMsg(BLEManagerIMPL_CHIPOBLE_CLOSE_CONN_EVT, (void *) pMsg) == true); + EnqueueEvtHdrMsg(BLEManagerIMPL_CHIPOBLE_CLOSE_CONN_EVT, (void *) pMsg); + + return CHIP_NO_ERROR; } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -295,8 +297,8 @@ void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) // Unused } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle data) { BLEMGR_LOG("BLEMGR: BLE SendIndication "); @@ -308,14 +310,14 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU pMsg = (CHIPoBLEIndEvt_t *) ICall_malloc(sizeof(CHIPoBLEIndEvt_t)); if (NULL == pMsg) { - return false; + return CHIP_ERROR_NO_MEMORY; } pBuf = (uint8_t *) ICall_malloc(dataLen); if (NULL == pBuf) { ICall_free((void *) pMsg); - return false; + return CHIP_ERROR_NO_MEMORY; } memset(pBuf, 0x00, dataLen); @@ -327,29 +329,28 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU EnqueueEvtHdrMsg(BLEManagerIMPL_CHIPOBLE_TX_IND_EVT, (void *) pMsg); BLEMGR_LOG("BLEMGR: BLE SendIndication RETURN, Length: %d ", dataLen); - return true; + return CHIP_NO_ERROR; } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) { /* Unsupported on TI peripheral device implementation */ - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) { /* Unsupported on TI peripheral device implementation */ - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { /* Unsupported on TI peripheral device implementation */ - BLEMGR_LOG("BLEMGR: BLE SendWriteRequest"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } // ===== Helper Members that implement the Low level BLE Stack behavior. diff --git a/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h b/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h index 510cea97df0e68..9af5b63f0b7219 100644 --- a/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h +++ b/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h @@ -220,17 +220,17 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/device.gni b/src/platform/device.gni index 332b4b3ee85716..87e2eb12e8d0d2 100644 --- a/src/platform/device.gni +++ b/src/platform/device.gni @@ -23,6 +23,9 @@ declare_args() { # Substitute fake platform when building with chip_device_platform=auto. chip_fake_platform = false + + # Include wifi-paf to commission the device or not + chip_device_config_enable_wifipaf = false } if (chip_device_platform == "auto") { diff --git a/src/platform/logging/BUILD.gn b/src/platform/logging/BUILD.gn index 632c4ee5353224..bc41c12da17e88 100644 --- a/src/platform/logging/BUILD.gn +++ b/src/platform/logging/BUILD.gn @@ -44,9 +44,10 @@ source_set("default") { deps += [ "${chip_root}/src/platform/ASR:logging" ] } else if (chip_device_platform == "webos") { deps += [ "${chip_root}/src/platform/webos:logging" ] - } else if (chip_device_platform == "zephyr" || - chip_device_platform == "nxp_zephyr") { + } else if (chip_device_platform == "zephyr") { deps += [ "${chip_root}/src/platform/Zephyr:logging" ] + } else if (chip_device_platform == "nxp_zephyr") { + deps += [ "${chip_root}/src/platform/nxp/zephyr:logging" ] } else if (chip_device_platform == "nrfconnect") { deps += [ "${chip_root}/src/platform/nrfconnect:logging" ] } else if (chip_device_platform == "telink") { @@ -78,7 +79,7 @@ source_set("default") { } else { assert( chip_device_platform == "fake" || chip_device_platform == "android" || - chip_device_platform == "external") + chip_device_platform == "external" || chip_device_platform == "none") } } } @@ -87,22 +88,6 @@ source_set("headers") { public = [ "LogV.h" ] } -if (current_os == "android") { - static_library("android") { - sources = [ "impl/android/Logging.cpp" ] - deps = [ - ":headers", - "${chip_root}/src/lib/core:chip_config_header", - "${chip_root}/src/lib/support:attributes", - "${chip_root}/src/lib/support:logging_constants", - "${chip_root}/src/platform:platform_config_header", - "${chip_root}/src/platform/logging:headers", - ] - - libs = [ "log" ] - } -} - # We need to reference the output file of ":stdio" at build time, # but get_target_outputs() does not work for binary targets. As a # workaround, define a reasonable path and make the target use it. diff --git a/src/platform/logging/impl/stdio/Logging.cpp b/src/platform/logging/impl/stdio/Logging.cpp index 26e050f0286f9f..d36fe2aae2dc64 100644 --- a/src/platform/logging/impl/stdio/Logging.cpp +++ b/src/platform/logging/impl/stdio/Logging.cpp @@ -59,6 +59,7 @@ void LogV(const char * module, uint8_t category, const char * msg, va_list v) printf("[%s] ", module); vprintf(msg, v); printf("\033[0m\n"); + fflush(stdout); #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) funlockfile(stdout); diff --git a/src/platform/mbed/BLEManagerImpl.cpp b/src/platform/mbed/BLEManagerImpl.cpp index 3a7b859b70510d..1bcd14fdbfabb5 100644 --- a/src/platform/mbed/BLEManagerImpl.cpp +++ b/src/platform/mbed/BLEManagerImpl.cpp @@ -943,26 +943,30 @@ void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) // no-op } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogError(DeviceLayer, "%s: NOT IMPLEMENTED", __PRETTY_FUNCTION__); - return true; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogError(DeviceLayer, "%s: NOT IMPLEMENTED", __PRETTY_FUNCTION__); - return true; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { ChipLogProgress(DeviceLayer, "Closing BLE GATT connection, connHandle=%d", conId); ble::Gap & gap = ble::BLE::Instance().gap(); ble_error_t mbed_err = gap.disconnect(conId, ble::local_disconnection_reason_t::USER_TERMINATION); - return mbed_err == BLE_ERROR_NONE; + VerifyOrReturnError(mbed_err == BLE_ERROR_NONE, CHIP_ERROR_INTERNAL); + + return CHIP_NO_ERROR; } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -970,8 +974,8 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const return sConnectionInfo.getMTU(conId); } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { ChipLogDetail(DeviceLayer, "BlePlatformDelegate %s", __FUNCTION__); @@ -996,10 +1000,8 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU } else { - // TODO handle error with chipConnection::SendMessage as described - // in the BlePlatformDelegate.h. ChipLogError(DeviceLayer, "Send indication failed, invalid charID."); - return false; + return BLE_ERROR_GATT_INDICATE_FAILED; } ChipLogDetail(DeviceLayer, @@ -1015,14 +1017,14 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU { ChipLogError(DeviceLayer, "Send indication failed, mbed-os error: %d", mbed_err); } - return err == CHIP_NO_ERROR; + return err; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { ChipLogError(DeviceLayer, "%s: NOT IMPLEMENTED", __PRETTY_FUNCTION__); - return true; + return CHIP_ERROR_NOT_IMPLEMENTED; } } // namespace Internal diff --git a/src/platform/mbed/BLEManagerImpl.h b/src/platform/mbed/BLEManagerImpl.h index bde5a314409b4e..6e5d19f5548135 100644 --- a/src/platform/mbed/BLEManagerImpl.h +++ b/src/platform/mbed/BLEManagerImpl.h @@ -65,14 +65,15 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId); - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId); - bool CloseConnection(BLE_CONNECTION_OBJECT conId); - uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf); - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf); + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; + uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/mt793x/BLEManagerImpl.cpp b/src/platform/mt793x/BLEManagerImpl.cpp index d74910e974caed..55bb0bfad17f36 100644 --- a/src/platform/mt793x/BLEManagerImpl.cpp +++ b/src/platform/mt793x/BLEManagerImpl.cpp @@ -288,19 +288,21 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) } } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::SubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::UnsubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { CHIP_ERROR err = CHIP_NO_ERROR; bt_hci_cmd_disconnect_t disconnect_para; @@ -319,7 +321,7 @@ bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) ChipLogError(DeviceLayer, "bt_gap_le_disconnect() failed: %s", ErrorStr(err)); } - return (err == CHIP_NO_ERROR); + return err; } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -332,8 +334,8 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const } #define INDICATION_BUFFER_LENGTH (300) -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle data) { uint8_t buf[INDICATION_BUFFER_LENGTH + 3] = { 0 }; bt_gattc_charc_value_notification_indication_t * req; @@ -362,13 +364,7 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU SuccessOrExit(err); exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "BLEManagerImpl::SendIndication() failed: %s", ErrorStr(err)); - return false; - } - - return true; + return err; } void BLEManagerImpl::HandleRXCharWrite(uint16_t handle, void * data, uint16_t size) @@ -447,11 +443,11 @@ void BLEManagerImpl::HandleTXCharCCCDWrite(uint16_t handle, void * data, uint16_ } } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::SendWriteRequest() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) diff --git a/src/platform/mt793x/BLEManagerImpl.h b/src/platform/mt793x/BLEManagerImpl.h index 00758be8a11852..283603a00a820d 100644 --- a/src/platform/mt793x/BLEManagerImpl.h +++ b/src/platform/mt793x/BLEManagerImpl.h @@ -64,16 +64,16 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h index 991c3689425ae7..d0d31252f99368 100644 --- a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h +++ b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h @@ -74,6 +74,11 @@ #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0 #endif +// nrfconnect platform does not support ethernet yet, but we need this config defined as we share the Zephyr platform +#ifndef CHIP_DEVICE_CONFIG_ENABLE_ETHERNET +#define CHIP_DEVICE_CONFIG_ENABLE_ETHERNET 0 +#endif // CHIP_DEVICE_CONFIG_ENABLE_ETHERNET + #ifdef CONFIG_BT #define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE CONFIG_BT #else diff --git a/src/platform/nrfconnect/CHIPPlatformConfig.h b/src/platform/nrfconnect/CHIPPlatformConfig.h index ee4609e05c5e5c..096bc3426c5fe3 100644 --- a/src/platform/nrfconnect/CHIPPlatformConfig.h +++ b/src/platform/nrfconnect/CHIPPlatformConfig.h @@ -141,3 +141,9 @@ #define CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC CONFIG_CHIP_ICD_CLIENTS_PER_FABRIC #endif // CONFIG_CHIP_ICD_CLIENTS_PER_FABRIC #endif // CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC + +#ifndef CHIP_CONFIG_ENABLE_BDX_LOG_TRANSFER +#ifdef CONFIG_CHIP_ENABLE_BDX_LOG_TRANSFER +#define CHIP_CONFIG_ENABLE_BDX_LOG_TRANSFER CONFIG_CHIP_ENABLE_BDX_LOG_TRANSFER +#endif // CONFIG_CHIP_ENABLE_BDX_LOG_TRANSFER +#endif // CHIP_CONFIG_ENABLE_BDX_LOG_TRANSFER diff --git a/src/platform/nrfconnect/ConnectivityManagerImpl.cpp b/src/platform/nrfconnect/ConnectivityManagerImpl.cpp index ecd185200c78f7..971c365561b2bc 100644 --- a/src/platform/nrfconnect/ConnectivityManagerImpl.cpp +++ b/src/platform/nrfconnect/ConnectivityManagerImpl.cpp @@ -24,6 +24,10 @@ #include #include +#ifndef CONFIG_ARCH_POSIX +#include +#endif + #include #if INET_CONFIG_ENABLE_TCP_ENDPOINT diff --git a/src/platform/nrfconnect/SystemPlatformConfig.h b/src/platform/nrfconnect/SystemPlatformConfig.h index fb544466dcdd75..de2f59cb7eac27 100644 --- a/src/platform/nrfconnect/SystemPlatformConfig.h +++ b/src/platform/nrfconnect/SystemPlatformConfig.h @@ -66,3 +66,6 @@ struct ChipDeviceEvent; #endif // CHIP_SYSTEM_CONFIG_PACKETBUFFER_CAPACITY_MAX // ========== Platform-specific Configuration Overrides ========= + +// Disable Zephyr Socket extensions module, as the Zephyr RTOS now implements recvmsg() +#define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_SOCKET_EXTENSIONS 0 diff --git a/src/platform/nrfconnect/wifi/WiFiManager.cpp b/src/platform/nrfconnect/wifi/WiFiManager.cpp index 11784f4475cfe0..6b1effd541be15 100644 --- a/src/platform/nrfconnect/wifi/WiFiManager.cpp +++ b/src/platform/nrfconnect/wifi/WiFiManager.cpp @@ -49,6 +49,21 @@ namespace DeviceLayer { namespace { +app::Clusters::NetworkCommissioning::WiFiBandEnum ConvertBandEnum(uint8_t band) +{ + switch (band) + { + case WIFI_FREQ_BAND_2_4_GHZ: + return app::Clusters::NetworkCommissioning::WiFiBandEnum::k2g4; + case WIFI_FREQ_BAND_5_GHZ: + return app::Clusters::NetworkCommissioning::WiFiBandEnum::k5g; + case WIFI_FREQ_BAND_6_GHZ: + return app::Clusters::NetworkCommissioning::WiFiBandEnum::k6g; + default: + return app::Clusters::NetworkCommissioning::WiFiBandEnum::kUnknownEnumValue; + } +} + NetworkCommissioning::WiFiScanResponse ToScanResponse(const wifi_scan_result * result) { NetworkCommissioning::WiFiScanResponse response = {}; @@ -61,9 +76,10 @@ NetworkCommissioning::WiFiScanResponse ToScanResponse(const wifi_scan_result * r // TODO: Distinguish WPA versions response.security.Set(result->security == WIFI_SECURITY_TYPE_PSK ? NetworkCommissioning::WiFiSecurity::kWpaPersonal : NetworkCommissioning::WiFiSecurity::kUnencrypted); - response.channel = result->channel; - response.rssi = result->rssi; - response.ssidLen = result->ssid_length; + response.channel = result->channel; + response.rssi = result->rssi; + response.ssidLen = result->ssid_length; + response.wiFiBand = ConvertBandEnum(result->band); memcpy(response.ssid, result->ssid, result->ssid_length); // TODO: MAC/BSSID is not filled by the Wi-Fi driver memcpy(response.bssid, result->mac, result->mac_length); @@ -300,8 +316,8 @@ CHIP_ERROR WiFiManager::GetNetworkStatistics(NetworkStatistics & stats) const stats.mPacketMulticastRxCount = data.multicast.rx; stats.mPacketMulticastTxCount = data.multicast.tx; - stats.mPacketUnicastRxCount = data.pkts.rx - data.multicast.rx - data.broadcast.rx; - stats.mPacketUnicastTxCount = data.pkts.tx - data.multicast.tx - data.broadcast.tx; + stats.mPacketUnicastRxCount = data.unicast.rx; + stats.mPacketUnicastTxCount = data.unicast.tx; stats.mBeaconsSuccessCount = data.sta_mgmt.beacons_rx; stats.mBeaconsLostCount = data.sta_mgmt.beacons_miss; diff --git a/src/platform/nxp/common/CHIPDeviceNXPPlatformDefaultConfig.h b/src/platform/nxp/common/CHIPDeviceNXPPlatformDefaultConfig.h index fba6a32fa26326..28e26038e6a3e2 100644 --- a/src/platform/nxp/common/CHIPDeviceNXPPlatformDefaultConfig.h +++ b/src/platform/nxp/common/CHIPDeviceNXPPlatformDefaultConfig.h @@ -106,3 +106,15 @@ #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY 1 #define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 #endif + +#ifndef CHIP_DEVICE_CONFIG_USE_ZEPHYR_BLE +#define CHIP_DEVICE_CONFIG_USE_ZEPHYR_BLE 1 +#endif // CHIP_DEVICE_CONFIG_USE_ZEPHYR_BLE + +#ifndef CHIP_DEVICE_CONFIG_PROCESS_BLE_IN_THREAD +#define CHIP_DEVICE_CONFIG_PROCESS_BLE_IN_THREAD 0 +#endif // CHIP_DEVICE_CONFIG_PROCESS_BLE_IN_THREAD + +#ifndef CHIP_DEVICE_CONFIG_INIT_OT_PLAT_ALARM +#define CHIP_DEVICE_CONFIG_INIT_OT_PLAT_ALARM 1 +#endif // CHIP_DEVICE_CONFIG_INIT_OT_PLAT_ALARM diff --git a/src/platform/nxp/common/CHIPDevicePlatformEvent.h b/src/platform/nxp/common/CHIPDevicePlatformEvent.h index e3167f5cc2240f..5c6a5c3c39ecf9 100644 --- a/src/platform/nxp/common/CHIPDevicePlatformEvent.h +++ b/src/platform/nxp/common/CHIPDevicePlatformEvent.h @@ -24,7 +24,7 @@ */ #pragma once -#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE && CHIP_DEVICE_CONFIG_USE_ZEPHYR_BLE #include #include #include @@ -69,11 +69,12 @@ enum InternalPlatformSpecificEventTypes kPlatformNxpWlanEvent, kPlatformNxpIpChangeEvent, kPlatformNxpStartWlanConnectEvent, + kPlatformNxpScanWiFiNetworkDoneEvent, }; } // namespace DeviceEventType -#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE && CHIP_DEVICE_CONFIG_USE_ZEPHYR_BLE struct BleConnEventType { bt_conn * BtConn; @@ -107,7 +108,7 @@ struct ChipDevicePlatformEvent final { union { -#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE && CHIP_DEVICE_CONFIG_USE_ZEPHYR_BLE BleConnEventType BleConnEvent; BleCCCWriteEventType BleCCCWriteEvent; BleC1WriteEventType BleC1WriteEvent; @@ -116,6 +117,7 @@ struct ChipDevicePlatformEvent final #if CHIP_DEVICE_CONFIG_ENABLE_WPA enum wlan_event_reason WlanEventReason; struct wlan_network * pNetworkDataEvent; + unsigned int ScanWiFiNetworkCount; #endif }; }; diff --git a/src/platform/nxp/common/CHIPNXPPlatformDefaultConfig.h b/src/platform/nxp/common/CHIPNXPPlatformDefaultConfig.h index 9282ffb5fe868e..0c263fc6ae3cfa 100644 --- a/src/platform/nxp/common/CHIPNXPPlatformDefaultConfig.h +++ b/src/platform/nxp/common/CHIPNXPPlatformDefaultConfig.h @@ -217,6 +217,34 @@ #define WDM_PUBLISHER_MAX_NOTIFIES_IN_FLIGHT 2 #endif // WDM_PUBLISHER_MAX_NOTIFIES_IN_FLIGHT +// ==================== ICD Configuration Overrides ==================== + +#ifndef NXP_ICD_ENABLED +#define NXP_ICD_ENABLED 0 +#endif // NXP_ICD_ENABLED + +#if NXP_ICD_ENABLED +#ifndef CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC +#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC NXP_IDLE_MODE_DURATION_SEC +#endif // CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC + +#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS +#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS NXP_ACTIVE_MODE_DURATION_MS +#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS + +#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS +#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS NXP_ACTIVE_MODE_THRESHOLD +#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS + +#ifndef CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC +#define CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC NXP_ICD_SUPPORTED_CLIENTS_PER_FABRIC +#endif // CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC + +#ifndef CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED +#define CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED 1 +#endif +#endif // NXP_ICD_ENABLED + // ==================== Other Configuration Overrides ==================== #ifndef CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS diff --git a/src/platform/nxp/common/ConfigurationManagerImpl.cpp b/src/platform/nxp/common/ConfigurationManagerImpl.cpp index e99f913369eda8..ad8f00eaf3a4cb 100644 --- a/src/platform/nxp/common/ConfigurationManagerImpl.cpp +++ b/src/platform/nxp/common/ConfigurationManagerImpl.cpp @@ -33,6 +33,10 @@ #include "fsl_device_registers.h" +#if CONFIG_BOOT_REASON_SDK_SUPPORT +#include "fsl_power.h" +#endif + #if CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA #include "FactoryDataProvider.h" #endif @@ -54,12 +58,61 @@ ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() return sInstance; } +#if CONFIG_BOOT_REASON_SDK_SUPPORT +CHIP_ERROR ConfigurationManagerImpl::DetermineBootReason(uint8_t rebootCause) +{ + /* + With current implementation kBrownOutReset couldn't be catched + */ + BootReasonType bootReason = BootReasonType::kUnspecified; + + if (rebootCause == 0) + { + bootReason = BootReasonType::kPowerOnReboot; + } + + else if (rebootCause == kPOWER_ResetCauseWdt) + { + /* Reboot can be due to hardware or software watchdog */ + bootReason = BootReasonType::kHardwareWatchdogReset; + } + else if (rebootCause == kPOWER_ResetCauseSysResetReq) + { + /* + kConfigKey_SoftwareUpdateCompleted not supported for now + if (NXPConfig::ConfigValueExists(NXPConfig::kConfigKey_SoftwareUpdateCompleted)) + { + bootReason = BootReasonType::kSoftwareUpdateCompleted; + } + else + { + bootReason = BootReasonType::kSoftwareReset; + } + */ + bootReason = BootReasonType::kSoftwareReset; + } + + return StoreBootReason(to_underlying(bootReason)); +} +#endif + +CHIP_ERROR ConfigurationManagerImpl::StoreSoftwareUpdateCompleted() +{ + /* Empty implementation*/ + return CHIP_NO_ERROR; +} + CHIP_ERROR ConfigurationManagerImpl::Init() { CHIP_ERROR err; uint32_t rebootCount = 0; bool failSafeArmed; +#if CONFIG_BOOT_REASON_SDK_SUPPORT + uint8_t rebootCause = POWER_GetResetCause(); + POWER_ClearResetCause(rebootCause); +#endif + // Initialize the generic implementation base class. err = Internal::GenericConfigurationManagerImpl::Init(); SuccessOrExit(err); @@ -84,12 +137,15 @@ CHIP_ERROR ConfigurationManagerImpl::Init() err = StoreTotalOperationalHours(0); SuccessOrExit(err); } - +#if CONFIG_BOOT_REASON_SDK_SUPPORT + SuccessOrExit(err = DetermineBootReason(rebootCause)); +#else if (!NXPConfig::ConfigValueExists(NXPConfig::kCounterKey_BootReason)) { err = StoreBootReason(to_underlying(BootReasonType::kUnspecified)); SuccessOrExit(err); } +#endif // TODO: Initialize the global GroupKeyStore object here diff --git a/src/platform/nxp/common/ConfigurationManagerImpl.h b/src/platform/nxp/common/ConfigurationManagerImpl.h index 062cc9dcac3901..e680942af6e6fe 100644 --- a/src/platform/nxp/common/ConfigurationManagerImpl.h +++ b/src/platform/nxp/common/ConfigurationManagerImpl.h @@ -39,6 +39,7 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana public: // This returns an instance of this class. static ConfigurationManagerImpl & GetDefaultInstance(); + CHIP_ERROR StoreSoftwareUpdateCompleted(); private: // ===== Members that implement the ConfigurationManager public interface. @@ -78,6 +79,9 @@ class ConfigurationManagerImpl final : public Internal::GenericConfigurationMana // ===== Private members reserved for use by this class only. static void DoFactoryReset(intptr_t arg); +#if CONFIG_BOOT_REASON_SDK_SUPPORT + CHIP_ERROR DetermineBootReason(uint8_t rebootCause); +#endif }; /** diff --git a/src/platform/nxp/common/ConnectivityManagerImpl.cpp b/src/platform/nxp/common/ConnectivityManagerImpl.cpp index 79abd4e9648dca..cbdb866ae71973 100644 --- a/src/platform/nxp/common/ConnectivityManagerImpl.cpp +++ b/src/platform/nxp/common/ConnectivityManagerImpl.cpp @@ -32,10 +32,12 @@ #include #endif +#if CHIP_SYSTEM_CONFIG_USE_LWIP #include #include #include #include +#endif #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE #include @@ -153,6 +155,11 @@ void ConnectivityManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) free(event->Platform.pNetworkDataEvent); } } + else if (event->Type == kPlatformNxpScanWiFiNetworkDoneEvent) + { + NetworkCommissioning::NXPWiFiDriver::GetInstance().ScanWiFINetworkDoneFromMatterTaskContext( + event->Platform.ScanWiFiNetworkCount); + } #endif } diff --git a/src/platform/nxp/common/DiagnosticDataProviderImpl.cpp b/src/platform/nxp/common/DiagnosticDataProviderImpl.cpp index 0dd9b52f6a0aba..93a73d2767b8d3 100644 --- a/src/platform/nxp/common/DiagnosticDataProviderImpl.cpp +++ b/src/platform/nxp/common/DiagnosticDataProviderImpl.cpp @@ -29,7 +29,10 @@ #include #include + +#if CHIP_SYSTEM_CONFIG_USE_LWIP #include +#endif #if CHIP_DEVICE_CONFIG_ENABLE_WPA extern "C" { diff --git a/src/platform/nxp/common/NetworkCommissioningDriver.h b/src/platform/nxp/common/NetworkCommissioningDriver.h index 33d7d5bc1ed3af..a9f5807018d631 100644 --- a/src/platform/nxp/common/NetworkCommissioningDriver.h +++ b/src/platform/nxp/common/NetworkCommissioningDriver.h @@ -92,7 +92,8 @@ class NXPWiFiDriver final : public WiFiDriver CHIP_ERROR ConnectWiFiNetwork(const char * ssid, uint8_t ssidLen, const char * key, uint8_t keyLen); void OnConnectWiFiNetwork(Status commissioningError, CharSpan debugText, int32_t connectStatus); - static int OnScanWiFiNetworkDone(unsigned int count); + int ScanWiFINetworkDoneFromMatterTaskContext(unsigned int count); + static int _OnScanWiFiNetworkDoneCallBack(unsigned int count); static NXPWiFiDriver & GetInstance() { static NXPWiFiDriver instance; diff --git a/src/platform/nxp/common/NetworkCommissioningWiFiDriver.cpp b/src/platform/nxp/common/NetworkCommissioningWiFiDriver.cpp index c201dad7a6661c..e1348f946c1865 100644 --- a/src/platform/nxp/common/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/nxp/common/NetworkCommissioningWiFiDriver.cpp @@ -270,7 +270,7 @@ CHIP_ERROR NXPWiFiDriver::StartScanWiFiNetworks(ByteSpan ssid) ChipLogProgress(DeviceLayer, "Scan for WiFi network(s) requested"); (void) memset(&wlan_scan_param, 0, sizeof(wlan_scan_params_v2_t)); - wlan_scan_param.cb = &NXPWiFiDriver::OnScanWiFiNetworkDone; + wlan_scan_param.cb = &NXPWiFiDriver::_OnScanWiFiNetworkDoneCallBack; if ((ssid.size() > 0) && (ssid.size() < MLAN_MAX_SSID_LENGTH)) { @@ -291,8 +291,23 @@ CHIP_ERROR NXPWiFiDriver::StartScanWiFiNetworks(ByteSpan ssid) return CHIP_NO_ERROR; } -// TODO should be modified to do it in the context of the Matter stack -int NXPWiFiDriver::OnScanWiFiNetworkDone(unsigned int count) +int NXPWiFiDriver::_OnScanWiFiNetworkDoneCallBack(unsigned int count) +{ + ChipDeviceEvent event; + event.Type = DeviceEventType::kPlatformNxpScanWiFiNetworkDoneEvent; + event.Platform.ScanWiFiNetworkCount = count; + CHIP_ERROR err = PlatformMgr().PostEvent(&event); + if (err != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "Failed to schedule work: %" CHIP_ERROR_FORMAT, err.Format()); + return WM_FAIL; + } + return WM_SUCCESS; +} + +// The processing of the scan callback should be done in the context of the Matter stack, as the scan callback will call Matter +// stack APIs +int NXPWiFiDriver::ScanWiFINetworkDoneFromMatterTaskContext(unsigned int count) { ChipLogProgress(DeviceLayer, "Scan for WiFi network(s) done, found: %u", count); diff --git a/src/platform/nxp/common/ThreadStackManagerImpl.cpp b/src/platform/nxp/common/ThreadStackManagerImpl.cpp index b15ad60f0e9578..5667eefc7650ed 100644 --- a/src/platform/nxp/common/ThreadStackManagerImpl.cpp +++ b/src/platform/nxp/common/ThreadStackManagerImpl.cpp @@ -20,8 +20,7 @@ /** * @file * Provides an implementation of the ThreadStackManager object for - * NXP platforms using the NXP SDK and the OpenThread - * stack. + * NXP platforms using the NXP SDK and the OpenThread stack. * */ @@ -32,7 +31,11 @@ #include #include +#if CHIP_SYSTEM_CONFIG_USE_LWIP #include +#else +#include +#endif #include @@ -59,21 +62,44 @@ CHIP_ERROR ThreadStackManagerImpl::_InitThreadStack(void) { CHIP_ERROR err = CHIP_NO_ERROR; +#if CHIP_DEVICE_CONFIG_INIT_OT_PLAT_ALARM /* Initialize the OpenThread Alarm module to make sure that if calling otInstance, * it can schedule events */ otPlatAlarmInit(); +#endif // Initialize the generic implementation base classes. err = GenericThreadStackManagerImpl_FreeRTOS::DoInit(); SuccessOrExit(err); +#if CHIP_SYSTEM_CONFIG_USE_LWIP err = GenericThreadStackManagerImpl_OpenThread_LwIP::DoInit(NULL); +#else + err = GenericThreadStackManagerImpl_OpenThread::DoInit(NULL); +#endif SuccessOrExit(err); exit: return err; } +#if CHIP_DEVICE_CONFIG_PROCESS_BLE_IN_THREAD +void ThreadStackManagerImpl::ProcessThreadActivity() +{ + /* reuse thread task for ble processing. + * by doing this, we avoid allocating a new stack for short-lived + * BLE processing (e.g.: only during Matter commissioning) + */ +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE + auto * bleManager = &chip::DeviceLayer::Internal::BLEMgrImpl(); + bleManager->DoBleProcessing(); +#endif + + otTaskletsProcess(OTInstance()); + otSysProcessDrivers(OTInstance()); +} +#endif + bool ThreadStackManagerImpl::IsInitialized() { return sInstance.mThreadStackLock != NULL; @@ -112,3 +138,8 @@ extern "C" void otPlatFree(void * aPtr) { return CHIPPlatformMemoryFree(aPtr); } + +extern "C" void * otPlatRealloc(void * p, size_t aSize) +{ + return CHIPPlatformMemoryRealloc(p, aSize); +} diff --git a/src/platform/nxp/common/ThreadStackManagerImpl.h b/src/platform/nxp/common/ThreadStackManagerImpl.h index 6f9fae80950670..83990db21569dc 100644 --- a/src/platform/nxp/common/ThreadStackManagerImpl.h +++ b/src/platform/nxp/common/ThreadStackManagerImpl.h @@ -28,7 +28,11 @@ #include #include #include +#if CHIP_SYSTEM_CONFIG_USE_LWIP #include +#else +#include +#endif extern "C" void otSysEventSignalPending(void); @@ -43,7 +47,11 @@ class ThreadStackManagerImpl; * using the NXP SDK and the OpenThread stack. */ class ThreadStackManagerImpl final : public ThreadStackManager, +#if CHIP_SYSTEM_CONFIG_USE_LWIP public Internal::GenericThreadStackManagerImpl_OpenThread_LwIP, +#else + public Internal::GenericThreadStackManagerImpl_OpenThread, +#endif public Internal::GenericThreadStackManagerImpl_FreeRTOS { // Allow the ThreadStackManager interface class to delegate method calls to @@ -53,8 +61,11 @@ class ThreadStackManagerImpl final : public ThreadStackManager, // Allow the generic implementation base classes to call helper methods on // this class. #ifndef DOXYGEN_SHOULD_SKIP_THIS - friend Internal::GenericThreadStackManagerImpl_OpenThread; +#if CHIP_SYSTEM_CONFIG_USE_LWIP friend Internal::GenericThreadStackManagerImpl_OpenThread_LwIP; +#else + friend Internal::GenericThreadStackManagerImpl_OpenThread; +#endif friend Internal::GenericThreadStackManagerImpl_FreeRTOS; #endif @@ -66,6 +77,11 @@ class ThreadStackManagerImpl final : public ThreadStackManager, public: // ===== Platform-specific members that may be accessed directly by the application. +#if CHIP_DEVICE_CONFIG_PROCESS_BLE_IN_THREAD + using ThreadStackManager::ProcessThreadActivity; + void ProcessThreadActivity(); +#endif + protected: // ===== Methods that implement the ThreadStackManager abstract interface. CHIP_ERROR _InitThreadStack(void); diff --git a/src/platform/nxp/common/ble_zephyr/BLEAdvertisingArbiter.cpp b/src/platform/nxp/common/ble_zephyr/BLEAdvertisingArbiter.cpp new file mode 100644 index 00000000000000..e977708fe4862a --- /dev/null +++ b/src/platform/nxp/common/ble_zephyr/BLEAdvertisingArbiter.cpp @@ -0,0 +1,138 @@ +/* + * + * Copyright (c) 2023-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 "BLEAdvertisingArbiter.h" + +#include +#include +#include + +namespace chip { +namespace DeviceLayer { +namespace BLEAdvertisingArbiter { +namespace { + +// List of advertising requests ordered by priority +sys_slist_t sRequests; + +// Cast an intrusive list node to the containing request object +const BLEAdvertisingArbiter::Request & ToRequest(const sys_snode_t * node) +{ + return *static_cast(node); +} + +// Notify application about stopped advertising if the callback has been provided +void NotifyAdvertisingStopped(const sys_snode_t * node) +{ + VerifyOrReturn(node); + + const Request & request = ToRequest(node); + + if (request.onStopped != nullptr) + { + request.onStopped(); + } +} + +// Restart advertising using the top-priority request +CHIP_ERROR RestartAdvertising() +{ + // Note: bt_le_adv_stop() returns success when the advertising was not started + ReturnErrorOnFailure(MapErrorZephyr(bt_le_adv_stop())); + ReturnErrorCodeIf(sys_slist_is_empty(&sRequests), CHIP_NO_ERROR); + + const Request & top = ToRequest(sys_slist_peek_head(&sRequests)); + const bt_le_adv_param params = BT_LE_ADV_PARAM_INIT(top.options, top.minInterval, top.maxInterval, nullptr); + const int result = bt_le_adv_start(¶ms, top.advertisingData.data(), top.advertisingData.size(), top.scanResponseData.data(), + top.scanResponseData.size()); + + if (top.onStarted != nullptr) + { + top.onStarted(result); + } + + return MapErrorZephyr(result); +} + +} // namespace + +CHIP_ERROR InsertRequest(Request & request) +{ + CancelRequest(request); + + sys_snode_t * prev = nullptr; + sys_snode_t * node = nullptr; + + // Find position of the request in the list that preserves ordering by priority + SYS_SLIST_FOR_EACH_NODE(&sRequests, node) + { + if (request.priority < ToRequest(node).priority) + { + break; + } + + prev = node; + } + + if (prev == nullptr) + { + NotifyAdvertisingStopped(sys_slist_peek_head(&sRequests)); + sys_slist_prepend(&sRequests, &request); + } + else + { + sys_slist_insert(&sRequests, prev, &request); + } + + // If the request is top-priority, restart the advertising + if (sys_slist_peek_head(&sRequests) == &request) + { + return RestartAdvertising(); + } + + return CHIP_NO_ERROR; +} + +void CancelRequest(Request & request) +{ + const bool isTopPriority = (sys_slist_peek_head(&sRequests) == &request); + VerifyOrReturn(sys_slist_find_and_remove(&sRequests, &request)); + + // If cancelled request was top-priority, restart the advertising. + if (isTopPriority) + { + RestartAdvertising(); + } +} + +} // namespace BLEAdvertisingArbiter + +/** + * This implements a mapping function for CHIP System Layer errors that allows mapping integers in the number space of the + * Zephyr OS user API stack errors into the POSIX range. + * + * @param[in] aError The native Zephyr API error to map. + * + * @return The mapped POSIX error. + */ +DLL_EXPORT CHIP_ERROR MapErrorZephyr(int aError) +{ + return chip::System::Internal::MapErrorPOSIX(-aError); +} + +} // namespace DeviceLayer +} // namespace chip diff --git a/src/platform/nxp/common/ble_zephyr/BLEAdvertisingArbiter.h b/src/platform/nxp/common/ble_zephyr/BLEAdvertisingArbiter.h new file mode 100644 index 00000000000000..9c00edbb8e746d --- /dev/null +++ b/src/platform/nxp/common/ble_zephyr/BLEAdvertisingArbiter.h @@ -0,0 +1,107 @@ +/* + * + * Copyright (c) 2023-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 + +#include +#include + +#include + +/** + * @file + * Bluetooth LE advertising arbiter. + * + * The purpose for this module is to coordinate BLE advertising between + * different application components. + * + * An application component that wants to advertise BLE services is expected to + * define a request with a desired priority, and pass it to the BLE advertising + * arbiter. If there are multiple components that request BLE advertising at the + * same time, the arbiter selects the one with the highest priority (represented + * by the lowest numeric value) and starts the BLE advertising using parameters + * defined in the winning request. + * + * The BLE arbiter does not take ownership of a submitted request, so the + * request object must be sustained until it is cancelled by the application. + */ + +namespace chip { +namespace DeviceLayer { +namespace BLEAdvertisingArbiter { + +using OnAdvertisingStarted = void (*)(int result); +using OnAdvertisingStopped = void (*)(); + +struct Request : public sys_snode_t +{ + uint8_t priority; ///< Advertising request priority. Lower value means higher priority + uint32_t options; ///< Advertising options: bitmask of BT_LE_ADV_OPT_XXX constants from Zephyr + uint16_t minInterval; ///< Minimum advertising interval in 0.625 ms units + uint16_t maxInterval; ///< Maximum advertising interval in 0.625 ms units + Span advertisingData; ///< Advertising data fields + Span scanResponseData; ///< Scan response data fields + OnAdvertisingStarted onStarted; ///< (Optional) Callback invoked when the request becomes top-priority. + OnAdvertisingStopped onStopped; ///< (Optional) Callback invoked when the request stops being top-priority. +}; + +/** + * @brief Request BLE advertising + * + * Add the request to the internal list of competing requests. If the request + * has higher priority than other requests in the list, restart the BLE + * advertising immediately using parameters defined in the new request. + * + * Inserting a request object that is already registered at the advertising + * arbiter automatically cancels the previous request. + * + * @note This method does not take ownership of the request object so the object + * must not get destroyed before it is cancelled. + * + * @param request Reference to advertising request that contains priority and + * other advertising parameters. + * @return error If the request is top-priority and failed to restart the + * advertising. + * @return success Otherwise. + */ +CHIP_ERROR InsertRequest(Request & request); + +/** + * @brief Cancel BLE advertising request + * + * Remove the request from the internal list of competing requests. If the + * request is the winning (top-priority) one at the time of calling this + * function, restart the BLE advertising using parameters defined in the 2nd + * top-priority request in the list, or stop the BLE advertising completely if + * this is the last request in the list. + * + * An attempt to cancel a request that has not been registered at the + * advertising arbiter is a no-op. That is, it returns immediately. + * + * @param request Reference to advertising request that contains priority and + * other advertising parameters. + */ +void CancelRequest(Request & request); + +} // namespace BLEAdvertisingArbiter + +extern CHIP_ERROR MapErrorZephyr(int code); + +} // namespace DeviceLayer +} // namespace chip diff --git a/src/platform/nxp/common/ble_zephyr/BLEManagerImpl.cpp b/src/platform/nxp/common/ble_zephyr/BLEManagerImpl.cpp new file mode 100644 index 00000000000000..0d1c4c0dcb8932 --- /dev/null +++ b/src/platform/nxp/common/ble_zephyr/BLEManagerImpl.cpp @@ -0,0 +1,833 @@ +/* + * + * Copyright (c) 2020-2022, 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. + */ + +/** + * @file + * Provides an implementation of the BLEManager singleton object + * for Zephyr platforms. + */ + +#include + +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE + +#include "BLEManagerImpl.h" + +#include +#include +#include +#include +#include +#include +#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING +#include +#endif + +#include +#include +#include +#include +#include +#include + +#include + +using namespace ::chip; +using namespace ::chip::Ble; +using namespace ::chip::System; + +namespace chip { +namespace DeviceLayer { +namespace Internal { + +namespace { + +constexpr uint32_t kAdvertisingOptions = BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME; +constexpr uint8_t kAdvertisingFlags = BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR; + +const bt_uuid_128 UUID128_CHIPoBLEChar_RX = + BT_UUID_INIT_128(0x11, 0x9D, 0x9F, 0x42, 0x9C, 0x4F, 0x9F, 0x95, 0x59, 0x45, 0x3D, 0x26, 0xF5, 0x2E, 0xEE, 0x18); +const bt_uuid_128 UUID128_CHIPoBLEChar_TX = + BT_UUID_INIT_128(0x12, 0x9D, 0x9F, 0x42, 0x9C, 0x4F, 0x9F, 0x95, 0x59, 0x45, 0x3D, 0x26, 0xF5, 0x2E, 0xEE, 0x18); +#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING +const bt_uuid_128 UUID128_CHIPoBLEChar_C3 = + BT_UUID_INIT_128(0x04, 0x8F, 0x21, 0x83, 0x8A, 0x74, 0x7D, 0xB8, 0xF2, 0x45, 0x72, 0x87, 0x38, 0x02, 0x63, 0x64); +#endif + +bt_uuid_16 UUID16_CHIPoBLEService = BT_UUID_INIT_16(0xFFF6); + +const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, + 0x9D, 0x11 } }; + +const ChipBleUUID chipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, + 0x9D, 0x12 } }; + +_bt_gatt_ccc CHIPoBLEChar_TX_CCC = BT_GATT_CCC_INITIALIZER(nullptr, BLEManagerImpl::HandleTXCCCWrite, nullptr); + +// clang-format off + +bt_gatt_attr sChipoBleAttributes[] = { + BT_GATT_PRIMARY_SERVICE(&UUID16_CHIPoBLEService.uuid), + BT_GATT_CHARACTERISTIC(&UUID128_CHIPoBLEChar_RX.uuid, + BT_GATT_CHRC_WRITE | BT_GATT_CHRC_WRITE_WITHOUT_RESP, + BT_GATT_PERM_READ | BT_GATT_PERM_WRITE, + nullptr, BLEManagerImpl::HandleRXWrite, nullptr), + BT_GATT_CHARACTERISTIC(&UUID128_CHIPoBLEChar_TX.uuid, + BT_GATT_CHRC_INDICATE, + BT_GATT_PERM_NONE, + nullptr, nullptr, nullptr), + BT_GATT_CCC_MANAGED(&CHIPoBLEChar_TX_CCC, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE), +#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING + BT_GATT_CHARACTERISTIC(&UUID128_CHIPoBLEChar_C3.uuid, + BT_GATT_CHRC_READ, + BT_GATT_PERM_READ, + BLEManagerImpl::HandleC3Read, nullptr, nullptr), +#endif +}; + +bt_gatt_service sChipoBleService = BT_GATT_SERVICE(sChipoBleAttributes); + +// clang-format on + +// Index of the CCC descriptor in the CHIPoBLE_Service array of attributes. +// This value should be adjusted accordingly if the service declaration changes. +constexpr int kCHIPoBLE_CCC_AttributeIndex = 3; + +CHIP_ERROR InitRandomStaticAddress() +{ + // Generate a random static address for the default identity. + // This must be done before bt_enable() as after that updating the default identity is not possible. + int error = 0; + bt_addr_le_t addr; + + // generating the address + addr.type = BT_ADDR_LE_RANDOM; + error = sys_csrand_get(addr.a.val, sizeof(addr.a.val)); + BT_ADDR_SET_STATIC(&addr.a); + + if (error) + { + ChipLogError(DeviceLayer, "Failed to create BLE address: %d", error); + return MapErrorZephyr(error); + } + + error = bt_id_create(&addr, nullptr); + + if (error < 0) + { + ChipLogError(DeviceLayer, "Failed to create BLE identity: %d", error); + return MapErrorZephyr(error); + } + + ChipLogProgress(DeviceLayer, "BLE address: %02X:%02X:%02X:%02X:%02X:%02X", addr.a.val[5], addr.a.val[4], addr.a.val[3], + addr.a.val[2], addr.a.val[1], addr.a.val[0]); + return CHIP_NO_ERROR; +} + +} // unnamed namespace + +BLEManagerImpl BLEManagerImpl::sInstance; + +CHIP_ERROR BLEManagerImpl::_Init() +{ + mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled; + mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART); + mFlags.Set(Flags::kFastAdvertisingEnabled, true); + mGAPConns = 0; + + memset(mSubscribedConns, 0, sizeof(mSubscribedConns)); + + ReturnErrorOnFailure(InitRandomStaticAddress()); + int err = bt_enable(NULL); + VerifyOrReturnError(err == 0, MapErrorZephyr(err)); + + memset(&mConnCallbacks, 0, sizeof(mConnCallbacks)); + mConnCallbacks.connected = HandleConnect; + mConnCallbacks.disconnected = HandleDisconnect; + + bt_conn_cb_register(&mConnCallbacks); + + // Initialize the CHIP BleLayer. + ReturnErrorOnFailure(BleLayer::Init(this, this, &DeviceLayer::SystemLayer())); + + PlatformMgr().ScheduleWork(DriveBLEState, 0); + + return CHIP_NO_ERROR; +} + +void BLEManagerImpl::DriveBLEState(intptr_t arg) +{ + BLEMgrImpl().DriveBLEState(); +} + +void BLEManagerImpl::DriveBLEState() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + // Perform any initialization actions that must occur after the CHIP task is running. + if (!mFlags.Has(Flags::kAsyncInitCompleted)) + { + mFlags.Set(Flags::kAsyncInitCompleted); + } + + // If the application has enabled CHIPoBLE and BLE advertising... + if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && + mFlags.Has(Flags::kAdvertisingEnabled) +#if CHIP_DEVICE_CONFIG_CHIPOBLE_SINGLE_CONNECTION + // and no connections are active... + && (NumConnections() == 0) +#endif + ) + { + // Start/re-start advertising if not already advertising, or if the + // advertising state needs to be refreshed. + if (!mFlags.Has(Flags::kAdvertising) || mFlags.Has(Flags::kAdvertisingRefreshNeeded)) + { + mFlags.Clear(Flags::kAdvertisingRefreshNeeded); + err = StartAdvertising(); + SuccessOrExit(err); + } + } + else + { + if (mFlags.Has(Flags::kAdvertising)) + { + err = StopAdvertising(); + SuccessOrExit(err); + } + + // If no connections are active unregister also CHIPoBLE GATT service + if (NumConnections() == 0 && mFlags.Has(Flags::kChipoBleGattServiceRegister)) + { + // Unregister CHIPoBLE service to not allow discovering it when pairing is disabled. + if (bt_gatt_service_unregister(&sChipoBleService) != 0) + { + ChipLogError(DeviceLayer, "Failed to unregister CHIPoBLE GATT service"); + } + else + { + mFlags.Clear(Flags::kChipoBleGattServiceRegister); + } + } + } + +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "Disabling CHIPoBLE service due to error: %" CHIP_ERROR_FORMAT, err.Format()); + mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Disabled; + } +} + +struct BLEManagerImpl::ServiceData +{ + uint8_t uuid[2]; + ChipBLEDeviceIdentificationInfo deviceIdInfo; +} __attribute__((packed)); + +inline CHIP_ERROR BLEManagerImpl::PrepareAdvertisingRequest() +{ + static ServiceData serviceData; + static std::array advertisingData; + static std::array scanResponseData; + static_assert(sizeof(serviceData) == 10, "Unexpected size of BLE advertising data!"); + + const char * name = bt_get_name(); + const uint8_t nameSize = static_cast(strlen(name)); + + Encoding::LittleEndian::Put16(serviceData.uuid, UUID16_CHIPoBLEService.val); + ReturnErrorOnFailure(ConfigurationMgr().GetBLEDeviceIdentificationInfo(serviceData.deviceIdInfo)); + + advertisingData[0] = BT_DATA(BT_DATA_FLAGS, &kAdvertisingFlags, sizeof(kAdvertisingFlags)); + advertisingData[1] = BT_DATA(BT_DATA_SVC_DATA16, &serviceData, sizeof(serviceData)); + scanResponseData[0] = BT_DATA(BT_DATA_NAME_COMPLETE, name, nameSize); + + mAdvertisingRequest.priority = CHIP_DEVICE_BLE_ADVERTISING_PRIORITY; + mAdvertisingRequest.options = kAdvertisingOptions; + mAdvertisingRequest.minInterval = mFlags.Has(Flags::kFastAdvertisingEnabled) + ? CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL_MIN + : CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL_MIN; + mAdvertisingRequest.maxInterval = mFlags.Has(Flags::kFastAdvertisingEnabled) + ? CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL_MAX + : CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL_MAX; + mAdvertisingRequest.advertisingData = Span(advertisingData); + mAdvertisingRequest.scanResponseData = nameSize ? Span(scanResponseData) : Span{}; + + mAdvertisingRequest.onStarted = [](int rc) { + if (rc == 0) + { + ChipLogProgress(DeviceLayer, "CHIPoBLE advertising started"); + } + else + { + ChipLogError(DeviceLayer, "Failed to start CHIPoBLE advertising: %d", rc); + } + }; + + return CHIP_NO_ERROR; +} + +CHIP_ERROR BLEManagerImpl::StartAdvertising() +{ + // Prepare advertising request + ReturnErrorOnFailure(PrepareAdvertisingRequest()); + + // Register dynamically CHIPoBLE GATT service + if (!mFlags.Has(Flags::kChipoBleGattServiceRegister)) + { + int err = bt_gatt_service_register(&sChipoBleService); + + if (err != 0) + ChipLogError(DeviceLayer, "Failed to register CHIPoBLE GATT service"); + + VerifyOrReturnError(err == 0, MapErrorZephyr(err)); + + mFlags.Set(Flags::kChipoBleGattServiceRegister); + } + + // Initialize C3 characteristic data +#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING + ReturnErrorOnFailure(PrepareC3CharData()); +#endif + + // Request advertising + ReturnErrorOnFailure(BLEAdvertisingArbiter::InsertRequest(mAdvertisingRequest)); + + // Transition to the Advertising state... + if (!mFlags.Has(Flags::kAdvertising)) + { + mFlags.Set(Flags::kAdvertising); + + // Post a CHIPoBLEAdvertisingChange(Started) event. + { + ChipDeviceEvent advChange; + advChange.Type = DeviceEventType::kCHIPoBLEAdvertisingChange; + advChange.CHIPoBLEAdvertisingChange.Result = kActivity_Started; + ReturnErrorOnFailure(PlatformMgr().PostEvent(&advChange)); + } + + if (mFlags.Has(Flags::kFastAdvertisingEnabled)) + { + // Start timer to change advertising interval. + DeviceLayer::SystemLayer().StartTimer( + System::Clock::Milliseconds32(CHIP_DEVICE_CONFIG_BLE_ADVERTISING_INTERVAL_CHANGE_TIME), + HandleBLEAdvertisementIntervalChange, this); + } + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR BLEManagerImpl::StopAdvertising() +{ + BLEAdvertisingArbiter::CancelRequest(mAdvertisingRequest); + + // Transition to the not Advertising state... + if (mFlags.Has(Flags::kAdvertising)) + { + mFlags.Clear(Flags::kAdvertising); + mFlags.Set(Flags::kFastAdvertisingEnabled, true); + + ChipLogProgress(DeviceLayer, "CHIPoBLE advertising stopped"); + + // Post a CHIPoBLEAdvertisingChange(Stopped) event. + { + ChipDeviceEvent advChange; + advChange.Type = DeviceEventType::kCHIPoBLEAdvertisingChange; + advChange.CHIPoBLEAdvertisingChange.Result = kActivity_Stopped; + ReturnErrorOnFailure(PlatformMgr().PostEvent(&advChange)); + } + + // Cancel timer event changing CHIPoBLE advertisement interval + DeviceLayer::SystemLayer().CancelTimer(HandleBLEAdvertisementIntervalChange, this); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR BLEManagerImpl::_SetAdvertisingEnabled(bool val) +{ + if (mFlags.Has(Flags::kAdvertisingEnabled) != val) + { + ChipLogDetail(DeviceLayer, "CHIPoBLE advertising set to %s", val ? "on" : "off"); + + mFlags.Set(Flags::kAdvertisingEnabled, val); + PlatformMgr().ScheduleWork(DriveBLEState, 0); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR BLEManagerImpl::_SetAdvertisingMode(BLEAdvertisingMode mode) +{ + switch (mode) + { + case BLEAdvertisingMode::kFastAdvertising: + mFlags.Set(Flags::kFastAdvertisingEnabled, true); + break; + case BLEAdvertisingMode::kSlowAdvertising: + mFlags.Set(Flags::kFastAdvertisingEnabled, false); + break; + default: + return CHIP_ERROR_INVALID_ARGUMENT; + } + mFlags.Set(Flags::kAdvertisingRefreshNeeded); + PlatformMgr().ScheduleWork(DriveBLEState, 0); + return CHIP_NO_ERROR; +} + +CHIP_ERROR BLEManagerImpl::_GetDeviceName(char * buf, size_t bufSize) +{ + Platform::CopyString(buf, bufSize, bt_get_name()); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR BLEManagerImpl::_SetDeviceName(const char * deviceName) +{ + ChipLogDetail(DeviceLayer, "Device name set to: %s", deviceName); + return MapErrorZephyr(bt_set_name(deviceName)); +} + +CHIP_ERROR BLEManagerImpl::HandleGAPConnect(const ChipDeviceEvent * event) +{ + const BleConnEventType * connEvent = &event->Platform.BleConnEvent; + + if (connEvent->HciResult == BT_HCI_ERR_SUCCESS) + { + ChipLogProgress(DeviceLayer, "BLE connection established (ConnId: 0x%02x)", bt_conn_index(connEvent->BtConn)); + mGAPConns++; + } + else + { + ChipLogError(DeviceLayer, "BLE connection failed (reason: 0x%02x)", connEvent->HciResult); + } + + ChipLogProgress(DeviceLayer, "Current number of connections: %u/%u", NumConnections(), CONFIG_BT_MAX_CONN); + + mFlags.Set(Flags::kAdvertisingRefreshNeeded); + PlatformMgr().ScheduleWork(DriveBLEState, 0); + + bt_conn_unref(connEvent->BtConn); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR BLEManagerImpl::HandleGAPDisconnect(const ChipDeviceEvent * event) +{ + const BleConnEventType * connEvent = &event->Platform.BleConnEvent; + + ChipLogProgress(DeviceLayer, "BLE GAP connection terminated (reason 0x%02x)", connEvent->HciResult); + + mGAPConns--; + + // If indications were enabled for this connection, record that they are now disabled and + // notify the BLE Layer of a disconnect. + if (UnsetSubscribed(connEvent->BtConn)) + { + CHIP_ERROR disconReason; + switch (connEvent->HciResult) + { + case BT_HCI_ERR_REMOTE_USER_TERM_CONN: + // Do not treat proper connection termination as an error and exit. + VerifyOrExit(!ConfigurationMgr().IsFullyProvisioned(), ); + disconReason = BLE_ERROR_REMOTE_DEVICE_DISCONNECTED; + break; + case BT_HCI_ERR_LOCALHOST_TERM_CONN: + disconReason = BLE_ERROR_APP_CLOSED_CONNECTION; + break; + default: + disconReason = BLE_ERROR_CHIPOBLE_PROTOCOL_ABORT; + break; + } + HandleConnectionError(connEvent->BtConn, disconReason); + } + +exit: + // Unref bt_conn before scheduling DriveBLEState. + bt_conn_unref(connEvent->BtConn); + + ChipLogProgress(DeviceLayer, "Current number of connections: %u/%u", NumConnections(), CONFIG_BT_MAX_CONN); + + ChipDeviceEvent disconnectEvent; + disconnectEvent.Type = DeviceEventType::kCHIPoBLEConnectionClosed; + ReturnErrorOnFailure(PlatformMgr().PostEvent(&disconnectEvent)); + + // Force a reconfiguration of advertising in case we switched to non-connectable mode when + // the BLE connection was established. + mFlags.Set(Flags::kAdvertisingRefreshNeeded); + PlatformMgr().ScheduleWork(DriveBLEState, 0); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR BLEManagerImpl::HandleTXCharCCCDWrite(const ChipDeviceEvent * event) +{ + const BleCCCWriteEventType * writeEvent = &event->Platform.BleCCCWriteEvent; + + ChipLogDetail(DeviceLayer, "ConnId: 0x%02x, New CCCD value: 0x%04x", bt_conn_index(writeEvent->BtConn), writeEvent->Value); + + // If the client has requested to enable indications and if it is not yet subscribed + if (writeEvent->Value == BT_GATT_CCC_INDICATE && SetSubscribed(writeEvent->BtConn)) + { + // Alert the BLE layer that CHIPoBLE "subscribe" has been received and increment the bt_conn reference counter. + HandleSubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + + ChipLogProgress(DeviceLayer, "CHIPoBLE connection established (ConnId: 0x%02x, GATT MTU: %u)", + bt_conn_index(writeEvent->BtConn), GetMTU(writeEvent->BtConn)); + + // Post a CHIPoBLEConnectionEstablished event to the DeviceLayer and the application. + { + ChipDeviceEvent conEstEvent; + conEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; + ReturnErrorOnFailure(PlatformMgr().PostEvent(&conEstEvent)); + } + } + else + { + if (UnsetSubscribed(writeEvent->BtConn)) + { + HandleUnsubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + } + } + + bt_conn_unref(writeEvent->BtConn); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR BLEManagerImpl::HandleRXCharWrite(const ChipDeviceEvent * event) +{ + const BleC1WriteEventType * c1WriteEvent = &event->Platform.BleC1WriteEvent; + + ChipLogDetail(DeviceLayer, "Write request received for CHIPoBLE RX characteristic (ConnId 0x%02x)", + bt_conn_index(c1WriteEvent->BtConn)); + + HandleWriteReceived(c1WriteEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + PacketBufferHandle::Adopt(c1WriteEvent->Data)); + bt_conn_unref(c1WriteEvent->BtConn); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR BLEManagerImpl::HandleTXCharComplete(const ChipDeviceEvent * event) +{ + const BleC2IndDoneEventType * c2IndDoneEvent = &event->Platform.BleC2IndDoneEvent; + + ChipLogDetail(DeviceLayer, "Indication for CHIPoBLE TX characteristic done (ConnId 0x%02x, result 0x%02x)", + bt_conn_index(c2IndDoneEvent->BtConn), c2IndDoneEvent->Result); + + // Signal the BLE Layer that the outstanding indication is complete. + HandleIndicationConfirmation(c2IndDoneEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + bt_conn_unref(c2IndDoneEvent->BtConn); + + return CHIP_NO_ERROR; +} + +#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING +CHIP_ERROR BLEManagerImpl::PrepareC3CharData() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + BitFlags additionalDataFields; + AdditionalDataPayloadGeneratorParams additionalDataPayloadParams; + +#if CHIP_ENABLE_ROTATING_DEVICE_ID && defined(CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID) + uint8_t rotatingDeviceIdUniqueId[ConfigurationManager::kRotatingDeviceIDUniqueIDLength] = {}; + MutableByteSpan rotatingDeviceIdUniqueIdSpan(rotatingDeviceIdUniqueId); + + err = DeviceLayer::GetDeviceInstanceInfoProvider()->GetRotatingDeviceIdUniqueId(rotatingDeviceIdUniqueIdSpan); + SuccessOrExit(err); + err = ConfigurationMgr().GetLifetimeCounter(additionalDataPayloadParams.rotatingDeviceIdLifetimeCounter); + SuccessOrExit(err); + additionalDataPayloadParams.rotatingDeviceIdUniqueId = rotatingDeviceIdUniqueIdSpan; + additionalDataFields.Set(AdditionalDataFields::RotatingDeviceId); +#endif /* CHIP_ENABLE_ROTATING_DEVICE_ID && defined(CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID) */ + + err = AdditionalDataPayloadGenerator().generateAdditionalDataPayload(additionalDataPayloadParams, c3CharDataBufferHandle, + additionalDataFields); + +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "Failed to generate TLV encoded Additional Data (%s)", __func__); + } + + return err; +} +#endif + +void BLEManagerImpl::HandleBLEAdvertisementIntervalChange(System::Layer * layer, void * param) +{ + BLEMgr().SetAdvertisingMode(BLEAdvertisingMode::kSlowAdvertising); + ChipLogProgress(DeviceLayer, "CHIPoBLE advertising mode changed to slow"); +} + +void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + switch (event->Type) + { + case DeviceEventType::kPlatformZephyrBleConnected: + err = HandleGAPConnect(event); + break; + + case DeviceEventType::kPlatformZephyrBleDisconnected: + err = HandleGAPDisconnect(event); + break; + + case DeviceEventType::kPlatformZephyrBleCCCWrite: + err = HandleTXCharCCCDWrite(event); + break; + + case DeviceEventType::kPlatformZephyrBleC1WriteEvent: + err = HandleRXCharWrite(event); + break; + + case DeviceEventType::kPlatformZephyrBleC2IndDoneEvent: + err = HandleTXCharComplete(event); + break; + + default: + break; + } + + if (err != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "Disabling CHIPoBLE service due to error: %" CHIP_ERROR_FORMAT, err.Format()); + mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Disabled; + PlatformMgr().ScheduleWork(DriveBLEState, 0); + } +} + +uint16_t BLEManagerImpl::_NumConnections(void) +{ + return mGAPConns; +} + +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +{ + ChipLogProgress(DeviceLayer, "Closing BLE GATT connection (ConnId %02x)", bt_conn_index(conId)); + int status = bt_conn_disconnect(conId, BT_HCI_ERR_REMOTE_USER_TERM_CONN); + return (status == 0) ? CHIP_NO_ERROR : MapErrorZephyr(status); +} + +uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const +{ + return bt_gatt_get_mtu(conId); +} + +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) +{ + ChipLogDetail(DeviceLayer, "BLE central not implemented"); + return CHIP_ERROR_NOT_IMPLEMENTED; +} + +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) +{ + ChipLogDetail(DeviceLayer, "BLE central not implemented"); + return CHIP_ERROR_NOT_IMPLEMENTED; +} + +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + int status = 0; + uint8_t index = bt_conn_index(conId); + bt_gatt_indicate_params * params = &mIndicateParams[index]; + + VerifyOrExit(IsSubscribed(conId) == true, err = CHIP_ERROR_INVALID_ARGUMENT); + + ChipLogDetail(DeviceLayer, "Sending indication for CHIPoBLE TX characteristic (ConnId %02x, len %u)", index, + pBuf->DataLength()); + + params->uuid = nullptr; + params->attr = &sChipoBleAttributes[kCHIPoBLE_CCC_AttributeIndex]; + params->func = HandleTXIndicated; + params->data = pBuf->Start(); + params->len = pBuf->DataLength(); + + status = bt_gatt_indicate(conId, params); + VerifyOrExit(status == 0, err = MapErrorZephyr(status)); + +exit: + return err; +} + +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) +{ + ChipLogDetail(DeviceLayer, "BLE central not implemented"); + return CHIP_ERROR_NOT_IMPLEMENTED; +} + +void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) +{ + CloseConnection(conId); +} + +bool BLEManagerImpl::IsSubscribed(bt_conn * conn) +{ + return mSubscribedConns[bt_conn_index(conn)]; +} + +bool BLEManagerImpl::SetSubscribed(bt_conn * conn) +{ + uint8_t index = bt_conn_index(conn); + bool isSubscribed = mSubscribedConns[index]; + mSubscribedConns[index] = true; + + // If we were not subscribed previously, increment the reference counter of the connection. + if (!isSubscribed) + { + bt_conn_ref(conn); + } + + return !isSubscribed; +} + +bool BLEManagerImpl::UnsetSubscribed(bt_conn * conn) +{ + uint8_t index = bt_conn_index(conn); + bool isSubscribed = mSubscribedConns[index]; + mSubscribedConns[index] = false; + + // If we were subscribed previously, decrement the reference counter of the connection. + if (isSubscribed) + { + bt_conn_unref(conn); + } + + return isSubscribed; +} + +ssize_t BLEManagerImpl::HandleRXWrite(struct bt_conn * conId, const struct bt_gatt_attr * attr, const void * buf, uint16_t len, + uint16_t offset, uint8_t flags) +{ + ChipDeviceEvent event; + PacketBufferHandle packetBuf = PacketBufferHandle::NewWithData(buf, len); + + if (!packetBuf.IsNull()) + { + // Arrange to post a CHIPoBLERXWriteEvent event to the CHIP queue. + event.Type = DeviceEventType::kPlatformZephyrBleC1WriteEvent; + event.Platform.BleC1WriteEvent.BtConn = bt_conn_ref(conId); + event.Platform.BleC1WriteEvent.Data = std::move(packetBuf).UnsafeRelease(); + } + + // If we failed to allocate a buffer, post a kPlatformZephyrBleOutOfBuffersEvent event. + else + { + event.Type = DeviceEventType::kPlatformZephyrBleOutOfBuffersEvent; + } + + PlatformMgr().PostEventOrDie(&event); + + return len; +} + +ssize_t BLEManagerImpl::HandleTXCCCWrite(struct bt_conn * conId, const struct bt_gatt_attr * attr, uint16_t value) +{ + ChipDeviceEvent event; + + if (value != BT_GATT_CCC_INDICATE && value != 0) + { + return BT_GATT_ERR(BT_ATT_ERR_VALUE_NOT_ALLOWED); + } + + event.Type = DeviceEventType::kPlatformZephyrBleCCCWrite; + event.Platform.BleCCCWriteEvent.BtConn = bt_conn_ref(conId); + event.Platform.BleCCCWriteEvent.Value = value; + + PlatformMgr().PostEventOrDie(&event); + + return sizeof(value); +} + +void BLEManagerImpl::HandleTXIndicated(struct bt_conn * conId, bt_gatt_indicate_params *, uint8_t err) +{ + ChipDeviceEvent event; + + event.Type = DeviceEventType::kPlatformZephyrBleC2IndDoneEvent; + event.Platform.BleC2IndDoneEvent.BtConn = bt_conn_ref(conId); + event.Platform.BleC2IndDoneEvent.Result = err; + + PlatformMgr().PostEventOrDie(&event); +} + +void BLEManagerImpl::HandleConnect(struct bt_conn * conId, uint8_t err) +{ + ChipDeviceEvent event; + + PlatformMgr().LockChipStack(); + + // Don't handle BLE connecting events when it is not related to CHIPoBLE + VerifyOrExit(sInstance.mFlags.Has(Flags::kChipoBleGattServiceRegister), ); + + event.Type = DeviceEventType::kPlatformZephyrBleConnected; + event.Platform.BleConnEvent.BtConn = bt_conn_ref(conId); + event.Platform.BleConnEvent.HciResult = err; + + PlatformMgr().PostEventOrDie(&event); + +exit: + PlatformMgr().UnlockChipStack(); +} + +void BLEManagerImpl::HandleDisconnect(struct bt_conn * conId, uint8_t reason) +{ + ChipDeviceEvent event; + + PlatformMgr().LockChipStack(); + + // Don't handle BLE disconnecting events when it is not related to CHIPoBLE + VerifyOrExit(sInstance.mFlags.Has(Flags::kChipoBleGattServiceRegister), ); + + event.Type = DeviceEventType::kPlatformZephyrBleDisconnected; + event.Platform.BleConnEvent.BtConn = bt_conn_ref(conId); + event.Platform.BleConnEvent.HciResult = reason; + + PlatformMgr().PostEventOrDie(&event); + +exit: + PlatformMgr().UnlockChipStack(); +} + +#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING +ssize_t BLEManagerImpl::HandleC3Read(struct bt_conn * conId, const struct bt_gatt_attr * attr, void * buf, uint16_t len, + uint16_t offset) +{ + ChipLogDetail(DeviceLayer, "Read request received for CHIPoBLE C3 (ConnId 0x%02x)", bt_conn_index(conId)); + + if (sInstance.c3CharDataBufferHandle.IsNull()) + { + return 0; + } + + return bt_gatt_attr_read(conId, attr, buf, len, offset, sInstance.c3CharDataBufferHandle->Start(), + sInstance.c3CharDataBufferHandle->DataLength()); +} +#endif + +} // namespace Internal +} // namespace DeviceLayer +} // namespace chip + +#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE diff --git a/src/platform/nxp/common/ble_zephyr/BLEManagerImpl.h b/src/platform/nxp/common/ble_zephyr/BLEManagerImpl.h index 411392aa3c6a8c..4ae142b65cb6c0 100644 --- a/src/platform/nxp/common/ble_zephyr/BLEManagerImpl.h +++ b/src/platform/nxp/common/ble_zephyr/BLEManagerImpl.h @@ -1,8 +1,6 @@ /* * - * Copyright (c) 2020-2021 Project CHIP Authors - * Copyright (c) 2020 Nest Labs, Inc. - * All rights reserved. + * Copyright (c) 2020-2021, 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. @@ -20,12 +18,177 @@ /** * @file * Provides an implementation of the BLEManager singleton object - * for the nxp platforms. + * for the NXP platforms. */ #pragma once +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE + +#include "BLEAdvertisingArbiter.h" + +#include +#include +#include + #include -#include #include #include + +namespace chip { +namespace DeviceLayer { +namespace Internal { + +using namespace chip::Ble; + +/** + * Concrete implementation of the BLEManager singleton object for the Zephyr platforms. + */ +class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePlatformDelegate, private BleApplicationDelegate +{ + // Allow the BLEManager interface class to delegate method calls to + // the implementation methods provided by this class. + friend BLEManager; + +private: + // ===== Members that implement the BLEManager internal interface. + + CHIP_ERROR _Init(void); + void _Shutdown() {} + bool _IsAdvertisingEnabled(void); + CHIP_ERROR _SetAdvertisingEnabled(bool val); + bool _IsAdvertising(void); + CHIP_ERROR _SetAdvertisingMode(BLEAdvertisingMode mode); + CHIP_ERROR _GetDeviceName(char * buf, size_t bufSize); + CHIP_ERROR _SetDeviceName(const char * deviceName); + uint16_t _NumConnections(void); + void _OnPlatformEvent(const ChipDeviceEvent * event); + BleLayer * _GetBleLayer(void); + + // ===== Members that implement virtual methods on BlePlatformDelegate. + + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; + uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) override; + + // ===== Members that implement virtual methods on BleApplicationDelegate. + + void NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId); + + // ===== Private members reserved for use by this class only. + + enum class Flags : uint8_t + { + kAsyncInitCompleted = 0x0001, /**< One-time asynchronous initialization actions have been performed. */ + kAdvertisingEnabled = 0x0002, /**< The application has enabled CHIPoBLE advertising. */ + kFastAdvertisingEnabled = 0x0004, /**< The application has enabled fast advertising. */ + kAdvertising = 0x0008, /**< The system is currently CHIPoBLE advertising. */ + kAdvertisingRefreshNeeded = + 0x0010, /**< The advertising state/configuration has changed, but the SoftDevice has yet to be updated. */ + kChipoBleGattServiceRegister = 0x0020, /**< The system has currently CHIPoBLE GATT service registered. */ + }; + + struct ServiceData; + + BitFlags mFlags; + uint16_t mGAPConns; + CHIPoBLEServiceMode mServiceMode; + bool mSubscribedConns[CONFIG_BT_MAX_CONN]; + bt_gatt_indicate_params mIndicateParams[CONFIG_BT_MAX_CONN]; + bt_conn_cb mConnCallbacks; + BLEAdvertisingArbiter::Request mAdvertisingRequest = {}; +#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING + PacketBufferHandle c3CharDataBufferHandle; +#endif + + void DriveBLEState(void); + CHIP_ERROR PrepareAdvertisingRequest(); + CHIP_ERROR StartAdvertising(void); + CHIP_ERROR StopAdvertising(void); + CHIP_ERROR HandleGAPConnect(const ChipDeviceEvent * event); + CHIP_ERROR HandleGAPDisconnect(const ChipDeviceEvent * event); + CHIP_ERROR HandleRXCharWrite(const ChipDeviceEvent * event); + CHIP_ERROR HandleTXCharCCCDWrite(const ChipDeviceEvent * event); + CHIP_ERROR HandleTXCharComplete(const ChipDeviceEvent * event); +#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING + CHIP_ERROR PrepareC3CharData(); +#endif + bool IsSubscribed(bt_conn * conn); + bool SetSubscribed(bt_conn * conn); + bool UnsetSubscribed(bt_conn * conn); + uint32_t GetAdvertisingInterval(); + + static void DriveBLEState(intptr_t arg); + + // Below callbacks run from the system workqueue context and have a limited stack capacity. + static void HandleTXIndicated(bt_conn * conn, bt_gatt_indicate_params * attr, uint8_t err); + static void HandleConnect(bt_conn * conn, uint8_t err); + static void HandleDisconnect(bt_conn * conn, uint8_t reason); + static void HandleBLEAdvertisementIntervalChange(System::Layer * layer, void * param); + + // ===== Members for internal use by the following friends. + + friend BLEManager & BLEMgr(void); + friend BLEManagerImpl & BLEMgrImpl(void); + + static BLEManagerImpl sInstance; + +public: + // Below callbacks are public in order to be visible from the global scope. + static ssize_t HandleRXWrite(bt_conn * conn, const bt_gatt_attr * attr, const void * buf, uint16_t len, uint16_t offset, + uint8_t flags); + static ssize_t HandleTXCCCWrite(bt_conn * conn, const bt_gatt_attr * attr, uint16_t value); + +#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING + static ssize_t HandleC3Read(struct bt_conn * conn, const struct bt_gatt_attr * attr, void * buf, uint16_t len, uint16_t offset); +#endif +}; + +/** + * Returns a reference to the public interface of the BLEManager singleton object. + * + * Internal components should use this to access features of the BLEManager object + * that are common to all platforms. + */ +inline BLEManager & BLEMgr(void) +{ + return BLEManagerImpl::sInstance; +} + +/** + * Returns the platform-specific implementation of the BLEManager singleton object. + * + * Internal components can use this to gain access to features of the BLEManager + * that are specific to the Zephyr platforms. + */ +inline BLEManagerImpl & BLEMgrImpl(void) +{ + return BLEManagerImpl::sInstance; +} + +inline BleLayer * BLEManagerImpl::_GetBleLayer() +{ + return this; +} + +inline bool BLEManagerImpl::_IsAdvertisingEnabled(void) +{ + return mFlags.Has(Flags::kAdvertisingEnabled); +} + +inline bool BLEManagerImpl::_IsAdvertising(void) +{ + return mFlags.Has(Flags::kAdvertising); +} + +} // namespace Internal +} // namespace DeviceLayer +} // namespace chip + +#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE diff --git a/src/platform/nxp/k32w/common/BLEManagerCommon.cpp b/src/platform/nxp/k32w/common/BLEManagerCommon.cpp index 59f745a0dd542e..d9dbde88f3a614 100644 --- a/src/platform/nxp/k32w/common/BLEManagerCommon.cpp +++ b/src/platform/nxp/k32w/common/BLEManagerCommon.cpp @@ -342,19 +342,21 @@ void BLEManagerCommon::_OnPlatformEvent(const ChipDeviceEvent * event) } } -bool BLEManagerCommon::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerCommon::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerCommon::SubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerCommon::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerCommon::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerCommon::UnsubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerCommon::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerCommon::CloseConnection(BLE_CONNECTION_OBJECT conId) { return blekw_stop_connection_internal(conId); } @@ -367,11 +369,11 @@ uint16_t BLEManagerCommon::GetMTU(BLE_CONNECTION_OBJECT conId) const return tempMtu; } -bool BLEManagerCommon::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerCommon::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { ChipLogProgress(DeviceLayer, "BLEManagerCommon::SendWriteRequest() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } void BLEManagerCommon::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) @@ -379,34 +381,26 @@ void BLEManagerCommon::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) BLEMgrImpl().CloseConnection(conId); } -bool BLEManagerCommon::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) +CHIP_ERROR BLEManagerCommon::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle data) { + VerifyOrReturnError(UUIDsMatch(&Ble::CHIP_BLE_CHAR_2_UUID, charId), BLE_ERROR_GATT_WRITE_FAILED); + CHIP_ERROR err = CHIP_NO_ERROR; - uint16_t cId = (UUIDsMatch(&Ble::CHIP_BLE_CHAR_2_UUID, charId) ? value_chipoble_tx : 0); - ChipDeviceEvent event; - if (cId != 0) + if (blekw_send_event(conId, value_chipoble_tx, data->Start(), data->DataLength()) != BLE_OK) { - if (blekw_send_event(conId, cId, data->Start(), data->DataLength()) != BLE_OK) - { - err = CHIP_ERROR_SENDING_BLOCKED; - } - else - { - event.Type = DeviceEventType::kCHIPoBLEIndicateConfirm; - event.CHIPoBLEIndicateConfirm.ConId = conId; - err = PlatformMgr().PostEvent(&event); - } - - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "BLEManagerCommon::SendIndication() failed: %s", ErrorStr(err)); - return false; - } - return true; + err = CHIP_ERROR_SENDING_BLOCKED; + } + else + { + ChipDeviceEvent event; + event.Type = DeviceEventType::kCHIPoBLEIndicateConfirm; + event.CHIPoBLEIndicateConfirm.ConId = conId; + err = PlatformMgr().PostEvent(&event); } - return false; + + return err; } BLEManagerCommon::ble_err_t BLEManagerCommon::blekw_send_event(int8_t connection_handle, uint16_t handle, uint8_t * data, @@ -1415,14 +1409,14 @@ void BLEManagerCommon::StartBleAdvTimeoutTimer(uint32_t aTimeoutInMs) } } -bool BLEManagerCommon::blekw_stop_connection_internal(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerCommon::blekw_stop_connection_internal(BLE_CONNECTION_OBJECT conId) { ChipLogProgress(DeviceLayer, "Closing BLE GATT connection (con %u)", conId); if (Gap_Disconnect(conId) != gBleSuccess_c) { ChipLogProgress(DeviceLayer, "Gap_Disconnect() failed."); - return false; + return CHIP_ERROR_INTERNAL; } #if defined(chip_with_low_power) && (chip_with_low_power == 1) else @@ -1432,7 +1426,7 @@ bool BLEManagerCommon::blekw_stop_connection_internal(BLE_CONNECTION_OBJECT conI } #endif - return true; + return CHIP_NO_ERROR; } } // namespace Internal diff --git a/src/platform/nxp/k32w/common/BLEManagerCommon.h b/src/platform/nxp/k32w/common/BLEManagerCommon.h index 3f70f080764168..b7fc1275d2501f 100644 --- a/src/platform/nxp/k32w/common/BLEManagerCommon.h +++ b/src/platform/nxp/k32w/common/BLEManagerCommon.h @@ -82,16 +82,16 @@ class BLEManagerCommon : public BLEManager, protected BleLayer, private BlePlatf // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. @@ -224,7 +224,7 @@ class BLEManagerCommon : public BLEManager, protected BleLayer, private BlePlatf static void blekw_gap_connection_cb(deviceId_t deviceId, gapConnectionEvent_t * pConnectionEvent); static void blekw_start_connection_timeout(void); static void blekw_stop_connection_timeout(void); - static bool blekw_stop_connection_internal(BLE_CONNECTION_OBJECT conId); + static CHIP_ERROR blekw_stop_connection_internal(BLE_CONNECTION_OBJECT conId); public: virtual CHIP_ERROR InitHostController(BLECallbackDelegate::GapGenericCallback cb_fp) = 0; diff --git a/src/platform/nxp/k32w/k32w0/args.gni b/src/platform/nxp/k32w/k32w0/args.gni index 404daaa3e916db..5f90c8248e207a 100644 --- a/src/platform/nxp/k32w/k32w0/args.gni +++ b/src/platform/nxp/k32w/k32w0/args.gni @@ -23,7 +23,8 @@ nxp_use_lwip = false nxp_use_mbedtls_port = false if (getenv("NXP_K32W0_SDK_ROOT") == "") { - k32w0_sdk_root = "${chip_root}/third_party/nxp/k32w0_sdk/repo/core" + k32w0_sdk_root = + "${nxp_sdk_matter_support_root}/github_sdk/k32w0_sdk/repo/core" } else { k32w0_sdk_root = getenv("NXP_K32W0_SDK_ROOT") } diff --git a/src/platform/nxp/rt/rw61x/BUILD.gn b/src/platform/nxp/rt/rw61x/BUILD.gn index 0e3558b8bf916a..7337f896c8ddcc 100644 --- a/src/platform/nxp/rt/rw61x/BUILD.gn +++ b/src/platform/nxp/rt/rw61x/BUILD.gn @@ -83,20 +83,20 @@ static_library("nxp_platform") { sources += [ "../../common/NXPConfigKS.cpp" ] } - public_deps = [ "${chip_root}/src/platform:platform_base" ] - - deps += [ "${chip_root}/src/platform/logging:headers" ] - if (chip_enable_ble) { sources += [ # Adding random file which defines the function sys_csrand_get which is called by BLEManagerImpl from Zephyr "${nxp_sdk_build_root}/${nxp_sdk_name}/sdk_hook/zephyr/random/random.cpp", - "../../../Zephyr/BLEAdvertisingArbiter.cpp", - "../../../Zephyr/BLEManagerImpl.cpp", + "../../common/ble_zephyr/BLEAdvertisingArbiter.cpp", + "../../common/ble_zephyr/BLEManagerImpl.cpp", "../../common/ble_zephyr/BLEManagerImpl.h", ] } + public_deps = [ "${chip_root}/src/platform:platform_base" ] + + deps += [ "${chip_root}/src/platform/logging:headers" ] + # define CHIP_PLAT_NVM_SUPPORT - See NXPConfig.cpp for definition if (rt_nvm_component == "nvm_fwk") { defines += [ "CHIP_PLAT_NVM_SUPPORT=1" ] diff --git a/src/platform/nxp/zephyr/BUILD.gn b/src/platform/nxp/zephyr/BUILD.gn index 291b84d3b03b29..91a746e1e4b41f 100644 --- a/src/platform/nxp/zephyr/BUILD.gn +++ b/src/platform/nxp/zephyr/BUILD.gn @@ -108,3 +108,11 @@ static_library("nxp_zephyr") { cflags = [ "-Wconversion" ] } + +source_set("logging") { + deps = [ + "${chip_root}/src/platform:platform_base", + "${chip_root}/src/platform/logging:headers", + ] + sources = [ "../../Zephyr/Logging.cpp" ] +} diff --git a/src/platform/qpg/BLEManagerImpl.cpp b/src/platform/qpg/BLEManagerImpl.cpp index 9d203b9b34f961..6de29e1f2412a8 100644 --- a/src/platform/qpg/BLEManagerImpl.cpp +++ b/src/platform/qpg/BLEManagerImpl.cpp @@ -250,19 +250,21 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) } } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::SubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::UnsubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { CHIP_ERROR err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; @@ -274,7 +276,7 @@ bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) ChipLogError(DeviceLayer, "qvCHIP_BleCloseConnection() failed: %s", ErrorStr(err)); } - return (err == CHIP_NO_ERROR); + return err; } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -289,8 +291,8 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const return retVal; } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle data) { CHIP_ERROR err = CHIP_NO_ERROR; bool isRxHandle; @@ -306,19 +308,14 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU qvCHIP_BleSendIndication(conId, cId, dataLen, data->Start()); exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "BLEManagerImpl::SendIndication() failed: %s", ErrorStr(err)); - return false; - } - return true; + return err; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::SendWriteRequest() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) diff --git a/src/platform/qpg/BLEManagerImpl.h b/src/platform/qpg/BLEManagerImpl.h index 9a9ad45a7a221e..b06593541d135f 100644 --- a/src/platform/qpg/BLEManagerImpl.h +++ b/src/platform/qpg/BLEManagerImpl.h @@ -61,14 +61,15 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/silabs/BLEManagerImpl.h b/src/platform/silabs/BLEManagerImpl.h index 69e5720387ef65..86d1b05a887869 100644 --- a/src/platform/silabs/BLEManagerImpl.h +++ b/src/platform/silabs/BLEManagerImpl.h @@ -109,16 +109,16 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/silabs/ConfigurationManagerImpl.cpp b/src/platform/silabs/ConfigurationManagerImpl.cpp index 9454367d3bf030..5a511038c799ed 100644 --- a/src/platform/silabs/ConfigurationManagerImpl.cpp +++ b/src/platform/silabs/ConfigurationManagerImpl.cpp @@ -260,6 +260,18 @@ void ConfigurationManagerImpl::RunConfigUnitTest(void) #endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST } +/// @brief Helper to erase Thread info from device +void ConfigurationManagerImpl::ClearThreadStack() +{ +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT + ThreadStackMgr().ClearAllSrpHostAndServices(); +#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT + ChipLogProgress(DeviceLayer, "Clearing Thread provision"); + ThreadStackMgr().ErasePersistentInfo(); +#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD +} + void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) { CHIP_ERROR err; @@ -272,13 +284,7 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) ChipLogError(DeviceLayer, "FactoryResetConfig() failed: %s", chip::ErrorStr(err)); } -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT - ThreadStackMgr().ClearAllSrpHostAndServices(); -#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT - ChipLogProgress(DeviceLayer, "Clearing Thread provision"); - ThreadStackMgr().ErasePersistentInfo(); -#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD + GetDefaultInstance().ClearThreadStack(); PersistedStorage::KeyValueStoreMgrImpl().ErasePartition(); diff --git a/src/platform/silabs/ConfigurationManagerImpl.h b/src/platform/silabs/ConfigurationManagerImpl.h index f34e37ed91bb52..262b68053a3214 100644 --- a/src/platform/silabs/ConfigurationManagerImpl.h +++ b/src/platform/silabs/ConfigurationManagerImpl.h @@ -46,6 +46,8 @@ class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImp CHIP_ERROR GetTotalOperationalHours(uint32_t & totalOperationalHours); CHIP_ERROR StoreTotalOperationalHours(uint32_t totalOperationalHours); + void ClearThreadStack(); + private: // ===== Members that implement the ConfigurationManager public interface. diff --git a/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp b/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp index 1eb7b01bfc83c9..574bde208a427c 100644 --- a/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp +++ b/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp @@ -357,14 +357,8 @@ void ConnectivityManagerImpl::DriveStationState() void ConnectivityManagerImpl::OnStationConnected() { - ChipDeviceEvent event; wfx_setup_ip6_link_local(SL_WFX_STA_INTERFACE); - NetworkCommissioning::SlWiFiDriver::GetInstance().OnConnectWiFiNetwork(); - // Alert other components of the new state. - event.Type = DeviceEventType::kWiFiConnectivityChange; - event.WiFiConnectivityChange.Result = kConnectivity_Established; - (void) PlatformMgr().PostEvent(&event); // Setting the rs911x in the power save mode #if (CHIP_CONFIG_ENABLE_ICD_SERVER && RS911X_WIFI) #if SLI_SI917 @@ -378,19 +372,22 @@ void ConnectivityManagerImpl::OnStationConnected() } #endif /* CHIP_CONFIG_ENABLE_ICD_SERVER && RS911X_WIFI */ UpdateInternetConnectivityState(); + // Alert other components of the new state. + ChipDeviceEvent event; + event.Type = DeviceEventType::kWiFiConnectivityChange; + event.WiFiConnectivityChange.Result = kConnectivity_Established; + (void) PlatformMgr().PostEvent(&event); } void ConnectivityManagerImpl::OnStationDisconnected() { // TODO: Invoke WARM to perform actions that occur when the WiFi station interface goes down. - + UpdateInternetConnectivityState(); // Alert other components of the new state. ChipDeviceEvent event; event.Type = DeviceEventType::kWiFiConnectivityChange; event.WiFiConnectivityChange.Result = kConnectivity_Lost; (void) PlatformMgr().PostEvent(&event); - - UpdateInternetConnectivityState(); } void ConnectivityManagerImpl::DriveStationState(::chip::System::Layer * aLayer, void * aAppState) @@ -440,8 +437,6 @@ void ConnectivityManagerImpl::UpdateInternetConnectivityState(void) event.InternetConnectivityChange.IPv6 = GetConnectivityChange(hadIPv6Conn, haveIPv6Conn); event.InternetConnectivityChange.ipAddress = addr; - (void) PlatformMgr().PostEvent(&event); - if (haveIPv4Conn != hadIPv4Conn) { ChipLogProgress(DeviceLayer, "%s Internet connectivity %s", "IPv4", (haveIPv4Conn) ? "ESTABLISHED" : "LOST"); @@ -451,6 +446,7 @@ void ConnectivityManagerImpl::UpdateInternetConnectivityState(void) { ChipLogProgress(DeviceLayer, "%s Internet connectivity %s", "IPv6", (haveIPv6Conn) ? "ESTABLISHED" : "LOST"); } + (void) PlatformMgr().PostEvent(&event); } } diff --git a/src/platform/silabs/KeyValueStoreManagerImpl.cpp b/src/platform/silabs/KeyValueStoreManagerImpl.cpp index 8f886dba84ba67..012c951aaaa729 100644 --- a/src/platform/silabs/KeyValueStoreManagerImpl.cpp +++ b/src/platform/silabs/KeyValueStoreManagerImpl.cpp @@ -164,15 +164,9 @@ void KeyValueStoreManagerImpl::ScheduleKeyMapSave(void) During commissioning, the key map will be modified multiples times subsequently. Commit the key map in nvm once it as stabilized. */ -#if SLI_SI91X_MCU_INTERFACE && CHIP_CONFIG_ENABLE_ICD_SERVER - // TODO: Remove this when RTC timer is added MATTER-2705 - SilabsConfig::WriteConfigValueBin(SilabsConfig::kConfigKey_KvsStringKeyMap, reinterpret_cast(mKvsKeyMap), - sizeof(mKvsKeyMap)); -#else SystemLayer().StartTimer( std::chrono::duration_cast(System::Clock::Seconds32(SILABS_KVS_SAVE_DELAY_SECONDS)), KeyValueStoreManagerImpl::OnScheduledKeyMapSave, NULL); -#endif // defined(SLI_SI91X_MCU_INTERFACE) && CHIP_CONFIG_ENABLE_ICD_SERVER } CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t value_size, size_t * read_bytes_size, diff --git a/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp b/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp index f798054932e692..614a121280eaef 100644 --- a/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp @@ -325,19 +325,14 @@ void SlWiFiDriver::ScanNetworks(ByteSpan ssid, WiFiDriver::ScanCallback * callba CHIP_ERROR GetConnectedNetwork(Network & network) { wfx_wifi_provision_t wifiConfig; - - if (!wfx_is_sta_connected() || !wfx_get_wifi_provision(&wifiConfig)) - { - return CHIP_ERROR_INCORRECT_STATE; - } - - uint8_t length = strnlen(wifiConfig.ssid, DeviceLayer::Internal::kMaxWiFiSSIDLength); - if (length > sizeof(network.networkID)) - { - ChipLogError(DeviceLayer, "SSID too long"); - return CHIP_ERROR_INTERNAL; - } - + network.networkIDLen = 0; + network.connected = false; + // we are able to fetch the wifi provision data and STA should be connected + VerifyOrReturnError(wfx_get_wifi_provision(&wifiConfig), CHIP_ERROR_UNINITIALIZED); + VerifyOrReturnError(wfx_is_sta_connected(), CHIP_ERROR_NOT_CONNECTED); + network.connected = true; + uint8_t length = strnlen(wifiConfig.ssid, DeviceLayer::Internal::kMaxWiFiSSIDLength); + VerifyOrReturnError(length < sizeof(network.networkID), CHIP_ERROR_BUFFER_TOO_SMALL); memcpy(network.networkID, wifiConfig.ssid, length); network.networkIDLen = length; diff --git a/src/platform/silabs/NetworkCommissioningWiFiDriver.h b/src/platform/silabs/NetworkCommissioningWiFiDriver.h index 55148e3700091d..f152edb343cbf2 100644 --- a/src/platform/silabs/NetworkCommissioningWiFiDriver.h +++ b/src/platform/silabs/NetworkCommissioningWiFiDriver.h @@ -30,6 +30,8 @@ inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; } // namespace +CHIP_ERROR GetConnectedNetwork(Network & network); + template class SlScanResponseIterator : public Iterator { diff --git a/src/platform/silabs/PlatformManagerImpl.cpp b/src/platform/silabs/PlatformManagerImpl.cpp index 741a0b6b8676e1..14dd4f78f2487e 100644 --- a/src/platform/silabs/PlatformManagerImpl.cpp +++ b/src/platform/silabs/PlatformManagerImpl.cpp @@ -47,13 +47,13 @@ namespace DeviceLayer { PlatformManagerImpl PlatformManagerImpl::sInstance; #if defined(SL_MBEDTLS_USE_TINYCRYPT) -sys_mutex_t PlatformManagerImpl::rngMutexHandle = NULL; +osMutexId_t PlatformManagerImpl::rngMutexHandle = nullptr; int PlatformManagerImpl::uECC_RNG_Function(uint8_t * dest, unsigned int size) { - sys_mutex_lock(&rngMutexHandle); + osMutexAcquire(rngMutexHandle, osWaitForever); int res = (chip::Crypto::DRBG_get_bytes(dest, size) == CHIP_NO_ERROR) ? size : 0; - sys_mutex_unlock(&rngMutexHandle); + osMutexRelease(rngMutexHandle); return res; } @@ -97,7 +97,8 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) ReturnErrorOnFailure(chip::Crypto::add_entropy_source(app_entropy_source, NULL, 16)); #endif // !SLI_SI91X_MCU_INTERFACE /* Set RNG function for tinycrypt operations. */ - VerifyOrExit(sys_mutex_new(&rngMutexHandle) == ERR_OK, err = CHIP_ERROR_NO_MEMORY); + rngMutexHandle = osMutexNew(nullptr); + VerifyOrExit((&rngMutexHandle != nullptr), err = CHIP_ERROR_NO_MEMORY); uECC_set_rng(PlatformManagerImpl::uECC_RNG_Function); #endif // SL_MBEDTLS_USE_TINYCRYPT diff --git a/src/platform/silabs/PlatformManagerImpl.h b/src/platform/silabs/PlatformManagerImpl.h index b44fbadbfa3308..25813afb4839f9 100644 --- a/src/platform/silabs/PlatformManagerImpl.h +++ b/src/platform/silabs/PlatformManagerImpl.h @@ -28,6 +28,7 @@ #if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION #include "wfx_host_events.h" #endif +#include namespace chip { namespace DeviceLayer { @@ -45,7 +46,7 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener // Since the RNG callback will be called from multiple threads, // use this mutex to lock/unlock the call to Matter RNG API, which // uses some global variables. - static sys_mutex_t rngMutexHandle; + static osMutexId_t rngMutexHandle; // Callback used by tinycrypt to generate random numbers. // It must be set before calling any sign operations, diff --git a/src/platform/silabs/SiWx917/wifi/wfx_host_events.h b/src/platform/silabs/SiWx917/wifi/wfx_host_events.h index e3f923894c24e6..beee667f58f261 100644 --- a/src/platform/silabs/SiWx917/wifi/wfx_host_events.h +++ b/src/platform/silabs/SiWx917/wifi/wfx_host_events.h @@ -23,7 +23,6 @@ #include "wfx_msgs.h" /* LwIP includes. */ -#include "lwip/apps/httpd.h" #include "lwip/ip_addr.h" #include "lwip/netif.h" #include "lwip/netifapi.h" @@ -41,7 +40,10 @@ #define SL_WFX_CONNECT_IND_ID (2) #define SL_WFX_DISCONNECT_IND_ID (3) #define SL_WFX_SCAN_COMPLETE_ID (4) -#define WFX_RSI_SSID_SIZE (64) +// MAX SSID LENGTH excluding NULL character +#define WFX_MAX_SSID_LENGTH (32) +// MAX PASSKEY LENGTH including NULL character +#define WFX_MAX_PASSKEY_LENGTH (SL_WIFI_MAX_PSK_LENGTH) /* Wi-Fi bitmask events - for the task */ #define SL_WFX_CONNECT (1 << 1) @@ -55,6 +57,7 @@ #define WLAN_TASK_STACK_SIZE (1024) #define WLAN_TASK_PRIORITY (3) #define WLAN_DRIVER_TASK_PRIORITY (2) +#define BLE_DRIVER_TASK_PRIORITY (2) #define MAX_JOIN_RETRIES_COUNT (5) // WLAN retry time intervals in milli seconds @@ -66,7 +69,7 @@ // WLAN related Macros #define ETH_FRAME (0) #define CMP_SUCCESS (0) -#define BSSID_MAX_STR_LEN (6) +#define BSSID_LEN (6) #define MAC_ADDRESS_FIRST_OCTET (6) #define AP_START_SUCCESS (0) #define BITS_TO_WAIT (0) @@ -159,8 +162,8 @@ typedef enum typedef struct { - char ssid[32 + 1]; - char passkey[64 + 1]; + char ssid[WFX_MAX_SSID_LENGTH + 1]; + char passkey[WFX_MAX_PASSKEY_LENGTH + 1]; wfx_sec_t security; } wfx_wifi_provision_t; @@ -175,9 +178,9 @@ typedef enum typedef struct wfx_wifi_scan_result { - char ssid[32 + 1]; + char ssid[WFX_MAX_SSID_LENGTH + 1]; wfx_sec_t security; - uint8_t bssid[6]; + uint8_t bssid[BSSID_LEN]; uint8_t chan; int16_t rssi; /* I suspect this is in dBm - so signed */ } wfx_wifi_scan_result_t; diff --git a/src/platform/silabs/ThreadStackManagerImpl.h b/src/platform/silabs/ThreadStackManagerImpl.h index c56990fb0d3712..411c8eeb0676e1 100644 --- a/src/platform/silabs/ThreadStackManagerImpl.h +++ b/src/platform/silabs/ThreadStackManagerImpl.h @@ -25,12 +25,17 @@ #pragma once -#include #include #include #include +#include "cmsis_os2.h" + +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT +static constexpr uint32_t threadSrpClearAllFlags = 0x0001U; +#endif + extern "C" void otSysEventSignalPending(void); namespace chip { @@ -47,8 +52,7 @@ extern int GetEntropy_EFR32(uint8_t * buf, size_t bufSize); * using the Silicon Labs SDK and the OpenThread stack. */ class ThreadStackManagerImpl final : public ThreadStackManager, - public Internal::GenericThreadStackManagerImpl_OpenThread, - public Internal::GenericThreadStackManagerImpl_FreeRTOS + public Internal::GenericThreadStackManagerImpl_OpenThread { // Allow the ThreadStackManager interface class to delegate method calls to // the implementation methods provided by this class. @@ -58,8 +62,6 @@ class ThreadStackManagerImpl final : public ThreadStackManager, // this class. #ifndef DOXYGEN_SHOULD_SKIP_THIS friend Internal::GenericThreadStackManagerImpl_OpenThread; - friend Internal::GenericThreadStackManagerImpl_OpenThread; - friend Internal::GenericThreadStackManagerImpl_FreeRTOS; #endif // Allow glue functions called by OpenThread to call helper methods on this @@ -72,11 +74,21 @@ class ThreadStackManagerImpl final : public ThreadStackManager, using ThreadStackManager::InitThreadStack; CHIP_ERROR InitThreadStack(otInstance * otInst); + void FactoryResetThreadStack(void); private: // ===== Methods that implement the ThreadStackManager abstract interface. CHIP_ERROR _InitThreadStack(void); + CHIP_ERROR _StartThreadTask(void); + void _LockThreadStack(void); + bool _TryLockThreadStack(void); + void _UnlockThreadStack(void); + +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT + void _WaitOnSrpClearAllComplete(); + void _NotifySrpClearAllComplete(); +#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT // ===== Members for internal use by the following friends. friend ThreadStackManager & ::chip::DeviceLayer::ThreadStackMgr(void); @@ -90,6 +102,10 @@ class ThreadStackManagerImpl final : public ThreadStackManager, // ===== Private members for use by this class only. ThreadStackManagerImpl() = default; + +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT + osThreadId_t mSrpClearAllRequester = NULL; +#endif }; /** diff --git a/src/platform/silabs/efr32/BLEManagerImpl.cpp b/src/platform/silabs/efr32/BLEManagerImpl.cpp index 78bd13d061ef45..2fcceefa37b90a 100644 --- a/src/platform/silabs/efr32/BLEManagerImpl.cpp +++ b/src/platform/silabs/efr32/BLEManagerImpl.cpp @@ -279,19 +279,21 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) } } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::SubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::UnsubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { CHIP_ERROR err = CHIP_NO_ERROR; sl_status_t ret; @@ -306,7 +308,7 @@ bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) ChipLogError(DeviceLayer, "sl_bt_connection_close() failed: %s", ErrorStr(err)); } - return (err == CHIP_NO_ERROR); + return err; } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -315,8 +317,8 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const return (conState != NULL) ? conState->mtu : 0; } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle data) { CHIP_ERROR err = CHIP_NO_ERROR; CHIPoBLEConState * conState = GetConnectionState(conId); @@ -334,20 +336,14 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU err = MapBLEError(ret); exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "BLEManagerImpl::SendIndication() failed: %s", ErrorStr(err)); - return false; - } - - return true; + return err; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::SendWriteRequest() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) diff --git a/src/platform/silabs/efr32/ThreadStackManagerImpl.cpp b/src/platform/silabs/efr32/ThreadStackManagerImpl.cpp index 2cab401837e8d8..d2ae058a8a03f1 100644 --- a/src/platform/silabs/efr32/ThreadStackManagerImpl.cpp +++ b/src/platform/silabs/efr32/ThreadStackManagerImpl.cpp @@ -26,7 +26,8 @@ /* this file behaves like a config.h, comes first */ #include -#include +#include +#include #include #include #include @@ -35,11 +36,42 @@ #include -// Forward declaration -extern "C" otInstance * otGetInstance(void); +#include +#include + +extern "C" { +#include "platform-efr32.h" +otInstance * otGetInstance(void); +#if CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI +void otAppCliInit(otInstance * aInstance); +#endif // CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI +} namespace chip { namespace DeviceLayer { +namespace { +otInstance * sOTInstance = NULL; + +// Network commissioning +#ifndef _NO_GENERIC_THREAD_NETWORK_COMMISSIONING_DRIVER_ +NetworkCommissioning::GenericThreadDriver sGenericThreadDriver; +app::Clusters::NetworkCommissioning::Instance sThreadNetworkCommissioningInstance(0 /* Endpoint Id */, &sGenericThreadDriver); +#endif + +void initStaticNetworkCommissioningThreadDriver(void) +{ +#ifndef _NO_GENERIC_THREAD_NETWORK_COMMISSIONING_DRIVER_ + sThreadNetworkCommissioningInstance.Init(); +#endif +} + +void shutdownStaticNetworkCommissioningThreadDriver(void) +{ +#ifndef _NO_GENERIC_THREAD_NETWORK_COMMISSIONING_DRIVER_ + sThreadNetworkCommissioningInstance.Shutdown(); +#endif +} +}; // namespace using namespace ::chip::DeviceLayer::Internal; @@ -47,61 +79,81 @@ ThreadStackManagerImpl ThreadStackManagerImpl::sInstance; CHIP_ERROR ThreadStackManagerImpl::_InitThreadStack(void) { - return InitThreadStack(NULL); + return InitThreadStack(sOTInstance); } -CHIP_ERROR ThreadStackManagerImpl::InitThreadStack(otInstance * otInst) +CHIP_ERROR ThreadStackManagerImpl::_StartThreadTask(void) { - CHIP_ERROR err = CHIP_NO_ERROR; - - // Initialize the generic implementation base classes. - err = GenericThreadStackManagerImpl_FreeRTOS::DoInit(); - SuccessOrExit(err); - err = GenericThreadStackManagerImpl_OpenThread::DoInit(otInst); - SuccessOrExit(err); + // Stubbed since our thread task is created in the InitThreadStack function and it will start once the scheduler starts. + return CHIP_NO_ERROR; +} -exit: - return err; +void ThreadStackManagerImpl::_LockThreadStack(void) +{ + sl_ot_rtos_acquire_stack_mutex(); } -bool ThreadStackManagerImpl::IsInitialized() +bool ThreadStackManagerImpl::_TryLockThreadStack(void) { - return sInstance.mThreadStackLock != NULL; + // TODO: Implement a non-blocking version of the mutex lock + sl_ot_rtos_acquire_stack_mutex(); + return true; } -} // namespace DeviceLayer -} // namespace chip +void ThreadStackManagerImpl::_UnlockThreadStack(void) +{ + sl_ot_rtos_release_stack_mutex(); +} -using namespace ::chip::DeviceLayer; +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT +void ThreadStackManagerImpl::_WaitOnSrpClearAllComplete() +{ + // Only 1 task can be blocked on a srpClearAll request + if (mSrpClearAllRequester == NULL) + { + mSrpClearAllRequester = osThreadGetId(); + // Wait on OnSrpClientNotification which confirms the clearing is done. + // It will notify this current task with NotifySrpClearAllComplete. + // However, we won't wait more than 2s. + osThreadFlagsWait(threadSrpClearAllFlags, osFlagsWaitAny, pdMS_TO_TICKS(2000)); + mSrpClearAllRequester = NULL; + } +} -/** - * Glue function called directly by the OpenThread stack when tasklet processing work - * is pending. - */ -extern "C" void otTaskletsSignalPending(otInstance * p_instance) +void ThreadStackManagerImpl::_NotifySrpClearAllComplete() { - ThreadStackMgrImpl().SignalThreadActivityPending(); + if (mSrpClearAllRequester) + { + osThreadFlagsSet(mSrpClearAllRequester, threadSrpClearAllFlags); + } } +#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT -/** - * Glue function called directly by the OpenThread stack when system event processing work - * is pending. - */ -extern "C" void otSysEventSignalPending(void) +CHIP_ERROR ThreadStackManagerImpl::InitThreadStack(otInstance * otInst) { - BaseType_t yieldRequired = ThreadStackMgrImpl().SignalThreadActivityPendingFromISR(); - portYIELD_FROM_ISR(yieldRequired); + CHIP_ERROR err = CHIP_NO_ERROR; + err = GenericThreadStackManagerImpl_OpenThread::ConfigureThreadStack(otInst); + initStaticNetworkCommissioningThreadDriver(); + return err; } -extern "C" void * otPlatCAlloc(size_t aNum, size_t aSize) +void ThreadStackManagerImpl::FactoryResetThreadStack(void) { - return CHIPPlatformMemoryCalloc(aNum, aSize); + VerifyOrReturn(sOTInstance != NULL); + otInstanceFactoryReset(sOTInstance); + shutdownStaticNetworkCommissioningThreadDriver(); } -extern "C" void otPlatFree(void * aPtr) +bool ThreadStackManagerImpl::IsInitialized() { - CHIPPlatformMemoryFree(aPtr); + return otGetInstance() != NULL; } + +} // namespace DeviceLayer +} // namespace chip + +using namespace ::chip::DeviceLayer; + #ifndef SL_COMPONENT_CATALOG_PRESENT extern "C" __WEAK void sl_openthread_init(void) { @@ -137,7 +189,22 @@ extern "C" otError otPlatUartEnable(void) extern "C" otInstance * otGetInstance(void) { - return ThreadStackMgrImpl().OTInstance(); + return sOTInstance; +} + +extern "C" void sl_ot_create_instance(void) +{ + VerifyOrDie(chip::Platform::MemoryInit() == CHIP_NO_ERROR); + mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree); + sOTInstance = otInstanceInitSingle(); +} + +extern "C" void sl_ot_cli_init(void) +{ +#if !defined(PW_RPC_ENABLED) && CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI + VerifyOrDie(sOTInstance != NULL); + otAppCliInit(sOTInstance); +#endif } #if CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI diff --git a/src/platform/silabs/efr32/wifi/wfx_host_events.h b/src/platform/silabs/efr32/wifi/wfx_host_events.h index a7a2dc2ac34fa4..24e5b6ea707a7a 100644 --- a/src/platform/silabs/efr32/wifi/wfx_host_events.h +++ b/src/platform/silabs/efr32/wifi/wfx_host_events.h @@ -114,12 +114,9 @@ typedef struct __attribute__((__packed__)) sl_wfx_mib_req_s #define SL_WFX_CONNECT_IND_ID 2 #define SL_WFX_DISCONNECT_IND_ID 3 #define SL_WFX_SCAN_COMPLETE_ID 4 -#define WFX_RSI_SSID_SIZE 64 - #endif /* WF200 */ /* LwIP includes. */ -#include "lwip/apps/httpd.h" #include "lwip/ip_addr.h" #include "lwip/netif.h" #include "lwip/netifapi.h" @@ -141,14 +138,19 @@ typedef struct __attribute__((__packed__)) sl_wfx_mib_req_s #define WLAN_TASK_STACK_SIZE 1024 #define WLAN_TASK_PRIORITY 1 #define WLAN_DRIVER_TASK_PRIORITY 1 +#define BLE_DRIVER_TASK_PRIORITY 1 #define MAX_JOIN_RETRIES_COUNT 5 #else /* WF200 */ #define WLAN_TASK_STACK_SIZE 1024 #define WLAN_TASK_PRIORITY 1 -#define BLE_TASK_PRIORITY 1 #define MAX_JOIN_RETRIES_COUNT 5 -#endif +#endif // RS911X_WIFI + +// MAX SSID LENGTH excluding NULL character +#define WFX_MAX_SSID_LENGTH (32) +// MAX PASSKEY LENGTH including NULL character +#define WFX_MAX_PASSKEY_LENGTH (64) // WLAN retry time intervals in milli seconds #define WLAN_MAX_RETRY_TIMER_MS 30000 @@ -159,7 +161,7 @@ typedef struct __attribute__((__packed__)) sl_wfx_mib_req_s // WLAN related Macros #define ETH_FRAME 0 #define CMP_SUCCESS 0 -#define BSSID_MAX_STR_LEN 6 +#define BSSID_LEN (6) #define MAC_ADDRESS_FIRST_OCTET 6 #define AP_START_SUCCESS 0 #define BITS_TO_WAIT 0 @@ -254,8 +256,8 @@ typedef enum typedef struct { - char ssid[32 + 1]; - char passkey[64 + 1]; + char ssid[WFX_MAX_SSID_LENGTH + 1]; + char passkey[WFX_MAX_PASSKEY_LENGTH + 1]; wfx_sec_t security; } wfx_wifi_provision_t; @@ -270,9 +272,9 @@ typedef enum typedef struct wfx_wifi_scan_result { - char ssid[32 + 1]; + char ssid[WFX_MAX_SSID_LENGTH + 1]; wfx_sec_t security; - uint8_t bssid[6]; + uint8_t bssid[BSSID_LEN]; uint8_t chan; int16_t rssi; /* I suspect this is in dBm - so signed */ } wfx_wifi_scan_result_t; diff --git a/src/platform/silabs/platformAbstraction/GsdkSpam.cpp b/src/platform/silabs/platformAbstraction/GsdkSpam.cpp index 0881bea848112b..514003305868cf 100644 --- a/src/platform/silabs/platformAbstraction/GsdkSpam.cpp +++ b/src/platform/silabs/platformAbstraction/GsdkSpam.cpp @@ -79,10 +79,6 @@ CHIP_ERROR SilabsPlatform::Init(void) sl_iostream_set_default(sl_iostream_stdio_handle); #endif -#if CHIP_ENABLE_OPENTHREAD - sl_ot_sys_init(); -#endif - #ifdef SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT SEGGER_SYSVIEW_Conf(); #endif diff --git a/src/platform/silabs/rs911x/BLEManagerImpl.cpp b/src/platform/silabs/rs911x/BLEManagerImpl.cpp index 962c78fb9d3daa..17047186eaf7fd 100644 --- a/src/platform/silabs/rs911x/BLEManagerImpl.cpp +++ b/src/platform/silabs/rs911x/BLEManagerImpl.cpp @@ -253,8 +253,8 @@ CHIP_ERROR BLEManagerImpl::_Init() sl_rs_ble_init_sem = osSemaphoreNew(1, 0, NULL); sl_ble_event_sem = osSemaphoreNew(1, 0, NULL); - wfx_rsi.ble_task = xTaskCreateStatic((TaskFunction_t) sl_ble_event_handling_task, "rsi_ble", WFX_RSI_TASK_SZ, NULL, 1, - wfxBLETaskStack, &rsiBLETaskStruct); + wfx_rsi.ble_task = xTaskCreateStatic((TaskFunction_t) sl_ble_event_handling_task, "rsi_ble", WFX_RSI_TASK_SZ, NULL, + BLE_DRIVER_TASK_PRIORITY, wfxBLETaskStack, &rsiBLETaskStruct); if (wfx_rsi.ble_task == NULL) { @@ -419,7 +419,6 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEIndicateConfirm: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEIndicateConfirm"); - DeviceLayer::SystemLayer().CancelTimer(OnSendIndicationTimeout, this); HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; @@ -430,19 +429,21 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) } } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::SubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::UnsubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -453,7 +454,7 @@ bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) ChipLogError(DeviceLayer, "sl_bt_connection_close() failed: %s", ErrorStr(err)); } - return true; //(err == CHIP_NO_ERROR); + return err; } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -462,8 +463,8 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const return (conState != NULL) ? conState->mtu : 0; } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle data) { int32_t status = 0; status = rsi_ble_indicate_value(event_msg.resp_enh_conn.dev_addr, event_msg.rsi_ble_measurement_hndl, (data->DataLength()), @@ -472,20 +473,20 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU if (status != RSI_SUCCESS) { ChipLogProgress(DeviceLayer, "indication failed with error code %lx ", status); - return false; + return BLE_ERROR_GATT_INDICATE_FAILED; } // start timer for the indication Confirmation Event DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Milliseconds32(BLE_SEND_INDICATION_TIMER_PERIOD_MS), OnSendIndicationTimeout, this); - return true; + return CHIP_NO_ERROR; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::SendWriteRequest() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) @@ -924,6 +925,10 @@ void BLEManagerImpl::HandleRXCharWrite(rsi_ble_event_write_t * evt) void BLEManagerImpl::HandleTxConfirmationEvent(BLE_CONNECTION_OBJECT conId) { + DeviceLayer::PlatformMgr().LockChipStack(); + // stop the indication confirmation timer + DeviceLayer::SystemLayer().CancelTimer(OnSendIndicationTimeout, this); + DeviceLayer::PlatformMgr().UnlockChipStack(); ChipDeviceEvent event; event.Type = DeviceEventType::kCHIPoBLEIndicateConfirm; event.CHIPoBLEIndicateConfirm.ConId = conId; diff --git a/src/platform/stm32/BLEManagerImpl.cpp b/src/platform/stm32/BLEManagerImpl.cpp index ba7ea02c3c9a91..96fe0a864a729f 100644 --- a/src/platform/stm32/BLEManagerImpl.cpp +++ b/src/platform/stm32/BLEManagerImpl.cpp @@ -233,25 +233,27 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) } } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::SubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::UnsubscribeCharacteristic() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { CHIP_ERROR err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; ChipLogProgress(DeviceLayer, "Closing BLE GATT connection con %u", *(uint16_t *) conId); // aci_gap_terminate(gconnid, CONNECTION_CLOSE); - return (err == CHIP_NO_ERROR); + return err; } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -262,8 +264,8 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const return retVal; } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle data) { uint16_t dataLen = data->DataLength(); @@ -271,14 +273,14 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU APP_MATTER_Send_Notification(dataLen, data->Start()); - return true; + return CHIP_NO_ERROR; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { ChipLogProgress(DeviceLayer, "BLEManagerImpl::SendWriteRequest() not supported"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) diff --git a/src/platform/stm32/BLEManagerImpl.h b/src/platform/stm32/BLEManagerImpl.h index 7b60e811088fe6..0a75c555fad5ae 100644 --- a/src/platform/stm32/BLEManagerImpl.h +++ b/src/platform/stm32/BLEManagerImpl.h @@ -66,14 +66,15 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/telink/BLEManagerImpl.cpp b/src/platform/telink/BLEManagerImpl.cpp index 55125cc07ef0be..819d2614ce349d 100644 --- a/src/platform/telink/BLEManagerImpl.cpp +++ b/src/platform/telink/BLEManagerImpl.cpp @@ -694,10 +694,10 @@ uint16_t BLEManagerImpl::_NumConnections(void) return mGAPConns; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { ChipLogProgress(DeviceLayer, "Closing BLE GATT connection (ConnId %02x)", bt_conn_index(conId)); - return bt_conn_disconnect(conId, BT_HCI_ERR_REMOTE_USER_TERM_CONN) == 0; + return MapErrorZephyr(bt_conn_disconnect(conId, BT_HCI_ERR_REMOTE_USER_TERM_CONN)); } uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const @@ -705,20 +705,22 @@ uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const return bt_gatt_get_mtu(conId); } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogDetail(DeviceLayer, "BLE central not implemented"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogDetail(DeviceLayer, "BLE central not implemented"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { CHIP_ERROR err = CHIP_NO_ERROR; int status = 0; @@ -740,19 +742,14 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU VerifyOrExit(status == 0, err = MapErrorZephyr(status)); exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "BLEManagerImpl::SendIndication() failed: %" CHIP_ERROR_FORMAT, err.Format()); - } - - return err == CHIP_NO_ERROR; + return err; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) { ChipLogDetail(DeviceLayer, "BLE central not implemented"); - return false; + return CHIP_ERROR_NOT_IMPLEMENTED; } void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) diff --git a/src/platform/telink/BLEManagerImpl.h b/src/platform/telink/BLEManagerImpl.h index 38ef878cee7171..65b74fb144c144 100644 --- a/src/platform/telink/BLEManagerImpl.h +++ b/src/platform/telink/BLEManagerImpl.h @@ -67,14 +67,15 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, + PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. diff --git a/src/platform/telink/tlsr9528a_2m_flash.overlay b/src/platform/telink/tlsr9528a_2m_flash.overlay deleted file mode 120000 index 3b425c1198b983..00000000000000 --- a/src/platform/telink/tlsr9528a_2m_flash.overlay +++ /dev/null @@ -1 +0,0 @@ -tlsr9518adk80d_2m_flash.overlay \ No newline at end of file diff --git a/src/platform/telink/tlsr9528a_2m_flash.overlay b/src/platform/telink/tlsr9528a_2m_flash.overlay new file mode 100644 index 00000000000000..98bc72b459dd24 --- /dev/null +++ b/src/platform/telink/tlsr9528a_2m_flash.overlay @@ -0,0 +1,44 @@ +&flash { + reg = <0x20000000 0x200000>; + + partitions { + /delete-node/ partition@0; + /delete-node/ partition@20000; + /delete-node/ partition@88000; + /delete-node/ partition@f0000; + /delete-node/ partition@f4000; + /delete-node/ partition@fe000; + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x13000>; + }; + slot0_partition: partition@13000 { + label = "image-0"; + reg = <0x13000 0xec000>; + }; + factory_partition: partition@ff000 { + label = "factory-data"; + reg = <0xff000 0x1000>; + }; + dac_keypair_partition: partition@100000 { + label = "dac-keypair"; + reg = <0x100000 0x1000>; //store dac and key pair. + }; + descriptor_partition: partition@101000 { + label = "sboot-descriptor"; + reg = <0x101000 0x2000>; + }; + storage_partition: partition@103000 { + label = "storage"; + reg = <0x103000 0xf000>; + }; + slot1_partition: partition@112000 { + label = "image-1"; + reg = <0x112000 0xec000>; + }; + vendor_partition: partition@1fe000 { + label = "vendor-data"; + reg = <0x1fe000 0x2000>; + }; + }; +}; diff --git a/src/platform/telink/tlsr9528a_4m_flash.overlay b/src/platform/telink/tlsr9528a_4m_flash.overlay new file mode 100644 index 00000000000000..0005da2a590ab4 --- /dev/null +++ b/src/platform/telink/tlsr9528a_4m_flash.overlay @@ -0,0 +1,44 @@ +&flash { + reg = <0x20000000 0x400000>; + + partitions { + /delete-node/ partition@0; + /delete-node/ partition@20000; + /delete-node/ partition@88000; + /delete-node/ partition@f0000; + /delete-node/ partition@f4000; + /delete-node/ partition@fe000; + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x13000>; + }; + slot0_partition: partition@13000 { + label = "image-0"; + reg = <0x13000 0x1ec000>; + }; + factory_partition: partition@1ff000 { + label = "factory-data"; + reg = <0x1ff000 0x1000>; + }; + dac_keypair_partition: partition@200000 { + label = "dac-keypair"; + reg = <0x200000 0x1000>; //store dac and key pair. + }; + descriptor_partition: partition@201000 { + label = "sboot-descriptor"; + reg = <0x201000 0x2000>; + }; + storage_partition: partition@203000 { + label = "storage"; + reg = <0x203000 0xf000>; + }; + slot1_partition: partition@212000 { + label = "image-1"; + reg = <0x212000 0x1ec000>; + }; + vendor_partition: partition@3fe000 { + label = "vendor-data"; + reg = <0x3fe000 0x2000>; + }; + }; +}; diff --git a/src/platform/telink/wifi/WiFiManager.cpp b/src/platform/telink/wifi/WiFiManager.cpp index 50ea5cf5682089..dfbfcfec354227 100644 --- a/src/platform/telink/wifi/WiFiManager.cpp +++ b/src/platform/telink/wifi/WiFiManager.cpp @@ -31,6 +31,7 @@ #include #include #include +#include namespace chip { namespace DeviceLayer { @@ -399,21 +400,6 @@ void WiFiManager::ScanDoneHandler(Platform::UniquePtr data, size_t leng } } -void WiFiManager::SendRouterSolicitation(System::Layer * layer, void * param) -{ - net_if_start_rs(Instance().mNetIf); - Instance().mRouterSolicitationCounter++; - if (Instance().mRouterSolicitationCounter < kRouterSolicitationMaxCount) - { - DeviceLayer::SystemLayer().StartTimer(System::Clock::Milliseconds32(kRouterSolicitationIntervalMs), SendRouterSolicitation, - nullptr); - } - else - { - Instance().mRouterSolicitationCounter = 0; - } -} - void WiFiManager::ConnectHandler(Platform::UniquePtr data, size_t length) { // Validate that input data size matches the expected one. @@ -436,10 +422,8 @@ void WiFiManager::ConnectHandler(Platform::UniquePtr data, size_t lengt } else // The connection has been established successfully. { - // Workaround needed until sending Router Solicitation after connect will be done by the driver. - DeviceLayer::SystemLayer().StartTimer( - System::Clock::Milliseconds32(chip::Crypto::GetRandU16() % kMaxInitialRouterSolicitationDelayMs), - SendRouterSolicitation, nullptr); + // Now we can send/receive data via WiFi + net_if_up(InetUtils::GetWiFiInterface()); ChipLogProgress(DeviceLayer, "Connected to WiFi network"); Instance().mWiFiState = WIFI_STATE_COMPLETED; @@ -491,6 +475,9 @@ void WiFiManager::DisconnectHandler(Platform::UniquePtr data, size_t le void WiFiManager::IPv6AddressChangeHandler(const void * data) { const in6_addr * addr = reinterpret_cast(data); + char buf[INET6_ADDRSTRLEN]; + + ChipLogProgress(DeviceLayer, "IP6 address %s", inet_ntop(AF_INET6, addr, buf, INET6_ADDRSTRLEN)); // Filter out link-local addresses that are not routable outside of a local network. if (!net_ipv6_is_ll_addr(addr)) @@ -504,6 +491,10 @@ void WiFiManager::IPv6AddressChangeHandler(const void * data) { ChipLogError(DeviceLayer, "Cannot post event: %" CHIP_ERROR_FORMAT, error.Format()); } + else + { + ChipLogProgress(DeviceLayer, "kDnssdRestartNeeded"); + } } } diff --git a/src/platform/tests/BUILD.gn b/src/platform/tests/BUILD.gn index bf4c2ee6ff90f4..ba092e2f7ee5dd 100644 --- a/src/platform/tests/BUILD.gn +++ b/src/platform/tests/BUILD.gn @@ -38,6 +38,7 @@ if (chip_device_platform != "none" && chip_device_platform != "fake") { } public_deps = [ + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/support", "${chip_root}/src/lib/support:test_utils", "${chip_root}/src/platform", diff --git a/src/platform/tests/TestCHIPoBLEStackMgr.cpp b/src/platform/tests/TestCHIPoBLEStackMgr.cpp index 2ec392849c7eca..fb39b6b6462568 100644 --- a/src/platform/tests/TestCHIPoBLEStackMgr.cpp +++ b/src/platform/tests/TestCHIPoBLEStackMgr.cpp @@ -16,14 +16,14 @@ */ #include "platform/internal/CHIPDeviceLayerInternal.h" -#include -#include + +#include + +#include #include #include -#include - -#include "platform/PlatformManager.h" -#include "platform/internal/BLEManager.h" +#include +#include void EventHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t) { diff --git a/src/platform/tests/TestCHIPoBLEStackMgrDriver.cpp b/src/platform/tests/TestCHIPoBLEStackMgrDriver.cpp index 38e3f23a10b59c..7e56479513fbf7 100644 --- a/src/platform/tests/TestCHIPoBLEStackMgrDriver.cpp +++ b/src/platform/tests/TestCHIPoBLEStackMgrDriver.cpp @@ -15,10 +15,12 @@ * limitations under the License. */ -#include -#include #include +#include + +#include + int main(int argc, char * argv[]) { testing::InitGoogleTest(&argc, argv); diff --git a/src/platform/tests/TestConfigurationMgr.cpp b/src/platform/tests/TestConfigurationMgr.cpp index ad60d44583250f..d40c600c5d03f3 100644 --- a/src/platform/tests/TestConfigurationMgr.cpp +++ b/src/platform/tests/TestConfigurationMgr.cpp @@ -28,10 +28,11 @@ #include #include -#include +#include + +#include #include #include - #include #include #include diff --git a/src/platform/tests/TestConnectivityMgr.cpp b/src/platform/tests/TestConnectivityMgr.cpp index 0699f971dfc493..55a7e97f7c24f6 100644 --- a/src/platform/tests/TestConnectivityMgr.cpp +++ b/src/platform/tests/TestConnectivityMgr.cpp @@ -28,11 +28,11 @@ #include #include +#include + +#include #include #include - -#include - #include #include diff --git a/src/platform/tests/TestDnssd.cpp b/src/platform/tests/TestDnssd.cpp index 43a3d62d61dc9a..5aa7565274f657 100644 --- a/src/platform/tests/TestDnssd.cpp +++ b/src/platform/tests/TestDnssd.cpp @@ -17,12 +17,13 @@ #include -#include +#include #include "lib/dnssd/platform/Dnssd.h" #include "platform/CHIPDeviceLayer.h" #include "platform/ConnectivityManager.h" #include "platform/PlatformManager.h" +#include #include #include #include diff --git a/src/platform/tests/TestKeyValueStoreMgr.cpp b/src/platform/tests/TestKeyValueStoreMgr.cpp index 49ddcb99752492..0429182e0c40c8 100644 --- a/src/platform/tests/TestKeyValueStoreMgr.cpp +++ b/src/platform/tests/TestKeyValueStoreMgr.cpp @@ -22,10 +22,10 @@ * */ -#include +#include +#include #include - #include #include diff --git a/src/platform/tests/TestPlatformMgr.cpp b/src/platform/tests/TestPlatformMgr.cpp index 96c989aa7455b2..51ec10bf8766dc 100644 --- a/src/platform/tests/TestPlatformMgr.cpp +++ b/src/platform/tests/TestPlatformMgr.cpp @@ -30,7 +30,9 @@ #include -#include +#include + +#include #include #include #include diff --git a/src/platform/tests/TestPlatformTime.cpp b/src/platform/tests/TestPlatformTime.cpp index 54cf60202b4440..ad7a59052b21f4 100644 --- a/src/platform/tests/TestPlatformTime.cpp +++ b/src/platform/tests/TestPlatformTime.cpp @@ -28,7 +28,9 @@ #include #include -#include +#include + +#include #include #include #include diff --git a/src/platform/tests/TestThreadStackMgr.cpp b/src/platform/tests/TestThreadStackMgr.cpp index 143de88587ccd5..ee381280529250 100644 --- a/src/platform/tests/TestThreadStackMgr.cpp +++ b/src/platform/tests/TestThreadStackMgr.cpp @@ -18,7 +18,9 @@ #include #include -#include +#include + +#include #include #include diff --git a/src/platform/webos/BLEManagerImpl.cpp b/src/platform/webos/BLEManagerImpl.cpp index ad03cd9ed2fa4f..a7a273d89b9523 100644 --- a/src/platform/webos/BLEManagerImpl.cpp +++ b/src/platform/webos/BLEManagerImpl.cpp @@ -421,7 +421,7 @@ bool BLEManagerImpl::gattWriteDescriptorValueCb(LSHandle * sh, LSMessage * messa return true; } -bool BLEManagerImpl::SubscribeCharacteristicToWebOS(void * bleConnObj, const uint8_t * svcId, const uint8_t * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristicToWebOS(void * bleConnObj, const uint8_t * svcId, const uint8_t * charId) { pbnjson::JValue valueForMonitor = pbnjson::JObject(); @@ -438,7 +438,7 @@ bool BLEManagerImpl::SubscribeCharacteristicToWebOS(void * bleConnObj, const uin if (mLSHandle == nullptr) { ChipLogError(DeviceLayer, "LS handle is null"); - return false; + return CHIP_ERROR_INTERNAL; } ret = LSCall(mLSHandle, "luna://com.webos.service.bluetooth2/gatt/monitorCharacteristics", valueForMonitor.stringify().c_str(), @@ -477,36 +477,36 @@ bool BLEManagerImpl::SubscribeCharacteristicToWebOS(void * bleConnObj, const uin gattWriteDescriptorValueCb, bleConnObj, NULL, NULL); if (ret != 1) - return false; + return BLE_ERROR_GATT_SUBSCRIBE_FAILED; - return true; + return CHIP_NO_ERROR; } -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { - bool result = false; - result = SubscribeCharacteristicToWebOS(conId, static_cast(svcId->bytes), - static_cast(charId->bytes)); - return result; + return SubscribeCharacteristicToWebOS(conId, static_cast(svcId->bytes), + static_cast(charId->bytes)); } -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +CHIP_ERROR BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, + const ChipBleUUID * charId) { ChipLogError(Ble, "UnsubscribeCharacteristic: Not implemented"); - return true; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +CHIP_ERROR BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) { ChipLogError(Ble, "CloseConnection: Not implemented"); - return true; + return CHIP_ERROR_NOT_IMPLEMENTED; } -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - chip::System::PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + chip::System::PacketBufferHandle pBuf) { ChipLogError(Ble, "SendIndication: Not implemented"); - return true; + return CHIP_ERROR_NOT_IMPLEMENTED; } bool BLEManagerImpl::gattWriteValueCb(LSHandle * sh, LSMessage * message, void * userData) @@ -536,8 +536,8 @@ bool BLEManagerImpl::gattWriteValueCb(LSHandle * sh, LSMessage * message, void * return true; } -bool BLEManagerImpl::SendWriteRequestToWebOS(void * bleConnObj, const uint8_t * svcId, const uint8_t * charId, const uint8_t * pBuf, - uint32_t pBufDataLen) +CHIP_ERROR BLEManagerImpl::SendWriteRequestToWebOS(void * bleConnObj, const uint8_t * svcId, const uint8_t * charId, + const uint8_t * pBuf, uint32_t pBufDataLen) { BLEConnection * conn = (BLEConnection *) bleConnObj; std::ostringstream cvt; @@ -595,7 +595,7 @@ bool BLEManagerImpl::SendWriteRequestToWebOS(void * bleConnObj, const uint8_t * if (mLSHandle == nullptr) { ChipLogError(DeviceLayer, "LS handle is null"); - return false; + return CHIP_ERROR_INTERNAL; } ret = LSCall(mLSHandle, "luna://com.webos.service.bluetooth2/gatt/writeCharacteristicValue", param.stringify().c_str(), @@ -605,19 +605,16 @@ bool BLEManagerImpl::SendWriteRequestToWebOS(void * bleConnObj, const uint8_t * exit: if (ret != 1) - return false; + return BLE_ERROR_GATT_WRITE_FAILED; - return true; + return CHIP_NO_ERROR; } -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - chip::System::PacketBufferHandle pBuf) +CHIP_ERROR BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId, chip::System::PacketBufferHandle pBuf) { - bool result = false; - result = SendWriteRequestToWebOS(conId, static_cast(svcId->bytes), static_cast(charId->bytes), - pBuf->Start(), pBuf->DataLength()); - - return result; + return SendWriteRequestToWebOS(conId, static_cast(svcId->bytes), static_cast(charId->bytes), + pBuf->Start(), pBuf->DataLength()); } void BLEManagerImpl::AddConnectionData(const char * remoteAddr) diff --git a/src/platform/webos/BLEManagerImpl.h b/src/platform/webos/BLEManagerImpl.h index 238952cda03732..c18ab9b9686419 100644 --- a/src/platform/webos/BLEManagerImpl.h +++ b/src/platform/webos/BLEManagerImpl.h @@ -110,16 +110,16 @@ class BLEManagerImpl final : public BLEManager, // ===== Members that implement virtual methods on BlePlatformDelegate. - bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - bool CloseConnection(BLE_CONNECTION_OBJECT conId) override; + CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, + const Ble::ChipBleUUID * charId) override; + CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - bool SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; - bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; + CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + System::PacketBufferHandle pBuf) override; // ===== Members that implement virtual methods on BleApplicationDelegate. @@ -174,9 +174,9 @@ class BLEManagerImpl final : public BLEManager, bool isChipDevice; }; - bool SendWriteRequestToWebOS(void * bleConnObj, const uint8_t * svcId, const uint8_t * charId, const uint8_t * pBuf, - uint32_t pBufDataLen); - bool SubscribeCharacteristicToWebOS(void * bleConnObj, const uint8_t * svcId, const uint8_t * charId); + CHIP_ERROR SendWriteRequestToWebOS(void * bleConnObj, const uint8_t * svcId, const uint8_t * charId, const uint8_t * pBuf, + uint32_t pBufDataLen); + CHIP_ERROR SubscribeCharacteristicToWebOS(void * bleConnObj, const uint8_t * svcId, const uint8_t * charId); void InitConnectionData(void); void AddConnectionData(const char * remoteAddr); diff --git a/src/protocols/bdx/BdxTransferSession.cpp b/src/protocols/bdx/BdxTransferSession.cpp index f6c54985ab5cd1..99588f0770a72e 100644 --- a/src/protocols/bdx/BdxTransferSession.cpp +++ b/src/protocols/bdx/BdxTransferSession.cpp @@ -261,6 +261,17 @@ CHIP_ERROR TransferSession::AcceptTransfer(const TransferAcceptData & acceptData return CHIP_NO_ERROR; } +CHIP_ERROR TransferSession::RejectTransfer(StatusCode reason) +{ + VerifyOrReturnError(mState == TransferState::kNegotiateTransferParams, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mPendingOutput == OutputEventType::kNone, CHIP_ERROR_INCORRECT_STATE); + + PrepareStatusReport(reason); + mState = TransferState::kTransferDone; + + return CHIP_NO_ERROR; +} + CHIP_ERROR TransferSession::PrepareBlockQuery() { const MessageType msgType = MessageType::BlockQuery; diff --git a/src/protocols/bdx/tests/BUILD.gn b/src/protocols/bdx/tests/BUILD.gn index 055301b3432916..25c8f2b8462995 100644 --- a/src/protocols/bdx/tests/BUILD.gn +++ b/src/protocols/bdx/tests/BUILD.gn @@ -28,6 +28,7 @@ chip_test_suite("tests") { public_deps = [ "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/support", "${chip_root}/src/protocols/bdx", ] diff --git a/src/protocols/bdx/tests/TestBdxMessages.cpp b/src/protocols/bdx/tests/TestBdxMessages.cpp index 6475cbd89c14c2..2bed80ae8aecf4 100644 --- a/src/protocols/bdx/tests/TestBdxMessages.cpp +++ b/src/protocols/bdx/tests/TestBdxMessages.cpp @@ -1,12 +1,12 @@ -#include +#include -#include +#include +#include #include #include #include - -#include +#include using namespace chip; using namespace chip::bdx; diff --git a/src/protocols/bdx/tests/TestBdxTransferSession.cpp b/src/protocols/bdx/tests/TestBdxTransferSession.cpp index a3a76df6bddf67..9a383752551064 100644 --- a/src/protocols/bdx/tests/TestBdxTransferSession.cpp +++ b/src/protocols/bdx/tests/TestBdxTransferSession.cpp @@ -1,15 +1,15 @@ -#include -#include -#include - #include -#include +#include +#include #include #include #include #include +#include +#include +#include #include #include #include @@ -124,6 +124,13 @@ void VerifyNoMoreOutput(TransferSession & transferSession) EXPECT_EQ(event.EventType, TransferSession::OutputEventType::kNone); } +void VerifyInternalError(TransferSession & transferSession) +{ + TransferSession::OutputEvent event; + transferSession.PollOutput(event, kNoAdvanceTime); + EXPECT_EQ(event.EventType, TransferSession::OutputEventType::kInternalError); +} + // Helper method for initializing two TransferSession objects, generating a TransferInit message, and passing it to a responding // TransferSession. void SendAndVerifyTransferInit(TransferSession::OutputEvent & outEvent, System::Clock::Timeout timeout, TransferSession & initiator, @@ -235,6 +242,30 @@ void SendAndVerifyAcceptMsg(TransferSession::OutputEvent & outEvent, TransferSes EXPECT_LE(acceptReceiver.GetTransferBlockSize(), initData.MaxBlockSize); } +void SendAndVerifyRejectMsg(TransferSession::OutputEvent & outEvent, TransferSession & rejectSender, StatusCode reason, + TransferSession & rejectReceiver) +{ + CHIP_ERROR err = rejectSender.RejectTransfer(reason); + EXPECT_EQ(err, CHIP_NO_ERROR); + + // Verify Sender emits status message for sending + rejectSender.PollOutput(outEvent, kNoAdvanceTime); + VerifyNoMoreOutput(rejectSender); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kMsgToSend); + System::PacketBufferHandle statusReportMsg = outEvent.MsgData.Retain(); + VerifyStatusReport(std::move(outEvent.MsgData), reason); + + // Pass status message to rejectReceiver + err = AttachHeaderAndSend(outEvent.msgTypeData, std::move(outEvent.MsgData), rejectReceiver); + EXPECT_EQ(err, CHIP_NO_ERROR); + + // Verify received status message. + rejectReceiver.PollOutput(outEvent, kNoAdvanceTime); + VerifyInternalError(rejectReceiver); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kStatusReceived); + EXPECT_EQ(outEvent.statusData.statusCode, reason); +} + // Helper method for preparing a sending a BlockQuery message between two TransferSession objects. void SendAndVerifyQuery(TransferSession & queryReceiver, TransferSession & querySender, TransferSession::OutputEvent & outEvent) { @@ -698,3 +729,33 @@ TEST_F(TestBdxTransferSession, TestDuplicateBlockError) EXPECT_EQ(outEvent.statusData.statusCode, StatusCode::kBadBlockCounter); } } + +TEST_F(TestBdxTransferSession, TestRejectTransfer) +{ + TransferSession::OutputEvent outEvent; + TransferSession initiatingReceiver; + TransferSession respondingSender; + + // Chosen arbitrarily for this test + uint16_t proposedBlockSize = 128; + System::Clock::Timeout timeout = System::Clock::Seconds16(24); + TransferControlFlags driveMode = TransferControlFlags::kReceiverDrive; + + // ReceiveInit parameters + TransferSession::TransferInitData initOptions; + initOptions.TransferCtlFlags = driveMode; + initOptions.MaxBlockSize = proposedBlockSize; + char testFileDes[9] = { "test.txt" }; + initOptions.FileDesLength = static_cast(strlen(testFileDes)); + initOptions.FileDesignator = reinterpret_cast(testFileDes); + + // Initialize respondingSender and pass ReceiveInit message + BitFlags senderOpts; + senderOpts.Set(driveMode); + + SendAndVerifyTransferInit(outEvent, timeout, initiatingReceiver, TransferRole::kReceiver, initOptions, respondingSender, + senderOpts, proposedBlockSize); + + // Reject the transfer with a status + SendAndVerifyRejectMsg(outEvent, respondingSender, StatusCode::kResponderBusy, initiatingReceiver); +} diff --git a/src/protocols/bdx/tests/TestBdxUri.cpp b/src/protocols/bdx/tests/TestBdxUri.cpp index e94b88ec0d9f21..60125695809dc7 100644 --- a/src/protocols/bdx/tests/TestBdxUri.cpp +++ b/src/protocols/bdx/tests/TestBdxUri.cpp @@ -15,10 +15,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include #include -#include + +#include + +#include +#include using namespace ::chip; diff --git a/src/protocols/interaction_model/tests/BUILD.gn b/src/protocols/interaction_model/tests/BUILD.gn index 875146e3958ec6..b3a5c3c157244a 100644 --- a/src/protocols/interaction_model/tests/BUILD.gn +++ b/src/protocols/interaction_model/tests/BUILD.gn @@ -24,6 +24,7 @@ chip_test_suite("tests") { public_deps = [ "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/support", "${chip_root}/src/protocols/interaction_model", ] diff --git a/src/protocols/interaction_model/tests/TestStatusCode.cpp b/src/protocols/interaction_model/tests/TestStatusCode.cpp index 3183d68e2e5f22..83f2dc3525c846 100644 --- a/src/protocols/interaction_model/tests/TestStatusCode.cpp +++ b/src/protocols/interaction_model/tests/TestStatusCode.cpp @@ -18,8 +18,10 @@ #include -#include +#include + #include +#include #include using namespace ::chip; diff --git a/src/protocols/secure_channel/CASESession.cpp b/src/protocols/secure_channel/CASESession.cpp index b7aa87e9d5e278..96cd7e17eef449 100644 --- a/src/protocols/secure_channel/CASESession.cpp +++ b/src/protocols/secure_channel/CASESession.cpp @@ -599,7 +599,7 @@ void CASESession::OnResponseTimeout(ExchangeContext * ec) ChipLogError(SecureChannel, "CASESession::OnResponseTimeout exchange doesn't match")); ChipLogError(SecureChannel, "CASESession timed out while waiting for a response from peer " ChipLogFormatScopedNodeId ". Current state was %u", - ChipLogValueScopedNodeId(ScopedNodeId(mPeerNodeId, mFabricIndex)), to_underlying(mState)); + ChipLogValueScopedNodeId(GetPeer()), to_underlying(mState)); MATTER_TRACE_COUNTER("CASETimeout"); // Discard the exchange so that Clear() doesn't try aborting it. The // exchange will handle that. @@ -872,7 +872,7 @@ CHIP_ERROR CASESession::SendSigma1() mState = State::kSentSigma1; } - ChipLogProgress(SecureChannel, "Sent Sigma1 msg"); + ChipLogProgress(SecureChannel, "Sent Sigma1 msg to " ChipLogFormatScopedNodeId, ChipLogValueScopedNodeId(GetPeer())); mDelegate->OnSessionEstablishmentStarted(); diff --git a/src/protocols/secure_channel/tests/BUILD.gn b/src/protocols/secure_channel/tests/BUILD.gn index 0760998e818422..a5e6d73455eaea 100644 --- a/src/protocols/secure_channel/tests/BUILD.gn +++ b/src/protocols/secure_channel/tests/BUILD.gn @@ -28,6 +28,7 @@ chip_test_suite("tests") { "${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", diff --git a/src/protocols/secure_channel/tests/TestCASESession.cpp b/src/protocols/secure_channel/tests/TestCASESession.cpp index 24aaffce0dbcb4..67b4cdd7d69faf 100644 --- a/src/protocols/secure_channel/tests/TestCASESession.cpp +++ b/src/protocols/secure_channel/tests/TestCASESession.cpp @@ -21,16 +21,20 @@ * This file implements unit tests for the CASESession implementation. */ +#include + +#include + #include #include #include #include #include -#include #include #include #include #include +#include #include #include #include @@ -39,7 +43,6 @@ #include #include #include -#include #include "credentials/tests/CHIPCert_test_vectors.h" @@ -56,7 +59,7 @@ using namespace chip::Crypto; namespace chip { class TestCASESecurePairingDelegate; -class TestCASESession : public Test::LoopbackMessagingContext, public ::testing::Test +class TestCASESession : public Test::LoopbackMessagingContext { public: // Performs shared setup for all tests in the test suite @@ -70,8 +73,6 @@ class TestCASESession : public Test::LoopbackMessagingContext, public ::testing: chip::Test::LoopbackMessagingContext::SetUp(); } - virtual void TearDown() override { chip::Test::LoopbackMessagingContext::TearDown(); } - void ServiceEvents(); void SecurePairingHandshakeTestCommon(SessionManager & sessionManager, CASESession & pairingCommissioner, TestCASESecurePairingDelegate & delegateCommissioner); diff --git a/src/protocols/secure_channel/tests/TestCheckInCounter.cpp b/src/protocols/secure_channel/tests/TestCheckInCounter.cpp index 57dbd4b3496cdd..f3d85d98815638 100644 --- a/src/protocols/secure_channel/tests/TestCheckInCounter.cpp +++ b/src/protocols/secure_channel/tests/TestCheckInCounter.cpp @@ -16,11 +16,14 @@ * limitations under the License. */ -#include +#include + +#include + #include +#include #include #include -#include using namespace chip; using namespace chip::Protocols::SecureChannel; diff --git a/src/protocols/secure_channel/tests/TestCheckinMsg.cpp b/src/protocols/secure_channel/tests/TestCheckinMsg.cpp index d5885f3a6d06bb..23f3b2f2d68ca4 100644 --- a/src/protocols/secure_channel/tests/TestCheckinMsg.cpp +++ b/src/protocols/secure_channel/tests/TestCheckinMsg.cpp @@ -16,9 +16,11 @@ * limitations under the License. */ +#include + #include #include -#include +#include #include #include #include diff --git a/src/protocols/secure_channel/tests/TestDefaultSessionResumptionStorage.cpp b/src/protocols/secure_channel/tests/TestDefaultSessionResumptionStorage.cpp index 59dcf3080a8ec3..70b841aec80581 100644 --- a/src/protocols/secure_channel/tests/TestDefaultSessionResumptionStorage.cpp +++ b/src/protocols/secure_channel/tests/TestDefaultSessionResumptionStorage.cpp @@ -15,7 +15,9 @@ * limitations under the License. */ -#include +#include + +#include #include #include diff --git a/src/protocols/secure_channel/tests/TestMessageCounterManager.cpp b/src/protocols/secure_channel/tests/TestMessageCounterManager.cpp index 41b6539ecf0773..838e14cf6bd302 100644 --- a/src/protocols/secure_channel/tests/TestMessageCounterManager.cpp +++ b/src/protocols/secure_channel/tests/TestMessageCounterManager.cpp @@ -21,9 +21,14 @@ * This file implements unit tests for the MessageCounterManager implementation. */ +#include + +#include +#include + #include +#include #include - #include #include #include @@ -34,11 +39,6 @@ #include #include -#include -#include - -#include - namespace { using namespace chip; @@ -64,14 +64,7 @@ class MockAppDelegate : public ExchangeDelegate int ReceiveHandlerCallCount = 0; }; -struct TestMessageCounterManager : public chip::Test::LoopbackMessagingContext, public ::testing::Test -{ - static void SetUpTestSuite() { chip::Test::LoopbackMessagingContext::SetUpTestSuite(); } - static void TearDownTestSuite() { chip::Test::LoopbackMessagingContext::TearDownTestSuite(); } - - void SetUp() override { chip::Test::LoopbackMessagingContext::SetUp(); } - void TearDown() override { chip::Test::LoopbackMessagingContext::TearDown(); } -}; +using TestMessageCounterManager = chip::Test::LoopbackMessagingContext; TEST_F(TestMessageCounterManager, MessageCounterSyncProcess) { diff --git a/src/protocols/secure_channel/tests/TestPASESession.cpp b/src/protocols/secure_channel/tests/TestPASESession.cpp index 5b3f957d51bf84..bf120b20823ceb 100644 --- a/src/protocols/secure_channel/tests/TestPASESession.cpp +++ b/src/protocols/secure_channel/tests/TestPASESession.cpp @@ -22,11 +22,13 @@ */ #include -#include + +#include #include #include #include +#include #include #include #include @@ -84,21 +86,15 @@ constexpr Spake2pVerifierSerialized sTestSpake2p01_SerializedVerifier = { }; class TestSecurePairingDelegate; -class TestPASESession : public chip::Test::LoopbackMessagingContext, public ::testing::Test +class TestPASESession : public chip::Test::LoopbackMessagingContext { public: - // Performs shared setup for all tests in the test suite - static void SetUpTestSuite() { chip::Test::LoopbackMessagingContext::SetUpTestSuite(); } - static void TearDownTestSuite() { chip::Test::LoopbackMessagingContext::TearDownTestSuite(); } - void SetUp() override { ConfigInitializeNodes(false); chip::Test::LoopbackMessagingContext::SetUp(); } - void TearDown() override { chip::Test::LoopbackMessagingContext::TearDown(); } - void SecurePairingHandshakeTestCommon(SessionManager & sessionManager, PASESession & pairingCommissioner, Optional mrpCommissionerConfig, Optional mrpAccessoryConfig, diff --git a/src/protocols/secure_channel/tests/TestPairingSession.cpp b/src/protocols/secure_channel/tests/TestPairingSession.cpp index 5a12f61fc5c69e..b8d29c1c1742b8 100644 --- a/src/protocols/secure_channel/tests/TestPairingSession.cpp +++ b/src/protocols/secure_channel/tests/TestPairingSession.cpp @@ -22,14 +22,15 @@ */ #include -#include +#include + +#include #include +#include #include - #include #include -#include #include #include diff --git a/src/protocols/secure_channel/tests/TestSimpleSessionResumptionStorage.cpp b/src/protocols/secure_channel/tests/TestSimpleSessionResumptionStorage.cpp index ee107f695542a9..c90ec3550e0068 100644 --- a/src/protocols/secure_channel/tests/TestSimpleSessionResumptionStorage.cpp +++ b/src/protocols/secure_channel/tests/TestSimpleSessionResumptionStorage.cpp @@ -15,8 +15,9 @@ * limitations under the License. */ -#include +#include +#include #include #include diff --git a/src/protocols/secure_channel/tests/TestStatusReport.cpp b/src/protocols/secure_channel/tests/TestStatusReport.cpp index 65bc639dcca7c3..a76376f6925320 100644 --- a/src/protocols/secure_channel/tests/TestStatusReport.cpp +++ b/src/protocols/secure_channel/tests/TestStatusReport.cpp @@ -16,17 +16,17 @@ * limitations under the License. */ +#include + +#include #include #include #include - #include #include #include #include -#include - using namespace chip; using namespace chip::Protocols; using namespace chip::Protocols::SecureChannel; diff --git a/src/protocols/user_directed_commissioning/tests/BUILD.gn b/src/protocols/user_directed_commissioning/tests/BUILD.gn index ee67f0492ece92..c7e8f711bd0a5c 100644 --- a/src/protocols/user_directed_commissioning/tests/BUILD.gn +++ b/src/protocols/user_directed_commissioning/tests/BUILD.gn @@ -22,6 +22,7 @@ chip_test_suite("tests") { public_deps = [ "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/support", "${chip_root}/src/protocols", ] diff --git a/src/protocols/user_directed_commissioning/tests/TestUdcMessages.cpp b/src/protocols/user_directed_commissioning/tests/TestUdcMessages.cpp index 9dd05083de6ced..d6115a73913778 100644 --- a/src/protocols/user_directed_commissioning/tests/TestUdcMessages.cpp +++ b/src/protocols/user_directed_commissioning/tests/TestUdcMessages.cpp @@ -1,8 +1,9 @@ #include -#include +#include #include +#include #include #include #include diff --git a/src/python_testing/TCP_Tests.py b/src/python_testing/TCP_Tests.py new file mode 100644 index 00000000000000..cc2f48c86419d9 --- /dev/null +++ b/src/python_testing/TCP_Tests.py @@ -0,0 +1,150 @@ +# +# 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. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === +# +import chip.clusters as Clusters +from chip import ChipDeviceCtrl +from chip.interaction_model import InteractionModelError +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main +from mobly import asserts + + +class TCP_Tests(MatterBaseTest): + + @async_test_body + async def test_TCPConnectionEstablishment(self): + + try: + device = await self.default_controller.GetConnectedDevice(nodeid=self.dut_node_id, allowPASE=False, timeoutMs=1000, + payloadCapability=ChipDeviceCtrl.TransportPayloadCapability.LARGE_PAYLOAD) + except TimeoutError: + asserts.fail("Unable to establish a CASE session over TCP to the device") + asserts.assert_equal(device.isSessionOverTCPConnection, True, "Session does not have associated TCP connection") + asserts.assert_equal(device.isActiveSession, True, "Large Payload Session should be active over TCP connection") + + @async_test_body + async def test_LargePayloadSessionEstablishment(self): + + try: + device = await self.default_controller.GetConnectedDevice(nodeid=self.dut_node_id, allowPASE=False, timeoutMs=1000, + payloadCapability=ChipDeviceCtrl.TransportPayloadCapability.LARGE_PAYLOAD) + except TimeoutError: + asserts.fail("Unable to establish a CASE session over TCP to the device") + asserts.assert_equal(device.sessionAllowsLargePayload, True, "Session does not have associated TCP connection") + + @async_test_body + async def test_SessionInactiveAfterTCPDisconnect(self): + + try: + device = await self.default_controller.GetConnectedDevice(nodeid=self.dut_node_id, allowPASE=False, timeoutMs=1000, + payloadCapability=ChipDeviceCtrl.TransportPayloadCapability.LARGE_PAYLOAD) + except TimeoutError: + asserts.fail("Unable to establish a CASE session over TCP to the device") + asserts.assert_equal(device.isSessionOverTCPConnection, True, "Session does not have associated TCP connection") + + device.closeTCPConnectionWithPeer() + asserts.assert_equal(device.isActiveSession, False, + "Large Payload Session should not be active after TCP connection closure") + + @async_test_body + async def test_TCPConnectDisconnectThenConnectAgain(self): + + try: + device = await self.default_controller.GetConnectedDevice(nodeid=self.dut_node_id, allowPASE=False, timeoutMs=1000, + payloadCapability=ChipDeviceCtrl.TransportPayloadCapability.LARGE_PAYLOAD) + except TimeoutError: + asserts.fail("Unable to establish a CASE session over TCP to the device") + asserts.assert_equal(device.isSessionOverTCPConnection, True, "Session does not have associated TCP connection") + + device.closeTCPConnectionWithPeer() + asserts.assert_equal(device.isActiveSession, False, + "Large Payload Session should not be active after TCP connection closure") + + # Connect again + try: + device = await self.default_controller.GetConnectedDevice(nodeid=self.dut_node_id, allowPASE=False, timeoutMs=1000, + payloadCapability=ChipDeviceCtrl.TransportPayloadCapability.LARGE_PAYLOAD) + except TimeoutError: + asserts.fail("Unable to establish a CASE session over TCP to the device") + asserts.assert_equal(device.isSessionOverTCPConnection, True, "Session does not have associated TCP connection") + asserts.assert_equal(device.isActiveSession, True, "Large Payload Session should be active over TCP connection") + + @async_test_body + async def test_OnOffToggleCommandOverTCPSession(self): + + try: + device = await self.default_controller.GetConnectedDevice(nodeid=self.dut_node_id, allowPASE=False, timeoutMs=1000, + payloadCapability=ChipDeviceCtrl.TransportPayloadCapability.LARGE_PAYLOAD) + except TimeoutError: + asserts.fail("Unable to establish a CASE session over TCP to the device") + asserts.assert_equal(device.isSessionOverTCPConnection, True, "Session does not have associated TCP connection") + asserts.assert_equal(device.isActiveSession, True, "Large Payload Session should be active over TCP connection") + asserts.assert_equal(device.sessionAllowsLargePayload, True, "Session does not have associated TCP connection") + + commands = Clusters.Objects.OnOff.Commands + try: + await self.send_single_cmd(cmd=commands.Toggle(), endpoint=1, + payloadCapability=ChipDeviceCtrl.TransportPayloadCapability.LARGE_PAYLOAD) + except InteractionModelError: + asserts.fail("Unexpected error returned by DUT") + + @async_test_body + async def test_WildCardReadOverTCPSession(self): + + try: + device = await self.default_controller.GetConnectedDevice(nodeid=self.dut_node_id, allowPASE=False, timeoutMs=1000, + payloadCapability=ChipDeviceCtrl.TransportPayloadCapability.LARGE_PAYLOAD) + except TimeoutError: + asserts.fail("Unable to establish a CASE session over TCP to the device") + asserts.assert_equal(device.isSessionOverTCPConnection, True, "Session does not have associated TCP connection") + asserts.assert_equal(device.isActiveSession, True, "Large Payload Session should be active over TCP connection") + asserts.assert_equal(device.sessionAllowsLargePayload, True, "Session does not have associated TCP connection") + + try: + await self.default_controller.Read(self.dut_node_id, [()], payloadCapability=ChipDeviceCtrl.TransportPayloadCapability.LARGE_PAYLOAD) + except InteractionModelError: + asserts.fail("Unexpected error returned by DUT") + + @async_test_body + async def test_UseTCPSessionIfAvailableForMRPInteraction(self): + + try: + device = await self.default_controller.GetConnectedDevice(nodeid=self.dut_node_id, allowPASE=False, timeoutMs=1000, + payloadCapability=ChipDeviceCtrl.TransportPayloadCapability.LARGE_PAYLOAD) + except TimeoutError: + asserts.fail("Unable to establish a CASE session over TCP to the device") + asserts.assert_equal(device.isSessionOverTCPConnection, True, "Session does not have associated TCP connection") + asserts.assert_equal(device.isActiveSession, True, "Large Payload Session should be active over TCP connection") + asserts.assert_equal(device.sessionAllowsLargePayload, True, "Session does not have associated TCP connection") + + commands = Clusters.Objects.OnOff.Commands + try: + await self.send_single_cmd(cmd=commands.Toggle(), endpoint=1, + payloadCapability=ChipDeviceCtrl.TransportPayloadCapability.MRP_OR_TCP_PAYLOAD) + except InteractionModelError: + asserts.fail("Unexpected error returned by DUT") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_ACE_1_2.py b/src/python_testing/TC_ACE_1_2.py index 2c6f07a217183a..9bd26523f3cbba 100644 --- a/src/python_testing/TC_ACE_1_2.py +++ b/src/python_testing/TC_ACE_1_2.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging import queue diff --git a/src/python_testing/TC_ACE_1_3.py b/src/python_testing/TC_ACE_1_3.py index 150683357e1e9c..3c64171571eb95 100644 --- a/src/python_testing/TC_ACE_1_3.py +++ b/src/python_testing/TC_ACE_1_3.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging diff --git a/src/python_testing/TC_ACE_1_4.py b/src/python_testing/TC_ACE_1_4.py index 31cc7cb0c15a3a..f6f04e3508860b 100644 --- a/src/python_testing/TC_ACE_1_4.py +++ b/src/python_testing/TC_ACE_1_4.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --int-arg PIXIT.ACE.APPENDPOINT:1 PIXIT.ACE.APPDEVTYPEID:0x0100 --string-arg PIXIT.ACE.APPCLUSTER:OnOff PIXIT.ACE.APPATTRIBUTE:OnOff --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import sys diff --git a/src/python_testing/TC_ACE_1_5.py b/src/python_testing/TC_ACE_1_5.py index e88a040e31b983..00bd343d461cb3 100644 --- a/src/python_testing/TC_ACE_1_5.py +++ b/src/python_testing/TC_ACE_1_5.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging diff --git a/src/python_testing/TC_AccessChecker.py b/src/python_testing/TC_AccessChecker.py index f2bbf36330ec6a..36c643407937e2 100644 --- a/src/python_testing/TC_AccessChecker.py +++ b/src/python_testing/TC_AccessChecker.py @@ -1,9 +1,14 @@ +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging from copy import deepcopy diff --git a/src/python_testing/TC_CCTRL_2_1.py b/src/python_testing/TC_CCTRL_2_1.py new file mode 100644 index 00000000000000..7822d101b16e02 --- /dev/null +++ b/src/python_testing/TC_CCTRL_2_1.py @@ -0,0 +1,44 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, default_matter_test_main, has_cluster, per_endpoint_test +from mobly import asserts + + +class TC_CCTRL_2_1(MatterBaseTest): + + def steps_TC_CCTRL_2_1(self) -> list[TestStep]: + steps = [TestStep(1, "Read MCORE.FS PICS code", is_commissioning=True), + TestStep(2, "Validate SupportedDeviceCategories is set accordingly based on MCORE.FS")] + return steps + + @per_endpoint_test(has_cluster(Clusters.CommissionerControl)) + async def test_TC_CCTRL_2_1(self): + self.step(1) + is_fabric_sync_pics_enabled = self.check_pics("MCORE.FS") + + self.step(2) + supported_device_categories = await self.read_single_attribute_check_success(cluster=Clusters.CommissionerControl, attribute=Clusters.CommissionerControl.Attributes.SupportedDeviceCategories) + is_fabric_sync_bit_set = bool(supported_device_categories & + Clusters.CommissionerControl.Bitmaps.SupportedDeviceCategoryBitmap.kFabricSynchronization) + asserts.assert_equal(is_fabric_sync_bit_set, is_fabric_sync_pics_enabled, + "Mismatch between PICS MCORE.FS value and what attribute indicates") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_CCTRL_2_2.py b/src/python_testing/TC_CCTRL_2_2.py new file mode 100644 index 00000000000000..a4314e24ddf36a --- /dev/null +++ b/src/python_testing/TC_CCTRL_2_2.py @@ -0,0 +1,300 @@ +# +# 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. +# + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# TODO: Skip CI for now, we don't have any way to run this. Needs setup. See test_TC_CCTRL.py + +import ipaddress +import logging +import os +import pathlib +import random +import signal +import subprocess +import time +import uuid + +import chip.clusters as Clusters +from chip import ChipDeviceCtrl +from chip.interaction_model import InteractionModelError, Status +from matter_testing_support import (MatterBaseTest, TestStep, async_test_body, default_matter_test_main, has_cluster, + per_endpoint_test) +from mobly import asserts + + +class TC_CCTRL_2_2(MatterBaseTest): + + @async_test_body + async def setup_class(self): + super().setup_class() + # TODO: This needs to come from an arg and needs to be something available on the TH + # TODO: confirm whether we can open processes like this on the TH + app = os.path.join(pathlib.Path(__file__).resolve().parent, '..', '..', 'out', + 'linux-x64-all-clusters-no-ble', 'chip-all-clusters-app') + + self.kvs = f'kvs_{str(uuid.uuid4())}' + self.port = 5543 + discriminator = random.randint(0, 4095) + discriminator = 3840 + passcode = 20202021 + app_args = f'--secured-device-port {self.port} --discriminator {discriminator} --passcode {passcode} --KVS {self.kvs}' + cmd = f'{app} {app_args}' + # TODO: Determine if we want these logs cooked or pushed to somewhere else + logging.info("Starting TH_SERVER") + self.app_process = subprocess.Popen(cmd, bufsize=0, shell=True) + logging.info("TH_SERVER started") + time.sleep(3) + + logging.info("Commissioning from separate fabric") + + # Create a second controller on a new fabric to communicate to the server + new_certificate_authority = self.certificate_authority_manager.NewCertificateAuthority() + new_fabric_admin = new_certificate_authority.NewFabricAdmin(vendorId=0xFFF1, fabricId=2) + paa_path = str(self.matter_test_config.paa_trust_store_path) + self.TH_server_controller = new_fabric_admin.NewController(nodeId=112233, paaTrustStorePath=paa_path) + self.server_nodeid = 1111 + await self.TH_server_controller.CommissionOnNetwork(nodeId=self.server_nodeid, setupPinCode=passcode, filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=discriminator) + logging.info("Commissioning TH_SERVER complete") + + def teardown_class(self): + logging.warning("Stopping app with SIGTERM") + self.app_process.send_signal(signal.SIGTERM.value) + self.app_process.wait() + # TODO: Use timeout, if term doesn't work, try SIGINT + + os.remove(self.kvs) + super().teardown_class() + + def steps_TC_CCTRL_2_2(self) -> list[TestStep]: + steps = [TestStep(1, "Get number of fabrics from TH_SERVER", is_commissioning=True), + TestStep(2, "Reading Attribute VendorId from TH_SERVER"), + TestStep(3, "Reading Attribute ProductId from TH_SERVER"), + TestStep(4, "Reading Event CommissioningRequestResult from DUT"), + TestStep(5, "Send CommissionNode command to DUT with CASE session"), + TestStep(6, "Send OpenCommissioningWindow command on Administrator Commissioning Cluster to DUT with CASE session"), + TestStep(7, "Send CommissionNode command to DUT with PASE session"), + TestStep(8, "Send RequestCommissioningApproval command to DUT with PASE session"), + TestStep(9, "Send RevokeCommissioning command on Administrator Commissioning Cluster to DUT with CASE session"), + TestStep(10, "Reading Event CommissioningRequestResult from DUT, confirm no new events"), + TestStep(11, "Send RequestCommissioningApproval command to DUT with CASE session with incorrect vendorID"), + TestStep(12, "(Manual Step) Approve Commissioning Approval Request on DUT using method indicated by the manufacturer"), + TestStep(13, "Reading Event CommissioningRequestResult from DUT, confirm one new event"), + TestStep(14, "Send CommissionNode command to DUT with CASE session, with invalid RequestId"), + TestStep(15, "Send CommissionNode command to DUT with CASE session, with invalid ResponseTimeoutSeconds too low"), + TestStep(16, "Send CommissionNode command to DUT with CASE session, with invalid ResponseTimeoutSeconds too high"), + TestStep(17, "Send CommissionNode command to DUT with CASE session, with valid parameters"), + TestStep(18, "Send OpenCommissioningWindow command on Administrator Commissioning Cluster sent to TH_SERVER"), + TestStep(19, "Wait for DUT to fail commissioning TH_SERVER, 30 seconds"), + TestStep(20, "Get number of fabrics from TH_SERVER"), + TestStep(21, "Send RevokeCommissioning command on Administrator Commissioning Cluster sent to TH_SERVER"), + TestStep(22, "Send RequestCommissioningApproval command to DUT with CASE session with correct vendorID"), + TestStep(23, "(Manual Step) Approve Commissioning Approval Request on DUT using method indicated by the manufacturer"), + TestStep(24, "Reading Event CommissioningRequestResult from DUT, confirm one new event"), + TestStep(25, "Send CommissionNode command to DUT with CASE session, with valid parameters"), + TestStep(26, "Send OpenCommissioningWindow command on Administrator Commissioning Cluster sent to TH_SERVER"), + TestStep(27, "Wait for DUT to successfully commission TH_SERVER, 30 seconds"), + TestStep(28, "Get number of fabrics from TH_SERVER, verify DUT successfully commissioned TH_SERVER")] + + return steps + + @per_endpoint_test(has_cluster(Clusters.CommissionerControl)) + async def test_TC_CCTRL_2_2(self): + self.is_ci = self.check_pics('PICS_SDK_CI_ONLY') + + self.step(1) + th_server_fabrics = await self.read_single_attribute_check_success(cluster=Clusters.OperationalCredentials, attribute=Clusters.OperationalCredentials.Attributes.Fabrics, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0) + self.step(2) + th_server_vid = await self.read_single_attribute_check_success(cluster=Clusters.BasicInformation, attribute=Clusters.BasicInformation.Attributes.VendorID, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0) + self.step(3) + th_server_pid = await self.read_single_attribute_check_success(cluster=Clusters.BasicInformation, attribute=Clusters.BasicInformation.Attributes.ProductID, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0) + + self.step(4) + event_path = [(self.matter_test_config.endpoint, Clusters.CommissionerControl.Events.CommissioningRequestResult, 1)] + events = await self.default_controller.ReadEvent(nodeid=self.dut_node_id, events=event_path) + + self.step(5) + ipaddr = ipaddress.IPv6Address('::1') + cmd = Clusters.CommissionerControl.Commands.CommissionNode( + requestId=1, responseTimeoutSeconds=30, ipAddress=ipaddr.packed, port=self.port) + try: + await self.send_single_cmd(cmd) + asserts.fail("Unexpected success on CommissionNode") + except InteractionModelError as e: + asserts.assert_equal(e.status, Status.Failure, "Incorrect error returned") + + self.step(6) + params = await self.openCommissioningWindow(dev_ctrl=self.default_controller, node_id=self.dut_node_id) + self.step(7) + pase_nodeid = self.dut_node_id + 1 + await self.default_controller.FindOrEstablishPASESession(setupCode=params.commissioningParameters.setupQRCode, nodeid=pase_nodeid) + try: + await self.send_single_cmd(cmd=cmd, node_id=pase_nodeid) + asserts.fail("Unexpected success on CommissionNode") + except InteractionModelError as e: + asserts.assert_equal(e.status, Status.UnsupportedAccess, "Incorrect error returned") + + self.step(8) + good_request_id = 0x1234567887654321 + cmd = Clusters.CommissionerControl.Commands.RequestCommissioningApproval( + requestId=good_request_id, vendorId=th_server_vid, productId=th_server_pid) + try: + await self.send_single_cmd(cmd=cmd, node_id=pase_nodeid) + asserts.fail("Unexpected success on RequestCommissioningApproval over PASE") + except InteractionModelError as e: + asserts.assert_equal(e.status, Status.UnsupportedAccess, "Incorrect error returned") + + self.step(9) + cmd = Clusters.AdministratorCommissioning.Commands.RevokeCommissioning() + # If no exception is raised, this is success + await self.send_single_cmd(cmd) + + self.step(10) + if not events: + new_event = await self.default_controller.ReadEvent(nodeid=self.dut_node_id, events=event_path) + else: + event_nums = [e.Header.EventNumber for e in events] + new_event = await self.default_controller.ReadEvent(nodeid=self.dut_node_id, events=event_path, eventNumberFilter=max(event_nums)+1) + asserts.assert_equal(new_event, [], "Unexpected event") + + self.step(11) + # There should be nothing on the TH that uses VID 0x6006 as this is a real vendor ID. + not_th_server_vid = 0x6006 + asserts.assert_not_equal(not_th_server_vid, th_server_vid, "Test implementation assumption incorrect") + cmd = Clusters.CommissionerControl.Commands.RequestCommissioningApproval( + requestId=good_request_id, vendorId=not_th_server_vid, productId=th_server_pid) + # If no exception is raised, this is success + await self.send_single_cmd(cmd) + + self.step(12) + if not self.is_ci: + self.wait_for_use_input("Approve Commissioning approval request using manufacturer specified mechanism") + + self.step(13) + if not events: + new_event = await self.default_controller.ReadEvent(nodeid=self.dut_node_id, events=event_path) + else: + event_nums = [e.Header.EventNumber for e in events] + new_event = await self.default_controller.ReadEvent(nodeid=self.dut_node_id, events=event_path, eventNumberFilter=max(event_nums)+1) + asserts.assert_equal(len(new_event), 1, "Unexpected event list len") + asserts.assert_equal(new_event[0].Data.statusCode, 0, "Unexpected status code") + asserts.assert_equal(new_event[0].Data.clientNodeId, + self.matter_test_config.controller_node_id, "Unexpected client node id") + asserts.assert_equal(new_event[0].Data.requestId, good_request_id, "Unexpected request ID") + + self.step(14) + bad_request_id = 0x1234567887654322 + cmd = Clusters.CommissionerControl.Commands.CommissionNode(requestId=bad_request_id, responseTimeoutSeconds=30) + try: + await self.send_single_cmd(cmd=cmd) + asserts.fail("Unexpected success on CommissionNode") + except InteractionModelError as e: + asserts.assert_equal(e.status, Status.Failure, "Incorrect error returned") + + self.step(15) + cmd = Clusters.CommissionerControl.Commands.CommissionNode(requestId=good_request_id, responseTimeoutSeconds=29) + try: + await self.send_single_cmd(cmd=cmd) + asserts.fail("Unexpected success on CommissionNode") + except InteractionModelError as e: + asserts.assert_equal(e.status, Status.Failure, "Incorrect error returned") + + self.step(16) + cmd = Clusters.CommissionerControl.Commands.CommissionNode(requestId=good_request_id, responseTimeoutSeconds=121) + try: + await self.send_single_cmd(cmd=cmd) + asserts.fail("Unexpected success on CommissionNode") + except InteractionModelError as e: + asserts.assert_equal(e.status, Status.Failure, "Incorrect error returned") + + self.step(17) + cmd = Clusters.CommissionerControl.Commands.CommissionNode(requestId=good_request_id, responseTimeoutSeconds=30) + resp: Clusters.CommissionerControl.Commands.ReverseOpenCommissioningWindow = await self.send_single_cmd(cmd) + asserts.assert_equal(type(resp), Clusters.CommissionerControl.Commands.ReverseOpenCommissioningWindow, + "Incorrect response type") + + self.step(18) + # min commissioning timeout is 3*60 seconds, so use that even though the command said 30. + cmd = Clusters.AdministratorCommissioning.Commands.OpenCommissioningWindow(commissioningTimeout=3*60, + PAKEPasscodeVerifier=resp.PAKEPasscodeVerifier, + discriminator=resp.discriminator, + iterations=resp.iterations, salt=resp.salt) + await self.send_single_cmd(cmd, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0, timedRequestTimeoutMs=5000) + + self.step(19) + logging.info("Test now waits for 30 seconds") + if not self.is_ci: + time.sleep(30) + + self.step(20) + print(f'server node id {self.server_nodeid}') + th_server_fabrics_new = await self.read_single_attribute_check_success(cluster=Clusters.OperationalCredentials, attribute=Clusters.OperationalCredentials.Attributes.Fabrics, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0) + asserts.assert_equal(len(th_server_fabrics), len(th_server_fabrics_new), "Unexpected number of fabrics on TH_SERVER") + + self.step(21) + cmd = Clusters.AdministratorCommissioning.Commands.RevokeCommissioning() + await self.send_single_cmd(cmd, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, timedRequestTimeoutMs=5000, endpoint=0) + + self.step(22) + good_request_id = 0x1234567812345678 + cmd = Clusters.CommissionerControl.Commands.RequestCommissioningApproval( + requestId=good_request_id, vendorId=th_server_vid, productId=th_server_pid, label="Test Ecosystem") + await self.send_single_cmd(cmd) + + self.step(23) + if not self.is_ci: + self.wait_for_use_input("Approve Commissioning approval request using manufacturer specified mechanism") + + self.step(24) + events = new_event + event_nums = [e.Header.EventNumber for e in events] + new_event = await self.default_controller.ReadEvent(nodeid=self.dut_node_id, events=event_path, eventNumberFilter=max(event_nums)+1) + asserts.assert_equal(len(new_event), 1, "Unexpected event list len") + asserts.assert_equal(new_event[0].Data.statusCode, 0, "Unexpected status code") + asserts.assert_equal(new_event[0].Data.clientNodeId, + self.matter_test_config.controller_node_id, "Unexpected client node id") + asserts.assert_equal(new_event[0].Data.requestId, good_request_id, "Unexpected request ID") + + self.step(25) + cmd = Clusters.CommissionerControl.Commands.CommissionNode(requestId=good_request_id, responseTimeoutSeconds=30) + resp = await self.send_single_cmd(cmd) + asserts.assert_equal(type(resp), Clusters.CommissionerControl.Commands.ReverseOpenCommissioningWindow, + "Incorrect response type") + + self.step(26) + # min commissioning timeout is 3*60 seconds, so use that even though the command said 30. + cmd = Clusters.AdministratorCommissioning.Commands.OpenCommissioningWindow(commissioningTimeout=3*60, + PAKEPasscodeVerifier=resp.PAKEPasscodeVerifier, + discriminator=resp.discriminator, + iterations=resp.iterations, salt=resp.salt) + await self.send_single_cmd(cmd, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0, timedRequestTimeoutMs=5000) + + self.step(27) + if not self.is_ci: + time.sleep(30) + + self.step(28) + th_server_fabrics_new = await self.read_single_attribute_check_success(cluster=Clusters.OperationalCredentials, attribute=Clusters.OperationalCredentials.Attributes.Fabrics, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0) + # TODO: this should be mocked too. + if not self.is_ci: + asserts.assert_equal(len(th_server_fabrics) + 1, len(th_server_fabrics_new), + "Unexpected number of fabrics on TH_SERVER") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_CC_10_1.py b/src/python_testing/TC_CC_10_1.py new file mode 100644 index 00000000000000..3f1e40278bb0c6 --- /dev/null +++ b/src/python_testing/TC_CC_10_1.py @@ -0,0 +1,511 @@ +# +# 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. +# + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --endpoint 1 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +import asyncio +from typing import List + +import chip.clusters as Clusters +from chip.interaction_model import Status +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + +kCCAttributeValueIDs = [0x0001, 0x0003, 0x0004, 0x0007, 0x4000, 0x4001, 0x4002, 0x4003, 0x4004] + + +class TC_CC_10_1(MatterBaseTest): + + # + # Class Helper functions + # + def _prepare_cc_extension_field_set(self, attribute_value_list: List[Clusters.ScenesManagement.Structs.AttributeValuePairStruct]) -> Clusters.ScenesManagement.Structs.ExtensionFieldSet: + efs_attribute_value_list: List[Clusters.ScenesManagement.Structs.AttributeValuePairStruct] = [] + for attribute_id in kCCAttributeValueIDs: + # Attempt to find the attribute in the input list + found = False + for pair in attribute_value_list: + if pair.attributeID == attribute_id: + efs_attribute_value_list.append(pair) + found = True + break + + if not found: + if attribute_id == 0x0001 or attribute_id == 0x4001 or attribute_id == 0x4002 or attribute_id == 0x4003: + empty_attribute_value = Clusters.ScenesManagement.Structs.AttributeValuePairStruct( + attributeID=attribute_id, + valueUnsigned8=0x00, + ) + elif attribute_id == 0x0003 or attribute_id == 0x0004 or attribute_id == 0x0007 or attribute_id == 0x4004: + empty_attribute_value = Clusters.ScenesManagement.Structs.AttributeValuePairStruct( + attributeID=attribute_id, + valueUnsigned16=0x0000, + ) + efs_attribute_value_list.append(empty_attribute_value) + + extension_field_set = Clusters.ScenesManagement.Structs.ExtensionFieldSet( + clusterID=Clusters.Objects.ColorControl.id, + attributeValueList=efs_attribute_value_list + ) + + return extension_field_set + + def desc_TC_CC_10_1(self) -> str: + """Returns a description of this test""" + return "4.2.29. [TC_CC_10_1] Scenes Management Cluster Interaction with DUT as Server" + + def pics_TC_CC_10_1(self): + """ This function returns a list of PICS for this test case that must be True for the test to be run""" + return ["CC.S", "S.S"] + + def steps_TC_CC_10_1(self) -> list[TestStep]: + steps = [ + TestStep("0", "Commissioning, already done", is_commissioning=True), + TestStep("0a", "TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT using a key that is pre-installed on the TH. GroupKeySet fields are as follows: GroupKeySetID: 0x01a1, GroupKeySecurityPolicy: TrustFirst (0), EpochKey0: a0a1a2a3a4a5a6a7a8a9aaabacadaeaf, EpochStartTime0: 1110000, EpochKey1: b0b1b2b3b4b5b6b7b8b9babbbcbdbebf, EpochStartTime1: 1110001, EpochKey2: c0c1c2c3c4c5c6c7c8c9cacbcccdcecf, EpochStartTime2: 1110002"), + TestStep("0b", "TH binds GroupIds 0x0001 with GroupKeySetID 0x01a1 in the GroupKeyMap attribute list on GroupKeyManagement cluster by writing the GroupKeyMap attribute with two entries as follows: * List item 1: - FabricIndex: 1 - GroupId: 0x0001 - GroupKeySetId: 0x01a1"), + TestStep("0c", "TH sends a _RemoveAllGroups_ command to DUT."), + TestStep("1a", "TH sends a _AddGroup_ command to DUT with the _GroupID_ field set to _G~1~_."), + TestStep("1b", "TH sends a _RemoveAllScenes_ command to DUT with the _GroupID_ field set to _G~1~_."), + TestStep("1c", "TH sends a _GetSceneMembership_ command to DUT with the _GroupID_ field set to _G~1~_."), + TestStep("1d", "TH reads ColorTempPhysicalMinMireds attribute from DUT."), + TestStep("1e", "TH reads ColorTempPhysicalMaxMireds attribute from DUT."), + TestStep("2a", "TH sends _MoveToHueAndSaturation command_ to DUT with _Hue_=200, _Saturation_=50 and _TransitionTime_=0 (immediately)."), + TestStep("2b", "TH reads _CurrentHue and CurrentSaturation attributes_ from DUT."), + TestStep("2c", "TH sends _MoveToColor command_ to DUT, with: ColorX = 32768/0x8000 (x=0.5) (purple), ColorY = 19660/0x4CCC (y=0.3), TransitionTime = 0 (immediate)"), + TestStep("2d", "TH reads _CurrentX and CurrentY attributes_ from DUT."), + TestStep("2e", "TH sends _MoveToColorTemperature command_ to DUT with _ColorTemperatureMireds_=(_ColorTempPhysicalMinMireds_ + _ColorTempPhysicalMaxMireds_)/2"), + TestStep("2f", "TH sends _MoveColorTemperature command_ to DUT with _MoveMode_ = 0x01 (up), _Rate_ = (_ColorTempPhysicalMaxMireds_ - _ColorTempPhysicalMinMireds_)/40"), + TestStep("2g", "After 10 seconds, TH reads _ColorTemperatureMireds attribute_ from DUT."), + TestStep("2h", "TH sends _EnhancedMoveToHueAndSaturation command_ to DUT with _EnhancedHue_=20000, _Saturation_=50 and _TransitionTime_=0 (immediately)."), + TestStep("2i", "TH reads _EnhancedCurrentHue and CurrentSaturation attributes_ from DUT."), + TestStep("3", "TH sends a _StoreScene_ command to DUT with the _GroupID_ field set to _G~1~_ and the _SceneID_ field set to 0x01."), + TestStep("4", "TH sends a _ViewScene_ command to DUT with the _GroupID_ field set to _G~1~_ and the _SceneID_ field set to 0x01."), + TestStep( + "5a", "TH sends a _AddScene_ command to DUT with the _GroupID_ field set to _G~1~_, the _SceneID_ field set to 0x02, the TransitionTime field set to 0 and the ExtensionFieldSets set to: '[{ ClusterID: 0x0300, AttributeValueList: [{ AttributeID: 0x4001, ValueUnsigned8: 0x00 }, { AttributeID: 0x0001, ValueUnsigned8: 0xFE }]}]'"), + TestStep("5b", "TH sends a _RecallScene_ command to DUT with the _GroupID_ field set to _G~1~_, the _SceneID_ field set to 0x02 and the _TransitionTime_ omitted."), + TestStep("5c", "TH reads the _CurrentSaturation attribute_ from DUT."), + TestStep( + "6a", "TH sends a _AddScene_ command to DUT with the _GroupID_ field set to _G~1~_, the _SceneID_ field set to 0x03, the TransitionTime field set to 0 and the ExtensionFieldSets set to: '[{ ClusterID: 0x0300, AttributeValueList: [{ AttributeID: 0x4001, ValueUnsigned8: 0x01 }, { AttributeID: 0x0003, ValueUnsigned16: 16334 },{ AttributeID: 0x0004, ValueUnsigned16: 13067 }]}]'"), + TestStep("6b", "TH sends a _RecallScene_ command to DUT with the _GroupID_ field set to _G~1~_, the _SceneID_ field set to 0x03 and the _TransitionTime_ omitted."), + TestStep("6c", "TH reads _CurrentX and CurrentY attributes_ from DUT."), + TestStep( + "7a", "TH sends a _AddScene_ command to DUT with the _GroupID_ field set to _G~1~_, the _SceneID_ field set to 0x04, the TransitionTime field set to 0 and the ExtensionFieldSets set to: '[{ ClusterID: 0x0300, AttributeValueList: [{ AttributeID: 0x4001, ValueUnsigned8: 0x02 }, { AttributeID: 0x0007, ValueUnsigned16: 175 }]}]'"), + TestStep("7b", "TH sends a _RecallScene_ command to DUT with the _GroupID_ field set to _G~1~_, the _SceneID_ field set to 0x04 and the _TransitionTime_ omitted."), + TestStep("7c", "TH reads _ColorTemperatureMireds attribute_ from DUT."), + TestStep( + "8a", "TH sends a _AddScene_ command to DUT with the _GroupID_ field set to _G~1~_, the _SceneID_ field set to 0x05, the TransitionTime field set to 0 and the ExtensionFieldSets set to: '[{ ClusterID: 0x0300, AttributeValueList: [{ AttributeID: 0x4001, ValueUnsigned8: 0x03 }, { AttributeID: 0x4000, ValueUnsigned16: 12000 }, { AttributeID: 0x0001, ValueUnsigned16: 70 }]}]'"), + TestStep("8b", "TH sends a _RecallScene_ command to DUT with the _GroupID_ field set to _G~1~_, the _SceneID_ field set to 0x05 and the _TransitionTime_ omitted."), + TestStep("8c", "TH reads _EnhancedCurrentHue and CurrentSaturation attributes_ from DUT."), + TestStep( + "9a", "TH sends a _AddScene_ command to DUT with the _GroupID_ field set to _G~1~_, the _SceneID_ field set to 0x06, the TransitionTime field set to 0 and the ExtensionFieldSets set to: '[{ ClusterID: 0x0300, AttributeValueList: [{ AttributeID: 0x4002, ValueUnsigned16: 1 }, { AttributeID: 0x4002, ValueUnsigned16: 1 }, { AttributeID: 0x4004, ValueUnsigned16: 5 }]}]'"), + TestStep("9b", "TH sends a _RecallScene_ command to DUT with the _GroupID_ field set to _G~1~_, the _SceneID_ field set to 0x05 and the _TransitionTime_ omitted."), + TestStep("9c", "TH read _ColorLoopActive attribute_ from DUT."), + TestStep("9d", "TH read _ColorLoopDirection attribute_ from DUT."), + TestStep("9e", "TH read _ColorLoopTime attribute_ from DUT."), + ] + return steps + + @async_test_body + async def setup_test(self): + super().setup_test() + # Pre-Condition: Commissioning + self.step("0") + + self.step("0a") + + self.TH1 = self.default_controller + self.kGroupKeyset1 = 0x01a1 + self.groupKey = Clusters.GroupKeyManagement.Structs.GroupKeySetStruct( + groupKeySetID=self.kGroupKeyset1, + groupKeySecurityPolicy=Clusters.GroupKeyManagement.Enums.GroupKeySecurityPolicyEnum.kTrustFirst, + epochKey0="0123456789abcdef".encode(), + epochStartTime0=1110000, + epochKey1="0123456789abcdef".encode(), + epochStartTime1=1110001, + epochKey2="0123456789abcdef".encode(), + epochStartTime2=1110002) + + await self.TH1.SendCommand(self.dut_node_id, 0, Clusters.GroupKeyManagement.Commands.KeySetWrite(self.groupKey)) + + self.step("0b") + self.kGroup1 = 0x0001 + mapping_structs: List[Clusters.GroupKeyManagement.Structs.GroupKeyMapStruct] = [] + + mapping_structs.append(Clusters.GroupKeyManagement.Structs.GroupKeyMapStruct( + groupId=self.kGroup1, + groupKeySetID=self.kGroupKeyset1, + fabricIndex=1)) + result = await self.TH1.WriteAttribute(self.dut_node_id, [(0, Clusters.GroupKeyManagement.Attributes.GroupKeyMap(mapping_structs))]) + asserts.assert_equal(result[0].Status, Status.Success, "GroupKeyMap write failed") + + self.step("0c") + await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, Clusters.Groups.Commands.RemoveAllGroups()) + + self.step("1a") + result = await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, Clusters.Groups.Commands.AddGroup(self.kGroup1, "Group1")) + asserts.assert_equal(result.status, Status.Success, "Adding Group 1 failed") + + self.step("1b") + result = await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, Clusters.ScenesManagement.Commands.RemoveAllScenes(self.kGroup1)) + asserts.assert_equal(result.status, Status.Success, "Remove All Scenes failed on status") + asserts.assert_equal(result.groupID, self.kGroup1, "Remove All Scenes failed on groupID") + + self.step("1c") + result = await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, Clusters.ScenesManagement.Commands.GetSceneMembership(self.kGroup1)) + asserts.assert_equal(result.status, Status.Success, "Get Scene Membership failed on status") + asserts.assert_equal(result.groupID, self.kGroup1, "Get Scene Membership failed on groupID") + asserts.assert_equal(result.sceneList, [], "Get Scene Membership failed on sceneList") + + @async_test_body + async def teardown_test(self): + result = await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, Clusters.ScenesManagement.Commands.RemoveAllScenes(self.kGroup1)) + asserts.assert_equal(result.status, Status.Success, "Remove All Scenes failed on status") + asserts.assert_equal(result.groupID, self.kGroup1, "Remove All Scenes failed on groupID") + await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, Clusters.Groups.Commands.RemoveAllGroups()) + super().teardown_test() + + @async_test_body + async def test_TC_CC_10_1(self): + cluster = Clusters.Objects.ColorControl + attributes = cluster.Attributes + + self.step("1d") + if self.pics_guard(self.check_pics("CC.S.F04")): + ColorTempPhysicalMinMiredsValue = await self.read_single_attribute_check_success(cluster, attributes.ColorTempPhysicalMinMireds) + + self.step("1e") + if self.pics_guard(self.check_pics("CC.S.F04")): + ColorTempPhysicalMaxMiredsValue = await self.read_single_attribute_check_success(cluster, attributes.ColorTempPhysicalMaxMireds) + + self.step("2a") + if self.pics_guard(self.check_pics("CC.S.F00")): + await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, cluster.Commands.MoveToHueAndSaturation(200, 50, 0, 1, 1)) + + self.step("2b") + if self.pics_guard(self.check_pics("CC.S.F00")): + result = await self.TH1.ReadAttribute(self.dut_node_id, [(self.matter_test_config.endpoint, attributes.CurrentHue), (self.matter_test_config.endpoint, attributes.CurrentSaturation)]) + asserts.assert_less_equal(result[self.matter_test_config.endpoint][cluster] + [attributes.CurrentHue], 230, "CurrentHue is not less than or equal to 230") + asserts.assert_greater_equal(result[self.matter_test_config.endpoint][cluster][attributes.CurrentHue], 170, + "CurrentHue is not greater than or equal to 170") + asserts.assert_less_equal(result[self.matter_test_config.endpoint][cluster] + [attributes.CurrentSaturation], 58, "CurrentSaturation is not 58") + asserts.assert_greater_equal(result[self.matter_test_config.endpoint][cluster] + [attributes.CurrentSaturation], 42, "CurrentSaturation is not 42") + + self.step("2c") + if self.pics_guard(self.check_pics("CC.S.F03")): + await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, cluster.Commands.MoveToColor(32768, 19660, 0, 1, 1)) + + self.step("2d") + if self.pics_guard(self.check_pics("CC.S.F03")): + result = await self.TH1.ReadAttribute(self.dut_node_id, [(self.matter_test_config.endpoint, attributes.CurrentX), (self.matter_test_config.endpoint, attributes.CurrentY)]) + asserts.assert_less_equal(result[self.matter_test_config.endpoint][cluster] + [attributes.CurrentX], 35000, "CurrentX is not less than or equal to 35000") + asserts.assert_greater_equal(result[self.matter_test_config.endpoint][cluster][attributes.CurrentX], 31000, + "CurrentX is not greater than or equal to 31000") + asserts.assert_less_equal(result[self.matter_test_config.endpoint][cluster] + [attributes.CurrentY], 21000, "CurrentY is not less than or equal to 21000") + asserts.assert_greater_equal(result[self.matter_test_config.endpoint][cluster][attributes.CurrentY], 17000, + "CurrentY is not greater than or equal to 17000") + + self.step("2e") + if self.pics_guard(self.check_pics("CC.S.F04")): + await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, cluster.Commands.MoveToColorTemperature((ColorTempPhysicalMinMiredsValue + ColorTempPhysicalMaxMiredsValue) / 2, 0, 1, 1)) + await asyncio.sleep(1) + + self.step("2f") + if self.pics_guard(self.check_pics("CC.S.F04")): + await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, cluster.Commands.MoveColorTemperature(self.matter_test_config.endpoint, (ColorTempPhysicalMaxMiredsValue - ColorTempPhysicalMinMiredsValue) / 40, 1, 1)) + await asyncio.sleep(10) + + self.step("2g") + if self.pics_guard(self.check_pics("CC.S.F04")): + ColorTemperatureMireds = await self.read_single_attribute_check_success(cluster, attributes.ColorTemperatureMireds) + asserts.assert_less_equal(ColorTemperatureMireds, ColorTempPhysicalMaxMiredsValue, + "ColorTemperatureMireds is not less than or equal to ColorTempPhysicalMaxMireds") + asserts.assert_greater_equal(ColorTemperatureMireds, ColorTempPhysicalMinMiredsValue, + "ColorTemperatureMireds is not greater than or equal to ColorTempPhysicalMinMireds") + + self.step("2h") + if self.pics_guard(self.check_pics("CC.S.F01")): + await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, cluster.Commands.EnhancedMoveToHueAndSaturation(20000, 50, 0, 1, 1)) + + self.step("2i") + if self.pics_guard(self.check_pics("CC.S.F01")): + result = await self.TH1.ReadAttribute(self.dut_node_id, [(self.matter_test_config.endpoint, attributes.EnhancedCurrentHue), (self.matter_test_config.endpoint, attributes.CurrentSaturation)]) + asserts.assert_less_equal(result[self.matter_test_config.endpoint][cluster][attributes.EnhancedCurrentHue], 21800, + "EnhancedCurrentHue is not less than or equal to 21800") + asserts.assert_greater_equal(result[self.matter_test_config.endpoint][cluster][attributes.EnhancedCurrentHue], 18200, + "EnhancedCurrentHue is not greater than or equal to 18200") + asserts.assert_less_equal(result[self.matter_test_config.endpoint][cluster] + [attributes.CurrentSaturation], 58, "CurrentSaturation is not 58") + asserts.assert_greater_equal(result[self.matter_test_config.endpoint][cluster] + [attributes.CurrentSaturation], 42, "CurrentSaturation is not 42") + + self.step("3") + result = await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, Clusters.ScenesManagement.Commands.StoreScene(self.kGroup1, 0x01)) + asserts.assert_equal(result.status, Status.Success, "Store Scene failed on status") + asserts.assert_equal(result.groupID, self.kGroup1, "Store Scene failed on groupID") + asserts.assert_equal(result.sceneID, 0x01, "Store Scene failed on sceneID") + + self.step("4") + result = await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, Clusters.ScenesManagement.Commands.ViewScene(self.kGroup1, 0x01)) + asserts.assert_equal(result.status, Status.Success, "View Scene failed on status") + asserts.assert_equal(result.groupID, self.kGroup1, "View Scene failed on groupID") + asserts.assert_equal(result.sceneID, 0x01, "View Scene failed on sceneID") + asserts.assert_equal(result.transitionTime, 0, "View Scene failed on transitionTime") + + for EFS in result.extensionFieldSets: + if EFS.clusterID != 0x0300: + continue + + for AV in EFS.attributeValueList: + if AV.attributeID == 0x0001 and self.pics_guard(self.check_pics("CC.S.F00")): + asserts.assert_less_equal(AV.valueUnsigned8, 58, "View Scene failed on Satuation above limit") + asserts.assert_greater_equal(AV.valueUnsigned8, 42, "View Scene failed on Satuation below limit") + + if AV.attributeID == 0x0003 and self.pics_guard(self.check_pics("CC.S.F03")): + asserts.assert_less_equal(AV.valueUnsigned16, 35000, "View Scene failed on CurrentX above limit") + asserts.assert_greater_equal(AV.valueUnsigned16, 31000, "View Scene failed on CurrentX below limit") + + if AV.attributeID == 0x0004 and self.pics_guard(self.check_pics("CC.S.F03")): + asserts.assert_less_equal(AV.valueUnsigned16, 21000, "View Scene failed on CurrentY above limit") + asserts.assert_greater_equal(AV.valueUnsigned16, 17000, "View Scene failed on CurrentY below limit") + + if AV.attributeID == 0x0007 and self.pics_guard(self.check_pics("CC.S.F04")): + asserts.assert_less_equal(AV.valueUnsigned16, ColorTempPhysicalMaxMiredsValue, + "View Scene failed on ColorTemperatureMireds above limit") + asserts.assert_greater_equal(AV.valueUnsigned16, ColorTempPhysicalMinMiredsValue, + "View Scene failed on ColorTemperatureMireds below limit") + + if AV.attributeID == 0x4000 and self.pics_guard(self.check_pics("CC.S.F01")): + asserts.assert_less_equal(AV.valueUnsigned16, 21800, "View Scene failed on EnhancedHue above limit") + asserts.assert_greater_equal(AV.valueUnsigned16, 18200, "View Scene failed on EnhancedHue below limit") + + self.step("5a") + if self.pics_guard(self.check_pics("CC.S.F00")): + result = await self.TH1.SendCommand( + self.dut_node_id, self.matter_test_config.endpoint, + Clusters.ScenesManagement.Commands.AddScene( + self.kGroup1, + 0x02, + 0, + "Sat Scene", + [ + self._prepare_cc_extension_field_set( + [ + Clusters.ScenesManagement.Structs.AttributeValuePairStruct(attributeID=0x4001, valueUnsigned8=0x00), + Clusters.ScenesManagement.Structs.AttributeValuePairStruct(attributeID=0x0001, valueUnsigned8=0xFE) + ] + ) + ] + + ) + ) + asserts.assert_equal(result.status, Status.Success, "Add Scene failed on status") + asserts.assert_equal(result.groupID, self.kGroup1, "Add Scene failed on groupID") + asserts.assert_equal(result.sceneID, 0x02, "Add Scene failed on sceneID") + + self.step("5b") + if self.pics_guard(self.check_pics("CC.S.F00")): + await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, Clusters.ScenesManagement.Commands.RecallScene(self.kGroup1, 0x02)) + + self.step("5c") + if self.pics_guard(self.check_pics("CC.S.F00")): + CurrentSaturation = await self.read_single_attribute_check_success(cluster, attributes.CurrentSaturation) + asserts.assert_less_equal(CurrentSaturation, 0xFE, "CurrentSaturation is above limit") + asserts.assert_greater_equal(CurrentSaturation, 0xF6, "CurrentSaturation is below limit") + + self.step("6a") + if self.pics_guard(self.check_pics("CC.S.F03")): + result = await self.TH1.SendCommand( + self.dut_node_id, self.matter_test_config.endpoint, + Clusters.ScenesManagement.Commands.AddScene( + self.kGroup1, + 0x03, + 0, + "XY Scene", + [ + self._prepare_cc_extension_field_set( + [ + Clusters.ScenesManagement.Structs.AttributeValuePairStruct(attributeID=0x4001, valueUnsigned8=0x01), + Clusters.ScenesManagement.Structs.AttributeValuePairStruct( + attributeID=0x0003, valueUnsigned16=16334), + Clusters.ScenesManagement.Structs.AttributeValuePairStruct( + attributeID=0x0004, valueUnsigned16=13067) + ] + ) + ] + + ) + ) + asserts.assert_equal(result.status, Status.Success, "Add Scene failed on status") + asserts.assert_equal(result.groupID, self.kGroup1, "Add Scene failed on groupID") + asserts.assert_equal(result.sceneID, 0x03, "Add Scene failed on sceneID") + + self.step("6b") + if self.pics_guard(self.check_pics("CC.S.F03")): + await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, Clusters.ScenesManagement.Commands.RecallScene(self.kGroup1, 0x03)) + + self.step("6c") + if self.pics_guard(self.check_pics("CC.S.F03")): + result = await self.TH1.ReadAttribute(self.dut_node_id, [(self.matter_test_config.endpoint, attributes.CurrentX), (self.matter_test_config.endpoint, attributes.CurrentY)]) + asserts.assert_less_equal(result[self.matter_test_config.endpoint][cluster] + [attributes.CurrentX], 18000, "CurrentX is above limit") + asserts.assert_greater_equal(result[self.matter_test_config.endpoint][cluster] + [attributes.CurrentX], 14000, "CurrentX is below limit") + asserts.assert_less_equal(result[self.matter_test_config.endpoint][cluster] + [attributes.CurrentY], 15000, "CurrentY is above limit") + asserts.assert_greater_equal(result[self.matter_test_config.endpoint][cluster] + [attributes.CurrentY], 11000, "CurrentY is below limit") + + self.step("7a") + if self.pics_guard(self.check_pics("CC.S.F04")): + result = await self.TH1.SendCommand( + self.dut_node_id, self.matter_test_config.endpoint, + Clusters.ScenesManagement.Commands.AddScene( + self.kGroup1, + 0x04, + 0, + "Temp Scene", + [ + self._prepare_cc_extension_field_set( + [ + Clusters.ScenesManagement.Structs.AttributeValuePairStruct(attributeID=0x4001, valueUnsigned8=0x02), + Clusters.ScenesManagement.Structs.AttributeValuePairStruct(attributeID=0x0007, valueUnsigned16=175) + ] + ) + ] + + ) + ) + asserts.assert_equal(result.status, Status.Success, "Add Scene failed on status") + asserts.assert_equal(result.groupID, self.kGroup1, "Add Scene failed on groupID") + asserts.assert_equal(result.sceneID, 0x04, "Add Scene failed on sceneID") + + self.step("7b") + if self.pics_guard(self.check_pics("CC.S.F04")): + await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, Clusters.ScenesManagement.Commands.RecallScene(self.kGroup1, 0x04)) + + self.step("7c") + if self.pics_guard(self.check_pics("CC.S.F04")): + ColorTemperatureMireds = await self.read_single_attribute_check_success(cluster, attributes.ColorTemperatureMireds) + asserts.assert_less_equal(ColorTemperatureMireds, + ColorTempPhysicalMaxMiredsValue, "ColorTemperatureMireds is above limit") + asserts.assert_greater_equal(ColorTemperatureMireds, + ColorTempPhysicalMinMiredsValue, "ColorTemperatureMireds is below limit") + + self.step("8a") + if self.pics_guard(self.check_pics("CC.S.F01")): + result = await self.TH1.SendCommand( + self.dut_node_id, self.matter_test_config.endpoint, + Clusters.ScenesManagement.Commands.AddScene( + self.kGroup1, + 0x05, + 0, + "Enh Scene", + [ + self._prepare_cc_extension_field_set( + [ + Clusters.ScenesManagement.Structs.AttributeValuePairStruct(attributeID=0x4001, valueUnsigned8=0x03), + Clusters.ScenesManagement.Structs.AttributeValuePairStruct( + attributeID=0x4000, valueUnsigned16=12000), + Clusters.ScenesManagement.Structs.AttributeValuePairStruct(attributeID=0x0001, valueUnsigned8=70) + ] + ) + ] + + ) + ) + asserts.assert_equal(result.status, Status.Success, "Add Scene failed on status") + asserts.assert_equal(result.groupID, self.kGroup1, "Add Scene failed on groupID") + asserts.assert_equal(result.sceneID, 0x05, "Add Scene failed on sceneID") + + self.step("8b") + if self.pics_guard(self.check_pics("CC.S.F01")): + await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, Clusters.ScenesManagement.Commands.RecallScene(self.kGroup1, 0x05)) + + self.step("8c") + if self.pics_guard(self.check_pics("CC.S.F01")): + result = await self.TH1.ReadAttribute(self.dut_node_id, [(self.matter_test_config.endpoint, attributes.EnhancedCurrentHue), (self.matter_test_config.endpoint, attributes.CurrentSaturation)]) + asserts.assert_less_equal(result[self.matter_test_config.endpoint][cluster] + [attributes.EnhancedCurrentHue], 13800, "EnhancedCurrentHue is above limit") + asserts.assert_greater_equal(result[self.matter_test_config.endpoint][cluster][attributes.EnhancedCurrentHue], + 10200, "EnhancedCurrentHue is below limit") + asserts.assert_less_equal(result[self.matter_test_config.endpoint][cluster] + [attributes.CurrentSaturation], 78, "CurrentSaturation is above limit") + asserts.assert_greater_equal(result[self.matter_test_config.endpoint][cluster] + [attributes.CurrentSaturation], 62, "CurrentSaturation is below limit") + + self.step("9a") + if self.pics_guard(self.check_pics("CC.S.F02")): + result = await self.TH1.SendCommand( + self.dut_node_id, self.matter_test_config.endpoint, + Clusters.ScenesManagement.Commands.AddScene( + self.kGroup1, + 0x06, + 0, + "Loop Scene", + [ + self._prepare_cc_extension_field_set( + [ + Clusters.ScenesManagement.Structs.AttributeValuePairStruct(attributeID=0x4002, valueUnsigned8=0x01), + Clusters.ScenesManagement.Structs.AttributeValuePairStruct(attributeID=0x4003, valueUnsigned8=0x01), + Clusters.ScenesManagement.Structs.AttributeValuePairStruct(attributeID=0x4004, valueUnsigned16=5) + ] + ) + ] + + ) + ) + asserts.assert_equal(result.status, Status.Success, "Add Scene failed on status") + asserts.assert_equal(result.groupID, self.kGroup1, "Add Scene failed on groupID") + asserts.assert_equal(result.sceneID, 0x06, "Add Scene failed on sceneID") + + self.step("9b") + if self.pics_guard(self.check_pics("CC.S.F02")): + await self.TH1.SendCommand(self.dut_node_id, self.matter_test_config.endpoint, Clusters.ScenesManagement.Commands.RecallScene(self.kGroup1, 0x06)) + + self.step("9c") + if self.pics_guard(self.check_pics("CC.S.F02")): + ColorLoopActive = await self.read_single_attribute_check_success(cluster, attributes.ColorLoopActive) + asserts.assert_equal(ColorLoopActive, 1, "ColorLoopActive is not 1") + + self.step("9d") + if self.pics_guard(self.check_pics("CC.S.F02")): + ColorLoopDirection = await self.read_single_attribute_check_success(cluster, attributes.ColorLoopDirection) + asserts.assert_equal(ColorLoopDirection, 1, "ColorLoopDirection is not 1") + + self.step("9e") + if self.pics_guard(self.check_pics("CC.S.C44.Rsp")): + ColorLoopTime = await self.read_single_attribute_check_success(cluster, attributes.ColorLoopTime) + asserts.assert_equal(ColorLoopTime, 5, "ColorLoopTime is not 5") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_CGEN_2_4.py b/src/python_testing/TC_CGEN_2_4.py index ef22360dac341d..7d9d075dc16cb9 100644 --- a/src/python_testing/TC_CGEN_2_4.py +++ b/src/python_testing/TC_CGEN_2_4.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging import random diff --git a/src/python_testing/TC_CNET_1_4.py b/src/python_testing/TC_CNET_1_4.py new file mode 100644 index 00000000000000..d7560c4fd03942 --- /dev/null +++ b/src/python_testing/TC_CNET_1_4.py @@ -0,0 +1,106 @@ +# +# 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. +# + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +import logging + +import chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + +kRootEndpointId = 0 +kSecondaryNetworkInterfaceDeviceTypeId = 0x0019 + + +class TC_CNET_1_4(MatterBaseTest): + def steps_TC_CNET_1_4(self): + return [TestStep(1, "TH is commissioned", is_commissioning=True), + TestStep(2, 'TH performs a wildcard read of the FeatureMap attribute on Network Commissioning clusters across all endpoints, and saves the response as `NetworkCommissioningResponse`'), + TestStep(3, 'If `NetworkCommissioningResponse` does not contain any entries for Network Commissioning cluster, skip remaining steps and end test case'), + TestStep(4, 'If `NetworkCommissioningResponse` contains only a single entry for Network Commissioning cluster on Endpoint 0, skip remaining steps and end test case. Verify `NetworkCommissioningResponse` contains an entry for Network Commissioning cluster on Endpoint 0'), + TestStep(5, 'TH reads from the DUT the Descriptor Cluster DeviceTypeList attribute on each endpoint from the `NetworkCommissioningResponse` (except for Endpoint 0), verify that the Secondary Network Interface device type id (0x0019) is listed in the DeviceTypeList'), + TestStep(6, 'TH reads from the DUT the General Commissioning Cluster SupportsConcurrentConnection attribute, verify that it is true')] + + def def_TC_CNET_1_4(self): + return '[TC-CNET-1.4] Verification for Secondary Network Interface [DUT-Server]' + + def pics_TC_CNET_1_4(self): + return ['CNET.S'] + + # Override default timeout. + @property + def default_timeout(self) -> int: + return 200 + + @async_test_body + async def test_TC_CNET_1_4(self): + # Commissioning is already done + self.step(1) + + self.step(2) + # Read FeatureMap attribute with wildcard endpoint + NetworkCommissioningResponse = await self.default_controller.ReadAttribute(self.dut_node_id, [(Clusters.NetworkCommissioning.Attributes.FeatureMap)], fabricFiltered=True) + + self.step(3) + NumNetworkCommissioning = len(NetworkCommissioningResponse) + if NumNetworkCommissioning == 0: + logging.info('No endpoint has Network Commissioning Cluster, skipping remaining steps') + self.skip_all_remaining_steps(4) + return + + self.step(4) + endpoints = [] + for endpoint, _ in NetworkCommissioningResponse.items(): + endpoints.append(endpoint) + if kRootEndpointId not in endpoints: + asserts.assert_true(False, "There is no Network Commissioning Cluster on endpoint 0") + + if NumNetworkCommissioning == 1: + logging.info('Only endpoint 0 has Network Commissioning Cluster, skipping remaining steps') + self.skip_all_remaining_steps(5) + return + + self.step(5) + for endpoint in endpoints: + if endpoint == kRootEndpointId: + continue + device_type_list = await self.read_single_attribute_check_success(cluster=Clusters.Descriptor, + attribute=Clusters.Descriptor.Attributes.DeviceTypeList, endpoint=endpoint) + required_device_types = {kSecondaryNetworkInterfaceDeviceTypeId} + found_device_types = {device.deviceType for device in device_type_list} + asserts.assert_true(required_device_types.intersection(found_device_types), + "Network Commissioning Cluster is not on Root Node or Secondary Network Interface") + + self.step(6) + concurrent_connection = await self.read_single_attribute_check_success(cluster=Clusters.GeneralCommissioning, + attribute=Clusters.GeneralCommissioning.Attributes.SupportsConcurrentConnection) + asserts.assert_true(concurrent_connection, "The device does not support concurrent connection commissioning") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_DA_1_2.py b/src/python_testing/TC_DA_1_2.py index f324a2d3571c77..30a5285a4a4b68 100644 --- a/src/python_testing/TC_DA_1_2.py +++ b/src/python_testing/TC_DA_1_2.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import os import random diff --git a/src/python_testing/TC_DA_1_5.py b/src/python_testing/TC_DA_1_5.py index 7e3bd92cda26e9..d37f236a9fccf4 100644 --- a/src/python_testing/TC_DA_1_5.py +++ b/src/python_testing/TC_DA_1_5.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import random diff --git a/src/python_testing/TC_DA_1_7.py b/src/python_testing/TC_DA_1_7.py index 9e25bdee88fa6a..be1e466002eebc 100644 --- a/src/python_testing/TC_DA_1_7.py +++ b/src/python_testing/TC_DA_1_7.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --bool-arg allow_sdk_dac:true --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging from glob import glob @@ -153,15 +158,13 @@ def steps_TC_DA_1_7(self): @async_test_body async def test_TC_DA_1_7(self): - # post_cert_tests (or sdk) can use the qr or manual code - # We don't currently support this in cert because the base doesn't support multiple QR/manual num = 0 if self.matter_test_config.discriminators: num += len(self.matter_test_config.discriminators) if self.matter_test_config.qr_code_content: - num += 1 + num += len(self.matter_test_config.qr_code_content) if self.matter_test_config.manual_code: - num += 1 + num += len(self.matter_test_config.manual_code) if num != self.expected_number_of_DUTs(): if self.allow_sdk_dac: diff --git a/src/python_testing/TC_DEMTestBase.py b/src/python_testing/TC_DEMTestBase.py new file mode 100644 index 00000000000000..db53c36f8cd1c9 --- /dev/null +++ b/src/python_testing/TC_DEMTestBase.py @@ -0,0 +1,242 @@ +# +# Copyright (c) 2023 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import logging + +import chip.clusters as Clusters +from chip.interaction_model import InteractionModelError, Status +from matter_testing_support import utc_time_in_matter_epoch +from mobly import asserts + +logger = logging.getLogger(__name__) + + +class DEMTestBase: + + async def read_dem_attribute_expect_success(self, endpoint: int = None, attribute: str = ""): + cluster = Clusters.Objects.DeviceEnergyManagement + full_attr = getattr(cluster.Attributes, attribute) + logging.info(f"endpoint {endpoint} full_attr {full_attr}") + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=full_attr) + + async def check_dem_attribute(self, attribute, expected_value, endpoint: int = None): + value = await self.read_dem_attribute_expect_success(endpoint=endpoint, attribute=attribute) + asserts.assert_equal(value, expected_value, + f"Unexpected '{attribute}' value - expected {expected_value}, was {value}") + + async def send_power_adjustment_command(self, power: int, duration: int, + cause: Clusters.Objects.DeviceEnergyManagement.Enums.CauseEnum, + endpoint: int = None, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.DeviceEnergyManagement.Commands.PowerAdjustRequest( + power=power, + duration=duration, + cause=cause), + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + asserts.assert_equal(expected_status, Status.Success) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_cancel_power_adjustment_command(self, endpoint: int = None, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.DeviceEnergyManagement.Commands.CancelPowerAdjustRequest(), + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + asserts.assert_equal(expected_status, Status.Success) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_start_time_adjust_request_command(self, requestedStartTime: int, + cause: Clusters.Objects.DeviceEnergyManagement.Enums.CauseEnum, + endpoint: int = None, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.DeviceEnergyManagement.Commands.StartTimeAdjustRequest( + requestedStartTime=requestedStartTime, + cause=cause), + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + asserts.assert_equal(expected_status, Status.Success) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_start_time_adjust_clear_command(self, + endpoint: int = None, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.DeviceEnergyManagement.Commands.StartTimeAdjustClear(), # StartTimeAdjustmentClear(), + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + asserts.assert_equal(expected_status, Status.Success) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_cancel_request_command(self, + endpoint: int = None, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.DeviceEnergyManagement.Commands.CancelRequest(), + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + asserts.assert_equal(expected_status, Status.Success) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_pause_request_command(self, duration: int, cause: + Clusters.Objects.DeviceEnergyManagement.Enums.AdjustmentCauseEnum, + endpoint: int = None, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.DeviceEnergyManagement.Commands.PauseRequest( + duration=duration, + cause=cause), + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + asserts.assert_equal(expected_status, Status.Success) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_resume_request_command(self, endpoint: int = None, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.DeviceEnergyManagement.Commands.ResumeRequest(), + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + asserts.assert_equal(expected_status, Status.Success) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_modify_forecast_request_command(self, forecastID: int, + slotAdjustments: list[Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct], + cause: Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum, + endpoint: int = None, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.DeviceEnergyManagement.Commands.ModifyForecastRequest(forecastID=forecastID, + slotAdjustments=slotAdjustments, + cause=cause), + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + asserts.assert_equal(expected_status, Status.Success) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_request_constraint_based_forecast(self, constraintList: list[Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct], + cause: Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum, + endpoint: int = None, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.DeviceEnergyManagement.Commands.RequestConstraintBasedForecast(constraints=constraintList, + cause=cause), + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + asserts.assert_equal(expected_status, Status.Success) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + def print_forecast(self, forecast): + for index, slot in enumerate(forecast.slots): + logging.info( + f" [{index}] MinDuration: {slot.minDuration} MaxDuration: {slot.maxDuration} DefaultDuration: {slot.defaultDuration}") + logging.info(f" ElapseSlotTime: {slot.elapsedSlotTime} RemainingSlotTime: {slot.remainingSlotTime}") + logging.info( + f" SlotIsPausable: {slot.slotIsPausable} MinPauseDuration: {slot.minPauseDuration} MaxPauseDuration: {slot.maxPauseDuration}") + logging.info(f" ManufacturerESAState: {slot.manufacturerESAState}") + logging.info(f" NominalPower: {slot.nominalPower} MinPower: {slot.minPower} MaxPower: {slot.maxPower}") + logging.info(f" MinPowerAdjustment: {slot.minPowerAdjustment} MaxPowerAdjustment: {slot.maxPowerAdjustment}") + logging.info( + f" MinDurationAdjustment: {slot.minDurationAdjustment} MaxDurationAdjustment: {slot.maxDurationAdjustment}") + if slot.costs is not None: + for cost_index, cost in enumerate(slot): + logging.info( + f" Cost: [{cost_index}] CostType:{cost.costType} Value: {cost.value} DecimalPoints: {cost.decimalPoints} Currency: {cost.currency}") + + def get_current_utc_time_in_seconds(self): + microseconds_in_second = 1000000 + return int(utc_time_in_matter_epoch()/microseconds_in_second) + + async def send_test_event_trigger_power_adjustment(self): + await self.send_test_event_triggers(eventTrigger=0x0098000000000000) + + async def send_test_event_trigger_power_adjustment_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0098000000000001) + + async def send_test_event_trigger_user_opt_out_local(self): + await self.send_test_event_triggers(eventTrigger=0x0098000000000002) + + async def send_test_event_trigger_user_opt_out_grid(self): + await self.send_test_event_triggers(eventTrigger=0x0098000000000003) + + async def send_test_event_trigger_user_opt_out_clear_all(self): + await self.send_test_event_triggers(eventTrigger=0x0098000000000004) + + async def send_test_event_trigger_start_time_adjustment(self): + await self.send_test_event_triggers(eventTrigger=0x0098000000000005) + + async def send_test_event_trigger_start_time_adjustment_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0098000000000006) + + async def send_test_event_trigger_pausable(self): + await self.send_test_event_triggers(eventTrigger=0x0098000000000007) + + async def send_test_event_trigger_pausable_next_slot(self): + await self.send_test_event_triggers(eventTrigger=0x0098000000000008) + + async def send_test_event_trigger_pausable_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0098000000000009) + + async def send_test_event_trigger_forecast_adjustment(self): + await self.send_test_event_triggers(eventTrigger=0x009800000000000A) + + async def send_test_event_trigger_forecast_adjustment_next_slot(self): + await self.send_test_event_triggers(eventTrigger=0x009800000000000B) + + async def send_test_event_trigger_forecast_adjustment_clear(self): + await self.send_test_event_triggers(eventTrigger=0x009800000000000C) + + async def send_test_event_trigger_constraint_based_adjustment(self): + await self.send_test_event_triggers(eventTrigger=0x009800000000000D) + + async def send_test_event_trigger_constraint_based_adjustment_clear(self): + await self.send_test_event_triggers(eventTrigger=0x009800000000000E) + + async def send_test_event_trigger_forecast(self): + await self.send_test_event_triggers(eventTrigger=0x009800000000000F) + + async def send_test_event_trigger_forecast_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0098000000000010) diff --git a/src/python_testing/TC_DEM_2_2.py b/src/python_testing/TC_DEM_2_2.py new file mode 100644 index 00000000000000..0c32992d934174 --- /dev/null +++ b/src/python_testing/TC_DEM_2_2.py @@ -0,0 +1,364 @@ +# +# 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. +# pylint: disable=invalid-name + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x01 +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +"""Define Matter test case TC_DEM_2_2.""" + + +import datetime +import logging +import sys +import time + +import chip.clusters as Clusters +from chip.interaction_model import Status +from matter_testing_support import EventChangeCallback, MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts +from TC_DEMTestBase import DEMTestBase + +logger = logging.getLogger(__name__) + + +class TC_DEM_2_2(MatterBaseTest, DEMTestBase): + """Implementation of test case TC_DEM_2_2.""" + + def desc_TC_DEM_2_2(self) -> str: + """Return a description of this test.""" + return "4.1.3. [TC-DEM-2.2] Power Adjustment feature functionality with DUT as Server" + + def pics_TC_DEM_2_2(self): + """Return the PICS definitions associated with this test.""" + pics = [ + "DEM.S.F00", # Depends on Feature 00 (PowerAdjustment) + ] + return pics + + def steps_TC_DEM_2_2(self) -> list[TestStep]: + """Execute the test steps.""" + steps = [ + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.", + "Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Power Adjustment Test Event", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("3a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("3b", "TH reads PowerAdjustmentCapability attribute.", + "Value has to include Cause=NoAdjustment. Note value for later. Determine the OverallMaxPower and OverallMaxDuration as the largest MaxPower and MaxDuration of the PowerAdjustStructs returned, and similarly the OverallMinPower and OverallMinDuration as the smallest of the MinPower and MinDuration values."), + TestStep("3c", "TH reads OptOutState attribute.", + "Verify value is 0x00 (NoOptOut)"), + TestStep("4", "TH sends PowerAdjustRequest with Power=PowerAdjustmentCapability[0].MaxPower, Duration=PowerAdjustmentCapability[0].MinDuration, Cause=LocalOptimization.", + "Verify DUT responds with status SUCCESS(0x00) and Event DEM.S.E00(PowerAdjustStart) sent"), + TestStep("4a", "TH reads ESAState attribute.", + "Verify value is 0x04 (PowerAdjustActive)"), + TestStep("4b", "TH reads PowerAdjustmentCapability attribute.", + "Value has to include Cause=LocalOptimizationAdjustment."), + TestStep("5", "TH sends CancelPowerAdjustRequest.", + "Verify DUT responds with status SUCCESS(0x00) and Event DEM.S.E01(PowerAdjustEnd) sent with Cause=Cancelled"), + TestStep("5a", "TH reads PowerAdjustmentCapability attribute.", + "Value has to include Cause=NoAdjustment."), + TestStep("5b", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("6", "TH sends CancelPowerAdjustRequest.", + "Verify DUT responds with status INVALID_IN_STATE(0xcb)"), + TestStep("7", "TH sends PowerAdjustRequest with Power=OverallMaxPower+1 Duration=OverallMinDuration Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("8", "TH sends PowerAdjustRequest with Power=OverallMinPower Duration=OverallMaxDuration+1 Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("9", "TH sends PowerAdjustRequest with Power=OverallMinPower-1 Duration=OverallMaxDuration Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("10", "TH sends PowerAdjustRequest with Power=OverallMaxPower Duration=OverallMinDuration-1 Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("11", "TH sends PowerAdjustRequest with Power=PowerAdjustmentCapability[0].MaxPower, Duration=PowerAdjustmentCapability[0].MinDuration, Cause=LocalOptimization.", + "Verify DUT responds with status SUCCESS(0x00) and event DEM.S.E00(PowerAdjustStart) sent"), + TestStep("11a", "TH reads PowerAdjustmentCapability attribute.", + "Value has to include Cause=LocalOptimizationAdjustment."), + TestStep("12", "TH sends PowerAdjustRequest with Power=PowerAdjustmentCapability[0].MaxPower, Duration=PowerAdjustmentCapability[0].MinDuration, Cause=GridOptimization.", + "Verify DUT responds with status SUCCESS(0x00) and no event sent"), + TestStep("12a", "TH reads ESAState attribute.", + "Verify value is 0x04 (PowerAdjustActive)"), + TestStep("12b", "TH reads PowerAdjustmentCapability attribute.", + "Value has to include Cause=GridOptimizationAdjustment."), + TestStep("13", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Local Optimization Test Event.", + "Verify DUT responds with status SUCCESS(0x00) and no event sent"), + TestStep("13a", "TH reads ESAState attribute.", + "Verify value is 0x04 (PowerAdjustActive)"), + TestStep("13b", "TH reads OptOutState attribute.", + "Verify value is 0x02 (LocalOptOut)"), + TestStep("14", "TH sends PowerAdjustRequest with Power=PowerAdjustmentCapability[0].MaxPower, Duration=PowerAdjustmentCapability[0].MinDuration, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("15", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Grid Optimization Test Event.", + "Verify DUT responds with status SUCCESS(0x00) and event DEM.S.E01(PowerAdjustEnd) sent with Cause=UserOptOut, Duration= approx time from step 11 to step 15, EnergyUse= a valid value"), + TestStep("15a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("15b", "TH reads OptOutState attribute.", + "Verify value is 0x03 (OptOut)"), + TestStep("15c", "TH reads PowerAdjustmentCapability attribute.", + "Value has to include Cause=NoAdjustment."), + TestStep("16", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Test Event Clear", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("16a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("16b", "TH reads OptOutState attribute.", + "Verify value is 0x00 (NoOptOut)"), + TestStep("17", "TH sends PowerAdjustRequest with Power=PowerAdjustmentCapability[0].MaxPower, Duration=PowerAdjustmentCapability[0].MinDuration, Cause=LocalOptimization.", + "Verify DUT responds with status SUCCESS(0x00) and event DEM.S.E00(PowerAdjustStart) sent"), + TestStep("17a", "TH reads ESAState attribute.", + "Verify value is 0x04 (PowerAdjustActive)"), + TestStep("17b", "TH reads PowerAdjustmentCapability attribute.", + "Value has to include Cause=LocalOptimizationAdjustment."), + TestStep("18", "Wait 10 seconds.", + "Event DEM.S.E01(PowerAdjustEnd) sent with Cause=NormalCompletion, Duration=10s, EnergyUse= a valid value"), + TestStep("18a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("18b", "TH reads PowerAdjustmentCapability attribute.", + "Value has to include Cause=NoAdjustment."), + TestStep("19", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Power Adjustment Test Event Clear", + "Verify DUT responds with status SUCCESS(0x00)"), + ] + + return steps + + @async_test_body + async def test_TC_DEM_2_2(self): + # pylint: disable=too-many-locals, too-many-statements + """Run the test steps.""" + min_duration = 10 + max_duration = 60 + + self.step("1") + # Commission DUT - already done + + # Subscribe to Events and when they are sent push them to a queue for checking later + events_callback = EventChangeCallback(Clusters.DeviceEnergyManagement) + await events_callback.start(self.default_controller, + self.dut_node_id, + self.matter_test_config.endpoint) + + self.step("2") + await self.check_test_event_triggers_enabled() + + self.step("3") + await self.send_test_event_trigger_power_adjustment() + + self.step("3a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("3b") + powerAdjustCapabilityStruct = await self.read_dem_attribute_expect_success(attribute="PowerAdjustmentCapability") + asserts.assert_greater_equal(len(powerAdjustCapabilityStruct.powerAdjustCapability), 1) + logging.info(powerAdjustCapabilityStruct) + asserts.assert_equal(powerAdjustCapabilityStruct.cause, + Clusters.DeviceEnergyManagement.Enums.PowerAdjustReasonEnum.kNoAdjustment) + + # we should expect powerAdjustCapabilityStruct to have multiple entries with different max powers, min powers, max and min durations + min_power = sys.maxsize + max_power = 0 + min_duration = sys.maxsize + max_duration = 0 + + for entry in powerAdjustCapabilityStruct.powerAdjustCapability: + min_power = min(min_power, entry.minPower) + max_power = max(max_power, entry.maxPower) + min_duration = min(min_duration, entry.minDuration) + max_duration = max(max_duration, entry.maxDuration) + + result = f"min_power {min_power} max_power {max_power} min_duration {min_duration} max_duration {max_duration}" + logging.info(result) + + self.step("3c") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kNoOptOut) + + self.step("4") + await self.send_power_adjustment_command(power=powerAdjustCapabilityStruct.powerAdjustCapability[0].maxPower, + duration=powerAdjustCapabilityStruct.powerAdjustCapability[0].minDuration, + cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization) + + event_data = events_callback.wait_for_event_report(Clusters.DeviceEnergyManagement.Events.PowerAdjustStart) + + self.step("4a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kPowerAdjustActive) + + self.step("4b") + powerAdjustCapabilityStruct = await self.read_dem_attribute_expect_success(attribute="PowerAdjustmentCapability") + asserts.assert_greater_equal(len(powerAdjustCapabilityStruct.powerAdjustCapability), 1) + asserts.assert_equal(powerAdjustCapabilityStruct.cause, + Clusters.DeviceEnergyManagement.Enums.PowerAdjustReasonEnum.kLocalOptimizationAdjustment) + + self.step("5") + await self.send_cancel_power_adjustment_command() + event_data = events_callback.wait_for_event_report(Clusters.DeviceEnergyManagement.Events.PowerAdjustEnd) + asserts.assert_equal(event_data.cause, Clusters.DeviceEnergyManagement.Enums.CauseEnum.kCancelled) + + self.step("5a") + powerAdjustCapabilityStruct = await self.read_dem_attribute_expect_success(attribute="PowerAdjustmentCapability") + asserts.assert_equal(powerAdjustCapabilityStruct.cause, + Clusters.DeviceEnergyManagement.Enums.PowerAdjustReasonEnum.kNoAdjustment) + + self.step("5b") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("6") + await self.send_cancel_power_adjustment_command(expected_status=Status.InvalidInState) + + self.step("7") + await self.send_power_adjustment_command(power=max_power + 1, + duration=min_duration, + cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, + expected_status=Status.ConstraintError) + + self.step("8") + await self.send_power_adjustment_command(power=min_power, + duration=max_duration + 1, + cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, + expected_status=Status.ConstraintError) + + self.step("9") + await self.send_power_adjustment_command(power=min_power - 1, + duration=max_duration, + cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, + expected_status=Status.ConstraintError) + + self.step("10") + await self.send_power_adjustment_command(power=max_power, + duration=min_duration - 1, + cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, + expected_status=Status.ConstraintError) + + self.step("11") + start = datetime.datetime.now() + await self.send_power_adjustment_command(power=powerAdjustCapabilityStruct.powerAdjustCapability[0].minPower, + duration=min_duration, + cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization) + + event_data = events_callback.wait_for_event_report(Clusters.DeviceEnergyManagement.Events.PowerAdjustStart) + + self.step("11a") + powerAdjustCapabilityStruct = await self.read_dem_attribute_expect_success(attribute="PowerAdjustmentCapability") + asserts.assert_equal(powerAdjustCapabilityStruct.cause, + Clusters.DeviceEnergyManagement.Enums.PowerAdjustReasonEnum.kLocalOptimizationAdjustment) + + self.step("12") + await self.send_power_adjustment_command(power=powerAdjustCapabilityStruct.powerAdjustCapability[0].maxPower, + duration=powerAdjustCapabilityStruct.powerAdjustCapability[0].minDuration, + cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization) + + # Wait 5 seconds for an event not to be reported + events_callback.wait_for_event_expect_no_report(5) + + self.step("12a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kPowerAdjustActive) + + self.step("12b") + powerAdjustCapabilityStruct = await self.read_dem_attribute_expect_success(attribute="PowerAdjustmentCapability") + asserts.assert_equal(powerAdjustCapabilityStruct.cause, + Clusters.DeviceEnergyManagement.Enums.PowerAdjustReasonEnum.kGridOptimizationAdjustment) + + self.step("13") + await self.send_test_event_trigger_user_opt_out_local() + + self.step("13a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kPowerAdjustActive) + + self.step("13b") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kLocalOptOut) + + self.step("14") + await self.send_power_adjustment_command(power=max_power, + duration=powerAdjustCapabilityStruct.powerAdjustCapability[0].maxDuration, + cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, + expected_status=Status.ConstraintError) + + self.step("15") + await self.send_test_event_trigger_user_opt_out_grid() + event_data = events_callback.wait_for_event_report(Clusters.DeviceEnergyManagement.Events.PowerAdjustEnd) + asserts.assert_equal(event_data.cause, Clusters.DeviceEnergyManagement.Enums.CauseEnum.kUserOptOut) + + # Allow 3s error margin as the CI build system can run out of CPU time + elapsed = datetime.datetime.now() - start + asserts.assert_less_equal(abs(elapsed.seconds - event_data.duration), 3) + asserts.assert_greater_equal(event_data.energyUse, 0) + + self.step("15a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("15b") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kOptOut) + + self.step("15c") + powerAdjustCapabilityStruct = await self.read_dem_attribute_expect_success(attribute="PowerAdjustmentCapability") + asserts.assert_equal(powerAdjustCapabilityStruct.cause, + Clusters.DeviceEnergyManagement.Enums.PowerAdjustReasonEnum.kNoAdjustment) + + self.step("16") + await self.send_test_event_trigger_user_opt_out_clear_all() + + self.step("16a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("16b") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kNoOptOut) + + self.step("17") + await self.send_power_adjustment_command(power=powerAdjustCapabilityStruct.powerAdjustCapability[0].maxPower, + duration=powerAdjustCapabilityStruct.powerAdjustCapability[0].minDuration, + cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, + expected_status=Status.Success) + event_data = events_callback.wait_for_event_report(Clusters.DeviceEnergyManagement.Events.PowerAdjustStart) + + self.step("17a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kPowerAdjustActive) + + self.step("17b") + powerAdjustCapabilityStruct = await self.read_dem_attribute_expect_success(attribute="PowerAdjustmentCapability") + asserts.assert_equal(powerAdjustCapabilityStruct.cause, + Clusters.DeviceEnergyManagement.Enums.PowerAdjustReasonEnum.kLocalOptimizationAdjustment) + + self.step("18") + time.sleep(10) + + event_data = events_callback.wait_for_event_report(Clusters.DeviceEnergyManagement.Events.PowerAdjustEnd) + asserts.assert_equal(event_data.duration, 10) + asserts.assert_equal(event_data.cause, Clusters.DeviceEnergyManagement.Enums.CauseEnum.kNormalCompletion) + asserts.assert_greater(event_data.energyUse, 0) + + self.step("18a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("18b") + powerAdjustCapabilityStruct = await self.read_dem_attribute_expect_success(attribute="PowerAdjustmentCapability") + asserts.assert_equal(powerAdjustCapabilityStruct.cause, + Clusters.DeviceEnergyManagement.Enums.PowerAdjustReasonEnum.kNoAdjustment) + + self.step("19") + await self.send_test_event_trigger_power_adjustment_clear() + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_DEM_2_3.py b/src/python_testing/TC_DEM_2_3.py new file mode 100644 index 00000000000000..6bdd81c710a914 --- /dev/null +++ b/src/python_testing/TC_DEM_2_3.py @@ -0,0 +1,304 @@ +# +# 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. + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x7a +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +import logging + +import chip.clusters as Clusters +from chip.clusters.Types import NullValue +from chip.interaction_model import Status +from matter_testing_support import EventChangeCallback, MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts +from TC_DEMTestBase import DEMTestBase + +logger = logging.getLogger(__name__) + + +class TC_DEM_2_3(MatterBaseTest, DEMTestBase): + """Implementation of test case TC_DEM_2_3.""" + + def desc_TC_DEM_2_3(self) -> str: + """Returns a description of this test""" + return "4.1.3. [TC-DEM-2.3] Start Time Adjustment feature functionality with DUT as Server" + + def pics_TC_DEM_2_3(self): + """Return the PICS definitions associated with this test.""" + pics = [ + "DEM.S.F03", # Depends on F03(StartTimeAdjustment) + ] + return pics + + def steps_TC_DEM_2_3(self) -> list[TestStep]: + steps = [ + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.", + "Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Start Time Adjustment Test Event", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("3a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("3b", "TH reads Forecast attribute.", + "Value has to include EarliestStartTime<=StartTime, LatestEndTime>=EndTime, and ForecastUpdateReason=Internal Optimization"), + TestStep("3c", "TH reads OptOutState attribute.", + "Verify value is 0x00 (NoOptOut)"), + TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Local Optimization Test Event", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("4a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("4b", "TH reads OptOutState attribute.", + "Verify value is 0x01 (LocalOptOut)"), + TestStep("5", "TH sends StartTimeAdjustRequest with RequestedStartTime=EarliestStartTime from Forecast, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("5a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("5b", "TH reads Forecast attribute.", + "Value has to be unchanged from step 3b"), + TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Test Event Clear", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("6a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("6b", "TH reads OptOutState attribute.", + "Verify value is 0x00 (NoOptOut)"), + TestStep("7", "TH sends StartTimeAdjustRequest with RequestedStartTime=EarliestStartTime from Forecast, Cause=LocalOptimization.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("7a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("7b", "TH reads Forecast attribute.", + "Value has to include EarliestStartTime=StartTime, LatestEndTime>=EndTime, and ForecastUpdateReason=Local Optimization"), + TestStep("8", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Local Optimization Test Event", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("8a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("8b", "TH reads OptOutState attribute.", + "Verify value is 0x01 (LocalOptOut)"), + TestStep("8c", "TH reads Forecast attribute.", + "Value has to include EarliestStartTime<=StartTime, LatestEndTime>=EndTime, and ForecastUpdateReason=Internal Optimization"), + TestStep("9", "TH sends StartTimeAdjustRequest with RequestedStartTime=StartTime+(LatestEndTime-EndTime) from Forecast, Cause=GridOptimization.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("9a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("9b", "TH reads Forecast attribute.", + "Value has to include EarliestStartTime<=StartTime, LatestEndTime=EndTime, and ForecastUpdateReason=Grid Optimization"), + TestStep("10", "TH sends CancelRequest.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("10a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("10b", "TH reads Forecast attribute.", + "Value has to include EarliestStartTime<=StartTime, LatestEndTime>=EndTime, and ForecastUpdateReason=Internal Optimization"), + TestStep("11", "TH sends StartTimeAdjustRequest with RequestedStartTime=EarliestStartTime-1 from Forecast, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("11a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("11b", "TH reads Forecast attribute.", + "Value has to include StartTime and EndTime unchanged from step 10b"), + TestStep("12", "TH sends StartTimeAdjustRequest with RequestedStartTime=StartTime+(LatestEndTime-EndTime)+1 from Forecast, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("12a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("12b", "TH reads Forecast attribute.", + "Value has to include StartTime and EndTime unchanged from step 10b"), + TestStep("13", "TH sends CancelRequest.", + "Verify DUT responds with status INVALID_IN_STATE(0xcb)"), + TestStep("14", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Start Time Adjustment Test Event Clear", + "Verify DUT responds with status SUCCESS(0x00)"), + ] + + return steps + + @async_test_body + async def test_TC_DEM_2_3(self): + + logging.info(Clusters.Objects.DeviceEnergyManagement.Attributes.FeatureMap) + + self.step("1") + # Commission DUT - already done + + # Subscribe to Events and when they are sent push them to a queue for checking later + events_callback = EventChangeCallback(Clusters.DeviceEnergyManagement) + await events_callback.start(self.default_controller, + self.dut_node_id, + self.matter_test_config.endpoint) + + self.step("2") + await self.check_test_event_triggers_enabled() + + self.step("3") + await self.send_test_event_trigger_start_time_adjustment() + + self.step("3a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("3b") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + + asserts.assert_not_equal(forecast, NullValue) + asserts.assert_less_equal(forecast.earliestStartTime, forecast.startTime, + f"Expected forecast earliestStartTime {forecast.earliestStartTime} to be <= startTime {forecast.startTime}") + asserts.assert_greater_equal(forecast.latestEndTime, forecast.endTime, + f"Expected forecast latestEndTime {forecast.latestEndTime} to be >= endTime {forecast.endTime}") + asserts.assert_equal(forecast.forecastUpdateReason, Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization, + f"Expected forecast forecastUpdateReason {forecast.forecastUpdateReason} to be == Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization") + + self.print_forecast(forecast) + + self.step("3c") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kNoOptOut) + + self.step("4") + await self.send_test_event_trigger_user_opt_out_local() + + self.step("4a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("4b") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kLocalOptOut) + + self.step("5") + await self.send_start_time_adjust_request_command(requestedStartTime=forecast.earliestStartTime, + cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, + expected_status=Status.ConstraintError) + + self.step("5a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("5b") + forecast2 = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast, forecast2, + f"Expected same forcast {forecast} to be == {forecast2}") + + self.step("6") + await self.send_test_event_trigger_user_opt_out_clear_all() + + self.step("6a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("6b") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kNoOptOut) + + self.step("7") + await self.send_start_time_adjust_request_command(requestedStartTime=forecast.earliestStartTime, + cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization) + + self.step("7a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("7b") + forecast3 = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast3.earliestStartTime, forecast3.startTime, + f"Expected earliestStartTime {forecast3.earliestStartTime} to be == startTime {forecast3.startTime}") + asserts.assert_greater_equal(forecast3.latestEndTime, forecast3.endTime, + f"Expected latestEndTime {forecast3.latestEndTime} to be >= endTime {forecast3.endTime}") + asserts.assert_equal(forecast3.forecastUpdateReason, Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kLocalOptimization, + f"Expected forecastUpdateReason {forecast3.forecastUpdateReason} to be == LocalOptimization {Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kLocalOptimization}") + + self.step("8") + await self.send_test_event_trigger_user_opt_out_local() + + self.step("8a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("8b") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kLocalOptOut) + + self.step("8c") + forecast4 = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_less_equal(forecast4.earliestStartTime, forecast4.startTime, + f"Expected earliestStartTime {forecast4.earliestStartTime} to be <= startTime {forecast4.startTime}") + asserts.assert_greater_equal(forecast4.latestEndTime, forecast4.endTime, + f"Expected forecast latestEndTime {forecast4.latestEndTime} to be >= endTime {forecast4.endTime}") + asserts.assert_equal(forecast4.forecastUpdateReason, Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization, + f"Expected forecastUpdateReason {forecast4.forecastUpdateReason} to be == InternalOptimization {Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization}") + + self.step("9") + await self.send_start_time_adjust_request_command(requestedStartTime=forecast4.startTime+forecast4.latestEndTime - forecast4.endTime, + cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization) + + self.step("9a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("9b") + forecast5 = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_less_equal(forecast5.earliestStartTime, forecast5.startTime, + f"Expected earliestStartTime {forecast5.earliestStartTime} to be <= startTime {forecast5.startTime}") + asserts.assert_equal(forecast5.latestEndTime, forecast5.endTime, + f"Expected latestEndTime {forecast5.latestEndTime} to be == endTime {forecast5.endTime}") + asserts.assert_equal(forecast5.forecastUpdateReason, Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kGridOptimization, + f"Expected forecastUpdateReason {forecast5.forecastUpdateReason} to be == GridOptimization {Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kGridOptimization}") + + self.step("10") + await self.send_cancel_request_command() + + self.step("10a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("10b") + forecast6 = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_less_equal(forecast6.earliestStartTime, forecast6.startTime, + f"Expected earliestStartTime {forecast6.earliestStartTime} to be <= startTime {forecast6.startTime}") + asserts.assert_greater_equal(forecast6.latestEndTime, forecast6.endTime, + f"Expected latestEndTime {forecast6.latestEndTime} to be >= endTime {forecast6.endTime}") + asserts.assert_equal(forecast6.forecastUpdateReason, Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization, + f"Expected forecastUpdateReason {forecast6.forecastUpdateReason} to be == InternalOptimization {Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization}") + + self.step("11") + await self.send_start_time_adjust_request_command(requestedStartTime=forecast6.earliestStartTime - 1, + cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, + expected_status=Status.ConstraintError) + self.step("11a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("11b") + forecast7 = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast6.startTime, forecast7.startTime, + f"Expected old startTime {forecast6.startTime} to be == startTime {forecast7.startTime}") + asserts.assert_equal(forecast6.endTime, forecast7.endTime, + f"Expected old endTime {forecast6.endTime} to be == endTime {forecast7.endTime}") + + self.step("12") + await self.send_start_time_adjust_request_command(requestedStartTime=forecast7.startTime+(forecast7.latestEndTime-forecast7.endTime)+1, + cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, + expected_status=Status.ConstraintError) + self.step("12a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("12b") + forecast8 = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast7.startTime, forecast8.startTime, + f"Expected old startTime {forecast7.startTime} to be == startTime {forecast8.startTime}") + asserts.assert_equal(forecast7.endTime, forecast8.endTime, + f"Expected old endTime {forecast7.endTime} to be == endTime {forecast8.endTime}") + + self.step("13") + await self.send_cancel_request_command(expected_status=Status.InvalidInState) + + self.step("14") + await self.send_test_event_trigger_start_time_adjustment_clear() + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_DEM_2_4.py b/src/python_testing/TC_DEM_2_4.py new file mode 100644 index 00000000000000..390889fc9f2d28 --- /dev/null +++ b/src/python_testing/TC_DEM_2_4.py @@ -0,0 +1,364 @@ +# +# 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. + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x7a +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +import logging +import time + +import chip.clusters as Clusters +from chip.clusters.Types import NullValue +from chip.interaction_model import Status +from matter_testing_support import EventChangeCallback, MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts +from TC_DEMTestBase import DEMTestBase + +logger = logging.getLogger(__name__) + + +class TC_DEM_2_4(MatterBaseTest, DEMTestBase): + """Implementation of test case TC_DEM_2_4.""" + + def desc_TC_DEM_2_4(self) -> str: + """Returns a description of this test""" + return "4.1.3. [TC-DEM-2.4] Pausable feature functionality with DUT as Server" + + def pics_TC_DEM_2_4(self): + """Return the PICS definitions associated with this test.""" + pics = [ + "DEM.S.F04", # Depends on F04(Pausable) + ] + return pics + + def steps_TC_DEM_2_4(self) -> list[TestStep]: + steps = [ + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.", + "Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Pausable Test Event", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("3a", "TH reads ESAState.", + "Verify value is 0x01 (Online)"), + TestStep("3b", "TH reads Forecast.", + "Value has to include IsPausable=True, slot[0].SlotIsPausable=True, slot[0].MinPauseDuration>1, slot[0].MaxPauseDuration>1, slot[1].SlotIsPausable=False, ActiveSlotNumber=0, and ForecastUpdateReason=Internal Optimization"), + TestStep("3c", "TH reads OptOutState.", + "Verify value is 0x00 (NoOptOut)"), + TestStep("4", "TH sends PauseRequest with Duration=Forecast.slots[0].MinPauseDuration-1, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("4a", "TH reads ESAState.", + "Verify value is 0x01 (Online)"), + TestStep("5", "TH sends PauseRequest with Duration=Forecast.slots[0].MaxPauseDuration+1, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("5a", "TH reads ESAState.", + "Verify value is 0x01 (Online)"), + TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Grid Optimization Test Event", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("6a", "TH reads ESAState.", + "Verify value is 0x01 (Online)"), + TestStep("6b", "TH reads OptOutState.", + "Verify value is 0x02 (GridOptOut)"), + TestStep("7", "TH sends PauseRequest with Duration=Forecast.slots[0].MinPauseDuration, Cause=GridOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("7a", "TH reads ESAState.", + "Verify value is 0x01 (Online)"), + TestStep("8", "TH sends PauseRequest with Duration=Forecast.slots[0].MinPauseDuration, Cause=LocalOptimization.", + "Verify DUT responds with status SUCCESS(0x00) and event DEM.S.E02(Paused) sent"), + TestStep("8a", "TH reads ESAState.", + "Verify value is 0x05 (Paused)"), + TestStep("9", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Local Optimization Test Event.", + "Verify DUT responds with status SUCCESS(0x00) and event DEM.S.E03(Resumed) sent with Cause=3 (UserOptOut)"), + TestStep("9a", "TH reads ESAState.", + "Verify value is 0x01 (Online)"), + TestStep("9b", "TH reads OptOutState.", + "Verify value is 0x03 (OptOut)"), + TestStep("9c", "TH reads Forecast.", + "Value has to include ForecastUpdateReason=Internal Optimization"), + TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Test Event Clear", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("10a", "TH reads ESAState.", + "Verify value is 0x01 (Online)"), + TestStep("10b", "TH reads OptOutState.", + "Verify value is 0x00 (NoOptOut)"), + TestStep("11", "TH sends PauseRequest with Duration=Forecast.slots[0].MinPauseDuration, Cause=LocalOptimization.", + "Verify DUT responds with status SUCCESS(0x00) and event DEM.S.E02(Paused) sent"), + TestStep("11a", "TH reads ESAState.", + "Verify value is 0x05 (Paused)"), + TestStep("11b", "TH reads Forecast.", + "Value has to include ForecastUpdateReason=Local Optimization"), + TestStep("12", "TH sends ResumeRequest.", + "Verify DUT responds with status SUCCESS(0x00) and event DEM.S.E03(Resumed) sent with Cause=4 (Cancelled)"), + TestStep("12a", "TH reads ESAState.", + "Verify value is 0x01 (Online)"), + TestStep("12b", "TH reads Forecast.", + "Value has to include IsPausable=True, slots[0].SlotIsPausable=True, slots[0].MinPauseDuration>1, slots[0].MaxPauseDuration>1, slots[1].SlotIsPausable=False, ActiveSlotNumber=0, ForecastUpdateReason=Internal Optimization"), + TestStep("13", "TH sends PauseRequest with Duration=Forecast.slots[0].MinPauseDuration, Cause=LocalOptimization.", + "Verify DUT responds with status SUCCESS(0x00) and event DEM.S.E02(Paused) sent"), + TestStep("13a", "TH reads ESAState.", + "Verify value is 0x05 (Paused)"), + TestStep("13b", "TH reads Forecast.", + "Value has to include ForecastUpdateReason=Local Optimization"), + TestStep("14", "TH sends ResumeRequest.", + "Verify DUT responds with status SUCCESS(0x00) and event DEM.S.E03(Resumed) sent with Cause=4 (Cancelled)"), + TestStep("14a", "TH reads ESAState.", + "Verify value is 0x01 (Online)"), + TestStep("15", "TH sends PauseRequest with Duration=Forecast.slots[0].MinPauseDuration, Cause=LocalOptimization.", + "Verify DUT responds with status SUCCESS(0x00) and event DEM.S.E02(Paused) sent"), + TestStep("15a", "TH reads ESAState.", + "Verify value is 0x05 (Paused)"), + TestStep("16", "Wait for minPauseDuration.", + "Event DEM.S.E03(Resumed) sent with Cause=0 (NormalCompletion)"), + TestStep("16a", "TH reads ESAState.", + "Verify value is 0x01 (Online)"), + TestStep("17", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Pausable Test Event Next Slot.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("17a", "TH reads ESAState.", + "Verify value is 0x01 (Online)"), + TestStep("17b", "TH reads Forecast.", + "Value has to include ActiveSlotNumber=1"), + TestStep("18", "TH sends PauseRequest with Duration=Forecast.slots[0].MinPauseDuration, Cause=LocalOptimization.", + "Verify DUT responds with status FAILURE(0x01)"), + TestStep("18a", "TH reads ESAState.", + "Verify value is 0x01 (Online)"), + TestStep("19", "TH sends ResumeRequest.", + "Verify DUT responds with status INVALID_IN_STATE(0xcb)"), + TestStep("20", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Pausable Test Event Clear.", + "Verify DUT responds with status SUCCESS(0x00)"), + ] + + return steps + + @async_test_body + async def test_TC_DEM_2_4(self): + + logging.info(Clusters.Objects.DeviceEnergyManagement.Attributes.FeatureMap) + + self.step("1") + # Commission DUT - already done + + # Subscribe to Events and when they are sent push them to a queue for checking later + events_callback = EventChangeCallback(Clusters.DeviceEnergyManagement) + await events_callback.start(self.default_controller, + self.dut_node_id, + self.matter_test_config.endpoint) + + self.step("2") + await self.check_test_event_triggers_enabled() + + self.step("3") + await self.send_test_event_trigger_pausable() + + self.step("3a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("3b") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + + asserts.assert_not_equal(forecast, NullValue) + asserts.assert_equal(forecast.isPausable, True) + asserts.assert_greater(forecast.slots[0].minPauseDuration, 1) + asserts.assert_greater(forecast.slots[0].maxPauseDuration, 1) + asserts.assert_equal(forecast.slots[0].slotIsPausable, True) + asserts.assert_equal(forecast.slots[1].slotIsPausable, False) + asserts.assert_equal(forecast.activeSlotNumber, 0) + + asserts.assert_less_equal(forecast.earliestStartTime, forecast.startTime, + f"Expected forecast earliestStartTime {forecast.earliestStartTime} to be <= startTime {forecast.startTime}") + asserts.assert_greater_equal(forecast.latestEndTime, forecast.endTime, + f"Expected forecast latestEndTime {forecast.latestEndTime} to be >= endTime {forecast.endTime}") + asserts.assert_equal(forecast.forecastUpdateReason, Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization, + f"Expected forecast forecastUpdateReason {forecast.forecastUpdateReason} to be == Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization") + self.print_forecast(forecast) + + self.step("3c") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kNoOptOut) + + self.step("4") + await self.send_pause_request_command(forecast.slots[0].minPauseDuration - 1, + Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, + expected_status=Status.ConstraintError) + + self.step("4a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("5") + await self.send_pause_request_command(forecast.slots[0].maxPauseDuration + 1, + Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, + expected_status=Status.ConstraintError) + + self.step("5a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("6") + await self.send_test_event_trigger_user_opt_out_grid() + + self.step("6a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("6b") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kGridOptOut) + + self.step("7") + await self.send_pause_request_command(forecast.slots[0].minPauseDuration, + Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, + expected_status=Status.ConstraintError) + + self.step("7a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("8") + await self.send_pause_request_command(forecast.slots[0].minPauseDuration, + Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization) + + event_data = events_callback.wait_for_event_report(Clusters.DeviceEnergyManagement.Events.Paused) + + self.step("8a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kPaused) + + self.step("9") + await self.send_test_event_trigger_user_opt_out_local() + event_data = events_callback.wait_for_event_report(Clusters.DeviceEnergyManagement.Events.Resumed) + asserts.assert_equal(event_data.cause, Clusters.DeviceEnergyManagement.Enums.CauseEnum.kUserOptOut) + + self.step("9a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("9b") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kOptOut) + + self.step("9c") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + + asserts.assert_not_equal(forecast, NullValue) + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization) + + self.step("10") + await self.send_test_event_trigger_user_opt_out_clear_all() + + self.step("10a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("10b") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kNoOptOut) + + self.step("11") + await self.send_pause_request_command(forecast.slots[0].minPauseDuration, + Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization) + event_data = events_callback.wait_for_event_report(Clusters.DeviceEnergyManagement.Events.Paused) + + self.step("11a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kPaused) + + self.step("11b") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kLocalOptimization) + + self.step("12") + await self.send_resume_request_command() + event_data = events_callback.wait_for_event_report(Clusters.DeviceEnergyManagement.Events.Resumed) + asserts.assert_equal(event_data.cause, Clusters.DeviceEnergyManagement.Enums.CauseEnum.kCancelled) + + self.step("12a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("12b") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.isPausable, True) + asserts.assert_greater(forecast.slots[0].minPauseDuration, 1) + asserts.assert_greater(forecast.slots[0].maxPauseDuration, 1) + asserts.assert_equal(forecast.slots[0].slotIsPausable, True) + asserts.assert_equal(forecast.slots[1].slotIsPausable, False) + asserts.assert_equal(forecast.activeSlotNumber, 0) + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization) + + self.step("13") + await self.send_pause_request_command(forecast.slots[0].minPauseDuration, + Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization) + event_data = events_callback.wait_for_event_report(Clusters.DeviceEnergyManagement.Events.Paused) + + self.step("13a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kPaused) + + self.step("13b") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kLocalOptimization) + + self.step("14") + await self.send_resume_request_command() + event_data = events_callback.wait_for_event_report(Clusters.DeviceEnergyManagement.Events.Resumed) + asserts.assert_equal(event_data.cause, Clusters.DeviceEnergyManagement.Enums.CauseEnum.kCancelled) + + self.step("14a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("15") + await self.send_pause_request_command(forecast.slots[0].minPauseDuration, + Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization) + event_data = events_callback.wait_for_event_report(Clusters.DeviceEnergyManagement.Events.Paused) + + self.step("15a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kPaused) + + self.step("16") + logging.info(f"Sleeping for forecast.slots[0].minPauseDuration {forecast.slots[0].minPauseDuration}s") + time.sleep(forecast.slots[0].minPauseDuration) + event_data = events_callback.wait_for_event_report(Clusters.DeviceEnergyManagement.Events.Resumed) + asserts.assert_equal(event_data.cause, Clusters.DeviceEnergyManagement.Enums.CauseEnum.kNormalCompletion) + + self.step("16a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("17") + await self.send_test_event_trigger_pausable_next_slot() + + self.step("17a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("17b") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.activeSlotNumber, 1) + + self.step("18") + await self.send_pause_request_command(forecast.slots[0].minPauseDuration, + Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, + expected_status=Status.Failure) + + self.step("18a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("19") + await self.send_resume_request_command(expected_status=Status.InvalidInState) + + self.step("20") + await self.send_test_event_trigger_user_opt_out_clear_all() + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_DEM_2_5.py b/src/python_testing/TC_DEM_2_5.py new file mode 100644 index 00000000000000..85d3cd779b22f4 --- /dev/null +++ b/src/python_testing/TC_DEM_2_5.py @@ -0,0 +1,306 @@ +# +# 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. +# pylint: disable=invalid-name + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x7a +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +"""Define Matter test case TC_DEM_2_5.""" + + +import logging + +import chip.clusters as Clusters +from chip.interaction_model import Status +from matter_testing_support import EventChangeCallback, MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts +from TC_DEMTestBase import DEMTestBase + +logger = logging.getLogger(__name__) + + +class TC_DEM_2_5(MatterBaseTest, DEMTestBase): + """Implementation of test case TC_DEM_2_5.""" + + def desc_TC_DEM_2_5(self) -> str: + """Return a description of this test.""" + return "4.1.3. [TC-DEM-2.5] Forecast Adjustment with Power Forecast Reporting feature functionality with DUT as Server" + + def pics_TC_DEM_2_5(self): + """Return the PICS definitions associated with this test.""" + pics = [ + # Depends on Feature 05 (ForecastAdjustment) & Feature 01 (PowerForecastReporting) + "DEM.S.F05", "DEM.S.F01" + ] + return pics + + def steps_TC_DEM_2_5(self) -> list[TestStep]: + """Execute the test steps.""" + steps = [ + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.", + "Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Forecast Adjustment Test Event", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("3a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("3b", "TH reads Forecast attribute.", + "Value has to include slots[0].MinPowerAdjustment, slots[0].MaxPowerAdjustment, slots[0].MinDurationAdjustment, slots[0].MaxDurationAdjustment"), + TestStep("3c", "TH reads OptOutState attribute.", + "Verify value is 0x00 (NoOptOut)"), + TestStep("4", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID+1, SlotAdjustments[0].{SlotIndex=0, NominalPower=Forecast.Slots[0].MinPowerAdjustment, Duration=Forecast.Slots[0].MaxDurationAdjustment}, Cause=GridOptimization.", + "Verify DUT responds with status FAILURE(0x01)"), + TestStep("5", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=4, NominalPower=Forecast.Slots[0].MinPowerAdjustment, Duration=Forecast.Slots[0].MaxDurationAdjustment}, Cause=GridOptimization.", + "Verify DUT responds with status FAILURE(0x01)"), + TestStep("6", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, NominalPower=Forecast.Slots[0].MinPowerAdjustment-1, Duration=Forecast.Slots[0].MaxDurationAdjustment}, Cause=GridOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("7", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, NominalPower=Forecast.Slots[0].MaxPowerAdjustment+1, Duration=Forecast.Slots[0].MinDurationAdjustment}, Cause=GridOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("8", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, NominalPower=Forecast.Slots[0].MinPowerAdjustment, Duration=Forecast.Slots[0].MaxDurationAdjustment+1}, Cause=GridOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("9", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, NominalPower=Forecast.Slots[0].MaxPowerAdjustment, Duration=Forecast.Slots[0].MinDurationAdjustment-1}, Cause=GridOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("10", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, NominalPower=Forecast.Slots[0].MinPowerAdjustment, Duration=Forecast.Slots[0].MaxDurationAdjustment}, SlotAdjustments[1].{SlotIndex=4, NominalPower=Forecast.Slots[0].MinPowerAdjustment, Duration=Forecast.Slots[0].MaxDurationAdjustment}, Cause=GridOptimization.", + "Verify DUT responds with status FAILURE(0x01)"), + TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Local Optimization Test Event", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("11a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("11b", "TH reads OptOutState attribute.", + "Verify value is 0x02 (LocalOptOut)"), + TestStep("12", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, NominalPower=Forecast.Slots[0].MinPowerAdjustment, Duration=Forecast.Slots[0].MaxDurationAdjustment}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("13", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, NominalPower=Forecast.Slots[0].MinPowerAdjustment, Duration=Forecast.Slots[0].MaxDurationAdjustment}, Cause=GridOptimization.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("13a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=GridOptimization"), + TestStep("14", "TH sends CancelRequest.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("14a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=InternalOptimization"), + TestStep("15", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, NominalPower=Forecast.Slots[0].MinPowerAdjustment, Duration=Forecast.Slots[0].MaxDurationAdjustment}, Cause=GridOptimization.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("15a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=GridOptimization"), + TestStep("16", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Grid Optimization Test Event", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("16a", "TH reads OptOutState attribute.", + "Verify value is 0x03 (OptOut)"), + TestStep("16b", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=Internal Optimization"), + TestStep("17", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, NominalPower=Forecast.Slots[0].MinPowerAdjustment, Duration=Forecast.Slots[0].MaxDurationAdjustment}, Cause=GridOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("18", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Test Event Clear", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("18a", "TH reads OptOutState attribute.", + "Verify value is 0x00 (NoOptOut)"), + TestStep("19", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, NominalPower=Forecast.Slots[0].MaxPowerAdjustment, Duration=Forecast.Slots[0].MinDurationAdjustment}, Cause=LocalOptimization.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("19a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=LocalOptimization"), + TestStep("20", "TH sends CancelRequest.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("20a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=InternalOptimization"), + TestStep("21", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Forecast Adjustment Test Event Next Slot", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("22", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, NominalPower=Forecast.Slots[0].MaxPowerAdjustment, Duration=Forecast.Slots[0].MinDurationAdjustment}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("23", "TH sends CancelRequest.", + "Verify DUT responds with status INVALID_IN_STATE(0xcb)"), + TestStep("24", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Forecast Adjustment Test Event Clear", + "Verify DUT responds with status SUCCESS(0x00)"), + ] + + return steps + + @async_test_body + async def test_TC_DEM_2_5(self): + # pylint: disable=too-many-locals, too-many-statements + """Run the test steps.""" + self.step("1") + # Commission DUT - already done + + # Subscribe to Events and when they are sent push them to a queue for checking later + events_callback = EventChangeCallback(Clusters.DeviceEnergyManagement) + await events_callback.start(self.default_controller, + self.dut_node_id, + self.matter_test_config.endpoint) + + self.step("2") + await self.check_test_event_triggers_enabled() + + self.step("3") + await self.send_test_event_trigger_forecast_adjustment() + + self.step("3a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("3b") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + + asserts.assert_is_not_none(forecast.slots[0].minPowerAdjustment) + asserts.assert_is_not_none(forecast.slots[0].maxPowerAdjustment) + asserts.assert_is_not_none(forecast.slots[0].minDurationAdjustment) + asserts.assert_is_not_none(forecast.slots[0].maxDurationAdjustment) + + self.step("3c") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kNoOptOut) + + self.step("4") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, nominalPower=forecast.slots[0].minPowerAdjustment, duration=forecast.slots[0].maxDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID + 1, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.Failure) + + self.step("5") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=4, nominalPower=forecast.slots[0].minPowerAdjustment, duration=forecast.slots[0].maxDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.Failure) + + self.step("6") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, nominalPower=forecast.slots[0].minPowerAdjustment - 1, duration=forecast.slots[0].maxDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.ConstraintError) + + self.step("7") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, nominalPower=forecast.slots[0].maxPowerAdjustment + 1, duration=forecast.slots[0].minDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.ConstraintError) + + self.step("8") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, nominalPower=forecast.slots[0].minPowerAdjustment, duration=forecast.slots[0].maxDurationAdjustment + 1)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.ConstraintError) + + self.step("9") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, nominalPower=forecast.slots[0].maxPowerAdjustment, duration=forecast.slots[0].minDurationAdjustment - 1)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.ConstraintError) + + self.step("10") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct(slotIndex=0, nominalPower=forecast.slots[0].minPowerAdjustment, duration=forecast.slots[0].maxDurationAdjustment), + Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct(slotIndex=4, nominalPower=forecast.slots[0].minPowerAdjustment, duration=forecast.slots[0].maxDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.Failure) + + self.step("11") + await self.send_test_event_trigger_user_opt_out_local() + + self.step("11a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("11b") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kLocalOptOut) + + self.step("12") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, nominalPower=forecast.slots[0].minPowerAdjustment, duration=forecast.slots[0].maxDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("13") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, nominalPower=forecast.slots[0].minPowerAdjustment, duration=forecast.slots[0].maxDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.Success) + + self.step("13a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kGridOptimization) + + self.step("14") + await self.send_cancel_request_command() + + self.step("14a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization) + + self.step("15") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, nominalPower=forecast.slots[0].minPowerAdjustment, duration=forecast.slots[0].maxDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.Success) + + self.step("15a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kGridOptimization) + + self.step("16") + await self.send_test_event_trigger_user_opt_out_grid() + + self.step("16a") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kOptOut) + + self.step("16b") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization) + + self.step("17") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, nominalPower=forecast.slots[0].minPowerAdjustment, duration=forecast.slots[0].maxDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.ConstraintError) + + self.step("18") + await self.send_test_event_trigger_user_opt_out_clear_all() + + self.step("18a") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kNoOptOut) + + self.step("19") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, nominalPower=forecast.slots[0].minPowerAdjustment, duration=forecast.slots[0].minDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.Success) + + self.step("19a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kLocalOptimization) + + self.step("20") + await self.send_cancel_request_command() + + self.step("20a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization) + + self.step("21") + await self.send_test_event_trigger_forecast_adjustment_next_slot() + + self.step("22") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, nominalPower=forecast.slots[0].minPowerAdjustment, duration=forecast.slots[0].minDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("23") + await self.send_cancel_request_command(expected_status=Status.InvalidInState) + + self.step("24") + await self.send_test_event_trigger_forecast_adjustment_clear() + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_DEM_2_6.py b/src/python_testing/TC_DEM_2_6.py new file mode 100644 index 00000000000000..7390436effd937 --- /dev/null +++ b/src/python_testing/TC_DEM_2_6.py @@ -0,0 +1,290 @@ +# +# 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. +# pylint: disable=invalid-name + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x7c +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +"""Define Matter test case TC_DEM_2_6.""" + + +import logging + +import chip.clusters as Clusters +from chip.interaction_model import Status +from matter_testing_support import EventChangeCallback, MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts +from TC_DEMTestBase import DEMTestBase + +logger = logging.getLogger(__name__) + + +class TC_DEM_2_6(MatterBaseTest, DEMTestBase): + """Implementation of test case TC_DEM_2_6.""" + + def desc_TC_DEM_2_6(self) -> str: + """Return a description of this test.""" + return "4.1.3. [TC-DEM-2.6] Forecast Adjustment with State Forecast Reporting feature functionality with DUT as Server" + + def pics_TC_DEM_2_6(self): + """Return the PICS definitions associated with this test.""" + pics = [ + # Depends on Feature 05 (ForecastAdjustment) & Feature 02 (StateForecastReporting) + "DEM.S.F05", "DEM.S.F02" + ] + return pics + + def steps_TC_DEM_2_6(self) -> list[TestStep]: + """Execute the test steps.""" + steps = [ + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.", + "Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Forecast Adjustment Test Event", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("3a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("3b", "TH reads Forecast attribute.", + "Value has to include slots[0].MinDurationAdjustment, slots[0].MaxDurationAdjustment"), + TestStep("3c", "TH reads OptOutState attribute.", + "Verify value is 0x00 (NoOptOut)"), + TestStep("4", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID+1, SlotAdjustments[0].{SlotIndex=0, Duration=Forecast.Slots[0].MaxDurationAdjustment}, Cause=GridOptimization.", + "Verify DUT responds with status FAILURE(0x01)"), + TestStep("5", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=4, Duration=Forecast.Slots[0].MaxDurationAdjustment}, Cause=GridOptimization.", + "Verify DUT responds with status FAILURE(0x01)"), + TestStep("6", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, Duration=Forecast.Slots[0].MaxDurationAdjustment+1}, Cause=GridOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("7", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, Duration=Forecast.Slots[0].MinDurationAdjustment-1}, Cause=GridOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("8", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, Duration=Forecast.Slots[0].MaxDurationAdjustment}, SlotAdjustments[1].{SlotIndex=4, Duration=Forecast.Slots[0].MaxDurationAdjustment}, Cause=GridOptimization.", + "Verify DUT responds with status FAILURE(0x01)"), + TestStep("9", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Local Optimization Test Event", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("9a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("9b", "TH reads OptOutState attribute.", + "Verify value is 0x02 (LocalOptOut)"), + TestStep("10", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, Duration=Forecast.Slots[0].MaxDurationAdjustment}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("11", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, Duration=Forecast.Slots[0].MaxDurationAdjustment}, Cause=GridOptimization.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("11a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=GridOptimization"), + TestStep("12", "TH sends CancelRequest.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("12a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=InternalOptimization"), + TestStep("13", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, Duration=Forecast.Slots[0].MaxDurationAdjustment}, Cause=GridOptimization.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("13a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=GridOptimization"), + TestStep("14", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Grid Optimization Test Event", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("14a", "TH reads OptOutState attribute.", + "Verify value is 0x03 (OptOut)"), + TestStep("14b", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=Internal Optimization"), + TestStep("15", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, Duration=Forecast.Slots[0].MaxDurationAdjustment}, Cause=GridOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("16", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Test Event Clear", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("16a", "TH reads OptOutState attribute.", + "Verify value is 0x00 (NoOptOut)"), + TestStep("17", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, Duration=Forecast.Slots[0].MinDurationAdjustment}, Cause=LocalOptimization.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("17a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=LocalOptimization"), + TestStep("18", "TH sends CancelRequest.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("18a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=InternalOptimization"), + TestStep("19", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Forecast Adjustment Test Event Next Slot", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("20", "TH sends ModifyForecastRequest with ForecastID=Forecast.ForecastID, SlotAdjustments[0].{SlotIndex=0, Duration=Forecast.Slots[0].MinDurationAdjustment}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("21", "TH sends CancelRequest.", + "Verify DUT responds with status INVALID_IN_STATE(0xcb)"), + TestStep("22", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Forecast Adjustment Test Event Clear", + "Verify DUT responds with status SUCCESS(0x00)"), + ] + + return steps + + @async_test_body + async def test_TC_DEM_2_6(self): + # pylint: disable=too-many-locals, too-many-statements + """Run the test steps.""" + self.step("1") + # Commission DUT - already done + + # Subscribe to Events and when they are sent push them to a queue for checking later + events_callback = EventChangeCallback(Clusters.DeviceEnergyManagement) + await events_callback.start(self.default_controller, + self.dut_node_id, + self.matter_test_config.endpoint) + + self.step("2") + await self.check_test_event_triggers_enabled() + + self.step("3") + await self.send_test_event_trigger_forecast_adjustment() + + self.step("3a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("3b") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_is_not_none(forecast.slots[0].minDurationAdjustment) + asserts.assert_is_not_none(forecast.slots[0].maxDurationAdjustment) + + self.step("3c") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kNoOptOut) + + self.step("4") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, duration=forecast.slots[0].maxDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID + 1, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.Failure) + + self.step("5") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=4, duration=forecast.slots[0].maxDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.Failure) + + self.step("6") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, duration=forecast.slots[0].maxDurationAdjustment + 1)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.ConstraintError) + + self.step("7") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, duration=forecast.slots[0].minDurationAdjustment - 1)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.ConstraintError) + + self.step("8") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct(slotIndex=0, duration=forecast.slots[0].maxDurationAdjustment), + Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct(slotIndex=4, duration=forecast.slots[0].maxDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.Failure) + + self.step("9") + await self.send_test_event_trigger_user_opt_out_local() + + self.step("9a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("9b") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kLocalOptOut) + + self.step("10") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, duration=forecast.slots[0].maxDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("11") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, duration=forecast.slots[0].maxDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.Success) + + self.step("11a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + logging.info(forecast) + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kGridOptimization) + + self.step("12") + await self.send_cancel_request_command() + + self.step("12a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization) + + self.step("13") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, duration=forecast.slots[0].maxDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.Success) + + self.step("13a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kGridOptimization) + + self.step("14") + await self.send_test_event_trigger_user_opt_out_grid() + + self.step("14a") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kOptOut) + + self.step("14b") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization) + + self.step("15") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, duration=forecast.slots[0].maxDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.ConstraintError) + + self.step("16") + await self.send_test_event_trigger_user_opt_out_clear_all() + + self.step("16a") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kNoOptOut) + + self.step("17") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, duration=forecast.slots[0].minDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.Success) + + self.step("17a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kLocalOptimization) + + self.step("18") + await self.send_cancel_request_command() + + self.step("18a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization) + + self.step("19") + await self.send_test_event_trigger_forecast_adjustment_next_slot() + + self.step("20") + slotAdjustments = [Clusters.DeviceEnergyManagement.Structs.SlotAdjustmentStruct( + slotIndex=0, duration=forecast.slots[0].minDurationAdjustment)] + await self.send_modify_forecast_request_command(forecast.forecastID, slotAdjustments, Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("21") + await self.send_cancel_request_command(expected_status=Status.InvalidInState) + + self.step("22") + await self.send_test_event_trigger_forecast_adjustment_clear() + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_DEM_2_7.py b/src/python_testing/TC_DEM_2_7.py new file mode 100644 index 00000000000000..fa7dba14a53315 --- /dev/null +++ b/src/python_testing/TC_DEM_2_7.py @@ -0,0 +1,345 @@ +# +# 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. +# pylint: disable=invalid-name + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x7a +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +"""Define Matter test case TC_DEM_2_7.""" + + +import logging + +import chip.clusters as Clusters +from chip.interaction_model import Status +from matter_testing_support import EventChangeCallback, MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts +from TC_DEMTestBase import DEMTestBase + +logger = logging.getLogger(__name__) + + +class TC_DEM_2_7(MatterBaseTest, DEMTestBase): + """Implementation of test case TC_DEM_2_7.""" + + def desc_TC_DEM_2_7(self) -> str: + """Return a description of this test.""" + return "4.1.3. [TC-DEM-2.7] Constraints-based Adjustment with Power Forecast Reporting feature functionality with DUT as Server" + + def pics_TC_DEM_2_7(self): + """Return the PICS definitions associated with this test.""" + pics = [ + # Depends on Feature 06 (ConstraintBasedAdjustment) & Feature 01 (PowerForecastReporting) + "DEM.S.F06", "DEM.S.F01" + ] + return pics + + def steps_TC_DEM_2_7(self) -> list[TestStep]: + """Execute the test steps.""" + steps = [ + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.", + "Verify value is 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Constraints-based Adjustment Test Event.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("3a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("3b", "TH reads Forecast attribute.", + "Value has to include valid slots[0].NominalPower, slots[0].MinPower, slots[0].MaxPower, slots[0].NominalEnergy"), + TestStep("3c", "TH reads OptOutState attribute.", + "Verify value is 0x00 (NoOptOut)"), + TestStep("4", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=now()-10, Duration=20, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("5", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=now()+10, Duration=20, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, constraints[1].{StartTime=now()+20, Duration=20, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, constraints[2].{StartTime=now()+40, Duration=20, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("6", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=now()+10, Duration=20, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, constraints[1].{StartTime=now()+30, Duration=20, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, constraints[2].{StartTime=now()+40, Duration=20, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("7", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=now()+30, Duration=20, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, constraints[1].{StartTime=now()+10, Duration=20, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, constraints[2].{StartTime=now()+50, Duration=20, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("8", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=now()+10, Duration=20, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, constraints[1].{StartTime=now()+50, Duration=20, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, constraints[2].{StartTime=now()+30, Duration=20, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("9", "TH reads AbsMaxPower attribute attribute.", + "Save the value"), + TestStep("9a", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=Forecast.StartTime, Duration=Forecast.Slots[0].DefaultDuration, NominalPower=AbsMaxPower+1, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("10", "TH reads AbsMinPower attribute attribute.", + "Save the value"), + TestStep("10a", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=Forecast.StartTime, Duration=Forecast.Slots[0].DefaultDuration, NominalPower=AbsMinPower-1, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("11", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=Forecast.StartTime, Duration=Forecast.Slots[0].DefaultDuration, NominalPower=Forecast.Slots[0].NominalPower}, Cause=LocalOptimization.", + "Verify DUT responds with status InvalidCommand"), + TestStep("12", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=Forecast.StartTime, Duration=Forecast.Slots[0].DefaultDuration, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, Cause=LocalOptimization.", + "Verify DUT responds with status InvalidCommand"), + TestStep("13", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Local Optimization Test Event.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("13a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("13b", "TH reads OptOutState attribute.", + "Verify value is 0x02 (LocalOptOut)"), + TestStep("14", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=Forecast.StartTime, Duration=Forecast.Slots[0].DefaultDuration, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("15", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=Forecast.StartTime, Duration=Forecast.Slots[0].DefaultDuration, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, Cause=GridOptimization.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("15a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=GridOptimization"), + TestStep("16", "TH sends CancelRequest.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("16a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=InternalOptimization"), + TestStep("17", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=Forecast.StartTime, Duration=Forecast.Slots[0].DefaultDuration, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, Cause=GridOptimization.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("17a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=GridOptimization"), + TestStep("18", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Grid Optimization Test Event.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("18a", "TH reads OptOutState attribute.", + "Verify value is 0x03 (OptOut)"), + TestStep("18b", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=InternalOptimization"), + TestStep("19", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=Forecast.StartTime, Duration=Forecast.Slots[0].DefaultDuration, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, Cause=GridOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("20", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Test Event Clear.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("20a", "TH reads OptOutState attribute.", + "Verify value is 0x00 (NoOptOut)"), + TestStep("21", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=Forecast.StartTime, Duration=Forecast.Slots[0].DefaultDuration, NominalPower=Forecast.Slots[0].NominalPower, MaximumEnergy=Forecast.Slots[0].NominalEnergy}, Cause=LocalOptimization.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("21a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=LocalOptimization"), + TestStep("22", "TH sends CancelRequest.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("22a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=InternalOptimization"), + TestStep("23", "TH sends CancelRequest.", + "Verify DUT responds with status INVALID_IN_STATE(0xcb)"), + TestStep("24", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Constraints-based Adjustment Adjustment Test Event Clear.", + "Verify DUT responds with status SUCCESS(0x00)"), + ] + + return steps + + @async_test_body + async def test_TC_DEM_2_7(self): + # pylint: disable=too-many-locals, too-many-statements + """Run the test steps.""" + self.step("1") + # Commission DUT - already done + + # Subscribe to Events and when they are sent push them to a queue for checking later + events_callback = EventChangeCallback(Clusters.DeviceEnergyManagement) + await events_callback.start(self.default_controller, + self.dut_node_id, + self.matter_test_config.endpoint) + + self.step("2") + await self.check_test_event_triggers_enabled() + + self.step("3") + await self.send_test_event_trigger_constraint_based_adjustment() + + self.step("3a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("3b") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + logging.info(forecast) + asserts.assert_greater(forecast.slots[0].nominalPower, 0) + asserts.assert_greater(forecast.slots[0].minPower, 0) + asserts.assert_greater(forecast.slots[0].maxPower, 0) + asserts.assert_greater(forecast.slots[0].nominalEnergy, 0) + + self.step("3c") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kNoOptOut) + + self.step("4") + # Matter UTC is time since 00:00:00 1/1/2000 + now = self.get_current_utc_time_in_seconds() + + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now - 10, duration=20, + nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("5") + now = self.get_current_utc_time_in_seconds() + + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 10, duration=20, + nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy), + Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 20, duration=20, + nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy), + Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 40, duration=20, + nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("6") + now = self.get_current_utc_time_in_seconds() + + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 10, duration=20, + nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy), + Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 30, duration=20, + nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy), + Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 40, duration=20, + nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("7") + now = self.get_current_utc_time_in_seconds() + + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 30, duration=20, + nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy), + Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 10, duration=20, + nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy), + Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 50, duration=20, + nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("8") + now = self.get_current_utc_time_in_seconds() + + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 10, duration=20, + nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy), + Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 50, duration=20, + nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy), + Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 30, duration=20, + nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("9") + absMaxPower = await self.read_dem_attribute_expect_success(attribute="AbsMaxPower") + + self.step("9a") + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=forecast.startTime, duration=forecast.slots[0].defaultDuration, nominalPower=absMaxPower + 1, maximumEnergy=forecast.slots[0].nominalEnergy)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("10") + absMinPower = await self.read_dem_attribute_expect_success(attribute="AbsMinPower") + + self.step("10a") + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=forecast.startTime, duration=forecast.slots[0].defaultDuration, nominalPower=absMinPower - 1, maximumEnergy=forecast.slots[0].nominalEnergy)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("11") + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=forecast.startTime, duration=forecast.slots[0].defaultDuration, nominalPower=forecast.slots[0].nominalPower)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.InvalidCommand) + + self.step("12") + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=forecast.startTime, duration=forecast.slots[0].defaultDuration, maximumEnergy=forecast.slots[0].nominalEnergy)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.InvalidCommand) + + self.step("13") + await self.send_test_event_trigger_user_opt_out_local() + + self.step("13a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("13b") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kLocalOptOut) + + self.step("14") + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=forecast.startTime, duration=forecast.slots[0].defaultDuration, nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("15") + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=forecast.startTime, duration=forecast.slots[0].defaultDuration, nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.Success) + + self.step("15a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kGridOptimization) + + self.step("16") + await self.send_cancel_request_command() + + self.step("16a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization) + + self.step("17") + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=forecast.startTime, duration=forecast.slots[0].defaultDuration, nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.Success) + + self.step("17a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kGridOptimization) + + self.step("18") + await self.send_test_event_trigger_user_opt_out_grid() + + self.step("18a") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kOptOut) + + self.step("18b") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization) + + self.step("19") + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=forecast.startTime, duration=forecast.slots[0].defaultDuration, nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.ConstraintError) + + self.step("20") + await self.send_test_event_trigger_user_opt_out_clear_all() + + self.step("20a") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kNoOptOut) + + self.step("21") + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=forecast.startTime, duration=forecast.slots[0].defaultDuration, nominalPower=forecast.slots[0].nominalPower, maximumEnergy=forecast.slots[0].nominalEnergy)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.Success) + + self.step("21a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kLocalOptimization) + + self.step("22") + await self.send_cancel_request_command() + + self.step("22a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization) + + self.step("23") + await self.send_cancel_request_command(expected_status=Status.InvalidInState) + + self.step("24") + await self.send_test_event_trigger_constraint_based_adjustment_clear() + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_DEM_2_8.py b/src/python_testing/TC_DEM_2_8.py new file mode 100644 index 00000000000000..773648c7e3ba8e --- /dev/null +++ b/src/python_testing/TC_DEM_2_8.py @@ -0,0 +1,307 @@ +# +# 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. +# pylint: disable=invalid-name + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x7c +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +"""Define Matter test case TC_DEM_2_8.""" + + +import logging + +import chip.clusters as Clusters +from chip.interaction_model import Status +from matter_testing_support import EventChangeCallback, MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts +from TC_DEMTestBase import DEMTestBase + +logger = logging.getLogger(__name__) + + +class TC_DEM_2_8(MatterBaseTest, DEMTestBase): + """Implementation of test case TC_DEM_2_8.""" + + def desc_TC_DEM_2_8(self) -> str: + """Return a description of this test.""" + return "4.1.3. [TC-DEM-2.8] Constraints-based Adjustment with State Forecast Reporting feature functionality with DUT as Server" + + def pics_TC_DEM_2_8(self): + """Return the PICS definitions associated with this test.""" + pics = [ + # Depends on Feature 06 (ConstraintBasedAdjustment) & Feature 02 (StateForecastReporting) + "DEM.S.F06", "DEM.S.F02" + ] + return pics + + def steps_TC_DEM_2_8(self) -> list[TestStep]: + """Execute the test steps.""" + steps = [ + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.", + "Verify value is 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Constraints-based Adjustment Test Event.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("3a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("3b", "TH reads Forecast attribute.", + "Value has to include valid slots[0].ManufacturerESAState"), + TestStep("3c", "TH reads OptOutState attribute.", + "Verify value is 0x00 (NoOptOut)"), + TestStep("4", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=now()-10, Duration=20, LoadControl=0}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("5", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=now()+10, Duration=20, LoadControl=0}, constraints[1].{StartTime=now()+20, Duration=20, LoadControl=0}, constraints[2].{StartTime=now()+50, Duration=20, LoadControl=0}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("6", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=now()+10, Duration=20, LoadControl=0}, constraints[1].{StartTime=now()+30, Duration=20, LoadControl=0}, constraints[2].{StartTime=now()+40, Duration=20, LoadControl=0}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("7", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=now()+30, Duration=20, LoadControl=0}, constraints[1].{StartTime=now()+10, Duration=20, LoadControl=0}, constraints[2].{StartTime=now()+50, Duration=20, LoadControl=0}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("8", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=now()+10, Duration=20, LoadControl=0}, constraints[1].{StartTime=now()+50, Duration=20, LoadControl=0}, constraints[2].{StartTime=now()+30, Duration=20, LoadControl=0}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("9", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=Forecast.StartTime, Duration=Forecast.Slots[0].DefaultDuration, LoadControl=101}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("10", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=Forecast.StartTime, Duration=Forecast.Slots[0].DefaultDuration, LoadControl=-101}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Local Optimization Test Event.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("11a", "TH reads ESAState attribute.", + "Verify value is 0x01 (Online)"), + TestStep("11b", "TH reads OptOutState attribute.", + "Verify value is 0x02 (LocalOptOut)"), + TestStep("12", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=Forecast.StartTime, Duration=Forecast.Slots[0].DefaultDuration, LoadControl=1}, Cause=LocalOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("13", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=Forecast.StartTime, Duration=Forecast.Slots[0].DefaultDuration, LoadControl=1}, Cause=GridOptimization.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("13a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=GridOptimization"), + TestStep("14", "TH sends CancelRequest.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("14a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=InternalOptimization"), + TestStep("15", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=Forecast.StartTime, Duration=Forecast.Slots[0].DefaultDuration, LoadControl=1}, Cause=GridOptimization.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("15a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=GridOptimization"), + TestStep("16", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Grid Optimization Test Event.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("16a", "TH reads OptOutState attribute.", + "Verify value is 0x03 (OptOut)"), + TestStep("16b", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=InternalOptimization"), + TestStep("17", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=Forecast.StartTime, Duration=Forecast.Slots[0].DefaultDuration, LoadControl=1}, Cause=GridOptimization.", + "Verify DUT responds with status CONSTRAINT_ERROR(0x87)"), + TestStep("18", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for User Opt-out Test Event Clear.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("18a", "TH reads OptOutState attribute.", + "Verify value is 0x00 (NoOptOut)"), + TestStep("19", "TH sends RequestConstraintBasedPowerForecast with constraints[0].{StartTime=Forecast.StartTime, Duration=Forecast.Slots[0].DefaultDuration, LoadControl=1}, Cause=LocalOptimization.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("19a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=LocalOptimization"), + TestStep("20", "TH sends CancelRequest.", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("20a", "TH reads Forecast attribute.", + "Value has to include ForecastUpdateReason=InternalOptimization"), + TestStep("21", "TH sends CancelRequest.", + "Verify DUT responds with status INVALID_IN_STATE(0xcb)"), + TestStep("22", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Constraints-based Adjustment Adjustment Test Event Clear.", + "Verify DUT responds with status SUCCESS(0x00)"), + ] + + return steps + + @async_test_body + async def test_TC_DEM_2_8(self): + # pylint: disable=too-many-locals, too-many-statements + """Run the test steps.""" + self.step("1") + # Commission DUT - already done + + # Subscribe to Events and when they are sent push them to a queue for checking later + events_callback = EventChangeCallback(Clusters.DeviceEnergyManagement) + await events_callback.start(self.default_controller, + self.dut_node_id, + self.matter_test_config.endpoint) + + self.step("2") + await self.check_test_event_triggers_enabled() + + self.step("3") + await self.send_test_event_trigger_constraint_based_adjustment() + + self.step("3a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("3b") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_is_not_none(forecast.slots[0].manufacturerESAState) + + self.step("3c") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kNoOptOut) + + self.step("4") + # Matter UTC is time since 00:00:00 1/1/2000 + now = self.get_current_utc_time_in_seconds() + + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=now - 10, duration=20, loadControl=0)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("5") + # Matter UTC is time since 00:00:00 1/1/2000 + now = self.get_current_utc_time_in_seconds() + + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 10, duration=20, loadControl=0), + Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 20, duration=20, loadControl=0), + Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 50, duration=20, loadControl=0)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("6") + # Matter UTC is time since 00:00:00 1/1/2000 + now = self.get_current_utc_time_in_seconds() + + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 10, duration=20, loadControl=0), + Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 30, duration=20, loadControl=0), + Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 40, duration=20, loadControl=0)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("7") + now = self.get_current_utc_time_in_seconds() + + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 30, duration=20, loadControl=0), + Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 10, duration=20, loadControl=0), + Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 50, duration=20, loadControl=0)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("8") + now = self.get_current_utc_time_in_seconds() + + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 10, duration=20, loadControl=0), + Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 50, duration=20, loadControl=0), + Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct(startTime=now + 30, duration=20, loadControl=0)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("9") + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=forecast.startTime, duration=forecast.slots[0].defaultDuration, loadControl=101)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("10") + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=forecast.startTime, duration=forecast.slots[0].defaultDuration, loadControl=-101)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("11") + await self.send_test_event_trigger_user_opt_out_local() + + self.step("11a") + await self.check_dem_attribute("ESAState", Clusters.DeviceEnergyManagement.Enums.ESAStateEnum.kOnline) + + self.step("11b") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kLocalOptOut) + + self.step("12") + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=forecast.startTime, duration=forecast.slots[0].defaultDuration, loadControl=1)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.ConstraintError) + + self.step("13") + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=forecast.startTime, duration=forecast.slots[0].defaultDuration, loadControl=1)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.Success) + + self.step("13a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kGridOptimization) + + self.step("14") + await self.send_cancel_request_command() + + self.step("14a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization) + + self.step("15") + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=forecast.startTime, duration=forecast.slots[0].defaultDuration, loadControl=1)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.Success) + + self.step("15a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kGridOptimization) + + self.step("16") + await self.send_test_event_trigger_user_opt_out_grid() + + self.step("16a") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kOptOut) + + self.step("16b") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization) + + self.step("17") + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=forecast.startTime, duration=forecast.slots[0].defaultDuration, loadControl=1)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kGridOptimization, expected_status=Status.ConstraintError) + + self.step("18") + await self.send_test_event_trigger_user_opt_out_clear_all() + + self.step("18a") + await self.check_dem_attribute("OptOutState", Clusters.DeviceEnergyManagement.Enums.OptOutStateEnum.kNoOptOut) + + self.step("19") + constraintList = [Clusters.DeviceEnergyManagement.Structs.ConstraintsStruct( + startTime=forecast.startTime, duration=forecast.slots[0].defaultDuration, loadControl=1)] + await self.send_request_constraint_based_forecast(constraintList, cause=Clusters.DeviceEnergyManagement.Enums.AdjustmentCauseEnum.kLocalOptimization, expected_status=Status.Success) + + self.step("19a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kLocalOptimization) + + self.step("20") + await self.send_cancel_request_command() + + self.step("20a") + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_equal(forecast.forecastUpdateReason, + Clusters.DeviceEnergyManagement.Enums.ForecastUpdateReasonEnum.kInternalOptimization) + + self.step("21") + await self.send_cancel_request_command(expected_status=Status.InvalidInState) + + self.step("22") + await self.send_test_event_trigger_constraint_based_adjustment_clear() + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_DEM_2_9.py b/src/python_testing/TC_DEM_2_9.py new file mode 100644 index 00000000000000..8e60b69b481d93 --- /dev/null +++ b/src/python_testing/TC_DEM_2_9.py @@ -0,0 +1,120 @@ +# +# 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. +# pylint: disable=invalid-name + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x7e +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +"""Define Matter test case TC_DEM_2_9.""" + + +import logging + +import chip.clusters as Clusters +from matter_testing_support import EventChangeCallback, MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts +from TC_DEMTestBase import DEMTestBase + +logger = logging.getLogger(__name__) + + +class TC_DEM_2_9(MatterBaseTest, DEMTestBase): + """Implementation of test case TC_DEM_2_9.""" + + def desc_TC_DEM_2_9(self) -> str: + """Return a description of this test.""" + return "4.1.3. [TC-DEM-2.2] Power or State Forecast Reporting feature functionality with DUT as Server" + + def pics_TC_DEM_2_9(self): + """Return the PICS definitions associated with this test.""" + pics = [ + # Depends on Feature 01 (PowerForecastReporting) | Feature 2 (StateForecastReporting) + "DEM.S.F01", "DEM.S.F02", + ] + return pics + + def steps_TC_DEM_2_9(self) -> list[TestStep]: + """Execute the test steps.""" + steps = [ + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.", + "Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Forecast Test Event", + "Verify DUT responds with status SUCCESS(0x00)"), + TestStep("3a", "TH reads Forecast attribute.", + "Value has to include a valid slots[0].ManufacturerESAState"), + TestStep("3b", "TH reads Forecast attribute.", + "Value has to include valid slots[0].NominalPower, slots[0].MinPower, slots[0].MaxPower, slots[0].NominalEnergy"), + TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Forecast Test Event Clear", + "Verify DUT responds with status SUCCESS(0x00)"), + ] + + return steps + + @async_test_body + async def test_TC_DEM_2_9(self): + # pylint: disable=too-many-locals, too-many-statements + """Run the test steps.""" + self.step("1") + # Commission DUT - already done + + # Subscribe to Events and when they are sent push them to a queue for checking later + events_callback = EventChangeCallback(Clusters.DeviceEnergyManagement) + await events_callback.start(self.default_controller, + self.dut_node_id, + self.matter_test_config.endpoint) + + self.step("2") + await self.check_test_event_triggers_enabled() + + self.step("3") + await self.send_test_event_trigger_forecast() + + self.step("3a") + feature_map = await self.read_dem_attribute_expect_success(attribute="FeatureMap") + if feature_map & Clusters.DeviceEnergyManagement.Bitmaps.Feature.kStateForecastReporting: + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + asserts.assert_is_not_none(forecast.slots[0].manufacturerESAState) + else: + logging.info('Device does not support StateForecastReporting. Skipping step 3a') + + self.step("3b") + if feature_map & Clusters.DeviceEnergyManagement.Bitmaps.Feature.kPowerForecastReporting: + forecast = await self.read_dem_attribute_expect_success(attribute="Forecast") + + asserts.assert_is_not_none(forecast.slots[0].nominalPower) + asserts.assert_is_not_none(forecast.slots[0].minPower) + asserts.assert_is_not_none(forecast.slots[0].maxPower) + asserts.assert_is_not_none(forecast.slots[0].nominalEnergy) + else: + logging.info('Device does not support StateForecastReporting. Skipping step 3b') + + self.step("4") + await self.send_test_event_trigger_forecast_clear() + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_DGGEN_2_4.py b/src/python_testing/TC_DGGEN_2_4.py index f68cefa260c76f..ee80d927a9b6c1 100644 --- a/src/python_testing/TC_DGGEN_2_4.py +++ b/src/python_testing/TC_DGGEN_2_4.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import asyncio import logging diff --git a/src/python_testing/TC_DRLK_2_12.py b/src/python_testing/TC_DRLK_2_12.py index 81c2271f52c0dd..4578aa01cd2ba0 100644 --- a/src/python_testing/TC_DRLK_2_12.py +++ b/src/python_testing/TC_DRLK_2_12.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_LOCK_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === from drlk_2_x_common import DRLK_COMMON from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main diff --git a/src/python_testing/TC_DRLK_2_2.py b/src/python_testing/TC_DRLK_2_2.py index fcb6c1068b26eb..e7f3e6fa8e421e 100644 --- a/src/python_testing/TC_DRLK_2_2.py +++ b/src/python_testing/TC_DRLK_2_2.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_LOCK_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === from drlk_2_x_common import DRLK_COMMON from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main diff --git a/src/python_testing/TC_DRLK_2_3.py b/src/python_testing/TC_DRLK_2_3.py index e30ac7b2a02635..8c6f40f19c5449 100644 --- a/src/python_testing/TC_DRLK_2_3.py +++ b/src/python_testing/TC_DRLK_2_3.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_LOCK_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === from drlk_2_x_common import DRLK_COMMON from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main diff --git a/src/python_testing/TC_DeviceBasicComposition.py b/src/python_testing/TC_DeviceBasicComposition.py index cff612b33f6497..7af7b865542e42 100644 --- a/src/python_testing/TC_DeviceBasicComposition.py +++ b/src/python_testing/TC_DeviceBasicComposition.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --manual-code 10054912339 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging from dataclasses import dataclass diff --git a/src/python_testing/TC_DeviceConformance.py b/src/python_testing/TC_DeviceConformance.py index ec28db53693c96..2a0fe309f20a4c 100644 --- a/src/python_testing/TC_DeviceConformance.py +++ b/src/python_testing/TC_DeviceConformance.py @@ -15,29 +15,40 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_LOCK_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --manual-code 10054912339 --bool-arg ignore_in_progress:True allow_provisional:True --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --tests test_TC_IDM_10_2 +# === END CI TEST ARGUMENTS === +# TODO: Enable 10.5 in CI once the door lock OTA requestor problem is sorted. from typing import Callable import chip.clusters as Clusters from basic_composition_support import BasicCompositionTests from chip.tlv import uint +from choice_conformance_support import (evaluate_attribute_choice_conformance, evaluate_command_choice_conformance, + evaluate_feature_choice_conformance) from conformance_support import ConformanceDecision, conformance_allowed -from global_attribute_ids import GlobalAttributeIds -from matter_testing_support import (AttributePathLocation, ClusterPathLocation, CommandPathLocation, MatterBaseTest, ProblemNotice, - ProblemSeverity, async_test_body, default_matter_test_main) -from spec_parsing_support import CommandType, build_xml_clusters +from global_attribute_ids import (ClusterIdType, DeviceTypeIdType, GlobalAttributeIds, cluster_id_type, device_type_id_type, + is_valid_device_type_id) +from matter_testing_support import (AttributePathLocation, ClusterPathLocation, CommandPathLocation, DeviceTypePathLocation, + MatterBaseTest, ProblemNotice, ProblemSeverity, async_test_body, default_matter_test_main) +from spec_parsing_support import CommandType, build_xml_clusters, build_xml_device_types class DeviceConformanceTests(BasicCompositionTests): async def setup_class_helper(self): await super().setup_class_helper() self.xml_clusters, self.problems = build_xml_clusters() + self.xml_device_types, problems = build_xml_device_types() + self.problems.extend(problems) def check_conformance(self, ignore_in_progress: bool, is_ci: bool): problems = [] @@ -65,8 +76,7 @@ def record_warning(location, problem): ignore_attributes: dict[int, list[int]] = {} if ignore_in_progress: # This is a manually curated list of attributes that are in-progress in the SDK, but have landed in the spec - in_progress_attributes = {Clusters.BasicInformation.id: [0x15, 0x016], - Clusters.PowerSource.id: [0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A]} + in_progress_attributes = {Clusters.ThreadNetworkDiagnostics.id: [0x3F, 0x40]} ignore_attributes.update(in_progress_attributes) if is_ci: @@ -119,12 +129,12 @@ def record_warning(location, problem): record_error(location=location, problem=f'Unknown feature with mask 0x{f:02x}') continue xml_feature = self.xml_clusters[cluster_id].features[f] - conformance_decision = xml_feature.conformance(feature_map, attribute_list, all_command_list) - if not conformance_allowed(conformance_decision, allow_provisional): + conformance_decision_with_choice = xml_feature.conformance(feature_map, attribute_list, all_command_list) + if not conformance_allowed(conformance_decision_with_choice, allow_provisional): record_error(location=location, problem=f'Disallowed feature with mask 0x{f:02x}') for feature_mask, xml_feature in self.xml_clusters[cluster_id].features.items(): - conformance_decision = xml_feature.conformance(feature_map, attribute_list, all_command_list) - if conformance_decision == ConformanceDecision.MANDATORY and feature_mask not in feature_masks: + conformance_decision_with_choice = xml_feature.conformance(feature_map, attribute_list, all_command_list) + if conformance_decision_with_choice.decision == ConformanceDecision.MANDATORY and feature_mask not in feature_masks: record_error( location=location, problem=f'Required feature with mask 0x{f:02x} is not present in feature map. {conformance_str(xml_feature.conformance, feature_map, self.xml_clusters[cluster_id].features)}') @@ -140,16 +150,16 @@ def record_warning(location, problem): record_error(location=location, problem='Standard attribute found on device, but not in spec') continue xml_attribute = self.xml_clusters[cluster_id].attributes[attribute_id] - conformance_decision = xml_attribute.conformance(feature_map, attribute_list, all_command_list) - if not conformance_allowed(conformance_decision, allow_provisional): + conformance_decision_with_choice = xml_attribute.conformance(feature_map, attribute_list, all_command_list) + if not conformance_allowed(conformance_decision_with_choice, allow_provisional): location = AttributePathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id, attribute_id=attribute_id) record_error( location=location, problem=f'Attribute 0x{attribute_id:02x} is included, but is disallowed by conformance. {conformance_str(xml_attribute.conformance, feature_map, self.xml_clusters[cluster_id].features)}') for attribute_id, xml_attribute in self.xml_clusters[cluster_id].attributes.items(): if cluster_id in ignore_attributes and attribute_id in ignore_attributes[cluster_id]: continue - conformance_decision = xml_attribute.conformance(feature_map, attribute_list, all_command_list) - if conformance_decision == ConformanceDecision.MANDATORY and attribute_id not in cluster.keys(): + conformance_decision_with_choice = xml_attribute.conformance(feature_map, attribute_list, all_command_list) + if conformance_decision_with_choice.decision == ConformanceDecision.MANDATORY and attribute_id not in cluster.keys(): location = AttributePathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id, attribute_id=attribute_id) record_error( location=location, problem=f'Attribute 0x{attribute_id:02x} is required, but is not present on the DUT. {conformance_str(xml_attribute.conformance, feature_map, self.xml_clusters[cluster_id].features)}') @@ -168,13 +178,13 @@ def check_spec_conformance_for_commands(command_type: CommandType): record_error(location=location, problem='Standard command found on device, but not in spec') continue xml_command = xml_commands_dict[command_id] - conformance_decision = xml_command.conformance(feature_map, attribute_list, all_command_list) - if not conformance_allowed(conformance_decision, allow_provisional): + conformance_decision_with_choice = xml_command.conformance(feature_map, attribute_list, all_command_list) + if not conformance_allowed(conformance_decision_with_choice, allow_provisional): record_error( location=location, problem=f'Command 0x{command_id:02x} is included, but disallowed by conformance. {conformance_str(xml_command.conformance, feature_map, self.xml_clusters[cluster_id].features)}') for command_id, xml_command in xml_commands_dict.items(): - conformance_decision = xml_command.conformance(feature_map, attribute_list, all_command_list) - if conformance_decision == ConformanceDecision.MANDATORY and command_id not in command_list: + conformance_decision_with_choice = xml_command.conformance(feature_map, attribute_list, all_command_list) + if conformance_decision_with_choice.decision == ConformanceDecision.MANDATORY and command_id not in command_list: location = CommandPathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id, command_id=command_id) record_error( location=location, problem=f'Command 0x{command_id:02x} is required, but is not present on the DUT. {conformance_str(xml_command.conformance, feature_map, self.xml_clusters[cluster_id].features)}') @@ -183,7 +193,17 @@ def check_spec_conformance_for_commands(command_type: CommandType): check_spec_conformance_for_commands(CommandType.ACCEPTED) check_spec_conformance_for_commands(CommandType.GENERATED) - # TODO: Add choice checkers + feature_choice_problems = evaluate_feature_choice_conformance( + endpoint_id, cluster_id, self.xml_clusters, feature_map, attribute_list, all_command_list) + attribute_choice_problems = evaluate_attribute_choice_conformance( + endpoint_id, cluster_id, self.xml_clusters, feature_map, attribute_list, all_command_list) + command_choice_problem = evaluate_command_choice_conformance( + endpoint_id, cluster_id, self.xml_clusters, feature_map, attribute_list, all_command_list) + + if feature_choice_problems or attribute_choice_problems or command_choice_problem: + success = False + problems.extend(feature_choice_problems + attribute_choice_problems + command_choice_problem) + print(f'success = {success}') return success, problems @@ -228,6 +248,86 @@ def record_warning(location, problem): return success, problems + def check_device_type(self, fail_on_extra_clusters: bool = True, allow_provisional: bool = False) -> tuple[bool, list[ProblemNotice]]: + success = True + problems = [] + + def record_problem(location, problem, severity): + problems.append(ProblemNotice("IDM-10.5", location, severity, problem, "")) + + def record_error(location, problem): + nonlocal success + record_problem(location, problem, ProblemSeverity.ERROR) + success = False + + def record_warning(location, problem): + record_problem(location, problem, ProblemSeverity.WARNING) + + for endpoint_id, endpoint in self.endpoints.items(): + if Clusters.Descriptor not in endpoint: + location = ClusterPathLocation(endpoint_id=endpoint_id, cluster_id=Clusters.Descriptor.id) + record_error(location=location, problem='No descriptor cluster found on endpoint') + continue + + device_type_list = endpoint[Clusters.Descriptor][Clusters.Descriptor.Attributes.DeviceTypeList] + invalid_device_types = [x for x in device_type_list if not is_valid_device_type_id(device_type_id_type(x.deviceType))] + standard_device_types = [x for x in endpoint[Clusters.Descriptor] + [Clusters.Descriptor.Attributes.DeviceTypeList] if device_type_id_type(x.deviceType) == DeviceTypeIdType.kStandard] + endpoint_clusters = [] + server_clusters = [] + for device_type in invalid_device_types: + location = DeviceTypePathLocation(device_type_id=device_type.deviceType) + record_error(location=location, problem='Invalid device type ID (out of valid range)') + + for device_type in standard_device_types: + device_type_id = device_type.deviceType + location = DeviceTypePathLocation(device_type_id=device_type_id) + if device_type_id not in self.xml_device_types.keys(): + record_error(location=location, problem='Unknown device type ID in standard range') + continue + + if device_type_id not in self.xml_device_types.keys(): + location = DeviceTypePathLocation(device_type_id=device_type_id) + record_error(location=location, problem='Unknown device type') + continue + + # TODO: check revision. Possibly in another test? + + xml_device = self.xml_device_types[device_type_id] + # IDM 10.1 checks individual clusters for validity, + # so here we can ignore checks for invalid and manufacturer clusters. + server_clusters = [x for x in endpoint[Clusters.Descriptor] + [Clusters.Descriptor.Attributes.ServerList] if cluster_id_type(x) == ClusterIdType.kStandard] + + # As a start, we are only checking server clusters + # TODO: check client clusters too? + for cluster_id, cluster_requirement in xml_device.server_clusters.items(): + # Device type cluster conformances do not include any conformances based on cluster elements + conformance_decision_with_choice = cluster_requirement.conformance(0, [], []) + location = DeviceTypePathLocation(device_type_id=device_type_id, cluster_id=cluster_id) + if conformance_decision_with_choice.decision == ConformanceDecision.MANDATORY and cluster_id not in server_clusters: + record_error(location=location, + problem=f"Mandatory cluster {cluster_requirement.name} for device type {xml_device.name} is not present in the server list") + success = False + + if cluster_id in server_clusters and not conformance_allowed(conformance_decision_with_choice, allow_provisional): + record_error(location=location, + problem=f"Disallowed cluster {cluster_requirement.name} found in server list for device type {xml_device.name}") + success = False + # If we want to check for extra clusters on the endpoint, we need to know the entire set of clusters in all the device type + # lists across all the device types on the endpoint. + endpoint_clusters += xml_device.server_clusters.keys() + if fail_on_extra_clusters: + fn = record_error + else: + fn = record_warning + extra_clusters = set(server_clusters) - set(endpoint_clusters) + for extra in extra_clusters: + location = ClusterPathLocation(endpoint_id=endpoint_id, cluster_id=extra) + fn(location=location, problem=f"Extra cluster found on endpoint with device types {device_type_list}") + + return success, problems + class TC_DeviceConformance(MatterBaseTest, DeviceConformanceTests): @async_test_body @@ -236,7 +336,9 @@ async def setup_class(self): await self.setup_class_helper() def test_TC_IDM_10_2(self): - ignore_in_progress = self.user_params.get("ignore_in_progress", False) + # TODO: Turn this off after TE2 + # https://github.com/project-chip/connectedhomeip/issues/34615 + ignore_in_progress = self.user_params.get("ignore_in_progress", True) is_ci = self.check_pics('PICS_SDK_CI_ONLY') success, problems = self.check_conformance(ignore_in_progress, is_ci) self.problems.extend(problems) @@ -250,6 +352,13 @@ def test_TC_IDM_10_3(self): if not success: self.fail_current_test("Problems with cluster revision on at least one cluster") + def test_TC_IDM_10_5(self): + fail_on_extra_clusters = self.user_params.get("fail_on_extra_clusters", True) + success, problems = self.check_device_type(fail_on_extra_clusters) + self.problems.extend(problems) + if not success: + self.fail_current_test("Problems with Device type conformance on one or more endpoints") + if __name__ == "__main__": default_matter_test_main() diff --git a/src/python_testing/TC_ECOINFO_2_1.py b/src/python_testing/TC_ECOINFO_2_1.py new file mode 100644 index 00000000000000..ea9ee43b7f0569 --- /dev/null +++ b/src/python_testing/TC_ECOINFO_2_1.py @@ -0,0 +1,190 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import chip.clusters as Clusters +from chip.clusters.Types import NullValue +from chip.interaction_model import Status +from chip.tlv import uint +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, type_matches +from mobly import asserts + + +class TC_ECOINFO_2_1(MatterBaseTest): + + def _validate_device_directory(self, is_removed_on_null, device_directory): + num_of_devices = len(device_directory) + if is_removed_on_null: + asserts.assert_less_equal(num_of_devices, 256, "Too many device entries") + for device in device_directory: + # TODO do fabric index check first + if device.deviceName is not None: + asserts.assert_true(type_matches(device.deviceName, str), "DeviceName should be a string") + asserts.assert_less_equal(len(device.deviceName), 64, "DeviceName should be <= 64") + asserts.assert_true(type_matches(device.deviceNameLastEdit, uint), "DeviceNameLastEdit should be a uint") + asserts.assert_greater(device.deviceNameLastEdit, 0, "DeviceNameLastEdit must be greater than 0") + else: + asserts.assert_true(device.deviceNameLastEdit is None, + "DeviceNameLastEdit should not be provided when there is no DeviceName") + + asserts.assert_true(type_matches(device.bridgedEndpoint, uint), "BridgedEndpoint should be a uint") + asserts.assert_greater_equal(device.bridgedEndpoint, 0, "BridgedEndpoint >= 0") + asserts.assert_less_equal(device.bridgedEndpoint, 0xffff_ffff, + "BridgedEndpoint less than or equal to Invalid Endpoint value") + + asserts.assert_true(type_matches(device.originalEndpoint, uint), "OriginalEndpoint should be a uint") + asserts.assert_greater_equal(device.originalEndpoint, 0, "OriginalEndpoint >= 0") + asserts.assert_less(device.originalEndpoint, 0xffff_ffff, + "OriginalEndpoint less than or equal to Invalid Endpoint value") + + asserts.assert_true(type_matches(device.deviceTypes, list), "DeviceTypes should be a list") + asserts.assert_greater_equal(len(device.deviceTypes), 1, "DeviceTypes list must contains at least one entry") + for device_type in device.deviceTypes: + asserts.assert_true(type_matches(device_type.deviceType, uint), "DeviceType should be a uint") + # TODO what other validation can we do here to device_type.deviceType + asserts.assert_true(type_matches(device_type.revision, uint), "device type's revision should be a uint") + asserts.assert_greater_equal(device_type.revision, 1, "device type's revision must >= 1") + + asserts.assert_true(type_matches(device.uniqueLocationIDs, list), "UniqueLocationIds should be a list") + num_of_unique_location_ids = len(device.uniqueLocationIDs) + asserts.assert_less_equal(num_of_unique_location_ids, 64, "UniqueLocationIds list should be <= 64") + for location_id in device.uniqueLocationIDs: + asserts.assert_true(type_matches(location_id, str), "UniqueLocationId should be a string") + location_id_string_length = len(location_id) + asserts.assert_greater_equal(location_id_string_length, 1, + "UniqueLocationId must contain at least one character") + asserts.assert_less_equal(location_id_string_length, 64, "UniqueLocationId should be <= 64") + + asserts.assert_true(type_matches(device.uniqueLocationIDsLastEdit, uint), + "UniqueLocationIdsLastEdit should be a uint") + if num_of_unique_location_ids: + asserts.assert_greater(device.uniqueLocationIDsLastEdit, 0, "UniqueLocationIdsLastEdit must be non-zero") + else: + asserts.assert_equal(num_of_devices, 0, "Device was removed, there should be no devices in DeviceDirectory") + + def _validate_location_directory(self, is_removed_on_null, location_directory): + num_of_locations = len(location_directory) + if is_removed_on_null: + asserts.assert_less_equal(num_of_locations, 64, "Too many location entries") + for location in location_directory: + asserts.assert_true(type_matches(location.uniqueLocationID, str), "UniqueLocationId should be a string") + location_id_string_length = len(location.uniqueLocationID) + asserts.assert_greater_equal(location_id_string_length, 1, + "UniqueLocationId must contain at least one character") + asserts.assert_less_equal(location_id_string_length, 64, "UniqueLocationId should be <= 64") + + asserts.assert_true(type_matches(location.locationDescriptor.locationName, str), + "LocationName should be a string") + asserts.assert_less_equal(len(location.locationDescriptor.locationName), 64, "LocationName should be <= 64") + + if location.locationDescriptor.floorNumber is not NullValue: + asserts.assert_true(type_matches(location.locationDescriptor.floorNumber, int), + "FloorNumber should be an int") + # TODO check in range of int16. + + if location.locationDescriptor.areaType is not NullValue: + # TODO check areaType is valid. + pass + + asserts.assert_true(type_matches(location.locationDescriptorLastEdit, uint), + "UniqueLocationIdsLastEdit should be a uint") + asserts.assert_greater(location.locationDescriptorLastEdit, 0, "LocationDescriptorLastEdit must be non-zero") + + else: + asserts.assert_equal(num_of_locations, 0, "Device was removed, there should be no location in LocationDirectory") + + def steps_TC_ECOINFO_2_1(self) -> list[TestStep]: + steps = [TestStep(1, "Identify endpoints with Ecosystem Information Cluster", is_commissioning=True), + TestStep(2, "Reading RemovedOn Attribute"), + TestStep(3, "Reading DeviceDirectory Attribute"), + TestStep(4, "Reading LocationDirectory Attribute"), + TestStep(5, "Try Writing to RemovedOn Attribute"), + TestStep(6, "Try Writing to DeviceDirectory Attribute"), + TestStep(7, "Try Writing to LocationDirectory Attribute"), + TestStep(8, "Repeating steps 2 to 7 for each endpoint identified in step 1")] + return steps + + @async_test_body + async def test_TC_ECOINFO_2_1(self): + dev_ctrl = self.default_controller + dut_node_id = self.dut_node_id + + self.print_step(0, "Commissioning, already done") + + self.step(1) + endpoint_wild_card_read = await dev_ctrl.ReadAttribute(dut_node_id, [(Clusters.EcosystemInformation.Attributes.ClusterRevision)]) + list_of_endpoints = list(endpoint_wild_card_read.keys()) + + for idx, cluster_endpoint in enumerate(list_of_endpoints): + if idx == 0: + self.step(2) + removed_on = await self.read_single_attribute( + dev_ctrl, + dut_node_id, + endpoint=cluster_endpoint, + attribute=Clusters.EcosystemInformation.Attributes.RemovedOn) + + is_removed_on_null = removed_on is NullValue + if not is_removed_on_null: + asserts.assert_true(type_matches(removed_on, uint)) + asserts.assert_greater(removed_on, 0, "RemovedOn must be greater than 0", "RemovedOn should be a uint") + + if idx == 0: + self.step(3) + device_directory = await self.read_single_attribute( + dev_ctrl, + dut_node_id, + endpoint=cluster_endpoint, + attribute=Clusters.EcosystemInformation.Attributes.DeviceDirectory, + fabricFiltered=False) + + self._validate_device_directory(is_removed_on_null, device_directory) + + if idx == 0: + self.step(4) + location_directory = await self.read_single_attribute( + dev_ctrl, + dut_node_id, + endpoint=cluster_endpoint, + attribute=Clusters.EcosystemInformation.Attributes.LocationDirectory, + fabricFiltered=False) + + self._validate_location_directory(is_removed_on_null, location_directory) + + if idx == 0: + self.step(5) + result = await dev_ctrl.WriteAttribute(dut_node_id, [(cluster_endpoint, Clusters.EcosystemInformation.Attributes.RemovedOn(2))]) + asserts.assert_equal(len(result), 1, "Expecting only one result from trying to write to RemovedOn Attribute") + asserts.assert_equal(result[0].Status, Status.UnsupportedWrite, "Expecting Status of UnsupportedWrite") + + if idx == 0: + self.step(6) + result = await dev_ctrl.WriteAttribute(dut_node_id, [(cluster_endpoint, Clusters.EcosystemInformation.Attributes.DeviceDirectory([]))]) + asserts.assert_equal(len(result), 1, "Expecting only one result from trying to write to DeviceDirectory Attribute") + asserts.assert_equal(result[0].Status, Status.UnsupportedWrite, "Expecting Status of UnsupportedWrite") + + if idx == 0: + self.step(7) + result = await dev_ctrl.WriteAttribute(dut_node_id, [(cluster_endpoint, Clusters.EcosystemInformation.Attributes.DeviceDirectory([]))]) + asserts.assert_equal(len(result), 1, "Expecting only one result from trying to write to LocationDirectory Attribute") + asserts.assert_equal(result[0].Status, Status.UnsupportedWrite, "Expecting Status of UnsupportedWrite") + + if idx == 0: + self.step(8) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_ECOINFO_2_2.py b/src/python_testing/TC_ECOINFO_2_2.py new file mode 100644 index 00000000000000..c8bb7de4004d56 --- /dev/null +++ b/src/python_testing/TC_ECOINFO_2_2.py @@ -0,0 +1,123 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import chip.clusters as Clusters +from chip.clusters.Types import NullValue +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + +_DEVICE_TYPE_AGGREGGATOR = 0x000E + + +class TC_ECOINFO_2_2(MatterBaseTest): + + def steps_TC_ECOINFO_2_2(self) -> list[TestStep]: + steps = [TestStep(1, "Prepare", is_commissioning=True), + TestStep("1a", "Read root endpoint's PartsList"), + TestStep("1b", "For each endpoint in 1a read DeviceType list confirming aggregator endpoint exists"), + TestStep(2, "Add a bridged device"), + TestStep("2a", "(Manual Step) Add a bridged device using method indicated by the manufacturer"), + TestStep("2b", "Read root endpoint's PartsList, validate exactly one endpoint added"), + TestStep("2c", "On newly added endpoint detected in 2b read RemovedOn Ecosystem Information Attribute and validate"), + TestStep(3, "Remove bridged device"), + TestStep("3a", "(Manual Step) Removed bridged device added in step 2a using method indicated by the manufacturer"), + TestStep("3b", "On newly added endpoint detected in 2b read RemovedOn Ecosystem Information Attribute and validate"), + TestStep("3c", "On newly added endpoint detected in 2b read DeviceDirectory Ecosystem Information Attribute and validate"), + TestStep("3d", "On newly added endpoint detected in 2b read LocationDirectory Ecosystem Information Attribute and validate")] + + return steps + + @async_test_body + async def test_TC_ECOINFO_2_2(self): + dev_ctrl = self.default_controller + dut_node_id = self.dut_node_id + + self.print_step(0, "Commissioning, already done") + self.step(1) + self.step("1a") + root_node_endpoint = 0 + root_part_list = await dev_ctrl.ReadAttribute(dut_node_id, [(root_node_endpoint, Clusters.Descriptor.Attributes.PartsList)]) + + self.step("1b") + set_of_endpoints_step_1 = set(root_part_list[root_node_endpoint] + [Clusters.Descriptor][Clusters.Descriptor.Attributes.PartsList]) + list_of_aggregator_endpoints = [] + for endpoint in set_of_endpoints_step_1: + device_type_list_read = await dev_ctrl.ReadAttribute(dut_node_id, [(endpoint, Clusters.Descriptor.Attributes.DeviceTypeList)]) + device_type_list = device_type_list_read[endpoint][Clusters.Descriptor][Clusters.Descriptor.Attributes.DeviceTypeList] + for device_type in device_type_list: + if device_type.deviceType == _DEVICE_TYPE_AGGREGGATOR: + list_of_aggregator_endpoints.append(endpoint) + + asserts.assert_greater_equal(len(list_of_aggregator_endpoints), 1, "Did not find any Aggregator device types") + + self.step(2) + self.step("2a") + self.wait_for_user_input(prompt_msg="Add a bridged device using method indicated by the manufacturer") + + self.step("2b") + root_part_list_step_2 = await dev_ctrl.ReadAttribute(dut_node_id, [(root_node_endpoint, Clusters.Descriptor.Attributes.PartsList)]) + set_of_endpoints_step_2 = set( + root_part_list_step_2[root_node_endpoint][Clusters.Descriptor][Clusters.Descriptor.Attributes.PartsList]) + + asserts.assert_true(set_of_endpoints_step_2.issuperset(set_of_endpoints_step_1), "Expected only new endpoints to be added") + unique_endpoints_set = set_of_endpoints_step_2 - set_of_endpoints_step_1 + asserts.assert_equal(len(unique_endpoints_set), 1, "Expected only one new endpoint") + + self.step("2c") + newly_added_endpoint = list(unique_endpoints_set)[0] + removed_on = await self.read_single_attribute( + dev_ctrl, + dut_node_id, + endpoint=newly_added_endpoint, + attribute=Clusters.EcosystemInformation.Attributes.RemovedOn) + + asserts.assert_true(removed_on is NullValue, "RemovedOn is expected to be null for a newly added device") + + self.step(3) + self.step("3a") + self.wait_for_user_input(prompt_msg="Removed bridged device added in step 2a using method indicated by the manufacturer") + + self.step("3b") + removed_on = await self.read_single_attribute( + dev_ctrl, + dut_node_id, + endpoint=newly_added_endpoint, + attribute=Clusters.EcosystemInformation.Attributes.RemovedOn) + asserts.assert_true(removed_on is not NullValue, "RemovedOn is expected to have a value") + + self.step("3c") + device_directory = await self.read_single_attribute( + dev_ctrl, + dut_node_id, + endpoint=newly_added_endpoint, + attribute=Clusters.EcosystemInformation.Attributes.DeviceDirectory, + fabricFiltered=False) + asserts.assert_equal(len(device_directory), 0, "Expected device directory to be empty") + + self.step("3d") + location_directory = await self.read_single_attribute( + dev_ctrl, + dut_node_id, + endpoint=newly_added_endpoint, + attribute=Clusters.EcosystemInformation.Attributes.LocationDirectory, + fabricFiltered=False) + asserts.assert_equal(len(location_directory), 0, "Expected location directory to be empty") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_EEM_2_1.py b/src/python_testing/TC_EEM_2_1.py index 51e01a1e4b3980..d5a2c0751145d1 100644 --- a/src/python_testing/TC_EEM_2_1.py +++ b/src/python_testing/TC_EEM_2_1.py @@ -14,12 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging @@ -44,13 +49,20 @@ def pics_TC_EEM_2_1(self): def steps_TC_EEM_2_1(self) -> list[TestStep]: steps = [ - TestStep("1", "Commissioning, already done", is_commissioning=True), - TestStep("2", "TH reads Accuracy attribute. Verify that the DUT response contains a MeasurementAccuracyStruct value."), - TestStep("3", "TH reads CumulativeEnergyImported attribute. Verify that the DUT response contains either null or an EnergyMeasurementStruct value."), - TestStep("4", "TH reads CumulativeEnergyExported attribute. Verify that the DUT response contains either null or an EnergyMeasurementStruct value."), - TestStep("5", "TH reads PeriodicEnergyImported attribute. Verify that the DUT response contains either null or an EnergyMeasurementStruct value."), - TestStep("6", "TH reads PeriodicEnergyExported attribute. Verify that the DUT response contains either null or an EnergyMeasurementStruct value."), - TestStep("7", "TH reads CumulativeEnergyReset attribute. Verify that the DUT response contains either null or an CumulativeEnergyResetStruct value."), + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads Accuracy attribute", + "Verify that the DUT response contains a MeasurementAccuracyStruct value."), + TestStep("3", "TH reads CumulativeEnergyImported attribute", + "Verify that the DUT response contains either null or an EnergyMeasurementStruct value."), + TestStep("4", "TH reads CumulativeEnergyExported attribute", + "Verify that the DUT response contains either null or an EnergyMeasurementStruct value."), + TestStep("5", "TH reads PeriodicEnergyImported attribute", + "Verify that the DUT response contains either null or an EnergyMeasurementStruct value."), + TestStep("6", "TH reads PeriodicEnergyExported attribute", + "Verify that the DUT response contains either null or an EnergyMeasurementStruct value."), + TestStep("7", "TH reads CumulativeEnergyReset attribute", + "Verify that the DUT response contains either null or an CumulativeEnergyResetStruct value."), ] return steps @@ -64,29 +76,34 @@ async def test_TC_EEM_2_1(self): self.step("2") accuracy = await self.read_eem_attribute_expect_success("Accuracy") logger.info(f"Rx'd Accuracy: {accuracy}") - asserts.assert_not_equal(accuracy, NullValue, "Accuracy is not allowed to be null") + asserts.assert_not_equal( + accuracy, NullValue, "Accuracy is not allowed to be null") asserts.assert_equal(accuracy.measurementType, Clusters.ElectricalEnergyMeasurement.Enums.MeasurementTypeEnum.kElectricalEnergy, "Accuracy measurementType must be ElectricalEnergy") self.step("3") if self.pics_guard(self.check_pics("EEM.S.A0001")): cumulativeEnergyImported = await self.read_eem_attribute_expect_success("CumulativeEnergyImported") - logger.info(f"Rx'd CumulativeEnergyImported: {cumulativeEnergyImported}") + logger.info( + f"Rx'd CumulativeEnergyImported: {cumulativeEnergyImported}") self.step("4") if self.pics_guard(self.check_pics("EEM.S.A0002")): cumulativeEnergyExported = await self.read_eem_attribute_expect_success("CumulativeEnergyExported") - logger.info(f"Rx'd CumulativeEnergyExported: {cumulativeEnergyExported}") + logger.info( + f"Rx'd CumulativeEnergyExported: {cumulativeEnergyExported}") self.step("5") if self.pics_guard(self.check_pics("EEM.S.A0003")): periodicEnergyImported = await self.read_eem_attribute_expect_success("PeriodicEnergyImported") - logger.info(f"Rx'd PeriodicEnergyImported: {periodicEnergyImported}") + logger.info( + f"Rx'd PeriodicEnergyImported: {periodicEnergyImported}") self.step("6") if self.pics_guard(self.check_pics("EEM.S.A0004")): periodicEnergyExported = await self.read_eem_attribute_expect_success("PeriodicEnergyExported") - logger.info(f"Rx'd PeriodicEnergyExported: {periodicEnergyExported}") + logger.info( + f"Rx'd PeriodicEnergyExported: {periodicEnergyExported}") self.step("7") if self.pics_guard(self.check_pics("EEM.S.A0005")): diff --git a/src/python_testing/TC_EEM_2_2.py b/src/python_testing/TC_EEM_2_2.py index 6571b80b53898d..fd2d5c828f64c9 100644 --- a/src/python_testing/TC_EEM_2_2.py +++ b/src/python_testing/TC_EEM_2_2.py @@ -14,12 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import time @@ -40,13 +45,17 @@ def pics_TC_EEM_2_2(self): def steps_TC_EEM_2_2(self) -> list[TestStep]: steps = [ - TestStep("1", "Commissioning, already done", is_commissioning=True), - TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster", + "Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Start Fake Load Test 1kW Event"), TestStep("4", "Wait 3 seconds"), - TestStep("4a", "TH reads from the DUT the CumulativeEnergyImported attribute. Verify the read is successful and note the value read."), + TestStep("4a", "TH reads from the DUT the CumulativeEnergyImported attribute", + "Verify the read is successful and note the value read."), TestStep("5", "Wait 3 seconds"), - TestStep("5a", "TH reads from the DUT the CumulativeEnergyImported attribute. Verify the read is successful and that the value is greater than the value measured in step 4a."), + TestStep("5a", "TH reads from the DUT the CumulativeEnergyImported attribute", + "Verify the read is successful and that the value is greater than the value measured in step 4a."), TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Stop Fake Readings Test Event."), ] diff --git a/src/python_testing/TC_EEM_2_3.py b/src/python_testing/TC_EEM_2_3.py index 7842f46d02e86f..927ec9aea2efd5 100644 --- a/src/python_testing/TC_EEM_2_3.py +++ b/src/python_testing/TC_EEM_2_3.py @@ -14,12 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import time @@ -40,13 +45,17 @@ def pics_TC_EEM_2_3(self): def steps_TC_EEM_2_3(self) -> list[TestStep]: steps = [ - TestStep("1", "Commissioning, already done", is_commissioning=True), - TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster", + "Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Start Fake Generator Test 3kW Event"), TestStep("4", "Wait 6 seconds"), - TestStep("4a", "TH reads from the DUT the CumulativeEnergyExported attribute. Verify the read is successful and note the value read."), + TestStep("4a", "TH reads from the DUT the CumulativeEnergyExported attribute", + "Verify the read is successful and note the value read."), TestStep("5", "Wait 6 seconds"), - TestStep("5a", "TH reads from the DUT the CumulativeEnergyExported attribute. Verify the read is successful and that the value is greater than the value measured in step 4a."), + TestStep("5a", "TH reads from the DUT the CumulativeEnergyExported attribute", + "Verify the read is successful and that the value is greater than the value measured in step 4a."), TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Stop Fake Readings Test Event."), ] diff --git a/src/python_testing/TC_EEM_2_4.py b/src/python_testing/TC_EEM_2_4.py index 2cf3b3482122e6..dbc89f1934b1ab 100644 --- a/src/python_testing/TC_EEM_2_4.py +++ b/src/python_testing/TC_EEM_2_4.py @@ -14,12 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import time @@ -40,13 +45,17 @@ def pics_TC_EEM_2_4(self): def steps_TC_EEM_2_4(self) -> list[TestStep]: steps = [ - TestStep("1", "Commissioning, already done", is_commissioning=True), - TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster", + "Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Start Fake Load Test 1kW Event"), TestStep("4", "Wait 3 seconds"), - TestStep("4a", "TH reads from the DUT the PeriodicEnergyImported attribute. Verify the read is successful and note the value read."), + TestStep("4a", "TH reads from the DUT the PeriodicEnergyImported attribute", + "Verify the read is successful and note the value read."), TestStep("5", "Wait 3 seconds"), - TestStep("5a", "TH reads from the DUT the PeriodicEnergyImported attribute. Verify the read is successful and that the value read has to be different from value measure in step 4a."), + TestStep("5a", "TH reads from the DUT the PeriodicEnergyImported attribute", + "Verify the read is successful and that the value read has to be different from value measure in step 4a."), TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Stop Fake Readings Test Event."), ] diff --git a/src/python_testing/TC_EEM_2_5.py b/src/python_testing/TC_EEM_2_5.py index 6a45707bf936ed..95f01ebc15f2d7 100644 --- a/src/python_testing/TC_EEM_2_5.py +++ b/src/python_testing/TC_EEM_2_5.py @@ -14,12 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import time @@ -40,13 +45,17 @@ def pics_TC_EEM_2_5(self): def steps_TC_EEM_2_5(self) -> list[TestStep]: steps = [ - TestStep("1", "Commissioning, already done", is_commissioning=True), - TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster", + "Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Start Fake Generator Test 3kW Event"), TestStep("4", "Wait 6 seconds"), - TestStep("4a", "TH reads from the DUT the PeriodicEnergyExported attribute. Verify the read is successful and note the value read."), + TestStep("4a", "TH reads from the DUT the PeriodicEnergyExported attribute", + "Verify the read is successful and note the value read."), TestStep("5", "Wait 6 seconds"), - TestStep("5a", "TH reads from the DUT the PeriodicEnergyExported attribute. Verify the read is successful and that the value read has to be different from value measure in step 4a."), + TestStep("5a", "TH reads from the DUT the PeriodicEnergyExported attribute", + "Verify the read is successful and that the value read has to be different from value measure in step 4a."), TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Stop Fake Readings Test Event."), ] diff --git a/src/python_testing/TC_EEVSE_2_2.py b/src/python_testing/TC_EEVSE_2_2.py index 4fdf12c151069a..833375e0fb7523 100644 --- a/src/python_testing/TC_EEVSE_2_2.py +++ b/src/python_testing/TC_EEVSE_2_2.py @@ -14,12 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging import time @@ -47,51 +52,92 @@ def pics_TC_EEVSE_2_2(self): def steps_TC_EEVSE_2_2(self) -> list[TestStep]: steps = [ - TestStep("1", "Commissioning, already done", is_commissioning=True), - TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.", + "Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event"), - TestStep("3a", "After a few seconds TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), - TestStep("3b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), - TestStep("3c", "TH reads from the DUT the FaultState attribute. Verify value is 0x00 (NoError)"), - TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event. Verify Event EEVSE.S.E00(EVConnected) sent"), - TestStep("4a", "TH reads from the DUT the State attribute. Verify value is 0x01 (PluggedInNoDemand)"), - TestStep("4b", "TH reads from the DUT the SessionID attribute. Value is noted for later"), + TestStep("3a", "After a few seconds TH reads from the DUT the State attribute.", + "Verify value is 0x00 (NotPluggedIn)"), + TestStep("3b", "TH reads from the DUT the SupplyState attribute.", + "Verify value is 0x00 (Disabled)"), + TestStep("3c", "TH reads from the DUT the FaultState attribute.", + "Verify value is 0x00 (NoError)"), + TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event.", + "Verify Event EEVSE.S.E00(EVConnected) sent"), + TestStep("4a", "TH reads from the DUT the State attribute.", + "Verify value is 0x01 (PluggedInNoDemand)"), + TestStep("4b", + "TH reads from the DUT the SessionID attribute. Value is noted for later"), TestStep("5", "TH sends command EnableCharging with ChargingEnabledUntil=2 minutes in the future, minimumChargeCurrent=6000, maximumChargeCurrent=60000"), - TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event. Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), - TestStep("6a", "TH reads from the DUT the State attribute. Verify value is 0x3 (PluggedInCharging)"), - TestStep("6b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x1 (ChargingEnabled)"), - TestStep("6c", "TH reads from the DUT the ChargingEnabledUntil attribute. Verify value is the commanded value"), - TestStep("6d", "TH reads from the DUT the MinimumChargeCurrent attribute. Verify value is the commanded value (6000)"), - TestStep("6e", "TH reads from the DUT the MaximumChargeCurrent attribute. Verify value is the min(command value (60000), CircuitCapacity)"), - TestStep("7", "Wait 2 minutes. Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvseStopped"), - TestStep("7a", "TH reads from the DUT the State attribute. Verify value is 0x02 (PluggedInDemand)"), - TestStep("7b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), + TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event.", + "Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), + TestStep("6a", "TH reads from the DUT the State attribute.", + "Verify value is 0x3 (PluggedInCharging)"), + TestStep("6b", "TH reads from the DUT the SupplyState attribute.", + "Verify value is 0x1 (ChargingEnabled)"), + TestStep("6c", "TH reads from the DUT the ChargingEnabledUntil attribute.", + "Verify value is the commanded value"), + TestStep("6d", "TH reads from the DUT the MinimumChargeCurrent attribute.", + "Verify value is the commanded value (6000)"), + TestStep("6e", "TH reads from the DUT the MaximumChargeCurrent attribute.", + "Verify value is the min(command value (60000), CircuitCapacity)"), + TestStep("7", "Wait 2 minutes.", + "Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvseStopped"), + TestStep("7a", "TH reads from the DUT the State attribute.", + "Verify value is 0x02 (PluggedInDemand)"), + TestStep("7b", "TH reads from the DUT the SupplyState attribute.", + "Verify value is 0x00 (Disabled)"), TestStep("8", "TH sends command EnableCharging with ChargingEnabledUntil=NULL, minimumChargeCurrent = 6000, maximumChargeCurrent=12000"), - TestStep("8a", "TH reads from the DUT the State attribute. Verify value is 0x03 (PluggedInCharging)"), - TestStep("8b", "TH reads from the DUT the SupplyState attribute. Verify value is 1 (ChargingEnabled)"), - TestStep("8c", "TH reads from the DUT the ChargingEnabledUntil attribute. Verify value is the commanded value (NULL)"), - TestStep("8d", "TH reads from the DUT the MinimumChargeCurrent attribute. Verify value is the commanded value (6000)"), - TestStep("8e", "TH reads from the DUT the MaximumChargeCurrent attribute. Verify value is the MIN(command value (60000), CircuitCapacity)"), - TestStep("9", "If the optional attribute is supported TH writes to the DUT UserMaximumChargeCurrent=6000"), - TestStep("9a", "After a few seconds TH reads from the DUT the MaximumChargeCurrent. Verify value is UserMaximumChargeCurrent value (6000)"), - TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear. Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvStopped"), - TestStep("10a", "TH reads from the DUT the State attribute. Verify value is 0x01 (PluggedInNoDemand)"), - TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event. Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), - TestStep("11a", "TH reads from the DUT the State attribute. Verify value is 0x03 (PluggedInCharging)"), - TestStep("12", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear. Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvStopped"), - TestStep("12a", "TH reads from the DUT the State attribute. Verify value is 0x01 (PluggedInNoDemand)"), - TestStep("13", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event Clear. Verify Event EEVSE.S.E01(EVNotDetected) sent"), - TestStep("13a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), - TestStep("13b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x01 (ChargingEnabled)"), - TestStep("13c", "TH reads from the DUT the SessionID attribute. Verify value is the same value noted in 4b"), - TestStep("13d", "TH reads from the DUT the SessionDuration attribute. Verify value is greater than 120 (and match the time taken for the tests from step 4 to step 13)"), - TestStep("14", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event. Verify Event EEVSE.S.E00(EVConnected) sent"), - TestStep("14a", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event. Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), - TestStep("14b", "TH reads from the DUT the SessionID attribute. Verify value is 1 more than the value noted in 4b"), - TestStep("15", "TH sends command Disable. Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvseStopped"), - TestStep("15a", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), + TestStep("8a", "TH reads from the DUT the State attribute.", + "Verify value is 0x03 (PluggedInCharging)"), + TestStep("8b", "TH reads from the DUT the SupplyState attribute.", + "Verify value is 1 (ChargingEnabled)"), + TestStep("8c", "TH reads from the DUT the ChargingEnabledUntil attribute", + "Verify value is the commanded value (NULL)"), + TestStep("8d", "TH reads from the DUT the MinimumChargeCurrent attribute", + "Verify value is the commanded value (6000)"), + TestStep("8e", "TH reads from the DUT the MaximumChargeCurrent attribute", + "Verify value is the MIN(command value (60000), CircuitCapacity)"), + TestStep("9", + "If the optional attribute is supported TH writes to the DUT UserMaximumChargeCurrent=6000"), + TestStep("9a", "After a few seconds TH reads from the DUT the MaximumChargeCurrent", + "Verify value is UserMaximumChargeCurrent value (6000)"), + TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear", + "Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvStopped"), + TestStep("10a", "TH reads from the DUT the State attribute", + "Verify value is 0x01 (PluggedInNoDemand)"), + TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event", + "Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), + TestStep("11a", "TH reads from the DUT the State attribute", + "Verify value is 0x03 (PluggedInCharging)"), + TestStep("12", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear", + "Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvStopped"), + TestStep("12a", "TH reads from the DUT the State attribute", + "Verify value is 0x01 (PluggedInNoDemand)"), + TestStep("13", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event Clear", + "Verify Event EEVSE.S.E01(EVNotDetected) sent"), + TestStep("13a", "TH reads from the DUT the State attribute", + "Verify value is 0x00 (NotPluggedIn)"), + TestStep("13b", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x01 (ChargingEnabled)"), + TestStep("13c", "TH reads from the DUT the SessionID attribute", + "Verify value is the same value noted in 4b"), + TestStep("13d", "TH reads from the DUT the SessionDuration attribute", + "Verify value is greater than 120 (and match the time taken for the tests from step 4 to step 13)"), + TestStep("14", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event", + "Verify Event EEVSE.S.E00(EVConnected) sent"), + TestStep("14a", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event", + "Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), + TestStep("14b", "TH reads from the DUT the SessionID attribute", + "Verify value is 1 more than the value noted in 4b"), + TestStep("15", "TH sends command Disable", + "Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvseStopped"), + TestStep("15a", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x00 (Disabled)"), TestStep("16", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear."), - TestStep("17", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event Clear. Verify Event EEVSE.S.E01(EVNotDetected) sent"), + TestStep("17", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event Clear", + "Verify Event EEVSE.S.E01(EVNotDetected) sent"), TestStep("18", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event Clear."), ] @@ -129,7 +175,8 @@ async def test_TC_EEVSE_2_2(self): self.step("4") await self.send_test_event_trigger_pluggedin() - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EVConnected) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EVConnected) self.step("4a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand) @@ -145,15 +192,18 @@ async def test_TC_EEVSE_2_2(self): max_charge_current = 60000 expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging # get epoch time for ChargeUntil variable (2 minutes from now) - utc_time_charging_end = datetime.now(tz=timezone.utc) + timedelta(seconds=charging_duration) + utc_time_charging_end = datetime.now( + tz=timezone.utc) + timedelta(seconds=charging_duration) # Matter epoch is 0 hours, 0 minutes, 0 seconds on Jan 1, 2000 UTC - epoch_time = int((utc_time_charging_end - datetime(2000, 1, 1, 0, 0, 0, 0, timezone.utc)).total_seconds()) + epoch_time = int((utc_time_charging_end - datetime(2000, + 1, 1, 0, 0, 0, 0, timezone.utc)).total_seconds()) await self.send_enable_charge_command(endpoint=1, charge_until=epoch_time, min_charge=min_charge_current, max_charge=max_charge_current) self.step("6") await self.send_test_event_trigger_charge_demand() - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EnergyTransferStarted) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EnergyTransferStarted) self.step("6a") await self.check_evse_attribute("State", expected_state) @@ -172,15 +222,18 @@ async def test_TC_EEVSE_2_2(self): expected_max_charge = min(max_charge_current, circuit_capacity) await self.check_evse_attribute("MaximumChargeCurrent", expected_max_charge) - self.validate_energy_transfer_started_event(event_data, session_id, expected_state, expected_max_charge) + self.validate_energy_transfer_started_event( + event_data, session_id, expected_state, expected_max_charge) self.step("7") # Sleep for the charging duration plus a couple of seconds to check it has stopped time.sleep(charging_duration + 2) # check EnergyTransferredStoped (EvseStopped) - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EnergyTransferStopped) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EnergyTransferStopped) expected_reason = Clusters.EnergyEvse.Enums.EnergyTransferStoppedReasonEnum.kEVSEStopped - self.validate_energy_transfer_stopped_event(event_data, session_id, expected_state, expected_reason) + self.validate_energy_transfer_stopped_event( + event_data, session_id, expected_state, expected_reason) self.step("7a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInDemand) @@ -194,7 +247,8 @@ async def test_TC_EEVSE_2_2(self): max_charge_current = 12000 await self.send_enable_charge_command(charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EnergyTransferStarted) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EnergyTransferStarted) self.step("8a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging) @@ -214,7 +268,8 @@ async def test_TC_EEVSE_2_2(self): await self.check_evse_attribute("MaximumChargeCurrent", expected_max_charge) # from step 8 above - validate event - self.validate_energy_transfer_started_event(event_data, session_id, expected_state, expected_max_charge) + self.validate_energy_transfer_started_event( + event_data, session_id, expected_state, expected_max_charge) self.step("9") # This will only work if the optional UserMaximumChargeCurrent attribute is supported @@ -227,16 +282,20 @@ async def test_TC_EEVSE_2_2(self): self.step("9a") time.sleep(3) - expected_max_charge = min(user_max_charge_current, circuit_capacity) + expected_max_charge = min( + user_max_charge_current, circuit_capacity) await self.check_evse_attribute("MaximumChargeCurrent", expected_max_charge) else: - logging.info("UserMaximumChargeCurrent is NOT supported... skipping.") + logging.info( + "UserMaximumChargeCurrent is NOT supported... skipping.") self.step("10") await self.send_test_event_trigger_charge_demand_clear() - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EnergyTransferStopped) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EnergyTransferStopped) expected_reason = Clusters.EnergyEvse.Enums.EnergyTransferStoppedReasonEnum.kEVStopped - self.validate_energy_transfer_stopped_event(event_data, session_id, expected_state, expected_reason) + self.validate_energy_transfer_stopped_event( + event_data, session_id, expected_state, expected_reason) self.step("10a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand) @@ -245,26 +304,32 @@ async def test_TC_EEVSE_2_2(self): await self.send_test_event_trigger_charge_demand() # Check we get EnergyTransferStarted again await self.send_enable_charge_command(charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EnergyTransferStarted) - self.validate_energy_transfer_started_event(event_data, session_id, expected_state, expected_max_charge) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EnergyTransferStarted) + self.validate_energy_transfer_started_event( + event_data, session_id, expected_state, expected_max_charge) self.step("11a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging) self.step("12") await self.send_test_event_trigger_charge_demand_clear() - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EnergyTransferStopped) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EnergyTransferStopped) expected_reason = Clusters.EnergyEvse.Enums.EnergyTransferStoppedReasonEnum.kEVStopped - self.validate_energy_transfer_stopped_event(event_data, session_id, expected_state, expected_reason) + self.validate_energy_transfer_stopped_event( + event_data, session_id, expected_state, expected_reason) self.step("12a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand) self.step("13") await self.send_test_event_trigger_pluggedin_clear() - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EVNotDetected) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EVNotDetected) expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand - self.validate_ev_not_detected_event(event_data, session_id, expected_state, expected_duration=0, expected_charged=0) + self.validate_ev_not_detected_event( + event_data, session_id, expected_state, expected_duration=0, expected_charged=0) self.step("13a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn) @@ -286,24 +351,31 @@ async def test_TC_EEVSE_2_2(self): session_id = session_id + 1 # Check we get a new EVConnected event with updated session ID - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EVConnected) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EVConnected) self.validate_ev_connected_event(event_data, session_id) self.step("14a") await self.send_test_event_trigger_charge_demand() - expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging # This is the value at the event time - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EnergyTransferStarted) - self.validate_energy_transfer_started_event(event_data, session_id, expected_state, expected_max_charge) + # This is the value at the event time + expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EnergyTransferStarted) + self.validate_energy_transfer_started_event( + event_data, session_id, expected_state, expected_max_charge) self.step("14b") await self.check_evse_attribute("SessionID", session_id) self.step("15") await self.send_disable_command() - expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging # This is the value prior to stopping - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EnergyTransferStopped) + # This is the value prior to stopping + expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EnergyTransferStopped) expected_reason = Clusters.EnergyEvse.Enums.EnergyTransferStoppedReasonEnum.kEVSEStopped - self.validate_energy_transfer_stopped_event(event_data, session_id, expected_state, expected_reason) + self.validate_energy_transfer_stopped_event( + event_data, session_id, expected_state, expected_reason) self.step("15a") await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabled) @@ -313,9 +385,11 @@ async def test_TC_EEVSE_2_2(self): self.step("17") await self.send_test_event_trigger_pluggedin_clear() - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EVNotDetected) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EVNotDetected) expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand - self.validate_ev_not_detected_event(event_data, session_id, expected_state, expected_duration=0, expected_charged=0) + self.validate_ev_not_detected_event( + event_data, session_id, expected_state, expected_duration=0, expected_charged=0) self.step("18") await self.send_test_event_trigger_basic_clear() diff --git a/src/python_testing/TC_EEVSE_2_3.py b/src/python_testing/TC_EEVSE_2_3.py new file mode 100644 index 00000000000000..d8d8f8fdfb96b5 --- /dev/null +++ b/src/python_testing/TC_EEVSE_2_3.py @@ -0,0 +1,454 @@ +# +# 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. + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +import logging +from datetime import datetime, timedelta, timezone + +import chip.clusters as Clusters +from chip.clusters.Types import NullValue +from chip.interaction_model import Status +from matter_testing_support import EventChangeCallback, MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts +from TC_EEVSE_Utils import EEVSEBaseTestHelper + +logger = logging.getLogger(__name__) + + +class TC_EEVSE_2_3(MatterBaseTest, EEVSEBaseTestHelper): + + def desc_TC_EEVSE_2_3(self) -> str: + """Returns a description of this test""" + return "5.1.4. [TC-EEVSE-2.3] Optional ChargingPreferences feature functionality with DUT as Server\n" \ + "This test case verifies the primary functionality of the Energy EVSE cluster server with the optional ChargingPreferences feature supported." + + def pics_TC_EEVSE_2_3(self): + """ This function returns a list of PICS for this test case that must be True for the test to be run""" + return ["EEVSE.S", "EEVSE.S.F00"] + + def steps_TC_EEVSE_2_3(self) -> list[TestStep]: + steps = [ + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.", + "Verify value is 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event.", + "Verify Command response is Success"), + TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE TimeOfUse Mode Test Event.", + "Verify Command response is Success"), + TestStep("5", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event.", + "Verify Command response is Success and event EEVSE.S.E00(EVConnected) sent"), + TestStep("6", "TH sends ClearTargets.", + "Verify Command response is Success"), + TestStep("6a", "TH reads NextChargeStartTime attribute.", + "Verify value is null."), + TestStep("6b", "TH reads NextChargeTargetTime attribute.", + "Verify value is null."), + TestStep("6c", "TH reads NextChargeRequiredEnergy attribute.", + "Verify value is null."), + TestStep("6d", "TH reads NextChargeTargetSoC attribute.", + "Verify value is null."), + TestStep("7", "TH sends GetTargets.", + "Response EEVSE.S.C00.Tx(GetTargetsResponse) sent with no targets defined."), + TestStep("8", "TH sends SetTargets with DayOfTheWeekforSequence=0x7F (i.e. having all days set) and a single ChargingTargets={TargetTime=1439, TargetSoC=null, AddedEnergy=25000000}.", + "Verify Command response is Success"), + TestStep("8a", "TH reads NextChargeStartTime attribute.", + "Verify value is null."), + TestStep("8b", "TH reads NextChargeTargetTime attribute.", + "Verify value is null."), + TestStep("8c", "TH reads NextChargeRequiredEnergy attribute.", + "Verify value is null."), + TestStep("8d", "TH reads NextChargeTargetSoC attribute.", + "Verify value is null."), + TestStep("9", "TH sends EnableCharging with ChargingEnabledUntil=null, minimumChargeCurrent=6000, maximumChargeCurrent=60000.", + "Verify Command response is Success"), + TestStep("9a", "TH reads NextChargeStartTime attribute.", + "Verify value is before the next TargetTime above."), + TestStep("9b", "TH reads NextChargeTargetTime attribute.", + "Verify value is TargetTime above."), + TestStep("9c", "TH reads NextChargeRequiredEnergy attribute.", + "Verify value is AddedEnergy above."), + TestStep("9d", "TH reads NextChargeTargetSoC attribute.", + "Verify value is null."), + TestStep("10", "TH sends GetTargets.", + "Response EEVSE.S.C00.Tx(GetTargetsResponse) sent with targets equivalent to the above (Note 1)."), + TestStep("11", "TH sends SetTargets with DayOfTheWeekforSequence=0x7F (i.e. having all days set) and a single ChargingTargets={TargetTime=1, TargetSoC=100, AddedEnergy=null}.", + "Verify Command response is Success"), + TestStep("11a", "TH reads NextChargeStartTime attribute.", + "Verify value is before the next TargetTime above."), + TestStep("11b", "TH reads NextChargeTargetTime attribute.", + "Verify value is TargetTime above."), + TestStep("11c", "TH reads NextChargeRequiredEnergy attribute.", + "Verify value is null."), + TestStep("11d", "TH reads NextChargeTargetSoC attribute.", + "Verify value is 100."), + TestStep("12", "TH sends GetTargets.", + "Response EEVSE.S.C00.Tx(GetTargetsResponse) sent with targets equivalent to the above (Note 1)."), + TestStep("13", "TH sends SetTargets with DayOfTheWeekforSequence=0x40 (i.e. having Saturday set) and 10 ChargingTargets with TargetTimes=60,180,300,420,540,660,780,900,1020,1140 and all with TargetSoC=null, AddedEnergy=2500000.", + "Verify Command response is Success"), + TestStep("14", "TH sends SetTargets with DayOfTheWeekforSequence=0x01 (i.e. having Sunday set) and no ChargingTargets.", + "Verify Command response is Success"), + TestStep("15", "TH sends GetTargets.", + "Response EEVSE.S.C00.Tx(GetTargetsResponse) sent with 1 target for each day Monday to Friday equivalent to step 9 (Note 1), 10 targets for Saturday as step 11, and no targets for Sunday."), + TestStep("16", "TH sends ClearTargets.", + "Verify Command response is Success"), + TestStep("16a", "TH reads NextChargeStartTime attribute.", + "Verify value is null."), + TestStep("16b", "TH reads NextChargeTargetTime attribute.", + "Verify value is null."), + TestStep("16c", "TH reads NextChargeRequiredEnergy attribute.", + "Verify value is null."), + TestStep("16d", "TH reads NextChargeTargetSoC attribute.", + "Verify value is null."), + TestStep("17", "TH sends GetTargets.", + "Response EEVSE.S.C00.Tx(GetTargetsResponse) sent with no targets defined."), + TestStep("18", "TH sends SetTargets with two identical ChargingTargetSchedules={DayOfTheWeekforSequence=0x01,ChargingTarget[0]={TargetTime=60,TargetSoC=null,AddedEnergy=2500000}}.", + "Verify Command response is ConstraintError"), + TestStep("19", "TH sends SetTargets with DayOfTheWeekforSequence=0x40 and 11 ChargingTargets with TargetTimes=60,180,300,420,540,660,780,900,1020,1140,1260 and all with TargetSoC=null, AddedEnergy=2500000.", + "Verify Command response is ResourceExhausted"), + TestStep("20", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event Clear.", + "Verify Command response is Success and event EEVSE.S.E01(EVNotDetected) sent"), + TestStep("21", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event Clear.", + "Verify Command response is Success"), + ] + + return steps + + def log_get_targets_response(self, get_targets_response): + logger.info(f" Rx'd: {get_targets_response}") + for index, entry in enumerate(get_targets_response.chargingTargetSchedules): + logger.info( + f" [{index}] DayOfWeekForSequence: {entry.dayOfWeekForSequence:02x}") + for sub_index, sub_entry in enumerate(entry.chargingTargets): + logger.info( + f" - [{sub_index}] TargetTime: {sub_entry.targetTimeMinutesPastMidnight} TargetSoC: {sub_entry.targetSoC} AddedEnergy: {sub_entry.addedEnergy}") + + def convert_epoch_s_to_time(self, epoch_s, tz=timezone.utc): + delta_from_epoch = timedelta(seconds=epoch_s) + matter_epoch = datetime(2000, 1, 1, 0, 0, 0, 0, tz) + + return matter_epoch + delta_from_epoch + + def compute_expected_target_time_as_epoch_s(self, minutes_past_midnight): + """Takes minutes past midnight and assumes local timezone, returns the value in Matter Epoch_S""" + # Matter epoch is 0 hours, 0 minutes, 0 seconds on Jan 1, 2000 UTC + # Get the current midnight + minutesPastMidnight as epoch_s + # NOTE that MinutesPastMidnight is in LOCAL time not UTC so it reflects + # the charging time based on where the consumer is. + target_time = datetime.now() # Get time in local time + target_time = target_time.replace(hour=int(minutes_past_midnight / 60), + minute=(minutes_past_midnight % 60), second=0, + microsecond=0) # Align to minutes past midnight + + if (target_time < datetime.now()): + # This is in the past - so we need to add 1 day + # We can get away with this in this test scenario - but should + # really look at the next target on this day to see if that is in the future + target_time = target_time + timedelta(days=1) + + # Shift to UTC so we can use timezone aware subtraction from Matter epoch in UTC + target_time = target_time.astimezone(timezone.utc) + + logger.info( + f"minutesPastMidnight = {minutes_past_midnight} => " + f"{int(minutes_past_midnight/60)}:{int(minutes_past_midnight%60)}" + f" Expected target_time = {target_time}") + + target_time_delta = target_time - \ + datetime(2000, 1, 1, 0, 0, 0, 0).astimezone(timezone.utc) + expected_target_time_epoch_s = int(target_time_delta.total_seconds()) + return expected_target_time_epoch_s + + @async_test_body + async def test_TC_EEVSE_2_3(self): + + self.step("1") + # Commission DUT - already done + + # Subscribe to Events and when they are sent push them to a queue for checking later + events_callback = EventChangeCallback(Clusters.EnergyEvse) + await events_callback.start(self.default_controller, + self.dut_node_id, + self.matter_test_config.endpoint) + + self.step("2") + await self.check_test_event_triggers_enabled() + + self.step("3") + await self.send_test_event_trigger_basic() + + self.step("4") + await self.send_test_event_trigger_time_of_use_mode() + + self.step("5") + await self.send_test_event_trigger_pluggedin() + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EVConnected) + session_id = event_data.sessionID + + self.step("6") + await self.send_clear_targets_command() + + self.step("6a") + await self.check_evse_attribute("NextChargeStartTime", NullValue) + + self.step("6b") + await self.check_evse_attribute("NextChargeTargetTime", NullValue) + + self.step("6c") + await self.check_evse_attribute("NextChargeRequiredEnergy", NullValue) + + self.step("6d") + await self.check_evse_attribute("NextChargeTargetSoC", NullValue) + + self.step("7") + get_targets_response = await self.send_get_targets_command() + self.log_get_targets_response(get_targets_response) + empty_targets_response = Clusters.EnergyEvse.Commands.GetTargetsResponse( + chargingTargetSchedules=[]) + asserts.assert_equal(get_targets_response, empty_targets_response, + f"Unexpected 'GetTargets' response value - expected {empty_targets_response}, was {get_targets_response}") + + self.step("8") + # The targets is a list of up to 7x ChargingTargetScheduleStruct's (one per day) + # each containing a list of up to 10x targets per day + minutes_past_midnight = 1439 + dailyTargets = [Clusters.EnergyEvse.Structs.ChargingTargetStruct(targetTimeMinutesPastMidnight=minutes_past_midnight, + # targetSoc not sent + addedEnergy=25000000)] + targets = [Clusters.EnergyEvse.Structs.ChargingTargetScheduleStruct( + dayOfWeekForSequence=0x7F, chargingTargets=dailyTargets)] + # This should be all days Sun-Sat (0x7F) with an TargetTime 1439 and added Energy 25kWh + await self.send_set_targets_command(chargingTargetSchedules=targets) + + self.step("8a") + await self.check_evse_attribute("NextChargeStartTime", NullValue) + + self.step("8b") + await self.check_evse_attribute("NextChargeTargetTime", NullValue) + + self.step("8c") + await self.check_evse_attribute("NextChargeRequiredEnergy", NullValue) + + self.step("8d") + await self.check_evse_attribute("NextChargeTargetSoC", NullValue) + + self.step("9") + await self.send_enable_charge_command(charge_until=NullValue, min_charge=6000, max_charge=60000) + + self.step("9a") + next_start_time_epoch_s = await self.read_evse_attribute_expect_success(attribute="NextChargeStartTime") + + expected_next_start_time_epoch_s = self.compute_expected_target_time_as_epoch_s( + minutes_past_midnight) + asserts.assert_less(next_start_time_epoch_s, + expected_next_start_time_epoch_s) + + self.step("9b") + await self.check_evse_attribute("NextChargeTargetTime", expected_next_start_time_epoch_s) + + self.step("9c") + await self.check_evse_attribute("NextChargeRequiredEnergy", 25000000) + + self.step("9d") + await self.check_evse_attribute("NextChargeTargetSoC", NullValue) + + self.step("10") + get_targets_response = await self.send_get_targets_command() + self.log_get_targets_response(get_targets_response) + asserts.assert_equal(get_targets_response.chargingTargetSchedules, targets, + f"Unexpected 'GetTargets' response value - expected {targets}, was {get_targets_response}") + + self.step("11") + # This should be all days Sun-Sat (0x7F) with an TargetTime 1 and SoC of 100%, AddedEnergy= NullValue + minutes_past_midnight = 1 + daily_targets_step_11 = [Clusters.EnergyEvse.Structs.ChargingTargetStruct(targetTimeMinutesPastMidnight=minutes_past_midnight, + targetSoC=100)] + targets_step_11 = [Clusters.EnergyEvse.Structs.ChargingTargetScheduleStruct( + dayOfWeekForSequence=0x7F, chargingTargets=daily_targets_step_11)] + + await self.send_set_targets_command(chargingTargetSchedules=targets_step_11) + + self.step("11a") + next_start_time_epoch_s = await self.read_evse_attribute_expect_success(attribute="NextChargeStartTime") + logger.info( + f"Received NextChargeStartTime: {next_start_time_epoch_s} = {self.convert_epoch_s_to_time(next_start_time_epoch_s, tz=None)}") + + self.step("11b") + next_target_time_epoch_s = await self.read_evse_attribute_expect_success(attribute="NextChargeTargetTime") + logger.info( + f"Received NextChargeTargetTime: {next_target_time_epoch_s} = {self.convert_epoch_s_to_time(next_target_time_epoch_s, tz=None)}") + + # This should be the next MinutesPastMidnight converted to realtime as epoch_s + expected_target_time_epoch_s = self.compute_expected_target_time_as_epoch_s( + minutes_past_midnight) + + asserts.assert_less(next_start_time_epoch_s, next_target_time_epoch_s, + f"Unexpected 'NextChargeStartTime' response value - expected this to be < {next_target_time_epoch_s}, was {next_start_time_epoch_s}") + + asserts.assert_equal(next_target_time_epoch_s, expected_target_time_epoch_s, + f"Unexpected 'NextChargeTargetTime' response value - expected {expected_target_time_epoch_s} = {self.convert_epoch_s_to_time(expected_target_time_epoch_s, tz=None)}, was {next_target_time_epoch_s} = {self.convert_epoch_s_to_time(next_target_time_epoch_s, tz=None)}") + + self.step("11c") + await self.check_evse_attribute("NextChargeRequiredEnergy", NullValue) + + self.step("11d") + await self.check_evse_attribute("NextChargeTargetSoC", 100) + + self.step("12") + get_targets_response = await self.send_get_targets_command() + self.log_get_targets_response(get_targets_response) + # This should be the same as targets_step_11 + asserts.assert_equal(get_targets_response.chargingTargetSchedules, targets_step_11, + f"Unexpected 'GetTargets' response value - expected {targets_step_11}, was {get_targets_response}") + + self.step("13") + # This should modify Sat (0x40) with 10 targets throughout the day + daily_targets_step_13 = [ + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=60, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=180, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=300, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=420, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=540, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=660, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=780, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=900, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=1020, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=1140, addedEnergy=25000000), + ] + targets_step_13 = [Clusters.EnergyEvse.Structs.ChargingTargetScheduleStruct( + dayOfWeekForSequence=0x40, chargingTargets=daily_targets_step_13)] + await self.send_set_targets_command(chargingTargetSchedules=targets_step_13) + + self.step("14") + # This should modify Sun (0x01) with NO targets on that day + daily_targets_step_14 = [] + targets_step_14 = [Clusters.EnergyEvse.Structs.ChargingTargetScheduleStruct( + dayOfWeekForSequence=0x01, chargingTargets=daily_targets_step_14)] + await self.send_set_targets_command(chargingTargetSchedules=targets_step_14) + + self.step("15") + get_targets_response = await self.send_get_targets_command() + self.log_get_targets_response(get_targets_response) + # We should expect that there should be 3 entries: + # [0] This should be all days (except Sun & Sat) = 0x3e with an TargetTime 1439 and added Energy 25kWh (from step 9) + # [1] This should be (Sat) = 0x40 with 10 TargetTimes and added Energy 25kWh (from step 11) + # [2] This should be (Sun) = 0x01 with NO Targets (from step 12) + # TODO - it would be better to iterate through each day and check it matches + asserts.assert_equal(len(get_targets_response.chargingTargetSchedules), 3, + "'GetTargets' response should have 3 entries") + asserts.assert_equal(get_targets_response.chargingTargetSchedules[0].dayOfWeekForSequence, 0x3e, + "'GetTargets' response entry 0 should have DayOfWeekForSequence = 0x3e (62)") + asserts.assert_equal(get_targets_response.chargingTargetSchedules[0].chargingTargets, daily_targets_step_11, + f"'GetTargets' response entry 0 should have chargingTargets = {daily_targets_step_11})") + asserts.assert_equal(get_targets_response.chargingTargetSchedules[1], targets_step_13[0], + f"'GetTargets' response entry 1 should be {targets_step_13})") + asserts.assert_equal(get_targets_response.chargingTargetSchedules[2], targets_step_14[0], + f"'GetTargets' response entry 2 should be {targets_step_14})") + + self.step("16") + await self.send_clear_targets_command() + + self.step("16a") + await self.check_evse_attribute("NextChargeStartTime", NullValue) + + self.step("16b") + await self.check_evse_attribute("NextChargeTargetTime", NullValue) + + self.step("16c") + await self.check_evse_attribute("NextChargeRequiredEnergy", NullValue) + + self.step("16d") + await self.check_evse_attribute("NextChargeTargetSoC", NullValue) + + self.step("17") + get_targets_response = await self.send_get_targets_command() + self.log_get_targets_response(get_targets_response) + asserts.assert_equal(get_targets_response, empty_targets_response, + f"Unexpected 'GetTargets' response value - expected {empty_targets_response}, was {get_targets_response}") + + self.step("18") + daily_targets_step_18 = [Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=60, addedEnergy=25000000)] + targets_step_18 = [Clusters.EnergyEvse.Structs.ChargingTargetScheduleStruct(dayOfWeekForSequence=0x1, chargingTargets=daily_targets_step_18), + Clusters.EnergyEvse.Structs.ChargingTargetScheduleStruct(dayOfWeekForSequence=0x1, chargingTargets=daily_targets_step_18)] + await self.send_set_targets_command(chargingTargetSchedules=targets_step_18, expected_status=Status.ConstraintError) + + self.step("19") + daily_targets_step_19 = [ + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=60, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=180, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=300, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=420, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=540, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=660, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=780, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=900, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=1020, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=1140, addedEnergy=25000000), + Clusters.EnergyEvse.Structs.ChargingTargetStruct( + targetTimeMinutesPastMidnight=1260, addedEnergy=25000000), + ] + + targets_step_19 = [Clusters.EnergyEvse.Structs.ChargingTargetScheduleStruct( + dayOfWeekForSequence=0x40, chargingTargets=daily_targets_step_19)] + await self.send_set_targets_command(chargingTargetSchedules=targets_step_19, expected_status=Status.ResourceExhausted) + + self.step("20") + await self.send_test_event_trigger_pluggedin_clear() + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EVNotDetected) + expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand + self.validate_ev_not_detected_event( + event_data, session_id, expected_state, expected_duration=0, expected_charged=0) + + self.step("21") + await self.send_test_event_trigger_basic_clear() + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_EEVSE_2_4.py b/src/python_testing/TC_EEVSE_2_4.py index f8d88270de4a83..3b2db653e86b63 100644 --- a/src/python_testing/TC_EEVSE_2_4.py +++ b/src/python_testing/TC_EEVSE_2_4.py @@ -14,12 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging import time @@ -45,30 +50,51 @@ def pics_TC_EEVSE_2_4(self): def steps_TC_EEVSE_2_4(self) -> list[TestStep]: steps = [ - TestStep("1", "Commissioning, already done", is_commissioning=True), - TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster", + "Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event"), - TestStep("3a", "After a few seconds TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), - TestStep("3b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), - TestStep("3c", "TH reads from the DUT the FaultState attribute. Verify value is 0x00 (NoError)"), - TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event. Verify Event EEVSE.S.E00(EVConnected) sent"), - TestStep("4a", "TH reads from the DUT the State attribute. Verify value is 0x01 (PluggedInNoDemand)"), - TestStep("4b", "TH reads from the DUT the SessionID attribute. Value is saved for later"), + TestStep("3a", "After a few seconds TH reads from the DUT the State attribute", + "Verify value is 0x00 (NotPluggedIn)"), + TestStep("3b", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x00 (Disabled)"), + TestStep("3c", "TH reads from the DUT the FaultState attribute", + "Verify value is 0x00 (NoError)"), + TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event", + "Verify Event EEVSE.S.E00(EVConnected) sent"), + TestStep("4a", "TH reads from the DUT the State attribute", + "Verify value is 0x01 (PluggedInNoDemand)"), + TestStep("4b", + "TH reads from the DUT the SessionID attribute. Value is saved for later"), TestStep("5", "TH sends command EnableCharging with ChargingEnabledUntil=Null, minimumChargeCurrent=6000, maximumChargeCurrent=60000"), - TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event. Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), - TestStep("6a", "TH reads from the DUT the State attribute. Verify value is 0x3 (PluggedInCharging)"), - TestStep("6b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x1 (ChargingEnabled)"), - TestStep("7", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Ground Fault Test Event. Verify Event EEVSE.S.E04(Fault) sent with SessionID matching value in step 4b, FaultStatePreviousFaultState = 0x00 (NoError), FaultStateCurrentFaultState = 0x07 (GroundFault)"), - TestStep("7a", "TH reads from the DUT the State attribute. Verify value is 0x6 (Fault)"), - TestStep("7b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x4 (DisabledError)"), - TestStep("8", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Over Temperature Fault Test Event. Verify Event EEVSE.S.E04(Fault) sent with SessionID matching value in step 4b, FaultStatePreviousFaultState = 0x07 (GroundFault), FaultStateCurrentFaultState = 0x0F (OverTemperature)"), - TestStep("8a", "TH reads from the DUT the State attribute. Verify value is 0x6 (Fault)"), - TestStep("8b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x4 (DisabledError)"), - TestStep("9", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Fault Test Event Clear. Verify Event EEVSE.S.E04(Fault) sent with SessionID matching value in step 4b, FaultStatePreviousFaultState = 0x0F (OverTemperature), FaultStateCurrentFaultState = 0x00 (NoError)"), - TestStep("9a", "TH reads from the DUT the State attribute. Verify value is 0x3 (PluggedInCharging)"), - TestStep("9b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x1 (ChargingEnabled)"), + TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event", + "Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), + TestStep("6a", "TH reads from the DUT the State attribute", + "Verify value is 0x3 (PluggedInCharging)"), + TestStep("6b", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x1 (ChargingEnabled)"), + TestStep("7", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Ground Fault Test Event", + "Verify Event EEVSE.S.E04(Fault) sent with SessionID matching value in step 4b, FaultStatePreviousFaultState = 0x00 (NoError), FaultStateCurrentFaultState = 0x07 (GroundFault)"), + TestStep("7a", "TH reads from the DUT the State attribute", + "Verify value is 0x6 (Fault)"), + TestStep("7b", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x4 (DisabledError)"), + TestStep("8", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Over Temperature Fault Test Event", + "Verify Event EEVSE.S.E04(Fault) sent with SessionID matching value in step 4b, FaultStatePreviousFaultState = 0x07 (GroundFault), FaultStateCurrentFaultState = 0x0F (OverTemperature)"), + TestStep("8a", "TH reads from the DUT the State attribute", + "Verify value is 0x6 (Fault)"), + TestStep("8b", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x4 (DisabledError)"), + TestStep("9", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Fault Test Event Clear", + "Verify Event EEVSE.S.E04(Fault) sent with SessionID matching value in step 4b, FaultStatePreviousFaultState = 0x0F (OverTemperature), FaultStateCurrentFaultState = 0x00 (NoError)"), + TestStep("9a", "TH reads from the DUT the State attribute", + "Verify value is 0x3 (PluggedInCharging)"), + TestStep("9b", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x1 (ChargingEnabled)"), TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear."), - TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event Clear. Verify Event EEVSE.S.E01(EVNotDetected) sent"), + TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event Clear", + "Verify Event EEVSE.S.E01(EVNotDetected) sent"), TestStep("12", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event Clear."), ] @@ -105,7 +131,8 @@ async def test_TC_EEVSE_2_4(self): self.step("4") await self.send_test_event_trigger_pluggedin() - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EVConnected) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EVConnected) self.step("4a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand) @@ -123,7 +150,8 @@ async def test_TC_EEVSE_2_4(self): self.step("6") await self.send_test_event_trigger_charge_demand() - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EnergyTransferStarted) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EnergyTransferStarted) self.step("6a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging) @@ -133,11 +161,13 @@ async def test_TC_EEVSE_2_4(self): self.step("7") await self.send_test_event_trigger_evse_ground_fault() - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.Fault) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.Fault) expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging previous_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kNoError current_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kGroundFault - self.validate_evse_fault_event(event_data, session_id, expected_state, previous_fault, current_fault) + self.validate_evse_fault_event( + event_data, session_id, expected_state, previous_fault, current_fault) self.step("7a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kFault) @@ -147,11 +177,13 @@ async def test_TC_EEVSE_2_4(self): self.step("8") await self.send_test_event_trigger_evse_over_temperature_fault() - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.Fault) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.Fault) expected_state = Clusters.EnergyEvse.Enums.StateEnum.kFault previous_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kGroundFault current_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kOverTemperature - self.validate_evse_fault_event(event_data, session_id, expected_state, previous_fault, current_fault) + self.validate_evse_fault_event( + event_data, session_id, expected_state, previous_fault, current_fault) self.step("8a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kFault) @@ -161,11 +193,13 @@ async def test_TC_EEVSE_2_4(self): self.step("9") await self.send_test_event_trigger_evse_fault_clear() - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.Fault) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.Fault) expected_state = Clusters.EnergyEvse.Enums.StateEnum.kFault previous_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kOverTemperature current_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kNoError - self.validate_evse_fault_event(event_data, session_id, expected_state, previous_fault, current_fault) + self.validate_evse_fault_event( + event_data, session_id, expected_state, previous_fault, current_fault) self.step("9a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging) @@ -175,13 +209,16 @@ async def test_TC_EEVSE_2_4(self): self.step("10") await self.send_test_event_trigger_charge_demand_clear() - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EnergyTransferStopped) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EnergyTransferStopped) self.step("11") await self.send_test_event_trigger_pluggedin_clear() - event_data = events_callback.wait_for_event_report(Clusters.EnergyEvse.Events.EVNotDetected) + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EVNotDetected) expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand - self.validate_ev_not_detected_event(event_data, session_id, expected_state, expected_duration=0, expected_charged=0) + self.validate_ev_not_detected_event( + event_data, session_id, expected_state, expected_duration=0, expected_charged=0) self.step("12") await self.send_test_event_trigger_basic_clear() diff --git a/src/python_testing/TC_EEVSE_2_5.py b/src/python_testing/TC_EEVSE_2_5.py index 3fdb5f901b6f97..89ee987ace2f66 100644 --- a/src/python_testing/TC_EEVSE_2_5.py +++ b/src/python_testing/TC_EEVSE_2_5.py @@ -14,12 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging @@ -45,24 +50,38 @@ def pics_TC_EEVSE_2_5(self): def steps_TC_EEVSE_2_5(self) -> list[TestStep]: steps = [ - TestStep("1", "Commissioning, already done", is_commissioning=True), - TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster", + "Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event"), - TestStep("3a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), - TestStep("3b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), - TestStep("3c", "TH reads from the DUT the FaultState attribute. Verify value is 0x00 (NoError)"), + TestStep("3a", "TH reads from the DUT the State attribute", + "Verify value is 0x00 (NotPluggedIn)"), + TestStep("3b", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x00 (Disabled)"), + TestStep("3c", "TH reads from the DUT the FaultState attribute", + "Verify value is 0x00 (NoError)"), TestStep("4", "TH sends command EnableCharging with ChargingEnabledUntil=Null, minimumChargeCurrent=6000, maximumChargeCurrent=60000"), - TestStep("4a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), - TestStep("4b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x01 (ChargingEnabled)"), - TestStep("5", "TH sends command StartDiagnostics. Verify that command is rejected with Failure"), + TestStep("4a", "TH reads from the DUT the State attribute", + "Verify value is 0x00 (NotPluggedIn)"), + TestStep("4b", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x01 (ChargingEnabled)"), + TestStep("5", "TH sends command StartDiagnostics", + "Verify that command is rejected with Failure"), TestStep("6", "TH sends command Disable."), - TestStep("6a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), - TestStep("6b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), - TestStep("7", "TH sends command StartDiagnostics. Verify that command is accepted with Success"), - TestStep("7a", "TH reads from the DUT the SupplyState attribute. Verify value is 0x04 (DisabledDiagnostics)"), + TestStep("6a", "TH reads from the DUT the State attribute", + "Verify value is 0x00 (NotPluggedIn)"), + TestStep("6b", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x00 (Disabled)"), + TestStep("7", "TH sends command StartDiagnostics", + "Verify that command is accepted with Success"), + TestStep("7a", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x04 (DisabledDiagnostics)"), TestStep("8", "A few seconds later TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Diagnostics Complete Event"), - TestStep("8a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), - TestStep("8b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), + TestStep("8a", "TH reads from the DUT the State attribute", + "Verify value is 0x00 (NotPluggedIn)"), + TestStep("8b", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x00 (Disabled)"), TestStep("9", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event Clear."), ] diff --git a/src/python_testing/TC_EEVSE_Utils.py b/src/python_testing/TC_EEVSE_Utils.py index 6b6b1395072ba0..17f64191ed37ec 100644 --- a/src/python_testing/TC_EEVSE_Utils.py +++ b/src/python_testing/TC_EEVSE_Utils.py @@ -16,8 +16,10 @@ import logging +import typing import chip.clusters as Clusters +from chip.clusters.Types import NullValue from chip.interaction_model import InteractionModelError, Status from mobly import asserts @@ -36,6 +38,22 @@ async def check_evse_attribute(self, attribute, expected_value, endpoint: int = asserts.assert_equal(value, expected_value, f"Unexpected '{attribute}' value - expected {expected_value}, was {value}") + def check_value_in_range(self, attribute: str, value: int, lower_value: int, upper_value: int): + asserts.assert_greater_equal(value, lower_value, + f"Unexpected '{attribute}' value - expected {lower_value}, was {value}") + asserts.assert_less_equal(value, upper_value, + f"Unexpected '{attribute}' value - expected {upper_value}, was {value}") + + async def check_evse_attribute_in_range(self, attribute, lower_value: int, upper_value: int, endpoint: int = None, allow_null: bool = False): + value = await self.read_evse_attribute_expect_success(endpoint=endpoint, attribute=attribute) + if allow_null and value is NullValue: + # skip the range check + logger.info("value is NULL - OK") + return value + + self.check_value_in_range(attribute, value, lower_value, upper_value) + return value + async def get_supported_energy_evse_attributes(self, endpoint: int = None): return await self.read_evse_attribute_expect_success(endpoint, "AttributeList") @@ -45,7 +63,8 @@ async def write_user_max_charge(self, endpoint: int = None, user_max_charge: int result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, Clusters.EnergyEvse.Attributes.UserMaximumChargeCurrent(user_max_charge))]) - asserts.assert_equal(result[0].Status, Status.Success, "UserMaximumChargeCurrent write failed") + asserts.assert_equal( + result[0].Status, Status.Success, "UserMaximumChargeCurrent write failed") async def send_enable_charge_command(self, endpoint: int = None, charge_until: int = None, timedRequestTimeoutMs: int = 3000, min_charge: int = 6000, max_charge: int = 32000, expected_status: Status = Status.Success): @@ -58,7 +77,8 @@ async def send_enable_charge_command(self, endpoint: int = None, charge_until: i timedRequestTimeoutMs=timedRequestTimeoutMs) except InteractionModelError as e: - asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + asserts.assert_equal(e.status, expected_status, + "Unexpected error returned") async def send_disable_command(self, endpoint: int = None, timedRequestTimeoutMs: int = 3000, expected_status: Status = Status.Success): try: @@ -67,7 +87,8 @@ async def send_disable_command(self, endpoint: int = None, timedRequestTimeoutMs timedRequestTimeoutMs=timedRequestTimeoutMs) except InteractionModelError as e: - asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + asserts.assert_equal(e.status, expected_status, + "Unexpected error returned") async def send_start_diagnostics_command(self, endpoint: int = None, timedRequestTimeoutMs: int = 3000, expected_status: Status = Status.Success): @@ -77,7 +98,46 @@ async def send_start_diagnostics_command(self, endpoint: int = None, timedReques timedRequestTimeoutMs=timedRequestTimeoutMs) except InteractionModelError as e: - asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + asserts.assert_equal(e.status, expected_status, + "Unexpected error returned") + + async def send_clear_targets_command(self, endpoint: int = None, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.ClearTargets(), + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, + "Unexpected error returned") + + async def send_get_targets_command(self, endpoint: int = None, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + get_targets_resp = await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.GetTargets(), + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, + "Unexpected error returned") + + return get_targets_resp + + async def send_set_targets_command(self, endpoint: int = None, + chargingTargetSchedules: typing.List[ + Clusters.EnergyEvse.Structs.ChargingTargetScheduleStruct] = None, + timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.SetTargets(chargingTargetSchedules), + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, + "Unexpected error returned") async def send_test_event_trigger_basic(self): await self.send_test_event_triggers(eventTrigger=0x0099000000000000) @@ -97,6 +157,9 @@ async def send_test_event_trigger_charge_demand(self): async def send_test_event_trigger_charge_demand_clear(self): await self.send_test_event_triggers(eventTrigger=0x0099000000000005) + async def send_test_event_trigger_time_of_use_mode(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000006) + async def send_test_event_trigger_evse_ground_fault(self): await self.send_test_event_triggers(eventTrigger=0x0099000000000010) diff --git a/src/python_testing/TC_EPM_2_1.py b/src/python_testing/TC_EPM_2_1.py index 2c39fd9aaa7d3f..81f0406a182f49 100644 --- a/src/python_testing/TC_EPM_2_1.py +++ b/src/python_testing/TC_EPM_2_1.py @@ -14,12 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging @@ -46,26 +51,48 @@ def pics_TC_EPM_2_1(self): def steps_TC_EPM_2_1(self) -> list[TestStep]: steps = [ - TestStep("1", "Commissioning, already done", is_commissioning=True), - TestStep("2", "TH reads PowerMode attribute. Verify that the DUT response contains an enum8 value"), - TestStep("3", "TH reads NumberOfMeasurementTypes attribute. Verify that the DUT response contains an uint8 value."), - TestStep("4", "TH reads Accuracy attribute. Verify that the DUT response contains a list of MeasurementAccuracyStruct entries - Verify that the list has between 1 and NumberOfMeasurementTypes entries."), - TestStep("5", "TH reads Ranges attribute. Verify that the DUT response contains a list of MeasurementRangeStruct entries - Verify that the list has between 0 and NumberOfMeasurementTypes entries."), - TestStep("6", "TH reads Voltage attribute. Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), - TestStep("7", "TH reads ActiveCurrent attribute. Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), - TestStep("8", "TH reads ReactiveCurrent attribute. Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), - TestStep("9", "TH reads ApparentCurrent attribute. Verify that the DUT response contains either null or an int64 value. Value has to be between a range of 0 to 2^62."), - TestStep("10", "TH reads ActivePower attribute. Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), - TestStep("11", "TH reads ReactivePower attribute. Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), - TestStep("12", "TH reads ApparentPower attribute. Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), - TestStep("13", "TH reads RMSVoltage attribute. Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), - TestStep("14", "TH reads RMSCurrent attribute. Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), - TestStep("15", "TH reads RMSPower attribute. Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), - TestStep("16", "TH reads Frequency attribute. Verify that the DUT response contains either null or an int64 value. Value has to be between a range of 0 to 1000000."), - TestStep("17", "TH reads HarmonicCurrents attribute. Verify that the DUT response contains a list of HarmonicMeasurementStruct entries."), - TestStep("18", "TH reads HarmonicPhases attribute. Verify that the DUT response contains a list of HarmonicMeasurementStruct entries."), - TestStep("19", "TH reads PowerFactor attribute. Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -10000 to 10000."), - TestStep("20", "TH reads NeutralCurrent attribute. Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads PowerMode attribute", + "Verify that the DUT response contains an enum8 value"), + TestStep("3", "TH reads NumberOfMeasurementTypes attribute", + "Verify that the DUT response contains an uint8 value."), + TestStep("4", "TH reads Accuracy attribute", + "Verify that the DUT response contains a list of MeasurementAccuracyStruct entries ", + "Verify that the list has between 1 and NumberOfMeasurementTypes entries."), + TestStep("5", "TH reads Ranges attribute", + "Verify that the DUT response contains a list of MeasurementRangeStruct entries ", + "Verify that the list has between 0 and NumberOfMeasurementTypes entries."), + TestStep("6", "TH reads Voltage attribute", + "Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), + TestStep("7", "TH reads ActiveCurrent attribute", + "Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), + TestStep("8", "TH reads ReactiveCurrent attribute", + "Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), + TestStep("9", "TH reads ApparentCurrent attribute", + "Verify that the DUT response contains either null or an int64 value. Value has to be between a range of 0 to 2^62."), + TestStep("10", "TH reads ActivePower attribute", + "Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), + TestStep("11", "TH reads ReactivePower attribute", + "Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), + TestStep("12", "TH reads ApparentPower attribute", + "Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), + TestStep("13", "TH reads RMSVoltage attribute", + "Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), + TestStep("14", "TH reads RMSCurrent attribute", + "Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), + TestStep("15", "TH reads RMSPower attribute", + "Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), + TestStep("16", "TH reads Frequency attribute", + "Verify that the DUT response contains either null or an int64 value. Value has to be between a range of 0 to 1000000."), + TestStep("17", "TH reads HarmonicCurrents attribute", + "Verify that the DUT response contains a list of HarmonicMeasurementStruct entries."), + TestStep("18", "TH reads HarmonicPhases attribute", + "Verify that the DUT response contains a list of HarmonicMeasurementStruct entries."), + TestStep("19", "TH reads PowerFactor attribute", + "Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -10000 to 10000."), + TestStep("20", "TH reads NeutralCurrent attribute", + "Verify that the DUT response contains either null or an int64 value. Value has to be between a range of -2^62 to 2^62."), ] return steps @@ -109,7 +136,8 @@ async def test_TC_EPM_2_1(self): for index, range_entry in enumerate(measurement.accuracyRanges): logging.info(f" [{index}] rangeMin:{range_entry.rangeMin} rangeMax:{range_entry.rangeMax} percentMax:{range_entry.percentMax} percentMin:{range_entry.percentMin} percentTypical:{range_entry.percentTypical} fixedMax:{range_entry.fixedMax} fixedMin:{range_entry.fixedMin} fixedTypical:{range_entry.fixedTypical}") - asserts.assert_greater(range_entry.rangeMax, range_entry.rangeMin, "rangeMax should be > rangeMin") + asserts.assert_greater( + range_entry.rangeMax, range_entry.rangeMin, "rangeMax should be > rangeMin") if index == 0: minimum_range = range_entry.rangeMin maximum_range = range_entry.rangeMax @@ -129,7 +157,8 @@ async def test_TC_EPM_2_1(self): asserts.assert_equal(minimum_range, measurement.minMeasuredValue, "The minMeasuredValue must be the same as any of the minimum of all rangeMin's") - asserts.assert_is(found_active_power, True, "There must be an ActivePower measurement accuracy") + asserts.assert_is(found_active_power, True, + "There must be an ActivePower measurement accuracy") asserts.assert_equal(len(accuracy), number_of_measurements, "The number of accuracy entries should match the NumberOfMeasurementTypes") @@ -202,9 +231,11 @@ async def test_TC_EPM_2_1(self): logger.info(f"Rx'd HarmonicCurrents: {harmonic_currents}") asserts.assert_is(type(harmonic_currents), list) for index, entry in enumerate(harmonic_currents): - logging.info(f" [{index}] order:{entry.order} measurement:{entry.measurement}") + logging.info( + f" [{index}] order:{entry.order} measurement:{entry.measurement}") asserts.assert_greater_equal(entry.order, 1) - self.check_value_in_range("Measurement", entry.measurement, MIN_INT64_ALLOWED, MAX_INT64_ALLOWED) + self.check_value_in_range( + "Measurement", entry.measurement, MIN_INT64_ALLOWED, MAX_INT64_ALLOWED) self.step("18") if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.HarmonicPhases.attribute_id in supported_attributes): @@ -212,9 +243,11 @@ async def test_TC_EPM_2_1(self): logger.info(f"Rx'd HarmonicPhases: {harmonic_phases}") asserts.assert_is(type(harmonic_phases), list) for index, entry in enumerate(harmonic_phases): - logging.info(f" [{index}] order:{entry.order} measurement:{entry.measurement}") + logging.info( + f" [{index}] order:{entry.order} measurement:{entry.measurement}") asserts.assert_greater_equal(entry.order, 1) - self.check_value_in_range("Measurement", entry.measurement, MIN_INT64_ALLOWED, MAX_INT64_ALLOWED) + self.check_value_in_range( + "Measurement", entry.measurement, MIN_INT64_ALLOWED, MAX_INT64_ALLOWED) self.step("19") if self.pics_guard(Clusters.ElectricalPowerMeasurement.Attributes.PowerFactor.attribute_id in supported_attributes): diff --git a/src/python_testing/TC_EPM_2_2.py b/src/python_testing/TC_EPM_2_2.py index b4a1079ce81b11..1ca497f4fabf4f 100644 --- a/src/python_testing/TC_EPM_2_2.py +++ b/src/python_testing/TC_EPM_2_2.py @@ -14,12 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging import time @@ -44,17 +49,25 @@ def pics_TC_EPM_2_2(self): def steps_TC_EPM_2_2(self) -> list[TestStep]: steps = [ - TestStep("1", "Commissioning, already done", is_commissioning=True), - TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster", + "Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EPM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EPM.TEST_EVENT_TRIGGER for Start Fake Load Test 1kW Event"), TestStep("4", "Wait 3 seconds"), - TestStep("4a", "TH reads from the DUT the ActivePower attribute. Verify the read is successful and that the value is between 980'000 and 1'020'000 mW. Note the value read."), - TestStep("4b", "TH reads from the DUT the ActiveCurrent attribute. Verify the read is successful and that the value is between 3'848 and 4'848 mA. Note the value read."), - TestStep("4c", "TH reads from the DUT the Voltage attribute. Verify the read is successful and that the value is between 229'000 and 231'000 mV. Note the value read."), + TestStep("4a", "TH reads from the DUT the ActivePower attribute", + "Verify the read is successful and that the value is between 980'000 and 1'020'000 mW. Note the value read."), + TestStep("4b", "TH reads from the DUT the ActiveCurrent attribute", + "Verify the read is successful and that the value is between 3'848 and 4'848 mA. Note the value read."), + TestStep("4c", "TH reads from the DUT the Voltage attribute", + "Verify the read is successful and that the value is between 229'000 and 231'000 mV. Note the value read."), TestStep("5", "Wait 3 seconds"), - TestStep("5a", "TH reads from the DUT the ActivePower attribute. Verify the read is successful, that the value is between '980'000 and 1'020'000 mW, and the value is different from the value read in step 4a."), - TestStep("5b", "TH reads from the DUT the ActiveCurrent attribute. Verify the read is successful, that the value is between 3'848 and 4'848 mA, and the value is different from the value read in step 4b."), - TestStep("5c", "TH reads from the DUT the Voltage attribute. Verify the read is successful, that the value is between 229'000 and 231'000 mV, and the value is different from the value read in step 4c."), + TestStep("5a", "TH reads from the DUT the ActivePower attribute", + "Verify the read is successful, that the value is between '980'000 and 1'020'000 mW, and the value is different from the value read in step 4a."), + TestStep("5b", "TH reads from the DUT the ActiveCurrent attribute", + "Verify the read is successful, that the value is between 3'848 and 4'848 mA, and the value is different from the value read in step 4b."), + TestStep("5c", "TH reads from the DUT the Voltage attribute", + "Verify the read is successful, that the value is between 229'000 and 231'000 mV, and the value is different from the value read in step 4c."), TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EPM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EPM.TEST_EVENT_TRIGGER for Stop Fake Readings Test Event."), ] @@ -78,15 +91,18 @@ async def test_TC_EPM_2_2(self): self.step("4a") # Active power is Mandatory - active_power = await self.check_epm_attribute_in_range("ActivePower", 980000, 1020000) # 1kW +/- 20W + # 1kW +/- 20W + active_power = await self.check_epm_attribute_in_range("ActivePower", 980000, 1020000) self.step("4b") if self.pics_guard(self.check_pics("EPM.S.A0005")): - active_current = await self.check_epm_attribute_in_range("ActiveCurrent", 3848, 4848) # 4.348 A +/- 500mA + # 4.348 A +/- 500mA + active_current = await self.check_epm_attribute_in_range("ActiveCurrent", 3848, 4848) self.step("4c") if self.pics_guard(self.check_pics("EPM.S.A0004")): - voltage = await self.check_epm_attribute_in_range("Voltage", 229000, 231000) # 230V +/- 1V + # 230V +/- 1V + voltage = await self.check_epm_attribute_in_range("Voltage", 229000, 231000) self.step("5") # After 3 seconds... @@ -94,20 +110,24 @@ async def test_TC_EPM_2_2(self): self.step("5a") # Active power is Mandatory - active_power2 = await self.check_epm_attribute_in_range("ActivePower", 980000, 1020000) # 1kW +/- 20W + # 1kW +/- 20W + active_power2 = await self.check_epm_attribute_in_range("ActivePower", 980000, 1020000) asserts.assert_not_equal(active_power, active_power2, f"Expected ActivePower readings to have changed {active_power}, {active_power2}") self.step("5b") if self.pics_guard(self.check_pics("EPM.S.A0005")): - active_current2 = await self.check_epm_attribute_in_range("ActiveCurrent", 3848, 4848) # 4.348 A +/- 500mA + # 4.348 A +/- 500mA + active_current2 = await self.check_epm_attribute_in_range("ActiveCurrent", 3848, 4848) asserts.assert_not_equal(active_current, active_current2, f"Expected ActiveCurrent readings to have changed {active_current}, {active_current2}") self.step("5c") if self.pics_guard(self.check_pics("EPM.S.A0004")): - voltage2 = await self.check_epm_attribute_in_range("Voltage", 229000, 231000) # 230V +/- 1V - asserts.assert_not_equal(voltage, voltage2, f"Expected Voltage readings to have changed {voltage}, {voltage2}") + # 230V +/- 1V + voltage2 = await self.check_epm_attribute_in_range("Voltage", 229000, 231000) + asserts.assert_not_equal( + voltage, voltage2, f"Expected Voltage readings to have changed {voltage}, {voltage2}") self.step("6") await self.send_test_event_trigger_stop_fake_readings() diff --git a/src/python_testing/TC_EWATERHTRBase.py b/src/python_testing/TC_EWATERHTRBase.py new file mode 100644 index 00000000000000..0bf42a7eb4d0a0 --- /dev/null +++ b/src/python_testing/TC_EWATERHTRBase.py @@ -0,0 +1,94 @@ +# +# 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 logging +import typing + +import chip.clusters as Clusters +from chip.interaction_model import InteractionModelError, Status +from mobly import asserts + +logger = logging.getLogger(__name__) + + +class EWATERHTRBase: + + async def read_whm_attribute_expect_success(self, endpoint: int = None, attribute: str = ""): + cluster = Clusters.Objects.WaterHeaterManagement + full_attr = getattr(cluster.Attributes, attribute) + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=full_attr) + + async def check_whm_attribute(self, attribute, expected_value, endpoint: int = None): + value = await self.read_whm_attribute_expect_success(endpoint=endpoint, attribute=attribute) + asserts.assert_equal(value, expected_value, + f"Unexpected '{attribute}' value - expected {expected_value}, was {value}") + + async def send_boost_command(self, duration: int, one_shot: typing.Optional[bool] = None, emergency_boost: typing.Optional[bool] = None, + temporary_setpoint: typing.Optional[int] = None, target_percentage: typing.Optional[int] = None, target_reheat: typing.Optional[int] = None, + endpoint: int = None, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.WaterHeaterManagement.Commands.Boost( + duration=duration, + oneShot=one_shot, + emergencyBoost=emergency_boost, + temporarySetpoint=temporary_setpoint, + targetPercentage=target_percentage, + targetReheat=target_reheat), + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + asserts.assert_equal(expected_status, Status.Success) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_cancel_boost_command(self, endpoint: int = None, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.WaterHeaterManagement.Commands.CancelBoost(), + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + asserts.assert_equal(expected_status, Status.Success) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_test_event_trigger_basic_installation_test_event(self): + await self.send_test_event_triggers(eventTrigger=0x0094000000000000) + + async def send_test_event_trigger_basic_installation_test_event_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0094000000000001) + + async def send_test_event_trigger_water_temperature20C_test_event(self): + await self.send_test_event_triggers(eventTrigger=0x0094000000000002) + + async def send_test_event_trigger_water_temperature61C_test_event(self): + await self.send_test_event_triggers(eventTrigger=0x0094000000000003) + + async def send_test_event_trigger_water_temperature66C_test_event(self): + await self.send_test_event_triggers(eventTrigger=0x0094000000000004) + + async def send_test_event_trigger_manual_mode_test_event(self): + await self.send_test_event_triggers(eventTrigger=0x0094000000000005) + + async def send_test_event_trigger_off_mode_test_event(self): + await self.send_test_event_triggers(eventTrigger=0x0094000000000006) + + async def send_test_event_trigger_draw_off_hot_water_test_event(self): + await self.send_test_event_triggers(eventTrigger=0x0094000000000007) diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py new file mode 100644 index 00000000000000..c278da6c094010 --- /dev/null +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -0,0 +1,121 @@ +# +# 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. + + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS ===# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x03 +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --int-arg PIXIT.EWATERHTR.EM:1 PIXIT.EWATERHTR.TP:2 +# === END CI TEST ARGUMENTS === + +import logging + +import chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts +from TC_EWATERHTRBase import EWATERHTRBase + +logger = logging.getLogger(__name__) + + +class TC_EWATERHTR_2_1(MatterBaseTest, EWATERHTRBase): + + def desc_TC_EWATERHTR_2_1(self) -> str: + """Returns a description of this test""" + return "[TC-EWATERHTR-2.1] Attributes with attributes with DUT as Server\n" \ + "This test case verifies the non-global attributes of the Water Heater Management cluster server." + + def pics_TC_EWATERHTR_2_1(self): + """ This function returns a list of PICS for this test case that must be True for the test to be run""" + return ["EWATERHTR.S"] + + def steps_TC_EWATERHTR_2_1(self) -> list[TestStep]: + steps = [ + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads HeaterTypes attribute.", + "DUT as Server replies with a WaterHeaterTypeBitmap (enum8) greater than 0x00 (at least one type supported), and less than 0x20 (no undefined types supported)."), + TestStep("3", "TH reads HeatDemand attribute.", + "DUT as Server replies with a WaterHeaterDemandBitmap (enum8)."), + TestStep("4", "TH reads TankVolume attribute.", + "DUT as Server replies with a uint16 value."), + TestStep("5", "TH reads EstimatedHeatRequired attribute.", + "DUT as Server replies with an energy-mWh value."), + TestStep("6", "TH reads TankPercentage attribute.", + "DUT as Server replies with a percent value."), + TestStep("7", "TH reads BoostState attribute.", + "DUT as Server replies with a BoostStateEnum (enum8) value."), + ] + + return steps + + @async_test_body + async def test_TC_EWATERHTR_2_1(self): + + em_supported = self.matter_test_config.global_test_params['PIXIT.EWATERHTR.EM'] + tp_supported = self.matter_test_config.global_test_params['PIXIT.EWATERHTR.TP'] + + self.step("1") + # Commission DUT - already done + + self.step("2") + heaterTypes = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") + asserts.assert_greater(heaterTypes, 0, + f"Unexpected HeaterTypes value - expected {heaterTypes} > 0") + asserts.assert_less_equal(heaterTypes, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kOther, + f"Unexpected HeaterTypes value - expected {heaterTypes} <= WaterHeaterTypeBitmap.kOther") + + self.step("3") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heatDemand, 0, + f"Unexpected HeatDemand value - expected {heatDemand} > 0") + asserts.assert_less_equal(heatDemand, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kOther, + f"Unexpected HeatDemand value - expected {heatDemand} <= WaterHeaterDemandBitmap.kOther") + + self.step("4") + if em_supported: + value = await self.read_whm_attribute_expect_success(attribute="TankVolume") + else: + logging.info("Skipping step 4 as PIXIT.EWATERHTR.EM not supported") + + self.step("5") + if em_supported: + value = await self.read_whm_attribute_expect_success(attribute="EstimatedHeatRequired") + asserts.assert_greater_equal(value, 0, f"Unexpected EstimatedHeatRequired value - expected {value} >= 0") + else: + logging.info("Skipping step 5 as PIXIT.EWATERHTR.EM not supported") + + self.step("6") + if tp_supported: + value = await self.read_whm_attribute_expect_success(attribute="TankPercentage") + asserts.assert_greater_equal(value, 0, f"Unexpected TankPercentage value - expected {value} >= 0") + asserts.assert_less_equal(value, 100, f"Unexpected TankPercentage value - expected {value} <= 100") + else: + logging.info("Skipping step 6 as PIXIT.EWATERHTR.TP not supported") + + self.step("7") + boost_state = await self.read_whm_attribute_expect_success(attribute="BoostState") + asserts.assert_less_equal(boost_state, Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive, + f"Unexpected BoostState value - expected {boost_state} should be BoostStateEnum (enum8) value in range 0x00 to 0x01") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_EWATERHTR_2_2.py b/src/python_testing/TC_EWATERHTR_2_2.py new file mode 100644 index 00000000000000..0d20e1d4af97f4 --- /dev/null +++ b/src/python_testing/TC_EWATERHTR_2_2.py @@ -0,0 +1,378 @@ +# +# 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. + + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS ===# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x00 +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + + +import logging +import time + +import chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts +from TC_EWATERHTRBase import EWATERHTRBase + +logger = logging.getLogger(__name__) + + +class TC_EWATERHTR_2_2(MatterBaseTest, EWATERHTRBase): + + def desc_TC_EWATERHTR_2_2(self) -> str: + """Returns a description of this test""" + return "[TC-EWATERHTR-2.2] Basic functionality with attributes with DUT as Server." \ + "This test case verifies the primary functionality of the Water Heater Management cluster server." + + def pics_TC_EWATERHTR_2_2(self): + """ This function returns a list of PICS for this test case that must be True for the test to be run""" + return ["EWATERHTR.S"] + + def steps_TC_EWATERHTR_2_2(self) -> list[TestStep]: + steps = [ + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.", + "Verify value is 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event.", + "Verify Command response is Success"), + TestStep("3a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("3b", "TH reads BoostState attribute.", + "Verify value is 0 (Inactive)"), + TestStep("3c", "TH reads HeaterTypes attribute.", + "Verify value is greater than 0x00 (at least one type supported) and store the value as HeaterTypes"), + TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Manual mode Test Event.", + "Verify Command response is Success"), + TestStep("4a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("5", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event.", + "Verify Command response is Success"), + TestStep("5a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 20C Test Event.", + "Verify Command response is Success"), + TestStep("6a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source)"), + TestStep("7", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Off mode Test Event.", + "Verify Command response is Success"), + TestStep("7a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("8", "TH sends Boost with Duration=5s,OneShot=True.", + "Verify Command response is Success"), + TestStep("8a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("8b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("9", "Wait 6 seconds"), + TestStep("9a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("9b", "TH reads BoostState attribute.", + "Verify value is 0 (Inactive)"), + TestStep("10", "TH sends Boost with Duration=600s,OneShot=True.", + "Verify Command response is Success"), + TestStep("10a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("10b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event.", + "Verify Command response is Success"), + TestStep("11a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("11b", "TH reads BoostState attribute.", + "Verify value is 0 (Inactive)"), + TestStep("12", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 20C Test Event.", + "Verify Command response is Success"), + TestStep("12a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("13", "TH sends Boost with Duration=600s.", + "Verify Command response is Success"), + TestStep("13a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("13b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("14", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event.", + "Verify Command response is Success"), + TestStep("14a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("14b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("15", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 20C Test Event.", + "Verify Command response is Success"), + TestStep("15a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("15b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("16", "TH sends CancelBoost.", + "Verify Command response is Success"), + TestStep("16a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("16b", "TH reads BoostState attribute.", + "Verify value is 0 (Inactive)"), + TestStep("17", "TH sends Boost with Duration=600s,TemporarySetpoint=65C.", + "Verify Command response is Success"), + TestStep("17a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("17b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("18", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event.", + "Verify Command response is Success"), + TestStep("18a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("18b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("19", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 66C Test Event.", + "Verify Command response is Success"), + TestStep("19a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("19b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("20", "TH sends Boost with Duration=600s,TemporarySetpoint=70C.", + "Verify Command response is Success"), + TestStep("20a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("20b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("21", "TH sends CancelBoost.", + "Verify Command response is Success"), + TestStep("21a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("21b", "TH reads BoostState attribute.", + "Verify value is 0 (Inactive)"), + TestStep("22", "TH sends CancelBoost.", + "Verify Command response is Success"), + TestStep("23", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event Clear.", + "Verify Command response is Success"), + ] + + return steps + + @async_test_body + async def test_TC_EWATERHTR_2_2(self): + + self.step("1") + # Commission DUT - already done + + self.step("2") + await self.check_test_event_triggers_enabled() + + self.step("3") + await self.send_test_event_trigger_basic_installation_test_event() + + self.step("3a") + await self.check_whm_attribute("HeatDemand", 0) + + self.step("3b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + self.step("3c") + heaterTypes = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") + asserts.assert_greater(heaterTypes, 0, + f"Unexpected HeaterTypes value - expected {heaterTypes} > 0") + asserts.assert_less_equal(heaterTypes, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kOther, + f"Unexpected HeaterTypes value - expected {heaterTypes} <= WaterHeaterTypeBitmap.kOther") + + self.step("4") + await self.send_test_event_trigger_manual_mode_test_event() + + self.step("4a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), + + self.step("5") + await self.send_test_event_trigger_water_temperature61C_test_event() + + self.step("5a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("6") + await self.send_test_event_trigger_water_temperature20C_test_event() + + self.step("6a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), + + self.step("7") + await self.send_test_event_trigger_off_mode_test_event() + + self.step("7a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("8") + await self.send_boost_command(duration=5, one_shot=True) + + self.step("8a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), + + self.step("8b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("9") + time.sleep(6) + + self.step("9a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("9b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + self.step("10") + await self.send_boost_command(duration=600, one_shot=True) + + self.step("10a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), + + self.step("10b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("11") + await self.send_test_event_trigger_water_temperature61C_test_event() + + self.step("11a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("11b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + self.step("12") + await self.send_test_event_trigger_water_temperature20C_test_event() + + self.step("12a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("13") + await self.send_boost_command(duration=600) + + self.step("13a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), + + self.step("13b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("14") + await self.send_test_event_trigger_water_temperature61C_test_event() + + self.step("14a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("14b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("15") + await self.send_test_event_trigger_water_temperature20C_test_event() + + self.step("15a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), + + self.step("15b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("16") + await self.send_cancel_boost_command() + + self.step("16a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("16b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + self.step("17") + await self.send_boost_command(duration=600, temporary_setpoint=6500) + + self.step("17a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), + + self.step("17b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("18") + await self.send_test_event_trigger_water_temperature61C_test_event() + + self.step("18a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), + + self.step("18b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("19") + await self.send_test_event_trigger_water_temperature66C_test_event() + + self.step("19a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("19b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("20") + await self.send_boost_command(duration=600, temporary_setpoint=7000) + + self.step("20a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), + + self.step("20b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("21") + await self.send_cancel_boost_command() + + self.step("21a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("21b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + self.step("22") + await self.send_cancel_boost_command() + + self.step("23") + await self.send_test_event_trigger_basic_installation_test_event_clear() + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_EWATERHTR_2_3.py b/src/python_testing/TC_EWATERHTR_2_3.py new file mode 100644 index 00000000000000..b9572c9520d843 --- /dev/null +++ b/src/python_testing/TC_EWATERHTR_2_3.py @@ -0,0 +1,285 @@ +# +# 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. + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS ===# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x03 +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + + +import logging + +import chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts +from TC_EWATERHTRBase import EWATERHTRBase + +logger = logging.getLogger(__name__) + + +class TC_EWATERHTR_2_3(MatterBaseTest, EWATERHTRBase): + + def desc_TC_EWATERHTR_2_3(self) -> str: + """Returns a description of this test""" + return "[TC-EWATERHTR-2.3] This test case verifies the functionality of the Water Heater Management cluster server with the TankPercentage feature." + + def pics_TC_EWATERHTR_2_3(self): + """ This function returns a list of PICS for this test case that must be True for the test to be run""" + return ["EWATERHTR.S", "EWATERHTR.S.F01"] + + def steps_TC_EWATERHTR_2_3(self) -> list[TestStep]: + steps = [ + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.", + "Verify value is 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event.", + "Verify Command response is Success"), + TestStep("3a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("3b", "TH reads BoostState attribute.", + "Verify value is 0 (Inactive)"), + TestStep("3c", "TH reads TankPercentage attribute.", + "Verify value is 0%"), + TestStep("3d", "TH reads HeaterTypes attribute.", + "Verify value is greater than 0x00 (at least one type supported) and store the value as HeaterTypes"), + TestStep("4", "TH sends Boost with Duration=600s,TargetPercentage=100%.", + "Verify Command response is Success"), + TestStep("4a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("4b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("5", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event.", + "Verify Command response is Success"), + TestStep("5a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("5b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("5c", "TH reads TankPercentage attribute.", + "Verify value is 100%"), + TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Draw off hot water Test Event.", + "Verify Command response is Success"), + TestStep("6a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("6b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("6c", "TH reads TankPercentage attribute.", + "Verify value is 75%"), + TestStep("7", "TH sends CancelBoost.", + "Verify Command response is Success"), + TestStep("7a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("7b", "TH reads BoostState attribute.", + "Verify value is 0 (Inactive)"), + TestStep("7c", "TH reads TankPercentage attribute.", + "Verify value is 75%"), + TestStep("8", "TH sends Boost with Duration=600s,TargetPercentage=100%,TargetReheat=65%.", + "Verify Command response is Success"), + TestStep("8a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("8b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("8c", "TH reads TankPercentage attribute.", + "Verify value is 75%"), + TestStep("9", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event.", + "Verify Command response is Success"), + TestStep("9a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("9b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("9c", "TH reads TankPercentage attribute.", + "Verify value is 100%"), + TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Draw off hot water Test Event.", + "Verify Command response is Success"), + TestStep("10a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("10b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("10c", "TH reads TankPercentage attribute.", + "Verify value is 75%"), + TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Draw off hot water Test Event.", + "Verify Command response is Success"), + TestStep("11a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("11b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("11c", "TH reads TankPercentage attribute.", + "Verify value is 50%"), + TestStep("12", "TH sends CancelBoost.", + "Verify Command response is Success"), + TestStep("12a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("12b", "TH reads BoostState attribute.", + "Verify value is 0 (Inactive)"), + TestStep("12c", "TH reads TankPercentage attribute.", + "Verify value is 50%"), + TestStep("13", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event Clear.", + "Verify Command response is Success"), + ] + + return steps + + @async_test_body + async def test_TC_EWATERHTR_2_3(self): + + self.step("1") + # Commission DUT - already done + + self.step("2") + await self.check_test_event_triggers_enabled() + + self.step("3") + await self.send_test_event_trigger_basic_installation_test_event() + + self.step("3a") + await self.check_whm_attribute("HeatDemand", 0) + + self.step("3b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + self.step("3c") + await self.check_whm_attribute("TankPercentage", 0) + + self.step("3d") + heaterTypes = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") + asserts.assert_greater(heaterTypes, 0) + + self.step("4") + await self.send_boost_command(duration=600, target_percentage=100) + + self.step("4a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), + + self.step("4b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("5") + await self.send_test_event_trigger_water_temperature61C_test_event() + + self.step("5a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("5b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("5c") + await self.check_whm_attribute("TankPercentage", 100) + + self.step("6") + await self.send_test_event_trigger_draw_off_hot_water_test_event() + + self.step("6a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), + + self.step("6b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("6c") + await self.check_whm_attribute("TankPercentage", 75) + + self.step("7") + await self.send_cancel_boost_command() + + self.step("7a") + await self.check_whm_attribute("HeatDemand", 0) + + self.step("7b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + self.step("7c") + await self.check_whm_attribute("TankPercentage", 75) + + self.step("8") + await self.send_boost_command(duration=600, target_percentage=100, target_reheat=65) + + self.step("8a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), + + self.step("8b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("8c") + await self.check_whm_attribute("TankPercentage", 75) + + self.step("9") + await self.send_test_event_trigger_water_temperature61C_test_event() + + self.step("9a") + await self.check_whm_attribute("HeatDemand", 0) + + self.step("9b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("9c") + await self.check_whm_attribute("TankPercentage", 100) + + self.step("10") + await self.send_test_event_trigger_draw_off_hot_water_test_event() + + self.step("10a") + await self.check_whm_attribute("HeatDemand", 0) + + self.step("10b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("10c") + await self.check_whm_attribute("TankPercentage", 75) + + self.step("11") + await self.send_test_event_trigger_draw_off_hot_water_test_event() + + self.step("11a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), + + self.step("11b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("11c") + await self.check_whm_attribute("TankPercentage", 50) + + self.step("12") + await self.send_cancel_boost_command() + + self.step("12a") + await self.check_whm_attribute("HeatDemand", 0) + + self.step("12b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + self.step("12c") + await self.check_whm_attribute("TankPercentage", 50) + + self.step("13") + await self.send_test_event_trigger_basic_installation_test_event_clear() + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_FAN_3_1.py b/src/python_testing/TC_FAN_3_1.py index f16eaf35f6c4a2..9e4477e9a258fa 100644 --- a/src/python_testing/TC_FAN_3_1.py +++ b/src/python_testing/TC_FAN_3_1.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging import time diff --git a/src/python_testing/TC_FAN_3_2.py b/src/python_testing/TC_FAN_3_2.py index 85a733a14c4033..e38706313db50d 100644 --- a/src/python_testing/TC_FAN_3_2.py +++ b/src/python_testing/TC_FAN_3_2.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging import time diff --git a/src/python_testing/TC_FAN_3_3.py b/src/python_testing/TC_FAN_3_3.py index 0ef571dffb0aa1..a70c457aed25d3 100644 --- a/src/python_testing/TC_FAN_3_3.py +++ b/src/python_testing/TC_FAN_3_3.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging diff --git a/src/python_testing/TC_FAN_3_4.py b/src/python_testing/TC_FAN_3_4.py index 1d7e7c8c9f81c5..95a2240c4eae5c 100644 --- a/src/python_testing/TC_FAN_3_4.py +++ b/src/python_testing/TC_FAN_3_4.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging diff --git a/src/python_testing/TC_FAN_3_5.py b/src/python_testing/TC_FAN_3_5.py index 67a15919db8a6c..a80e4b15aa91eb 100644 --- a/src/python_testing/TC_FAN_3_5.py +++ b/src/python_testing/TC_FAN_3_5.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging import time diff --git a/src/python_testing/TC_ICDM_2_1.py b/src/python_testing/TC_ICDM_2_1.py index 44fde90aee7813..ac20cf2c001fb0 100644 --- a/src/python_testing/TC_ICDM_2_1.py +++ b/src/python_testing/TC_ICDM_2_1.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${LIT_ICD_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging import re diff --git a/src/python_testing/TC_ICDM_3_1.py b/src/python_testing/TC_ICDM_3_1.py index f5a37cd763c7af..938479a9147f5f 100644 --- a/src/python_testing/TC_ICDM_3_1.py +++ b/src/python_testing/TC_ICDM_3_1.py @@ -16,12 +16,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${LIT_ICD_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging import os diff --git a/src/python_testing/TC_ICDManagementCluster.py b/src/python_testing/TC_ICDManagementCluster.py index 6db1863e45bc1e..9f54e9b7dc227a 100644 --- a/src/python_testing/TC_ICDManagementCluster.py +++ b/src/python_testing/TC_ICDManagementCluster.py @@ -14,12 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${LIT_ICD_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import ctypes from enum import IntEnum @@ -41,6 +46,7 @@ class ICDTestEventTriggerOperations(IntEnum): kRemoveActiveModeReq = 0x0046000000000002 kInvalidateHalfCounterValues = 0x0046000000000003 kInvalidateAllCounterValues = 0x0046000000000004 + kForceMaximumCheckInBackOffState = 0x0046000000000005 class TestICDManagementCluster(MatterBaseTest): @@ -108,6 +114,15 @@ async def test_active_mode_test_event_trigger(self): ) ) + asserts.assert_is_none( + await dev_ctrl.SendCommand( + self.dut_node_id, + endpoint=kRootEndpointId, + payload=Clusters.GeneralDiagnostics.Commands.TestEventTrigger(enableKey=kTestEventTriggerKey, + eventTrigger=ICDTestEventTriggerOperations.kForceMaximumCheckInBackOffState) + ) + ) + if __name__ == "__main__": default_matter_test_main() diff --git a/src/python_testing/TC_IDM_1_2.py b/src/python_testing/TC_IDM_1_2.py index c91cef571d952f..d5985c8ae967f1 100644 --- a/src/python_testing/TC_IDM_1_2.py +++ b/src/python_testing/TC_IDM_1_2.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import inspect import logging diff --git a/src/python_testing/TC_IDM_1_4.py b/src/python_testing/TC_IDM_1_4.py index 07d3cde29ba326..fcfb5915ed136a 100644 --- a/src/python_testing/TC_IDM_1_4.py +++ b/src/python_testing/TC_IDM_1_4.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f # test-runner-run/run1/script-args: --hex-arg PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY:000102030405060708090a0b0c0d0e0f --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging diff --git a/src/python_testing/TC_IDM_4_2.py b/src/python_testing/TC_IDM_4_2.py index 60016ba4dcf20a..8cd84011a4fdfe 100644 --- a/src/python_testing/TC_IDM_4_2.py +++ b/src/python_testing/TC_IDM_4_2.py @@ -15,16 +15,29 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + import copy import logging import time import chip.clusters as Clusters from chip.ChipDeviceCtrl import ChipDeviceController +from chip.clusters import ClusterObjects as ClusterObjects from chip.clusters.Attribute import AttributePath, TypedAttributePath from chip.exceptions import ChipStackError from chip.interaction_model import Status -from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main +from matter_testing_support import AttributeChangeCallback, MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts ''' @@ -45,11 +58,37 @@ class TC_IDM_4_2(MatterBaseTest): - ROOT_NODE_ENDPOINT_ID = 0 + def steps_TC_IDM_4_2(self): + return [TestStep(0, "CR1 reads the ServerList attribute from the Descriptor cluster on EP0.", + "If the ICD Management cluster ID (70,0x46) is present, set SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC = IdleModeDuration and min_interval_floor_s to 0, otherwise, set SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC = 60 mins and min_interval_floor_s to 3."), + TestStep(1, "CR1 sends a subscription message to the DUT with MaxIntervalCeiling set to a value greater than subscription_max_interval_publisher_limit_sec. DUT sends a report data action to the TH. CR1 sends a success status response to the DUT. DUT sends a Subscribe Response Message to the CR1 to activate the subscription.", + "Verify on the CR1, a report data message is received. Verify it contains the following data Report data - data of the attribute/event requested earlier. Verify on the CR1 the Subscribe Response has the following fields, SubscriptionId - Verify it is of type uint32. MaxInterval - Verify it is of type uint32. Verify that the MaxInterval is less than or equal to MaxIntervalCeiling."), + TestStep(2, "CR1 sends a subscription message to the DUT with MaxIntervalCeiling set to a value less than subscription_max_interval_publisher_limit_sec. DUT sends a report data action to the CR1. CR1 sends a success status response to the DUT. DUT sends a Subscribe Response Message to the CR1 to activate the subscription.", + "Verify on the CR1, a report data message is received. Verify it contains the following data: Report data - data of the attribute/event requested earlier. Verify on the CR1 the Subscribe Response has the following fields, SubscriptionId - Verify it is of type uint32. MaxInterval - Verify it is of type uint32. Verify that the MaxInterval is less than or equal to SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT."), + TestStep(3, "Setup CR2 such that it does not have access to a specific cluster. CR2 sends a subscription message to subscribe to an attribute on that cluster for which it does not have access.", + "Verify that the DUT returns a \"INVALID_ACTION\" status response."), + TestStep(4, "Setup CR2 such that it does not have access to all attributes on a specific cluster and endpoint. CR2 sends a subscription request to subscribe to all attributes for which it does not have access.", + "Verify that the DUT returns a \"INVALID_ACTION\" status response."), + TestStep(5, "Setup CR2 such that it does not have access to an Endpoint. CR2 sends a subscription request to subscribe to all attributes on all clusters on a specific Endpoint for which it does not have access.", + "Verify that the DUT returns a \"INVALID_ACTION\" status response."), + TestStep(6, "Setup CR2 such that it does not have access to the Node. CR2 sends a subscription request to subscribe to all attributes on all clusters on all endpoints on a Node for which it does not have access.", + "Verify that the DUT returns a \"INVALID_ACTION\" status response."), + TestStep(7, "CR1 sends a subscription request action for an attribute with an empty DataVersionFilters field. DUT sends a report data action with the data of the attribute along with the data version. Tear down the subscription for that attribute. Start another subscription with the DataVersionFilter field set to the data version received above.", + "Verify that the subscription is activated between CR1 and DUT."), + TestStep(8, "CR1 sends a subscription request action for an attribute and sets the MinIntervalFloor to min_interval_floor_sec and MaxIntervalCeiling to 10. Activate the Subscription between CR1 and DUT and record the time when the priming ReportDataMessage is received as t_report_sec. Save the returned MaxInterval from the SubscribeResponseMessage as max_interval_sec."), + TestStep(9, "CR1 modifies the attribute which has been subscribed to on the DUT and waits for an incoming ReportDataMessage", + "Verify that t_update - t_report is greater than min_interval_floor_s and less than the ReadClient SubscriptionTimeout (calculated by the ReadClient using max_interval_s and the maximum estimated network delay based on the MRP parameters for retries with backoff)"), + TestStep(10, "CR1 sends a subscription request action for an attribute and set the MinIntervalFloor value to be greater than MaxIntervalCeiling.", + "Verify that the DUT sends an error message and the subscription is not established."), + TestStep(11, "CR1 sends a subscription request to subscribe to a specific global attribute from all clusters on all endpoints.", + "Verify that the Subscription succeeds and the DUT sends back the attribute values for the global attribute."), + TestStep(12, "CR1 sends a subscription request to subscribe to a global attribute on an endpoint on all clusters.", + "Verify that the Subscription succeeds and the DUT sends back the attribute values for the global attribute. Verify no data from other endpoints is sent back."), + TestStep(13, "CR1 sends a subscription request to the DUT with both AttributeRequests and EventRequests as empty.", + "Verify that the Subscription does not succeed and the DUT sends back a Status Response Action with the INVALID_ACTION Status Code") + ] - async def write_acl(self, ctrl, acl, ep=ROOT_NODE_ENDPOINT_ID): - result = await ctrl.WriteAttribute(self.dut_node_id, [(ep, Clusters.AccessControl.Attributes.Acl(acl))]) - asserts.assert_equal(result[ep].Status, Status.Success, "ACL write failed") + ROOT_NODE_ENDPOINT_ID = 0 async def get_descriptor_server_list(self, ctrl, ep=ROOT_NODE_ENDPOINT_ID): return await self.read_single_attribute_check_success( @@ -59,6 +98,14 @@ async def get_descriptor_server_list(self, ctrl, ep=ROOT_NODE_ENDPOINT_ID): attribute=Clusters.Descriptor.Attributes.ServerList ) + async def get_descriptor_parts_list(self, ctrl, ep=ROOT_NODE_ENDPOINT_ID): + return await self.read_single_attribute_check_success( + endpoint=ep, + dev_ctrl=ctrl, + cluster=Clusters.Descriptor, + attribute=Clusters.Descriptor.Attributes.PartsList + ) + async def get_idle_mode_duration_sec(self, ctrl, ep=ROOT_NODE_ENDPOINT_ID): return await self.read_single_attribute_check_success( endpoint=ep, @@ -81,14 +128,18 @@ def verify_attribute_exists(sub, cluster, attribute, ep=ROOT_NODE_ENDPOINT_ID): @staticmethod def get_typed_attribute_path(attribute, ep=ROOT_NODE_ENDPOINT_ID): return TypedAttributePath( - Path=AttributePath( + Path=AttributePath.from_attribute( EndpointId=ep, Attribute=attribute ) ) - async def get_dut_acl(self, ep=ROOT_NODE_ENDPOINT_ID): - sub = await self.default_controller.ReadAttribute( + async def write_dut_acl(self, ctrl, acl, ep=ROOT_NODE_ENDPOINT_ID): + result = await ctrl.WriteAttribute(self.dut_node_id, [(ep, Clusters.AccessControl.Attributes.Acl(acl))]) + asserts.assert_equal(result[ep].Status, Status.Success, "ACL write failed") + + async def get_dut_acl(self, ctrl, ep=ROOT_NODE_ENDPOINT_ID): + sub = await ctrl.ReadAttribute( nodeid=self.dut_node_id, attributes=[(ep, Clusters.AccessControl.Attributes.Acl)], keepSubscriptions=False, @@ -99,11 +150,10 @@ async def get_dut_acl(self, ep=ROOT_NODE_ENDPOINT_ID): return acl_list - async def add_ace_to_dut_acl(self, ctrl, ace): - dut_acl_original = await self.get_dut_acl() + async def add_ace_to_dut_acl(self, ctrl, ace, dut_acl_original): dut_acl = copy.deepcopy(dut_acl_original) dut_acl.append(ace) - await self.write_acl(ctrl=ctrl, acl=dut_acl) + await self.write_dut_acl(ctrl=ctrl, acl=dut_acl) @staticmethod def is_valid_uint32_value(var): @@ -121,8 +171,7 @@ async def test_TC_IDM_4_2(self): cluster_rev_attr_typed_path = self.get_typed_attribute_path(cluster_rev_attr) node_label_attr = Clusters.BasicInformation.Attributes.NodeLabel node_label_attr_path = [(0, node_label_attr)] - node_label_attr_typed_path = self.get_typed_attribute_path(node_label_attr) - SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC = 0 + subscription_max_interval_publisher_limit_sec = 0 INVALID_ACTION_ERROR_CODE = 0x580 # Controller 1 setup @@ -130,6 +179,9 @@ async def test_TC_IDM_4_2(self): # Will write ACL for controller 2 and validate success/error codes CR1: ChipDeviceController = self.default_controller + # Original DUT ACL used for reseting the ACL on some steps + dut_acl_original = await self.get_dut_acl(CR1) + # Controller 2 setup # Subscriber/client with limited access to the DUT # Will validate error status codes @@ -140,8 +192,14 @@ async def test_TC_IDM_4_2(self): paaTrustStorePath=str(self.matter_test_config.paa_trust_store_path), ) - # Read ServerList attribute - self.print_step("0a", "CR1 reads the Descriptor cluster ServerList attribute from EP0") + # *** Step 0 *** + # CR1 reads the ServerList attribute from the Descriptor cluster on EP0. If the ICDManagement cluster ID + # (70,0x46) is present, set SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC = IdleModeDuration and + # min_interval_floor_s to 0, otherwise, set SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC = 60 mins and + # min_interval_floor_s to 3. + self.step(0) + + # Reads the ServerList attribute ep0_servers = await self.get_descriptor_server_list(CR1) # Check if ep0_servers contains the ICD Management cluster ID (0x0046) @@ -151,19 +209,27 @@ async def test_TC_IDM_4_2(self): "CR1 reads from the DUT the IdleModeDuration attribute and sets SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC = IdleModeDuration") idleModeDuration = await self.get_idle_mode_duration_sec(CR1) - - SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC = idleModeDuration + subscription_max_interval_publisher_limit_sec = idleModeDuration + min_interval_floor_sec = 0 else: # Defaulting SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC to 60 minutes - SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC = 60 * 60 + subscription_max_interval_publisher_limit_sec = 60 * 60 + min_interval_floor_sec = 3 + + asserts.assert_greater_equal(subscription_max_interval_publisher_limit_sec, 1, + "SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC must be at least 1") logging.info( - f"Set SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC to {SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC} seconds") + f"Set SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC to {subscription_max_interval_publisher_limit_sec} seconds") # *** Step 1 *** - self.print_step(1, "CR1 sends a subscription message to the DUT with MaxIntervalCeiling set to a value greater than SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC. DUT sends a report data action to the TH. CR1 sends a success status response to the DUT. DUT sends a Subscribe Response Message to the CR1 to activate the subscription.") - min_interval_floor_sec = 1 - max_interval_ceiling_sec = SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC + 5 + # CR1 sends a subscription message to the DUT with MaxIntervalCeiling set to a value greater than + # SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC. DUT sends a report data action to the TH. CR1 sends + # a success status response to the DUT. DUT sends a Subscribe Response Message to the CR1 to activate + # the subscription. + self.step(1) + + max_interval_ceiling_sec = subscription_max_interval_publisher_limit_sec + 5 asserts.assert_greater(max_interval_ceiling_sec, min_interval_floor_sec, "MaxIntervalCeiling must be greater than MinIntervalFloor") @@ -198,9 +264,15 @@ async def test_TC_IDM_4_2(self): sub_cr1_step1.Shutdown() # *** Step 2 *** - self.print_step(2, "CR1 sends a subscription message to the DUT with MaxIntervalCeiling set to a value less than SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC. DUT sends a report data action to the CR1. CR1 sends a success status response to the DUT. DUT sends a Subscribe Response Message to the CR1 to activate the subscription.") - min_interval_floor_sec = 1 - max_interval_ceiling_sec = max(2, SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC - 5) + # CR1 sends a subscription message to the DUT with MaxIntervalCeiling set to a value less than + # subscription_max_interval_publisher_limit_sec. DUT sends a report data action to the CR1. + # CR1 sends a success status response to the DUT. DUT sends a Subscribe Response Message to the + # CR1 to activate the subscription. + self.step(2) + + min_interval_floor_sec = 0 + + max_interval_ceiling_sec = max(1, subscription_max_interval_publisher_limit_sec - 5) asserts.assert_greater(max_interval_ceiling_sec, min_interval_floor_sec, "MaxIntervalCeiling must be greater than MinIntervalFloor") @@ -229,13 +301,18 @@ async def test_TC_IDM_4_2(self): "MaxInterval is not of uint32 type.") # Verify MaxInterval is less than or equal to MaxIntervalCeiling - asserts.assert_less_equal(sub_cr1_step2_max_interval_ceiling_sec, SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC, + asserts.assert_less_equal(sub_cr1_step2_max_interval_ceiling_sec, subscription_max_interval_publisher_limit_sec, "MaxInterval is not less than or equal to SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT_SEC") sub_cr1_step2.Shutdown() # *** Step 3 *** - self.print_step(3, "Setup CR2 such that it does not have access to a specific cluster. CR2 sends a subscription message to subscribe to an attribute on that cluster for which it does not have access.") + # Setup CR2 such that it does not have access to a specific cluster. CR2 sends a subscription + # message to subscribe to an attribute on that cluster for which it does not have access. + self.step(3) + + # Setting max_interval_ceiling_sec value for steps 3-8 + max_interval_ceiling_sec = 10 # Limited ACE for controller 2 with single cluster access CR2_limited_ace = Clusters.AccessControl.Structs.AccessControlEntryStruct( @@ -244,18 +321,20 @@ async def test_TC_IDM_4_2(self): targets=[Clusters.AccessControl.Structs.AccessControlTargetStruct(cluster=Clusters.BasicInformation.id)], subjects=[CR2_nodeid]) - self.add_ace_to_dut_acl(CR1, CR2_limited_ace) + # Add limited ACE + await self.add_ace_to_dut_acl(CR1, CR2_limited_ace, dut_acl_original) # Controller 2 tries to subscribe an attribute from a cluster # it doesn't have access to # "INVALID_ACTION" status response expected + try: await CR2.ReadAttribute( nodeid=self.dut_node_id, # Attribute from a cluster controller 2 has no access to attributes=[(0, Clusters.AccessControl.Attributes.Acl)], keepSubscriptions=False, - reportInterval=[3, 3], + reportInterval=(min_interval_floor_sec, max_interval_ceiling_sec), autoResubscribe=False ) asserts.fail("Expected exception not thrown") @@ -265,7 +344,10 @@ async def test_TC_IDM_4_2(self): "Incorrect error response for subscription to unallowed cluster") # *** Step 4 *** - self.print_step(4, "Setup CR2 such that it does not have access to all attributes on a specific cluster and endpoint. CR2 sends a subscription request to subscribe to all attributes for which it does not have access.") + # Setup CR2 such that it does not have access to all attributes on a specific cluster and + # endpoint. CR2 sends a subscription request to subscribe to all attributes for which it + # does not have access. + self.step(4) # Limited ACE for controller 2 with single cluster access and specific endpoint CR2_limited_ace = Clusters.AccessControl.Structs.AccessControlEntryStruct( @@ -273,10 +355,11 @@ async def test_TC_IDM_4_2(self): authMode=Clusters.AccessControl.Enums.AccessControlEntryAuthModeEnum.kCase, targets=[Clusters.AccessControl.Structs.AccessControlTargetStruct( endpoint=1, - cluster=Clusters.BasicInformation.id)], + cluster=Clusters.Descriptor.id)], subjects=[CR2_nodeid]) - self.add_ace_to_dut_acl(CR1, CR2_limited_ace) + # Add limited ACE + await self.add_ace_to_dut_acl(CR1, CR2_limited_ace, dut_acl_original) # Controller 2 tries to subscribe to all attributes from a cluster # it doesn't have access to @@ -287,7 +370,7 @@ async def test_TC_IDM_4_2(self): # Cluster controller 2 has no access to attributes=[(0, Clusters.BasicInformation)], keepSubscriptions=False, - reportInterval=[3, 3], + reportInterval=(min_interval_floor_sec, max_interval_ceiling_sec), autoResubscribe=False ) raise ValueError("Expected exception not thrown") @@ -296,17 +379,30 @@ async def test_TC_IDM_4_2(self): asserts.assert_equal(e.err, INVALID_ACTION_ERROR_CODE, "Incorrect error response for subscription to unallowed cluster") + await self.write_dut_acl(CR1, dut_acl_original) + acl_list = await self.get_dut_acl(CR1) + print(f'acl_list - reset 4: {acl_list}') + # *** Step 5 *** - self.print_step(5, "Setup CR2 such that it does not have access to an Endpoint. CR2 sends a subscription request to subscribe to all attributes on all clusters on a specific Endpoint for which it does not have access.") + # Setup CR2 such that it does not have access to an Endpoint. CR2 sends a subscription + # request to subscribe to all attributes on all clusters on a specific Endpoint for which + # it does not have access. + self.step(5) + + # Get first value of parts list for the endpoint + parts_list = await self.get_descriptor_parts_list(CR1) + asserts.assert_greater(len(parts_list), 0, "Parts list is empty.") + endpoint = parts_list[0] # Limited ACE for controller 2 with endpoint 1 access only to all clusters and all attributes CR2_limited_ace = Clusters.AccessControl.Structs.AccessControlEntryStruct( privilege=Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kView, authMode=Clusters.AccessControl.Enums.AccessControlEntryAuthModeEnum.kCase, - targets=[Clusters.AccessControl.Structs.AccessControlTargetStruct(endpoint=1)], + targets=[Clusters.AccessControl.Structs.AccessControlTargetStruct(endpoint=endpoint)], subjects=[CR2_nodeid]) - self.add_ace_to_dut_acl(CR1, CR2_limited_ace) + # Add limited ACE + await self.add_ace_to_dut_acl(CR1, CR2_limited_ace, dut_acl_original) # Controller 2 tries to subscribe to all attributes from all clusters # on an endpoint it doesn't have access to @@ -317,7 +413,7 @@ async def test_TC_IDM_4_2(self): # Endpoint controller 2 has no access to attributes=[(0)], keepSubscriptions=False, - reportInterval=[3, 3], + reportInterval=(min_interval_floor_sec, max_interval_ceiling_sec), autoResubscribe=False ) raise ValueError("Expected exception not thrown") @@ -327,14 +423,15 @@ async def test_TC_IDM_4_2(self): "Incorrect error response for subscription to unallowed endpoint") # *** Step 6 *** - self.print_step(6, "Setup CR2 such that it does not have access to the Node. CR2 sends a subscription request to subscribe to all attributes on all clusters on all endpoints on a Node for which it does not have access.") + # Setup CR2 such that it does not have access to the Node. CR2 sends a subscription + # request to subscribe to all attributes on all clusters on all endpoints on a Node + # for which it does not have access. + self.step(6) - # Skip setting an ACE for controller 2 so - # the DUT node rejects subscribing to it + # Skip setting an ACE for controller 2 so the DUT node rejects subscribing to it - # Write original DUT ACL into DUT - dut_acl_original = await self.get_dut_acl() - await self.write_acl(ctrl=CR1, acl=dut_acl_original) + # Restore original DUT ACL + await self.write_dut_acl(CR1, dut_acl_original) # Controller 2 tries to subscribe to all attributes from all clusters # from all endpoints on a node it doesn't have access to @@ -345,7 +442,7 @@ async def test_TC_IDM_4_2(self): nodeid=self.dut_node_id, attributes=[], keepSubscriptions=False, - reportInterval=[3, 3], + reportInterval=(min_interval_floor_sec, max_interval_ceiling_sec), autoResubscribe=False ) raise ValueError("Expected exception not thrown") @@ -355,7 +452,12 @@ async def test_TC_IDM_4_2(self): "Incorrect error response for subscription to unallowed node") # *** Step 7 *** - self.print_step(7, "CR1 sends a subscription request action for an attribute with an empty DataVersionFilters field. DUT sends a report data action with the data of the attribute along with the data version. Tear down the subscription for that attribute. Start another subscription with the DataVersionFilter field set to the data version received above.") + # CR1 sends a subscription request action for an attribute with an empty + # DataVersionFilters field. DUT sends a report data action with the data + # of the attribute along with the data version. Tear down the subscription + # for that attribute. Start another subscription with the DataVersionFilter + # field set to the data version received above. + self.step(7) # Subscribe to attribute with empty dataVersionFilters sub_cr1_empty_dvf = await CR1.ReadAttribute( @@ -376,94 +478,126 @@ async def test_TC_IDM_4_2(self): data_version_filter = [(0, Clusters.BasicInformation, data_version)] # Subscribe to attribute with provided DataVersion - sub_cr1_provided_dvf = await CR1.ReadAttribute( + sub_cr1_step7 = await CR1.ReadAttribute( nodeid=self.dut_node_id, attributes=node_label_attr_path, - reportInterval=(10, 20), + reportInterval=(min_interval_floor_sec, max_interval_ceiling_sec), keepSubscriptions=False, dataVersionFilters=data_version_filter ) # Verify that the subscription is activated between CR1 and DUT - asserts.assert_true(sub_cr1_provided_dvf.subscriptionId, "Subscription not activated") + asserts.assert_true(sub_cr1_step7.subscriptionId, "Subscription not activated") - sub_cr1_provided_dvf.Shutdown() + sub_cr1_step7.Shutdown() # *** Step 8 *** - self.print_step(8, "CR1 sends a subscription request action for an attribute and sets the MinIntervalFloor value to be same as MaxIntervalCeiling. Activate the Subscription between CR1 and DUT. Modify the attribute which has been subscribed to on the DUT.") + # CR1 sends a subscription request action for an attribute and sets the + # MinIntervalFloor to min_interval_floor_sec and MaxIntervalCeiling to 10. + # Activate the Subscription between CR1 and DUT and record the time when + # the priming ReportDataMessage is received as t_report_sec. Save the + # returned MaxInterval from the SubscribeResponseMessage as max_interval_sec. + self.step(8) # Subscribe to attribute - same_min_max_interval_sec = 3 sub_cr1_update_value = await CR1.ReadAttribute( nodeid=self.dut_node_id, attributes=node_label_attr_path, - reportInterval=(same_min_max_interval_sec, same_min_max_interval_sec), + reportInterval=(min_interval_floor_sec, max_interval_ceiling_sec), keepSubscriptions=False ) - # Modify attribute value + # Record the time when the priming ReportDataMessage is received + t_report_sec = time.time() + + # *** Step 9 *** + # CR1 modifies the attribute which has been subscribed to on the DUT + # and waits for an incoming ReportDataMessage + self.step(9) + + # Saving the returned MaxInterval from the SubscribeResponseMessage + min_interval_floor_sec, max_interval_sec = sub_cr1_update_value.GetReportingIntervalsSeconds() + + # Get subscription timeout + subscription_timeout_sec = sub_cr1_update_value.GetSubscriptionTimeoutMs() / 1000 + + # Set Attribute Update Callback + node_label_update_cb = AttributeChangeCallback(node_label_attr) + sub_cr1_update_value.SetAttributeUpdateCallback(node_label_update_cb) + + # Update attribute value new_node_label_write = "NewNodeLabel_011235813" await CR1.WriteAttribute( self.dut_node_id, [(0, node_label_attr(value=new_node_label_write))] ) - # Wait MinIntervalFloor seconds before reading updated attribute value - time.sleep(same_min_max_interval_sec) - new_node_label_read = sub_cr1_update_value.GetAttribute(node_label_attr_typed_path) + node_label_update_cb.wait_for_report() + + # Save the time that the report is received + t_update_sec = time.time() - # Verify new attribute value after MinIntervalFloor time - asserts.assert_equal(new_node_label_read, new_node_label_write, "Attribute value not updated after write operation.") + # Elapsed time between attribute subscription and write update + t_elapsed_sec = t_update_sec - t_report_sec + + # Verify that t_update - t_report is greater than min_interval_floor_s and less than the ReadClient SubscriptionTimeout + asserts.assert_greater(t_elapsed_sec, min_interval_floor_sec, + f"t_update_sec - t_report_sec ({t_elapsed_sec}s) must be greater than min_interval_floor_sec ({min_interval_floor_sec}s)") + asserts.assert_less(t_elapsed_sec, subscription_timeout_sec, + f"t_update_sec - t_report_sec ({t_elapsed_sec}s) must be less than subscription_timeout_sec ({subscription_timeout_sec}s)") sub_cr1_update_value.Shutdown() - # *** Step 9 *** - self.print_step( - 9, "CR1 sends a subscription request action for an attribute and set the MinIntervalFloor value to be greater than MaxIntervalCeiling.") + # *** Step 10 *** + # CR1 sends a subscription request action for an attribute and set the MinIntervalFloor + # value to be greater than MaxIntervalCeiling. + self.step(10) - # Subscribe to attribute with invalid reportInterval arguments, expect and exception + # Subscribe to attribute with invalid reportInterval arguments, expect an error sub_cr1_invalid_intervals = None - try: + with asserts.assert_raises(ChipStackError, "Expected exception wasn't thrown."): sub_cr1_invalid_intervals = await CR1.ReadAttribute( nodeid=self.dut_node_id, attributes=node_label_attr_path, reportInterval=(20, 10), keepSubscriptions=False ) - except ChipStackError: - # Verify no subscription is established - with asserts.assert_raises(AttributeError): - sub_cr1_invalid_intervals.subscriptionId - except Exception: - asserts.fail("Expected exception was not thrown") - # *** Step 10 *** - self.print_step( - 10, "CR1 sends a subscription request to subscribe to a specific global attribute from all clusters on all endpoints.") + # Verify no subscription was established + with asserts.assert_raises(AttributeError): + sub_cr1_invalid_intervals.subscriptionId + + # *** Step 11 *** + # CR1 sends a subscription request to subscribe to a specific global attribute from + # all clusters on all endpoints. + self.step(11) + + # Setting max_interval_ceiling_sec value for steps 11-13 + max_interval_ceiling_sec = 10 # Omitting endpoint to indicate endpoint wildcard cluster_rev_attr_path = [(cluster_rev_attr)] # Subscribe to global attribute - sub_cr1_step10 = await CR1.ReadAttribute( + sub_cr1_step11 = await CR1.ReadAttribute( nodeid=self.dut_node_id, attributes=cluster_rev_attr_path, - reportInterval=(3, 3), + reportInterval=(min_interval_floor_sec, max_interval_ceiling_sec), keepSubscriptions=False ) # Verify that the subscription is activated between CR1 and DUT - asserts.assert_true(sub_cr1_step10.subscriptionId, "Subscription not activated") + asserts.assert_true(sub_cr1_step11.subscriptionId, "Subscription not activated") # Verify attribute came back self.verify_attribute_exists( - sub=sub_cr1_step10, + sub=sub_cr1_step11, cluster=Clusters.BasicInformation, attribute=cluster_rev_attr ) # Verify DUT sends back the attribute values for the global attribute - cluster_revision_attr_value = sub_cr1_step10.GetAttribute(cluster_rev_attr_typed_path) + cluster_revision_attr_value = sub_cr1_step11.GetAttribute(cluster_rev_attr_typed_path) # Verify ClusterRevision is of uint16 type asserts.assert_true(self.is_valid_uint16_value(cluster_revision_attr_value), "ClusterRevision is not of uint16 type.") @@ -471,58 +605,60 @@ async def test_TC_IDM_4_2(self): # Verify valid ClusterRevision value asserts.assert_greater_equal(cluster_revision_attr_value, 0, "Invalid ClusterRevision value.") - sub_cr1_step10.Shutdown() + sub_cr1_step11.Shutdown() - # *** Step 11 *** - self.print_step(11, "CR1 sends a subscription request to subscribe to a global attribute on an endpoint on all clusters.") + # *** Step 12 *** + # CR1 sends a subscription request to subscribe to a global attribute on an endpoint on all clusters. + self.step(12) # Specifying single endpoint 0 requested_ep = 0 cluster_rev_attr_path = [(requested_ep, cluster_rev_attr)] # Subscribe to global attribute - sub_cr1_step11 = await CR1.ReadAttribute( + sub_cr1_step12 = await CR1.ReadAttribute( nodeid=self.dut_node_id, attributes=cluster_rev_attr_path, - reportInterval=(3, 3), + reportInterval=(min_interval_floor_sec, max_interval_ceiling_sec), keepSubscriptions=False ) # Verify that the subscription is activated between CR1 and DUT - asserts.assert_true(sub_cr1_step11.subscriptionId, "Subscription not activated") + asserts.assert_true(sub_cr1_step12.subscriptionId, "Subscription not activated") # Verify attribute came back self.verify_attribute_exists( - sub=sub_cr1_step11, + sub=sub_cr1_step12, cluster=Clusters.BasicInformation, attribute=cluster_rev_attr ) # Verify no data from other endpoints is sent back - attributes = sub_cr1_step11.GetAttributes() + attributes = sub_cr1_step12.GetAttributes() ep_keys = list(attributes.keys()) asserts.assert_true(len(ep_keys) == 1, "More than one endpoint returned, exactly 1 was expected") # Verify DUT sends back the attribute values for the global attribute cluster_rev_attr_typed_path = self.get_typed_attribute_path(cluster_rev_attr) - cluster_revision_attr_value = sub_cr1_step11.GetAttribute(cluster_rev_attr_typed_path) + cluster_revision_attr_value = sub_cr1_step12.GetAttribute(cluster_rev_attr_typed_path) # Verify ClusterRevision is of uint16 type asserts.assert_true(self.is_valid_uint16_value(cluster_revision_attr_value), "ClusterRevision is not of uint16 type.") - sub_cr1_step11.Shutdown() + sub_cr1_step12.Shutdown() - # *** Step 12 *** - self.print_step(12, "CR1 sends a subscription request to the DUT with both AttributeRequests and EventRequests as empty.") + # *** Step 13 *** + # CR1 sends a subscription request to the DUT with both AttributeRequests and EventRequests as empty. + self.step(13) # Attempt a subscription with both AttributeRequests and EventRequests as empty - sub_cr1_step12 = None + sub_cr1_step13 = None try: - sub_cr1_step12 = await CR1.Read( + sub_cr1_step13 = await CR1.Read( nodeid=self.dut_node_id, attributes=[], events=[], - reportInterval=(3, 3) + reportInterval=(min_interval_floor_sec, max_interval_ceiling_sec), ) raise ValueError("Expected exception not thrown") except ChipStackError as e: @@ -532,7 +668,7 @@ async def test_TC_IDM_4_2(self): # Verify no subscription is established with asserts.assert_raises(AttributeError): - sub_cr1_step12.subscriptionId + sub_cr1_step13.subscriptionId except Exception: asserts.fail("Expected exception was not thrown") diff --git a/src/python_testing/TC_LVL_2_3.py b/src/python_testing/TC_LVL_2_3.py new file mode 100644 index 00000000000000..57fbe2b7edc367 --- /dev/null +++ b/src/python_testing/TC_LVL_2_3.py @@ -0,0 +1,186 @@ +# +# 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. +# + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${CHIP_MICROWAVE_OVEN_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +import logging +import time + +import chip.clusters as Clusters +import test_plan_support +from matter_testing_support import (ClusterAttributeChangeAccumulator, MatterBaseTest, TestStep, default_matter_test_main, + has_cluster, per_endpoint_test) +from mobly import asserts + + +class TC_LVL_2_3(MatterBaseTest): + + def steps_TC_LVL_2_3(self) -> list[TestStep]: + THRead = "TH reads" + THcommand = "TH sends the command" + return [TestStep(1, test_plan_support.commission_if_required(), is_commissioning=True), + TestStep(2, f"{THRead} FeatureMap attribute."), + TestStep(3, f"{THRead} MaxLevel attribute and store value as maxLevel", test_plan_support.verify_success()), + TestStep(4, f"{THcommand} MoveWithOnOff with MoveMode field set to Down and remaining fields set to 0", + test_plan_support.verify_success()), + TestStep(5, f"{THRead} CurrentLevel attribute and store value as startCurrentLevel", + test_plan_support.verify_success()), + TestStep(6, "Set up a subscription wildcard subscription for the Level Control Cluster, with MinIntervalFloor set to 0, MaxIntervalCeiling set to 30 and KeepSubscriptions set to false", + "Subscription successfully established"), + TestStep(7, f"{THcommand} MoveToLevel with Level field set to maxLevel, TransitionTime field set to 10 and remaining fields set to 0", + test_plan_support.verify_success()), + TestStep(8, "TH stores the reported values of CurrentLevel in all incoming reports for CurrentLevel attribute, that contains data in reportedCurrentLevelValuesList, over a period of 30 seconds."), + TestStep(9, "TH verifies that reportedCurrentLevelValuesList does not contain more than 10 entries for CurrentLevel", + "reportedCurrentLevelValuesList has 10 or less entries in the list"), + TestStep(10, "If reportedCurrentLevelValuesList only contain a single entry, TH verifies the value of the entry is equal to maxLevel", + "The entry in reportedCurrentLevelValuesList is equal to maxLevel"), + TestStep(11, "If reportedCurrentLevelValuesList contains two or more entries, TH verifies the value of the first entry is larger than startCurrentLevel", + "The first entry in reportedCurrentLevelValuesList is equal to or larger than to startCurrentLevel"), + TestStep(12, "If reportedCurrentLevelValuesList contains two or more entries, TH verifies the value of the last entry is equal to maxLevel", + "The last entry in reportedCurrentLevelValuesList is equal to maxLevel"), + TestStep(13, "If the LT feature is not supported, skip remaining steps and end test case"), + # 14 is missing in the test plan + TestStep(15, "TH stores the reported values of RemainingTime in all incoming reports for RemainingTime attribute, that contains data in reportedRemainingTimeValuesList."), + TestStep(16, f" {THcommand} MoveToLevel with Level field set to startCurrentLevel, TransitionTime field set to 10 and remaining fields set to 0", + test_plan_support.verify_success()), + TestStep(17, "Wait for 5 seconds"), + TestStep(18, f"{THcommand} MoveToLevel with Level field set to startCurrentLevel, TransitionTime field set to 15 and remaining fields set to 0", + test_plan_support.verify_success()), + TestStep(19, "Wait for 20 seconds"), + TestStep(20, "TH verifies reportedRemainingTimeValuesList contains three entries", + "reportedRemainingTimeValuesList has 3 entries in the list"), + TestStep(21, "TH verifies the first entry in reportedRemainingTimeValuesList is 10", + "The first entry in reportedRemainingTimeValuesList is equal to 10"), + TestStep(22, "TH verifies the second entry in reportedRemainingTimeValuesList is 15", + "The second entry in reportedRemainingTimeValuesList is equal to 15"), + TestStep(23, "TH verifies the third entry in reportedRemainingTimeValuesList is 0", + "The third entry in reportedRemainingTimeValuesList is equal to 0") + ] + + @per_endpoint_test(has_cluster(Clusters.LevelControl)) + async def test_TC_LVL_2_3(self): + # Commissioning - already done + self.step(1) + + lvl = Clusters.LevelControl + + self.step(2) + feature_map = await self.read_single_attribute_check_success(cluster=lvl, attribute=lvl.Attributes.FeatureMap) + + self.step(3) + max_level = await self.read_single_attribute_check_success(cluster=lvl, attribute=lvl.Attributes.MaxLevel) + + self.step(4) + cmd = Clusters.LevelControl.Commands.MoveWithOnOff(moveMode=lvl.Enums.MoveModeEnum.kDown) + await self.send_single_cmd(cmd) + # NOTE: added this sleep to let the DUT have some time to move + logging.info("Test waits for 5 seconds") + time.sleep(5) + + self.step(5) + start_current_level = await self.read_single_attribute_check_success(cluster=lvl, attribute=lvl.Attributes.CurrentLevel) + + self.step(6) + sub_handler = ClusterAttributeChangeAccumulator(lvl) + await sub_handler.start(self.default_controller, self.dut_node_id, self.matter_test_config.endpoint) + + self.step(7) + # NOTE: had to use the WithOnOff version of this command because the dut is off at this point thanks to the above command + # TODO: Need to check above and here that the on/off cluster is actually implemented. + cmd = lvl.Commands.MoveToLevelWithOnOff(level=max_level, transitionTime=100, optionsMask=0, optionsOverride=0) + await self.send_single_cmd(cmd) + + self.step(8) + logging.info('Test will now collect data for 30 seconds') + time.sleep(30) + + self.step(9) + count = sub_handler.attribute_report_counts[lvl.Attributes.CurrentLevel] + asserts.assert_less_equal(count, 10, "Received more than 10 reports for CurrentLevel") + asserts.assert_greater(count, 0, "Did not receive any reports for CurrentLevel") + + self.step(10) + if count == 1: + entry = sub_handler.attribute_reports[lvl.Attributes.CurrentLevel][-1] + asserts.assert_equal(entry.value, max_level, "Entry is not equal to max level") + + if count > 1: + self.step(11) + last_value = start_current_level + for e in sub_handler.attribute_reports[lvl.Attributes.CurrentLevel]: + asserts.assert_greater_equal(e.value, last_value, "Values are not increasing") + + self.step(12) + asserts.assert_equal(e.value, max_level, "Last entry is not max value") + else: + self.skip_step(11) + self.skip_step(12) + + self.step(13) + if (lvl.Bitmaps.Feature.kLighting & feature_map) == 0: + self.skip_all_remaining_steps(15) + + self.step(15) + # reports are stored by the handler, so just reset so we get a clean look + sub_handler.reset() + + self.step(16) + cmd = Clusters.LevelControl.Commands.MoveToLevel( + level=start_current_level, transitionTime=100, optionsMask=0, optionsOverride=0) + await self.send_single_cmd(cmd) + + self.step(17) + logging.info("Test waits for 5 seconds") + time.sleep(5) + + self.step(18) + cmd = Clusters.LevelControl.Commands.MoveToLevel( + level=start_current_level, transitionTime=150, optionsMask=0, optionsOverride=0) + await self.send_single_cmd(cmd) + + self.step(19) + logging.info("Test waits for 20 seconds") + time.sleep(20) + + self.step(20) + count = sub_handler.attribute_report_counts[lvl.Attributes.RemainingTime] + asserts.assert_equal(count, 3, "Unexpected number of remaining time reports") + + self.step(21) + remaining_time = sub_handler.attribute_reports[lvl.Attributes.RemainingTime] + logging.info(f'Reamining time reports: {remaining_time}') + asserts.assert_equal(remaining_time[0].value, 100, "Unexpected first RemainingTime report") + + self.step(22) + asserts.assert_almost_equal(remaining_time[1].value, 150, delta=10, msg="Unexpected second RemainingTime report") + + self.step(23) + asserts.assert_equal(remaining_time[2].value, 0, "Unexpected last RemainingTime report") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_MWOCTRL_2_1.py b/src/python_testing/TC_MWOCTRL_2_1.py index 225a4569b345f0..0de3bee72ec12f 100644 --- a/src/python_testing/TC_MWOCTRL_2_1.py +++ b/src/python_testing/TC_MWOCTRL_2_1.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_MICROWAVE_OVEN_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import chip.clusters as Clusters from chip.interaction_model import InteractionModelError, Status diff --git a/src/python_testing/TC_MWOCTRL_2_2.py b/src/python_testing/TC_MWOCTRL_2_2.py index 54cf7a90463831..0edc2ac6616fde 100644 --- a/src/python_testing/TC_MWOCTRL_2_2.py +++ b/src/python_testing/TC_MWOCTRL_2_2.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_MICROWAVE_OVEN_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging diff --git a/src/python_testing/TC_MWOCTRL_2_4.py b/src/python_testing/TC_MWOCTRL_2_4.py index 136f9f882ab20e..fce17c4175d6c5 100644 --- a/src/python_testing/TC_MWOCTRL_2_4.py +++ b/src/python_testing/TC_MWOCTRL_2_4.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_MICROWAVE_OVEN_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging diff --git a/src/python_testing/TC_MWOM_1_2.py b/src/python_testing/TC_MWOM_1_2.py index c92f8d5c5804fc..7d29c3f43eba35 100644 --- a/src/python_testing/TC_MWOM_1_2.py +++ b/src/python_testing/TC_MWOM_1_2.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_MICROWAVE_OVEN_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging diff --git a/src/python_testing/TC_OPCREDS_3_1.py b/src/python_testing/TC_OPCREDS_3_1.py index 86b6d109be8e8a..dd92fd7a2f88b9 100644 --- a/src/python_testing/TC_OPCREDS_3_1.py +++ b/src/python_testing/TC_OPCREDS_3_1.py @@ -14,7 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. # - +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import copy import logging import random @@ -342,8 +352,8 @@ async def test_TC_OPCREDS_3_1(self): self.print_step(33, "TH1 reconnects to the DUT over PASE") TH1.ExpireSessions(newNodeId) - self.FindAndEstablishPase(dev_ctrl=TH1, longDiscriminator=longDiscriminator, - setupPinCode=params.setupPinCode, nodeid=newNodeId) + await self.FindAndEstablishPase(dev_ctrl=TH1, longDiscriminator=longDiscriminator, + setupPinCode=params.setupPinCode, nodeid=newNodeId) self.print_step(34, "TH1 reads the TrustedRootCertificates list from DUT and verifies the TH1 root is not present") trusted_root_list = await self.read_single_attribute_check_success(dev_ctrl=TH1, node_id=newNodeId, cluster=opcreds, attribute=opcreds.Attributes.TrustedRootCertificates) diff --git a/src/python_testing/TC_OPCREDS_3_2.py b/src/python_testing/TC_OPCREDS_3_2.py index 384540c249e7ca..3eab07bc9dae06 100644 --- a/src/python_testing/TC_OPCREDS_3_2.py +++ b/src/python_testing/TC_OPCREDS_3_2.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import chip.clusters as Clusters from chip.tlv import TLVReader diff --git a/src/python_testing/TC_OPSTATE_2_1.py b/src/python_testing/TC_OPSTATE_2_1.py index ef9afa0a14b741..c3be8a438c14b8 100644 --- a/src/python_testing/TC_OPSTATE_2_1.py +++ b/src/python_testing/TC_OPSTATE_2_1.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import chip.clusters as Clusters from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main diff --git a/src/python_testing/TC_OPSTATE_2_2.py b/src/python_testing/TC_OPSTATE_2_2.py index e8b5286af5ee5c..09e4c6591813e4 100644 --- a/src/python_testing/TC_OPSTATE_2_2.py +++ b/src/python_testing/TC_OPSTATE_2_2.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import chip.clusters as Clusters from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main diff --git a/src/python_testing/TC_OPSTATE_2_3.py b/src/python_testing/TC_OPSTATE_2_3.py index c8abb6bc88a38b..b9a62b275c52aa 100644 --- a/src/python_testing/TC_OPSTATE_2_3.py +++ b/src/python_testing/TC_OPSTATE_2_3.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import chip.clusters as Clusters diff --git a/src/python_testing/TC_OPSTATE_2_4.py b/src/python_testing/TC_OPSTATE_2_4.py index 21e18fd10cd8a5..512802467f8f2c 100644 --- a/src/python_testing/TC_OPSTATE_2_4.py +++ b/src/python_testing/TC_OPSTATE_2_4.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --endpoint 1 --int-arg PIXIT.OPSTATE.ErrorEventGen:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import chip.clusters as Clusters diff --git a/src/python_testing/TC_OPSTATE_2_5.py b/src/python_testing/TC_OPSTATE_2_5.py index fe42a59ffb0b8f..ad79765e8890fd 100644 --- a/src/python_testing/TC_OPSTATE_2_5.py +++ b/src/python_testing/TC_OPSTATE_2_5.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --endpoint 1 --int-arg PIXIT.WAITTIME.REBOOT:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import chip.clusters as Clusters diff --git a/src/python_testing/TC_OVENOPSTATE_2_1.py b/src/python_testing/TC_OVENOPSTATE_2_1.py index 56d7fe2087818a..1d1a2890802e33 100644 --- a/src/python_testing/TC_OVENOPSTATE_2_1.py +++ b/src/python_testing/TC_OVENOPSTATE_2_1.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import chip.clusters as Clusters diff --git a/src/python_testing/TC_OVENOPSTATE_2_2.py b/src/python_testing/TC_OVENOPSTATE_2_2.py index 158bae59260ff3..254464eaa661f9 100644 --- a/src/python_testing/TC_OVENOPSTATE_2_2.py +++ b/src/python_testing/TC_OVENOPSTATE_2_2.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import chip.clusters as Clusters from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main diff --git a/src/python_testing/TC_OVENOPSTATE_2_3.py b/src/python_testing/TC_OVENOPSTATE_2_3.py index 1f882b3b4ba987..77d4358788afad 100644 --- a/src/python_testing/TC_OVENOPSTATE_2_3.py +++ b/src/python_testing/TC_OVENOPSTATE_2_3.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import chip.clusters as Clusters from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main diff --git a/src/python_testing/TC_OVENOPSTATE_2_4.py b/src/python_testing/TC_OVENOPSTATE_2_4.py index 7fa53e73dd8e5f..70a3a6f0207cee 100644 --- a/src/python_testing/TC_OVENOPSTATE_2_4.py +++ b/src/python_testing/TC_OVENOPSTATE_2_4.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --endpoint 1 --int-arg PIXIT.OVENOPSTATE.ErrorEventGen:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import chip.clusters as Clusters from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main diff --git a/src/python_testing/TC_OVENOPSTATE_2_5.py b/src/python_testing/TC_OVENOPSTATE_2_5.py index 0982ec4f2ff64c..39edb670ff6f5c 100644 --- a/src/python_testing/TC_OVENOPSTATE_2_5.py +++ b/src/python_testing/TC_OVENOPSTATE_2_5.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --endpoint 1 --int-arg PIXIT.WAITTIME.REBOOT:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import chip.clusters as Clusters diff --git a/src/python_testing/TC_OpstateCommon.py b/src/python_testing/TC_OpstateCommon.py index 648eea59f2bb3c..09dc73e3344c1f 100644 --- a/src/python_testing/TC_OpstateCommon.py +++ b/src/python_testing/TC_OpstateCommon.py @@ -354,7 +354,7 @@ async def TEST_TC_OPSTATE_BASE_2_1(self, endpoint=1): if phase_list is not NullValue: phase_list_len = len(phase_list) asserts.assert_less_equal(phase_list_len, 32, - f"PhaseList length({phase_list_len}) must be less than 32!") + f"PhaseList length({phase_list_len}) must be at most 32 entries!") # STEP 3: TH reads from the DUT the CurrentPhase attribute self.step(3) @@ -364,8 +364,9 @@ async def TEST_TC_OPSTATE_BASE_2_1(self, endpoint=1): if (phase_list == NullValue) or (not phase_list): asserts.assert_true(current_phase == NullValue, f"CurrentPhase({current_phase}) should be null") else: - asserts.assert_true(0 <= current_phase and current_phase < phase_list_len, - f"CurrentPhase({current_phase}) must be between 0 and {(phase_list_len - 1)}") + asserts.assert_greater_equal(current_phase, 0, f"CurrentPhase({current_phase}) must be >= 0") + asserts.assert_less(current_phase, phase_list_len, + f"CurrentPhase({current_phase}) must be less than {phase_list_len}") # STEP 4: TH reads from the DUT the CountdownTime attribute self.step(4) @@ -652,7 +653,7 @@ async def TEST_TC_OPSTATE_BASE_2_2(self, endpoint=1): if phase_list is not NullValue: phase_list_len = len(phase_list) asserts.assert_less_equal(phase_list_len, 32, - f"PhaseList length({phase_list_len}) must be less than 32!") + f"PhaseList length({phase_list_len}) must be at most 32 entries!") # STEP 9: TH reads from the DUT the CurrentPhase attribute self.step(9) @@ -662,10 +663,10 @@ async def TEST_TC_OPSTATE_BASE_2_2(self, endpoint=1): if (phase_list == NullValue) or (not phase_list): asserts.assert_equal(current_phase, NullValue, f"CurrentPhase({current_phase}) should be null") else: - asserts.assert_less_equal(0, current_phase, - f"CurrentPhase({current_phase}) must be greater or equal than 0") - asserts.assert_less(current_phase < phase_list_len, - f"CurrentPhase({current_phase}) must be less then {(phase_list_len - 1)}") + asserts.assert_greater_equal(current_phase, 0, + f"CurrentPhase({current_phase}) must be greater or equal to 0") + asserts.assert_less(current_phase, phase_list_len, + f"CurrentPhase({current_phase}) must be less than {(phase_list_len)}") # STEP 10: TH waits for {PIXIT.WAITTIME.COUNTDOWN} self.step(10) @@ -679,6 +680,8 @@ async def TEST_TC_OPSTATE_BASE_2_2(self, endpoint=1): attribute=attributes.CountdownTime) if (countdown_time is not NullValue) and (initial_countdown_time is not NullValue): + logging.info(f" -> Initial countdown time: {initial_countdown_time}") + logging.info(f" -> New countdown time: {countdown_time}") asserts.assert_less_equal(countdown_time, (initial_countdown_time - wait_time), f"The countdown time shall have decreased at least {wait_time:.1f} since start command") @@ -821,6 +824,7 @@ async def TEST_TC_OPSTATE_BASE_2_3(self, endpoint=1): initial_countdown_time = await self.read_expect_success(endpoint=endpoint, attribute=attributes.CountdownTime) if initial_countdown_time is not NullValue: + logging.info(f" -> Initial ountdown time: {initial_countdown_time}") asserts.assert_true(0 <= initial_countdown_time <= 259200, f"CountdownTime({initial_countdown_time}) must be between 0 and 259200") @@ -835,6 +839,8 @@ async def TEST_TC_OPSTATE_BASE_2_3(self, endpoint=1): attribute=attributes.CountdownTime) if (countdown_time is not NullValue) and (initial_countdown_time is not NullValue): + logging.info(f" -> Initial countdown time: {initial_countdown_time}") + logging.info(f" -> New countdown time: {countdown_time}") asserts.assert_equal(countdown_time, initial_countdown_time, "The countdown time shall be equal since pause command") diff --git a/src/python_testing/TC_PS_2_3.py b/src/python_testing/TC_PS_2_3.py new file mode 100644 index 00000000000000..72b54877dc5f95 --- /dev/null +++ b/src/python_testing/TC_PS_2_3.py @@ -0,0 +1,71 @@ +# +# 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. +# + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +import logging +import time + +import chip.clusters as Clusters +from matter_testing_support import (ClusterAttributeChangeAccumulator, MatterBaseTest, TestStep, async_test_body, + default_matter_test_main) +from mobly import asserts + + +class TC_PS_2_3(MatterBaseTest): + + def pics_TC_PS_2_3(self) -> list[str]: + return ["PWRTL.S"] + + def steps_TC_PS_2_3(self): + return [TestStep(1, "Commission DUT to TH", "", is_commissioning=True), + TestStep(2, "Subscribe to all attributes of the PowerSource Cluster"), + TestStep(3, "Accumulate all attribute reports on the endpoint under test for 30 seconds", + "For each of the attributes in the set of BatTimeToFullCharge, BatPercentRemaining and BatTimeRemaining, verify that there are not more than 4 reports per attribute where the value is non-null over the period of accumulation.")] + + @async_test_body + async def test_TC_PS_2_3(self): + # Commissioning, already done. + self.step(1) + + self.step(2) + ps = Clusters.PowerSource + sub_handler = ClusterAttributeChangeAccumulator(ps) + await sub_handler.start(self.default_controller, self.dut_node_id, self.matter_test_config.endpoint) + + self.step(3) + logging.info("This test will now wait for 30 seconds.") + time.sleep(30) + + counts = sub_handler.attribute_report_counts + asserts.assert_less_equal(counts[ps.Attributes.BatTimeToFullCharge], 4, "Too many reports for BatTimeToFullCharge") + asserts.assert_less_equal(counts[ps.Attributes.BatPercentRemaining], 4, "Too many reports for BatPercentRemaining") + asserts.assert_less_equal(counts[ps.Attributes.BatTimeRemaining], 4, "Too many reports for BatTimeRemaining") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_PWRTL_2_1.py b/src/python_testing/TC_PWRTL_2_1.py index 93e0e946fe19ea..7216031a9374f4 100644 --- a/src/python_testing/TC_PWRTL_2_1.py +++ b/src/python_testing/TC_PWRTL_2_1.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging diff --git a/src/python_testing/TC_RR_1_1.py b/src/python_testing/TC_RR_1_1.py index 5e25f2a77ff086..0cb53a4fb491dc 100644 --- a/src/python_testing/TC_RR_1_1.py +++ b/src/python_testing/TC_RR_1_1.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import asyncio import logging diff --git a/src/python_testing/TC_RVCCLEANM_1_2.py b/src/python_testing/TC_RVCCLEANM_1_2.py index 9e571195adec35..c78906157a9a29 100644 --- a/src/python_testing/TC_RVCCLEANM_1_2.py +++ b/src/python_testing/TC_RVCCLEANM_1_2.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_RVC_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging diff --git a/src/python_testing/TC_RVCCLEANM_2_1.py b/src/python_testing/TC_RVCCLEANM_2_1.py index 7ec8fd9b9812ec..046dfe9fc93018 100644 --- a/src/python_testing/TC_RVCCLEANM_2_1.py +++ b/src/python_testing/TC_RVCCLEANM_2_1.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_RVC_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --int-arg PIXIT.RVCCLEANM.MODE_CHANGE_FAIL:1 PIXIT.RVCCLEANM.MODE_CHANGE_OK:2 +# === END CI TEST ARGUMENTS === import logging from time import sleep diff --git a/src/python_testing/TC_RVCCLEANM_2_2.py b/src/python_testing/TC_RVCCLEANM_2_2.py index 02d193978d05e7..147cead22f658a 100644 --- a/src/python_testing/TC_RVCCLEANM_2_2.py +++ b/src/python_testing/TC_RVCCLEANM_2_2.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_RVC_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === from time import sleep diff --git a/src/python_testing/TC_RVCOPSTATE_2_1.py b/src/python_testing/TC_RVCOPSTATE_2_1.py index 01d4e0c88c4b13..42a2d02d6fae9c 100644 --- a/src/python_testing/TC_RVCOPSTATE_2_1.py +++ b/src/python_testing/TC_RVCOPSTATE_2_1.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_RVC_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging from time import sleep diff --git a/src/python_testing/TC_RVCOPSTATE_2_3.py b/src/python_testing/TC_RVCOPSTATE_2_3.py index 3b75515f1a23d2..1d915641260d3b 100644 --- a/src/python_testing/TC_RVCOPSTATE_2_3.py +++ b/src/python_testing/TC_RVCOPSTATE_2_3.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_RVC_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging from time import sleep diff --git a/src/python_testing/TC_RVCOPSTATE_2_4.py b/src/python_testing/TC_RVCOPSTATE_2_4.py index 43b64b9595a172..b680453b06c287 100644 --- a/src/python_testing/TC_RVCOPSTATE_2_4.py +++ b/src/python_testing/TC_RVCOPSTATE_2_4.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_RVC_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging from time import sleep diff --git a/src/python_testing/TC_RVCRUNM_1_2.py b/src/python_testing/TC_RVCRUNM_1_2.py index c696af369dfffa..b731875214e36f 100644 --- a/src/python_testing/TC_RVCRUNM_1_2.py +++ b/src/python_testing/TC_RVCRUNM_1_2.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_RVC_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging diff --git a/src/python_testing/TC_RVCRUNM_2_1.py b/src/python_testing/TC_RVCRUNM_2_1.py index e02639f8530e27..a0860d6e438c6b 100644 --- a/src/python_testing/TC_RVCRUNM_2_1.py +++ b/src/python_testing/TC_RVCRUNM_2_1.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_RVC_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --int-arg PIXIT.RVCRUNM.MODE_CHANGE_OK:0 PIXIT.RVCRUNM.MODE_CHANGE_FAIL:2 +# === END CI TEST ARGUMENTS === import logging from time import sleep diff --git a/src/python_testing/TC_RVCRUNM_2_2.py b/src/python_testing/TC_RVCRUNM_2_2.py index 12f9887e20e33f..ec62e9899a8ebd 100644 --- a/src/python_testing/TC_RVCRUNM_2_2.py +++ b/src/python_testing/TC_RVCRUNM_2_2.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${CHIP_RVC_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --int-arg PIXIT.RVCRUNM.MODE_A:1 PIXIT.RVCRUNM.MODE_B:2 +# === END CI TEST ARGUMENTS === from time import sleep diff --git a/src/python_testing/TC_SC_3_6.py b/src/python_testing/TC_SC_3_6.py index 9247cb546e19c6..53353ea85f8bdb 100644 --- a/src/python_testing/TC_SC_3_6.py +++ b/src/python_testing/TC_SC_3_6.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import asyncio diff --git a/src/python_testing/TC_SC_7_1.py b/src/python_testing/TC_SC_7_1.py new file mode 100644 index 00000000000000..b702bf438fba86 --- /dev/null +++ b/src/python_testing/TC_SC_7_1.py @@ -0,0 +1,114 @@ +# +# Copyright (c) 2022 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 2222 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --bool-arg post_cert_test:true --qr-code MT:-24J0KCZ16750648G00 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +# Note that in the CI we are using the post-cert test as we can only start one app from the current script. +# This should still be fine as this test has unit tests for other conditions. See test_TC_SC_7_1.py +import logging + +import chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + + +def _trusted_root_test_step(dut_num: int) -> TestStep: + read_trusted_roots_over_pase = f'TH establishes a PASE session to DUT{dut_num} using the provided setup code and reads the TrustedRootCertificates attribute from the operational credentials cluster over PASE' + return TestStep(dut_num, read_trusted_roots_over_pase, "List should be empty as the DUT should be in factory reset ") + + +class TC_SC_7_1(MatterBaseTest): + ''' TC-SC-7.1 + + This test requires two instances of the DUT with the same PID/VID to confirm that the individual + devices are provisioned with different discriminators and PAKE salts in the same product line. + + This test MUST be run on a factory reset device, over PASE, with no commissioned fabrics. + ''' + + def __init__(self, *args): + super().__init__(*args) + self.post_cert_test = False + + def setup_class(self): + super().setup_class() + self.post_cert_test = self.user_params.get("post_cert_test", False) + + def expected_number_of_DUTs(self) -> int: + return 1 if self.post_cert_test else 2 + + def steps_TC_SC_7_1(self): + if self.post_cert_test: + return [_trusted_root_test_step(1), + TestStep(2, "TH extracts the discriminator from the provided setup code", "Ensure the code is not the default")] + + return [_trusted_root_test_step(1), + _trusted_root_test_step(2), + TestStep(3, "TH compares the discriminators from the provided setup codes", "Discriminators do not match")] + + # TODO: Need a pics or something to limit this to devices that have a factory-provided matter setup code (as opposed to a field upgradable device / device with a custom commissioning where this test won't apply) + + @async_test_body + async def test_TC_SC_7_1(self): + # For now, this test is WAY easier if we just ask for the setup code instead of discriminator / passcode + asserts.assert_false(self.matter_test_config.discriminators, + "This test needs to be run with either the QR or manual setup code. The QR code is preferred.") + + if len(self.matter_test_config.qr_code_content + self.matter_test_config.manual_code) != self.expected_number_of_DUTs(): + if self.post_cert_test: + msg = "The post_cert_test flag is only for use post-certification. When using this flag, specify a single discriminator, manual-code or qr-code-content" + else: + msg = "This test requires two devices for use at certification. Specify two device discriminators or QR codes ex. --discriminator 1234 5678" + asserts.fail(msg) + + # Make sure these are no fabrics on the device so we know we're looking at the factory discriminator. This also ensures that the provided codes are correct. + for i, setup_code in enumerate(self.matter_test_config.qr_code_content + self.matter_test_config.manual_code): + self.step(i+1) + await self.default_controller.FindOrEstablishPASESession(setupCode=setup_code, nodeid=i+1) + root_certs = await self.read_single_attribute_check_success(node_id=i+1, cluster=Clusters.OperationalCredentials, attribute=Clusters.OperationalCredentials.Attributes.TrustedRootCertificates, endpoint=0) + asserts.assert_equal( + root_certs, [], "Root certificates found on device. Device must be factory reset before running this test.") + + self.step(i+2) + setup_payload_info = self.get_setup_payload_info() + if self.post_cert_test: + # For post-cert, we're testing against the defaults + # TODO: Does it even make sense to test against a manual code in post-cert? It's such a small space, collisions are likely. Should we restrict post-cert to QR? What if one isn't provided? + asserts.assert_not_equal(setup_payload_info[0].filter_value, 3840, "Device is using the default discriminator") + else: + if setup_payload_info[0].filter_value == setup_payload_info[1].filter_value and self.matter_test_config.manual_code is not None: + logging.warn("The two provided discriminators are the same. Note that this CAN occur by chance, especially when using manual codes with the short discriminator. Consider using a QR code, or a different device if you believe the DUTs have individually provisioned") + asserts.assert_not_equal( + setup_payload_info[0].filter_value, setup_payload_info[1].filter_value, "Devices are using the same discriminator values") + + # TODO: add test for PAKE salt. This needs to be plumbed through starting from HandlePBKDFParamResponse. + # Will handle in a separate follow up as the plumbing here is aggressive and through some of the crypto layers. + # TODO: Other unit-specific values? + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_SWTCH.py b/src/python_testing/TC_SWTCH.py new file mode 100644 index 00000000000000..926379804eb8e3 --- /dev/null +++ b/src/python_testing/TC_SWTCH.py @@ -0,0 +1,792 @@ +# +# 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. + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --PICS src/app/tests/suites/certification/ci-pics-values +# === END CI TEST ARGUMENTS === + +import json +import logging +import queue +import time +from datetime import datetime, timedelta +from typing import Any + +import chip.clusters as Clusters +import test_plan_support +from chip.clusters import ClusterObjects as ClusterObjects +from chip.clusters.Attribute import EventReadResult, TypedAttributePath +from chip.tlv import uint +from matter_testing_support import (AttributeValue, ClusterAttributeChangeAccumulator, EventChangeCallback, MatterBaseTest, + TestStep, default_matter_test_main, has_feature, per_endpoint_test) +from mobly import asserts + +logger = logging.getLogger(__name__) + + +class TC_SwitchTests(MatterBaseTest): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + def desc_TC_SWTCH_2_4(self) -> str: + """Returns a description of this test""" + return "[TC-SWTCH-2.4] Momentary Switch Long Press Verification" + + # def steps_TC_SWTCH_2_4(self) -> list[TestStep]: + # steps = [ + # TestStep("0", "Commissioning, already done", is_commissioning=True), + # # TODO: fill when test is done + # ] + + # return steps + + def _send_named_pipe_command(self, command_dict: dict[str, Any]): + app_pid = self.matter_test_config.app_pid + if app_pid == 0: + asserts.fail("The --app-pid flag must be set when usage of button simulation named pipe is required (e.g. CI)") + + app_pipe = f"/tmp/chip_all_clusters_fifo_{app_pid}" + command = json.dumps(command_dict) + + # Sends an out-of-band command to the sample app + with open(app_pipe, "w") as outfile: + logging.info(f"Sending named pipe command to {app_pipe}: '{command}'") + outfile.write(command + "\n") + # Delay for pipe command to be processed (otherwise tests may be flaky). + time.sleep(0.1) + + def _use_button_simulator(self) -> bool: + return self.check_pics("PICS_SDK_CI_ONLY") or self.user_params.get("use_button_simulator", False) + + def _ask_for_switch_idle(self): + if not self._use_button_simulator(): + self.wait_for_user_input(prompt_msg="Ensure switch is idle") + + def _send_multi_press_named_pipe_command(self, endpoint_id: int, number_of_presses: int, pressed_position: int, feature_map: uint, multi_press_max: uint): + command_dict = {"Name": 'SimulateMultiPress', "EndpointId": endpoint_id, + "ButtonId": pressed_position, "MultiPressPressedTimeMillis": 500, "MultiPressReleasedTimeMillis": 500, + "MultiPressNumPresses": number_of_presses, "FeatureMap": feature_map, "MultiPressMax": multi_press_max} + self._send_named_pipe_command(command_dict) + + def _send_long_press_named_pipe_command(self, endpoint_id: int, pressed_position: int, feature_map: int): + command_dict = {"Name": "SimulateLongPress", "EndpointId": endpoint_id, + "ButtonId": pressed_position, "LongPressDelayMillis": 5000, "LongPressDurationMillis": 5500, "FeatureMap": feature_map} + self._send_named_pipe_command(command_dict) + + def _ask_for_multi_press_short_long(self, endpoint_id: int, pressed_position: int, feature_map: uint, multi_press_max: uint): + if not self._use_button_simulator(): + msg = f""" + Actuate the switch in the following sequence: + 1. Operate switch (press briefly) associated with position {pressed_position} on the DUT then release switch from DUT + 2. Operate switch (keep pressed for long time, e.g. 5 seconds) on the DUT immediately after the previous step + 3. Release switch from the DUT + """ + self.wait_for_user_input(msg) + else: + # This is just a simulator, ignore the long press instruction for now, it doesn't matter for the CI. It does for cert. + self._send_multi_press_named_pipe_command(endpoint_id, 2, pressed_position, feature_map, multi_press_max) + + def _ask_for_multi_press_long_short(self, endpoint_id, pressed_position, feature_map: int): + if not self._use_button_simulator(): + msg = f""" + Actuate the switch in the following sequence: + 1. Operate switch (keep pressed for long time, e.g. 5 seconds) on the DUT + 2. Releases switch from the DUT + 3. Immediately after the previous step completes, operate switch (press briefly) associated with position {pressed_position} on the DUT then release switch from DUT + """ + self.wait_for_user_input(msg) + else: + # This is just the start of the sequence + # we'll need to send the short press after getting the LongRelease event because the simulator doesn't queue requests. + self._send_long_press_named_pipe_command(endpoint_id, pressed_position, feature_map) + + def _ask_for_multi_press(self, endpoint_id: int, number_of_presses: int, pressed_position: int, feature_map: uint, multi_press_max: uint): + if not self._use_button_simulator(): + self.wait_for_user_input( + f'Operate the switch (press briefly) associated with position {pressed_position} then release {number_of_presses} times') + else: + self._send_multi_press_named_pipe_command(endpoint_id, number_of_presses, + pressed_position, feature_map, multi_press_max) + + def _ask_for_long_press(self, endpoint_id: int, pressed_position: int, feature_map): + if not self._use_button_simulator(): + self.wait_for_user_input( + prompt_msg=f"Press switch position {pressed_position} for a long time (around 5 seconds) on the DUT, then release it.") + else: + self._send_long_press_named_pipe_command(endpoint_id, pressed_position, feature_map) + + def _ask_for_keep_pressed(self, endpoint_id: int, pressed_position: int, feature_map: int): + if not self._use_button_simulator(): + self.wait_for_user_input( + prompt_msg=f"Press switch position {pressed_position} for a long time (around 5 seconds) on the DUT, then release it.") + else: + self._send_long_press_named_pipe_command(endpoint_id, pressed_position, feature_map) + + def _ask_for_release(self): + # Since we used a long press for this, "ask for release" on the button simulator just means waiting out the delay + if not self._use_button_simulator(): + self.wait_for_user_input( + prompt_msg="Release the button." + ) + else: + time.sleep(self.keep_pressed_delay/1000) + + def _placeholder_for_step(self, step_id: str): + # TODO: Global search an replace of `self._placeholder_for_step` with `self.step` when done. + logging.info(f"Step {step_id}") + pass + + def _placeholder_for_skip(self, step_id: str): + logging.info(f"Skipped step {step_id}") + + def _await_sequence_of_reports(self, report_queue: queue.Queue, endpoint_id: int, attribute: TypedAttributePath, sequence: list[Any], timeout_sec: float): + start_time = time.time() + elapsed = 0.0 + time_remaining = timeout_sec + + sequence_idx = 0 + actual_values = [] + + while time_remaining > 0: + expected_value = sequence[sequence_idx] + logging.info(f"Expecting value {expected_value} for attribute {attribute} on endpoint {endpoint_id}") + try: + item: AttributeValue = report_queue.get(block=True, timeout=time_remaining) + + # Track arrival of all values for the given attribute. + if item.endpoint_id == endpoint_id and item.attribute == attribute: + actual_values.append(item.value) + + if item.value == expected_value: + logging.info(f"Got expected attribute change {sequence_idx+1}/{len(sequence)} for attribute {attribute}") + sequence_idx += 1 + else: + asserts.assert_equal(item.value, expected_value, + msg="Did not get expected attribute value in correct sequence.") + + # We are done waiting when we have accumulated all results. + if sequence_idx == len(sequence): + logging.info("Got all attribute changes, done waiting.") + return + except queue.Empty: + # No error, we update timeouts and keep going + pass + + elapsed = time.time() - start_time + time_remaining = timeout_sec - elapsed + + asserts.fail(f"Did not get full sequence {sequence} in {timeout_sec:.1f} seconds. Got {actual_values} before time-out.") + + def _await_sequence_of_events(self, event_queue: queue.Queue, endpoint_id: int, sequence: list[ClusterObjects.ClusterEvent], timeout_sec: float): + start_time = time.time() + elapsed = 0.0 + time_remaining = timeout_sec + + sequence_idx = 0 + actual_events = [] + + while time_remaining > 0: + logging.info(f"Expecting event {sequence[sequence_idx]} on endpoint {endpoint_id}") + try: + item: EventReadResult = event_queue.get(block=True, timeout=time_remaining) + expected_event = sequence[sequence_idx] + event_data = item.Data + + if item.Header.EndpointId == endpoint_id and item.Header.ClusterId == event_data.cluster_id: + actual_events.append(event_data) + + if event_data == expected_event: + logging.info(f"Got expected Event {sequence_idx+1}/{len(sequence)}: {event_data}") + sequence_idx += 1 + else: + asserts.assert_equal(event_data, expected_event, msg="Did not get expected event in correct sequence.") + + # We are done waiting when we have accumulated all results. + if sequence_idx == len(sequence): + logging.info("Got all expected events, done waiting.") + return + except queue.Empty: + # No error, we update timeouts and keep going + pass + + elapsed = time.time() - start_time + time_remaining = timeout_sec - elapsed + + asserts.fail(f"Did not get full sequence {sequence} in {timeout_sec:.1f} seconds. Got {actual_events} before time-out.") + + def _expect_no_events_for_cluster(self, event_queue: queue.Queue, endpoint_id: int, expected_cluster: ClusterObjects.Cluster, timeout_sec: float): + start_time = time.time() + elapsed = 0.0 + time_remaining = timeout_sec + + logging.info(f"Waiting {timeout_sec:.1f} seconds for no more events for cluster {expected_cluster} on endpoint {endpoint_id}") + while time_remaining > 0: + try: + item: EventReadResult = event_queue.get(block=True, timeout=time_remaining) + event_data = item.Data + + if item.Header.EndpointId == endpoint_id and item.Header.ClusterId == event_data.cluster_id and item.Header.ClusterId == expected_cluster.id: + asserts.fail(f"Got Event {event_data} when we expected no further events for {expected_cluster}") + except queue.Empty: + # No error, we update timeouts and keep going + pass + + elapsed = time.time() - start_time + time_remaining = timeout_sec - elapsed + + logging.info(f"Successfully waited for no further events on {expected_cluster} for {elapsed:.1f} seconds") + + @per_endpoint_test(has_feature(Clusters.Switch, Clusters.Switch.Bitmaps.Feature.kMomentarySwitch)) + async def test_TC_SWTCH_2_4(self): + # TODO: Make this come from PIXIT + switch_pressed_position = 1 + post_prompt_settle_delay_seconds = 10.0 + + # Commission DUT - already done + + # Read feature map to set bool markers + cluster = Clusters.Objects.Switch + feature_map = await self.read_single_attribute_check_success(cluster, attribute=cluster.Attributes.FeatureMap) + + has_ms_feature = (feature_map & cluster.Bitmaps.Feature.kMomentarySwitch) != 0 + has_msr_feature = (feature_map & cluster.Bitmaps.Feature.kMomentarySwitchRelease) != 0 + has_msl_feature = (feature_map & cluster.Bitmaps.Feature.kMomentarySwitchLongPress) != 0 + has_as_feature = (feature_map & cluster.Bitmaps.Feature.kActionSwitch) != 0 + # has_msm_feature = (feature_map & cluster.Bitmaps.Feature.kMomentarySwitchMultiPress) != 0 + + if not has_ms_feature: + logging.info("Skipping rest of test: SWTCH.S.F01(MS) feature not present") + self.skip_all_remaining_steps("2") + + endpoint_id = self.matter_test_config.endpoint + + # Step 1: Set up subscription to all Switch cluster events + self._placeholder_for_step("1") + event_listener = EventChangeCallback(cluster) + attrib_listener = ClusterAttributeChangeAccumulator(cluster) + await event_listener.start(self.default_controller, self.dut_node_id, endpoint=endpoint_id) + await attrib_listener.start(self.default_controller, self.dut_node_id, endpoint=endpoint_id) + + # Step 2: Operator does not operate switch on the DUT + self._placeholder_for_step("2") + self._ask_for_switch_idle() + + # Step 3: TH reads the CurrentPosition attribute from the DUT + self._placeholder_for_step("3") + + # Verify that the value is 0 + current_position = await self.read_single_attribute_check_success(cluster, attribute=cluster.Attributes.CurrentPosition) + asserts.assert_equal(current_position, 0) + + # Step 4a: Operator operates switch (keep pressed for long time, e.g. 5 seconds) on the DUT, the release it + self._placeholder_for_step("4a") + self._ask_for_long_press(endpoint_id, switch_pressed_position, feature_map) + + # Step 4b: TH expects report of CurrentPosition 1, followed by a report of Current Position 0. + self._placeholder_for_step("4b") + logging.info( + f"Starting to wait for {post_prompt_settle_delay_seconds:.1f} seconds for CurrentPosition to go {switch_pressed_position}, then 0.") + self._await_sequence_of_reports(report_queue=attrib_listener.attribute_queue, endpoint_id=endpoint_id, attribute=cluster.Attributes.CurrentPosition, sequence=[ + switch_pressed_position, 0], timeout_sec=post_prompt_settle_delay_seconds) + + # Step 4c: TH expects at least InitialPress with NewPosition = 1 + self._placeholder_for_step("4c") + logging.info(f"Starting to wait for {post_prompt_settle_delay_seconds:.1f} seconds for InitialPress event.") + expected_events = [cluster.Events.InitialPress(newPosition=switch_pressed_position)] + self._await_sequence_of_events(event_queue=event_listener.event_queue, endpoint_id=endpoint_id, + sequence=expected_events, timeout_sec=post_prompt_settle_delay_seconds) + + # Step 4d: For MSL/AS, expect to see LongPress/LongRelease in that order + if not has_msl_feature and not has_as_feature: + logging.info("Skipping Step 4d due to missing MSL and AS features") + self._placeholder_for_skip("4d") + else: + # Steb 4d: TH expects report of LongPress, LongRelease in that order. + self._placeholder_for_step("4d") + logging.info(f"Starting to wait for {post_prompt_settle_delay_seconds:.1f} seconds for LongPress then LongRelease.") + expected_events = [] + expected_events.append(cluster.Events.LongPress(newPosition=switch_pressed_position)) + expected_events.append(cluster.Events.LongRelease(previousPosition=switch_pressed_position)) + self._await_sequence_of_events(event_queue=event_listener.event_queue, endpoint_id=endpoint_id, + sequence=expected_events, timeout_sec=post_prompt_settle_delay_seconds) + + # Step 4e: For MS & (!MSL & !AS & !MSR), expect no further events for 10 seconds. + if not has_msl_feature and not has_as_feature and not has_msr_feature: + self._placeholder_for_step("4e") + self._expect_no_events_for_cluster(event_queue=event_listener.event_queue, + endpoint_id=endpoint_id, expected_cluster=cluster, timeout_sec=10.0) + + # Step 4f: For MSR & not MSL, expect to see ShortRelease. + if not has_msl_feature and has_msr_feature: + self._placeholder_for_step("4f") + expected_events = [cluster.Events.ShortRelease(previousPosition=switch_pressed_position)] + self._await_sequence_of_events(event_queue=event_listener.event_queue, endpoint_id=endpoint_id, + sequence=expected_events, timeout_sec=post_prompt_settle_delay_seconds) + + def _received_event(self, event_listener: EventChangeCallback, target_event: ClusterObjects.ClusterEvent, timeout_s: int) -> bool: + """ + Returns true if this event was received, false otherwise + """ + remaining = timedelta(seconds=timeout_s) + end_time = datetime.now() + remaining + while (remaining.seconds > 0): + try: + event = event_listener.event_queue.get(timeout=remaining.seconds) + except queue.Empty: + return False + + if event.Header.EventId == target_event.event_id: + return True + remaining = end_time - datetime.now() + return False + + def steps_TC_SWTCH_2_3(self): + return [TestStep(1, test_plan_support.commission_if_required(), "", is_commissioning=True), + TestStep(2, "Set up subscription to all events of Switch cluster on the endpoint"), + TestStep(3, "Operator does not operate switch on the DUT"), + TestStep(4, "TH reads the CurrentPosition attribute from the DUT", "Verify that the value is 0"), + TestStep(5, "Operator operates switch (keep it pressed)", + "Verify that the TH receives InitialPress event with NewPosition set to 1 on the DUT"), + TestStep(6, "TH reads the CurrentPosition attribute from the DUT", "Verify that the value is 1"), + TestStep(7, "Operator releases switch on the DUT"), + TestStep("8a", "If the DUT implements the MSR feature and does not implement the MSL feature, verify that the TH receives ShortRelease event with NewPosition set to 0 on the DUT", "Event received"), + TestStep("8b", "If the DUT implements the MSR feature and the MSL feature, verify that the TH receives LongRelease event with NewPosition set to 0 on the DUT", "Event received"), + TestStep( + "8c", "If the DUT implements the AS feature, verify that the TH does not receive ShortRelease event on the DUT", "No event received"), + TestStep(9, "TH reads the CurrentPosition attribute from the DUT", "Verify that the value is 0"), + ] + + @per_endpoint_test(has_feature(Clusters.Switch, Clusters.Switch.Bitmaps.Feature.kMomentarySwitch)) + async def test_TC_SWTCH_2_3(self): + # Commissioning - already done + self.step(1) + cluster = Clusters.Switch + feature_map = await self.read_single_attribute_check_success(cluster, attribute=cluster.Attributes.FeatureMap) + + has_msr_feature = (feature_map & cluster.Bitmaps.Feature.kMomentarySwitchRelease) != 0 + has_msl_feature = (feature_map & cluster.Bitmaps.Feature.kMomentarySwitchLongPress) != 0 + has_as_feature = (feature_map & cluster.Bitmaps.Feature.kActionSwitch) != 0 + + endpoint_id = self.matter_test_config.endpoint + + self.step(2) + event_listener = EventChangeCallback(cluster) + await event_listener.start(self.default_controller, self.dut_node_id, endpoint=endpoint_id) + + self.step(3) + self._ask_for_switch_idle() + + self.step(4) + button_val = await self.read_single_attribute_check_success(cluster=cluster, attribute=cluster.Attributes.CurrentPosition) + asserts.assert_equal(button_val, 0, "Button value is not 0") + + self.step(5) + # We're using a long press here with a very long duration (in computer-land). This will let us check the intermediate values. + # This is 1s larger than the subscription ceiling + self.keep_pressed_delay = 6000 + self.pressed_position = 1 + self._ask_for_keep_pressed(endpoint_id, self.pressed_position, feature_map) + event_listener.wait_for_event_report(cluster.Events.InitialPress) + + self.step(6) + button_val = await self.read_single_attribute_check_success(cluster=cluster, attribute=cluster.Attributes.CurrentPosition) + asserts.assert_equal(button_val, self.pressed_position, f"Button value is not {self.pressed_position}") + + self.step(7) + self._ask_for_release() + + self.step("8a") + if has_msr_feature and not has_msl_feature: + asserts.assert_true(self._received_event(event_listener, cluster.Events.ShortRelease, 10), + "Did not receive short release") + else: + self.mark_current_step_skipped() + + self.step("8b") + if has_msr_feature and has_msl_feature: + asserts.assert_true(self._received_event(event_listener, cluster.Events.LongRelease, 10), + "Did not receive long release") + + self.step("8c") + if has_as_feature: + asserts.assert_false(self._received_event(event_listener, cluster.Events.ShortRelease, 10), "Received short release") + else: + self.mark_current_step_skipped() + + self.step(9) + button_val = await self.read_single_attribute_check_success(cluster=cluster, attribute=cluster.Attributes.CurrentPosition) + asserts.assert_equal(button_val, 0, "Button value is not 0") + + def steps_TC_SWTCH_2_5(self): + return [TestStep(1, test_plan_support.commission_if_required(), "", is_commissioning=True), + TestStep(2, "Set up a subscription to all Switch cluster events"), + TestStep(3, "Operate does not operate the switch on the DUT"), + TestStep("4a", "Operator operates switch (press briefly) associated with position 1 on the DUT then release switch from DUT", + """ + + * Verify that the TH receives InitialPress event with NewPosition set to 1 from the DUT + * Verify that the TH receives ShortRelease event with PreviousPosition set to 1 from the DUT + """), + TestStep("4b", "Operator does not operate switch on the DUT", + "TH receives MultiPressComplete event with PreviousPosition set to 1 and TotalNumberOfPressesCounted set to 1 from the DUT"), + TestStep("5a", "Operator repeat step 4a 2 times quickly", + """ + + * Verify that the TH receives InitialPress event with NewPosition set to 1 from the DUT + * Verify that the TH receives ShortRelease event with PreviousPosition set to 1 from the DUT + * Verify that the TH receives InitialPress event with NewPosition set to 1 from the DUT + * Verify that the TH receives MultiPressOngoing event with NewPosition set to 1 and CurrentNumberOfPressesCounted set to 2 from the DUT + * Verify that the TH receives ShortRelease event with PreviousPosition set to 1 from the DUT + + + The events sequence SHALL follow the same sequence as above + """), + TestStep("5b", "Operator does not operate switch on the DUT", + "Verify that the TH receives MultiPressComplete event with PreviousPosition set to 1 and TotalNumberOfPressesCounted set to 2 from the DUT"), + TestStep("6a", "If MultiPressMax == 2 (see 2c of TC-SWTCH-2.1), skip steps 6b .. 6c"), + TestStep("6b", "Operator repeat step 4a 3 times quickly", + """ + * Verify that the TH receives InitialPress event with NewPosition set to 1 from the DUT + * Verify that the TH receives ShortRelease event with PreviousPosition set to 1 from the DUT + * Verify that the TH receives InitialPress event with NewPosition set to 1 from the DUT + * Verify that the TH receives MultiPressOngoing event with NewPosition set to 1 and CurrentNumberOfPressesCounted set to 2 from the DUT + * Verify that the TH receives ShortRelease event with PreviousPosition set to 1 from the DUT + * Verify that the TH receives InitialPress event with NewPosition set to 1 from the DUT + * Verify that the TH receives MultiPressOngoing event with NewPosition set to 1 and CurrentNumberOfPressesCounted set to 3 from the DUT + * Verify that the TH receives ShortRelease event with PreviousPosition set to 1 from the DUT + + + The events sequence from the subscription SHALL follow the same sequence as expressed above, in the exact order of events specified. + """), + TestStep("6c", "Operator does not operate switch on the DUT for 5 seconds", + "Verify that the TH receives MultiPressComplete event with PreviousPosition set to 1 and TotalNumberOfPressesCounted set to 3 from the DUT"), + TestStep(7, "Set up subscription to all Switch cluster events"), + TestStep("8a", + """ + Operator operates switch in below sequence: + 1. Operator operates switch (press briefly) associated with position 1 on the DUT then release switch from DUT + 2. Operator operates switch (keep pressed for long time, e.g. 5 seconds) on the DUT immediately after the previous step + 3. Operator releases switch from the DUT + """, + """ + + * Verify that the TH receives InitialPress event with NewPosition set to 1 from the DUT + * Verify that the TH receives ShortRelease event with PreviousPosition set to 1 from the DUT + * Verify that the TH receives InitialPress event with NewPosition set to 1 from the DUT + + * Verify that the TH receives MultiPressOngoing event with NewPosition set to 1 and CurrentNumberOfPressesCounted set to 2 from the DUT + * Verify that the TH receives ShortRelease event with PreviousPosition set to 1 from the DUT + * Verify that the TH does not receive LongPress event from the DUT + * Verify that the TH does not receive LongRelease event from the DUT + + The events sequence from the subscription SHALL follow the same sequence as expressed above, in the exact order of events specified. + """), + TestStep("8b", "Operator does not operate switch on the DUT", + "TH receives MultiPressComplete event with PreviousPosition set to 1 and TotalNumberOfPressesCounted set to 2 from the DUT"), + TestStep("9a", + """ + Operator operates switch in below sequence: + 1. Operator operates switch (keep pressed for long time, e.g. 5 seconds) on the DUT + 2. Operator releases switch from the DUT + 3. Immediately after the previous step completes, Operator operates switch (press briefly) associated with position 1 on the DUT then release switch from DUT + """, + """ + + * Verify that the TH receives InitialPress event with NewPosition set to 1 from the DUT + * Verify that the TH receives (one, not more than one) LongPress event with NewPosition set to 1 from the DUT + * Verify that the TH receives LongRelease event with PreviousPosition set to 1 from the DUT + * Verify that the TH receives InitialPress event with NewPosition set to 1 from the DUT + * Verify that the TH receives ShortRelease event with PreviousPosition set to 1 from the DUT + * Verify that the TH does not receive MultiPressOngoing event from the DUT + + The events sequence from the subscription SHALL follow the same sequence as expressed above, in the exact order of events specified. + """), + TestStep("9b", "Operator does not operate switch on the DUT", + "TH receives MultiPressComplete event with PreviousPosition set to 1 and TotalNumberOfPressesCounted set to 2 from the DUT") + + ] + + @staticmethod + def should_run_SWTCH_2_5(wildcard, endpoint): + msm = has_feature(Clusters.Switch, Clusters.Switch.Bitmaps.Feature.kMomentarySwitchMultiPress) + asf = has_feature(Clusters.Switch, 0x20) + return msm(wildcard, endpoint) and not asf(wildcard, endpoint) + + @per_endpoint_test(should_run_SWTCH_2_5) + async def test_TC_SWTCH_2_5(self): + # Commissioning - already done + self.step(1) + + cluster = Clusters.Switch + feature_map = await self.read_single_attribute_check_success(cluster, attribute=cluster.Attributes.FeatureMap) + has_msl_feature = (feature_map & cluster.Bitmaps.Feature.kMomentarySwitchLongPress) + multi_press_max = await self.read_single_attribute_check_success(cluster, attribute=cluster.Attributes.MultiPressMax) + + endpoint_id = self.matter_test_config.endpoint + pressed_position = 1 + + self.step(2) + event_listener = EventChangeCallback(cluster) + await event_listener.start(self.default_controller, self.dut_node_id, endpoint=endpoint_id) + + self.step(3) + self._ask_for_switch_idle() + + def test_multi_press_sequence(starting_step: str, count: int, short_long: bool = False): + step = starting_step + self.step(step) + + if short_long: + self._ask_for_multi_press_short_long(endpoint_id, pressed_position, + feature_map=feature_map, multi_press_max=multi_press_max) + else: + self._ask_for_multi_press(endpoint_id, number_of_presses=count, pressed_position=pressed_position, + feature_map=feature_map, multi_press_max=multi_press_max) + for i in range(count): + event = event_listener.wait_for_event_report(cluster.Events.InitialPress) + asserts.assert_equal(event.newPosition, pressed_position, "Unexpected NewPosition on InitialEvent") + if i > 0: + event = event_listener.wait_for_event_report(cluster.Events.MultiPressOngoing) + asserts.assert_equal(event.newPosition, pressed_position, "Unexpected NewPosition on MultiPressOngoing") + asserts.assert_equal(event.currentNumberOfPressesCounted, i+1, + "Unexpected CurrentNumberOfPressesCounted on MultiPressOngoing") + event = event_listener.wait_for_event_report(cluster.Events.ShortRelease) + asserts.assert_equal(event.previousPosition, pressed_position, "Unexpected PreviousPosition on ShortRelease") + + step = step[:-1] + chr(ord(step[-1])+1) + self.step(step) + self._ask_for_switch_idle() + event = event_listener.wait_for_event_report(cluster.Events.MultiPressComplete) + asserts.assert_equal(event.previousPosition, pressed_position, "Unexpected PreviousPosition on MultiPressComplete") + asserts.assert_equal(event.totalNumberOfPressesCounted, count, "Unexpected count on MultiPressComplete") + + test_multi_press_sequence("4a", 1) + + test_multi_press_sequence("5a", 2) + + self.step("6a") + multi_press_max = await self.read_single_attribute_check_success(cluster=cluster, attribute=cluster.Attributes.MultiPressMax) + if multi_press_max == 2: + self.skip_step("6b") + self.skip_step("6c") + else: + test_multi_press_sequence("6b", 3) + + if not has_msl_feature: + self.skip_all_remaining_steps(7) + return + + self.step(7) + # subscription is already set up + + test_multi_press_sequence("8a", 2, short_long=True) + + self.step("9a") + self._ask_for_multi_press_long_short(endpoint_id, pressed_position, feature_map) + + event = event_listener.wait_for_event_report(cluster.Events.InitialPress) + asserts.assert_equal(event.newPosition, pressed_position, "Unexpected NewPosition on InitialEvent") + event = event_listener.wait_for_event_report(cluster.Events.LongPress) + asserts.assert_equal(event.newPosition, pressed_position, "Unexpected NewPosition on LongPress") + event = event_listener.wait_for_event_report(cluster.Events.LongRelease) + asserts.assert_equal(event.previousPosition, pressed_position, "Unexpected PreviousPosition on LongRelease") + if self._use_button_simulator: + # simulator can't sequence so we need to help it along here + self._send_multi_press_named_pipe_command(endpoint_id, number_of_presses=1, + pressed_position=1, feature_map=feature_map, multi_press_max=multi_press_max) + + event = event_listener.wait_for_event_report(cluster.Events.InitialPress) + asserts.assert_equal(event.newPosition, pressed_position, "Unexpected NewPosition on InitialEvent") + event = event_listener.wait_for_event_report(cluster.Events.ShortRelease) + asserts.assert_equal(event.previousPosition, pressed_position, "Unexpected PreviousPosition on ShortRelease") + + # Because this is a queue, we verify that no multipress ongoing is received by verifying that the next event is the multipress complete + + self.step("9b") + self._ask_for_switch_idle() + event = event_listener.wait_for_event_report(cluster.Events.MultiPressComplete) + asserts.assert_equal(event.previousPosition, pressed_position, "Unexpected PreviousPosition on MultiPressComplete") + asserts.assert_equal(event.totalNumberOfPressesCounted, 1, "Unexpected count on MultiPressComplete") + + def steps_TC_SWTCH_2_6(self): + return [TestStep(1, test_plan_support.commission_if_required(), is_commissioning=True), + TestStep(2, "Set up subscription to all Switch cluster events"), + TestStep(3, "Operator does not operate switch on the DUT"), + TestStep("4a", "Operator operates switch (press briefly) associated with position 1 on the DUT then release switch from DUT", + """ + + * Verify that the TH receives InitialPress event with NewPosition set to 1 from the DUT + * Verify that the TH does not receive ShortRelease event from the DUT + """), + TestStep("4b", "Operator does not operate switch on the DUT", + "TH receives MultiPressComplete event with PreviousPosition set to 1 and TotalNumberOfPressesCounted set to 1 from the DUT"), + TestStep("5a", "Operator repeat step 4a 2 times quickly", + """ + + * Verify that the TH receives InitialPress(one, not more than one) event with NewPosition set to 1 from the DUT + * Verify that the TH does not receive ShortRelease event from the DUT + * Verify that the TH does not receive MultiPressOngoing event from the DUT + """), + TestStep("5b", "Operator does not operate switch on the DUT", + "Verify that the TH receives MultiPressComplete event with PreviousPosition set to 1 and TotalNumberOfPressesCounted set to 2 from the DUT"), + TestStep("6a", "Operator repeat step 4a MultiPressMax + 1(see 2c of TC-SWTCH-2.1) times quickly", + """ + + * Verify that the TH receives InitialPress(one, not more than one) event with NewPosition set to 1 from the DUT + * Verify that the TH does not receive ShortRelease event from the DUT + * Verify that the TH does not receive MultiPressOngoing event from the DUT + """ + ), + TestStep("6b", "Operator does not operate switch on the DUT", + "Verify that the TH receives MultiPressComplete event with PreviousPosition set to 1 and TotalNumberOfPressesCounted set to 0 from the DUT"), + TestStep("7a", "If the switch cluster does not implement the MomentarySwitchLongPress (MSL) feature, skip the remaining steps"), + TestStep("7b", "Set up subscription to all Switch cluster events"), + TestStep("8a", + """ + Operator operates switch in below sequence: + 1. Operator operates switch (press briefly) associated with position 1 on the DUT then release switch from DUT + 2. Operator operates switch (keep pressed for long time, e.g. 5 seconds) on the DUT immediately after the previous step + 3. Operator releases switch from the DUT + """, + """ + + * Verify that the TH receives InitialPress(one, not more than one) event with NewPosition set to 1 from the DUT + * Verify that the TH does not receive ShortRelease event from the DUT + * Verify that the TH does not receive MultiPressOngoing event from the DUT + * Verify that the TH does not receive LongPress event from the DUT + * Verify that the TH does not receive LongRelease event from the DUT + """), + TestStep("8b", "Operator does not operate switch on the DUT", + "TH receives MultiPressComplete event with PreviousPosition set to 1 and TotalNumberOfPressesCounted set to 2 from the DUT"), + TestStep("9a", + """ + Operator operates switch in below sequence: + + 1. Operator operates switch (keep pressed for long time, e.g. 5 seconds) on the DUT + 2. Operator releases switch from the DUT + 3. Immediately after the previous step complete, Operator operates switch (press briefly) associated with position 1 on the DUT then release switch from DUT + """, + """ + + * Verify that the TH receives InitialPress event with NewPosition set to 1 from the DUT + * Verify that the TH receives (one, not more than one) LongPress event with NewPosition set to 1 from the DUT + * Verify that the TH receives LongRelease event with PreviousPosition set to 1 from the DUT + * Verify that the TH receives InitialPress event with NewPosition set to 1 from the DUT + * Verify that the TH does not receive MultiPressOngoing event from the DUT + * Verify that the TH does not receive ShortRelease event from the DUT + + The events sequence from the subscription SHALL follow the same sequence as expressed above, in the exact order of events specified. + """), + TestStep("9b", "Operator does not operate switch on the DUT" + "Verify that the TH receives MultiPressComplete event with PreviousPosition set to 1 and TotalNumberOfPressesCounted set to 1 from the DUT"), + ] + + @staticmethod + def should_run_SWTCH_2_6(wildcard, endpoint): + msm = has_feature(Clusters.Switch, Clusters.Switch.Bitmaps.Feature.kMomentarySwitchMultiPress) + asf = has_feature(Clusters.Switch, 0x20) + return msm(wildcard, endpoint) and asf(wildcard, endpoint) + + @per_endpoint_test(should_run_SWTCH_2_6) + async def test_TC_SWTCH_2_6(self): + # Commissioning - already done + self.step(1) + + cluster = Clusters.Switch + feature_map = await self.read_single_attribute_check_success(cluster, attribute=cluster.Attributes.FeatureMap) + has_msl_feature = (feature_map & cluster.Bitmaps.Feature.kMomentarySwitchLongPress) + multi_press_max = await self.read_single_attribute_check_success(cluster, attribute=cluster.Attributes.MultiPressMax) + + endpoint_id = self.matter_test_config.endpoint + pressed_position = 1 + + self.step(2) + event_listener = EventChangeCallback(cluster) + await event_listener.start(self.default_controller, self.dut_node_id, endpoint=endpoint_id) + + self.step(3) + self._ask_for_switch_idle() + + def test_multi_press_sequence(starting_step: str, count: int, short_long: bool = False): + step = starting_step + self.step(step) + + if short_long: + self._ask_for_multi_press_short_long(endpoint_id, pressed_position, + feature_map=feature_map, multi_press_max=multi_press_max) + else: + self._ask_for_multi_press(endpoint_id, number_of_presses=count, pressed_position=pressed_position, + feature_map=feature_map, multi_press_max=multi_press_max) + + event = event_listener.wait_for_event_report(cluster.Events.InitialPress) + asserts.assert_equal(event.newPosition, pressed_position, "Unexpected NewPosition on InitialEvent") + + step = step[:-1] + chr(ord(step[-1])+1) + self.step(step) + self._ask_for_switch_idle() + event = event_listener.wait_for_event_report(cluster.Events.MultiPressComplete) + asserts.assert_equal(event.previousPosition, pressed_position, "Unexpected PreviousPosition on MultiPressComplete") + expected_count = 0 if count > multi_press_max else count + asserts.assert_equal(event.totalNumberOfPressesCounted, expected_count, "Unexpected count on MultiPressComplete") + + test_multi_press_sequence("4a", 1) + + test_multi_press_sequence("5a", 2) + + test_multi_press_sequence("6a", multi_press_max + 1) + + self.step("7a") + if not has_msl_feature: + self.skip_all_remaining_steps("7b") + + # subscription is already established + self.step("7b") + + test_multi_press_sequence("8a", 2, short_long=True) + + self.step("9a") + self._ask_for_multi_press_long_short(endpoint_id, pressed_position, feature_map) + + event = event_listener.wait_for_event_report(cluster.Events.InitialPress) + asserts.assert_equal(event.newPosition, pressed_position, "Unexpected NewPosition on InitialEvent") + event = event_listener.wait_for_event_report(cluster.Events.LongPress) + asserts.assert_equal(event.newPosition, pressed_position, "Unexpected NewPosition on LongPress") + event = event_listener.wait_for_event_report(cluster.Events.LongRelease) + asserts.assert_equal(event.previousPosition, pressed_position, "Unexpected PreviousPosition on LongRelease") + if self._use_button_simulator: + # simulator can't sequence so we need to help it along here + self._send_multi_press_named_pipe_command(endpoint_id, number_of_presses=1, + pressed_position=1, feature_map=feature_map, multi_press_max=multi_press_max) + + event = event_listener.wait_for_event_report(cluster.Events.InitialPress) + asserts.assert_equal(event.newPosition, pressed_position, "Unexpected NewPosition on InitialEvent") + + # Verify that we don't receive the multi-press ongoing or short release by verifying that the next event in the sequence is the multi-press complete + self.step("9b") + self._ask_for_switch_idle() + event = event_listener.wait_for_event_report(cluster.Events.MultiPressComplete) + asserts.assert_equal(event.previousPosition, pressed_position, "Unexpected PreviousPosition on MultiPressComplete") + asserts.assert_equal(event.totalNumberOfPressesCounted, 1, "Unexpected count on MultiPressComplete") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_TIMESYNC_2_1.py b/src/python_testing/TC_TIMESYNC_2_1.py index 1930606b2b245f..1cfb22e17c7fc8 100644 --- a/src/python_testing/TC_TIMESYNC_2_1.py +++ b/src/python_testing/TC_TIMESYNC_2_1.py @@ -15,67 +15,72 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import ipaddress from datetime import timedelta import chip.clusters as Clusters from chip.clusters.Types import NullValue -from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, utc_time_in_matter_epoch +from matter_testing_support import (MatterBaseTest, default_matter_test_main, has_attribute, has_cluster, per_endpoint_test, + utc_time_in_matter_epoch) from mobly import asserts class TC_TIMESYNC_2_1(MatterBaseTest): - async def read_ts_attribute_expect_success(self, endpoint, attribute): + async def read_ts_attribute_expect_success(self, attribute): cluster = Clusters.Objects.TimeSynchronization - return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) - - def pics_TC_TIMESYNC_2_1(self) -> list[str]: - return ["TIMESYNC.S"] + return await self.read_single_attribute_check_success(endpoint=None, cluster=cluster, attribute=attribute) - @async_test_body + @per_endpoint_test(has_cluster(Clusters.TimeSynchronization) and has_attribute(Clusters.TimeSynchronization.Attributes.TimeSource)) async def test_TC_TIMESYNC_2_1(self): + attributes = Clusters.TimeSynchronization.Attributes + features = await self.read_ts_attribute_expect_success(attribute=attributes.FeatureMap) - endpoint = self.user_params.get("endpoint", 0) + self.supports_time_zone = bool(features & Clusters.TimeSynchronization.Bitmaps.Feature.kTimeZone) + self.supports_ntpc = bool(features & Clusters.TimeSynchronization.Bitmaps.Feature.kNTPClient) + self.supports_ntps = bool(features & Clusters.TimeSynchronization.Bitmaps.Feature.kNTPServer) + self.supports_trusted_time_source = bool(features & Clusters.TimeSynchronization.Bitmaps.Feature.kTimeSyncClient) + + timesync_attr_list = attributes.AttributeList + attribute_list = await self.read_ts_attribute_expect_success(attribute=timesync_attr_list) + timesource_attr_id = attributes.TimeSource.attribute_id self.print_step(1, "Commissioning, already done") - attributes = Clusters.TimeSynchronization.Attributes self.print_step(2, "Read Granularity attribute") - if self.check_pics("TIMESYNC.S.A0001"): - granularity_dut = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.Granularity) - asserts.assert_less(granularity_dut, Clusters.TimeSynchronization.Enums.GranularityEnum.kUnknownEnumValue, - "Granularity is not in valid range") - else: - asserts.assert_true(False, "Granularity is a mandatory attribute and must be present in the PICS file") + granularity_dut = await self.read_ts_attribute_expect_success(attribute=attributes.Granularity) + asserts.assert_less(granularity_dut, Clusters.TimeSynchronization.Enums.GranularityEnum.kUnknownEnumValue, + "Granularity is not in valid range") self.print_step(3, "Read TimeSource") - if self.check_pics("TIMESYNC.S.A0002"): - time_source = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.TimeSource) + if timesource_attr_id in attribute_list: + time_source = await self.read_ts_attribute_expect_success(attribute=attributes.TimeSource) asserts.assert_less(time_source, Clusters.TimeSynchronization.Enums.TimeSourceEnum.kUnknownEnumValue, "TimeSource is not in valid range") self.print_step(4, "Read TrustedTimeSource") - if self.check_pics("TIMESYNC.S.A0003"): - trusted_time_source = await self.read_ts_attribute_expect_success(endpoint=endpoint, - attribute=attributes.TrustedTimeSource) + if self.supports_trusted_time_source: + trusted_time_source = await self.read_ts_attribute_expect_success(attribute=attributes.TrustedTimeSource) if trusted_time_source is not NullValue: asserts.assert_less_equal(trusted_time_source.fabricIndex, 0xFE, "FabricIndex for the TrustedTimeSource is out of range") asserts.assert_greater_equal(trusted_time_source.fabricIndex, 1, "FabricIndex for the TrustedTimeSource is out of range") - elif self.check_pics("TIMESYNC.S.F03"): - asserts.assert_true(False, "TrustedTimeSource is mandatory if the TSC feature (TIMESYNC.S.F03) is supported") self.print_step(5, "Read DefaultNTP") - if self.check_pics("TIMESYNC.S.A0004"): - default_ntp = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.DefaultNTP) + if self.supports_ntpc: + default_ntp = await self.read_ts_attribute_expect_success(attribute=attributes.DefaultNTP) if default_ntp is not NullValue: asserts.assert_less_equal(len(default_ntp), 128, "DefaultNTP length must be less than 128") # Assume this is a valid web address if it has at least one . in the name @@ -87,12 +92,10 @@ async def test_TC_TIMESYNC_2_1(self): is_ip_addr = False pass asserts.assert_true(is_web_addr or is_ip_addr, "Returned DefaultNTP value is not a IP address or web address") - elif self.check_pics("TIMESYNC.S.F01"): - asserts.assert_true(False, "DefaultNTP is mandatory if the NTPC (TIMESYNC.S.F01) feature is supported") self.print_step(6, "Read TimeZone") - if self.check_pics("TIMESYNC.S.A0005"): - tz_dut = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.TimeZone) + if self.supports_time_zone: + tz_dut = await self.read_ts_attribute_expect_success(attribute=attributes.TimeZone) asserts.assert_greater_equal(len(tz_dut), 1, "TimeZone must have at least one entry in the list") asserts.assert_less_equal(len(tz_dut), 2, "TimeZone may have a maximum of two entries in the list") for entry in tz_dut: @@ -104,12 +107,10 @@ async def test_TC_TIMESYNC_2_1(self): asserts.assert_equal(tz_dut[0].validAt, 0, "TimeZone list first entry must have a 0 ValidAt time") if len(tz_dut) > 1: asserts.assert_not_equal(tz_dut[1].validAt, 0, "TimeZone list second entry must have a non-zero ValidAt time") - elif self.check_pics("TIMESYNC.S.F00"): - asserts.assert_true(False, "TimeZone is mandatory if the TZ (TIMESYNC.S.F00) feature is supported") self.print_step(7, "Read DSTOffset") - if self.check_pics("TIMESYNC.S.A0006"): - dst_dut = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.DSTOffset) + if self.supports_time_zone: + dst_dut = await self.read_ts_attribute_expect_success(attribute=attributes.DSTOffset) last_valid_until = -1 last_valid_starting = -1 for dst in dst_dut: @@ -121,30 +122,25 @@ async def test_TC_TIMESYNC_2_1(self): last_valid_until = dst.validUntil if dst.validUntil is NullValue or dst.validUntil is None: asserts.assert_equal(dst, dst_dut[-1], "DSTOffset list must have Null ValidUntil at the end") - elif self.check_pics("TIMESYNC.S.F00"): - asserts.assert_true(False, "DSTOffset is mandatory if the TZ (TIMESYNC.S.F00) feature is supported") self.print_step(8, "Read UTCTime") - if self.check_pics("TIMESYNC.S.A0000"): - utc_dut = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.UTCTime) - if utc_dut is NullValue: - asserts.assert_equal(granularity_dut, Clusters.TimeSynchronization.Enums.GranularityEnum.kNoTimeGranularity) - else: - asserts.assert_not_equal(granularity_dut, Clusters.TimeSynchronization.Enums.GranularityEnum.kNoTimeGranularity) - if granularity_dut is Clusters.TimeSynchronization.Enums.GranularityEnum.kMinutesGranularity: - toleranace = timedelta(minutes=10) - else: - toleranace = timedelta(minutes=1) - delta_us = abs(utc_dut - utc_time_in_matter_epoch()) - delta = timedelta(microseconds=delta_us) - asserts.assert_less_equal(delta, toleranace, "UTC time is not within tolerance of TH") + utc_dut = await self.read_ts_attribute_expect_success(attribute=attributes.UTCTime) + if utc_dut is NullValue: + asserts.assert_equal(granularity_dut, Clusters.TimeSynchronization.Enums.GranularityEnum.kNoTimeGranularity) else: - asserts.assert_true(False, "UTCTime is a mandatory attribute and must be present in the PICS file") + asserts.assert_not_equal(granularity_dut, Clusters.TimeSynchronization.Enums.GranularityEnum.kNoTimeGranularity) + if granularity_dut is Clusters.TimeSynchronization.Enums.GranularityEnum.kMinutesGranularity: + toleranace = timedelta(minutes=10) + else: + toleranace = timedelta(minutes=1) + delta_us = abs(utc_dut - utc_time_in_matter_epoch()) + delta = timedelta(microseconds=delta_us) + asserts.assert_less_equal(delta, toleranace, "UTC time is not within tolerance of TH") self.print_step(9, "Read LocalTime") - if self.check_pics("TIMESYNC.S.A0007"): - utc_dut = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.UTCTime) - local_dut = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.LocalTime) + if self.supports_time_zone: + utc_dut = await self.read_ts_attribute_expect_success(attribute=attributes.UTCTime) + local_dut = await self.read_ts_attribute_expect_success(attribute=attributes.LocalTime) if utc_dut is NullValue: asserts.assert_true(local_dut is NullValue, "LocalTime must be Null if UTC time is Null") elif len(dst_dut) == 0: @@ -155,45 +151,33 @@ async def test_TC_TIMESYNC_2_1(self): delta = timedelta(microseconds=delta_us) toleranace = timedelta(minutes=1) asserts.assert_less_equal(delta, toleranace, "Local time caluclation is not within tolerance of calculated value") - elif self.check_pics("TIMESYNC.S.F00"): - asserts.assert_true(False, "LocalTime is mandatory if the TZ (TIMESYNC.S.F00) feature is supported") self.print_step(10, "Read TimeZoneDatabase") - if self.check_pics("TIMESYNC.S.A0008"): - tz_db_dut = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.TimeZoneDatabase) + if self.supports_time_zone: + tz_db_dut = await self.read_ts_attribute_expect_success(attribute=attributes.TimeZoneDatabase) asserts.assert_less(tz_db_dut, Clusters.TimeSynchronization.Enums.TimeZoneDatabaseEnum.kUnknownEnumValue, "TimeZoneDatabase is not in valid range") - elif self.check_pics("TIMESYNC.S.F00"): - asserts.assert_true(False, "TimeZoneDatabase is mandatory if the TZ (TIMESYNC.S.F00) feature is supported") self.print_step(11, "Read NTPServerAvailable") - if self.check_pics("TIMESYNC.S.A0009"): + if self.supports_ntps: # bool typechecking happens in the test read functions, so all we need to do here is do the read - await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.NTPServerAvailable) - elif self.check_pics("TIMESYNC.S.F02"): - asserts.assert_true(False, "NTPServerAvailable is mandatory if the NTPS (TIMESYNC.S.F02) feature is supported") + await self.read_ts_attribute_expect_success(attribute=attributes.NTPServerAvailable) self.print_step(12, "Read TimeZoneListMaxSize") - if self.check_pics("TIMESYNC.S.A000a"): - size = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.TimeZoneListMaxSize) + if self.supports_time_zone: + size = await self.read_ts_attribute_expect_success(attribute=attributes.TimeZoneListMaxSize) asserts.assert_greater_equal(size, 1, "TimeZoneListMaxSize must be at least 1") asserts.assert_less_equal(size, 2, "TimeZoneListMaxSize must be max 2") - elif self.check_pics("TIMESYNC.S.F00"): - asserts.assert_true(False, "TimeZoneListMaxSize is mandatory if the TZ (TIMESYNC.S.F00) feature is supported") self.print_step(13, "Read DSTOffsetListMaxSize") - if self.check_pics("TIMESYNC.S.A000b"): - size = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.DSTOffsetListMaxSize) + if self.supports_time_zone: + size = await self.read_ts_attribute_expect_success(attribute=attributes.DSTOffsetListMaxSize) asserts.assert_greater_equal(size, 1, "DSTOffsetListMaxSize must be at least 1") - elif self.check_pics("TIMESYNC.S.F00"): - asserts.assert_true(False, "DSTOffsetListMaxSize is mandatory if the TZ (TIMESYNC.S.F00) feature is supported") self.print_step(14, "Read SupportsDNSResolve") - if self.check_pics("TIMESYNC.S.A0004"): - # bool typechecking happens in the test read functions, so all we need to do here is do the read - await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.SupportsDNSResolve) - elif self.check_pics("TIMESYNC.S.F01"): - asserts.assert_true(False, "SupportsDNSResolve is mandatory if the NTPC (TIMESYNC.S.F01) feature is supported") + # bool typechecking happens in the test read functions, so all we need to do here is do the read + if self.supports_ntpc: + await self.read_ts_attribute_expect_success(attribute=attributes.SupportsDNSResolve) if __name__ == "__main__": diff --git a/src/python_testing/TC_TIMESYNC_2_10.py b/src/python_testing/TC_TIMESYNC_2_10.py index d6b772bcaa1064..c7eb9860b9a8d0 100644 --- a/src/python_testing/TC_TIMESYNC_2_10.py +++ b/src/python_testing/TC_TIMESYNC_2_10.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import queue import time diff --git a/src/python_testing/TC_TIMESYNC_2_11.py b/src/python_testing/TC_TIMESYNC_2_11.py index 7272109525011c..5815baeacadca0 100644 --- a/src/python_testing/TC_TIMESYNC_2_11.py +++ b/src/python_testing/TC_TIMESYNC_2_11.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import queue import time diff --git a/src/python_testing/TC_TIMESYNC_2_12.py b/src/python_testing/TC_TIMESYNC_2_12.py index 1fd05ca352fb38..f530554591202c 100644 --- a/src/python_testing/TC_TIMESYNC_2_12.py +++ b/src/python_testing/TC_TIMESYNC_2_12.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import queue import time diff --git a/src/python_testing/TC_TIMESYNC_2_13.py b/src/python_testing/TC_TIMESYNC_2_13.py index ded6769c7d3828..c667b71edaba55 100644 --- a/src/python_testing/TC_TIMESYNC_2_13.py +++ b/src/python_testing/TC_TIMESYNC_2_13.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import queue import time diff --git a/src/python_testing/TC_TIMESYNC_2_2.py b/src/python_testing/TC_TIMESYNC_2_2.py index cb8e6d54d904e3..83c07355d688d3 100644 --- a/src/python_testing/TC_TIMESYNC_2_2.py +++ b/src/python_testing/TC_TIMESYNC_2_2.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === from datetime import timedelta @@ -45,7 +50,10 @@ async def test_TC_TIMESYNC_2_2(self): # Time sync is required to be on endpoint 0 if it is present endpoint = 0 - time_cluster = Clusters.Objects.TimeSynchronization + time_cluster = Clusters.TimeSynchronization + timesync_attr_list = time_cluster.Attributes.AttributeList + attribute_list = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=time_cluster, attribute=timesync_attr_list) + timesource_attr_id = time_cluster.Attributes.TimeSource.attribute_id self.print_step(1, "Commissioning, already done") attributes = Clusters.TimeSynchronization.Attributes @@ -85,7 +93,7 @@ async def test_TC_TIMESYNC_2_2(self): compare_time(received=utc_dut, utc=th_utc, tolerance=tolerance) self.print_step(5, "Read time source") - if self.check_pics("TIMESYNC.S.A0002"): + if timesource_attr_id in attribute_list: source = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.TimeSource) if utc_dut_initial is NullValue: asserts.assert_equal(source, Clusters.Objects.TimeSynchronization.Enums.TimeSourceEnum.kAdmin) diff --git a/src/python_testing/TC_TIMESYNC_2_4.py b/src/python_testing/TC_TIMESYNC_2_4.py index 89c284b21024f6..21d98fd8ca7f9b 100644 --- a/src/python_testing/TC_TIMESYNC_2_4.py +++ b/src/python_testing/TC_TIMESYNC_2_4.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import typing from datetime import timedelta diff --git a/src/python_testing/TC_TIMESYNC_2_5.py b/src/python_testing/TC_TIMESYNC_2_5.py index ae2b3debbb8569..5c19e3722956d9 100644 --- a/src/python_testing/TC_TIMESYNC_2_5.py +++ b/src/python_testing/TC_TIMESYNC_2_5.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import typing diff --git a/src/python_testing/TC_TIMESYNC_2_6.py b/src/python_testing/TC_TIMESYNC_2_6.py index 7a121cb2a2f0ca..deae1123213a67 100644 --- a/src/python_testing/TC_TIMESYNC_2_6.py +++ b/src/python_testing/TC_TIMESYNC_2_6.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import typing diff --git a/src/python_testing/TC_TIMESYNC_2_7.py b/src/python_testing/TC_TIMESYNC_2_7.py index 0e4e80f87a5548..a405aae1f901a3 100644 --- a/src/python_testing/TC_TIMESYNC_2_7.py +++ b/src/python_testing/TC_TIMESYNC_2_7.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import time import typing diff --git a/src/python_testing/TC_TIMESYNC_2_8.py b/src/python_testing/TC_TIMESYNC_2_8.py index eb78c40cd7318a..418d6e8e41040d 100644 --- a/src/python_testing/TC_TIMESYNC_2_8.py +++ b/src/python_testing/TC_TIMESYNC_2_8.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import time import typing diff --git a/src/python_testing/TC_TIMESYNC_2_9.py b/src/python_testing/TC_TIMESYNC_2_9.py index f52241f9730c24..0fd6872d704684 100644 --- a/src/python_testing/TC_TIMESYNC_2_9.py +++ b/src/python_testing/TC_TIMESYNC_2_9.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import typing from datetime import timedelta diff --git a/src/python_testing/TC_TIMESYNC_3_1.py b/src/python_testing/TC_TIMESYNC_3_1.py index 6d3148872e6ece..ad972345db5828 100644 --- a/src/python_testing/TC_TIMESYNC_3_1.py +++ b/src/python_testing/TC_TIMESYNC_3_1.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import chip.clusters as Clusters from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main diff --git a/src/python_testing/TC_TestEventTrigger.py b/src/python_testing/TC_TestEventTrigger.py index ee227a8bfbec9d..373fabf704078f 100644 --- a/src/python_testing/TC_TestEventTrigger.py +++ b/src/python_testing/TC_TestEventTrigger.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f # test-runner-run/run1/script-args: --storage-path admin_storage.json --bool-arg allow_sdk_dac:true --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging diff --git a/src/python_testing/TC_pics_checker.py b/src/python_testing/TC_pics_checker.py index 4e503edd101a01..f63628fd4eb426 100644 --- a/src/python_testing/TC_pics_checker.py +++ b/src/python_testing/TC_pics_checker.py @@ -20,7 +20,7 @@ from basic_composition_support import BasicCompositionTests from global_attribute_ids import GlobalAttributeIds from matter_testing_support import (AttributePathLocation, ClusterPathLocation, CommandPathLocation, FeaturePathLocation, - MatterBaseTest, TestStep, async_test_body, default_matter_test_main) + MatterBaseTest, ProblemLocation, TestStep, async_test_body, default_matter_test_main) from mobly import asserts from pics_support import accepted_cmd_pics_str, attribute_pics_str, feature_pics_str, generated_cmd_pics_str from spec_parsing_support import build_xml_clusters @@ -88,11 +88,12 @@ def _add_pics_for_lists(self, cluster_id: int, attribute_id_of_element_list: Glo def steps_TC_IDM_10_4(self): return [TestStep(1, "TH performs a wildcard read of all attributes on the endpoint under test"), - TestStep(2, "For every standard cluster: If the cluster is present on the endpoint, ensure the server-side PICS code for the cluster is present in the PICS file (e.g. OO.S for On/Off cluster).If the cluster is not present on the endpoint, ensure the cluster server PICS code is not present in the PICS file."), - TestStep(3, "For every standard cluster, for every attribute in the cluster:If the cluster is present on the endpoint and the attribute ID is present in the AttributeList global attribute within the cluster, ensure the server-side PICS code for the attribute is present in the PICS file (e.g. OO.S.A000 for On/Off cluster’s OnOff attribute).Otherwise, ensure the attribute PICS code is NOT present in the PICS file."), - TestStep(4, "For every cluster present in the spec, for every client → server command in the cluster: If the cluster is present on the endpoint and the command id is present in the accepted commands list, ensure the PICS code for the accepted command is present in the PICS file. Otherwise, ensure the accepted command PICS code is not present in the PICS file."), - TestStep(5, "For every cluster present in the spec, for every server → client command in the cluster: If the cluster is present on the endpoint and the command id is present in the generated commands list, ensure the PICS code for the generated command is present in the PICS file. Otherwise, ensure the generated command PICS code is not present in the PICS file."), - TestStep(6, "For every cluster present in the spec, for every feature in the cluster: If the cluster is present on the endpoint and the feature is marked in the feature map, ensure the PICS code for the feature is present in the PICS file. Otherwise, ensure the feature PICS code is not present in the PICS file.")] + TestStep(2, "For every standard cluster: If the cluster is present on the endpoint, ensure the server-side PICS code for the cluster is present in the PICS file (e.g. OO.S for On/Off cluster).If the cluster is not present on the endpoint, ensure the cluster server PICS code is not present in the PICS file.", "PICS exactly match for server clusters."), + TestStep(3, "For every standard cluster, for every attribute in the cluster:If the cluster is present on the endpoint and the attribute ID is present in the AttributeList global attribute within the cluster, ensure the server-side PICS code for the attribute is present in the PICS file (e.g. OO.S.A000 for On/Off cluster’s OnOff attribute).Otherwise, ensure the attribute PICS code is NOT present in the PICS file.", "PICS exactly match for all attributes in all clusters."), + TestStep(4, "For every cluster present in the spec, for every client → server command in the cluster: If the cluster is present on the endpoint and the command id is present in the accepted commands list, ensure the PICS code for the accepted command is present in the PICS file. Otherwise, ensure the accepted command PICS code is not present in the PICS file.", "PICS exactly match for all accepted commands in all clusters."), + TestStep(5, "For every cluster present in the spec, for every server → client command in the cluster: If the cluster is present on the endpoint and the command id is present in the generated commands list, ensure the PICS code for the generated command is present in the PICS file. Otherwise, ensure the generated command PICS code is not present in the PICS file.", "PICS exactly match for all generated commands in all clusters."), + TestStep(6, "For every cluster present in the spec, for every feature in the cluster: If the cluster is present on the endpoint and the feature is marked in the feature map, ensure the PICS code for the feature is present in the PICS file. Otherwise, ensure the feature PICS code is not present in the PICS file.", "PICS exactly match for all features in all clusters."), + TestStep(7, "Ensure that the PICS_SDK_CI_ONLY PICS does not appear in the PICS file", "CI PICS is not present")] def test_TC_IDM_10_4(self): # wildcard read is done in setup_class @@ -175,6 +176,12 @@ def test_TC_IDM_10_4(self): location = ClusterPathLocation(endpoint_id=self.endpoint_id, cluster_id=cluster_id) self._check_and_record_errors(location, required, pics) + self.step(7) + if self.check_pics('PICS_SDK_CI_ONLY'): + self.record_error("PICS check", location=ProblemLocation(), + problem="PICS PICS_SDK_CI_ONLY found in PICS list. This PICS is disallowed for certification.") + self.success = False + if not self.success: self.fail_current_test("At least one PICS error was found for this endpoint") diff --git a/src/python_testing/TestBatchInvoke.py b/src/python_testing/TestBatchInvoke.py index 8af874fa7b0b27..230ebc9bbc1705 100644 --- a/src/python_testing/TestBatchInvoke.py +++ b/src/python_testing/TestBatchInvoke.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging diff --git a/src/python_testing/TestChoiceConformanceSupport.py b/src/python_testing/TestChoiceConformanceSupport.py new file mode 100644 index 00000000000000..8436bc8418a804 --- /dev/null +++ b/src/python_testing/TestChoiceConformanceSupport.py @@ -0,0 +1,211 @@ +# +# Copyright (c) 2023 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import itertools +import xml.etree.ElementTree as ElementTree + +import jinja2 +from choice_conformance_support import (evaluate_attribute_choice_conformance, evaluate_command_choice_conformance, + evaluate_feature_choice_conformance) +from matter_testing_support import MatterBaseTest, ProblemNotice, default_matter_test_main +from mobly import asserts +from spec_parsing_support import XmlCluster, add_cluster_data_from_xml + +FEATURE_TEMPLATE = '''\ + + + {%- if XXX %}' + + {% endif %} + + +''' + +ATTRIBUTE_TEMPLATE = ( + ' \n' + ' \n' + ' {% if XXX %}' + ' \n' + ' {% endif %}' + ' \n' + ' \n' +) + +COMMAND_TEMPLATE = ( + ' \n' + ' \n' + ' {% if XXX %}' + ' \n' + ' {% endif %}' + ' \n' + ' \n' +) + +CLUSTER_TEMPLATE = ( + '\n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' {{ feature_string }}\n' + ' \n' + ' \n' + ' {{ attribute_string}}\n' + ' \n' + ' \n' + ' {{ command_string }}\n' + ' \n' + '\n') + + +def _create_elements(template_str: str, base_name: str) -> list[str]: + xml_str = [] + + def add_elements(curr_choice: str, starting_id: int, more: str, XXX: bool): + for i in range(3): + element_name = f'{base_name}{curr_choice.upper()*(i+1)}' + environment = jinja2.Environment() + template = environment.from_string(template_str) + xml_str.append(template.render(id=(i + starting_id), name=element_name, choice=curr_choice, more=more, XXX=XXX)) + add_elements('a', 1, 'false', False) + add_elements('b', 4, 'true', False) + add_elements('c', 7, 'false', True) + add_elements('d', 10, 'true', True) + + return xml_str + +# TODO: this setup makes my life easy because it assumes that choice conformances apply only within one table +# if this is not true (ex, you can have choose 1 of a feature or an attribute), then this gets more complex +# in this case we need to have this test evaluate the same choice conformance value between multiple tables, and all +# the conformances need to be assessed for the entire element set. +# I've done it this way specifically so I can hardcode the choice values and test the features, attributes and commands +# separately, even though I load them all at the start. + +# Cluster with choices on all elements +# 3 of each element with O.a +# 3 of each element with O.b+ +# 3 of each element with [XXX].c +# 3 of each element with [XXX].d+ +# 1 element named XXX + + +def _create_features(): + xml = _create_elements(FEATURE_TEMPLATE, 'F') + xxx = (' \n' + ' \n' + ' \n') + xml.append(xxx) + return '\n'.join(xml) + + +def _create_attributes(): + xml = _create_elements(ATTRIBUTE_TEMPLATE, "attr") + xxx = (' \n' + ' \n' + ' \n') + xml.append(xxx) + return '\n'.join(xml) + + +def _create_commands(): + xml = _create_elements(COMMAND_TEMPLATE, 'cmd') + xxx = (' \n' + ' \n' + ' \n') + xml.append(xxx) + return '\n'.join(xml) + + +def _create_cluster(): + environment = jinja2.Environment() + template = environment.from_string(CLUSTER_TEMPLATE) + return template.render(feature_string=_create_features(), attribute_string=_create_attributes(), command_string=_create_commands()) + + +class TestConformanceSupport(MatterBaseTest): + def setup_class(self): + super().setup_class() + + clusters: dict[int, XmlCluster] = {} + pure_base_clusters: dict[str, XmlCluster] = {} + ids_by_name: dict[str, int] = {} + problems: list[ProblemNotice] = [] + cluster_xml = ElementTree.fromstring(_create_cluster()) + add_cluster_data_from_xml(cluster_xml, clusters, pure_base_clusters, ids_by_name, problems) + self.clusters = clusters + # each element type uses 13 IDs from 1-13 (or bits for the features) and we want to test all the combinations + num_elements = 13 + ids = range(1, num_elements + 1) + self.all_id_combos = [] + combos = [] + for r in range(1, num_elements + 1): + combos.extend(list(itertools.combinations(ids, r))) + for combo in combos: + # The first three IDs are all O.a, so we need exactly one for the conformance to be valid + expected_failures = set() + if len(set([1, 2, 3]) & set(combo)) != 1: + expected_failures.add('a') + if len(set([4, 5, 6]) & set(combo)) < 1: + expected_failures.add('b') + # For these, we are checking that choice conformance checkers + # - Correctly report errors and correct cases when the gating feature is ON + # - Do not report any errors when the gating features is off. + # Errors where we incorrectly set disallowed features based on the gating feature are checked + # elsewhere in the cert test in a comprehensive way. We just want to ensure that we are not + # incorrectly reporting choice conformance error as well + if 13 in combo and ((len(set([7, 8, 9]) & set(combo)) != 1)): + expected_failures.add('c') + if 13 in combo and (len(set([10, 11, 12]) & set(combo)) < 1): + expected_failures.add('d') + + self.all_id_combos.append((combo, expected_failures)) + + def _evaluate_problems(self, problems, expected_failures=list[str]): + if len(expected_failures) != len(problems): + print(problems) + asserts.assert_equal(len(expected_failures), len(problems), 'Unexpected number of choice conformance problems') + actual_failures = set([p.choice.marker for p in problems]) + asserts.assert_equal(actual_failures, expected_failures, "Mismatch between failures") + + def test_features(self): + def make_feature_map(combo: tuple[int]) -> int: + feature_map = 0 + for bit in combo: + feature_map += pow(2, bit) + return feature_map + + for combo, expected_failures in self.all_id_combos: + problems = evaluate_feature_choice_conformance(0, 1, self.clusters, make_feature_map(combo), [], []) + self._evaluate_problems(problems, expected_failures) + + def test_attributes(self): + for combo, expected_failures in self.all_id_combos: + problems = evaluate_attribute_choice_conformance(0, 1, self.clusters, 0, list(combo), []) + self._evaluate_problems(problems, expected_failures) + + def test_commands(self): + for combo, expected_failures in self.all_id_combos: + problems = evaluate_command_choice_conformance(0, 1, self.clusters, 0, [], list(combo)) + self._evaluate_problems(problems, expected_failures) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TestConformanceSupport.py b/src/python_testing/TestConformanceSupport.py index 1405e5c8c791cc..3744b6fe5e70d5 100644 --- a/src/python_testing/TestConformanceSupport.py +++ b/src/python_testing/TestConformanceSupport.py @@ -18,9 +18,10 @@ import xml.etree.ElementTree as ElementTree from typing import Callable -from conformance_support import (ConformanceDecision, ConformanceException, ConformanceParseParameters, deprecated, disallowed, - mandatory, optional, parse_basic_callable_from_xml, parse_callable_from_xml, - parse_device_type_callable_from_xml, provisional, zigbee) +from chip.tlv import uint +from conformance_support import (Choice, Conformance, ConformanceDecision, ConformanceException, ConformanceParseParameters, + deprecated, disallowed, mandatory, optional, parse_basic_callable_from_xml, + parse_callable_from_xml, parse_device_type_callable_from_xml, provisional, zigbee) from matter_testing_support import MatterBaseTest, default_matter_test_main from mobly import asserts @@ -59,7 +60,7 @@ def test_conformance_mandatory(self): et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) for f in self.feature_maps: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.MANDATORY) asserts.assert_equal(str(xml_callable), 'M') def test_conformance_optional(self): @@ -67,7 +68,7 @@ def test_conformance_optional(self): et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) for f in self.feature_maps: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.OPTIONAL) asserts.assert_equal(str(xml_callable), 'O') def test_conformance_disallowed(self): @@ -75,14 +76,14 @@ def test_conformance_disallowed(self): et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) for f in self.feature_maps: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.DISALLOWED) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.DISALLOWED) asserts.assert_equal(str(xml_callable), 'X') xml = '' et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) for f in self.feature_maps: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.DISALLOWED) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.DISALLOWED) asserts.assert_equal(str(xml_callable), 'D') def test_conformance_provisional(self): @@ -90,7 +91,7 @@ def test_conformance_provisional(self): et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) for f in self.feature_maps: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.PROVISIONAL) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.PROVISIONAL) asserts.assert_equal(str(xml_callable), 'P') def test_conformance_zigbee(self): @@ -98,7 +99,7 @@ def test_conformance_zigbee(self): et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) for f in self.feature_maps: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'Zigbee') def test_conformance_mandatory_on_condition(self): @@ -109,9 +110,9 @@ def test_conformance_mandatory_on_condition(self): xml_callable = parse_callable_from_xml(et, self.params) for i, f in enumerate(self.feature_maps): if self.has_ab[i]: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'AB') xml = ('' @@ -121,9 +122,9 @@ def test_conformance_mandatory_on_condition(self): xml_callable = parse_callable_from_xml(et, self.params) for i, f in enumerate(self.feature_maps): if self.has_cd[i]: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'CD') # single attribute mandatory @@ -134,9 +135,9 @@ def test_conformance_mandatory_on_condition(self): xml_callable = parse_callable_from_xml(et, self.params) for i, a in enumerate(self.attribute_lists): if self.has_attr1[i]: - asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(0x00, a, []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(0x00, a, []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'attr1') xml = ('' @@ -146,9 +147,9 @@ def test_conformance_mandatory_on_condition(self): xml_callable = parse_callable_from_xml(et, self.params) for i, a in enumerate(self.attribute_lists): if self.has_attr2[i]: - asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(0x00, a, []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(0x00, a, []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'attr2') # test command in optional and in boolean - this is the same as attribute essentially, so testing every permutation is overkill @@ -162,9 +163,9 @@ def test_conformance_optional_on_condition(self): xml_callable = parse_callable_from_xml(et, self.params) for i, f in enumerate(self.feature_maps): if self.has_ab[i]: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.OPTIONAL) else: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[AB]') xml = ('' @@ -174,9 +175,9 @@ def test_conformance_optional_on_condition(self): xml_callable = parse_callable_from_xml(et, self.params) for i, f in enumerate(self.feature_maps): if self.has_cd[i]: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.OPTIONAL) else: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[CD]') # single attribute optional @@ -187,9 +188,9 @@ def test_conformance_optional_on_condition(self): xml_callable = parse_callable_from_xml(et, self.params) for i, a in enumerate(self.attribute_lists): if self.has_attr1[i]: - asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(0x00, a, []).decision, ConformanceDecision.OPTIONAL) else: - asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(0x00, a, []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[attr1]') xml = ('' @@ -199,9 +200,9 @@ def test_conformance_optional_on_condition(self): xml_callable = parse_callable_from_xml(et, self.params) for i, a in enumerate(self.attribute_lists): if self.has_attr2[i]: - asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(0x00, a, []).decision, ConformanceDecision.OPTIONAL) else: - asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(0x00, a, []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[attr2]') # single command optional @@ -212,9 +213,9 @@ def test_conformance_optional_on_condition(self): xml_callable = parse_callable_from_xml(et, self.params) for i, c in enumerate(self.cmd_lists): if self.has_cmd1[i]: - asserts.assert_equal(xml_callable(0x00, [], c), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(0x00, [], c).decision, ConformanceDecision.OPTIONAL) else: - asserts.assert_equal(xml_callable(0x00, [], c), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(0x00, [], c).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[cmd1]') xml = ('' @@ -224,9 +225,9 @@ def test_conformance_optional_on_condition(self): xml_callable = parse_callable_from_xml(et, self.params) for i, c in enumerate(self.cmd_lists): if self.has_cmd2[i]: - asserts.assert_equal(xml_callable(0x00, [], c), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(0x00, [], c).decision, ConformanceDecision.OPTIONAL) else: - asserts.assert_equal(xml_callable(0x00, [], c), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(0x00, [], c).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[cmd2]') def test_conformance_not_term_mandatory(self): @@ -240,9 +241,9 @@ def test_conformance_not_term_mandatory(self): xml_callable = parse_callable_from_xml(et, self.params) for i, f in enumerate(self.feature_maps): if not self.has_ab[i]: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '!AB') xml = ('' @@ -254,9 +255,9 @@ def test_conformance_not_term_mandatory(self): xml_callable = parse_callable_from_xml(et, self.params) for i, f in enumerate(self.feature_maps): if not self.has_cd[i]: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '!CD') # single attribute not mandatory @@ -269,9 +270,9 @@ def test_conformance_not_term_mandatory(self): xml_callable = parse_callable_from_xml(et, self.params) for i, a in enumerate(self.attribute_lists): if not self.has_attr1[i]: - asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(0x00, a, []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(0x00, a, []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '!attr1') xml = ('' @@ -283,9 +284,9 @@ def test_conformance_not_term_mandatory(self): xml_callable = parse_callable_from_xml(et, self.params) for i, a in enumerate(self.attribute_lists): if not self.has_attr2[i]: - asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(0x00, a, []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(0x00, a, []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '!attr2') def test_conformance_not_term_optional(self): @@ -299,9 +300,9 @@ def test_conformance_not_term_optional(self): xml_callable = parse_callable_from_xml(et, self.params) for i, f in enumerate(self.feature_maps): if not self.has_ab[i]: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.OPTIONAL) else: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[!AB]') xml = ('' @@ -313,9 +314,9 @@ def test_conformance_not_term_optional(self): xml_callable = parse_callable_from_xml(et, self.params) for i, f in enumerate(self.feature_maps): if not self.has_cd[i]: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.OPTIONAL) else: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[!CD]') def test_conformance_and_term(self): @@ -330,9 +331,9 @@ def test_conformance_and_term(self): xml_callable = parse_callable_from_xml(et, self.params) for i, f in enumerate(self.feature_maps): if self.has_ab[i] and self.has_cd[i]: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'AB & CD') # and term for attributes only @@ -346,9 +347,9 @@ def test_conformance_and_term(self): xml_callable = parse_callable_from_xml(et, self.params) for i, a in enumerate(self.attribute_lists): if self.has_attr1[i] and self.has_attr2[i]: - asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(0x00, a, []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(0x00, a, []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'attr1 & attr2') # and term for feature and attribute @@ -363,9 +364,9 @@ def test_conformance_and_term(self): for i, f in enumerate(self.feature_maps): for j, a in enumerate(self.attribute_lists): if self.has_ab[i] and self.has_attr2[j]: - asserts.assert_equal(xml_callable(f, a, []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(f, a, []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(f, a, []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, a, []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'AB & attr2') def test_conformance_or_term(self): @@ -380,9 +381,9 @@ def test_conformance_or_term(self): xml_callable = parse_callable_from_xml(et, self.params) for i, f in enumerate(self.feature_maps): if self.has_ab[i] or self.has_cd[i]: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'AB | CD') # or term attribute only @@ -396,9 +397,9 @@ def test_conformance_or_term(self): xml_callable = parse_callable_from_xml(et, self.params) for i, a in enumerate(self.attribute_lists): if self.has_attr1[i] or self.has_attr2[i]: - asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(0x00, a, []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(0x00, a, []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'attr1 | attr2') # or term feature and attribute @@ -413,9 +414,9 @@ def test_conformance_or_term(self): for i, f in enumerate(self.feature_maps): for j, a in enumerate(self.attribute_lists): if self.has_ab[i] or self.has_attr2[j]: - asserts.assert_equal(xml_callable(f, a, []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(f, a, []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(f, a, []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, a, []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'AB | attr2') def test_conformance_and_term_with_not(self): @@ -432,9 +433,9 @@ def test_conformance_and_term_with_not(self): xml_callable = parse_callable_from_xml(et, self.params) for i, f in enumerate(self.feature_maps): if not self.has_ab[i] and self.has_cd[i]: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.OPTIONAL) else: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[!AB & CD]') def test_conformance_or_term_with_not(self): @@ -451,9 +452,9 @@ def test_conformance_or_term_with_not(self): xml_callable = parse_callable_from_xml(et, self.params) for i, f in enumerate(self.feature_maps): if self.has_ab[i] or not self.has_cd[i]: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'AB | !CD') # not around or term with @@ -469,9 +470,9 @@ def test_conformance_or_term_with_not(self): xml_callable = parse_callable_from_xml(et, self.params) for i, f in enumerate(self.feature_maps): if not (self.has_ab[i] or self.has_cd[i]): - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.OPTIONAL) else: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[!(AB | CD)]') def test_conformance_and_term_with_three_terms(self): @@ -487,11 +488,11 @@ def test_conformance_and_term_with_three_terms(self): et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) # no features - asserts.assert_equal(xml_callable(0x00, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(0x00, [], []).decision, ConformanceDecision.NOT_APPLICABLE) # one feature - asserts.assert_equal(xml_callable(0x01, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(0x01, [], []).decision, ConformanceDecision.NOT_APPLICABLE) # all features - asserts.assert_equal(xml_callable(0x07, [], []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(0x07, [], []).decision, ConformanceDecision.OPTIONAL) asserts.assert_equal(str(xml_callable), '[AB & CD & EF]') # and term with one of each @@ -508,9 +509,9 @@ def test_conformance_and_term_with_three_terms(self): for j, a in enumerate(self.attribute_lists): for k, c in enumerate(self.cmd_lists): if self.has_ab[i] and self.has_attr1[j] and self.has_cmd1[k]: - asserts.assert_equal(xml_callable(f, a, c), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(f, a, c).decision, ConformanceDecision.OPTIONAL) else: - asserts.assert_equal(xml_callable(f, a, c), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, a, c).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[AB & attr1 & cmd1]') def test_conformance_or_term_with_three_terms(self): @@ -525,11 +526,11 @@ def test_conformance_or_term_with_three_terms(self): et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) # no features - asserts.assert_equal(xml_callable(0x00, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(0x00, [], []).decision, ConformanceDecision.NOT_APPLICABLE) # one feature - asserts.assert_equal(xml_callable(0x01, [], []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(0x01, [], []).decision, ConformanceDecision.OPTIONAL) # all features - asserts.assert_equal(xml_callable(0x07, [], []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(0x07, [], []).decision, ConformanceDecision.OPTIONAL) asserts.assert_equal(str(xml_callable), '[AB | CD | EF]') # or term with one of each @@ -546,9 +547,9 @@ def test_conformance_or_term_with_three_terms(self): for j, a in enumerate(self.attribute_lists): for k, c in enumerate(self.cmd_lists): if self.has_ab[i] or self.has_attr1[j] or self.has_cmd1[k]: - asserts.assert_equal(xml_callable(f, a, c), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(f, a, c).decision, ConformanceDecision.OPTIONAL) else: - asserts.assert_equal(xml_callable(f, a, c), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, a, c).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[AB | attr1 | cmd1]') def test_conformance_otherwise(self): @@ -563,9 +564,9 @@ def test_conformance_otherwise(self): xml_callable = parse_callable_from_xml(et, self.params) for i, f in enumerate(self.feature_maps): if self.has_ab[i]: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.OPTIONAL) asserts.assert_equal(str(xml_callable), 'AB, O') # AB, [CD] @@ -581,11 +582,11 @@ def test_conformance_otherwise(self): xml_callable = parse_callable_from_xml(et, self.params) for i, f in enumerate(self.feature_maps): if self.has_ab[i]: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.MANDATORY) elif self.has_cd[i]: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.OPTIONAL) else: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'AB, [CD]') # AB & !CD, P @@ -604,9 +605,9 @@ def test_conformance_otherwise(self): xml_callable = parse_callable_from_xml(et, self.params) for i, f in enumerate(self.feature_maps): if self.has_ab[i] and not self.has_cd[i]: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.MANDATORY) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.MANDATORY) else: - asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.PROVISIONAL) + asserts.assert_equal(xml_callable(f, [], []).decision, ConformanceDecision.PROVISIONAL) asserts.assert_equal(str(xml_callable), 'AB & !CD, P') def test_conformance_greater(self): @@ -620,7 +621,7 @@ def test_conformance_greater(self): et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) # TODO: switch this to check greater than once the update to the base is done (#33422) - asserts.assert_equal(xml_callable(0x00, [], []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(0x00, [], []).decision, ConformanceDecision.OPTIONAL) asserts.assert_equal(str(xml_callable), 'attr1 > 1') # Ensure that we can only have greater terms with exactly 2 value @@ -705,7 +706,7 @@ def test_device_type_conformance(self): et = ElementTree.fromstring(xml) xml_callable = parse_device_type_callable_from_xml(et) asserts.assert_equal(str(xml_callable), 'Zigbee', msg) - asserts.assert_equal(xml_callable(0, [], []), ConformanceDecision.NOT_APPLICABLE, msg) + asserts.assert_equal(xml_callable(0, [], []).decision, ConformanceDecision.NOT_APPLICABLE, msg) xml = ('' '' @@ -714,7 +715,7 @@ def test_device_type_conformance(self): xml_callable = parse_device_type_callable_from_xml(et) # expect no exception here asserts.assert_equal(str(xml_callable), '[Zigbee]', msg) - asserts.assert_equal(xml_callable(0, [], []), ConformanceDecision.NOT_APPLICABLE, msg) + asserts.assert_equal(xml_callable(0, [], []).decision, ConformanceDecision.NOT_APPLICABLE, msg) # otherwise conforms are allowed xml = ('' @@ -725,7 +726,7 @@ def test_device_type_conformance(self): xml_callable = parse_device_type_callable_from_xml(et) # expect no exception here asserts.assert_equal(str(xml_callable), 'Zigbee, P', msg) - asserts.assert_equal(xml_callable(0, [], []), ConformanceDecision.PROVISIONAL, msg) + asserts.assert_equal(xml_callable(0, [], []).decision, ConformanceDecision.PROVISIONAL, msg) # Device type conditions or features don't correspond to anything in the spec, so the XML takes a best # guess as to what they are. We should be able to parse features, conditions, attributes as the same @@ -739,7 +740,7 @@ def test_device_type_conformance(self): xml_callable = parse_device_type_callable_from_xml(et) asserts.assert_equal(str(xml_callable), 'CD', msg) # Device features are always optional (at least for now), even though we didn't pass this feature in - asserts.assert_equal(xml_callable(0, [], []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(0, [], []).decision, ConformanceDecision.OPTIONAL) xml = ('' '' @@ -748,7 +749,208 @@ def test_device_type_conformance(self): et = ElementTree.fromstring(xml) xml_callable = parse_device_type_callable_from_xml(et) asserts.assert_equal(str(xml_callable), 'CD, testy', msg) - asserts.assert_equal(xml_callable(0, [], []), ConformanceDecision.OPTIONAL) + asserts.assert_equal(xml_callable(0, [], []).decision, ConformanceDecision.OPTIONAL) + + def check_good_choice(self, xml: str, conformance_str: str) -> Conformance: + et = ElementTree.fromstring(xml) + xml_callable = parse_callable_from_xml(et, self.params) + asserts.assert_equal(str(xml_callable), conformance_str, 'Bad choice conformance string') + return xml_callable + + def check_decision(self, more_expected: bool, conformance: Conformance, feature_map: uint, attr_list: list[uint], cmd_list: list[uint]): + decision = conformance(feature_map, attr_list, cmd_list) + asserts.assert_true(decision.choice, 'Expected choice conformance on decision, but did not get one') + asserts.assert_equal(decision.choice.marker, 'a', 'Unexpected conformance string returned') + asserts.assert_equal(decision.choice.more, more_expected, "Unexpected more on choice") + + def test_choice_conformance(self): + # Choice conformances can appear on: + # - base optional O.a + # - base optional feature [AB].a + # - base optional attribute [attr1].a + # - base optional command [cmd1].a + # - optional wrapper of complex feature [AB | CD].a, [!attr1].a + # - otherwise conformance attr1, [AB], O.a / attr1, [AB].a, O + # - multiple in otherwise [AB].a, [CD].b + # + # Choice conformances are disallowed on: + # - mandatory M.a + # - mandatory feature AB.a + # - mandatory attribute attr1.a + # - mandatory command cmd1.a + # - AND expressions (attr1 & O.a) + # - OR expressions (attr1 | O.a) + # - NOT expressions (!O.a) + # - internal expressions [AB.a], [attr1.a], [cmd1.a] + # - provisional P.a + # - disallowed X.a + # - deprecated D.a + + choices = [('a+', 'choice="a" more="true"', True), ('a', 'choice="a"', False)] + for suffix, xml_attrs, more in choices: + + AB = self.feature_names_to_bits['AB'] + attr1 = [self.attribute_names_to_values['attr1']] + cmd1 = [self.command_names_to_values['cmd1']] + + msg_not_applicable = "Expected NOT_APPLICABLE conformance" + xml = f'' + conformance = self.check_good_choice(xml, f'O.{suffix}') + self.check_decision(more, conformance, 0, [], []) + + xml = (f'' + '' + '') + conformance = self.check_good_choice(xml, f'[AB].{suffix}') + asserts.assert_equal(conformance(0, [], []).decision, ConformanceDecision.NOT_APPLICABLE, msg_not_applicable) + self.check_decision(more, conformance, AB, [], []) + + xml = (f'' + '' + '') + conformance = self.check_good_choice(xml, f'[attr1].{suffix}') + asserts.assert_equal(conformance(0, [], []).decision, ConformanceDecision.NOT_APPLICABLE, msg_not_applicable) + self.check_decision(more, conformance, 0, attr1, []) + + xml = (f'' + '' + '') + conformance = self.check_good_choice(xml, f'[cmd1].{suffix}') + asserts.assert_equal(conformance(0, [], []).decision, ConformanceDecision.NOT_APPLICABLE, msg_not_applicable) + self.check_decision(more, conformance, 0, [], cmd1) + + xml = (f'' + '' + '' + '' + '' + '') + conformance = self.check_good_choice(xml, f'[AB | CD].{suffix}') + asserts.assert_equal(conformance(0, [], []).decision, ConformanceDecision.NOT_APPLICABLE, msg_not_applicable) + self.check_decision(more, conformance, AB, [], []) + + xml = (f'' + '' + '' + '' + '') + conformance = self.check_good_choice(xml, f'[!attr1].{suffix}') + asserts.assert_equal(conformance(0, attr1, []).decision, ConformanceDecision.NOT_APPLICABLE, msg_not_applicable) + self.check_decision(more, conformance, 0, [], []) + + xml = ('' + '' + f'' + '' + '' + f'' + '') + conformance = self.check_good_choice(xml, f'attr1, [AB], O.{suffix}') + # with no features or attributes, this should end up as O.a, so there should be a choice + self.check_decision(more, conformance, 0, [], []) + # when we have this attribute, we should not have a choice + asserts.assert_equal(conformance(0, attr1, []).decision, ConformanceDecision.MANDATORY, 'Unexpected conformance') + asserts.assert_equal(conformance(0, attr1, []).choice, None, 'Unexpected choice in conformance') + # when we have only this feature, we should not have a choice + asserts.assert_equal(conformance(AB, [], []).decision, ConformanceDecision.OPTIONAL, 'Unexpected conformance') + asserts.assert_equal(conformance(AB, [], []).choice, None, 'Unexpected choice in conformance') + + # - multiple in otherwise [AB].a, [CD].b + xml = ('' + '' + f'' + '' + '' + f'' + '' + '' + '') + conformance = self.check_good_choice(xml, f'attr1, [AB].{suffix}, [CD].b') + asserts.assert_equal(conformance(0, [], []).decision, ConformanceDecision.NOT_APPLICABLE, msg_not_applicable) + # when we have this attribute, we should not have a choice + asserts.assert_equal(conformance(0, attr1, []).decision, ConformanceDecision.MANDATORY, 'Unexpected conformance') + asserts.assert_equal(conformance(0, attr1, []).choice, None, 'Unexpected choice in conformance') + # When it's just AB, we should have a choice + self.check_decision(more, conformance, AB, [], []) + # When we have both the attribute and AB, we should not have a choice + asserts.assert_equal(conformance(0, attr1, []).decision, ConformanceDecision.MANDATORY, 'Unexpected conformance') + asserts.assert_equal(conformance(0, attr1, []).choice, None, 'Unexpected choice in conformance') + # When we have AB and CD, we should be using the AB choice + CD = self.feature_names_to_bits['CD'] + ABCD = AB | CD + self.check_decision(more, conformance, ABCD, [], []) + # When we just have CD, we still have a choice, but the string should be b + asserts.assert_equal(conformance(CD, [], []).decision, ConformanceDecision.OPTIONAL, 'Unexpected conformance') + asserts.assert_equal(conformance(CD, [], []).choice, Choice('b', False), 'Unexpected choice in conformance') + + # Ones that should throw exceptions + + def check_bad_choice(xml: str): + msg = f'Choice conformance string should cause exception, but did not: {xml}' + et = ElementTree.fromstring(xml) + try: + parse_callable_from_xml(et, self.params) + asserts.fail(msg) + except ConformanceException: + pass + xml = f'' + check_bad_choice(xml) + + xml = f'' + check_bad_choice(xml) + + xml = f'' + check_bad_choice(xml) + + xml = f'' + check_bad_choice(xml) + + xml = ('' + '' + '' + f'' + '' + '') + check_bad_choice(xml) + + xml = ('' + '' + '' + f'' + '' + '') + check_bad_choice(xml) + + xml = ('' + '' + f'' + '' + '') + check_bad_choice(xml) + + xml = ('' + f'' + '') + check_bad_choice(xml) + + xml = ('' + f'' + '') + check_bad_choice(xml) + + xml = ('' + f'' + '') + check_bad_choice(xml) + + xml = (f'') + check_bad_choice(xml) + + xml = (f'') + check_bad_choice(xml) + + xml = (f'') + check_bad_choice(xml) if __name__ == "__main__": diff --git a/src/python_testing/TestGroupTableReports.py b/src/python_testing/TestGroupTableReports.py index d827752f1ee176..cc9b9a0718a25e 100644 --- a/src/python_testing/TestGroupTableReports.py +++ b/src/python_testing/TestGroupTableReports.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging import queue diff --git a/src/python_testing/TestMatterTestingSupport.py b/src/python_testing/TestMatterTestingSupport.py index eba9dc458383e5..d2a259f154adc6 100644 --- a/src/python_testing/TestMatterTestingSupport.py +++ b/src/python_testing/TestMatterTestingSupport.py @@ -625,7 +625,7 @@ def test_xml_pics(self): self.pics_assert('BINFO.S.A0010', True) self.pics_assert('BINFO.S.A0011', False) self.pics_assert('BINFO.S.A0012', True) - self.pics_assert('BINFO.S.A0013', True) + self.pics_assert('BINFO.S.A0013', False) self.pics_assert('BINFO.S.A0014', False) self.pics_assert('PICSDOESNOTEXIST', False) diff --git a/src/python_testing/TestSpecParsingDeviceType.py b/src/python_testing/TestSpecParsingDeviceType.py new file mode 100644 index 00000000000000..7729ccee8af24d --- /dev/null +++ b/src/python_testing/TestSpecParsingDeviceType.py @@ -0,0 +1,250 @@ +# +# 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 xml.etree.ElementTree as ElementTree + +import chip.clusters as Clusters +from chip.clusters import Attribute +from chip.tlv import uint +from conformance_support import conformance_allowed +from jinja2 import Template +from matter_testing_support import MatterBaseTest, default_matter_test_main +from mobly import asserts +from spec_parsing_support import build_xml_clusters, build_xml_device_types, parse_single_device_type +from TC_DeviceConformance import DeviceConformanceTests + + +class TestSpecParsingDeviceType(MatterBaseTest): + # This just tests that the current spec can be parsed without failures + def test_spec_device_parsing(self): + for id, d in self.xml_device_types.items(): + print(str(d)) + + def setup_class(self): + self.xml_clusters, self.xml_cluster_problems = build_xml_clusters() + self.xml_device_types, self.xml_device_types_problems = build_xml_device_types() + + self.device_type_id = 0xBBEF + self.revision = 2 + self.classification_class = "simple" + self.classification_scope = "endpoint" + self.clusters = {0x0003: "Identify", 0x0004: "Groups"} + + # Conformance support tests the different types of conformance for clusters, so here we just want to ensure that we're correctly parsing the XML into python + # adds the same attributes and features to every cluster. This is fine for testing. + self.template = Template(""" + + {% for i in range(revision) %} + + {% endfor %} + + + + + {% for k,v in clusters.items() %} + + + + {% endfor %} + + """) + + def test_device_type_clusters(self): + xml = self.template.render(device_type_id=self.device_type_id, revision=self.revision, classification_class=self.classification_class, + classification_scope=self.classification_scope, clusters=self.clusters) + et = ElementTree.fromstring(xml) + device_type, problems = parse_single_device_type(et) + asserts.assert_equal(len(problems), 0, "Unexpected problems parsing device type conformance") + asserts.assert_equal(len(device_type.keys()), 1, "Unexpected number of device types returned") + asserts.assert_true(self.device_type_id in device_type.keys(), "device type id not found in returned data") + asserts.assert_equal(device_type[self.device_type_id].revision, self.revision, "Unexpected revision") + asserts.assert_equal(len(device_type[self.device_type_id].server_clusters), + len(self.clusters), "Unexpected number of clusters") + for id, name in self.clusters.items(): + asserts.assert_equal(device_type[self.device_type_id].server_clusters[id].name, name, "Incorrect cluster name") + asserts.assert_equal(str(device_type[self.device_type_id].server_clusters[id].conformance), + 'M', 'Incorrect cluster conformance') + + def test_no_clusters(self): + clusters = {} + xml = self.template.render(device_type_id=self.device_type_id, revision=self.revision, classification_class=self.classification_class, + classification_scope=self.classification_scope, clusters=clusters) + et = ElementTree.fromstring(xml) + device_type, problems = parse_single_device_type(et) + asserts.assert_equal(len(problems), 0, "Unexpected problems parsing device type conformance") + asserts.assert_equal(len(device_type.keys()), 1, "Unexpected number of device types returned") + asserts.assert_true(self.device_type_id in device_type.keys(), "device type id not found in returned data") + asserts.assert_equal(device_type[self.device_type_id].revision, self.revision, "Unexpected revision") + asserts.assert_equal(len(device_type[self.device_type_id].server_clusters), len(clusters), "Unexpected number of clusters") + + def test_bad_device_type_id(self): + xml = self.template.render(device_type_id="", revision=self.revision, classification_class=self.classification_class, + classification_scope=self.classification_scope, clusters=self.clusters) + et = ElementTree.fromstring(xml) + device_type, problems = parse_single_device_type(et) + asserts.assert_equal(len(problems), 1, "Device with blank ID did not generate a problem notice") + + def test_bad_class(self): + xml = self.template.render(device_type_id=self.device_type_id, revision=self.revision, classification_class="", + classification_scope=self.classification_scope, clusters=self.clusters) + et = ElementTree.fromstring(xml) + device_type, problems = parse_single_device_type(et) + asserts.assert_equal(len(problems), 1, "Device with no class did not generate a problem notice") + + def test_bad_scope(self): + xml = self.template.render(device_type_id=self.device_type_id, revision=self.revision, classification_class=self.classification_class, + classification_scope="", clusters=self.clusters) + et = ElementTree.fromstring(xml) + device_type, problems = parse_single_device_type(et) + asserts.assert_equal(len(problems), 1, "Device with no scope did not generate a problem notice") + + # All these tests are based on the temp sensor device type because it is very simple + # it requires temperature measurement, identify and the base devices. + # Right now I'm not testing for binding condition. + # The test is entirely based on the descriptor cluster so that's all I'm populating here + # because it makes the test less complex to write. + def create_test(self, server_list: list[uint], no_descriptor: bool = False, bad_device_id: bool = False) -> DeviceConformanceTests: + self.test = DeviceConformanceTests() + self.test.xml_device_types = self.xml_device_types + self.test.xml_clusters = self.xml_clusters + + if bad_device_id: + known_ids = list(self.test.xml_device_types.keys()) + device_type_id = [a for a in range(min(known_ids), max(known_ids)) if a not in known_ids][0] + else: + device_type_id = 0x0302 + + resp = Attribute.AsyncReadTransaction.ReadResponse({}, [], {}) + if no_descriptor: + resp.attributes = {1: {}} + else: + desc = Clusters.Descriptor + server_list_attr = Clusters.Descriptor.Attributes.ServerList + device_type_list_attr = Clusters.Descriptor.Attributes.DeviceTypeList + device_type_list = [Clusters.Descriptor.Structs.DeviceTypeStruct(deviceType=device_type_id, revision=2)] + resp.attributes = {1: {desc: {device_type_list_attr: device_type_list, server_list_attr: server_list}}} + self.test.endpoints = resp.attributes + + def create_good_device(self, device_type_id: int) -> DeviceConformanceTests: + self.test = DeviceConformanceTests() + self.test.xml_device_types = self.xml_device_types + self.test.xml_clusters = self.xml_clusters + + resp = Attribute.AsyncReadTransaction.ReadResponse({}, [], {}) + desc = Clusters.Descriptor + server_list_attr = Clusters.Descriptor.Attributes.ServerList + device_type_list_attr = Clusters.Descriptor.Attributes.DeviceTypeList + device_type_list = [Clusters.Descriptor.Structs.DeviceTypeStruct( + deviceType=device_type_id, revision=self.xml_device_types[device_type_id].revision)] + server_list = [k for k, v in self.xml_device_types[device_type_id].server_clusters.items( + ) if conformance_allowed(v.conformance(0, [], []), False)] + resp.attributes = {1: {desc: {device_type_list_attr: device_type_list, server_list_attr: server_list}}} + + self.test.endpoints = resp.attributes + + # Test with temp sensor with temp sensor, identify and descriptor + def test_ts_minimal_clusters(self): + self.create_test([Clusters.TemperatureMeasurement.id, Clusters.Identify.id, Clusters.Descriptor.id]) + success, problems = self.test.check_device_type(fail_on_extra_clusters=True) + if problems: + print(problems) + asserts.assert_true(success, "Failure on Temperature Sensor device type test") + + # Temp sensor with temp sensor, identify, descriptor, binding + def test_ts_minimal_with_binding(self): + self.create_test([Clusters.TemperatureMeasurement.id, Clusters.Identify.id, Clusters.Binding.id, Clusters.Descriptor.id]) + success, problems = self.test.check_device_type(fail_on_extra_clusters=True) + if problems: + print(problems) + asserts.assert_true(success, "Failure on Temperature Sensor device type test") + asserts.assert_false(problems, "Found problems on Temperature sensor device type test") + + # Temp sensor with temp sensor, identify, descriptor, fixed label + def test_ts_minimal_with_label(self): + self.create_test([Clusters.TemperatureMeasurement.id, Clusters.Identify.id, Clusters.FixedLabel.id, Clusters.Descriptor.id]) + success, problems = self.test.check_device_type(fail_on_extra_clusters=True) + if problems: + print(problems) + asserts.assert_true(success, "Failure on Temperature Sensor device type test") + asserts.assert_false(problems, "Found problems on Temperature sensor device type test") + + # Temp sensor with temp sensor, descriptor + def test_ts_missing_identify(self): + self.create_test([Clusters.TemperatureMeasurement.id, Clusters.Descriptor.id]) + success, problems = self.test.check_device_type(fail_on_extra_clusters=True) + if problems: + print(problems) + asserts.assert_equal(len(problems), 1, "Unexpected number of problems") + asserts.assert_false(success, "Unexpected success running test that should fail") + + # endpoint 1 empty + def test_endpoint_missing_descriptor(self): + self.create_test([], no_descriptor=True) + success, problems = self.test.check_device_type(fail_on_extra_clusters=True) + if problems: + print(problems) + asserts.assert_equal(len(problems), 1, "Unexpected number of problems") + asserts.assert_false(success, "Unexpected success running test that should fail") + + # Temp sensor with temp sensor, descriptor, identify, onoff + def test_ts_extra_cluster(self): + self.create_test([Clusters.TemperatureMeasurement.id, Clusters.Identify.id, Clusters.Descriptor.id, Clusters.OnOff.id]) + success, problems = self.test.check_device_type(fail_on_extra_clusters=True) + if problems: + print(problems) + asserts.assert_equal(len(problems), 1, "Unexpected number of problems") + asserts.assert_false(success, "Unexpected success running test that should fail") + + success, problems = self.test.check_device_type(fail_on_extra_clusters=False) + asserts.assert_equal(len(problems), 1, "Did not receive expected warning for extra clusters") + asserts.assert_true(success, "Unexpected failure") + + def test_bad_device_type_id_device_type_test(self): + self.create_test([], bad_device_id=True) + success, problems = self.test.check_device_type(fail_on_extra_clusters=True) + if problems: + print(problems) + asserts.assert_equal(len(problems), 1, "Unexpected number of problems") + asserts.assert_false(success, "Unexpected success running test that should fail") + + def test_all_device_types(self): + for id in self.xml_device_types.keys(): + self.create_good_device(id) + success, problems = self.test.check_device_type(fail_on_extra_clusters=True) + if problems: + print(problems) + asserts.assert_false(problems, f"Unexpected problems on device type {id}") + asserts.assert_true(success, f"Unexpected failure on device type {id}") + + def test_disallowed_cluster(self): + for id, dt in self.xml_device_types.items(): + expected_problems = 0 + self.create_good_device(id) + for cluster_id, cluster in dt.server_clusters.items(): + if not conformance_allowed(cluster.conformance(0, [], []), False): + self.test.endpoints[1][Clusters.Descriptor][Clusters.Descriptor.Attributes.ServerList].append(cluster_id) + expected_problems += 1 + if expected_problems == 0: + continue + success, problems = self.test.check_device_type(fail_on_extra_clusters=True) + if problems: + print(problems) + asserts.assert_equal(len(problems), expected_problems, "Unexpected number of problems") + asserts.assert_false(success, "Unexpected success running test that should fail") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TestSpecParsingSupport.py b/src/python_testing/TestSpecParsingSupport.py index c35a5eb0f6bb22..0523ebbcd6a6df 100644 --- a/src/python_testing/TestSpecParsingSupport.py +++ b/src/python_testing/TestSpecParsingSupport.py @@ -235,20 +235,17 @@ def setup_class(self): def test_build_xml_override(self): # checks that the 1.3 spec (default) does not contain in-progress clusters and the TOT does tot_xml_clusters, problems = build_xml_clusters(PrebuiltDataModelDirectory.kMaster) - asserts.assert_greater(len(set(tot_xml_clusters.keys()) - set(self.spec_xml_clusters.keys())), + one_three_clusters, problems = build_xml_clusters(PrebuiltDataModelDirectory.k1_3) + asserts.assert_greater(len(set(tot_xml_clusters.keys()) - set(one_three_clusters.keys())), 0, "In progress dir does not contain any clusters not in 1.3") # only the pulse width modulation cluster was removed post 1.3 - asserts.assert_equal(set(self.spec_xml_clusters.keys()) - set(tot_xml_clusters.keys()), + asserts.assert_equal(set(one_three_clusters.keys()) - set(tot_xml_clusters.keys()), set([Clusters.PulseWidthModulation.id]), "There are some 1.3 clusters that are not included in the TOT spec") - str_path = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'data_model', '1.3', 'clusters')) + str_path = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'data_model', 'master', 'clusters')) string_override_check, problems = build_xml_clusters(str_path) asserts.assert_equal(string_override_check.keys(), self.spec_xml_clusters.keys(), "Mismatched cluster generation") - path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'data_model', '1.3', 'clusters') - path_override_check, problems = build_xml_clusters(path) - asserts.assert_equal(path_override_check.keys(), self.spec_xml_clusters.keys(), "Mismatched cluster generation") - with asserts.assert_raises(SpecParsingException): build_xml_clusters("baddir") @@ -377,8 +374,7 @@ def test_known_aliased_clusters(self): (0x040D, 'Carbon Dioxide Concentration Measurement', 'CDOCONC'), (0x0413, 'Nitrogen Dioxide Concentration Measurement', 'NDOCONC'), (0x0415, 'Ozone Concentration Measurement', 'OZCONC'), - # Change to "PM2.5 Concentration Measurement" once https://github.com/csa-data-model/projects/issues/453 is fixed - (0x042A, 'PM2', 'PMICONC'), + (0x042A, 'PM2.5 Concentration Measurement', 'PMICONC'), (0x042B, 'Formaldehyde Concentration Measurement', 'FLDCONC'), (0x042C, 'PM1 Concentration Measurement', 'PMHCONC'), (0x042D, 'PM10 Concentration Measurement', 'PMKCONC'), diff --git a/src/python_testing/basic_composition_support.py b/src/python_testing/basic_composition_support.py index 69f9633962eaca..678c249d0abf5d 100644 --- a/src/python_testing/basic_composition_support.py +++ b/src/python_testing/basic_composition_support.py @@ -99,9 +99,11 @@ def ConvertValue(value) -> Any: class BasicCompositionTests: async def connect_over_pase(self, dev_ctrl): - setupCode = self.matter_test_config.qr_code_content if self.matter_test_config.qr_code_content is not None else self.matter_test_config.manual_code - asserts.assert_true(setupCode, "Require either --qr-code or --manual-code.") - await dev_ctrl.FindOrEstablishPASESession(setupCode, self.dut_node_id) + asserts.assert_true(self.matter_test_config.qr_code_content == [] or self.matter_test_config.manual_code == [], + "Cannot have both QR and manual code specified") + setupCode = self.matter_test_config.qr_code_content + self.matter_test_config.manual_code + asserts.assert_equal(len(setupCode), 1, "Require one of either --qr-code or --manual-code.") + await dev_ctrl.FindOrEstablishPASESession(setupCode[0], self.dut_node_id) def dump_wildcard(self, dump_device_composition_path: typing.Optional[str]): node_dump_dict = {endpoint_id: MatterTlvToJson(self.endpoints_tlv[endpoint_id]) for endpoint_id in self.endpoints_tlv} diff --git a/src/python_testing/choice_conformance_support.py b/src/python_testing/choice_conformance_support.py new file mode 100644 index 00000000000000..58d37bf10180b0 --- /dev/null +++ b/src/python_testing/choice_conformance_support.py @@ -0,0 +1,74 @@ +from chip.tlv import uint +from conformance_support import Choice, ConformanceDecisionWithChoice +from global_attribute_ids import GlobalAttributeIds +from matter_testing_support import AttributePathLocation, ProblemNotice, ProblemSeverity +from spec_parsing_support import XmlCluster + + +class ChoiceConformanceProblemNotice(ProblemNotice): + def __init__(self, location: AttributePathLocation, choice: Choice, count: int): + problem = f'Problem with choice conformance {choice} - {count} selected' + super().__init__(test_name='Choice conformance', location=location, severity=ProblemSeverity.ERROR, problem=problem, spec_location='') + self.choice = choice + self.count = count + + +def _add_to_counts_if_required(conformance_decision_with_choice: ConformanceDecisionWithChoice, element_present: bool, counts: dict[Choice, int]): + choice = conformance_decision_with_choice.choice + if not choice: + return + counts[choice] = counts.get(choice, 0) + if element_present: + counts[choice] += 1 + + +def _evaluate_choices(location: AttributePathLocation, counts: dict[Choice, int]) -> list[ChoiceConformanceProblemNotice]: + problems: list[ChoiceConformanceProblemNotice] = [] + for choice, count in counts.items(): + if count == 0 or (not choice.more and count > 1): + problems.append(ChoiceConformanceProblemNotice(location, choice, count)) + return problems + + +def evaluate_feature_choice_conformance(endpoint_id: int, cluster_id: int, xml_clusters: dict[int, XmlCluster], feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> list[ChoiceConformanceProblemNotice]: + all_features = [1 << i for i in range(32)] + all_features = [f for f in all_features if f in xml_clusters[cluster_id].features.keys()] + + # Other pieces of the 10.2 test check for unknown features, so just remove them here to check choice conformance + counts: dict[Choice, int] = {} + for f in all_features: + xml_feature = xml_clusters[cluster_id].features[f] + conformance_decision_with_choice = xml_feature.conformance(feature_map, attribute_list, all_command_list) + _add_to_counts_if_required(conformance_decision_with_choice, (feature_map & f), counts) + + location = AttributePathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id, + attribute_id=GlobalAttributeIds.FEATURE_MAP_ID) + return _evaluate_choices(location, counts) + + +def evaluate_attribute_choice_conformance(endpoint_id: int, cluster_id: int, xml_clusters: dict[int, XmlCluster], feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> list[ChoiceConformanceProblemNotice]: + all_attributes = xml_clusters[cluster_id].attributes.keys() + + counts: dict[Choice, int] = {} + for attribute_id in all_attributes: + conformance_decision_with_choice = xml_clusters[cluster_id].attributes[attribute_id].conformance( + feature_map, attribute_list, all_command_list) + _add_to_counts_if_required(conformance_decision_with_choice, attribute_id in attribute_list, counts) + + location = AttributePathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id, + attribute_id=GlobalAttributeIds.ATTRIBUTE_LIST_ID) + return _evaluate_choices(location, counts) + + +def evaluate_command_choice_conformance(endpoint_id: int, cluster_id: int, xml_clusters: dict[int, XmlCluster], feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> list[ChoiceConformanceProblemNotice]: + all_commands = xml_clusters[cluster_id].accepted_commands.keys() + + counts: dict[Choice, int] = {} + for command_id in all_commands: + conformance_decision_with_choice = xml_clusters[cluster_id].accepted_commands[command_id].conformance( + feature_map, attribute_list, all_command_list) + _add_to_counts_if_required(conformance_decision_with_choice, command_id in all_command_list, counts) + + location = AttributePathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id, + attribute_id=GlobalAttributeIds.ACCEPTED_COMMAND_LIST_ID) + return _evaluate_choices(location, counts) diff --git a/src/python_testing/conformance_support.py b/src/python_testing/conformance_support.py index c9bdb5830c884b..90b6a4c3dd105c 100644 --- a/src/python_testing/conformance_support.py +++ b/src/python_testing/conformance_support.py @@ -18,7 +18,7 @@ import xml.etree.ElementTree as ElementTree from dataclasses import dataclass from enum import Enum, auto -from typing import Callable +from typing import Callable, Optional from chip.tlv import uint @@ -50,6 +50,35 @@ def __str__(self): return f"ConformanceException({self.msg})" +class ChoiceConformanceException(ConformanceException): + def __str__(self): + return f'ChoiceExceptions({self.msg})' + + +class BasicConformanceException(ConformanceException): + pass + + +@dataclass(frozen=True) +class Choice: + marker: str + more: bool + + def __str__(self): + more_str = '+' if self.more else '' + return '.' + self.marker + more_str + + +def parse_choice(element: ElementTree.Element) -> Optional[Choice]: + choice = element.get('choice', '') + if not choice: + return None + if element.tag != OPTIONAL_CONFORM: + raise ChoiceConformanceException('Choice conformance on non-optional attribute') + more = element.get('more', 'false') == 'true' + return Choice(choice, more) + + class ConformanceDecision(Enum): MANDATORY = auto() OPTIONAL = auto() @@ -58,6 +87,12 @@ class ConformanceDecision(Enum): PROVISIONAL = auto() +@dataclass +class ConformanceDecisionWithChoice: + decision: ConformanceDecision + choice: Optional[Choice] = None + + @dataclass class ConformanceParseParameters: feature_map: dict[str, uint] @@ -65,68 +100,87 @@ class ConformanceParseParameters: command_map: dict[str, uint] -def conformance_allowed(conformance_decision: ConformanceDecision, allow_provisional: bool): - if conformance_decision == ConformanceDecision.NOT_APPLICABLE or conformance_decision == ConformanceDecision.DISALLOWED: +def conformance_allowed(conformance_decision: ConformanceDecisionWithChoice, allow_provisional: bool): + if conformance_decision.decision in [ConformanceDecision.NOT_APPLICABLE, ConformanceDecision.DISALLOWED]: return False - if conformance_decision == ConformanceDecision.PROVISIONAL: + if conformance_decision.decision == ConformanceDecision.PROVISIONAL: return allow_provisional return True def is_disallowed(conformance: Callable): # Deprecated and disallowed conformances will come back as disallowed regardless of the implemented features / attributes / etc. - return conformance(0, [], []) == ConformanceDecision.DISALLOWED + return conformance(0, [], []).decision == ConformanceDecision.DISALLOWED + + +@dataclass +class Conformance(Callable): + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: + ''' Evaluates the conformance of a specific cluster or device type element. + + feature_map: The feature_map for the given cluster for which this conformance applies. Used to evaluate feature conformances + attribute_list: The attribute list for the given cluster for which this conformance applied. Used to evaluate attribute conformances + all_command_list: combined list of accepted and generated command IDs for the cluster. Used to evaluate command conformances + Returns: ConformanceDevisionWithChoice + Raises: ConformanceException if the conformance is invalid + ''' + raise ConformanceException('Base conformance called') + choice: Optional[Choice] = None -class zigbee: - def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecision: - return ConformanceDecision.NOT_APPLICABLE + +class zigbee(Conformance): + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: + return ConformanceDecisionWithChoice(ConformanceDecision.NOT_APPLICABLE) def __str__(self): return "Zigbee" -class mandatory: - def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecision: - return ConformanceDecision.MANDATORY +class mandatory(Conformance): + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: + return ConformanceDecisionWithChoice(ConformanceDecision.MANDATORY) def __str__(self): return 'M' -class optional: - def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecision: - return ConformanceDecision.OPTIONAL +class optional(Conformance): + def __init__(self, choice: Optional[Choice] = None): + self.choice = choice + + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: + return ConformanceDecisionWithChoice(ConformanceDecision.OPTIONAL, self.choice) def __str__(self): - return 'O' + return 'O' + (str(self.choice) if self.choice else '') -class deprecated: - def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecision: - return ConformanceDecision.DISALLOWED +class deprecated(Conformance): + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: + return ConformanceDecisionWithChoice(ConformanceDecision.DISALLOWED) def __str__(self): return 'D' -class disallowed: - def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecision: - return ConformanceDecision.DISALLOWED +class disallowed(Conformance): + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: + return ConformanceDecisionWithChoice(ConformanceDecision.DISALLOWED) def __str__(self): return 'X' -class provisional: - def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecision: - return ConformanceDecision.PROVISIONAL +class provisional(Conformance): + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: + return ConformanceDecisionWithChoice(ConformanceDecision.PROVISIONAL) def __str__(self): return 'P' -class literal: +class literal(Conformance): def __init__(self, value: str): self.value = int(value) @@ -148,56 +202,56 @@ def __str__(self): } -class feature: +class feature(Conformance): def __init__(self, requiredFeature: uint, code: str): self.requiredFeature = requiredFeature self.code = code - def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecision: + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: if self.requiredFeature & feature_map != 0: - return ConformanceDecision.MANDATORY - return ConformanceDecision.NOT_APPLICABLE + return ConformanceDecisionWithChoice(ConformanceDecision.MANDATORY) + return ConformanceDecisionWithChoice(ConformanceDecision.NOT_APPLICABLE) def __str__(self): return self.code -class device_feature: +class device_feature(Conformance): ''' This is different than element feature because device types use "features" that aren't reported anywhere''' def __init__(self, feature: str): self.feature = feature - def __call__(self, feature_map: uint = 0, attribute_list: list[uint] = [], all_command_list: list[uint] = []) -> ConformanceDecision: - return ConformanceDecision.OPTIONAL + def __call__(self, feature_map: uint = 0, attribute_list: list[uint] = [], all_command_list: list[uint] = []) -> ConformanceDecisionWithChoice: + return ConformanceDecisionWithChoice(ConformanceDecision.OPTIONAL) def __str__(self): return self.feature -class attribute: +class attribute(Conformance): def __init__(self, requiredAttribute: uint, name: str): self.requiredAttribute = requiredAttribute self.name = name - def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecision: + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: if self.requiredAttribute in attribute_list: - return ConformanceDecision.MANDATORY - return ConformanceDecision.NOT_APPLICABLE + return ConformanceDecisionWithChoice(ConformanceDecision.MANDATORY) + return ConformanceDecisionWithChoice(ConformanceDecision.NOT_APPLICABLE) def __str__(self): return self.name -class command: +class command(Conformance): def __init__(self, requiredCommand: uint, name: str): self.requiredCommand = requiredCommand self.name = name - def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecision: + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: if self.requiredCommand in all_command_list: - return ConformanceDecision.MANDATORY - return ConformanceDecision.NOT_APPLICABLE + return ConformanceDecisionWithChoice(ConformanceDecision.MANDATORY) + return ConformanceDecisionWithChoice(ConformanceDecision.NOT_APPLICABLE) def __str__(self): return self.name @@ -209,52 +263,56 @@ def strip_outer_parentheses(inner: str) -> str: return inner -class optional_wrapper: - def __init__(self, op: Callable): +class optional_wrapper(Conformance): + def __init__(self, op: Callable, choice: Optional[Choice] = None): self.op = op + self.choice = choice - def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecision: - decision = self.op(feature_map, attribute_list, all_command_list) - if decision == ConformanceDecision.MANDATORY or decision == ConformanceDecision.OPTIONAL: - return ConformanceDecision.OPTIONAL - elif decision == ConformanceDecision.NOT_APPLICABLE: - return ConformanceDecision.NOT_APPLICABLE + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: + decision_with_choice = self.op(feature_map, attribute_list, all_command_list) + + if decision_with_choice.decision in [ConformanceDecision.MANDATORY, ConformanceDecision.OPTIONAL]: + return ConformanceDecisionWithChoice(ConformanceDecision.OPTIONAL, self.choice) + elif decision_with_choice.decision == ConformanceDecision.NOT_APPLICABLE: + return decision_with_choice else: - raise ConformanceException(f'Optional wrapping invalid op {decision}') + raise ConformanceException(f'Optional wrapping invalid op {decision_with_choice}') def __str__(self): - return f'[{strip_outer_parentheses(str(self.op))}]' + return f'[{strip_outer_parentheses(str(self.op))}]' + (str(self.choice) if self.choice else '') -class mandatory_wrapper: +class mandatory_wrapper(Conformance): def __init__(self, op: Callable): self.op = op - def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecision: + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: return self.op(feature_map, attribute_list, all_command_list) def __str__(self): return strip_outer_parentheses(str(self.op)) -class not_operation: +class not_operation(Conformance): def __init__(self, op: Callable): + if op.choice: + raise ChoiceConformanceException('NOT operation called on choice conformance') self.op = op - def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecision: + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: # not operations can't be used with anything that returns DISALLOWED # not operations also can't be used with things that are optional # ie, ![AB] doesn't make sense, nor does !O - decision = self.op(feature_map, attribute_list, all_command_list) - if decision == ConformanceDecision.DISALLOWED or decision == ConformanceDecision.PROVISIONAL: + decision_with_choice = self.op(feature_map, attribute_list, all_command_list) + if decision_with_choice.decision in [ConformanceDecision.DISALLOWED, ConformanceDecision.PROVISIONAL]: raise ConformanceException('NOT operation on optional or disallowed item') # Features in device types degrade to optional so a not operation here is still optional because we don't have any way to verify the features since they're not exposed anywhere - elif decision == ConformanceDecision.OPTIONAL: - return ConformanceDecision.OPTIONAL - elif decision == ConformanceDecision.NOT_APPLICABLE: - return ConformanceDecision.MANDATORY - elif decision == ConformanceDecision.MANDATORY: - return ConformanceDecision.NOT_APPLICABLE + elif decision_with_choice.decision == ConformanceDecision.OPTIONAL: + return decision_with_choice + elif decision_with_choice.decision == ConformanceDecision.NOT_APPLICABLE: + return ConformanceDecisionWithChoice(ConformanceDecision.MANDATORY) + elif decision_with_choice.decision == ConformanceDecision.MANDATORY: + return ConformanceDecisionWithChoice(ConformanceDecision.NOT_APPLICABLE) else: raise ConformanceException('NOT called on item with non-conformance value') @@ -262,54 +320,60 @@ def __str__(self): return f'!{str(self.op)}' -class and_operation: +class and_operation(Conformance): def __init__(self, op_list: list[Callable]): + for op in op_list: + if op.choice: + raise ChoiceConformanceException('AND operation with internal choice conformance') self.op_list = op_list - def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecision: + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: for op in self.op_list: - decision = op(feature_map, attribute_list, all_command_list) + decision_with_choice = op(feature_map, attribute_list, all_command_list) # and operations can't happen on optional or disallowed - if decision == ConformanceDecision.OPTIONAL or decision == ConformanceDecision.DISALLOWED or decision == ConformanceDecision.PROVISIONAL: + if decision_with_choice.decision == ConformanceDecision.OPTIONAL and all([type(op) == device_feature for op in self.op_list]): + return decision_with_choice + elif decision_with_choice.decision in [ConformanceDecision.OPTIONAL, ConformanceDecision.DISALLOWED, ConformanceDecision.PROVISIONAL]: raise ConformanceException('AND operation on optional or disallowed item') - elif decision == ConformanceDecision.NOT_APPLICABLE: - return ConformanceDecision.NOT_APPLICABLE - elif decision == ConformanceDecision.MANDATORY: + elif decision_with_choice.decision == ConformanceDecision.NOT_APPLICABLE: + return decision_with_choice + elif decision_with_choice.decision == ConformanceDecision.MANDATORY: continue else: raise ConformanceException('Oplist item returned non-conformance value') - return ConformanceDecision.MANDATORY + return ConformanceDecisionWithChoice(ConformanceDecision.MANDATORY) def __str__(self): op_strs = [str(op) for op in self.op_list] return f'({" & ".join(op_strs)})' -class or_operation: +class or_operation(Conformance): def __init__(self, op_list: list[Callable]): + for op in op_list: + if op.choice: + raise ChoiceConformanceException('AND operation with internal choice conformance') self.op_list = op_list - def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecision: + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: for op in self.op_list: - decision = op(feature_map, attribute_list, all_command_list) - if decision == ConformanceDecision.DISALLOWED or decision == ConformanceDecision.PROVISIONAL: + decision_with_choice = op(feature_map, attribute_list, all_command_list) + if decision_with_choice.decision in [ConformanceDecision.DISALLOWED, ConformanceDecision.PROVISIONAL]: raise ConformanceException('OR operation on optional or disallowed item') - elif decision == ConformanceDecision.NOT_APPLICABLE: + elif decision_with_choice.decision == ConformanceDecision.NOT_APPLICABLE: continue - elif decision == ConformanceDecision.MANDATORY: - return ConformanceDecision.MANDATORY - elif decision == ConformanceDecision.OPTIONAL: - return ConformanceDecision.OPTIONAL + elif decision_with_choice.decision in [ConformanceDecision.MANDATORY, ConformanceDecision.OPTIONAL]: + return decision_with_choice else: raise ConformanceException('Oplist item returned non-conformance value') - return ConformanceDecision.NOT_APPLICABLE + return ConformanceDecisionWithChoice(ConformanceDecision.NOT_APPLICABLE) def __str__(self): op_strs = [str(op) for op in self.op_list] return f'({" | ".join(op_strs)})' -class greater_operation: +class greater_operation(Conformance): def _type_ok(self, op: Callable): return type(op) == attribute or type(op) == literal @@ -319,21 +383,21 @@ def __init__(self, op1: Callable, op2: Callable): self.op1 = op1 self.op2 = op2 - def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecision: + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: # For now, this is fully optional, need to implement this properly later, but it requires access to the actual attribute values # We need to reach into the attribute, but can't use it directly because the attribute callable is an EXISTENCE check and # the arithmetic functions require a value. - return ConformanceDecision.OPTIONAL + return ConformanceDecisionWithChoice(ConformanceDecision.OPTIONAL) def __str__(self): return f'{str(self.op1)} > {str(self.op2)}' -class otherwise: +class otherwise(Conformance): def __init__(self, op_list: list[Callable]): self.op_list = op_list - def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecision: + def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_list: list[uint]) -> ConformanceDecisionWithChoice: # Otherwise operations apply from left to right. If any of them # has a definite decision (optional, mandatory or disallowed), that is the one that applies # Provisional items are meant to be marked as the first item in the list @@ -341,11 +405,11 @@ def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_li # For O,D, optional applies (leftmost), but we should consider some way to warn here as well, # possibly in another function for op in self.op_list: - decision = op(feature_map, attribute_list, all_command_list) - if decision == ConformanceDecision.NOT_APPLICABLE: + decision_with_choice = op(feature_map, attribute_list, all_command_list) + if decision_with_choice.decision == ConformanceDecision.NOT_APPLICABLE: continue - return decision - return ConformanceDecision.NOT_APPLICABLE + return decision_with_choice + return ConformanceDecisionWithChoice(ConformanceDecision.NOT_APPLICABLE) def __str__(self): op_strs = [strip_outer_parentheses(str(op)) for op in self.op_list] @@ -354,9 +418,12 @@ def __str__(self): def parse_basic_callable_from_xml(element: ElementTree.Element) -> Callable: if list(element): - raise ConformanceException("parse_basic_callable_from_xml called for XML element with children") + raise BasicConformanceException("parse_basic_callable_from_xml called for XML element with children") # This will throw a key error if this is not a basic element key. try: + choice = parse_choice(element) + if choice and element.tag == OPTIONAL_CONFORM: + return optional(choice) return BASIC_CONFORMANCE[element.tag] except KeyError: if element.tag == CONDITION_TAG and element.get('name').lower() == ZIGBEE_CONDITION: @@ -364,17 +431,18 @@ def parse_basic_callable_from_xml(element: ElementTree.Element) -> Callable: elif element.tag == LITERAL_TAG: return literal(element.get('value')) else: - raise ConformanceException( + raise BasicConformanceException( f'parse_basic_callable_from_xml called for unknown element {str(element.tag)} {str(element.attrib)}') def parse_wrapper_callable_from_xml(element: ElementTree.Element, ops: list[Callable]) -> Callable: # optional can be a wrapper as well as a standalone # This can be any of the boolean operations, optional or otherwise + choice = parse_choice(element) if element.tag == OPTIONAL_CONFORM: if len(ops) > 1: raise ConformanceException(f'OPTIONAL term found with more than one subelement {list(element)}') - return optional_wrapper(ops[0]) + return optional_wrapper(ops[0], choice) elif element.tag == MANDATORY_CONFORM: if len(ops) > 1: raise ConformanceException(f'MANDATORY term found with more than one subelement {list(element)}') @@ -407,7 +475,7 @@ def parse_device_type_callable_from_xml(element: ElementTree.Element) -> Callabl # actually exposed anywhere ON the device other than through the presence of the cluster. So for now, treat any attribute conditions that are cluster conditions # as just optional, because it's optional to implement any device type feature. # Device types also have some marked as "condition" that are similarly optional - except ConformanceException: + except BasicConformanceException: if element.tag == ATTRIBUTE_TAG or element.tag == CONDITION_TAG or element.tag == FEATURE_TAG: return device_feature(element.attrib['name']) raise @@ -420,7 +488,7 @@ def parse_callable_from_xml(element: ElementTree.Element, params: ConformancePar if not list(element): try: return parse_basic_callable_from_xml(element) - except ConformanceException: + except BasicConformanceException: # If we get an exception here, it wasn't a basic type, so move on and check if its # something else. pass diff --git a/src/python_testing/hello_test.py b/src/python_testing/hello_test.py index 01657bf1bded6a..041f28ebeefb0d 100644 --- a/src/python_testing/hello_test.py +++ b/src/python_testing/hello_test.py @@ -15,12 +15,17 @@ # limitations under the License. # +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 # test-runner-run/run1/app: ${TYPE_OF_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === import logging diff --git a/scripts/tests/py/BUILD.gn b/src/python_testing/matter_testing_infrastructure/BUILD.gn similarity index 88% rename from scripts/tests/py/BUILD.gn rename to src/python_testing/matter_testing_infrastructure/BUILD.gn index e77297ac4e0955..f972040a3e64b5 100644 --- a/scripts/tests/py/BUILD.gn +++ b/src/python_testing/matter_testing_infrastructure/BUILD.gn @@ -28,9 +28,9 @@ pw_python_package("metadata_parser") { inputs = [ "env_test.yaml" ] sources = [ - "__init__.py", - "metadata.py", + "metadata_parser/__init__.py", + "metadata_parser/metadata.py", ] - tests = [ "test_metadata.py" ] + tests = [ "metadata_parser/test_metadata.py" ] } diff --git a/scripts/tests/py/env_test.yaml b/src/python_testing/matter_testing_infrastructure/env_test.yaml similarity index 100% rename from scripts/tests/py/env_test.yaml rename to src/python_testing/matter_testing_infrastructure/env_test.yaml diff --git a/third_party/nxp/rt_sdk/sdk_hook/logging/log.h b/src/python_testing/matter_testing_infrastructure/metadata_parser/__init__.py similarity index 100% rename from third_party/nxp/rt_sdk/sdk_hook/logging/log.h rename to src/python_testing/matter_testing_infrastructure/metadata_parser/__init__.py diff --git a/scripts/tests/py/metadata.py b/src/python_testing/matter_testing_infrastructure/metadata_parser/metadata.py similarity index 65% rename from scripts/tests/py/metadata.py rename to src/python_testing/matter_testing_infrastructure/metadata_parser/metadata.py index 46ac1fe9ec8ab8..050f20f9920d6b 100644 --- a/scripts/tests/py/metadata.py +++ b/src/python_testing/matter_testing_infrastructure/metadata_parser/metadata.py @@ -14,12 +14,18 @@ # limitations under the License. import re +import sys from dataclasses import dataclass from typing import Any, Dict, List import yaml +def bool_from_str(value: str) -> bool: + """Convert True/true/False/false strings to bool.""" + return value.strip().lower() == "true" + + @dataclass class Metadata: py_script_path: str @@ -58,16 +64,59 @@ def copy_from_dict(self, attr_dict: Dict[str, Any]) -> None: self.py_script_path = attr_dict["py_script_path"] if "factoryreset" in attr_dict: - self.factoryreset = bool(attr_dict["factoryreset"]) + self.factoryreset = bool_from_str(attr_dict["factoryreset"]) if "factoryreset_app_only" in attr_dict: - self.factoryreset_app_only = bool(attr_dict["factoryreset_app_only"]) + self.factoryreset_app_only = bool_from_str(attr_dict["factoryreset_app_only"]) if "script_gdb" in attr_dict: - self.script_gdb = bool(attr_dict["script_gdb"]) + self.script_gdb = bool_from_str(attr_dict["script_gdb"]) if "quiet" in attr_dict: - self.quiet = bool(attr_dict["quiet"]) + self.quiet = bool_from_str(attr_dict["quiet"]) + + +def extract_runs_arg_lines(py_script_path: str) -> Dict[str, Dict[str, str]]: + """Extract the run arguments from the CI test arguments blocks.""" + + found_ci_args_section = False + done_ci_args_section = False + + runs_def_ptrn = re.compile(r'^\s*#\s*test-runner-runs:\s*(?P.*)$') + arg_def_ptrn = re.compile( + r'^\s*#\s*test-runner-run/(?P[a-zA-Z0-9_]+)/(?P[a-zA-Z0-9_\-]+):\s*(?P.*)$') + + runs_arg_lines: Dict[str, Dict[str, str]] = {} + + with open(py_script_path, 'r', encoding='utf8') as py_script: + for line_idx, line in enumerate(py_script.readlines()): + line = line.strip() + line_num = line_idx + 1 + + # Detect the single CI args section, to skip the lines otherwise. + if not done_ci_args_section and line.startswith("# === BEGIN CI TEST ARGUMENTS ==="): + found_ci_args_section = True + elif found_ci_args_section and line.startswith("# === END CI TEST ARGUMENTS ==="): + done_ci_args_section = True + found_ci_args_section = False + + runs_match = runs_def_ptrn.match(line) + args_match = arg_def_ptrn.match(line) + + if not found_ci_args_section and (runs_match or args_match): + print(f"WARNING: {py_script_path}:{line_num}: Found CI args outside of CI TEST ARGUMENTS block!", file=sys.stderr) + continue + + if runs_match: + for run in runs_match.group("run_id").strip().split(): + runs_arg_lines[run] = {} + runs_arg_lines[run]['run'] = run + runs_arg_lines[run]['py_script_path'] = py_script_path + + elif args_match: + runs_arg_lines[args_match.group("run_id")][args_match.group("arg_name")] = args_match.group("arg_val") + + return runs_arg_lines class MetadataReader: @@ -126,33 +175,15 @@ def parse_script(self, py_script_path: str) -> List[Metadata]: the run arguments associated with a particular run defined in the script file. """ - - runs_def_ptrn = re.compile(r'^\s*#\s*test-runner-runs:\s*(.*)$') - arg_def_ptrn = re.compile(r'^\s*#\s*test-runner-run/([a-zA-Z0-9_]+)/([a-zA-Z0-9_\-]+):\s*(.*)$') - - runs_arg_lines: Dict[str, Dict[str, str]] = {} runs_metadata: List[Metadata] = [] - - with open(py_script_path, 'r', encoding='utf8') as py_script: - for line in py_script.readlines(): - runs_match = runs_def_ptrn.match(line.strip()) - args_match = arg_def_ptrn.match(line.strip()) - - if runs_match: - for run in runs_match.group(1).strip().split(): - runs_arg_lines[run] = {} - runs_arg_lines[run]['run'] = run - runs_arg_lines[run]['py_script_path'] = py_script_path - - elif args_match: - runs_arg_lines[args_match.group(1)][args_match.group(2)] = args_match.group(3) + runs_arg_lines = extract_runs_arg_lines(py_script_path) for run, attr in runs_arg_lines.items(): self.__resolve_env_vals__(attr) metadata = Metadata( py_script_path=attr.get("py_script_path", ""), - run=attr.get("run", ""), + run=run, app=attr.get("app", ""), app_args=attr.get("app_args", ""), script_args=attr.get("script_args", ""), diff --git a/scripts/tests/py/test_metadata.py b/src/python_testing/matter_testing_infrastructure/metadata_parser/test_metadata.py similarity index 94% rename from scripts/tests/py/test_metadata.py rename to src/python_testing/matter_testing_infrastructure/metadata_parser/test_metadata.py index a0c12a0ab0ed5a..863add965c315e 100644 --- a/scripts/tests/py/test_metadata.py +++ b/src/python_testing/matter_testing_infrastructure/metadata_parser/test_metadata.py @@ -21,13 +21,17 @@ class TestMetadataReader(unittest.TestCase): - test_file_content = ''' - # test-runner-runs: run1 + test_file_content = ''' + # === BEGIN CI TEST ARGUMENTS === + # test-runner-runs: run1 # test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/app-args: --discriminator 1234 --trace-to json:${TRACE_APP}.json # test-runner-run/run1/script-args: --commissioning-method on-network --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True + # === END CI TEST ARGUMENTS === + + # test-runner-run/run1/quiet: False ''' env_file_content = ''' diff --git a/scripts/tests/py/pyproject.toml b/src/python_testing/matter_testing_infrastructure/pyproject.toml similarity index 100% rename from scripts/tests/py/pyproject.toml rename to src/python_testing/matter_testing_infrastructure/pyproject.toml diff --git a/scripts/tests/py/setup.cfg b/src/python_testing/matter_testing_infrastructure/setup.cfg similarity index 95% rename from scripts/tests/py/setup.cfg rename to src/python_testing/matter_testing_infrastructure/setup.cfg index 464e36c03d3e2f..d1cbadff10880c 100644 --- a/scripts/tests/py/setup.cfg +++ b/src/python_testing/matter_testing_infrastructure/setup.cfg @@ -16,4 +16,4 @@ name = metadata_parser version = 0.0.1 author = Project CHIP Authors -description = Scripts to get metadata (runner arguments) associated with the python_testing scripts +description = Scripts to get metadata (runner arguments) associated with the python_testing scripts \ No newline at end of file diff --git a/scripts/tests/py/setup.py b/src/python_testing/matter_testing_infrastructure/setup.py similarity index 100% rename from scripts/tests/py/setup.py rename to src/python_testing/matter_testing_infrastructure/setup.py diff --git a/src/python_testing/matter_testing_support.py b/src/python_testing/matter_testing_support.py index 796397c57e0458..26437ea54b5b79 100644 --- a/src/python_testing/matter_testing_support.py +++ b/src/python_testing/matter_testing_support.py @@ -33,8 +33,9 @@ from dataclasses import asdict as dataclass_asdict from dataclasses import dataclass, field from datetime import datetime, timedelta, timezone -from enum import Enum -from typing import List, Optional, Tuple, Union +from enum import Enum, IntFlag +from functools import partial +from typing import Any, List, Optional, Tuple from chip.tlv import float32, uint @@ -52,7 +53,7 @@ from chip import discovery from chip.ChipStack import ChipStack from chip.clusters import ClusterObjects as ClusterObjects -from chip.clusters.Attribute import EventReadResult, SubscriptionTransaction +from chip.clusters.Attribute import EventReadResult, SubscriptionTransaction, TypedAttributePath from chip.exceptions import ChipStackError from chip.interaction_model import InteractionModelError, Status from chip.setup_payload import SetupPayload @@ -231,19 +232,22 @@ def name(self) -> str: class EventChangeCallback: - def __init__(self, expected_cluster: ClusterObjects): + def __init__(self, expected_cluster: ClusterObjects.Cluster): """This class creates a queue to store received event callbacks, that can be checked by the test script expected_cluster: is the cluster from which the events are expected """ self._q = queue.Queue() self._expected_cluster = expected_cluster - async def start(self, dev_ctrl, node_id: int, endpoint: int): + async def start(self, dev_ctrl, node_id: int, endpoint: int, fabric_filtered: bool = False, min_interval_sec: int = 0, max_interval_sec: int = 30) -> Any: """This starts a subscription for events on the specified node_id and endpoint. The cluster is specified when the class instance is created.""" + urgent = True self._subscription = await dev_ctrl.ReadEvent(node_id, - events=[(endpoint, self._expected_cluster, True)], reportInterval=(1, 5), - fabricFiltered=False, keepSubscriptions=True, autoResubscribe=False) + events=[(endpoint, self._expected_cluster, urgent)], reportInterval=( + min_interval_sec, max_interval_sec), + fabricFiltered=fabric_filtered, keepSubscriptions=True, autoResubscribe=False) self._subscription.SetEventUpdateCallback(self.__call__) + return self._subscription def __call__(self, res: EventReadResult, transaction: SubscriptionTransaction): """This is the subscription callback when an event is received. @@ -253,11 +257,11 @@ def __call__(self, res: EventReadResult, transaction: SubscriptionTransaction): f'Got subscription report for event on cluster {self._expected_cluster}: {res.Data}') self._q.put(res) - def wait_for_event_report(self, expected_event: ClusterObjects.ClusterEvent, timeout: int = 10): - """This function allows a test script to block waiting for the specific event to arrive with a timeout. - It returns the event data so that the values can be checked.""" + def wait_for_event_report(self, expected_event: ClusterObjects.ClusterEvent, timeoutS: int = 10): + """This function allows a test script to block waiting for the specific event to arrive with a timeout + (specified in seconds). It returns the event data so that the values can be checked.""" try: - res = self._q.get(block=True, timeout=timeout) + res = self._q.get(block=True, timeout=timeoutS) except queue.Empty: asserts.fail("Failed to receive a report for the event {}".format(expected_event)) @@ -265,6 +269,114 @@ def wait_for_event_report(self, expected_event: ClusterObjects.ClusterEvent, tim asserts.assert_equal(res.Header.EventId, expected_event.event_id, "Expected event ID not found in event report") return res.Data + def wait_for_event_expect_no_report(self, timeoutS: int = 10): + """This function succceeds/returns if an event does not arrive within the timeout specified in seconds. + If an event does arrive, an assert is called.""" + try: + res = self._q.get(block=True, timeout=timeoutS) + except queue.Empty: + return + + asserts.fail(f"Event reported when not expected {res}") + + @property + def event_queue(self) -> queue.Queue: + return self._q + + +class AttributeChangeCallback: + def __init__(self, expected_attribute: ClusterObjects.ClusterAttributeDescriptor): + self._output = queue.Queue() + self._expected_attribute = expected_attribute + + def __call__(self, path: TypedAttributePath, transaction: SubscriptionTransaction): + """This is the subscription callback when an attribute is updated. + It checks the passed in attribute is the same as the subscribed to attribute and + then posts it into the queue for later processing.""" + + asserts.assert_equal(path.AttributeType, self._expected_attribute, + f"[AttributeChangeCallback] Attribute mismatch. Expected: {self._expected_attribute}, received: {path.AttributeType}") + logging.debug(f"[AttributeChangeCallback] Attribute update callback for {path.AttributeType}") + q = (path, transaction) + self._output.put(q) + + def wait_for_report(self): + try: + path, transaction = self._output.get(block=True, timeout=10) + except queue.Empty: + asserts.fail( + f"[AttributeChangeCallback] Failed to receive a report for the {self._expected_attribute} attribute change") + + asserts.assert_equal(path.AttributeType, self._expected_attribute, + f"[AttributeChangeCallback] Received incorrect report. Expected: {self._expected_attribute}, received: {path.AttributeType}") + try: + attribute_value = transaction.GetAttribute(path) + logging.info( + f"[AttributeChangeCallback] Got attribute subscription report. Attribute {path.AttributeType}. Updated value: {attribute_value}. SubscriptionId: {transaction.subscriptionId}") + except KeyError: + asserts.fail("[AttributeChangeCallback] Attribute {expected_attribute} not found in returned report") + + +@dataclass +class AttributeValue: + endpoint_id: int + attribute: ClusterObjects.ClusterAttributeDescriptor + value: Any + timestamp_utc: datetime + + +class ClusterAttributeChangeAccumulator: + def __init__(self, expected_cluster: ClusterObjects.Cluster): + self._expected_cluster = expected_cluster + self._subscription = None + self.reset() + + def reset(self): + self._attribute_report_counts = {} + attrs = [cls for name, cls in inspect.getmembers(self._expected_cluster.Attributes) if inspect.isclass( + cls) and issubclass(cls, ClusterObjects.ClusterAttributeDescriptor)] + self._attribute_reports = {} + for a in attrs: + self._attribute_report_counts[a] = 0 + self._attribute_reports[a] = [] + self._q = queue.Queue() + + async def start(self, dev_ctrl, node_id: int, endpoint: int, fabric_filtered: bool = False, min_interval_sec: int = 0, max_interval_sec: int = 5) -> Any: + """This starts a subscription for attributes on the specified node_id and endpoint. The cluster is specified when the class instance is created.""" + self._subscription = await dev_ctrl.ReadAttribute( + nodeid=node_id, + attributes=[(endpoint, self._expected_cluster)], + reportInterval=(min_interval_sec, max_interval_sec), + fabricFiltered=fabric_filtered, + keepSubscriptions=True + ) + self._subscription.SetAttributeUpdateCallback(self.__call__) + return self._subscription + + def __call__(self, path: TypedAttributePath, transaction: SubscriptionTransaction): + """This is the subscription callback when an attribute report is received. + It checks the report is from the expected_cluster and then posts it into the queue for later processing.""" + if path.ClusterType == self._expected_cluster: + data = transaction.GetAttribute(path) + value = AttributeValue(endpoint_id=path.Path.EndpointId, attribute=path.AttributeType, + value=data, timestamp_utc=datetime.now(timezone.utc)) + logging.info(f"Got subscription report for {path.AttributeType}: {data}") + self._q.put(value) + self._attribute_report_counts[path.AttributeType] += 1 + self._attribute_reports[path.AttributeType].append(value) + + @property + def attribute_queue(self) -> queue.Queue: + return self._q + + @property + def attribute_report_counts(self) -> dict[ClusterObjects.ClusterAttributeDescriptor, int]: + return self._attribute_report_counts + + @property + def attribute_reports(self) -> dict[ClusterObjects.ClusterAttributeDescriptor, AttributeValue]: + return self._attribute_reports + class InternalTestRunnerHooks(TestRunnerHooks): @@ -307,6 +419,9 @@ def show_prompt(self, default_value: Optional[str] = None) -> None: pass + def test_skipped(self, filename: str, name: str): + logging.info(f"Skipping test from {filename}: {name}") + @dataclass class MatterTestConfig: @@ -333,8 +448,8 @@ class MatterTestConfig: # This allows cert tests to be run without re-commissioning for RR-1.1. maximize_cert_chains: bool = True - qr_code_content: Optional[str] = None - manual_code: Optional[str] = None + qr_code_content: List[str] = field(default_factory=list) + manual_code: List[str] = field(default_factory=list) wifi_ssid: Optional[str] = None wifi_passphrase: Optional[str] = None @@ -417,8 +532,17 @@ class CustomCommissioningParameters: @dataclass -class AttributePathLocation: +class ClusterPathLocation: endpoint_id: int + cluster_id: int + + def __str__(self): + return (f'\n Endpoint: {self.endpoint_id},' + f'\n Cluster: {cluster_id_str(self.cluster_id)}') + + +@dataclass +class AttributePathLocation(ClusterPathLocation): cluster_id: Optional[int] = None attribute_id: Optional[int] = None @@ -436,55 +560,50 @@ def as_string(self, mapper: ClusterMapper): return desc def __str__(self): - return (f'\n Endpoint: {self.endpoint_id},' - f'\n Cluster: {cluster_id_str(self.cluster_id)},' - f'\n Attribute:{id_str(self.attribute_id)}') + return (f'{super().__str__()}' + f'\n Attribute:{id_str(self.attribute_id)}') @dataclass -class EventPathLocation: - endpoint_id: int - cluster_id: int +class EventPathLocation(ClusterPathLocation): event_id: int def __str__(self): - return (f'\n Endpoint: {self.endpoint_id},' - f'\n Cluster: {cluster_id_str(self.cluster_id)},' - f'\n Event: {id_str(self.event_id)}') + return (f'{super().__str__()}' + f'\n Event: {id_str(self.event_id)}') @dataclass -class CommandPathLocation: - endpoint_id: int - cluster_id: int +class CommandPathLocation(ClusterPathLocation): command_id: int def __str__(self): - return (f'\n Endpoint: {self.endpoint_id},' - f'\n Cluster: {cluster_id_str(self.cluster_id)},' - f'\n Command: {id_str(self.command_id)}') + return (f'{super().__str__()}' + f'\n Command: {id_str(self.command_id)}') @dataclass -class ClusterPathLocation: - endpoint_id: int - cluster_id: int +class FeaturePathLocation(ClusterPathLocation): + feature_code: str def __str__(self): - return (f'\n Endpoint: {self.endpoint_id},' - f'\n Cluster: {cluster_id_str(self.cluster_id)}') + return (f'{super().__str__()}' + f'\n Feature: {self.feature_code}') @dataclass -class FeaturePathLocation: - endpoint_id: int - cluster_id: int - feature_code: str +class DeviceTypePathLocation: + device_type_id: int + cluster_id: Optional[int] = None def __str__(self): - return (f'\n Endpoint: {self.endpoint_id},' - f'\n Cluster: {cluster_id_str(self.cluster_id)},' - f'\n Feature: {self.feature_code}') + msg = f'\n DeviceType: {self.device_type_id}' + if self.cluster_id: + msg += f'\n ClusterID: {self.cluster_id}' + return msg + + +ProblemLocation = typing.Union[ClusterPathLocation, DeviceTypePathLocation] # ProblemSeverity is not using StrEnum, but rather Enum, since StrEnum only # appeared in 3.11. To make it JSON serializable easily, multiple inheritance @@ -500,7 +619,7 @@ class ProblemSeverity(str, Enum): @dataclass class ProblemNotice: test_name: str - location: Union[AttributePathLocation, EventPathLocation, CommandPathLocation, ClusterPathLocation, FeaturePathLocation] + location: ProblemLocation severity: ProblemSeverity problem: str spec_location: str = "" @@ -643,7 +762,7 @@ def get_test_steps(self, test: str) -> list[TestStep]: return [TestStep(1, "Run entire test")] if steps is None else steps def get_defined_test_steps(self, test: str) -> list[TestStep]: - steps_name = 'steps_' + test[5:] + steps_name = f'steps_{test.removeprefix("test_")}' try: fn = getattr(self, steps_name) return fn() @@ -663,7 +782,7 @@ def get_test_pics(self, test: str) -> list[str]: return [] if pics is None else pics def _get_defined_pics(self, test: str) -> list[TestStep]: - steps_name = 'pics_' + test[5:] + steps_name = f'pics_{test.removeprefix("test_")}' try: fn = getattr(self, steps_name) return fn() @@ -683,7 +802,7 @@ def get_test_desc(self, test: str) -> str: ex: 133.1.1. [TC-ACL-1.1] Global attributes ''' - desc_name = 'desc_' + test[5:] + desc_name = f'desc_{test.removeprefix("test_")}' try: fn = getattr(self, desc_name) return fn() @@ -732,8 +851,10 @@ def setup_class(self): def setup_test(self): self.current_step_index = 0 + self.test_start_time = datetime.now(timezone.utc) self.step_start_time = datetime.now(timezone.utc) self.step_skipped = False + self.failed = False if self.runner_hook and not self.is_commissioning: test_name = self.current_test_info.name steps = self.get_defined_test_steps(test_name) @@ -845,7 +966,8 @@ async def read_single_attribute_expect_error( async def send_single_cmd( self, cmd: Clusters.ClusterObjects.ClusterCommand, dev_ctrl: ChipDeviceCtrl = None, node_id: int = None, endpoint: int = None, - timedRequestTimeoutMs: typing.Union[None, int] = None) -> object: + timedRequestTimeoutMs: typing.Union[None, int] = None, + payloadCapability: int = ChipDeviceCtrl.TransportPayloadCapability.MRP_PAYLOAD) -> object: if dev_ctrl is None: dev_ctrl = self.default_controller if node_id is None: @@ -853,7 +975,8 @@ async def send_single_cmd( if endpoint is None: endpoint = self.matter_test_config.endpoint - result = await dev_ctrl.SendCommand(nodeid=node_id, endpoint=endpoint, payload=cmd, timedRequestTimeoutMs=timedRequestTimeoutMs) + result = await dev_ctrl.SendCommand(nodeid=node_id, endpoint=endpoint, payload=cmd, timedRequestTimeoutMs=timedRequestTimeoutMs, + payloadCapability=payloadCapability) return result async def send_test_event_triggers(self, eventTrigger: int, enableKey: bytes = None): @@ -896,13 +1019,13 @@ async def check_test_event_triggers_enabled(self): def print_step(self, stepnum: typing.Union[int, str], title: str) -> None: logging.info(f'***** Test Step {stepnum} : {title}') - def record_error(self, test_name: str, location: Union[AttributePathLocation, EventPathLocation, CommandPathLocation, ClusterPathLocation, FeaturePathLocation], problem: str, spec_location: str = ""): + def record_error(self, test_name: str, location: ProblemLocation, problem: str, spec_location: str = ""): self.problems.append(ProblemNotice(test_name, location, ProblemSeverity.ERROR, problem, spec_location)) - def record_warning(self, test_name: str, location: Union[AttributePathLocation, EventPathLocation, CommandPathLocation, ClusterPathLocation, FeaturePathLocation], problem: str, spec_location: str = ""): + def record_warning(self, test_name: str, location: ProblemLocation, problem: str, spec_location: str = ""): self.problems.append(ProblemNotice(test_name, location, ProblemSeverity.WARNING, problem, spec_location)) - def record_note(self, test_name: str, location: Union[AttributePathLocation, EventPathLocation, CommandPathLocation, ClusterPathLocation, FeaturePathLocation], problem: str, spec_location: str = ""): + def record_note(self, test_name: str, location: ProblemLocation, problem: str, spec_location: str = ""): self.problems.append(ProblemNotice(test_name, location, ProblemSeverity.NOTE, problem, spec_location)) def on_fail(self, record): @@ -910,12 +1033,11 @@ def on_fail(self, record): record is of type TestResultRecord ''' + self.failed = True if self.runner_hook and not self.is_commissioning: exception = record.termination_signal.exception step_duration = (datetime.now(timezone.utc) - self.step_start_time) / timedelta(microseconds=1) - # This isn't QUITE the test duration because the commissioning is handled separately, but it's clsoe enough for now - # This is already given in milliseconds - test_duration = record.end_time - record.begin_time + test_duration = (datetime.now(timezone.utc) - self.test_start_time) / timedelta(microseconds=1) # TODO: I have no idea what logger, logs, request or received are. Hope None works because I have nothing to give self.runner_hook.step_failure(logger=None, logs=None, duration=step_duration, request=None, received=None) self.runner_hook.test_stop(exception=exception, duration=test_duration) @@ -929,7 +1051,7 @@ def on_pass(self, record): # What is request? This seems like an implementation detail for the runner # TODO: As with failure, I have no idea what logger, logs or request are meant to be step_duration = (datetime.now(timezone.utc) - self.step_start_time) / timedelta(microseconds=1) - test_duration = record.end_time - record.begin_time + test_duration = (datetime.now(timezone.utc) - self.test_start_time) / timedelta(microseconds=1) self.runner_hook.step_success(logger=None, logs=None, duration=step_duration, request=None) # TODO: this check could easily be annoying when doing dev. flag it somehow? Ditto with the in-order check @@ -947,6 +1069,18 @@ def on_pass(self, record): if self.runner_hook and not self.is_commissioning: self.runner_hook.test_stop(exception=None, duration=test_duration) + def on_skip(self, record): + ''' Called by Mobly on test skip + + record is of type TestResultRecord + ''' + if self.runner_hook and not self.is_commissioning: + test_duration = (datetime.now(timezone.utc) - self.test_start_time) / timedelta(microseconds=1) + test_name = self.current_test_info.name + filename = inspect.getfile(self.__class__) + self.runner_hook.test_skipped(filename, test_name) + self.runner_hook.test_stop(exception=None, duration=test_duration) + def pics_guard(self, pics_condition: bool): """Checks a condition and if False marks the test step as skipped and returns False, otherwise returns True. @@ -969,7 +1103,7 @@ def mark_current_step_skipped(self): steps = self.get_test_steps(self.current_test_info.name) if self.current_step_index == 0: asserts.fail("Script error: mark_current_step_skipped cannot be called before step()") - num = steps[self.current_step_index-1].test_plan_number + num = steps[self.current_step_index - 1].test_plan_number except KeyError: num = self.current_step_index @@ -1030,39 +1164,50 @@ def step(self, step: typing.Union[int, str]): self.current_step_index = self.current_step_index + 1 self.step_skipped = False - def get_setup_payload_info(self) -> SetupPayloadInfo: - if self.matter_test_config.qr_code_content is not None: - qr_code = self.matter_test_config.qr_code_content + def get_setup_payload_info(self) -> List[SetupPayloadInfo]: + setup_payloads = [] + for qr_code in self.matter_test_config.qr_code_content: try: - setup_payload = SetupPayload().ParseQrCode(qr_code) + setup_payloads.append(SetupPayload().ParseQrCode(qr_code)) except ChipStackError: asserts.fail(f"QR code '{qr_code} failed to parse properly as a Matter setup code.") - elif self.matter_test_config.manual_code is not None: - manual_code = self.matter_test_config.manual_code + for manual_code in self.matter_test_config.manual_code: try: - setup_payload = SetupPayload().ParseManualPairingCode(manual_code) + setup_payloads.append(SetupPayload().ParseManualPairingCode(manual_code)) except ChipStackError: asserts.fail( f"Manual code code '{manual_code}' failed to parse properly as a Matter setup code. Check that all digits are correct and length is 11 or 21 characters.") - else: - asserts.fail("Require either --qr-code or --manual-code.") - - info = SetupPayloadInfo() - info.passcode = setup_payload.setup_passcode - if setup_payload.short_discriminator is not None: - info.filter_type = discovery.FilterType.SHORT_DISCRIMINATOR - info.filter_value = setup_payload.short_discriminator - else: - info.filter_type = discovery.FilterType.LONG_DISCRIMINATOR - info.filter_value = setup_payload.long_discriminator - return info + infos = [] + for setup_payload in setup_payloads: + info = SetupPayloadInfo() + info.passcode = setup_payload.setup_passcode + if setup_payload.short_discriminator is not None: + info.filter_type = discovery.FilterType.SHORT_DISCRIMINATOR + info.filter_value = setup_payload.short_discriminator + else: + info.filter_type = discovery.FilterType.LONG_DISCRIMINATOR + info.filter_value = setup_payload.long_discriminator + infos.append(info) + + num_passcodes = 0 if self.matter_test_config.setup_passcodes is None else len(self.matter_test_config.setup_passcodes) + num_discriminators = 0 if self.matter_test_config.discriminators is None else len(self.matter_test_config.discriminators) + asserts.assert_equal(num_passcodes, num_discriminators, "Must have same number of discriminators as passcodes") + if self.matter_test_config.discriminators: + for idx, discriminator in enumerate(self.matter_test_config.discriminators): + info = SetupPayloadInfo() + info.passcode = self.matter_test_config.setup_passcodes[idx] + info.filter_type = DiscoveryFilterType.LONG_DISCRIMINATOR + info.filter_value = discriminator + infos.append(info) + + return infos def wait_for_user_input(self, prompt_msg: str, prompt_msg_placeholder: str = "Submit anything to continue", - default_value: str = "y") -> str: + default_value: str = "y") -> Optional[str]: """Ask for user input and wait for it. Args: @@ -1071,13 +1216,19 @@ def wait_for_user_input(self, default_value (str, optional): TH UI prompt default value. Defaults to "y". Returns: - str: User input + str: User input or none if input is closed. """ if self.runner_hook: self.runner_hook.show_prompt(msg=prompt_msg, placeholder=prompt_msg_placeholder, default_value=default_value) - return input(f'{prompt_msg.removesuffix(chr(10))}\n') + logging.info("========= USER PROMPT =========") + logging.info(f">>> {prompt_msg.rstrip()} (press enter to confirm)") + try: + return input() + except EOFError: + logging.info("========= EOF on STDIN =========") + return None def generate_mobly_test_config(matter_test_config: MatterTestConfig): @@ -1256,27 +1407,23 @@ def populate_commissioning_args(args: argparse.Namespace, config: MatterTestConf config.commissioning_method = args.commissioning_method config.commission_only = args.commission_only - # TODO: this should also allow multiple once QR and manual codes are supported. - config.qr_code_content = args.qr_code - if args.manual_code: - config.manual_code = args.manual_code - else: - config.manual_code = None + config.qr_code_content.extend(args.qr_code) + config.manual_code.extend(args.manual_code) if args.commissioning_method is None: return True - if args.discriminators is None and (args.qr_code is None and args.manual_code is None): + if args.discriminators == [] and (args.qr_code == [] and args.manual_code == []): print("error: Missing --discriminator when no --qr-code/--manual-code present!") return False config.discriminators = args.discriminators - if args.passcodes is None and (args.qr_code is None and args.manual_code is None): + if args.passcodes == [] and (args.qr_code == [] and args.manual_code == []): print("error: Missing --passcode when no --qr-code/--manual-code present!") return False config.setup_passcodes = args.passcodes - if args.qr_code is not None and args.manual_code is not None: + if args.qr_code != [] and args.manual_code != []: print("error: Cannot have both --qr-code and --manual-code present!") return False @@ -1284,8 +1431,7 @@ def populate_commissioning_args(args: argparse.Namespace, config: MatterTestConf print("error: supplied number of discriminators does not match number of passcodes") return False - device_descriptors = [config.qr_code_content] if config.qr_code_content is not None else [ - config.manual_code] if config.manual_code is not None else config.discriminators + device_descriptors = config.qr_code_content + config.manual_code + config.discriminators if len(config.dut_node_ids) > len(device_descriptors): print("error: More node IDs provided than discriminators") @@ -1454,9 +1600,9 @@ def parse_matter_test_args(argv: Optional[List[str]] = None) -> MatterTestConfig code_group = parser.add_mutually_exclusive_group(required=False) code_group.add_argument('-q', '--qr-code', type=str, - metavar="QR_CODE", help="QR setup code content (overrides passcode and discriminator)") + metavar="QR_CODE", default=[], help="QR setup code content (overrides passcode and discriminator)", nargs="+") code_group.add_argument('--manual-code', type=str_from_manual_code, - metavar="MANUAL_CODE", help="Manual setup code content (overrides passcode and discriminator)") + metavar="MANUAL_CODE", default=[], help="Manual setup code content (overrides passcode and discriminator)", nargs="+") fabric_group = parser.add_argument_group( title="Fabric selection", description="Fabric selection for single-fabric basic usage, and commissioning") @@ -1493,6 +1639,12 @@ def parse_matter_test_args(argv: Optional[List[str]] = None) -> MatterTestConfig return convert_args_to_matter_config(parser.parse_known_args(argv)[0]) +def _async_runner(body, self: MatterBaseTest, *args, **kwargs): + timeout = self.matter_test_config.timeout if self.matter_test_config.timeout is not None else self.default_timeout + runner_with_timeout = asyncio.wait_for(body(self, *args, **kwargs), timeout=timeout) + return asyncio.run(runner_with_timeout) + + def async_test_body(body): """Decorator required to be applied whenever a `test_*` method is `async def`. @@ -1502,13 +1654,196 @@ def async_test_body(body): """ def async_runner(self: MatterBaseTest, *args, **kwargs): - timeout = self.matter_test_config.timeout if self.matter_test_config.timeout is not None else self.default_timeout - runner_with_timeout = asyncio.wait_for(body(self, *args, **kwargs), timeout=timeout) - return asyncio.run(runner_with_timeout) + return _async_runner(body, self, *args, **kwargs) return async_runner +def per_node_test(body): + """ Decorator to be used for PICS-free tests that apply to the entire node. + + Use this decorator when your script needs to be run once to validate the whole node. + To use this decorator, the test must NOT have an associated pics_ method. + """ + + def whole_node_runner(self: MatterBaseTest, *args, **kwargs): + asserts.assert_false(self.get_test_pics(self.current_test_info.name), "pics_ method supplied for per_node_test.") + return _async_runner(body, self, *args, **kwargs) + + return whole_node_runner + + +EndpointCheckFunction = typing.Callable[[Clusters.Attribute.AsyncReadTransaction.ReadResponse, int], bool] + + +def _has_cluster(wildcard, endpoint, cluster: ClusterObjects.Cluster) -> bool: + try: + return cluster in wildcard.attributes[endpoint] + except KeyError: + return False + + +def has_cluster(cluster: ClusterObjects.ClusterObjectDescriptor) -> EndpointCheckFunction: + """ EndpointCheckFunction that can be passed as a parameter to the per_endpoint_test decorator. + + Use this function with the per_endpoint_test decorator to run this test on all endpoints with + the specified cluster. For example, given a device with the following conformance + + EP0: cluster A, B, C + EP1: cluster D, E + EP2, cluster D + EP3, cluster E + + And the following test specification: + @per_endpoint_test(has_cluster(Clusters.D)) + test_mytest(self): + ... + + The test would be run on endpoint 1 and on endpoint 2. + + If the cluster is not found on any endpoint the decorator will call the on_skip function to + notify the test harness that the test is not applicable to this node and the test will not be run. + """ + return partial(_has_cluster, cluster=cluster) + + +def _has_attribute(wildcard, endpoint, attribute: ClusterObjects.ClusterAttributeDescriptor) -> bool: + cluster = getattr(Clusters, attribute.__qualname__.split('.')[-3]) + try: + attr_list = wildcard.attributes[endpoint][cluster][cluster.Attributes.AttributeList] + return attribute.attribute_id in attr_list + except KeyError: + return False + + +def has_attribute(attribute: ClusterObjects.ClusterAttributeDescriptor) -> EndpointCheckFunction: + """ EndpointCheckFunction that can be passed as a parameter to the per_endpoint_test decorator. + + Use this function with the per_endpoint_test decorator to run this test on all endpoints with + the specified attribute. For example, given a device with the following conformance + + EP0: cluster A, B, C + EP1: cluster D with attribute d, E + EP2, cluster D with attribute d + EP3, cluster D without attribute d + + And the following test specification: + @per_endpoint_test(has_attribute(Clusters.D.Attributes.d)) + test_mytest(self): + ... + + The test would be run on endpoint 1 and on endpoint 2. + + If the cluster is not found on any endpoint the decorator will call the on_skip function to + notify the test harness that the test is not applicable to this node and the test will not be run. + """ + return partial(_has_attribute, attribute=attribute) + + +def _has_feature(wildcard, endpoint, cluster: ClusterObjects.ClusterObjectDescriptor, feature: IntFlag) -> bool: + try: + feature_map = wildcard.attributes[endpoint][cluster][cluster.Attributes.FeatureMap] + return (feature & feature_map) != 0 + except KeyError: + return False + + +def has_feature(cluster: ClusterObjects.ClusterObjectDescriptor, feature: IntFlag) -> EndpointCheckFunction: + """ EndpointCheckFunction that can be passed as a parameter to the per_endpoint_test decorator. + + Use this function with the per_endpoint_test decorator to run this test on all endpoints with + the specified feature. For example, given a device with the following conformance + + EP0: cluster A, B, C + EP1: cluster D with feature F0 + EP2, cluster D with feature F0 + EP3, cluster D without feature F0 + + And the following test specification: + @per_endpoint_test(has_feature(Clusters.D.Bitmaps.Feature.F0)) + test_mytest(self): + ... + + The test would be run on endpoint 1 and on endpoint 2. + + If the cluster is not found on any endpoint the decorator will call the on_skip function to + notify the test harness that the test is not applicable to this node and the test will not be run. + """ + return partial(_has_feature, cluster=cluster, feature=feature) + + +async def get_accepted_endpoints_for_test(self: MatterBaseTest, accept_function: EndpointCheckFunction) -> list[uint]: + """ Helper function for the per_endpoint_test decorator. + + Returns a list of endpoints on which the test should be run given the accept_function for the test. + """ + wildcard = await self.default_controller.Read(self.dut_node_id, [()]) + return [e for e in wildcard.attributes.keys() if accept_function(wildcard, e)] + + +def per_endpoint_test(accept_function: EndpointCheckFunction): + """ Test decorator for a test that needs to be run once per endpoint that meets the accept_function criteria. + + Place this decorator above the test_ method to have the test framework run this test once per endpoint. + This decorator takes an EndpointCheckFunction to assess whether a test needs to be run on a particular + endpoint. + + For example, given the following device conformance: + + EP0: cluster A, B, C + EP1: cluster D, E + EP2, cluster D + EP3, cluster E + + And the following test specification: + @per_endpoint_test(has_cluster(Clusters.D)) + test_mytest(self): + ... + + The test would be run on endpoint 1 and on endpoint 2. + + If the cluster is not found on any endpoint the decorator will call the on_skip function to + notify the test harness that the test is not applicable to this node and the test will not be run. + + The decorator works by setting the self.matter_test_config.endpoint value and running the test function. + Therefore, tests that make use of this decorator should call controller functions against that endpoint. + Support functions in this file default to this endpoint. + + Tests that use this decorator cannot use a pics_ method for test selection and should not reference any + PICS values internally. + """ + def per_endpoint_test_internal(body): + def per_endpoint_runner(self: MatterBaseTest, *args, **kwargs): + asserts.assert_false(self.get_test_pics(self.current_test_info.name), "pics_ method supplied for per_endpoint_test.") + runner_with_timeout = asyncio.wait_for(get_accepted_endpoints_for_test(self, accept_function), timeout=30) + endpoints = asyncio.run(runner_with_timeout) + if not endpoints: + logging.info("No matching endpoints found - skipping test") + asserts.skip('No endpoints match requirements') + return + logging.info(f"Running test on the following endpoints: {endpoints}") + # setup_class is meant to be called once, but setup_test is expected to be run before + # each iteration. Mobly will run it for us the first time, but since we're running this + # more than one time, we want to make sure we reset everything as expected. + # Ditto for teardown - we want to tear down after each iteration, and we want to notify the hook that + # the test iteration is stopped. test_stop is called by on_pass or on_fail during the last iteration or + # on failure. + original_ep = self.matter_test_config.endpoint + for e in endpoints: + logging.info(f'Running test on endpoint {e}') + if e != endpoints[0]: + self.setup_test() + self.matter_test_config.endpoint = e + _async_runner(body, self, *args, **kwargs) + if e != endpoints[-1] and not self.failed: + self.teardown_test() + test_duration = (datetime.now(timezone.utc) - self.test_start_time) / timedelta(microseconds=1) + self.runner_hook.test_stop(exception=None, duration=test_duration) + self.matter_test_config.endpoint = original_ep + return per_endpoint_runner + return per_endpoint_test_internal + + class CommissionDeviceTest(MatterBaseTest): """Test class auto-injected at the start of test list to commission a device when requested""" @@ -1530,15 +1865,7 @@ async def _commission_device(self, i) -> bool: dev_ctrl = self.default_controller conf = self.matter_test_config - # TODO: qr code and manual code aren't lists - - if conf.qr_code_content or conf.manual_code: - info = self.get_setup_payload_info() - else: - info = SetupPayloadInfo() - info.passcode = conf.setup_passcodes[i] - info.filter_type = DiscoveryFilterType.LONG_DISCRIMINATOR - info.filter_value = conf.discriminators[i] + info = self.get_setup_payload_info()[i] if conf.commissioning_method == "on-network": try: diff --git a/src/python_testing/post_certification_tests/production_device_checks.py b/src/python_testing/post_certification_tests/production_device_checks.py index 0e8fd617c44110..6988076e6a87af 100644 --- a/src/python_testing/post_certification_tests/production_device_checks.py +++ b/src/python_testing/post_certification_tests/production_device_checks.py @@ -352,9 +352,9 @@ def __init__(self, code: str, code_type: SetupCodeType): self.config = MatterTestConfig(endpoint=0, dut_node_ids=[ 1], global_test_params=global_test_params, storage_path=self.admin_storage) if code_type == SetupCodeType.QR: - self.config.qr_code_content = code + self.config.qr_code_content = [code] else: - self.config.manual_code = code + self.config.manual_code = [code] self.config.paa_trust_store_path = Path(self.paa_path) # Set for DA-1.2, which uses the CD signing certs for verification. This test is now set to use the production CD signing certs from the DCL. self.config.global_test_params['cd_cert_dir'] = tmpdir_cd diff --git a/src/python_testing/spec_parsing_support.py b/src/python_testing/spec_parsing_support.py index bc36049de54cd5..1b8e29c4cf33cf 100644 --- a/src/python_testing/spec_parsing_support.py +++ b/src/python_testing/spec_parsing_support.py @@ -29,10 +29,10 @@ from chip.tlv import uint from conformance_support import (OPTIONAL_CONFORM, TOP_LEVEL_CONFORMANCE_TAGS, ConformanceDecision, ConformanceException, ConformanceParseParameters, feature, is_disallowed, mandatory, optional, or_operation, - parse_callable_from_xml) + parse_callable_from_xml, parse_device_type_callable_from_xml) from global_attribute_ids import GlobalAttributeIds -from matter_testing_support import (AttributePathLocation, ClusterPathLocation, CommandPathLocation, EventPathLocation, - FeaturePathLocation, ProblemNotice, ProblemSeverity) +from matter_testing_support import (AttributePathLocation, ClusterPathLocation, CommandPathLocation, DeviceTypePathLocation, + EventPathLocation, FeaturePathLocation, ProblemNotice, ProblemSeverity) _PRIVILEGE_STR = { None: "N/A", @@ -110,6 +110,43 @@ class XmlCluster: pics: str +class ClusterSide(Enum): + SERVER = auto() + CLIENT = auto() + + +@dataclass +class XmlDeviceTypeClusterRequirements: + name: str + side: ClusterSide + conformance: Callable[[uint, list[uint], list[uint]], ConformanceDecision] + # TODO: add element requirements + + def __str__(self): + return f'{self.name}: {str(self.conformance)}' + + +@dataclass +class XmlDeviceType: + name: str + revision: int + server_clusters: dict[uint, XmlDeviceTypeClusterRequirements] + client_clusters: dict[uint, XmlDeviceTypeClusterRequirements] + # Keeping these as strings for now because the exact definitions are being discussed in DMTT + classification_class: str + classification_scope: str + + def __str__(self): + msg = f'{self.name} - Revision {self.revision}, Class {self.classification_class}, Scope {self.classification_scope}\n' + msg += ' Server clusters\n' + for id, c in self.server_clusters.items(): + msg = msg + f' {id}: {str(c)}\n' + msg += ' Client clusters\n' + for id, c in self.client_clusters.items(): + msg = msg + f' {id}: {str(c)}\n' + return msg + + class CommandType(Enum): ACCEPTED = auto() GENERATED = auto() @@ -130,7 +167,35 @@ class CommandType(Enum): 0x042F: 'RNCONC', 0x0071: 'HEPAFREMON', 0x0072: 'ACFREMON', - 0x0405: 'RH'} + 0x0405: 'RH', + 0x001C: 'PWM'} + +CLUSTER_NAME_FIXES = {0x0036: 'WiFi Network Diagnostics', 0x042a: 'PM25 Concentration Measurement', 0x0006: 'On/Off'} +DEVICE_TYPE_NAME_FIXES = {0x010b: 'Dimmable Plug-In Unit', 0x010a: 'On/Off Plug-in Unit'} + + +def get_location_from_element(element: ElementTree.Element, cluster_id: int): + if element.tag == 'feature': + location = FeaturePathLocation(endpoint_id=0, cluster_id=cluster_id, feature_code=element.attrib['code']) + elif element.tag == 'command': + location = CommandPathLocation(endpoint_id=0, cluster_id=cluster_id, command_id=int(element.attrib['id'], 0)) + elif element.tag == 'attribute': + location = AttributePathLocation(endpoint_id=0, cluster_id=cluster_id, attribute_id=int(element.attrib['id'], 0)) + elif element.tag == 'event': + location = EventPathLocation(endpoint_id=0, cluster_id=cluster_id, event_id=int(element.attrib['id'], 0)) + else: + location = ClusterPathLocation(endpoint_id=0, cluster_id=cluster_id) + return location + + +def get_conformance(element: ElementTree.Element, cluster_id: int) -> tuple[ElementTree.Element, typing.Optional[ProblemNotice]]: + for sub in element: + if sub.tag in TOP_LEVEL_CONFORMANCE_TAGS: + return sub, None + location = get_location_from_element(element, cluster_id) + problem = ProblemNotice(test_name='Spec XML parsing', location=location, + severity=ProblemSeverity.WARNING, problem='Unable to find conformance element') + return ElementTree.Element(OPTIONAL_CONFORM), problem class ClusterParser: @@ -165,29 +230,11 @@ def __init__(self, cluster, cluster_id, name): self.params = ConformanceParseParameters(feature_map=self.create_feature_map(), attribute_map=self.create_attribute_map(), command_map=self.create_command_map()) - def get_location_from_element(self, element: ElementTree.Element): - # Conformance is missing, so let's record the problem and treat it as optional for lack of a better choice - if element.tag == 'feature': - location = FeaturePathLocation(endpoint_id=0, cluster_id=self._cluster_id, feature_code=element.attrib['code']) - elif element.tag == 'command': - location = CommandPathLocation(endpoint_id=0, cluster_id=self._cluster_id, command_id=int(element.attrib['id'], 0)) - elif element.tag == 'attribute': - location = AttributePathLocation(endpoint_id=0, cluster_id=self._cluster_id, attribute_id=int(element.attrib['id'], 0)) - elif element.tag == 'event': - location = EventPathLocation(endpoint_id=0, cluster_id=self._cluster_id, event_id=int(element.attrib['id'], 0)) - else: - location = ClusterPathLocation(endpoint_id=0, cluster_id=self._cluster_id) - return location - def get_conformance(self, element: ElementTree.Element) -> ElementTree.Element: - for sub in element: - if sub.tag in TOP_LEVEL_CONFORMANCE_TAGS: - return sub - location = self.get_location_from_element(element) - self._problems.append(ProblemNotice(test_name='Spec XML parsing', location=location, - severity=ProblemSeverity.WARNING, problem='Unable to find conformance element')) - - return ElementTree.Element(OPTIONAL_CONFORM) + element, problem = get_conformance(element, self._cluster_id) + if problem: + self._problems.append(problem) + return element def get_access(self, element: ElementTree.Element) -> Optional[ElementTree.Element]: for sub in element: @@ -271,7 +318,7 @@ def str_to_access_type(privilege_str: str) -> Clusters.AccessControl.Enums.Acces return Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kAdminister # We don't know what this means, for now, assume no access and mark a warning - location = self.get_location_from_element(element_xml) + location = get_location_from_element(element_xml, self._cluster_id) self._problems.append(ProblemNotice(test_name='Spec XML parsing', location=location, severity=ProblemSeverity.WARNING, problem=f'Unknown access type {privilege_str}')) return Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kUnknownEnumValue @@ -285,7 +332,7 @@ def str_to_access_type(privilege_str: str) -> Clusters.AccessControl.Enums.Acces if self._derived is not None or is_disallowed(conformance): return (None, None, None) - location = self.get_location_from_element(element_xml) + location = get_location_from_element(element_xml, self._cluster_id) self._problems.append(ProblemNotice(test_name='Spec XML parsing', location=location, severity=ProblemSeverity.WARNING, problem='Unable to find access element')) return (None, None, None) @@ -456,13 +503,22 @@ class PrebuiltDataModelDirectory(Enum): kMaster = auto() -def build_xml_clusters(data_model_directory: typing.Union[PrebuiltDataModelDirectory, str] = PrebuiltDataModelDirectory.k1_3) -> tuple[dict[uint, XmlCluster], list[ProblemNotice]]: +class DataModelLevel(str, Enum): + kCluster = 'clusters' + kDeviceType = 'device_types' + + +def _get_data_model_directory(data_model_directory: typing.Union[PrebuiltDataModelDirectory, str], data_model_level: DataModelLevel) -> str: if data_model_directory == PrebuiltDataModelDirectory.k1_3: - dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'data_model', '1.3', 'clusters') + return os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'data_model', '1.3', data_model_level) elif data_model_directory == PrebuiltDataModelDirectory.kMaster: - dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'data_model', 'master', 'clusters') + return os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'data_model', 'master', data_model_level) else: - dir = data_model_directory + return data_model_directory + + +def build_xml_clusters(data_model_directory: typing.Union[PrebuiltDataModelDirectory, str] = PrebuiltDataModelDirectory.kMaster) -> tuple[dict[uint, XmlCluster], list[ProblemNotice]]: + dir = _get_data_model_directory(data_model_directory, DataModelLevel.kCluster) clusters: dict[int, XmlCluster] = {} pure_base_clusters: dict[str, XmlCluster] = {} @@ -613,3 +669,98 @@ def combine_attributes(base: dict[uint, XmlAttribute], derived: dict[uint, XmlAt features=features, attributes=attributes, accepted_commands=accepted_commands, generated_commands=generated_commands, unknown_commands=unknown_commands, events=events, pics=c.pics) xml_clusters[id] = new + + +def parse_single_device_type(root: ElementTree.Element) -> tuple[list[ProblemNotice], dict[int, XmlDeviceType]]: + problems: list[ProblemNotice] = [] + device_types: dict[int, XmlDeviceType] = {} + device = root.iter('deviceType') + for d in device: + name = d.attrib['name'] + location = DeviceTypePathLocation(device_type_id=0) + + str_id = d.attrib['id'] + if not str_id: + if name == "Base Device Type": + # Base is special device type, we're going to call it -1 so we can combine and remove it later. + str_id = '-1' + else: + problems.append(ProblemNotice("Parse Device Type XML", location=location, + severity=ProblemSeverity.WARNING, problem=f"Device type {name} does not have an ID listed")) + break + try: + id = int(str_id, 0) + revision = int(d.attrib['revision'], 0) + except ValueError: + problems.append(ProblemNotice("Parse Device Type XML", location=location, + severity=ProblemSeverity.WARNING, + problem=f"Device type {name} does not a valid ID or revision. ID: {str_id} revision: {d.get('revision', 'UNKNOWN')}")) + break + if id in DEVICE_TYPE_NAME_FIXES: + name = DEVICE_TYPE_NAME_FIXES[id] + try: + classification = next(d.iter('classification')) + scope = classification.attrib['scope'] + device_class = classification.attrib['class'] + except (KeyError, StopIteration): + # this is fine for base device type + if id == -1: + classification = 'BASE' + scope = 'BASE' + device_class = 'BASE' + else: + location = DeviceTypePathLocation(device_type_id=id) + problems.append(ProblemNotice("Parse Device Type XML", location=location, + severity=ProblemSeverity.WARNING, problem="Unable to find classification data for device type")) + break + device_types[id] = XmlDeviceType(name=name, revision=revision, server_clusters={}, client_clusters={}, + classification_class=device_class, classification_scope=scope) + clusters = d.iter('cluster') + for c in clusters: + try: + cid = int(c.attrib['id'], 0) + conformance_xml, tmp_problem = get_conformance(c, cid) + if tmp_problem: + problems.append(tmp_problem) + conformance = parse_device_type_callable_from_xml(conformance_xml) + side_dict = {'server': ClusterSide.SERVER, 'client': ClusterSide.CLIENT} + side = side_dict[c.attrib['side']] + name = c.attrib['name'] + if cid in CLUSTER_NAME_FIXES: + name = CLUSTER_NAME_FIXES[cid] + cluster = XmlDeviceTypeClusterRequirements(name=name, side=side, conformance=conformance) + if side == ClusterSide.SERVER: + device_types[id].server_clusters[cid] = cluster + else: + device_types[id].client_clusters[cid] = cluster + except ConformanceException: + location = DeviceTypePathLocation(device_type_id=id, cluster_id=cid) + problems.append(ProblemNotice("Parse Device Type XML", location=location, + severity=ProblemSeverity.WARNING, problem="Unable to parse conformance for cluster")) + # TODO: Check for features, attributes and commands as element requirements + # NOTE: Spec currently does a bad job of matching these exactly to the names and codes + # so this will need a bit of fancy handling here to get this right. + return device_types, problems + + +def build_xml_device_types(data_model_directory: typing.Union[PrebuiltDataModelDirectory, str] = PrebuiltDataModelDirectory.kMaster) -> tuple[dict[int, XmlDeviceType], list[ProblemNotice]]: + dir = _get_data_model_directory(data_model_directory, DataModelLevel.kDeviceType) + device_types: dict[int, XmlDeviceType] = {} + problems = [] + for xml in glob.glob(f"{dir}/*.xml"): + logging.info(f'Parsing file {xml}') + tree = ElementTree.parse(f'{xml}') + root = tree.getroot() + tmp_device_types, tmp_problems = parse_single_device_type(root) + problems = problems + tmp_problems + device_types.update(tmp_device_types) + + if -1 not in device_types.keys(): + raise ConformanceException("Base device type not found in device type xml data") + + # Add in the base device type information and remove the base device type from the device_types + for d in device_types.values(): + d.server_clusters.update(device_types[-1].server_clusters) + device_types.pop(-1) + + return device_types, problems diff --git a/src/python_testing/test_testing/MockTestRunner.py b/src/python_testing/test_testing/MockTestRunner.py index 5d6592b5a8cd41..024228db7cd035 100644 --- a/src/python_testing/test_testing/MockTestRunner.py +++ b/src/python_testing/test_testing/MockTestRunner.py @@ -37,21 +37,43 @@ async def __call__(self, *args, **kwargs): class MockTestRunner(): - def __init__(self, filename: str, classname: str, test: str, endpoint: int, pics: dict[str, bool] = {}): - self.config = MatterTestConfig( - tests=[test], endpoint=endpoint, dut_node_ids=[1], pics=pics) + + def __init__(self, filename: str, classname: str, test: str, endpoint: int = 0, pics: dict[str, bool] = None, paa_trust_store_path=None): + self.test = test + self.endpoint = endpoint + self.pics = pics + self.kvs_storage = 'kvs_admin.json' + self.paa_path = paa_trust_store_path + self.set_test(filename, classname, test) self.stack = MatterStackState(self.config) self.default_controller = self.stack.certificate_authorities[0].adminList[0].NewController( nodeId=self.config.controller_node_id, paaTrustStorePath=str(self.config.paa_trust_store_path), catTags=self.config.controller_cat_tags ) + + def set_test(self, filename: str, classname: str, test: str): + self.test = test + self.set_test_config() module = importlib.import_module(Path(os.path.basename(filename)).stem) self.test_class = getattr(module, classname) + def set_test_config(self, test_config: MatterTestConfig = MatterTestConfig()): + self.config = test_config + self.config.tests = [self.test] + self.config.endpoint = self.endpoint + self.config.storage_path = self.kvs_storage + self.config.paa_trust_store_path = self.paa_path + if not self.config.dut_node_ids: + self.config.dut_node_ids = [1] + if self.pics: + self.config.pics = self.pics + def Shutdown(self): self.stack.Shutdown() - def run_test_with_mock_read(self, read_cache: Attribute.AsyncReadTransaction.ReadResponse): + def run_test_with_mock_read(self, read_cache: Attribute.AsyncReadTransaction.ReadResponse, hooks=None): self.default_controller.Read = AsyncMock(return_value=read_cache) - return run_tests_no_exit(self.test_class, self.config, None, self.default_controller, self.stack) + # This doesn't need to do anything since we are overriding the read anyway + self.default_controller.FindOrEstablishPASESession = AsyncMock(return_value=None) + return run_tests_no_exit(self.test_class, self.config, hooks, self.default_controller, self.stack) diff --git a/src/python_testing/test_testing/TestDecorators.py b/src/python_testing/test_testing/TestDecorators.py new file mode 100644 index 00000000000000..2ce418d6c5e43a --- /dev/null +++ b/src/python_testing/test_testing/TestDecorators.py @@ -0,0 +1,347 @@ +# +# 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. +# + + +# Hooks: +# If this is a per-endpoint test +# - If test is run, hook object will get one test_start and one test_stop call per endpoint on which the test is run +# - If the test is skipped, hook object will get test_start, test_skipped, test_stop +# If this is a whole-node test: +# - test will always be run, so hook object will get test_start, test_stop +# +# You will get step_* calls as appropriate in between the test_start and test_stop calls if the test is not skipped. + +import os +import sys + +import chip.clusters as Clusters +from chip.clusters import Attribute + +try: + from matter_testing_support import (MatterBaseTest, async_test_body, get_accepted_endpoints_for_test, has_attribute, + has_cluster, has_feature, per_endpoint_test, per_node_test) +except ImportError: + sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from matter_testing_support import (MatterBaseTest, async_test_body, get_accepted_endpoints_for_test, has_attribute, + has_cluster, has_feature, per_endpoint_test, per_node_test) + +from typing import Optional + +from mobly import asserts +from MockTestRunner import MockTestRunner + + +def get_clusters(endpoints: list[int]) -> Attribute.AsyncReadTransaction.ReadResponse: + c = Clusters.OnOff + attr = c.Attributes + # We're JUST populating the globals here because that's all that matters for this particular test + feature_map = c.Bitmaps.Feature.kLighting + # Only supported attributes - globals and OnOff. This isn't a compliant device. Doesn't matter for this test. + attribute_list = [attr.FeatureMap.attribute_id, attr.AttributeList.attribute_id, + attr.AcceptedCommandList.attribute_id, attr.GeneratedCommandList.attribute_id, attr.OnOff.attribute_id] + accepted_commands = [c.Commands.Off, c.Commands.On] + resp = Attribute.AsyncReadTransaction.ReadResponse({}, [], {}) + for e in endpoints: + resp.attributes[e] = {c: {attr.FeatureMap: feature_map, + attr.AttributeList: attribute_list, attr.AcceptedCommandList: accepted_commands}} + return resp + + +class DecoratorTestRunnerHooks: + def __init__(self): + self.started = [] + self.skipped = [] + self.stopped = 0 + + def start(self, count: int): + pass + + def stop(self, duration: int): + pass + + def test_start(self, filename: str, name: str, count: int, steps: list[str] = []): + self.started.append(name) + + def test_skipped(self, filename: str, name: str): + self.skipped.append(name) + + def test_stop(self, exception: Exception, duration: int): + self.stopped += 1 + + def step_skipped(self, name: str, expression: str): + pass + + def step_start(self, name: str): + pass + + def step_success(self, logger, logs, duration: int, request): + pass + + def step_failure(self, logger, logs, duration: int, request, received): + pass + + def step_unknown(self): + pass + + def show_prompt(self, + msg: str, + placeholder: Optional[str] = None, + default_value: Optional[str] = None) -> None: + pass + + +class TestDecorators(MatterBaseTest): + def test_checkers(self): + has_onoff = has_cluster(Clusters.OnOff) + has_onoff_onoff = has_attribute(Clusters.OnOff.Attributes.OnOff) + has_onoff_ontime = has_attribute(Clusters.OnOff.Attributes.OnTime) + has_timesync = has_cluster(Clusters.TimeSynchronization) + has_timesync_utc = has_attribute(Clusters.TimeSynchronization.Attributes.UTCTime) + + wildcard = get_clusters([0, 1]) + + def check_endpoints(f, expect_true, expectation: str): + asserts.assert_equal(f(wildcard, 0), expect_true, f"Expected {expectation} == {expect_true} on EP0") + asserts.assert_equal(f(wildcard, 1), expect_true, f"Expected {expectation} == {expect_true} on EP1") + asserts.assert_false(f(wildcard, 2), f"Expected {expectation} == False on EP2") + + check_endpoints(has_onoff, True, "OnOff Cluster") + check_endpoints(has_onoff_onoff, True, "OnOff attribute") + check_endpoints(has_onoff_ontime, False, "OnTime attribute") + check_endpoints(has_timesync, False, "TimeSynchronization Cluster") + check_endpoints(has_timesync_utc, False, "UTC attribute") + + @async_test_body + async def test_endpoints(self): + has_onoff = has_cluster(Clusters.OnOff) + has_onoff_onoff = has_attribute(Clusters.OnOff.Attributes.OnOff) + has_onoff_ontime = has_attribute(Clusters.OnOff.Attributes.OnTime) + has_timesync = has_cluster(Clusters.TimeSynchronization) + has_timesync_utc = has_attribute(Clusters.TimeSynchronization.Attributes.UTCTime) + + all_endpoints = await self.default_controller.Read(self.dut_node_id, [()]) + all_endpoints = list(all_endpoints.attributes.keys()) + + msg = "Unexpected endpoint list returned" + + endpoints = await get_accepted_endpoints_for_test(self, has_onoff) + asserts.assert_equal(endpoints, all_endpoints, msg) + + endpoints = await get_accepted_endpoints_for_test(self, has_onoff_onoff) + asserts.assert_equal(endpoints, all_endpoints, msg) + + endpoints = await get_accepted_endpoints_for_test(self, has_onoff_ontime) + asserts.assert_equal(endpoints, [], msg) + + endpoints = await get_accepted_endpoints_for_test(self, has_timesync) + asserts.assert_equal(endpoints, [], msg) + + endpoints = await get_accepted_endpoints_for_test(self, has_timesync_utc) + asserts.assert_equal(endpoints, [], msg) + + # This test should cause an assertion because it has pics_ method + @per_node_test + async def test_whole_node_with_pics(self): + pass + + # This method returns the top level pics for test_whole_node_with_pics + # It is used to test that test_whole_node_with_pics will fail since you can't have a whole node test gated on a PICS. + def pics_whole_node_with_pics(self): + return ['EXAMPLE.S'] + + # This test should cause an assertion because it has a pics_ method + @per_endpoint_test(has_cluster(Clusters.OnOff)) + async def test_per_endpoint_with_pics(self): + pass + + # This method returns the top level pics for test_per_endpoint_with_pics + # It is used to test that test_per_endpoint_with_pics will fail since you can't have a per endpoint test gated on a PICS. + def pics_per_endpoint_with_pics(self): + return ['EXAMPLE.S'] + + # This test should be run once + @per_node_test + async def test_whole_node_ok(self): + pass + + # This test should be run once per endpoint + @per_endpoint_test(has_cluster(Clusters.OnOff)) + async def test_endpoint_cluster_yes(self): + pass + + # This test should be skipped since this cluster isn't on any endpoint + @per_endpoint_test(has_cluster(Clusters.TimeSynchronization)) + async def test_endpoint_cluster_no(self): + pass + + # This test should be run once per endpoint + @per_endpoint_test(has_attribute(Clusters.OnOff.Attributes.OnOff)) + async def test_endpoint_attribute_yes(self): + pass + + # This test should be skipped since this attribute isn't on the supported cluster + @per_endpoint_test(has_attribute(Clusters.OnOff.Attributes.OffWaitTime)) + async def test_endpoint_attribute_supported_cluster_no(self): + pass + + # This test should be skipped since this attribute is part of an unsupported cluster + @per_endpoint_test(has_attribute(Clusters.TimeSynchronization.Attributes.Granularity)) + async def test_endpoint_attribute_unsupported_cluster_no(self): + pass + + # This test should be run once per endpoint + @per_endpoint_test(has_feature(Clusters.OnOff, Clusters.OnOff.Bitmaps.Feature.kLighting)) + async def test_endpoint_feature_yes(self): + pass + + # This test should be skipped since this attribute is part of an unsupported cluster + @per_endpoint_test(has_feature(Clusters.TimeSynchronization, Clusters.TimeSynchronization.Bitmaps.Feature.kNTPClient)) + async def test_endpoint_feature_unsupported_cluster_no(self): + pass + + # This test should be run since both are present + @per_endpoint_test(has_attribute(Clusters.OnOff.Attributes.OnOff) and has_cluster(Clusters.OnOff)) + async def test_endpoint_boolean_yes(self): + pass + + # This test should be skipped since we have an OnOff cluster, but no Time sync + @per_endpoint_test(has_cluster(Clusters.OnOff) and has_cluster(Clusters.TimeSynchronization)) + async def test_endpoint_boolean_no(self): + pass + + @per_endpoint_test(has_cluster(Clusters.OnOff)) + async def test_fail_on_ep0(self): + if self.matter_test_config.endpoint == 0: + asserts.fail("Expected failure") + + @per_endpoint_test(has_cluster(Clusters.OnOff)) + async def test_fail_on_ep1(self): + if self.matter_test_config.endpoint == 1: + asserts.fail("Expected failure") + + @per_node_test + async def test_fail_on_whole_node(self): + asserts.fail("Expected failure") + + +def main(): + failures = [] + hooks = DecoratorTestRunnerHooks() + test_runner = MockTestRunner('TestDecorators.py', 'TestDecorators', 'test_checkers') + read_resp = get_clusters([0, 1]) + ok = test_runner.run_test_with_mock_read(read_resp, hooks) + if not ok: + failures.append("Test case failure: test_checkers") + + test_runner.set_test('TestDecorators.py', 'TestDecorators', 'test_endpoints') + read_resp = get_clusters([0, 1]) + ok = test_runner.run_test_with_mock_read(read_resp, hooks) + if not ok: + failures.append("Test case failure: test_endpoints") + + read_resp = get_clusters([0]) + ok = test_runner.run_test_with_mock_read(read_resp, hooks) + if not ok: + failures.append("Test case failure: test_endpoints") + + test_name = 'test_whole_node_with_pics' + test_runner.set_test('TestDecorators.py', 'TestDecorators', test_name) + ok = test_runner.run_test_with_mock_read(read_resp, hooks) + if ok: + failures.append(f"Did not get expected test assertion on {test_name}") + + test_name = 'test_per_endpoint_with_pics' + test_runner.set_test('TestDecorators.py', 'TestDecorators', test_name) + ok = test_runner.run_test_with_mock_read(read_resp, hooks) + if ok: + failures.append(f"Did not get expected test assertion on {test_name}") + + # Test should run once for the whole node, regardless of the number of endpoints + def run_check(test_name: str, read_response: Attribute.AsyncReadTransaction.ReadResponse, expected_runs: int, expect_skip: bool) -> None: + nonlocal failures + test_runner.set_test('TestDecorators.py', 'TestDecorators', test_name) + hooks = DecoratorTestRunnerHooks() + ok = test_runner.run_test_with_mock_read(read_response, hooks) + started_ok = len(hooks.started) == expected_runs + skipped_ok = (hooks.skipped != []) == expect_skip + stopped_ok = hooks.stopped == expected_runs + if not ok or not started_ok or not skipped_ok or not stopped_ok: + failures.append( + f'Expected {expected_runs} run of {test_name}, skips expected: {expect_skip}. Runs: {hooks.started}, skips: {hooks.skipped} stops: {hooks.stopped}') + + def check_once_per_node(test_name: str): + run_check(test_name, get_clusters([0]), 1, False) + run_check(test_name, get_clusters([0, 1]), 1, False) + + def check_once_per_endpoint(test_name: str): + run_check(test_name, get_clusters([0]), 1, False) + run_check(test_name, get_clusters([0, 1]), 2, False) + + def check_skipped(test_name: str): + run_check(test_name, get_clusters([0]), 1, True) + run_check(test_name, get_clusters([0, 1]), 1, True) + + check_once_per_node('test_whole_node_ok') + check_once_per_endpoint('test_endpoint_cluster_yes') + check_skipped('test_endpoint_cluster_no') + check_once_per_endpoint('test_endpoint_attribute_yes') + check_skipped('test_endpoint_attribute_supported_cluster_no') + check_skipped('test_endpoint_attribute_unsupported_cluster_no') + check_once_per_endpoint('test_endpoint_feature_yes') + check_skipped('test_endpoint_feature_unsupported_cluster_no') + check_once_per_endpoint('test_endpoint_boolean_yes') + check_skipped('test_endpoint_boolean_no') + + test_name = 'test_fail_on_ep0' + test_runner.set_test('TestDecorators.py', 'TestDecorators', test_name) + read_resp = get_clusters([0, 1]) + ok = test_runner.run_test_with_mock_read(read_resp, hooks) + if ok: + failures.append(f"Did not get expected test assertion on {test_name}") + + test_name = 'test_fail_on_ep1' + test_runner.set_test('TestDecorators.py', 'TestDecorators', test_name) + read_resp = get_clusters([0, 1]) + ok = test_runner.run_test_with_mock_read(read_resp, hooks) + if ok: + failures.append(f"Did not get expected test assertion on {test_name}") + + test_name = 'test_fail_on_ep1' + test_runner.set_test('TestDecorators.py', 'TestDecorators', test_name) + read_resp = get_clusters([0]) + ok = test_runner.run_test_with_mock_read(read_resp, hooks) + if not ok: + failures.append(f"Unexpected failure on {test_name}") + + test_name = 'test_fail_on_whole_node' + test_runner.set_test('TestDecorators.py', 'TestDecorators', test_name) + read_resp = get_clusters([0, 1]) + ok = test_runner.run_test_with_mock_read(read_resp, hooks) + if ok: + failures.append(f"Did not get expected test assertion on {test_name}") + + test_runner.Shutdown() + print( + f"Test of Decorators: test response incorrect: {len(failures)}") + for f in failures: + print(f) + + return 1 if failures else 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/src/python_testing/test_testing/example_pics_xml_basic_info.xml b/src/python_testing/test_testing/example_pics_xml_basic_info.xml index 3a8e279f3aa345..3d488c3ae90ace 100644 --- a/src/python_testing/test_testing/example_pics_xml_basic_info.xml +++ b/src/python_testing/test_testing/example_pics_xml_basic_info.xml @@ -22,6 +22,14 @@ Draft O true + + + LVL.S + Does the device implement the Level Control Cluster as a server? + 9.1. Role - index.html[pdf] + O + true + @@ -182,7 +190,7 @@ Draft Does the DUT(server) support the CapabilityMinima attribute? 9.2.1. Attributes - index.html[pdf] M - true + false BINFO.S.A0014 diff --git a/src/python_testing/test_testing/test_IDM_10_4.py b/src/python_testing/test_testing/test_IDM_10_4.py new file mode 100644 index 00000000000000..8634e94129b86a --- /dev/null +++ b/src/python_testing/test_testing/test_IDM_10_4.py @@ -0,0 +1,134 @@ +#!/usr/bin/env -S python3 -B +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import sys + +import chip.clusters as Clusters +from chip.clusters import Attribute + +try: + from pics_support import parse_pics_xml +except ImportError: + sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from pics_support import parse_pics_xml + +from MockTestRunner import MockTestRunner + +# Reachable attribute is off in the pics file +# MaxPathsPerInvoke is not include in the pics file +# Vendor ID is included on ON in the PICS file + + +def create_read(include_reachable: bool = False, include_max_paths: bool = False, include_vendor_id: bool = True) -> Attribute.AsyncReadTransaction.ReadResponse: + # Attribute read here is set to match the example_pics_xml_basic_info.xml in this directory + bi = Clusters.BasicInformation.Attributes + lvl = Clusters.LevelControl.Attributes + attrs_bi = {bi.DataModelRevision: 1, + bi.VendorName: 'testVendor', + bi.ProductName: 'testProduct', + bi.ProductID: 0x8000, + bi.NodeLabel: 'label', + bi.Location: 'XX', + bi.HardwareVersion: 1, + bi.HardwareVersionString: 'one', + bi.SoftwareVersion: 2, + bi.SoftwareVersionString: 'two', + bi.ManufacturingDate: 'today', + bi.PartNumber: 'three', + bi.ProductURL: 'example.com', + bi.ProductLabel: 'myProduct', + bi.SerialNumber: 'ABCD1234', + bi.LocalConfigDisabled: False, + bi.UniqueID: 'Hashy-McHashface'} + if include_reachable: + attrs_bi[bi.Reachable] = True + if include_max_paths: + attrs_bi[bi.MaxPathsPerInvoke] = 2 + if include_vendor_id: + attrs_bi[bi.VendorID] = 0xFFF1 + + attrs_bi[bi.AttributeList] = [a.attribute_id for a in attrs_bi.keys()] + attrs_bi[bi.AcceptedCommandList] = [] + attrs_bi[bi.GeneratedCommandList] = [] + attrs_bi[bi.FeatureMap] = 0 + + attrs_lvl = {} + attrs_lvl[lvl.AttributeList] = [] + attrs_lvl[lvl.AcceptedCommandList] = [] + attrs_lvl[lvl.GeneratedCommandList] = [] + attrs_lvl[lvl.FeatureMap] = 0 + + resp = Attribute.AsyncReadTransaction.ReadResponse({}, [], {}) + resp.attributes = {0: {Clusters.BasicInformation: attrs_bi, Clusters.LevelControl: attrs_lvl}} + + tlv_attrs_bi = {a.attribute_id: value for a, value in attrs_bi.items()} + tlv_attrs_lvl = {a.attribute_id: value for a, value in attrs_lvl.items()} + resp.tlvAttributes = {0: {Clusters.BasicInformation.id: tlv_attrs_bi, Clusters.LevelControl.id: tlv_attrs_lvl}} + + return resp + + +def main(): + # TODO: add the same test for commands and features + script_dir = os.path.dirname(os.path.realpath(__file__)) + with open(f'{script_dir}/example_pics_xml_basic_info.xml') as f: + pics = parse_pics_xml(f.read()) + test_runner = MockTestRunner('TC_pics_checker.py', 'TC_PICS_Checker', 'test_TC_IDM_10_4', 0, pics) + failures = [] + + # Success, include vendor ID, which IS in the pics file, and neither of the incorrect ones + resp = create_read() + print(resp) + if not test_runner.run_test_with_mock_read(resp): + failures.append("Test case failure: Vendor ID included - expected pass") + + # Failure because Vendor ID is not included in the read, but included in the PICS + resp = create_read(include_vendor_id=False) + if test_runner.run_test_with_mock_read(resp): + failures.append("Test case failure: Vendor ID not included - expected failure") + + # Failure because Reachable is included in the read, but not in the PICS + resp = create_read(include_reachable=True) + if test_runner.run_test_with_mock_read(resp): + failures.append("Test case failure: Reachable included but not in PICS- expected failure") + + # Failure because MaxPathsPerInvoke is included in the read, but not in the PICS + resp = create_read(include_max_paths=True) + if test_runner.run_test_with_mock_read(resp): + failures.append("Test case failure: MaxPathsPerInvoke included but not in PICS- expected failure") + + pics['PICS_SDK_CI_ONLY'] = True + test_runner.config.pics = pics + # This is a success case for the attributes (as seen above), but the test should fail because the CI PICS is added + resp = create_read() + if test_runner.run_test_with_mock_read(resp): + failures.append("Test case failure: SDK CI PICS is included - expected failure") + + test_runner.Shutdown() + + print( + f"Test of tests: PICS - test response incorrect: {len(failures)}") + for f in failures: + print(f) + + return 1 if failures else 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/src/python_testing/test_testing/test_TC_CCNTL_2_2.py b/src/python_testing/test_testing/test_TC_CCNTL_2_2.py new file mode 100644 index 00000000000000..3fa2481e9fa4c3 --- /dev/null +++ b/src/python_testing/test_testing/test_TC_CCNTL_2_2.py @@ -0,0 +1,164 @@ +#!/usr/bin/env -S python3 -B +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import base64 +import os +import pathlib +import sys +import typing + +import chip.clusters as Clusters +from chip import ChipDeviceCtrl +from chip.clusters import Attribute +from chip.interaction_model import InteractionModelError, Status +from MockTestRunner import AsyncMock, MockTestRunner + +try: + from matter_testing_support import get_default_paa_trust_store, run_tests_no_exit +except ImportError: + sys.path.append(os.path.abspath( + os.path.join(os.path.dirname(__file__), '..'))) + from matter_testing_support import get_default_paa_trust_store, run_tests_no_exit + +invoke_call_count = 0 +event_call_count = 0 + + +def dynamic_invoke_return(*args, **argv): + global invoke_call_count + invoke_call_count += 1 + + # passcode 20202024 + reverse_open = Clusters.CommissionerControl.Commands.ReverseOpenCommissioningWindow(commissioningTimeout=30, + PAKEPasscodeVerifier=b"+w1qZQR05Zn0bc2LDyNaDAhsrhDS5iRHPTN10+EmNx8E2OpIPC4SjWRDQVOgqcbnXdYMlpiZ168xLBqn1fx9659gGK/7f9Yc6GxpoJH8kwAUYAYyLGsYeEBt1kL6kpXjgA==", + discriminator=2222, iterations=10000, salt=base64.b64encode(bytes('SaltyMcSalterson', 'utf-8'))) + + print(f'invoke call {invoke_call_count}') + if invoke_call_count == 1: # Commission node with no prior request, return failure - step 5 + raise InteractionModelError(status=Status.Failure) + elif invoke_call_count == 2: # Commission node over pase - return unsupported access - step 7 + raise InteractionModelError(status=Status.UnsupportedAccess) + elif invoke_call_count == 3: # request commissioning approval over pase - return unsupported access - step 8 + raise InteractionModelError(status=Status.UnsupportedAccess) + elif invoke_call_count == 4: # good RevokeCommissioning over CASE with bad vid - step 9 + return None + elif invoke_call_count == 5: # good RequestCommissioningApproval over CASE with bad vid - step 10 + return None + elif invoke_call_count == 6: # CommissionNode with bad request id - step 14 + raise InteractionModelError(status=Status.Failure) + elif invoke_call_count == 7: # CommissionNode with bad timeout (low) - step 15 + raise InteractionModelError(status=Status.Failure) + elif invoke_call_count == 8: # CommissionNode with bad timeout (high) - step 16 + raise InteractionModelError(status=Status.Failure) + elif invoke_call_count == 9: # CommissionNode - step 17 + # passcode 20202024 + return reverse_open + elif invoke_call_count == 10: # RequestCommissioningApproval with good vid - step 22 + return None + elif invoke_call_count == 11: # CommissionNode - step 25 + # passcode 20202024 + return reverse_open + else: + raise InteractionModelError(Status.Failure) + + +def dynamic_event_return(*args, **argv): + global event_call_count + event_call_count += 1 + + if event_call_count == 1: # reading events, start empty - no events + return [] + elif event_call_count == 2: # read event with filter - expect empty + return [] + elif event_call_count == 3: # returned event + header = Attribute.EventHeader(EndpointId=0, ClusterId=Clusters.CommissionerControl.id, + EventId=Clusters.CommissionerControl.Events.CommissioningRequestResult.event_id, EventNumber=1) + data = Clusters.CommissionerControl.Events.CommissioningRequestResult( + requestId=0x1234567887654321, clientNodeId=112233, statusCode=0) + result = Attribute.EventReadResult(Header=header, Status=Status.Success, Data=data) + return [result] + elif event_call_count == 4: # returned event with new request + header = Attribute.EventHeader(EndpointId=0, ClusterId=Clusters.CommissionerControl.id, + EventId=Clusters.CommissionerControl.Events.CommissioningRequestResult.event_id, EventNumber=1) + data = Clusters.CommissionerControl.Events.CommissioningRequestResult( + requestId=0x1234567812345678, clientNodeId=112233, statusCode=0) + result = Attribute.EventReadResult(Header=header, Status=Status.Success, Data=data) + return [result] + else: + raise InteractionModelError(Status.Failure) + + +def wildcard() -> Attribute.AsyncReadTransaction.ReadResponse: + cc = Clusters.CommissionerControl + ei = Clusters.EcosystemInformation + desc = Clusters.Descriptor + bdbi = Clusters.BridgedDeviceBasicInformation + + # EP1 is aggregator device type with a commissioner control cluster + # children - EP2 type bridged node endpoint, ecosystem information, bridged device basic information. Should also have and admin commissioning, but I don't need it for this test. + desc_ep1 = {desc.Attributes.PartsList: [2], desc.Attributes.ServerList: [ + cc.id], desc.Attributes.DeviceTypeList: [desc.Structs.DeviceTypeStruct(deviceType=0x000E, revision=2)]} + desc_ep2 = {desc.Attributes.ServerList: [bdbi.id, ei.id], desc.Attributes.DeviceTypeList: [ + desc.Structs.DeviceTypeStruct(deviceType=0x0013, revision=3)]} + + # I'm not filling anything in here, because I don't care. I just care that the cluster exists. + ei_attrs = {ei.Attributes.AttributeList: [ei.Attributes.DeviceDirectory.attribute_id, + ei.Attributes.LocationDirectory.attribute_id], ei.Attributes.DeviceDirectory: [], ei.Attributes.LocationDirectory: []} + + # This cluster just needs to exist, so I'm just going to throw on the mandatory items for now. + bdbi_attrs = {bdbi.Attributes.AttributeList: [bdbi.Attributes.Reachable.attribute_id, + bdbi.Attributes.UniqueID.attribute_id], bdbi.Attributes.Reachable: True, bdbi.Attributes.UniqueID: 'something'} + + cc_attrs = {cc.Attributes.AttributeList: [cc.Attributes.SupportedDeviceCategories], cc.Attributes.AcceptedCommandList: [cc.Commands.RequestCommissioningApproval, cc.Commands.CommissionNode], + cc.Attributes.GeneratedCommandList: [cc.Commands.RequestCommissioningApproval], cc.Attributes.SupportedDeviceCategories: 1} + + resp = Attribute.AsyncReadTransaction.ReadResponse({}, [], {}) + resp.attributes = {1: {desc: desc_ep1, cc: cc_attrs}, 2: {desc: desc_ep2, ei: ei_attrs, bdbi: bdbi_attrs}} + return resp + + +class MyMock(MockTestRunner): + # TODO consolidate with above + def run_test_with_mock(self, dynamic_invoke_return: typing.Callable, dynamic_event_return: typing.Callable, read_cache: Attribute.AsyncReadTransaction.ReadResponse, hooks=None): + ''' Effects is a list of callable functions with *args, **kwargs parameters. It can either throw an InteractionModelException or return the command response.''' + self.default_controller.Read = AsyncMock(return_value=read_cache) + self.default_controller.SendCommand = AsyncMock(return_value=None, side_effect=dynamic_invoke_return) + # It doesn't actually matter what we return here because I'm going to catch the next pase session connection anyway + params = ChipDeviceCtrl.CommissioningParameters(setupPinCode=0, setupManualCode='', setupQRCode='') + self.default_controller.OpenCommissioningWindow = AsyncMock(return_value=params) + self.default_controller.FindOrEstablishPASESession = AsyncMock(return_value=None) + self.default_controller.ReadEvent = AsyncMock(return_value=[], side_effect=dynamic_event_return) + + return run_tests_no_exit(self.test_class, self.config, hooks, self.default_controller, self.stack) + + +def main(): + root = os.path.abspath(os.path.join(pathlib.Path(__file__).resolve().parent, '..', '..', '..')) + print(f'root = {root}') + paa_path = get_default_paa_trust_store(root) + print(f'paa = {paa_path}') + + pics = {"PICS_SDK_CI_ONLY": True} + test_runner = MyMock('TC_CCTRL_2_2', 'TC_CCTRL_2_2', 'test_TC_CCTRL_2_2', 1, paa_trust_store_path=paa_path, pics=pics) + + test_runner.run_test_with_mock(dynamic_invoke_return, dynamic_event_return, wildcard()) + test_runner.Shutdown() + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/src/python_testing/test_testing/test_TC_SC_7_1.py b/src/python_testing/test_testing/test_TC_SC_7_1.py new file mode 100644 index 00000000000000..3b1b6a5b1cd269 --- /dev/null +++ b/src/python_testing/test_testing/test_TC_SC_7_1.py @@ -0,0 +1,174 @@ +#!/usr/bin/env -S python3 -B +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import sys +from random import randbytes + +import chip.clusters as Clusters +from chip.clusters import Attribute +from MockTestRunner import MockTestRunner + +try: + from matter_testing_support import MatterTestConfig +except ImportError: + sys.path.append(os.path.abspath( + os.path.join(os.path.dirname(__file__), '..'))) + from matter_testing_support import MatterTestConfig + + +def read_trusted_root(filled: bool) -> Attribute.AsyncReadTransaction.ReadResponse: + opcreds = Clusters.OperationalCredentials + trusted_roots = [randbytes(400)] if filled else [] + resp = Attribute.AsyncReadTransaction.ReadResponse({}, [], {}) + resp.attributes = {0: {opcreds: {opcreds.Attributes.TrustedRootCertificates: trusted_roots}}} + return resp + + +def main(): + # All QR and manual codes use vendor ID 0xFFF1, product ID 0x8000. + qr_2222_20202021 = 'MT:Y.K908OC16750648G00' + qr_3333_20202021 = 'MT:Y.K900C415W80648G00' + qr_2222_20202024 = 'MT:Y.K908OC16N71648G00' + qr_3840_20202021 = 'MT:Y.K90-Q000KA0648G00' + manual_2222_20202021 = '20054912334' + manual_3333_20202021 = '31693312339' + manual_2222_20202024 = '20055212333' + + test_runner = MockTestRunner('TC_SC_7_1', 'TC_SC_7_1', 'test_TC_SC_7_1', 0) + failures = [] + + # Tests with no code specified should fail + test_config = MatterTestConfig() + test_runner.set_test_config(test_config) + ok = test_runner.run_test_with_mock_read(read_trusted_root(False)) + if ok: + failures.append('Expected assertion on test with no codes') + + # Tests using discriminators should fail because we need QR or manual codes, no matter the number + test_config = MatterTestConfig(discriminators=[2222], setup_passcodes=[20202021]) + test_runner.set_test_config(test_config) + ok = test_runner.run_test_with_mock_read(read_trusted_root(False)) + if ok: + failures.append('Expected assertion on test with 1 discriminator') + + test_config = MatterTestConfig(discriminators=[2222, 3333], setup_passcodes=[20202021, 20202021]) + test_runner.set_test_config(test_config) + ok = test_runner.run_test_with_mock_read(read_trusted_root(False)) + if ok: + failures.append('Expected assertion on test with 2 discriminators') + + # Single qr code or manual without post-cert should cause a failure + test_config = MatterTestConfig(qr_code_content=[qr_2222_20202021]) + test_runner.set_test_config(test_config) + ok = test_runner.run_test_with_mock_read(read_trusted_root(False)) + if ok: + failures.append('Expected assertion on test with 1 QR code') + + test_config = MatterTestConfig(manual_code=[manual_2222_20202021]) + test_runner.set_test_config(test_config) + ok = test_runner.run_test_with_mock_read(read_trusted_root(False)) + if ok: + failures.append('Expected assertion on test with 1 manual code') + + # Two QR or manual codes with post cert marked should fail + test_config = MatterTestConfig(qr_code_content=[qr_2222_20202021, qr_3333_20202021], + global_test_params={'post_cert_test': True}) + test_runner.set_test_config(test_config) + ok = test_runner.run_test_with_mock_read(read_trusted_root(False)) + if ok: + failures.append('Expected assertion on post-cert test with 2 QR codes') + + test_config = MatterTestConfig(manual_code=[manual_2222_20202021, manual_3333_20202021], + global_test_params={'post_cert_test': True}) + test_runner.set_test_config(test_config) + ok = test_runner.run_test_with_mock_read(read_trusted_root(False)) + if ok: + failures.append('Expected assertion on post-cert test with 2 manual codes') + + # Incorrectly formatted codes should fail + test_config = MatterTestConfig(manual_code=[qr_2222_20202021, qr_2222_20202024]) + test_runner.set_test_config(test_config) + ok = test_runner.run_test_with_mock_read(read_trusted_root(False)) + if ok: + failures.append('Expected assertion on test with incorrectly formatted manual codes') + + test_config = MatterTestConfig(qr_code_content=[manual_2222_20202021, manual_2222_20202024]) + test_runner.set_test_config(test_config) + ok = test_runner.run_test_with_mock_read(read_trusted_root(False)) + if ok: + failures.append('Expected assertion on test with incorrectly formatted QR codes') + + # Two codes with the same discriminator should fail + test_config = MatterTestConfig(qr_code_content=[qr_2222_20202021, qr_2222_20202024]) + test_runner.set_test_config(test_config) + ok = test_runner.run_test_with_mock_read(read_trusted_root(False)) + if ok: + failures.append('Expected assertion on test with 2 QR codes with the same discriminator') + + test_config = MatterTestConfig(manual_code=[manual_2222_20202021, manual_2222_20202024]) + test_runner.set_test_config(test_config) + ok = test_runner.run_test_with_mock_read(read_trusted_root(False)) + if ok: + failures.append('Expected assertion on test with 2 manual codes with the same discriminator') + + # Post cert test should fail on default discriminator + test_config = MatterTestConfig(qr_code_content=[qr_3840_20202021], global_test_params={'post_cert_test': True}) + test_runner.set_test_config(test_config) + ok = test_runner.run_test_with_mock_read(read_trusted_root(False)) + if ok: + failures.append('Expected assertion on post-cert test with default code') + + # Test should fail if there is fabric info + test_config = MatterTestConfig(qr_code_content=[qr_2222_20202021, qr_3333_20202021]) + test_runner.set_test_config(test_config) + ok = test_runner.run_test_with_mock_read(read_trusted_root(True)) + if ok: + failures.append('Expected assertion on test when fabrics are present') + + # Test should pass on codes with two different discriminators + test_config = MatterTestConfig(qr_code_content=[qr_2222_20202021, qr_3333_20202021]) + test_runner.set_test_config(test_config) + ok = test_runner.run_test_with_mock_read(read_trusted_root(False)) + if not ok: + failures.append('Expected pass on QR code test') + + test_config = MatterTestConfig(manual_code=[manual_2222_20202021, manual_3333_20202021]) + test_runner.set_test_config(test_config) + ok = test_runner.run_test_with_mock_read(read_trusted_root(False)) + if not ok: + failures.append('Expected pass on manual code test') + + # Test should pass on post-cert test + test_config = MatterTestConfig(qr_code_content=[qr_2222_20202021], global_test_params={'post_cert_test': True}) + test_runner.set_test_config(test_config) + ok = test_runner.run_test_with_mock_read(read_trusted_root(False)) + if not ok: + failures.append('Expected pass on post-cert test') + + test_runner.Shutdown() + print( + f"Test of TC-SC-7.1: test response incorrect: {len(failures)}") + for f in failures: + print(f) + + return 1 if failures else 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/src/setup_payload/SetupPayload.cpp b/src/setup_payload/SetupPayload.cpp index 1ef4795d571e4d..9683da21f8a7f9 100644 --- a/src/setup_payload/SetupPayload.cpp +++ b/src/setup_payload/SetupPayload.cpp @@ -62,7 +62,7 @@ bool PayloadContents::isValidQRCodePayload(ValidationMode mode) const if (mode == ValidationMode::kProduce) { chip::RendezvousInformationFlags valid(RendezvousInformationFlag::kBLE, RendezvousInformationFlag::kOnNetwork, - RendezvousInformationFlag::kSoftAP); + RendezvousInformationFlag::kSoftAP, RendezvousInformationFlag::kWiFiPAF); VerifyOrReturnValue(rendezvousInformation.Value().HasOnly(valid), false); } diff --git a/src/setup_payload/SetupPayload.h b/src/setup_payload/SetupPayload.h index dc67206dd51867..3d5d101fbf4c6e 100644 --- a/src/setup_payload/SetupPayload.h +++ b/src/setup_payload/SetupPayload.h @@ -101,6 +101,7 @@ enum class RendezvousInformationFlag : uint8_t kSoftAP = 1 << 0, ///< Device supports Wi-Fi softAP kBLE = 1 << 1, ///< Device supports BLE kOnNetwork = 1 << 2, ///< Device supports Setup on network + kWiFiPAF = 1 << 3, ///< Device supports Wi-Fi Public Action Frame for discovery }; using RendezvousInformationFlags = chip::BitFlags; diff --git a/src/setup_payload/tests/TestAdditionalDataPayload.cpp b/src/setup_payload/tests/TestAdditionalDataPayload.cpp index d59eac34a0b20b..c0671994ff96b4 100644 --- a/src/setup_payload/tests/TestAdditionalDataPayload.cpp +++ b/src/setup_payload/tests/TestAdditionalDataPayload.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include diff --git a/src/setup_payload/tests/TestQRCode.cpp b/src/setup_payload/tests/TestQRCode.cpp index 44c50d9e1e8f5b..e5d68227c2956e 100644 --- a/src/setup_payload/tests/TestQRCode.cpp +++ b/src/setup_payload/tests/TestQRCode.cpp @@ -53,6 +53,9 @@ TEST(TestQRCode, TestRendezvousFlags) inPayload.rendezvousInformation.SetValue(RendezvousInformationFlag::kOnNetwork); EXPECT_TRUE(CheckWriteRead(inPayload)); + inPayload.rendezvousInformation.SetValue(RendezvousInformationFlag::kWiFiPAF); + EXPECT_TRUE(CheckWriteRead(inPayload)); + inPayload.rendezvousInformation.SetValue( RendezvousInformationFlags(RendezvousInformationFlag::kSoftAP, RendezvousInformationFlag::kOnNetwork)); EXPECT_TRUE(CheckWriteRead(inPayload)); @@ -61,9 +64,26 @@ TEST(TestQRCode, TestRendezvousFlags) RendezvousInformationFlags(RendezvousInformationFlag::kBLE, RendezvousInformationFlag::kOnNetwork)); EXPECT_TRUE(CheckWriteRead(inPayload)); + inPayload.rendezvousInformation.SetValue( + RendezvousInformationFlags(RendezvousInformationFlag::kWiFiPAF, RendezvousInformationFlag::kOnNetwork)); + EXPECT_TRUE(CheckWriteRead(inPayload)); + inPayload.rendezvousInformation.SetValue(RendezvousInformationFlags( RendezvousInformationFlag::kBLE, RendezvousInformationFlag::kSoftAP, RendezvousInformationFlag::kOnNetwork)); EXPECT_TRUE(CheckWriteRead(inPayload)); + + inPayload.rendezvousInformation.SetValue(RendezvousInformationFlags( + RendezvousInformationFlag::kWiFiPAF, RendezvousInformationFlag::kSoftAP, RendezvousInformationFlag::kOnNetwork)); + EXPECT_TRUE(CheckWriteRead(inPayload)); + + inPayload.rendezvousInformation.SetValue(RendezvousInformationFlags( + RendezvousInformationFlag::kWiFiPAF, RendezvousInformationFlag::kBLE, RendezvousInformationFlag::kOnNetwork)); + EXPECT_TRUE(CheckWriteRead(inPayload)); + + inPayload.rendezvousInformation.SetValue( + RendezvousInformationFlags(RendezvousInformationFlag::kWiFiPAF, RendezvousInformationFlag::kBLE, + RendezvousInformationFlag::kSoftAP, RendezvousInformationFlag::kOnNetwork)); + EXPECT_TRUE(CheckWriteRead(inPayload)); } TEST(TestQRCode, TestCommissioningFlow) @@ -88,8 +108,9 @@ TEST(TestQRCode, TestMaximumValues) inPayload.vendorID = 0xFFFF; inPayload.productID = 0xFFFF; inPayload.commissioningFlow = CommissioningFlow::kCustom; - inPayload.rendezvousInformation.SetValue(RendezvousInformationFlags( - RendezvousInformationFlag::kBLE, RendezvousInformationFlag::kSoftAP, RendezvousInformationFlag::kOnNetwork)); + inPayload.rendezvousInformation.SetValue( + RendezvousInformationFlags(RendezvousInformationFlag::kWiFiPAF, RendezvousInformationFlag::kBLE, + RendezvousInformationFlag::kSoftAP, RendezvousInformationFlag::kOnNetwork)); inPayload.discriminator.SetLongValue(static_cast((1 << kPayloadDiscriminatorFieldLengthInBits) - 1)); inPayload.setUpPINCode = static_cast((1 << kSetupPINCodeFieldLengthInBits) - 1); @@ -303,9 +324,10 @@ TEST(TestQRCode, TestSetupPayloadVerify) EXPECT_EQ(test_payload.isValidQRCodePayload(), false); // test invalid rendezvousInformation - test_payload = payload; - RendezvousInformationFlags invalid = RendezvousInformationFlags( - RendezvousInformationFlag::kBLE, RendezvousInformationFlag::kSoftAP, RendezvousInformationFlag::kOnNetwork); + test_payload = payload; + RendezvousInformationFlags invalid = + RendezvousInformationFlags(RendezvousInformationFlag::kBLE, RendezvousInformationFlag::kSoftAP, + RendezvousInformationFlag::kOnNetwork, RendezvousInformationFlag::kWiFiPAF); invalid.SetRaw(static_cast(invalid.Raw() + 1)); test_payload.rendezvousInformation.SetValue(invalid); EXPECT_EQ(test_payload.isValidQRCodePayload(), false); diff --git a/src/test_driver/linux-cirque/IcdWaitForActiveTest.py b/src/test_driver/linux-cirque/IcdWaitForActiveTest.py new file mode 100755 index 00000000000000..bb2c1cb8384a3c --- /dev/null +++ b/src/test_driver/linux-cirque/IcdWaitForActiveTest.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python3 +""" +Copyright (c) 2021 Project CHIP Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +import logging +import os +import sys + +from helper.CHIPTestBase import CHIPVirtualHome + +logger = logging.getLogger('MobileDeviceTest') +logger.setLevel(logging.INFO) + +sh = logging.StreamHandler() +sh.setFormatter( + logging.Formatter( + '%(asctime)s [%(name)s] %(levelname)s %(message)s')) +logger.addHandler(sh) + +CHIP_PORT = 5540 + +CIRQUE_URL = "http://localhost:5000" +CHIP_REPO = os.path.join(os.path.abspath( + os.path.dirname(__file__)), "..", "..", "..") +TEST_EXTPANID = "fedcba9876543210" +TEST_DISCRIMINATOR = 3840 +TEST_DISCRIMINATOR2 = 3584 +TEST_DISCRIMINATOR3 = 1203 +TEST_DISCRIMINATOR4 = 2145 +TEST_DISCOVERY_TYPE = [0, 1, 2] +MATTER_DEVELOPMENT_PAA_ROOT_CERTS = "credentials/development/paa-root-certs" + +DEVICE_CONFIG = { + 'device0': { + 'type': 'MobileDevice', + 'base_image': '@default', + 'capability': ['TrafficControl', 'Mount'], + 'rcp_mode': True, + 'docker_network': 'Ipv6', + 'traffic_control': {'latencyMs': 25}, + "mount_pairs": [[CHIP_REPO, CHIP_REPO]], + }, + 'device1': { + 'type': 'CHIPEndDevice', + 'base_image': '@default', + 'capability': ['Thread', 'TrafficControl', 'Mount'], + 'rcp_mode': True, + 'docker_network': 'Ipv6', + 'traffic_control': {'latencyMs': 25}, + "mount_pairs": [[CHIP_REPO, CHIP_REPO]], + } +} + + +class TestCommissioner(CHIPVirtualHome): + def __init__(self, device_config): + super().__init__(CIRQUE_URL, device_config) + self.logger = logger + + def setup(self): + self.initialize_home() + + def test_routine(self): + self.run_controller_test() + + def run_controller_test(self): + ethernet_ip = [device['description']['ipv6_addr'] for device in self.non_ap_devices + if device['type'] == 'CHIPEndDevice'][0] + server_ids = [device['id'] for device in self.non_ap_devices + if device['type'] == 'CHIPEndDevice'] + req_ids = [device['id'] for device in self.non_ap_devices + if device['type'] == 'MobileDevice'] + + for server in server_ids: + 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)) + + self.reset_thread_devices(server_ids) + + req_device_id = req_ids[0] + + self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join( + CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_clusters-0.0-py3-none-any.whl"))) + self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join( + CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip_core-0.0-cp37-abi3-linux_x86_64.whl"))) + self.execute_device_cmd(req_device_id, "pip3 install --break-system-packages {}".format(os.path.join( + 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( + 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)) + ret = self.execute_device_cmd(req_device_id, command) + + self.assertEqual(ret['return_code'], '0', + "Test failed: non-zero return code") + + +if __name__ == "__main__": + sys.exit(TestCommissioner(DEVICE_CONFIG).run_test()) diff --git a/src/test_driver/nrfconnect/sysbuild.conf b/src/test_driver/nrfconnect/sysbuild.conf new file mode 100644 index 00000000000000..d0c5eee2b93c39 --- /dev/null +++ b/src/test_driver/nrfconnect/sysbuild.conf @@ -0,0 +1,17 @@ +# +# 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. +# + +SB_CONFIG_MATTER=y diff --git a/src/test_driver/openiotsdk/unit-tests/test_components.txt b/src/test_driver/openiotsdk/unit-tests/test_components.txt index 54f47dfa47c557..10729a9f5deb2e 100644 --- a/src/test_driver/openiotsdk/unit-tests/test_components.txt +++ b/src/test_driver/openiotsdk/unit-tests/test_components.txt @@ -18,7 +18,8 @@ SupportTests UserDirectedCommissioningTests SecureChannelTests ICDServerTests -DataModelTests +ControllerDataModelTests +AppDataModelTests InetLayerTests AppTests MessagingLayerTests diff --git a/src/tracing/json/json_tracing.cpp b/src/tracing/json/json_tracing.cpp index 91b4474388ecd0..4531740b81a193 100644 --- a/src/tracing/json/json_tracing.cpp +++ b/src/tracing/json/json_tracing.cpp @@ -418,8 +418,9 @@ void JsonBackend::LogNodeDiscovered(NodeDiscoveredInfo & info) info.result->address.ToString(address_buff); - result["supports_tcp"] = info.result->supportsTcp; - result["address"] = address_buff; + result["supports_tcp_client"] = info.result->supportsTcpClient; + result["supports_tcp_server"] = info.result->supportsTcpServer; + result["address"] = address_buff; result["mrp"]["idle_retransmit_timeout_ms"] = info.result->mrpRemoteConfig.mIdleRetransTimeout.count(); result["mrp"]["active_retransmit_timeout_ms"] = info.result->mrpRemoteConfig.mActiveRetransTimeout.count(); diff --git a/src/tracing/tests/BUILD.gn b/src/tracing/tests/BUILD.gn index fcb9bc2810544d..6fb830d6e75e35 100644 --- a/src/tracing/tests/BUILD.gn +++ b/src/tracing/tests/BUILD.gn @@ -14,6 +14,7 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") +import("//build_overrides/pigweed.gni") import("${chip_root}/build/chip/chip_test_suite.gni") import("${chip_root}/src/tracing/tracing_args.gni") @@ -29,6 +30,7 @@ if (matter_enable_tracing_support && ] public_deps = [ + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/platform", "${chip_root}/src/tracing", "${chip_root}/src/tracing:macros", diff --git a/src/tracing/tests/TestMetricEvents.cpp b/src/tracing/tests/TestMetricEvents.cpp index a0190265d57e0b..20c6f7788ad69e 100644 --- a/src/tracing/tests/TestMetricEvents.cpp +++ b/src/tracing/tests/TestMetricEvents.cpp @@ -13,7 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include + +#include + +#include #include #include diff --git a/src/tracing/tests/TestTracing.cpp b/src/tracing/tests/TestTracing.cpp index 254c6de5c78cb7..b3e4e87562397a 100644 --- a/src/tracing/tests/TestTracing.cpp +++ b/src/tracing/tests/TestTracing.cpp @@ -13,7 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include + +#include + +#include #include #include #include diff --git a/src/transport/SessionManager.cpp b/src/transport/SessionManager.cpp index ffb3633b289e21..17065e319cf3bd 100644 --- a/src/transport/SessionManager.cpp +++ b/src/transport/SessionManager.cpp @@ -339,6 +339,8 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P return CHIP_ERROR_INTERNAL; } + ReturnErrorOnFailure(packetHeader.EncodeBeforeData(message)); + #if CHIP_PROGRESS_LOGGING CompressedFabricId compressedFabricId = kUndefinedCompressedFabricId; @@ -372,19 +374,26 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P char typeStr[4 + 1 + 2 + 1]; snprintf(typeStr, sizeof(typeStr), "%04X:%02X", payloadHeader.GetProtocolID().GetProtocolId(), payloadHeader.GetMessageType()); + // More work around pigweed not allowing more than 14 format args in a log + // message when using tokenized logs. + // ChipLogFormatExchangeId logs the numeric exchange ID (at most 5 chars, + // since it's a uint16_t) and one char for initiator/responder. Plus we + // need a null-terminator. + char exchangeStr[5 + 1 + 1]; + snprintf(exchangeStr, sizeof(exchangeStr), ChipLogFormatExchangeId, ChipLogValueExchangeIdFromSentHeader(payloadHeader)); + // // Legend that can be used to decode this log line can be found in messaging/README.md // ChipLogProgress(ExchangeManager, - "<<< [E:" ChipLogFormatExchangeId " S:%u M:" ChipLogFormatMessageCounter - "%s] (%s) Msg TX to %u:" ChipLogFormatX64 " [%04X] [%s] --- Type %s (%s:%s)", - ChipLogValueExchangeIdFromSentHeader(payloadHeader), sessionHandle->SessionIdForLogging(), - packetHeader.GetMessageCounter(), ackBuf, Transport::GetSessionTypeString(sessionHandle), fabricIndex, - ChipLogValueX64(destination), static_cast(compressedFabricId), addressStr, typeStr, protocolName, - msgTypeName); + "<<< [E:%s S:%u M:" ChipLogFormatMessageCounter "%s] (%s) Msg TX to %u:" ChipLogFormatX64 + " [%04X] [%s] --- Type %s (%s:%s) (B:%u)", + exchangeStr, sessionHandle->SessionIdForLogging(), packetHeader.GetMessageCounter(), ackBuf, + Transport::GetSessionTypeString(sessionHandle), fabricIndex, ChipLogValueX64(destination), + static_cast(compressedFabricId), addressStr, typeStr, protocolName, msgTypeName, + static_cast(message->TotalLength())); #endif - ReturnErrorOnFailure(packetHeader.EncodeBeforeData(message)); preparedMessage = EncryptedPacketBufferHandle::MarkEncrypted(std::move(message)); return CHIP_NO_ERROR; @@ -705,27 +714,7 @@ void SessionManager::HandleConnectionClosed(Transport::ActiveTCPConnectionState { VerifyOrReturn(conn != nullptr); - // Mark the corresponding secure sessions as defunct - mSecureSessions.ForEachSession([&](auto session) { - if (session->IsActiveSession() && session->GetTCPConnection() == conn) - { - SessionHandle handle(*session); - // Notify the SessionConnection delegate of the connection - // closure. - if (mConnDelegate != nullptr) - { - mConnDelegate->OnTCPConnectionClosed(handle, conErr); - } - - // Dis-associate the connection from session by setting it to a - // nullptr. - session->SetTCPConnection(nullptr); - // Mark session as defunct - session->MarkAsDefunct(); - } - - return Loop::Continue; - }); + MarkSecureSessionOverTCPForEviction(conn, conErr); // TODO: A mechanism to mark an unauthenticated session as unusable when // the underlying connection is broken. Issue #32323 @@ -776,6 +765,8 @@ void SessionManager::TCPDisconnect(Transport::ActiveTCPConnectionState * conn, b conn->mPeerAddr.ToString(peerAddrBuf); ChipLogProgress(Inet, "Disconnecting TCP connection from peer at %s.", peerAddrBuf); mTransportMgr->TCPDisconnect(conn, shouldAbort); + + MarkSecureSessionOverTCPForEviction(conn, CHIP_NO_ERROR); } } #endif // INET_CONFIG_ENABLE_TCP_ENDPOINT @@ -1327,6 +1318,33 @@ Optional SessionManager::FindSecureSessionForNode(ScopedNodeId pe return mrpSession != nullptr ? MakeOptional(*mrpSession) : Optional::Missing(); } +#if INET_CONFIG_ENABLE_TCP_ENDPOINT +void SessionManager::MarkSecureSessionOverTCPForEviction(Transport::ActiveTCPConnectionState * conn, CHIP_ERROR conErr) +{ + // Mark the corresponding secure sessions for eviction + mSecureSessions.ForEachSession([&](auto session) { + if (session->IsActiveSession() && session->GetTCPConnection() == conn) + { + SessionHandle handle(*session); + // Notify the SessionConnection delegate of the connection + // closure. + if (mConnDelegate != nullptr) + { + mConnDelegate->OnTCPConnectionClosed(handle, conErr); + } + + // Dis-associate the connection from session by setting it to a + // nullptr. + session->SetTCPConnection(nullptr); + // Mark session for eviction. + session->MarkForEviction(); + } + + return Loop::Continue; + }); +} +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT + /** * Provides a means to get diagnostic information such as number of sessions. */ diff --git a/src/transport/SessionManager.h b/src/transport/SessionManager.h index 7d0c5645365f97..67871d4ee83b2a 100644 --- a/src/transport/SessionManager.h +++ b/src/transport/SessionManager.h @@ -616,6 +616,10 @@ class DLL_EXPORT SessionManager : public TransportMgrDelegate, public FabricTabl void OnReceiveError(CHIP_ERROR error, const Transport::PeerAddress & source); +#if INET_CONFIG_ENABLE_TCP_ENDPOINT + void MarkSecureSessionOverTCPForEviction(Transport::ActiveTCPConnectionState * conn, CHIP_ERROR conErr); +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT + static bool IsControlMessage(PayloadHeader & payloadHeader) { return payloadHeader.HasMessageType(Protocols::SecureChannel::MsgType::MsgCounterSyncReq) || diff --git a/src/transport/raw/BUILD.gn b/src/transport/raw/BUILD.gn index 3e8d3d4761dca3..f5593c012769e7 100644 --- a/src/transport/raw/BUILD.gn +++ b/src/transport/raw/BUILD.gn @@ -15,6 +15,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/src/ble/ble.gni") import("${chip_root}/src/inet/inet.gni") +import("${chip_root}/src/platform/device.gni") static_library("raw") { output_name = "libRawTransport" @@ -44,6 +45,12 @@ static_library("raw") { "BLE.h", ] } + if (chip_device_config_enable_wifipaf) { + sources += [ + "WiFiPAF.cpp", + "WiFiPAF.h", + ] + } cflags = [ "-Wconversion" ] diff --git a/src/transport/raw/PeerAddress.h b/src/transport/raw/PeerAddress.h index 64588bc64c062f..896648f76f537a 100644 --- a/src/transport/raw/PeerAddress.h +++ b/src/transport/raw/PeerAddress.h @@ -53,6 +53,7 @@ enum class Type : uint8_t kUdp, kBle, kTcp, + kWiFiPAF, }; /** @@ -64,6 +65,7 @@ class PeerAddress PeerAddress() : mIPAddress(Inet::IPAddress::Any), mTransportType(Type::kUndefined) {} PeerAddress(const Inet::IPAddress & addr, Type type) : mIPAddress(addr), mTransportType(type) {} PeerAddress(Type type) : mTransportType(type) {} + PeerAddress(Type type, NodeId remoteId) : mTransportType(type), mRemoteId(remoteId) {} PeerAddress(PeerAddress &&) = default; PeerAddress(const PeerAddress &) = default; @@ -77,6 +79,8 @@ class PeerAddress return *this; } + NodeId GetRemoteId() const { return mRemoteId; } + Type GetTransportType() const { return mTransportType; } PeerAddress & SetTransportType(Type type) { @@ -167,6 +171,9 @@ class PeerAddress #endif snprintf(buf, bufSize, "TCP:[%s%s]:%d", ip_addr, interface, mPort); break; + case Type::kWiFiPAF: + snprintf(buf, bufSize, "Wi-Fi PAF"); + break; case Type::kBle: // Note that BLE does not currently use any specific address. snprintf(buf, bufSize, "BLE"); @@ -209,6 +216,8 @@ class PeerAddress return TCP(addr).SetPort(port).SetInterface(interface); } + static PeerAddress WiFiPAF(NodeId remoteId) { return PeerAddress(Type::kWiFiPAF); } + static PeerAddress Multicast(chip::FabricId fabric, chip::GroupId group) { constexpr uint8_t scope = 0x05; // Site-Local @@ -237,6 +246,7 @@ class PeerAddress Type mTransportType = Type::kUndefined; uint16_t mPort = CHIP_PORT; ///< Relevant for UDP data sending. Inet::InterfaceId mInterface = Inet::InterfaceId::Null(); + NodeId mRemoteId = 0; }; } // namespace Transport diff --git a/src/transport/raw/TCP.cpp b/src/transport/raw/TCP.cpp index 3c3e6da15c2b58..b73540d7956f29 100644 --- a/src/transport/raw/TCP.cpp +++ b/src/transport/raw/TCP.cpp @@ -398,6 +398,10 @@ void TCPBase::CloseConnectionInternal(ActiveTCPConnectionState * connection, CHI if (connection->mConnectionState != TCPState::kClosed && connection->mEndPoint) { + char addrStr[Transport::PeerAddress::kMaxToStringSize]; + connection->mPeerAddr.ToString(addrStr); + ChipLogProgress(Inet, "Closing connection with peer %s.", addrStr); + if (err == CHIP_NO_ERROR) { connection->mEndPoint->Close(); @@ -574,6 +578,9 @@ void TCPBase::HandleIncomingConnection(Inet::TCPEndPoint * listenEndPoint, Inet: tcp->mUsedEndPointCount++; activeConnection->mConnectionState = TCPState::kConnected; + // Set the TCPKeepalive configurations on the received connection + endPoint->EnableKeepAlive(activeConnection->mTCPKeepAliveIntervalSecs, activeConnection->mTCPMaxNumKeepAliveProbes); + char addrStr[Transport::PeerAddress::kMaxToStringSize]; peerAddress.ToString(addrStr); ChipLogProgress(Inet, "Incoming connection established with peer at %s.", addrStr); @@ -616,36 +623,20 @@ CHIP_ERROR TCPBase::TCPConnect(const PeerAddress & address, Transport::AppTCPCon void TCPBase::TCPDisconnect(const PeerAddress & address) { - CHIP_ERROR err = CHIP_NO_ERROR; // Closes an existing connection for (size_t i = 0; i < mActiveConnectionsSize; i++) { if (mActiveConnections[i].IsConnected()) { - Inet::IPAddress ipAddress; - uint16_t port; - Inet::InterfaceId interfaceId; - - err = mActiveConnections[i].mEndPoint->GetPeerInfo(&ipAddress, &port); - if (err != CHIP_NO_ERROR) + const Inet::IPAddress & ipAddress = mActiveConnections[i].mPeerAddr.GetIPAddress(); + uint16_t port = mActiveConnections[i].mPeerAddr.GetPort(); + + // Ignoring the InterfaceID in the check as it may not have been provided in + // the PeerAddress during connection establishment. The IPAddress and Port + // are the necessary and sufficient set of parameters for searching + // through the connections. + if (ipAddress == address.GetIPAddress() && port == address.GetPort() && address.GetTransportType() == Type::kTcp) { - ChipLogError(Inet, "TCPDisconnect: GetPeerInfo error: %" CHIP_ERROR_FORMAT, err.Format()); - return; - } - - err = mActiveConnections[i].mEndPoint->GetInterfaceId(&interfaceId); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Inet, "TCPDisconnect: GetInterfaceId error: %" CHIP_ERROR_FORMAT, err.Format()); - return; - } - // if (address == PeerAddress::TCP(ipAddress, port, interfaceId)) - if (ipAddress == address.GetIPAddress() && port == address.GetPort()) - { - char addrStr[Transport::PeerAddress::kMaxToStringSize]; - address.ToString(addrStr); - ChipLogProgress(Inet, "Disconnecting with peer %s.", addrStr); - // NOTE: this leaves the socket in TIME_WAIT. // Calling Abort() would clean it since SO_LINGER would be set to 0, // however this seems not to be useful. diff --git a/src/transport/raw/WiFiPAF.cpp b/src/transport/raw/WiFiPAF.cpp new file mode 100644 index 00000000000000..97b465dd261e9b --- /dev/null +++ b/src/transport/raw/WiFiPAF.cpp @@ -0,0 +1,113 @@ +/* + * + * 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. + */ + +/** + * @file + * This file implements the Matter Connection object that maintains a Wi-Fi PAF connection + * + */ + +#include +#include +#include +#include +#include +#include + +using namespace chip::System; + +namespace chip { +namespace Transport { + +WiFiPAFBase::~WiFiPAFBase() +{ + ClearState(); +} + +void WiFiPAFBase::ClearState() +{ + mState = State::kNotReady; +} + +CHIP_ERROR WiFiPAFBase::Init(const WiFiPAFListenParameters & param) +{ + ChipLogDetail(Inet, "WiFiPAFBase::Init - setting/overriding transport"); + VerifyOrReturnError(mState == State::kNotReady, CHIP_ERROR_INCORRECT_STATE); + DeviceLayer::ConnectivityMgr().SetWiFiPAF(this); + mState = State::kInitialized; + + if (!DeviceLayer::ConnectivityMgrImpl().IsWiFiManagementStarted()) + { + ChipLogError(Inet, "Wi-Fi Management has not started, do it now."); + static constexpr useconds_t kWiFiStartCheckTimeUsec = WIFI_START_CHECK_TIME_USEC; + static constexpr uint8_t kWiFiStartCheckAttempts = WIFI_START_CHECK_ATTEMPTS; + DeviceLayer::ConnectivityMgrImpl().StartWiFiManagement(); + { + for (int cnt = 0; cnt < kWiFiStartCheckAttempts; cnt++) + { + if (DeviceLayer::ConnectivityMgrImpl().IsWiFiManagementStarted()) + { + break; + } + usleep(kWiFiStartCheckTimeUsec); + } + } + if (!DeviceLayer::ConnectivityMgrImpl().IsWiFiManagementStarted()) + { + ChipLogError(Inet, "Wi-Fi Management taking too long to start - device configuration will be reset."); + return CHIP_ERROR_INTERNAL; + } + ChipLogProgress(NotSpecified, "Wi-Fi Management is started"); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR WiFiPAFBase::SendMessage(const Transport::PeerAddress & address, System::PacketBufferHandle && msgBuf) +{ + ReturnErrorCodeIf(address.GetTransportType() != Type::kWiFiPAF, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorCodeIf(mState == State::kNotReady, CHIP_ERROR_INCORRECT_STATE); + DeviceLayer::ConnectivityMgr().WiFiPAFSend(std::move(msgBuf)); + + return CHIP_NO_ERROR; +} + +void WiFiPAFBase::OnWiFiPAFMessageReceived(System::PacketBufferHandle && buffer) +{ + HandleMessageReceived(Transport::PeerAddress(Transport::Type::kWiFiPAF), std::move(buffer)); + return; +} + +CHIP_ERROR WiFiPAFBase::SendAfterConnect(System::PacketBufferHandle && msg) +{ + CHIP_ERROR err = CHIP_ERROR_NO_MEMORY; + + for (size_t i = 0; i < mPendingPacketsSize; i++) + { + if (mPendingPackets[i].IsNull()) + { + mPendingPackets[i] = std::move(msg); + err = CHIP_NO_ERROR; + break; + } + } + + return err; +} + +} // namespace Transport +} // namespace chip diff --git a/src/transport/raw/WiFiPAF.h b/src/transport/raw/WiFiPAF.h new file mode 100644 index 00000000000000..bd54d22cc3e26f --- /dev/null +++ b/src/transport/raw/WiFiPAF.h @@ -0,0 +1,115 @@ +/* + * + * 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. + */ + +/** + * @file + * This file defines the Matter Connection object that maintains a Wi-Fi PAF connection. + * + */ + +#pragma once + +#include +#include +#include +#include +#include + +namespace chip { +namespace Transport { + +class WiFiPAFLayer +{ +public: + WiFiPAFLayer() = default; +}; +class WiFiPAFListenParameters; + +/** + * Implements a transport using Wi-Fi-PAF + */ +class DLL_EXPORT WiFiPAFBase : public Base +{ +public: + /** + * The State of the Wi-Fi-PAF connection + * + */ + enum class State + { + kNotReady = 0, /**< State before initialization. */ + kInitialized = 1, /**< State after class is connected and ready. */ + kConnected = 2, /**< Endpoint connected. */ + }; + WiFiPAFBase() = default; + WiFiPAFBase(System::PacketBufferHandle * packetBuffers, size_t packetBuffersSize) : + mPendingPackets(packetBuffers), mPendingPacketsSize(packetBuffersSize) + {} + ~WiFiPAFBase() override; + + /** + * Initialize a Wi-Fi-PAF transport + * + * @param param Wi-Fi-PAF configuration parameters for this transport + */ + CHIP_ERROR Init(const WiFiPAFListenParameters & param); + CHIP_ERROR SendMessage(const Transport::PeerAddress & address, System::PacketBufferHandle && msgBuf) override; + bool CanSendToPeer(const Transport::PeerAddress & address) override + { + return (mState != State::kNotReady) && (address.GetTransportType() == Type::kWiFiPAF); + } + void OnWiFiPAFMessageReceived(System::PacketBufferHandle && buffer); + void SetWiFiPAFState(State state) { mState = state; }; + State GetWiFiPAFState() { return mState; }; + +private: + void ClearState(); + /** + * Sends the specified message once a connection has been established. + * @param msg - what buffer to send once a connection has been established. + */ + CHIP_ERROR SendAfterConnect(System::PacketBufferHandle && msg); + State mState = State::kNotReady; + + System::PacketBufferHandle * mPendingPackets; + size_t mPendingPacketsSize; +}; + +template +class WiFiPAF : public WiFiPAFBase +{ +public: + WiFiPAF() : WiFiPAFBase(mPendingPackets, kPendingPacketSize) {} + +private: + System::PacketBufferHandle mPendingPackets[kPendingPacketSize]; +}; + +/** Defines parameters for setting up the Wi-Fi PAF transport */ +class WiFiPAFListenParameters +{ +public: + WiFiPAFListenParameters() = default; + explicit WiFiPAFListenParameters(WiFiPAFBase * layer) : mWiFiPAF(layer) {} + +private: + WiFiPAFBase * mWiFiPAF; +}; + +} // namespace Transport +} // namespace chip diff --git a/src/transport/raw/tests/BUILD.gn b/src/transport/raw/tests/BUILD.gn index 1ac84f3d097700..195e164ec32c73 100644 --- a/src/transport/raw/tests/BUILD.gn +++ b/src/transport/raw/tests/BUILD.gn @@ -54,6 +54,7 @@ chip_test_suite("tests") { ":helpers", "${chip_root}/src/inet/tests:helpers", "${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/transport", diff --git a/src/transport/raw/tests/TestMessageHeader.cpp b/src/transport/raw/tests/TestMessageHeader.cpp index 4c807afc5c3608..27bbf74790bf97 100644 --- a/src/transport/raw/tests/TestMessageHeader.cpp +++ b/src/transport/raw/tests/TestMessageHeader.cpp @@ -23,9 +23,10 @@ * */ -#include +#include #include +#include #include #include #include diff --git a/src/transport/raw/tests/TestPeerAddress.cpp b/src/transport/raw/tests/TestPeerAddress.cpp index d96bc1990e0755..a4561ad4ebdc4c 100644 --- a/src/transport/raw/tests/TestPeerAddress.cpp +++ b/src/transport/raw/tests/TestPeerAddress.cpp @@ -21,11 +21,12 @@ #include #include -#include +#include #include #include #include +#include #include namespace { diff --git a/src/transport/raw/tests/TestTCP.cpp b/src/transport/raw/tests/TestTCP.cpp index 4f78da5dcdce86..80531491f288a0 100644 --- a/src/transport/raw/tests/TestTCP.cpp +++ b/src/transport/raw/tests/TestTCP.cpp @@ -28,11 +28,12 @@ #include #include -#include +#include #include #include #include +#include #include #include #include diff --git a/src/transport/raw/tests/TestUDP.cpp b/src/transport/raw/tests/TestUDP.cpp index 39167b89a58bb7..d96a781237d18b 100644 --- a/src/transport/raw/tests/TestUDP.cpp +++ b/src/transport/raw/tests/TestUDP.cpp @@ -25,9 +25,10 @@ #include -#include +#include #include +#include #include #include #include diff --git a/src/transport/retransmit/tests/BUILD.gn b/src/transport/retransmit/tests/BUILD.gn index cd762b2c755571..23482412716463 100644 --- a/src/transport/retransmit/tests/BUILD.gn +++ b/src/transport/retransmit/tests/BUILD.gn @@ -25,5 +25,8 @@ chip_test_suite("tests") { test_sources = [ "TestCache.cpp" ] - public_deps = [ "${chip_root}/src/transport/retransmit" ] + public_deps = [ + "${chip_root}/src/lib/core:string-builder-adapters", + "${chip_root}/src/transport/retransmit", + ] } diff --git a/src/transport/retransmit/tests/TestCache.cpp b/src/transport/retransmit/tests/TestCache.cpp index 6142f4910dbf44..09e8cced0f1101 100644 --- a/src/transport/retransmit/tests/TestCache.cpp +++ b/src/transport/retransmit/tests/TestCache.cpp @@ -14,10 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include #include -#include + +#include + +#include +#include // Helpers for simple payload management namespace { diff --git a/src/transport/tests/BUILD.gn b/src/transport/tests/BUILD.gn index 7c38cea5e7e8eb..f0be95ff5ac8dd 100644 --- a/src/transport/tests/BUILD.gn +++ b/src/transport/tests/BUILD.gn @@ -57,6 +57,7 @@ chip_test_suite("tests") { "${chip_root}/src/credentials/tests:cert_test_vectors", "${chip_root}/src/inet/tests:helpers", "${chip_root}/src/lib/core", + "${chip_root}/src/lib/core:string-builder-adapters", "${chip_root}/src/lib/support", "${chip_root}/src/lib/support:testing", "${chip_root}/src/protocols", diff --git a/src/transport/tests/TestCryptoContext.cpp b/src/transport/tests/TestCryptoContext.cpp index 45c3f3e5eb441e..76194a795ff531 100644 --- a/src/transport/tests/TestCryptoContext.cpp +++ b/src/transport/tests/TestCryptoContext.cpp @@ -18,10 +18,11 @@ #include -#include +#include #include #include +#include #include #include diff --git a/src/transport/tests/TestGroupMessageCounter.cpp b/src/transport/tests/TestGroupMessageCounter.cpp index 72fe57754e8976..266decb34ce614 100644 --- a/src/transport/tests/TestGroupMessageCounter.cpp +++ b/src/transport/tests/TestGroupMessageCounter.cpp @@ -22,8 +22,10 @@ */ #include -#include +#include + +#include #include #include #include diff --git a/src/transport/tests/TestPeerConnections.cpp b/src/transport/tests/TestPeerConnections.cpp index 9beb263f1d15c8..5da94eb66dd708 100644 --- a/src/transport/tests/TestPeerConnections.cpp +++ b/src/transport/tests/TestPeerConnections.cpp @@ -23,9 +23,10 @@ * */ -#include +#include #include +#include #include #include diff --git a/src/transport/tests/TestPeerMessageCounter.cpp b/src/transport/tests/TestPeerMessageCounter.cpp index 75f296b1bcba21..6b0c151d9209cc 100644 --- a/src/transport/tests/TestPeerMessageCounter.cpp +++ b/src/transport/tests/TestPeerMessageCounter.cpp @@ -24,8 +24,9 @@ #include #include -#include +#include +#include #include #include diff --git a/src/transport/tests/TestSecureSession.cpp b/src/transport/tests/TestSecureSession.cpp index 672ba04e8fd38c..695f6642b79d3c 100644 --- a/src/transport/tests/TestSecureSession.cpp +++ b/src/transport/tests/TestSecureSession.cpp @@ -24,10 +24,11 @@ #include #include -#include +#include #include #include +#include #include #include diff --git a/src/transport/tests/TestSecureSessionTable.cpp b/src/transport/tests/TestSecureSessionTable.cpp index 323558a0cecd24..da5ca96951c6ed 100644 --- a/src/transport/tests/TestSecureSessionTable.cpp +++ b/src/transport/tests/TestSecureSessionTable.cpp @@ -24,11 +24,12 @@ #include #include -#include +#include -#include "system/SystemClock.h" #include +#include #include +#include #include #include diff --git a/src/transport/tests/TestSessionManager.cpp b/src/transport/tests/TestSessionManager.cpp index c5384a7be40328..154071a56418c5 100644 --- a/src/transport/tests/TestSessionManager.cpp +++ b/src/transport/tests/TestSessionManager.cpp @@ -21,6 +21,10 @@ * This file implements unit tests for the SessionManager implementation. */ +#include + +#include + #define CHIP_ENABLE_TEST_ENCRYPTED_BUFFER_API // Up here in case some other header // includes SessionManager.h indirectly @@ -29,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -39,10 +44,6 @@ #include #include -#include - -#include - #undef CHIP_ENABLE_TEST_ENCRYPTED_BUFFER_API namespace { diff --git a/src/transport/tests/TestSessionManagerDispatch.cpp b/src/transport/tests/TestSessionManagerDispatch.cpp index f90cb0fa2b21ac..099ccec4b2f6c6 100644 --- a/src/transport/tests/TestSessionManagerDispatch.cpp +++ b/src/transport/tests/TestSessionManagerDispatch.cpp @@ -21,6 +21,10 @@ * This file implements unit tests for the SessionManager implementation. */ +#include + +#include + #define CHIP_ENABLE_TEST_ENCRYPTED_BUFFER_API // Up here in case some other header // includes SessionManager.h indirectly @@ -29,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -36,10 +41,6 @@ #include #include -#include - -#include - #undef CHIP_ENABLE_TEST_ENCRYPTED_BUFFER_API namespace { diff --git a/third_party/infineon/psoc6/BUILD.gn b/third_party/infineon/psoc6/BUILD.gn index 19fe610b1e6777..82fe0865cec5ec 100644 --- a/third_party/infineon/psoc6/BUILD.gn +++ b/third_party/infineon/psoc6/BUILD.gn @@ -22,12 +22,25 @@ declare_args() { assert(psoc6_target_project != "", "psoc6_target_project must be specified") +mtb_json_local = + mtb_core_json # Can't modify without copying into current scope + +if (is_debug) { + mtb_json_local.cflags += [ "-Og" ] + mtb_json_local.cxxflags += [ "-Og" ] + mtb_json_local.defines += [ "-DDEBUG" ] +} else { + mtb_json_local.cflags += [ "-Os" ] + mtb_json_local.cxxflags += [ "-Os" ] + mtb_json_local.defines += [ "-DNDEBUG" ] +} + # Add includes, cflags, asmflags, etc in config config("psoc6_sdk_config") { # Pull out includes from generated json # Treat these includes as system includes, so warnings in them are not fatal. _system_include_dirs = [] - foreach(include_dir, mtb_json.includes) { + foreach(include_dir, mtb_json_local.includes) { # Strip off leading -I part include_dir = string_replace(include_dir, "-I", "", 1) @@ -48,24 +61,24 @@ config("psoc6_sdk_config") { # Pull out defines from generated json defines = [] - foreach(def, mtb_json.defines) { + foreach(def, mtb_json_local.defines) { # Strip off leading -D part defines += [ string_replace(def, "-D", "", 1) ] } # Pull out static libs (.a files) from generated json libs = [] - foreach(lib, mtb_json.libs) { + foreach(lib, mtb_json_local.libs) { # Path is relative to SDK lib = "${psoc6_sdk_root}/${lib}" libs += [ lib ] } - cflags_c = mtb_json.cflags - cflags_cc = mtb_json.cxxflags - asmflags = mtb_json.asflags - ldflags = filter_exclude(mtb_json.ldflags, [ "-T*" ]) + cflags_c = mtb_json_local.cflags + cflags_cc = mtb_json_local.cxxflags + asmflags = mtb_json_local.asflags + ldflags = filter_exclude(mtb_json_local.ldflags, [ "-T*" ]) # TODO, once the issue is properly fixed we should no longer need this warning. cflags_c += [ "-Wno-error=array-parameter" ] @@ -73,7 +86,7 @@ config("psoc6_sdk_config") { # Pull out linker flags with paths (-T flags) and make paths absolute # OTA app provides it's own linker script if (!chip_enable_ota_requestor) { - linker_script_flags = filter_include(mtb_json.ldflags, [ "-T*" ]) + linker_script_flags = filter_include(mtb_json_local.ldflags, [ "-T*" ]) foreach(linker_script, linker_script_flags) { # Strip off leading -T part linker_script = string_replace(linker_script, "-T", "", 1) diff --git a/third_party/infineon/psoc6/psoc6_board.gni b/third_party/infineon/psoc6/psoc6_board.gni index a6cae75a7aecc3..340f312a67753d 100644 --- a/third_party/infineon/psoc6/psoc6_board.gni +++ b/third_party/infineon/psoc6/psoc6_board.gni @@ -13,7 +13,7 @@ # limitations under the License. declare_args() { - # P6 board used + # PSOC6 board used psoc6_board = "" } diff --git a/third_party/infineon/psoc6/psoc6_sdk.gni b/third_party/infineon/psoc6/psoc6_sdk.gni index 90366ddac471aa..bc315affc544be 100644 --- a/third_party/infineon/psoc6/psoc6_sdk.gni +++ b/third_party/infineon/psoc6/psoc6_sdk.gni @@ -21,15 +21,9 @@ import("psoc6_board.gni") # TODO: Don't hardcode config/toolchain # TODO: Convert to GN action? -if (is_debug) { - debug_str = "Debug" -} else { - debug_str = "Release" -} -mtb_json = - read_file("${psoc6_sdk_root}/build/${psoc6_board}/$debug_str/GCC_ARM.json", - "json") +mtb_core_json = + read_file("${psoc6_sdk_root}/build/${psoc6_board}/GCC_ARM.json", "json") # Defines an psoc6 SDK build target. # @@ -73,13 +67,26 @@ template("psoc6_sdk_sources") { } # This is ugly. See note in BUILD.gn for reasoning - mtb_json_local = mtb_json # Can't modify without copying into current scope + mtb_json_local = + mtb_core_json # Can't modify without copying into current scope + + # Update the flags and defines for either Release or Debug mode + if (is_debug) { + mtb_json_local.cflags += [ "-Og" ] + mtb_json_local.cxxflags += [ "-Og" ] + mtb_json_local.defines += [ "-DDEBUG" ] + } else { + mtb_json_local.cflags += [ "-Os" ] + mtb_json_local.cxxflags += [ "-Os" ] + mtb_json_local.defines += [ "-DNDEBUG" ] + } + if (chip_enable_ota_requestor == true) { mtb_json_local.c_source -= [ - "./libs/psoc6cm0p/COMPONENT_CM0P_SLEEP/psoc6_01_cm0p_sleep.c", - "./libs/psoc6cm0p/COMPONENT_CM0P_SLEEP/psoc6_02_cm0p_sleep.c", - "./libs/psoc6cm0p/COMPONENT_CM0P_SLEEP/psoc6_03_cm0p_sleep.c", - "./libs/psoc6cm0p/COMPONENT_CM0P_SLEEP/psoc6_04_cm0p_sleep.c", + "./libs/cat1cm0p/COMPONENT_CAT1A/COMPONENT_CM0P_SLEEP/psoc6_01_cm0p_sleep.c", + "./libs/cat1cm0p/COMPONENT_CAT1A/COMPONENT_CM0P_SLEEP/psoc6_02_cm0p_sleep.c", + "./libs/cat1cm0p/COMPONENT_CAT1A/COMPONENT_CM0P_SLEEP/psoc6_03_cm0p_sleep.c", + "./libs/cat1cm0p/COMPONENT_CAT1A/COMPONENT_CM0P_SLEEP/psoc6_04_cm0p_sleep.c", ] } diff --git a/third_party/infineon/psoc6/psoc6_sdk/Makefile b/third_party/infineon/psoc6/psoc6_sdk/Makefile deleted file mode 100755 index 45318c6686baa7..00000000000000 --- a/third_party/infineon/psoc6/psoc6_sdk/Makefile +++ /dev/null @@ -1,236 +0,0 @@ -################################################################################ -# \file Makefile -# \version 1.0 -# -# \brief -# Top-level application make file. -# -################################################################################ -# \copyright -# Copyright 2018-2021 Cypress Semiconductor Corporation -# SPDX-License-Identifier: Apache-2.0 -# -# 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. -################################################################################ - - -################################################################################ -# Basic Configuration -################################################################################ - -# Target board/hardware (BSP). -# To change the target, it is recommended to use the Library manager -# ('make modlibs' from command line), which will also update Eclipse IDE launch -# configurations. If TARGET is manually edited, ensure TARGET_.mtb with a -# valid URL exists in the application, run 'make getlibs' to fetch BSP contents -# and update or regenerate launch configurations for your IDE. -TARGET=$(error TARGET should be set on make command-line) - -APPNAME=mtb-chip-sdk - -# Name of toolchain to use. Options include: -# -# GCC_ARM -- GCC provided with ModusToolbox IDE -# ARM -- ARM Compiler (must be installed separately) -# IAR -- IAR Compiler (must be installed separately) -# -# See also: CY_COMPILER_PATH below -TOOLCHAIN=GCC_ARM - -# Default build configuration. Options include: -# -# Debug -- build with minimal optimizations, focus on debugging. -# Release -- build with full optimizations -# Custom -- build with custom configuration, set the optimization flag in CFLAGS -# -# If CONFIG is manually edited, ensure to update or regenerate launch configurations -# for your IDE. -CONFIG=Debug - -# If set to "true" or "1", display full command-lines when building. -VERBOSE= - -# The MQTT Client library does not support secure connections to the Mosquitto -# broker by default, because the server uses the SHA1 hashing algorithm which -# is considered a weak message digest and is therefore not enabled by default. -# However, if it is required to connect securely to the Mosquitto Broker set -# this macro to "true" or "1". -ENABLE_SECURE_MOSQUITTO_BROKER_SUPPORT=0 - -################################################################################ -# Advanced Configuration -################################################################################ - -# Enable optional code that is ordinarily disabled by default. -# -# Available components depend on the specific targeted hardware and firmware -# in use. In general, if you have -# -# COMPONENTS=foo bar -# -# ... then code in directories named COMPONENT_foo and COMPONENT_bar will be -# added to the build -# -COMPONENTS=FREERTOS LWIP MBEDTLS RTOS_AWARE WICED_BLE OTA_MCUBOOT_PSOC - -# CHIP: ModusToolbox 2.2 & 2.3 do not have a way to disable indirect library -# dependencies. This causes trouble for CHIP because we need to use its -# bundled version of LwIP. -# -# As a work-around, we enable "QUICK_MODE" for the "getlibs" target. This -# tells it to skip automatic generation of .mtb files for indirect -# dependencies. We list everything we need as a direct dependency. -# -# This isn't ideal (it means have to manually manage dependencies), but it's -# the best we can do for these versions of ModusToolbox. -ifeq ($(filter getlibs,$(MAKECMDGOALS)),getlibs) -QUICK_MODE=true -endif - -# Like COMPONENTS, but disable optional code that was enabled by default. -DISABLE_COMPONENTS= - -# By default the build system automatically looks in the Makefile's directory -# tree for source code and builds it. The SOURCES variable can be used to -# manually add source code to the build process from a location not searched -# by default, or otherwise not found by the build system. -SOURCES= - -# Like SOURCES, but for include directories. Value should be paths to -# directories (without a leading -I). -INCLUDES=./configs - -# Custom configuration of mbedtls library. -MBEDTLSFLAGS = MBEDTLS_USER_CONFIG_FILE= - -# Add additional defines to the build process (without a leading -D). -DEFINES=$(MBEDTLSFLAGS) CYBSP_WIFI_CAPABLE CY_RETARGET_IO_CONVERT_LF_TO_CRLF CY_RTOS_AWARE PSOC_062_2M - -# Enable support for Mosquitto Broker based on 'ENABLE_SECURE_MOSQUITTO_BROKER_ -# SUPPORT' variable. See the MQTT Client library's README for more information. -ifneq (,$(filter $(ENABLE_SECURE_MOSQUITTO_BROKER_SUPPORT),true 1)) -DEFINES+=CY_MQTT_ENABLE_SECURE_TEST_MOSQUITTO_SUPPORT -endif - -# CY8CPROTO-062-4343W board shares the same GPIO for the user button (USER BTN1) -# and the CYW4343W host wake up pin. Since this example uses the GPIO for -# interfacing with the user button, the SDIO interrupt to wake up the host is -# disabled by setting CY_WIFI_HOST_WAKE_SW_FORCE to '0'. -ifeq ($(TARGET), CY8CPROTO-062-4343W) -DEFINES+=CY_WIFI_HOST_WAKE_SW_FORCE=0 -endif - -# Select softfp or hardfp floating point. Default is softfp. -VFP_SELECT= - -COMMON_WARNING_FLAGS = -Wall -Werror=all \ - -Wno-error=unused-function \ - -Wno-error=unused-but-set-variable \ - -Wno-error=unused-variable \ - -Wno-error=deprecated-declarations \ - -Wextra \ - -Wno-unused-parameter -Wno-sign-compare \ - -Wno-shadow \ - -Wno-maybe-uninitialized \ - -Wno-incompatible-pointer-types \ - -Wno-type-limits \ - -Wno-conversion - -# Additional / custom C compiler flags. -# -# NOTE: Includes and defines should use the INCLUDES and DEFINES variable -# above. -CFLAGS=$(COMMON_WARNING_FLAGS) - -# Additional / custom C++ compiler flags. -# -# NOTE: Includes and defines should use the INCLUDES and DEFINES variable -# above. -CXXFLAGS= - -# Additional / custom assembler flags. -# -# NOTE: Includes and defines should use the INCLUDES and DEFINES variable -# above. -ASFLAGS= - -# Additional / custom linker flags. -LDFLAGS= - -# Additional / custom libraries to link in to the application. -LDLIBS= - -# Path to the linker script to use (if empty, use the default linker script). -LINKER_SCRIPT= - -# Custom pre-build commands to run. -PREBUILD= - -# Custom post-build commands to run. -POSTBUILD= - - -################################################################################ -# Paths -################################################################################ - -# Relative path to the project directory (default is the Makefile's directory). -# -# This controls where automatic source code discovery looks for code. -CY_APP_PATH= - -# Relative path to the shared repo location. -# -# All .mtb files have the format, ##. If the field -# begins with $$ASSET_REPO$$, then the repo is deposited in the path specified by -# the CY_GETLIBS_SHARED_PATH variable. The default location is one directory level -# above the current app directory. -# This is used with CY_GETLIBS_SHARED_NAME variable, which specifies the directory name. -CY_GETLIBS_SHARED_PATH=../ - -# Directory name of the shared repo location. -# -CY_GETLIBS_SHARED_NAME=mtb_shared - -# Absolute path to the compiler's "bin" directory. -# -# The default depends on the selected TOOLCHAIN (GCC_ARM uses the ModusToolbox -# IDE provided compiler by default). -CY_COMPILER_PATH= - - -# Locate ModusToolbox IDE helper tools folders in default installation -# locations for Windows, Linux, and macOS. -CY_WIN_HOME=$(subst \,/,$(USERPROFILE)) -CY_TOOLS_PATHS ?= $(wildcard \ - $(CY_WIN_HOME)/ModusToolbox/tools_* \ - $(HOME)/ModusToolbox/tools_* \ - /Applications/ModusToolbox/tools_*) - -# If you install ModusToolbox IDE in a custom location, add the path to its -# "tools_X.Y" folder (where X and Y are the version number of the tools -# folder). Make sure you use forward slashes. -CY_TOOLS_PATHS+= - -# Default to the newest installed tools folder, or the users override (if it's -# found). -CY_TOOLS_DIR=$(lastword $(sort $(wildcard $(CY_TOOLS_PATHS)))) - -ifeq ($(CY_TOOLS_DIR),) -$(error Unable to find any of the available CY_TOOLS_PATHS -- $(CY_TOOLS_PATHS). On Windows, use forward slashes.) -endif - -$(info Tools Directory: $(CY_TOOLS_DIR)) - -include $(CY_TOOLS_DIR)/make/start.mk - diff --git a/third_party/infineon/psoc6/psoc6_sdk/build/CY8CKIT-062S2-43012/Debug/GCC_ARM.json b/third_party/infineon/psoc6/psoc6_sdk/build/CY8CKIT-062S2-43012/GCC_ARM.json similarity index 83% rename from third_party/infineon/psoc6/psoc6_sdk/build/CY8CKIT-062S2-43012/Debug/GCC_ARM.json rename to third_party/infineon/psoc6/psoc6_sdk/build/CY8CKIT-062S2-43012/GCC_ARM.json index bdf407807c5a42..89ef0454830145 100644 --- a/third_party/infineon/psoc6/psoc6_sdk/build/CY8CKIT-062S2-43012/Debug/GCC_ARM.json +++ b/third_party/infineon/psoc6/psoc6_sdk/build/CY8CKIT-062S2-43012/GCC_ARM.json @@ -17,7 +17,6 @@ "-c", "-mcpu=cortex-m4", "--specs=nano.specs", - "-Og", "-mfloat-abi=softfp", "-mfpu=fpv4-sp-d16", "-mthumb", @@ -31,7 +30,6 @@ "-c", "-mcpu=cortex-m4", "--specs=nano.specs", - "-Og", "-mfloat-abi=softfp", "-mfpu=fpv4-sp-d16", "-mthumb", @@ -67,50 +65,48 @@ "-ffat-lto-objects", "-g", "-Wall", + "-pipe", "-Wl,--gc-sections", - "-T./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_CM4/TOOLCHAIN_GCC_ARM/cy8c6xxa_cm4_dual.ld" + "-T./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_CM4/TOOLCHAIN_GCC_ARM/linker.ld" ], "includes": [ "-I./configs", "-I.", - "-I./arch", - "-I./configs", "-I./libs", + "-I./libs/abstraction-rtos/include/COMPONENT_FREERTOS", + "-I./libs/secure-sockets/include/COMPONENT_FREERTOS", + "-I./arch", + "-I./libs/freertos", + "-I./libs/freertos/Source", + "-I./libs/freertos/Source/include", + "-I./libs/freertos/Source/portable", + "-I./libs/freertos/Source/portable/COMPONENT_CM4", + "-I./libs/freertos/Source/portable/COMPONENT_CM4/TOOLCHAIN_GCC_ARM", "-I./libs/TARGET_CY8CKIT-062S2-43012", "-I./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS", - "-I./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource", + "-I./configs/GeneratedSource", "-I./libs/TARGET_CY8CKIT-062S2-43012/bluetooth", "-I./libs/abstraction-rtos", "-I./libs/abstraction-rtos/include", - "-I./libs/abstraction-rtos/include/COMPONENT_FREERTOS", - "-I./libs/abstraction-rtos/include/Template", - "-I./libs/anycloud-ota", - "-I./libs/anycloud-ota/include", - "-I./libs/anycloud-ota/source", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/bootutil", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/bootutil/include", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/bootutil/include/bootutil", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/bootutil/src", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/flash_qspi", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/include", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/include/flash_map_backend", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/mem_config", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/mcuboot_header", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/mcuboot_header/mcuboot_config", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/sysflash", - "-I./libs/anycloud-ota/source/port_support", - "-I./libs/anycloud-ota/source/port_support/serial_flash", - "-I./libs/anycloud-ota/source/port_support/untar", - "-I./libs/bluetooth-freertos", - "-I./libs/bluetooth-freertos/platform", - "-I./libs/bluetooth-freertos/platform/common", - "-I./libs/bluetooth-freertos/platform/debug", - "-I./libs/bluetooth-freertos/platform/include", - "-I./libs/btstack", + "-I./ota/config/", + "-I./libs/ota-update/include", + "-I./libs/ota-update/source", + "-I./libs/ota-update/configs", + "-I./libs/ota-update/source/COMPONENT_MBEDTLS", + "-I./libs/ota-update/source/COMPONENT_OTA_BLUETOOTH/", + "-I./libs/ota-update/configs/COMPONENT_OTA_BLUETOOTH_SECURE", + "-I./libs/ota-update/configs/FreeRTOS/COMPONENT_CM4", + "-I./libs/ota-bootloader-abstraction/source/COMPONENT_MCUBOOT", + "-I./libs/ota-bootloader-abstraction/configs/COMPONENT_MCUBOOT/flash/COMPONENT_OTA_PSOC_062", + "-I./libs/ota-bootloader-abstraction/include/", + "-I./libs/ota-bootloader-abstraction/configs/COMPONENT_MCUBOOT/flash/", + "-I./libs/ota-bootloader-abstraction/source/COMPONENT_MCUBOOT/", + "-I./libs/ota-bootloader-abstraction/source/untar/", + "-I./libs/btstack-integration/", + "-I./libs/btstack-integration/COMPONENT_HCI-UART/common", + "-I./libs/btstack-integration/COMPONENT_HCI-UART/include", "-I./libs/btstack/wiced_include", + "-I./libs/cat1cm0p/COMPONENT_CAT1A", "-I./libs/clib-support", "-I./libs/clib-support/TOOLCHAIN_GCC_ARM", "-I./libs/connectivity-utilities", @@ -121,12 +117,6 @@ "-I./libs/connectivity-utilities/network", "-I./libs/core-lib", "-I./libs/core-lib/include", - "-I./libs/freertos", - "-I./libs/freertos/Source", - "-I./libs/freertos/Source/include", - "-I./libs/freertos/Source/portable", - "-I./libs/freertos/Source/portable/COMPONENT_CM4", - "-I./libs/freertos/Source/portable/COMPONENT_CM4/TOOLCHAIN_GCC_ARM", "-I./libs/kv-store", "-I./libs/lwip", "-I./libs/lwip/src", @@ -137,6 +127,8 @@ "-I./libs/lwip/src/include/netif", "-I./libs/lwip/src/include/netif/ppp", "-I./libs/lwip/src/include/netif/ppp/polarssl", + "-I./libs/lwip-network-interface-integration/include", + "-I./libs/lwip-network-interface-integration/source", "-I./libs/mbedtls", "-I./libs/mbedtls/include", "-I./libs/mbedtls/include/mbedtls", @@ -151,19 +143,21 @@ "-I./libs/mtb-hal-cat1/include_pvt", "-I./libs/mtb-hal-cat1/source", "-I./libs/mtb-pdl-cat1", - "-I./libs/mtb-pdl-cat1/cmsis", - "-I./libs/mtb-pdl-cat1/cmsis/include", + "-I./libs/cmsis/Core/Include", + "-I./libs/cmsis/COMPONENT_CMSIS_NN/include", "-I./libs/mtb-pdl-cat1/devices", "-I./libs/mtb-pdl-cat1/devices/COMPONENT_CAT1A", "-I./libs/mtb-pdl-cat1/devices/COMPONENT_CAT1A/include", "-I./libs/mtb-pdl-cat1/devices/COMPONENT_CAT1A/include/ip", "-I./libs/mtb-pdl-cat1/drivers", "-I./libs/mtb-pdl-cat1/drivers/include", + "-I./ota", + "-I./ota/bootutil", "-I./libs/retarget-io", "-I./libs/secure-sockets", "-I./libs/secure-sockets/include", - "-I./libs/secure-sockets/include/COMPONENT_FREERTOS", "-I./libs/secure-sockets/source", + "-I./libs/secure-sockets/source/COMPONENT_MBEDTLS/include", "-I./libs/serial-flash", "-I./libs/whd-bsp-integration", "-I./libs/wifi-connection-manager", @@ -185,15 +179,15 @@ "-I./libs/wifi-host-driver/WiFi_Host_Driver/resources/resource_imp", "-I./libs/wifi-host-driver/WiFi_Host_Driver/src", "-I./libs/wifi-host-driver/WiFi_Host_Driver/src/bus_protocols", - "-I./libs/wifi-host-driver/WiFi_Host_Driver/src/include", - "-I./libs/lwip-network-interface-integration", - "-I./libs/lwip-network-interface-integration/source", - "-I./libs/lwip-network-interface-integration/include", - "-I./ota/config" + "-I./libs/wifi-host-driver/WiFi_Host_Driver/src/include" ], "defines": [ + "-DCOMPONENT_FREERTOS", "-DMBEDTLS_USER_CONFIG_FILE=", "-DCYBSP_WIFI_CAPABLE", + "-DCYBSP_WIFI_SDIO_NEEDS_INIT", + "-DCORE_NAME_CM4_0", + "-DCY_USING_PREBUILT_CM0P_IMAGE", "-DCY_RETARGET_IO_CONVERT_LF_TO_CRLF", "-DCY_RTOS_AWARE", "-DPSOC_062_2M", @@ -207,10 +201,11 @@ "-DCOMPONENT_BSP_DESIGN_MODUS", "-DCOMPONENT_CAT1", "-DCOMPONENT_CAT1A", + "-DCOMPONENT_CMSIS_NN", "-DCOMPONENT_CM0P_SLEEP", "-DCOMPONENT_CM4", "-DCOMPONENT_CY8CKIT_062S2_43012", - "-DCOMPONENT_FREERTOS", + "-DCOMPONENT_43012", "-DCOMPONENT_HCI_UART", "-DCOMPONENT_LWIP", "-DCOMPONENT_MBEDTLS", @@ -220,7 +215,6 @@ "-DCOMPONENT_RTOS_AWARE", "-DCOMPONENT_SOFTFP", "-DCOMPONENT_WICED_BLE", - "-DDEBUG", "-DCY_SUPPORTS_DEVICE_VALIDATION", "-DCY_CRYPTO_HAL_DISABLE", "-DCOMPONENT_SECURE_SOCKETS", @@ -228,24 +222,6 @@ "-DOPTIGA_LIB_EXTERNAL=" ], "c_source": [ - "./libs/abstraction-rtos/source/cy_worker_thread.c", - "./libs/anycloud-ota/source/port_support/serial_flash/ota_serial_flash.c", - "./libs/bluetooth-freertos/platform/common/cybt_hci_rx_task.c", - "./libs/bluetooth-freertos/platform/common/cybt_hci_tx_task.c", - "./libs/bluetooth-freertos/platform/common/cybt_host_stack_platform_interface.c", - "./libs/bluetooth-freertos/platform/common/cybt_patchram_download.c", - "./libs/bluetooth-freertos/platform/common/cybt_platform_main.c", - "./libs/bluetooth-freertos/platform/common/cybt_platform_task.c", - "./libs/bluetooth-freertos/platform/common/cybt_platform_trace.c", - "./libs/bluetooth-freertos/platform/common/cybt_prm.c", - "./libs/bluetooth-freertos/platform/debug/cybt_debug_uart.c", - "./libs/bluetooth-freertos/platform/freertos/cybt_platform_freertos.c", - "./libs/clib-support/cy_time.c", - "./libs/connectivity-utilities/JSON_parser/cy_json_parser.c", - "./libs/connectivity-utilities/cy_log/cy_log.c", - "./libs/connectivity-utilities/cy_string/cy_string_utils.c", - "./libs/connectivity-utilities/linked_list/cy_linked_list.c", - "./libs/connectivity-utilities/network/cy_nw_helper_common.c", "./libs/freertos/Source/croutine.c", "./libs/freertos/Source/event_groups.c", "./libs/freertos/Source/list.c", @@ -258,6 +234,46 @@ "./libs/freertos/Source/stream_buffer.c", "./libs/freertos/Source/tasks.c", "./libs/freertos/Source/timers.c", + "./libs/freertos/Source/portable/COMPONENT_CM4/TOOLCHAIN_GCC_ARM/port.c", + "./libs/clib-support/COMPONENT_FREERTOS/cy_mutex_pool.c", + "./libs/abstraction-rtos/source/COMPONENT_FREERTOS/cyabs_freertos_common.c", + "./libs/abstraction-rtos/source/COMPONENT_FREERTOS/cyabs_freertos_helpers.c", + "./libs/abstraction-rtos/source/COMPONENT_FREERTOS/cyabs_rtos_freertos.c", + "./libs/abstraction-rtos/source/COMPONENT_FREERTOS/cyabs_rtos_dsram.c", + "./arch/sys_arch.c", + "./libs/abstraction-rtos/source/cy_worker_thread.c", + "./libs/ota-update/source/cy_ota_agent.c", + "./libs/ota-update/source/cy_ota_ble.c", + "./libs/ota-update/source/cy_ota_http.c", + "./libs/ota-update/source/cy_ota_mqtt.c", + "./libs/ota-update/source/COMPONENT_MBEDTLS/cy_ota_ble_secure.c", + "./libs/ota-update/source/COMPONENT_OTA_BLUETOOTH/ota_ecc_pp.c", + "./libs/ota-update/source/COMPONENT_OTA_BLUETOOTH/ota_multprecision.c", + "./libs/ota-update/configs/COMPONENT_OTA_BLUETOOTH_SECURE/ecdsa256_pub.c", + "./libs/ota-bootloader-abstraction/configs/COMPONENT_MCUBOOT/flash/cy_ota_flash.c", + "./libs/ota-bootloader-abstraction/configs/COMPONENT_MCUBOOT/flash/COMPONENT_OTA_PSOC_062/flash_qspi.c", + "./libs/ota-bootloader-abstraction/source/COMPONENT_MCUBOOT/cy_flash_map.c", + "./libs/ota-bootloader-abstraction/source/COMPONENT_MCUBOOT/cy_ota_flash_weak.c", + "./libs/ota-bootloader-abstraction/source/COMPONENT_MCUBOOT/cy_ota_storage_api.c", + "./libs/ota-bootloader-abstraction/source/COMPONENT_MCUBOOT/cy_ota_untar_wrapper.c", + "./libs/ota-bootloader-abstraction/source/untar/cy_ota_untar.c", + "./libs/btstack-integration/COMPONENT_HCI-UART/common/cybt_hci_rx_task.c", + "./libs/btstack-integration/COMPONENT_HCI-UART/common/cybt_hci_tx_task.c", + "./libs/btstack-integration/COMPONENT_HCI-UART/common/cybt_host_stack_platform_interface.c", + "./libs/btstack-integration/COMPONENT_HCI-UART/common/cybt_patchram_download.c", + "./libs/btstack-integration/COMPONENT_HCI-UART/common/cybt_platform_main.c", + "./libs/btstack-integration/COMPONENT_HCI-UART/common/cybt_platform_task.c", + "./libs/btstack-integration/COMPONENT_HCI-UART/common/cybt_platform_trace.c", + "./libs/btstack-integration/COMPONENT_HCI-UART/common/cybt_prm.c", + "./libs/btstack-integration/COMPONENT_HCI-UART/common/cybt_serialize.c", + "./libs/btstack-integration/COMPONENT_HCI-UART/debug/cybt_debug_uart.c", + "./libs/btstack-integration/COMPONENT_HCI-UART/freertos/cybt_platform_freertos.c", + "./libs/clib-support/cy_time.c", + "./libs/connectivity-utilities/JSON_parser/cy_json_parser.c", + "./libs/connectivity-utilities/cy_log/cy_log.c", + "./libs/connectivity-utilities/cy_string/cy_string_utils.c", + "./libs/connectivity-utilities/linked_list/cy_linked_list.c", + "./libs/connectivity-utilities/network/cy_nw_helper_common.c", "./libs/kv-store/mtb_kvstore.c", "./libs/lwip/src/api/api_lib.c", "./libs/lwip/src/api/api_msg.c", @@ -309,6 +325,9 @@ "./libs/lwip/src/netif/bridgeif_fdb.c", "./libs/lwip/src/netif/ethernet.c", "./libs/lwip/src/netif/zepif.c", + "./libs/lwip-network-interface-integration/source/cy_ethernetif.c", + "./libs/lwip-network-interface-integration/source/cy_lwip_dhcp_server.c", + "./libs/lwip-network-interface-integration/source/cy_network_mw_core.c", "./libs/mbedtls/library/aes.c", "./libs/mbedtls/library/aesni.c", "./libs/mbedtls/library/arc4.c", @@ -408,13 +427,12 @@ "./libs/mtb-hal-cat1/source/cyhal_dma_dmac.c", "./libs/mtb-hal-cat1/source/cyhal_dma_dw.c", "./libs/mtb-hal-cat1/source/cyhal_ezi2c.c", - "./libs/mtb-hal-cat1/source/cyhal_flash.c", "./libs/mtb-hal-cat1/source/cyhal_gpio.c", "./libs/mtb-hal-cat1/source/cyhal_hwmgr.c", + "./libs/mtb-hal-cat1/source/cyhal_irq_impl.c", "./libs/mtb-hal-cat1/source/cyhal_i2c.c", "./libs/mtb-hal-cat1/source/cyhal_i2s.c", "./libs/mtb-hal-cat1/source/cyhal_interconnect.c", - "./libs/mtb-hal-cat1/source/cyhal_irq_psoc.c", "./libs/mtb-hal-cat1/source/cyhal_keyscan.c", "./libs/mtb-hal-cat1/source/cyhal_lptimer.c", "./libs/mtb-hal-cat1/source/cyhal_opamp.c", @@ -436,13 +454,13 @@ "./libs/mtb-hal-cat1/source/cyhal_udb_sdio.c", "./libs/mtb-hal-cat1/source/cyhal_usb_dev.c", "./libs/mtb-hal-cat1/source/cyhal_utils.c", - "./libs/mtb-hal-cat1/source/cyhal_utils_psoc.c", + "./libs/mtb-hal-cat1/source/cyhal_utils_impl.c", "./libs/mtb-hal-cat1/source/cyhal_wdt.c", "./libs/mtb-pdl-cat1/drivers/source/cy_adcmic.c", "./libs/mtb-pdl-cat1/drivers/source/cy_ble_clk.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_btss.c", "./libs/mtb-pdl-cat1/drivers/source/cy_canfd.c", "./libs/mtb-pdl-cat1/drivers/source/cy_crypto.c", + "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_trng.c", "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_aes_v1.c", "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_aes_v2.c", "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_cmac_v1.c", @@ -466,11 +484,8 @@ "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_rsa.c", "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_sha_v1.c", "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_sha_v2.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_trng_v1.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_trng_v2.c", "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_vu.c", "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_server.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_cryptolite.c", "./libs/mtb-pdl-cat1/drivers/source/cy_csd.c", "./libs/mtb-pdl-cat1/drivers/source/cy_ctb.c", "./libs/mtb-pdl-cat1/drivers/source/cy_ctdac.c", @@ -490,8 +505,6 @@ "./libs/mtb-pdl-cat1/drivers/source/cy_lpcomp.c", "./libs/mtb-pdl-cat1/drivers/source/cy_lvd.c", "./libs/mtb-pdl-cat1/drivers/source/cy_mcwdt.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_pd_pdcm.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_pd_ppu.c", "./libs/mtb-pdl-cat1/drivers/source/cy_pdm_pcm.c", "./libs/mtb-pdl-cat1/drivers/source/cy_pdm_pcm_v2.c", "./libs/mtb-pdl-cat1/drivers/source/cy_pra.c", @@ -562,33 +575,21 @@ "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_wifi.c", "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_wifi_api.c", "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_wifi_p2p.c", - "./libs/lwip-network-interface-integration/source/cy_network_mw_core.c", - "./libs/lwip-network-interface-integration/source/cy_lwip_dhcp_server.c", + "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_proto.c", "./libs/clib-support/TOOLCHAIN_GCC_ARM/cy_clib_support_newlib.c", "./libs/TARGET_CY8CKIT-062S2-43012/bluetooth/cybsp_bt_config.c", "./libs/TARGET_CY8CKIT-062S2-43012/cybsp.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg_clocks.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg_connectivity_bt.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg_peripherals.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg_pins.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg_qspi_memslot.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg_routing.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg_system.c", + "./configs/GeneratedSource/cycfg.c", + "./configs/GeneratedSource/cycfg_clocks.c", + "./configs/GeneratedSource/cycfg_connectivity_bt.c", + "./configs/GeneratedSource/cycfg_peripherals.c", + "./configs/GeneratedSource/cycfg_pins.c", + "./configs/GeneratedSource/cycfg_qspi_memslot.c", + "./configs/GeneratedSource/cycfg_routing.c", + "./configs/GeneratedSource/cycfg_system.c", "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_CM4/system_psoc6_cm4.c", - "./libs/abstraction-rtos/source/COMPONENT_FREERTOS/cyabs_freertos_helpers.c", - "./libs/abstraction-rtos/source/COMPONENT_FREERTOS/cyabs_rtos_freertos.c", - "./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/bootutil/src/bootutil_misc.c", - "./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/cy_flash_map.c", - "./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/cy_flash_psoc6.c", - "./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/flash_qspi/flash_qspi.c", - "./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/mem_config/mem_config_sfdp.c", - "./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/ota_flash_map.c", - "./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/ota_flash_xip_map.c", - "./libs/bluetooth-freertos/firmware/COMPONENT_43012/COMPONENT_MURATA-1LV/COMPONENT_HCI-UART/w_bt_firmware_controller.c", - "./libs/clib-support/COMPONENT_FREERTOS/cy_mutex_pool.c", + "./libs/btstack-integration/COMPONENT_HCI-UART/firmware/COMPONENT_43012/COMPONENT_MURATA-1LV/w_bt_firmware_controller.c", "./libs/connectivity-utilities/network/COMPONENT_LWIP/cy_nw_helper.c", - "./libs/freertos/Source/portable/COMPONENT_CM4/TOOLCHAIN_GCC_ARM/port.c", "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_01_104_m_csp_ble.c", "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_01_104_m_csp_ble_usb.c", "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_01_116_bga_ble.c", @@ -613,10 +614,10 @@ "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/triggers/cyhal_triggers_psoc6_03.c", "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/triggers/cyhal_triggers_psoc6_04.c", "./libs/mtb-pdl-cat1/devices/COMPONENT_CAT1A/source/cy_device.c", - "./libs/psoc6cm0p/COMPONENT_CM0P_SLEEP/psoc6_01_cm0p_sleep.c", - "./libs/psoc6cm0p/COMPONENT_CM0P_SLEEP/psoc6_02_cm0p_sleep.c", - "./libs/psoc6cm0p/COMPONENT_CM0P_SLEEP/psoc6_03_cm0p_sleep.c", - "./libs/psoc6cm0p/COMPONENT_CM0P_SLEEP/psoc6_04_cm0p_sleep.c", + "./libs/cat1cm0p/COMPONENT_CAT1A/COMPONENT_CM0P_SLEEP/psoc6_01_cm0p_sleep.c", + "./libs/cat1cm0p/COMPONENT_CAT1A/COMPONENT_CM0P_SLEEP/psoc6_02_cm0p_sleep.c", + "./libs/cat1cm0p/COMPONENT_CAT1A/COMPONENT_CM0P_SLEEP/psoc6_03_cm0p_sleep.c", + "./libs/cat1cm0p/COMPONENT_CAT1A/COMPONENT_CM0P_SLEEP/psoc6_04_cm0p_sleep.c", "./libs/secure-sockets/source/COMPONENT_LWIP/cy_secure_sockets.c", "./libs/secure-sockets/source/COMPONENT_MBEDTLS/cy_tls.c", "./libs/secure-sockets/source/COMPONENT_MBEDTLS/iot_crypto.c", @@ -627,12 +628,11 @@ "./libs/wifi-host-driver/WiFi_Host_Driver/resources/clm/COMPONENT_43012/43012C0-mfgtest_clm_blob.c", "./libs/wifi-host-driver/WiFi_Host_Driver/resources/clm/COMPONENT_43012/43012C0_clm_blob.c", "./libs/wifi-host-driver/WiFi_Host_Driver/resources/firmware/COMPONENT_43012/43012C0-mfgtest_bin.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/resources/firmware/COMPONENT_43012/43012C0_bin.c", - "./arch/sys_arch.c" + "./libs/wifi-host-driver/WiFi_Host_Driver/resources/firmware/COMPONENT_43012/43012C0_bin.c" ], "cxx_source": [], "asm_source": [ - "./libs/mtb-pdl-cat1/drivers/source/TOOLCHAIN_GCC_ARM/cy_syslib_gcc.S", + "./libs/mtb-pdl-cat1/drivers/source/TOOLCHAIN_GCC_ARM/cy_syslib_ext.S", "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_CM4/TOOLCHAIN_GCC_ARM/startup_psoc6_02_cm4.S" ], "libs": [ diff --git a/third_party/infineon/psoc6/psoc6_sdk/build/CY8CKIT-062S2-43012/Release/GCC_ARM.json b/third_party/infineon/psoc6/psoc6_sdk/build/CY8CKIT-062S2-43012/Release/GCC_ARM.json deleted file mode 100644 index 917160ac8f83e7..00000000000000 --- a/third_party/infineon/psoc6/psoc6_sdk/build/CY8CKIT-062S2-43012/Release/GCC_ARM.json +++ /dev/null @@ -1,642 +0,0 @@ -{ - "cflags": [ - "-Wall", - "-Werror=all", - "-Wno-error=unused-function", - "-Wno-error=unused-but-set-variable", - "-Wno-error=unused-variable", - "-Wno-error=deprecated-declarations", - "-Wextra", - "-Wno-unused-parameter", - "-Wno-sign-compare", - "-Wno-shadow", - "-Wno-maybe-uninitialized", - "-Wno-incompatible-pointer-types", - "-Wno-type-limits", - "-Wno-conversion", - "-c", - "-mcpu=cortex-m4", - "--specs=nano.specs", - "-Os", - "-mfloat-abi=softfp", - "-mfpu=fpv4-sp-d16", - "-mthumb", - "-ffunction-sections", - "-fdata-sections", - "-ffat-lto-objects", - "-g", - "-Wall" - ], - "cxxflags": [ - "-c", - "-mcpu=cortex-m4", - "--specs=nano.specs", - "-Os", - "-mfloat-abi=softfp", - "-mfpu=fpv4-sp-d16", - "-mthumb", - "-ffunction-sections", - "-fdata-sections", - "-ffat-lto-objects", - "-g", - "-Wall", - "-fno-rtti", - "-fno-exceptions" - ], - "asflags": [ - "-c", - "-mcpu=cortex-m4", - "--specs=nano.specs", - "-mfloat-abi=softfp", - "-mfpu=fpv4-sp-d16", - "-mthumb", - "-ffunction-sections", - "-fdata-sections", - "-ffat-lto-objects", - "-g", - "-Wall" - ], - "ldflags": [ - "-mcpu=cortex-m4", - "--specs=nano.specs", - "-mfloat-abi=softfp", - "-mfpu=fpv4-sp-d16", - "-mthumb", - "-ffunction-sections", - "-fdata-sections", - "-ffat-lto-objects", - "-g", - "-Wall", - "-Wl,--gc-sections", - "-T./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_CM4/TOOLCHAIN_GCC_ARM/cy8c6xxa_cm4_dual.ld" - ], - "includes": [ - "-I./configs", - "-I.", - "-I./arch", - "-I./configs", - "-I./libs", - "-I./libs/TARGET_CY8CKIT-062S2-43012", - "-I./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS", - "-I./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource", - "-I./libs/TARGET_CY8CKIT-062S2-43012/bluetooth", - "-I./libs/abstraction-rtos", - "-I./libs/abstraction-rtos/include", - "-I./libs/abstraction-rtos/include/COMPONENT_FREERTOS", - "-I./libs/abstraction-rtos/include/Template", - "-I./libs/anycloud-ota", - "-I./libs/anycloud-ota/include", - "-I./libs/anycloud-ota/source", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/bootutil", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/bootutil/include", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/bootutil/include/bootutil", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/bootutil/src", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/flash_qspi", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/include", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/include/flash_map_backend", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/mem_config", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/mcuboot_header", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/mcuboot_header/mcuboot_config", - "-I./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/sysflash", - "-I./libs/anycloud-ota/source/port_support", - "-I./libs/anycloud-ota/source/port_support/serial_flash", - "-I./libs/anycloud-ota/source/port_support/untar", - "-I./libs/bluetooth-freertos", - "-I./libs/bluetooth-freertos/platform", - "-I./libs/bluetooth-freertos/platform/common", - "-I./libs/bluetooth-freertos/platform/debug", - "-I./libs/bluetooth-freertos/platform/include", - "-I./libs/btstack", - "-I./libs/btstack/wiced_include", - "-I./libs/clib-support", - "-I./libs/clib-support/TOOLCHAIN_GCC_ARM", - "-I./libs/connectivity-utilities", - "-I./libs/connectivity-utilities/JSON_parser", - "-I./libs/connectivity-utilities/cy_log", - "-I./libs/connectivity-utilities/cy_string", - "-I./libs/connectivity-utilities/linked_list", - "-I./libs/connectivity-utilities/network", - "-I./libs/core-lib", - "-I./libs/core-lib/include", - "-I./libs/freertos", - "-I./libs/freertos/Source", - "-I./libs/freertos/Source/include", - "-I./libs/freertos/Source/portable", - "-I./libs/freertos/Source/portable/COMPONENT_CM4", - "-I./libs/freertos/Source/portable/COMPONENT_CM4/TOOLCHAIN_GCC_ARM", - "-I./libs/kv-store", - "-I./libs/lwip", - "-I./libs/lwip/src", - "-I./libs/lwip/src/include", - "-I./libs/lwip/src/include/lwip/apps", - "-I./libs/lwip/src/include/lwip/priv", - "-I./libs/lwip/src/include/lwip/prot", - "-I./libs/lwip/src/include/netif", - "-I./libs/lwip/src/include/netif/ppp", - "-I./libs/lwip/src/include/netif/ppp/polarssl", - "-I./libs/mbedtls", - "-I./libs/mbedtls/include", - "-I./libs/mbedtls/include/mbedtls", - "-I./libs/mbedtls/include/psa", - "-I./libs/mbedtls/library", - "-I./libs/mtb-hal-cat1", - "-I./libs/mtb-hal-cat1/COMPONENT_CAT1A", - "-I./libs/mtb-hal-cat1/COMPONENT_CAT1A/include", - "-I./libs/mtb-hal-cat1/COMPONENT_CAT1A/include/pin_packages", - "-I./libs/mtb-hal-cat1/COMPONENT_CAT1A/include/triggers", - "-I./libs/mtb-hal-cat1/include", - "-I./libs/mtb-hal-cat1/include_pvt", - "-I./libs/mtb-hal-cat1/source", - "-I./libs/mtb-pdl-cat1", - "-I./libs/mtb-pdl-cat1/cmsis", - "-I./libs/mtb-pdl-cat1/cmsis/include", - "-I./libs/mtb-pdl-cat1/devices", - "-I./libs/mtb-pdl-cat1/devices/COMPONENT_CAT1A", - "-I./libs/mtb-pdl-cat1/devices/COMPONENT_CAT1A/include", - "-I./libs/mtb-pdl-cat1/devices/COMPONENT_CAT1A/include/ip", - "-I./libs/mtb-pdl-cat1/drivers", - "-I./libs/mtb-pdl-cat1/drivers/include", - "-I./libs/retarget-io", - "-I./libs/secure-sockets", - "-I./libs/secure-sockets/include", - "-I./libs/secure-sockets/include/COMPONENT_FREERTOS", - "-I./libs/secure-sockets/source", - "-I./libs/serial-flash", - "-I./libs/whd-bsp-integration", - "-I./libs/wifi-connection-manager", - "-I./libs/wifi-connection-manager/include", - "-I./libs/wifi-connection-manager/source", - "-I./libs/wifi-connection-manager/source/COMPONENT_43012", - "-I./libs/wifi-connection-manager/source/COMPONENT_MBEDTLS", - "-I./libs/wifi-host-driver", - "-I./libs/wifi-host-driver/WiFi_Host_Driver", - "-I./libs/wifi-host-driver/WiFi_Host_Driver/inc", - "-I./libs/wifi-host-driver/WiFi_Host_Driver/resources", - "-I./libs/wifi-host-driver/WiFi_Host_Driver/resources/clm", - "-I./libs/wifi-host-driver/WiFi_Host_Driver/resources/clm/COMPONENT_43012", - "-I./libs/wifi-host-driver/WiFi_Host_Driver/resources/firmware", - "-I./libs/wifi-host-driver/WiFi_Host_Driver/resources/firmware/COMPONENT_43012", - "-I./libs/wifi-host-driver/WiFi_Host_Driver/resources/nvram", - "-I./libs/wifi-host-driver/WiFi_Host_Driver/resources/nvram/COMPONENT_43012", - "-I./libs/wifi-host-driver/WiFi_Host_Driver/resources/nvram/COMPONENT_43012/COMPONENT_MURATA-1LV", - "-I./libs/wifi-host-driver/WiFi_Host_Driver/resources/resource_imp", - "-I./libs/wifi-host-driver/WiFi_Host_Driver/src", - "-I./libs/wifi-host-driver/WiFi_Host_Driver/src/bus_protocols", - "-I./libs/wifi-host-driver/WiFi_Host_Driver/src/include", - "-I./libs/lwip-network-interface-integration", - "-I./libs/lwip-network-interface-integration/source", - "-I./libs/lwip-network-interface-integration/include", - "-I./ota/config" - ], - "defines": [ - "-DMBEDTLS_USER_CONFIG_FILE=", - "-DCYBSP_WIFI_CAPABLE", - "-DCY_RETARGET_IO_CONVERT_LF_TO_CRLF", - "-DCY_RTOS_AWARE", - "-DPSOC_062_2M", - "-DCY_USING_HAL", - "-DCY_APPNAME_mtb_chip_sdk", - "-DCY8C624ABZI_S2D44", - "-DCY_TARGET_DEVICE=CY8C624ABZI_S2D44", - "-DTARGET_CY8CKIT_062S2_43012", - "-DCY_TARGET_BOARD=CY8CKIT_062S2_43012", - "-DCOMPONENT_43012", - "-DCOMPONENT_BSP_DESIGN_MODUS", - "-DCOMPONENT_CAT1", - "-DCOMPONENT_CAT1A", - "-DCOMPONENT_CM0P_SLEEP", - "-DCOMPONENT_CM4", - "-DCOMPONENT_CY8CKIT_062S2_43012", - "-DCOMPONENT_FREERTOS", - "-DCOMPONENT_HCI_UART", - "-DCOMPONENT_LWIP", - "-DCOMPONENT_MBEDTLS", - "-DCOMPONENT_MURATA_1LV", - "-DCOMPONENT_OTA_MCUBOOT_PSOC", - "-DCOMPONENT_PSOC6HAL", - "-DCOMPONENT_RTOS_AWARE", - "-DCOMPONENT_SOFTFP", - "-DCOMPONENT_WICED_BLE", - "-DNDEBUG", - "-DCY_SUPPORTS_DEVICE_VALIDATION", - "-DCY_CRYPTO_HAL_DISABLE", - "-DCOMPONENT_SECURE_SOCKETS", - "-DCOMPONENT_PSOC6_FREERTOS", - "-DOPTIGA_LIB_EXTERNAL=" - ], - "c_source": [ - "./libs/abstraction-rtos/source/cy_worker_thread.c", - "./libs/anycloud-ota/source/port_support/serial_flash/ota_serial_flash.c", - "./libs/bluetooth-freertos/platform/common/cybt_hci_rx_task.c", - "./libs/bluetooth-freertos/platform/common/cybt_hci_tx_task.c", - "./libs/bluetooth-freertos/platform/common/cybt_host_stack_platform_interface.c", - "./libs/bluetooth-freertos/platform/common/cybt_patchram_download.c", - "./libs/bluetooth-freertos/platform/common/cybt_platform_main.c", - "./libs/bluetooth-freertos/platform/common/cybt_platform_task.c", - "./libs/bluetooth-freertos/platform/common/cybt_platform_trace.c", - "./libs/bluetooth-freertos/platform/common/cybt_prm.c", - "./libs/bluetooth-freertos/platform/debug/cybt_debug_uart.c", - "./libs/bluetooth-freertos/platform/freertos/cybt_platform_freertos.c", - "./libs/clib-support/cy_time.c", - "./libs/connectivity-utilities/JSON_parser/cy_json_parser.c", - "./libs/connectivity-utilities/cy_log/cy_log.c", - "./libs/connectivity-utilities/cy_string/cy_string_utils.c", - "./libs/connectivity-utilities/linked_list/cy_linked_list.c", - "./libs/connectivity-utilities/network/cy_nw_helper_common.c", - "./libs/freertos/Source/croutine.c", - "./libs/freertos/Source/event_groups.c", - "./libs/freertos/Source/list.c", - "./libs/freertos/Source/portable/MemMang/heap_1.c", - "./libs/freertos/Source/portable/MemMang/heap_2.c", - "./libs/freertos/Source/portable/MemMang/heap_3.c", - "./libs/freertos/Source/portable/MemMang/heap_4.c", - "./libs/freertos/Source/portable/MemMang/heap_5.c", - "./libs/freertos/Source/queue.c", - "./libs/freertos/Source/stream_buffer.c", - "./libs/freertos/Source/tasks.c", - "./libs/freertos/Source/timers.c", - "./libs/kv-store/mtb_kvstore.c", - "./libs/lwip/src/api/api_lib.c", - "./libs/lwip/src/api/api_msg.c", - "./libs/lwip/src/api/err.c", - "./libs/lwip/src/api/if_api.c", - "./libs/lwip/src/api/netbuf.c", - "./libs/lwip/src/api/netdb.c", - "./libs/lwip/src/api/netifapi.c", - "./libs/lwip/src/api/sockets.c", - "./libs/lwip/src/api/tcpip.c", - "./libs/lwip/src/core/altcp.c", - "./libs/lwip/src/core/altcp_alloc.c", - "./libs/lwip/src/core/altcp_tcp.c", - "./libs/lwip/src/core/def.c", - "./libs/lwip/src/core/dns.c", - "./libs/lwip/src/core/inet_chksum.c", - "./libs/lwip/src/core/init.c", - "./libs/lwip/src/core/ip.c", - "./libs/lwip/src/core/ipv4/autoip.c", - "./libs/lwip/src/core/ipv4/dhcp.c", - "./libs/lwip/src/core/ipv4/etharp.c", - "./libs/lwip/src/core/ipv4/icmp.c", - "./libs/lwip/src/core/ipv4/igmp.c", - "./libs/lwip/src/core/ipv4/ip4.c", - "./libs/lwip/src/core/ipv4/ip4_addr.c", - "./libs/lwip/src/core/ipv4/ip4_frag.c", - "./libs/lwip/src/core/ipv6/dhcp6.c", - "./libs/lwip/src/core/ipv6/ethip6.c", - "./libs/lwip/src/core/ipv6/icmp6.c", - "./libs/lwip/src/core/ipv6/inet6.c", - "./libs/lwip/src/core/ipv6/ip6.c", - "./libs/lwip/src/core/ipv6/ip6_addr.c", - "./libs/lwip/src/core/ipv6/ip6_frag.c", - "./libs/lwip/src/core/ipv6/mld6.c", - "./libs/lwip/src/core/ipv6/nd6.c", - "./libs/lwip/src/core/mem.c", - "./libs/lwip/src/core/memp.c", - "./libs/lwip/src/core/netif.c", - "./libs/lwip/src/core/pbuf.c", - "./libs/lwip/src/core/raw.c", - "./libs/lwip/src/core/stats.c", - "./libs/lwip/src/core/sys.c", - "./libs/lwip/src/core/tcp.c", - "./libs/lwip/src/core/tcp_in.c", - "./libs/lwip/src/core/tcp_out.c", - "./libs/lwip/src/core/timeouts.c", - "./libs/lwip/src/core/udp.c", - "./libs/lwip/src/netif/bridgeif.c", - "./libs/lwip/src/netif/bridgeif_fdb.c", - "./libs/lwip/src/netif/ethernet.c", - "./libs/lwip/src/netif/zepif.c", - "./libs/mbedtls/library/aes.c", - "./libs/mbedtls/library/aesni.c", - "./libs/mbedtls/library/arc4.c", - "./libs/mbedtls/library/aria.c", - "./libs/mbedtls/library/asn1parse.c", - "./libs/mbedtls/library/asn1write.c", - "./libs/mbedtls/library/base64.c", - "./libs/mbedtls/library/bignum.c", - "./libs/mbedtls/library/blowfish.c", - "./libs/mbedtls/library/camellia.c", - "./libs/mbedtls/library/ccm.c", - "./libs/mbedtls/library/certs.c", - "./libs/mbedtls/library/chacha20.c", - "./libs/mbedtls/library/chachapoly.c", - "./libs/mbedtls/library/cipher.c", - "./libs/mbedtls/library/cipher_wrap.c", - "./libs/mbedtls/library/cmac.c", - "./libs/mbedtls/library/ctr_drbg.c", - "./libs/mbedtls/library/debug.c", - "./libs/mbedtls/library/des.c", - "./libs/mbedtls/library/dhm.c", - "./libs/mbedtls/library/ecdh.c", - "./libs/mbedtls/library/ecdsa.c", - "./libs/mbedtls/library/ecjpake.c", - "./libs/mbedtls/library/ecp.c", - "./libs/mbedtls/library/ecp_curves.c", - "./libs/mbedtls/library/entropy.c", - "./libs/mbedtls/library/entropy_poll.c", - "./libs/mbedtls/library/error.c", - "./libs/mbedtls/library/gcm.c", - "./libs/mbedtls/library/havege.c", - "./libs/mbedtls/library/hkdf.c", - "./libs/mbedtls/library/hmac_drbg.c", - "./libs/mbedtls/library/md.c", - "./libs/mbedtls/library/md2.c", - "./libs/mbedtls/library/md4.c", - "./libs/mbedtls/library/md5.c", - "./libs/mbedtls/library/memory_buffer_alloc.c", - "./libs/mbedtls/library/nist_kw.c", - "./libs/mbedtls/library/oid.c", - "./libs/mbedtls/library/padlock.c", - "./libs/mbedtls/library/pem.c", - "./libs/mbedtls/library/pk.c", - "./libs/mbedtls/library/pk_wrap.c", - "./libs/mbedtls/library/pkcs11.c", - "./libs/mbedtls/library/pkcs12.c", - "./libs/mbedtls/library/pkcs5.c", - "./libs/mbedtls/library/pkparse.c", - "./libs/mbedtls/library/pkwrite.c", - "./libs/mbedtls/library/platform.c", - "./libs/mbedtls/library/platform_util.c", - "./libs/mbedtls/library/poly1305.c", - "./libs/mbedtls/library/psa_crypto.c", - "./libs/mbedtls/library/psa_crypto_se.c", - "./libs/mbedtls/library/psa_crypto_slot_management.c", - "./libs/mbedtls/library/psa_crypto_storage.c", - "./libs/mbedtls/library/psa_its_file.c", - "./libs/mbedtls/library/ripemd160.c", - "./libs/mbedtls/library/rsa.c", - "./libs/mbedtls/library/rsa_internal.c", - "./libs/mbedtls/library/sha1.c", - "./libs/mbedtls/library/sha256.c", - "./libs/mbedtls/library/sha512.c", - "./libs/mbedtls/library/ssl_cache.c", - "./libs/mbedtls/library/ssl_ciphersuites.c", - "./libs/mbedtls/library/ssl_cli.c", - "./libs/mbedtls/library/ssl_cookie.c", - "./libs/mbedtls/library/ssl_msg.c", - "./libs/mbedtls/library/ssl_srv.c", - "./libs/mbedtls/library/ssl_ticket.c", - "./libs/mbedtls/library/ssl_tls.c", - "./libs/mbedtls/library/ssl_tls13_keys.c", - "./libs/mbedtls/library/threading.c", - "./libs/mbedtls/library/timing.c", - "./libs/mbedtls/library/version.c", - "./libs/mbedtls/library/version_features.c", - "./libs/mbedtls/library/x509.c", - "./libs/mbedtls/library/x509_create.c", - "./libs/mbedtls/library/x509_crl.c", - "./libs/mbedtls/library/x509_crt.c", - "./libs/mbedtls/library/x509_csr.c", - "./libs/mbedtls/library/x509write_crt.c", - "./libs/mbedtls/library/x509write_csr.c", - "./libs/mbedtls/library/xtea.c", - "./libs/mtb-hal-cat1/source/cyhal_adc_mic.c", - "./libs/mtb-hal-cat1/source/cyhal_adc_sar.c", - "./libs/mtb-hal-cat1/source/cyhal_analog_common.c", - "./libs/mtb-hal-cat1/source/cyhal_audio_common.c", - "./libs/mtb-hal-cat1/source/cyhal_clock.c", - "./libs/mtb-hal-cat1/source/cyhal_comp.c", - "./libs/mtb-hal-cat1/source/cyhal_comp_ctb.c", - "./libs/mtb-hal-cat1/source/cyhal_comp_lp.c", - "./libs/mtb-hal-cat1/source/cyhal_crc.c", - "./libs/mtb-hal-cat1/source/cyhal_crypto_common.c", - "./libs/mtb-hal-cat1/source/cyhal_dac.c", - "./libs/mtb-hal-cat1/source/cyhal_dma.c", - "./libs/mtb-hal-cat1/source/cyhal_dma_dmac.c", - "./libs/mtb-hal-cat1/source/cyhal_dma_dw.c", - "./libs/mtb-hal-cat1/source/cyhal_ezi2c.c", - "./libs/mtb-hal-cat1/source/cyhal_flash.c", - "./libs/mtb-hal-cat1/source/cyhal_gpio.c", - "./libs/mtb-hal-cat1/source/cyhal_hwmgr.c", - "./libs/mtb-hal-cat1/source/cyhal_i2c.c", - "./libs/mtb-hal-cat1/source/cyhal_i2s.c", - "./libs/mtb-hal-cat1/source/cyhal_interconnect.c", - "./libs/mtb-hal-cat1/source/cyhal_irq_psoc.c", - "./libs/mtb-hal-cat1/source/cyhal_keyscan.c", - "./libs/mtb-hal-cat1/source/cyhal_lptimer.c", - "./libs/mtb-hal-cat1/source/cyhal_opamp.c", - "./libs/mtb-hal-cat1/source/cyhal_pdmpcm.c", - "./libs/mtb-hal-cat1/source/cyhal_pwm.c", - "./libs/mtb-hal-cat1/source/cyhal_qspi.c", - "./libs/mtb-hal-cat1/source/cyhal_quaddec.c", - "./libs/mtb-hal-cat1/source/cyhal_rtc.c", - "./libs/mtb-hal-cat1/source/cyhal_scb_common.c", - "./libs/mtb-hal-cat1/source/cyhal_sdhc.c", - "./libs/mtb-hal-cat1/source/cyhal_spi.c", - "./libs/mtb-hal-cat1/source/cyhal_syspm.c", - "./libs/mtb-hal-cat1/source/cyhal_system.c", - "./libs/mtb-hal-cat1/source/cyhal_tcpwm_common.c", - "./libs/mtb-hal-cat1/source/cyhal_tdm.c", - "./libs/mtb-hal-cat1/source/cyhal_timer.c", - "./libs/mtb-hal-cat1/source/cyhal_trng.c", - "./libs/mtb-hal-cat1/source/cyhal_uart.c", - "./libs/mtb-hal-cat1/source/cyhal_udb_sdio.c", - "./libs/mtb-hal-cat1/source/cyhal_usb_dev.c", - "./libs/mtb-hal-cat1/source/cyhal_utils.c", - "./libs/mtb-hal-cat1/source/cyhal_utils_psoc.c", - "./libs/mtb-hal-cat1/source/cyhal_wdt.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_adcmic.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_ble_clk.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_btss.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_canfd.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_aes_v1.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_aes_v2.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_cmac_v1.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_cmac_v2.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_crc_v1.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_crc_v2.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_des_v1.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_des_v2.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_ecc_domain_params.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_ecc_ecdsa.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_ecc_key_gen.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_ecc_nist_p.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_hmac_v1.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_hmac_v2.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_hw.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_hw_v1.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_mem_v1.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_mem_v2.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_prng_v1.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_prng_v2.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_rsa.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_sha_v1.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_sha_v2.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_trng_v1.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_trng_v2.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_core_vu.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_crypto_server.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_cryptolite.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_csd.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_ctb.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_ctdac.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_dma.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_dmac.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_efuse.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_efuse_v3.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_flash.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_gpio.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_i2s.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_ipc_bt.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_ipc_drv.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_ipc_pipe.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_ipc_sema.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_keyscan.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_lin.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_lpcomp.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_lvd.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_mcwdt.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_pd_pdcm.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_pd_ppu.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_pdm_pcm.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_pdm_pcm_v2.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_pra.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_pra_cfg.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_profile.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_prot.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_rtc.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_sar.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_scb_common.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_scb_ezi2c.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_scb_i2c.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_scb_spi.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_scb_uart.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_sd_host.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_seglcd.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_smartio.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_smif.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_smif_memslot.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_smif_sfdp.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_sysanalog.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_sysclk.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_sysclk_v2.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_sysint.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_sysint_v2.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_syslib.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_syspm.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_syspm_v2.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_systick.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_systick_v2.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_tcpwm_counter.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_tcpwm_pwm.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_tcpwm_quaddec.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_tcpwm_shiftreg.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_tdm.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_trigmux.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_usbfs_dev_drv.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_usbfs_dev_drv_io.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_usbfs_dev_drv_io_dma.c", - "./libs/mtb-pdl-cat1/drivers/source/cy_wdt.c", - "./libs/mtb-pdl-cat1/drivers/source/ppu_v1.c", - "./libs/retarget-io/cy_retarget_io.c", - "./libs/secure-sockets/source/cy_pkcs_psa_logging.c", - "./libs/secure-sockets/source/cy_tls_weak.c", - "./libs/serial-flash/cy_serial_flash_prog.c", - "./libs/serial-flash/cy_serial_flash_qspi.c", - "./libs/whd-bsp-integration/cybsp_wifi.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/resources/resource_imp/whd_resources.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/bus_protocols/whd_bus.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/bus_protocols/whd_bus_common.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/bus_protocols/whd_bus_m2m_protocol.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/bus_protocols/whd_bus_sdio_protocol.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/bus_protocols/whd_bus_spi_protocol.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_ap.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_buffer_api.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_cdc_bdc.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_chip.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_chip_constants.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_clm.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_debug.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_events.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_logging.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_management.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_network_if.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_resource_if.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_sdpcm.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_thread.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_utils.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_wifi.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_wifi_api.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/src/whd_wifi_p2p.c", - "./libs/lwip-network-interface-integration/source/cy_network_mw_core.c", - "./libs/lwip-network-interface-integration/source/cy_lwip_dhcp_server.c", - "./libs/clib-support/TOOLCHAIN_GCC_ARM/cy_clib_support_newlib.c", - "./libs/TARGET_CY8CKIT-062S2-43012/bluetooth/cybsp_bt_config.c", - "./libs/TARGET_CY8CKIT-062S2-43012/cybsp.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg_clocks.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg_connectivity_bt.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg_peripherals.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg_pins.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg_qspi_memslot.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg_routing.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg_system.c", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_CM4/system_psoc6_cm4.c", - "./libs/abstraction-rtos/source/COMPONENT_FREERTOS/cyabs_freertos_helpers.c", - "./libs/abstraction-rtos/source/COMPONENT_FREERTOS/cyabs_rtos_freertos.c", - "./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/bootutil/src/bootutil_misc.c", - "./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/cy_flash_map.c", - "./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/cy_flash_psoc6.c", - "./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/flash_qspi/flash_qspi.c", - "./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/mem_config/mem_config_sfdp.c", - "./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/ota_flash_map.c", - "./libs/anycloud-ota/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/cy_flash_pal/ota_flash_xip_map.c", - "./libs/bluetooth-freertos/firmware/COMPONENT_43012/COMPONENT_MURATA-1LV/COMPONENT_HCI-UART/w_bt_firmware_controller.c", - "./libs/clib-support/COMPONENT_FREERTOS/cy_mutex_pool.c", - "./libs/connectivity-utilities/network/COMPONENT_LWIP/cy_nw_helper.c", - "./libs/freertos/Source/portable/COMPONENT_CM4/TOOLCHAIN_GCC_ARM/port.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_01_104_m_csp_ble.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_01_104_m_csp_ble_usb.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_01_116_bga_ble.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_01_116_bga_usb.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_01_124_bga.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_01_124_bga_sip.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_01_43_smt.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_01_68_qfn_ble.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_01_80_wlcsp.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_02_100_wlcsp.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_02_124_bga.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_02_128_tqfp.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_02_68_qfn.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_03_100_tqfp.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_03_49_wlcsp.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_03_68_qfn.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_04_64_tqfp.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_04_68_qfn.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_04_80_tqfp.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/triggers/cyhal_triggers_psoc6_01.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/triggers/cyhal_triggers_psoc6_02.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/triggers/cyhal_triggers_psoc6_03.c", - "./libs/mtb-hal-cat1/COMPONENT_CAT1A/source/triggers/cyhal_triggers_psoc6_04.c", - "./libs/mtb-pdl-cat1/devices/COMPONENT_CAT1A/source/cy_device.c", - "./libs/psoc6cm0p/COMPONENT_CM0P_SLEEP/psoc6_01_cm0p_sleep.c", - "./libs/psoc6cm0p/COMPONENT_CM0P_SLEEP/psoc6_02_cm0p_sleep.c", - "./libs/psoc6cm0p/COMPONENT_CM0P_SLEEP/psoc6_03_cm0p_sleep.c", - "./libs/psoc6cm0p/COMPONENT_CM0P_SLEEP/psoc6_04_cm0p_sleep.c", - "./libs/secure-sockets/source/COMPONENT_LWIP/cy_secure_sockets.c", - "./libs/secure-sockets/source/COMPONENT_MBEDTLS/cy_tls.c", - "./libs/secure-sockets/source/COMPONENT_MBEDTLS/iot_crypto.c", - "./libs/whd-bsp-integration/COMPONENT_LWIP/cy_network_buffer_lwip.c", - "./libs/wifi-connection-manager/source/cy_wcm.c", - "./libs/wifi-connection-manager/source/COMPONENT_MBEDTLS/cy_wps_aes_ctr_ccm.c", - "./libs/wifi-connection-manager/source/COMPONENT_MBEDTLS/cy_wps_crypto.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/resources/clm/COMPONENT_43012/43012C0-mfgtest_clm_blob.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/resources/clm/COMPONENT_43012/43012C0_clm_blob.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/resources/firmware/COMPONENT_43012/43012C0-mfgtest_bin.c", - "./libs/wifi-host-driver/WiFi_Host_Driver/resources/firmware/COMPONENT_43012/43012C0_bin.c", - "./arch/sys_arch.c" - ], - "cxx_source": [], - "asm_source": [ - "./libs/mtb-pdl-cat1/drivers/source/TOOLCHAIN_GCC_ARM/cy_syslib_gcc.S", - "./libs/TARGET_CY8CKIT-062S2-43012/COMPONENT_CM4/TOOLCHAIN_GCC_ARM/startup_psoc6_02_cm4.S" - ], - "libs": [ - "./libs/btstack/stack/COMPONENT_WICED_BLE/COMPONENT_CM4/COMPONENT_SOFTFP/TOOLCHAIN_GCC_ARM/libbtstack.a" - ], - "objs": [] -} diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg.c b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg.c new file mode 100644 index 00000000000000..ee208401b46edc --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg.c @@ -0,0 +1,50 @@ +/******************************************************************************* + * File Name: cycfg.c + * + * Description: + * Wrapper function to initialize all generated code. + * This file was automatically generated and should not be modified. + * Configurator Backend 3.10.0 + * device-db 4.100.0.4304 + * mtb-pdl-cat1 3.9.0.29592 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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 "cycfg.h" + +/* This function is provided for compatibility with older 2.X style projects. */ +void init_cycfg_all(void) +{ + cycfg_config_init(); + cycfg_config_reservations(); +} +void cycfg_config_init(void) +{ + init_cycfg_system(); + init_cycfg_clocks(); + init_cycfg_routing(); + init_cycfg_peripherals(); + init_cycfg_pins(); +} +void cycfg_config_reservations(void) +{ + reserve_cycfg_system(); + reserve_cycfg_clocks(); + reserve_cycfg_pins(); +} diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg.h b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg.h new file mode 100644 index 00000000000000..14fd49c29027d6 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg.h @@ -0,0 +1,52 @@ +/******************************************************************************* + * File Name: cycfg.h + * + * Description: + * Simple wrapper header containing all generated files. + * This file was automatically generated and should not be modified. + * Configurator Backend 3.10.0 + * device-db 4.100.0.4304 + * mtb-pdl-cat1 3.9.0.29592 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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(CYCFG_H) +#define CYCFG_H + +#if defined(__cplusplus) +extern "C" { +#endif + +#include "cycfg_clocks.h" +#include "cycfg_connectivity_bt.h" +#include "cycfg_notices.h" +#include "cycfg_peripherals.h" +#include "cycfg_pins.h" +#include "cycfg_routing.h" +#include "cycfg_system.h" + +void init_cycfg_all(void); +void cycfg_config_init(void); +void cycfg_config_reservations(void); + +#if defined(__cplusplus) +} +#endif + +#endif /* CYCFG_H */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg.timestamp b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg.timestamp new file mode 100644 index 00000000000000..ef0be7a1d73ca9 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg.timestamp @@ -0,0 +1,28 @@ +/******************************************************************************* +* File Name: cycfg.timestamp +* +* Description: +* Sentinel file for determining if generated source is up to date. +* This file was automatically generated and should not be modified. +* Configurator Backend 3.10.0 +* device-db 4.100.0.4304 +* mtb-pdl-cat1 3.9.0.29592 +* +******************************************************************************** +* Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or +* an affiliate of Cypress Semiconductor Corporation. +* SPDX-License-Identifier: Apache-2.0 +* +* 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. +********************************************************************************/ + diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_capsense.c b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_capsense.c new file mode 100644 index 00000000000000..aad075c61d2607 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_capsense.c @@ -0,0 +1,920 @@ +/******************************************************************************* + * File Name: cycfg_capsense.c + * + * Description: + * CAPSENSE Middleware configuration + * This file should not be modified. It was automatically generated by + * CAPSENSE Configurator 6.10.0.3796 + * + ******************************************************************************** + * Copyright 2024, Cypress Semiconductor Corporation (an Infineon company) + * or an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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 "cycfg_capsense.h" + +/* This enables code only when the CAPSENSE(TM) Middleware is present in the project + * or the information about the Middleware presence cannot be obtained. + */ +#if (defined(COMPONENT_MW_CAPSENSE) || !defined(COMPONENT_MW_CORE_MAKE)) + +#if !defined(CY_DISABLE_CAPSENSE) + +#if (CY_CAPSENSE_CORE == __CORTEX_M) + +#ifndef CSD_CMODPADS_PORT +#define CSD_CMODPADS_PORT 0xFF +#endif +#ifndef CSD_CMODPADS_PIN +#define CSD_CMODPADS_PIN 0xFF +#endif +#ifndef CSD_CSH_TANKPADS_PORT +#define CSD_CSH_TANKPADS_PORT 0xFF +#endif +#ifndef CSD_CSH_TANKPADS_PIN +#define CSD_CSH_TANKPADS_PIN 0xFF +#endif +#ifndef CSD_CSHIELDPADS_PORT +#define CSD_CSHIELDPADS_PORT 0xFF +#endif +#ifndef CSD_CSHIELDPADS_PIN +#define CSD_CSHIELDPADS_PIN 0xFF +#endif +#ifndef CSD_VREF_EXT_PORT +#define CSD_VREF_EXT_PORT 0xFF +#endif +#ifndef CSD_VREF_EXT_PIN +#define CSD_VREF_EXT_PIN 0xFF +#endif + +static cy_stc_capsense_internal_context_t cy_capsense_internalContext; + +#if (CY_CAPSENSE_MW_VERSION >= 400) +static cy_stc_capsense_active_scan_sns_t cy_capsense_activeScanSns; +#else +static cy_stc_active_scan_sns_t cy_capsense_activeScanSns; +#endif + +#if (CY_CAPSENSE_DEBOUNCE_SIZE > 0) +static uint8_t cy_capsense_debounce[CY_CAPSENSE_DEBOUNCE_SIZE] = { 0 }; +#endif + +#if (CY_CAPSENSE_NOISE_ENVELOPE_SIZE > 0) +static cy_stc_capsense_smartsense_csd_noise_envelope_t cy_capsense_noiseEnvelope[CY_CAPSENSE_NOISE_ENVELOPE_SIZE]; +#endif + +#if (CY_CAPSENSE_RAW_HISTORY_SIZE > 0) +static uint16_t cy_capsense_rawFilterHistory[CY_CAPSENSE_RAW_HISTORY_SIZE] = { 0 }; +#endif + +#if (CY_CAPSENSE_RAW_ALP_HISTORY_SIZE > 0) +static uint16_t cy_capsense_rawAlpFilterHistory[CY_CAPSENSE_RAW_ALP_HISTORY_SIZE] = { 0 }; +#endif + +#if (CY_CAPSENSE_IIR_HISTORY_LOW_SIZE > 0) +static uint8_t cy_capsense_iirHistoryLow[CY_CAPSENSE_IIR_HISTORY_LOW_SIZE] = { 0 }; +#endif + +#if (CY_CAPSENSE_POSITION_FILTER_HISTORY_SIZE > 0) +static cy_stc_capsense_position_t cy_capsense_positionFilterHistory[CY_CAPSENSE_POSITION_FILTER_HISTORY_SIZE]; +#endif + +#if (CY_CAPSENSE_TOUCH_FILTER_HISTORY_SIZE > 0) +static cy_stc_capsense_touch_t cy_capsense_touchFilterHistory[CY_CAPSENSE_TOUCH_FILTER_HISTORY_SIZE] = {}; +#endif + +#if (CY_CAPSENSE_DIPLEX_SIZE > 0) +static const uint8_t cy_capsense_diplexTable[CY_CAPSENSE_DIPLEX_SIZE] = {}; +#endif + +#if (CY_CAPSENSE_CSD_TOUCHPAD_MAX_SENSORS_SIZE > 0) +static uint16_t cy_capsense_csdTouchBuffer[CY_CAPSENSE_CSD_TOUCHPAD_MAX_SENSORS_SIZE] = { 0 }; +#endif + +#if (CY_CAPSENSE_CSX_TOUCH_BUFFER_ENABLE > 0) +static cy_stc_capsense_csx_touch_buffer_t cy_capsense_csxTouchBuffer; +#endif + +#if (CY_CAPSENSE_CSX_TOUCH_HISTORY_SIZE > 0) +static cy_stc_capsense_csx_touch_history_t cy_capsense_csxTouchHistory[CY_CAPSENSE_CSX_TOUCH_HISTORY_SIZE] = {}; +#endif + +#if (CY_CAPSENSE_BALLISTIC_WIDGET_COUNT > 0) +static cy_stc_capsense_ballistic_context_t cy_capsense_ballisticContext[CY_CAPSENSE_BALLISTIC_WIDGET_COUNT]; +#endif + +#if (CY_CAPSENSE_GESTURE_WIDGET_COUNT > 0) +static cy_stc_capsense_gesture_context_t cy_capsense_gestureContext[CY_CAPSENSE_GESTURE_WIDGET_COUNT]; +#endif + +#if (CY_CAPSENSE_BIST_SUPPORTED) +#if (CY_CAPSENSE_BIST_EN != 0) +static uint16_t cy_capsense_bslnInv[CY_CAPSENSE_SENSOR_COUNT * CY_CAPSENSE_MFS_CH_NUMBER]; +static uint32_t cy_capsense_eltdCap[CY_CAPSENSE_ELTD_COUNT]; +static uint16_t cy_capsense_wdgtCrc[CY_CAPSENSE_WIDGET_COUNT]; +#endif +#endif + +static const cy_stc_capsense_common_config_t cy_capsense_commonConfig = +{ + .cpuClkHz = CY_CAPSENSE_CPU_CLK, + .periClkHz = CY_CAPSENSE_PERI_CLK, + .vdda = CY_CAPSENSE_VDDA_MV, + .numPin = CY_CAPSENSE_PIN_COUNT, + .numSns = CY_CAPSENSE_SENSOR_COUNT, + .numWd = CY_CAPSENSE_TOTAL_WIDGET_COUNT, +#if (CY_CAPSENSE_MW_VERSION < 400) + .csdEn = CY_CAPSENSE_ENABLE, + .csxEn = CY_CAPSENSE_ENABLE, +#if (CY_CAPSENSE_MW_VERSION < 300) + .mfsEn = CY_CAPSENSE_DISABLE, +#endif +#if (CY_CAPSENSE_BIST_SUPPORTED) + .bistEn = CY_CAPSENSE_DISABLE, +#endif + .positionFilterEn = CY_CAPSENSE_DISABLE, +#endif + .periDividerType = (uint8_t)CY_CAPSENSE_PERI_DIV_TYPE, + .periDividerIndex = CY_CAPSENSE_PERI_DIV_INDEX, + .analogWakeupDelay = 25u, + .ssIrefSource = CY_CAPSENSE_IREF_SRSS, + .ssVrefSource = CY_CAPSENSE_VREF_SRSS, + .proxTouchCoeff = 300u, + .swSensorAutoResetEn = CY_CAPSENSE_DISABLE, + .portCmodPadNum = CSD_CMODPADS_PORT, + .pinCmodPad = CSD_CMODPADS_PIN, + .portCshPadNum = CSD_CSH_TANKPADS_PORT, + .pinCshPad = CSD_CSH_TANKPADS_PIN, + .portShieldPadNum = CSD_CSHIELDPADS_PORT, + .pinShieldPad = CSD_CSHIELDPADS_PIN, + .portVrefExtPadNum = CSD_VREF_EXT_PORT, + .pinVrefExtPad = CSD_VREF_EXT_PIN, + .portCmodNum = Cmod_PORT_NUM, + .idacGainTable = { + {0x01000000u, 37500u}, + {0x03000000u, 75000u}, + {0x01400000u, 300000u}, + {0x03400000u, 600000u}, + {0x01800000u, 2400000u}, + {0x03800000u, 4800000u}, + }, + .ptrCsdBase = CSD0, + .ptrCsdContext = &cy_csd_0_context, + .portCmod = Cmod_PORT, + .portCsh = NULL, + .portCintA = CintA_PORT, + .portCintB = CintB_PORT, + .pinCmod = Cmod_PIN, + .portCshNum = 0u, + .pinCsh = 0u, + .pinCintA = CintA_PIN, + .pinCintB = CintB_PIN, +#if (CY_CAPSENSE_MW_VERSION < 400) + .csdShieldEn = CY_CAPSENSE_DISABLE, +#endif + .csdInactiveSnsConnection = CY_CAPSENSE_SNS_CONNECTION_GROUND, +#if (CY_CAPSENSE_MW_VERSION >= 300) + .csxInactiveSnsConnection = CY_CAPSENSE_SNS_CONNECTION_GROUND, +#endif + .csdShieldDelay = CY_CAPSENSE_SH_DELAY_0NS, + .csdVref = 0u, + .csdRConst = 1000u, +#if (CY_CAPSENSE_MW_VERSION < 400) + .csdCTankShieldEn = CY_CAPSENSE_DISABLE, +#endif + .csdShieldNumPin = 0u, + .csdShieldSwRes = CY_CAPSENSE_SHIELD_SW_RES_MEDIUM, + .csdInitSwRes = CY_CAPSENSE_INIT_SW_RES_MEDIUM, + .csdChargeTransfer = CY_CAPSENSE_IDAC_SOURCING, + .csdRawTarget = 85u, +#if (CY_CAPSENSE_MW_VERSION < 400) + .csdAutotuneEn = CY_CAPSENSE_CSD_SS_HWTH_EN, + .csdIdacAutocalEn = CY_CAPSENSE_ENABLE, + .csdIdacAutoGainEn = CY_CAPSENSE_ENABLE, +#endif + .csdCalibrationError = 10u, + .csdIdacGainInitIndex = 4u, + .csdIdacMin = 20u, +#if (CY_CAPSENSE_MW_VERSION < 400) + .csdIdacCompEn = CY_CAPSENSE_ENABLE, +#endif + .csdFineInitTime = 10u, +#if (CY_CAPSENSE_MW_VERSION < 400) + .csdIdacRowColAlignEn = CY_CAPSENSE_ENABLE, +#endif + .csdMfsDividerOffsetF1 = 1u, + .csdMfsDividerOffsetF2 = 2u, + .csxRawTarget = 40u, +#if (CY_CAPSENSE_MW_VERSION < 400) + .csxIdacGainInitIndex = 2u, + .csxIdacAutocalEn = CY_CAPSENSE_ENABLE, +#endif + .csxCalibrationError = 20u, + .csxFineInitTime = 10u, + .csxInitSwRes = CY_CAPSENSE_INIT_SW_RES_MEDIUM, + .csxScanSwRes = CY_CAPSENSE_INIT_SW_RES_LOW, + .csxInitShieldSwRes = CY_CAPSENSE_SHIELD_SW_RES_MEDIUM, + .csxScanShieldSwRes = CY_CAPSENSE_SHIELD_SW_RES_LOW, + .csxMfsDividerOffsetF1 = 1u, + .csxMfsDividerOffsetF2 = 2u, +}; + +#if (CY_CAPSENSE_MW_VERSION < 300) +static const cy_stc_capsense_fptr_config_t cy_capsense_fptrConfig = { +#if (CY_CAPSENSE_CSD_EN == 0) + .fptrCSDSetupWidget = NULL, + .fptrCSDScan = NULL, + .fptrDpProcessCsdWidgetRawCounts = NULL, + .fptrDpProcessCsdWidgetStatus = NULL, + .fptrCSDDisableMode = NULL, + .fptrCSDInitialize = NULL, + .fptrCSDScanISR = NULL, +#else + .fptrCSDSetupWidget = &Cy_CapSense_CSDSetupWidget, + .fptrCSDScan = &Cy_CapSense_CSDScan, + .fptrDpProcessCsdWidgetRawCounts = &Cy_CapSense_DpProcessCsdWidgetRawCounts, + .fptrDpProcessCsdWidgetStatus = &Cy_CapSense_DpProcessCsdWidgetStatus, + .fptrCSDDisableMode = &Cy_CapSense_CSDDisableMode, + .fptrCSDInitialize = &Cy_CapSense_CSDInitialize, + .fptrCSDScanISR = &Cy_CapSense_CSDScanISR, +#endif + +#if (CY_CAPSENSE_CSX_EN == 0) + .fptrCSXSetupWidget = NULL, + .fptrCSXScan = NULL, + .fptrDpProcessCsxWidgetRawCounts = NULL, + .fptrDpProcessCsxWidgetStatus = NULL, + .fptrCSXInitialize = NULL, + .fptrCSXDisableMode = NULL, + .fptrCSXScanISR = NULL, +#else + .fptrCSXSetupWidget = &Cy_CapSense_CSXSetupWidget, + .fptrCSXScan = &Cy_CapSense_CSXScan, + .fptrDpProcessCsxWidgetRawCounts = &Cy_CapSense_DpProcessCsxWidgetRawCounts, + .fptrDpProcessCsxWidgetStatus = &Cy_CapSense_DpProcessCsxWidgetStatus, + .fptrCSXInitialize = &Cy_CapSense_CSXInitialize, + .fptrCSXDisableMode = &Cy_CapSense_CSXDisableMode, + .fptrCSXScanISR = &Cy_CapSense_CSXScanISR, +#endif + +#if (CY_CAPSENSE_ADAPTIVE_FILTER_EN == 0) + .fptrAdaptiveFilterInitializeLib = NULL, + .fptrAdaptiveFilterRunLib = NULL, +#else + .fptrAdaptiveFilterInitializeLib = &Cy_CapSense_AdaptiveFilterInitialize_Lib, + .fptrAdaptiveFilterRunLib = &Cy_CapSense_AdaptiveFilterRun_Lib, +#endif + +#if (CY_CAPSENSE_BALLISTIC_MULTIPLIER_EN == 0) + .fptrBallisticMultiplierLib = NULL, +#else + .fptrBallisticMultiplierLib = &Cy_CapSense_BallisticMultiplier_Lib, +#endif + +#if (CY_CAPSENSE_RAWCOUNT_FILTER_EN == 0) + .fptrInitializeAllFilters = NULL, + .fptrFtRunEnabledFiltersInternal = NULL, +#else + .fptrInitializeAllFilters = &Cy_CapSense_InitializeAllFilters, + .fptrFtRunEnabledFiltersInternal = &Cy_CapSense_FtRunEnabledFiltersInternal, +#endif + +#if (CY_CAPSENSE_CSD_POSITION_FILTER_EN == 0) + .fptrProcessPositionFilters = NULL, +#else + .fptrProcessPositionFilters = &Cy_CapSense_ProcessPositionFilters, +#endif + +#if ((CY_CAPSENSE_CSX_POSITION_FILTER_EN == 0) && (CY_CAPSENSE_CSD_POSITION_FILTER_EN == 0)) + .fptrRunPositionFilters = NULL, + .fptrInitPositionFilters = NULL, +#else + .fptrRunPositionFilters = &Cy_CapSense_RunPositionFilters, + .fptrInitPositionFilters = &Cy_CapSense_InitPositionFilters, +#endif + +#if ((CY_CAPSENSE_CSD_BUTTON_EN == 0) && (CY_CAPSENSE_CSX_BUTTON_EN == 0) && (CY_CAPSENSE_CSX_MATRIX_EN == 0)) + .fptrDpProcessButton = NULL, +#else + .fptrDpProcessButton = &Cy_CapSense_DpProcessButton, +#endif + +#if ((CY_CAPSENSE_CSD_SLIDER_EN == 0) && (CY_CAPSENSE_CSX_SLIDER_EN == 0)) + .fptrDpProcessSlider = NULL, +#else + .fptrDpProcessSlider = &Cy_CapSense_DpProcessSlider, +#endif + +#if (CY_CAPSENSE_CSD_MATRIX_EN == 0) + .fptrDpProcessCsdMatrix = NULL, +#else + .fptrDpProcessCsdMatrix = &Cy_CapSense_DpProcessCsdMatrix, +#endif + +#if (CY_CAPSENSE_CSD_TOUCHPAD_EN == 0) + .fptrDpProcessCsdTouchpad = NULL, +#else + .fptrDpProcessCsdTouchpad = &Cy_CapSense_DpProcessCsdTouchpad, +#endif + +#if (CY_CAPSENSE_CSD_PROXIMITY_EN == 0) + .fptrDpProcessProximity = NULL, +#else + .fptrDpProcessProximity = &Cy_CapSense_DpProcessProximity, +#endif + +#if (CY_CAPSENSE_CSX_TOUCHPAD_EN == 0) + .fptrDpProcessCsxTouchpad = NULL, +#else + .fptrDpProcessCsxTouchpad = &Cy_CapSense_DpProcessCsxTouchpad, +#endif + +#if (CY_CAPSENSE_ADVANCED_CENTROID_5X5_EN == 0) + .fptrDpAdvancedCentroidTouchpad = NULL, +#else + .fptrDpAdvancedCentroidTouchpad = &Cy_CapSense_DpAdvancedCentroidTouchpad, +#endif + +#if ((CY_CAPSENSE_CSD_CALIBRATION_EN == 0) && (CY_CAPSENSE_SMARTSENSE_FULL_EN == 0)) + .fptrCSDCalibrateWidget = NULL, + .fptrCalibrateAllCsdWidgets = NULL, +#else + .fptrCSDCalibrateWidget = &Cy_CapSense_CSDCalibrateWidget, + .fptrCalibrateAllCsdWidgets = &Cy_CapSense_CalibrateAllCsdWidgets, +#endif + +#if (CY_CAPSENSE_CSX_CALIBRATION_EN == 0) + .fptrCalibrateAllCsxWidgets = NULL, +#else + .fptrCalibrateAllCsxWidgets = &Cy_CapSense_CalibrateAllCsxWidgets, +#endif + +#if (CY_CAPSENSE_SMARTSENSE_FULL_EN == 0) + .fptrRunNoiseEnvelopeLib = NULL, + .fptrDpUpdateThresholds = NULL, + .fptrInitializeNoiseEnvelopeLib = NULL, +#else + .fptrRunNoiseEnvelopeLib = &Cy_CapSense_RunNoiseEnvelope_Lib, + .fptrDpUpdateThresholds = &Cy_CapSense_DpUpdateThresholds, + .fptrInitializeNoiseEnvelopeLib = &Cy_CapSense_InitializeNoiseEnvelope_Lib, +#endif + +#if ((CY_CAPSENSE_SMARTSENSE_HW_EN == 0) && (CY_CAPSENSE_SMARTSENSE_FULL_EN == 0)) + .fptrSsAutoTune = NULL, +#else + .fptrSsAutoTune = &Cy_CapSense_SsAutoTune, +#endif + +#if (CY_CAPSENSE_BIST_SUPPORTED) +#if (CY_CAPSENSE_BIST_EN == 0) + .fptrBistInitialize = NULL, + .fptrBistDisableMode = NULL, + .fptrBistDsInitialize = NULL, +#else + .fptrBistInitialize = &Cy_CapSense_BistInitialize, + .fptrBistDisableMode = &Cy_CapSense_BistDisableMode, + .fptrBistDsInitialize = &Cy_CapSense_BistDsInitialize, +#endif +#endif +}; +#endif + +static const cy_stc_capsense_pin_config_t cy_capsense_pinConfig[CY_CAPSENSE_PIN_COUNT] = { + { + /* Button0_Rx0 */ + Button0_Rx0_PORT, + Button0_Rx0_PIN, + }, + { + /* Button0_Tx */ + Button0_Tx_PORT, + Button0_Tx_PIN, + }, + { + /* Button1_Rx0 */ + Button1_Rx0_PORT, + Button1_Rx0_PIN, + }, + { + /* Button1_Tx */ + Button1_Tx_PORT, + Button1_Tx_PIN, + }, + { + /* LinearSlider0_Sns0 */ + LinearSlider0_Sns0_PORT, + LinearSlider0_Sns0_PIN, + }, + { + /* LinearSlider0_Sns1 */ + LinearSlider0_Sns1_PORT, + LinearSlider0_Sns1_PIN, + }, + { + /* LinearSlider0_Sns2 */ + LinearSlider0_Sns2_PORT, + LinearSlider0_Sns2_PIN, + }, + { + /* LinearSlider0_Sns3 */ + LinearSlider0_Sns3_PORT, + LinearSlider0_Sns3_PIN, + }, + { + /* LinearSlider0_Sns4 */ + LinearSlider0_Sns4_PORT, + LinearSlider0_Sns4_PIN, + }, +}; + +#if (CY_CAPSENSE_SHIELD_PIN_COUNT > 0) +static const cy_stc_capsense_pin_config_t cy_capsense_shieldPinConfig[CY_CAPSENSE_SHIELD_PIN_COUNT] = {}; +#endif + +#if (CY_CAPSENSE_ELTD_COUNT > 0) +static const cy_stc_capsense_electrode_config_t cy_capsense_electrodeConfig[CY_CAPSENSE_ELTD_COUNT] = { + { + /* Button0_Rx0 */ + .ptrPin = &cy_capsense_pinConfig[0u], + .type = (uint8_t) CY_CAPSENSE_ELTD_TYPE_MUT_RX_E, + .numPins = 1u, + }, + { + /* Button0_Tx */ + .ptrPin = &cy_capsense_pinConfig[1u], + .type = (uint8_t) CY_CAPSENSE_ELTD_TYPE_MUT_TX_E, + .numPins = 1u, + }, + { + /* Button1_Rx0 */ + .ptrPin = &cy_capsense_pinConfig[2u], + .type = (uint8_t) CY_CAPSENSE_ELTD_TYPE_MUT_RX_E, + .numPins = 1u, + }, + { + /* Button1_Tx */ + .ptrPin = &cy_capsense_pinConfig[3u], + .type = (uint8_t) CY_CAPSENSE_ELTD_TYPE_MUT_TX_E, + .numPins = 1u, + }, + { + /* LinearSlider0_Sns0 */ + .ptrPin = &cy_capsense_pinConfig[4u], + .type = (uint8_t) CY_CAPSENSE_ELTD_TYPE_SELF_E, + .numPins = 1u, + }, + { + /* LinearSlider0_Sns1 */ + .ptrPin = &cy_capsense_pinConfig[5u], + .type = (uint8_t) CY_CAPSENSE_ELTD_TYPE_SELF_E, + .numPins = 1u, + }, + { + /* LinearSlider0_Sns2 */ + .ptrPin = &cy_capsense_pinConfig[6u], + .type = (uint8_t) CY_CAPSENSE_ELTD_TYPE_SELF_E, + .numPins = 1u, + }, + { + /* LinearSlider0_Sns3 */ + .ptrPin = &cy_capsense_pinConfig[7u], + .type = (uint8_t) CY_CAPSENSE_ELTD_TYPE_SELF_E, + .numPins = 1u, + }, + { + /* LinearSlider0_Sns4 */ + .ptrPin = &cy_capsense_pinConfig[8u], + .type = (uint8_t) CY_CAPSENSE_ELTD_TYPE_SELF_E, + .numPins = 1u, + }, +}; +#endif + +static const cy_stc_capsense_widget_config_t cy_capsense_widgetConfig[CY_CAPSENSE_WIDGET_COUNT] = +{ + { /* Button0 */ + .ptrWdContext = &cy_capsense_tuner.widgetContext[0u], + .ptrSnsContext = &cy_capsense_tuner.sensorContext[0u], + .ptrEltdConfig = &cy_capsense_electrodeConfig[0u], +#if (CY_CAPSENSE_BIST_SUPPORTED) + .ptrEltdCapacitance = NULL, + .ptrBslnInv = NULL, +#endif + .ptrNoiseEnvelope = NULL, + .ptrRawFilterHistory = NULL, + .ptrRawFilterHistoryLow = NULL, + .iirCoeff = 128u, + .ptrDebounceArr = &cy_capsense_debounce[0u], + .ptrDiplexTable = NULL, + .centroidConfig = 0u, + .xResolution = 0u, + .yResolution = 0u, + .numSns = 1u, + .numCols = 1u, + .numRows = 1u, + .ptrPosFilterHistory = NULL, + .ptrCsxTouchHistory = NULL, + .ptrCsxTouchBuffer = NULL, + .ptrCsdTouchBuffer = NULL, + .ptrGestureConfig = NULL, + .ptrGestureContext = NULL, + .ballisticConfig = { + .accelCoeff = 9u, + .speedCoeff = 2u, + .divisorValue = 4u, + .speedThresholdX = 3u, + .speedThresholdY = 4u, + }, + .ptrBallisticContext = NULL, + .aiirConfig = { + .maxK = 60u, + .minK = 1u, + .noMovTh = 3u, + .littleMovTh = 7u, + .largeMovTh = 12u, + .divVal = 64u, + }, + .advConfig = { + .penultimateTh = 100u, + .virtualSnsTh = 100u, + .crossCouplingTh = 5u, + }, + .posFilterConfig = 0u, + .rawFilterConfig = 0u, +#if (CY_CAPSENSE_MW_VERSION >= 400) + .alpOnThreshold = 15u, + .alpOffThreshold = 5u, +#endif +#if (CY_CAPSENSE_MW_VERSION >= 300) + .senseMethod = CY_CAPSENSE_CSX_GROUP, +#else + .senseMethod = CY_CAPSENSE_SENSE_METHOD_CSX_E, +#endif + .wdType = (uint8_t)CY_CAPSENSE_WD_BUTTON_E, + }, + { /* Button1 */ + .ptrWdContext = &cy_capsense_tuner.widgetContext[1u], + .ptrSnsContext = &cy_capsense_tuner.sensorContext[1u], + .ptrEltdConfig = &cy_capsense_electrodeConfig[2u], +#if (CY_CAPSENSE_BIST_SUPPORTED) + .ptrEltdCapacitance = NULL, + .ptrBslnInv = NULL, +#endif + .ptrNoiseEnvelope = NULL, + .ptrRawFilterHistory = NULL, + .ptrRawFilterHistoryLow = NULL, + .iirCoeff = 128u, + .ptrDebounceArr = &cy_capsense_debounce[1u], + .ptrDiplexTable = NULL, + .centroidConfig = 0u, + .xResolution = 0u, + .yResolution = 0u, + .numSns = 1u, + .numCols = 1u, + .numRows = 1u, + .ptrPosFilterHistory = NULL, + .ptrCsxTouchHistory = NULL, + .ptrCsxTouchBuffer = NULL, + .ptrCsdTouchBuffer = NULL, + .ptrGestureConfig = NULL, + .ptrGestureContext = NULL, + .ballisticConfig = { + .accelCoeff = 9u, + .speedCoeff = 2u, + .divisorValue = 4u, + .speedThresholdX = 3u, + .speedThresholdY = 4u, + }, + .ptrBallisticContext = NULL, + .aiirConfig = { + .maxK = 60u, + .minK = 1u, + .noMovTh = 3u, + .littleMovTh = 7u, + .largeMovTh = 12u, + .divVal = 64u, + }, + .advConfig = { + .penultimateTh = 100u, + .virtualSnsTh = 100u, + .crossCouplingTh = 5u, + }, + .posFilterConfig = 0u, + .rawFilterConfig = 0u, +#if (CY_CAPSENSE_MW_VERSION >= 400) + .alpOnThreshold = 15u, + .alpOffThreshold = 5u, +#endif +#if (CY_CAPSENSE_MW_VERSION >= 300) + .senseMethod = CY_CAPSENSE_CSX_GROUP, +#else + .senseMethod = CY_CAPSENSE_SENSE_METHOD_CSX_E, +#endif + .wdType = (uint8_t)CY_CAPSENSE_WD_BUTTON_E, + }, + { /* LinearSlider0 */ + .ptrWdContext = &cy_capsense_tuner.widgetContext[2u], + .ptrSnsContext = &cy_capsense_tuner.sensorContext[2u], + .ptrEltdConfig = &cy_capsense_electrodeConfig[4u], +#if (CY_CAPSENSE_BIST_SUPPORTED) + .ptrEltdCapacitance = NULL, + .ptrBslnInv = NULL, +#endif + .ptrNoiseEnvelope = &cy_capsense_noiseEnvelope[0u], + .ptrRawFilterHistory = NULL, + .ptrRawFilterHistoryLow = NULL, + .iirCoeff = 128u, + .ptrDebounceArr = &cy_capsense_debounce[2u], + .ptrDiplexTable = NULL, + .centroidConfig = 1u, + .xResolution = 300u, + .yResolution = 0u, + .numSns = 5u, + .numCols = 5u, + .numRows = 0u, + .ptrPosFilterHistory = NULL, + .ptrCsxTouchHistory = NULL, + .ptrCsxTouchBuffer = NULL, + .ptrCsdTouchBuffer = NULL, + .ptrGestureConfig = NULL, + .ptrGestureContext = NULL, + .ballisticConfig = { + .accelCoeff = 9u, + .speedCoeff = 2u, + .divisorValue = 4u, + .speedThresholdX = 3u, + .speedThresholdY = 4u, + }, + .ptrBallisticContext = NULL, + .aiirConfig = { + .maxK = 60u, + .minK = 1u, + .noMovTh = 3u, + .littleMovTh = 7u, + .largeMovTh = 12u, + .divVal = 64u, + }, + .advConfig = { + .penultimateTh = 100u, + .virtualSnsTh = 100u, + .crossCouplingTh = 5u, + }, + .posFilterConfig = 0u, + .rawFilterConfig = 0u, +#if (CY_CAPSENSE_MW_VERSION >= 400) + .alpOnThreshold = 15u, + .alpOffThreshold = 5u, +#endif +#if (CY_CAPSENSE_MW_VERSION >= 300) + .senseMethod = CY_CAPSENSE_CSD_GROUP, +#else + .senseMethod = CY_CAPSENSE_SENSE_METHOD_CSD_E, +#endif + .wdType = (uint8_t)CY_CAPSENSE_WD_LINEAR_SLIDER_E, + }, +}; + +cy_stc_capsense_tuner_t cy_capsense_tuner = +{ + .commonContext = { +#if (CY_CAPSENSE_MW_VERSION < 300) + .configId = 0x0990, +#elif (CY_CAPSENSE_MW_VERSION < 400) + .configId = 0x0991, +#else + .configId = 0x0992, +#endif + + .tunerCmd = 0u, + .scanCounter = 0u, + .tunerSt = 0u, + .initDone = 0u, +#if (CY_CAPSENSE_MW_VERSION < 300) + .ptrSSCallback = NULL, + .ptrEOSCallback = NULL, + .ptrTunerSendCallback = NULL, + .ptrTunerReceiveCallback = NULL, +#endif + .status = 0u, + .timestampInterval = 1u, + .timestamp = 0u, + .modCsdClk = 2u, + .modCsxClk = 2u, + .tunerCnt = 0u, + }, + .widgetContext = { + { /* Button0 */ + .fingerCap = 160u, + .sigPFC = 0u, + .resolution = 100u, + .maxRawCount = 0u, +#if (CY_CAPSENSE_MW_VERSION >= 300) + .maxRawCountRow = 0u, +#endif + .fingerTh = 100u, + .proxTh = 200u, + .lowBslnRst = 30u, + .snsClk = 32u, + .rowSnsClk = 16u, + .gestureDetected = 0u, + .gestureDirection = 0u, + .xDelta = 0, + .yDelta = 0, + .noiseTh = 40u, + .nNoiseTh = 40u, + .hysteresis = 10u, + .onDebounce = 3u, + .snsClkSource = CY_CAPSENSE_CLK_SOURCE_AUTO_MASK, + .idacMod = { 32u, 32u, 32u, }, + .idacGainIndex = 2u, + .rowIdacMod = { 32u, 32u, 32u, }, + .bslnCoeff = 1u, + .status = 0u, + .wdTouch = { + .ptrPosition = NULL, + .numPosition = 0, + }, + }, + { /* Button1 */ + .fingerCap = 160u, + .sigPFC = 0u, + .resolution = 100u, + .maxRawCount = 0u, +#if (CY_CAPSENSE_MW_VERSION >= 300) + .maxRawCountRow = 0u, +#endif + .fingerTh = 100u, + .proxTh = 200u, + .lowBslnRst = 30u, + .snsClk = 32u, + .rowSnsClk = 16u, + .gestureDetected = 0u, + .gestureDirection = 0u, + .xDelta = 0, + .yDelta = 0, + .noiseTh = 40u, + .nNoiseTh = 40u, + .hysteresis = 10u, + .onDebounce = 3u, + .snsClkSource = CY_CAPSENSE_CLK_SOURCE_AUTO_MASK, + .idacMod = { 32u, 32u, 32u, }, + .idacGainIndex = 2u, + .rowIdacMod = { 32u, 32u, 32u, }, + .bslnCoeff = 1u, + .status = 0u, + .wdTouch = { + .ptrPosition = NULL, + .numPosition = 0, + }, + }, + { /* LinearSlider0 */ + .fingerCap = 160u, + .sigPFC = 0u, + .resolution = 12u, + .maxRawCount = 0u, +#if (CY_CAPSENSE_MW_VERSION >= 300) + .maxRawCountRow = 0u, +#endif + .fingerTh = 100u, + .proxTh = 200u, + .lowBslnRst = 30u, + .snsClk = 16u, + .rowSnsClk = 16u, + .gestureDetected = 0u, + .gestureDirection = 0u, + .xDelta = 0, + .yDelta = 0, + .noiseTh = 40u, + .nNoiseTh = 40u, + .hysteresis = 10u, + .onDebounce = 3u, + .snsClkSource = CY_CAPSENSE_CLK_SOURCE_AUTO_MASK, + .idacMod = { 32u, 32u, 32u, }, + .idacGainIndex = 4u, + .rowIdacMod = { 32u, 32u, 32u, }, + .bslnCoeff = 1u, + .status = 0u, + .wdTouch = { + .ptrPosition = &cy_capsense_tuner.position[0u], + .numPosition = 1, + }, + }, + }, + .sensorContext = { + { /* Button0_Rx0 */ + .raw = 0u, + .bsln = 0u, + .diff = 0u, + .status = 0u, + .negBslnRstCnt = 0u, + .idacComp = 32u, + .bslnExt = 0u, + }, + { /* Button1_Rx0 */ + .raw = 0u, + .bsln = 0u, + .diff = 0u, + .status = 0u, + .negBslnRstCnt = 0u, + .idacComp = 32u, + .bslnExt = 0u, + }, + { /* LinearSlider0_Sns0 */ + .raw = 0u, + .bsln = 0u, + .diff = 0u, + .status = 0u, + .negBslnRstCnt = 0u, + .idacComp = 32u, + .bslnExt = 0u, + }, + { /* LinearSlider0_Sns1 */ + .raw = 0u, + .bsln = 0u, + .diff = 0u, + .status = 0u, + .negBslnRstCnt = 0u, + .idacComp = 32u, + .bslnExt = 0u, + }, + { /* LinearSlider0_Sns2 */ + .raw = 0u, + .bsln = 0u, + .diff = 0u, + .status = 0u, + .negBslnRstCnt = 0u, + .idacComp = 32u, + .bslnExt = 0u, + }, + { /* LinearSlider0_Sns3 */ + .raw = 0u, + .bsln = 0u, + .diff = 0u, + .status = 0u, + .negBslnRstCnt = 0u, + .idacComp = 32u, + .bslnExt = 0u, + }, + { /* LinearSlider0_Sns4 */ + .raw = 0u, + .bsln = 0u, + .diff = 0u, + .status = 0u, + .negBslnRstCnt = 0u, + .idacComp = 32u, + .bslnExt = 0u, + }, + }, + .position = { + { /* LinearSlider0 */ + .x = 0u, + .y = 0u, + .z = 0u, + .id = 0u, + }, + }, +}; + +#if (CY_CAPSENSE_BIST_SUPPORTED) +#if (CY_CAPSENSE_BIST_EN != 0) +static cy_stc_capsense_bist_context_t cy_capsense_bist_context = {}; +#endif +#endif + +cy_stc_capsense_context_t cy_capsense_context = { + .ptrCommonConfig = &cy_capsense_commonConfig, + .ptrCommonContext = &cy_capsense_tuner.commonContext, + .ptrInternalContext = &cy_capsense_internalContext, + .ptrWdConfig = &cy_capsense_widgetConfig[0u], + .ptrWdContext = &cy_capsense_tuner.widgetContext[0u], + .ptrPinConfig = &cy_capsense_pinConfig[0u], + .ptrShieldPinConfig = NULL, + .ptrActiveScanSns = &cy_capsense_activeScanSns, +#if (CY_CAPSENSE_MW_VERSION < 300) + .ptrFptrConfig = (const void *) &cy_capsense_fptrConfig, +#endif +#if (CY_CAPSENSE_BIST_SUPPORTED) + .ptrBistContext = NULL, +#endif +}; + +#endif /* CY_CAPSENSE_CORE == __CORTEX_M */ + +#endif /* !defined(CY_DISABLE_CAPSENSE) */ + +#endif /* (defined(COMPONENT_MW_CAPSENSE) || !defined(COMPONENT_MW_CORE_MAKE)) */ + +/* [] END OF FILE */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_capsense.h b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_capsense.h new file mode 100644 index 00000000000000..8654b3c71e2ac8 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_capsense.h @@ -0,0 +1,2334 @@ +/******************************************************************************* + * File Name: cycfg_capsense.h + * + * Description: + * CAPSENSE Middleware configuration + * This file should not be modified. It was automatically generated by + * CAPSENSE Configurator 6.10.0.3796 + * + ******************************************************************************** + * Copyright 2024, Cypress Semiconductor Corporation (an Infineon company) + * or an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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(CYCFG_CAPSENSE_H) +#define CYCFG_CAPSENSE_H + +/* This enables code only when the CAPSENSE(TM) Middleware is present in the project + * or the information about the Middleware presence cannot be obtained. + */ +#if (defined(COMPONENT_MW_CAPSENSE) || !defined(COMPONENT_MW_CORE_MAKE)) + +#include "cy_device_headers.h" +#include "cycfg_capsense_defines.h" +#include "cycfg_peripherals.h" +#include + +#define CY_CAPSENSE_CFG_TOOL_VERSION (610) + +#if !defined(CY_DISABLE_CAPSENSE) + +#if (CY_CAPSENSE_CORE == __CORTEX_M) + +#if !defined(Cmod_PORT) || !defined(Cmod_PIN) || !defined(Cmod_PORT_NUM) +#error Cmod Capacitor is not assigned: missing #define Cmod_PORT, #define Cmod_PIN, #define Cmod_PORT_NUM +#endif + +#if !defined(CintA_PORT) || !defined(CintA_PIN) || !defined(CintA_PORT_NUM) +#error CintA Capacitor is not assigned: missing #define CintA_PORT, #define CintA_PIN, #define CintA_PORT_NUM +#endif + +#if !defined(CintB_PORT) || !defined(CintB_PIN) || !defined(CintB_PORT_NUM) +#error CintB Capacitor is not assigned: missing #define CintB_PORT, #define CintB_PIN, #define CintB_PORT_NUM +#endif + +#if !defined(Button0_Rx0_PORT) || !defined(Button0_Rx0_PIN) +#error Button0_Rx0 Sensor is not assigned: missing #define Button0_Rx0_PORT, #define Button0_Rx0_PIN +#endif + +#if !defined(Button0_Tx_PORT) || !defined(Button0_Tx_PIN) +#error Button0_Tx Sensor is not assigned: missing #define Button0_Tx_PORT, #define Button0_Tx_PIN +#endif + +#if !defined(Button1_Rx0_PORT) || !defined(Button1_Rx0_PIN) +#error Button1_Rx0 Sensor is not assigned: missing #define Button1_Rx0_PORT, #define Button1_Rx0_PIN +#endif + +#if !defined(Button1_Tx_PORT) || !defined(Button1_Tx_PIN) +#error Button1_Tx Sensor is not assigned: missing #define Button1_Tx_PORT, #define Button1_Tx_PIN +#endif + +#if !defined(LinearSlider0_Sns0_PORT) || !defined(LinearSlider0_Sns0_PIN) +#error LinearSlider0_Sns0 Sensor is not assigned: missing #define LinearSlider0_Sns0_PORT, #define LinearSlider0_Sns0_PIN +#endif + +#if !defined(LinearSlider0_Sns1_PORT) || !defined(LinearSlider0_Sns1_PIN) +#error LinearSlider0_Sns1 Sensor is not assigned: missing #define LinearSlider0_Sns1_PORT, #define LinearSlider0_Sns1_PIN +#endif + +#if !defined(LinearSlider0_Sns2_PORT) || !defined(LinearSlider0_Sns2_PIN) +#error LinearSlider0_Sns2 Sensor is not assigned: missing #define LinearSlider0_Sns2_PORT, #define LinearSlider0_Sns2_PIN +#endif + +#if !defined(LinearSlider0_Sns3_PORT) || !defined(LinearSlider0_Sns3_PIN) +#error LinearSlider0_Sns3 Sensor is not assigned: missing #define LinearSlider0_Sns3_PORT, #define LinearSlider0_Sns3_PIN +#endif + +#if !defined(LinearSlider0_Sns4_PORT) || !defined(LinearSlider0_Sns4_PIN) +#error LinearSlider0_Sns4 Sensor is not assigned: missing #define LinearSlider0_Sns4_PORT, #define LinearSlider0_Sns4_PIN +#endif + +#if !defined(CY_CAPSENSE_CPU_CLK) +#error CPU clock frequency is not set: missing #define CY_CAPSENSE_CPU_CLK +#endif + +#if !defined(CY_CAPSENSE_PERI_CLK) +#error Peripheral clock core is not set: missing #define CY_CAPSENSE_PERI_CLK +#endif + +#if !defined(CY_CAPSENSE_VDDA_MV) +#error VDDA voltage is not set: missing #define CY_CAPSENSE_VDDA_MV +#endif + +#if !defined(CY_CAPSENSE_PERI_DIV_TYPE) +#error Peripheral clock divider type is not set: missing #define CY_CAPSENSE_PERI_DIV_TYPE +#endif + +#if !defined(CY_CAPSENSE_PERI_DIV_INDEX) +#error Peripheral clock divider index is not set: missing #define CY_CAPSENSE_PERI_DIV_INDEX +#endif + +#include "cy_capsense.h" + +/* Supported CapSense Middleware version */ +#define CY_CAPSENSE_MW_VERSION_REQUIRED (200) + +#if !defined(CY_CAPSENSE_MW_VERSION) +#if (CY_CAPSENSE_MW_VERSION_MAJOR == 2) +#define CY_CAPSENSE_MW_VERSION (200) +#elif (CY_CAPSENSE_MW_VERSION_MAJOR == 1) +#define CY_CAPSENSE_MW_VERSION (100) +#else +#define CY_CAPSENSE_MW_VERSION (100) +#endif +#endif + +/* Check the used Middleware version */ +#if (CY_CAPSENSE_MW_VERSION_REQUIRED > CY_CAPSENSE_MW_VERSION) +#error The CapSense Configurator requires a newer version of the CapSense Middleware. Update the CapSense Middleware in your project. +#endif + +#define CY_CAPSENSE_BIST_SUPPORTED (CY_CAPSENSE_MW_VERSION >= 210) + +#if defined(__cplusplus) +extern "C" { +#endif + +/* Widget names */ +#define CY_CAPSENSE_BUTTON0_WDGT_ID (0u) +#define CY_CAPSENSE_BUTTON1_WDGT_ID (1u) +#define CY_CAPSENSE_LINEARSLIDER0_WDGT_ID (2u) + +/* Button0 sensor names */ +#define CY_CAPSENSE_BUTTON0_SNS0_ID (0u) + +/* Button0 node names */ +#define CY_CAPSENSE_BUTTON0_RX0_TX0_ID (0u) + +/* Button0 sensor element IDs */ +#define CY_CAPSENSE_BUTTON0_RX0_ID (0u) +#define CY_CAPSENSE_BUTTON0_TX0_ID (1u) + +/* Button1 sensor names */ +#define CY_CAPSENSE_BUTTON1_SNS0_ID (0u) + +/* Button1 node names */ +#define CY_CAPSENSE_BUTTON1_RX0_TX0_ID (0u) + +/* Button1 sensor element IDs */ +#define CY_CAPSENSE_BUTTON1_RX0_ID (0u) +#define CY_CAPSENSE_BUTTON1_TX0_ID (1u) + +/* LinearSlider0 sensor names */ +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_ID (0u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_ID (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_ID (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_ID (3u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_ID (4u) + +typedef struct +{ + cy_stc_capsense_common_context_t commonContext; + cy_stc_capsense_widget_context_t widgetContext[3]; + cy_stc_capsense_sensor_context_t sensorContext[7]; + cy_stc_capsense_position_t position[1]; +} cy_stc_capsense_tuner_t; + +extern cy_stc_capsense_tuner_t cy_capsense_tuner; + +extern cy_stc_capsense_context_t cy_capsense_context; + +/* RAM Data structure register definitions */ +#if (CY_CAPSENSE_MW_VERSION < 300) +#define CY_CAPSENSE_CONFIG_ID_VALUE (cy_capsense_tuner.commonContext.configId) +#define CY_CAPSENSE_CONFIG_ID_OFFSET (0u) +#define CY_CAPSENSE_CONFIG_ID_SIZE (2u) +#define CY_CAPSENSE_CONFIG_ID_PARAM_ID (0x02000000u) + +#define CY_CAPSENSE_TUNER_CMD_VALUE (cy_capsense_tuner.commonContext.tunerCmd) +#define CY_CAPSENSE_TUNER_CMD_OFFSET (2u) +#define CY_CAPSENSE_TUNER_CMD_SIZE (2u) +#define CY_CAPSENSE_TUNER_CMD_PARAM_ID (0x02000002u) + +#define CY_CAPSENSE_SCAN_COUNTER_VALUE (cy_capsense_tuner.commonContext.scanCounter) +#define CY_CAPSENSE_SCAN_COUNTER_OFFSET (4u) +#define CY_CAPSENSE_SCAN_COUNTER_SIZE (2u) +#define CY_CAPSENSE_SCAN_COUNTER_PARAM_ID (0x02000004u) + +#define CY_CAPSENSE_TUNER_ST_VALUE (cy_capsense_tuner.commonContext.tunerSt) +#define CY_CAPSENSE_TUNER_ST_OFFSET (6u) +#define CY_CAPSENSE_TUNER_ST_SIZE (1u) +#define CY_CAPSENSE_TUNER_ST_PARAM_ID (0x01000006u) + +#define CY_CAPSENSE_INITDONE_VALUE (cy_capsense_tuner.commonContext.initDone) +#define CY_CAPSENSE_INITDONE_OFFSET (7u) +#define CY_CAPSENSE_INITDONE_SIZE (1u) +#define CY_CAPSENSE_INITDONE_PARAM_ID (0x01000007u) + +#define CY_CAPSENSE_PTRSSCALLBACK_VALUE (cy_capsense_tuner.commonContext.ptrSSCallback) +#define CY_CAPSENSE_PTRSSCALLBACK_OFFSET (8u) +#define CY_CAPSENSE_PTRSSCALLBACK_SIZE (4u) +#define CY_CAPSENSE_PTRSSCALLBACK_PARAM_ID (0x03000008u) + +#define CY_CAPSENSE_PTREOSCALLBACK_VALUE (cy_capsense_tuner.commonContext.ptrEOSCallback) +#define CY_CAPSENSE_PTREOSCALLBACK_OFFSET (12u) +#define CY_CAPSENSE_PTREOSCALLBACK_SIZE (4u) +#define CY_CAPSENSE_PTREOSCALLBACK_PARAM_ID (0x0300000cu) + +#define CY_CAPSENSE_PTRTUNERSENDCALLBACK_VALUE (cy_capsense_tuner.commonContext.ptrTunerSendCallback) +#define CY_CAPSENSE_PTRTUNERSENDCALLBACK_OFFSET (16u) +#define CY_CAPSENSE_PTRTUNERSENDCALLBACK_SIZE (4u) +#define CY_CAPSENSE_PTRTUNERSENDCALLBACK_PARAM_ID (0x03000010u) + +#define CY_CAPSENSE_PTRTUNERRECEIVECALLBACK_VALUE (cy_capsense_tuner.commonContext.ptrTunerReceiveCallback) +#define CY_CAPSENSE_PTRTUNERRECEIVECALLBACK_OFFSET (20u) +#define CY_CAPSENSE_PTRTUNERRECEIVECALLBACK_SIZE (4u) +#define CY_CAPSENSE_PTRTUNERRECEIVECALLBACK_PARAM_ID (0x03000014u) + +#define CY_CAPSENSE_STATUS_VALUE (cy_capsense_tuner.commonContext.status) +#define CY_CAPSENSE_STATUS_OFFSET (24u) +#define CY_CAPSENSE_STATUS_SIZE (4u) +#define CY_CAPSENSE_STATUS_PARAM_ID (0x03000018u) + +#define CY_CAPSENSE_TIMESTAMPINTERVAL_VALUE (cy_capsense_tuner.commonContext.timestampInterval) +#define CY_CAPSENSE_TIMESTAMPINTERVAL_OFFSET (28u) +#define CY_CAPSENSE_TIMESTAMPINTERVAL_SIZE (4u) +#define CY_CAPSENSE_TIMESTAMPINTERVAL_PARAM_ID (0x0300001cu) + +#define CY_CAPSENSE_TIMESTAMP_VALUE (cy_capsense_tuner.commonContext.timestamp) +#define CY_CAPSENSE_TIMESTAMP_OFFSET (32u) +#define CY_CAPSENSE_TIMESTAMP_SIZE (4u) +#define CY_CAPSENSE_TIMESTAMP_PARAM_ID (0x03000020u) + +#define CY_CAPSENSE_CSD_MOD_CLK_DIVIDER_VALUE (cy_capsense_tuner.commonContext.modCsdClk) +#define CY_CAPSENSE_CSD_MOD_CLK_DIVIDER_OFFSET (36u) +#define CY_CAPSENSE_CSD_MOD_CLK_DIVIDER_SIZE (1u) +#define CY_CAPSENSE_CSD_MOD_CLK_DIVIDER_PARAM_ID (0x01000024u) + +#define CY_CAPSENSE_CSX_MOD_CLK_DIVIDER_VALUE (cy_capsense_tuner.commonContext.modCsxClk) +#define CY_CAPSENSE_CSX_MOD_CLK_DIVIDER_OFFSET (37u) +#define CY_CAPSENSE_CSX_MOD_CLK_DIVIDER_SIZE (1u) +#define CY_CAPSENSE_CSX_MOD_CLK_DIVIDER_PARAM_ID (0x01000025u) + +#define CY_CAPSENSE_TUNER_CNT_VALUE (cy_capsense_tuner.commonContext.tunerCnt) +#define CY_CAPSENSE_TUNER_CNT_OFFSET (38u) +#define CY_CAPSENSE_TUNER_CNT_SIZE (1u) +#define CY_CAPSENSE_TUNER_CNT_PARAM_ID (0x01000026u) + +#define CY_CAPSENSE_BUTTON0_FINGER_CP_VALUE (cy_capsense_tuner.widgetContext[0].fingerCap) +#define CY_CAPSENSE_BUTTON0_FINGER_CP_OFFSET (40u) +#define CY_CAPSENSE_BUTTON0_FINGER_CP_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_FINGER_CP_PARAM_ID (0x06000028u) + +#define CY_CAPSENSE_BUTTON0_SIGPFC_VALUE (cy_capsense_tuner.widgetContext[0].sigPFC) +#define CY_CAPSENSE_BUTTON0_SIGPFC_OFFSET (42u) +#define CY_CAPSENSE_BUTTON0_SIGPFC_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_SIGPFC_PARAM_ID (0x0600002au) + +#define CY_CAPSENSE_BUTTON0_NUM_CONV_VALUE (cy_capsense_tuner.widgetContext[0].resolution) +#define CY_CAPSENSE_BUTTON0_NUM_CONV_OFFSET (44u) +#define CY_CAPSENSE_BUTTON0_NUM_CONV_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_NUM_CONV_PARAM_ID (0x0600002cu) + +#define CY_CAPSENSE_BUTTON0_MAX_RAW_COUNT_VALUE (cy_capsense_tuner.widgetContext[0].maxRawCount) +#define CY_CAPSENSE_BUTTON0_MAX_RAW_COUNT_OFFSET (46u) +#define CY_CAPSENSE_BUTTON0_MAX_RAW_COUNT_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_MAX_RAW_COUNT_PARAM_ID (0x0600002eu) + +#define CY_CAPSENSE_BUTTON0_FINGER_TH_VALUE (cy_capsense_tuner.widgetContext[0].fingerTh) +#define CY_CAPSENSE_BUTTON0_FINGER_TH_OFFSET (48u) +#define CY_CAPSENSE_BUTTON0_FINGER_TH_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_FINGER_TH_PARAM_ID (0x06000030u) + +#define CY_CAPSENSE_BUTTON0_PROX_TOUCH_TH_VALUE (cy_capsense_tuner.widgetContext[0].proxTh) +#define CY_CAPSENSE_BUTTON0_PROX_TOUCH_TH_OFFSET (50u) +#define CY_CAPSENSE_BUTTON0_PROX_TOUCH_TH_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_PROX_TOUCH_TH_PARAM_ID (0x06000032u) + +#define CY_CAPSENSE_BUTTON0_LOW_BSLN_RST_VALUE (cy_capsense_tuner.widgetContext[0].lowBslnRst) +#define CY_CAPSENSE_BUTTON0_LOW_BSLN_RST_OFFSET (52u) +#define CY_CAPSENSE_BUTTON0_LOW_BSLN_RST_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_LOW_BSLN_RST_PARAM_ID (0x06000034u) + +#define CY_CAPSENSE_BUTTON0_TX_CLK_VALUE (cy_capsense_tuner.widgetContext[0].snsClk) +#define CY_CAPSENSE_BUTTON0_TX_CLK_OFFSET (54u) +#define CY_CAPSENSE_BUTTON0_TX_CLK_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_TX_CLK_PARAM_ID (0x06000036u) + +#define CY_CAPSENSE_BUTTON0_ROW_SNS_CLK_VALUE (cy_capsense_tuner.widgetContext[0].rowSnsClk) +#define CY_CAPSENSE_BUTTON0_ROW_SNS_CLK_OFFSET (56u) +#define CY_CAPSENSE_BUTTON0_ROW_SNS_CLK_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_ROW_SNS_CLK_PARAM_ID (0x06000038u) + +#define CY_CAPSENSE_BUTTON0_GESTURE_DETECTED_VALUE (cy_capsense_tuner.widgetContext[0].gestureDetected) +#define CY_CAPSENSE_BUTTON0_GESTURE_DETECTED_OFFSET (58u) +#define CY_CAPSENSE_BUTTON0_GESTURE_DETECTED_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_GESTURE_DETECTED_PARAM_ID (0x0200003au) + +#define CY_CAPSENSE_BUTTON0_GESTURE_DIRECTION_VALUE (cy_capsense_tuner.widgetContext[0].gestureDirection) +#define CY_CAPSENSE_BUTTON0_GESTURE_DIRECTION_OFFSET (60u) +#define CY_CAPSENSE_BUTTON0_GESTURE_DIRECTION_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_GESTURE_DIRECTION_PARAM_ID (0x0200003cu) + +#define CY_CAPSENSE_BUTTON0_XDELTA_VALUE (cy_capsense_tuner.widgetContext[0].xDelta) +#define CY_CAPSENSE_BUTTON0_XDELTA_OFFSET (62u) +#define CY_CAPSENSE_BUTTON0_XDELTA_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_XDELTA_PARAM_ID (0x0200003eu) + +#define CY_CAPSENSE_BUTTON0_YDELTA_VALUE (cy_capsense_tuner.widgetContext[0].yDelta) +#define CY_CAPSENSE_BUTTON0_YDELTA_OFFSET (64u) +#define CY_CAPSENSE_BUTTON0_YDELTA_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_YDELTA_PARAM_ID (0x02000040u) + +#define CY_CAPSENSE_BUTTON0_NOISE_TH_VALUE (cy_capsense_tuner.widgetContext[0].noiseTh) +#define CY_CAPSENSE_BUTTON0_NOISE_TH_OFFSET (66u) +#define CY_CAPSENSE_BUTTON0_NOISE_TH_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_NOISE_TH_PARAM_ID (0x05000042u) + +#define CY_CAPSENSE_BUTTON0_NNOISE_TH_VALUE (cy_capsense_tuner.widgetContext[0].nNoiseTh) +#define CY_CAPSENSE_BUTTON0_NNOISE_TH_OFFSET (67u) +#define CY_CAPSENSE_BUTTON0_NNOISE_TH_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_NNOISE_TH_PARAM_ID (0x05000043u) + +#define CY_CAPSENSE_BUTTON0_HYSTERESIS_VALUE (cy_capsense_tuner.widgetContext[0].hysteresis) +#define CY_CAPSENSE_BUTTON0_HYSTERESIS_OFFSET (68u) +#define CY_CAPSENSE_BUTTON0_HYSTERESIS_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_HYSTERESIS_PARAM_ID (0x05000044u) + +#define CY_CAPSENSE_BUTTON0_ON_DEBOUNCE_VALUE (cy_capsense_tuner.widgetContext[0].onDebounce) +#define CY_CAPSENSE_BUTTON0_ON_DEBOUNCE_OFFSET (69u) +#define CY_CAPSENSE_BUTTON0_ON_DEBOUNCE_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_ON_DEBOUNCE_PARAM_ID (0x05000045u) + +#define CY_CAPSENSE_BUTTON0_TX_CLK_SOURCE_VALUE (cy_capsense_tuner.widgetContext[0].snsClkSource) +#define CY_CAPSENSE_BUTTON0_TX_CLK_SOURCE_OFFSET (70u) +#define CY_CAPSENSE_BUTTON0_TX_CLK_SOURCE_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_TX_CLK_SOURCE_PARAM_ID (0x05000046u) + +#define CY_CAPSENSE_BUTTON0_IDAC_MOD0_VALUE (cy_capsense_tuner.widgetContext[0].idacMod[0]) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD0_OFFSET (71u) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD0_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD0_PARAM_ID (0x05000047u) + +#define CY_CAPSENSE_BUTTON0_IDAC_MOD1_VALUE (cy_capsense_tuner.widgetContext[0].idacMod[1]) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD1_OFFSET (72u) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD1_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD1_PARAM_ID (0x05000048u) + +#define CY_CAPSENSE_BUTTON0_IDAC_MOD2_VALUE (cy_capsense_tuner.widgetContext[0].idacMod[2]) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD2_OFFSET (73u) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD2_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD2_PARAM_ID (0x05000049u) + +#define CY_CAPSENSE_BUTTON0_IDAC_GAIN_INDEX_VALUE (cy_capsense_tuner.widgetContext[0].idacGainIndex) +#define CY_CAPSENSE_BUTTON0_IDAC_GAIN_INDEX_OFFSET (74u) +#define CY_CAPSENSE_BUTTON0_IDAC_GAIN_INDEX_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_IDAC_GAIN_INDEX_PARAM_ID (0x0500004au) + +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD0_VALUE (cy_capsense_tuner.widgetContext[0].rowIdacMod[0]) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD0_OFFSET (75u) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD0_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD0_PARAM_ID (0x0500004bu) + +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD1_VALUE (cy_capsense_tuner.widgetContext[0].rowIdacMod[1]) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD1_OFFSET (76u) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD1_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD1_PARAM_ID (0x0500004cu) + +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD2_VALUE (cy_capsense_tuner.widgetContext[0].rowIdacMod[2]) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD2_OFFSET (77u) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD2_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD2_PARAM_ID (0x0500004du) + +#define CY_CAPSENSE_BUTTON0_REGULAR_IIR_BL_N_VALUE (cy_capsense_tuner.widgetContext[0].bslnCoeff) +#define CY_CAPSENSE_BUTTON0_REGULAR_IIR_BL_N_OFFSET (78u) +#define CY_CAPSENSE_BUTTON0_REGULAR_IIR_BL_N_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_REGULAR_IIR_BL_N_PARAM_ID (0x0500004eu) + +#define CY_CAPSENSE_BUTTON0_STATUS_VALUE (cy_capsense_tuner.widgetContext[0].status) +#define CY_CAPSENSE_BUTTON0_STATUS_OFFSET (79u) +#define CY_CAPSENSE_BUTTON0_STATUS_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_STATUS_PARAM_ID (0x0100004fu) + +#define CY_CAPSENSE_BUTTON0_PTRPOSITION_VALUE (cy_capsense_tuner.widgetContext[0].wdTouch.ptrPosition) +#define CY_CAPSENSE_BUTTON0_PTRPOSITION_OFFSET (80u) +#define CY_CAPSENSE_BUTTON0_PTRPOSITION_SIZE (4u) +#define CY_CAPSENSE_BUTTON0_PTRPOSITION_PARAM_ID (0x03000050u) + +#define CY_CAPSENSE_BUTTON0_NUM_POSITIONS_VALUE (cy_capsense_tuner.widgetContext[0].wdTouch.numPosition) +#define CY_CAPSENSE_BUTTON0_NUM_POSITIONS_OFFSET (84u) +#define CY_CAPSENSE_BUTTON0_NUM_POSITIONS_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_NUM_POSITIONS_PARAM_ID (0x01000054u) + +#define CY_CAPSENSE_BUTTON1_FINGER_CP_VALUE (cy_capsense_tuner.widgetContext[1].fingerCap) +#define CY_CAPSENSE_BUTTON1_FINGER_CP_OFFSET (88u) +#define CY_CAPSENSE_BUTTON1_FINGER_CP_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_FINGER_CP_PARAM_ID (0x06010058u) + +#define CY_CAPSENSE_BUTTON1_SIGPFC_VALUE (cy_capsense_tuner.widgetContext[1].sigPFC) +#define CY_CAPSENSE_BUTTON1_SIGPFC_OFFSET (90u) +#define CY_CAPSENSE_BUTTON1_SIGPFC_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_SIGPFC_PARAM_ID (0x0601005au) + +#define CY_CAPSENSE_BUTTON1_NUM_CONV_VALUE (cy_capsense_tuner.widgetContext[1].resolution) +#define CY_CAPSENSE_BUTTON1_NUM_CONV_OFFSET (92u) +#define CY_CAPSENSE_BUTTON1_NUM_CONV_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_NUM_CONV_PARAM_ID (0x0601005cu) + +#define CY_CAPSENSE_BUTTON1_MAX_RAW_COUNT_VALUE (cy_capsense_tuner.widgetContext[1].maxRawCount) +#define CY_CAPSENSE_BUTTON1_MAX_RAW_COUNT_OFFSET (94u) +#define CY_CAPSENSE_BUTTON1_MAX_RAW_COUNT_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_MAX_RAW_COUNT_PARAM_ID (0x0601005eu) + +#define CY_CAPSENSE_BUTTON1_FINGER_TH_VALUE (cy_capsense_tuner.widgetContext[1].fingerTh) +#define CY_CAPSENSE_BUTTON1_FINGER_TH_OFFSET (96u) +#define CY_CAPSENSE_BUTTON1_FINGER_TH_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_FINGER_TH_PARAM_ID (0x06010060u) + +#define CY_CAPSENSE_BUTTON1_PROX_TOUCH_TH_VALUE (cy_capsense_tuner.widgetContext[1].proxTh) +#define CY_CAPSENSE_BUTTON1_PROX_TOUCH_TH_OFFSET (98u) +#define CY_CAPSENSE_BUTTON1_PROX_TOUCH_TH_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_PROX_TOUCH_TH_PARAM_ID (0x06010062u) + +#define CY_CAPSENSE_BUTTON1_LOW_BSLN_RST_VALUE (cy_capsense_tuner.widgetContext[1].lowBslnRst) +#define CY_CAPSENSE_BUTTON1_LOW_BSLN_RST_OFFSET (100u) +#define CY_CAPSENSE_BUTTON1_LOW_BSLN_RST_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_LOW_BSLN_RST_PARAM_ID (0x06010064u) + +#define CY_CAPSENSE_BUTTON1_TX_CLK_VALUE (cy_capsense_tuner.widgetContext[1].snsClk) +#define CY_CAPSENSE_BUTTON1_TX_CLK_OFFSET (102u) +#define CY_CAPSENSE_BUTTON1_TX_CLK_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_TX_CLK_PARAM_ID (0x06010066u) + +#define CY_CAPSENSE_BUTTON1_ROW_SNS_CLK_VALUE (cy_capsense_tuner.widgetContext[1].rowSnsClk) +#define CY_CAPSENSE_BUTTON1_ROW_SNS_CLK_OFFSET (104u) +#define CY_CAPSENSE_BUTTON1_ROW_SNS_CLK_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_ROW_SNS_CLK_PARAM_ID (0x06010068u) + +#define CY_CAPSENSE_BUTTON1_GESTURE_DETECTED_VALUE (cy_capsense_tuner.widgetContext[1].gestureDetected) +#define CY_CAPSENSE_BUTTON1_GESTURE_DETECTED_OFFSET (106u) +#define CY_CAPSENSE_BUTTON1_GESTURE_DETECTED_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_GESTURE_DETECTED_PARAM_ID (0x0201006au) + +#define CY_CAPSENSE_BUTTON1_GESTURE_DIRECTION_VALUE (cy_capsense_tuner.widgetContext[1].gestureDirection) +#define CY_CAPSENSE_BUTTON1_GESTURE_DIRECTION_OFFSET (108u) +#define CY_CAPSENSE_BUTTON1_GESTURE_DIRECTION_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_GESTURE_DIRECTION_PARAM_ID (0x0201006cu) + +#define CY_CAPSENSE_BUTTON1_XDELTA_VALUE (cy_capsense_tuner.widgetContext[1].xDelta) +#define CY_CAPSENSE_BUTTON1_XDELTA_OFFSET (110u) +#define CY_CAPSENSE_BUTTON1_XDELTA_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_XDELTA_PARAM_ID (0x0201006eu) + +#define CY_CAPSENSE_BUTTON1_YDELTA_VALUE (cy_capsense_tuner.widgetContext[1].yDelta) +#define CY_CAPSENSE_BUTTON1_YDELTA_OFFSET (112u) +#define CY_CAPSENSE_BUTTON1_YDELTA_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_YDELTA_PARAM_ID (0x02010070u) + +#define CY_CAPSENSE_BUTTON1_NOISE_TH_VALUE (cy_capsense_tuner.widgetContext[1].noiseTh) +#define CY_CAPSENSE_BUTTON1_NOISE_TH_OFFSET (114u) +#define CY_CAPSENSE_BUTTON1_NOISE_TH_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_NOISE_TH_PARAM_ID (0x05010072u) + +#define CY_CAPSENSE_BUTTON1_NNOISE_TH_VALUE (cy_capsense_tuner.widgetContext[1].nNoiseTh) +#define CY_CAPSENSE_BUTTON1_NNOISE_TH_OFFSET (115u) +#define CY_CAPSENSE_BUTTON1_NNOISE_TH_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_NNOISE_TH_PARAM_ID (0x05010073u) + +#define CY_CAPSENSE_BUTTON1_HYSTERESIS_VALUE (cy_capsense_tuner.widgetContext[1].hysteresis) +#define CY_CAPSENSE_BUTTON1_HYSTERESIS_OFFSET (116u) +#define CY_CAPSENSE_BUTTON1_HYSTERESIS_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_HYSTERESIS_PARAM_ID (0x05010074u) + +#define CY_CAPSENSE_BUTTON1_ON_DEBOUNCE_VALUE (cy_capsense_tuner.widgetContext[1].onDebounce) +#define CY_CAPSENSE_BUTTON1_ON_DEBOUNCE_OFFSET (117u) +#define CY_CAPSENSE_BUTTON1_ON_DEBOUNCE_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_ON_DEBOUNCE_PARAM_ID (0x05010075u) + +#define CY_CAPSENSE_BUTTON1_TX_CLK_SOURCE_VALUE (cy_capsense_tuner.widgetContext[1].snsClkSource) +#define CY_CAPSENSE_BUTTON1_TX_CLK_SOURCE_OFFSET (118u) +#define CY_CAPSENSE_BUTTON1_TX_CLK_SOURCE_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_TX_CLK_SOURCE_PARAM_ID (0x05010076u) + +#define CY_CAPSENSE_BUTTON1_IDAC_MOD0_VALUE (cy_capsense_tuner.widgetContext[1].idacMod[0]) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD0_OFFSET (119u) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD0_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD0_PARAM_ID (0x05010077u) + +#define CY_CAPSENSE_BUTTON1_IDAC_MOD1_VALUE (cy_capsense_tuner.widgetContext[1].idacMod[1]) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD1_OFFSET (120u) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD1_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD1_PARAM_ID (0x05010078u) + +#define CY_CAPSENSE_BUTTON1_IDAC_MOD2_VALUE (cy_capsense_tuner.widgetContext[1].idacMod[2]) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD2_OFFSET (121u) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD2_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD2_PARAM_ID (0x05010079u) + +#define CY_CAPSENSE_BUTTON1_IDAC_GAIN_INDEX_VALUE (cy_capsense_tuner.widgetContext[1].idacGainIndex) +#define CY_CAPSENSE_BUTTON1_IDAC_GAIN_INDEX_OFFSET (122u) +#define CY_CAPSENSE_BUTTON1_IDAC_GAIN_INDEX_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_IDAC_GAIN_INDEX_PARAM_ID (0x0501007au) + +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD0_VALUE (cy_capsense_tuner.widgetContext[1].rowIdacMod[0]) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD0_OFFSET (123u) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD0_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD0_PARAM_ID (0x0501007bu) + +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD1_VALUE (cy_capsense_tuner.widgetContext[1].rowIdacMod[1]) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD1_OFFSET (124u) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD1_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD1_PARAM_ID (0x0501007cu) + +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD2_VALUE (cy_capsense_tuner.widgetContext[1].rowIdacMod[2]) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD2_OFFSET (125u) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD2_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD2_PARAM_ID (0x0501007du) + +#define CY_CAPSENSE_BUTTON1_REGULAR_IIR_BL_N_VALUE (cy_capsense_tuner.widgetContext[1].bslnCoeff) +#define CY_CAPSENSE_BUTTON1_REGULAR_IIR_BL_N_OFFSET (126u) +#define CY_CAPSENSE_BUTTON1_REGULAR_IIR_BL_N_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_REGULAR_IIR_BL_N_PARAM_ID (0x0501007eu) + +#define CY_CAPSENSE_BUTTON1_STATUS_VALUE (cy_capsense_tuner.widgetContext[1].status) +#define CY_CAPSENSE_BUTTON1_STATUS_OFFSET (127u) +#define CY_CAPSENSE_BUTTON1_STATUS_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_STATUS_PARAM_ID (0x0101007fu) + +#define CY_CAPSENSE_BUTTON1_PTRPOSITION_VALUE (cy_capsense_tuner.widgetContext[1].wdTouch.ptrPosition) +#define CY_CAPSENSE_BUTTON1_PTRPOSITION_OFFSET (128u) +#define CY_CAPSENSE_BUTTON1_PTRPOSITION_SIZE (4u) +#define CY_CAPSENSE_BUTTON1_PTRPOSITION_PARAM_ID (0x03010080u) + +#define CY_CAPSENSE_BUTTON1_NUM_POSITIONS_VALUE (cy_capsense_tuner.widgetContext[1].wdTouch.numPosition) +#define CY_CAPSENSE_BUTTON1_NUM_POSITIONS_OFFSET (132u) +#define CY_CAPSENSE_BUTTON1_NUM_POSITIONS_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_NUM_POSITIONS_PARAM_ID (0x01010084u) + +#define CY_CAPSENSE_LINEARSLIDER0_FINGER_CP_VALUE (cy_capsense_tuner.widgetContext[2].fingerCap) +#define CY_CAPSENSE_LINEARSLIDER0_FINGER_CP_OFFSET (136u) +#define CY_CAPSENSE_LINEARSLIDER0_FINGER_CP_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_FINGER_CP_PARAM_ID (0x06020088u) + +#define CY_CAPSENSE_LINEARSLIDER0_SIGPFC_VALUE (cy_capsense_tuner.widgetContext[2].sigPFC) +#define CY_CAPSENSE_LINEARSLIDER0_SIGPFC_OFFSET (138u) +#define CY_CAPSENSE_LINEARSLIDER0_SIGPFC_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SIGPFC_PARAM_ID (0x0602008au) + +#define CY_CAPSENSE_LINEARSLIDER0_RESOLUTION_VALUE (cy_capsense_tuner.widgetContext[2].resolution) +#define CY_CAPSENSE_LINEARSLIDER0_RESOLUTION_OFFSET (140u) +#define CY_CAPSENSE_LINEARSLIDER0_RESOLUTION_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_RESOLUTION_PARAM_ID (0x0602008cu) + +#define CY_CAPSENSE_LINEARSLIDER0_MAX_RAW_COUNT_VALUE (cy_capsense_tuner.widgetContext[2].maxRawCount) +#define CY_CAPSENSE_LINEARSLIDER0_MAX_RAW_COUNT_OFFSET (142u) +#define CY_CAPSENSE_LINEARSLIDER0_MAX_RAW_COUNT_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_MAX_RAW_COUNT_PARAM_ID (0x0602008eu) + +#define CY_CAPSENSE_LINEARSLIDER0_FINGER_TH_VALUE (cy_capsense_tuner.widgetContext[2].fingerTh) +#define CY_CAPSENSE_LINEARSLIDER0_FINGER_TH_OFFSET (144u) +#define CY_CAPSENSE_LINEARSLIDER0_FINGER_TH_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_FINGER_TH_PARAM_ID (0x02020090u) + +#define CY_CAPSENSE_LINEARSLIDER0_PROX_TOUCH_TH_VALUE (cy_capsense_tuner.widgetContext[2].proxTh) +#define CY_CAPSENSE_LINEARSLIDER0_PROX_TOUCH_TH_OFFSET (146u) +#define CY_CAPSENSE_LINEARSLIDER0_PROX_TOUCH_TH_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_PROX_TOUCH_TH_PARAM_ID (0x02020092u) + +#define CY_CAPSENSE_LINEARSLIDER0_LOW_BSLN_RST_VALUE (cy_capsense_tuner.widgetContext[2].lowBslnRst) +#define CY_CAPSENSE_LINEARSLIDER0_LOW_BSLN_RST_OFFSET (148u) +#define CY_CAPSENSE_LINEARSLIDER0_LOW_BSLN_RST_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_LOW_BSLN_RST_PARAM_ID (0x06020094u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS_CLK_VALUE (cy_capsense_tuner.widgetContext[2].snsClk) +#define CY_CAPSENSE_LINEARSLIDER0_SNS_CLK_OFFSET (150u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS_CLK_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS_CLK_PARAM_ID (0x06020096u) + +#define CY_CAPSENSE_LINEARSLIDER0_ROW_SNS_CLK_VALUE (cy_capsense_tuner.widgetContext[2].rowSnsClk) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_SNS_CLK_OFFSET (152u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_SNS_CLK_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_SNS_CLK_PARAM_ID (0x06020098u) + +#define CY_CAPSENSE_LINEARSLIDER0_GESTURE_DETECTED_VALUE (cy_capsense_tuner.widgetContext[2].gestureDetected) +#define CY_CAPSENSE_LINEARSLIDER0_GESTURE_DETECTED_OFFSET (154u) +#define CY_CAPSENSE_LINEARSLIDER0_GESTURE_DETECTED_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_GESTURE_DETECTED_PARAM_ID (0x0202009au) + +#define CY_CAPSENSE_LINEARSLIDER0_GESTURE_DIRECTION_VALUE (cy_capsense_tuner.widgetContext[2].gestureDirection) +#define CY_CAPSENSE_LINEARSLIDER0_GESTURE_DIRECTION_OFFSET (156u) +#define CY_CAPSENSE_LINEARSLIDER0_GESTURE_DIRECTION_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_GESTURE_DIRECTION_PARAM_ID (0x0202009cu) + +#define CY_CAPSENSE_LINEARSLIDER0_XDELTA_VALUE (cy_capsense_tuner.widgetContext[2].xDelta) +#define CY_CAPSENSE_LINEARSLIDER0_XDELTA_OFFSET (158u) +#define CY_CAPSENSE_LINEARSLIDER0_XDELTA_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_XDELTA_PARAM_ID (0x0202009eu) + +#define CY_CAPSENSE_LINEARSLIDER0_YDELTA_VALUE (cy_capsense_tuner.widgetContext[2].yDelta) +#define CY_CAPSENSE_LINEARSLIDER0_YDELTA_OFFSET (160u) +#define CY_CAPSENSE_LINEARSLIDER0_YDELTA_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_YDELTA_PARAM_ID (0x020200a0u) + +#define CY_CAPSENSE_LINEARSLIDER0_NOISE_TH_VALUE (cy_capsense_tuner.widgetContext[2].noiseTh) +#define CY_CAPSENSE_LINEARSLIDER0_NOISE_TH_OFFSET (162u) +#define CY_CAPSENSE_LINEARSLIDER0_NOISE_TH_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_NOISE_TH_PARAM_ID (0x010200a2u) + +#define CY_CAPSENSE_LINEARSLIDER0_NNOISE_TH_VALUE (cy_capsense_tuner.widgetContext[2].nNoiseTh) +#define CY_CAPSENSE_LINEARSLIDER0_NNOISE_TH_OFFSET (163u) +#define CY_CAPSENSE_LINEARSLIDER0_NNOISE_TH_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_NNOISE_TH_PARAM_ID (0x010200a3u) + +#define CY_CAPSENSE_LINEARSLIDER0_HYSTERESIS_VALUE (cy_capsense_tuner.widgetContext[2].hysteresis) +#define CY_CAPSENSE_LINEARSLIDER0_HYSTERESIS_OFFSET (164u) +#define CY_CAPSENSE_LINEARSLIDER0_HYSTERESIS_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_HYSTERESIS_PARAM_ID (0x010200a4u) + +#define CY_CAPSENSE_LINEARSLIDER0_ON_DEBOUNCE_VALUE (cy_capsense_tuner.widgetContext[2].onDebounce) +#define CY_CAPSENSE_LINEARSLIDER0_ON_DEBOUNCE_OFFSET (165u) +#define CY_CAPSENSE_LINEARSLIDER0_ON_DEBOUNCE_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_ON_DEBOUNCE_PARAM_ID (0x050200a5u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS_CLK_SOURCE_VALUE (cy_capsense_tuner.widgetContext[2].snsClkSource) +#define CY_CAPSENSE_LINEARSLIDER0_SNS_CLK_SOURCE_OFFSET (166u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS_CLK_SOURCE_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS_CLK_SOURCE_PARAM_ID (0x050200a6u) + +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD0_VALUE (cy_capsense_tuner.widgetContext[2].idacMod[0]) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD0_OFFSET (167u) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD0_PARAM_ID (0x050200a7u) + +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD1_VALUE (cy_capsense_tuner.widgetContext[2].idacMod[1]) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD1_OFFSET (168u) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD1_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD1_PARAM_ID (0x050200a8u) + +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD2_VALUE (cy_capsense_tuner.widgetContext[2].idacMod[2]) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD2_OFFSET (169u) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD2_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD2_PARAM_ID (0x050200a9u) + +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_GAIN_INDEX_VALUE (cy_capsense_tuner.widgetContext[2].idacGainIndex) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_GAIN_INDEX_OFFSET (170u) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_GAIN_INDEX_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_GAIN_INDEX_PARAM_ID (0x050200aau) + +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD0_VALUE (cy_capsense_tuner.widgetContext[2].rowIdacMod[0]) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD0_OFFSET (171u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD0_PARAM_ID (0x050200abu) + +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD1_VALUE (cy_capsense_tuner.widgetContext[2].rowIdacMod[1]) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD1_OFFSET (172u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD1_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD1_PARAM_ID (0x050200acu) + +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD2_VALUE (cy_capsense_tuner.widgetContext[2].rowIdacMod[2]) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD2_OFFSET (173u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD2_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD2_PARAM_ID (0x050200adu) + +#define CY_CAPSENSE_LINEARSLIDER0_REGULAR_IIR_BL_N_VALUE (cy_capsense_tuner.widgetContext[2].bslnCoeff) +#define CY_CAPSENSE_LINEARSLIDER0_REGULAR_IIR_BL_N_OFFSET (174u) +#define CY_CAPSENSE_LINEARSLIDER0_REGULAR_IIR_BL_N_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_REGULAR_IIR_BL_N_PARAM_ID (0x050200aeu) + +#define CY_CAPSENSE_LINEARSLIDER0_STATUS_VALUE (cy_capsense_tuner.widgetContext[2].status) +#define CY_CAPSENSE_LINEARSLIDER0_STATUS_OFFSET (175u) +#define CY_CAPSENSE_LINEARSLIDER0_STATUS_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_STATUS_PARAM_ID (0x010200afu) + +#define CY_CAPSENSE_LINEARSLIDER0_PTRPOSITION_VALUE (cy_capsense_tuner.widgetContext[2].wdTouch.ptrPosition) +#define CY_CAPSENSE_LINEARSLIDER0_PTRPOSITION_OFFSET (176u) +#define CY_CAPSENSE_LINEARSLIDER0_PTRPOSITION_SIZE (4u) +#define CY_CAPSENSE_LINEARSLIDER0_PTRPOSITION_PARAM_ID (0x030200b0u) + +#define CY_CAPSENSE_LINEARSLIDER0_NUM_POSITIONS_VALUE (cy_capsense_tuner.widgetContext[2].wdTouch.numPosition) +#define CY_CAPSENSE_LINEARSLIDER0_NUM_POSITIONS_OFFSET (180u) +#define CY_CAPSENSE_LINEARSLIDER0_NUM_POSITIONS_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_NUM_POSITIONS_PARAM_ID (0x010200b4u) + +#define CY_CAPSENSE_BUTTON0_RX0_RAW0_VALUE (cy_capsense_tuner.sensorContext[0].raw) +#define CY_CAPSENSE_BUTTON0_RX0_RAW0_OFFSET (184u) +#define CY_CAPSENSE_BUTTON0_RX0_RAW0_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_RX0_RAW0_PARAM_ID (0x020000b8u) + +#define CY_CAPSENSE_BUTTON0_RX0_BSLN0_VALUE (cy_capsense_tuner.sensorContext[0].bsln) +#define CY_CAPSENSE_BUTTON0_RX0_BSLN0_OFFSET (186u) +#define CY_CAPSENSE_BUTTON0_RX0_BSLN0_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_RX0_BSLN0_PARAM_ID (0x020000bau) + +#define CY_CAPSENSE_BUTTON0_RX0_DIFF0_VALUE (cy_capsense_tuner.sensorContext[0].diff) +#define CY_CAPSENSE_BUTTON0_RX0_DIFF0_OFFSET (188u) +#define CY_CAPSENSE_BUTTON0_RX0_DIFF0_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_RX0_DIFF0_PARAM_ID (0x020000bcu) + +#define CY_CAPSENSE_BUTTON0_RX0_STATUS0_VALUE (cy_capsense_tuner.sensorContext[0].status) +#define CY_CAPSENSE_BUTTON0_RX0_STATUS0_OFFSET (190u) +#define CY_CAPSENSE_BUTTON0_RX0_STATUS0_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_RX0_STATUS0_PARAM_ID (0x010000beu) + +#define CY_CAPSENSE_BUTTON0_RX0_NEG_BSLN_RST_CNT0_VALUE (cy_capsense_tuner.sensorContext[0].negBslnRstCnt) +#define CY_CAPSENSE_BUTTON0_RX0_NEG_BSLN_RST_CNT0_OFFSET (191u) +#define CY_CAPSENSE_BUTTON0_RX0_NEG_BSLN_RST_CNT0_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_RX0_NEG_BSLN_RST_CNT0_PARAM_ID (0x010000bfu) + +#define CY_CAPSENSE_BUTTON0_RX0_IDAC0_VALUE (cy_capsense_tuner.sensorContext[0].idacComp) +#define CY_CAPSENSE_BUTTON0_RX0_IDAC0_OFFSET (192u) +#define CY_CAPSENSE_BUTTON0_RX0_IDAC0_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_RX0_IDAC0_PARAM_ID (0x010000c0u) + +#define CY_CAPSENSE_BUTTON0_RX0_BSLN_EXT0_VALUE (cy_capsense_tuner.sensorContext[0].bslnExt) +#define CY_CAPSENSE_BUTTON0_RX0_BSLN_EXT0_OFFSET (193u) +#define CY_CAPSENSE_BUTTON0_RX0_BSLN_EXT0_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_RX0_BSLN_EXT0_PARAM_ID (0x010000c1u) + +#define CY_CAPSENSE_BUTTON1_RX0_RAW0_VALUE (cy_capsense_tuner.sensorContext[1].raw) +#define CY_CAPSENSE_BUTTON1_RX0_RAW0_OFFSET (194u) +#define CY_CAPSENSE_BUTTON1_RX0_RAW0_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_RX0_RAW0_PARAM_ID (0x020100c2u) + +#define CY_CAPSENSE_BUTTON1_RX0_BSLN0_VALUE (cy_capsense_tuner.sensorContext[1].bsln) +#define CY_CAPSENSE_BUTTON1_RX0_BSLN0_OFFSET (196u) +#define CY_CAPSENSE_BUTTON1_RX0_BSLN0_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_RX0_BSLN0_PARAM_ID (0x020100c4u) + +#define CY_CAPSENSE_BUTTON1_RX0_DIFF0_VALUE (cy_capsense_tuner.sensorContext[1].diff) +#define CY_CAPSENSE_BUTTON1_RX0_DIFF0_OFFSET (198u) +#define CY_CAPSENSE_BUTTON1_RX0_DIFF0_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_RX0_DIFF0_PARAM_ID (0x020100c6u) + +#define CY_CAPSENSE_BUTTON1_RX0_STATUS0_VALUE (cy_capsense_tuner.sensorContext[1].status) +#define CY_CAPSENSE_BUTTON1_RX0_STATUS0_OFFSET (200u) +#define CY_CAPSENSE_BUTTON1_RX0_STATUS0_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_RX0_STATUS0_PARAM_ID (0x010100c8u) + +#define CY_CAPSENSE_BUTTON1_RX0_NEG_BSLN_RST_CNT0_VALUE (cy_capsense_tuner.sensorContext[1].negBslnRstCnt) +#define CY_CAPSENSE_BUTTON1_RX0_NEG_BSLN_RST_CNT0_OFFSET (201u) +#define CY_CAPSENSE_BUTTON1_RX0_NEG_BSLN_RST_CNT0_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_RX0_NEG_BSLN_RST_CNT0_PARAM_ID (0x010100c9u) + +#define CY_CAPSENSE_BUTTON1_RX0_IDAC0_VALUE (cy_capsense_tuner.sensorContext[1].idacComp) +#define CY_CAPSENSE_BUTTON1_RX0_IDAC0_OFFSET (202u) +#define CY_CAPSENSE_BUTTON1_RX0_IDAC0_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_RX0_IDAC0_PARAM_ID (0x010100cau) + +#define CY_CAPSENSE_BUTTON1_RX0_BSLN_EXT0_VALUE (cy_capsense_tuner.sensorContext[1].bslnExt) +#define CY_CAPSENSE_BUTTON1_RX0_BSLN_EXT0_OFFSET (203u) +#define CY_CAPSENSE_BUTTON1_RX0_BSLN_EXT0_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_RX0_BSLN_EXT0_PARAM_ID (0x010100cbu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_RAW0_VALUE (cy_capsense_tuner.sensorContext[2].raw) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_RAW0_OFFSET (204u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_RAW0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_RAW0_PARAM_ID (0x020200ccu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_BSLN0_VALUE (cy_capsense_tuner.sensorContext[2].bsln) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_BSLN0_OFFSET (206u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_BSLN0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_BSLN0_PARAM_ID (0x020200ceu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_DIFF0_VALUE (cy_capsense_tuner.sensorContext[2].diff) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_DIFF0_OFFSET (208u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_DIFF0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_DIFF0_PARAM_ID (0x020200d0u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_STATUS0_VALUE (cy_capsense_tuner.sensorContext[2].status) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_STATUS0_OFFSET (210u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_STATUS0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_STATUS0_PARAM_ID (0x010200d2u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_NEG_BSLN_RST_CNT0_VALUE (cy_capsense_tuner.sensorContext[2].negBslnRstCnt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_NEG_BSLN_RST_CNT0_OFFSET (211u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_NEG_BSLN_RST_CNT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_NEG_BSLN_RST_CNT0_PARAM_ID (0x010200d3u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_IDAC0_VALUE (cy_capsense_tuner.sensorContext[2].idacComp) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_IDAC0_OFFSET (212u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_IDAC0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_IDAC0_PARAM_ID (0x010200d4u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_BSLN_EXT0_VALUE (cy_capsense_tuner.sensorContext[2].bslnExt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_BSLN_EXT0_OFFSET (213u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_BSLN_EXT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_BSLN_EXT0_PARAM_ID (0x010200d5u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_RAW0_VALUE (cy_capsense_tuner.sensorContext[3].raw) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_RAW0_OFFSET (214u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_RAW0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_RAW0_PARAM_ID (0x020200d6u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_BSLN0_VALUE (cy_capsense_tuner.sensorContext[3].bsln) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_BSLN0_OFFSET (216u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_BSLN0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_BSLN0_PARAM_ID (0x020200d8u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_DIFF0_VALUE (cy_capsense_tuner.sensorContext[3].diff) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_DIFF0_OFFSET (218u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_DIFF0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_DIFF0_PARAM_ID (0x020200dau) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_STATUS0_VALUE (cy_capsense_tuner.sensorContext[3].status) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_STATUS0_OFFSET (220u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_STATUS0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_STATUS0_PARAM_ID (0x010200dcu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_NEG_BSLN_RST_CNT0_VALUE (cy_capsense_tuner.sensorContext[3].negBslnRstCnt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_NEG_BSLN_RST_CNT0_OFFSET (221u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_NEG_BSLN_RST_CNT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_NEG_BSLN_RST_CNT0_PARAM_ID (0x010200ddu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_IDAC0_VALUE (cy_capsense_tuner.sensorContext[3].idacComp) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_IDAC0_OFFSET (222u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_IDAC0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_IDAC0_PARAM_ID (0x010200deu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_BSLN_EXT0_VALUE (cy_capsense_tuner.sensorContext[3].bslnExt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_BSLN_EXT0_OFFSET (223u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_BSLN_EXT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_BSLN_EXT0_PARAM_ID (0x010200dfu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_RAW0_VALUE (cy_capsense_tuner.sensorContext[4].raw) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_RAW0_OFFSET (224u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_RAW0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_RAW0_PARAM_ID (0x020200e0u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_BSLN0_VALUE (cy_capsense_tuner.sensorContext[4].bsln) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_BSLN0_OFFSET (226u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_BSLN0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_BSLN0_PARAM_ID (0x020200e2u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_DIFF0_VALUE (cy_capsense_tuner.sensorContext[4].diff) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_DIFF0_OFFSET (228u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_DIFF0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_DIFF0_PARAM_ID (0x020200e4u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_STATUS0_VALUE (cy_capsense_tuner.sensorContext[4].status) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_STATUS0_OFFSET (230u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_STATUS0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_STATUS0_PARAM_ID (0x010200e6u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_NEG_BSLN_RST_CNT0_VALUE (cy_capsense_tuner.sensorContext[4].negBslnRstCnt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_NEG_BSLN_RST_CNT0_OFFSET (231u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_NEG_BSLN_RST_CNT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_NEG_BSLN_RST_CNT0_PARAM_ID (0x010200e7u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_IDAC0_VALUE (cy_capsense_tuner.sensorContext[4].idacComp) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_IDAC0_OFFSET (232u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_IDAC0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_IDAC0_PARAM_ID (0x010200e8u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_BSLN_EXT0_VALUE (cy_capsense_tuner.sensorContext[4].bslnExt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_BSLN_EXT0_OFFSET (233u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_BSLN_EXT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_BSLN_EXT0_PARAM_ID (0x010200e9u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_RAW0_VALUE (cy_capsense_tuner.sensorContext[5].raw) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_RAW0_OFFSET (234u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_RAW0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_RAW0_PARAM_ID (0x020200eau) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_BSLN0_VALUE (cy_capsense_tuner.sensorContext[5].bsln) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_BSLN0_OFFSET (236u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_BSLN0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_BSLN0_PARAM_ID (0x020200ecu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_DIFF0_VALUE (cy_capsense_tuner.sensorContext[5].diff) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_DIFF0_OFFSET (238u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_DIFF0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_DIFF0_PARAM_ID (0x020200eeu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_STATUS0_VALUE (cy_capsense_tuner.sensorContext[5].status) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_STATUS0_OFFSET (240u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_STATUS0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_STATUS0_PARAM_ID (0x010200f0u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_NEG_BSLN_RST_CNT0_VALUE (cy_capsense_tuner.sensorContext[5].negBslnRstCnt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_NEG_BSLN_RST_CNT0_OFFSET (241u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_NEG_BSLN_RST_CNT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_NEG_BSLN_RST_CNT0_PARAM_ID (0x010200f1u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_IDAC0_VALUE (cy_capsense_tuner.sensorContext[5].idacComp) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_IDAC0_OFFSET (242u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_IDAC0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_IDAC0_PARAM_ID (0x010200f2u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_BSLN_EXT0_VALUE (cy_capsense_tuner.sensorContext[5].bslnExt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_BSLN_EXT0_OFFSET (243u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_BSLN_EXT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_BSLN_EXT0_PARAM_ID (0x010200f3u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_RAW0_VALUE (cy_capsense_tuner.sensorContext[6].raw) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_RAW0_OFFSET (244u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_RAW0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_RAW0_PARAM_ID (0x020200f4u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_BSLN0_VALUE (cy_capsense_tuner.sensorContext[6].bsln) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_BSLN0_OFFSET (246u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_BSLN0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_BSLN0_PARAM_ID (0x020200f6u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_DIFF0_VALUE (cy_capsense_tuner.sensorContext[6].diff) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_DIFF0_OFFSET (248u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_DIFF0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_DIFF0_PARAM_ID (0x020200f8u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_STATUS0_VALUE (cy_capsense_tuner.sensorContext[6].status) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_STATUS0_OFFSET (250u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_STATUS0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_STATUS0_PARAM_ID (0x010200fau) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_NEG_BSLN_RST_CNT0_VALUE (cy_capsense_tuner.sensorContext[6].negBslnRstCnt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_NEG_BSLN_RST_CNT0_OFFSET (251u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_NEG_BSLN_RST_CNT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_NEG_BSLN_RST_CNT0_PARAM_ID (0x010200fbu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_IDAC0_VALUE (cy_capsense_tuner.sensorContext[6].idacComp) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_IDAC0_OFFSET (252u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_IDAC0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_IDAC0_PARAM_ID (0x010200fcu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_BSLN_EXT0_VALUE (cy_capsense_tuner.sensorContext[6].bslnExt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_BSLN_EXT0_OFFSET (253u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_BSLN_EXT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_BSLN_EXT0_PARAM_ID (0x010200fdu) + +#define CY_CAPSENSE_LINEARSLIDER0_X0_VALUE (cy_capsense_tuner.position[0].x) +#define CY_CAPSENSE_LINEARSLIDER0_X0_OFFSET (254u) +#define CY_CAPSENSE_LINEARSLIDER0_X0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_X0_PARAM_ID (0x020200feu) + +#define CY_CAPSENSE_LINEARSLIDER0_Y0_VALUE (cy_capsense_tuner.position[0].y) +#define CY_CAPSENSE_LINEARSLIDER0_Y0_OFFSET (256u) +#define CY_CAPSENSE_LINEARSLIDER0_Y0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_Y0_PARAM_ID (0x02020100u) + +#define CY_CAPSENSE_LINEARSLIDER0_Z0_VALUE (cy_capsense_tuner.position[0].z) +#define CY_CAPSENSE_LINEARSLIDER0_Z0_OFFSET (258u) +#define CY_CAPSENSE_LINEARSLIDER0_Z0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_Z0_PARAM_ID (0x02020102u) + +#define CY_CAPSENSE_LINEARSLIDER0_ID0_VALUE (cy_capsense_tuner.position[0].id) +#define CY_CAPSENSE_LINEARSLIDER0_ID0_OFFSET (260u) +#define CY_CAPSENSE_LINEARSLIDER0_ID0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_ID0_PARAM_ID (0x02020104u) + +#else /* CY_CAPSENSE_MW_VERSION >= 300 */ +#define CY_CAPSENSE_CONFIG_ID_VALUE (cy_capsense_tuner.commonContext.configId) +#define CY_CAPSENSE_CONFIG_ID_OFFSET (0u) +#define CY_CAPSENSE_CONFIG_ID_SIZE (2u) +#define CY_CAPSENSE_CONFIG_ID_PARAM_ID (0x02000000u) + +#define CY_CAPSENSE_TUNER_CMD_VALUE (cy_capsense_tuner.commonContext.tunerCmd) +#define CY_CAPSENSE_TUNER_CMD_OFFSET (2u) +#define CY_CAPSENSE_TUNER_CMD_SIZE (2u) +#define CY_CAPSENSE_TUNER_CMD_PARAM_ID (0x02000002u) + +#define CY_CAPSENSE_SCAN_COUNTER_VALUE (cy_capsense_tuner.commonContext.scanCounter) +#define CY_CAPSENSE_SCAN_COUNTER_OFFSET (4u) +#define CY_CAPSENSE_SCAN_COUNTER_SIZE (2u) +#define CY_CAPSENSE_SCAN_COUNTER_PARAM_ID (0x02000004u) + +#define CY_CAPSENSE_TUNER_ST_VALUE (cy_capsense_tuner.commonContext.tunerSt) +#define CY_CAPSENSE_TUNER_ST_OFFSET (6u) +#define CY_CAPSENSE_TUNER_ST_SIZE (1u) +#define CY_CAPSENSE_TUNER_ST_PARAM_ID (0x01000006u) + +#define CY_CAPSENSE_INITDONE_VALUE (cy_capsense_tuner.commonContext.initDone) +#define CY_CAPSENSE_INITDONE_OFFSET (7u) +#define CY_CAPSENSE_INITDONE_SIZE (1u) +#define CY_CAPSENSE_INITDONE_PARAM_ID (0x01000007u) + +#define CY_CAPSENSE_STATUS_VALUE (cy_capsense_tuner.commonContext.status) +#define CY_CAPSENSE_STATUS_OFFSET (8u) +#define CY_CAPSENSE_STATUS_SIZE (4u) +#define CY_CAPSENSE_STATUS_PARAM_ID (0x03000008u) + +#define CY_CAPSENSE_TIMESTAMPINTERVAL_VALUE (cy_capsense_tuner.commonContext.timestampInterval) +#define CY_CAPSENSE_TIMESTAMPINTERVAL_OFFSET (12u) +#define CY_CAPSENSE_TIMESTAMPINTERVAL_SIZE (4u) +#define CY_CAPSENSE_TIMESTAMPINTERVAL_PARAM_ID (0x0300000cu) + +#define CY_CAPSENSE_TIMESTAMP_VALUE (cy_capsense_tuner.commonContext.timestamp) +#define CY_CAPSENSE_TIMESTAMP_OFFSET (16u) +#define CY_CAPSENSE_TIMESTAMP_SIZE (4u) +#define CY_CAPSENSE_TIMESTAMP_PARAM_ID (0x03000010u) + +#define CY_CAPSENSE_CSD_MOD_CLK_DIVIDER_VALUE (cy_capsense_tuner.commonContext.modCsdClk) +#define CY_CAPSENSE_CSD_MOD_CLK_DIVIDER_OFFSET (20u) +#define CY_CAPSENSE_CSD_MOD_CLK_DIVIDER_SIZE (1u) +#define CY_CAPSENSE_CSD_MOD_CLK_DIVIDER_PARAM_ID (0x01000014u) + +#define CY_CAPSENSE_CSX_MOD_CLK_DIVIDER_VALUE (cy_capsense_tuner.commonContext.modCsxClk) +#define CY_CAPSENSE_CSX_MOD_CLK_DIVIDER_OFFSET (21u) +#define CY_CAPSENSE_CSX_MOD_CLK_DIVIDER_SIZE (1u) +#define CY_CAPSENSE_CSX_MOD_CLK_DIVIDER_PARAM_ID (0x01000015u) + +#define CY_CAPSENSE_TUNER_CNT_VALUE (cy_capsense_tuner.commonContext.tunerCnt) +#define CY_CAPSENSE_TUNER_CNT_OFFSET (22u) +#define CY_CAPSENSE_TUNER_CNT_SIZE (1u) +#define CY_CAPSENSE_TUNER_CNT_PARAM_ID (0x01000016u) + +#define CY_CAPSENSE_BUTTON0_FINGER_CP_VALUE (cy_capsense_tuner.widgetContext[0].fingerCap) +#define CY_CAPSENSE_BUTTON0_FINGER_CP_OFFSET (24u) +#define CY_CAPSENSE_BUTTON0_FINGER_CP_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_FINGER_CP_PARAM_ID (0x06000018u) + +#define CY_CAPSENSE_BUTTON0_SIGPFC_VALUE (cy_capsense_tuner.widgetContext[0].sigPFC) +#define CY_CAPSENSE_BUTTON0_SIGPFC_OFFSET (26u) +#define CY_CAPSENSE_BUTTON0_SIGPFC_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_SIGPFC_PARAM_ID (0x0600001au) + +#define CY_CAPSENSE_BUTTON0_NUM_CONV_VALUE (cy_capsense_tuner.widgetContext[0].resolution) +#define CY_CAPSENSE_BUTTON0_NUM_CONV_OFFSET (28u) +#define CY_CAPSENSE_BUTTON0_NUM_CONV_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_NUM_CONV_PARAM_ID (0x0600001cu) + +#define CY_CAPSENSE_BUTTON0_MAX_RAW_COUNT_VALUE (cy_capsense_tuner.widgetContext[0].maxRawCount) +#define CY_CAPSENSE_BUTTON0_MAX_RAW_COUNT_OFFSET (30u) +#define CY_CAPSENSE_BUTTON0_MAX_RAW_COUNT_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_MAX_RAW_COUNT_PARAM_ID (0x0600001eu) + +#define CY_CAPSENSE_BUTTON0_ROW_MAX_RAW_COUNT_VALUE (cy_capsense_tuner.widgetContext[0].maxRawCountRow) +#define CY_CAPSENSE_BUTTON0_ROW_MAX_RAW_COUNT_OFFSET (32u) +#define CY_CAPSENSE_BUTTON0_ROW_MAX_RAW_COUNT_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_ROW_MAX_RAW_COUNT_PARAM_ID (0x06000020u) + +#define CY_CAPSENSE_BUTTON0_FINGER_TH_VALUE (cy_capsense_tuner.widgetContext[0].fingerTh) +#define CY_CAPSENSE_BUTTON0_FINGER_TH_OFFSET (34u) +#define CY_CAPSENSE_BUTTON0_FINGER_TH_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_FINGER_TH_PARAM_ID (0x06000022u) + +#define CY_CAPSENSE_BUTTON0_PROX_TOUCH_TH_VALUE (cy_capsense_tuner.widgetContext[0].proxTh) +#define CY_CAPSENSE_BUTTON0_PROX_TOUCH_TH_OFFSET (36u) +#define CY_CAPSENSE_BUTTON0_PROX_TOUCH_TH_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_PROX_TOUCH_TH_PARAM_ID (0x06000024u) + +#define CY_CAPSENSE_BUTTON0_LOW_BSLN_RST_VALUE (cy_capsense_tuner.widgetContext[0].lowBslnRst) +#define CY_CAPSENSE_BUTTON0_LOW_BSLN_RST_OFFSET (38u) +#define CY_CAPSENSE_BUTTON0_LOW_BSLN_RST_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_LOW_BSLN_RST_PARAM_ID (0x06000026u) + +#define CY_CAPSENSE_BUTTON0_TX_CLK_VALUE (cy_capsense_tuner.widgetContext[0].snsClk) +#define CY_CAPSENSE_BUTTON0_TX_CLK_OFFSET (40u) +#define CY_CAPSENSE_BUTTON0_TX_CLK_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_TX_CLK_PARAM_ID (0x06000028u) + +#define CY_CAPSENSE_BUTTON0_ROW_SNS_CLK_VALUE (cy_capsense_tuner.widgetContext[0].rowSnsClk) +#define CY_CAPSENSE_BUTTON0_ROW_SNS_CLK_OFFSET (42u) +#define CY_CAPSENSE_BUTTON0_ROW_SNS_CLK_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_ROW_SNS_CLK_PARAM_ID (0x0600002au) + +#define CY_CAPSENSE_BUTTON0_GESTURE_DETECTED_VALUE (cy_capsense_tuner.widgetContext[0].gestureDetected) +#define CY_CAPSENSE_BUTTON0_GESTURE_DETECTED_OFFSET (44u) +#define CY_CAPSENSE_BUTTON0_GESTURE_DETECTED_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_GESTURE_DETECTED_PARAM_ID (0x0200002cu) + +#define CY_CAPSENSE_BUTTON0_GESTURE_DIRECTION_VALUE (cy_capsense_tuner.widgetContext[0].gestureDirection) +#define CY_CAPSENSE_BUTTON0_GESTURE_DIRECTION_OFFSET (46u) +#define CY_CAPSENSE_BUTTON0_GESTURE_DIRECTION_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_GESTURE_DIRECTION_PARAM_ID (0x0200002eu) + +#define CY_CAPSENSE_BUTTON0_XDELTA_VALUE (cy_capsense_tuner.widgetContext[0].xDelta) +#define CY_CAPSENSE_BUTTON0_XDELTA_OFFSET (48u) +#define CY_CAPSENSE_BUTTON0_XDELTA_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_XDELTA_PARAM_ID (0x02000030u) + +#define CY_CAPSENSE_BUTTON0_YDELTA_VALUE (cy_capsense_tuner.widgetContext[0].yDelta) +#define CY_CAPSENSE_BUTTON0_YDELTA_OFFSET (50u) +#define CY_CAPSENSE_BUTTON0_YDELTA_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_YDELTA_PARAM_ID (0x02000032u) + +#define CY_CAPSENSE_BUTTON0_NOISE_TH_VALUE (cy_capsense_tuner.widgetContext[0].noiseTh) +#define CY_CAPSENSE_BUTTON0_NOISE_TH_OFFSET (52u) +#define CY_CAPSENSE_BUTTON0_NOISE_TH_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_NOISE_TH_PARAM_ID (0x06000034u) + +#define CY_CAPSENSE_BUTTON0_NNOISE_TH_VALUE (cy_capsense_tuner.widgetContext[0].nNoiseTh) +#define CY_CAPSENSE_BUTTON0_NNOISE_TH_OFFSET (54u) +#define CY_CAPSENSE_BUTTON0_NNOISE_TH_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_NNOISE_TH_PARAM_ID (0x06000036u) + +#define CY_CAPSENSE_BUTTON0_HYSTERESIS_VALUE (cy_capsense_tuner.widgetContext[0].hysteresis) +#define CY_CAPSENSE_BUTTON0_HYSTERESIS_OFFSET (56u) +#define CY_CAPSENSE_BUTTON0_HYSTERESIS_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_HYSTERESIS_PARAM_ID (0x06000038u) + +#define CY_CAPSENSE_BUTTON0_ON_DEBOUNCE_VALUE (cy_capsense_tuner.widgetContext[0].onDebounce) +#define CY_CAPSENSE_BUTTON0_ON_DEBOUNCE_OFFSET (58u) +#define CY_CAPSENSE_BUTTON0_ON_DEBOUNCE_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_ON_DEBOUNCE_PARAM_ID (0x0500003au) + +#define CY_CAPSENSE_BUTTON0_TX_CLK_SOURCE_VALUE (cy_capsense_tuner.widgetContext[0].snsClkSource) +#define CY_CAPSENSE_BUTTON0_TX_CLK_SOURCE_OFFSET (59u) +#define CY_CAPSENSE_BUTTON0_TX_CLK_SOURCE_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_TX_CLK_SOURCE_PARAM_ID (0x0500003bu) + +#define CY_CAPSENSE_BUTTON0_IDAC_MOD0_VALUE (cy_capsense_tuner.widgetContext[0].idacMod[0]) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD0_OFFSET (60u) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD0_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD0_PARAM_ID (0x0500003cu) + +#define CY_CAPSENSE_BUTTON0_IDAC_MOD1_VALUE (cy_capsense_tuner.widgetContext[0].idacMod[1]) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD1_OFFSET (61u) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD1_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD1_PARAM_ID (0x0500003du) + +#define CY_CAPSENSE_BUTTON0_IDAC_MOD2_VALUE (cy_capsense_tuner.widgetContext[0].idacMod[2]) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD2_OFFSET (62u) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD2_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_IDAC_MOD2_PARAM_ID (0x0500003eu) + +#define CY_CAPSENSE_BUTTON0_IDAC_GAIN_INDEX_VALUE (cy_capsense_tuner.widgetContext[0].idacGainIndex) +#define CY_CAPSENSE_BUTTON0_IDAC_GAIN_INDEX_OFFSET (63u) +#define CY_CAPSENSE_BUTTON0_IDAC_GAIN_INDEX_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_IDAC_GAIN_INDEX_PARAM_ID (0x0500003fu) + +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD0_VALUE (cy_capsense_tuner.widgetContext[0].rowIdacMod[0]) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD0_OFFSET (64u) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD0_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD0_PARAM_ID (0x05000040u) + +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD1_VALUE (cy_capsense_tuner.widgetContext[0].rowIdacMod[1]) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD1_OFFSET (65u) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD1_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD1_PARAM_ID (0x05000041u) + +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD2_VALUE (cy_capsense_tuner.widgetContext[0].rowIdacMod[2]) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD2_OFFSET (66u) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD2_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_ROW_IDAC_MOD2_PARAM_ID (0x05000042u) + +#define CY_CAPSENSE_BUTTON0_REGULAR_IIR_BL_N_VALUE (cy_capsense_tuner.widgetContext[0].bslnCoeff) +#define CY_CAPSENSE_BUTTON0_REGULAR_IIR_BL_N_OFFSET (67u) +#define CY_CAPSENSE_BUTTON0_REGULAR_IIR_BL_N_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_REGULAR_IIR_BL_N_PARAM_ID (0x05000043u) + +#define CY_CAPSENSE_BUTTON0_STATUS_VALUE (cy_capsense_tuner.widgetContext[0].status) +#define CY_CAPSENSE_BUTTON0_STATUS_OFFSET (68u) +#define CY_CAPSENSE_BUTTON0_STATUS_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_STATUS_PARAM_ID (0x01000044u) + +#define CY_CAPSENSE_BUTTON0_PTRPOSITION_VALUE (cy_capsense_tuner.widgetContext[0].wdTouch.ptrPosition) +#define CY_CAPSENSE_BUTTON0_PTRPOSITION_OFFSET (72u) +#define CY_CAPSENSE_BUTTON0_PTRPOSITION_SIZE (4u) +#define CY_CAPSENSE_BUTTON0_PTRPOSITION_PARAM_ID (0x03000048u) + +#define CY_CAPSENSE_BUTTON0_NUM_POSITIONS_VALUE (cy_capsense_tuner.widgetContext[0].wdTouch.numPosition) +#define CY_CAPSENSE_BUTTON0_NUM_POSITIONS_OFFSET (76u) +#define CY_CAPSENSE_BUTTON0_NUM_POSITIONS_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_NUM_POSITIONS_PARAM_ID (0x0100004cu) + +#define CY_CAPSENSE_BUTTON1_FINGER_CP_VALUE (cy_capsense_tuner.widgetContext[1].fingerCap) +#define CY_CAPSENSE_BUTTON1_FINGER_CP_OFFSET (80u) +#define CY_CAPSENSE_BUTTON1_FINGER_CP_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_FINGER_CP_PARAM_ID (0x06010050u) + +#define CY_CAPSENSE_BUTTON1_SIGPFC_VALUE (cy_capsense_tuner.widgetContext[1].sigPFC) +#define CY_CAPSENSE_BUTTON1_SIGPFC_OFFSET (82u) +#define CY_CAPSENSE_BUTTON1_SIGPFC_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_SIGPFC_PARAM_ID (0x06010052u) + +#define CY_CAPSENSE_BUTTON1_NUM_CONV_VALUE (cy_capsense_tuner.widgetContext[1].resolution) +#define CY_CAPSENSE_BUTTON1_NUM_CONV_OFFSET (84u) +#define CY_CAPSENSE_BUTTON1_NUM_CONV_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_NUM_CONV_PARAM_ID (0x06010054u) + +#define CY_CAPSENSE_BUTTON1_MAX_RAW_COUNT_VALUE (cy_capsense_tuner.widgetContext[1].maxRawCount) +#define CY_CAPSENSE_BUTTON1_MAX_RAW_COUNT_OFFSET (86u) +#define CY_CAPSENSE_BUTTON1_MAX_RAW_COUNT_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_MAX_RAW_COUNT_PARAM_ID (0x06010056u) + +#define CY_CAPSENSE_BUTTON1_ROW_MAX_RAW_COUNT_VALUE (cy_capsense_tuner.widgetContext[1].maxRawCountRow) +#define CY_CAPSENSE_BUTTON1_ROW_MAX_RAW_COUNT_OFFSET (88u) +#define CY_CAPSENSE_BUTTON1_ROW_MAX_RAW_COUNT_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_ROW_MAX_RAW_COUNT_PARAM_ID (0x06010058u) + +#define CY_CAPSENSE_BUTTON1_FINGER_TH_VALUE (cy_capsense_tuner.widgetContext[1].fingerTh) +#define CY_CAPSENSE_BUTTON1_FINGER_TH_OFFSET (90u) +#define CY_CAPSENSE_BUTTON1_FINGER_TH_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_FINGER_TH_PARAM_ID (0x0601005au) + +#define CY_CAPSENSE_BUTTON1_PROX_TOUCH_TH_VALUE (cy_capsense_tuner.widgetContext[1].proxTh) +#define CY_CAPSENSE_BUTTON1_PROX_TOUCH_TH_OFFSET (92u) +#define CY_CAPSENSE_BUTTON1_PROX_TOUCH_TH_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_PROX_TOUCH_TH_PARAM_ID (0x0601005cu) + +#define CY_CAPSENSE_BUTTON1_LOW_BSLN_RST_VALUE (cy_capsense_tuner.widgetContext[1].lowBslnRst) +#define CY_CAPSENSE_BUTTON1_LOW_BSLN_RST_OFFSET (94u) +#define CY_CAPSENSE_BUTTON1_LOW_BSLN_RST_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_LOW_BSLN_RST_PARAM_ID (0x0601005eu) + +#define CY_CAPSENSE_BUTTON1_TX_CLK_VALUE (cy_capsense_tuner.widgetContext[1].snsClk) +#define CY_CAPSENSE_BUTTON1_TX_CLK_OFFSET (96u) +#define CY_CAPSENSE_BUTTON1_TX_CLK_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_TX_CLK_PARAM_ID (0x06010060u) + +#define CY_CAPSENSE_BUTTON1_ROW_SNS_CLK_VALUE (cy_capsense_tuner.widgetContext[1].rowSnsClk) +#define CY_CAPSENSE_BUTTON1_ROW_SNS_CLK_OFFSET (98u) +#define CY_CAPSENSE_BUTTON1_ROW_SNS_CLK_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_ROW_SNS_CLK_PARAM_ID (0x06010062u) + +#define CY_CAPSENSE_BUTTON1_GESTURE_DETECTED_VALUE (cy_capsense_tuner.widgetContext[1].gestureDetected) +#define CY_CAPSENSE_BUTTON1_GESTURE_DETECTED_OFFSET (100u) +#define CY_CAPSENSE_BUTTON1_GESTURE_DETECTED_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_GESTURE_DETECTED_PARAM_ID (0x02010064u) + +#define CY_CAPSENSE_BUTTON1_GESTURE_DIRECTION_VALUE (cy_capsense_tuner.widgetContext[1].gestureDirection) +#define CY_CAPSENSE_BUTTON1_GESTURE_DIRECTION_OFFSET (102u) +#define CY_CAPSENSE_BUTTON1_GESTURE_DIRECTION_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_GESTURE_DIRECTION_PARAM_ID (0x02010066u) + +#define CY_CAPSENSE_BUTTON1_XDELTA_VALUE (cy_capsense_tuner.widgetContext[1].xDelta) +#define CY_CAPSENSE_BUTTON1_XDELTA_OFFSET (104u) +#define CY_CAPSENSE_BUTTON1_XDELTA_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_XDELTA_PARAM_ID (0x02010068u) + +#define CY_CAPSENSE_BUTTON1_YDELTA_VALUE (cy_capsense_tuner.widgetContext[1].yDelta) +#define CY_CAPSENSE_BUTTON1_YDELTA_OFFSET (106u) +#define CY_CAPSENSE_BUTTON1_YDELTA_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_YDELTA_PARAM_ID (0x0201006au) + +#define CY_CAPSENSE_BUTTON1_NOISE_TH_VALUE (cy_capsense_tuner.widgetContext[1].noiseTh) +#define CY_CAPSENSE_BUTTON1_NOISE_TH_OFFSET (108u) +#define CY_CAPSENSE_BUTTON1_NOISE_TH_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_NOISE_TH_PARAM_ID (0x0601006cu) + +#define CY_CAPSENSE_BUTTON1_NNOISE_TH_VALUE (cy_capsense_tuner.widgetContext[1].nNoiseTh) +#define CY_CAPSENSE_BUTTON1_NNOISE_TH_OFFSET (110u) +#define CY_CAPSENSE_BUTTON1_NNOISE_TH_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_NNOISE_TH_PARAM_ID (0x0601006eu) + +#define CY_CAPSENSE_BUTTON1_HYSTERESIS_VALUE (cy_capsense_tuner.widgetContext[1].hysteresis) +#define CY_CAPSENSE_BUTTON1_HYSTERESIS_OFFSET (112u) +#define CY_CAPSENSE_BUTTON1_HYSTERESIS_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_HYSTERESIS_PARAM_ID (0x06010070u) + +#define CY_CAPSENSE_BUTTON1_ON_DEBOUNCE_VALUE (cy_capsense_tuner.widgetContext[1].onDebounce) +#define CY_CAPSENSE_BUTTON1_ON_DEBOUNCE_OFFSET (114u) +#define CY_CAPSENSE_BUTTON1_ON_DEBOUNCE_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_ON_DEBOUNCE_PARAM_ID (0x05010072u) + +#define CY_CAPSENSE_BUTTON1_TX_CLK_SOURCE_VALUE (cy_capsense_tuner.widgetContext[1].snsClkSource) +#define CY_CAPSENSE_BUTTON1_TX_CLK_SOURCE_OFFSET (115u) +#define CY_CAPSENSE_BUTTON1_TX_CLK_SOURCE_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_TX_CLK_SOURCE_PARAM_ID (0x05010073u) + +#define CY_CAPSENSE_BUTTON1_IDAC_MOD0_VALUE (cy_capsense_tuner.widgetContext[1].idacMod[0]) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD0_OFFSET (116u) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD0_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD0_PARAM_ID (0x05010074u) + +#define CY_CAPSENSE_BUTTON1_IDAC_MOD1_VALUE (cy_capsense_tuner.widgetContext[1].idacMod[1]) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD1_OFFSET (117u) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD1_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD1_PARAM_ID (0x05010075u) + +#define CY_CAPSENSE_BUTTON1_IDAC_MOD2_VALUE (cy_capsense_tuner.widgetContext[1].idacMod[2]) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD2_OFFSET (118u) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD2_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_IDAC_MOD2_PARAM_ID (0x05010076u) + +#define CY_CAPSENSE_BUTTON1_IDAC_GAIN_INDEX_VALUE (cy_capsense_tuner.widgetContext[1].idacGainIndex) +#define CY_CAPSENSE_BUTTON1_IDAC_GAIN_INDEX_OFFSET (119u) +#define CY_CAPSENSE_BUTTON1_IDAC_GAIN_INDEX_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_IDAC_GAIN_INDEX_PARAM_ID (0x05010077u) + +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD0_VALUE (cy_capsense_tuner.widgetContext[1].rowIdacMod[0]) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD0_OFFSET (120u) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD0_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD0_PARAM_ID (0x05010078u) + +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD1_VALUE (cy_capsense_tuner.widgetContext[1].rowIdacMod[1]) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD1_OFFSET (121u) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD1_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD1_PARAM_ID (0x05010079u) + +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD2_VALUE (cy_capsense_tuner.widgetContext[1].rowIdacMod[2]) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD2_OFFSET (122u) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD2_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_ROW_IDAC_MOD2_PARAM_ID (0x0501007au) + +#define CY_CAPSENSE_BUTTON1_REGULAR_IIR_BL_N_VALUE (cy_capsense_tuner.widgetContext[1].bslnCoeff) +#define CY_CAPSENSE_BUTTON1_REGULAR_IIR_BL_N_OFFSET (123u) +#define CY_CAPSENSE_BUTTON1_REGULAR_IIR_BL_N_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_REGULAR_IIR_BL_N_PARAM_ID (0x0501007bu) + +#define CY_CAPSENSE_BUTTON1_STATUS_VALUE (cy_capsense_tuner.widgetContext[1].status) +#define CY_CAPSENSE_BUTTON1_STATUS_OFFSET (124u) +#define CY_CAPSENSE_BUTTON1_STATUS_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_STATUS_PARAM_ID (0x0101007cu) + +#define CY_CAPSENSE_BUTTON1_PTRPOSITION_VALUE (cy_capsense_tuner.widgetContext[1].wdTouch.ptrPosition) +#define CY_CAPSENSE_BUTTON1_PTRPOSITION_OFFSET (128u) +#define CY_CAPSENSE_BUTTON1_PTRPOSITION_SIZE (4u) +#define CY_CAPSENSE_BUTTON1_PTRPOSITION_PARAM_ID (0x03010080u) + +#define CY_CAPSENSE_BUTTON1_NUM_POSITIONS_VALUE (cy_capsense_tuner.widgetContext[1].wdTouch.numPosition) +#define CY_CAPSENSE_BUTTON1_NUM_POSITIONS_OFFSET (132u) +#define CY_CAPSENSE_BUTTON1_NUM_POSITIONS_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_NUM_POSITIONS_PARAM_ID (0x01010084u) + +#define CY_CAPSENSE_LINEARSLIDER0_FINGER_CP_VALUE (cy_capsense_tuner.widgetContext[2].fingerCap) +#define CY_CAPSENSE_LINEARSLIDER0_FINGER_CP_OFFSET (136u) +#define CY_CAPSENSE_LINEARSLIDER0_FINGER_CP_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_FINGER_CP_PARAM_ID (0x06020088u) + +#define CY_CAPSENSE_LINEARSLIDER0_SIGPFC_VALUE (cy_capsense_tuner.widgetContext[2].sigPFC) +#define CY_CAPSENSE_LINEARSLIDER0_SIGPFC_OFFSET (138u) +#define CY_CAPSENSE_LINEARSLIDER0_SIGPFC_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SIGPFC_PARAM_ID (0x0602008au) + +#define CY_CAPSENSE_LINEARSLIDER0_RESOLUTION_VALUE (cy_capsense_tuner.widgetContext[2].resolution) +#define CY_CAPSENSE_LINEARSLIDER0_RESOLUTION_OFFSET (140u) +#define CY_CAPSENSE_LINEARSLIDER0_RESOLUTION_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_RESOLUTION_PARAM_ID (0x0602008cu) + +#define CY_CAPSENSE_LINEARSLIDER0_MAX_RAW_COUNT_VALUE (cy_capsense_tuner.widgetContext[2].maxRawCount) +#define CY_CAPSENSE_LINEARSLIDER0_MAX_RAW_COUNT_OFFSET (142u) +#define CY_CAPSENSE_LINEARSLIDER0_MAX_RAW_COUNT_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_MAX_RAW_COUNT_PARAM_ID (0x0602008eu) + +#define CY_CAPSENSE_LINEARSLIDER0_ROW_MAX_RAW_COUNT_VALUE (cy_capsense_tuner.widgetContext[2].maxRawCountRow) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_MAX_RAW_COUNT_OFFSET (144u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_MAX_RAW_COUNT_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_MAX_RAW_COUNT_PARAM_ID (0x06020090u) + +#define CY_CAPSENSE_LINEARSLIDER0_FINGER_TH_VALUE (cy_capsense_tuner.widgetContext[2].fingerTh) +#define CY_CAPSENSE_LINEARSLIDER0_FINGER_TH_OFFSET (146u) +#define CY_CAPSENSE_LINEARSLIDER0_FINGER_TH_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_FINGER_TH_PARAM_ID (0x02020092u) + +#define CY_CAPSENSE_LINEARSLIDER0_PROX_TOUCH_TH_VALUE (cy_capsense_tuner.widgetContext[2].proxTh) +#define CY_CAPSENSE_LINEARSLIDER0_PROX_TOUCH_TH_OFFSET (148u) +#define CY_CAPSENSE_LINEARSLIDER0_PROX_TOUCH_TH_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_PROX_TOUCH_TH_PARAM_ID (0x02020094u) + +#define CY_CAPSENSE_LINEARSLIDER0_LOW_BSLN_RST_VALUE (cy_capsense_tuner.widgetContext[2].lowBslnRst) +#define CY_CAPSENSE_LINEARSLIDER0_LOW_BSLN_RST_OFFSET (150u) +#define CY_CAPSENSE_LINEARSLIDER0_LOW_BSLN_RST_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_LOW_BSLN_RST_PARAM_ID (0x06020096u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS_CLK_VALUE (cy_capsense_tuner.widgetContext[2].snsClk) +#define CY_CAPSENSE_LINEARSLIDER0_SNS_CLK_OFFSET (152u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS_CLK_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS_CLK_PARAM_ID (0x06020098u) + +#define CY_CAPSENSE_LINEARSLIDER0_ROW_SNS_CLK_VALUE (cy_capsense_tuner.widgetContext[2].rowSnsClk) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_SNS_CLK_OFFSET (154u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_SNS_CLK_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_SNS_CLK_PARAM_ID (0x0602009au) + +#define CY_CAPSENSE_LINEARSLIDER0_GESTURE_DETECTED_VALUE (cy_capsense_tuner.widgetContext[2].gestureDetected) +#define CY_CAPSENSE_LINEARSLIDER0_GESTURE_DETECTED_OFFSET (156u) +#define CY_CAPSENSE_LINEARSLIDER0_GESTURE_DETECTED_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_GESTURE_DETECTED_PARAM_ID (0x0202009cu) + +#define CY_CAPSENSE_LINEARSLIDER0_GESTURE_DIRECTION_VALUE (cy_capsense_tuner.widgetContext[2].gestureDirection) +#define CY_CAPSENSE_LINEARSLIDER0_GESTURE_DIRECTION_OFFSET (158u) +#define CY_CAPSENSE_LINEARSLIDER0_GESTURE_DIRECTION_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_GESTURE_DIRECTION_PARAM_ID (0x0202009eu) + +#define CY_CAPSENSE_LINEARSLIDER0_XDELTA_VALUE (cy_capsense_tuner.widgetContext[2].xDelta) +#define CY_CAPSENSE_LINEARSLIDER0_XDELTA_OFFSET (160u) +#define CY_CAPSENSE_LINEARSLIDER0_XDELTA_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_XDELTA_PARAM_ID (0x020200a0u) + +#define CY_CAPSENSE_LINEARSLIDER0_YDELTA_VALUE (cy_capsense_tuner.widgetContext[2].yDelta) +#define CY_CAPSENSE_LINEARSLIDER0_YDELTA_OFFSET (162u) +#define CY_CAPSENSE_LINEARSLIDER0_YDELTA_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_YDELTA_PARAM_ID (0x020200a2u) + +#define CY_CAPSENSE_LINEARSLIDER0_NOISE_TH_VALUE (cy_capsense_tuner.widgetContext[2].noiseTh) +#define CY_CAPSENSE_LINEARSLIDER0_NOISE_TH_OFFSET (164u) +#define CY_CAPSENSE_LINEARSLIDER0_NOISE_TH_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_NOISE_TH_PARAM_ID (0x020200a4u) + +#define CY_CAPSENSE_LINEARSLIDER0_NNOISE_TH_VALUE (cy_capsense_tuner.widgetContext[2].nNoiseTh) +#define CY_CAPSENSE_LINEARSLIDER0_NNOISE_TH_OFFSET (166u) +#define CY_CAPSENSE_LINEARSLIDER0_NNOISE_TH_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_NNOISE_TH_PARAM_ID (0x020200a6u) + +#define CY_CAPSENSE_LINEARSLIDER0_HYSTERESIS_VALUE (cy_capsense_tuner.widgetContext[2].hysteresis) +#define CY_CAPSENSE_LINEARSLIDER0_HYSTERESIS_OFFSET (168u) +#define CY_CAPSENSE_LINEARSLIDER0_HYSTERESIS_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_HYSTERESIS_PARAM_ID (0x020200a8u) + +#define CY_CAPSENSE_LINEARSLIDER0_ON_DEBOUNCE_VALUE (cy_capsense_tuner.widgetContext[2].onDebounce) +#define CY_CAPSENSE_LINEARSLIDER0_ON_DEBOUNCE_OFFSET (170u) +#define CY_CAPSENSE_LINEARSLIDER0_ON_DEBOUNCE_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_ON_DEBOUNCE_PARAM_ID (0x050200aau) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS_CLK_SOURCE_VALUE (cy_capsense_tuner.widgetContext[2].snsClkSource) +#define CY_CAPSENSE_LINEARSLIDER0_SNS_CLK_SOURCE_OFFSET (171u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS_CLK_SOURCE_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS_CLK_SOURCE_PARAM_ID (0x050200abu) + +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD0_VALUE (cy_capsense_tuner.widgetContext[2].idacMod[0]) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD0_OFFSET (172u) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD0_PARAM_ID (0x050200acu) + +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD1_VALUE (cy_capsense_tuner.widgetContext[2].idacMod[1]) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD1_OFFSET (173u) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD1_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD1_PARAM_ID (0x050200adu) + +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD2_VALUE (cy_capsense_tuner.widgetContext[2].idacMod[2]) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD2_OFFSET (174u) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD2_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_MOD2_PARAM_ID (0x050200aeu) + +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_GAIN_INDEX_VALUE (cy_capsense_tuner.widgetContext[2].idacGainIndex) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_GAIN_INDEX_OFFSET (175u) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_GAIN_INDEX_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_IDAC_GAIN_INDEX_PARAM_ID (0x050200afu) + +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD0_VALUE (cy_capsense_tuner.widgetContext[2].rowIdacMod[0]) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD0_OFFSET (176u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD0_PARAM_ID (0x050200b0u) + +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD1_VALUE (cy_capsense_tuner.widgetContext[2].rowIdacMod[1]) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD1_OFFSET (177u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD1_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD1_PARAM_ID (0x050200b1u) + +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD2_VALUE (cy_capsense_tuner.widgetContext[2].rowIdacMod[2]) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD2_OFFSET (178u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD2_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_ROW_IDAC_MOD2_PARAM_ID (0x050200b2u) + +#define CY_CAPSENSE_LINEARSLIDER0_REGULAR_IIR_BL_N_VALUE (cy_capsense_tuner.widgetContext[2].bslnCoeff) +#define CY_CAPSENSE_LINEARSLIDER0_REGULAR_IIR_BL_N_OFFSET (179u) +#define CY_CAPSENSE_LINEARSLIDER0_REGULAR_IIR_BL_N_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_REGULAR_IIR_BL_N_PARAM_ID (0x050200b3u) + +#define CY_CAPSENSE_LINEARSLIDER0_STATUS_VALUE (cy_capsense_tuner.widgetContext[2].status) +#define CY_CAPSENSE_LINEARSLIDER0_STATUS_OFFSET (180u) +#define CY_CAPSENSE_LINEARSLIDER0_STATUS_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_STATUS_PARAM_ID (0x010200b4u) + +#define CY_CAPSENSE_LINEARSLIDER0_PTRPOSITION_VALUE (cy_capsense_tuner.widgetContext[2].wdTouch.ptrPosition) +#define CY_CAPSENSE_LINEARSLIDER0_PTRPOSITION_OFFSET (184u) +#define CY_CAPSENSE_LINEARSLIDER0_PTRPOSITION_SIZE (4u) +#define CY_CAPSENSE_LINEARSLIDER0_PTRPOSITION_PARAM_ID (0x030200b8u) + +#define CY_CAPSENSE_LINEARSLIDER0_NUM_POSITIONS_VALUE (cy_capsense_tuner.widgetContext[2].wdTouch.numPosition) +#define CY_CAPSENSE_LINEARSLIDER0_NUM_POSITIONS_OFFSET (188u) +#define CY_CAPSENSE_LINEARSLIDER0_NUM_POSITIONS_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_NUM_POSITIONS_PARAM_ID (0x010200bcu) + +#define CY_CAPSENSE_BUTTON0_RX0_RAW0_VALUE (cy_capsense_tuner.sensorContext[0].raw) +#define CY_CAPSENSE_BUTTON0_RX0_RAW0_OFFSET (192u) +#define CY_CAPSENSE_BUTTON0_RX0_RAW0_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_RX0_RAW0_PARAM_ID (0x020000c0u) + +#define CY_CAPSENSE_BUTTON0_RX0_BSLN0_VALUE (cy_capsense_tuner.sensorContext[0].bsln) +#define CY_CAPSENSE_BUTTON0_RX0_BSLN0_OFFSET (194u) +#define CY_CAPSENSE_BUTTON0_RX0_BSLN0_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_RX0_BSLN0_PARAM_ID (0x020000c2u) + +#define CY_CAPSENSE_BUTTON0_RX0_DIFF0_VALUE (cy_capsense_tuner.sensorContext[0].diff) +#define CY_CAPSENSE_BUTTON0_RX0_DIFF0_OFFSET (196u) +#define CY_CAPSENSE_BUTTON0_RX0_DIFF0_SIZE (2u) +#define CY_CAPSENSE_BUTTON0_RX0_DIFF0_PARAM_ID (0x020000c4u) + +#define CY_CAPSENSE_BUTTON0_RX0_STATUS0_VALUE (cy_capsense_tuner.sensorContext[0].status) +#define CY_CAPSENSE_BUTTON0_RX0_STATUS0_OFFSET (198u) +#define CY_CAPSENSE_BUTTON0_RX0_STATUS0_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_RX0_STATUS0_PARAM_ID (0x010000c6u) + +#define CY_CAPSENSE_BUTTON0_RX0_NEG_BSLN_RST_CNT0_VALUE (cy_capsense_tuner.sensorContext[0].negBslnRstCnt) +#define CY_CAPSENSE_BUTTON0_RX0_NEG_BSLN_RST_CNT0_OFFSET (199u) +#define CY_CAPSENSE_BUTTON0_RX0_NEG_BSLN_RST_CNT0_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_RX0_NEG_BSLN_RST_CNT0_PARAM_ID (0x010000c7u) + +#define CY_CAPSENSE_BUTTON0_RX0_IDAC0_VALUE (cy_capsense_tuner.sensorContext[0].idacComp) +#define CY_CAPSENSE_BUTTON0_RX0_IDAC0_OFFSET (200u) +#define CY_CAPSENSE_BUTTON0_RX0_IDAC0_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_RX0_IDAC0_PARAM_ID (0x010000c8u) + +#define CY_CAPSENSE_BUTTON0_RX0_BSLN_EXT0_VALUE (cy_capsense_tuner.sensorContext[0].bslnExt) +#define CY_CAPSENSE_BUTTON0_RX0_BSLN_EXT0_OFFSET (201u) +#define CY_CAPSENSE_BUTTON0_RX0_BSLN_EXT0_SIZE (1u) +#define CY_CAPSENSE_BUTTON0_RX0_BSLN_EXT0_PARAM_ID (0x010000c9u) + +#define CY_CAPSENSE_BUTTON1_RX0_RAW0_VALUE (cy_capsense_tuner.sensorContext[1].raw) +#define CY_CAPSENSE_BUTTON1_RX0_RAW0_OFFSET (202u) +#define CY_CAPSENSE_BUTTON1_RX0_RAW0_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_RX0_RAW0_PARAM_ID (0x020100cau) + +#define CY_CAPSENSE_BUTTON1_RX0_BSLN0_VALUE (cy_capsense_tuner.sensorContext[1].bsln) +#define CY_CAPSENSE_BUTTON1_RX0_BSLN0_OFFSET (204u) +#define CY_CAPSENSE_BUTTON1_RX0_BSLN0_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_RX0_BSLN0_PARAM_ID (0x020100ccu) + +#define CY_CAPSENSE_BUTTON1_RX0_DIFF0_VALUE (cy_capsense_tuner.sensorContext[1].diff) +#define CY_CAPSENSE_BUTTON1_RX0_DIFF0_OFFSET (206u) +#define CY_CAPSENSE_BUTTON1_RX0_DIFF0_SIZE (2u) +#define CY_CAPSENSE_BUTTON1_RX0_DIFF0_PARAM_ID (0x020100ceu) + +#define CY_CAPSENSE_BUTTON1_RX0_STATUS0_VALUE (cy_capsense_tuner.sensorContext[1].status) +#define CY_CAPSENSE_BUTTON1_RX0_STATUS0_OFFSET (208u) +#define CY_CAPSENSE_BUTTON1_RX0_STATUS0_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_RX0_STATUS0_PARAM_ID (0x010100d0u) + +#define CY_CAPSENSE_BUTTON1_RX0_NEG_BSLN_RST_CNT0_VALUE (cy_capsense_tuner.sensorContext[1].negBslnRstCnt) +#define CY_CAPSENSE_BUTTON1_RX0_NEG_BSLN_RST_CNT0_OFFSET (209u) +#define CY_CAPSENSE_BUTTON1_RX0_NEG_BSLN_RST_CNT0_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_RX0_NEG_BSLN_RST_CNT0_PARAM_ID (0x010100d1u) + +#define CY_CAPSENSE_BUTTON1_RX0_IDAC0_VALUE (cy_capsense_tuner.sensorContext[1].idacComp) +#define CY_CAPSENSE_BUTTON1_RX0_IDAC0_OFFSET (210u) +#define CY_CAPSENSE_BUTTON1_RX0_IDAC0_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_RX0_IDAC0_PARAM_ID (0x010100d2u) + +#define CY_CAPSENSE_BUTTON1_RX0_BSLN_EXT0_VALUE (cy_capsense_tuner.sensorContext[1].bslnExt) +#define CY_CAPSENSE_BUTTON1_RX0_BSLN_EXT0_OFFSET (211u) +#define CY_CAPSENSE_BUTTON1_RX0_BSLN_EXT0_SIZE (1u) +#define CY_CAPSENSE_BUTTON1_RX0_BSLN_EXT0_PARAM_ID (0x010100d3u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_RAW0_VALUE (cy_capsense_tuner.sensorContext[2].raw) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_RAW0_OFFSET (212u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_RAW0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_RAW0_PARAM_ID (0x020200d4u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_BSLN0_VALUE (cy_capsense_tuner.sensorContext[2].bsln) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_BSLN0_OFFSET (214u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_BSLN0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_BSLN0_PARAM_ID (0x020200d6u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_DIFF0_VALUE (cy_capsense_tuner.sensorContext[2].diff) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_DIFF0_OFFSET (216u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_DIFF0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_DIFF0_PARAM_ID (0x020200d8u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_STATUS0_VALUE (cy_capsense_tuner.sensorContext[2].status) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_STATUS0_OFFSET (218u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_STATUS0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_STATUS0_PARAM_ID (0x010200dau) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_NEG_BSLN_RST_CNT0_VALUE (cy_capsense_tuner.sensorContext[2].negBslnRstCnt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_NEG_BSLN_RST_CNT0_OFFSET (219u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_NEG_BSLN_RST_CNT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_NEG_BSLN_RST_CNT0_PARAM_ID (0x010200dbu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_IDAC0_VALUE (cy_capsense_tuner.sensorContext[2].idacComp) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_IDAC0_OFFSET (220u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_IDAC0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_IDAC0_PARAM_ID (0x010200dcu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_BSLN_EXT0_VALUE (cy_capsense_tuner.sensorContext[2].bslnExt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_BSLN_EXT0_OFFSET (221u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_BSLN_EXT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_BSLN_EXT0_PARAM_ID (0x010200ddu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_RAW0_VALUE (cy_capsense_tuner.sensorContext[3].raw) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_RAW0_OFFSET (222u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_RAW0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_RAW0_PARAM_ID (0x020200deu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_BSLN0_VALUE (cy_capsense_tuner.sensorContext[3].bsln) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_BSLN0_OFFSET (224u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_BSLN0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_BSLN0_PARAM_ID (0x020200e0u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_DIFF0_VALUE (cy_capsense_tuner.sensorContext[3].diff) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_DIFF0_OFFSET (226u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_DIFF0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_DIFF0_PARAM_ID (0x020200e2u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_STATUS0_VALUE (cy_capsense_tuner.sensorContext[3].status) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_STATUS0_OFFSET (228u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_STATUS0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_STATUS0_PARAM_ID (0x010200e4u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_NEG_BSLN_RST_CNT0_VALUE (cy_capsense_tuner.sensorContext[3].negBslnRstCnt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_NEG_BSLN_RST_CNT0_OFFSET (229u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_NEG_BSLN_RST_CNT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_NEG_BSLN_RST_CNT0_PARAM_ID (0x010200e5u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_IDAC0_VALUE (cy_capsense_tuner.sensorContext[3].idacComp) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_IDAC0_OFFSET (230u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_IDAC0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_IDAC0_PARAM_ID (0x010200e6u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_BSLN_EXT0_VALUE (cy_capsense_tuner.sensorContext[3].bslnExt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_BSLN_EXT0_OFFSET (231u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_BSLN_EXT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_BSLN_EXT0_PARAM_ID (0x010200e7u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_RAW0_VALUE (cy_capsense_tuner.sensorContext[4].raw) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_RAW0_OFFSET (232u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_RAW0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_RAW0_PARAM_ID (0x020200e8u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_BSLN0_VALUE (cy_capsense_tuner.sensorContext[4].bsln) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_BSLN0_OFFSET (234u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_BSLN0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_BSLN0_PARAM_ID (0x020200eau) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_DIFF0_VALUE (cy_capsense_tuner.sensorContext[4].diff) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_DIFF0_OFFSET (236u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_DIFF0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_DIFF0_PARAM_ID (0x020200ecu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_STATUS0_VALUE (cy_capsense_tuner.sensorContext[4].status) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_STATUS0_OFFSET (238u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_STATUS0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_STATUS0_PARAM_ID (0x010200eeu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_NEG_BSLN_RST_CNT0_VALUE (cy_capsense_tuner.sensorContext[4].negBslnRstCnt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_NEG_BSLN_RST_CNT0_OFFSET (239u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_NEG_BSLN_RST_CNT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_NEG_BSLN_RST_CNT0_PARAM_ID (0x010200efu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_IDAC0_VALUE (cy_capsense_tuner.sensorContext[4].idacComp) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_IDAC0_OFFSET (240u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_IDAC0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_IDAC0_PARAM_ID (0x010200f0u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_BSLN_EXT0_VALUE (cy_capsense_tuner.sensorContext[4].bslnExt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_BSLN_EXT0_OFFSET (241u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_BSLN_EXT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_BSLN_EXT0_PARAM_ID (0x010200f1u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_RAW0_VALUE (cy_capsense_tuner.sensorContext[5].raw) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_RAW0_OFFSET (242u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_RAW0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_RAW0_PARAM_ID (0x020200f2u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_BSLN0_VALUE (cy_capsense_tuner.sensorContext[5].bsln) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_BSLN0_OFFSET (244u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_BSLN0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_BSLN0_PARAM_ID (0x020200f4u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_DIFF0_VALUE (cy_capsense_tuner.sensorContext[5].diff) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_DIFF0_OFFSET (246u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_DIFF0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_DIFF0_PARAM_ID (0x020200f6u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_STATUS0_VALUE (cy_capsense_tuner.sensorContext[5].status) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_STATUS0_OFFSET (248u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_STATUS0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_STATUS0_PARAM_ID (0x010200f8u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_NEG_BSLN_RST_CNT0_VALUE (cy_capsense_tuner.sensorContext[5].negBslnRstCnt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_NEG_BSLN_RST_CNT0_OFFSET (249u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_NEG_BSLN_RST_CNT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_NEG_BSLN_RST_CNT0_PARAM_ID (0x010200f9u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_IDAC0_VALUE (cy_capsense_tuner.sensorContext[5].idacComp) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_IDAC0_OFFSET (250u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_IDAC0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_IDAC0_PARAM_ID (0x010200fau) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_BSLN_EXT0_VALUE (cy_capsense_tuner.sensorContext[5].bslnExt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_BSLN_EXT0_OFFSET (251u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_BSLN_EXT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_BSLN_EXT0_PARAM_ID (0x010200fbu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_RAW0_VALUE (cy_capsense_tuner.sensorContext[6].raw) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_RAW0_OFFSET (252u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_RAW0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_RAW0_PARAM_ID (0x020200fcu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_BSLN0_VALUE (cy_capsense_tuner.sensorContext[6].bsln) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_BSLN0_OFFSET (254u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_BSLN0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_BSLN0_PARAM_ID (0x020200feu) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_DIFF0_VALUE (cy_capsense_tuner.sensorContext[6].diff) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_DIFF0_OFFSET (256u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_DIFF0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_DIFF0_PARAM_ID (0x02020100u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_STATUS0_VALUE (cy_capsense_tuner.sensorContext[6].status) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_STATUS0_OFFSET (258u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_STATUS0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_STATUS0_PARAM_ID (0x01020102u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_NEG_BSLN_RST_CNT0_VALUE (cy_capsense_tuner.sensorContext[6].negBslnRstCnt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_NEG_BSLN_RST_CNT0_OFFSET (259u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_NEG_BSLN_RST_CNT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_NEG_BSLN_RST_CNT0_PARAM_ID (0x01020103u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_IDAC0_VALUE (cy_capsense_tuner.sensorContext[6].idacComp) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_IDAC0_OFFSET (260u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_IDAC0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_IDAC0_PARAM_ID (0x01020104u) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_BSLN_EXT0_VALUE (cy_capsense_tuner.sensorContext[6].bslnExt) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_BSLN_EXT0_OFFSET (261u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_BSLN_EXT0_SIZE (1u) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_BSLN_EXT0_PARAM_ID (0x01020105u) + +#define CY_CAPSENSE_LINEARSLIDER0_X0_VALUE (cy_capsense_tuner.position[0].x) +#define CY_CAPSENSE_LINEARSLIDER0_X0_OFFSET (262u) +#define CY_CAPSENSE_LINEARSLIDER0_X0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_X0_PARAM_ID (0x02020106u) + +#define CY_CAPSENSE_LINEARSLIDER0_Y0_VALUE (cy_capsense_tuner.position[0].y) +#define CY_CAPSENSE_LINEARSLIDER0_Y0_OFFSET (264u) +#define CY_CAPSENSE_LINEARSLIDER0_Y0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_Y0_PARAM_ID (0x02020108u) + +#define CY_CAPSENSE_LINEARSLIDER0_Z0_VALUE (cy_capsense_tuner.position[0].z) +#define CY_CAPSENSE_LINEARSLIDER0_Z0_OFFSET (266u) +#define CY_CAPSENSE_LINEARSLIDER0_Z0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_Z0_PARAM_ID (0x0202010au) + +#define CY_CAPSENSE_LINEARSLIDER0_ID0_VALUE (cy_capsense_tuner.position[0].id) +#define CY_CAPSENSE_LINEARSLIDER0_ID0_OFFSET (268u) +#define CY_CAPSENSE_LINEARSLIDER0_ID0_SIZE (2u) +#define CY_CAPSENSE_LINEARSLIDER0_ID0_PARAM_ID (0x0202010cu) + +#endif +/* cy_capsense_context */ +#define CY_CAPSENSE_COMMON_CONFIG_PTR_VALUE (cy_capsense_context.ptrCommonConfig) +#define CY_CAPSENSE_COMMON_CONFIG_PTR_SIZE (sizeof(cy_capsense_context.ptrCommonConfig)) + +#define CY_CAPSENSE_COMMON_CONTEXT_PTR_VALUE (cy_capsense_context.ptrCommonContext) +#define CY_CAPSENSE_COMMON_CONTEXT_PTR_SIZE (sizeof(cy_capsense_context.ptrCommonContext)) + +#define CY_CAPSENSE_INTERNAL_CONTEXT_PTR_VALUE (cy_capsense_context.ptrInternalContext) +#define CY_CAPSENSE_INTERNAL_CONTEXT_PTR_SIZE (sizeof(cy_capsense_context.ptrInternalContext)) + +#define CY_CAPSENSE_WD_CONFIG_PTR_VALUE (cy_capsense_context.ptrWdConfig) +#define CY_CAPSENSE_WD_CONFIG_PTR_SIZE (sizeof(cy_capsense_context.ptrWdConfig)) + +#define CY_CAPSENSE_WD_CONTEXT_PTR_VALUE (cy_capsense_context.ptrWdContext) +#define CY_CAPSENSE_WD_CONTEXT_PTR_SIZE (sizeof(cy_capsense_context.ptrWdContext)) + +#define CY_CAPSENSE_PIN_CONFIG_PTR_VALUE (cy_capsense_context.ptrPinConfig) +#define CY_CAPSENSE_PIN_CONFIG_PTR_SIZE (sizeof(cy_capsense_context.ptrPinConfig)) + +#define CY_CAPSENSE_SHIELD_PIN_CONFIG_PTR_VALUE (cy_capsense_context.ptrShieldPinConfig) +#define CY_CAPSENSE_SHIELD_PIN_CONFIG_PTR_SIZE (sizeof(cy_capsense_context.ptrShieldPinConfig)) + +#define CY_CAPSENSE_ACTIVE_SCAN_SNS_PTR_VALUE (cy_capsense_context.ptrActiveScanSns) +#define CY_CAPSENSE_ACTIVE_SCAN_SNS_PTR_SIZE (sizeof(cy_capsense_context.ptrActiveScanSns)) + +#if (CY_CAPSENSE_MW_VERSION < 300) +#define CY_CAPSENSE_FPTR_CONFIG_PTR_VALUE (cy_capsense_context.ptrFptrConfig) +#define CY_CAPSENSE_FPTR_CONFIG_PTR_SIZE (sizeof(cy_capsense_context.ptrFptrConfig)) +#endif + +#define CY_CAPSENSE_BIST_CONTEXT_PTR_VALUE (cy_capsense_context.ptrBistContext) +#define CY_CAPSENSE_BIST_CONTEXT_PTR_SIZE (sizeof(cy_capsense_context.ptrBistContext)) + +/* cy_capsense_commonConfig */ +#define CY_CAPSENSE_CPU_CLK_HZ_VALUE (cy_capsense_context.ptrCommonConfig->cpuClkHz) +#define CY_CAPSENSE_CPU_CLK_HZ_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->cpuClkHz)) + +#define CY_CAPSENSE_PERI_CLK_HZ_VALUE (cy_capsense_context.ptrCommonConfig->periClkHz) +#define CY_CAPSENSE_PERI_CLK_HZ_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->periClkHz)) + +#define CY_CAPSENSE_VDDA_VALUE (cy_capsense_context.ptrCommonConfig->vdda) +#define CY_CAPSENSE_VDDA_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->vdda)) + +#define CY_CAPSENSE_NUM_PIN_VALUE (cy_capsense_context.ptrCommonConfig->numPin) +#define CY_CAPSENSE_NUM_PIN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->numPin)) + +#define CY_CAPSENSE_NUM_SNS_VALUE (cy_capsense_context.ptrCommonConfig->numSns) +#define CY_CAPSENSE_NUM_SNS_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->numSns)) + +#define CY_CAPSENSE_NUM_WD_VALUE (cy_capsense_context.ptrCommonConfig->numWd) +#define CY_CAPSENSE_NUM_WD_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->numWd)) + +#if (CY_CAPSENSE_MW_VERSION < 400) +#define CY_CAPSENSE_CSD_EN_VALUE (cy_capsense_context.ptrCommonConfig->csdEn) +#define CY_CAPSENSE_CSD_EN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdEn)) + +#define CY_CAPSENSE_CSX_EN_VALUE (cy_capsense_context.ptrCommonConfig->csxEn) +#define CY_CAPSENSE_CSX_EN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csxEn)) + +#if (CY_CAPSENSE_MW_VERSION < 300) +#define CY_CAPSENSE_MFS_EN_VALUE (cy_capsense_context.ptrCommonConfig->mfsEn) +#define CY_CAPSENSE_MFS_EN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->mfsEn)) +#endif + +#define CY_CAPSENSE_BIST_EN_VALUE (cy_capsense_context.ptrCommonConfig->bistEn) +#define CY_CAPSENSE_BIST_EN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->bistEn)) + +#define CY_CAPSENSE_POSITION_FILTER_EN_VALUE (cy_capsense_context.ptrCommonConfig->positionFilterEn) +#define CY_CAPSENSE_POSITION_FILTER_EN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->positionFilterEn)) +#endif + +#define CY_CAPSENSE_PERI_DIVIDER_TYPE_VALUE (cy_capsense_context.ptrCommonConfig->periDividerType) +#define CY_CAPSENSE_PERI_DIVIDER_TYPE_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->periDividerType)) + +#define CY_CAPSENSE_PERI_DIVIDER_INDEX_VALUE (cy_capsense_context.ptrCommonConfig->periDividerIndex) +#define CY_CAPSENSE_PERI_DIVIDER_INDEX_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->periDividerIndex)) + +#define CY_CAPSENSE_ANALOG_WAKEUP_DELAY_VALUE (cy_capsense_context.ptrCommonConfig->analogWakeupDelay) +#define CY_CAPSENSE_ANALOG_WAKEUP_DELAY_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->analogWakeupDelay)) + +#define CY_CAPSENSE_SS_IREF_SOURCE_VALUE (cy_capsense_context.ptrCommonConfig->ssIrefSource) +#define CY_CAPSENSE_SS_IREF_SOURCE_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->ssIrefSource)) + +#define CY_CAPSENSE_SS_VREF_SOURCE_VALUE (cy_capsense_context.ptrCommonConfig->ssVrefSource) +#define CY_CAPSENSE_SS_VREF_SOURCE_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->ssVrefSource)) + +#define CY_CAPSENSE_PROX_TOUCH_COEFF_VALUE (cy_capsense_context.ptrCommonConfig->proxTouchCoeff) +#define CY_CAPSENSE_PROX_TOUCH_COEFF_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->proxTouchCoeff)) + +#define CY_CAPSENSE_SW_SENSOR_AUTO_RESET_EN_VALUE (cy_capsense_context.ptrCommonConfig->swSensorAutoResetEn) +#define CY_CAPSENSE_SW_SENSOR_AUTO_RESET_EN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->swSensorAutoResetEn)) + +#define CY_CAPSENSE_PORT_CMOD_PAD_NUM_VALUE (cy_capsense_context.ptrCommonConfig->portCmodPadNum) +#define CY_CAPSENSE_PORT_CMOD_PAD_NUM_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->portCmodPadNum)) + +#define CY_CAPSENSE_PIN_CMOD_PAD_VALUE (cy_capsense_context.ptrCommonConfig->pinCmodPad) +#define CY_CAPSENSE_PIN_CMOD_PAD_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->pinCmodPad)) + +#define CY_CAPSENSE_PORT_CSH_PAD_NUM_VALUE (cy_capsense_context.ptrCommonConfig->portCshPadNum) +#define CY_CAPSENSE_PORT_CSH_PAD_NUM_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->portCshPadNum)) + +#define CY_CAPSENSE_PIN_CSH_PAD_VALUE (cy_capsense_context.ptrCommonConfig->pinCshPad) +#define CY_CAPSENSE_PIN_CSH_PAD_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->pinCshPad)) + +#define CY_CAPSENSE_PORT_SHIELD_PAD_NUM_VALUE (cy_capsense_context.ptrCommonConfig->portShieldPadNum) +#define CY_CAPSENSE_PORT_SHIELD_PAD_NUM_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->portShieldPadNum)) + +#define CY_CAPSENSE_PIN_SHIELD_PAD_VALUE (cy_capsense_context.ptrCommonConfig->pinShieldPad) +#define CY_CAPSENSE_PIN_SHIELD_PAD_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->pinShieldPad)) + +#define CY_CAPSENSE_PORT_VREF_EXT_PAD_NUM_VALUE (cy_capsense_context.ptrCommonConfig->portVrefExtPadNum) +#define CY_CAPSENSE_PORT_VREF_EXT_PAD_NUM_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->portVrefExtPadNum)) + +#define CY_CAPSENSE_PIN_VREF_EXT_PAD_VALUE (cy_capsense_context.ptrCommonConfig->pinVrefExtPad) +#define CY_CAPSENSE_PIN_VREF_EXT_PAD_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->pinVrefExtPad)) + +#define CY_CAPSENSE_PORT_CMOD_NUM_VALUE (cy_capsense_context.ptrCommonConfig->portCmodNum) +#define CY_CAPSENSE_PORT_CMOD_NUM_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->portCmodNum)) + +#define CY_CAPSENSE_IDAC_GAIN_TABLE_PTR_VALUE (&cy_capsense_context.ptrCommonConfig->idacGainTable[0u]) +#define CY_CAPSENSE_IDAC_GAIN_TABLE_PTR_SIZE (sizeof(&cy_capsense_context.ptrCommonConfig->idacGainTable[0u])) + +#define CY_CAPSENSE_PTR_CSD_BASE_VALUE (cy_capsense_context.ptrCommonConfig->ptrCsdBase) +#define CY_CAPSENSE_PTR_CSD_BASE_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->ptrCsdBase)) + +#define CY_CAPSENSE_PTR_CSD_CONTEXT_VALUE (cy_capsense_context.ptrCommonConfig->ptrCsdContext) +#define CY_CAPSENSE_PTR_CSD_CONTEXT_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->ptrCsdContext)) + +#define CY_CAPSENSE_PORT_CMOD_VALUE (cy_capsense_context.ptrCommonConfig->portCmod) +#define CY_CAPSENSE_PORT_CMOD_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->portCmod)) + +#define CY_CAPSENSE_PORT_CSH_VALUE (cy_capsense_context.ptrCommonConfig->portCsh) +#define CY_CAPSENSE_PORT_CSH_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->portCsh)) + +#define CY_CAPSENSE_PORT_CINT_A_VALUE (cy_capsense_context.ptrCommonConfig->portCintA) +#define CY_CAPSENSE_PORT_CINT_A_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->portCintA)) + +#define CY_CAPSENSE_PORT_CINT_B_VALUE (cy_capsense_context.ptrCommonConfig->portCintB) +#define CY_CAPSENSE_PORT_CINT_B_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->portCintB)) + +#define CY_CAPSENSE_PIN_CMOD_VALUE (cy_capsense_context.ptrCommonConfig->pinCmod) +#define CY_CAPSENSE_PIN_CMOD_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->pinCmod)) + +#define CY_CAPSENSE_PORT_CSH_NUM_VALUE (cy_capsense_context.ptrCommonConfig->portCshNum) +#define CY_CAPSENSE_PORT_CSH_NUM_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->portCshNum)) + +#define CY_CAPSENSE_PIN_CSH_VALUE (cy_capsense_context.ptrCommonConfig->pinCsh) +#define CY_CAPSENSE_PIN_CSH_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->pinCsh)) + +#define CY_CAPSENSE_PIN_CINT_A_VALUE (cy_capsense_context.ptrCommonConfig->pinCintA) +#define CY_CAPSENSE_PIN_CINT_A_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->pinCintA)) + +#define CY_CAPSENSE_PIN_CINT_B_VALUE (cy_capsense_context.ptrCommonConfig->pinCintB) +#define CY_CAPSENSE_PIN_CINT_B_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->pinCintB)) + +#if (CY_CAPSENSE_MW_VERSION < 400) +#define CY_CAPSENSE_CSD_SHIELD_EN_VALUE (cy_capsense_context.ptrCommonConfig->csdShieldEn) +#define CY_CAPSENSE_CSD_SHIELD_EN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdShieldEn)) +#endif + +#define CY_CAPSENSE_CSD_INACTIVE_SNS_CONNECTION_VALUE (cy_capsense_context.ptrCommonConfig->csdInactiveSnsConnection) +#define CY_CAPSENSE_CSD_INACTIVE_SNS_CONNECTION_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdInactiveSnsConnection)) + +#if (CY_CAPSENSE_MW_VERSION >= 300) +#define CY_CAPSENSE_CSX_INACTIVE_SNS_CONNECTION_VALUE (cy_capsense_context.ptrCommonConfig->csxInactiveSnsConnection) +#define CY_CAPSENSE_CSX_INACTIVE_SNS_CONNECTION_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csxInactiveSnsConnection)) +#endif + +#define CY_CAPSENSE_CSD_SHIELD_DELAY_VALUE (cy_capsense_context.ptrCommonConfig->csdShieldDelay) +#define CY_CAPSENSE_CSD_SHIELD_DELAY_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdShieldDelay)) + +#define CY_CAPSENSE_CSD_VREF_VALUE (cy_capsense_context.ptrCommonConfig->csdVref) +#define CY_CAPSENSE_CSD_VREF_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdVref)) + +#define CY_CAPSENSE_CSD_R_CONST_VALUE (cy_capsense_context.ptrCommonConfig->csdRConst) +#define CY_CAPSENSE_CSD_R_CONST_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdRConst)) + +#if (CY_CAPSENSE_MW_VERSION < 400) +#define CY_CAPSENSE_CSD_C_TANK_SHIELD_EN_VALUE (cy_capsense_context.ptrCommonConfig->csdCTankShieldEn) +#define CY_CAPSENSE_CSD_C_TANK_SHIELD_EN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdCTankShieldEn)) +#endif + +#define CY_CAPSENSE_CSD_SHIELD_NUM_PIN_VALUE (cy_capsense_context.ptrCommonConfig->csdShieldNumPin) +#define CY_CAPSENSE_CSD_SHIELD_NUM_PIN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdShieldNumPin)) + +#define CY_CAPSENSE_CSD_SHIELD_SW_RES_VALUE (cy_capsense_context.ptrCommonConfig->csdShieldSwRes) +#define CY_CAPSENSE_CSD_SHIELD_SW_RES_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdShieldSwRes)) + +#define CY_CAPSENSE_CSD_INIT_SW_RES_VALUE (cy_capsense_context.ptrCommonConfig->csdInitSwRes) +#define CY_CAPSENSE_CSD_INIT_SW_RES_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdInitSwRes)) + +#define CY_CAPSENSE_CSD_CHARGE_TRANSFER_VALUE (cy_capsense_context.ptrCommonConfig->csdChargeTransfer) +#define CY_CAPSENSE_CSD_CHARGE_TRANSFER_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdChargeTransfer)) + +#define CY_CAPSENSE_CSD_RAW_TARGET_VALUE (cy_capsense_context.ptrCommonConfig->csdRawTarget) +#define CY_CAPSENSE_CSD_RAW_TARGET_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdRawTarget)) + +#if (CY_CAPSENSE_MW_VERSION < 400) +#define CY_CAPSENSE_CSD_AUTOTUNE_EN_VALUE (cy_capsense_context.ptrCommonConfig->csdAutotuneEn) +#define CY_CAPSENSE_CSD_AUTOTUNE_EN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdAutotuneEn)) + +#define CY_CAPSENSE_CSD_IDAC_AUTOCAL_EN_VALUE (cy_capsense_context.ptrCommonConfig->csdIdacAutocalEn) +#define CY_CAPSENSE_CSD_IDAC_AUTOCAL_EN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdIdacAutocalEn)) + +#define CY_CAPSENSE_CSD_IDAC_AUTO_GAIN_EN_VALUE (cy_capsense_context.ptrCommonConfig->csdIdacAutoGainEn) +#define CY_CAPSENSE_CSD_IDAC_AUTO_GAIN_EN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdIdacAutoGainEn)) +#endif + +#define CY_CAPSENSE_CSD_CALIBRATION_ERROR_VALUE (cy_capsense_context.ptrCommonConfig->csdCalibrationError) +#define CY_CAPSENSE_CSD_CALIBRATION_ERROR_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdCalibrationError)) + +#define CY_CAPSENSE_CSD_IDAC_GAIN_INIT_INDEX_VALUE (cy_capsense_context.ptrCommonConfig->csdIdacGainInitIndex) +#define CY_CAPSENSE_CSD_IDAC_GAIN_INIT_INDEX_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdIdacGainInitIndex)) + +#define CY_CAPSENSE_CSD_IDAC_MIN_VALUE (cy_capsense_context.ptrCommonConfig->csdIdacMin) +#define CY_CAPSENSE_CSD_IDAC_MIN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdIdacMin)) + +#define CY_CAPSENSE_CSD_IDAC_COMP_EN_VALUE (cy_capsense_context.ptrCommonConfig->csdIdacCompEn) +#define CY_CAPSENSE_CSD_IDAC_COMP_EN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdIdacCompEn)) + +#define CY_CAPSENSE_CSD_FINE_INIT_TIME_VALUE (cy_capsense_context.ptrCommonConfig->csdFineInitTime) +#define CY_CAPSENSE_CSD_FINE_INIT_TIME_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdFineInitTime)) + +#if (CY_CAPSENSE_MW_VERSION < 400) +#define CY_CAPSENSE_CSD_IDAC_ROW_COL_ALIGN_EN_VALUE (cy_capsense_context.ptrCommonConfig->csdIdacRowColAlignEn) +#define CY_CAPSENSE_CSD_IDAC_ROW_COL_ALIGN_EN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdIdacRowColAlignEn)) +#endif + +#define CY_CAPSENSE_CSD_MFS_DIVIDER_OFFSET_F1_VALUE (cy_capsense_context.ptrCommonConfig->csdMfsDividerOffsetF1) +#define CY_CAPSENSE_CSD_MFS_DIVIDER_OFFSET_F1_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdMfsDividerOffsetF1)) + +#define CY_CAPSENSE_CSD_MFS_DIVIDER_OFFSET_F2_VALUE (cy_capsense_context.ptrCommonConfig->csdMfsDividerOffsetF2) +#define CY_CAPSENSE_CSD_MFS_DIVIDER_OFFSET_F2_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csdMfsDividerOffsetF2)) + +#define CY_CAPSENSE_CSX_RAW_TARGET_VALUE (cy_capsense_context.ptrCommonConfig->csxRawTarget) +#define CY_CAPSENSE_CSX_RAW_TARGET_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csxRawTarget)) + +#if (CY_CAPSENSE_MW_VERSION < 400) +#define CY_CAPSENSE_CSX_IDAC_GAIN_INIT_INDEX_VALUE (cy_capsense_context.ptrCommonConfig->csxIdacGainInitIndex) +#define CY_CAPSENSE_CSX_IDAC_GAIN_INIT_INDEX_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csxIdacGainInitIndex)) + +#define CY_CAPSENSE_CSX_REF_GAIN_VALUE (cy_capsense_context.ptrCommonConfig->csxRefGain) +#define CY_CAPSENSE_CSX_REF_GAIN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csxRefGain)) + +#define CY_CAPSENSE_CSX_IDAC_AUTOCAL_EN_VALUE (cy_capsense_context.ptrCommonConfig->csxIdacAutocalEn) +#define CY_CAPSENSE_CSX_IDAC_AUTOCAL_EN_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csxIdacAutocalEn)) +#endif + +#define CY_CAPSENSE_CSX_CALIBRATION_ERROR_VALUE (cy_capsense_context.ptrCommonConfig->csxCalibrationError) +#define CY_CAPSENSE_CSX_CALIBRATION_ERROR_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csxCalibrationError)) + +#define CY_CAPSENSE_CSX_FINE_INIT_TIME_VALUE (cy_capsense_context.ptrCommonConfig->csxFineInitTime) +#define CY_CAPSENSE_CSX_FINE_INIT_TIME_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csxFineInitTime)) + +#define CY_CAPSENSE_CSX_INIT_SW_RES_VALUE (cy_capsense_context.ptrCommonConfig->csxInitSwRes) +#define CY_CAPSENSE_CSX_INIT_SW_RES_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csxInitSwRes)) + +#define CY_CAPSENSE_CSX_SCAN_SW_RES_VALUE (cy_capsense_context.ptrCommonConfig->csxScanSwRes) +#define CY_CAPSENSE_CSX_SCAN_SW_RES_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csxScanSwRes)) + +#define CY_CAPSENSE_CSX_INIT_SHIELD_SW_RES_VALUE (cy_capsense_context.ptrCommonConfig->csxInitShieldSwRes) +#define CY_CAPSENSE_CSX_INIT_SHIELD_SW_RES_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csxInitShieldSwRes)) + +#define CY_CAPSENSE_CSX_SCAN_SHIELD_SW_RES_VALUE (cy_capsense_context.ptrCommonConfig->csxScanShieldSwRes) +#define CY_CAPSENSE_CSX_SCAN_SHIELD_SW_RES_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csxScanShieldSwRes)) + +#define CY_CAPSENSE_CSX_MFS_DIVIDER_OFFSET_F1_VALUE (cy_capsense_context.ptrCommonConfig->csxMfsDividerOffsetF1) +#define CY_CAPSENSE_CSX_MFS_DIVIDER_OFFSET_F1_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csxMfsDividerOffsetF1)) + +#define CY_CAPSENSE_CSX_MFS_DIVIDER_OFFSET_F2_VALUE (cy_capsense_context.ptrCommonConfig->csxMfsDividerOffsetF2) +#define CY_CAPSENSE_CSX_MFS_DIVIDER_OFFSET_F2_SIZE (sizeof(cy_capsense_context.ptrCommonConfig->csxMfsDividerOffsetF2)) + +/* cy_capsense_widgetConfig */ +#define CY_CAPSENSE_BUTTON0_PTR_WD_CONTEXT_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrWdContext) +#define CY_CAPSENSE_BUTTON0_PTR_WD_CONTEXT_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrWdContext)) +#define CY_CAPSENSE_BUTTON0_PTR_SNS_CONTEXT_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrSnsContext) +#define CY_CAPSENSE_BUTTON0_PTR_SNS_CONTEXT_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrSnsContext)) +#define CY_CAPSENSE_BUTTON0_PTR_ELTD_CONTEXT_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrEltdConfig) +#define CY_CAPSENSE_BUTTON0_PTR_ELTD_CONTEXT_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrEltdConfig)) +#define CY_CAPSENSE_BUTTON0_PTR_ELTD_CAPACITANCE_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrEltdCapacitance) +#define CY_CAPSENSE_BUTTON0_PTR_ELTD_CAPACITANCE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrEltdCapacitance)) +#define CY_CAPSENSE_BUTTON0_PTR_BSLN_INV_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrBslnInv) +#define CY_CAPSENSE_BUTTON0_PTR_BSLN_INV_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrBslnInv)) +#define CY_CAPSENSE_BUTTON0_PTR_NOISE_ENVELOPE_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrNoiseEnvelope) +#define CY_CAPSENSE_BUTTON0_PTR_NOISE_ENVELOPE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrNoiseEnvelope)) +#define CY_CAPSENSE_BUTTON0_PTR_RAW_FILTER_HISTORY_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrRawFilterHistory) +#define CY_CAPSENSE_BUTTON0_PTR_RAW_FILTER_HISTORY_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrRawFilterHistory)) +#define CY_CAPSENSE_BUTTON0_PTR_RAW_FILTER_HISTORY_LOW_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrRawFilterHistoryLow) +#define CY_CAPSENSE_BUTTON0_PTR_RAW_FILTER_HISTORY_LOW_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrRawFilterHistoryLow)) +#define CY_CAPSENSE_BUTTON0_IIR_COEFF_VALUE (cy_capsense_context.ptrWdConfig[0u].iirCoeff) +#define CY_CAPSENSE_BUTTON0_IIR_COEFF_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].iirCoeff)) +#define CY_CAPSENSE_BUTTON0_PTR_DEBOUNCE_ARR_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrDebounceArr) +#define CY_CAPSENSE_BUTTON0_PTR_DEBOUNCE_ARR_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrDebounceArr)) +#define CY_CAPSENSE_BUTTON0_PTR_DIPLEX_TABLE_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrDiplexTable) +#define CY_CAPSENSE_BUTTON0_PTR_DIPLEX_TABLE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrDiplexTable)) +#define CY_CAPSENSE_BUTTON0_CENTROID_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[0u].centroidConfig) +#define CY_CAPSENSE_BUTTON0_CENTROID_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].centroidConfig)) +#define CY_CAPSENSE_BUTTON0_X_RESOLUTION_VALUE (cy_capsense_context.ptrWdConfig[0u].xResolution) +#define CY_CAPSENSE_BUTTON0_X_RESOLUTION_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].xResolution)) +#define CY_CAPSENSE_BUTTON0_Y_RESOLUTION_VALUE (cy_capsense_context.ptrWdConfig[0u].yResolution) +#define CY_CAPSENSE_BUTTON0_Y_RESOLUTION_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].yResolution)) +#define CY_CAPSENSE_BUTTON0_NUM_SNS_VALUE (cy_capsense_context.ptrWdConfig[0u].numSns) +#define CY_CAPSENSE_BUTTON0_NUM_SNS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].numSns)) +#define CY_CAPSENSE_BUTTON0_NUM_COLS_VALUE (cy_capsense_context.ptrWdConfig[0u].numCols) +#define CY_CAPSENSE_BUTTON0_NUM_COLS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].numCols)) +#define CY_CAPSENSE_BUTTON0_NUM_ROWS_VALUE (cy_capsense_context.ptrWdConfig[0u].numRows) +#define CY_CAPSENSE_BUTTON0_NUM_ROWS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].numRows)) +#define CY_CAPSENSE_BUTTON0_PTR_POS_FILTER_HISTORY_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrPosFilterHistory) +#define CY_CAPSENSE_BUTTON0_PTR_POS_FILTER_HISTORY_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrPosFilterHistory)) +#define CY_CAPSENSE_BUTTON0_PTR_CSX_TOUCH_HISTORY_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrCsxTouchHistory) +#define CY_CAPSENSE_BUTTON0_PTR_CSX_TOUCH_HISTORY_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrCsxTouchHistory)) +#define CY_CAPSENSE_BUTTON0_PTR_CSX_TOUCH_BUFFER_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrCsxTouchBuffer) +#define CY_CAPSENSE_BUTTON0_PTR_CSX_TOUCH_BUFFER_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrCsxTouchBuffer)) +#define CY_CAPSENSE_BUTTON0_PTR_CSD_TOUCH_BUFFER_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrCsdTouchBuffer) +#define CY_CAPSENSE_BUTTON0_PTR_CSD_TOUCH_BUFFER_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrCsdTouchBuffer)) +#define CY_CAPSENSE_BUTTON0_PTR_GESTURE_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrGestureConfig) +#define CY_CAPSENSE_BUTTON0_PTR_GESTURE_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrGestureConfig)) +#define CY_CAPSENSE_BUTTON0_PTR_GESTURE_CONTEXT_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrGestureContext) +#define CY_CAPSENSE_BUTTON0_PTR_GESTURE_CONTEXT_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrGestureContext)) +#define CY_CAPSENSE_BUTTON0_BALLISTIC_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[0u].ballisticConfig) +#define CY_CAPSENSE_BUTTON0_BALLISTIC_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ballisticConfig)) +#define CY_CAPSENSE_BUTTON0_PTR_BALLISTIC_CONTEXT_VALUE (cy_capsense_context.ptrWdConfig[0u].ptrBallisticContext) +#define CY_CAPSENSE_BUTTON0_PTR_BALLISTIC_CONTEXT_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].ptrBallisticContext)) +#define CY_CAPSENSE_BUTTON0_AIIR_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[0u].aiirConfig) +#define CY_CAPSENSE_BUTTON0_AIIR_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].aiirConfig)) +#define CY_CAPSENSE_BUTTON0_ADV_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[0u].advConfig) +#define CY_CAPSENSE_BUTTON0_ADV_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].advConfig)) +#define CY_CAPSENSE_BUTTON0_POS_FILTER_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[0u].posFilterConfig) +#define CY_CAPSENSE_BUTTON0_POS_FILTER_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].posFilterConfig)) +#define CY_CAPSENSE_BUTTON0_RAW_FILTER_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[0u].rawFilterConfig) +#define CY_CAPSENSE_BUTTON0_RAW_FILTER_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].rawFilterConfig)) +#define CY_CAPSENSE_BUTTON0_SENSE_METHOD_VALUE (cy_capsense_context.ptrWdConfig[0u].senseMethod) +#define CY_CAPSENSE_BUTTON0_SENSE_METHOD_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].senseMethod)) +#define CY_CAPSENSE_BUTTON0_WD_TYPE_VALUE (cy_capsense_context.ptrWdConfig[0u].wdType) +#define CY_CAPSENSE_BUTTON0_WD_TYPE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0u].wdType)) + +#define CY_CAPSENSE_BUTTON1_PTR_WD_CONTEXT_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrWdContext) +#define CY_CAPSENSE_BUTTON1_PTR_WD_CONTEXT_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrWdContext)) +#define CY_CAPSENSE_BUTTON1_PTR_SNS_CONTEXT_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrSnsContext) +#define CY_CAPSENSE_BUTTON1_PTR_SNS_CONTEXT_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrSnsContext)) +#define CY_CAPSENSE_BUTTON1_PTR_ELTD_CONTEXT_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrEltdConfig) +#define CY_CAPSENSE_BUTTON1_PTR_ELTD_CONTEXT_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrEltdConfig)) +#define CY_CAPSENSE_BUTTON1_PTR_ELTD_CAPACITANCE_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrEltdCapacitance) +#define CY_CAPSENSE_BUTTON1_PTR_ELTD_CAPACITANCE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrEltdCapacitance)) +#define CY_CAPSENSE_BUTTON1_PTR_BSLN_INV_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrBslnInv) +#define CY_CAPSENSE_BUTTON1_PTR_BSLN_INV_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrBslnInv)) +#define CY_CAPSENSE_BUTTON1_PTR_NOISE_ENVELOPE_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrNoiseEnvelope) +#define CY_CAPSENSE_BUTTON1_PTR_NOISE_ENVELOPE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrNoiseEnvelope)) +#define CY_CAPSENSE_BUTTON1_PTR_RAW_FILTER_HISTORY_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrRawFilterHistory) +#define CY_CAPSENSE_BUTTON1_PTR_RAW_FILTER_HISTORY_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrRawFilterHistory)) +#define CY_CAPSENSE_BUTTON1_PTR_RAW_FILTER_HISTORY_LOW_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrRawFilterHistoryLow) +#define CY_CAPSENSE_BUTTON1_PTR_RAW_FILTER_HISTORY_LOW_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrRawFilterHistoryLow)) +#define CY_CAPSENSE_BUTTON1_IIR_COEFF_VALUE (cy_capsense_context.ptrWdConfig[1u].iirCoeff) +#define CY_CAPSENSE_BUTTON1_IIR_COEFF_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].iirCoeff)) +#define CY_CAPSENSE_BUTTON1_PTR_DEBOUNCE_ARR_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrDebounceArr) +#define CY_CAPSENSE_BUTTON1_PTR_DEBOUNCE_ARR_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrDebounceArr)) +#define CY_CAPSENSE_BUTTON1_PTR_DIPLEX_TABLE_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrDiplexTable) +#define CY_CAPSENSE_BUTTON1_PTR_DIPLEX_TABLE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrDiplexTable)) +#define CY_CAPSENSE_BUTTON1_CENTROID_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[1u].centroidConfig) +#define CY_CAPSENSE_BUTTON1_CENTROID_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].centroidConfig)) +#define CY_CAPSENSE_BUTTON1_X_RESOLUTION_VALUE (cy_capsense_context.ptrWdConfig[1u].xResolution) +#define CY_CAPSENSE_BUTTON1_X_RESOLUTION_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].xResolution)) +#define CY_CAPSENSE_BUTTON1_Y_RESOLUTION_VALUE (cy_capsense_context.ptrWdConfig[1u].yResolution) +#define CY_CAPSENSE_BUTTON1_Y_RESOLUTION_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].yResolution)) +#define CY_CAPSENSE_BUTTON1_NUM_SNS_VALUE (cy_capsense_context.ptrWdConfig[1u].numSns) +#define CY_CAPSENSE_BUTTON1_NUM_SNS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].numSns)) +#define CY_CAPSENSE_BUTTON1_NUM_COLS_VALUE (cy_capsense_context.ptrWdConfig[1u].numCols) +#define CY_CAPSENSE_BUTTON1_NUM_COLS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].numCols)) +#define CY_CAPSENSE_BUTTON1_NUM_ROWS_VALUE (cy_capsense_context.ptrWdConfig[1u].numRows) +#define CY_CAPSENSE_BUTTON1_NUM_ROWS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].numRows)) +#define CY_CAPSENSE_BUTTON1_PTR_POS_FILTER_HISTORY_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrPosFilterHistory) +#define CY_CAPSENSE_BUTTON1_PTR_POS_FILTER_HISTORY_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrPosFilterHistory)) +#define CY_CAPSENSE_BUTTON1_PTR_CSX_TOUCH_HISTORY_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrCsxTouchHistory) +#define CY_CAPSENSE_BUTTON1_PTR_CSX_TOUCH_HISTORY_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrCsxTouchHistory)) +#define CY_CAPSENSE_BUTTON1_PTR_CSX_TOUCH_BUFFER_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrCsxTouchBuffer) +#define CY_CAPSENSE_BUTTON1_PTR_CSX_TOUCH_BUFFER_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrCsxTouchBuffer)) +#define CY_CAPSENSE_BUTTON1_PTR_CSD_TOUCH_BUFFER_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrCsdTouchBuffer) +#define CY_CAPSENSE_BUTTON1_PTR_CSD_TOUCH_BUFFER_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrCsdTouchBuffer)) +#define CY_CAPSENSE_BUTTON1_PTR_GESTURE_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrGestureConfig) +#define CY_CAPSENSE_BUTTON1_PTR_GESTURE_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrGestureConfig)) +#define CY_CAPSENSE_BUTTON1_PTR_GESTURE_CONTEXT_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrGestureContext) +#define CY_CAPSENSE_BUTTON1_PTR_GESTURE_CONTEXT_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrGestureContext)) +#define CY_CAPSENSE_BUTTON1_BALLISTIC_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[1u].ballisticConfig) +#define CY_CAPSENSE_BUTTON1_BALLISTIC_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ballisticConfig)) +#define CY_CAPSENSE_BUTTON1_PTR_BALLISTIC_CONTEXT_VALUE (cy_capsense_context.ptrWdConfig[1u].ptrBallisticContext) +#define CY_CAPSENSE_BUTTON1_PTR_BALLISTIC_CONTEXT_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].ptrBallisticContext)) +#define CY_CAPSENSE_BUTTON1_AIIR_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[1u].aiirConfig) +#define CY_CAPSENSE_BUTTON1_AIIR_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].aiirConfig)) +#define CY_CAPSENSE_BUTTON1_ADV_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[1u].advConfig) +#define CY_CAPSENSE_BUTTON1_ADV_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].advConfig)) +#define CY_CAPSENSE_BUTTON1_POS_FILTER_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[1u].posFilterConfig) +#define CY_CAPSENSE_BUTTON1_POS_FILTER_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].posFilterConfig)) +#define CY_CAPSENSE_BUTTON1_RAW_FILTER_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[1u].rawFilterConfig) +#define CY_CAPSENSE_BUTTON1_RAW_FILTER_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].rawFilterConfig)) +#define CY_CAPSENSE_BUTTON1_SENSE_METHOD_VALUE (cy_capsense_context.ptrWdConfig[1u].senseMethod) +#define CY_CAPSENSE_BUTTON1_SENSE_METHOD_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].senseMethod)) +#define CY_CAPSENSE_BUTTON1_WD_TYPE_VALUE (cy_capsense_context.ptrWdConfig[1u].wdType) +#define CY_CAPSENSE_BUTTON1_WD_TYPE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1u].wdType)) + +#define CY_CAPSENSE_LINEARSLIDER0_PTR_WD_CONTEXT_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrWdContext) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_WD_CONTEXT_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrWdContext)) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_SNS_CONTEXT_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrSnsContext) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_SNS_CONTEXT_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrSnsContext)) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_ELTD_CONTEXT_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrEltdConfig) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_ELTD_CONTEXT_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrEltdConfig)) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_ELTD_CAPACITANCE_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrEltdCapacitance) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_ELTD_CAPACITANCE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrEltdCapacitance)) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_BSLN_INV_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrBslnInv) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_BSLN_INV_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrBslnInv)) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_NOISE_ENVELOPE_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrNoiseEnvelope) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_NOISE_ENVELOPE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrNoiseEnvelope)) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_RAW_FILTER_HISTORY_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrRawFilterHistory) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_RAW_FILTER_HISTORY_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrRawFilterHistory)) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_RAW_FILTER_HISTORY_LOW_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrRawFilterHistoryLow) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_RAW_FILTER_HISTORY_LOW_SIZE \ + (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrRawFilterHistoryLow)) +#define CY_CAPSENSE_LINEARSLIDER0_IIR_COEFF_VALUE (cy_capsense_context.ptrWdConfig[2u].iirCoeff) +#define CY_CAPSENSE_LINEARSLIDER0_IIR_COEFF_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].iirCoeff)) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_DEBOUNCE_ARR_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrDebounceArr) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_DEBOUNCE_ARR_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrDebounceArr)) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_DIPLEX_TABLE_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrDiplexTable) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_DIPLEX_TABLE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrDiplexTable)) +#define CY_CAPSENSE_LINEARSLIDER0_CENTROID_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[2u].centroidConfig) +#define CY_CAPSENSE_LINEARSLIDER0_CENTROID_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].centroidConfig)) +#define CY_CAPSENSE_LINEARSLIDER0_X_RESOLUTION_VALUE (cy_capsense_context.ptrWdConfig[2u].xResolution) +#define CY_CAPSENSE_LINEARSLIDER0_X_RESOLUTION_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].xResolution)) +#define CY_CAPSENSE_LINEARSLIDER0_Y_RESOLUTION_VALUE (cy_capsense_context.ptrWdConfig[2u].yResolution) +#define CY_CAPSENSE_LINEARSLIDER0_Y_RESOLUTION_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].yResolution)) +#define CY_CAPSENSE_LINEARSLIDER0_NUM_SNS_VALUE (cy_capsense_context.ptrWdConfig[2u].numSns) +#define CY_CAPSENSE_LINEARSLIDER0_NUM_SNS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].numSns)) +#define CY_CAPSENSE_LINEARSLIDER0_NUM_COLS_VALUE (cy_capsense_context.ptrWdConfig[2u].numCols) +#define CY_CAPSENSE_LINEARSLIDER0_NUM_COLS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].numCols)) +#define CY_CAPSENSE_LINEARSLIDER0_NUM_ROWS_VALUE (cy_capsense_context.ptrWdConfig[2u].numRows) +#define CY_CAPSENSE_LINEARSLIDER0_NUM_ROWS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].numRows)) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_POS_FILTER_HISTORY_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrPosFilterHistory) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_POS_FILTER_HISTORY_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrPosFilterHistory)) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_CSX_TOUCH_HISTORY_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrCsxTouchHistory) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_CSX_TOUCH_HISTORY_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrCsxTouchHistory)) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_CSX_TOUCH_BUFFER_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrCsxTouchBuffer) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_CSX_TOUCH_BUFFER_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrCsxTouchBuffer)) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_CSD_TOUCH_BUFFER_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrCsdTouchBuffer) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_CSD_TOUCH_BUFFER_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrCsdTouchBuffer)) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_GESTURE_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrGestureConfig) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_GESTURE_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrGestureConfig)) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_GESTURE_CONTEXT_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrGestureContext) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_GESTURE_CONTEXT_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrGestureContext)) +#define CY_CAPSENSE_LINEARSLIDER0_BALLISTIC_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[2u].ballisticConfig) +#define CY_CAPSENSE_LINEARSLIDER0_BALLISTIC_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ballisticConfig)) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_BALLISTIC_CONTEXT_VALUE (cy_capsense_context.ptrWdConfig[2u].ptrBallisticContext) +#define CY_CAPSENSE_LINEARSLIDER0_PTR_BALLISTIC_CONTEXT_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].ptrBallisticContext)) +#define CY_CAPSENSE_LINEARSLIDER0_AIIR_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[2u].aiirConfig) +#define CY_CAPSENSE_LINEARSLIDER0_AIIR_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].aiirConfig)) +#define CY_CAPSENSE_LINEARSLIDER0_ADV_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[2u].advConfig) +#define CY_CAPSENSE_LINEARSLIDER0_ADV_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].advConfig)) +#define CY_CAPSENSE_LINEARSLIDER0_POS_FILTER_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[2u].posFilterConfig) +#define CY_CAPSENSE_LINEARSLIDER0_POS_FILTER_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].posFilterConfig)) +#define CY_CAPSENSE_LINEARSLIDER0_RAW_FILTER_CONFIG_VALUE (cy_capsense_context.ptrWdConfig[2u].rawFilterConfig) +#define CY_CAPSENSE_LINEARSLIDER0_RAW_FILTER_CONFIG_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].rawFilterConfig)) +#define CY_CAPSENSE_LINEARSLIDER0_SENSE_METHOD_VALUE (cy_capsense_context.ptrWdConfig[2u].senseMethod) +#define CY_CAPSENSE_LINEARSLIDER0_SENSE_METHOD_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].senseMethod)) +#define CY_CAPSENSE_LINEARSLIDER0_WD_TYPE_VALUE (cy_capsense_context.ptrWdConfig[2u].wdType) +#define CY_CAPSENSE_LINEARSLIDER0_WD_TYPE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2u].wdType)) + +/* cy_capsense_pinConfig */ +#define CY_CAPSENSE_BUTTON0_RX0_PIN0_PC_PTR_VALUE (cy_capsense_context.ptrPinConfig[0].pcPtr) +#define CY_CAPSENSE_BUTTON0_RX0_PIN0_PC_PTR_SIZE (sizeof(cy_capsense_context.ptrPinConfig[0].pcPtr)) +#define CY_CAPSENSE_BUTTON0_RX0_PIN0_NUMBER_VALUE (cy_capsense_context.ptrPinConfig[0].pinNumber) +#define CY_CAPSENSE_BUTTON0_RX0_PIN0_NUMBER_SIZE (sizeof(cy_capsense_context.ptrPinConfig[0].pinNumber)) + +#define CY_CAPSENSE_BUTTON0_TX_PIN0_PC_PTR_VALUE (cy_capsense_context.ptrPinConfig[1].pcPtr) +#define CY_CAPSENSE_BUTTON0_TX_PIN0_PC_PTR_SIZE (sizeof(cy_capsense_context.ptrPinConfig[1].pcPtr)) +#define CY_CAPSENSE_BUTTON0_TX_PIN0_NUMBER_VALUE (cy_capsense_context.ptrPinConfig[1].pinNumber) +#define CY_CAPSENSE_BUTTON0_TX_PIN0_NUMBER_SIZE (sizeof(cy_capsense_context.ptrPinConfig[1].pinNumber)) + +#define CY_CAPSENSE_BUTTON1_RX0_PIN0_PC_PTR_VALUE (cy_capsense_context.ptrPinConfig[2].pcPtr) +#define CY_CAPSENSE_BUTTON1_RX0_PIN0_PC_PTR_SIZE (sizeof(cy_capsense_context.ptrPinConfig[2].pcPtr)) +#define CY_CAPSENSE_BUTTON1_RX0_PIN0_NUMBER_VALUE (cy_capsense_context.ptrPinConfig[2].pinNumber) +#define CY_CAPSENSE_BUTTON1_RX0_PIN0_NUMBER_SIZE (sizeof(cy_capsense_context.ptrPinConfig[2].pinNumber)) + +#define CY_CAPSENSE_BUTTON1_TX_PIN0_PC_PTR_VALUE (cy_capsense_context.ptrPinConfig[3].pcPtr) +#define CY_CAPSENSE_BUTTON1_TX_PIN0_PC_PTR_SIZE (sizeof(cy_capsense_context.ptrPinConfig[3].pcPtr)) +#define CY_CAPSENSE_BUTTON1_TX_PIN0_NUMBER_VALUE (cy_capsense_context.ptrPinConfig[3].pinNumber) +#define CY_CAPSENSE_BUTTON1_TX_PIN0_NUMBER_SIZE (sizeof(cy_capsense_context.ptrPinConfig[3].pinNumber)) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_PIN0_PC_PTR_VALUE (cy_capsense_context.ptrPinConfig[4].pcPtr) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_PIN0_PC_PTR_SIZE (sizeof(cy_capsense_context.ptrPinConfig[4].pcPtr)) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_PIN0_NUMBER_VALUE (cy_capsense_context.ptrPinConfig[4].pinNumber) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_PIN0_NUMBER_SIZE (sizeof(cy_capsense_context.ptrPinConfig[4].pinNumber)) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_PIN0_PC_PTR_VALUE (cy_capsense_context.ptrPinConfig[5].pcPtr) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_PIN0_PC_PTR_SIZE (sizeof(cy_capsense_context.ptrPinConfig[5].pcPtr)) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_PIN0_NUMBER_VALUE (cy_capsense_context.ptrPinConfig[5].pinNumber) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_PIN0_NUMBER_SIZE (sizeof(cy_capsense_context.ptrPinConfig[5].pinNumber)) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_PIN0_PC_PTR_VALUE (cy_capsense_context.ptrPinConfig[6].pcPtr) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_PIN0_PC_PTR_SIZE (sizeof(cy_capsense_context.ptrPinConfig[6].pcPtr)) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_PIN0_NUMBER_VALUE (cy_capsense_context.ptrPinConfig[6].pinNumber) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_PIN0_NUMBER_SIZE (sizeof(cy_capsense_context.ptrPinConfig[6].pinNumber)) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_PIN0_PC_PTR_VALUE (cy_capsense_context.ptrPinConfig[7].pcPtr) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_PIN0_PC_PTR_SIZE (sizeof(cy_capsense_context.ptrPinConfig[7].pcPtr)) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_PIN0_NUMBER_VALUE (cy_capsense_context.ptrPinConfig[7].pinNumber) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_PIN0_NUMBER_SIZE (sizeof(cy_capsense_context.ptrPinConfig[7].pinNumber)) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_PIN0_PC_PTR_VALUE (cy_capsense_context.ptrPinConfig[8].pcPtr) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_PIN0_PC_PTR_SIZE (sizeof(cy_capsense_context.ptrPinConfig[8].pcPtr)) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_PIN0_NUMBER_VALUE (cy_capsense_context.ptrPinConfig[8].pinNumber) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_PIN0_NUMBER_SIZE (sizeof(cy_capsense_context.ptrPinConfig[8].pinNumber)) + +/* cy_capsense_electrodeConfig */ +#define CY_CAPSENSE_BUTTON0_RX0_CFG_PTR_VALUE (cy_capsense_context.ptrWdConfig[0].ptrEltdConfig[0].ptrPin) +#define CY_CAPSENSE_BUTTON0_RX0_CFG_PTR_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0].ptrEltdConfig[0].ptrPin)) +#define CY_CAPSENSE_BUTTON0_RX0_ELTD_TYPE_VALUE (cy_capsense_context.ptrWdConfig[0].ptrEltdConfig[0].type) +#define CY_CAPSENSE_BUTTON0_RX0_ELTD_TYPE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0].ptrEltdConfig[0].type)) +#define CY_CAPSENSE_BUTTON0_RX0_NUM_PINS_VALUE (cy_capsense_context.ptrWdConfig[0].ptrEltdConfig[0].numPins) +#define CY_CAPSENSE_BUTTON0_RX0_NUM_PINS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0].ptrEltdConfig[0].numPins)) + +#define CY_CAPSENSE_BUTTON0_TX_CFG_PTR_VALUE (cy_capsense_context.ptrWdConfig[0].ptrEltdConfig[1].ptrPin) +#define CY_CAPSENSE_BUTTON0_TX_CFG_PTR_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0].ptrEltdConfig[1].ptrPin)) +#define CY_CAPSENSE_BUTTON0_TX_ELTD_TYPE_VALUE (cy_capsense_context.ptrWdConfig[0].ptrEltdConfig[1].type) +#define CY_CAPSENSE_BUTTON0_TX_ELTD_TYPE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0].ptrEltdConfig[1].type)) +#define CY_CAPSENSE_BUTTON0_TX_NUM_PINS_VALUE (cy_capsense_context.ptrWdConfig[0].ptrEltdConfig[1].numPins) +#define CY_CAPSENSE_BUTTON0_TX_NUM_PINS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[0].ptrEltdConfig[1].numPins)) + +#define CY_CAPSENSE_BUTTON1_RX0_CFG_PTR_VALUE (cy_capsense_context.ptrWdConfig[1].ptrEltdConfig[0].ptrPin) +#define CY_CAPSENSE_BUTTON1_RX0_CFG_PTR_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1].ptrEltdConfig[0].ptrPin)) +#define CY_CAPSENSE_BUTTON1_RX0_ELTD_TYPE_VALUE (cy_capsense_context.ptrWdConfig[1].ptrEltdConfig[0].type) +#define CY_CAPSENSE_BUTTON1_RX0_ELTD_TYPE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1].ptrEltdConfig[0].type)) +#define CY_CAPSENSE_BUTTON1_RX0_NUM_PINS_VALUE (cy_capsense_context.ptrWdConfig[1].ptrEltdConfig[0].numPins) +#define CY_CAPSENSE_BUTTON1_RX0_NUM_PINS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1].ptrEltdConfig[0].numPins)) + +#define CY_CAPSENSE_BUTTON1_TX_CFG_PTR_VALUE (cy_capsense_context.ptrWdConfig[1].ptrEltdConfig[1].ptrPin) +#define CY_CAPSENSE_BUTTON1_TX_CFG_PTR_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1].ptrEltdConfig[1].ptrPin)) +#define CY_CAPSENSE_BUTTON1_TX_ELTD_TYPE_VALUE (cy_capsense_context.ptrWdConfig[1].ptrEltdConfig[1].type) +#define CY_CAPSENSE_BUTTON1_TX_ELTD_TYPE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1].ptrEltdConfig[1].type)) +#define CY_CAPSENSE_BUTTON1_TX_NUM_PINS_VALUE (cy_capsense_context.ptrWdConfig[1].ptrEltdConfig[1].numPins) +#define CY_CAPSENSE_BUTTON1_TX_NUM_PINS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[1].ptrEltdConfig[1].numPins)) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_CFG_PTR_VALUE (cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[0].ptrPin) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_CFG_PTR_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[0].ptrPin)) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_ELTD_TYPE_VALUE (cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[0].type) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_ELTD_TYPE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[0].type)) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_NUM_PINS_VALUE (cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[0].numPins) +#define CY_CAPSENSE_LINEARSLIDER0_SNS0_NUM_PINS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[0].numPins)) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_CFG_PTR_VALUE (cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[1].ptrPin) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_CFG_PTR_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[1].ptrPin)) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_ELTD_TYPE_VALUE (cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[1].type) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_ELTD_TYPE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[1].type)) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_NUM_PINS_VALUE (cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[1].numPins) +#define CY_CAPSENSE_LINEARSLIDER0_SNS1_NUM_PINS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[1].numPins)) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_CFG_PTR_VALUE (cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[2].ptrPin) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_CFG_PTR_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[2].ptrPin)) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_ELTD_TYPE_VALUE (cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[2].type) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_ELTD_TYPE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[2].type)) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_NUM_PINS_VALUE (cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[2].numPins) +#define CY_CAPSENSE_LINEARSLIDER0_SNS2_NUM_PINS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[2].numPins)) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_CFG_PTR_VALUE (cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[3].ptrPin) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_CFG_PTR_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[3].ptrPin)) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_ELTD_TYPE_VALUE (cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[3].type) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_ELTD_TYPE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[3].type)) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_NUM_PINS_VALUE (cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[3].numPins) +#define CY_CAPSENSE_LINEARSLIDER0_SNS3_NUM_PINS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[3].numPins)) + +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_CFG_PTR_VALUE (cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[4].ptrPin) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_CFG_PTR_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[4].ptrPin)) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_ELTD_TYPE_VALUE (cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[4].type) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_ELTD_TYPE_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[4].type)) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_NUM_PINS_VALUE (cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[4].numPins) +#define CY_CAPSENSE_LINEARSLIDER0_SNS4_NUM_PINS_SIZE (sizeof(cy_capsense_context.ptrWdConfig[2].ptrEltdConfig[4].numPins)) + +#if ((CY_CAPSENSE_PERI_CLK / 2) > 50000000) +#warning The maximum CSD modulator clock frequency is 50 MHz: increase CSD modulator clock divider to meet the valid operation conditions +#endif + +#if ((CY_CAPSENSE_PERI_CLK / 2) > 50000000) +#warning The maximum CSX modulator clock frequency is 50 MHz: increase CSX modulator clock divider to meet the valid operation conditions +#endif + +#if ((CY_CAPSENSE_PERI_CLK / 2 / 32) > 3000000) +#warning The maximum Tx clock frequency is 3 MHz: increase Tx clock divider for widget Button0 to meet the valid operation conditions +#endif + +#if ((CY_CAPSENSE_PERI_CLK / 2 / 32) > 3000000) +#warning The maximum Tx clock frequency is 3 MHz: increase Tx clock divider for widget Button1 to meet the valid operation conditions +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* CY_CAPSENSE_CORE == __CORTEX_M */ + +#endif /* !defined(CY_DISABLE_CAPSENSE) */ + +#endif /* (defined(COMPONENT_MW_CAPSENSE) || !defined(COMPONENT_MW_CORE_MAKE)) */ + +#endif /* CYCFG_CAPSENSE_H */ + +/* [] END OF FILE */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_capsense.timestamp b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_capsense.timestamp new file mode 100644 index 00000000000000..1f1e351cf22890 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_capsense.timestamp @@ -0,0 +1,26 @@ +/******************************************************************************* +* File Name: cycfg_capsense.timestamp +* +* Description: +* Sentinel file for determining if generated source is up to date. +* This file was automatically generated and should not be modified. +* CAPSENSE Configurator 6.10.0.3796 +* +******************************************************************************** +* Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or +* an affiliate of Cypress Semiconductor Corporation. +* SPDX-License-Identifier: Apache-2.0 +* +* 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. +********************************************************************************/ + diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_capsense_defines.h b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_capsense_defines.h new file mode 100644 index 00000000000000..570294dcd562e1 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_capsense_defines.h @@ -0,0 +1,159 @@ +/******************************************************************************* + * File Name: cycfg_capsense_defines.h + * + * Description: + * CAPSENSE configuration defines. + * + * Note: This file is required for the CAPSENSE Middleware Library to build + * successfully. + * + * This file should not be modified. It was automatically generated by + * CAPSENSE Configurator 6.10.0.3796 + * + ******************************************************************************** + * Copyright 2024, Cypress Semiconductor Corporation (an Infineon company) + * or an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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(CYCFG_CAPSENSE_DEFINES_H) +#define CYCFG_CAPSENSE_DEFINES_H + +#include + +/* General */ +#define CY_CAPSENSE_WIDGET_COUNT (3u) +#define CY_CAPSENSE_ACTIVE_WIDGET_COUNT (CY_CAPSENSE_WIDGET_COUNT) +#define CY_CAPSENSE_LP_WIDGET_COUNT (0u) +#define CY_CAPSENSE_TOTAL_WIDGET_COUNT (CY_CAPSENSE_WIDGET_COUNT) +#define CY_CAPSENSE_SENSOR_COUNT (7u) +#define CY_CAPSENSE_ELTD_COUNT (9u) +#define CY_CAPSENSE_PIN_COUNT (9u) +#define CY_CAPSENSE_SHIELD_PIN_COUNT (0u) +#define CY_CAPSENSE_POSITION_SIZE (1u) +#define CY_CAPSENSE_DEBOUNCE_SIZE (3u) +#define CY_CAPSENSE_NOISE_ENVELOPE_SIZE (5u) +#define CY_CAPSENSE_MFS_CH_NUMBER (1u) +#define CY_CAPSENSE_RAW_HISTORY_SIZE (0u) +#define CY_CAPSENSE_IIR_HISTORY_LOW_SIZE (0u) +#define CY_CAPSENSE_RAW_ALP_HISTORY_SIZE (0u) +#define CY_CAPSENSE_POSITION_FILTER_HISTORY_SIZE (0u) +#define CY_CAPSENSE_TOUCH_FILTER_HISTORY_SIZE (0u) +#define CY_CAPSENSE_DIPLEX_SIZE (0u) +#define CY_CAPSENSE_CSD_TOUCHPAD_MAX_SENSORS_SIZE (0u) +#define CY_CAPSENSE_CSX_TOUCH_BUFFER_ENABLE (0u) +#define CY_CAPSENSE_CSX_TOUCH_HISTORY_SIZE (0u) +#define CY_CAPSENSE_BALLISTIC_WIDGET_COUNT (0u) +#define CY_CAPSENSE_GESTURE_WIDGET_COUNT (0u) + +/* Sensing Methods */ +#define CY_CAPSENSE_CSD_EN (1u) +#define CY_CAPSENSE_CSX_EN (1u) +#define CY_CAPSENSE_ISX_EN (0u) +#define CY_CAPSENSE_CSD_CALIBRATION_EN (1u) +#define CY_CAPSENSE_CSX_CALIBRATION_EN (1u) +#define CY_CAPSENSE_SMARTSENSE_FULL_EN (1u) +#define CY_CAPSENSE_SMARTSENSE_HW_EN (0u) +#define CY_CAPSENSE_SMARTSENSE_DISABLED (0u) +#define CY_CAPSENSE_CSD_AUTOTUNE_EN (CY_CAPSENSE_SMARTSENSE_FULL_EN | CY_CAPSENSE_SMARTSENSE_HW_EN) +#define CY_CAPSENSE_CSD_SHIELD_EN (0u) +#define CY_CAPSENSE_CSD_SHIELD_CAP_EN (0u) +#define CY_CAPSENSE_CSD_CHARGE_TRANSFER (0u) +#define CY_CAPSENSE_CSD_IDAC_COMP_EN (1u) +#define CY_CAPSENSE_CSD_IDAC_AUTO_GAIN_EN (1u) +#define CY_CAPSENSE_CSD_IDAC_ROW_COL_ALIGN_EN (1u) +#define CY_CAPSENSE_LFSR_EN (1u) +#define CY_CAPSENSE_LFSR_AUTO_EN (1u) +#define CY_CAPSENSE_CLOCK_SOURCE_AUTO_EN (1u) + +/* Filtering */ +#define CY_CAPSENSE_ADAPTIVE_FILTER_EN (0u) +#define CY_CAPSENSE_BALLISTIC_MULTIPLIER_EN (0u) +#define CY_CAPSENSE_RAWCOUNT_FILTER_EN (0u) +#define CY_CAPSENSE_RC_ALP_FILTER_EN (0u) +#define CY_CAPSENSE_REGULAR_RC_IIR_FILTER_EN (0u) +#define CY_CAPSENSE_REGULAR_RC_MEDIAN_FILTER_EN (0u) +#define CY_CAPSENSE_REGULAR_RC_AVERAGE_FILTER_EN (0u) +#define CY_CAPSENSE_REGULAR_RC_ALP_FILTER_EN (0u) +#define CY_CAPSENSE_REGULAR_RC_FILTER_EN \ + (CY_CAPSENSE_REGULAR_RC_IIR_FILTER_EN | CY_CAPSENSE_REGULAR_RC_MEDIAN_FILTER_EN | CY_CAPSENSE_REGULAR_RC_AVERAGE_FILTER_EN | \ + CY_CAPSENSE_REGULAR_RC_ALP_FILTER_EN) +#define CY_CAPSENSE_PROX_RC_IIR_FILTER_EN (0u) +#define CY_CAPSENSE_PROX_RC_MEDIAN_FILTER_EN (0u) +#define CY_CAPSENSE_PROX_RC_AVERAGE_FILTER_EN (0u) +#define CY_CAPSENSE_PROX_RC_ALP_FILTER_EN (0u) +#define CY_CAPSENSE_PROX_RC_FILTER_EN \ + (CY_CAPSENSE_PROX_RC_IIR_FILTER_EN | CY_CAPSENSE_PROX_RC_MEDIAN_FILTER_EN | CY_CAPSENSE_PROX_RC_AVERAGE_FILTER_EN | \ + CY_CAPSENSE_PROX_RC_ALP_FILTER_EN) +#define CY_CAPSENSE_POSITION_FILTER_EN (0u) +#define CY_CAPSENSE_CSD_POSITION_FILTER_EN (0u) +#define CY_CAPSENSE_CSX_POSITION_FILTER_EN (0u) +#define CY_CAPSENSE_POS_IIR_FILTER_EN (0u) +#define CY_CAPSENSE_POS_MEDIAN_FILTER_EN (0u) +#define CY_CAPSENSE_POS_AVERAGE_FILTER_EN (0u) +#define CY_CAPSENSE_POS_JITTER_FILTER_EN (0u) + +/* Widgets */ +#define CY_CAPSENSE_CSD_BUTTON_EN (0u) +#define CY_CAPSENSE_CSD_MATRIX_EN (0u) +#define CY_CAPSENSE_CSD_SLIDER_EN (1u) +#define CY_CAPSENSE_CSD_TOUCHPAD_EN (0u) +#define CY_CAPSENSE_CSD_PROXIMITY_EN (0u) +#define CY_CAPSENSE_CSX_BUTTON_EN (1u) +#define CY_CAPSENSE_CSX_SLIDER_EN (0u) +#define CY_CAPSENSE_CSX_MATRIX_EN (0u) +#define CY_CAPSENSE_CSX_TOUCHPAD_EN (0u) +#define CY_CAPSENSE_ISX_BUTTON_EN (0u) +#define CY_CAPSENSE_ISX_PROXIMITY_EN (0u) +#define CY_CAPSENSE_ISX_LINEAR_SLIDER_EN (0u) +#define CY_CAPSENSE_ISX_DIPLEX_SLIDER_EN (0u) +#define CY_CAPSENSE_ADVANCED_CENTROID_5X5_EN (0u) +#define CY_CAPSENSE_CSD_LINEAR_SLIDER_EN (1u) +#define CY_CAPSENSE_CSD_RADIAL_SLIDER_EN (0u) +#define CY_CAPSENSE_CSD_DIPLEX_SLIDER_EN (0u) +#define CY_CAPSENSE_CSX_LINEAR_SLIDER_EN (0u) +#define CY_CAPSENSE_CSX_DIPLEX_SLIDER_EN (0u) +#define CY_CAPSENSE_GANGED_SNS_EN (0u) +#define CY_CAPSENSE_CSD_GANGED_SNS_EN (0u) +#define CY_CAPSENSE_CSX_GANGED_SNS_EN (0u) +#define CY_CAPSENSE_BUTTON_EN (1u) +#define CY_CAPSENSE_MATRIX_EN (0u) +#define CY_CAPSENSE_SLIDER_EN (1u) +#define CY_CAPSENSE_LINEAR_SLIDER_EN (1u) +#define CY_CAPSENSE_RADIAL_SLIDER_EN (0u) +#define CY_CAPSENSE_DIPLEX_SLIDER_EN (0u) +#define CY_CAPSENSE_TOUCHPAD_EN (0u) +#define CY_CAPSENSE_PROXIMITY_EN (0u) + +/* Features */ +#define CY_CAPSENSE_GESTURE_EN (0u) +#define CY_CAPSENSE_MULTI_FREQUENCY_SCAN_EN (0u) +#define CY_CAPSENSE_MULTI_FREQUENCY_WIDGET_EN (0u) +#define CY_CAPSENSE_SNS_AUTO_RESET_EN (0u) + +/* Self-test */ +#define CY_CAPSENSE_BIST_EN (0u) +#define CY_CAPSENSE_TST_WDGT_CRC_EN (0u) +#define CY_CAPSENSE_TST_BSLN_INTEGRITY_EN (0u) +#define CY_CAPSENSE_TST_RAW_INTEGRITY_EN (0u) +#define CY_CAPSENSE_TST_SNS_SHORT_EN (0u) +#define CY_CAPSENSE_TST_SNS_CAP_EN (0u) +#define CY_CAPSENSE_TST_SH_CAP_EN (0u) +#define CY_CAPSENSE_TST_EXTERNAL_CAP_EN (0u) +#define CY_CAPSENSE_TST_VDDA_EN (0u) + +#endif /* CYCFG_CAPSENSE_DEFINES_H */ + +/* [] END OF FILE */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_capsense_tuner_regmap.h b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_capsense_tuner_regmap.h new file mode 100644 index 00000000000000..650ac462f4ee74 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_capsense_tuner_regmap.h @@ -0,0 +1,972 @@ +/******************************************************************************* + * File Name: cycfg_capsense_tuner_regmap.h + * + * Description: + * CAPSENSE Tuner register map configuration. + * This file should not be modified. It was automatically generated by + * CAPSENSE Configurator 6.10.0.3796 + * + ******************************************************************************** + * Copyright 2024, Cypress Semiconductor Corporation (an Infineon company) + * or an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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(CYCFG_CAPSENSE_TUNER_REGMAP_H) +#define CYCFG_CAPSENSE_TUNER_REGMAP_H + +#include "cy_capsense_common.h" + +#if !defined(CY_CAPSENSE_MW_VERSION) +#define CY_CAPSENSE_TUNER_MW_VERSION (200) +#else +#define CY_CAPSENSE_TUNER_MW_VERSION (CY_CAPSENSE_MW_VERSION) +#endif + +/* RAM Data structure register definitions */ +#if (CY_CAPSENSE_TUNER_MW_VERSION < 300) +#define CY_CAPSENSE_TUNER_CONFIG_ID_OFFSET (0u) +#define CY_CAPSENSE_TUNER_CONFIG_ID_SIZE (2u) + +#define CY_CAPSENSE_TUNER_TUNER_CMD_OFFSET (2u) +#define CY_CAPSENSE_TUNER_TUNER_CMD_SIZE (2u) + +#define CY_CAPSENSE_TUNER_SCAN_COUNTER_OFFSET (4u) +#define CY_CAPSENSE_TUNER_SCAN_COUNTER_SIZE (2u) + +#define CY_CAPSENSE_TUNER_TUNER_ST_OFFSET (6u) +#define CY_CAPSENSE_TUNER_TUNER_ST_SIZE (1u) + +#define CY_CAPSENSE_TUNER_INITDONE_OFFSET (7u) +#define CY_CAPSENSE_TUNER_INITDONE_SIZE (1u) + +#define CY_CAPSENSE_TUNER_PTRSSCALLBACK_OFFSET (8u) +#define CY_CAPSENSE_TUNER_PTRSSCALLBACK_SIZE (4u) + +#define CY_CAPSENSE_TUNER_PTREOSCALLBACK_OFFSET (12u) +#define CY_CAPSENSE_TUNER_PTREOSCALLBACK_SIZE (4u) + +#define CY_CAPSENSE_TUNER_PTRTUNERSENDCALLBACK_OFFSET (16u) +#define CY_CAPSENSE_TUNER_PTRTUNERSENDCALLBACK_SIZE (4u) + +#define CY_CAPSENSE_TUNER_PTRTUNERRECEIVECALLBACK_OFFSET (20u) +#define CY_CAPSENSE_TUNER_PTRTUNERRECEIVECALLBACK_SIZE (4u) + +#define CY_CAPSENSE_TUNER_STATUS_OFFSET (24u) +#define CY_CAPSENSE_TUNER_STATUS_SIZE (4u) + +#define CY_CAPSENSE_TUNER_TIMESTAMPINTERVAL_OFFSET (28u) +#define CY_CAPSENSE_TUNER_TIMESTAMPINTERVAL_SIZE (4u) + +#define CY_CAPSENSE_TUNER_TIMESTAMP_OFFSET (32u) +#define CY_CAPSENSE_TUNER_TIMESTAMP_SIZE (4u) + +#define CY_CAPSENSE_TUNER_CSD_MOD_CLK_DIVIDER_OFFSET (36u) +#define CY_CAPSENSE_TUNER_CSD_MOD_CLK_DIVIDER_SIZE (1u) + +#define CY_CAPSENSE_TUNER_CSX_MOD_CLK_DIVIDER_OFFSET (37u) +#define CY_CAPSENSE_TUNER_CSX_MOD_CLK_DIVIDER_SIZE (1u) + +#define CY_CAPSENSE_TUNER_TUNER_CNT_OFFSET (38u) +#define CY_CAPSENSE_TUNER_TUNER_CNT_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_FINGER_CP_OFFSET (40u) +#define CY_CAPSENSE_TUNER_BUTTON0_FINGER_CP_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_SIGPFC_OFFSET (42u) +#define CY_CAPSENSE_TUNER_BUTTON0_SIGPFC_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_NUM_CONV_OFFSET (44u) +#define CY_CAPSENSE_TUNER_BUTTON0_NUM_CONV_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_MAX_RAW_COUNT_OFFSET (46u) +#define CY_CAPSENSE_TUNER_BUTTON0_MAX_RAW_COUNT_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_FINGER_TH_OFFSET (48u) +#define CY_CAPSENSE_TUNER_BUTTON0_FINGER_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_PROX_TOUCH_TH_OFFSET (50u) +#define CY_CAPSENSE_TUNER_BUTTON0_PROX_TOUCH_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_LOW_BSLN_RST_OFFSET (52u) +#define CY_CAPSENSE_TUNER_BUTTON0_LOW_BSLN_RST_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_TX_CLK_OFFSET (54u) +#define CY_CAPSENSE_TUNER_BUTTON0_TX_CLK_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_SNS_CLK_OFFSET (56u) +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_SNS_CLK_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_GESTURE_DETECTED_OFFSET (58u) +#define CY_CAPSENSE_TUNER_BUTTON0_GESTURE_DETECTED_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_GESTURE_DIRECTION_OFFSET (60u) +#define CY_CAPSENSE_TUNER_BUTTON0_GESTURE_DIRECTION_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_XDELTA_OFFSET (62u) +#define CY_CAPSENSE_TUNER_BUTTON0_XDELTA_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_YDELTA_OFFSET (64u) +#define CY_CAPSENSE_TUNER_BUTTON0_YDELTA_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_NOISE_TH_OFFSET (66u) +#define CY_CAPSENSE_TUNER_BUTTON0_NOISE_TH_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_NNOISE_TH_OFFSET (67u) +#define CY_CAPSENSE_TUNER_BUTTON0_NNOISE_TH_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_HYSTERESIS_OFFSET (68u) +#define CY_CAPSENSE_TUNER_BUTTON0_HYSTERESIS_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_ON_DEBOUNCE_OFFSET (69u) +#define CY_CAPSENSE_TUNER_BUTTON0_ON_DEBOUNCE_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_TX_CLK_SOURCE_OFFSET (70u) +#define CY_CAPSENSE_TUNER_BUTTON0_TX_CLK_SOURCE_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_IDAC_MOD0_OFFSET (71u) +#define CY_CAPSENSE_TUNER_BUTTON0_IDAC_MOD0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_IDAC_MOD1_OFFSET (72u) +#define CY_CAPSENSE_TUNER_BUTTON0_IDAC_MOD1_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_IDAC_MOD2_OFFSET (73u) +#define CY_CAPSENSE_TUNER_BUTTON0_IDAC_MOD2_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_IDAC_GAIN_INDEX_OFFSET (74u) +#define CY_CAPSENSE_TUNER_BUTTON0_IDAC_GAIN_INDEX_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_IDAC_MOD0_OFFSET (75u) +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_IDAC_MOD0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_IDAC_MOD1_OFFSET (76u) +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_IDAC_MOD1_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_IDAC_MOD2_OFFSET (77u) +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_IDAC_MOD2_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_REGULAR_IIR_BL_N_OFFSET (78u) +#define CY_CAPSENSE_TUNER_BUTTON0_REGULAR_IIR_BL_N_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_STATUS_OFFSET (79u) +#define CY_CAPSENSE_TUNER_BUTTON0_STATUS_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_PTRPOSITION_OFFSET (80u) +#define CY_CAPSENSE_TUNER_BUTTON0_PTRPOSITION_SIZE (4u) + +#define CY_CAPSENSE_TUNER_BUTTON0_NUM_POSITIONS_OFFSET (84u) +#define CY_CAPSENSE_TUNER_BUTTON0_NUM_POSITIONS_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_FINGER_CP_OFFSET (88u) +#define CY_CAPSENSE_TUNER_BUTTON1_FINGER_CP_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_SIGPFC_OFFSET (90u) +#define CY_CAPSENSE_TUNER_BUTTON1_SIGPFC_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_NUM_CONV_OFFSET (92u) +#define CY_CAPSENSE_TUNER_BUTTON1_NUM_CONV_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_MAX_RAW_COUNT_OFFSET (94u) +#define CY_CAPSENSE_TUNER_BUTTON1_MAX_RAW_COUNT_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_FINGER_TH_OFFSET (96u) +#define CY_CAPSENSE_TUNER_BUTTON1_FINGER_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_PROX_TOUCH_TH_OFFSET (98u) +#define CY_CAPSENSE_TUNER_BUTTON1_PROX_TOUCH_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_LOW_BSLN_RST_OFFSET (100u) +#define CY_CAPSENSE_TUNER_BUTTON1_LOW_BSLN_RST_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_TX_CLK_OFFSET (102u) +#define CY_CAPSENSE_TUNER_BUTTON1_TX_CLK_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_SNS_CLK_OFFSET (104u) +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_SNS_CLK_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_GESTURE_DETECTED_OFFSET (106u) +#define CY_CAPSENSE_TUNER_BUTTON1_GESTURE_DETECTED_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_GESTURE_DIRECTION_OFFSET (108u) +#define CY_CAPSENSE_TUNER_BUTTON1_GESTURE_DIRECTION_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_XDELTA_OFFSET (110u) +#define CY_CAPSENSE_TUNER_BUTTON1_XDELTA_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_YDELTA_OFFSET (112u) +#define CY_CAPSENSE_TUNER_BUTTON1_YDELTA_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_NOISE_TH_OFFSET (114u) +#define CY_CAPSENSE_TUNER_BUTTON1_NOISE_TH_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_NNOISE_TH_OFFSET (115u) +#define CY_CAPSENSE_TUNER_BUTTON1_NNOISE_TH_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_HYSTERESIS_OFFSET (116u) +#define CY_CAPSENSE_TUNER_BUTTON1_HYSTERESIS_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_ON_DEBOUNCE_OFFSET (117u) +#define CY_CAPSENSE_TUNER_BUTTON1_ON_DEBOUNCE_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_TX_CLK_SOURCE_OFFSET (118u) +#define CY_CAPSENSE_TUNER_BUTTON1_TX_CLK_SOURCE_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_IDAC_MOD0_OFFSET (119u) +#define CY_CAPSENSE_TUNER_BUTTON1_IDAC_MOD0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_IDAC_MOD1_OFFSET (120u) +#define CY_CAPSENSE_TUNER_BUTTON1_IDAC_MOD1_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_IDAC_MOD2_OFFSET (121u) +#define CY_CAPSENSE_TUNER_BUTTON1_IDAC_MOD2_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_IDAC_GAIN_INDEX_OFFSET (122u) +#define CY_CAPSENSE_TUNER_BUTTON1_IDAC_GAIN_INDEX_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_IDAC_MOD0_OFFSET (123u) +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_IDAC_MOD0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_IDAC_MOD1_OFFSET (124u) +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_IDAC_MOD1_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_IDAC_MOD2_OFFSET (125u) +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_IDAC_MOD2_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_REGULAR_IIR_BL_N_OFFSET (126u) +#define CY_CAPSENSE_TUNER_BUTTON1_REGULAR_IIR_BL_N_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_STATUS_OFFSET (127u) +#define CY_CAPSENSE_TUNER_BUTTON1_STATUS_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_PTRPOSITION_OFFSET (128u) +#define CY_CAPSENSE_TUNER_BUTTON1_PTRPOSITION_SIZE (4u) + +#define CY_CAPSENSE_TUNER_BUTTON1_NUM_POSITIONS_OFFSET (132u) +#define CY_CAPSENSE_TUNER_BUTTON1_NUM_POSITIONS_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_FINGER_CP_OFFSET (136u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_FINGER_CP_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SIGPFC_OFFSET (138u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SIGPFC_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_RESOLUTION_OFFSET (140u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_RESOLUTION_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_MAX_RAW_COUNT_OFFSET (142u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_MAX_RAW_COUNT_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_FINGER_TH_OFFSET (144u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_FINGER_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_PROX_TOUCH_TH_OFFSET (146u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_PROX_TOUCH_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_LOW_BSLN_RST_OFFSET (148u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_LOW_BSLN_RST_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS_CLK_OFFSET (150u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS_CLK_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_SNS_CLK_OFFSET (152u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_SNS_CLK_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_GESTURE_DETECTED_OFFSET (154u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_GESTURE_DETECTED_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_GESTURE_DIRECTION_OFFSET (156u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_GESTURE_DIRECTION_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_XDELTA_OFFSET (158u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_XDELTA_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_YDELTA_OFFSET (160u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_YDELTA_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_NOISE_TH_OFFSET (162u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_NOISE_TH_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_NNOISE_TH_OFFSET (163u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_NNOISE_TH_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_HYSTERESIS_OFFSET (164u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_HYSTERESIS_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ON_DEBOUNCE_OFFSET (165u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ON_DEBOUNCE_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS_CLK_SOURCE_OFFSET (166u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS_CLK_SOURCE_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_IDAC_MOD0_OFFSET (167u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_IDAC_MOD0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_IDAC_MOD1_OFFSET (168u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_IDAC_MOD1_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_IDAC_MOD2_OFFSET (169u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_IDAC_MOD2_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_IDAC_GAIN_INDEX_OFFSET (170u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_IDAC_GAIN_INDEX_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_IDAC_MOD0_OFFSET (171u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_IDAC_MOD0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_IDAC_MOD1_OFFSET (172u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_IDAC_MOD1_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_IDAC_MOD2_OFFSET (173u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_IDAC_MOD2_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_REGULAR_IIR_BL_N_OFFSET (174u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_REGULAR_IIR_BL_N_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_STATUS_OFFSET (175u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_STATUS_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_PTRPOSITION_OFFSET (176u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_PTRPOSITION_SIZE (4u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_NUM_POSITIONS_OFFSET (180u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_NUM_POSITIONS_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_RAW0_OFFSET (184u) +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_RAW0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_BSLN0_OFFSET (186u) +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_BSLN0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_DIFF0_OFFSET (188u) +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_DIFF0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_STATUS0_OFFSET (190u) +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_STATUS0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_NEG_BSLN_RST_CNT0_OFFSET (191u) +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_NEG_BSLN_RST_CNT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_IDAC0_OFFSET (192u) +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_IDAC0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_BSLN_EXT0_OFFSET (193u) +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_BSLN_EXT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_RAW0_OFFSET (194u) +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_RAW0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_BSLN0_OFFSET (196u) +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_BSLN0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_DIFF0_OFFSET (198u) +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_DIFF0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_STATUS0_OFFSET (200u) +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_STATUS0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_NEG_BSLN_RST_CNT0_OFFSET (201u) +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_NEG_BSLN_RST_CNT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_IDAC0_OFFSET (202u) +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_IDAC0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_BSLN_EXT0_OFFSET (203u) +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_BSLN_EXT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_RAW0_OFFSET (204u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_RAW0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_BSLN0_OFFSET (206u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_BSLN0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_DIFF0_OFFSET (208u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_DIFF0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_STATUS0_OFFSET (210u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_STATUS0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_NEG_BSLN_RST_CNT0_OFFSET (211u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_NEG_BSLN_RST_CNT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_IDAC0_OFFSET (212u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_IDAC0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_BSLN_EXT0_OFFSET (213u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_BSLN_EXT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_RAW0_OFFSET (214u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_RAW0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_BSLN0_OFFSET (216u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_BSLN0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_DIFF0_OFFSET (218u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_DIFF0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_STATUS0_OFFSET (220u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_STATUS0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_NEG_BSLN_RST_CNT0_OFFSET (221u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_NEG_BSLN_RST_CNT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_IDAC0_OFFSET (222u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_IDAC0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_BSLN_EXT0_OFFSET (223u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_BSLN_EXT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_RAW0_OFFSET (224u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_RAW0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_BSLN0_OFFSET (226u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_BSLN0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_DIFF0_OFFSET (228u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_DIFF0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_STATUS0_OFFSET (230u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_STATUS0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_NEG_BSLN_RST_CNT0_OFFSET (231u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_NEG_BSLN_RST_CNT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_IDAC0_OFFSET (232u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_IDAC0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_BSLN_EXT0_OFFSET (233u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_BSLN_EXT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_RAW0_OFFSET (234u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_RAW0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_BSLN0_OFFSET (236u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_BSLN0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_DIFF0_OFFSET (238u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_DIFF0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_STATUS0_OFFSET (240u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_STATUS0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_NEG_BSLN_RST_CNT0_OFFSET (241u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_NEG_BSLN_RST_CNT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_IDAC0_OFFSET (242u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_IDAC0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_BSLN_EXT0_OFFSET (243u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_BSLN_EXT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_RAW0_OFFSET (244u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_RAW0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_BSLN0_OFFSET (246u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_BSLN0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_DIFF0_OFFSET (248u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_DIFF0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_STATUS0_OFFSET (250u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_STATUS0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_NEG_BSLN_RST_CNT0_OFFSET (251u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_NEG_BSLN_RST_CNT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_IDAC0_OFFSET (252u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_IDAC0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_BSLN_EXT0_OFFSET (253u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_BSLN_EXT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_X0_OFFSET (254u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_X0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_Y0_OFFSET (256u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_Y0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_Z0_OFFSET (258u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_Z0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ID0_OFFSET (260u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ID0_SIZE (2u) + +#else /* CY_CAPSENSE_TUNER_MW_VERSION >= 300 */ +#define CY_CAPSENSE_TUNER_CONFIG_ID_OFFSET (0u) +#define CY_CAPSENSE_TUNER_CONFIG_ID_SIZE (2u) + +#define CY_CAPSENSE_TUNER_TUNER_CMD_OFFSET (2u) +#define CY_CAPSENSE_TUNER_TUNER_CMD_SIZE (2u) + +#define CY_CAPSENSE_TUNER_SCAN_COUNTER_OFFSET (4u) +#define CY_CAPSENSE_TUNER_SCAN_COUNTER_SIZE (2u) + +#define CY_CAPSENSE_TUNER_TUNER_ST_OFFSET (6u) +#define CY_CAPSENSE_TUNER_TUNER_ST_SIZE (1u) + +#define CY_CAPSENSE_TUNER_INITDONE_OFFSET (7u) +#define CY_CAPSENSE_TUNER_INITDONE_SIZE (1u) + +#define CY_CAPSENSE_TUNER_STATUS_OFFSET (8u) +#define CY_CAPSENSE_TUNER_STATUS_SIZE (4u) + +#define CY_CAPSENSE_TUNER_TIMESTAMPINTERVAL_OFFSET (12u) +#define CY_CAPSENSE_TUNER_TIMESTAMPINTERVAL_SIZE (4u) + +#define CY_CAPSENSE_TUNER_TIMESTAMP_OFFSET (16u) +#define CY_CAPSENSE_TUNER_TIMESTAMP_SIZE (4u) + +#define CY_CAPSENSE_TUNER_CSD_MOD_CLK_DIVIDER_OFFSET (20u) +#define CY_CAPSENSE_TUNER_CSD_MOD_CLK_DIVIDER_SIZE (1u) + +#define CY_CAPSENSE_TUNER_CSX_MOD_CLK_DIVIDER_OFFSET (21u) +#define CY_CAPSENSE_TUNER_CSX_MOD_CLK_DIVIDER_SIZE (1u) + +#define CY_CAPSENSE_TUNER_TUNER_CNT_OFFSET (22u) +#define CY_CAPSENSE_TUNER_TUNER_CNT_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_FINGER_CP_OFFSET (24u) +#define CY_CAPSENSE_TUNER_BUTTON0_FINGER_CP_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_SIGPFC_OFFSET (26u) +#define CY_CAPSENSE_TUNER_BUTTON0_SIGPFC_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_NUM_CONV_OFFSET (28u) +#define CY_CAPSENSE_TUNER_BUTTON0_NUM_CONV_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_MAX_RAW_COUNT_OFFSET (30u) +#define CY_CAPSENSE_TUNER_BUTTON0_MAX_RAW_COUNT_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_MAX_RAW_COUNT_OFFSET (32u) +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_MAX_RAW_COUNT_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_FINGER_TH_OFFSET (34u) +#define CY_CAPSENSE_TUNER_BUTTON0_FINGER_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_PROX_TOUCH_TH_OFFSET (36u) +#define CY_CAPSENSE_TUNER_BUTTON0_PROX_TOUCH_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_LOW_BSLN_RST_OFFSET (38u) +#define CY_CAPSENSE_TUNER_BUTTON0_LOW_BSLN_RST_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_TX_CLK_OFFSET (40u) +#define CY_CAPSENSE_TUNER_BUTTON0_TX_CLK_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_SNS_CLK_OFFSET (42u) +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_SNS_CLK_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_GESTURE_DETECTED_OFFSET (44u) +#define CY_CAPSENSE_TUNER_BUTTON0_GESTURE_DETECTED_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_GESTURE_DIRECTION_OFFSET (46u) +#define CY_CAPSENSE_TUNER_BUTTON0_GESTURE_DIRECTION_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_XDELTA_OFFSET (48u) +#define CY_CAPSENSE_TUNER_BUTTON0_XDELTA_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_YDELTA_OFFSET (50u) +#define CY_CAPSENSE_TUNER_BUTTON0_YDELTA_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_NOISE_TH_OFFSET (52u) +#define CY_CAPSENSE_TUNER_BUTTON0_NOISE_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_NNOISE_TH_OFFSET (54u) +#define CY_CAPSENSE_TUNER_BUTTON0_NNOISE_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_HYSTERESIS_OFFSET (56u) +#define CY_CAPSENSE_TUNER_BUTTON0_HYSTERESIS_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_ON_DEBOUNCE_OFFSET (58u) +#define CY_CAPSENSE_TUNER_BUTTON0_ON_DEBOUNCE_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_TX_CLK_SOURCE_OFFSET (59u) +#define CY_CAPSENSE_TUNER_BUTTON0_TX_CLK_SOURCE_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_IDAC_MOD0_OFFSET (60u) +#define CY_CAPSENSE_TUNER_BUTTON0_IDAC_MOD0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_IDAC_MOD1_OFFSET (61u) +#define CY_CAPSENSE_TUNER_BUTTON0_IDAC_MOD1_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_IDAC_MOD2_OFFSET (62u) +#define CY_CAPSENSE_TUNER_BUTTON0_IDAC_MOD2_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_IDAC_GAIN_INDEX_OFFSET (63u) +#define CY_CAPSENSE_TUNER_BUTTON0_IDAC_GAIN_INDEX_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_IDAC_MOD0_OFFSET (64u) +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_IDAC_MOD0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_IDAC_MOD1_OFFSET (65u) +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_IDAC_MOD1_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_IDAC_MOD2_OFFSET (66u) +#define CY_CAPSENSE_TUNER_BUTTON0_ROW_IDAC_MOD2_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_REGULAR_IIR_BL_N_OFFSET (67u) +#define CY_CAPSENSE_TUNER_BUTTON0_REGULAR_IIR_BL_N_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_STATUS_OFFSET (68u) +#define CY_CAPSENSE_TUNER_BUTTON0_STATUS_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_PTRPOSITION_OFFSET (72u) +#define CY_CAPSENSE_TUNER_BUTTON0_PTRPOSITION_SIZE (4u) + +#define CY_CAPSENSE_TUNER_BUTTON0_NUM_POSITIONS_OFFSET (76u) +#define CY_CAPSENSE_TUNER_BUTTON0_NUM_POSITIONS_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_FINGER_CP_OFFSET (80u) +#define CY_CAPSENSE_TUNER_BUTTON1_FINGER_CP_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_SIGPFC_OFFSET (82u) +#define CY_CAPSENSE_TUNER_BUTTON1_SIGPFC_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_NUM_CONV_OFFSET (84u) +#define CY_CAPSENSE_TUNER_BUTTON1_NUM_CONV_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_MAX_RAW_COUNT_OFFSET (86u) +#define CY_CAPSENSE_TUNER_BUTTON1_MAX_RAW_COUNT_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_MAX_RAW_COUNT_OFFSET (88u) +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_MAX_RAW_COUNT_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_FINGER_TH_OFFSET (90u) +#define CY_CAPSENSE_TUNER_BUTTON1_FINGER_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_PROX_TOUCH_TH_OFFSET (92u) +#define CY_CAPSENSE_TUNER_BUTTON1_PROX_TOUCH_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_LOW_BSLN_RST_OFFSET (94u) +#define CY_CAPSENSE_TUNER_BUTTON1_LOW_BSLN_RST_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_TX_CLK_OFFSET (96u) +#define CY_CAPSENSE_TUNER_BUTTON1_TX_CLK_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_SNS_CLK_OFFSET (98u) +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_SNS_CLK_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_GESTURE_DETECTED_OFFSET (100u) +#define CY_CAPSENSE_TUNER_BUTTON1_GESTURE_DETECTED_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_GESTURE_DIRECTION_OFFSET (102u) +#define CY_CAPSENSE_TUNER_BUTTON1_GESTURE_DIRECTION_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_XDELTA_OFFSET (104u) +#define CY_CAPSENSE_TUNER_BUTTON1_XDELTA_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_YDELTA_OFFSET (106u) +#define CY_CAPSENSE_TUNER_BUTTON1_YDELTA_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_NOISE_TH_OFFSET (108u) +#define CY_CAPSENSE_TUNER_BUTTON1_NOISE_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_NNOISE_TH_OFFSET (110u) +#define CY_CAPSENSE_TUNER_BUTTON1_NNOISE_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_HYSTERESIS_OFFSET (112u) +#define CY_CAPSENSE_TUNER_BUTTON1_HYSTERESIS_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_ON_DEBOUNCE_OFFSET (114u) +#define CY_CAPSENSE_TUNER_BUTTON1_ON_DEBOUNCE_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_TX_CLK_SOURCE_OFFSET (115u) +#define CY_CAPSENSE_TUNER_BUTTON1_TX_CLK_SOURCE_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_IDAC_MOD0_OFFSET (116u) +#define CY_CAPSENSE_TUNER_BUTTON1_IDAC_MOD0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_IDAC_MOD1_OFFSET (117u) +#define CY_CAPSENSE_TUNER_BUTTON1_IDAC_MOD1_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_IDAC_MOD2_OFFSET (118u) +#define CY_CAPSENSE_TUNER_BUTTON1_IDAC_MOD2_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_IDAC_GAIN_INDEX_OFFSET (119u) +#define CY_CAPSENSE_TUNER_BUTTON1_IDAC_GAIN_INDEX_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_IDAC_MOD0_OFFSET (120u) +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_IDAC_MOD0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_IDAC_MOD1_OFFSET (121u) +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_IDAC_MOD1_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_IDAC_MOD2_OFFSET (122u) +#define CY_CAPSENSE_TUNER_BUTTON1_ROW_IDAC_MOD2_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_REGULAR_IIR_BL_N_OFFSET (123u) +#define CY_CAPSENSE_TUNER_BUTTON1_REGULAR_IIR_BL_N_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_STATUS_OFFSET (124u) +#define CY_CAPSENSE_TUNER_BUTTON1_STATUS_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_PTRPOSITION_OFFSET (128u) +#define CY_CAPSENSE_TUNER_BUTTON1_PTRPOSITION_SIZE (4u) + +#define CY_CAPSENSE_TUNER_BUTTON1_NUM_POSITIONS_OFFSET (132u) +#define CY_CAPSENSE_TUNER_BUTTON1_NUM_POSITIONS_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_FINGER_CP_OFFSET (136u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_FINGER_CP_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SIGPFC_OFFSET (138u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SIGPFC_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_RESOLUTION_OFFSET (140u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_RESOLUTION_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_MAX_RAW_COUNT_OFFSET (142u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_MAX_RAW_COUNT_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_MAX_RAW_COUNT_OFFSET (144u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_MAX_RAW_COUNT_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_FINGER_TH_OFFSET (146u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_FINGER_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_PROX_TOUCH_TH_OFFSET (148u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_PROX_TOUCH_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_LOW_BSLN_RST_OFFSET (150u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_LOW_BSLN_RST_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS_CLK_OFFSET (152u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS_CLK_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_SNS_CLK_OFFSET (154u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_SNS_CLK_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_GESTURE_DETECTED_OFFSET (156u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_GESTURE_DETECTED_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_GESTURE_DIRECTION_OFFSET (158u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_GESTURE_DIRECTION_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_XDELTA_OFFSET (160u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_XDELTA_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_YDELTA_OFFSET (162u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_YDELTA_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_NOISE_TH_OFFSET (164u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_NOISE_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_NNOISE_TH_OFFSET (166u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_NNOISE_TH_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_HYSTERESIS_OFFSET (168u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_HYSTERESIS_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ON_DEBOUNCE_OFFSET (170u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ON_DEBOUNCE_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS_CLK_SOURCE_OFFSET (171u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS_CLK_SOURCE_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_IDAC_MOD0_OFFSET (172u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_IDAC_MOD0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_IDAC_MOD1_OFFSET (173u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_IDAC_MOD1_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_IDAC_MOD2_OFFSET (174u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_IDAC_MOD2_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_IDAC_GAIN_INDEX_OFFSET (175u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_IDAC_GAIN_INDEX_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_IDAC_MOD0_OFFSET (176u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_IDAC_MOD0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_IDAC_MOD1_OFFSET (177u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_IDAC_MOD1_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_IDAC_MOD2_OFFSET (178u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ROW_IDAC_MOD2_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_REGULAR_IIR_BL_N_OFFSET (179u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_REGULAR_IIR_BL_N_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_STATUS_OFFSET (180u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_STATUS_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_PTRPOSITION_OFFSET (184u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_PTRPOSITION_SIZE (4u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_NUM_POSITIONS_OFFSET (188u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_NUM_POSITIONS_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_RAW0_OFFSET (192u) +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_RAW0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_BSLN0_OFFSET (194u) +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_BSLN0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_DIFF0_OFFSET (196u) +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_DIFF0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_STATUS0_OFFSET (198u) +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_STATUS0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_NEG_BSLN_RST_CNT0_OFFSET (199u) +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_NEG_BSLN_RST_CNT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_IDAC0_OFFSET (200u) +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_IDAC0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_BSLN_EXT0_OFFSET (201u) +#define CY_CAPSENSE_TUNER_BUTTON0_RX0_BSLN_EXT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_RAW0_OFFSET (202u) +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_RAW0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_BSLN0_OFFSET (204u) +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_BSLN0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_DIFF0_OFFSET (206u) +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_DIFF0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_STATUS0_OFFSET (208u) +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_STATUS0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_NEG_BSLN_RST_CNT0_OFFSET (209u) +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_NEG_BSLN_RST_CNT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_IDAC0_OFFSET (210u) +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_IDAC0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_BSLN_EXT0_OFFSET (211u) +#define CY_CAPSENSE_TUNER_BUTTON1_RX0_BSLN_EXT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_RAW0_OFFSET (212u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_RAW0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_BSLN0_OFFSET (214u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_BSLN0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_DIFF0_OFFSET (216u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_DIFF0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_STATUS0_OFFSET (218u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_STATUS0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_NEG_BSLN_RST_CNT0_OFFSET (219u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_NEG_BSLN_RST_CNT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_IDAC0_OFFSET (220u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_IDAC0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_BSLN_EXT0_OFFSET (221u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS0_BSLN_EXT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_RAW0_OFFSET (222u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_RAW0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_BSLN0_OFFSET (224u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_BSLN0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_DIFF0_OFFSET (226u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_DIFF0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_STATUS0_OFFSET (228u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_STATUS0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_NEG_BSLN_RST_CNT0_OFFSET (229u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_NEG_BSLN_RST_CNT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_IDAC0_OFFSET (230u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_IDAC0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_BSLN_EXT0_OFFSET (231u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS1_BSLN_EXT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_RAW0_OFFSET (232u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_RAW0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_BSLN0_OFFSET (234u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_BSLN0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_DIFF0_OFFSET (236u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_DIFF0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_STATUS0_OFFSET (238u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_STATUS0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_NEG_BSLN_RST_CNT0_OFFSET (239u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_NEG_BSLN_RST_CNT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_IDAC0_OFFSET (240u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_IDAC0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_BSLN_EXT0_OFFSET (241u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS2_BSLN_EXT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_RAW0_OFFSET (242u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_RAW0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_BSLN0_OFFSET (244u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_BSLN0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_DIFF0_OFFSET (246u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_DIFF0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_STATUS0_OFFSET (248u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_STATUS0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_NEG_BSLN_RST_CNT0_OFFSET (249u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_NEG_BSLN_RST_CNT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_IDAC0_OFFSET (250u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_IDAC0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_BSLN_EXT0_OFFSET (251u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS3_BSLN_EXT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_RAW0_OFFSET (252u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_RAW0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_BSLN0_OFFSET (254u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_BSLN0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_DIFF0_OFFSET (256u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_DIFF0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_STATUS0_OFFSET (258u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_STATUS0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_NEG_BSLN_RST_CNT0_OFFSET (259u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_NEG_BSLN_RST_CNT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_IDAC0_OFFSET (260u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_IDAC0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_BSLN_EXT0_OFFSET (261u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_SNS4_BSLN_EXT0_SIZE (1u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_X0_OFFSET (262u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_X0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_Y0_OFFSET (264u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_Y0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_Z0_OFFSET (266u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_Z0_SIZE (2u) + +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ID0_OFFSET (268u) +#define CY_CAPSENSE_TUNER_LINEARSLIDER0_ID0_SIZE (2u) + +#endif + +#endif /* CYCFG_CAPSENSE_TUNER_REGMAP_H */ + +/* [] END OF FILE */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_clocks.c b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_clocks.c new file mode 100644 index 00000000000000..d8298c696d8dde --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_clocks.c @@ -0,0 +1,69 @@ +/******************************************************************************* + * File Name: cycfg_clocks.c + * + * Description: + * Clock configuration + * This file was automatically generated and should not be modified. + * Configurator Backend 3.10.0 + * device-db 4.100.0.4304 + * mtb-pdl-cat1 3.9.0.29592 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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 "cycfg_clocks.h" + +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t peri_0_div_16_15_obj = { + .type = CYHAL_RSC_CLOCK, + .block_num = peri_0_div_16_15_HW, + .channel_num = peri_0_div_16_15_NUM, +}; +const cyhal_resource_inst_t CYBSP_CSD_CLK_DIV_obj = { + .type = CYHAL_RSC_CLOCK, + .block_num = CYBSP_CSD_CLK_DIV_HW, + .channel_num = CYBSP_CSD_CLK_DIV_NUM, +}; +const cyhal_resource_inst_t CYBSP_TRACE_CLK_DIV_obj = { + .type = CYHAL_RSC_CLOCK, + .block_num = CYBSP_TRACE_CLK_DIV_HW, + .channel_num = CYBSP_TRACE_CLK_DIV_NUM, +}; +#endif // defined (CY_USING_HAL) + +void init_cycfg_clocks(void) +{ + Cy_SysClk_PeriphDisableDivider(CY_SYSCLK_DIV_16_BIT, 15U); + Cy_SysClk_PeriphSetDivider(CY_SYSCLK_DIV_16_BIT, 15U, 0U); + Cy_SysClk_PeriphEnableDivider(CY_SYSCLK_DIV_16_BIT, 15U); + Cy_SysClk_PeriphDisableDivider(CY_SYSCLK_DIV_8_BIT, 0U); + Cy_SysClk_PeriphSetDivider(CY_SYSCLK_DIV_8_BIT, 0U, 0U); + Cy_SysClk_PeriphEnableDivider(CY_SYSCLK_DIV_8_BIT, 0U); + Cy_SysClk_PeriphDisableDivider(CY_SYSCLK_DIV_8_BIT, 7U); + Cy_SysClk_PeriphSetDivider(CY_SYSCLK_DIV_8_BIT, 7U, 0U); + Cy_SysClk_PeriphEnableDivider(CY_SYSCLK_DIV_8_BIT, 7U); +} + +void reserve_cycfg_clocks(void) +{ +#if defined(CY_USING_HAL) + cyhal_hwmgr_reserve(&peri_0_div_16_15_obj); + cyhal_hwmgr_reserve(&CYBSP_CSD_CLK_DIV_obj); + cyhal_hwmgr_reserve(&CYBSP_TRACE_CLK_DIV_obj); +#endif // defined (CY_USING_HAL) +} diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_clocks.h b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_clocks.h new file mode 100644 index 00000000000000..8d5d6cf34f40b6 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_clocks.h @@ -0,0 +1,69 @@ +/******************************************************************************* + * File Name: cycfg_clocks.h + * + * Description: + * Clock configuration + * This file was automatically generated and should not be modified. + * Configurator Backend 3.10.0 + * device-db 4.100.0.4304 + * mtb-pdl-cat1 3.9.0.29592 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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(CYCFG_CLOCKS_H) +#define CYCFG_CLOCKS_H + +#include "cy_sysclk.h" +#include "cycfg_notices.h" +#if defined(CY_USING_HAL) +#include "cyhal_hwmgr.h" +#endif // defined (CY_USING_HAL) + +#if defined(__cplusplus) +extern "C" { +#endif + +#define peri_0_div_16_15_ENABLED 1U +#define peri_0_div_16_15_HW CY_SYSCLK_DIV_16_BIT +#define peri_0_div_16_15_NUM 15U +#define CYBSP_CSD_CLK_DIV_ENABLED 1U +#define CYBSP_CS_CLK_DIV_ENABLED CYBSP_CSD_CLK_DIV_ENABLED +#define CYBSP_CSD_CLK_DIV_HW CY_SYSCLK_DIV_8_BIT +#define CYBSP_CS_CLK_DIV_HW CYBSP_CSD_CLK_DIV_HW +#define CYBSP_CSD_CLK_DIV_NUM 0U +#define CYBSP_CS_CLK_DIV_NUM CYBSP_CSD_CLK_DIV_NUM +#define CYBSP_TRACE_CLK_DIV_ENABLED 1U +#define CYBSP_TRACE_CLK_DIV_HW CY_SYSCLK_DIV_8_BIT +#define CYBSP_TRACE_CLK_DIV_NUM 7U + +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t peri_0_div_16_15_obj; +extern const cyhal_resource_inst_t CYBSP_CSD_CLK_DIV_obj; +#define CYBSP_CS_CLK_DIV_obj CYBSP_CSD_CLK_DIV_obj +extern const cyhal_resource_inst_t CYBSP_TRACE_CLK_DIV_obj; +#endif // defined (CY_USING_HAL) + +void init_cycfg_clocks(void); +void reserve_cycfg_clocks(void); + +#if defined(__cplusplus) +} +#endif + +#endif /* CYCFG_CLOCKS_H */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_connectivity_bt.c b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_connectivity_bt.c new file mode 100644 index 00000000000000..8c6062f3adaccf --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_connectivity_bt.c @@ -0,0 +1,29 @@ +/******************************************************************************* + * File Name: cycfg_connectivity_bt.c + * + * Description: + * Connectivity BT configuration + * This file was automatically generated and should not be modified. + * Configurator Backend 3.10.0 + * device-db 4.100.0.4304 + * mtb-pdl-cat1 3.9.0.29592 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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 "cycfg_connectivity_bt.h" diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_connectivity_bt.h b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_connectivity_bt.h new file mode 100644 index 00000000000000..24fbaed1013b81 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_connectivity_bt.h @@ -0,0 +1,52 @@ +/******************************************************************************* + * File Name: cycfg_connectivity_bt.h + * + * Description: + * Connectivity BT configuration + * This file was automatically generated and should not be modified. + * Configurator Backend 3.10.0 + * device-db 4.100.0.4304 + * mtb-pdl-cat1 3.9.0.29592 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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(CYCFG_CONNECTIVITY_BT_H) +#define CYCFG_CONNECTIVITY_BT_H + +#include "cycfg_notices.h" +#include "cycfg_pins.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +#define bt_0_power_0_ENABLED 1U +#define CYCFG_BT_LP_ENABLED (1u) +#define CYCFG_BT_WAKE_EVENT_ACTIVE_LOW (0) +#define CYCFG_BT_WAKE_EVENT_ACTIVE_HIGH (1) +#define CYCFG_BT_HOST_WAKE_GPIO CYBSP_BT_HOST_WAKE +#define CYCFG_BT_HOST_WAKE_IRQ_EVENT CYBT_WAKE_ACTIVE_LOW +#define CYCFG_BT_DEV_WAKE_GPIO CYBSP_BT_DEVICE_WAKE +#define CYCFG_BT_DEV_WAKE_POLARITY CYBT_WAKE_ACTIVE_LOW + +#if defined(__cplusplus) +} +#endif + +#endif /* CYCFG_CONNECTIVITY_BT_H */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_notices.h b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_notices.h new file mode 100644 index 00000000000000..ac7067c526b175 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_notices.h @@ -0,0 +1,51 @@ +/******************************************************************************* + * File Name: cycfg_notices.h + * + * Description: + * Contains warnings and errors that occurred while generating code for the + * design. + * This file was automatically generated and should not be modified. + * Configurator Backend 3.10.0 + * device-db 4.100.0.4304 + * mtb-pdl-cat1 3.9.0.29592 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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(CYCFG_NOTICES_H) +#define CYCFG_NOTICES_H + +#ifdef CY_SUPPORTS_DEVICE_VALIDATION +#ifndef CY8C624ABZI_S2D44 +#error \ + "Unexpected MPN; expected DEVICE:=CY8C624ABZI-S2D44. There may be an inconsistency between the *.modus file and the makefile target configuration device sets." +#endif +#endif + +#ifdef CY_SUPPORTS_COMPLETE_DEVICE_VALIDATION +#ifndef CY8C624ABZI_S2D44 +#error \ + "Unexpected MPN; expected DEVICE:=CY8C624ABZI-S2D44, ADDITIONAL_DEVICES:=CYW43012C0WKWBG. There may be an inconsistency between the *.modus file and the makefile target configuration device sets." +#endif +#ifndef CYW43012C0WKWBG +#error \ + "Unexpected MPN; expected DEVICE:=CY8C624ABZI-S2D44, ADDITIONAL_DEVICES:=CYW43012C0WKWBG. There may be an inconsistency between the *.modus file and the makefile target configuration device sets." +#endif +#endif + +#endif /* CYCFG_NOTICES_H */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_peripherals.c b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_peripherals.c new file mode 100644 index 00000000000000..f46d17a4dffcad --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_peripherals.c @@ -0,0 +1,38 @@ +/******************************************************************************* + * File Name: cycfg_peripherals.c + * + * Description: + * Peripheral Hardware Block configuration + * This file was automatically generated and should not be modified. + * Configurator Backend 3.10.0 + * device-db 4.100.0.4304 + * mtb-pdl-cat1 3.9.0.29592 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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 "cycfg_peripherals.h" + +cy_stc_csd_context_t cy_csd_0_context = { + .lockKey = CY_CSD_NONE_KEY, +}; + +void init_cycfg_peripherals(void) +{ + Cy_SysClk_PeriphAssignDivider(PCLK_CSD_CLOCK, CY_SYSCLK_DIV_8_BIT, 0U); +} diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_peripherals.h b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_peripherals.h new file mode 100644 index 00000000000000..19c98a592ca11e --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_peripherals.h @@ -0,0 +1,85 @@ +/******************************************************************************* + * File Name: cycfg_peripherals.h + * + * Description: + * Peripheral Hardware Block configuration + * This file was automatically generated and should not be modified. + * Configurator Backend 3.10.0 + * device-db 4.100.0.4304 + * mtb-pdl-cat1 3.9.0.29592 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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(CYCFG_PERIPHERALS_H) +#define CYCFG_PERIPHERALS_H + +#include "cy_csd.h" +#include "cy_sysclk.h" +#include "cycfg_notices.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +#define CYBSP_CSD_ENABLED 1U +#define CY_CAPSENSE_CORE 4u +#define CY_CAPSENSE_CPU_CLK 100000000u +#define CY_CAPSENSE_PERI_CLK 100000000u +#define CY_CAPSENSE_VDDA_MV 3300u +#define CY_CAPSENSE_PERI_DIV_TYPE CY_SYSCLK_DIV_8_BIT +#define CY_CAPSENSE_PERI_DIV_INDEX 0u +#define Cmod_PORT GPIO_PRT7 +#define CintA_PORT GPIO_PRT7 +#define CintB_PORT GPIO_PRT7 +#define Button0_Rx0_PORT GPIO_PRT1 +#define Button0_Tx_PORT GPIO_PRT8 +#define Button1_Rx0_PORT GPIO_PRT1 +#define Button1_Tx_PORT GPIO_PRT8 +#define LinearSlider0_Sns0_PORT GPIO_PRT8 +#define LinearSlider0_Sns1_PORT GPIO_PRT8 +#define LinearSlider0_Sns2_PORT GPIO_PRT8 +#define LinearSlider0_Sns3_PORT GPIO_PRT8 +#define LinearSlider0_Sns4_PORT GPIO_PRT8 +#define Cmod_PIN 7u +#define CintA_PIN 1u +#define CintB_PIN 2u +#define Button0_Rx0_PIN 0u +#define Button0_Tx_PIN 1u +#define Button1_Rx0_PIN 0u +#define Button1_Tx_PIN 2u +#define LinearSlider0_Sns0_PIN 3u +#define LinearSlider0_Sns1_PIN 4u +#define LinearSlider0_Sns2_PIN 5u +#define LinearSlider0_Sns3_PIN 6u +#define LinearSlider0_Sns4_PIN 7u +#define Cmod_PORT_NUM 7u +#define CintA_PORT_NUM 7u +#define CintB_PORT_NUM 7u +#define CYBSP_CSD_HW CSD0 +#define CYBSP_CSD_IRQ csd_interrupt_IRQn + +extern cy_stc_csd_context_t cy_csd_0_context; + +void init_cycfg_peripherals(void); + +#if defined(__cplusplus) +} +#endif + +#endif /* CYCFG_PERIPHERALS_H */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_pins.c b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_pins.c new file mode 100644 index 00000000000000..10c5ff5a8414e4 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_pins.c @@ -0,0 +1,411 @@ +/******************************************************************************* + * File Name: cycfg_pins.c + * + * Description: + * Pin configuration + * This file was automatically generated and should not be modified. + * Configurator Backend 3.10.0 + * device-db 4.100.0.4304 + * mtb-pdl-cat1 3.9.0.29592 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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 "cycfg_pins.h" + +const cy_stc_gpio_pin_config_t CYBSP_WCO_IN_config = { + .outVal = 1, + .driveMode = CY_GPIO_DM_ANALOG, + .hsiom = CYBSP_WCO_IN_HSIOM, + .intEdge = CY_GPIO_INTR_DISABLE, + .intMask = 0UL, + .vtrip = CY_GPIO_VTRIP_CMOS, + .slewRate = CY_GPIO_SLEW_FAST, + .driveSel = CY_GPIO_DRIVE_1_2, + .vregEn = 0UL, + .ibufMode = 0UL, + .vtripSel = 0UL, + .vrefSel = 0UL, + .vohSel = 0UL, +}; +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t CYBSP_WCO_IN_obj = { + .type = CYHAL_RSC_GPIO, + .block_num = CYBSP_WCO_IN_PORT_NUM, + .channel_num = CYBSP_WCO_IN_PIN, +}; +#endif // defined (CY_USING_HAL) +const cy_stc_gpio_pin_config_t CYBSP_WCO_OUT_config = { + .outVal = 1, + .driveMode = CY_GPIO_DM_ANALOG, + .hsiom = CYBSP_WCO_OUT_HSIOM, + .intEdge = CY_GPIO_INTR_DISABLE, + .intMask = 0UL, + .vtrip = CY_GPIO_VTRIP_CMOS, + .slewRate = CY_GPIO_SLEW_FAST, + .driveSel = CY_GPIO_DRIVE_1_2, + .vregEn = 0UL, + .ibufMode = 0UL, + .vtripSel = 0UL, + .vrefSel = 0UL, + .vohSel = 0UL, +}; +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t CYBSP_WCO_OUT_obj = { + .type = CYHAL_RSC_GPIO, + .block_num = CYBSP_WCO_OUT_PORT_NUM, + .channel_num = CYBSP_WCO_OUT_PIN, +}; +#endif // defined (CY_USING_HAL) +const cy_stc_gpio_pin_config_t CYBSP_CSD_RX_config = { + .outVal = 1, + .driveMode = CY_GPIO_DM_ANALOG, + .hsiom = CYBSP_CSD_RX_HSIOM, + .intEdge = CY_GPIO_INTR_DISABLE, + .intMask = 0UL, + .vtrip = CY_GPIO_VTRIP_CMOS, + .slewRate = CY_GPIO_SLEW_FAST, + .driveSel = CY_GPIO_DRIVE_1_2, + .vregEn = 0UL, + .ibufMode = 0UL, + .vtripSel = 0UL, + .vrefSel = 0UL, + .vohSel = 0UL, +}; +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t CYBSP_CSD_RX_obj = { + .type = CYHAL_RSC_GPIO, + .block_num = CYBSP_CSD_RX_PORT_NUM, + .channel_num = CYBSP_CSD_RX_PIN, +}; +#endif // defined (CY_USING_HAL) +const cy_stc_gpio_pin_config_t CYBSP_SWO_config = { + .outVal = 1, + .driveMode = CY_GPIO_DM_STRONG_IN_OFF, + .hsiom = CYBSP_SWO_HSIOM, + .intEdge = CY_GPIO_INTR_DISABLE, + .intMask = 0UL, + .vtrip = CY_GPIO_VTRIP_CMOS, + .slewRate = CY_GPIO_SLEW_FAST, + .driveSel = CY_GPIO_DRIVE_1_2, + .vregEn = 0UL, + .ibufMode = 0UL, + .vtripSel = 0UL, + .vrefSel = 0UL, + .vohSel = 0UL, +}; +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t CYBSP_SWO_obj = { + .type = CYHAL_RSC_GPIO, + .block_num = CYBSP_SWO_PORT_NUM, + .channel_num = CYBSP_SWO_PIN, +}; +#endif // defined (CY_USING_HAL) +const cy_stc_gpio_pin_config_t CYBSP_SWDIO_config = { + .outVal = 1, + .driveMode = CY_GPIO_DM_PULLUP, + .hsiom = CYBSP_SWDIO_HSIOM, + .intEdge = CY_GPIO_INTR_DISABLE, + .intMask = 0UL, + .vtrip = CY_GPIO_VTRIP_CMOS, + .slewRate = CY_GPIO_SLEW_FAST, + .driveSel = CY_GPIO_DRIVE_1_2, + .vregEn = 0UL, + .ibufMode = 0UL, + .vtripSel = 0UL, + .vrefSel = 0UL, + .vohSel = 0UL, +}; +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t CYBSP_SWDIO_obj = { + .type = CYHAL_RSC_GPIO, + .block_num = CYBSP_SWDIO_PORT_NUM, + .channel_num = CYBSP_SWDIO_PIN, +}; +#endif // defined (CY_USING_HAL) +const cy_stc_gpio_pin_config_t CYBSP_SWDCK_config = { + .outVal = 1, + .driveMode = CY_GPIO_DM_PULLDOWN, + .hsiom = CYBSP_SWDCK_HSIOM, + .intEdge = CY_GPIO_INTR_DISABLE, + .intMask = 0UL, + .vtrip = CY_GPIO_VTRIP_CMOS, + .slewRate = CY_GPIO_SLEW_FAST, + .driveSel = CY_GPIO_DRIVE_1_2, + .vregEn = 0UL, + .ibufMode = 0UL, + .vtripSel = 0UL, + .vrefSel = 0UL, + .vohSel = 0UL, +}; +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t CYBSP_SWDCK_obj = { + .type = CYHAL_RSC_GPIO, + .block_num = CYBSP_SWDCK_PORT_NUM, + .channel_num = CYBSP_SWDCK_PIN, +}; +#endif // defined (CY_USING_HAL) +const cy_stc_gpio_pin_config_t CYBSP_CINA_config = { + .outVal = 1, + .driveMode = CY_GPIO_DM_ANALOG, + .hsiom = CYBSP_CINA_HSIOM, + .intEdge = CY_GPIO_INTR_DISABLE, + .intMask = 0UL, + .vtrip = CY_GPIO_VTRIP_CMOS, + .slewRate = CY_GPIO_SLEW_FAST, + .driveSel = CY_GPIO_DRIVE_1_2, + .vregEn = 0UL, + .ibufMode = 0UL, + .vtripSel = 0UL, + .vrefSel = 0UL, + .vohSel = 0UL, +}; +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t CYBSP_CINA_obj = { + .type = CYHAL_RSC_GPIO, + .block_num = CYBSP_CINA_PORT_NUM, + .channel_num = CYBSP_CINA_PIN, +}; +#endif // defined (CY_USING_HAL) +const cy_stc_gpio_pin_config_t CYBSP_CINB_config = { + .outVal = 1, + .driveMode = CY_GPIO_DM_ANALOG, + .hsiom = CYBSP_CINB_HSIOM, + .intEdge = CY_GPIO_INTR_DISABLE, + .intMask = 0UL, + .vtrip = CY_GPIO_VTRIP_CMOS, + .slewRate = CY_GPIO_SLEW_FAST, + .driveSel = CY_GPIO_DRIVE_1_2, + .vregEn = 0UL, + .ibufMode = 0UL, + .vtripSel = 0UL, + .vrefSel = 0UL, + .vohSel = 0UL, +}; +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t CYBSP_CINB_obj = { + .type = CYHAL_RSC_GPIO, + .block_num = CYBSP_CINB_PORT_NUM, + .channel_num = CYBSP_CINB_PIN, +}; +#endif // defined (CY_USING_HAL) +const cy_stc_gpio_pin_config_t CYBSP_CMOD_config = { + .outVal = 1, + .driveMode = CY_GPIO_DM_ANALOG, + .hsiom = CYBSP_CMOD_HSIOM, + .intEdge = CY_GPIO_INTR_DISABLE, + .intMask = 0UL, + .vtrip = CY_GPIO_VTRIP_CMOS, + .slewRate = CY_GPIO_SLEW_FAST, + .driveSel = CY_GPIO_DRIVE_1_2, + .vregEn = 0UL, + .ibufMode = 0UL, + .vtripSel = 0UL, + .vrefSel = 0UL, + .vohSel = 0UL, +}; +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t CYBSP_CMOD_obj = { + .type = CYHAL_RSC_GPIO, + .block_num = CYBSP_CMOD_PORT_NUM, + .channel_num = CYBSP_CMOD_PIN, +}; +#endif // defined (CY_USING_HAL) +const cy_stc_gpio_pin_config_t CYBSP_CSD_BTN0_config = { + .outVal = 1, + .driveMode = CY_GPIO_DM_ANALOG, + .hsiom = CYBSP_CSD_BTN0_HSIOM, + .intEdge = CY_GPIO_INTR_DISABLE, + .intMask = 0UL, + .vtrip = CY_GPIO_VTRIP_CMOS, + .slewRate = CY_GPIO_SLEW_FAST, + .driveSel = CY_GPIO_DRIVE_1_2, + .vregEn = 0UL, + .ibufMode = 0UL, + .vtripSel = 0UL, + .vrefSel = 0UL, + .vohSel = 0UL, +}; +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t CYBSP_CSD_BTN0_obj = { + .type = CYHAL_RSC_GPIO, + .block_num = CYBSP_CSD_BTN0_PORT_NUM, + .channel_num = CYBSP_CSD_BTN0_PIN, +}; +#endif // defined (CY_USING_HAL) +const cy_stc_gpio_pin_config_t CYBSP_CSD_BTN1_config = { + .outVal = 1, + .driveMode = CY_GPIO_DM_ANALOG, + .hsiom = CYBSP_CSD_BTN1_HSIOM, + .intEdge = CY_GPIO_INTR_DISABLE, + .intMask = 0UL, + .vtrip = CY_GPIO_VTRIP_CMOS, + .slewRate = CY_GPIO_SLEW_FAST, + .driveSel = CY_GPIO_DRIVE_1_2, + .vregEn = 0UL, + .ibufMode = 0UL, + .vtripSel = 0UL, + .vrefSel = 0UL, + .vohSel = 0UL, +}; +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t CYBSP_CSD_BTN1_obj = { + .type = CYHAL_RSC_GPIO, + .block_num = CYBSP_CSD_BTN1_PORT_NUM, + .channel_num = CYBSP_CSD_BTN1_PIN, +}; +#endif // defined (CY_USING_HAL) +const cy_stc_gpio_pin_config_t CYBSP_CSD_SLD0_config = { + .outVal = 1, + .driveMode = CY_GPIO_DM_ANALOG, + .hsiom = CYBSP_CSD_SLD0_HSIOM, + .intEdge = CY_GPIO_INTR_DISABLE, + .intMask = 0UL, + .vtrip = CY_GPIO_VTRIP_CMOS, + .slewRate = CY_GPIO_SLEW_FAST, + .driveSel = CY_GPIO_DRIVE_1_2, + .vregEn = 0UL, + .ibufMode = 0UL, + .vtripSel = 0UL, + .vrefSel = 0UL, + .vohSel = 0UL, +}; +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t CYBSP_CSD_SLD0_obj = { + .type = CYHAL_RSC_GPIO, + .block_num = CYBSP_CSD_SLD0_PORT_NUM, + .channel_num = CYBSP_CSD_SLD0_PIN, +}; +#endif // defined (CY_USING_HAL) +const cy_stc_gpio_pin_config_t CYBSP_CSD_SLD1_config = { + .outVal = 1, + .driveMode = CY_GPIO_DM_ANALOG, + .hsiom = CYBSP_CSD_SLD1_HSIOM, + .intEdge = CY_GPIO_INTR_DISABLE, + .intMask = 0UL, + .vtrip = CY_GPIO_VTRIP_CMOS, + .slewRate = CY_GPIO_SLEW_FAST, + .driveSel = CY_GPIO_DRIVE_1_2, + .vregEn = 0UL, + .ibufMode = 0UL, + .vtripSel = 0UL, + .vrefSel = 0UL, + .vohSel = 0UL, +}; +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t CYBSP_CSD_SLD1_obj = { + .type = CYHAL_RSC_GPIO, + .block_num = CYBSP_CSD_SLD1_PORT_NUM, + .channel_num = CYBSP_CSD_SLD1_PIN, +}; +#endif // defined (CY_USING_HAL) +const cy_stc_gpio_pin_config_t CYBSP_CSD_SLD2_config = { + .outVal = 1, + .driveMode = CY_GPIO_DM_ANALOG, + .hsiom = CYBSP_CSD_SLD2_HSIOM, + .intEdge = CY_GPIO_INTR_DISABLE, + .intMask = 0UL, + .vtrip = CY_GPIO_VTRIP_CMOS, + .slewRate = CY_GPIO_SLEW_FAST, + .driveSel = CY_GPIO_DRIVE_1_2, + .vregEn = 0UL, + .ibufMode = 0UL, + .vtripSel = 0UL, + .vrefSel = 0UL, + .vohSel = 0UL, +}; +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t CYBSP_CSD_SLD2_obj = { + .type = CYHAL_RSC_GPIO, + .block_num = CYBSP_CSD_SLD2_PORT_NUM, + .channel_num = CYBSP_CSD_SLD2_PIN, +}; +#endif // defined (CY_USING_HAL) +const cy_stc_gpio_pin_config_t CYBSP_CSD_SLD3_config = { + .outVal = 1, + .driveMode = CY_GPIO_DM_ANALOG, + .hsiom = CYBSP_CSD_SLD3_HSIOM, + .intEdge = CY_GPIO_INTR_DISABLE, + .intMask = 0UL, + .vtrip = CY_GPIO_VTRIP_CMOS, + .slewRate = CY_GPIO_SLEW_FAST, + .driveSel = CY_GPIO_DRIVE_1_2, + .vregEn = 0UL, + .ibufMode = 0UL, + .vtripSel = 0UL, + .vrefSel = 0UL, + .vohSel = 0UL, +}; +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t CYBSP_CSD_SLD3_obj = { + .type = CYHAL_RSC_GPIO, + .block_num = CYBSP_CSD_SLD3_PORT_NUM, + .channel_num = CYBSP_CSD_SLD3_PIN, +}; +#endif // defined (CY_USING_HAL) +const cy_stc_gpio_pin_config_t CYBSP_CSD_SLD4_config = { + .outVal = 1, + .driveMode = CY_GPIO_DM_ANALOG, + .hsiom = CYBSP_CSD_SLD4_HSIOM, + .intEdge = CY_GPIO_INTR_DISABLE, + .intMask = 0UL, + .vtrip = CY_GPIO_VTRIP_CMOS, + .slewRate = CY_GPIO_SLEW_FAST, + .driveSel = CY_GPIO_DRIVE_1_2, + .vregEn = 0UL, + .ibufMode = 0UL, + .vtripSel = 0UL, + .vrefSel = 0UL, + .vohSel = 0UL, +}; +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t CYBSP_CSD_SLD4_obj = { + .type = CYHAL_RSC_GPIO, + .block_num = CYBSP_CSD_SLD4_PORT_NUM, + .channel_num = CYBSP_CSD_SLD4_PIN, +}; +#endif // defined (CY_USING_HAL) + +void init_cycfg_pins(void) +{ + Cy_GPIO_Pin_Init(CYBSP_SWO_PORT, CYBSP_SWO_PIN, &CYBSP_SWO_config); + Cy_GPIO_Pin_Init(CYBSP_SWDIO_PORT, CYBSP_SWDIO_PIN, &CYBSP_SWDIO_config); + Cy_GPIO_Pin_Init(CYBSP_SWDCK_PORT, CYBSP_SWDCK_PIN, &CYBSP_SWDCK_config); +} + +void reserve_cycfg_pins(void) +{ +#if defined(CY_USING_HAL) + cyhal_hwmgr_reserve(&CYBSP_WCO_IN_obj); + cyhal_hwmgr_reserve(&CYBSP_WCO_OUT_obj); + cyhal_hwmgr_reserve(&CYBSP_CSD_RX_obj); + cyhal_hwmgr_reserve(&CYBSP_SWO_obj); + cyhal_hwmgr_reserve(&CYBSP_SWDIO_obj); + cyhal_hwmgr_reserve(&CYBSP_SWDCK_obj); + cyhal_hwmgr_reserve(&CYBSP_CINA_obj); + cyhal_hwmgr_reserve(&CYBSP_CINB_obj); + cyhal_hwmgr_reserve(&CYBSP_CMOD_obj); + cyhal_hwmgr_reserve(&CYBSP_CSD_BTN0_obj); + cyhal_hwmgr_reserve(&CYBSP_CSD_BTN1_obj); + cyhal_hwmgr_reserve(&CYBSP_CSD_SLD0_obj); + cyhal_hwmgr_reserve(&CYBSP_CSD_SLD1_obj); + cyhal_hwmgr_reserve(&CYBSP_CSD_SLD2_obj); + cyhal_hwmgr_reserve(&CYBSP_CSD_SLD3_obj); + cyhal_hwmgr_reserve(&CYBSP_CSD_SLD4_obj); +#endif // defined (CY_USING_HAL) +} diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_pins.h b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_pins.h new file mode 100644 index 00000000000000..6614740f3e5646 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_pins.h @@ -0,0 +1,674 @@ +/******************************************************************************* + * File Name: cycfg_pins.h + * + * Description: + * Pin configuration + * This file was automatically generated and should not be modified. + * Configurator Backend 3.10.0 + * device-db 4.100.0.4304 + * mtb-pdl-cat1 3.9.0.29592 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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(CYCFG_PINS_H) +#define CYCFG_PINS_H + +#include "cy_gpio.h" +#include "cycfg_notices.h" +#include "cycfg_routing.h" +#if defined(CY_USING_HAL) +#include "cyhal_hwmgr.h" +#endif // defined (CY_USING_HAL) + +#if defined(__cplusplus) +extern "C" { +#endif + +#define CYBSP_WCO_IN_ENABLED 1U +#define CYBSP_WCO_IN_PORT GPIO_PRT0 +#define CYBSP_WCO_IN_PORT_NUM 0U +#define CYBSP_WCO_IN_PIN 0U +#define CYBSP_WCO_IN_NUM 0U +#define CYBSP_WCO_IN_DRIVEMODE CY_GPIO_DM_ANALOG +#define CYBSP_WCO_IN_INIT_DRIVESTATE 1 +#ifndef ioss_0_port_0_pin_0_HSIOM +#define ioss_0_port_0_pin_0_HSIOM HSIOM_SEL_GPIO +#endif +#define CYBSP_WCO_IN_HSIOM ioss_0_port_0_pin_0_HSIOM +#define CYBSP_WCO_IN_IRQ ioss_interrupts_gpio_0_IRQn +#if defined(CY_USING_HAL) +#define CYBSP_WCO_IN_HAL_PORT_PIN P0_0 +#define CYBSP_WCO_IN P0_0 +#define CYBSP_WCO_IN_HAL_IRQ CYHAL_GPIO_IRQ_NONE +#define CYBSP_WCO_IN_HAL_DIR CYHAL_GPIO_DIR_INPUT +#define CYBSP_WCO_IN_HAL_DRIVEMODE CYHAL_GPIO_DRIVE_ANALOG +#endif // defined (CY_USING_HAL) +#define CYBSP_WCO_OUT_ENABLED 1U +#define CYBSP_WCO_OUT_PORT GPIO_PRT0 +#define CYBSP_WCO_OUT_PORT_NUM 0U +#define CYBSP_WCO_OUT_PIN 1U +#define CYBSP_WCO_OUT_NUM 1U +#define CYBSP_WCO_OUT_DRIVEMODE CY_GPIO_DM_ANALOG +#define CYBSP_WCO_OUT_INIT_DRIVESTATE 1 +#ifndef ioss_0_port_0_pin_1_HSIOM +#define ioss_0_port_0_pin_1_HSIOM HSIOM_SEL_GPIO +#endif +#define CYBSP_WCO_OUT_HSIOM ioss_0_port_0_pin_1_HSIOM +#define CYBSP_WCO_OUT_IRQ ioss_interrupts_gpio_0_IRQn +#if defined(CY_USING_HAL) +#define CYBSP_WCO_OUT_HAL_PORT_PIN P0_1 +#define CYBSP_WCO_OUT P0_1 +#define CYBSP_WCO_OUT_HAL_IRQ CYHAL_GPIO_IRQ_NONE +#define CYBSP_WCO_OUT_HAL_DIR CYHAL_GPIO_DIR_INPUT +#define CYBSP_WCO_OUT_HAL_DRIVEMODE CYHAL_GPIO_DRIVE_ANALOG +#define CYBSP_SW2 (P0_4) +#define CYBSP_USER_BTN1 CYBSP_SW2 +#define CYBSP_USER_BTN CYBSP_SW2 +#define CYBSP_LED_RGB_GREEN (P0_5) +#define CYBSP_USER_LED4 CYBSP_LED_RGB_GREEN +#define CYBSP_A0 (P10_0) +#define CYBSP_J2_1 CYBSP_A0 +#define CYBSP_A1 (P10_1) +#define CYBSP_J2_3 CYBSP_A1 +#define CYBSP_A2 (P10_2) +#define CYBSP_J2_5 CYBSP_A2 +#define CYBSP_A3 (P10_3) +#define CYBSP_J2_7 CYBSP_A3 +#define CYBSP_A4 (P10_4) +#define CYBSP_J2_9 CYBSP_A4 +#define CYBSP_A5 (P10_5) +#define CYBSP_J2_11 CYBSP_A5 +#define CYBSP_A6 (P10_6) +#define CYBSP_J2_13 CYBSP_A6 +#define CYBSP_POT CYBSP_A6 +#define CYBSP_A7 (P10_7) +#define CYBSP_J2_15 CYBSP_A7 +#define CYBSP_QSPI_FRAM_SSEL (P11_0) +#define CYBSP_LED9 (P11_1) +#define CYBSP_USER_LED2 CYBSP_LED9 +#define CYBSP_QSPI_SS (P11_2) +#define CYBSP_QSPI_FLASH_SSEL CYBSP_QSPI_SS +#define CYBSP_QSPI_D3 (P11_3) +#define CYBSP_QSPI_D2 (P11_4) +#define CYBSP_QSPI_D1 (P11_5) +#define CYBSP_QSPI_D0 (P11_6) +#define CYBSP_QSPI_SCK (P11_7) +#define CYBSP_SPI_MOSI (P12_0) +#define CYBSP_D11 CYBSP_SPI_MOSI +#define CYBSP_SPI_MISO (P12_1) +#define CYBSP_D12 CYBSP_SPI_MISO +#define CYBSP_SPI_CLK (P12_2) +#define CYBSP_D13 CYBSP_SPI_CLK +#define CYBSP_SPI_CS (P12_3) +#define CYBSP_D10 CYBSP_SPI_CS +#define CYBSP_SDHC_CMD (P12_4) +#define CYBSP_SDHC_CLK (P12_5) +#define CYBSP_SDHC_IO0 (P13_0) +#define CYBSP_SDHC_IO1 (P13_1) +#define CYBSP_SDHC_IO2 (P13_2) +#define CYBSP_SDHC_IO3 (P13_3) +#define CYBSP_SDHC_DETECT (P13_7) +#endif // defined (CY_USING_HAL) +#define CYBSP_CSD_RX_ENABLED 1U +#define CYBSP_CS_RX_ENABLED CYBSP_CSD_RX_ENABLED +#define CYBSP_CS_TX_RX_ENABLED CYBSP_CSD_RX_ENABLED +#define CYBSP_CSD_RX_PORT GPIO_PRT1 +#define CYBSP_CS_RX_PORT CYBSP_CSD_RX_PORT +#define CYBSP_CS_TX_RX_PORT CYBSP_CSD_RX_PORT +#define CYBSP_CSD_RX_PORT_NUM 1U +#define CYBSP_CS_RX_PORT_NUM CYBSP_CSD_RX_PORT_NUM +#define CYBSP_CS_TX_RX_PORT_NUM CYBSP_CSD_RX_PORT_NUM +#define CYBSP_CSD_RX_PIN 0U +#define CYBSP_CS_RX_PIN CYBSP_CSD_RX_PIN +#define CYBSP_CS_TX_RX_PIN CYBSP_CSD_RX_PIN +#define CYBSP_CSD_RX_NUM 0U +#define CYBSP_CS_RX_NUM CYBSP_CSD_RX_NUM +#define CYBSP_CS_TX_RX_NUM CYBSP_CSD_RX_NUM +#define CYBSP_CSD_RX_DRIVEMODE CY_GPIO_DM_ANALOG +#define CYBSP_CS_RX_DRIVEMODE CYBSP_CSD_RX_DRIVEMODE +#define CYBSP_CS_TX_RX_DRIVEMODE CYBSP_CSD_RX_DRIVEMODE +#define CYBSP_CSD_RX_INIT_DRIVESTATE 1 +#define CYBSP_CS_RX_INIT_DRIVESTATE CYBSP_CSD_RX_INIT_DRIVESTATE +#define CYBSP_CS_TX_RX_INIT_DRIVESTATE CYBSP_CSD_RX_INIT_DRIVESTATE +#ifndef ioss_0_port_1_pin_0_HSIOM +#define ioss_0_port_1_pin_0_HSIOM HSIOM_SEL_GPIO +#endif +#define CYBSP_CSD_RX_HSIOM ioss_0_port_1_pin_0_HSIOM +#define CYBSP_CS_RX_HSIOM CYBSP_CSD_RX_HSIOM +#define CYBSP_CS_TX_RX_HSIOM CYBSP_CSD_RX_HSIOM +#define CYBSP_CSD_RX_IRQ ioss_interrupts_gpio_1_IRQn +#define CYBSP_CS_RX_IRQ CYBSP_CSD_RX_IRQ +#define CYBSP_CS_TX_RX_IRQ CYBSP_CSD_RX_IRQ +#if defined(CY_USING_HAL) +#define CYBSP_CSD_RX_HAL_PORT_PIN P1_0 +#define CYBSP_CS_RX_HAL_PORT_PIN CYBSP_CSD_RX_HAL_PORT_PIN +#define CYBSP_CS_TX_RX_HAL_PORT_PIN CYBSP_CSD_RX_HAL_PORT_PIN +#define CYBSP_CSD_RX P1_0 +#define CYBSP_CS_RX CYBSP_CSD_RX +#define CYBSP_CS_TX_RX CYBSP_CSD_RX +#define CYBSP_CSD_RX_HAL_IRQ CYHAL_GPIO_IRQ_NONE +#define CYBSP_CS_RX_HAL_IRQ CYBSP_CSD_RX_HAL_IRQ +#define CYBSP_CS_TX_RX_HAL_IRQ CYBSP_CSD_RX_HAL_IRQ +#define CYBSP_CSD_RX_HAL_DIR CYHAL_GPIO_DIR_INPUT +#define CYBSP_CS_RX_HAL_DIR CYBSP_CSD_RX_HAL_DIR +#define CYBSP_CS_TX_RX_HAL_DIR CYBSP_CSD_RX_HAL_DIR +#define CYBSP_CSD_RX_HAL_DRIVEMODE CYHAL_GPIO_DRIVE_ANALOG +#define CYBSP_CS_RX_HAL_DRIVEMODE CYBSP_CSD_RX_HAL_DRIVEMODE +#define CYBSP_CS_TX_RX_HAL_DRIVEMODE CYBSP_CSD_RX_HAL_DRIVEMODE +#define CYBSP_LED_RGB_RED (P1_1) +#define CYBSP_USER_LED3 CYBSP_LED_RGB_RED +#define CYBSP_SW4 (P1_4) +#define CYBSP_USER_BTN2 CYBSP_SW4 +#define CYBSP_LED8 (P1_5) +#define CYBSP_USER_LED1 CYBSP_LED8 +#define CYBSP_USER_LED CYBSP_LED8 +#define CYBSP_WIFI_SDIO_D0 (P2_0) +#define CYBSP_WIFI_SDIO_D1 (P2_1) +#define CYBSP_WIFI_SDIO_D2 (P2_2) +#define CYBSP_WIFI_SDIO_D3 (P2_3) +#define CYBSP_WIFI_SDIO_CMD (P2_4) +#define CYBSP_WIFI_SDIO_CLK (P2_5) +#define CYBSP_WIFI_WL_REG_ON (P2_6) +#define CYBSP_BT_UART_RX (P3_0) +#define CYBSP_BT_UART_TX (P3_1) +#define CYBSP_BT_UART_RTS (P3_2) +#define CYBSP_BT_UART_CTS (P3_3) +#define CYBSP_BT_POWER (P3_4) +#define CYBSP_BT_DEVICE_WAKE (P3_5) +#define CYBSP_BT_HOST_WAKE (P4_0) +#define CYBSP_WIFI_HOST_WAKE (P4_1) +#define CYBSP_DEBUG_UART_RX (P5_0) +#define CYBSP_D0 CYBSP_DEBUG_UART_RX +#define CYBSP_DEBUG_UART_TX (P5_1) +#define CYBSP_D1 CYBSP_DEBUG_UART_TX +#define CYBSP_DEBUG_UART_RTS (P5_2) +#define CYBSP_D2 CYBSP_DEBUG_UART_RTS +#define CYBSP_DEBUG_UART_CTS (P5_3) +#define CYBSP_D3 CYBSP_DEBUG_UART_CTS +#define CYBSP_D4 (P5_4) +#define CYBSP_D5 (P5_5) +#define CYBSP_D6 (P5_6) +#define CYBSP_D7 (P5_7) +#define CYBSP_I2C_SCL (P6_0) +#define CYBSP_D15 CYBSP_I2C_SCL +#define CYBSP_I2C_SDA (P6_1) +#define CYBSP_D14 CYBSP_I2C_SDA +#endif // defined (CY_USING_HAL) +#define CYBSP_SWO_ENABLED 1U +#define CYBSP_SWO_PORT GPIO_PRT6 +#define CYBSP_SWO_PORT_NUM 6U +#define CYBSP_SWO_PIN 4U +#define CYBSP_SWO_NUM 4U +#define CYBSP_SWO_DRIVEMODE CY_GPIO_DM_STRONG_IN_OFF +#define CYBSP_SWO_INIT_DRIVESTATE 1 +#ifndef ioss_0_port_6_pin_4_HSIOM +#define ioss_0_port_6_pin_4_HSIOM HSIOM_SEL_GPIO +#endif +#define CYBSP_SWO_HSIOM ioss_0_port_6_pin_4_HSIOM +#define CYBSP_SWO_IRQ ioss_interrupts_gpio_6_IRQn +#if defined(CY_USING_HAL) +#define CYBSP_SWO_HAL_PORT_PIN P6_4 +#define CYBSP_SWO P6_4 +#define CYBSP_SWO_HAL_IRQ CYHAL_GPIO_IRQ_NONE +#define CYBSP_SWO_HAL_DIR CYHAL_GPIO_DIR_OUTPUT +#define CYBSP_SWO_HAL_DRIVEMODE CYHAL_GPIO_DRIVE_STRONG +#endif // defined (CY_USING_HAL) +#define CYBSP_SWDIO_ENABLED 1U +#define CYBSP_SWDIO_PORT GPIO_PRT6 +#define CYBSP_SWDIO_PORT_NUM 6U +#define CYBSP_SWDIO_PIN 6U +#define CYBSP_SWDIO_NUM 6U +#define CYBSP_SWDIO_DRIVEMODE CY_GPIO_DM_PULLUP +#define CYBSP_SWDIO_INIT_DRIVESTATE 1 +#ifndef ioss_0_port_6_pin_6_HSIOM +#define ioss_0_port_6_pin_6_HSIOM HSIOM_SEL_GPIO +#endif +#define CYBSP_SWDIO_HSIOM ioss_0_port_6_pin_6_HSIOM +#define CYBSP_SWDIO_IRQ ioss_interrupts_gpio_6_IRQn +#if defined(CY_USING_HAL) +#define CYBSP_SWDIO_HAL_PORT_PIN P6_6 +#define CYBSP_SWDIO P6_6 +#define CYBSP_SWDIO_HAL_IRQ CYHAL_GPIO_IRQ_NONE +#define CYBSP_SWDIO_HAL_DIR CYHAL_GPIO_DIR_BIDIRECTIONAL +#define CYBSP_SWDIO_HAL_DRIVEMODE CYHAL_GPIO_DRIVE_PULLUP +#endif // defined (CY_USING_HAL) +#define CYBSP_SWDCK_ENABLED 1U +#define CYBSP_SWDCK_PORT GPIO_PRT6 +#define CYBSP_SWDCK_PORT_NUM 6U +#define CYBSP_SWDCK_PIN 7U +#define CYBSP_SWDCK_NUM 7U +#define CYBSP_SWDCK_DRIVEMODE CY_GPIO_DM_PULLDOWN +#define CYBSP_SWDCK_INIT_DRIVESTATE 1 +#ifndef ioss_0_port_6_pin_7_HSIOM +#define ioss_0_port_6_pin_7_HSIOM HSIOM_SEL_GPIO +#endif +#define CYBSP_SWDCK_HSIOM ioss_0_port_6_pin_7_HSIOM +#define CYBSP_SWDCK_IRQ ioss_interrupts_gpio_6_IRQn +#if defined(CY_USING_HAL) +#define CYBSP_SWDCK_HAL_PORT_PIN P6_7 +#define CYBSP_SWDCK P6_7 +#define CYBSP_SWDCK_HAL_IRQ CYHAL_GPIO_IRQ_NONE +#define CYBSP_SWDCK_HAL_DIR CYHAL_GPIO_DIR_BIDIRECTIONAL +#define CYBSP_SWDCK_HAL_DRIVEMODE CYHAL_GPIO_DRIVE_PULLDOWN +#define CYBSP_TRACE_CLK (P7_0) +#endif // defined (CY_USING_HAL) +#define CYBSP_CINA_ENABLED 1U +#define CYBSP_CINA_PORT GPIO_PRT7 +#define CYBSP_CINA_PORT_NUM 7U +#define CYBSP_CINA_PIN 1U +#define CYBSP_CINA_NUM 1U +#define CYBSP_CINA_DRIVEMODE CY_GPIO_DM_ANALOG +#define CYBSP_CINA_INIT_DRIVESTATE 1 +#ifndef ioss_0_port_7_pin_1_HSIOM +#define ioss_0_port_7_pin_1_HSIOM HSIOM_SEL_GPIO +#endif +#define CYBSP_CINA_HSIOM ioss_0_port_7_pin_1_HSIOM +#define CYBSP_CINA_IRQ ioss_interrupts_gpio_7_IRQn +#if defined(CY_USING_HAL) +#define CYBSP_CINA_HAL_PORT_PIN P7_1 +#define CYBSP_CINA P7_1 +#define CYBSP_CINA_HAL_IRQ CYHAL_GPIO_IRQ_NONE +#define CYBSP_CINA_HAL_DIR CYHAL_GPIO_DIR_INPUT +#define CYBSP_CINA_HAL_DRIVEMODE CYHAL_GPIO_DRIVE_ANALOG +#endif // defined (CY_USING_HAL) +#define CYBSP_CINB_ENABLED 1U +#define CYBSP_CINB_PORT GPIO_PRT7 +#define CYBSP_CINB_PORT_NUM 7U +#define CYBSP_CINB_PIN 2U +#define CYBSP_CINB_NUM 2U +#define CYBSP_CINB_DRIVEMODE CY_GPIO_DM_ANALOG +#define CYBSP_CINB_INIT_DRIVESTATE 1 +#ifndef ioss_0_port_7_pin_2_HSIOM +#define ioss_0_port_7_pin_2_HSIOM HSIOM_SEL_GPIO +#endif +#define CYBSP_CINB_HSIOM ioss_0_port_7_pin_2_HSIOM +#define CYBSP_CINB_IRQ ioss_interrupts_gpio_7_IRQn +#if defined(CY_USING_HAL) +#define CYBSP_CINB_HAL_PORT_PIN P7_2 +#define CYBSP_CINB P7_2 +#define CYBSP_CINB_HAL_IRQ CYHAL_GPIO_IRQ_NONE +#define CYBSP_CINB_HAL_DIR CYHAL_GPIO_DIR_INPUT +#define CYBSP_CINB_HAL_DRIVEMODE CYHAL_GPIO_DRIVE_ANALOG +#define CYBSP_LED_RGB_BLUE (P7_3) +#define CYBSP_USER_LED5 CYBSP_LED_RGB_BLUE +#define CYBSP_TRACE_DATA3 (P7_4) +#define CYBSP_D8 (P7_5) +#define CYBSP_TRACE_DATA2 CYBSP_D8 +#define CYBSP_D9 (P7_6) +#define CYBSP_TRACE_DATA1 CYBSP_D9 +#endif // defined (CY_USING_HAL) +#define CYBSP_CMOD_ENABLED 1U +#define CYBSP_CMOD_PORT GPIO_PRT7 +#define CYBSP_CMOD_PORT_NUM 7U +#define CYBSP_CMOD_PIN 7U +#define CYBSP_CMOD_NUM 7U +#define CYBSP_CMOD_DRIVEMODE CY_GPIO_DM_ANALOG +#define CYBSP_CMOD_INIT_DRIVESTATE 1 +#ifndef ioss_0_port_7_pin_7_HSIOM +#define ioss_0_port_7_pin_7_HSIOM HSIOM_SEL_GPIO +#endif +#define CYBSP_CMOD_HSIOM ioss_0_port_7_pin_7_HSIOM +#define CYBSP_CMOD_IRQ ioss_interrupts_gpio_7_IRQn +#if defined(CY_USING_HAL) +#define CYBSP_CMOD_HAL_PORT_PIN P7_7 +#define CYBSP_CMOD P7_7 +#define CYBSP_CMOD_HAL_IRQ CYHAL_GPIO_IRQ_NONE +#define CYBSP_CMOD_HAL_DIR CYHAL_GPIO_DIR_INPUT +#define CYBSP_CMOD_HAL_DRIVEMODE CYHAL_GPIO_DRIVE_ANALOG +#endif // defined (CY_USING_HAL) +#define CYBSP_CSD_BTN0_ENABLED 1U +#define CYBSP_CS_BTN0_ENABLED CYBSP_CSD_BTN0_ENABLED +#define CYBSP_CSD_BTN0_PORT GPIO_PRT8 +#define CYBSP_CS_BTN0_PORT CYBSP_CSD_BTN0_PORT +#define CYBSP_CSD_BTN0_PORT_NUM 8U +#define CYBSP_CS_BTN0_PORT_NUM CYBSP_CSD_BTN0_PORT_NUM +#define CYBSP_CSD_BTN0_PIN 1U +#define CYBSP_CS_BTN0_PIN CYBSP_CSD_BTN0_PIN +#define CYBSP_CSD_BTN0_NUM 1U +#define CYBSP_CS_BTN0_NUM CYBSP_CSD_BTN0_NUM +#define CYBSP_CSD_BTN0_DRIVEMODE CY_GPIO_DM_ANALOG +#define CYBSP_CS_BTN0_DRIVEMODE CYBSP_CSD_BTN0_DRIVEMODE +#define CYBSP_CSD_BTN0_INIT_DRIVESTATE 1 +#define CYBSP_CS_BTN0_INIT_DRIVESTATE CYBSP_CSD_BTN0_INIT_DRIVESTATE +#ifndef ioss_0_port_8_pin_1_HSIOM +#define ioss_0_port_8_pin_1_HSIOM HSIOM_SEL_GPIO +#endif +#define CYBSP_CSD_BTN0_HSIOM ioss_0_port_8_pin_1_HSIOM +#define CYBSP_CS_BTN0_HSIOM CYBSP_CSD_BTN0_HSIOM +#define CYBSP_CSD_BTN0_IRQ ioss_interrupts_gpio_8_IRQn +#define CYBSP_CS_BTN0_IRQ CYBSP_CSD_BTN0_IRQ +#if defined(CY_USING_HAL) +#define CYBSP_CSD_BTN0_HAL_PORT_PIN P8_1 +#define CYBSP_CS_BTN0_HAL_PORT_PIN CYBSP_CSD_BTN0_HAL_PORT_PIN +#define CYBSP_CSD_BTN0 P8_1 +#define CYBSP_CS_BTN0 CYBSP_CSD_BTN0 +#define CYBSP_CSD_BTN0_HAL_IRQ CYHAL_GPIO_IRQ_NONE +#define CYBSP_CS_BTN0_HAL_IRQ CYBSP_CSD_BTN0_HAL_IRQ +#define CYBSP_CSD_BTN0_HAL_DIR CYHAL_GPIO_DIR_INPUT +#define CYBSP_CS_BTN0_HAL_DIR CYBSP_CSD_BTN0_HAL_DIR +#define CYBSP_CSD_BTN0_HAL_DRIVEMODE CYHAL_GPIO_DRIVE_ANALOG +#define CYBSP_CS_BTN0_HAL_DRIVEMODE CYBSP_CSD_BTN0_HAL_DRIVEMODE +#endif // defined (CY_USING_HAL) +#define CYBSP_CSD_BTN1_ENABLED 1U +#define CYBSP_CS_BTN1_ENABLED CYBSP_CSD_BTN1_ENABLED +#define CYBSP_CSD_BTN1_PORT GPIO_PRT8 +#define CYBSP_CS_BTN1_PORT CYBSP_CSD_BTN1_PORT +#define CYBSP_CSD_BTN1_PORT_NUM 8U +#define CYBSP_CS_BTN1_PORT_NUM CYBSP_CSD_BTN1_PORT_NUM +#define CYBSP_CSD_BTN1_PIN 2U +#define CYBSP_CS_BTN1_PIN CYBSP_CSD_BTN1_PIN +#define CYBSP_CSD_BTN1_NUM 2U +#define CYBSP_CS_BTN1_NUM CYBSP_CSD_BTN1_NUM +#define CYBSP_CSD_BTN1_DRIVEMODE CY_GPIO_DM_ANALOG +#define CYBSP_CS_BTN1_DRIVEMODE CYBSP_CSD_BTN1_DRIVEMODE +#define CYBSP_CSD_BTN1_INIT_DRIVESTATE 1 +#define CYBSP_CS_BTN1_INIT_DRIVESTATE CYBSP_CSD_BTN1_INIT_DRIVESTATE +#ifndef ioss_0_port_8_pin_2_HSIOM +#define ioss_0_port_8_pin_2_HSIOM HSIOM_SEL_GPIO +#endif +#define CYBSP_CSD_BTN1_HSIOM ioss_0_port_8_pin_2_HSIOM +#define CYBSP_CS_BTN1_HSIOM CYBSP_CSD_BTN1_HSIOM +#define CYBSP_CSD_BTN1_IRQ ioss_interrupts_gpio_8_IRQn +#define CYBSP_CS_BTN1_IRQ CYBSP_CSD_BTN1_IRQ +#if defined(CY_USING_HAL) +#define CYBSP_CSD_BTN1_HAL_PORT_PIN P8_2 +#define CYBSP_CS_BTN1_HAL_PORT_PIN CYBSP_CSD_BTN1_HAL_PORT_PIN +#define CYBSP_CSD_BTN1 P8_2 +#define CYBSP_CS_BTN1 CYBSP_CSD_BTN1 +#define CYBSP_CSD_BTN1_HAL_IRQ CYHAL_GPIO_IRQ_NONE +#define CYBSP_CS_BTN1_HAL_IRQ CYBSP_CSD_BTN1_HAL_IRQ +#define CYBSP_CSD_BTN1_HAL_DIR CYHAL_GPIO_DIR_INPUT +#define CYBSP_CS_BTN1_HAL_DIR CYBSP_CSD_BTN1_HAL_DIR +#define CYBSP_CSD_BTN1_HAL_DRIVEMODE CYHAL_GPIO_DRIVE_ANALOG +#define CYBSP_CS_BTN1_HAL_DRIVEMODE CYBSP_CSD_BTN1_HAL_DRIVEMODE +#endif // defined (CY_USING_HAL) +#define CYBSP_CSD_SLD0_ENABLED 1U +#define CYBSP_CS_SLD0_ENABLED CYBSP_CSD_SLD0_ENABLED +#define CYBSP_CSD_SLD0_PORT GPIO_PRT8 +#define CYBSP_CS_SLD0_PORT CYBSP_CSD_SLD0_PORT +#define CYBSP_CSD_SLD0_PORT_NUM 8U +#define CYBSP_CS_SLD0_PORT_NUM CYBSP_CSD_SLD0_PORT_NUM +#define CYBSP_CSD_SLD0_PIN 3U +#define CYBSP_CS_SLD0_PIN CYBSP_CSD_SLD0_PIN +#define CYBSP_CSD_SLD0_NUM 3U +#define CYBSP_CS_SLD0_NUM CYBSP_CSD_SLD0_NUM +#define CYBSP_CSD_SLD0_DRIVEMODE CY_GPIO_DM_ANALOG +#define CYBSP_CS_SLD0_DRIVEMODE CYBSP_CSD_SLD0_DRIVEMODE +#define CYBSP_CSD_SLD0_INIT_DRIVESTATE 1 +#define CYBSP_CS_SLD0_INIT_DRIVESTATE CYBSP_CSD_SLD0_INIT_DRIVESTATE +#ifndef ioss_0_port_8_pin_3_HSIOM +#define ioss_0_port_8_pin_3_HSIOM HSIOM_SEL_GPIO +#endif +#define CYBSP_CSD_SLD0_HSIOM ioss_0_port_8_pin_3_HSIOM +#define CYBSP_CS_SLD0_HSIOM CYBSP_CSD_SLD0_HSIOM +#define CYBSP_CSD_SLD0_IRQ ioss_interrupts_gpio_8_IRQn +#define CYBSP_CS_SLD0_IRQ CYBSP_CSD_SLD0_IRQ +#if defined(CY_USING_HAL) +#define CYBSP_CSD_SLD0_HAL_PORT_PIN P8_3 +#define CYBSP_CS_SLD0_HAL_PORT_PIN CYBSP_CSD_SLD0_HAL_PORT_PIN +#define CYBSP_CSD_SLD0 P8_3 +#define CYBSP_CS_SLD0 CYBSP_CSD_SLD0 +#define CYBSP_CSD_SLD0_HAL_IRQ CYHAL_GPIO_IRQ_NONE +#define CYBSP_CS_SLD0_HAL_IRQ CYBSP_CSD_SLD0_HAL_IRQ +#define CYBSP_CSD_SLD0_HAL_DIR CYHAL_GPIO_DIR_INPUT +#define CYBSP_CS_SLD0_HAL_DIR CYBSP_CSD_SLD0_HAL_DIR +#define CYBSP_CSD_SLD0_HAL_DRIVEMODE CYHAL_GPIO_DRIVE_ANALOG +#define CYBSP_CS_SLD0_HAL_DRIVEMODE CYBSP_CSD_SLD0_HAL_DRIVEMODE +#endif // defined (CY_USING_HAL) +#define CYBSP_CSD_SLD1_ENABLED 1U +#define CYBSP_CS_SLD1_ENABLED CYBSP_CSD_SLD1_ENABLED +#define CYBSP_CSD_SLD1_PORT GPIO_PRT8 +#define CYBSP_CS_SLD1_PORT CYBSP_CSD_SLD1_PORT +#define CYBSP_CSD_SLD1_PORT_NUM 8U +#define CYBSP_CS_SLD1_PORT_NUM CYBSP_CSD_SLD1_PORT_NUM +#define CYBSP_CSD_SLD1_PIN 4U +#define CYBSP_CS_SLD1_PIN CYBSP_CSD_SLD1_PIN +#define CYBSP_CSD_SLD1_NUM 4U +#define CYBSP_CS_SLD1_NUM CYBSP_CSD_SLD1_NUM +#define CYBSP_CSD_SLD1_DRIVEMODE CY_GPIO_DM_ANALOG +#define CYBSP_CS_SLD1_DRIVEMODE CYBSP_CSD_SLD1_DRIVEMODE +#define CYBSP_CSD_SLD1_INIT_DRIVESTATE 1 +#define CYBSP_CS_SLD1_INIT_DRIVESTATE CYBSP_CSD_SLD1_INIT_DRIVESTATE +#ifndef ioss_0_port_8_pin_4_HSIOM +#define ioss_0_port_8_pin_4_HSIOM HSIOM_SEL_GPIO +#endif +#define CYBSP_CSD_SLD1_HSIOM ioss_0_port_8_pin_4_HSIOM +#define CYBSP_CS_SLD1_HSIOM CYBSP_CSD_SLD1_HSIOM +#define CYBSP_CSD_SLD1_IRQ ioss_interrupts_gpio_8_IRQn +#define CYBSP_CS_SLD1_IRQ CYBSP_CSD_SLD1_IRQ +#if defined(CY_USING_HAL) +#define CYBSP_CSD_SLD1_HAL_PORT_PIN P8_4 +#define CYBSP_CS_SLD1_HAL_PORT_PIN CYBSP_CSD_SLD1_HAL_PORT_PIN +#define CYBSP_CSD_SLD1 P8_4 +#define CYBSP_CS_SLD1 CYBSP_CSD_SLD1 +#define CYBSP_CSD_SLD1_HAL_IRQ CYHAL_GPIO_IRQ_NONE +#define CYBSP_CS_SLD1_HAL_IRQ CYBSP_CSD_SLD1_HAL_IRQ +#define CYBSP_CSD_SLD1_HAL_DIR CYHAL_GPIO_DIR_INPUT +#define CYBSP_CS_SLD1_HAL_DIR CYBSP_CSD_SLD1_HAL_DIR +#define CYBSP_CSD_SLD1_HAL_DRIVEMODE CYHAL_GPIO_DRIVE_ANALOG +#define CYBSP_CS_SLD1_HAL_DRIVEMODE CYBSP_CSD_SLD1_HAL_DRIVEMODE +#endif // defined (CY_USING_HAL) +#define CYBSP_CSD_SLD2_ENABLED 1U +#define CYBSP_CS_SLD2_ENABLED CYBSP_CSD_SLD2_ENABLED +#define CYBSP_CSD_SLD2_PORT GPIO_PRT8 +#define CYBSP_CS_SLD2_PORT CYBSP_CSD_SLD2_PORT +#define CYBSP_CSD_SLD2_PORT_NUM 8U +#define CYBSP_CS_SLD2_PORT_NUM CYBSP_CSD_SLD2_PORT_NUM +#define CYBSP_CSD_SLD2_PIN 5U +#define CYBSP_CS_SLD2_PIN CYBSP_CSD_SLD2_PIN +#define CYBSP_CSD_SLD2_NUM 5U +#define CYBSP_CS_SLD2_NUM CYBSP_CSD_SLD2_NUM +#define CYBSP_CSD_SLD2_DRIVEMODE CY_GPIO_DM_ANALOG +#define CYBSP_CS_SLD2_DRIVEMODE CYBSP_CSD_SLD2_DRIVEMODE +#define CYBSP_CSD_SLD2_INIT_DRIVESTATE 1 +#define CYBSP_CS_SLD2_INIT_DRIVESTATE CYBSP_CSD_SLD2_INIT_DRIVESTATE +#ifndef ioss_0_port_8_pin_5_HSIOM +#define ioss_0_port_8_pin_5_HSIOM HSIOM_SEL_GPIO +#endif +#define CYBSP_CSD_SLD2_HSIOM ioss_0_port_8_pin_5_HSIOM +#define CYBSP_CS_SLD2_HSIOM CYBSP_CSD_SLD2_HSIOM +#define CYBSP_CSD_SLD2_IRQ ioss_interrupts_gpio_8_IRQn +#define CYBSP_CS_SLD2_IRQ CYBSP_CSD_SLD2_IRQ +#if defined(CY_USING_HAL) +#define CYBSP_CSD_SLD2_HAL_PORT_PIN P8_5 +#define CYBSP_CS_SLD2_HAL_PORT_PIN CYBSP_CSD_SLD2_HAL_PORT_PIN +#define CYBSP_CSD_SLD2 P8_5 +#define CYBSP_CS_SLD2 CYBSP_CSD_SLD2 +#define CYBSP_CSD_SLD2_HAL_IRQ CYHAL_GPIO_IRQ_NONE +#define CYBSP_CS_SLD2_HAL_IRQ CYBSP_CSD_SLD2_HAL_IRQ +#define CYBSP_CSD_SLD2_HAL_DIR CYHAL_GPIO_DIR_INPUT +#define CYBSP_CS_SLD2_HAL_DIR CYBSP_CSD_SLD2_HAL_DIR +#define CYBSP_CSD_SLD2_HAL_DRIVEMODE CYHAL_GPIO_DRIVE_ANALOG +#define CYBSP_CS_SLD2_HAL_DRIVEMODE CYBSP_CSD_SLD2_HAL_DRIVEMODE +#endif // defined (CY_USING_HAL) +#define CYBSP_CSD_SLD3_ENABLED 1U +#define CYBSP_CS_SLD3_ENABLED CYBSP_CSD_SLD3_ENABLED +#define CYBSP_CSD_SLD3_PORT GPIO_PRT8 +#define CYBSP_CS_SLD3_PORT CYBSP_CSD_SLD3_PORT +#define CYBSP_CSD_SLD3_PORT_NUM 8U +#define CYBSP_CS_SLD3_PORT_NUM CYBSP_CSD_SLD3_PORT_NUM +#define CYBSP_CSD_SLD3_PIN 6U +#define CYBSP_CS_SLD3_PIN CYBSP_CSD_SLD3_PIN +#define CYBSP_CSD_SLD3_NUM 6U +#define CYBSP_CS_SLD3_NUM CYBSP_CSD_SLD3_NUM +#define CYBSP_CSD_SLD3_DRIVEMODE CY_GPIO_DM_ANALOG +#define CYBSP_CS_SLD3_DRIVEMODE CYBSP_CSD_SLD3_DRIVEMODE +#define CYBSP_CSD_SLD3_INIT_DRIVESTATE 1 +#define CYBSP_CS_SLD3_INIT_DRIVESTATE CYBSP_CSD_SLD3_INIT_DRIVESTATE +#ifndef ioss_0_port_8_pin_6_HSIOM +#define ioss_0_port_8_pin_6_HSIOM HSIOM_SEL_GPIO +#endif +#define CYBSP_CSD_SLD3_HSIOM ioss_0_port_8_pin_6_HSIOM +#define CYBSP_CS_SLD3_HSIOM CYBSP_CSD_SLD3_HSIOM +#define CYBSP_CSD_SLD3_IRQ ioss_interrupts_gpio_8_IRQn +#define CYBSP_CS_SLD3_IRQ CYBSP_CSD_SLD3_IRQ +#if defined(CY_USING_HAL) +#define CYBSP_CSD_SLD3_HAL_PORT_PIN P8_6 +#define CYBSP_CS_SLD3_HAL_PORT_PIN CYBSP_CSD_SLD3_HAL_PORT_PIN +#define CYBSP_CSD_SLD3 P8_6 +#define CYBSP_CS_SLD3 CYBSP_CSD_SLD3 +#define CYBSP_CSD_SLD3_HAL_IRQ CYHAL_GPIO_IRQ_NONE +#define CYBSP_CS_SLD3_HAL_IRQ CYBSP_CSD_SLD3_HAL_IRQ +#define CYBSP_CSD_SLD3_HAL_DIR CYHAL_GPIO_DIR_INPUT +#define CYBSP_CS_SLD3_HAL_DIR CYBSP_CSD_SLD3_HAL_DIR +#define CYBSP_CSD_SLD3_HAL_DRIVEMODE CYHAL_GPIO_DRIVE_ANALOG +#define CYBSP_CS_SLD3_HAL_DRIVEMODE CYBSP_CSD_SLD3_HAL_DRIVEMODE +#endif // defined (CY_USING_HAL) +#define CYBSP_CSD_SLD4_ENABLED 1U +#define CYBSP_CS_SLD4_ENABLED CYBSP_CSD_SLD4_ENABLED +#define CYBSP_CSD_SLD4_PORT GPIO_PRT8 +#define CYBSP_CS_SLD4_PORT CYBSP_CSD_SLD4_PORT +#define CYBSP_CSD_SLD4_PORT_NUM 8U +#define CYBSP_CS_SLD4_PORT_NUM CYBSP_CSD_SLD4_PORT_NUM +#define CYBSP_CSD_SLD4_PIN 7U +#define CYBSP_CS_SLD4_PIN CYBSP_CSD_SLD4_PIN +#define CYBSP_CSD_SLD4_NUM 7U +#define CYBSP_CS_SLD4_NUM CYBSP_CSD_SLD4_NUM +#define CYBSP_CSD_SLD4_DRIVEMODE CY_GPIO_DM_ANALOG +#define CYBSP_CS_SLD4_DRIVEMODE CYBSP_CSD_SLD4_DRIVEMODE +#define CYBSP_CSD_SLD4_INIT_DRIVESTATE 1 +#define CYBSP_CS_SLD4_INIT_DRIVESTATE CYBSP_CSD_SLD4_INIT_DRIVESTATE +#ifndef ioss_0_port_8_pin_7_HSIOM +#define ioss_0_port_8_pin_7_HSIOM HSIOM_SEL_GPIO +#endif +#define CYBSP_CSD_SLD4_HSIOM ioss_0_port_8_pin_7_HSIOM +#define CYBSP_CS_SLD4_HSIOM CYBSP_CSD_SLD4_HSIOM +#define CYBSP_CSD_SLD4_IRQ ioss_interrupts_gpio_8_IRQn +#define CYBSP_CS_SLD4_IRQ CYBSP_CSD_SLD4_IRQ +#if defined(CY_USING_HAL) +#define CYBSP_CSD_SLD4_HAL_PORT_PIN P8_7 +#define CYBSP_CS_SLD4_HAL_PORT_PIN CYBSP_CSD_SLD4_HAL_PORT_PIN +#define CYBSP_CSD_SLD4 P8_7 +#define CYBSP_CS_SLD4 CYBSP_CSD_SLD4 +#define CYBSP_CSD_SLD4_HAL_IRQ CYHAL_GPIO_IRQ_NONE +#define CYBSP_CS_SLD4_HAL_IRQ CYBSP_CSD_SLD4_HAL_IRQ +#define CYBSP_CSD_SLD4_HAL_DIR CYHAL_GPIO_DIR_INPUT +#define CYBSP_CS_SLD4_HAL_DIR CYBSP_CSD_SLD4_HAL_DIR +#define CYBSP_CSD_SLD4_HAL_DRIVEMODE CYHAL_GPIO_DRIVE_ANALOG +#define CYBSP_CS_SLD4_HAL_DRIVEMODE CYBSP_CSD_SLD4_HAL_DRIVEMODE +#define CYBSP_A8 (P9_0) +#define CYBSP_J2_2 CYBSP_A8 +#define CYBSP_A9 (P9_1) +#define CYBSP_J2_4 CYBSP_A9 +#define CYBSP_A10 (P9_2) +#define CYBSP_J2_6 CYBSP_A10 +#define CYBSP_A11 (P9_3) +#define CYBSP_J2_8 CYBSP_A11 +#define CYBSP_TRACE_DATA0 CYBSP_A11 +#define CYBSP_A12 (P9_4) +#define CYBSP_J2_10 CYBSP_A12 +#define CYBSP_A13 (P9_5) +#define CYBSP_J2_12 CYBSP_A13 +#define CYBSP_A14 (P9_6) +#define CYBSP_J2_14 CYBSP_A14 +#define CYBSP_A15 (P9_7) +#define CYBSP_J2_16 CYBSP_A15 +#endif // defined (CY_USING_HAL) + +extern const cy_stc_gpio_pin_config_t CYBSP_WCO_IN_config; +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t CYBSP_WCO_IN_obj; +#endif // defined (CY_USING_HAL) +extern const cy_stc_gpio_pin_config_t CYBSP_WCO_OUT_config; +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t CYBSP_WCO_OUT_obj; +#endif // defined (CY_USING_HAL) +extern const cy_stc_gpio_pin_config_t CYBSP_CSD_RX_config; +#define CYBSP_CS_RX_config CYBSP_CSD_RX_config +#define CYBSP_CS_TX_RX_config CYBSP_CSD_RX_config +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t CYBSP_CSD_RX_obj; +#define CYBSP_CS_RX_obj CYBSP_CSD_RX_obj +#define CYBSP_CS_TX_RX_obj CYBSP_CSD_RX_obj +#endif // defined (CY_USING_HAL) +extern const cy_stc_gpio_pin_config_t CYBSP_SWO_config; +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t CYBSP_SWO_obj; +#endif // defined (CY_USING_HAL) +extern const cy_stc_gpio_pin_config_t CYBSP_SWDIO_config; +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t CYBSP_SWDIO_obj; +#endif // defined (CY_USING_HAL) +extern const cy_stc_gpio_pin_config_t CYBSP_SWDCK_config; +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t CYBSP_SWDCK_obj; +#endif // defined (CY_USING_HAL) +extern const cy_stc_gpio_pin_config_t CYBSP_CINA_config; +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t CYBSP_CINA_obj; +#endif // defined (CY_USING_HAL) +extern const cy_stc_gpio_pin_config_t CYBSP_CINB_config; +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t CYBSP_CINB_obj; +#endif // defined (CY_USING_HAL) +extern const cy_stc_gpio_pin_config_t CYBSP_CMOD_config; +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t CYBSP_CMOD_obj; +#endif // defined (CY_USING_HAL) +extern const cy_stc_gpio_pin_config_t CYBSP_CSD_BTN0_config; +#define CYBSP_CS_BTN0_config CYBSP_CSD_BTN0_config +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t CYBSP_CSD_BTN0_obj; +#define CYBSP_CS_BTN0_obj CYBSP_CSD_BTN0_obj +#endif // defined (CY_USING_HAL) +extern const cy_stc_gpio_pin_config_t CYBSP_CSD_BTN1_config; +#define CYBSP_CS_BTN1_config CYBSP_CSD_BTN1_config +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t CYBSP_CSD_BTN1_obj; +#define CYBSP_CS_BTN1_obj CYBSP_CSD_BTN1_obj +#endif // defined (CY_USING_HAL) +extern const cy_stc_gpio_pin_config_t CYBSP_CSD_SLD0_config; +#define CYBSP_CS_SLD0_config CYBSP_CSD_SLD0_config +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t CYBSP_CSD_SLD0_obj; +#define CYBSP_CS_SLD0_obj CYBSP_CSD_SLD0_obj +#endif // defined (CY_USING_HAL) +extern const cy_stc_gpio_pin_config_t CYBSP_CSD_SLD1_config; +#define CYBSP_CS_SLD1_config CYBSP_CSD_SLD1_config +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t CYBSP_CSD_SLD1_obj; +#define CYBSP_CS_SLD1_obj CYBSP_CSD_SLD1_obj +#endif // defined (CY_USING_HAL) +extern const cy_stc_gpio_pin_config_t CYBSP_CSD_SLD2_config; +#define CYBSP_CS_SLD2_config CYBSP_CSD_SLD2_config +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t CYBSP_CSD_SLD2_obj; +#define CYBSP_CS_SLD2_obj CYBSP_CSD_SLD2_obj +#endif // defined (CY_USING_HAL) +extern const cy_stc_gpio_pin_config_t CYBSP_CSD_SLD3_config; +#define CYBSP_CS_SLD3_config CYBSP_CSD_SLD3_config +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t CYBSP_CSD_SLD3_obj; +#define CYBSP_CS_SLD3_obj CYBSP_CSD_SLD3_obj +#endif // defined (CY_USING_HAL) +extern const cy_stc_gpio_pin_config_t CYBSP_CSD_SLD4_config; +#define CYBSP_CS_SLD4_config CYBSP_CSD_SLD4_config +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t CYBSP_CSD_SLD4_obj; +#define CYBSP_CS_SLD4_obj CYBSP_CSD_SLD4_obj +#endif // defined (CY_USING_HAL) + +void init_cycfg_pins(void); +void reserve_cycfg_pins(void); + +#if defined(__cplusplus) +} +#endif + +#endif /* CYCFG_PINS_H */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_qspi_memslot.c b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_qspi_memslot.c new file mode 100644 index 00000000000000..7f954aca038238 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_qspi_memslot.c @@ -0,0 +1,472 @@ +/******************************************************************************* + * File Name: cycfg_qspi_memslot.c + * + * Description: + * Provides definitions of the SMIF-driver memory configuration. + * This file was automatically generated and should not be modified. + * QSPI Configurator 4.10.0.1343 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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 "cycfg_qspi_memslot.h" + +const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_readCmd = { + /* The 8-bit command. 1 x I/O read command. */ + .command = 0xECU, + /* The width of the command transfer. */ + .cmdWidth = CY_SMIF_WIDTH_SINGLE, + /* The width of the address transfer. */ + .addrWidth = CY_SMIF_WIDTH_QUAD, + /* The 8-bit mode byte. This value is 0xFFFFFFFF when there is no mode present. */ + .mode = 0x01U, + /* The width of the mode command transfer. */ + .modeWidth = CY_SMIF_WIDTH_QUAD, + /* The number of dummy cycles. A zero value suggests no dummy cycles. */ + .dummyCycles = 4U, + /* The width of the data transfer. */ + .dataWidth = CY_SMIF_WIDTH_QUAD, +#if (CY_IP_MXSMIF_VERSION >= 2) + /* The Data rate of data */ + .dataRate = CY_SMIF_SDR, + /* This specifies the presence of the dummy field */ + .dummyCyclesPresence = CY_SMIF_PRESENT_1BYTE, + /* This specifies the presence of the mode field */ + .modePresence = CY_SMIF_PRESENT_1BYTE, + /* The high byte of a 16-bit mode. This value is 0x0 when there is no higher byte mode present */ + .modeH = 0x00, + /* The Data rate of mode */ + .modeRate = CY_SMIF_SDR, + /* The Data rate of address */ + .addrRate = CY_SMIF_SDR, + /* This specifies the width of the command field */ + .cmdPresence = CY_SMIF_PRESENT_1BYTE, + /* The high byte of a 16-bit command. This value is 0x0 when there is no higher byte command present */ + .commandH = 0x00, + /* The Data rate of command */ + .cmdRate = CY_SMIF_SDR, +#endif /* CY_IP_MXSMIF_VERSION */ +}; + +const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_writeEnCmd = { + /* The 8-bit command. 1 x I/O read command. */ + .command = 0x06U, + /* The width of the command transfer. */ + .cmdWidth = CY_SMIF_WIDTH_SINGLE, + /* The width of the address transfer. */ + .addrWidth = CY_SMIF_WIDTH_SINGLE, + /* The 8-bit mode byte. This value is 0xFFFFFFFF when there is no mode present. */ + .mode = 0xFFFFFFFFU, + /* The width of the mode command transfer. */ + .modeWidth = CY_SMIF_WIDTH_SINGLE, + /* The number of dummy cycles. A zero value suggests no dummy cycles. */ + .dummyCycles = 0U, + /* The width of the data transfer. */ + .dataWidth = CY_SMIF_WIDTH_SINGLE, +#if (CY_IP_MXSMIF_VERSION >= 2) + /* The Data rate of data */ + .dataRate = CY_SMIF_SDR, + /* This specifies the presence of the dummy field */ + .dummyCyclesPresence = CY_SMIF_NOT_PRESENT, + /* This specifies the presence of the mode field */ + .modePresence = CY_SMIF_NOT_PRESENT, + /* The high byte of a 16-bit mode. This value is 0x0 when there is no higher byte mode present */ + .modeH = 0x00, + /* The Data rate of mode */ + .modeRate = CY_SMIF_SDR, + /* The Data rate of address */ + .addrRate = CY_SMIF_SDR, + /* This specifies the width of the command field */ + .cmdPresence = CY_SMIF_PRESENT_1BYTE, + /* The high byte of a 16-bit command. This value is 0x0 when there is no higher byte command present */ + .commandH = 0x00, + /* The Data rate of command */ + .cmdRate = CY_SMIF_SDR, +#endif /* CY_IP_MXSMIF_VERSION */ +}; + +const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_writeDisCmd = { + /* The 8-bit command. 1 x I/O read command. */ + .command = 0x04U, + /* The width of the command transfer. */ + .cmdWidth = CY_SMIF_WIDTH_SINGLE, + /* The width of the address transfer. */ + .addrWidth = CY_SMIF_WIDTH_SINGLE, + /* The 8-bit mode byte. This value is 0xFFFFFFFF when there is no mode present. */ + .mode = 0xFFFFFFFFU, + /* The width of the mode command transfer. */ + .modeWidth = CY_SMIF_WIDTH_SINGLE, + /* The number of dummy cycles. A zero value suggests no dummy cycles. */ + .dummyCycles = 0U, + /* The width of the data transfer. */ + .dataWidth = CY_SMIF_WIDTH_SINGLE, +#if (CY_IP_MXSMIF_VERSION >= 2) + /* The Data rate of data */ + .dataRate = CY_SMIF_SDR, + /* This specifies the presence of the dummy field */ + .dummyCyclesPresence = CY_SMIF_NOT_PRESENT, + /* This specifies the presence of the mode field */ + .modePresence = CY_SMIF_NOT_PRESENT, + /* The high byte of a 16-bit mode. This value is 0x0 when there is no higher byte mode present */ + .modeH = 0x00, + /* The Data rate of mode */ + .modeRate = CY_SMIF_SDR, + /* The Data rate of address */ + .addrRate = CY_SMIF_SDR, + /* This specifies the width of the command field */ + .cmdPresence = CY_SMIF_PRESENT_1BYTE, + /* The high byte of a 16-bit command. This value is 0x0 when there is no higher byte command present */ + .commandH = 0x00, + /* The Data rate of command */ + .cmdRate = CY_SMIF_SDR, +#endif /* CY_IP_MXSMIF_VERSION */ +}; + +const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_eraseCmd = { + /* The 8-bit command. 1 x I/O read command. */ + .command = 0xDCU, + /* The width of the command transfer. */ + .cmdWidth = CY_SMIF_WIDTH_SINGLE, + /* The width of the address transfer. */ + .addrWidth = CY_SMIF_WIDTH_SINGLE, + /* The 8-bit mode byte. This value is 0xFFFFFFFF when there is no mode present. */ + .mode = 0xFFFFFFFFU, + /* The width of the mode command transfer. */ + .modeWidth = CY_SMIF_WIDTH_SINGLE, + /* The number of dummy cycles. A zero value suggests no dummy cycles. */ + .dummyCycles = 0U, + /* The width of the data transfer. */ + .dataWidth = CY_SMIF_WIDTH_SINGLE, +#if (CY_IP_MXSMIF_VERSION >= 2) + /* The Data rate of data */ + .dataRate = CY_SMIF_SDR, + /* This specifies the presence of the dummy field */ + .dummyCyclesPresence = CY_SMIF_NOT_PRESENT, + /* This specifies the presence of the mode field */ + .modePresence = CY_SMIF_NOT_PRESENT, + /* The high byte of a 16-bit mode. This value is 0x0 when there is no higher byte mode present */ + .modeH = 0x00, + /* The Data rate of mode */ + .modeRate = CY_SMIF_SDR, + /* The Data rate of address */ + .addrRate = CY_SMIF_SDR, + /* This specifies the width of the command field */ + .cmdPresence = CY_SMIF_PRESENT_1BYTE, + /* The high byte of a 16-bit command. This value is 0x0 when there is no higher byte command present */ + .commandH = 0x00, + /* The Data rate of command */ + .cmdRate = CY_SMIF_SDR, +#endif /* CY_IP_MXSMIF_VERSION */ +}; + +const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_chipEraseCmd = { + /* The 8-bit command. 1 x I/O read command. */ + .command = 0x60U, + /* The width of the command transfer. */ + .cmdWidth = CY_SMIF_WIDTH_SINGLE, + /* The width of the address transfer. */ + .addrWidth = CY_SMIF_WIDTH_SINGLE, + /* The 8-bit mode byte. This value is 0xFFFFFFFF when there is no mode present. */ + .mode = 0xFFFFFFFFU, + /* The width of the mode command transfer. */ + .modeWidth = CY_SMIF_WIDTH_SINGLE, + /* The number of dummy cycles. A zero value suggests no dummy cycles. */ + .dummyCycles = 0U, + /* The width of the data transfer. */ + .dataWidth = CY_SMIF_WIDTH_SINGLE, +#if (CY_IP_MXSMIF_VERSION >= 2) + /* The Data rate of data */ + .dataRate = CY_SMIF_SDR, + /* This specifies the presence of the dummy field */ + .dummyCyclesPresence = CY_SMIF_NOT_PRESENT, + /* This specifies the presence of the mode field */ + .modePresence = CY_SMIF_NOT_PRESENT, + /* The high byte of a 16-bit mode. This value is 0x0 when there is no higher byte mode present */ + .modeH = 0x00, + /* The Data rate of mode */ + .modeRate = CY_SMIF_SDR, + /* The Data rate of address */ + .addrRate = CY_SMIF_SDR, + /* This specifies the width of the command field */ + .cmdPresence = CY_SMIF_PRESENT_1BYTE, + /* The high byte of a 16-bit command. This value is 0x0 when there is no higher byte command present */ + .commandH = 0x00, + /* The Data rate of command */ + .cmdRate = CY_SMIF_SDR, +#endif /* CY_IP_MXSMIF_VERSION */ +}; + +const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_programCmd = { + /* The 8-bit command. 1 x I/O read command. */ + .command = 0x34U, + /* The width of the command transfer. */ + .cmdWidth = CY_SMIF_WIDTH_SINGLE, + /* The width of the address transfer. */ + .addrWidth = CY_SMIF_WIDTH_SINGLE, + /* The 8-bit mode byte. This value is 0xFFFFFFFF when there is no mode present. */ + .mode = 0xFFFFFFFFU, + /* The width of the mode command transfer. */ + .modeWidth = CY_SMIF_WIDTH_QUAD, + /* The number of dummy cycles. A zero value suggests no dummy cycles. */ + .dummyCycles = 0U, + /* The width of the data transfer. */ + .dataWidth = CY_SMIF_WIDTH_QUAD, +#if (CY_IP_MXSMIF_VERSION >= 2) + /* The Data rate of data */ + .dataRate = CY_SMIF_SDR, + /* This specifies the presence of the dummy field */ + .dummyCyclesPresence = CY_SMIF_NOT_PRESENT, + /* This specifies the presence of the mode field */ + .modePresence = CY_SMIF_NOT_PRESENT, + /* The high byte of a 16-bit mode. This value is 0x0 when there is no higher byte mode present */ + .modeH = 0x00, + /* The Data rate of mode */ + .modeRate = CY_SMIF_SDR, + /* The Data rate of address */ + .addrRate = CY_SMIF_SDR, + /* This specifies the width of the command field */ + .cmdPresence = CY_SMIF_PRESENT_1BYTE, + /* The high byte of a 16-bit command. This value is 0x0 when there is no higher byte command present */ + .commandH = 0x00, + /* The Data rate of command */ + .cmdRate = CY_SMIF_SDR, +#endif /* CY_IP_MXSMIF_VERSION */ +}; + +const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_readStsRegQeCmd = { + /* The 8-bit command. 1 x I/O read command. */ + .command = 0x35U, + /* The width of the command transfer. */ + .cmdWidth = CY_SMIF_WIDTH_SINGLE, + /* The width of the address transfer. */ + .addrWidth = CY_SMIF_WIDTH_SINGLE, + /* The 8-bit mode byte. This value is 0xFFFFFFFF when there is no mode present. */ + .mode = 0xFFFFFFFFU, + /* The width of the mode command transfer. */ + .modeWidth = CY_SMIF_WIDTH_SINGLE, + /* The number of dummy cycles. A zero value suggests no dummy cycles. */ + .dummyCycles = 0U, + /* The width of the data transfer. */ + .dataWidth = CY_SMIF_WIDTH_SINGLE, +#if (CY_IP_MXSMIF_VERSION >= 2) + /* The Data rate of data */ + .dataRate = CY_SMIF_SDR, + /* This specifies the presence of the dummy field */ + .dummyCyclesPresence = CY_SMIF_NOT_PRESENT, + /* This specifies the presence of the mode field */ + .modePresence = CY_SMIF_NOT_PRESENT, + /* The high byte of a 16-bit mode. This value is 0x0 when there is no higher byte mode present */ + .modeH = 0x00, + /* The Data rate of mode */ + .modeRate = CY_SMIF_SDR, + /* The Data rate of address */ + .addrRate = CY_SMIF_SDR, + /* This specifies the width of the command field */ + .cmdPresence = CY_SMIF_PRESENT_1BYTE, + /* The high byte of a 16-bit command. This value is 0x0 when there is no higher byte command present */ + .commandH = 0x00, + /* The Data rate of command */ + .cmdRate = CY_SMIF_SDR, +#endif /* CY_IP_MXSMIF_VERSION */ +}; + +const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_readStsRegWipCmd = { + /* The 8-bit command. 1 x I/O read command. */ + .command = 0x05U, + /* The width of the command transfer. */ + .cmdWidth = CY_SMIF_WIDTH_SINGLE, + /* The width of the address transfer. */ + .addrWidth = CY_SMIF_WIDTH_SINGLE, + /* The 8-bit mode byte. This value is 0xFFFFFFFF when there is no mode present. */ + .mode = 0xFFFFFFFFU, + /* The width of the mode command transfer. */ + .modeWidth = CY_SMIF_WIDTH_SINGLE, + /* The number of dummy cycles. A zero value suggests no dummy cycles. */ + .dummyCycles = 0U, + /* The width of the data transfer. */ + .dataWidth = CY_SMIF_WIDTH_SINGLE, +#if (CY_IP_MXSMIF_VERSION >= 2) + /* The Data rate of data */ + .dataRate = CY_SMIF_SDR, + /* This specifies the presence of the dummy field */ + .dummyCyclesPresence = CY_SMIF_NOT_PRESENT, + /* This specifies the presence of the mode field */ + .modePresence = CY_SMIF_NOT_PRESENT, + /* The high byte of a 16-bit mode. This value is 0x0 when there is no higher byte mode present */ + .modeH = 0x00, + /* The Data rate of mode */ + .modeRate = CY_SMIF_SDR, + /* The Data rate of address */ + .addrRate = CY_SMIF_SDR, + /* This specifies the width of the command field */ + .cmdPresence = CY_SMIF_PRESENT_1BYTE, + /* The high byte of a 16-bit command. This value is 0x0 when there is no higher byte command present */ + .commandH = 0x00, + /* The Data rate of command */ + .cmdRate = CY_SMIF_SDR, +#endif /* CY_IP_MXSMIF_VERSION */ +}; + +const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_writeStsRegQeCmd = { + /* The 8-bit command. 1 x I/O read command. */ + .command = 0x01U, + /* The width of the command transfer. */ + .cmdWidth = CY_SMIF_WIDTH_SINGLE, + /* The width of the address transfer. */ + .addrWidth = CY_SMIF_WIDTH_SINGLE, + /* The 8-bit mode byte. This value is 0xFFFFFFFF when there is no mode present. */ + .mode = 0xFFFFFFFFU, + /* The width of the mode command transfer. */ + .modeWidth = CY_SMIF_WIDTH_SINGLE, + /* The number of dummy cycles. A zero value suggests no dummy cycles. */ + .dummyCycles = 0U, + /* The width of the data transfer. */ + .dataWidth = CY_SMIF_WIDTH_SINGLE, +#if (CY_IP_MXSMIF_VERSION >= 2) + /* The Data rate of data */ + .dataRate = CY_SMIF_SDR, + /* This specifies the presence of the dummy field */ + .dummyCyclesPresence = CY_SMIF_NOT_PRESENT, + /* This specifies the presence of the mode field */ + .modePresence = CY_SMIF_NOT_PRESENT, + /* The high byte of a 16-bit mode. This value is 0x0 when there is no higher byte mode present */ + .modeH = 0x00, + /* The Data rate of mode */ + .modeRate = CY_SMIF_SDR, + /* The Data rate of address */ + .addrRate = CY_SMIF_SDR, + /* This specifies the width of the command field */ + .cmdPresence = CY_SMIF_PRESENT_1BYTE, + /* The high byte of a 16-bit command. This value is 0x0 when there is no higher byte command present */ + .commandH = 0x00, + /* The Data rate of command */ + .cmdRate = CY_SMIF_SDR, +#endif /* CY_IP_MXSMIF_VERSION */ +}; + +const cy_stc_smif_mem_device_cfg_t deviceCfg_S25FL512S_SlaveSlot_0 = { + /* Specifies the number of address bytes used by the memory slave device. */ + .numOfAddrBytes = 0x04U, + /* The size of the memory. */ + .memSize = 0x04000000U, + /* Specifies the Read command. */ + .readCmd = (cy_stc_smif_mem_cmd_t *) &S25FL512S_SlaveSlot_0_readCmd, + /* Specifies the Write Enable command. */ + .writeEnCmd = (cy_stc_smif_mem_cmd_t *) &S25FL512S_SlaveSlot_0_writeEnCmd, + /* Specifies the Write Disable command. */ + .writeDisCmd = (cy_stc_smif_mem_cmd_t *) &S25FL512S_SlaveSlot_0_writeDisCmd, + /* Specifies the Erase command. */ + .eraseCmd = (cy_stc_smif_mem_cmd_t *) &S25FL512S_SlaveSlot_0_eraseCmd, + /* Specifies the sector size of each erase. */ + .eraseSize = 0x00040000U, + /* Specifies the Chip Erase command. */ + .chipEraseCmd = (cy_stc_smif_mem_cmd_t *) &S25FL512S_SlaveSlot_0_chipEraseCmd, + /* Specifies the Program command. */ + .programCmd = (cy_stc_smif_mem_cmd_t *) &S25FL512S_SlaveSlot_0_programCmd, + /* Specifies the page size for programming. */ + .programSize = 0x00000200U, + /* Specifies the command to read the QE-containing status register. */ + .readStsRegQeCmd = (cy_stc_smif_mem_cmd_t *) &S25FL512S_SlaveSlot_0_readStsRegQeCmd, + /* Specifies the command to read the WIP-containing status register. */ + .readStsRegWipCmd = (cy_stc_smif_mem_cmd_t *) &S25FL512S_SlaveSlot_0_readStsRegWipCmd, + /* Specifies the command to write into the QE-containing status register. */ + .writeStsRegQeCmd = (cy_stc_smif_mem_cmd_t *) &S25FL512S_SlaveSlot_0_writeStsRegQeCmd, + /* The mask for the status register. */ + .stsRegBusyMask = 0x01U, + /* The mask for the status register. */ + .stsRegQuadEnableMask = 0x02U, + /* The max time for the erase type-1 cycle-time in ms. */ + .eraseTime = 2600U, + /* The max time for the chip-erase cycle-time in ms. */ + .chipEraseTime = 460000U, + /* The max time for the page-program cycle-time in us. */ + .programTime = 1300U, +#if (CY_SMIF_DRV_VERSION_MAJOR > 1) || (CY_SMIF_DRV_VERSION_MINOR >= 50) + /* Points to NULL or to structure with info about sectors for hybrid memory. */ + .hybridRegionCount = 0U, + .hybridRegionInfo = 0, +#endif + /* Specifies the command to read variable latency cycles configuration register */ + .readLatencyCmd = 0, + /* Specifies the command to write variable latency cycles configuration register */ + .writeLatencyCmd = 0, + /* Specifies the address for variable latency cycle address */ + .latencyCyclesRegAddr = 0x00U, + /* Specifies variable latency cycles Mask */ + .latencyCyclesMask = 0x00U, +#if (CY_IP_MXSMIF_VERSION >= 2) + /* Specifies data for memory with hybrid sectors */ + .octalDDREnableSeq = 0, + /* Specifies the command to read the OE-containing status register. */ + .readStsRegOeCmd = 0, + /* Specifies the command to write the OE-containing status register. */ + .writeStsRegOeCmd = 0, + /* QE mask for the status registers */ + .stsRegOctalEnableMask = 0x00U, + /* Octal enable register address */ + .octalEnableRegAddr = 0x00U, + /* Frequency of operation used in Octal mode */ + .freq_of_operation = CY_SMIF_100MHZ_OPERATION, +#endif +}; + +const cy_stc_smif_mem_config_t S25FL512S_SlaveSlot_0 = { + /* Determines the slot number where the memory device is placed. */ + .slaveSelect = CY_SMIF_SLAVE_SELECT_0, +/* Flags. */ +#if (CY_IP_MXSMIF_VERSION >= 2) + .flags = CY_SMIF_FLAG_SMIF_REV_3 | CY_SMIF_FLAG_MEMORY_MAPPED | CY_SMIF_FLAG_WR_EN, +#else + .flags = CY_SMIF_FLAG_MEMORY_MAPPED | CY_SMIF_FLAG_WR_EN, +#endif /* CY_IP_MXSMIF_VERSION */ + /* The data-line selection options for a slave device. */ + .dataSelect = CY_SMIF_DATA_SEL0, + /* The base address the memory slave is mapped to in the PSoC memory map. + Valid when the memory-mapped mode is enabled. */ + .baseAddress = 0x18000000U, + /* The size allocated in the PSoC memory map, for the memory slave device. + The size is allocated from the base address. Valid when the memory mapped mode is enabled. */ + .memMappedSize = 0x4000000U, + /* If this memory device is one of the devices in the dual quad SPI configuration. + Valid when the memory mapped mode is enabled. */ + .dualQuadSlots = 0, + /* The configuration of the device. */ + .deviceCfg = (cy_stc_smif_mem_device_cfg_t *) &deviceCfg_S25FL512S_SlaveSlot_0, +#if (CY_IP_MXSMIF_VERSION >= 2) + /** Continous transfer merge timeout. + * After this period the memory device is deselected. A later transfer, even from a + * continuous address, starts with the overhead phases (command, address, mode, dummy cycles). + * This configuration parameter is available for CAT1B devices. */ + .mergeTimeout = CY_SMIF_MERGE_TIMEOUT_1_CYCLE, +#endif /* CY_IP_MXSMIF_VERSION */ +}; + +const cy_stc_smif_mem_config_t * const smifMemConfigs[CY_SMIF_DEVICE_NUM] = { + &S25FL512S_SlaveSlot_0, +}; + +const cy_stc_smif_block_config_t smifBlockConfig = { + /* The number of SMIF memories defined. */ + .memCount = CY_SMIF_DEVICE_NUM, + /* The pointer to the array of memory config structures of size memCount. */ + .memConfig = (cy_stc_smif_mem_config_t **) smifMemConfigs, + /* The version of the SMIF driver. */ + .majorVersion = CY_SMIF_DRV_VERSION_MAJOR, + /* The version of the SMIF driver. */ + .minorVersion = CY_SMIF_DRV_VERSION_MINOR, +}; diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_qspi_memslot.h b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_qspi_memslot.h new file mode 100644 index 00000000000000..48b280a91b4b7d --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_qspi_memslot.h @@ -0,0 +1,68 @@ +/******************************************************************************* + * File Name: cycfg_qspi_memslot.h + * + * Description: + * Provides declarations of the SMIF-driver memory configuration. + * This file was automatically generated and should not be modified. + * QSPI Configurator 4.10.0.1343 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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 CYCFG_QSPI_MEMSLOT_H +#define CYCFG_QSPI_MEMSLOT_H +#include "cy_smif_memslot.h" + +#define CY_SMIF_CFG_TOOL_VERSION (410) + +/* Supported QSPI Driver version */ +#define CY_SMIF_DRV_VERSION_REQUIRED (100) + +#if !defined(CY_SMIF_DRV_VERSION) +#define CY_SMIF_DRV_VERSION (100) +#endif + +/* Check the used Driver version */ +#if (CY_SMIF_DRV_VERSION_REQUIRED > CY_SMIF_DRV_VERSION) +#error The QSPI Configurator requires a newer version of the PDL. Update the PDL in your project. +#endif + +typedef cy_stc_smif_mem_config_t cy_serial_flash_mem_config_t; +typedef cy_stc_smif_block_config_t cy_serial_flash_block_config_t; + +#define CY_SMIF_DEVICE_NUM 1 + +extern const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_readCmd; +extern const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_writeEnCmd; +extern const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_writeDisCmd; +extern const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_eraseCmd; +extern const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_chipEraseCmd; +extern const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_programCmd; +extern const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_readStsRegQeCmd; +extern const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_readStsRegWipCmd; +extern const cy_stc_smif_mem_cmd_t S25FL512S_SlaveSlot_0_writeStsRegQeCmd; + +extern const cy_stc_smif_mem_device_cfg_t deviceCfg_S25FL512S_SlaveSlot_0; + +extern const cy_stc_smif_mem_config_t S25FL512S_SlaveSlot_0; + +extern const cy_stc_smif_mem_config_t * const smifMemConfigs[CY_SMIF_DEVICE_NUM]; + +extern const cy_stc_smif_block_config_t smifBlockConfig; + +#endif /*CYCFG_QSPI_MEMSLOT_H*/ diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_qspi_memslot.timestamp b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_qspi_memslot.timestamp new file mode 100644 index 00000000000000..b58d184ac8c9e0 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_qspi_memslot.timestamp @@ -0,0 +1,26 @@ +/******************************************************************************* +* File Name: cycfg_qspi_memslot.timestamp +* +* Description: +* Sentinel file for determining if generated source is up to date. +* This file was automatically generated and should not be modified. +* QSPI Configurator 4.10.0.1343 +* +******************************************************************************** +* Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or +* an affiliate of Cypress Semiconductor Corporation. +* SPDX-License-Identifier: Apache-2.0 +* +* 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. +********************************************************************************/ + diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_routing.c b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_routing.c new file mode 100644 index 00000000000000..b7f613092bdbe6 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_routing.c @@ -0,0 +1,40 @@ +/******************************************************************************* + * File Name: cycfg_routing.c + * + * Description: + * Establishes all necessary connections between hardware elements. + * This file was automatically generated and should not be modified. + * Configurator Backend 3.10.0 + * device-db 4.100.0.4304 + * mtb-pdl-cat1 3.9.0.29592 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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 "cycfg_routing.h" +#include "cy_device_headers.h" +#include "cy_trigmux.h" +#include "stdbool.h" + +void init_cycfg_routing(void) +{ + HSIOM->AMUX_SPLIT_CTL[2] = HSIOM_V2_AMUX_SPLIT_CTL_SWITCH_AA_SL_Msk | HSIOM_V2_AMUX_SPLIT_CTL_SWITCH_AA_SR_Msk | + HSIOM_V2_AMUX_SPLIT_CTL_SWITCH_BB_SL_Msk | HSIOM_V2_AMUX_SPLIT_CTL_SWITCH_BB_SR_Msk; + HSIOM->AMUX_SPLIT_CTL[4] = HSIOM_V2_AMUX_SPLIT_CTL_SWITCH_AA_SL_Msk | HSIOM_V2_AMUX_SPLIT_CTL_SWITCH_AA_SR_Msk | + HSIOM_V2_AMUX_SPLIT_CTL_SWITCH_BB_SL_Msk | HSIOM_V2_AMUX_SPLIT_CTL_SWITCH_BB_SR_Msk; +} diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_routing.h b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_routing.h new file mode 100644 index 00000000000000..f6bae4541ba221 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_routing.h @@ -0,0 +1,61 @@ +/******************************************************************************* + * File Name: cycfg_routing.h + * + * Description: + * Establishes all necessary connections between hardware elements. + * This file was automatically generated and should not be modified. + * Configurator Backend 3.10.0 + * device-db 4.100.0.4304 + * mtb-pdl-cat1 3.9.0.29592 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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(CYCFG_ROUTING_H) +#define CYCFG_ROUTING_H + +#if defined(__cplusplus) +extern "C" { +#endif + +#include "cycfg_notices.h" + +void init_cycfg_routing(void); + +#define ioss_0_port_0_pin_0_ANALOG P0_0_SRSS_WCO_IN +#define ioss_0_port_0_pin_1_ANALOG P0_1_SRSS_WCO_OUT +#define ioss_0_port_1_pin_0_HSIOM HSIOM_SEL_AMUXA +#define ioss_0_port_6_pin_4_HSIOM P6_4_CPUSS_SWJ_SWO_TDO +#define ioss_0_port_6_pin_6_HSIOM P6_6_CPUSS_SWJ_SWDIO_TMS +#define ioss_0_port_6_pin_7_HSIOM P6_7_CPUSS_SWJ_SWCLK_TCLK +#define ioss_0_port_7_pin_1_HSIOM HSIOM_SEL_AMUXA +#define ioss_0_port_7_pin_2_HSIOM HSIOM_SEL_AMUXA +#define ioss_0_port_7_pin_7_HSIOM HSIOM_SEL_AMUXA +#define ioss_0_port_8_pin_1_HSIOM HSIOM_SEL_AMUXA +#define ioss_0_port_8_pin_2_HSIOM HSIOM_SEL_AMUXA +#define ioss_0_port_8_pin_3_HSIOM HSIOM_SEL_AMUXA +#define ioss_0_port_8_pin_4_HSIOM HSIOM_SEL_AMUXA +#define ioss_0_port_8_pin_5_HSIOM HSIOM_SEL_AMUXA +#define ioss_0_port_8_pin_6_HSIOM HSIOM_SEL_AMUXA +#define ioss_0_port_8_pin_7_HSIOM HSIOM_SEL_AMUXA + +#if defined(__cplusplus) +} +#endif + +#endif /* CYCFG_ROUTING_H */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_system.c b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_system.c new file mode 100644 index 00000000000000..7c180a8e0812aa --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_system.c @@ -0,0 +1,1160 @@ +/******************************************************************************* + * File Name: cycfg_system.c + * + * Description: + * System configuration + * This file was automatically generated and should not be modified. + * Configurator Backend 3.10.0 + * device-db 4.100.0.4304 + * mtb-pdl-cat1 3.9.0.29592 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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 "cycfg_system.h" + +#define CY_CFG_SYSCLK_ECO_ERROR 1 +#define CY_CFG_SYSCLK_ALTHF_ERROR 2 +#define CY_CFG_SYSCLK_PLL_ERROR 3 +#define CY_CFG_SYSCLK_FLL_ERROR 4 +#define CY_CFG_SYSCLK_WCO_ERROR 5 +#define CY_CFG_SYSCLK_CLKALTSYSTICK_ENABLED 1 +#define CY_CFG_SYSCLK_CLKALTSYSTICK_SOURCE CY_SYSTICK_CLOCK_SOURCE_CLK_LF +#define CY_CFG_SYSCLK_CLKALTSYSTICK_INTERVAL 0 +#define CY_CFG_SYSCLK_CLKALTSYSTICK_FREQUENCY 32768 +#define CY_CFG_SYSCLK_CLKALTSYSTICK_TICKS ((0) / 1000000.0) * 32768 +#define CY_CFG_SYSCLK_CLKBAK_ENABLED 1 +#define CY_CFG_SYSCLK_CLKBAK_SOURCE CY_SYSCLK_BAK_IN_CLKLF +#define CY_CFG_SYSCLK_CLKFAST_ENABLED 1 +#define CY_CFG_SYSCLK_CLKFAST_DIVIDER 0 +#define CY_CFG_SYSCLK_FLL_ENABLED 1 +#define CY_CFG_SYSCLK_FLL_MULT 500U +#define CY_CFG_SYSCLK_FLL_REFDIV 20U +#define CY_CFG_SYSCLK_FLL_CCO_RANGE CY_SYSCLK_FLL_CCO_RANGE4 +#define CY_CFG_SYSCLK_FLL_ENABLE_OUTDIV true +#define CY_CFG_SYSCLK_FLL_LOCK_TOLERANCE 10U +#define CY_CFG_SYSCLK_FLL_IGAIN 9U +#define CY_CFG_SYSCLK_FLL_PGAIN 5U +#define CY_CFG_SYSCLK_FLL_SETTLING_COUNT 8U +#define CY_CFG_SYSCLK_FLL_OUTPUT_MODE CY_SYSCLK_FLLPLL_OUTPUT_OUTPUT +#define CY_CFG_SYSCLK_FLL_CCO_FREQ 355U +#define CY_CFG_SYSCLK_FLL_OUT_FREQ 100000000 +#define CY_CFG_SYSCLK_CLKHF0_ENABLED 1 +#define CY_CFG_SYSCLK_CLKHF0_DIVIDER CY_SYSCLK_CLKHF_NO_DIVIDE +#define CY_CFG_SYSCLK_CLKHF0_FREQ_MHZ 100UL +#define CY_CFG_SYSCLK_CLKHF0_CLKPATH CY_SYSCLK_CLKHF_IN_CLKPATH0 +#define CY_CFG_SYSCLK_ILO_ENABLED 1 +#define CY_CFG_SYSCLK_ILO_HIBERNATE true +#define CY_CFG_SYSCLK_IMO_ENABLED 1 +#define CY_CFG_SYSCLK_CLKLF_ENABLED 1 +#define CY_CFG_SYSCLK_CLKPATH0_ENABLED 1 +#define CY_CFG_SYSCLK_CLKPATH0_SOURCE CY_SYSCLK_CLKPATH_IN_IMO +#define CY_CFG_SYSCLK_CLKPATH0_SOURCE_NUM 0UL +#define CY_CFG_SYSCLK_CLKPATH1_ENABLED 1 +#define CY_CFG_SYSCLK_CLKPATH1_SOURCE CY_SYSCLK_CLKPATH_IN_IMO +#define CY_CFG_SYSCLK_CLKPATH1_SOURCE_NUM 0UL +#define CY_CFG_SYSCLK_CLKPATH2_ENABLED 1 +#define CY_CFG_SYSCLK_CLKPATH2_SOURCE CY_SYSCLK_CLKPATH_IN_IMO +#define CY_CFG_SYSCLK_CLKPATH2_SOURCE_NUM 0UL +#define CY_CFG_SYSCLK_CLKPATH3_ENABLED 1 +#define CY_CFG_SYSCLK_CLKPATH3_SOURCE CY_SYSCLK_CLKPATH_IN_IMO +#define CY_CFG_SYSCLK_CLKPATH3_SOURCE_NUM 0UL +#define CY_CFG_SYSCLK_CLKPATH4_ENABLED 1 +#define CY_CFG_SYSCLK_CLKPATH4_SOURCE CY_SYSCLK_CLKPATH_IN_IMO +#define CY_CFG_SYSCLK_CLKPATH4_SOURCE_NUM 0UL +#define CY_CFG_SYSCLK_CLKPATH5_ENABLED 1 +#define CY_CFG_SYSCLK_CLKPATH5_SOURCE CY_SYSCLK_CLKPATH_IN_IMO +#define CY_CFG_SYSCLK_CLKPATH5_SOURCE_NUM 0UL +#define CY_CFG_SYSCLK_CLKPERI_ENABLED 1 +#define CY_CFG_SYSCLK_CLKPERI_DIVIDER 0 +#define CY_CFG_SYSCLK_PLL0_ENABLED 1 +#define CY_CFG_SYSCLK_PLL0_FEEDBACK_DIV 30 +#define CY_CFG_SYSCLK_PLL0_REFERENCE_DIV 1 +#define CY_CFG_SYSCLK_PLL0_OUTPUT_DIV 5 +#define CY_CFG_SYSCLK_PLL0_LF_MODE false +#define CY_CFG_SYSCLK_PLL0_OUTPUT_MODE CY_SYSCLK_FLLPLL_OUTPUT_AUTO +#define CY_CFG_SYSCLK_PLL0_OUTPUT_FREQ 48000000 +#define CY_CFG_SYSCLK_CLKSLOW_ENABLED 1 +#define CY_CFG_SYSCLK_CLKSLOW_DIVIDER 0 +#define CY_CFG_SYSCLK_CLKTIMER_ENABLED 1 +#define CY_CFG_SYSCLK_CLKTIMER_SOURCE CY_SYSCLK_CLKTIMER_IN_IMO +#define CY_CFG_SYSCLK_CLKTIMER_DIVIDER 0U +#define CY_CFG_SYSCLK_WCO_ENABLED 1 +#define CY_CFG_SYSCLK_WCO_IN_PRT GPIO_PRT0 +#define CY_CFG_SYSCLK_WCO_IN_PIN 0U +#define CY_CFG_SYSCLK_WCO_OUT_PRT GPIO_PRT0 +#define CY_CFG_SYSCLK_WCO_OUT_PIN 1U +#define CY_CFG_SYSCLK_WCO_BYPASS CY_SYSCLK_WCO_NOT_BYPASSED +#define CY_CFG_PWR_ENABLED 1 +#define CY_CFG_PWR_INIT 1 +#define CY_CFG_PWR_USING_PMIC 0 +#define CY_CFG_PWR_VBACKUP_USING_VDDD 1 +#define CY_CFG_PWR_LDO_VOLTAGE CY_SYSPM_LDO_VOLTAGE_LP +#define CY_CFG_PWR_USING_ULP 0 +#define CY_CFG_PWR_REGULATOR_MODE_MIN false +#define CY_CFG_PWR_BKP_ERROR 6 + +#if defined(CY_DEVICE_SECURE) +static cy_stc_pra_system_config_t srss_0_clock_0_secureConfig; +#endif // defined (CY_DEVICE_SECURE) +#if (!defined(CY_DEVICE_SECURE)) +static const cy_stc_fll_manual_config_t srss_0_clock_0_fll_0_fllConfig = { + .fllMult = 500U, + .refDiv = 20U, + .ccoRange = CY_SYSCLK_FLL_CCO_RANGE4, + .enableOutputDiv = true, + .lockTolerance = 10U, + .igain = 9U, + .pgain = 5U, + .settlingCount = 8U, + .outputMode = CY_SYSCLK_FLLPLL_OUTPUT_OUTPUT, + .cco_Freq = 355U, +}; +#endif //(!defined(CY_DEVICE_SECURE)) +#if defined(CY_USING_HAL) +const cyhal_resource_inst_t srss_0_clock_0_pathmux_0_obj = { + .type = CYHAL_RSC_CLKPATH, + .block_num = 0U, + .channel_num = 0U, +}; +const cyhal_resource_inst_t srss_0_clock_0_pathmux_1_obj = { + .type = CYHAL_RSC_CLKPATH, + .block_num = 1U, + .channel_num = 0U, +}; +const cyhal_resource_inst_t srss_0_clock_0_pathmux_2_obj = { + .type = CYHAL_RSC_CLKPATH, + .block_num = 2U, + .channel_num = 0U, +}; +const cyhal_resource_inst_t srss_0_clock_0_pathmux_3_obj = { + .type = CYHAL_RSC_CLKPATH, + .block_num = 3U, + .channel_num = 0U, +}; +const cyhal_resource_inst_t srss_0_clock_0_pathmux_4_obj = { + .type = CYHAL_RSC_CLKPATH, + .block_num = 4U, + .channel_num = 0U, +}; +const cyhal_resource_inst_t srss_0_clock_0_pathmux_5_obj = { + .type = CYHAL_RSC_CLKPATH, + .block_num = 5U, + .channel_num = 0U, +}; +#endif // defined (CY_USING_HAL) +#if (!defined(CY_DEVICE_SECURE)) +static const cy_stc_pll_manual_config_t srss_0_clock_0_pll_0_pllConfig = { + .feedbackDiv = 30, + .referenceDiv = 1, + .outputDiv = 5, + .lfMode = false, + .outputMode = CY_SYSCLK_FLLPLL_OUTPUT_AUTO, +}; +#endif //(!defined(CY_DEVICE_SECURE)) + +__WEAK void __NO_RETURN cycfg_ClockStartupError(uint32_t error) +{ + (void) error; /* Suppress the compiler warning */ + while (1) + ; +} +#if (!defined(CY_DEVICE_SECURE)) +__STATIC_INLINE void Cy_SysClk_FllDeInit() +{ + Cy_SysClk_FllDisable(); +} +#endif //(!defined(CY_DEVICE_SECURE)) +#if defined(CY_DEVICE_SECURE) +void init_cycfg_secure_struct(cy_stc_pra_system_config_t * secure_config) +{ +#ifdef CY_CFG_PWR_ENABLED + secure_config->powerEnable = CY_CFG_PWR_ENABLED; +#endif /* CY_CFG_PWR_ENABLED */ + +#ifdef CY_CFG_PWR_USING_LDO + secure_config->ldoEnable = CY_CFG_PWR_USING_LDO; +#endif /* CY_CFG_PWR_USING_LDO */ + +#ifdef CY_CFG_PWR_USING_PMIC + secure_config->pmicEnable = CY_CFG_PWR_USING_PMIC; +#endif /* CY_CFG_PWR_USING_PMIC */ + +#ifdef CY_CFG_PWR_VBACKUP_USING_VDDD + secure_config->vBackupVDDDEnable = CY_CFG_PWR_VBACKUP_USING_VDDD; +#endif /* CY_CFG_PWR_VBACKUP_USING_VDDD */ + +#ifdef CY_CFG_PWR_USING_ULP + secure_config->ulpEnable = CY_CFG_PWR_USING_ULP; +#endif /* CY_CFG_PWR_USING_ULP */ + +#ifdef CY_CFG_SYSCLK_ECO_ENABLED + secure_config->ecoEnable = CY_CFG_SYSCLK_ECO_ENABLED; +#endif /* CY_CFG_SYSCLK_ECO_ENABLED */ + +#ifdef CY_CFG_SYSCLK_EXTCLK_ENABLED + secure_config->extClkEnable = CY_CFG_SYSCLK_EXTCLK_ENABLED; +#endif /* CY_CFG_SYSCLK_EXTCLK_ENABLED */ + +#ifdef CY_CFG_SYSCLK_ILO_ENABLED + secure_config->iloEnable = CY_CFG_SYSCLK_ILO_ENABLED; +#endif /* CY_CFG_SYSCLK_ILO_ENABLED */ + +#ifdef CY_CFG_SYSCLK_WCO_ENABLED + secure_config->wcoEnable = CY_CFG_SYSCLK_WCO_ENABLED; +#endif /* CY_CFG_SYSCLK_WCO_ENABLED */ + +#ifdef CY_CFG_SYSCLK_FLL_ENABLED + secure_config->fllEnable = CY_CFG_SYSCLK_FLL_ENABLED; +#endif /* CY_CFG_SYSCLK_FLL_ENABLED */ + +#ifdef CY_CFG_SYSCLK_PLL0_ENABLED + secure_config->pll0Enable = CY_CFG_SYSCLK_PLL0_ENABLED; +#endif /* CY_CFG_SYSCLK_PLL0_ENABLED */ + +#ifdef CY_CFG_SYSCLK_PLL1_ENABLED + secure_config->pll1Enable = CY_CFG_SYSCLK_PLL1_ENABLED; +#endif /* CY_CFG_SYSCLK_PLL1_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKPATH0_ENABLED + secure_config->path0Enable = CY_CFG_SYSCLK_CLKPATH0_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKPATH0_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKPATH1_ENABLED + secure_config->path1Enable = CY_CFG_SYSCLK_CLKPATH1_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKPATH1_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKPATH2_ENABLED + secure_config->path2Enable = CY_CFG_SYSCLK_CLKPATH2_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKPATH2_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKPATH3_ENABLED + secure_config->path3Enable = CY_CFG_SYSCLK_CLKPATH3_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKPATH3_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKPATH4_ENABLED + secure_config->path4Enable = CY_CFG_SYSCLK_CLKPATH4_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKPATH4_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKPATH5_ENABLED + secure_config->path5Enable = CY_CFG_SYSCLK_CLKPATH5_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKPATH5_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKFAST_ENABLED + secure_config->clkFastEnable = CY_CFG_SYSCLK_CLKFAST_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKFAST_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKPERI_ENABLED + secure_config->clkPeriEnable = CY_CFG_SYSCLK_CLKPERI_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKPERI_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKSLOW_ENABLED + secure_config->clkSlowEnable = CY_CFG_SYSCLK_CLKSLOW_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKSLOW_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKHF0_ENABLED + secure_config->clkHF0Enable = CY_CFG_SYSCLK_CLKHF0_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKHF0_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKHF1_ENABLED + secure_config->clkHF1Enable = CY_CFG_SYSCLK_CLKHF1_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKHF1_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKHF2_ENABLED + secure_config->clkHF2Enable = CY_CFG_SYSCLK_CLKHF2_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKHF2_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKHF3_ENABLED + secure_config->clkHF3Enable = CY_CFG_SYSCLK_CLKHF3_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKHF3_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKHF4_ENABLED + secure_config->clkHF4Enable = CY_CFG_SYSCLK_CLKHF4_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKHF4_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKHF5_ENABLED + secure_config->clkHF5Enable = CY_CFG_SYSCLK_CLKHF5_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKHF5_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKPUMP_ENABLED + secure_config->clkPumpEnable = CY_CFG_SYSCLK_CLKPUMP_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKPUMP_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKLF_ENABLED + secure_config->clkLFEnable = CY_CFG_SYSCLK_CLKLF_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKLF_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKBAK_ENABLED + secure_config->clkBakEnable = CY_CFG_SYSCLK_CLKBAK_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKBAK_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKTIMER_ENABLED + secure_config->clkTimerEnable = CY_CFG_SYSCLK_CLKTIMER_ENABLED; +#endif /* CY_CFG_SYSCLK_CLKTIMER_ENABLED */ + +#ifdef CY_CFG_SYSCLK_CLKALTSYSTICK_ENABLED +#error Configuration Error : ALT SYSTICK cannot be enabled for Secure devices. +#endif /* CY_CFG_SYSCLK_CLKALTSYSTICK_ENABLED */ + +#ifdef CY_CFG_SYSCLK_PILO_ENABLED + secure_config->piloEnable = CY_CFG_SYSCLK_PILO_ENABLED; +#endif /* CY_CFG_SYSCLK_PILO_ENABLED */ + +#ifdef CY_CFG_SYSCLK_ALTHF_ENABLED + secure_config->clkAltHfEnable = CY_CFG_SYSCLK_ALTHF_ENABLED; +#endif /* CY_CFG_SYSCLK_ALTHF_ENABLED */ + +#ifdef CY_CFG_PWR_LDO_VOLTAGE + secure_config->ldoVoltage = CY_CFG_PWR_LDO_VOLTAGE; +#endif /* CY_CFG_PWR_LDO_VOLTAGE */ + +#ifdef CY_CFG_PWR_REGULATOR_MODE_MIN + secure_config->pwrCurrentModeMin = CY_CFG_PWR_REGULATOR_MODE_MIN; +#endif /* CY_CFG_PWR_REGULATOR_MODE_MIN */ + +#ifdef CY_CFG_PWR_BUCK_VOLTAGE + secure_config->buckVoltage = CY_CFG_PWR_BUCK_VOLTAGE; +#endif /* CY_CFG_PWR_BUCK_VOLTAGE */ + +#ifdef CY_CFG_SYSCLK_ECO_FREQ + secure_config->ecoFreqHz = CY_CFG_SYSCLK_ECO_FREQ; +#endif /* CY_CFG_SYSCLK_ECO_FREQ */ + +#ifdef CY_CFG_SYSCLK_ECO_CLOAD + secure_config->ecoLoad = CY_CFG_SYSCLK_ECO_CLOAD; +#endif /* CY_CFG_SYSCLK_ECO_CLOAD */ + +#ifdef CY_CFG_SYSCLK_ECO_ESR + secure_config->ecoEsr = CY_CFG_SYSCLK_ECO_ESR; +#endif /* CY_CFG_SYSCLK_ECO_ESR */ + +#ifdef CY_CFG_SYSCLK_ECO_DRIVE_LEVEL + secure_config->ecoDriveLevel = CY_CFG_SYSCLK_ECO_DRIVE_LEVEL; +#endif /* CY_CFG_SYSCLK_ECO_DRIVE_LEVEL */ + +#ifdef CY_CFG_SYSCLK_ECO_GPIO_IN_PRT + secure_config->ecoInPort = CY_CFG_SYSCLK_ECO_GPIO_IN_PRT; +#endif /* CY_CFG_SYSCLK_ECO_GPIO_IN_PRT */ + +#ifdef CY_CFG_SYSCLK_ECO_GPIO_OUT_PRT + secure_config->ecoOutPort = CY_CFG_SYSCLK_ECO_GPIO_OUT_PRT; +#endif /* CY_CFG_SYSCLK_ECO_GPIO_OUT_PRT */ + +#ifdef CY_CFG_SYSCLK_ECO_GPIO_IN_PIN + secure_config->ecoInPinNum = CY_CFG_SYSCLK_ECO_GPIO_IN_PIN; +#endif /* CY_CFG_SYSCLK_ECO_GPIO_IN_PIN */ + +#ifdef CY_CFG_SYSCLK_ECO_GPIO_OUT_PIN + secure_config->ecoOutPinNum = CY_CFG_SYSCLK_ECO_GPIO_OUT_PIN; +#endif /* CY_CFG_SYSCLK_ECO_GPIO_OUT_PIN */ + +#ifdef CY_CFG_SYSCLK_EXTCLK_FREQ + secure_config->extClkFreqHz = CY_CFG_SYSCLK_EXTCLK_FREQ; +#endif /* CY_CFG_SYSCLK_EXTCLK_FREQ */ + +#ifdef CY_CFG_SYSCLK_EXTCLK_GPIO_PRT + secure_config->extClkPort = CY_CFG_SYSCLK_EXTCLK_GPIO_PRT; +#endif /* CY_CFG_SYSCLK_EXTCLK_GPIO_PRT */ + +#ifdef CY_CFG_SYSCLK_EXTCLK_GPIO_PIN + secure_config->extClkPinNum = CY_CFG_SYSCLK_EXTCLK_GPIO_PIN; +#endif /* CY_CFG_SYSCLK_EXTCLK_GPIO_PIN */ + +#ifdef CY_CFG_SYSCLK_EXTCLK_GPIO_HSIOM + secure_config->extClkHsiom = CY_CFG_SYSCLK_EXTCLK_GPIO_HSIOM; +#endif /* CY_CFG_SYSCLK_EXTCLK_GPIO_HSIOM */ + +#ifdef CY_CFG_SYSCLK_ILO_HIBERNATE + secure_config->iloHibernateON = CY_CFG_SYSCLK_ILO_HIBERNATE; +#endif /* CY_CFG_SYSCLK_ILO_HIBERNATE */ + +#ifdef CY_CFG_SYSCLK_WCO_BYPASS + secure_config->bypassEnable = CY_CFG_SYSCLK_WCO_BYPASS; +#endif /* CY_CFG_SYSCLK_WCO_BYPASS */ + +#ifdef CY_CFG_SYSCLK_WCO_IN_PRT + secure_config->wcoInPort = CY_CFG_SYSCLK_WCO_IN_PRT; +#endif /* CY_CFG_SYSCLK_WCO_IN_PRT */ + +#ifdef CY_CFG_SYSCLK_WCO_OUT_PRT + secure_config->wcoOutPort = CY_CFG_SYSCLK_WCO_OUT_PRT; +#endif /* CY_CFG_SYSCLK_WCO_OUT_PRT */ + +#ifdef CY_CFG_SYSCLK_WCO_IN_PIN + secure_config->wcoInPinNum = CY_CFG_SYSCLK_WCO_IN_PIN; +#endif /* CY_CFG_SYSCLK_WCO_IN_PIN */ + +#ifdef CY_CFG_SYSCLK_WCO_OUT_PIN + secure_config->wcoOutPinNum = CY_CFG_SYSCLK_WCO_OUT_PIN; +#endif /* CY_CFG_SYSCLK_WCO_OUT_PIN */ + +#ifdef CY_CFG_SYSCLK_FLL_OUT_FREQ + secure_config->fllOutFreqHz = CY_CFG_SYSCLK_FLL_OUT_FREQ; +#endif /* CY_CFG_SYSCLK_FLL_OUT_FREQ */ + +#ifdef CY_CFG_SYSCLK_FLL_MULT + secure_config->fllMult = CY_CFG_SYSCLK_FLL_MULT; +#endif /* CY_CFG_SYSCLK_FLL_MULT */ + +#ifdef CY_CFG_SYSCLK_FLL_REFDIV + secure_config->fllRefDiv = CY_CFG_SYSCLK_FLL_REFDIV; +#endif /* CY_CFG_SYSCLK_FLL_REFDIV */ + +#ifdef CY_CFG_SYSCLK_FLL_CCO_RANGE + secure_config->fllCcoRange = CY_CFG_SYSCLK_FLL_CCO_RANGE; +#endif /* CY_CFG_SYSCLK_FLL_CCO_RANGE */ + +#ifdef CY_CFG_SYSCLK_FLL_ENABLE_OUTDIV + secure_config->enableOutputDiv = CY_CFG_SYSCLK_FLL_ENABLE_OUTDIV; +#endif /* CY_CFG_SYSCLK_FLL_ENABLE_OUTDIV */ + +#ifdef CY_CFG_SYSCLK_FLL_LOCK_TOLERANCE + secure_config->lockTolerance = CY_CFG_SYSCLK_FLL_LOCK_TOLERANCE; +#endif /* CY_CFG_SYSCLK_FLL_LOCK_TOLERANCE */ + +#ifdef CY_CFG_SYSCLK_FLL_IGAIN + secure_config->igain = CY_CFG_SYSCLK_FLL_IGAIN; +#endif /* CY_CFG_SYSCLK_FLL_IGAIN */ + +#ifdef CY_CFG_SYSCLK_FLL_PGAIN + secure_config->pgain = CY_CFG_SYSCLK_FLL_PGAIN; +#endif /* CY_CFG_SYSCLK_FLL_PGAIN */ + +#ifdef CY_CFG_SYSCLK_FLL_SETTLING_COUNT + secure_config->settlingCount = CY_CFG_SYSCLK_FLL_SETTLING_COUNT; +#endif /* CY_CFG_SYSCLK_FLL_SETTLING_COUNT */ + +#ifdef CY_CFG_SYSCLK_FLL_OUTPUT_MODE + secure_config->outputMode = CY_CFG_SYSCLK_FLL_OUTPUT_MODE; +#endif /* CY_CFG_SYSCLK_FLL_OUTPUT_MODE */ + +#ifdef CY_CFG_SYSCLK_FLL_CCO_FREQ + secure_config->ccoFreq = CY_CFG_SYSCLK_FLL_CCO_FREQ; +#endif /* CY_CFG_SYSCLK_FLL_CCO_FREQ */ + +#ifdef CY_CFG_SYSCLK_PLL0_FEEDBACK_DIV + secure_config->pll0FeedbackDiv = CY_CFG_SYSCLK_PLL0_FEEDBACK_DIV; +#endif /* CY_CFG_SYSCLK_PLL0_FEEDBACK_DIV */ + +#ifdef CY_CFG_SYSCLK_PLL0_REFERENCE_DIV + secure_config->pll0ReferenceDiv = CY_CFG_SYSCLK_PLL0_REFERENCE_DIV; +#endif /* CY_CFG_SYSCLK_PLL0_REFERENCE_DIV */ + +#ifdef CY_CFG_SYSCLK_PLL0_OUTPUT_DIV + secure_config->pll0OutputDiv = CY_CFG_SYSCLK_PLL0_OUTPUT_DIV; +#endif /* CY_CFG_SYSCLK_PLL0_OUTPUT_DIV */ + +#ifdef CY_CFG_SYSCLK_PLL0_LF_MODE + secure_config->pll0LfMode = CY_CFG_SYSCLK_PLL0_LF_MODE; +#endif /* CY_CFG_SYSCLK_PLL0_LF_MODE */ + +#ifdef CY_CFG_SYSCLK_PLL0_OUTPUT_MODE + secure_config->pll0OutputMode = CY_CFG_SYSCLK_PLL0_OUTPUT_MODE; +#endif /* CY_CFG_SYSCLK_PLL0_OUTPUT_MODE */ + +#ifdef CY_CFG_SYSCLK_PLL0_OUTPUT_FREQ + secure_config->pll0OutFreqHz = CY_CFG_SYSCLK_PLL0_OUTPUT_FREQ; +#endif /* CY_CFG_SYSCLK_PLL0_OUTPUT_FREQ */ + +#ifdef CY_CFG_SYSCLK_PLL1_FEEDBACK_DIV + secure_config->pll1FeedbackDiv = CY_CFG_SYSCLK_PLL1_FEEDBACK_DIV; +#endif /* CY_CFG_SYSCLK_PLL1_FEEDBACK_DIV */ + +#ifdef CY_CFG_SYSCLK_PLL1_REFERENCE_DIV + secure_config->pll1ReferenceDiv = CY_CFG_SYSCLK_PLL1_REFERENCE_DIV; +#endif /* CY_CFG_SYSCLK_PLL1_REFERENCE_DIV */ + +#ifdef CY_CFG_SYSCLK_PLL1_OUTPUT_DIV + secure_config->pll1OutputDiv = CY_CFG_SYSCLK_PLL1_OUTPUT_DIV; +#endif /* CY_CFG_SYSCLK_PLL1_OUTPUT_DIV */ + +#ifdef CY_CFG_SYSCLK_PLL1_LF_MODE + secure_config->pll1LfMode = CY_CFG_SYSCLK_PLL1_LF_MODE; +#endif /* CY_CFG_SYSCLK_PLL1_LF_MODE */ + +#ifdef CY_CFG_SYSCLK_PLL1_OUTPUT_MODE + secure_config->pll1OutputMode = CY_CFG_SYSCLK_PLL1_OUTPUT_MODE; +#endif /* CY_CFG_SYSCLK_PLL1_OUTPUT_MODE */ + +#ifdef CY_CFG_SYSCLK_PLL1_OUTPUT_FREQ + secure_config->pll1OutFreqHz = CY_CFG_SYSCLK_PLL1_OUTPUT_FREQ; +#endif /* CY_CFG_SYSCLK_PLL1_OUTPUT_FREQ */ + +#ifdef CY_CFG_SYSCLK_CLKPATH0_SOURCE + secure_config->path0Src = CY_CFG_SYSCLK_CLKPATH0_SOURCE; +#endif /* CY_CFG_SYSCLK_CLKPATH0_SOURCE */ + +#ifdef CY_CFG_SYSCLK_CLKPATH1_SOURCE + secure_config->path1Src = CY_CFG_SYSCLK_CLKPATH1_SOURCE; +#endif /* CY_CFG_SYSCLK_CLKPATH1_SOURCE */ + +#ifdef CY_CFG_SYSCLK_CLKPATH2_SOURCE + secure_config->path2Src = CY_CFG_SYSCLK_CLKPATH2_SOURCE; +#endif /* CY_CFG_SYSCLK_CLKPATH2_SOURCE */ + +#ifdef CY_CFG_SYSCLK_CLKPATH3_SOURCE + secure_config->path3Src = CY_CFG_SYSCLK_CLKPATH3_SOURCE; +#endif /* CY_CFG_SYSCLK_CLKPATH3_SOURCE */ + +#ifdef CY_CFG_SYSCLK_CLKPATH4_SOURCE + secure_config->path4Src = CY_CFG_SYSCLK_CLKPATH4_SOURCE; +#endif /* CY_CFG_SYSCLK_CLKPATH4_SOURCE */ + +#ifdef CY_CFG_SYSCLK_CLKPATH5_SOURCE + secure_config->path5Src = CY_CFG_SYSCLK_CLKPATH5_SOURCE; +#endif /* CY_CFG_SYSCLK_CLKPATH5_SOURCE */ + +#ifdef CY_CFG_SYSCLK_CLKFAST_DIVIDER + secure_config->clkFastDiv = CY_CFG_SYSCLK_CLKFAST_DIVIDER; +#endif /* CY_CFG_SYSCLK_CLKFAST_DIVIDER */ + +#ifdef CY_CFG_SYSCLK_CLKPERI_DIVIDER + secure_config->clkPeriDiv = CY_CFG_SYSCLK_CLKPERI_DIVIDER; +#endif /* CY_CFG_SYSCLK_CLKPERI_DIVIDER */ + +#ifdef CY_CFG_SYSCLK_CLKSLOW_DIVIDER + secure_config->clkSlowDiv = CY_CFG_SYSCLK_CLKSLOW_DIVIDER; +#endif /* CY_CFG_SYSCLK_CLKSLOW_DIVIDER */ + +#ifdef CY_CFG_SYSCLK_CLKHF0_CLKPATH + secure_config->hf0Source = CY_CFG_SYSCLK_CLKHF0_CLKPATH; +#endif /* CY_CFG_SYSCLK_CLKHF0_CLKPATH */ + +#ifdef CY_CFG_SYSCLK_CLKHF0_DIVIDER + secure_config->hf0Divider = CY_CFG_SYSCLK_CLKHF0_DIVIDER; +#endif /* CY_CFG_SYSCLK_CLKHF0_DIVIDER */ + +#ifdef CY_CFG_SYSCLK_CLKHF0_FREQ_MHZ + secure_config->hf0OutFreqMHz = CY_CFG_SYSCLK_CLKHF0_FREQ_MHZ; +#endif /* CY_CFG_SYSCLK_CLKHF0_FREQ_MHZ */ + +#ifdef CY_CFG_SYSCLK_CLKHF1_CLKPATH + secure_config->hf1Source = CY_CFG_SYSCLK_CLKHF1_CLKPATH; +#endif /* CY_CFG_SYSCLK_CLKHF1_CLKPATH */ + +#ifdef CY_CFG_SYSCLK_CLKHF1_DIVIDER + secure_config->hf1Divider = CY_CFG_SYSCLK_CLKHF1_DIVIDER; +#endif /* CY_CFG_SYSCLK_CLKHF1_DIVIDER */ + +#ifdef CY_CFG_SYSCLK_CLKHF1_FREQ_MHZ + secure_config->hf1OutFreqMHz = CY_CFG_SYSCLK_CLKHF1_FREQ_MHZ; +#endif /* CY_CFG_SYSCLK_CLKHF1_FREQ_MHZ */ + +#ifdef CY_CFG_SYSCLK_CLKHF2_CLKPATH + secure_config->hf2Source = CY_CFG_SYSCLK_CLKHF2_CLKPATH; +#endif /* CY_CFG_SYSCLK_CLKHF2_CLKPATH */ + +#ifdef CY_CFG_SYSCLK_CLKHF2_DIVIDER + secure_config->hf2Divider = CY_CFG_SYSCLK_CLKHF2_DIVIDER; +#endif /* CY_CFG_SYSCLK_CLKHF2_DIVIDER */ + +#ifdef CY_CFG_SYSCLK_CLKHF2_FREQ_MHZ + secure_config->hf2OutFreqMHz = CY_CFG_SYSCLK_CLKHF2_FREQ_MHZ; +#endif /* CY_CFG_SYSCLK_CLKHF2_FREQ_MHZ */ + +#ifdef CY_CFG_SYSCLK_CLKHF3_CLKPATH + secure_config->hf3Source = CY_CFG_SYSCLK_CLKHF3_CLKPATH; +#endif /* CY_CFG_SYSCLK_CLKHF3_CLKPATH */ + +#ifdef CY_CFG_SYSCLK_CLKHF3_DIVIDER + secure_config->hf3Divider = CY_CFG_SYSCLK_CLKHF3_DIVIDER; +#endif /* CY_CFG_SYSCLK_CLKHF3_DIVIDER */ + +#ifdef CY_CFG_SYSCLK_CLKHF3_FREQ_MHZ + secure_config->hf3OutFreqMHz = CY_CFG_SYSCLK_CLKHF3_FREQ_MHZ; +#endif /* CY_CFG_SYSCLK_CLKHF3_FREQ_MHZ */ + +#ifdef CY_CFG_SYSCLK_CLKHF4_CLKPATH + secure_config->hf4Source = CY_CFG_SYSCLK_CLKHF4_CLKPATH; +#endif /* CY_CFG_SYSCLK_CLKHF4_CLKPATH */ + +#ifdef CY_CFG_SYSCLK_CLKHF4_DIVIDER + secure_config->hf4Divider = CY_CFG_SYSCLK_CLKHF4_DIVIDER; +#endif /* CY_CFG_SYSCLK_CLKHF4_DIVIDER */ + +#ifdef CY_CFG_SYSCLK_CLKHF4_FREQ_MHZ + secure_config->hf4OutFreqMHz = CY_CFG_SYSCLK_CLKHF4_FREQ_MHZ; +#endif /* CY_CFG_SYSCLK_CLKHF4_FREQ_MHZ */ + +#ifdef CY_CFG_SYSCLK_CLKHF5_CLKPATH + secure_config->hf5Source = CY_CFG_SYSCLK_CLKHF5_CLKPATH; +#endif /* CY_CFG_SYSCLK_CLKHF5_CLKPATH */ + +#ifdef CY_CFG_SYSCLK_CLKHF5_DIVIDER + secure_config->hf5Divider = CY_CFG_SYSCLK_CLKHF5_DIVIDER; +#endif /* CY_CFG_SYSCLK_CLKHF5_DIVIDER */ + +#ifdef CY_CFG_SYSCLK_CLKHF5_FREQ_MHZ + secure_config->hf5OutFreqMHz = CY_CFG_SYSCLK_CLKHF5_FREQ_MHZ; +#endif /* CY_CFG_SYSCLK_CLKHF5_FREQ_MHZ */ + +#ifdef CY_CFG_SYSCLK_CLKPUMP_SOURCE + secure_config->pumpSource = CY_CFG_SYSCLK_CLKPUMP_SOURCE; +#endif /* CY_CFG_SYSCLK_CLKPUMP_SOURCE */ + +#ifdef CY_CFG_SYSCLK_CLKPUMP_DIVIDER + secure_config->pumpDivider = CY_CFG_SYSCLK_CLKPUMP_DIVIDER; +#endif /* CY_CFG_SYSCLK_CLKPUMP_DIVIDER */ + +#ifdef CY_CFG_SYSCLK_CLKLF_SOURCE + secure_config->clkLfSource = CY_CFG_SYSCLK_CLKLF_SOURCE; +#endif /* CY_CFG_SYSCLK_CLKLF_SOURCE */ + +#ifdef CY_CFG_SYSCLK_CLKBAK_SOURCE + secure_config->clkBakSource = CY_CFG_SYSCLK_CLKBAK_SOURCE; +#endif /* CY_CFG_SYSCLK_CLKBAK_SOURCE */ + +#ifdef CY_CFG_SYSCLK_CLKTIMER_SOURCE + secure_config->clkTimerSource = CY_CFG_SYSCLK_CLKTIMER_SOURCE; +#endif /* CY_CFG_SYSCLK_CLKTIMER_SOURCE */ + +#ifdef CY_CFG_SYSCLK_CLKTIMER_DIVIDER + secure_config->clkTimerDivider = CY_CFG_SYSCLK_CLKTIMER_DIVIDER; +#endif /* CY_CFG_SYSCLK_CLKTIMER_DIVIDER */ + +#ifdef CY_CFG_SYSCLK_CLKALTSYSTICK_SOURCE + secure_config->clkSrcAltSysTick = CY_CFG_SYSCLK_CLKALTSYSTICK_SOURCE; +#endif /* CY_CFG_SYSCLK_CLKALTSYSTICK_SOURCE */ + +#ifdef CY_CFG_SYSCLK_ALTHF_BLE_ECO_CLOAD + secure_config->altHFcLoad = CY_CFG_SYSCLK_ALTHF_BLE_ECO_CLOAD; +#endif /* CY_CFG_SYSCLK_ALTHF_BLE_ECO_CLOAD */ + +#ifdef CY_CFG_SYSCLK_ALTHF_BLE_ECO_TIME + secure_config->altHFxtalStartUpTime = CY_CFG_SYSCLK_ALTHF_BLE_ECO_TIME; +#endif /* CY_CFG_SYSCLK_ALTHF_BLE_ECO_TIME */ + +#ifdef CY_CFG_SYSCLK_ALTHF_BLE_ECO_FREQ + secure_config->altHFclkFreq = CY_CFG_SYSCLK_ALTHF_BLE_ECO_FREQ; +#endif /* CY_CFG_SYSCLK_ALTHF_BLE_ECO_FREQ */ + +#ifdef CY_CFG_SYSCLK_ALTHF_BLE_ECO_CLK_DIV + secure_config->altHFsysClkDiv = CY_CFG_SYSCLK_ALTHF_BLE_ECO_CLK_DIV; +#endif /* CY_CFG_SYSCLK_ALTHF_BLE_ECO_CLK_DIV */ + +#ifdef CY_CFG_SYSCLK_ALTHF_BLE_ECO_VOL_REGULATOR + secure_config->altHFvoltageReg = CY_CFG_SYSCLK_ALTHF_BLE_ECO_VOL_REGULATOR; +#endif /* CY_CFG_SYSCLK_ALTHF_BLE_ECO_VOL_REGULATOR */ +} +#endif // defined (CY_DEVICE_SECURE) +__STATIC_INLINE void Cy_SysClk_ClkAltSysTickInit() +{ + Cy_SysTick_Init(CY_CFG_SYSCLK_CLKALTSYSTICK_SOURCE, CY_CFG_SYSCLK_CLKALTSYSTICK_TICKS); +} +#if (!defined(CY_DEVICE_SECURE)) +__STATIC_INLINE void Cy_SysClk_ClkBakInit() +{ + Cy_SysClk_ClkBakSetSource(CY_SYSCLK_BAK_IN_CLKLF); +} +__STATIC_INLINE void Cy_SysClk_ClkFastInit() +{ + Cy_SysClk_ClkFastSetDivider(0U); +} +__STATIC_INLINE void Cy_SysClk_FllInit() +{ + if (CY_SYSCLK_SUCCESS != Cy_SysClk_FllManualConfigure(&srss_0_clock_0_fll_0_fllConfig)) + { + cycfg_ClockStartupError(CY_CFG_SYSCLK_FLL_ERROR); + } + if (CY_SYSCLK_SUCCESS != Cy_SysClk_FllEnable(200000UL)) + { + cycfg_ClockStartupError(CY_CFG_SYSCLK_FLL_ERROR); + } +} +__STATIC_INLINE void Cy_SysClk_ClkHf0Init() +{ + Cy_SysClk_ClkHfSetSource(0U, CY_CFG_SYSCLK_CLKHF0_CLKPATH); + Cy_SysClk_ClkHfSetDivider(0U, CY_SYSCLK_CLKHF_NO_DIVIDE); +} +__STATIC_INLINE void Cy_SysClk_IloInit() +{ + /* The WDT is unlocked in the default startup code */ + Cy_SysClk_IloEnable(); + Cy_SysClk_IloHibernateOn(true); +} +__STATIC_INLINE void Cy_SysClk_ClkLfInit() +{ + /* The WDT is unlocked in the default startup code */ + Cy_SysClk_ClkLfSetSource(CY_SYSCLK_CLKLF_IN_WCO); +} +__STATIC_INLINE void Cy_SysClk_ClkPath0Init() +{ + Cy_SysClk_ClkPathSetSource(0U, CY_CFG_SYSCLK_CLKPATH0_SOURCE); +} +__STATIC_INLINE void Cy_SysClk_ClkPath1Init() +{ + Cy_SysClk_ClkPathSetSource(1U, CY_CFG_SYSCLK_CLKPATH1_SOURCE); +} +__STATIC_INLINE void Cy_SysClk_ClkPath2Init() +{ + Cy_SysClk_ClkPathSetSource(2U, CY_CFG_SYSCLK_CLKPATH2_SOURCE); +} +__STATIC_INLINE void Cy_SysClk_ClkPath3Init() +{ + Cy_SysClk_ClkPathSetSource(3U, CY_CFG_SYSCLK_CLKPATH3_SOURCE); +} +__STATIC_INLINE void Cy_SysClk_ClkPath4Init() +{ + Cy_SysClk_ClkPathSetSource(4U, CY_CFG_SYSCLK_CLKPATH4_SOURCE); +} +__STATIC_INLINE void Cy_SysClk_ClkPath5Init() +{ + Cy_SysClk_ClkPathSetSource(5U, CY_CFG_SYSCLK_CLKPATH5_SOURCE); +} +__STATIC_INLINE void Cy_SysClk_ClkPeriInit() +{ + Cy_SysClk_ClkPeriSetDivider(0U); +} +__STATIC_INLINE void Cy_SysClk_Pll0Init() +{ + if (CY_SYSCLK_SUCCESS != Cy_SysClk_PllManualConfigure(1U, &srss_0_clock_0_pll_0_pllConfig)) + { + cycfg_ClockStartupError(CY_CFG_SYSCLK_PLL_ERROR); + } + if (CY_SYSCLK_SUCCESS != Cy_SysClk_PllEnable(1U, 10000u)) + { + cycfg_ClockStartupError(CY_CFG_SYSCLK_PLL_ERROR); + } +} +__STATIC_INLINE void Cy_SysClk_ClkSlowInit() +{ + Cy_SysClk_ClkSlowSetDivider(0U); +} +__STATIC_INLINE void Cy_SysClk_ClkTimerInit() +{ + Cy_SysClk_ClkTimerDisable(); + Cy_SysClk_ClkTimerSetSource(CY_SYSCLK_CLKTIMER_IN_IMO); + Cy_SysClk_ClkTimerSetDivider(0U); + Cy_SysClk_ClkTimerEnable(); +} +__STATIC_INLINE void Cy_SysClk_WcoInit() +{ + (void) Cy_GPIO_Pin_FastInit(GPIO_PRT0, 0U, 0x00U, 0x00U, HSIOM_SEL_GPIO); + (void) Cy_GPIO_Pin_FastInit(GPIO_PRT0, 1U, 0x00U, 0x00U, HSIOM_SEL_GPIO); + if (CY_SYSCLK_SUCCESS != Cy_SysClk_WcoEnable(1000000UL)) + { + cycfg_ClockStartupError(CY_CFG_SYSCLK_WCO_ERROR); + } +} +__STATIC_INLINE void init_cycfg_power(void) +{ + /* Reset the Backup domain on POR, XRES, BOD only if Backup domain is supplied by VDDD */ +#if (CY_CFG_PWR_VBACKUP_USING_VDDD) +#ifdef CY_CFG_SYSCLK_ILO_ENABLED + if (0u == Cy_SysLib_GetResetReason() /* POR, XRES, or BOD */) + { +#if CY_CFG_SYSCLK_WCO_ENABLED + uint32_t wcoTrim = Cy_SysLib_GetWcoTrim(); + if (CY_SYSLIB_SUCCESS != Cy_SysLib_ResetBackupDomain()) + { + Cy_SysLib_DelayUs(1U); + if (CY_SYSLIB_SUCCESS != Cy_SysLib_GetResetStatus()) + { + cycfg_ClockStartupError(CY_CFG_PWR_BKP_ERROR); + } + } + Cy_SysLib_SetWcoTrim(wcoTrim); +#else /* CY_CFG_SYSCLK_WCO_ENABLED */ + (void) Cy_SysLib_ResetBackupDomain(); +#endif /* CY_CFG_SYSCLK_WCO_ENABLED */ + Cy_SysClk_IloDisable(); + Cy_SysClk_IloInit(); + } +#endif /* CY_CFG_SYSCLK_ILO_ENABLED */ +#endif /* CY_CFG_PWR_VBACKUP_USING_VDDD */ +/* Configure core regulator */ +#if !(defined(CY_DEVICE_SECURE)) +#if defined(CY_IP_M4CPUSS) +#if CY_CFG_PWR_USING_LDO + Cy_SysPm_LdoSetVoltage(CY_SYSPM_LDO_VOLTAGE_LP); +#else + Cy_SysPm_BuckEnable(CY_SYSPM_BUCK_OUT1_VOLTAGE_LP); +#endif /* CY_CFG_PWR_USING_LDO */ +#endif /* defined (CY_IP_M4CPUSS) */ +#if CY_CFG_PWR_REGULATOR_MODE_MIN + Cy_SysPm_SystemSetMinRegulatorCurrent(); +#else + Cy_SysPm_SystemSetNormalRegulatorCurrent(); +#endif /* CY_CFG_PWR_REGULATOR_MODE_MIN */ +#endif /* !(defined(CY_DEVICE_SECURE)) */ + /* Configure PMIC */ + Cy_SysPm_UnlockPmic(); +#if CY_CFG_PWR_USING_PMIC + Cy_SysPm_PmicEnableOutput(); +#else + Cy_SysPm_PmicDisableOutput(); +#endif /* CY_CFG_PWR_USING_PMIC */ +} +#endif //(!defined(CY_DEVICE_SECURE)) + +void init_cycfg_system(void) +{ + Cy_SysClk_PeriphAssignDivider(PCLK_CPUSS_CLOCK_TRACE_IN, CY_SYSCLK_DIV_8_BIT, 7U); +#if defined(CY_DEVICE_SECURE) + cy_en_pra_status_t configStatus; + init_cycfg_secure_struct(&srss_0_clock_0_secureConfig); +#if (((CY_CFG_SYSCLK_CLKPATH0_SOURCE_NUM >= 3UL) && (CY_CFG_SYSCLK_CLKPATH0_SOURCE_NUM <= 5UL)) && \ + (CY_CFG_SYSCLK_CLKHF0_CLKPATH_NUM == 0UL)) +#error Configuration Error : ALTHF, ILO, PILO cannot drive HF0. +#endif +#if (((CY_CFG_SYSCLK_CLKPATH1_SOURCE_NUM >= 3UL) && (CY_CFG_SYSCLK_CLKPATH1_SOURCE_NUM <= 5UL)) && \ + (CY_CFG_SYSCLK_CLKHF0_CLKPATH_NUM == 1UL)) +#error Configuration Error : ALTHF, ILO, PILO cannot drive HF0. +#endif +#if (((CY_CFG_SYSCLK_CLKPATH2_SOURCE_NUM >= 3UL) && (CY_CFG_SYSCLK_CLKPATH2_SOURCE_NUM <= 5UL)) && \ + (CY_CFG_SYSCLK_CLKHF0_CLKPATH_NUM == 2UL)) +#error Configuration Error : ALTHF, ILO, PILO cannot drive HF0. +#endif +#if (((CY_CFG_SYSCLK_CLKPATH3_SOURCE_NUM >= 3UL) && (CY_CFG_SYSCLK_CLKPATH3_SOURCE_NUM <= 5UL)) && \ + (CY_CFG_SYSCLK_CLKHF0_CLKPATH_NUM == 3UL)) +#error Configuration Error : ALTHF, ILO, PILO cannot drive HF0. +#endif +#if (((CY_CFG_SYSCLK_CLKPATH4_SOURCE_NUM >= 3UL) && (CY_CFG_SYSCLK_CLKPATH4_SOURCE_NUM <= 5UL)) && \ + (CY_CFG_SYSCLK_CLKHF0_CLKPATH_NUM == 4UL)) +#error Configuration Error : ALTHF, ILO, PILO cannot drive HF0. +#endif +#if (((CY_CFG_SYSCLK_CLKPATH5_SOURCE_NUM >= 3UL) && (CY_CFG_SYSCLK_CLKPATH5_SOURCE_NUM <= 5UL)) && \ + (CY_CFG_SYSCLK_CLKHF0_CLKPATH_NUM == 5UL)) +#error Configuration Error : ALTHF, ILO, PILO cannot drive HF0. +#endif + + configStatus = CY_PRA_FUNCTION_CALL_RETURN_PARAM(CY_PRA_MSG_TYPE_SYS_CFG_FUNC, CY_PRA_FUNC_INIT_CYCFG_DEVICE, + &srss_0_clock_0_secureConfig); + if (configStatus != CY_PRA_STATUS_SUCCESS) + { + cycfg_ClockStartupError(configStatus); + } +#ifdef CY_CFG_SYSCLK_EXTCLK_FREQ + Cy_SysClk_ExtClkSetFrequency(CY_CFG_SYSCLK_EXTCLK_FREQ); +#endif /* CY_CFG_SYSCLK_EXTCLK_FREQ */ +#else /* defined(CY_DEVICE_SECURE) */ + + /* Set worst case memory wait states (! ultra low power, 150 MHz), will update at the end */ + Cy_SysLib_SetWaitStates(false, 150UL); +#ifdef CY_CFG_PWR_ENABLED +#ifdef CY_CFG_PWR_INIT + init_cycfg_power(); +#else +#warning Power system will not be configured. Update power personality to v1.20 or later. +#endif /* CY_CFG_PWR_INIT */ +#endif /* CY_CFG_PWR_ENABLED */ + + /* Disable FLL */ + Cy_SysClk_FllDeInit(); + + /* Reset the core clock path to default and disable all the FLLs/PLLs */ + Cy_SysClk_ClkHfSetDivider(0U, CY_SYSCLK_CLKHF_NO_DIVIDE); + Cy_SysClk_ClkFastSetDivider(0U); + Cy_SysClk_ClkPeriSetDivider(1U); + Cy_SysClk_ClkSlowSetDivider(0U); + for (uint32_t pll = CY_SRSS_NUM_PLL; pll > 0UL; --pll) /* PLL 1 is the first PLL. 0 is invalid. */ + { + (void) Cy_SysClk_PllDisable(pll); + } + Cy_SysClk_ClkPathSetSource(CY_SYSCLK_CLKHF_IN_CLKPATH1, CY_SYSCLK_CLKPATH_IN_IMO); + + if ((CY_SYSCLK_CLKHF_IN_CLKPATH0 == Cy_SysClk_ClkHfGetSource(0UL)) && + (CY_SYSCLK_CLKPATH_IN_WCO == Cy_SysClk_ClkPathGetSource(CY_SYSCLK_CLKHF_IN_CLKPATH0))) + { + Cy_SysClk_ClkHfSetSource(0U, CY_SYSCLK_CLKHF_IN_CLKPATH1); + } + + Cy_SysClk_ClkPathSetSource(CY_SYSCLK_CLKHF_IN_CLKPATH0, CY_SYSCLK_CLKPATH_IN_IMO); + Cy_SysClk_ClkHfSetSource(0UL, CY_SYSCLK_CLKHF_IN_CLKPATH0); +#ifdef CY_IP_MXBLESS + (void) Cy_BLE_EcoReset(); +#endif + +/* Enable all source clocks */ +#ifdef CY_CFG_SYSCLK_PILO_ENABLED + Cy_SysClk_PiloInit(); +#endif + +#ifdef CY_CFG_SYSCLK_WCO_ENABLED + Cy_SysClk_WcoInit(); +#endif + +#ifdef CY_CFG_SYSCLK_CLKLF_ENABLED + Cy_SysClk_ClkLfInit(); +#endif + +#if (defined(CY_IP_M4CPUSS) && CY_CFG_SYSCLK_ALTHF_ENABLED) + Cy_SysClk_AltHfInit(); +#endif /* (defined(CY_IP_M4CPUSS) && CY_CFG_SYSCLK_ALTHF_ENABLED */ + +#ifdef CY_CFG_SYSCLK_ECO_ENABLED + Cy_SysClk_EcoInit(); +#endif + +#ifdef CY_CFG_SYSCLK_EXTCLK_ENABLED + Cy_SysClk_ExtClkInit(); +#endif + +/* Configure CPU clock dividers */ +#ifdef CY_CFG_SYSCLK_CLKFAST_ENABLED + Cy_SysClk_ClkFastInit(); +#endif + +#ifdef CY_CFG_SYSCLK_CLKPERI_ENABLED + Cy_SysClk_ClkPeriInit(); +#endif + +#ifdef CY_CFG_SYSCLK_CLKSLOW_ENABLED + Cy_SysClk_ClkSlowInit(); +#endif + +#if ((CY_CFG_SYSCLK_CLKPATH0_SOURCE_NUM == 0x6UL) && (CY_CFG_SYSCLK_CLKHF0_CLKPATH_NUM == 0U)) + /* Configure HFCLK0 to temporarily run from IMO to initialize other clocks */ + Cy_SysClk_ClkPathSetSource(1UL, CY_SYSCLK_CLKPATH_IN_IMO); + Cy_SysClk_ClkHfSetSource(0UL, CY_SYSCLK_CLKHF_IN_CLKPATH1); +#else +#ifdef CY_CFG_SYSCLK_CLKPATH1_ENABLED + Cy_SysClk_ClkPath1Init(); +#endif +#endif + +/* Configure Path Clocks */ +#ifdef CY_CFG_SYSCLK_CLKPATH0_ENABLED + Cy_SysClk_ClkPath0Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKPATH2_ENABLED + Cy_SysClk_ClkPath2Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKPATH3_ENABLED + Cy_SysClk_ClkPath3Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKPATH4_ENABLED + Cy_SysClk_ClkPath4Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKPATH5_ENABLED + Cy_SysClk_ClkPath5Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKPATH6_ENABLED + Cy_SysClk_ClkPath6Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKPATH7_ENABLED + Cy_SysClk_ClkPath7Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKPATH8_ENABLED + Cy_SysClk_ClkPath8Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKPATH9_ENABLED + Cy_SysClk_ClkPath9Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKPATH10_ENABLED + Cy_SysClk_ClkPath10Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKPATH11_ENABLED + Cy_SysClk_ClkPath11Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKPATH12_ENABLED + Cy_SysClk_ClkPath12Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKPATH13_ENABLED + Cy_SysClk_ClkPath13Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKPATH14_ENABLED + Cy_SysClk_ClkPath14Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKPATH15_ENABLED + Cy_SysClk_ClkPath15Init(); +#endif + +/* Configure and enable FLL */ +#ifdef CY_CFG_SYSCLK_FLL_ENABLED + Cy_SysClk_FllInit(); +#endif + + Cy_SysClk_ClkHf0Init(); + +#if ((CY_CFG_SYSCLK_CLKPATH0_SOURCE_NUM == 0x6UL) && (CY_CFG_SYSCLK_CLKHF0_CLKPATH_NUM == 0U)) +#ifdef CY_CFG_SYSCLK_CLKPATH1_ENABLED + /* Apply the ClkPath1 user setting */ + Cy_SysClk_ClkPath1Init(); +#endif +#endif + +/* Configure and enable PLLs */ +#ifdef CY_CFG_SYSCLK_PLL0_ENABLED + Cy_SysClk_Pll0Init(); +#endif +#ifdef CY_CFG_SYSCLK_PLL1_ENABLED + Cy_SysClk_Pll1Init(); +#endif +#ifdef CY_CFG_SYSCLK_PLL2_ENABLED + Cy_SysClk_Pll2Init(); +#endif +#ifdef CY_CFG_SYSCLK_PLL3_ENABLED + Cy_SysClk_Pll3Init(); +#endif +#ifdef CY_CFG_SYSCLK_PLL4_ENABLED + Cy_SysClk_Pll4Init(); +#endif +#ifdef CY_CFG_SYSCLK_PLL5_ENABLED + Cy_SysClk_Pll5Init(); +#endif +#ifdef CY_CFG_SYSCLK_PLL6_ENABLED + Cy_SysClk_Pll6Init(); +#endif +#ifdef CY_CFG_SYSCLK_PLL7_ENABLED + Cy_SysClk_Pll7Init(); +#endif +#ifdef CY_CFG_SYSCLK_PLL8_ENABLED + Cy_SysClk_Pll8Init(); +#endif +#ifdef CY_CFG_SYSCLK_PLL9_ENABLED + Cy_SysClk_Pll9Init(); +#endif +#ifdef CY_CFG_SYSCLK_PLL10_ENABLED + Cy_SysClk_Pll10Init(); +#endif +#ifdef CY_CFG_SYSCLK_PLL11_ENABLED + Cy_SysClk_Pll11Init(); +#endif +#ifdef CY_CFG_SYSCLK_PLL12_ENABLED + Cy_SysClk_Pll12Init(); +#endif +#ifdef CY_CFG_SYSCLK_PLL13_ENABLED + Cy_SysClk_Pll13Init(); +#endif +#ifdef CY_CFG_SYSCLK_PLL14_ENABLED + Cy_SysClk_Pll14Init(); +#endif + +/* Configure HF clocks */ +#ifdef CY_CFG_SYSCLK_CLKHF1_ENABLED + Cy_SysClk_ClkHf1Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKHF2_ENABLED + Cy_SysClk_ClkHf2Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKHF3_ENABLED + Cy_SysClk_ClkHf3Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKHF4_ENABLED + Cy_SysClk_ClkHf4Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKHF5_ENABLED + Cy_SysClk_ClkHf5Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKHF6_ENABLED + Cy_SysClk_ClkHf6Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKHF7_ENABLED + Cy_SysClk_ClkHf7Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKHF8_ENABLED + Cy_SysClk_ClkHf8Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKHF9_ENABLED + Cy_SysClk_ClkHf9Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKHF10_ENABLED + Cy_SysClk_ClkHf10Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKHF11_ENABLED + Cy_SysClk_ClkHf11Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKHF12_ENABLED + Cy_SysClk_ClkHf12Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKHF13_ENABLED + Cy_SysClk_ClkHf13Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKHF14_ENABLED + Cy_SysClk_ClkHf14Init(); +#endif +#ifdef CY_CFG_SYSCLK_CLKHF15_ENABLED + Cy_SysClk_ClkHf15Init(); +#endif + + /* Configure miscellaneous clocks */ +#ifdef CY_CFG_SYSCLK_CLKTIMER_ENABLED + Cy_SysClk_ClkTimerInit(); +#endif + +#ifdef CY_CFG_SYSCLK_CLKALTSYSTICK_ENABLED + Cy_SysClk_ClkAltSysTickInit(); +#endif + +#ifdef CY_CFG_SYSCLK_CLKPUMP_ENABLED + Cy_SysClk_ClkPumpInit(); +#endif + +#ifdef CY_CFG_SYSCLK_CLKBAK_ENABLED + Cy_SysClk_ClkBakInit(); +#endif + +/* Configure default enabled clocks */ +#ifdef CY_CFG_SYSCLK_ILO_ENABLED + Cy_SysClk_IloInit(); +#endif + +#ifndef CY_CFG_SYSCLK_IMO_ENABLED +#error the IMO must be enabled for proper chip operation +#endif + +#ifndef CY_CFG_SYSCLK_CLKHF0_ENABLED +#error the CLKHF0 must be enabled for proper chip operation +#endif + +#endif /* defined(CY_DEVICE_SECURE) */ + +#ifdef CY_CFG_SYSCLK_MFO_ENABLED + Cy_SysClk_MfoInit(); +#endif + +#ifdef CY_CFG_SYSCLK_CLKMF_ENABLED + Cy_SysClk_ClkMfInit(); +#endif + +#if (!defined(CY_DEVICE_SECURE)) +/* Set accurate flash wait states */ +#if (defined(CY_CFG_PWR_ENABLED) && defined(CY_CFG_SYSCLK_CLKHF0_ENABLED)) + Cy_SysLib_SetWaitStates(CY_CFG_PWR_USING_ULP != 0, CY_CFG_SYSCLK_CLKHF0_FREQ_MHZ); +#endif + + /* Update System Core Clock values for correct Cy_SysLib_Delay functioning */ + SystemCoreClockUpdate(); +#ifndef CY_CFG_SYSCLK_ILO_ENABLED +#ifdef CY_CFG_SYSCLK_CLKLF_ENABLED + /* Wait 4 ILO cycles in case of unfinished CLKLF clock source transition */ + Cy_SysLib_DelayUs(200U); +#endif + Cy_SysClk_IloDisable(); + Cy_SysClk_IloHibernateOn(false); +#endif + +#endif /* (!defined(CY_DEVICE_SECURE)) */ + +#if defined(CY_CFG_SYSCLK_ECO_PRESCALER_ENABLED) + Cy_SysClk_EcoPrescalerInit(); +#endif // defined(CY_CFG_SYSCLK_ECO_PRESCALER_ENABLED) +} + +void reserve_cycfg_system(void) +{ +#if defined(CY_USING_HAL) + cyhal_hwmgr_reserve(&srss_0_clock_0_pathmux_0_obj); + cyhal_hwmgr_reserve(&srss_0_clock_0_pathmux_1_obj); + cyhal_hwmgr_reserve(&srss_0_clock_0_pathmux_2_obj); + cyhal_hwmgr_reserve(&srss_0_clock_0_pathmux_3_obj); + cyhal_hwmgr_reserve(&srss_0_clock_0_pathmux_4_obj); + cyhal_hwmgr_reserve(&srss_0_clock_0_pathmux_5_obj); +#endif // defined (CY_USING_HAL) +} diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_system.h b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_system.h new file mode 100644 index 00000000000000..0bc3082fa297da --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/cycfg_system.h @@ -0,0 +1,105 @@ +/******************************************************************************* + * File Name: cycfg_system.h + * + * Description: + * System configuration + * This file was automatically generated and should not be modified. + * Configurator Backend 3.10.0 + * device-db 4.100.0.4304 + * mtb-pdl-cat1 3.9.0.29592 + * + ******************************************************************************** + * Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + * + * 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(CYCFG_SYSTEM_H) +#define CYCFG_SYSTEM_H + +#include "cy_pra.h" +#include "cy_pra_cfg.h" +#include "cy_sysclk.h" +#include "cy_systick.h" +#include "cycfg_notices.h" +#if defined(CY_USING_HAL) +#include "cyhal_hwmgr.h" +#endif // defined (CY_USING_HAL) +#include "cy_gpio.h" +#include "cy_syspm.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +#define cpuss_0_dap_0_ENABLED 1U +#define srss_0_clock_0_ENABLED 1U +#define srss_0_clock_0_altsystickclk_0_ENABLED 1U +#define srss_0_clock_0_bakclk_0_ENABLED 1U +#define srss_0_clock_0_fastclk_0_ENABLED 1U +#define srss_0_clock_0_fll_0_ENABLED 1U +#define srss_0_clock_0_hfclk_0_ENABLED 1U +#define CY_CFG_SYSCLK_CLKHF0 0UL +#define CY_CFG_SYSCLK_CLKHF0_CLKPATH_NUM 0UL +#define srss_0_clock_0_ilo_0_ENABLED 1U +#define srss_0_clock_0_imo_0_ENABLED 1U +#define srss_0_clock_0_lfclk_0_ENABLED 1U +#define CY_CFG_SYSCLK_CLKLF_FREQ_HZ 32768 +#define CY_CFG_SYSCLK_CLKLF_SOURCE CY_SYSCLK_CLKLF_IN_WCO +#define srss_0_clock_0_pathmux_0_ENABLED 1U +#define srss_0_clock_0_pathmux_1_ENABLED 1U +#define srss_0_clock_0_pathmux_2_ENABLED 1U +#define srss_0_clock_0_pathmux_3_ENABLED 1U +#define srss_0_clock_0_pathmux_4_ENABLED 1U +#define srss_0_clock_0_pathmux_5_ENABLED 1U +#define srss_0_clock_0_periclk_0_ENABLED 1U +#define srss_0_clock_0_pll_0_ENABLED 1U +#define srss_0_clock_0_slowclk_0_ENABLED 1U +#define srss_0_clock_0_timerclk_0_ENABLED 1U +#define srss_0_clock_0_wco_0_ENABLED 1U +#define srss_0_power_0_ENABLED 1U +#define CY_CFG_PWR_MODE_LP 0x01UL +#define CY_CFG_PWR_MODE_ULP 0x02UL +#define CY_CFG_PWR_MODE_ACTIVE 0x04UL +#define CY_CFG_PWR_MODE_SLEEP 0x08UL +#define CY_CFG_PWR_MODE_DEEPSLEEP 0x10UL +#define CY_CFG_PWR_SYS_IDLE_MODE CY_CFG_PWR_MODE_DEEPSLEEP +#define CY_CFG_PWR_SYS_ACTIVE_MODE CY_CFG_PWR_MODE_LP +#define CY_CFG_PWR_DEEPSLEEP_LATENCY 0UL +#define CY_CFG_PWR_USING_LDO 1 +#define CY_CFG_PWR_VDDA_MV 3300 +#define CY_CFG_PWR_VDDD_MV 3300 +#define CY_CFG_PWR_VBACKUP_MV 3300 +#define CY_CFG_PWR_VDD_NS_MV 3300 +#define CY_CFG_PWR_VDDIO0_MV 3300 +#define CY_CFG_PWR_VDDIO1_MV 3300 + +#if defined(CY_USING_HAL) +extern const cyhal_resource_inst_t srss_0_clock_0_pathmux_0_obj; +extern const cyhal_resource_inst_t srss_0_clock_0_pathmux_1_obj; +extern const cyhal_resource_inst_t srss_0_clock_0_pathmux_2_obj; +extern const cyhal_resource_inst_t srss_0_clock_0_pathmux_3_obj; +extern const cyhal_resource_inst_t srss_0_clock_0_pathmux_4_obj; +extern const cyhal_resource_inst_t srss_0_clock_0_pathmux_5_obj; +#endif // defined (CY_USING_HAL) + +void init_cycfg_system(void); +void reserve_cycfg_system(void); + +#if defined(__cplusplus) +} +#endif + +#endif /* CYCFG_SYSTEM_H */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/qspi_config.cfg b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/qspi_config.cfg new file mode 100644 index 00000000000000..b751dcd0f17ff5 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/GeneratedSource/qspi_config.cfg @@ -0,0 +1,29 @@ +################################################################################ +# File Name: qspi_config.cfg +# +# Description: +# This file contains a SMIF Bank layout for use with OpenOCD. +# This file was automatically generated and should not be modified. +# QSPI Configurator: 4.10.0.1343 +# +################################################################################ +# Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or +# an affiliate of Cypress Semiconductor Corporation. +# SPDX-License-Identifier: Apache-2.0 +# +# 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. +################################################################################ + +set SMIF_BANKS { + 0 {addr 0x18000000 size 0x4000000 psize 0x00000200 esize 0x00040000} +} diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/cy_flash_map.h b/third_party/infineon/psoc6/psoc6_sdk/configs/cy_flash_map.h new file mode 100644 index 00000000000000..89031c0bb4e151 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/cy_flash_map.h @@ -0,0 +1,22 @@ +/* AUTO-GENERATED FILE, DO NOT EDIT. ALL CHANGES WILL BE LOST! */ +/* Platform: PSOC_062_2M */ +#ifndef CY_FLASH_MAP_H +#define CY_FLASH_MAP_H + +static struct flash_area flash_areas[] = { + { .fa_id = FLASH_AREA_BOOTLOADER, .fa_device_id = FLASH_DEVICE_INTERNAL_FLASH, .fa_off = 0x0U, .fa_size = 0x28000U }, + { .fa_id = FLASH_AREA_IMG_1_PRIMARY, .fa_device_id = FLASH_DEVICE_INTERNAL_FLASH, .fa_off = 0x28000U, .fa_size = 0x1c0000U }, + { .fa_id = FLASH_AREA_IMG_1_SECONDARY, + .fa_device_id = FLASH_DEVICE_EXTERNAL_FLASH(CY_BOOT_EXTERNAL_DEVICE_INDEX), + .fa_off = 0x200U, + .fa_size = 0x1c0000U }, + { .fa_id = FLASH_AREA_IMAGE_SWAP_STATUS, .fa_device_id = FLASH_DEVICE_INTERNAL_FLASH, .fa_off = 0x1e8000U, .fa_size = 0x6c00U }, + { .fa_id = FLASH_AREA_IMAGE_SCRATCH, + .fa_device_id = FLASH_DEVICE_EXTERNAL_FLASH(CY_BOOT_EXTERNAL_DEVICE_INDEX), + .fa_off = 0x440000U, + .fa_size = 0x80000U } +}; + +struct flash_area * boot_area_descs[] = { &flash_areas[0U], &flash_areas[1U], &flash_areas[2U], + &flash_areas[3U], &flash_areas[4U], NULL }; +#endif /* CY_FLASH_MAP_H */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/configs/lwipopts.h b/third_party/infineon/psoc6/psoc6_sdk/configs/lwipopts.h index e0701a2cd268ac..5a10a49ce2ef67 100644 --- a/third_party/infineon/psoc6/psoc6_sdk/configs/lwipopts.h +++ b/third_party/infineon/psoc6/psoc6_sdk/configs/lwipopts.h @@ -18,8 +18,8 @@ /** * @file - * Compile-time configuration for LwIP on P6 platforms using the - * P6 SDK. + * Compile-time configuration for LwIP on PSOC6 platforms using the + * PSOC6 SDK. * */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/TARGET_CY8CKIT-062S2-43012 b/third_party/infineon/psoc6/psoc6_sdk/libs/TARGET_CY8CKIT-062S2-43012 index 7f3840aab53ff7..a085cc64ea8edc 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/TARGET_CY8CKIT-062S2-43012 +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/TARGET_CY8CKIT-062S2-43012 @@ -1 +1 @@ -Subproject commit 7f3840aab53ff773c5d95eaedb5aaaae9dd2af45 +Subproject commit a085cc64ea8edc368423b515cecb6787a48e2392 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/abstraction-rtos b/third_party/infineon/psoc6/psoc6_sdk/libs/abstraction-rtos index 23800dd03bf460..ccca0f72d96ef6 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/abstraction-rtos +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/abstraction-rtos @@ -1 +1 @@ -Subproject commit 23800dd03bf46064930127b22f915807cacbc1e7 +Subproject commit ccca0f72d96ef6dcdfe11402b244fdd420ae4792 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/anycloud-ota b/third_party/infineon/psoc6/psoc6_sdk/libs/anycloud-ota deleted file mode 160000 index adc942bb85aa6e..00000000000000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/anycloud-ota +++ /dev/null @@ -1 +0,0 @@ -Subproject commit adc942bb85aa6e43021cbf31454314dbe6038e25 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/bluetooth-freertos b/third_party/infineon/psoc6/psoc6_sdk/libs/bluetooth-freertos deleted file mode 160000 index e0d13d8e1f49f5..00000000000000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/bluetooth-freertos +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e0d13d8e1f49f5522043133856fa268d1a279b32 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/btstack b/third_party/infineon/psoc6/psoc6_sdk/libs/btstack index 205412d987da3f..d8f0984529fd9c 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/btstack +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/btstack @@ -1 +1 @@ -Subproject commit 205412d987da3f397201580ac2f98918d1bb0d57 +Subproject commit d8f0984529fd9cbc84bfbda62eb0f4d25063d630 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/btstack-integration b/third_party/infineon/psoc6/psoc6_sdk/libs/btstack-integration new file mode 160000 index 00000000000000..5e47501ee097ad --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/btstack-integration @@ -0,0 +1 @@ +Subproject commit 5e47501ee097add323be53bc7032fb50e110ad3e diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/cat1cm0p b/third_party/infineon/psoc6/psoc6_sdk/libs/cat1cm0p new file mode 160000 index 00000000000000..ddcdedbccd69b3 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/cat1cm0p @@ -0,0 +1 @@ +Subproject commit ddcdedbccd69b360da108328e689af2b4d6ac8cb diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/clib-support b/third_party/infineon/psoc6/psoc6_sdk/libs/clib-support index 8be98e6512bb03..97cf620d8cde5d 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/clib-support +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/clib-support @@ -1 +1 @@ -Subproject commit 8be98e6512bb03d11780530c35e23cd723a1cd72 +Subproject commit 97cf620d8cde5ded9844f7a2f8e0fe2f0ea65891 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/cmsis b/third_party/infineon/psoc6/psoc6_sdk/libs/cmsis new file mode 160000 index 00000000000000..ce02f641ebc221 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/cmsis @@ -0,0 +1 @@ +Subproject commit ce02f641ebc22103402260f9bb95698fd14086f1 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/connectivity-utilities b/third_party/infineon/psoc6/psoc6_sdk/libs/connectivity-utilities index 25d71a735e2165..3f6ae38680bb85 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/connectivity-utilities +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/connectivity-utilities @@ -1 +1 @@ -Subproject commit 25d71a735e2165e777948469cd68c419fd75b3a5 +Subproject commit 3f6ae38680bb85061829733c8f1037a6299ce6c5 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/core-lib b/third_party/infineon/psoc6/psoc6_sdk/libs/core-lib index 7e6892ee1eeabc..a74be8b06601cb 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/core-lib +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/core-lib @@ -1 +1 @@ -Subproject commit 7e6892ee1eeabc8f6c25fbf02cb00ff43bd3ac73 +Subproject commit a74be8b06601cbd698dc80b1cdad772412c12d04 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/core-make b/third_party/infineon/psoc6/psoc6_sdk/libs/core-make index 251ade90cd5600..b962a1ed157c34 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/core-make +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/core-make @@ -1 +1 @@ -Subproject commit 251ade90cd56005369ced67cf0583171783b1cd1 +Subproject commit b962a1ed157c34ee24ab7002dadcc39276dd5218 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/freertos b/third_party/infineon/psoc6/psoc6_sdk/libs/freertos index eec60193e7f5d4..c2c8a9b26fd8b3 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/freertos +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/freertos @@ -1 +1 @@ -Subproject commit eec60193e7f5d4e239bc9c8e6c0c6e88eb3ecdb4 +Subproject commit c2c8a9b26fd8b33d9f08e66c85dd3cae4610acef diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/kv-store b/third_party/infineon/psoc6/psoc6_sdk/libs/kv-store index c81d0a32cb8301..9a75a83d22583c 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/kv-store +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/kv-store @@ -1 +1 @@ -Subproject commit c81d0a32cb8301b307b9e32c126bf1a1f6465fbb +Subproject commit 9a75a83d22583c83b862b4118ee13a20e38af8ac diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/lwip b/third_party/infineon/psoc6/psoc6_sdk/libs/lwip index bef26c44236a07..159e31b689577d 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/lwip +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/lwip @@ -1 +1 @@ -Subproject commit bef26c44236a078d4352e76392ef16f019bea501 +Subproject commit 159e31b689577dbf69cf0683bbaffbd71fa5ee10 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/lwip-network-interface-integration b/third_party/infineon/psoc6/psoc6_sdk/libs/lwip-network-interface-integration index 9e1660130f6113..683110fbb75965 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/lwip-network-interface-integration +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/lwip-network-interface-integration @@ -1 +1 @@ -Subproject commit 9e1660130f611364c8772bc01147ddb2916c8d8d +Subproject commit 683110fbb7596507e9b61fd1c83510cb3b35d805 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/mtb-hal-cat1 b/third_party/infineon/psoc6/psoc6_sdk/libs/mtb-hal-cat1 index 708a6b2542f0d8..4090e1aec69137 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/mtb-hal-cat1 +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/mtb-hal-cat1 @@ -1 +1 @@ -Subproject commit 708a6b2542f0d8814c129a3141e78fd265826a0b +Subproject commit 4090e1aec69137fe80423eabe4558d9291dbe9d2 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/mtb-pdl-cat1 b/third_party/infineon/psoc6/psoc6_sdk/libs/mtb-pdl-cat1 index 3c6aebd2f3238b..96bbf1928e6b99 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/mtb-pdl-cat1 +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/mtb-pdl-cat1 @@ -1 +1 @@ -Subproject commit 3c6aebd2f3238b578329bfb8a6c5a0e138bd5c7b +Subproject commit 96bbf1928e6b99feec4451c6011403aaabf4c08d diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/ota-bootloader-abstraction b/third_party/infineon/psoc6/psoc6_sdk/libs/ota-bootloader-abstraction new file mode 160000 index 00000000000000..472c6455f74a64 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/ota-bootloader-abstraction @@ -0,0 +1 @@ +Subproject commit 472c6455f74a643f1894fc5d111cf7838c89ad2d diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/ota-update b/third_party/infineon/psoc6/psoc6_sdk/libs/ota-update new file mode 160000 index 00000000000000..d7da5cc50fc31d --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/ota-update @@ -0,0 +1 @@ +Subproject commit d7da5cc50fc31d525b9bc7324989b5cbb330644c diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/psoc6cm0p b/third_party/infineon/psoc6/psoc6_sdk/libs/psoc6cm0p deleted file mode 160000 index 65569574830d3e..00000000000000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/psoc6cm0p +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 65569574830d3eef29fb9a0f1060eb0885063b56 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/recipe-make-cat1a b/third_party/infineon/psoc6/psoc6_sdk/libs/recipe-make-cat1a index 656d8c5b4fbd1e..0446103a230b44 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/recipe-make-cat1a +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/recipe-make-cat1a @@ -1 +1 @@ -Subproject commit 656d8c5b4fbd1e20190315ffb6a64ae151f627c9 +Subproject commit 0446103a230b44aa972a028bbe31591c4744e85f diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/retarget-io b/third_party/infineon/psoc6/psoc6_sdk/libs/retarget-io index a61cd7c5f4b280..db7f9627c81f3d 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/retarget-io +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/retarget-io @@ -1 +1 @@ -Subproject commit a61cd7c5f4b2808c949248f05287c09e6578abfc +Subproject commit db7f9627c81f3d54401cf4aaf7f5ddf21ceda326 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/secure-sockets b/third_party/infineon/psoc6/psoc6_sdk/libs/secure-sockets index f7508f942e1c25..3627168abbed91 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/secure-sockets +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/secure-sockets @@ -1 +1 @@ -Subproject commit f7508f942e1c25f74f5317422ed8289b2b930cb1 +Subproject commit 3627168abbed91f8df3f1d6e41a37ad918fffdfc diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/serial-flash b/third_party/infineon/psoc6/psoc6_sdk/libs/serial-flash index c7b55aa5406e6d..9830481016731e 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/serial-flash +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/serial-flash @@ -1 +1 @@ -Subproject commit c7b55aa5406e6da9954f60e5f5460b71cd220ef2 +Subproject commit 9830481016731e3953996a7b118c84f7f46baa1e diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/whd-bsp-integration b/third_party/infineon/psoc6/psoc6_sdk/libs/whd-bsp-integration index c180a141838d02..0bdf13bafdcd19 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/whd-bsp-integration +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/whd-bsp-integration @@ -1 +1 @@ -Subproject commit c180a141838d02aea52f86967772f8216fc15a18 +Subproject commit 0bdf13bafdcd190c8eade52e03af676b163ac6d0 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/wifi-connection-manager b/third_party/infineon/psoc6/psoc6_sdk/libs/wifi-connection-manager index 2567493ff15459..8602aabdfff9ed 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/wifi-connection-manager +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/wifi-connection-manager @@ -1 +1 @@ -Subproject commit 2567493ff1545989e24f6415254a70d24b7a76e6 +Subproject commit 8602aabdfff9edbaeacfd8ee09461ff81e363064 diff --git a/third_party/infineon/psoc6/psoc6_sdk/libs/wifi-host-driver b/third_party/infineon/psoc6/psoc6_sdk/libs/wifi-host-driver index 919d9213128860..04ee318cc96bff 160000 --- a/third_party/infineon/psoc6/psoc6_sdk/libs/wifi-host-driver +++ b/third_party/infineon/psoc6/psoc6_sdk/libs/wifi-host-driver @@ -1 +1 @@ -Subproject commit 919d921312886057411efcf2271c99296f87afb8 +Subproject commit 04ee318cc96bffa7d69a1e076c008e2364453f82 diff --git a/third_party/infineon/psoc6/psoc6_sdk/ota/bootutil/bootutil.h b/third_party/infineon/psoc6/psoc6_sdk/ota/bootutil/bootutil.h new file mode 100644 index 00000000000000..ff94964158ef3d --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/ota/bootutil/bootutil.h @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 H_BOOTUTIL_ +#define H_BOOTUTIL_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Attempt to boot the contents of the primary slot. */ +#define BOOT_SWAP_TYPE_NONE 1 + +/** + * Swap to the secondary slot. + * Absent a confirm command, revert back on next boot. + */ +#define BOOT_SWAP_TYPE_TEST 2 + +/** + * Swap to the secondary slot, + * and permanently switch to booting its contents. + */ +#define BOOT_SWAP_TYPE_PERM 3 + +/** Swap back to alternate slot. A confirm changes this state to NONE. */ +#define BOOT_SWAP_TYPE_REVERT 4 + +/** Swap failed because image to be run is not valid */ +#define BOOT_SWAP_TYPE_FAIL 5 + +/** Swapping encountered an unrecoverable error */ +#define BOOT_SWAP_TYPE_PANIC 0xff + +#define BOOT_MAX_ALIGN 8 + +/* This is not actually used by mcuboot's code but can be used by apps + * when attempting to read/write a trailer. + */ +struct image_trailer +{ + uint8_t swap_type; + uint8_t pad1[BOOT_MAX_ALIGN - 1]; + uint8_t copy_done; + uint8_t pad2[BOOT_MAX_ALIGN - 1]; + uint8_t image_ok; + uint8_t pad3[BOOT_MAX_ALIGN - 1]; + uint8_t magic[16]; +}; + +int boot_swap_type_multi(int image_index); +int boot_swap_type(void); + +int boot_set_pending(int image, int permanent); +int boot_set_confirmed(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/third_party/infineon/psoc6/psoc6_sdk/ota/bootutil/bootutil_log.h b/third_party/infineon/psoc6/psoc6_sdk/ota/bootutil/bootutil_log.h new file mode 100644 index 00000000000000..02f15f063949b9 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/ota/bootutil/bootutil_log.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2017 Linaro Limited + * + * 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 H_BOOTUTIL_LOG_H_ +#define H_BOOTUTIL_LOG_H_ + +#include "ignore.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#if 1 // def MCUBOOT_HAVE_LOGGING + +#define BOOT_LOG_ERR(...) MCUBOOT_LOG_ERR(__VA_ARGS__) +#define BOOT_LOG_WRN(...) MCUBOOT_LOG_WRN(__VA_ARGS__) +#define BOOT_LOG_INF(...) MCUBOOT_LOG_INF(__VA_ARGS__) +#define BOOT_LOG_DBG(...) MCUBOOT_LOG_DBG(__VA_ARGS__) + +#else + +#define BOOT_LOG_ERR(...) IGNORE(__VA_ARGS__) +#define BOOT_LOG_WRN(...) IGNORE(__VA_ARGS__) +#define BOOT_LOG_INF(...) IGNORE(__VA_ARGS__) +#define BOOT_LOG_DBG(...) IGNORE(__VA_ARGS__) + +#endif /* MCUBOOT_HAVE_LOGGING */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/third_party/infineon/psoc6/psoc6_sdk/ota/bootutil/ignore.h b/third_party/infineon/psoc6/psoc6_sdk/ota/bootutil/ignore.h new file mode 100644 index 00000000000000..64d519e7baa770 --- /dev/null +++ b/third_party/infineon/psoc6/psoc6_sdk/ota/bootutil/ignore.h @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 H_IGNORE_ +#define H_IGNORE_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * These macros prevent the "set but not used" warnings for log writes below + * the log level. + */ + +#define IGN_1(X) ((void) (X)) +#define IGN_2(X, ...) \ + ((void) (X)); \ + IGN_1(__VA_ARGS__) +#define IGN_3(X, ...) \ + ((void) (X)); \ + IGN_2(__VA_ARGS__) +#define IGN_4(X, ...) \ + ((void) (X)); \ + IGN_3(__VA_ARGS__) +#define IGN_5(X, ...) \ + ((void) (X)); \ + IGN_4(__VA_ARGS__) +#define IGN_6(X, ...) \ + ((void) (X)); \ + IGN_5(__VA_ARGS__) +#define IGN_7(X, ...) \ + ((void) (X)); \ + IGN_6(__VA_ARGS__) +#define IGN_8(X, ...) \ + ((void) (X)); \ + IGN_7(__VA_ARGS__) +#define IGN_9(X, ...) \ + ((void) (X)); \ + IGN_8(__VA_ARGS__) +#define IGN_10(X, ...) \ + ((void) (X)); \ + IGN_9(__VA_ARGS__) +#define IGN_11(X, ...) \ + ((void) (X)); \ + IGN_10(__VA_ARGS__) +#define IGN_12(X, ...) \ + ((void) (X)); \ + IGN_11(__VA_ARGS__) +#define IGN_13(X, ...) \ + ((void) (X)); \ + IGN_12(__VA_ARGS__) +#define IGN_14(X, ...) \ + ((void) (X)); \ + IGN_13(__VA_ARGS__) +#define IGN_15(X, ...) \ + ((void) (X)); \ + IGN_14(__VA_ARGS__) +#define IGN_16(X, ...) \ + ((void) (X)); \ + IGN_15(__VA_ARGS__) +#define IGN_17(X, ...) \ + ((void) (X)); \ + IGN_16(__VA_ARGS__) +#define IGN_18(X, ...) \ + ((void) (X)); \ + IGN_17(__VA_ARGS__) +#define IGN_19(X, ...) \ + ((void) (X)); \ + IGN_18(__VA_ARGS__) +#define IGN_20(X, ...) \ + ((void) (X)); \ + IGN_19(__VA_ARGS__) + +#define GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, NAME, ...) NAME +#define IGNORE(...) \ + GET_MACRO(__VA_ARGS__, IGN_20, IGN_19, IGN_18, IGN_17, IGN_16, IGN_15, IGN_14, IGN_13, IGN_12, IGN_11, IGN_10, IGN_9, IGN_8, \ + IGN_7, IGN_6, IGN_5, IGN_4, IGN_3, IGN_2, IGN_1) \ + (__VA_ARGS__) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/third_party/infineon/psoc6/psoc6_sdk/ota/config/mcuboot_config/mcuboot_assert.h b/third_party/infineon/psoc6/psoc6_sdk/ota/config/mcuboot_config/mcuboot_assert.h deleted file mode 100644 index 15a69555516030..00000000000000 --- a/third_party/infineon/psoc6/psoc6_sdk/ota/config/mcuboot_config/mcuboot_assert.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * mcuboot_assert.h - * - * Cypress-specific assert() macro redefinition - * - */ - -#ifndef MCUBOOT_ASSERT_H -#define MCUBOOT_ASSERT_H - -#define CYBL_ASSERT(...) Cy_BLServ_Assert(__VA_ARGS__) - -#if !defined(NDEBUG) -#undef assert -#define assert(...) CYBL_ASSERT(__VA_ARGS__) -#else -#define assert -#endif - -#endif /* MCUBOOT_ASSERT_H */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/ota/config/mcuboot_config/mcuboot_config.h b/third_party/infineon/psoc6/psoc6_sdk/ota/config/mcuboot_config/mcuboot_config.h deleted file mode 100644 index 6b11d855ca1d04..00000000000000 --- a/third_party/infineon/psoc6/psoc6_sdk/ota/config/mcuboot_config/mcuboot_config.h +++ /dev/null @@ -1,151 +0,0 @@ -/* Copyright 2019 Cypress Semiconductor Corporation - * - * Copyright (c) 2018 Open Source Foundries Limited - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef MCUBOOT_CONFIG_H -#define MCUBOOT_CONFIG_H - -/* - * Template configuration file for MCUboot. - * - * When porting MCUboot to a new target, copy it somewhere that your - * include path can find it as mcuboot_config/mcuboot_config.h, and - * make adjustments to suit your platform. - * - * For examples, see: - * - * boot/zephyr/include/mcuboot_config/mcuboot_config.h - * boot/mynewt/mcuboot_config/include/mcuboot_config/mcuboot_config.h - */ -/* Default maximum number of flash sectors per image slot; change - * as desirable. */ -#ifndef MCUBOOT_MAX_IMG_SECTORS -#define MCUBOOT_MAX_IMG_SECTORS 128 -#endif - -/* - * Signature types - * - * You must choose exactly one signature type. - */ - -/* Uncomment for RSA signature support */ -//#define MCUBOOT_SIGN_RSA - -/* Uncomment for ECDSA signatures using curve P-256. */ -//#define MCUBOOT_SIGN_EC256 -//#define NUM_ECC_BYTES (256 / 8) // P-256 curve size in bytes, rnok: to make compilable - -// #define MCUBOOT_SIGN_EC - -/* - * Upgrade mode - * - * The default is to support A/B image swapping with rollback. A - * simpler code path, which only supports overwriting the - * existing image with the update image, is also available. - */ -#ifdef MCUBOOT_OVERWRITE_ONLY -/* Uncomment to only erase and overwrite those slot 0 sectors needed - * to install the new image, rather than the entire image slot. */ -/* #define MCUBOOT_OVERWRITE_ONLY_FAST */ -#else -/* Using SWAP w Scratch by default. - * Comment/Uncomment which is needed. */ -/* #define MCUBOOT_SWAP_USING_SCRATCH 1 */ -/* #define MCUBOOT_SWAP_USING_MOVE 1 */ -#define MCUBOOT_SWAP_USING_STATUS 1 -#endif - -/* - * Cryptographic settings - * - * You must choose between mbedTLS and Tinycrypt as source of - * cryptographic primitives. Other cryptographic settings are also - * available. - */ - -/* Uncomment to use ARM's mbedTLS cryptographic primitives */ -#define MCUBOOT_USE_MBED_TLS -/* Uncomment to use Tinycrypt's. */ -/* #define MCUBOOT_USE_TINYCRYPT */ - -/* - * Always check the signature of the image in slot 0 before booting, - * even if no upgrade was performed. This is recommended if the boot - * time penalty is acceptable. - */ -//#define MCUBOOT_VALIDATE_PRIMARY_SLOT - -/* - * Flash abstraction - */ - -/* Uncomment if your flash map API supports flash_area_get_sectors(). - * See the flash APIs for more details. */ -// TODO: FWSECURITY-755 -#define MCUBOOT_USE_FLASH_AREA_GET_SECTORS - -/* Default number of separately updateable images; change in case of - * multiple images. */ -#ifndef MCUBOOT_IMAGE_NUMBER -#define MCUBOOT_IMAGE_NUMBER 1 -#endif - -/* - * Logging - */ - -/* - * If logging is enabled the following functions must be defined by the - * platform: - * - * MCUBOOT_LOG_ERR(...) - * MCUBOOT_LOG_WRN(...) - * MCUBOOT_LOG_INF(...) - * MCUBOOT_LOG_DBG(...) - * - * The following global logging level configuration macros must also be - * defined, each with a unique value. Those will be used to define a global - * configuration and will allow any source files to override the global - * configuration: - * - * MCUBOOT_LOG_LEVEL_OFF - * MCUBOOT_LOG_LEVEL_ERROR - * MCUBOOT_LOG_LEVEL_WARNING - * MCUBOOT_LOG_LEVEL_INFO - * MCUBOOT_LOG_LEVEL_DEBUG - * - * The global logging level must be defined, with one of the previously defined - * logging levels: - * - * #define MCUBOOT_LOG_LEVEL MCUBOOT_LOG_LEVEL_(OFF|ERROR|WARNING|INFO|DEBUG) - * - * MCUBOOT_LOG_LEVEL sets the minimum level that will be logged. The function - * priority is: - * - * MCUBOOT_LOG_ERR > MCUBOOT_LOG_WRN > MCUBOOT_LOG_INF > MCUBOOT_LOG_DBG - * - * NOTE: Each source file is still able to request its own logging level by - * defining BOOT_LOG_LEVEL before #including `bootutil_log.h` - */ -#define MCUBOOT_HAVE_LOGGING 1 - -/* - * Assertions - */ - -/* Uncomment if your platform has its own mcuboot_config/mcuboot_assert.h. - * If so, it must provide an ASSERT macro for use by bootutil. Otherwise, - * "assert" is used. */ -//#define MCUBOOT_HAVE_ASSERT_H - -#define MCUBOOT_WATCHDOG_FEED() \ - do \ - { \ - /* TODO: to be implemented */ \ - } while (0) - -#endif /* MCUBOOT_CONFIG_H */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/ota/config/mcuboot_config/mcuboot_logging.h b/third_party/infineon/psoc6/psoc6_sdk/ota/config/mcuboot_config/mcuboot_logging.h deleted file mode 100644 index 35424b4c5ad96d..00000000000000 --- a/third_party/infineon/psoc6/psoc6_sdk/ota/config/mcuboot_config/mcuboot_logging.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2018 Nordic Semiconductor ASA - * Copyright (c) 2015 Runtime Inc - * Copyright (c) 2020 Cypress Semiconductor Corporation - * - * SPDX-License-Identifier: Apache-2.0 - */ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 MCUBOOT_LOGGING_H -#define MCUBOOT_LOGGING_H - -#include - -#define MCUBOOT_LOG_LEVEL_OFF 0 -#define MCUBOOT_LOG_LEVEL_ERROR 1 -#define MCUBOOT_LOG_LEVEL_WARNING 2 -#define MCUBOOT_LOG_LEVEL_INFO 3 -#define MCUBOOT_LOG_LEVEL_DEBUG 4 - -/* - * The compiled log level determines the maximum level that can be - * printed. Messages at or below this level can be printed, provided - * they are also enabled through the Rust logging system, such as by - * setting RUST_LOG to bootsim::api=info. - */ -#ifndef MCUBOOT_LOG_LEVEL -#define MCUBOOT_LOG_LEVEL MCUBOOT_LOG_LEVEL_INFO -#endif - -int sim_log_enabled(int level); - -#define sim_log_enabled(x) 1 - -#if MCUBOOT_LOG_LEVEL >= MCUBOOT_LOG_LEVEL_ERROR -#define MCUBOOT_LOG_ERR(_fmt, ...) \ - do \ - { \ - if (sim_log_enabled(MCUBOOT_LOG_LEVEL_ERROR)) \ - { \ - fprintf(stderr, "[ERR] " _fmt "\n\r", ##__VA_ARGS__); \ - } \ - } while (0) -#else -#define MCUBOOT_LOG_ERR(...) IGNORE(__VA_ARGS__) -#endif - -#if MCUBOOT_LOG_LEVEL >= MCUBOOT_LOG_LEVEL_WARNING -#define MCUBOOT_LOG_WRN(_fmt, ...) \ - do \ - { \ - if (sim_log_enabled(MCUBOOT_LOG_LEVEL_WARNING)) \ - { \ - fprintf(stderr, "[WRN] " _fmt "\n\r", ##__VA_ARGS__); \ - } \ - } while (0) -#else -#define MCUBOOT_LOG_WRN(...) IGNORE(__VA_ARGS__) -#endif - -#if MCUBOOT_LOG_LEVEL >= MCUBOOT_LOG_LEVEL_INFO -#define MCUBOOT_LOG_INF(_fmt, ...) \ - do \ - { \ - if (sim_log_enabled(MCUBOOT_LOG_LEVEL_INFO)) \ - { \ - fprintf(stderr, "[INF] " _fmt "\n\r", ##__VA_ARGS__); \ - } \ - } while (0) -#else -#define MCUBOOT_LOG_INF(...) IGNORE(__VA_ARGS__) -#endif - -#if MCUBOOT_LOG_LEVEL >= MCUBOOT_LOG_LEVEL_DEBUG -#define MCUBOOT_LOG_DBG(_fmt, ...) \ - do \ - { \ - if (sim_log_enabled(MCUBOOT_LOG_LEVEL_DEBUG)) \ - { \ - fprintf(stderr, "[DBG] " _fmt "\n\r", ##__VA_ARGS__); \ - } \ - } while (0) -#else -#define MCUBOOT_LOG_DBG(...) IGNORE(__VA_ARGS__) -#endif - -#define MCUBOOT_LOG_MODULE_DECLARE(...) - -#endif /* MCUBOOT_LOGGING_H */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/ota/config/mcuboot_crypto_acc_config.h b/third_party/infineon/psoc6/psoc6_sdk/ota/config/mcuboot_crypto_acc_config.h deleted file mode 100644 index 2bf440a549bc49..00000000000000 --- a/third_party/infineon/psoc6/psoc6_sdk/ota/config/mcuboot_crypto_acc_config.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * mbed Microcontroller Library - * Copyright (c) 2019 Cypress Semiconductor Corporation - * - * 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 mcuboot_crypto_acc_config.h - * \version 1.1 - */ - -#ifndef MCUBOOT_MBEDTLS_DEVICE_H -#define MCUBOOT_MBEDTLS_DEVICE_H - -/* Currently this target supports SHA1 */ -// #define MBEDTLS_SHA1_C - -#define MBEDTLS_SHA1_ALT -#define MBEDTLS_SHA256_ALT -#define MBEDTLS_SHA512_ALT - -/* Currently this target supports CBC, CFB, OFB, CTR and XTS cipher modes */ -#define MBEDTLS_AES_ALT -// #define MBEDTLS_CIPHER_MODE_CBC -// #define MBEDTLS_CIPHER_MODE_CFB -// #define MBEDTLS_CIPHER_MODE_OFB -// #define MBEDTLS_CIPHER_MODE_CTR -// #define MBEDTLS_CIPHER_MODE_XTS - -/* Only NIST-P curves are currently supported */ -#define MBEDTLS_ECP_ALT -// #define MBEDTLS_ECP_DP_SECP192R1_ENABLED -// #define MBEDTLS_ECP_DP_SECP224R1_ENABLED -// #define MBEDTLS_ECP_DP_SECP256R1_ENABLED -// #define MBEDTLS_ECP_DP_SECP384R1_ENABLED -// #define MBEDTLS_ECP_DP_SECP521R1_ENABLED - -#define MBEDTLS_ECDSA_SIGN_ALT -#define MBEDTLS_ECDSA_VERIFY_ALT - -#endif /* MCUBOOT_MBEDTLS_DEVICE_H */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/ota/config/mcuboot_crypto_config.h b/third_party/infineon/psoc6/psoc6_sdk/ota/config/mcuboot_crypto_config.h deleted file mode 100644 index 4f0f7d383b4bc4..00000000000000 --- a/third_party/infineon/psoc6/psoc6_sdk/ota/config/mcuboot_crypto_config.h +++ /dev/null @@ -1,3606 +0,0 @@ -/** - * \file config.h - * - * \brief Configuration options (set of defines) - * - * This set of compile-time options may be used to enable - * or disable features selectively, and reduce the global - * memory footprint. - */ -/* - * Copyright (C) 2006-2018, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 - * - * 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 is part of mbed TLS (https://tls.mbed.org) - */ - -#ifndef MBEDTLS_CONFIG_H -#define MBEDTLS_CONFIG_H - -#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) -#define _CRT_SECURE_NO_DEPRECATE 1 -#endif - -/** - * \name SECTION: System support - * - * This section sets system specific settings. - * \{ - */ - -/** - * \def MBEDTLS_HAVE_ASM - * - * The compiler has support for asm(). - * - * Requires support for asm() in compiler. - * - * Used in: - * library/aria.c - * library/timing.c - * include/mbedtls/bn_mul.h - * - * Required by: - * MBEDTLS_AESNI_C - * MBEDTLS_PADLOCK_C - * - * Comment to disable the use of assembly code. - */ -#define MBEDTLS_HAVE_ASM - -/** - * \def MBEDTLS_NO_UDBL_DIVISION - * - * The platform lacks support for double-width integer division (64-bit - * division on a 32-bit platform, 128-bit division on a 64-bit platform). - * - * Used in: - * include/mbedtls/bignum.h - * library/bignum.c - * - * The bignum code uses double-width division to speed up some operations. - * Double-width division is often implemented in software that needs to - * be linked with the program. The presence of a double-width integer - * type is usually detected automatically through preprocessor macros, - * but the automatic detection cannot know whether the code needs to - * and can be linked with an implementation of division for that type. - * By default division is assumed to be usable if the type is present. - * Uncomment this option to prevent the use of double-width division. - * - * Note that division for the native integer type is always required. - * Furthermore, a 64-bit type is always required even on a 32-bit - * platform, but it need not support multiplication or division. In some - * cases it is also desirable to disable some double-width operations. For - * example, if double-width division is implemented in software, disabling - * it can reduce code size in some embedded targets. - */ -//#define MBEDTLS_NO_UDBL_DIVISION - -/** - * \def MBEDTLS_NO_64BIT_MULTIPLICATION - * - * The platform lacks support for 32x32 -> 64-bit multiplication. - * - * Used in: - * library/poly1305.c - * - * Some parts of the library may use multiplication of two unsigned 32-bit - * operands with a 64-bit result in order to speed up computations. On some - * platforms, this is not available in hardware and has to be implemented in - * software, usually in a library provided by the toolchain. - * - * Sometimes it is not desirable to have to link to that library. This option - * removes the dependency of that library on platforms that lack a hardware - * 64-bit multiplier by embedding a software implementation in Mbed TLS. - * - * Note that depending on the compiler, this may decrease performance compared - * to using the library function provided by the toolchain. - */ -//#define MBEDTLS_NO_64BIT_MULTIPLICATION - -/** - * \def MBEDTLS_HAVE_SSE2 - * - * CPU supports SSE2 instruction set. - * - * Uncomment if the CPU supports SSE2 (IA-32 specific). - */ -//#define MBEDTLS_HAVE_SSE2 - -/** - * \def MBEDTLS_HAVE_TIME - * - * System has time.h and time(). - * The time does not need to be correct, only time differences are used, - * by contrast with MBEDTLS_HAVE_TIME_DATE - * - * Defining MBEDTLS_HAVE_TIME allows you to specify MBEDTLS_PLATFORM_TIME_ALT, - * MBEDTLS_PLATFORM_TIME_MACRO, MBEDTLS_PLATFORM_TIME_TYPE_MACRO and - * MBEDTLS_PLATFORM_STD_TIME. - * - * Comment if your system does not support time functions - */ -#define MBEDTLS_HAVE_TIME - -/** - * \def MBEDTLS_HAVE_TIME_DATE - * - * System has time.h, time(), and an implementation for - * mbedtls_platform_gmtime_r() (see below). - * The time needs to be correct (not necessarily very accurate, but at least - * the date should be correct). This is used to verify the validity period of - * X.509 certificates. - * - * Comment if your system does not have a correct clock. - * - * \note mbedtls_platform_gmtime_r() is an abstraction in platform_util.h that - * behaves similarly to the gmtime_r() function from the C standard. Refer to - * the documentation for mbedtls_platform_gmtime_r() for more information. - * - * \note It is possible to configure an implementation for - * mbedtls_platform_gmtime_r() at compile-time by using the macro - * MBEDTLS_PLATFORM_GMTIME_R_ALT. - */ -#define MBEDTLS_HAVE_TIME_DATE - -/** - * \def MBEDTLS_PLATFORM_MEMORY - * - * Enable the memory allocation layer. - * - * By default mbed TLS uses the system-provided calloc() and free(). - * This allows different allocators (self-implemented or provided) to be - * provided to the platform abstraction layer. - * - * Enabling MBEDTLS_PLATFORM_MEMORY without the - * MBEDTLS_PLATFORM_{FREE,CALLOC}_MACROs will provide - * "mbedtls_platform_set_calloc_free()" allowing you to set an alternative calloc() and - * free() function pointer at runtime. - * - * Enabling MBEDTLS_PLATFORM_MEMORY and specifying - * MBEDTLS_PLATFORM_{CALLOC,FREE}_MACROs will allow you to specify the - * alternate function at compile time. - * - * Requires: MBEDTLS_PLATFORM_C - * - * Enable this layer to allow use of alternative memory allocators. - */ -//#define MBEDTLS_PLATFORM_MEMORY - -/** - * \def MBEDTLS_PLATFORM_NO_STD_FUNCTIONS - * - * Do not assign standard functions in the platform layer (e.g. calloc() to - * MBEDTLS_PLATFORM_STD_CALLOC and printf() to MBEDTLS_PLATFORM_STD_PRINTF) - * - * This makes sure there are no linking errors on platforms that do not support - * these functions. You will HAVE to provide alternatives, either at runtime - * via the platform_set_xxx() functions or at compile time by setting - * the MBEDTLS_PLATFORM_STD_XXX defines, or enabling a - * MBEDTLS_PLATFORM_XXX_MACRO. - * - * Requires: MBEDTLS_PLATFORM_C - * - * Uncomment to prevent default assignment of standard functions in the - * platform layer. - */ -//#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS - -/** - * \def MBEDTLS_PLATFORM_EXIT_ALT - * - * MBEDTLS_PLATFORM_XXX_ALT: Uncomment a macro to let mbed TLS support the - * function in the platform abstraction layer. - * - * Example: In case you uncomment MBEDTLS_PLATFORM_PRINTF_ALT, mbed TLS will - * provide a function "mbedtls_platform_set_printf()" that allows you to set an - * alternative printf function pointer. - * - * All these define require MBEDTLS_PLATFORM_C to be defined! - * - * \note MBEDTLS_PLATFORM_SNPRINTF_ALT is required on Windows; - * it will be enabled automatically by check_config.h - * - * \warning MBEDTLS_PLATFORM_XXX_ALT cannot be defined at the same time as - * MBEDTLS_PLATFORM_XXX_MACRO! - * - * Requires: MBEDTLS_PLATFORM_TIME_ALT requires MBEDTLS_HAVE_TIME - * - * Uncomment a macro to enable alternate implementation of specific base - * platform function - */ -//#define MBEDTLS_PLATFORM_EXIT_ALT -//#define MBEDTLS_PLATFORM_TIME_ALT -//#define MBEDTLS_PLATFORM_FPRINTF_ALT -//#define MBEDTLS_PLATFORM_PRINTF_ALT -//#define MBEDTLS_PLATFORM_SNPRINTF_ALT -//#define MBEDTLS_PLATFORM_VSNPRINTF_ALT -//#define MBEDTLS_PLATFORM_NV_SEED_ALT -//#define MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT - -/** - * \def MBEDTLS_DEPRECATED_WARNING - * - * Mark deprecated functions so that they generate a warning if used. - * Functions deprecated in one version will usually be removed in the next - * version. You can enable this to help you prepare the transition to a new - * major version by making sure your code is not using these functions. - * - * This only works with GCC and Clang. With other compilers, you may want to - * use MBEDTLS_DEPRECATED_REMOVED - * - * Uncomment to get warnings on using deprecated functions. - */ -//#define MBEDTLS_DEPRECATED_WARNING - -/** - * \def MBEDTLS_DEPRECATED_REMOVED - * - * Remove deprecated functions so that they generate an error if used. - * Functions deprecated in one version will usually be removed in the next - * version. You can enable this to help you prepare the transition to a new - * major version by making sure your code is not using these functions. - * - * Uncomment to get errors on using deprecated functions. - */ -//#define MBEDTLS_DEPRECATED_REMOVED - -/** - * \def MBEDTLS_CHECK_PARAMS - * - * This configuration option controls whether the library validates more of - * the parameters passed to it. - * - * When this flag is not defined, the library only attempts to validate an - * input parameter if: (1) they may come from the outside world (such as the - * network, the filesystem, etc.) or (2) not validating them could result in - * internal memory errors such as overflowing a buffer controlled by the - * library. On the other hand, it doesn't attempt to validate parameters whose - * values are fully controlled by the application (such as pointers). - * - * When this flag is defined, the library additionally attempts to validate - * parameters that are fully controlled by the application, and should always - * be valid if the application code is fully correct and trusted. - * - * For example, when a function accepts as input a pointer to a buffer that may - * contain untrusted data, and its documentation mentions that this pointer - * must not be NULL: - * - The pointer is checked to be non-NULL only if this option is enabled. - * - The content of the buffer is always validated. - * - * When this flag is defined, if a library function receives a parameter that - * is invalid: - * 1. The function will invoke the macro MBEDTLS_PARAM_FAILED(). - * 2. If MBEDTLS_PARAM_FAILED() did not terminate the program, the function - * will immediately return. If the function returns an Mbed TLS error code, - * the error code in this case is MBEDTLS_ERR_xxx_BAD_INPUT_DATA. - * - * When defining this flag, you also need to arrange a definition for - * MBEDTLS_PARAM_FAILED(). You can do this by any of the following methods: - * - By default, the library defines MBEDTLS_PARAM_FAILED() to call a - * function mbedtls_param_failed(), but the library does not define this - * function. If you do not make any other arrangements, you must provide - * the function mbedtls_param_failed() in your application. - * See `platform_util.h` for its prototype. - * - If you enable the macro #MBEDTLS_CHECK_PARAMS_ASSERT, then the - * library defines MBEDTLS_PARAM_FAILED(\c cond) to be `assert(cond)`. - * You can still supply an alternative definition of - * MBEDTLS_PARAM_FAILED(), which may call `assert`. - * - If you define a macro MBEDTLS_PARAM_FAILED() before including `config.h` - * or you uncomment the definition of MBEDTLS_PARAM_FAILED() in `config.h`, - * the library will call the macro that you defined and will not supply - * its own version. Note that if MBEDTLS_PARAM_FAILED() calls `assert`, - * you need to enable #MBEDTLS_CHECK_PARAMS_ASSERT so that library source - * files include ``. - * - * Uncomment to enable validation of application-controlled parameters. - */ -//#define MBEDTLS_CHECK_PARAMS - -/** - * \def MBEDTLS_CHECK_PARAMS_ASSERT - * - * Allow MBEDTLS_PARAM_FAILED() to call `assert`, and make it default to - * `assert`. This macro is only used if #MBEDTLS_CHECK_PARAMS is defined. - * - * If this macro is not defined, then MBEDTLS_PARAM_FAILED() defaults to - * calling a function mbedtls_param_failed(). See the documentation of - * #MBEDTLS_CHECK_PARAMS for details. - * - * Uncomment to allow MBEDTLS_PARAM_FAILED() to call `assert`. - */ -//#define MBEDTLS_CHECK_PARAMS_ASSERT - -/* \} name SECTION: System support */ - -/** - * \name SECTION: mbed TLS feature support - * - * This section sets support for features that are or are not needed - * within the modules that are enabled. - * \{ - */ - -/** - * \def MBEDTLS_TIMING_ALT - * - * Uncomment to provide your own alternate implementation for mbedtls_timing_hardclock(), - * mbedtls_timing_get_timer(), mbedtls_set_alarm(), mbedtls_set/get_delay() - * - * Only works if you have MBEDTLS_TIMING_C enabled. - * - * You will need to provide a header "timing_alt.h" and an implementation at - * compile time. - */ -//#define MBEDTLS_TIMING_ALT - -/** - * \def MBEDTLS_AES_ALT - * - * MBEDTLS__MODULE_NAME__ALT: Uncomment a macro to let mbed TLS use your - * alternate core implementation of a symmetric crypto, an arithmetic or hash - * module (e.g. platform specific assembly optimized implementations). Keep - * in mind that the function prototypes should remain the same. - * - * This replaces the whole module. If you only want to replace one of the - * functions, use one of the MBEDTLS__FUNCTION_NAME__ALT flags. - * - * Example: In case you uncomment MBEDTLS_AES_ALT, mbed TLS will no longer - * provide the "struct mbedtls_aes_context" definition and omit the base - * function declarations and implementations. "aes_alt.h" will be included from - * "aes.h" to include the new function definitions. - * - * Uncomment a macro to enable alternate implementation of the corresponding - * module. - * - * \warning MD2, MD4, MD5, ARC4, DES and SHA-1 are considered weak and their - * use constitutes a security risk. If possible, we recommend - * avoiding dependencies on them, and considering stronger message - * digests and ciphers instead. - * - */ -//#define MBEDTLS_AES_ALT -//#define MBEDTLS_ARC4_ALT -//#define MBEDTLS_ARIA_ALT -//#define MBEDTLS_BLOWFISH_ALT -//#define MBEDTLS_CAMELLIA_ALT -//#define MBEDTLS_CCM_ALT -//#define MBEDTLS_CHACHA20_ALT -//#define MBEDTLS_CHACHAPOLY_ALT -//#define MBEDTLS_CMAC_ALT -//#define MBEDTLS_DES_ALT -//#define MBEDTLS_DHM_ALT -//#define MBEDTLS_ECJPAKE_ALT -//#define MBEDTLS_GCM_ALT -//#define MBEDTLS_NIST_KW_ALT -//#define MBEDTLS_MD2_ALT -//#define MBEDTLS_MD4_ALT -//#define MBEDTLS_MD5_ALT -//#define MBEDTLS_POLY1305_ALT -//#define MBEDTLS_RIPEMD160_ALT -//#define MBEDTLS_RSA_ALT -//#define MBEDTLS_SHA1_ALT -//#define MBEDTLS_SHA256_ALT -//#define MBEDTLS_SHA512_ALT -//#define MBEDTLS_XTEA_ALT - -/* - * When replacing the elliptic curve module, pleace consider, that it is - * implemented with two .c files: - * - ecp.c - * - ecp_curves.c - * You can replace them very much like all the other MBEDTLS__MODULE_NAME__ALT - * macros as described above. The only difference is that you have to make sure - * that you provide functionality for both .c files. - */ -//#define MBEDTLS_ECP_ALT - -/** - * \def MBEDTLS_MD2_PROCESS_ALT - * - * MBEDTLS__FUNCTION_NAME__ALT: Uncomment a macro to let mbed TLS use you - * alternate core implementation of symmetric crypto or hash function. Keep in - * mind that function prototypes should remain the same. - * - * This replaces only one function. The header file from mbed TLS is still - * used, in contrast to the MBEDTLS__MODULE_NAME__ALT flags. - * - * Example: In case you uncomment MBEDTLS_SHA256_PROCESS_ALT, mbed TLS will - * no longer provide the mbedtls_sha1_process() function, but it will still provide - * the other function (using your mbedtls_sha1_process() function) and the definition - * of mbedtls_sha1_context, so your implementation of mbedtls_sha1_process must be compatible - * with this definition. - * - * \note Because of a signature change, the core AES encryption and decryption routines are - * currently named mbedtls_aes_internal_encrypt and mbedtls_aes_internal_decrypt, - * respectively. When setting up alternative implementations, these functions should - * be overridden, but the wrapper functions mbedtls_aes_decrypt and mbedtls_aes_encrypt - * must stay untouched. - * - * \note If you use the AES_xxx_ALT macros, then is is recommended to also set - * MBEDTLS_AES_ROM_TABLES in order to help the linker garbage-collect the AES - * tables. - * - * Uncomment a macro to enable alternate implementation of the corresponding - * function. - * - * \warning MD2, MD4, MD5, DES and SHA-1 are considered weak and their use - * constitutes a security risk. If possible, we recommend avoiding - * dependencies on them, and considering stronger message digests - * and ciphers instead. - * - */ -//#define MBEDTLS_MD2_PROCESS_ALT -//#define MBEDTLS_MD4_PROCESS_ALT -//#define MBEDTLS_MD5_PROCESS_ALT -//#define MBEDTLS_RIPEMD160_PROCESS_ALT -//#define MBEDTLS_SHA1_PROCESS_ALT -//#define MBEDTLS_SHA256_PROCESS_ALT -//#define MBEDTLS_SHA512_PROCESS_ALT -//#define MBEDTLS_DES_SETKEY_ALT -//#define MBEDTLS_DES_CRYPT_ECB_ALT -//#define MBEDTLS_DES3_CRYPT_ECB_ALT -//#define MBEDTLS_AES_SETKEY_ENC_ALT -//#define MBEDTLS_AES_SETKEY_DEC_ALT -//#define MBEDTLS_AES_ENCRYPT_ALT -//#define MBEDTLS_AES_DECRYPT_ALT -//#define MBEDTLS_ECDH_GEN_PUBLIC_ALT -//#define MBEDTLS_ECDH_COMPUTE_SHARED_ALT -//#define MBEDTLS_ECDSA_VERIFY_ALT -//#define MBEDTLS_ECDSA_SIGN_ALT -//#define MBEDTLS_ECDSA_GENKEY_ALT - -/** - * \def MBEDTLS_ECP_INTERNAL_ALT - * - * Expose a part of the internal interface of the Elliptic Curve Point module. - * - * MBEDTLS_ECP__FUNCTION_NAME__ALT: Uncomment a macro to let mbed TLS use your - * alternative core implementation of elliptic curve arithmetic. Keep in mind - * that function prototypes should remain the same. - * - * This partially replaces one function. The header file from mbed TLS is still - * used, in contrast to the MBEDTLS_ECP_ALT flag. The original implementation - * is still present and it is used for group structures not supported by the - * alternative. - * - * Any of these options become available by defining MBEDTLS_ECP_INTERNAL_ALT - * and implementing the following functions: - * unsigned char mbedtls_internal_ecp_grp_capable( - * const mbedtls_ecp_group *grp ) - * int mbedtls_internal_ecp_init( const mbedtls_ecp_group *grp ) - * void mbedtls_internal_ecp_free( const mbedtls_ecp_group *grp ) - * The mbedtls_internal_ecp_grp_capable function should return 1 if the - * replacement functions implement arithmetic for the given group and 0 - * otherwise. - * The functions mbedtls_internal_ecp_init and mbedtls_internal_ecp_free are - * called before and after each point operation and provide an opportunity to - * implement optimized set up and tear down instructions. - * - * Example: In case you uncomment MBEDTLS_ECP_INTERNAL_ALT and - * MBEDTLS_ECP_DOUBLE_JAC_ALT, mbed TLS will still provide the ecp_double_jac - * function, but will use your mbedtls_internal_ecp_double_jac if the group is - * supported (your mbedtls_internal_ecp_grp_capable function returns 1 when - * receives it as an argument). If the group is not supported then the original - * implementation is used. The other functions and the definition of - * mbedtls_ecp_group and mbedtls_ecp_point will not change, so your - * implementation of mbedtls_internal_ecp_double_jac and - * mbedtls_internal_ecp_grp_capable must be compatible with this definition. - * - * Uncomment a macro to enable alternate implementation of the corresponding - * function. - */ -/* Required for all the functions in this section */ -//#define MBEDTLS_ECP_INTERNAL_ALT -/* Support for Weierstrass curves with Jacobi representation */ -//#define MBEDTLS_ECP_RANDOMIZE_JAC_ALT -//#define MBEDTLS_ECP_ADD_MIXED_ALT -//#define MBEDTLS_ECP_DOUBLE_JAC_ALT -//#define MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT -//#define MBEDTLS_ECP_NORMALIZE_JAC_ALT -/* Support for curves with Montgomery arithmetic */ -//#define MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT -//#define MBEDTLS_ECP_RANDOMIZE_MXZ_ALT -//#define MBEDTLS_ECP_NORMALIZE_MXZ_ALT - -/** - * \def MBEDTLS_TEST_NULL_ENTROPY - * - * Enables testing and use of mbed TLS without any configured entropy sources. - * This permits use of the library on platforms before an entropy source has - * been integrated (see for example the MBEDTLS_ENTROPY_HARDWARE_ALT or the - * MBEDTLS_ENTROPY_NV_SEED switches). - * - * WARNING! This switch MUST be disabled in production builds, and is suitable - * only for development. - * Enabling the switch negates any security provided by the library. - * - * Requires MBEDTLS_ENTROPY_C, MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES - * - */ -//#define MBEDTLS_TEST_NULL_ENTROPY - -/** - * \def MBEDTLS_ENTROPY_HARDWARE_ALT - * - * Uncomment this macro to let mbed TLS use your own implementation of a - * hardware entropy collector. - * - * Your function must be called \c mbedtls_hardware_poll(), have the same - * prototype as declared in entropy_poll.h, and accept NULL as first argument. - * - * Uncomment to use your own hardware entropy collector. - */ -//#define MBEDTLS_ENTROPY_HARDWARE_ALT - -/** - * \def MBEDTLS_AES_ROM_TABLES - * - * Use precomputed AES tables stored in ROM. - * - * Uncomment this macro to use precomputed AES tables stored in ROM. - * Comment this macro to generate AES tables in RAM at runtime. - * - * Tradeoff: Using precomputed ROM tables reduces RAM usage by ~8kb - * (or ~2kb if \c MBEDTLS_AES_FEWER_TABLES is used) and reduces the - * initialization time before the first AES operation can be performed. - * It comes at the cost of additional ~8kb ROM use (resp. ~2kb if \c - * MBEDTLS_AES_FEWER_TABLES below is used), and potentially degraded - * performance if ROM access is slower than RAM access. - * - * This option is independent of \c MBEDTLS_AES_FEWER_TABLES. - * - */ -//#define MBEDTLS_AES_ROM_TABLES - -/** - * \def MBEDTLS_AES_FEWER_TABLES - * - * Use less ROM/RAM for AES tables. - * - * Uncommenting this macro omits 75% of the AES tables from - * ROM / RAM (depending on the value of \c MBEDTLS_AES_ROM_TABLES) - * by computing their values on the fly during operations - * (the tables are entry-wise rotations of one another). - * - * Tradeoff: Uncommenting this reduces the RAM / ROM footprint - * by ~6kb but at the cost of more arithmetic operations during - * runtime. Specifically, one has to compare 4 accesses within - * different tables to 4 accesses with additional arithmetic - * operations within the same table. The performance gain/loss - * depends on the system and memory details. - * - * This option is independent of \c MBEDTLS_AES_ROM_TABLES. - * - */ -//#define MBEDTLS_AES_FEWER_TABLES - -/** - * \def MBEDTLS_CAMELLIA_SMALL_MEMORY - * - * Use less ROM for the Camellia implementation (saves about 768 bytes). - * - * Uncomment this macro to use less memory for Camellia. - */ -//#define MBEDTLS_CAMELLIA_SMALL_MEMORY - -/** - * \def MBEDTLS_CIPHER_MODE_CBC - * - * Enable Cipher Block Chaining mode (CBC) for symmetric ciphers. - */ -#define MBEDTLS_CIPHER_MODE_CBC - -/** - * \def MBEDTLS_CIPHER_MODE_CFB - * - * Enable Cipher Feedback mode (CFB) for symmetric ciphers. - */ -#define MBEDTLS_CIPHER_MODE_CFB - -/** - * \def MBEDTLS_CIPHER_MODE_CTR - * - * Enable Counter Block Cipher mode (CTR) for symmetric ciphers. - */ -#define MBEDTLS_CIPHER_MODE_CTR - -/** - * \def MBEDTLS_CIPHER_MODE_OFB - * - * Enable Output Feedback mode (OFB) for symmetric ciphers. - */ -#define MBEDTLS_CIPHER_MODE_OFB - -/** - * \def MBEDTLS_CIPHER_MODE_XTS - * - * Enable Xor-encrypt-xor with ciphertext stealing mode (XTS) for AES. - */ -#define MBEDTLS_CIPHER_MODE_XTS - -/** - * \def MBEDTLS_CIPHER_NULL_CIPHER - * - * Enable NULL cipher. - * Warning: Only do so when you know what you are doing. This allows for - * encryption or channels without any security! - * - * Requires MBEDTLS_ENABLE_WEAK_CIPHERSUITES as well to enable - * the following ciphersuites: - * MBEDTLS_TLS_ECDH_ECDSA_WITH_NULL_SHA - * MBEDTLS_TLS_ECDH_RSA_WITH_NULL_SHA - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_NULL_SHA - * MBEDTLS_TLS_ECDHE_RSA_WITH_NULL_SHA - * MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA384 - * MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA256 - * MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA - * MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA384 - * MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA256 - * MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA - * MBEDTLS_TLS_RSA_WITH_NULL_SHA256 - * MBEDTLS_TLS_RSA_WITH_NULL_SHA - * MBEDTLS_TLS_RSA_WITH_NULL_MD5 - * MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA384 - * MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA256 - * MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA - * MBEDTLS_TLS_PSK_WITH_NULL_SHA384 - * MBEDTLS_TLS_PSK_WITH_NULL_SHA256 - * MBEDTLS_TLS_PSK_WITH_NULL_SHA - * - * Uncomment this macro to enable the NULL cipher and ciphersuites - */ -//#define MBEDTLS_CIPHER_NULL_CIPHER - -/** - * \def MBEDTLS_CIPHER_PADDING_PKCS7 - * - * MBEDTLS_CIPHER_PADDING_XXX: Uncomment or comment macros to add support for - * specific padding modes in the cipher layer with cipher modes that support - * padding (e.g. CBC) - * - * If you disable all padding modes, only full blocks can be used with CBC. - * - * Enable padding modes in the cipher layer. - */ -#define MBEDTLS_CIPHER_PADDING_PKCS7 -#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS -#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN -#define MBEDTLS_CIPHER_PADDING_ZEROS - -/** - * \def MBEDTLS_ENABLE_WEAK_CIPHERSUITES - * - * Enable weak ciphersuites in SSL / TLS. - * Warning: Only do so when you know what you are doing. This allows for - * channels with virtually no security at all! - * - * This enables the following ciphersuites: - * MBEDTLS_TLS_RSA_WITH_DES_CBC_SHA - * MBEDTLS_TLS_DHE_RSA_WITH_DES_CBC_SHA - * - * Uncomment this macro to enable weak ciphersuites - * - * \warning DES is considered a weak cipher and its use constitutes a - * security risk. We recommend considering stronger ciphers instead. - */ -//#define MBEDTLS_ENABLE_WEAK_CIPHERSUITES - -/** - * \def MBEDTLS_REMOVE_ARC4_CIPHERSUITES - * - * Remove RC4 ciphersuites by default in SSL / TLS. - * This flag removes the ciphersuites based on RC4 from the default list as - * returned by mbedtls_ssl_list_ciphersuites(). However, it is still possible to - * enable (some of) them with mbedtls_ssl_conf_ciphersuites() by including them - * explicitly. - * - * Uncomment this macro to remove RC4 ciphersuites by default. - */ -#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES - -/** - * \def MBEDTLS_REMOVE_3DES_CIPHERSUITES - * - * Remove 3DES ciphersuites by default in SSL / TLS. - * This flag removes the ciphersuites based on 3DES from the default list as - * returned by mbedtls_ssl_list_ciphersuites(). However, it is still possible - * to enable (some of) them with mbedtls_ssl_conf_ciphersuites() by including - * them explicitly. - * - * A man-in-the-browser attacker can recover authentication tokens sent through - * a TLS connection using a 3DES based cipher suite (see "On the Practical - * (In-)Security of 64-bit Block Ciphers" by Karthikeyan Bhargavan and Gaëtan - * Leurent, see https://sweet32.info/SWEET32_CCS16.pdf). If this attack falls - * in your threat model or you are unsure, then you should keep this option - * enabled to remove 3DES based cipher suites. - * - * Comment this macro to keep 3DES in the default ciphersuite list. - */ -#define MBEDTLS_REMOVE_3DES_CIPHERSUITES - -/** - * \def MBEDTLS_ECP_DP_SECP192R1_ENABLED - * - * MBEDTLS_ECP_XXXX_ENABLED: Enables specific curves within the Elliptic Curve - * module. By default all supported curves are enabled. - * - * Comment macros to disable the curve and functions for it - */ -// #define MBEDTLS_ECP_DP_SECP192R1_ENABLED -#define MBEDTLS_ECP_DP_SECP224R1_ENABLED -#define MBEDTLS_ECP_DP_SECP256R1_ENABLED -// #define MBEDTLS_ECP_DP_SECP384R1_ENABLED -// #define MBEDTLS_ECP_DP_SECP521R1_ENABLED -// #define MBEDTLS_ECP_DP_SECP192K1_ENABLED -// #define MBEDTLS_ECP_DP_SECP224K1_ENABLED -// #define MBEDTLS_ECP_DP_SECP256K1_ENABLED -// #define MBEDTLS_ECP_DP_BP256R1_ENABLED -// #define MBEDTLS_ECP_DP_BP384R1_ENABLED -// #define MBEDTLS_ECP_DP_BP512R1_ENABLED -// #define MBEDTLS_ECP_DP_CURVE25519_ENABLED -// #define MBEDTLS_ECP_DP_CURVE448_ENABLED - -/** - * \def MBEDTLS_ECP_NIST_OPTIM - * - * Enable specific 'modulo p' routines for each NIST prime. - * Depending on the prime and architecture, makes operations 4 to 8 times - * faster on the corresponding curve. - * - * Comment this macro to disable NIST curves optimisation. - */ -#define MBEDTLS_ECP_NIST_OPTIM - -/** - * \def MBEDTLS_ECP_RESTARTABLE - * - * Enable "non-blocking" ECC operations that can return early and be resumed. - * - * This allows various functions to pause by returning - * #MBEDTLS_ERR_ECP_IN_PROGRESS (or, for functions in the SSL module, - * #MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) and then be called later again in - * order to further progress and eventually complete their operation. This is - * controlled through mbedtls_ecp_set_max_ops() which limits the maximum - * number of ECC operations a function may perform before pausing; see - * mbedtls_ecp_set_max_ops() for more information. - * - * This is useful in non-threaded environments if you want to avoid blocking - * for too long on ECC (and, hence, X.509 or SSL/TLS) operations. - * - * Uncomment this macro to enable restartable ECC computations. - * - * \note This option only works with the default software implementation of - * elliptic curve functionality. It is incompatible with - * MBEDTLS_ECP_ALT, MBEDTLS_ECDH_XXX_ALT, MBEDTLS_ECDSA_XXX_ALT - * and MBEDTLS_ECDH_LEGACY_CONTEXT. - */ -//#define MBEDTLS_ECP_RESTARTABLE - -/** - * \def MBEDTLS_ECDH_LEGACY_CONTEXT - * - * Use a backward compatible ECDH context. - * - * Mbed TLS supports two formats for ECDH contexts (#mbedtls_ecdh_context - * defined in `ecdh.h`). For most applications, the choice of format makes - * no difference, since all library functions can work with either format, - * except that the new format is incompatible with MBEDTLS_ECP_RESTARTABLE. - - * The new format used when this option is disabled is smaller - * (56 bytes on a 32-bit platform). In future versions of the library, it - * will support alternative implementations of ECDH operations. - * The new format is incompatible with applications that access - * context fields directly and with restartable ECP operations. - * - * Define this macro if you enable MBEDTLS_ECP_RESTARTABLE or if you - * want to access ECDH context fields directly. Otherwise you should - * comment out this macro definition. - * - * This option has no effect if #MBEDTLS_ECDH_C is not enabled. - * - * \note This configuration option is experimental. Future versions of the - * library may modify the way the ECDH context layout is configured - * and may modify the layout of the new context type. - */ -#define MBEDTLS_ECDH_LEGACY_CONTEXT - -/** - * \def MBEDTLS_ECDSA_DETERMINISTIC - * - * Enable deterministic ECDSA (RFC 6979). - * Standard ECDSA is "fragile" in the sense that lack of entropy when signing - * may result in a compromise of the long-term signing key. This is avoided by - * the deterministic variant. - * - * Requires: MBEDTLS_HMAC_DRBG_C - * - * Comment this macro to disable deterministic ECDSA. - */ -#define MBEDTLS_ECDSA_DETERMINISTIC - -/** - * \def MBEDTLS_KEY_EXCHANGE_PSK_ENABLED - * - * Enable the PSK based ciphersuite modes in SSL / TLS. - * - * This enables the following ciphersuites (if other requisites are - * enabled as well): - * MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384 - * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 - * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 - * MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_PSK_WITH_RC4_128_SHA - */ -#define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED - -/** - * \def MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED - * - * Enable the DHE-PSK based ciphersuite modes in SSL / TLS. - * - * Requires: MBEDTLS_DHM_C - * - * This enables the following ciphersuites (if other requisites are - * enabled as well): - * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 - * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384 - * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 - * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA - * - * \warning Using DHE constitutes a security risk as it - * is not possible to validate custom DH parameters. - * If possible, it is recommended users should consider - * preferring other methods of key exchange. - * See dhm.h for more details. - * - */ -#define MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED - -/** - * \def MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED - * - * Enable the ECDHE-PSK based ciphersuite modes in SSL / TLS. - * - * Requires: MBEDTLS_ECDH_C - * - * This enables the following ciphersuites (if other requisites are - * enabled as well): - * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 - * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 - * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA - */ -#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED - -/** - * \def MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED - * - * Enable the RSA-PSK based ciphersuite modes in SSL / TLS. - * - * Requires: MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15, - * MBEDTLS_X509_CRT_PARSE_C - * - * This enables the following ciphersuites (if other requisites are - * enabled as well): - * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 - * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 - * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 - * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA - */ -#define MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED - -/** - * \def MBEDTLS_KEY_EXCHANGE_RSA_ENABLED - * - * Enable the RSA-only based ciphersuite modes in SSL / TLS. - * - * Requires: MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15, - * MBEDTLS_X509_CRT_PARSE_C - * - * This enables the following ciphersuites (if other requisites are - * enabled as well): - * MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256 - * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 - * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 - * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - * MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - * MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_RSA_WITH_RC4_128_SHA - * MBEDTLS_TLS_RSA_WITH_RC4_128_MD5 - */ -#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED - -/** - * \def MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED - * - * Enable the DHE-RSA based ciphersuite modes in SSL / TLS. - * - * Requires: MBEDTLS_DHM_C, MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15, - * MBEDTLS_X509_CRT_PARSE_C - * - * This enables the following ciphersuites (if other requisites are - * enabled as well): - * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 - * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 - * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 - * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA - * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA - * MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA - * - * \warning Using DHE constitutes a security risk as it - * is not possible to validate custom DH parameters. - * If possible, it is recommended users should consider - * preferring other methods of key exchange. - * See dhm.h for more details. - * - */ -#define MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED - -/** - * \def MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED - * - * Enable the ECDHE-RSA based ciphersuite modes in SSL / TLS. - * - * Requires: MBEDTLS_ECDH_C, MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15, - * MBEDTLS_X509_CRT_PARSE_C - * - * This enables the following ciphersuites (if other requisites are - * enabled as well): - * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 - * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 - * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 - * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_ECDHE_RSA_WITH_RC4_128_SHA - */ -#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED - -/** - * \def MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED - * - * Enable the ECDHE-ECDSA based ciphersuite modes in SSL / TLS. - * - * Requires: MBEDTLS_ECDH_C, MBEDTLS_ECDSA_C, MBEDTLS_X509_CRT_PARSE_C, - * - * This enables the following ciphersuites (if other requisites are - * enabled as well): - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA - */ -#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED - -/** - * \def MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED - * - * Enable the ECDH-ECDSA based ciphersuite modes in SSL / TLS. - * - * Requires: MBEDTLS_ECDH_C, MBEDTLS_X509_CRT_PARSE_C - * - * This enables the following ciphersuites (if other requisites are - * enabled as well): - * MBEDTLS_TLS_ECDH_ECDSA_WITH_RC4_128_SHA - * MBEDTLS_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 - */ -#define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED - -/** - * \def MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED - * - * Enable the ECDH-RSA based ciphersuite modes in SSL / TLS. - * - * Requires: MBEDTLS_ECDH_C, MBEDTLS_X509_CRT_PARSE_C - * - * This enables the following ciphersuites (if other requisites are - * enabled as well): - * MBEDTLS_TLS_ECDH_RSA_WITH_RC4_128_SHA - * MBEDTLS_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 - * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 - * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 - */ -#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED - -/** - * \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED - * - * Enable the ECJPAKE based ciphersuite modes in SSL / TLS. - * - * \warning This is currently experimental. EC J-PAKE support is based on the - * Thread v1.0.0 specification; incompatible changes to the specification - * might still happen. For this reason, this is disabled by default. - * - * Requires: MBEDTLS_ECJPAKE_C - * MBEDTLS_SHA256_C - * MBEDTLS_ECP_DP_SECP256R1_ENABLED - * - * This enables the following ciphersuites (if other requisites are - * enabled as well): - * MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8 - */ -//#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED - -/** - * \def MBEDTLS_PK_PARSE_EC_EXTENDED - * - * Enhance support for reading EC keys using variants of SEC1 not allowed by - * RFC 5915 and RFC 5480. - * - * Currently this means parsing the SpecifiedECDomain choice of EC - * parameters (only known groups are supported, not arbitrary domains, to - * avoid validation issues). - * - * Disable if you only need to support RFC 5915 + 5480 key formats. - */ -#define MBEDTLS_PK_PARSE_EC_EXTENDED - -/** - * \def MBEDTLS_ERROR_STRERROR_DUMMY - * - * Enable a dummy error function to make use of mbedtls_strerror() in - * third party libraries easier when MBEDTLS_ERROR_C is disabled - * (no effect when MBEDTLS_ERROR_C is enabled). - * - * You can safely disable this if MBEDTLS_ERROR_C is enabled, or if you're - * not using mbedtls_strerror() or error_strerror() in your application. - * - * Disable if you run into name conflicts and want to really remove the - * mbedtls_strerror() - */ -// #define MBEDTLS_ERROR_STRERROR_DUMMY - -/** - * \def MBEDTLS_GENPRIME - * - * Enable the prime-number generation code. - * - * Requires: MBEDTLS_BIGNUM_C - */ -#define MBEDTLS_GENPRIME - -/** - * \def MBEDTLS_FS_IO - * - * Enable functions that use the filesystem. - */ -// #define MBEDTLS_FS_IO - -/** - * \def MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES - * - * Do not add default entropy sources. These are the platform specific, - * mbedtls_timing_hardclock and HAVEGE based poll functions. - * - * This is useful to have more control over the added entropy sources in an - * application. - * - * Uncomment this macro to prevent loading of default entropy functions. - */ -//#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES - -/** - * \def MBEDTLS_NO_PLATFORM_ENTROPY - * - * Do not use built-in platform entropy functions. - * This is useful if your platform does not support - * standards like the /dev/urandom or Windows CryptoAPI. - * - * Uncomment this macro to disable the built-in platform entropy functions. - */ -#define MBEDTLS_NO_PLATFORM_ENTROPY - -/** - * \def MBEDTLS_ENTROPY_FORCE_SHA256 - * - * Force the entropy accumulator to use a SHA-256 accumulator instead of the - * default SHA-512 based one (if both are available). - * - * Requires: MBEDTLS_SHA256_C - * - * On 32-bit systems SHA-256 can be much faster than SHA-512. Use this option - * if you have performance concerns. - * - * This option is only useful if both MBEDTLS_SHA256_C and - * MBEDTLS_SHA512_C are defined. Otherwise the available hash module is used. - */ -//#define MBEDTLS_ENTROPY_FORCE_SHA256 - -/** - * \def MBEDTLS_ENTROPY_NV_SEED - * - * Enable the non-volatile (NV) seed file-based entropy source. - * (Also enables the NV seed read/write functions in the platform layer) - * - * This is crucial (if not required) on systems that do not have a - * cryptographic entropy source (in hardware or kernel) available. - * - * Requires: MBEDTLS_ENTROPY_C, MBEDTLS_PLATFORM_C - * - * \note The read/write functions that are used by the entropy source are - * determined in the platform layer, and can be modified at runtime and/or - * compile-time depending on the flags (MBEDTLS_PLATFORM_NV_SEED_*) used. - * - * \note If you use the default implementation functions that read a seedfile - * with regular fopen(), please make sure you make a seedfile with the - * proper name (defined in MBEDTLS_PLATFORM_STD_NV_SEED_FILE) and at - * least MBEDTLS_ENTROPY_BLOCK_SIZE bytes in size that can be read from - * and written to or you will get an entropy source error! The default - * implementation will only use the first MBEDTLS_ENTROPY_BLOCK_SIZE - * bytes from the file. - * - * \note The entropy collector will write to the seed file before entropy is - * given to an external source, to update it. - */ -//#define MBEDTLS_ENTROPY_NV_SEED - -/** - * \def MBEDTLS_MEMORY_DEBUG - * - * Enable debugging of buffer allocator memory issues. Automatically prints - * (to stderr) all (fatal) messages on memory allocation issues. Enables - * function for 'debug output' of allocated memory. - * - * Requires: MBEDTLS_MEMORY_BUFFER_ALLOC_C - * - * Uncomment this macro to let the buffer allocator print out error messages. - */ -//#define MBEDTLS_MEMORY_DEBUG - -/** - * \def MBEDTLS_MEMORY_BACKTRACE - * - * Include backtrace information with each allocated block. - * - * Requires: MBEDTLS_MEMORY_BUFFER_ALLOC_C - * GLIBC-compatible backtrace() an backtrace_symbols() support - * - * Uncomment this macro to include backtrace information - */ -//#define MBEDTLS_MEMORY_BACKTRACE - -/** - * \def MBEDTLS_PK_RSA_ALT_SUPPORT - * - * Support external private RSA keys (eg from a HSM) in the PK layer. - * - * Comment this macro to disable support for external private RSA keys. - */ -// #define MBEDTLS_PK_RSA_ALT_SUPPORT - -/** - * \def MBEDTLS_PKCS1_V15 - * - * Enable support for PKCS#1 v1.5 encoding. - * - * Requires: MBEDTLS_RSA_C - * - * This enables support for PKCS#1 v1.5 operations. - */ -#define MBEDTLS_PKCS1_V15 - -/** - * \def MBEDTLS_PKCS1_V21 - * - * Enable support for PKCS#1 v2.1 encoding. - * - * Requires: MBEDTLS_MD_C, MBEDTLS_RSA_C - * - * This enables support for RSAES-OAEP and RSASSA-PSS operations. - */ -#define MBEDTLS_PKCS1_V21 - -/** - * \def MBEDTLS_PSA_CRYPTO_SPM - * - * When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is built for SPM (Secure - * Partition Manager) integration which separates the code into two parts: a - * NSPE (Non-Secure Process Environment) and an SPE (Secure Process - * Environment). - * - * Module: library/psa_crypto.c - * Requires: MBEDTLS_PSA_CRYPTO_C - * - */ -//#define MBEDTLS_PSA_CRYPTO_SPM - -/** - * \def MBEDTLS_PSA_INJECT_ENTROPY - * - * Enable support for entropy injection at first boot. This feature is - * required on systems that do not have a built-in entropy source (TRNG). - * This feature is currently not supported on systems that have a built-in - * entropy source. - * - * Requires: MBEDTLS_PSA_CRYPTO_STORAGE_C, MBEDTLS_ENTROPY_NV_SEED - * - */ -//#define MBEDTLS_PSA_INJECT_ENTROPY - -/** - * \def MBEDTLS_RSA_NO_CRT - * - * Do not use the Chinese Remainder Theorem - * for the RSA private operation. - * - * Uncomment this macro to disable the use of CRT in RSA. - * - */ -//#define MBEDTLS_RSA_NO_CRT - -/** - * \def MBEDTLS_SELF_TEST - * - * Enable the checkup functions (*_self_test). - */ -#define MBEDTLS_SELF_TEST - -/** - * \def MBEDTLS_SHA256_SMALLER - * - * Enable an implementation of SHA-256 that has lower ROM footprint but also - * lower performance. - * - * The default implementation is meant to be a reasonnable compromise between - * performance and size. This version optimizes more aggressively for size at - * the expense of performance. Eg on Cortex-M4 it reduces the size of - * mbedtls_sha256_process() from ~2KB to ~0.5KB for a performance hit of about - * 30%. - * - * Uncomment to enable the smaller implementation of SHA256. - */ -//#define MBEDTLS_SHA256_SMALLER - -/** - * \def MBEDTLS_SSL_ALL_ALERT_MESSAGES - * - * Enable sending of alert messages in case of encountered errors as per RFC. - * If you choose not to send the alert messages, mbed TLS can still communicate - * with other servers, only debugging of failures is harder. - * - * The advantage of not sending alert messages, is that no information is given - * about reasons for failures thus preventing adversaries of gaining intel. - * - * Enable sending of all alert messages - */ -#define MBEDTLS_SSL_ALL_ALERT_MESSAGES - -/** - * \def MBEDTLS_SSL_RECORD_CHECKING - * - * Enable the function mbedtls_ssl_check_record() which can be used to check - * the validity and authenticity of an incoming record, to verify that it has - * not been seen before. These checks are performed without modifying the - * externally visible state of the SSL context. - * - * See mbedtls_ssl_check_record() for more information. - * - * Uncomment to enable support for record checking. - */ -#define MBEDTLS_SSL_RECORD_CHECKING - -/** - * \def MBEDTLS_SSL_DTLS_CONNECTION_ID - * - * Enable support for the DTLS Connection ID extension - * (version draft-ietf-tls-dtls-connection-id-05, - * https://tools.ietf.org/html/draft-ietf-tls-dtls-connection-id-05) - * which allows to identify DTLS connections across changes - * in the underlying transport. - * - * Setting this option enables the SSL APIs `mbedtls_ssl_set_cid()`, - * `mbedtls_ssl_get_peer_cid()` and `mbedtls_ssl_conf_cid()`. - * See the corresponding documentation for more information. - * - * \warning The Connection ID extension is still in draft state. - * We make no stability promises for the availability - * or the shape of the API controlled by this option. - * - * The maximum lengths of outgoing and incoming CIDs can be configured - * through the options - * - MBEDTLS_SSL_CID_OUT_LEN_MAX - * - MBEDTLS_SSL_CID_IN_LEN_MAX. - * - * Requires: MBEDTLS_SSL_PROTO_DTLS - * - * Uncomment to enable the Connection ID extension. - */ -//#define MBEDTLS_SSL_DTLS_CONNECTION_ID - -/** - * \def MBEDTLS_SSL_ASYNC_PRIVATE - * - * Enable asynchronous external private key operations in SSL. This allows - * you to configure an SSL connection to call an external cryptographic - * module to perform private key operations instead of performing the - * operation inside the library. - * - */ -//#define MBEDTLS_SSL_ASYNC_PRIVATE - -/** - * \def MBEDTLS_SSL_CONTEXT_SERIALIZATION - * - * Enable serialization of the TLS context structures, through use of the - * functions mbedtls_ssl_context_save() and mbedtls_ssl_context_load(). - * - * This pair of functions allows one side of a connection to serialize the - * context associated with the connection, then free or re-use that context - * while the serialized state is persisted elsewhere, and finally deserialize - * that state to a live context for resuming read/write operations on the - * connection. From a protocol perspective, the state of the connection is - * unaffected, in particular this is entirely transparent to the peer. - * - * Note: this is distinct from TLS session resumption, which is part of the - * protocol and fully visible by the peer. TLS session resumption enables - * establishing new connections associated to a saved session with shorter, - * lighter handshakes, while context serialization is a local optimization in - * handling a single, potentially long-lived connection. - * - * Enabling these APIs makes some SSL structures larger, as 64 extra bytes are - * saved after the handshake to allow for more efficient serialization, so if - * you don't need this feature you'll save RAM by disabling it. - * - * Comment to disable the context serialization APIs. - */ -#define MBEDTLS_SSL_CONTEXT_SERIALIZATION - -/** - * \def MBEDTLS_SSL_DEBUG_ALL - * - * Enable the debug messages in SSL module for all issues. - * Debug messages have been disabled in some places to prevent timing - * attacks due to (unbalanced) debugging function calls. - * - * If you need all error reporting you should enable this during debugging, - * but remove this for production servers that should log as well. - * - * Uncomment this macro to report all debug messages on errors introducing - * a timing side-channel. - * - */ -//#define MBEDTLS_SSL_DEBUG_ALL - -/** \def MBEDTLS_SSL_ENCRYPT_THEN_MAC - * - * Enable support for Encrypt-then-MAC, RFC 7366. - * - * This allows peers that both support it to use a more robust protection for - * ciphersuites using CBC, providing deep resistance against timing attacks - * on the padding or underlying cipher. - * - * This only affects CBC ciphersuites, and is useless if none is defined. - * - * Requires: MBEDTLS_SSL_PROTO_TLS1 or - * MBEDTLS_SSL_PROTO_TLS1_1 or - * MBEDTLS_SSL_PROTO_TLS1_2 - * - * Comment this macro to disable support for Encrypt-then-MAC - */ -#define MBEDTLS_SSL_ENCRYPT_THEN_MAC - -/** \def MBEDTLS_SSL_EXTENDED_MASTER_SECRET - * - * Enable support for Extended Master Secret, aka Session Hash - * (draft-ietf-tls-session-hash-02). - * - * This was introduced as "the proper fix" to the Triple Handshake familiy of - * attacks, but it is recommended to always use it (even if you disable - * renegotiation), since it actually fixes a more fundamental issue in the - * original SSL/TLS design, and has implications beyond Triple Handshake. - * - * Requires: MBEDTLS_SSL_PROTO_TLS1 or - * MBEDTLS_SSL_PROTO_TLS1_1 or - * MBEDTLS_SSL_PROTO_TLS1_2 - * - * Comment this macro to disable support for Extended Master Secret. - */ -#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET - -/** - * \def MBEDTLS_SSL_FALLBACK_SCSV - * - * Enable support for FALLBACK_SCSV (draft-ietf-tls-downgrade-scsv-00). - * - * For servers, it is recommended to always enable this, unless you support - * only one version of TLS, or know for sure that none of your clients - * implements a fallback strategy. - * - * For clients, you only need this if you're using a fallback strategy, which - * is not recommended in the first place, unless you absolutely need it to - * interoperate with buggy (version-intolerant) servers. - * - * Comment this macro to disable support for FALLBACK_SCSV - */ -#define MBEDTLS_SSL_FALLBACK_SCSV - -/** - * \def MBEDTLS_SSL_KEEP_PEER_CERTIFICATE - * - * This option controls the availability of the API mbedtls_ssl_get_peer_cert() - * giving access to the peer's certificate after completion of the handshake. - * - * Unless you need mbedtls_ssl_peer_cert() in your application, it is - * recommended to disable this option for reduced RAM usage. - * - * \note If this option is disabled, mbedtls_ssl_get_peer_cert() is still - * defined, but always returns \c NULL. - * - * \note This option has no influence on the protection against the - * triple handshake attack. Even if it is disabled, Mbed TLS will - * still ensure that certificates do not change during renegotiation, - * for exaple by keeping a hash of the peer's certificate. - * - * Comment this macro to disable storing the peer's certificate - * after the handshake. - */ -#define MBEDTLS_SSL_KEEP_PEER_CERTIFICATE - -/** - * \def MBEDTLS_SSL_HW_RECORD_ACCEL - * - * Enable hooking functions in SSL module for hardware acceleration of - * individual records. - * - * Uncomment this macro to enable hooking functions. - */ -//#define MBEDTLS_SSL_HW_RECORD_ACCEL - -/** - * \def MBEDTLS_SSL_CBC_RECORD_SPLITTING - * - * Enable 1/n-1 record splitting for CBC mode in SSLv3 and TLS 1.0. - * - * This is a countermeasure to the BEAST attack, which also minimizes the risk - * of interoperability issues compared to sending 0-length records. - * - * Comment this macro to disable 1/n-1 record splitting. - */ -#define MBEDTLS_SSL_CBC_RECORD_SPLITTING - -/** - * \def MBEDTLS_SSL_RENEGOTIATION - * - * Enable support for TLS renegotiation. - * - * The two main uses of renegotiation are (1) refresh keys on long-lived - * connections and (2) client authentication after the initial handshake. - * If you don't need renegotiation, it's probably better to disable it, since - * it has been associated with security issues in the past and is easy to - * misuse/misunderstand. - * - * Comment this to disable support for renegotiation. - * - * \note Even if this option is disabled, both client and server are aware - * of the Renegotiation Indication Extension (RFC 5746) used to - * prevent the SSL renegotiation attack (see RFC 5746 Sect. 1). - * (See \c mbedtls_ssl_conf_legacy_renegotiation for the - * configuration of this extension). - * - */ -#define MBEDTLS_SSL_RENEGOTIATION - -/** - * \def MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO - * - * Enable support for receiving and parsing SSLv2 Client Hello messages for the - * SSL Server module (MBEDTLS_SSL_SRV_C). - * - * Uncomment this macro to enable support for SSLv2 Client Hello messages. - */ -//#define MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO - -/** - * \def MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE - * - * Pick the ciphersuite according to the client's preferences rather than ours - * in the SSL Server module (MBEDTLS_SSL_SRV_C). - * - * Uncomment this macro to respect client's ciphersuite order - */ -//#define MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE - -/** - * \def MBEDTLS_SSL_MAX_FRAGMENT_LENGTH - * - * Enable support for RFC 6066 max_fragment_length extension in SSL. - * - * Comment this macro to disable support for the max_fragment_length extension - */ -#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH - -/** - * \def MBEDTLS_SSL_PROTO_SSL3 - * - * Enable support for SSL 3.0. - * - * Requires: MBEDTLS_MD5_C - * MBEDTLS_SHA1_C - * - * Comment this macro to disable support for SSL 3.0 - */ -//#define MBEDTLS_SSL_PROTO_SSL3 - -/** - * \def MBEDTLS_SSL_PROTO_TLS1 - * - * Enable support for TLS 1.0. - * - * Requires: MBEDTLS_MD5_C - * MBEDTLS_SHA1_C - * - * Comment this macro to disable support for TLS 1.0 - */ -#define MBEDTLS_SSL_PROTO_TLS1 - -/** - * \def MBEDTLS_SSL_PROTO_TLS1_1 - * - * Enable support for TLS 1.1 (and DTLS 1.0 if DTLS is enabled). - * - * Requires: MBEDTLS_MD5_C - * MBEDTLS_SHA1_C - * - * Comment this macro to disable support for TLS 1.1 / DTLS 1.0 - */ -#define MBEDTLS_SSL_PROTO_TLS1_1 - -/** - * \def MBEDTLS_SSL_PROTO_TLS1_2 - * - * Enable support for TLS 1.2 (and DTLS 1.2 if DTLS is enabled). - * - * Requires: MBEDTLS_SHA1_C or MBEDTLS_SHA256_C or MBEDTLS_SHA512_C - * (Depends on ciphersuites) - * - * Comment this macro to disable support for TLS 1.2 / DTLS 1.2 - */ -#define MBEDTLS_SSL_PROTO_TLS1_2 - -/** - * \def MBEDTLS_SSL_PROTO_DTLS - * - * Enable support for DTLS (all available versions). - * - * Enable this and MBEDTLS_SSL_PROTO_TLS1_1 to enable DTLS 1.0, - * and/or this and MBEDTLS_SSL_PROTO_TLS1_2 to enable DTLS 1.2. - * - * Requires: MBEDTLS_SSL_PROTO_TLS1_1 - * or MBEDTLS_SSL_PROTO_TLS1_2 - * - * Comment this macro to disable support for DTLS - */ -#define MBEDTLS_SSL_PROTO_DTLS - -/** - * \def MBEDTLS_SSL_ALPN - * - * Enable support for RFC 7301 Application Layer Protocol Negotiation. - * - * Comment this macro to disable support for ALPN. - */ -#define MBEDTLS_SSL_ALPN - -/** - * \def MBEDTLS_SSL_DTLS_ANTI_REPLAY - * - * Enable support for the anti-replay mechanism in DTLS. - * - * Requires: MBEDTLS_SSL_TLS_C - * MBEDTLS_SSL_PROTO_DTLS - * - * \warning Disabling this is often a security risk! - * See mbedtls_ssl_conf_dtls_anti_replay() for details. - * - * Comment this to disable anti-replay in DTLS. - */ -#define MBEDTLS_SSL_DTLS_ANTI_REPLAY - -/** - * \def MBEDTLS_SSL_DTLS_HELLO_VERIFY - * - * Enable support for HelloVerifyRequest on DTLS servers. - * - * This feature is highly recommended to prevent DTLS servers being used as - * amplifiers in DoS attacks against other hosts. It should always be enabled - * unless you know for sure amplification cannot be a problem in the - * environment in which your server operates. - * - * \warning Disabling this can ba a security risk! (see above) - * - * Requires: MBEDTLS_SSL_PROTO_DTLS - * - * Comment this to disable support for HelloVerifyRequest. - */ -#define MBEDTLS_SSL_DTLS_HELLO_VERIFY - -/** - * \def MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE - * - * Enable server-side support for clients that reconnect from the same port. - * - * Some clients unexpectedly close the connection and try to reconnect using the - * same source port. This needs special support from the server to handle the - * new connection securely, as described in section 4.2.8 of RFC 6347. This - * flag enables that support. - * - * Requires: MBEDTLS_SSL_DTLS_HELLO_VERIFY - * - * Comment this to disable support for clients reusing the source port. - */ -#define MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE - -/** - * \def MBEDTLS_SSL_DTLS_BADMAC_LIMIT - * - * Enable support for a limit of records with bad MAC. - * - * See mbedtls_ssl_conf_dtls_badmac_limit(). - * - * Requires: MBEDTLS_SSL_PROTO_DTLS - */ -#define MBEDTLS_SSL_DTLS_BADMAC_LIMIT - -/** - * \def MBEDTLS_SSL_SESSION_TICKETS - * - * Enable support for RFC 5077 session tickets in SSL. - * Client-side, provides full support for session tickets (maintenance of a - * session store remains the responsibility of the application, though). - * Server-side, you also need to provide callbacks for writing and parsing - * tickets, including authenticated encryption and key management. Example - * callbacks are provided by MBEDTLS_SSL_TICKET_C. - * - * Comment this macro to disable support for SSL session tickets - */ -#define MBEDTLS_SSL_SESSION_TICKETS - -/** - * \def MBEDTLS_SSL_EXPORT_KEYS - * - * Enable support for exporting key block and master secret. - * This is required for certain users of TLS, e.g. EAP-TLS. - * - * Comment this macro to disable support for key export - */ -#define MBEDTLS_SSL_EXPORT_KEYS - -/** - * \def MBEDTLS_SSL_SERVER_NAME_INDICATION - * - * Enable support for RFC 6066 server name indication (SNI) in SSL. - * - * Requires: MBEDTLS_X509_CRT_PARSE_C - * - * Comment this macro to disable support for server name indication in SSL - */ -#define MBEDTLS_SSL_SERVER_NAME_INDICATION - -/** - * \def MBEDTLS_SSL_TRUNCATED_HMAC - * - * Enable support for RFC 6066 truncated HMAC in SSL. - * - * Comment this macro to disable support for truncated HMAC in SSL - */ -#define MBEDTLS_SSL_TRUNCATED_HMAC - -/** - * \def MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT - * - * Fallback to old (pre-2.7), non-conforming implementation of the truncated - * HMAC extension which also truncates the HMAC key. Note that this option is - * only meant for a transitory upgrade period and is likely to be removed in - * a future version of the library. - * - * \warning The old implementation is non-compliant and has a security weakness - * (2^80 brute force attack on the HMAC key used for a single, - * uninterrupted connection). This should only be enabled temporarily - * when (1) the use of truncated HMAC is essential in order to save - * bandwidth, and (2) the peer is an Mbed TLS stack that doesn't use - * the fixed implementation yet (pre-2.7). - * - * \deprecated This option is deprecated and will likely be removed in a - * future version of Mbed TLS. - * - * Uncomment to fallback to old, non-compliant truncated HMAC implementation. - * - * Requires: MBEDTLS_SSL_TRUNCATED_HMAC - */ -//#define MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT - -/** - * \def MBEDTLS_THREADING_ALT - * - * Provide your own alternate threading implementation. - * - * Requires: MBEDTLS_THREADING_C - * - * Uncomment this to allow your own alternate threading implementation. - */ -//#define MBEDTLS_THREADING_ALT - -/** - * \def MBEDTLS_THREADING_PTHREAD - * - * Enable the pthread wrapper layer for the threading layer. - * - * Requires: MBEDTLS_THREADING_C - * - * Uncomment this to enable pthread mutexes. - */ -//#define MBEDTLS_THREADING_PTHREAD - -/** - * \def MBEDTLS_USE_PSA_CRYPTO - * - * Make the X.509 and TLS library use PSA for cryptographic operations, and - * enable new APIs for using keys handled by PSA Crypto. - * - * \note Development of this option is currently in progress, and parts - * of the X.509 and TLS modules are not ported to PSA yet. However, these parts - * will still continue to work as usual, so enabling this option should not - * break backwards compatibility. - * - * \warning The PSA Crypto API is in beta stage. While you're welcome to - * experiment using it, incompatible API changes are still possible, and some - * parts may not have reached the same quality as the rest of Mbed TLS yet. - * - * \warning This option enables new Mbed TLS APIs that are dependent on the - * PSA Crypto API, so can't come with the same stability guarantees as the - * rest of the Mbed TLS APIs. You're welcome to experiment with them, but for - * now, access to these APIs is opt-in (via enabling the present option), in - * order to clearly differentiate them from the stable Mbed TLS APIs. - * - * Requires: MBEDTLS_PSA_CRYPTO_C. - * - * Uncomment this to enable internal use of PSA Crypto and new associated APIs. - */ -//#define MBEDTLS_USE_PSA_CRYPTO - -/** - * \def MBEDTLS_VERSION_FEATURES - * - * Allow run-time checking of compile-time enabled features. Thus allowing users - * to check at run-time if the library is for instance compiled with threading - * support via mbedtls_version_check_feature(). - * - * Requires: MBEDTLS_VERSION_C - * - * Comment this to disable run-time checking and save ROM space - */ -// #define MBEDTLS_VERSION_FEATURES - -/** - * \def MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3 - * - * If set, the X509 parser will not break-off when parsing an X509 certificate - * and encountering an extension in a v1 or v2 certificate. - * - * Uncomment to prevent an error. - */ -//#define MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3 - -/** - * \def MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION - * - * If set, the X509 parser will not break-off when parsing an X509 certificate - * and encountering an unknown critical extension. - * - * \warning Depending on your PKI use, enabling this can be a security risk! - * - * Uncomment to prevent an error. - */ -//#define MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION - -/** - * \def MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK - * - * If set, this enables the X.509 API `mbedtls_x509_crt_verify_with_ca_cb()` - * and the SSL API `mbedtls_ssl_conf_ca_cb()` which allow users to configure - * the set of trusted certificates through a callback instead of a linked - * list. - * - * This is useful for example in environments where a large number of trusted - * certificates is present and storing them in a linked list isn't efficient - * enough, or when the set of trusted certificates changes frequently. - * - * See the documentation of `mbedtls_x509_crt_verify_with_ca_cb()` and - * `mbedtls_ssl_conf_ca_cb()` for more information. - * - * Uncomment to enable trusted certificate callbacks. - */ -//#define MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK - -/** - * \def MBEDTLS_X509_CHECK_KEY_USAGE - * - * Enable verification of the keyUsage extension (CA and leaf certificates). - * - * Disabling this avoids problems with mis-issued and/or misused - * (intermediate) CA and leaf certificates. - * - * \warning Depending on your PKI use, disabling this can be a security risk! - * - * Comment to skip keyUsage checking for both CA and leaf certificates. - */ -#define MBEDTLS_X509_CHECK_KEY_USAGE - -/** - * \def MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE - * - * Enable verification of the extendedKeyUsage extension (leaf certificates). - * - * Disabling this avoids problems with mis-issued and/or misused certificates. - * - * \warning Depending on your PKI use, disabling this can be a security risk! - * - * Comment to skip extendedKeyUsage checking for certificates. - */ -#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE - -/** - * \def MBEDTLS_X509_RSASSA_PSS_SUPPORT - * - * Enable parsing and verification of X.509 certificates, CRLs and CSRS - * signed with RSASSA-PSS (aka PKCS#1 v2.1). - * - * Comment this macro to disallow using RSASSA-PSS in certificates. - */ -#define MBEDTLS_X509_RSASSA_PSS_SUPPORT - -/** - * \def MBEDTLS_ZLIB_SUPPORT - * - * If set, the SSL/TLS module uses ZLIB to support compression and - * decompression of packet data. - * - * \warning TLS-level compression MAY REDUCE SECURITY! See for example the - * CRIME attack. Before enabling this option, you should examine with care if - * CRIME or similar exploits may be applicable to your use case. - * - * \note Currently compression can't be used with DTLS. - * - * \deprecated This feature is deprecated and will be removed - * in the next major revision of the library. - * - * Used in: library/ssl_tls.c - * library/ssl_cli.c - * library/ssl_srv.c - * - * This feature requires zlib library and headers to be present. - * - * Uncomment to enable use of ZLIB - */ -//#define MBEDTLS_ZLIB_SUPPORT -/* \} name SECTION: mbed TLS feature support */ - -/** - * \name SECTION: mbed TLS modules - * - * This section enables or disables entire modules in mbed TLS - * \{ - */ - -/** - * \def MBEDTLS_AESNI_C - * - * Enable AES-NI support on x86-64. - * - * Module: library/aesni.c - * Caller: library/aes.c - * - * Requires: MBEDTLS_HAVE_ASM - * - * This modules adds support for the AES-NI instructions on x86-64 - */ -#define MBEDTLS_AESNI_C - -/** - * \def MBEDTLS_AES_C - * - * Enable the AES block cipher. - * - * Module: library/aes.c - * Caller: library/cipher.c - * library/pem.c - * library/ctr_drbg.c - * - * This module enables the following ciphersuites (if other requisites are - * enabled as well): - * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 - * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 - * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 - * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 - * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 - * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256 - * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 - * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA - * MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384 - * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384 - * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA - * MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256 - * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256 - * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA - * - * PEM_PARSE uses AES for decrypting encrypted keys. - */ -#define MBEDTLS_AES_C - -/** - * \def MBEDTLS_ARC4_C - * - * Enable the ARCFOUR stream cipher. - * - * Module: library/arc4.c - * Caller: library/cipher.c - * - * This module enables the following ciphersuites (if other requisites are - * enabled as well): - * MBEDTLS_TLS_ECDH_ECDSA_WITH_RC4_128_SHA - * MBEDTLS_TLS_ECDH_RSA_WITH_RC4_128_SHA - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA - * MBEDTLS_TLS_ECDHE_RSA_WITH_RC4_128_SHA - * MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA - * MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA - * MBEDTLS_TLS_RSA_WITH_RC4_128_SHA - * MBEDTLS_TLS_RSA_WITH_RC4_128_MD5 - * MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA - * MBEDTLS_TLS_PSK_WITH_RC4_128_SHA - * - * \warning ARC4 is considered a weak cipher and its use constitutes a - * security risk. If possible, we recommend avoidng dependencies on - * it, and considering stronger ciphers instead. - * - */ -#define MBEDTLS_ARC4_C - -/** - * \def MBEDTLS_ASN1_PARSE_C - * - * Enable the generic ASN1 parser. - * - * Module: library/asn1.c - * Caller: library/x509.c - * library/dhm.c - * library/pkcs12.c - * library/pkcs5.c - * library/pkparse.c - */ -#define MBEDTLS_ASN1_PARSE_C - -/** - * \def MBEDTLS_ASN1_WRITE_C - * - * Enable the generic ASN1 writer. - * - * Module: library/asn1write.c - * Caller: library/ecdsa.c - * library/pkwrite.c - * library/x509_create.c - * library/x509write_crt.c - * library/x509write_csr.c - */ -#define MBEDTLS_ASN1_WRITE_C - -/** - * \def MBEDTLS_BASE64_C - * - * Enable the Base64 module. - * - * Module: library/base64.c - * Caller: library/pem.c - * - * This module is required for PEM support (required by X.509). - */ -#define MBEDTLS_BASE64_C - -/** - * \def MBEDTLS_BIGNUM_C - * - * Enable the multi-precision integer library. - * - * Module: library/bignum.c - * Caller: library/dhm.c - * library/ecp.c - * library/ecdsa.c - * library/rsa.c - * library/rsa_internal.c - * library/ssl_tls.c - * - * This module is required for RSA, DHM and ECC (ECDH, ECDSA) support. - */ -#define MBEDTLS_BIGNUM_C - -/** - * \def MBEDTLS_BLOWFISH_C - * - * Enable the Blowfish block cipher. - * - * Module: library/blowfish.c - */ -#define MBEDTLS_BLOWFISH_C - -/** - * \def MBEDTLS_CAMELLIA_C - * - * Enable the Camellia block cipher. - * - * Module: library/camellia.c - * Caller: library/cipher.c - * - * This module enables the following ciphersuites (if other requisites are - * enabled as well): - * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 - * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 - * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 - * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 - * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 - * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 - * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 - * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA - * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384 - * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 - * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 - * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 - * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 - * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 - * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 - * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 - * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 - * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 - * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 - * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 - */ -#define MBEDTLS_CAMELLIA_C - -/** - * \def MBEDTLS_ARIA_C - * - * Enable the ARIA block cipher. - * - * Module: library/aria.c - * Caller: library/cipher.c - * - * This module enables the following ciphersuites (if other requisites are - * enabled as well): - * - * MBEDTLS_TLS_RSA_WITH_ARIA_128_CBC_SHA256 - * MBEDTLS_TLS_RSA_WITH_ARIA_256_CBC_SHA384 - * MBEDTLS_TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256 - * MBEDTLS_TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384 - * MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256 - * MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384 - * MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256 - * MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384 - * MBEDTLS_TLS_RSA_WITH_ARIA_128_GCM_SHA256 - * MBEDTLS_TLS_RSA_WITH_ARIA_256_GCM_SHA384 - * MBEDTLS_TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256 - * MBEDTLS_TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 - * MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 - * MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 - * MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 - * MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 - * MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 - * MBEDTLS_TLS_PSK_WITH_ARIA_128_CBC_SHA256 - * MBEDTLS_TLS_PSK_WITH_ARIA_256_CBC_SHA384 - * MBEDTLS_TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256 - * MBEDTLS_TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384 - * MBEDTLS_TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256 - * MBEDTLS_TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384 - * MBEDTLS_TLS_PSK_WITH_ARIA_128_GCM_SHA256 - * MBEDTLS_TLS_PSK_WITH_ARIA_256_GCM_SHA384 - * MBEDTLS_TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256 - * MBEDTLS_TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384 - * MBEDTLS_TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256 - * MBEDTLS_TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384 - * MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256 - * MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384 - */ -//#define MBEDTLS_ARIA_C - -/** - * \def MBEDTLS_CCM_C - * - * Enable the Counter with CBC-MAC (CCM) mode for 128-bit block cipher. - * - * Module: library/ccm.c - * - * Requires: MBEDTLS_AES_C or MBEDTLS_CAMELLIA_C - * - * This module enables the AES-CCM ciphersuites, if other requisites are - * enabled as well. - */ -#define MBEDTLS_CCM_C - -/** - * \def MBEDTLS_CERTS_C - * - * Enable the test certificates. - * - * Module: library/certs.c - * Caller: - * - * This module is used for testing (ssl_client/server). - */ -#define MBEDTLS_CERTS_C - -/** - * \def MBEDTLS_CHACHA20_C - * - * Enable the ChaCha20 stream cipher. - * - * Module: library/chacha20.c - */ -#define MBEDTLS_CHACHA20_C - -/** - * \def MBEDTLS_CHACHAPOLY_C - * - * Enable the ChaCha20-Poly1305 AEAD algorithm. - * - * Module: library/chachapoly.c - * - * This module requires: MBEDTLS_CHACHA20_C, MBEDTLS_POLY1305_C - */ -#define MBEDTLS_CHACHAPOLY_C - -/** - * \def MBEDTLS_CIPHER_C - * - * Enable the generic cipher layer. - * - * Module: library/cipher.c - * Caller: library/ssl_tls.c - * - * Uncomment to enable generic cipher wrappers. - */ -#define MBEDTLS_CIPHER_C - -/** - * \def MBEDTLS_CMAC_C - * - * Enable the CMAC (Cipher-based Message Authentication Code) mode for block - * ciphers. - * - * Module: library/cmac.c - * - * Requires: MBEDTLS_AES_C or MBEDTLS_DES_C - * - */ -//#define MBEDTLS_CMAC_C - -/** - * \def MBEDTLS_CTR_DRBG_C - * - * Enable the CTR_DRBG AES-based random generator. - * The CTR_DRBG generator uses AES-256 by default. - * To use AES-128 instead, enable MBEDTLS_CTR_DRBG_USE_128_BIT_KEY below. - * - * Module: library/ctr_drbg.c - * Caller: - * - * Requires: MBEDTLS_AES_C - * - * This module provides the CTR_DRBG AES random number generator. - */ -#define MBEDTLS_CTR_DRBG_C - -/** - * \def MBEDTLS_DEBUG_C - * - * Enable the debug functions. - * - * Module: library/debug.c - * Caller: library/ssl_cli.c - * library/ssl_srv.c - * library/ssl_tls.c - * - * This module provides debugging functions. - */ -#define MBEDTLS_DEBUG_C - -/** - * \def MBEDTLS_DES_C - * - * Enable the DES block cipher. - * - * Module: library/des.c - * Caller: library/pem.c - * library/cipher.c - * - * This module enables the following ciphersuites (if other requisites are - * enabled as well): - * MBEDTLS_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA - * MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA - * - * PEM_PARSE uses DES/3DES for decrypting encrypted keys. - * - * \warning DES is considered a weak cipher and its use constitutes a - * security risk. We recommend considering stronger ciphers instead. - */ -#define MBEDTLS_DES_C - -/** - * \def MBEDTLS_DHM_C - * - * Enable the Diffie-Hellman-Merkle module. - * - * Module: library/dhm.c - * Caller: library/ssl_cli.c - * library/ssl_srv.c - * - * This module is used by the following key exchanges: - * DHE-RSA, DHE-PSK - * - * \warning Using DHE constitutes a security risk as it - * is not possible to validate custom DH parameters. - * If possible, it is recommended users should consider - * preferring other methods of key exchange. - * See dhm.h for more details. - * - */ -#define MBEDTLS_DHM_C - -/** - * \def MBEDTLS_ECDH_C - * - * Enable the elliptic curve Diffie-Hellman library. - * - * Module: library/ecdh.c - * Caller: library/ssl_cli.c - * library/ssl_srv.c - * - * This module is used by the following key exchanges: - * ECDHE-ECDSA, ECDHE-RSA, DHE-PSK - * - * Requires: MBEDTLS_ECP_C - */ -#define MBEDTLS_ECDH_C - -/** - * \def MBEDTLS_ECDSA_C - * - * Enable the elliptic curve DSA library. - * - * Module: library/ecdsa.c - * Caller: - * - * This module is used by the following key exchanges: - * ECDHE-ECDSA - * - * Requires: MBEDTLS_ECP_C, MBEDTLS_ASN1_WRITE_C, MBEDTLS_ASN1_PARSE_C - */ -#define MBEDTLS_ECDSA_C - -/** - * \def MBEDTLS_ECJPAKE_C - * - * Enable the elliptic curve J-PAKE library. - * - * \warning This is currently experimental. EC J-PAKE support is based on the - * Thread v1.0.0 specification; incompatible changes to the specification - * might still happen. For this reason, this is disabled by default. - * - * Module: library/ecjpake.c - * Caller: - * - * This module is used by the following key exchanges: - * ECJPAKE - * - * Requires: MBEDTLS_ECP_C, MBEDTLS_MD_C - */ -//#define MBEDTLS_ECJPAKE_C - -/** - * \def MBEDTLS_ECP_C - * - * Enable the elliptic curve over GF(p) library. - * - * Module: library/ecp.c - * Caller: library/ecdh.c - * library/ecdsa.c - * library/ecjpake.c - * - * Requires: MBEDTLS_BIGNUM_C and at least one MBEDTLS_ECP_DP_XXX_ENABLED - */ -#define MBEDTLS_ECP_C - -/** - * \def MBEDTLS_ENTROPY_C - * - * Enable the platform-specific entropy code. - * - * Module: library/entropy.c - * Caller: - * - * Requires: MBEDTLS_SHA512_C or MBEDTLS_SHA256_C - * - * This module provides a generic entropy pool - */ -#define MBEDTLS_ENTROPY_C - -/** - * \def MBEDTLS_ERROR_C - * - * Enable error code to error string conversion. - * - * Module: library/error.c - * Caller: - * - * This module enables mbedtls_strerror(). - */ -// #define MBEDTLS_ERROR_C - -/** - * \def MBEDTLS_GCM_C - * - * Enable the Galois/Counter Mode (GCM) for AES. - * - * Module: library/gcm.c - * - * Requires: MBEDTLS_AES_C or MBEDTLS_CAMELLIA_C - * - * This module enables the AES-GCM and CAMELLIA-GCM ciphersuites, if other - * requisites are enabled as well. - */ -#define MBEDTLS_GCM_C - -/** - * \def MBEDTLS_HAVEGE_C - * - * Enable the HAVEGE random generator. - * - * Warning: the HAVEGE random generator is not suitable for virtualized - * environments - * - * Warning: the HAVEGE random generator is dependent on timing and specific - * processor traits. It is therefore not advised to use HAVEGE as - * your applications primary random generator or primary entropy pool - * input. As a secondary input to your entropy pool, it IS able add - * the (limited) extra entropy it provides. - * - * Module: library/havege.c - * Caller: - * - * Requires: MBEDTLS_TIMING_C - * - * Uncomment to enable the HAVEGE random generator. - */ -//#define MBEDTLS_HAVEGE_C - -/** - * \def MBEDTLS_HKDF_C - * - * Enable the HKDF algorithm (RFC 5869). - * - * Module: library/hkdf.c - * Caller: - * - * Requires: MBEDTLS_MD_C - * - * This module adds support for the Hashed Message Authentication Code - * (HMAC)-based key derivation function (HKDF). - */ -#define MBEDTLS_HKDF_C - -/** - * \def MBEDTLS_HMAC_DRBG_C - * - * Enable the HMAC_DRBG random generator. - * - * Module: library/hmac_drbg.c - * Caller: - * - * Requires: MBEDTLS_MD_C - * - * Uncomment to enable the HMAC_DRBG random number geerator. - */ -#define MBEDTLS_HMAC_DRBG_C - -/** - * \def MBEDTLS_NIST_KW_C - * - * Enable the Key Wrapping mode for 128-bit block ciphers, - * as defined in NIST SP 800-38F. Only KW and KWP modes - * are supported. At the moment, only AES is approved by NIST. - * - * Module: library/nist_kw.c - * - * Requires: MBEDTLS_AES_C and MBEDTLS_CIPHER_C - */ -//#define MBEDTLS_NIST_KW_C - -/** - * \def MBEDTLS_MD_C - * - * Enable the generic message digest layer. - * - * Module: library/md.c - * Caller: - * - * Uncomment to enable generic message digest wrappers. - */ -#define MBEDTLS_MD_C - -/** - * \def MBEDTLS_MD2_C - * - * Enable the MD2 hash algorithm. - * - * Module: library/md2.c - * Caller: - * - * Uncomment to enable support for (rare) MD2-signed X.509 certs. - * - * \warning MD2 is considered a weak message digest and its use constitutes a - * security risk. If possible, we recommend avoiding dependencies on - * it, and considering stronger message digests instead. - * - */ -//#define MBEDTLS_MD2_C - -/** - * \def MBEDTLS_MD4_C - * - * Enable the MD4 hash algorithm. - * - * Module: library/md4.c - * Caller: - * - * Uncomment to enable support for (rare) MD4-signed X.509 certs. - * - * \warning MD4 is considered a weak message digest and its use constitutes a - * security risk. If possible, we recommend avoiding dependencies on - * it, and considering stronger message digests instead. - * - */ -//#define MBEDTLS_MD4_C - -/** - * \def MBEDTLS_MD5_C - * - * Enable the MD5 hash algorithm. - * - * Module: library/md5.c - * Caller: library/md.c - * library/pem.c - * library/ssl_tls.c - * - * This module is required for SSL/TLS up to version 1.1, and for TLS 1.2 - * depending on the handshake parameters. Further, it is used for checking - * MD5-signed certificates, and for PBKDF1 when decrypting PEM-encoded - * encrypted keys. - * - * \warning MD5 is considered a weak message digest and its use constitutes a - * security risk. If possible, we recommend avoiding dependencies on - * it, and considering stronger message digests instead. - * - */ -#define MBEDTLS_MD5_C - -/** - * \def MBEDTLS_MEMORY_BUFFER_ALLOC_C - * - * Enable the buffer allocator implementation that makes use of a (stack) - * based buffer to 'allocate' dynamic memory. (replaces calloc() and free() - * calls) - * - * Module: library/memory_buffer_alloc.c - * - * Requires: MBEDTLS_PLATFORM_C - * MBEDTLS_PLATFORM_MEMORY (to use it within mbed TLS) - * - * Enable this module to enable the buffer memory allocator. - */ -//#define MBEDTLS_MEMORY_BUFFER_ALLOC_C - -/** - * \def MBEDTLS_NET_C - * - * Enable the TCP and UDP over IPv6/IPv4 networking routines. - * - * \note This module only works on POSIX/Unix (including Linux, BSD and OS X) - * and Windows. For other platforms, you'll want to disable it, and write your - * own networking callbacks to be passed to \c mbedtls_ssl_set_bio(). - * - * \note See also our Knowledge Base article about porting to a new - * environment: - * https://tls.mbed.org/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS - * - * Module: library/net_sockets.c - * - * This module provides networking routines. - */ -// #define MBEDTLS_NET_C - -/** - * \def MBEDTLS_OID_C - * - * Enable the OID database. - * - * Module: library/oid.c - * Caller: library/asn1write.c - * library/pkcs5.c - * library/pkparse.c - * library/pkwrite.c - * library/rsa.c - * library/x509.c - * library/x509_create.c - * library/x509_crl.c - * library/x509_crt.c - * library/x509_csr.c - * library/x509write_crt.c - * library/x509write_csr.c - * - * This modules translates between OIDs and internal values. - */ -#define MBEDTLS_OID_C - -/** - * \def MBEDTLS_PADLOCK_C - * - * Enable VIA Padlock support on x86. - * - * Module: library/padlock.c - * Caller: library/aes.c - * - * Requires: MBEDTLS_HAVE_ASM - * - * This modules adds support for the VIA PadLock on x86. - */ -#define MBEDTLS_PADLOCK_C - -/** - * \def MBEDTLS_PEM_PARSE_C - * - * Enable PEM decoding / parsing. - * - * Module: library/pem.c - * Caller: library/dhm.c - * library/pkparse.c - * library/x509_crl.c - * library/x509_crt.c - * library/x509_csr.c - * - * Requires: MBEDTLS_BASE64_C - * - * This modules adds support for decoding / parsing PEM files. - */ -#define MBEDTLS_PEM_PARSE_C - -/** - * \def MBEDTLS_PEM_WRITE_C - * - * Enable PEM encoding / writing. - * - * Module: library/pem.c - * Caller: library/pkwrite.c - * library/x509write_crt.c - * library/x509write_csr.c - * - * Requires: MBEDTLS_BASE64_C - * - * This modules adds support for encoding / writing PEM files. - */ -#define MBEDTLS_PEM_WRITE_C - -/** - * \def MBEDTLS_PK_C - * - * Enable the generic public (asymetric) key layer. - * - * Module: library/pk.c - * Caller: library/ssl_tls.c - * library/ssl_cli.c - * library/ssl_srv.c - * - * Requires: MBEDTLS_RSA_C or MBEDTLS_ECP_C - * - * Uncomment to enable generic public key wrappers. - */ -#define MBEDTLS_PK_C - -/** - * \def MBEDTLS_PK_PARSE_C - * - * Enable the generic public (asymetric) key parser. - * - * Module: library/pkparse.c - * Caller: library/x509_crt.c - * library/x509_csr.c - * - * Requires: MBEDTLS_PK_C - * - * Uncomment to enable generic public key parse functions. - */ -#define MBEDTLS_PK_PARSE_C - -/** - * \def MBEDTLS_PK_WRITE_C - * - * Enable the generic public (asymetric) key writer. - * - * Module: library/pkwrite.c - * Caller: library/x509write.c - * - * Requires: MBEDTLS_PK_C - * - * Uncomment to enable generic public key write functions. - */ -#define MBEDTLS_PK_WRITE_C - -/** - * \def MBEDTLS_PKCS5_C - * - * Enable PKCS#5 functions. - * - * Module: library/pkcs5.c - * - * Requires: MBEDTLS_MD_C - * - * This module adds support for the PKCS#5 functions. - */ -#define MBEDTLS_PKCS5_C - -/** - * \def MBEDTLS_PKCS11_C - * - * Enable wrapper for PKCS#11 smartcard support. - * - * Module: library/pkcs11.c - * Caller: library/pk.c - * - * Requires: MBEDTLS_PK_C - * - * This module enables SSL/TLS PKCS #11 smartcard support. - * Requires the presence of the PKCS#11 helper library (libpkcs11-helper) - */ -//#define MBEDTLS_PKCS11_C - -/** - * \def MBEDTLS_PKCS12_C - * - * Enable PKCS#12 PBE functions. - * Adds algorithms for parsing PKCS#8 encrypted private keys - * - * Module: library/pkcs12.c - * Caller: library/pkparse.c - * - * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_CIPHER_C, MBEDTLS_MD_C - * Can use: MBEDTLS_ARC4_C - * - * This module enables PKCS#12 functions. - */ -#define MBEDTLS_PKCS12_C - -/** - * \def MBEDTLS_PLATFORM_C - * - * Enable the platform abstraction layer that allows you to re-assign - * functions like calloc(), free(), snprintf(), printf(), fprintf(), exit(). - * - * Enabling MBEDTLS_PLATFORM_C enables to use of MBEDTLS_PLATFORM_XXX_ALT - * or MBEDTLS_PLATFORM_XXX_MACRO directives, allowing the functions mentioned - * above to be specified at runtime or compile time respectively. - * - * \note This abstraction layer must be enabled on Windows (including MSYS2) - * as other module rely on it for a fixed snprintf implementation. - * - * Module: library/platform.c - * Caller: Most other .c files - * - * This module enables abstraction of common (libc) functions. - */ -#define MBEDTLS_PLATFORM_C - -/** - * \def MBEDTLS_POLY1305_C - * - * Enable the Poly1305 MAC algorithm. - * - * Module: library/poly1305.c - * Caller: library/chachapoly.c - */ -#define MBEDTLS_POLY1305_C - -/** - * \def MBEDTLS_PSA_CRYPTO_C - * - * Enable the Platform Security Architecture cryptography API. - * - * \warning The PSA Crypto API is still beta status. While you're welcome to - * experiment using it, incompatible API changes are still possible, and some - * parts may not have reached the same quality as the rest of Mbed TLS yet. - * - * Module: crypto/library/psa_crypto.c - * - * Requires: MBEDTLS_CTR_DRBG_C, MBEDTLS_ENTROPY_C - * - */ -#define MBEDTLS_PSA_CRYPTO_C - -/** - * \def MBEDTLS_PSA_CRYPTO_STORAGE_C - * - * Enable the Platform Security Architecture persistent key storage. - * - * Module: crypto/library/psa_crypto_storage.c - * - * Requires: MBEDTLS_PSA_CRYPTO_C, - * either MBEDTLS_PSA_ITS_FILE_C or a native implementation of - * the PSA ITS interface - */ -//#define MBEDTLS_PSA_CRYPTO_STORAGE_C - -/** - * \def MBEDTLS_PSA_ITS_FILE_C - * - * Enable the emulation of the Platform Security Architecture - * Internal Trusted Storage (PSA ITS) over files. - * - * Module: crypto/library/psa_its_file.c - * - * Requires: MBEDTLS_FS_IO - * - */ -//#define MBEDTLS_PSA_ITS_FILE_C - -/** - * \def MBEDTLS_RIPEMD160_C - * - * Enable the RIPEMD-160 hash algorithm. - * - * Module: library/ripemd160.c - * Caller: library/md.c - * - */ -#define MBEDTLS_RIPEMD160_C - -/** - * \def MBEDTLS_RSA_C - * - * Enable the RSA public-key cryptosystem. - * - * Module: library/rsa.c - * library/rsa_internal.c - * Caller: library/ssl_cli.c - * library/ssl_srv.c - * library/ssl_tls.c - * library/x509.c - * - * This module is used by the following key exchanges: - * RSA, DHE-RSA, ECDHE-RSA, RSA-PSK - * - * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C - */ -#define MBEDTLS_RSA_C - -/** - * \def MBEDTLS_SHA1_C - * - * Enable the SHA1 cryptographic hash algorithm. - * - * Module: library/sha1.c - * Caller: library/md.c - * library/ssl_cli.c - * library/ssl_srv.c - * library/ssl_tls.c - * library/x509write_crt.c - * - * This module is required for SSL/TLS up to version 1.1, for TLS 1.2 - * depending on the handshake parameters, and for SHA1-signed certificates. - * - * \warning SHA-1 is considered a weak message digest and its use constitutes - * a security risk. If possible, we recommend avoiding dependencies - * on it, and considering stronger message digests instead. - * - */ -#define MBEDTLS_SHA1_C - -/** - * \def MBEDTLS_SHA256_C - * - * Enable the SHA-224 and SHA-256 cryptographic hash algorithms. - * - * Module: library/sha256.c - * Caller: library/entropy.c - * library/md.c - * library/ssl_cli.c - * library/ssl_srv.c - * library/ssl_tls.c - * - * This module adds support for SHA-224 and SHA-256. - * This module is required for the SSL/TLS 1.2 PRF function. - */ -#define MBEDTLS_SHA256_C - -/** - * \def MBEDTLS_SHA512_C - * - * Enable the SHA-384 and SHA-512 cryptographic hash algorithms. - * - * Module: library/sha512.c - * Caller: library/entropy.c - * library/md.c - * library/ssl_cli.c - * library/ssl_srv.c - * - * This module adds support for SHA-384 and SHA-512. - */ -#define MBEDTLS_SHA512_C - -/** - * \def MBEDTLS_SSL_CACHE_C - * - * Enable simple SSL cache implementation. - * - * Module: library/ssl_cache.c - * Caller: - * - * Requires: MBEDTLS_SSL_CACHE_C - */ -#define MBEDTLS_SSL_CACHE_C - -/** - * \def MBEDTLS_SSL_COOKIE_C - * - * Enable basic implementation of DTLS cookies for hello verification. - * - * Module: library/ssl_cookie.c - * Caller: - */ -#define MBEDTLS_SSL_COOKIE_C - -/** - * \def MBEDTLS_SSL_TICKET_C - * - * Enable an implementation of TLS server-side callbacks for session tickets. - * - * Module: library/ssl_ticket.c - * Caller: - * - * Requires: MBEDTLS_CIPHER_C - */ -#define MBEDTLS_SSL_TICKET_C - -/** - * \def MBEDTLS_SSL_CLI_C - * - * Enable the SSL/TLS client code. - * - * Module: library/ssl_cli.c - * Caller: - * - * Requires: MBEDTLS_SSL_TLS_C - * - * This module is required for SSL/TLS client support. - */ -#define MBEDTLS_SSL_CLI_C - -/** - * \def MBEDTLS_SSL_SRV_C - * - * Enable the SSL/TLS server code. - * - * Module: library/ssl_srv.c - * Caller: - * - * Requires: MBEDTLS_SSL_TLS_C - * - * This module is required for SSL/TLS server support. - */ -#define MBEDTLS_SSL_SRV_C - -/** - * \def MBEDTLS_SSL_TLS_C - * - * Enable the generic SSL/TLS code. - * - * Module: library/ssl_tls.c - * Caller: library/ssl_cli.c - * library/ssl_srv.c - * - * Requires: MBEDTLS_CIPHER_C, MBEDTLS_MD_C - * and at least one of the MBEDTLS_SSL_PROTO_XXX defines - * - * This module is required for SSL/TLS. - */ -#define MBEDTLS_SSL_TLS_C - -/** - * \def MBEDTLS_THREADING_C - * - * Enable the threading abstraction layer. - * By default mbed TLS assumes it is used in a non-threaded environment or that - * contexts are not shared between threads. If you do intend to use contexts - * between threads, you will need to enable this layer to prevent race - * conditions. See also our Knowledge Base article about threading: - * https://tls.mbed.org/kb/development/thread-safety-and-multi-threading - * - * Module: library/threading.c - * - * This allows different threading implementations (self-implemented or - * provided). - * - * You will have to enable either MBEDTLS_THREADING_ALT or - * MBEDTLS_THREADING_PTHREAD. - * - * Enable this layer to allow use of mutexes within mbed TLS - */ -//#define MBEDTLS_THREADING_C - -/** - * \def MBEDTLS_TIMING_C - * - * Enable the semi-portable timing interface. - * - * \note The provided implementation only works on POSIX/Unix (including Linux, - * BSD and OS X) and Windows. On other platforms, you can either disable that - * module and provide your own implementations of the callbacks needed by - * \c mbedtls_ssl_set_timer_cb() for DTLS, or leave it enabled and provide - * your own implementation of the whole module by setting - * \c MBEDTLS_TIMING_ALT in the current file. - * - * \note See also our Knowledge Base article about porting to a new - * environment: - * https://tls.mbed.org/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS - * - * Module: library/timing.c - * Caller: library/havege.c - * - * This module is used by the HAVEGE random number generator. - */ -// #define MBEDTLS_TIMING_C - -/** - * \def MBEDTLS_VERSION_C - * - * Enable run-time version information. - * - * Module: library/version.c - * - * This module provides run-time version information. - */ -// #define MBEDTLS_VERSION_C - -/** - * \def MBEDTLS_X509_USE_C - * - * Enable X.509 core for using certificates. - * - * Module: library/x509.c - * Caller: library/x509_crl.c - * library/x509_crt.c - * library/x509_csr.c - * - * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, - * MBEDTLS_PK_PARSE_C - * - * This module is required for the X.509 parsing modules. - */ -#define MBEDTLS_X509_USE_C - -/** - * \def MBEDTLS_X509_CRT_PARSE_C - * - * Enable X.509 certificate parsing. - * - * Module: library/x509_crt.c - * Caller: library/ssl_cli.c - * library/ssl_srv.c - * library/ssl_tls.c - * - * Requires: MBEDTLS_X509_USE_C - * - * This module is required for X.509 certificate parsing. - */ -#define MBEDTLS_X509_CRT_PARSE_C - -/** - * \def MBEDTLS_X509_CRL_PARSE_C - * - * Enable X.509 CRL parsing. - * - * Module: library/x509_crl.c - * Caller: library/x509_crt.c - * - * Requires: MBEDTLS_X509_USE_C - * - * This module is required for X.509 CRL parsing. - */ -#define MBEDTLS_X509_CRL_PARSE_C - -/** - * \def MBEDTLS_X509_CSR_PARSE_C - * - * Enable X.509 Certificate Signing Request (CSR) parsing. - * - * Module: library/x509_csr.c - * Caller: library/x509_crt_write.c - * - * Requires: MBEDTLS_X509_USE_C - * - * This module is used for reading X.509 certificate request. - */ -#define MBEDTLS_X509_CSR_PARSE_C - -/** - * \def MBEDTLS_X509_CREATE_C - * - * Enable X.509 core for creating certificates. - * - * Module: library/x509_create.c - * - * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, MBEDTLS_PK_WRITE_C - * - * This module is the basis for creating X.509 certificates and CSRs. - */ -#define MBEDTLS_X509_CREATE_C - -/** - * \def MBEDTLS_X509_CRT_WRITE_C - * - * Enable creating X.509 certificates. - * - * Module: library/x509_crt_write.c - * - * Requires: MBEDTLS_X509_CREATE_C - * - * This module is required for X.509 certificate creation. - */ -#define MBEDTLS_X509_CRT_WRITE_C - -/** - * \def MBEDTLS_X509_CSR_WRITE_C - * - * Enable creating X.509 Certificate Signing Requests (CSR). - * - * Module: library/x509_csr_write.c - * - * Requires: MBEDTLS_X509_CREATE_C - * - * This module is required for X.509 certificate request writing. - */ -#define MBEDTLS_X509_CSR_WRITE_C - -/** - * \def MBEDTLS_XTEA_C - * - * Enable the XTEA block cipher. - * - * Module: library/xtea.c - * Caller: - */ -#define MBEDTLS_XTEA_C - -/* \} name SECTION: mbed TLS modules */ - -/** - * \name SECTION: Module configuration options - * - * This section allows for the setting of module specific sizes and - * configuration options. The default values are already present in the - * relevant header files and should suffice for the regular use cases. - * - * Our advice is to enable options and change their values here - * only if you have a good reason and know the consequences. - * - * Please check the respective header file for documentation on these - * parameters (to prevent duplicate documentation). - * \{ - */ - -/* MPI / BIGNUM options */ -//#define MBEDTLS_MPI_WINDOW_SIZE 6 /**< Maximum windows size used. */ -//#define MBEDTLS_MPI_MAX_SIZE 1024 /**< Maximum number of bytes for usable MPIs. */ - -/* CTR_DRBG options */ -//#define MBEDTLS_CTR_DRBG_ENTROPY_LEN 48 /**< Amount of entropy used per seed by default (48 with SHA-512, 32 with -// SHA-256) */ #define MBEDTLS_CTR_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */ #define -// MBEDTLS_CTR_DRBG_MAX_INPUT 256 /**< Maximum number of additional input bytes */ #define -// MBEDTLS_CTR_DRBG_MAX_REQUEST 1024 /**< Maximum number of requested bytes per call */ #define -// MBEDTLS_CTR_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */ #define MBEDTLS_CTR_DRBG_USE_128_BIT_KEY -///**< Use 128-bit key for CTR_DRBG - may reduce security (see ctr_drbg.h) */ - -/* HMAC_DRBG options */ -//#define MBEDTLS_HMAC_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */ -//#define MBEDTLS_HMAC_DRBG_MAX_INPUT 256 /**< Maximum number of additional input bytes */ -//#define MBEDTLS_HMAC_DRBG_MAX_REQUEST 1024 /**< Maximum number of requested bytes per call */ -//#define MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */ - -/* ECP options */ -//#define MBEDTLS_ECP_MAX_BITS 521 /**< Maximum bit size of groups */ -//#define MBEDTLS_ECP_WINDOW_SIZE 6 /**< Maximum window size used */ -//#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1 /**< Enable fixed-point speed-up */ - -/* Entropy options */ -//#define MBEDTLS_ENTROPY_MAX_SOURCES 20 /**< Maximum number of sources supported */ -//#define MBEDTLS_ENTROPY_MAX_GATHER 128 /**< Maximum amount requested from entropy sources */ -//#define MBEDTLS_ENTROPY_MIN_HARDWARE 32 /**< Default minimum number of bytes required for the hardware entropy -// source mbedtls_hardware_poll() before entropy is released */ - -/* Memory buffer allocator options */ -//#define MBEDTLS_MEMORY_ALIGN_MULTIPLE 4 /**< Align on multiples of this value */ - -/* Platform options */ -//#define MBEDTLS_PLATFORM_STD_MEM_HDR /**< Header to include if MBEDTLS_PLATFORM_NO_STD_FUNCTIONS is defined. Don't -// define if no header is needed. */ #define MBEDTLS_PLATFORM_STD_CALLOC calloc /**< Default allocator to use, can be -// undefined */ #define MBEDTLS_PLATFORM_STD_FREE free /**< Default free to use, can be undefined */ #define -// MBEDTLS_PLATFORM_STD_EXIT exit /**< Default exit to use, can be undefined */ #define MBEDTLS_PLATFORM_STD_TIME time -///**< Default time to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */ #define MBEDTLS_PLATFORM_STD_FPRINTF fprintf -///**< Default fprintf to use, can be undefined */ #define MBEDTLS_PLATFORM_STD_PRINTF printf /**< Default printf to use, can -// be undefined */ -/* Note: your snprintf must correctly zero-terminate the buffer! */ -//#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */ -//#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS 0 /**< Default exit value to use, can be undefined */ -//#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE 1 /**< Default exit value to use, can be undefined */ -//#define MBEDTLS_PLATFORM_STD_NV_SEED_READ mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be -// undefined */ #define MBEDTLS_PLATFORM_STD_NV_SEED_WRITE mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function -// to use, can be undefined */ #define MBEDTLS_PLATFORM_STD_NV_SEED_FILE "seedfile" /**< Seed file to read/write with default -// implementation */ - -/* To Use Function Macros MBEDTLS_PLATFORM_C must be enabled */ -/* MBEDTLS_PLATFORM_XXX_MACRO and MBEDTLS_PLATFORM_XXX_ALT cannot both be defined */ -//#define MBEDTLS_PLATFORM_CALLOC_MACRO calloc /**< Default allocator macro to use, can be undefined */ -//#define MBEDTLS_PLATFORM_FREE_MACRO free /**< Default free macro to use, can be undefined */ -//#define MBEDTLS_PLATFORM_EXIT_MACRO exit /**< Default exit macro to use, can be undefined */ -//#define MBEDTLS_PLATFORM_TIME_MACRO time /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be -// enabled */ #define MBEDTLS_PLATFORM_TIME_TYPE_MACRO time_t /**< Default time macro to use, can be undefined. -// MBEDTLS_HAVE_TIME must be enabled */ #define MBEDTLS_PLATFORM_FPRINTF_MACRO fprintf /**< Default fprintf macro to use, can -// be undefined */ #define MBEDTLS_PLATFORM_PRINTF_MACRO printf /**< Default printf macro to use, can be undefined */ -/* Note: your snprintf must correctly zero-terminate the buffer! */ -//#define MBEDTLS_PLATFORM_SNPRINTF_MACRO snprintf /**< Default snprintf macro to use, can be undefined */ -//#define MBEDTLS_PLATFORM_VSNPRINTF_MACRO vsnprintf /**< Default vsnprintf macro to use, can be undefined */ -//#define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be -// undefined */ #define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function -// to use, can be undefined */ - -/** - * \brief This macro is invoked by the library when an invalid parameter - * is detected that is only checked with #MBEDTLS_CHECK_PARAMS - * (see the documentation of that option for context). - * - * When you leave this undefined here, the library provides - * a default definition. If the macro #MBEDTLS_CHECK_PARAMS_ASSERT - * is defined, the default definition is `assert(cond)`, - * otherwise the default definition calls a function - * mbedtls_param_failed(). This function is declared in - * `platform_util.h` for the benefit of the library, but - * you need to define in your application. - * - * When you define this here, this replaces the default - * definition in platform_util.h (which no longer declares the - * function mbedtls_param_failed()) and it is your responsibility - * to make sure this macro expands to something suitable (in - * particular, that all the necessary declarations are visible - * from within the library - you can ensure that by providing - * them in this file next to the macro definition). - * If you define this macro to call `assert`, also define - * #MBEDTLS_CHECK_PARAMS_ASSERT so that library source files - * include ``. - * - * Note that you may define this macro to expand to nothing, in - * which case you don't have to worry about declarations or - * definitions. However, you will then be notified about invalid - * parameters only in non-void functions, and void function will - * just silently return early on invalid parameters, which - * partially negates the benefits of enabling - * #MBEDTLS_CHECK_PARAMS in the first place, so is discouraged. - * - * \param cond The expression that should evaluate to true, but doesn't. - */ -//#define MBEDTLS_PARAM_FAILED( cond ) assert( cond ) - -/* SSL Cache options */ -//#define MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT 86400 /**< 1 day */ -//#define MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES 50 /**< Maximum entries in cache */ - -/* SSL options */ - -/** \def MBEDTLS_SSL_MAX_CONTENT_LEN - * - * Maximum length (in bytes) of incoming and outgoing plaintext fragments. - * - * This determines the size of both the incoming and outgoing TLS I/O buffers - * in such a way that both are capable of holding the specified amount of - * plaintext data, regardless of the protection mechanism used. - * - * To configure incoming and outgoing I/O buffers separately, use - * #MBEDTLS_SSL_IN_CONTENT_LEN and #MBEDTLS_SSL_OUT_CONTENT_LEN, - * which overwrite the value set by this option. - * - * \note When using a value less than the default of 16KB on the client, it is - * recommended to use the Maximum Fragment Length (MFL) extension to - * inform the server about this limitation. On the server, there - * is no supported, standardized way of informing the client about - * restriction on the maximum size of incoming messages, and unless - * the limitation has been communicated by other means, it is recommended - * to only change the outgoing buffer size #MBEDTLS_SSL_OUT_CONTENT_LEN - * while keeping the default value of 16KB for the incoming buffer. - * - * Uncomment to set the maximum plaintext size of both - * incoming and outgoing I/O buffers. - */ -//#define MBEDTLS_SSL_MAX_CONTENT_LEN 16384 - -/** \def MBEDTLS_SSL_IN_CONTENT_LEN - * - * Maximum length (in bytes) of incoming plaintext fragments. - * - * This determines the size of the incoming TLS I/O buffer in such a way - * that it is capable of holding the specified amount of plaintext data, - * regardless of the protection mechanism used. - * - * If this option is undefined, it inherits its value from - * #MBEDTLS_SSL_MAX_CONTENT_LEN. - * - * \note When using a value less than the default of 16KB on the client, it is - * recommended to use the Maximum Fragment Length (MFL) extension to - * inform the server about this limitation. On the server, there - * is no supported, standardized way of informing the client about - * restriction on the maximum size of incoming messages, and unless - * the limitation has been communicated by other means, it is recommended - * to only change the outgoing buffer size #MBEDTLS_SSL_OUT_CONTENT_LEN - * while keeping the default value of 16KB for the incoming buffer. - * - * Uncomment to set the maximum plaintext size of the incoming I/O buffer - * independently of the outgoing I/O buffer. - */ -//#define MBEDTLS_SSL_IN_CONTENT_LEN 16384 - -/** \def MBEDTLS_SSL_CID_IN_LEN_MAX - * - * The maximum length of CIDs used for incoming DTLS messages. - * - */ -//#define MBEDTLS_SSL_CID_IN_LEN_MAX 32 - -/** \def MBEDTLS_SSL_CID_OUT_LEN_MAX - * - * The maximum length of CIDs used for outgoing DTLS messages. - * - */ -//#define MBEDTLS_SSL_CID_OUT_LEN_MAX 32 - -/** \def MBEDTLS_SSL_CID_PADDING_GRANULARITY - * - * This option controls the use of record plaintext padding - * when using the Connection ID extension in DTLS 1.2. - * - * The padding will always be chosen so that the length of the - * padded plaintext is a multiple of the value of this option. - * - * Note: A value of \c 1 means that no padding will be used - * for outgoing records. - * - * Note: On systems lacking division instructions, - * a power of two should be preferred. - * - */ -//#define MBEDTLS_SSL_CID_PADDING_GRANULARITY 16 - -/** \def MBEDTLS_SSL_OUT_CONTENT_LEN - * - * Maximum length (in bytes) of outgoing plaintext fragments. - * - * This determines the size of the outgoing TLS I/O buffer in such a way - * that it is capable of holding the specified amount of plaintext data, - * regardless of the protection mechanism used. - * - * If this option undefined, it inherits its value from - * #MBEDTLS_SSL_MAX_CONTENT_LEN. - * - * It is possible to save RAM by setting a smaller outward buffer, while keeping - * the default inward 16384 byte buffer to conform to the TLS specification. - * - * The minimum required outward buffer size is determined by the handshake - * protocol's usage. Handshaking will fail if the outward buffer is too small. - * The specific size requirement depends on the configured ciphers and any - * certificate data which is sent during the handshake. - * - * Uncomment to set the maximum plaintext size of the outgoing I/O buffer - * independently of the incoming I/O buffer. - */ -//#define MBEDTLS_SSL_OUT_CONTENT_LEN 16384 - -/** \def MBEDTLS_SSL_DTLS_MAX_BUFFERING - * - * Maximum number of heap-allocated bytes for the purpose of - * DTLS handshake message reassembly and future message buffering. - * - * This should be at least 9/8 * MBEDTLSSL_IN_CONTENT_LEN - * to account for a reassembled handshake message of maximum size, - * together with its reassembly bitmap. - * - * A value of 2 * MBEDTLS_SSL_IN_CONTENT_LEN (32768 by default) - * should be sufficient for all practical situations as it allows - * to reassembly a large handshake message (such as a certificate) - * while buffering multiple smaller handshake messages. - * - */ -//#define MBEDTLS_SSL_DTLS_MAX_BUFFERING 32768 - -//#define MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME 86400 /**< Lifetime of session tickets (if enabled) */ -//#define MBEDTLS_PSK_MAX_LEN 32 /**< Max size of TLS pre-shared keys, in bytes (default 256 bits) */ -//#define MBEDTLS_SSL_COOKIE_TIMEOUT 60 /**< Default expiration delay of DTLS cookies, in seconds if HAVE_TIME, or in number -// of cookies issued */ - -/** - * Complete list of ciphersuites to use, in order of preference. - * - * \warning No dependency checking is done on that field! This option can only - * be used to restrict the set of available ciphersuites. It is your - * responsibility to make sure the needed modules are active. - * - * Use this to save a few hundred bytes of ROM (default ordering of all - * available ciphersuites) and a few to a few hundred bytes of RAM. - * - * The value below is only an example, not the default. - */ -//#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 - -/* X509 options */ -//#define MBEDTLS_X509_MAX_INTERMEDIATE_CA 8 /**< Maximum number of intermediate CAs in a verification chain. */ -//#define MBEDTLS_X509_MAX_FILE_PATH_LEN 512 /**< Maximum length of a path/filename string in bytes including the null -// terminator character ('\0'). */ - -/** - * Allow SHA-1 in the default TLS configuration for certificate signing. - * Without this build-time option, SHA-1 support must be activated explicitly - * through mbedtls_ssl_conf_cert_profile. Turning on this option is not - * recommended because of it is possible to generate SHA-1 collisions, however - * this may be safe for legacy infrastructure where additional controls apply. - * - * \warning SHA-1 is considered a weak message digest and its use constitutes - * a security risk. If possible, we recommend avoiding dependencies - * on it, and considering stronger message digests instead. - * - */ -//#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES - -/** - * Allow SHA-1 in the default TLS configuration for TLS 1.2 handshake - * signature and ciphersuite selection. Without this build-time option, SHA-1 - * support must be activated explicitly through mbedtls_ssl_conf_sig_hashes. - * The use of SHA-1 in TLS <= 1.1 and in HMAC-SHA-1 is always allowed by - * default. At the time of writing, there is no practical attack on the use - * of SHA-1 in handshake signatures, hence this option is turned on by default - * to preserve compatibility with existing peers, but the general - * warning applies nonetheless: - * - * \warning SHA-1 is considered a weak message digest and its use constitutes - * a security risk. If possible, we recommend avoiding dependencies - * on it, and considering stronger message digests instead. - * - */ -#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE - -/** - * Uncomment the macro to let mbed TLS use your alternate implementation of - * mbedtls_platform_zeroize(). This replaces the default implementation in - * platform_util.c. - * - * mbedtls_platform_zeroize() is a widely used function across the library to - * zero a block of memory. The implementation is expected to be secure in the - * sense that it has been written to prevent the compiler from removing calls - * to mbedtls_platform_zeroize() as part of redundant code elimination - * optimizations. However, it is difficult to guarantee that calls to - * mbedtls_platform_zeroize() will not be optimized by the compiler as older - * versions of the C language standards do not provide a secure implementation - * of memset(). Therefore, MBEDTLS_PLATFORM_ZEROIZE_ALT enables users to - * configure their own implementation of mbedtls_platform_zeroize(), for - * example by using directives specific to their compiler, features from newer - * C standards (e.g using memset_s() in C11) or calling a secure memset() from - * their system (e.g explicit_bzero() in BSD). - */ -//#define MBEDTLS_PLATFORM_ZEROIZE_ALT - -/** - * Uncomment the macro to let Mbed TLS use your alternate implementation of - * mbedtls_platform_gmtime_r(). This replaces the default implementation in - * platform_util.c. - * - * gmtime() is not a thread-safe function as defined in the C standard. The - * library will try to use safer implementations of this function, such as - * gmtime_r() when available. However, if Mbed TLS cannot identify the target - * system, the implementation of mbedtls_platform_gmtime_r() will default to - * using the standard gmtime(). In this case, calls from the library to - * gmtime() will be guarded by the global mutex mbedtls_threading_gmtime_mutex - * if MBEDTLS_THREADING_C is enabled. We recommend that calls from outside the - * library are also guarded with this mutex to avoid race conditions. However, - * if the macro MBEDTLS_PLATFORM_GMTIME_R_ALT is defined, Mbed TLS will - * unconditionally use the implementation for mbedtls_platform_gmtime_r() - * supplied at compile time. - */ -//#define MBEDTLS_PLATFORM_GMTIME_R_ALT - -/** - * Enable the verified implementations of ECDH primitives from Project Everest - * (currently only Curve25519). This feature changes the layout of ECDH - * contexts and therefore is a compatibility break for applications that access - * fields of a mbedtls_ecdh_context structure directly. See also - * MBEDTLS_ECDH_LEGACY_CONTEXT in include/mbedtls/ecdh.h. - */ -//#define MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED - -/* \} name SECTION: Customisation configuration options */ - -/* Target and application specific configurations - * - * Allow user to override any previous default. - * - */ -#if defined(MBEDTLS_USER_CONFIG_FILE) -#include MBEDTLS_USER_CONFIG_FILE -#endif - -#include "mbedtls/check_config.h" - -#endif /* MBEDTLS_CONFIG_H */ diff --git a/third_party/infineon/psoc6/psoc6_sdk/ota/cy8c6xxa_cm4_dual_ota_int.ld b/third_party/infineon/psoc6/psoc6_sdk/ota/cy8c6xxa_cm4_dual_ota_int.ld index d1717ff3e47ff0..7e8e34fa3239c4 100644 --- a/third_party/infineon/psoc6/psoc6_sdk/ota/cy8c6xxa_cm4_dual_ota_int.ld +++ b/third_party/infineon/psoc6/psoc6_sdk/ota/cy8c6xxa_cm4_dual_ota_int.ld @@ -43,15 +43,12 @@ ENTRY(Reset_Handler) /* Size of the stack section at the end of CM4 SRAM */ STACK_SIZE = 0x1000; -/* Size of the Cortex-M0+ application image at the start of FLASH - passed in as argument to ld.exe*/ -/* MCUBOOT_BOOTLOADER_SIZE = 0x12000; */ - -/* MCUBoot Header Size passed in as argument to ld.exe */ -/* MCUBOOT_HEADER_SIZE = 0x1000; */ - -/* CY_BOOT_PRIMARY_1_SIZE Slot 1 size passed in as argument to ld.exe */ -/* CY_BOOT_PRIMARY_1_SIZE = 0x0EE000 (Internal FLASH) */ -/* CY_BOOT_PRIMARY_1_SIZE = 0x10C000 (External FLASH) */ +/* + Arguments for OTA using MCUBoot -- will get from passed in Makefile: + --defsym,MCUBOOT_HEADER_SIZE=XXXX + --defsym,FLASH_AREA_IMG_1_PRIMARY_START=XXXX + --defsym,FLASH_AREA_IMG_1_PRIMARY_SIZE=XXXX +*/ /* Force symbol to be entered in the output file as an undefined symbol. Doing * this may, for example, trigger linking of additional modules from standard @@ -74,7 +71,7 @@ MEMORY * where 'xx' is the device group; for example, 'cy8c6xx7_cm0plus.ld'. */ ram (rwx) : ORIGIN = 0x08020800, LENGTH = 0xDF000 - flash (rx) : ORIGIN = 0x10000000 + MCUBOOT_BOOTLOADER_SIZE, LENGTH = CY_BOOT_PRIMARY_1_SIZE + flash (rx) : ORIGIN = 0x10000000 + FLASH_AREA_IMG_1_PRIMARY_START + MCUBOOT_HEADER_SIZE, LENGTH = FLASH_AREA_IMG_1_PRIMARY_SIZE - MCUBOOT_HEADER_SIZE /* This is a 32K flash region used for EEPROM emulation. This region can also be used as the general purpose flash. * You can assign sections to this memory region for only one of the cores. @@ -133,7 +130,7 @@ GROUP(libgcc.a libc.a libm.a libnosys.a) SECTIONS { /* Cortex-M4 application flash area */ - .text ORIGIN(flash) + MCUBOOT_HEADER_SIZE : + .text ORIGIN(flash) : { . = ALIGN(8); __cy_app_load_addr = . ; @@ -401,4 +398,4 @@ __cy_memory_4_start = 0x90700000; __cy_memory_4_length = 0x100000; __cy_memory_4_row_size = 1; -/* EOF */ +/* EOF */ \ No newline at end of file diff --git a/third_party/infineon/psoc6/psoc6_sdk/ota/matter-psoc6-mcuboot-bootloader.hex b/third_party/infineon/psoc6/psoc6_sdk/ota/matter-psoc6-mcuboot-bootloader.hex index a8ae0bf328eb65..ff4b8ae09aefb5 100644 --- a/third_party/infineon/psoc6/psoc6_sdk/ota/matter-psoc6-mcuboot-bootloader.hex +++ b/third_party/infineon/psoc6/psoc6_sdk/ota/matter-psoc6-mcuboot-bootloader.hex @@ -1,4099 +1,5769 @@ -:020000041000EA -:1000000000000208070500100D000000690500103F -:1000100000000000000000000000000000000000E0 -:100020000000000000000000000000006505001056 -:1000300000000000000000006505001065050010CC -:1000400065050010650500106505001065050010C8 -:1000500065050010650500106505001065050010B8 -:1000600065050010650500106505001065050010A8 -:100070006505001065050010650500106505001098 -:1000800010B5064C2378002B07D1054B002B02D06E -:10009000044800E000BF0123237010BD740700086E -:1000A00000000000DCF60010044B10B5002B03D05C -:1000B0000349044800E000BF10BDC0460000000036 -:1000C00078070008DCF6001010B500F07DF800F0AD -:1000D00007F800F069F800F01FF800F029F810BDEB -:1000E00010B50021012007F059F94D22002101200F -:1000F00007F092F80021012007F00EF900210020FE -:1001000007F04CF900220021002007F085F80021BB -:10011000002007F001F910BD10B5002200212F20AA -:1001200007F0C0F800220121052007F0BBF810BD40 -:1001300010B5134C134A0021200004F0AFFD124A01 -:100140000121200004F0AAFD104C114A00212000DA -:1001500004F0A4FD0F4A0121200004F09FFD0E4C85 -:100160000E4A0421200004F099FD0D4A06212000CA -:1001700004F094FD0B4A0721200004F08FFD10BD10 -:1001800000003140FCDF001030E000108002314000 -:1001900094DF0010C8DF00100003314060DF001062 -:1001A0002CDF0010F8DE0010034B332203495A50B5 -:1001B00003495A507047C0460000304008200000F4 -:1001C00010200000FEE7000030B583B0962100202B -:1001D00008F048F808F00CF800281BD1774AFF23F4 -:1001E0001B02D4583F231C4007F0F2FF002806D022 -:1001F000012007F0DBFF714B9B6C002B25DB6F4A66 -:10020000FF231B02D45007F07BFA07F06DFA0120A0 -:1002100007F08EFA012008F005FD08F0A1FC08F0B7 -:1002200087FD08F06FFD0021002007F0FFF9002096 -:1002300007F086F9012007F067F9002007F0E2F8DF -:100240005F4B1A683F23D45C06E00620FFF7BAFF35 -:10025000200007F0BBFC013C002CF9D1002101205B -:1002600007F09EFA002007F0CFF9002800D189E0BE -:1002700007F054FB0021002007F092FA0021002033 -:1002800007F0A4F94F4C002500950023002200211F -:10029000200004F055FC00950023002201212000DD -:1002A00004F04EFC484807F0FFF9002800D075E044 -:1002B000012007F017F9002007F042F9012007F0AC -:1002C00023F9002007F09EF80021012007F068FACA -:1002D0000021002007F064FA0021022007F060FAF4 -:1002E0000021032007F05CFA0021042007F058FAEF -:1002F0000021052007F054FA344807F02DFB0028B0 -:100300004FD1334807F0F6FB00284DD101210020E2 -:1003100007F05CF90021002007F088F92D49012041 -:1003200007F07AFC002842D12B49012007F00AFD92 -:1003300000283FD10021022007F048F901210220C6 -:1003400007F074F9022007F00DF907F0BFF800205C -:1003500007F088F8002007F09DF807F0ABF80020C0 -:1003600008F0F4FC012007F06BF807F0BDF901205C -:1003700007F0DEF99021002007F074FF00F01AF971 -:1003800003B030BD07F03AFA1223FF33984200D091 -:100390006EE70121002007F019F969E70520FFF752 -:1003A00011FF0420FFF70EFF0420FFF70BFF0320CF -:1003B000FFF708FF0320FFF705FFC04600002740B6 -:1003C000D45F01080000314040420F00C0E100103E -:1003D000400D0300D4E100101027000010B503F019 -:1003E00059F9054C200004F055FB200004F052FBA5 -:1003F000012002F04FFE10BD8002314010B584682C -:1004000003681B89E418094B1B68DB68382201214B -:1004100007480AF0B5F80A21064803F01DF9FFF76E -:10042000DDFF200000F082F910BDC046EC0100089D -:10043000DCE100100000654010B584B0FFF744FE19 -:1004400062B6E120400203F0E9F8264C2368DB683D -:100450001022012124480AF093F82368DB68222245 -:10046000012122480AF08CF8012002F0C1FD041E8F -:100470000DD11C4B1B68DB682E2201211C480AF0A1 -:100480007FF8002C0BD0002008F032FAFBE7154B68 -:100490001B68D8682200174909F0FEFFF1E701A8A0 -:1004A00000F086FF00280FD10E4B1B68DB682F225F -:1004B000012111480AF064F8FA20000102F0BAFFA5 -:1004C00001A8FFF79BFFDEE7064B1B68DB683222C3 -:1004D00001210A480AF054F80A21094803F0BCF83F -:1004E000D1E7C046EC01000818E200102CE2001031 -:1004F00050E2001080E20010C4E20010F4E20010AC -:10050000000065407047FFF7FDFF72B60F4C104DBD -:10051000AC4209DA21686268A368043B02DBC85870 -:10052000D050FAE70C34F3E70A490B4A0020521A7C -:1005300002DD043A8850FCDC084809490860BFF332 -:100540004F8F00F075F8FFF777FFFEE7E8F6001031 -:1005500000F70010740700087C6001080000000824 -:1005600008ED00E0FEE7FEE700B504207146084212 -:1005700002D0EFF3098001E0EFF30880043007F0C8 -:1005800059FEFEE7000000000230800803D0013071 -:100590000238FCD1C046C0467047EFF3108072B6F7 -:1005A000704780F31088704710B5002004F0C2FD3A -:1005B00010BD704710B5002007F0EAFC041E00D102 -:1005C00010BD144B186006F0AFFF411C200008F06E -:1005D00035FC0400104B186006F026FF411C20007B -:1005E00008F02CFC04000D4B1860013C0C49200065 -:1005F00008F024FC01300B4B1870FA218900200010 -:1006000008F01CFC0130084B1860C003074B186051 -:10061000D6E7C04684000008880000088000000873 -:1006200040420F0094000008900000088C00000871 -:1006300010B5234803F036F8224CB022D200A3585C -:100640005B005B08A350E02189006358302083439E -:10065000635080235B04A3501B4B1C4AE2500433BD -:10066000A0229201E2501A4BFF22E25008F098FBC0 -:10067000C0225200A35801218B43A350FFF799FFDA -:10068000FFF798FF134B1B68BA20195ACA00521A79 -:10069000196A8C4662440021D1601A6A185AC30054 -:1006A0001B1AD31859600C4A8031032004F09AFDBC -:1006B0000A4804F0F3FB0A4804F048FC10BDC046A9 -:1006C000F8ED001000002640840500000100020043 -:1006D0008C050000D45F010820070008900700087F -:1006E00028E30010034A90235B01D35803201840ED -:1006F0007047C0460000204010B5FFF74EFF084C81 -:10070000902149016358074A1A40074B134363502D -:10071000034B5B68DB06FBD5FFF743FF10BDC0460C -:1007200000002040FCFF00000100FA0570B5040045 -:10073000830500D001BEFFF730FF0500FFF7D2FFB1 -:10074000032813D00B4B802292009C509020400134 -:100750001A5809491140094A0A431A50054B5B6867 -:10076000DB06FBD52800FFF71CFF70BDFFF7C4FFB9 -:10077000E8E7C04600002040FCFF00000300FA0547 -:1007800000B583B0130001AA1370012301F055FADC -:1007900003B000BD10B509F00DFF10BD04280AD04C -:1007A000052804D101394B1E994108007047401AB1 -:1007B00043425841FAE70120F8E710B582B00C0037 -:1007C000C0B201A901F07EFF002803D0012420005F -:1007D00002B010BD2100019801F094FA04000198C4 -:1007E00001F084FFF3E710B5040001F015FA0100F1 -:1007F00001222000FFF7C4FF10BD10B5040001F076 -:1008000007FA010001222000FFF7BAFF10BD000027 -:1008100030B583B004000E2A10D80E2915D8120165 -:100820000A436B46DD1DDA7101F0FBF9010001237B -:100830002A00200001F001FA03B030BD9C21064BD4 -:10084000064A8900064809F009FE9C21054B034A27 -:100850008900034809F002FE5CE30010CCE40010BC -:1008600070E30010B8E3001010B582B004000191ED -:1008700001F0DCF90100042301AA200001F0DDF9F8 -:1008800002B010BD30B589B006A90120FFF795FF71 -:10089000002800D08CE004A90230FFF78EFF04008E -:1008A000444B1B68D86806AB1B78012B28D0032B60 -:1008B00024D0414B06AA51789578D27802920195BE -:1008C00000913E4A3E4909F0E7FD3A4B1B68D86863 -:1008D00004AB1B78012B17D0032B13D0364B04AA83 -:1008E00051789578D278029201950091354A344931 -:1008F00009F0D2FD002C11D0FF2057E0324BD9E790 -:10090000324BD7E7304BEAE7304BE8E72B79042B43 -:1009100028D006AA9278934224D00134022C3CD8E5 -:1009200063001B195B002A4AD51806A90978D05C18 -:10093000FFF734FF0028F0D004AB19786878FFF790 -:100940002DFF0028E9D0AB78042B03D006AAD2787B -:100950009342E2D1EB78042BD8D004AAD278934208 -:10096000DBD1D3E7134B1B68D8686B79022B07D018 -:10097000032B10D0042B01D0164A02E0164A00E0E7 -:10098000164A174909F088FD6879831EDBB2022BED -:100990000CD9FF200AE0134AF3E7064B1B68DB681B -:1009A00017220121104809F0EBFD012009B030BDEC -:1009B000FF20FBE7EC010008CCE300100CE4001082 -:1009C00030E4001074E40010D8E30010D0E300100D -:1009D000F4E40010F0E3001004E40010E0E3001081 -:1009E0009CE40010E8E30010B4E4001070B50500CA -:1009F000002915D001235B422878584004090F22B2 -:100A00001040094E80008359634018091A40920033 -:100A100093594340013901350029EDD1D84370BDC8 -:100A200001235B42FAE7C04608E50010F0B5CE4668 -:100A3000474680B5A7B0140099462E9F2F9B984635 -:100A4000684602F0B9FC0021684602F0BAFC319B0E -:100A5000002B02D0329B002B07DC2389E2689446EE -:100A600063446689F618002513E01A003199684638 -:100A700002F0B5FCF1E723003A002900484601F0F6 -:100A800037FE002811D122003900684602F0A7FC89 -:100A90002D19B54204D2741B4445ECD94446EAE70B -:100AA0003099684602F0A7FC002027B0C0BCB946C8 -:100AB000B046F0BDF0B59FB017001D002C4B1E686E -:100AC000279B0493269B039306AB0293259B0193DC -:100AD000249B00932B00FFF7A9FF041E3DD1289B08 -:100AE000002B04D0202206A9180009F071FD002374 -:100AF0000093204B2A00390016A801F00FFD041EB8 -:100B00002BD11CAB72226A441DA916A801F07CFDF2 -:100B1000002821DB1CDC1CA909881029F1D17223D3 -:100B20006B441B88202B20D10EAA1D99280001F0B0 -:100B3000DFFD071E17D120220EA906A8FFF72AFE07 -:100B400006000D4B1B6801248342DAD03C0004E010 -:100B500063425C41E4B200E00400002C00D13400A8 -:100B600020001FB0F0BD0400F7E701246442F7E75E -:100B700098000008FFFF00001009000810B50B4B9B -:100B800002689A420FD1C2680389D843824202D8D0 -:100B9000D418012000E00020002805D08B68A34273 -:100BA00002D8002000E0002010BDC0463DB8F396FA -:100BB000F0B585B005000C000192002001F098FE10 -:100BC000C0B203A901F07EFD002806D001270398DA -:100BD00001F08CFD380005B0F0BD2C236343EB1809 -:100BE0001A89DE689619042302AA3100039801F0DD -:100BF0007FFD071E26D12C214C432D196C8902AB99 -:100C00001A88134B9A420DD0002C1DD102AB1A88C2 -:100C1000104B9A421AD1331902AA52889B18019A92 -:100C20001360D4E702AB59888C4201D00327CEE78A -:100C30008919042302AA039801F05AFD0028E5D07F -:100C40000127C4E70127C2E70327C0E70327BEE760 -:100C5000086900000769000010B582B004000800B0 -:100C6000E02212010192012906D002290FD00729A2 -:100C700010D1E26D603401E0626A283401A901F00C -:100C800085FE002801D1019B236002B010BD226DBA -:100C90005434F3E70120F8E710B5006A01F018FEBC -:100CA00010BD70B504000121FFF7D6FF002802D067 -:100CB0000125280070BD02212000FFF7CDFF00288C -:100CC00001D00125F5E707212000FFF7C5FF051E2C -:100CD00001D00125EDE72000FFF7DEFFA066E8E781 -:100CE000F0B583B004000F00002001F001FEC0B297 -:100CF00001A901F0E7FC061E1AD1019801F008FED7 -:100D00000500019801F0F2FC2C21794361180023C1 -:100D1000032B05D8CA5C954208D10133DBB2F7E753 -:100D20000123002B07D0300003B0F0BD0023F8E70B -:100D300001267642F7E701267642F4E700B587B050 -:100D4000130000220492039202920132FF320192B8 -:100D5000044A00920A0000210020FFF7ABFE07B012 -:100D600000BDC046805D0108F0B585B005000C00EF -:100D70000192244B1F68002001F0BAFDC0B203A904 -:100D800001F0A0FC002802D0380005B0F0BD2C30E6 -:100D900060432E1821002800FFF7A2FF00282BD067 -:100DA0003369D90601D5012727E0019B039A310059 -:100DB0002800FFF7C3FF0700039D29003000FFF75D -:100DC000DDFE002803D0104B1B68BB4215D0002C61 -:100DD0000AD10E4B1B68D868002C0BD10C4A0D4968 -:100DE00009F05AFB012708E0AA680021280001F059 -:100DF00015FDEEE7084AF2E70127039801F076FCBB -:100E0000C2E7C0469800000810090008EC0100087D -:100E100054E500105CE5001048E5001070B50500D1 -:100E20000E000020FFF72EFD0400022805D0042844 -:100E300003D0032801D0200070BD3200012128001A -:100E4000FFF792FF044B1B688342F4D0012801D0C6 -:100E50000524F0E70400EEE710090008F8B50600E5 -:100E60000D0017000024012C11DC2C226243B21863 -:100E70003B002100300000F0D9FB002801D10134F3 -:100E8000F1E7002C04DD002D02D1002000E000205D -:100E9000F8BD002383718360C36001334371036035 -:100EA0000371C37170474379012B01D00020704753 -:100EB0000368012B01D00020F9E70379012B01D051 -:100EC0000020F4E70120F2E730B583B005000C0004 -:100ED0000023009301930800FFF7E5FF002830D0BE -:100EE000204B2A689A4212D01E4BEA6A9A421BD0C3 -:100EF000019B009A934200D90093009BA360009A43 -:100F00002100280000F0D2FD002003B030BD6A4669 -:100F100000212800FFF74CFE0028E5D0124B134AB1 -:100F20001349144809F09AFA01AA01212800FFF791 -:100F30003FFE0028DCD00C4B0C4A0F490D4809F04D -:100F40008DFA21000831002001F000F8002802D1BC -:100F5000A3680093D3E7044B044A0849054809F005 -:100F60007DFAC0463DB8F39688E50010C8E600104B -:100F70003604000090E500104D0400006D040000F0 -:100F800070B504000D00FFF79FFF002812D1EB7928 -:100F90006422A354033BDBB2012B11D9EB79022B62 -:100FA00017D0042B15D0032B13D06423E35CFF2B45 -:100FB00018D070BD124B134A1349144809F04EFA69 -:100FC000002000F011FA0028E8D06423FF22E25448 -:100FD000E4E7002000F0F4F90028E6D06423FF22C3 -:100FE000E254E2E70A4B1B68DB680E220121094844 -:100FF00009F0C6FA084B034A0849044809F02EFADA -:1010000088E50010D8E600109605000090E5001075 -:10101000EC010008D0E50010E0E50010AE0500008E -:1010200070B50400FFF750FF002814D16423E55C7D -:10103000EB1EDBB2012B14D9022D03D0042D01D0FD -:10104000032D07D1002000F0BBF9002802D0642353 -:10105000FF22E25470BD084B084A0949094809F0CB -:10106000FDF9002000F0C0F90028E5D06423FF223C -:10107000E254FF25E2E7C04688E50010B4E6001020 -:101080005305000090E5001070B504000D00FFF757 -:1010900008FE00280FD1002200212000FFF7DEFE0D -:1010A000002814D1200000F0CDFB00281AD16423C1 -:1010B0000122E2540AE0344B1B68D868E022120196 -:1010C000324909F0E9F964230122E25470BD2E4B44 -:1010D0001B68D86800222E4909F0DEF9642301223A -:1010E000E254F3E72800FFF7D4FE2900200001F0C6 -:1010F00001F8002814D12800FFF7D5FE00281AD0E7 -:10110000EB79012B34D02A0001212000FFF72CFEBF -:10111000204B1B68834232D064230522E254D5E77A -:10112000194B1B68D86800221B4909F0B5F96423E4 -:101130000122E254CAE729002000FFF721FF00281E -:101140000AD12A0000212000FFF788FE002809D1DB -:1011500064230122E254B9E7104B114A11491248A5 -:1011600009F07CF90D4B0E4A10490F4809F076F949 -:1011700029002000FFF752FE6423E054A6E7EA7935 -:101180006423E254A2E7C046EC010008E4E5001045 -:101190002CE60010100900085CE6001088E500103D -:1011A000F4E600105306000090E500105906000018 -:1011B00010B501F033FB10BDF8B5DE4657464E467C -:1011C0004546E0B58946924698460A9B9B460B9E4B -:1011D000002512E04346E9182300124A484601F070 -:1011E00087FA002819D15B46E91823000D4A5046BA -:1011F00001F0BEFA002812D12D19B54206D2741B97 -:101200008023DB009C42E5D91C00E3E70020F0BC12 -:10121000BB46B246A946A046F8BD0120F7E701202B -:10122000F5E7C04680090008F0B5C64600B584B0B1 -:1012300004000E004E4B1B6898466C22002109F0FA -:10124000D0F94C4B63624C4B23654C4BE365012753 -:101250007F420025012D14D82900002001F048FB11 -:101260002C21694320316118C0B201F02BFA071E0E -:1012700001D10135EEE7424B424A4349434809F068 -:10128000EDF869462000FFF7FFFE6423E35C6A4641 -:10129000D371042B18D8022B21D2012B2BD164231C -:1012A000E35CFF2B2BD0012B37D1394B22689A42BC -:1012B0003BD0384B1B68D86800232200364909F020 -:1012C000EBF80327002549E0052B14D1002000F09E -:1012D0008BF8071EE3D06423FF22E254DFE7694660 -:1012E0002000FFF79DFE071ED9D0254B254A2B492C -:1012F000264809F0B3F86423FF22E254CFE7254BD8 -:101300001B68DB680E220121254809F039F9254BBD -:101310001C4A25491D4809F0A1F86A460021200011 -:10132000FFF79CFD071EC0D0CCE7102200216846C5 -:1013300009F057F9236A5B783371236A5B68B360FD -:1013400034601A4B1B689846BCE70122521B2C23C1 -:101350005343E318186A01F0C9F90135012DF4D996 -:10136000002F00D14746380004B080BCB846F0BD1D -:1013700098000008800D0008807D000880ED0008BE -:1013800088E5001014E70010D406000090E5001076 -:101390003DB8F396EC0100088CE60010140700003D -:1013A000D0E50010E0E500102B0700001009000850 -:1013B00010B501000148FFF737FF10BD1409000800 -:1013C00010B582B001A9012001F07CF9002803D0FA -:1013D0000124200002B010BD0198FFF704FA0400B8 -:1013E000019801F083F9F4E710B584B003A9012056 -:1013F00001F068F9002803D00124200004B010BDDA -:1014000001A9039800F07EFC041E0CD101ABDB782F -:10141000032B03D0039801F069F9EEE70398FFF777 -:10142000ECF90400F6E70124F4E70000F0B5CE463D -:1014300000B582B00C0016001D00526AC300D758D8 -:101440001368FF1A0138C0001258D31A99462B6846 -:10145000012B15D1EB68022B0CD00899300000F05D -:101460008BFD00282AD12A000899300000F0EAFDFF -:1014700000282AD10999300000F07EFD00282BD1E8 -:10148000220039000898FFF793FE00282BD1019421 -:1014900000974B46089A11003000FFF78DFE002898 -:1014A00028D12900300000F0E9FB2B6801332B60C4 -:1014B000002826D102B080BCB946F0BD5421144B9F -:1014C000144AFF31144808F0C9FFAB21104B114AF0 -:1014D0004900114808F0C2FFAD210D4B0D4A4900EB -:1014E0000D4808F0BBFFAF21094B0A4A49000A48E2 -:1014F00008F0B4FF6221064B064AFF31064808F0A7 -:10150000ADFFB321024B034A4900034808F0A6FF90 -:1015100088E50010CCE8001024E70010F0B5CE46B6 -:10152000474680B583B00F0015001C00566AC30003 -:10153000F2583368D21A90460138C0003658F61A6D -:101540002A6D11581368CB1A99462279012A07D0BF -:101550002379022B32D003B0C0BCB946B046F0BDEF -:101560003A0031000A98FFF723FE002818D10197AE -:1015700000964B460A9A0B992800FFF71DFE00289B -:1015800015D12100280000F079FB022323710028E7 -:10159000DED08021224B234AFF31234808F05EFF32 -:1015A0007A211F4B1F4AFF311F4808F057FFBE2109 -:1015B0001B4B1C4A49001C4808F050FF3A004946A2 -:1015C0000B98FFF7F5FD00281CD101974B460093BF -:1015D00043460B9A0A992800FFF7EEFD002818D120 -:1015E0002100280000F04AFB236801332360012317 -:1015F00023710028AFD08C21094B0A4AFF310A48D9 -:1016000008F02CFFC221064B064A4900064808F0A4 -:1016100025FF8821024B034AFF31034808F01EFFD3 -:1016200088E50010B8E8001024E7001070B582B01B -:1016300016001C1E3AD0436A5D686379012B12D0F4 -:10164000022B19D00025002001F052F9C0B201A9E7 -:1016500001F038F8002830D00125019801F046F853 -:10166000280002B070BD002922D11D4B1B682268E2 -:101670009A42E8D80025E6E72368012B08D9184AE2 -:101680001268934204D8002914D100250131DAE709 -:10169000012B01D00025D6E7002900D00025012923 -:1016A000D1D12379022BCED10021CCE70025CAE786 -:1016B0000025C8E700250021C5E7202332002900C6 -:1016C000019801F015F8051E08D1002CC5D032682C -:1016D000044B9A42C1D001256D42BEE70125BCE70B -:1016E0009C0000083DB8F396F0B5DE4657464E46DE -:1016F0004546E0B589B006000591049200230393A6 -:101700000378032B00D182E000F095FAE0252D014B -:1017100000239A460133019300239B46013B9946DF -:101720000023029380464F460BE06B1E9B460292BD -:101730001AE0019BA34202D001239C46E244013DF2 -:101740000194002D1DDD30784346E918013901234D -:1017500006AA073200F086FE041E5ADB06ABDA79D1 -:10176000531EDBB2012BE0D9300001F0D1F806ABFB -:1017700007331B789842DCD07A1CE0D12F0003930A -:10178000DDE7B9465346012B24DC049908310020DB -:1017900000F0DCFB041E2BD1049B9E6805998F6E24 -:1017A0003900300007F04AFB05003900300007F02F -:1017B000CBFB4B1E99416918484601302AD0894518 -:1017C0001CDA0123049A537113004A461A60039AE3 -:1017D0001A711FE0134B1B68DB6825220121124898 -:1017E00008F0CEFE114B124AC221124808F036FE14 -:1017F000114B0F4AC8210F4808F030FE0223049A0B -:10180000537113005A461A60029A1A7102E00724B3 -:1018100000E00124200009B0F0BCBB46B246A94656 -:10182000A046F0BDEC0100086CE70010E0E50010F8 -:1018300010E9001024E7001088E500100068484314 -:101840007047000070B5856A446DAC4202D0631CDD -:10185000AB4213D1E0231B019D4219D80023002184 -:10186000A34229D2DA00416A89184968066DB44654 -:10187000624452688A4215D10133F1E7194B1B6863 -:10188000DB683A220121184808F07AFE002012E0B5 -:10189000144B1B68DB6831220121144808F070FEEC -:1018A000002008E00F4B1B68DB682E220121104846 -:1018B00008F066FE002070BDAC4211D2426ADB0027 -:1018C000D3185B68994201D10120F4E7054B1B68EE -:1018D000DB682E220121064808F052FE0020EAE7CC -:1018E0000120E8E7EC01000894E70010D0E70010C1 -:1018F00004E8001070B586B004A90120FEF75DFF72 -:10190000041E25D11D4B1B68D86804AB1B78012B26 -:1019100027D0032B23D01A4B04AD6A78A978EE7830 -:10192000029601910092174A174908F0B5FD2B78ED -:10193000012B02D1AB78032B15D0104B1B68DB6851 -:1019400019220121114808F01BFE200006B070BDCD -:1019500030210F4B0F4AFF310F4808F07FFD0F4B2E -:10196000DAE70F4BD8E7054B1B68DB682122012122 -:101970000C4808F005FE0224E7E7C046EC01000829 -:10198000CCE3001034E8001030E400107CE80010D4 -:1019900088E50010FCE8001024E70010D8E30010F0 -:1019A000D0E3001058E80010F0B589B005900C00A5 -:1019B0001500334962681140324A914202D12268CF -:1019C000012A01D009B0F0BD06A91800FEF7F5FE06 -:1019D000002834D12C4B1B68D86806AB1B78012B30 -:1019E00036D0032B32D0294B06AF7A78B978FE78FF -:1019F000029601910092264A264908F04DFD3B7857 -:101A0000032BDFD12900059800F0B6FA002821D178 -:101A10002800FEF7F2FE002823D1A1682800FEF777 -:101A200023FF002824D1280000F010F90028C9D095 -:101A3000B821194B194AFF31194808F00FFDD4217C -:101A4000154B164A4900164808F008FD154BCBE720 -:101A5000154BC9E7D721104B104A4900104808F030 -:101A6000FDFCB2210C4B0D4AFF310D4808F0F6FC8D -:101A7000DA21094B094A4900094808F0EFFCC04641 -:101A800000FF00FF00010004EC010008CCE300109F -:101A900098E8001030E4001088E50010ECE8001031 -:101AA00024E70010D8E30010D0E30010F0B5C646DC -:101AB00000B584B080460E00354B00211960436AA2 -:101AC0005F680023DB19324D29684C1C2C6093425F -:101AD000F8D303A9012000F0F5FD002812D102A9D6 -:101AE000022000F0EFFD002813D10223029A3100FA -:101AF0004046FFF759FF7379012B11D00223737110 -:101B0000012429E0D821234B234AFF31234808F040 -:101B1000A5FCED211F4B204A4900204808F09EFCFF -:101B20001B4B1C6800E0013C002C11D0184B1B68BB -:101B300032689B1A0133A342F5D3029B0193039BA6 -:101B400000933300424639002000FFF76FFCEAE7BC -:101B500001233360D2E701340D4B1B68A3420DD340 -:101B60003368A342F7D8029B0193039B0093330091 -:101B7000424639002000FFF7D1FCECE7039800F063 -:101B8000B5FD029800F0B2FD04B080BCB846F0BDCF -:101B90009C00000888E50010E0E8001024E7001031 -:101BA000012800D170470220FCE7000010B5102288 -:101BB000044908F0FFFC002801D0022010BD0120DC -:101BC000FCE7C046E4E4001030B585B00D0001200C -:101BD00000F078FD041E02D0200005B030BD1023B7 -:101BE0006A460949012000F03DFC041E07D110227D -:101BF0000649684608F0DEFC002800D10400286889 -:101C000000F074FDE8E7C04684110000E4E4001031 -:101C1000004870478311000010B5FFF7F9FF013845 -:101C200010BD10B5FFF7F8FF013810BD10B5FFF774 -:101C3000F8FF043810BD0020704710B5007800F0A0 -:101C40009FFB002800D110BD0120FCE710B50078F3 -:101C50001023044A044900F093FB002800D110BD72 -:101C60000120FCE7E4E400108411000010B5C36D0E -:101C700059689020800107F0E1F810BD30B583B0BD -:101C80000C0001A9012000F01DFD002806D0012450 -:101C9000019800F02BFD200003B030BD0198FFF744 -:101CA000CAFF050001212000FFF7C8FD291863794C -:101CB000012B0ED023790133DBB26A460332137055 -:101CC000019B1878012300F05BFB041EE0D0012487 -:101CD000DEE72379F1E7F0B5C64600B580460F0090 -:101CE0001600002400E00134B44207D23D5D4046B6 -:101CF00000F00EFE8542F6D0002000E0012080BCFE -:101D0000B846F0BDF0B5DE4657464E464546E0B50E -:101D100089B004000E0002A9072000F0D3FC051EC4 -:101D200008D00127380009B0F0BCBB46B246A9462E -:101D3000A046F0BD2078102304AA834900F092FB4E -:101D4000002800DAEEE0102204A90298FFF7C3FF92 -:101D5000071E00DAE8E001286FD004A8FFF726FF8D -:101D600030700023994698462000FFF75AFF010083 -:101D70002078012302AA073200F074FB002800DA61 -:101D8000D4E0012202ABD91D0298FFF7A4FF00287E -:101D900000DACDE002AB07331B780F221A407270D5 -:101DA0001B093371012801D0042A03D90123737060 -:101DB000002333712000FFF72FFF01002078B71CAC -:101DC00001233A0000F04EFB002800DAB2E00122C5 -:101DD00039000298FFF77FFF002800DAACE0012805 -:101DE00063D0B078FFF7DCFEB0702000FFF710FF83 -:101DF00082462078F31C9B4601235A46514600F048 -:101E000031FB002800DA99E0012259460298FFF7D9 -:101E100062FF071E00DA93E0012849D0F078FFF74F -:101E2000BFFEF0704B46002B00D18BE010224146E4 -:101E3000200000F0F3FC070074E7032333702378DD -:101E4000022B05D0062B03D00023994698468BE73A -:101E5000A36810225242944663449846102304AA71 -:101E60004146200000F06EFD8146031E00DA59E76E -:101E700001280DD004A8FFF799FEC0B230700128E8 -:101E80000BD04B46002B00DA4CE7012399466BE759 -:101E9000023333700023994666E72078102304AAA2 -:101EA000294900F06DFA8146EBE70323B3709CE704 -:101EB0000323F3702378052B25D021D8012B22D0C2 -:101EC000022B00D02EE7A3681822524294466344A6 -:101ED000984601235A464146200000F033FD031E78 -:101EE000019000DA1EE7012811D0F078FFF758FEC4 -:101EF000C0B2F07002280DD1019B002B96DA11E7D9 -:101F0000062BE0D00EE7B378012B8BD1DBE7023351 -:101F1000F37087E7207801235A46514600F030FAE3 -:101F20000190E9E70127FDE60127FBE60127F9E635 -:101F30000127F7E60127F5E60127F3E60127F1E699 -:101F40000127EFE62F00EDE68411000030B583B0E5 -:101F50000C0001A9FFF738FE002801D003B030BD06 -:101F6000019D2800FFF762FE01002878042322006B -:101F700000F078FAF2E70000F0B5CE46474680B5AB -:101F800083B007008946294B1B68D8680A7828491E -:101F900008F082FA01A9072000F094FB002806D07F -:101FA0000124200003B0C0BCB946B046F0BD0021FA -:101FB00000F09EFC04000121002000F099FC4B463B -:101FC0001B78A34201D083422ED1180000F048F9BB -:101FD00080463800FFF74AFE441E0025FA6DE300F4 -:101FE000D3185E6819681368C91A41443200019811 -:101FF000FFF7DEF8002811D1013CAD1990239B01B9 -:102000009D42EBD34B46996840394022484600F048 -:1020100005FC0400019800F069FBC2E7054B064A85 -:102020000649074808F01AFA0124BAE7EC0100084B -:1020300028E9001088E50010C0E90010190200002E -:102040004CE9001030B583B00C0015006946022041 -:10205000FEF7B3FB002814D1E979012917D16B46AB -:10206000DB78012B1FD0A9682000FEF7FDFB0028BC -:1020700024D12000FFF7EAFD002825D1002003B07D -:1020800030BD144B144A1549154808F0E7F90022F1 -:102090002000FEF7BDFB0028E1D00E4B0E4A11498F -:1020A0000F4808F0DBF92000FEF7A7FB0028DAD084 -:1020B000084B094A0C490A4808F0D0F9054B064A72 -:1020C0000A49074808F0CAF9024B034A084904487C -:1020D00008F0C4F988E50010ACE900103E020000E9 -:1020E0004CE9001042020000470200004B020000D1 -:1020F0005602000070B584B005000E00FFF7FAFB31 -:10210000041EF06008D0022809D103A9012000F0C4 -:10211000D9FA002809D00124200004B070BD1E4B5C -:102120001E4A1F491F4808F099F902A9072000F02C -:10213000C9FA002801D00124EEE7320029000398F3 -:10214000FFF7D2FA041E19D10398FFF76AFD0100C8 -:1021500001236A460732012000F084F901226B4610 -:10216000D91D0298FFF7B7FD002813DB01280CD01A -:102170006B46DA790F231340F3710400039800F0E3 -:10218000B5FA029800F0B2FAC6E76B460122DA719E -:102190002000EDE70124BFE7E0E5001098E900101A -:1021A0006F0200004CE9001010B5FA21490006F05A -:1021B00045FE10BD10B5FFF7F7FF400210BD10B58A -:1021C000FEF714FC10BD000070B5204CA5440400BF -:1021D0000E001D000132839201A9072000F072FA5F -:1021E000002805D00124200084239B009D4470BD5D -:1021F000FA225200290002A808F0EAF9839B809392 -:10220000134B1B687F93FE21490002A8FFF7D7FFFD -:1022100082908190012E10D00136F1008919490277 -:10222000091980239B0002AA019800F0A1FA041E5C -:1022300005D1019800F05AFAD5E70026EDE7054BE5 -:10224000054AE921054808F009F9C046F0FDFFFFFD -:10225000C4EA001088E500107CEA0010DCE90010F8 -:10226000012804D0022804D190208001704700206A -:10227000FCE701204042F9E7F0B5DE4657464E46FE -:102280004546E0B5394CA54481460191029205A925 -:10229000072000F017FA061E63D100250023984698 -:1022A00000279A4603930CE0859B9B46FE2149003C -:1022B00006A8FFF784FF584518D001239C46E24446 -:1022C0000135012D19D8EC00641964024C448023B7 -:1022D0009B0006AA2100059800F00AFA002842D1C6 -:1022E000234B839A9A42DFD00137E9E7849B9845D4 -:1022F000E6D82E0098460394E2E7022F11D0534609 -:10230000022B1CD101267642059800F0EFF930002F -:1023100087239B009D44F0BCBB46B246A946A0461D -:10232000F0BD0023029A1360059800F0F1FA010055 -:10233000FA225200019808F054F90126E4E7029BC2 -:1023400042461A60FA235B00019A0399059800F04F -:10235000CFF90028D8D0074B074AAB21074808F02F -:102360007DF80126D3E70126D1E7C046E4FDFFFF53 -:10237000AFBEADDE88E50010ACEA0010DCE900106D -:10238000F0B5CE46474680B5FFB007000C00914639 -:102390001E00FA214900200006F0D6FD0D0032197A -:1023A0002A4B9A420DD83800FFF75AFF071E0FDB61 -:1023B0002000FFF7FFFEC719002398460120404286 -:1023C00026E00E21224B234AFF31234808F046F82D -:1023D0001221224B1F4AFF311F4808F03FF85A1BB9 -:1023E000280068444946414408F0F2F86B467D9A5B -:1023F00021003800FFF7E8FE002818D1F53EFF3E27 -:1024000080239B009C4667440C3B9C46E04400258F -:10241000002E15DD7DAA69463800FFF72DFF041E4A -:102420000CDBFA235B009E42D9DC3200D8E72E2178 -:102430000B4B084AFF31084808F010F801204042D1 -:102440007FB0C0BCB946B046F0BDC0469411000094 -:1024500028EA001098EA0010DCE9001054EA0010A5 -:1024600088E50010F0B5C64600B5FEB005000E00C8 -:1024700090461C00FA214900300006F065FD0F006F -:10248000A219214B9A420AD82800FFF7E9FE051E3F -:102490000CDB3000FFF78EFE451900261DE0AA2157 -:1024A0001A4B1B4A49001B4807F0D8FFAC211A4BB6 -:1024B000174A4900174807F0D1FF22003900694444 -:1024C0004346981908F084F8F53CFF3C80239B00B4 -:1024D0009C466544F536FF360027002C0CDD7DAAAE -:1024E00069462800FFF7C8FE00280ADBFA235B00D4 -:1024F0009C42E2DDDA1BE1E700207EB080BCB846FA -:10250000F0BD01204042F8E79411000028EA0010D5 -:1025100064EA0010DCE9001054EA0010F0B5D64679 -:102520004F464646C0B582B004000D0017009946DC -:102530000AAA13789A46002845D0002947D0002FD0 -:1025400049D00E89CB689C466644042301AA310019 -:10255000380000F0CDF88046002840D101AB1A8841 -:10256000274B9A421FD06B89002B40D101AB1A88B0 -:10257000244B9A423FD1256067604B4623815346E6 -:10258000A3726B899B19E3606B899B1901AA52881E -:102590009B18636104362661404602B0E0BCBA462F -:1025A000B146A846F0BD6B8901AA51888B421AD169 -:1025B00089190423380000F09BF80028D6D00123A5 -:1025C0005B429846E8E701235B429846E4E7012333 -:1025D0005B429846E0E701235B429846DCE7012333 -:1025E0005B429846D8E701235B429846D4E7012333 -:1025F0005B429846D0E701235B429846CCE7C04651 -:102600000869000007690000F0B583B004000F00FE -:1026100016001D00002848D00368002B48D04368EE -:10262000002B20D1012040423BE0042301AA216974 -:10263000606800F05DF800283DD1A37A002B03D03C -:102640002369E268934239D223891D4A934218D004 -:1026500001AA1288934214D001AB5B882269944688 -:102660006344043323612369626993421BD2226865 -:102670005289002AD9D0E2689A42D6D10433236124 -:10268000D3E7002D02D001AB1B882B8023690433D4 -:102690003B6001AB5B88338022699446634404331A -:1026A000236103B0F0BD0120FBE701204042F8E7C1 -:1026B00001204042F5E701204042F2E70120F0E727 -:1026C000FFFF000010B5002200E001329300064C2D -:1026D0001B59002B05D01C788442F6D10B600020DA -:1026E00001E00120404210BDA0000008704700003A -:1026F00070B5150044688C4214D9CA18944218D990 -:10270000611842787F2A1BD052B2002A1EDB0124B6 -:102710006442114B1B68D8682200104907F0BCFEC8 -:10272000200070BD20210E4B0E4AFF310E4807F0ED -:1027300095FE90210D4B0B4A49000B4807F08EFE89 -:102740001A00280007F044FF0024E9E72A0000F0FF -:102750006FF9041EE4D0DCE7EC01000844EB001044 -:10276000C8EA001098EC0010DCEA00102CEB001016 -:10277000F8B5150044688C420CD9CA18944210D997 -:10278000641842787F2A13D052B2002A34DB012029 -:102790004042F8BDA3211B4B1B4A49001B4807F0D0 -:1027A0005DFE48211A4B184AFF31184807F056FEC3 -:1027B000DA0506D1E205D00D002A09D15F0A06002C -:1027C00017E0A921134B104A4900104807F046FEB4 -:1027D0005421114B0C4AFF310C4807F03FFE2900F1 -:1027E000200002F017F980239B009C466444654456 -:1027F0000136BE42F3D3CCE72A00210000F040F9B5 -:10280000C7E7C046C8EA001084EC0010DCEA0010FC -:102810002CEB00106CEB00108CEB001070B5836893 -:10282000934211D38B4216D9541845685B199C42C8 -:1028300018D26D18531941787F291AD049B200294E -:1028400034DB0120404270BDBC211B4B1B4A4900B8 -:102850001B4807F003FE7A211A4B184AFF3118482B -:1028600007F0FCFDBD21184B144A4900144807F03D -:10287000F5FD6D0A6D025B0A5B029D4212D05B1B87 -:102880005C0A0020002CDED0013C6002401902F0FE -:1028900087F80028F6D094210C4B084AFF310848ED -:1028A00007F0DCFD280002F07BF8CCE711002800DF -:1028B00000F00EF9C7E7C046B8EB001070EC00104E -:1028C000DCEA0010CCEB0010E0EB001008EC00108C -:1028D00010B543787F2B08D05BB2002B02DB0120C0 -:1028E000404210BD00F0C6FBFBE780208000F8E707 -:1028F000012908D0022908D0002902D00120404235 -:1029000070470120FCE70220FAE70320F8E7000007 -:1029100010B543787F2B0BD05BB2002B02DAFF207F -:10292000C0B210BD034B044A0449054807F096FDA8 -:102930000020F5E724EC001058EC00101F02000006 -:10294000DCEA0010F8B5CE46474680B50700904651 -:102950001E00FFF7CDFE814600280FD10024B442AF -:1029600009D243461D5D3800FFF7D2FF854208D1EA -:102970000134E4B2F3E70123994602E001235B420C -:1029800099464846C0BCB946B046F8BDF8B50E00F9 -:102990001500002200E00132930020495B58002B13 -:1029A00004D019788142F6D11C0000E01C00002BF5 -:1029B0002ED063787F2B11D05BB2002B2BDA00F086 -:1029C00061FB0700A368D8190138390006F036FA10 -:1029D000336883420BD36268002414E0072802D1D5 -:1029E0008027BF00EEE700F04DFB0700EAE70C4B45 -:1029F0000C4A0D490D4807F031FDE300EB185F600C -:102A00001A60D21901348442F7D330600020F8BD37 -:102A100001204042FBE701204042F8E7A000000807 -:102A20002CEC001040EC001072020000DCEA0010F8 -:102A3000F0B5C64600B582B00E0017001C00437802 -:102A40007F20184000F0AEFA0500E8231B069C46E4 -:102A5000664400F0AFFA804600F0B0FA01900094AE -:102A60003B0032002900404604F0F6F9002804D16A -:102A7000002002B080BCB846F0BD01204042F8E71B -:102A8000F0B5C64600B582B00E0017001C004378B2 -:102A90007F20184000F086FA0500E8231B069C46BC -:102AA000664400F087FA804600F088FA01900094AE -:102AB0003B0032002900404604F048FA002804D1C7 -:102AC000002002B080BCB846F0BD01204042F8E7CB -:102AD000F0B583B00500002000F064FA0400E8239C -:102AE0001B06E818A3699D696D42054000F062FA73 -:102AF0000600A3699F6900F061FA00903B002A007C -:102B00002100300004F0C0FA002802D1002003B0F8 -:102B1000F0BD01204042FAE7F0B5C64600B58C682A -:102B20000A688423C3580F252B40073DED1A230064 -:102B3000AC4226D92B0024E055782D021678354377 -:102B4000D678360697783F043E4335439827C551DB -:102B500055792D0216793543A846D67936069579EA -:102B60002D042E4345463543C551D218E41A84231B -:102B7000C3580F252B40073DED1A2300AC4200D966 -:102B80002B00002B00D183E0082BD5D0012B24D0C3 -:102B9000022B26D0032B2BD0042B33D0052B3ED079 -:102BA000062B4CD0072B5DD053781B0215782B4396 -:102BB000D5782D069678360435432B4398268351D5 -:102BC00053791B0215792B43D5792D0697793F044C -:102BD0003D432B4383510823C7E716789025465180 -:102BE000C3E755782D021678354394268551BCE706 -:102BF00055782D0216783543942685519678902580 -:102C00004651B2E755782D0216783543D678360608 -:102C100097783F043E43354398268551A5E755787C -:102C20002D0216783543D678360697783F043E4312 -:102C300035439826855116799025465195E7557864 -:102C40002D0216783543D678360697783F043E43F2 -:102C500035439826855155792D02167935439426AA -:102C6000855182E755782D0216783543D678360699 -:102C700097783F043E4335439826855155792D0278 -:102C800016793543942685519679902546516CE7FF -:102C90000A608C60002C0CD1F924E4000359012255 -:102CA000934303518A61CB69002B02D0CB69012089 -:102CB000984780BCB846F0BDF8B50E004C69CA68AC -:102CC000C423C3580F21194023008C421CD90B0088 -:102CD0001AE0D825415911700F0A57700F0C9770E0 -:102CE000090ED17045591571290A5171290C91713C -:102CF0002D0ED571D218E41AC423C3580F251D40D8 -:102D00002300AC4200D92B00002B6DD0082BE0D063 -:102D1000012B1ED0022B20D0032B24D0042B2BD030 -:102D2000052B33D0062B3ED0072B4BD0D821435850 -:102D300013701D0A55701D0C95701B0ED3704358EF -:102D40001371190A5171190C91711B0ED37108235B -:102D5000D0E7D02141581170CCE7D42141581170EF -:102D6000090A5170C6E7D42141581170090A5170FF -:102D7000D02141589170BDE7D821415811700D0AFA -:102D800055700D0C9570090ED170B3E7D8214158DC -:102D900011700D0A55700D0C9570090ED170D0216F -:102DA00041581171A6E7D821415811700D0A55708C -:102DB0000D0C9570090ED170D42141581171090A7A -:102DC000517197E7D821415811700D0A55700D0CBB -:102DD0009570090ED170D42141581171090A5171B1 -:102DE000D0214158917185E7F2607461002C0DD1BA -:102DF000F922D200835802218B4383500323B3610D -:102E0000336A002B02D0336A032098477461F8BDFF -:102E100010B5264A264BD358DA070DD49A0716D494 -:102E20005A071FD5234B05229A61204AF823DB005D -:102E30000421D150D35809E01C4C1E492000FFF753 -:102E40006BFEF823DB000122E250E35810BD174C63 -:102E500018492000FFF730FFF823DB000222E25080 -:102E6000E358F3E71A0709D5124B06229A610F4A75 -:102E7000F823DB000821D150D358E7E7DA0609D55B -:102E80000C4B07229A61094AF823DB001021D1502C -:102E9000D358DBE79B06D9D5064B08229A61034A33 -:102EA000F823DB002021D150D358CFE70000424067 -:102EB000CC070000805E010810B52E4C2E4A03217D -:102EC000200001F0EBFE11220321200001F00CFE96 -:102ED0002A4A0421200001F0E1FE112204212000F1 -:102EE00001F002FE264A0521200001F0D7FE112242 -:102EF0000521200001F0F8FD224A0621200001F002 -:102F0000CDFE11220621200001F0EEFD1E4A072110 -:102F1000200001F0C3FE11220721200001F0E4FD92 -:102F20000021022004F052FB0221022004F07EFB6B -:102F3000022004F017FB1549154805F0BBF8FA22EA -:102F4000144B92001449154802F040FD041E0FD1A5 -:102F50000F4B00229B5E002B06DB1F2213401E3A04 -:102F60009A4013000E4A13600A490C4802F00CFF05 -:102F7000200010BD8005314044ED001010ED001020 -:102F8000DCEC0010A8EC001078ED0010112E001001 -:102F9000E4010008805E0108ACED00100000424032 -:102FA00000E100E0024B1B685B688000C05870477E -:102FB000385F0108004870470000424000487047F1 -:102FC000805E010810B50400FFF776FF002800D0EE -:102FD00010BD044B1C60044A2100044803F02EFE7F -:102FE000F6E7C046385F0108805E010800004240F5 -:102FF00070B51D4B5B68032831D00AD8012811D069 -:10300000022803D11B6802221A700EE00120404200 -:1030100024E0042803D11B6808221A7005E001206F -:1030200040421BE01B6801221A7001380F4A43001E -:10303000191889008C581918890051184D680E7A92 -:103040000B4A16722900200001F028FE32002900E8 -:10305000200001F049FD0448FFF7B4FF70BD1B6874 -:1030600004221A70E1E7C046D40100088C01000870 -:10307000E4000008024B5B681B689B69586A704754 -:10308000D4010008024B5B681B689B699869704714 -:10309000D401000870B504001D4D280003F040FB6A -:1030A0002B685B005B082B60022004F073FA194B5D -:1030B00000229B5E002B0BDB1F2213401E3A9A401E -:1030C0001300154980228B50BFF34F8FBFF36F8FD2 -:1030D000104B59880020185E04F0BAFF013C6000D4 -:1030E000001980000D4BC05801F0D4FC0C4C20009E -:1030F00001F0D0FC200001F0CDFC200001F0CAFC62 -:10310000200001F0C7FC200001F0C4FC70BDC046E7 -:1031100000004240E401000800E100E08C010008EA -:1031200080053140074BC200D05A9B1859889A88B5 -:10313000DB88084310431843C0B2431E9841C0B215 -:103140007047C046845F010870B515000024002C4C -:1031500002D0124C200070BDA3005B195B00104A26 -:103160009A5A6B000F4E9B5B9A4201D30134EEE7F3 -:1031700000230B704C700C4B03602000FFF7D2FF54 -:10318000002807D00649A20055196D006B5A01337B -:103190006B52DFE7044800F0FDFBF3E7011000008D -:1031A000845F0108BCED00100000104070B50600FF -:1031B0000D004C78A3009B185B0010495B5A002B54 -:1031C00004D0A400A4186400013B63526878FFF7A0 -:1031D000A9FF002800D070BD094B1B68002B05D04B -:1031E0003368002B05DB01232B70F4E700F026FB8E -:1031F000F6E7300000F014FCF5E7C046845F0108F4 -:10320000D85F010870B504000D0000280BD0211D07 -:103210002A002000FFF798FF002800D1A571434243 -:103220005841C0B270BD01BEF1E710B5002803D00F -:103230000379002B02D010BD01BEF9E782790100AD -:1032400001C9FFF7B3FFF6E730B583B005000C0006 -:10325000002801D0002901D103B030BD0321684608 -:10326000FFF7D0FF002803D16846FFF7DEFFF3E742 -:103270000098A3B2074A11682D228A5C1F2A04D83D -:103280000022290000F07AFCEEE70022290000F07D -:1032900003FDE9E7D45F010810B5041E01D0002941 -:1032A00000D110BDFFF7D0FF03212000FFF7AAFFD8 -:1032B000F7E7000070B505000C1E22D0002B23D0CC -:1032C000006816490E682D21715C1F2911D8210054 -:1032D00000F05EFD00281AD12868104B1A682D23D3 -:1032E000D35C1F2B09D8210000F008FE002811D163 -:1032F00070BD210000F0D6FEECE7210000F060FF79 -:10330000F4E701204042F3E701204042F0E70120CA -:103310004042EDE701204042EAE7C046D45F0108A1 -:1033200070B5002913D0002A14D0CC68002C14D01A -:1033300000680D4C25682D242C5D1F2C04D800F04E -:10334000F3FD00280CD170BD00F050FFF9E701201B -:103350004042F8E701204042F5E701204042F2E711 -:1033600001204042EFE7C046D45F010810B50029B4 -:1033700013D0002A14D0CB68002B14D000680D4B5A -:103380001C682D23E35C1F2B04D800F019FE0028D5 -:103390000CD110BD01F0C6F8F9E701204042F8E772 -:1033A00001204042F5E701204042F2E7012040427F -:1033B000EFE7C046D45F010810B59821FFF76CFF16 -:1033C00010BD10B50B0001000831002B05D1022201 -:1033D00003003833FFF76EFF10BD0122F8E710B588 -:1033E0000C00131E01D1002010BD01000831220085 -:1033F000FFF796FFF8E710B50A0001000831FFF764 -:10340000B5FF10BD10B50549C02252008B580120F0 -:1034100003438B5005F008FD10BDC0460000264058 -:103420000349C02252008B58012083438B507047C0 -:103430000000264070B50400421E304B9A4256D818 -:103440002F4B1B78002B55D12D4B01221A702D4B81 -:103450001B78002B0ED0FFF7E3FF2B4B1C800023C3 -:103460000C2B1FD89900294A52185288A24212D90F -:103470000133F5E7264D8032FF32AB580126334346 -:10348000AB5005F0D1FCE122D200AB58B343AB50B6 -:103490001C4B1E70DFE70A001C49525AA24202D997 -:1034A000140000E00C231B4A1370FF251D40280068 -:1034B00005F0A0FC2004000C06F02CFE164A174B69 -:1034C00005F06AFF05F07EFE82B211235B1B01202E -:1034D0009840101A80B20E4AC2235B00D358C0181D -:1034E00080B205F06FFCFFF78DFF002070BD01205A -:1034F0004042FBE701204042F8E7C0466F1700005A -:10350000905F0108915F01088E5F0108C4ED001013 -:10351000000026408C5F010833DFC14F1C409F3FF5 -:10352000064AD0239B00D05803E0044AD0239B00D6 -:10353000D058431CF9D0C0B27047C0460000654067 -:1035400010B50400002003E02100034801F0E8FE6C -:103550000028F9D010BDC0460000654070B50600D7 -:103560000D00002102F0AAF80021012003F016FF4F -:10357000040004F01DFDE9004B08C01805F05EFCD6 -:10358000421E002C08D0002C0CD0326880231B0671 -:1035900013433360200070BD0021012003F03CFE86 -:1035A0000400F0E70021012003F0B6FE0400ECE780 -:1035B00070B50C001600002901D0002509E0002597 -:1035C000280070BD2078094B1870FFF7B9FF01344F -:1035D0000135B542F4DA23780A2BF3D1034B1B787B -:1035E0000D2BEFD00D20FFF7ABFFEBE7D05F01080D -:1035F00070B50C001600002901D0002503E000255D -:10360000280070BD0134B542FADAFFF789FF207057 -:1036100001350A28F4D00D28F4D1F1E710B50400E3 -:103620000A4A0B490B4801F08FFE002808D00028F9 -:1036300005D1084A116880231B060B43136010BD97 -:1036400021000448FFF78AFFF1E7C046945F0108B4 -:10365000B8DE00100000654070B505000C0007E002 -:103660000B4B1B689800C0184000FCF78DFF013C15 -:10367000002C0BD082229200AB58DB05DB0DA95841 -:10368000C90B01220A409B18002BE9D170BDC0462E -:103690009000000810B5024801F0DEFF10BDC046E2 -:1036A00000006540014B18607047C046D45F0108B8 -:1036B000F0B51F001D4B1E68002E2DD0B36B1B18DC -:1036C0001B68346D2418E41A631E9C41E3B29C46C7 -:1036D000B368C41825680F242C40062CF8D81306AC -:1036E000F26882183B43136063460B4313D00F4BC1 -:1036F0001B689B68C3181B68DB03F8D50C4B1A6862 -:103700002D23D35C1F2B09D8084B1B681B681B1883 -:103710001B681B06F8D4F0BD3300D2E7034B1B68CF -:103720001B681B181B68002BF8D1F4E7D85F010851 -:10373000D45F010810B50400E0239B05802200211E -:10374000FFF7B6FFD0239B05802200212000FFF762 -:10375000AFFFC0239B05802200212000FFF7A8FFB8 -:10376000B0239B05802200212000FFF7A1FFA023AA -:103770009B05802200212000FFF79AFF90239B05E4 -:10378000802200212000FFF793FF80239B058022E9 -:1037900000212000FFF78CFFE0235B058022002141 -:1037A0002000FFF785FFC0235B0580220021200059 -:1037B000FFF77EFFA0235B05802200212000FFF79A -:1037C00077FF80235B05802200212000FFF770FF38 -:1037D000C0231B05802200212000FFF769FF802302 -:1037E0001B05802200212000FFF762FF8023DB04FD -:1037F000802200212000FFF75BFF002380220021B0 -:103800002000FFF755FF0B4B1B689B080A4A116805 -:103810002D228A5C1F2A0AD80C229340F02292059E -:103820001343802200212000FFF742FF10BD0D222C -:10383000F3E7C046DC5F0108D45F0108054B1A6856 -:103840002D23D35C1F2B03D8034A044B1A60704707 -:10385000034AFAE7D45F0108B8EE0010D85F010808 -:103860000CEF0010F0B583B01400444B1B68002B24 -:1038700075D0002918D0002973D0002C73D0802275 -:103880001202944200D972E080225201944239D04F -:1038900021D88022D200944236D00ED98022120143 -:1038A000944216D1782225E0002AE4D11A6D11182D -:1038B000334A1268D46CA400DDE78022520094429F -:1038C00024D00132FF32944201D17E2212E02D4DEC -:1038D0004AE02C4D48E08022D201944218D0802248 -:1038E0001202944201D1002204E08022920194420B -:1038F0003FD16022224D2E682D25765D1F2E09D9DD -:10390000671E08E07022F5E77C22F3E77F22F1E7EB -:103910004022EFE71C4F01910D003D4039422AD172 -:103920001F2E02D91202194942509B6B1B18019A93 -:103930001A60A308124A11682D228A5C1F2A0CD82B -:103940000C2293401A00F0239B0513438022002190 -:10395000FFF7AEFE0E4B1C6006E00D22F1E7094DAD -:1039600002E0084D00E0074D280003B0F0BD054D12 -:10397000FAE7044DF8E7034DF6E7C046D85F0108C3 -:10398000D45F01080B003200FF3F000088140000E4 -:10399000DC5F010810B50400FFF750FF1A4B1A68EE -:1039A0002D23D35C1F2B10D8184B2360184B1B689A -:1039B0005B6B1B1901221A60164B1B68002B16D07B -:1039C0002000FFF7B7FE002010BD2368124A134005 -:1039D00023600F4B1B685B681B19104A1A60226832 -:1039E00080231B06134323600323A360DEE7084BF9 -:1039F0001B68196D6118044B1B68DA6C920020007B -:103A0000FFF730FFDCE7C046D45F01080300008009 -:103A1000D85F0108DC5F0108FFFFFE7F01000200A4 -:103A2000084B1A682D23D35C1F2B06D80023036094 -:103A3000054B00221A60002070470023036083605A -:103A4000F6E7C046D45F0108DC5F010870B50D4C95 -:103A50002568AC68241826680F243440042CF6D856 -:103A6000EC680419084D2560064C2568ED68451979 -:103A700029602168C96841180A602268D2688018E4 -:103A8000036070BDD85F01081002004270B50F4C92 -:103A90002568AC68241826680C242642F7D1EC6807 -:103AA00004190B4D2560094C2568ED6845192960FE -:103AB0002168C96841180A602268D26882181360B8 -:103AC0002368DB68C018049B036070BDD85F0108E1 -:103AD0001032004370B51D0004AB1E78084A14680C -:103AE000A3681A1812681307F8D409060223B34012 -:103AF00019430123AB40E26880181943016070BD8F -:103B0000D85F010830B51D000B4A1468A3681A1865 -:103B100012681307F8D409060323049A9340194343 -:103B20000223039A934019430123AB40E2688018B3 -:103B30001943016030BDC046D85F010810B582B09E -:103B4000040008001100002B01D102B010BD0200DA -:103B50002000FFF77BFF08230093043B0022502145 -:103B60002000FFF7B7FF044B1B681B681B191B687D -:103B7000DB06F8D4E9E7C046D85F010810B582B08B -:103B8000040010001A1E01D102B010BD0300200075 -:103B9000FFF75CFF0C230093043B0022512120001F -:103BA000FFF798FF034B1B681B681B191B68DB069C -:103BB000F8D4E9E7D85F0108F0B5002B00D1F0BDDB -:103BC0001E00314C2568AC68241827680F243C403F -:103BD000042CF6D8862464010459002CFADBEC6826 -:103BE00004192A4D2560284D2C68E46804192260C8 -:103BF0002A68D26882181660234A1468A2681218CC -:103C000015680F222A40042AF6D8E2688218204C50 -:103C100014601D4C2268D268821811602268D26834 -:103C2000821816600EE0184A11688A681218146823 -:103C30000F222240062AF6D8CA6882181549116058 -:103C4000103B9BB20F2BEED8002B07D10E4B1B68FD -:103C50001B681B181B68002BF8D1B0E70A4A1168D3 -:103C60008A68121814680F222240062AF6D81B040C -:103C7000C02212021343CA68821808210B43802114 -:103C8000C9050B431360E1E7D85F01080800007124 -:103C90000C00007008C01040F0B5002B00D1F0BD42 -:103CA0001F00264C2568AC68241826680F24344071 -:103CB000042CF6D8EC680419214D25601F4D2C68A2 -:103CC000E468041921602968C96841180F600F2B46 -:103CD00014D91A490C68A16809180D680F212940E8 -:103CE0000629F6D8E168411886256D03154384241A -:103CF000E4052C430C60103B9BB2E8E7002B07D196 -:103D00000E4B1B681B681B181B68002BF8D1C6E7FD -:103D10000A490C68A16809180D680F212940062975 -:103D2000F6D81B04C02109020B43E16841181A436D -:103D30008423DB051A430A60E2E7C046D85F010826 -:103D40000C00007010B582B004000B0011000722B7 -:103D500058680240C020800022501A699B69009276 -:103D60002000FFF793FE0C230193043B0093043BD8 -:103D700000224C212000FFF7C5FE044B1B681B6886 -:103D80001B191B685B07F8D402B010BDD85F01088F -:103D900010B5002B01D0002900D101BE062A00D9A0 -:103DA00098E090004C4C205887468B6018004030BB -:103DB000086154338B610A6000234B60474BCB6230 -:103DC0004023CB602C3B4B614B622D33FF33CB61E7 -:103DD000002010BD8B6018004030086160338B619B -:103DE0000A6001234B603E4BCB624023CB60203BFB -:103DF0004B61043B4B62E433CB610020E9E78B600D -:103E000018004030086160338B610A6001234B6009 -:103E1000344BCB624023CB60203B4B614B62E033A1 -:103E2000CB610020D5E78B60180080300861C0337B -:103E30008B610A6002234B602B4BCB628023CB60EB -:103E4000403B4B61103B4B62A0239B00CB610020A9 -:103E5000BFE78B60180080300861C0338B610A6057 -:103E600002234B60214BCB628023CB60403B4B61F4 -:103E70004B62A0239B00CB610020AAE78B60180057 -:103E800080300861C0338B610A6002234B60184B9D -:103E9000CB628023CB60403B4B61243B4B62A02331 -:103EA0009B00CB61002094E78B6018008030086194 -:103EB000C0338B610A6002234B600E4BCB628023C0 -:103EC000CB60403B4B61203B4B62A0239B00CB610E -:103ED00000207EE708487CE760EF00107CEF0010D0 -:103EE00090EF0010B0EF0010D0EF001010F00010B5 -:103EF00050F0001090F000100B00320010B50A1EB8 -:103F00000ED000238B620B624B69002B01D1054858 -:103F100010BD0969D26A9BB2FFF710FE0020F7E7D7 -:103F20000048F5E70B003200F0B5D6464F4646464E -:103F3000C0B581460E001700002931D0002A31D0CB -:103F4000CA689046002A2FD0002B34D00A6AD218B3 -:103F50000A628C6A1D0014E043461B1B9A46B36834 -:103F6000191953469BB23A004846FFF7E7FDB2687D -:103F700031004846FFF7E6FE4346E41A2D19574440 -:103F800000242B199845E7D9B362002D0DD0B168F4 -:103F90000919ABB23A004846FFF7D0FD002504E00E -:103FA000064D02E0054D00E0044D2800E0BCBA4695 -:103FB000B146A846F0BD1D00F7E7C0460B00320031 -:103FC000F0B5DE4657464E464546E0B583B0009014 -:103FD0000E00140000295FD0002A5FD00D698B68A5 -:103FE0009846CF688B6A9A460B6ADB009946802F09 -:103FF0002DD038230193802342465146535401313A -:104000004144BBB29B4652469B1A9BB2013B9BB2BA -:1040100000220098FFF7B2FD019B53451AD93B1FC0 -:104020004A46120E4146CA544B461A0CFB1ECA544D -:104030004B461A0ABB1ECA54013F4A46CA5542465D -:1040400031000098FFF77EFE706A80081BE0702345 -:104050000193D0E742463100009B9A461800FFF7D3 -:1040600071FE5B46002241465046FFF787FDD6E7CA -:10407000EB782370AB7863706B78A3702B78E37068 -:104080000434043501380028F2D103B0F0BCBB463B -:10409000B246A946A046F0BD0148F6E70048F4E75D -:1040A0000B00320010B5002B01D0002900D101BE59 -:1040B000062A00D970E09000384C205887468B6063 -:1040C00040330B610A6069234B60354BCB62402360 -:1040D000CB602C3B4B614B62002010BD8B604033AA -:1040E0000B610A606A234B602E4BCB624023CB608E -:1040F000203B4B614B620020EFE78B6040330B614C -:104100000A606A234B60284BCB624023CB60203B84 -:104110004B61043B4B620020DFE78B6080330B6117 -:104120000A606B234B60214BCB628023CB60403B0A -:104130004B614B620020D0E78B6080330B610A60DB -:104140006B234B601A4BCB628023CB60403B4B61AF -:10415000103B4B620020C0E78B6080330B610A602C -:104160006B234B60134BCB628023CB60403B4B6196 -:10417000203B4B620020B0E78B6080330B610A600C -:104180006B234B600C4BCB628023CB60403B4B617D -:10419000243B4B620020A0E708489EE7D0F00010C7 -:1041A000ECF0001020F1001000F1001080F1001080 -:1041B00040F1001000F20010C0F100100B003200BE -:1041C00010B50A1E0ED000238B620B624B69002BC8 -:1041D00001D1054810BD0969D26A9BB2FFF7ECFC1A -:1041E0000020F7E70048F5E70B003200F0B5D646AF -:1041F0004F464646C0B504009146002900D180E1F3 -:10420000002A00D17FE1CE68002E00D17DE1002B95 -:1042100005D11800E0BCBA46B146A846F0BD0A6A0E -:10422000D01808628D6ABA480768BA68101902681F -:104230000F2010400628F6D8F8682018C827FF0578 -:104240000760B34800680068001900680028F8D1CA -:104250000A6990464A699446AD480768BA681019D9 -:1042600002680F2010400428F6D8F8682018A94FDB -:104270000760A74F3868C068201842460260386857 -:10428000C0682018624602604A699446A0480768E0 -:10429000BA68101902680F2010400628F6D8F8688E -:1042A0002018CC27FF05624617430760984800682E -:1042B0000068201802689246002AF7D194480268E4 -:1042C0009068001907680F2038400628F6D8D06893 -:1042D0002018CA22D2050260002D48D18C480268FD -:1042E0009068001907680F2038400428F6D8862007 -:1042F000400120580028FADBD0682018864A026066 -:10430000834A94461068C06820184A460260624694 -:104310001268D268A21813605A19964257D8721BB5 -:1043200090467B4A10688268121917680F223A403B -:10433000062AF6D82A02C068201847461743CC221E -:10434000D2053A4302604A689046714A1068826812 -:10435000121917680F223A40062AF6D8C268A21826 -:10436000404600061060AD1B5B195546D4E78A68CD -:104370009046674802689068001907680F20384027 -:104380000428F6D8D0682018624A0260604A106893 -:10439000C0682018474607601068C068201805608C -:1043A0005B4802689068001907680F2038400628AB -:1043B000F6D8D0682018CC22D2052A43026054488F -:1043C00000680068201800680028F8D186E78A6233 -:1043D000002B4ED18D6A002D64D10E694D694C4B76 -:1043E0001A6893681B1918680F230340042BF6D82A -:1043F000D368E318494A1A60454A1368DB68E31832 -:104400001E601368DB68E3181D60414B1A689368EF -:104410001B1918680F230340062BF6D8D368E3183E -:10442000CA22D2051A604869394B1A6893681B1969 -:1044300019680F230B40062BF6D8D368E318CE2259 -:10444000D20502431A60324B1B681B68E3181868D8 -:104450000028F8D12E4B1A6893681B1919680F238E -:104460000B40062BF6D8D368E418CA23DB0523607B -:10447000D0E6274A10688268121916680F22324067 -:10448000062AF6D82D02C268A2182B43CC25ED05CA -:104490002B4313601E4B1B681B68E3181B68002B23 -:1044A000F8D197E78E681A4B1A6893681B19186839 -:1044B0000F230340042BF6D8D368E318174A1A6079 -:1044C000134A1368DB68E3181E601368DB68E3189F -:1044D0001D608D6A0E4B1A6893681B1918680F23AC -:1044E0000340062BF6D8D368E318CE22D2052A4320 -:1044F0001A60074B1B681B68E3181B68002BF8D178 -:104500006BE7074886E6064884E6054882E6C0462B -:10451000D85F010808000070080000710C000070EE -:104520000B003200F0B5DE4657464E464546E0B534 -:1045300083B003000192002900D198E1002A00D144 -:1045400097E1CC688E6A0D6A6A0F9346ED00802C65 -:1045500000D171E138229446C7480768BA68D0187C -:1045600002680F2010400628F6D8F8681818C827E7 -:10457000FF050760C04800680068C0180068002890 -:10458000F8D10A6991464A699046BB480768BA68FB -:10459000D01802680F2010400428F6D8F8681818C0 -:1045A000B64A0260B44A92461068C06818184A4673 -:1045B000026052461068C0681818424602604A6994 -:1045C0009146AD480768BA68D01802680F201040BD -:1045D0000628F6D8F8681818CC22D2054F4617439B -:1045E0000760A54800680068181800680028F8D11E -:1045F000A1480768BA68D01802680F201040062842 -:10460000F6D8F8681818CA27FF0507608A68904628 -:1046100099480768BA68D01802680F20104004282B -:10462000F6D8F8681818954F0760934F3868C06837 -:104630001818424602603868C068181806608E482C -:104640000768BA68D01802680F2010400628F6D80C -:10465000F8681818CC27FF053743076086480068BC -:104660000068181800680028F8D183480768BA68FD -:10467000D01802680F2010400628F6D83202914662 -:10468000F8681818802290464A4647463A439146B1 -:10469000D022D20590464A4647463A430260B44586 -:1046A00000D8CCE0621F94465A46D2B29046724877 -:1046B0000668B268D01807680F2038400628F6D878 -:1046C00062461702F068181842461743D026F605CE -:1046D00037430760221F90462A0E944666480668B4 -:1046E000B268D01807680F2038400628F6D842462E -:1046F0001002F6689E1962461043D027FF05384322 -:104700003060E21E9046280CC2B294465A480668B1 -:10471000B268D01807680F2038400628F6D84246FD -:104720001002F6689E1962461043D027FF053843F1 -:104730003060A21E9046280AC2B294464E480668CF -:10474000B268D01807680F2038400628F6D84246CD -:104750001002F6689E1962461043D027FF053843C1 -:104760003060013CEAB2944643480668B268D0180B -:1047700007680F2038400628F6D82502F068181878 -:1047800062461543D024E405254305604E683A4847 -:104790000468A268D01805680F2028400628F6D8BB -:1047A000E068181836060660334800680068181874 -:1047B00000680028F8D14F6A2F4C2568AA68D418E1 -:1047C00026680F243440042CF6D8EC681C192C4DB4 -:1047D0002560294D2C68E4681C19019A22602A681A -:1047E000D2689A181760244A1468A268D21815680B -:1047F0000F222A40062AF6D8E2689A18CA24E4054D -:1048000014604D6A1C4A11688A68D21814680F2215 -:104810002240062AF6D8CA689A18CE21C90529432B -:104820001160184A9A58002AFBDB03B0F0BCBB4663 -:10483000B246A946A046F0BD702294468CE64A686E -:1048400090460D480668B268D01807680F203840B7 -:104850000628F6D8F068181842461606066006487C -:1048600000680068181800680028F8D11AE70648A0 -:10487000DBE70548D9E7C046D85F010808000070AB -:104880000C000070F01000000B003200C005434225 -:104890005841C0B270470000A0231B0698422AD09E -:1048A00014D8802829D008D980235B0098422AD0C8 -:1048B0001B4B984209D01B4807E010281FD0402806 -:1048C00001D1194801E000281BD17047174B9842CD -:1048D0001BD007D9164B98421ED0164B98421DD1BB -:1048E0001548F2E7154B984211D0154B984211D15B -:1048F000A420C003E9E70020E7E71248E5E71248F3 -:10490000E3E70848E1E70648DFE71048DDE7A020D5 -:10491000C003DAE70348D8E70D48D6E70148D4E7F3 -:1049200006005200FF00520002005000030000F099 -:10493000040000F0050000F003005200090000A090 -:10494000010000F00500520001005000010052007B -:104950000200520010B50F4B1A683323D35C002BB2 -:1049600000D101BE0B4B1C68BC23E358226A94465D -:1049700063441B68002B0BDB074B1868FFF78CFFA9 -:10498000636801229A6063689B68002BFBD110BDAD -:104990000248FCE7D45F0108E05F01080200500014 -:1049A00010B50400FFF772FF002801D1134810BDB5 -:1049B000FBF700FE124B134A1A605C6000229A60FB -:1049C000DA60114B1A685423D35C002B10D003F02B -:1049D000FCFAFA21890004F031FA01000B4804F0D6 -:1049E0002DFA0B4BC1188020400009F05DFADEE77C -:1049F00080200021400009F057FAD8E70600520055 -:104A0000E05F01080001001CD45F010860F5900020 -:104A10009808000070B504000D00FFF737FF00286C -:104A200027D0002D27D0FBF7C5FD144B144A1A6080 -:104A300000225A609C60DD60124B1A685223D35CDE -:104A4000002B10D003F0C1FAFA21890004F0F6F926 -:104A500001000D4804F0F2F90C4BC1188020400011 -:104A600009F022FA06E080200021400009F01CFA3B -:104A700000E0074870BD0648FCE7C046E05F01085B -:104A800000010005D45F0108C0EA210148260000AA -:104A90000600520030B5134A11688B69C31ADB094E -:104AA00049691B01C91800230360812415682C5D26 -:104AB00004192360822415682C5D04192360832463 -:104AC00015682C5D04192360802415682C5D041979 -:104AD0002360836114688422A25C801803600B60E9 -:104AE0004B6030BDD45F010810B5072900D901BE65 -:104AF0001F2314009C4300D001BE104B1B689C690F -:104B0000001BC0095B690001181803290AD8046852 -:104B1000C9001F238B409C431F231A408A40224315 -:104B2000026010BD04394468C9001F238B409C43B8 -:104B30001F231A408A4022434260F2E7D45F0108F3 -:104B4000F8B506000C0015001F0006AB1A780729FF -:104B500000D901BE0F232900994303D1012D01D0B3 -:104B6000092D00D101BE012F00D901BE1F23110064 -:104B7000994300D001BE21003000FFF7B5FF336834 -:104B800001210A00A24093433940A14019433160FA -:104B9000074B1A688123D05C86193268A400723BE7 -:104BA0001900A1408A432B40A34013433360F8BD52 -:104BB000D45F0108072900D901BE012A00D901BE2E -:104BC00001238B40002A01D1436070478360FCE7DA -:104BD00030B50400072900D901BE0F231000984307 -:104BE00003D1012A01D0092A00D101BE8900074B57 -:104BF00018688123C05C00190468723B1D008D4059 -:104C0000AC4313408B402343036030BDD45F0108A5 -:104C100030B50300072900D901BE012A00D901BE21 -:104C2000074804688220205CC018046801231D0026 -:104C30008D40AC4313408B402343036030BDC046DE -:104C4000D45F010830B5082900D901BE012A00D976 -:104C500001BE846901231D008D40AC4313408B408D -:104C60002343836130BD000030B50300082900D91B -:104C700001BE032A00D901BE49000748046880200C -:104C8000205CC018046803231D008D40AC43134012 -:104C90008B402343036030BDD45F0108F8B5CE4696 -:104CA000474680B507000E001400002800D1B1E08F -:104CB000002A00D1B0E0072900D901BE2368012BEA -:104CC00000D901BE63680F221900914303D1012B63 -:104CD00001D0092B00D101BE237A1F22934300D0BB -:104CE00001BEE368032B00D901BE2369012B00D963 -:104CF00001BE6369012B00D901BE236A012B00D9D3 -:104D000001BE636A012B00D901BEA36A012B00D941 -:104D100001BEE36A032B00D901BE236B072B00D928 -:104D200001BEE369032B00D901BEA369012B00D9A1 -:104D300001BE01252B00B3407000103003229146C4 -:104D4000110081400B439C46344B984683234146D7 -:104D50000968C95CC9190B68624693439C46A369FC -:104D60002B40B340624613439C46E2694B461340D6 -:104D70001A008240634613430B60626831003800BA -:104D8000FFF726FF227A31003800FFF7ADFEE26818 -:104D900031003800FFF768FF226931003800FFF763 -:104DA00051FF626931003800FFF732FF43461A684D -:104DB0008423D25CBA1810687B3398469843236AE0 -:104DC0001D40636A5B009C46022361460B401D4305 -:104DD000A36A9B009C46042361460B402B43E16A77 -:104DE000C90018250D402B43216B4D014146294038 -:104DF0000B43B100FE25AD0029408B4003431360F7 -:104E0000226831003800FFF7D5FE0020C0BCB9464B -:104E1000B046F8BD0248F9E70148F7E7D45F01085A -:104E200001005A00084B1A68BC23D3581B181B6892 -:104E3000002B07DA0B0C00D001BE0904090C4160FD -:104E4000002070470148FCE7D45F010801008A0098 -:104E50000368002B08DAC2600B0C00D001BE090405 -:104E6000090C8160002070470048FCE701008A00BF -:104E700000290BD0074B1A68BC23D3581B181B689A -:104E8000002B05DAC3680B600020704701BEF1E714 -:104E90000148FAE7D45F010801008A00034B1B6850 -:104EA000002B00D07047014B1860FBE7046001083D -:104EB00070B5040023480068002840D021480568E8 -:104EC0002C2060432818FF2425001D4005601E0A81 -:104ED000344044601B0C83601B4B1C683323E35C31 -:104EE0009D4200D301BE184B1C68BA23E35A6B43A2 -:104EF000256AAC466344036143683425645DA3427C -:104F000000D301BE104C2468246A80335B01E4188E -:104F1000446183681D0C00D001BE1D0C00D001BE91 -:104F20001B041D0C2B43A360C2610162002383613B -:104F3000049B002B02D000229B5E838170BD01BECA -:104F4000BCE7C04604600108D45F0108F0B58FB02B -:104F5000041E44D06368032B00D901BEE36A002B12 -:104F60003FD0236B002B3ED007AA1300210061C95C -:104F700061C321C921C302AE230014333100A1CB88 -:104F8000A1C121CB21C10821535E0CAD2B80174B51 -:104F90001B681B8F079989B25B186B80089B0D9368 -:104FA0000B9B0A980095A26AE16AFFF781FF069BB6 -:104FB0000598002200920021FFF77AFF216B28005C -:104FC00003F078F80022AB5E002B06DB1F221340B3 -:104FD0001E3A9A401300064A13600FB0F0BD01BE9E -:104FE000B8E701BEBDE701BEBEE7C046D45F010819 -:104FF00000E100E0F0B504000800002A2DD01C49B3 -:10500000096800292BD01A4909682C256C430C1912 -:105010004543491901263500486885402D046068DC -:1050200086402769002F1CD0886900281BD13F6863 -:10503000002F1ADA17683F043F0C17603D431560D4 -:105040002569EA6001228A614B622369320C00D033 -:1050500001BE3604360C9E60F0BD01BECFE701BE36 -:10506000D1E70448F8E70448F6E70348F4E7C04608 -:105070000460010804028A0007028A0070B582B049 -:1050800004000023019300282BD02369002B2AD091 -:105090006369002B29D0236A002B28D06369DD685F -:1050A0002A0C0BD012041A601B682069204B1A6866 -:1050B000BC23D3581B181B68002B1ADB2D042A0CA9 -:1050C000002D0AD063691A601B68636A002B2AD01E -:1050D0009847002363620023A36163691B6802B0E1 -:1050E00070BD01BED1E701BED2E701BED3E701BE6C -:1050F000D4E701A9FFF7BCFE00280ED10198026891 -:10510000160CFF231340E2699A4207D99B00226ADA -:10511000D358002B02D0984700E0002631002069C8 -:10512000FFF780FECAE7A36A002BD4D09847D2E7E6 -:10513000D45F010810B50200064B1B68002B07D096 -:10514000044B18682C235343C018FFF797FF10BD7A -:1051500001BEF5E70460010870B50C001D4B1A682C -:105160003323D35C834230D9002930D00B68DB066F -:1051700001D019482AE03323D35C984200D301BE02 -:10518000144B1B681D6ABA229B5A58432D18134EA4 -:1051900035602368DA080021606805F022FA0021F2 -:1051A0002800FFF73FFE306822000021FFF750FE85 -:1051B000002801D00A4809E0084B18680021FFF7D1 -:1051C00031FE002802D0064800E0034870BD0248C6 -:1051D000FCE7C046D45F010803018A0008600108AB -:1051E00001018A0010B50B00002A05D0002A1DD04D -:1051F000002B15D10E4810BD0029F7D10D4A1168BA -:1052000033228A5C904200D301BE0A4A11680A6ABE -:10521000BA24095B4843121807490A601800EAE7F4 -:1052200006490B604A60FFF797FFE4E70048E2E7B2 -:1052300003018A00D45F01080860010830070008F4 -:10524000F0B5C64600B50C00194B1B68DE68336824 -:1052500083422BD947091F23184001258540002987 -:1052600018D000239846124B18680368002B17DAF1 -:105270007368BF00DF193B681D420FD0AB433B6032 -:1052800000250021FFF7CEFD002C0BD0280080BCAC -:10529000B846F0BDFBF781F98046E4E7054DF0E73D -:1052A000054DF1E74046FBF77CF9EFE7034DEDE7ED -:1052B00008600108020188000301880004018A00D7 -:1052C0000A4B1B68DB681A6882420BD941091F220E -:1052D00010401E3A8240586889000B581A4203D089 -:1052E000034800E0034870470348FCE708600108F2 -:1052F0000101880004018A0000018800074B1B6837 -:105300009B6CC340DB0700D401BE044B1B681B69C8 -:1053100010308002C3580F2018407047D45F010836 -:1053200003681B050CD5802282239B00C358DB0534 -:10533000DB0D934206D090239B00C15001207047A3 -:105340004022F1E70020FAE7F0B5002800D16CE137 -:10535000002900D16BE10B78022B00D901BE4B7BF9 -:10536000023BDBB2062B00D901BE8B7B002B04D0A5 -:10537000022B02D0032B00D001BE2123CB5C012BDA -:1053800000D901BE2823CB5C012B00D901BE0B78CC -:10539000012B07D98B7F002B09D04B68013B062BD3 -:1053A00005D903E04B68083B082B00D901BE8B6888 -:1053B000053B042B00D901BE4B69FF2B00D901BE70 -:1053C0008B69FF2B00D901BE8B7C002B06D00B789C -:1053D000002B02D18B68092B74D001BE964B4C6B0D -:1053E0001C4200D001BE954BCC6B1C4200D001BECC -:1053F0000B78022B6AD04B685D1E0B7F002B6AD0A6 -:1054000080235B028C68082C67D880242401234306 -:105410000F242C4023438024A404234303600C6BFB -:1054200003681B055BD580239C4200D301BE8C6BB7 -:1054300003681B0555D580239C4200D301BE4C6AEE -:1054400003681B054FD580239C4200D301BE0B7817 -:105450001B06C024A404234003644B7F002B44D0CC -:1054600040238C7C002C42D08024E40023430C7C1D -:10547000002C3ED08024640023434C7C002C3AD086 -:105480008024A4002343CC6A013C2404F0252D038E -:105490002C4023434D7B013D07242C4023438D7B2F -:1054A0002D0130242C40234383640B7B002B24D01C -:1054B00080246400CB7B002B21D10B78022B46D0BB -:1054C00000231EE08B7B002B88D086E78B7F002B90 -:1054D00091D1002591E7002394E7002497E740232A -:1054E000A2E74023A8E74023AEE70023B9E7002462 -:1054F000BCE70024C0E70024C4E70024DAE78023E7 -:105500009B001C438B685D1E0F231D402C43C0264F -:10551000B6008451FF244D692C408D692D04FF276E -:105520003F043D402C43C425AD004451CC6A85590D -:105530002B4003339C4201D3102C00D901BECB7FFA -:10554000002B07D00B78012B5FD0002503E08023D0 -:105550009B00D6E700254C7B013C072323402B43CF -:105560008D7B2D0130242C40234343640B7B002B87 -:105570004ED080256D008B685C1E0F2323402B438B -:105580000C78012C46D0002423438024A40003512E -:10559000FF230C6B2340C124A40003512023CB5CC8 -:1055A000002B3AD080239B0421240C5D012C36D0A3 -:1055B0000024234328240C5D012C33D000242343F2 -:1055C000FF244D6A25402B4303658B6B1C408123D0 -:1055D0009B00C4501A4B4C6B23401A4C03511A4B7E -:1055E000CC6B2340194C0351002A22D00023536076 -:1055F00013609360D3601362D3625363897F303347 -:10560000D154134B93630020F0BD80256D00A2E7B9 -:105610000025B0E780246402B6E70023C4E78024B5 -:105620006404C6E780246402C9E70A48ECE7094835 -:10563000EAE70020E8E7C04692F4FFFF8CF8FFFF9E -:105640006D0B0000C80F000073070000880F0000FA -:10565000EFCDAB000160AA00114B03600F3B036468 -:10566000002383640822FF32C021890042500431A4 -:1056700043500C31435043641139FF394250FD32DD -:1056800083500365074A8350074A8350074A835073 -:10569000074A8350074A8350074A83507047C046E1 -:1056A0000F000003C80E0000880E0000C80F0000A5 -:1056B000880F0000080F0000480F000003685B001F -:1056C0005B080360002904D000234B600B600B6271 -:1056D000CB627047F0B5C64600B58C680A68842373 -:1056E000C3580F252B40073DED1A2300AC4226D9A5 -:1056F0002B0024E055782D0216783543D6783606EF -:1057000097783F043E4335439827C55155792D027C -:1057100016793543A846D679360695792D042E4359 -:1057200045463543C551D218E41A8423C3580F2582 -:105730002B40073DED1A2300AC4200D92B00002B73 -:1057400000D183E0082BD5D0012B24D0022B26D00A -:10575000032B2BD0042B33D0052B3ED0062B4CD063 -:10576000072B5DD053781B0215782B43D5782D0677 -:105770009678360435432B439826835153791B0280 -:1057800015792B43D5792D0697793F043D432B435B -:1057900083510823C7E7167890254651C3E755780B -:1057A0002D021678354394268551BCE755782D0295 -:1057B0001678354394268551967890254651B2E760 -:1057C00055782D0216783543D678360697783F04FB -:1057D0003E43354398268551A5E755782D02167826 -:1057E0003543D678360697783F043E4335439826AE -:1057F000855116799025465195E755782D021678F2 -:105800003543D678360697783F043E43354398268D -:10581000855155792D02167935439426855182E7B5 -:1058200055782D0216783543D678360697783F049A -:105830003E4335439826855155792D0216793543D7 -:10584000942685519679902546516CE70A608C60C4 -:10585000002C0CD1F924E400035901229343035195 -:105860008A61CB69002B02D0CB690120984780BCAC -:10587000B846F0BDF8B50E004C69CA68C423C358D9 -:105880000F21194023008C421CD90B001AE0D825A7 -:10589000415911700F0A57700F0C9770090ED17093 -:1058A00045591571290A5171290C91712D0ED57127 -:1058B000D218E41AC423C3580F251D402300AC425C -:1058C00000D92B00002B6DD0082BE0D0012B1ED06F -:1058D000022B20D0032B24D0042B2BD0052B33D02C -:1058E000062B3ED0072B4BD0D821435813701D0AEE -:1058F00055701D0C95701B0ED37043581371190A07 -:105900005171190C91711B0ED3710823D0E7D0216E -:1059100041581170CCE7D42141581170090A5170D7 -:10592000C6E7D42141581170090A5170D02141585D -:105930009170BDE7D821415811700D0A55700D0CBA -:105940009570090ED170B3E7D821415811700D0A36 -:1059500055700D0C9570090ED170D0214158117100 -:10596000A6E7D821415811700D0A55700D0C95709D -:10597000090ED170D42141581171090A517197E76C -:10598000D821415811700D0A55700D0C9570090EF3 -:10599000D170D42141581171090A5171D021415857 -:1059A000917185E7F2607461002C0DD1F922D2006B -:1059B000835802218B4383500323B361336A002B46 -:1059C00002D0336A032098477461F8BD10B50028EF -:1059D00032D0002932D0002B32D05A62F922D200C4 -:1059E00083580324A34383500B78012B00D901BEB5 -:1059F0000B7A032B00D901BE4B68072B00D901BEDF -:105A00000B7B012B00D901BE01230A6813408A6871 -:105A10001203C024A401224013434A681204E02464 -:105A2000E40222401343CA681206802149040A4056 -:105A300013430360002010BD0248FCE70148FAE769 -:105A40000048F8E70400B2004B1EDBB2012B04D97A -:105A5000042902D0082900D001BE032A00D901BEC2 -:105A6000042920D008D801290DD002291AD1882371 -:105A70001B019C4660440AE0082913D198231B01AE -:105A80009C46604403E080231B019C466044002840 -:105A900008D0036806490B401204C02189020A405D -:105AA0001A430260704790231B019C466044EEE756 -:105AB000FFFFFCFFF8B5DE4657464E464546E0B5CB -:105AC000070008009A460AAB40CB1B789B460CABFC -:105AD0001B78111FC9B2FA2900D801BE59460439F2 -:105AE000C9B2FA2900D801BE591EC9B2012904D988 -:105AF000042B02D0082B00D001BE002E02D051464C -:105B000000291CD0002E02D05946FF2919D01B02B3 -:105B1000F02109010B4099460E9B5D6A1104C022D9 -:105B2000920211404B4619430143002E0BD10D9BAD -:105B3000DA07120C11433965002400200CE001BE85 -:105B4000E0E701BEE3E70022F4E703433B650134ED -:105B5000E4B2002D1FD128002100B44225D2164BFB -:105B6000984222D07B6C0422100018401A42F0D1D7 -:105B700053465B5C4A46134398465A461204C02378 -:105B80009B021A40434613430131B142DDD30D9AC3 -:105B9000D007000CD9E7012002F008FB013D002DE1 -:105BA00001D00020D8E70448D6E7F0BCBB46B24697 -:105BB000A946A046F8BDC0460200B20070B58AB042 -:105BC0000500181FC0B2FA2800D801BE002A34D040 -:105BD000686C042634000440064231D11B04C02006 -:105BE00080020340501E0004000C03438020C002CA -:105BF00003432B65002925D00E9B5E6A009102921B -:105C00000023079302330693200006E0012002F0F0 -:105C1000CDFA013E002E0ED02000069B022B0DD1A6 -:105C2000094B98420AD069462800FFF753FD002E21 -:105C3000ECD13000F1E70448EFE704480AB070BD4A -:105C40000348FBE72000F9E70200B2000400B200BD -:105C50000100B200F0B50400069D181FC0B2FA287A -:105C600000D801BE002A21D0666C042738003040DD -:105C700037421DD11B04C026B6023340561E3604DF -:105C8000360C3343802636033343236500290ED078 -:105C9000E9602A616A61059B2B620423AB61F922EA -:105CA000D200A35802210B43A35000E00148F0BDED -:105CB0000148FCE70400B2000100B20070B58AB0F0 -:105CC0000500181FC0B2FA2800D801BE002A34D03F -:105CD000686C042634000440064231D11B04C02005 -:105CE00080020340501E0004000C03438020000388 -:105CF00003432B65002925D00E9B5E6A0391059214 -:105D00000023089304330693200006E0012002F0EC -:105D10004DFA013E002E0ED02000069B042B0DD123 -:105D2000094B98420AD069462800FFF7A3FD002ED0 -:105D3000ECD13000F1E70448EFE704480AB070BD49 -:105D40000348FBE72000F9E70200B2000400B200BC -:105D50000100B20010B5030000290DD0426C0424EC -:105D600020001040144209D101390904090CC02255 -:105D700012031143196510BD0148FCE70148FAE719 -:105D80000400B2000100B20000230B604B608B6086 -:105D9000CB600B614B618B61026880231B06134350 -:105DA0000360704770B58D69AA682B6AFF26CC68BE -:105DB000B44384600C696442B443C4602D68013DFF -:105DC00003242C404969002901D080214900214346 -:105DD0000162002A33D01468611C67D0FF21214082 -:105DE00014792404C025AD022C40214380242406CC -:105DF0002143016451790904C024A4022140416473 -:105E00009468611C54D0FF212140147B2404C025D8 -:105E1000AD022C4021438024240621438164116972 -:105E2000002905D001391F240C4080210906214397 -:105E3000C164127D1204C02189020A400265002B50 -:105E400033D019684A1C35D0FF220A401979090459 -:105E5000C024A40221400A43802109060A430266A5 -:105E60005A791204C02189020A40426699684A1C84 -:105E700022D0FF220A40197B0904C024A402214039 -:105E80000A43802109060A4382661A69002A05D05E -:105E9000013A1F211140802212060A43C2661B7D6F -:105EA0001B04C02292021340036770BD0021A0E7CB -:105EB0000021B3E70022D2E70022E5E770B5050034 -:105EC00008220026002000E008328B790133DB0035 -:105ED000934216D3FF232B408C5CA342F4D12C0AAF -:105EE000FF2323408C18E479A342EDD18B185B7813 -:105EF000B342E9D38C18A478012CE5D11E00100020 -:105F0000E2E770BD70B50C0015001E00FFF7D6FF6C -:105F100000280BD021180B79AB704B796B708B7903 -:105F20002B70CB789B003360002070BD0048FCE7ED -:105F30008000B2008278520803231340012B07D05F -:105F4000022B07D0002B01D0002070470320FCE774 -:105F50000420FAE70420F8E70200407900021379F0 -:105F60001843D3791B069279120413431843002B6C -:105F700002DB0130C0087047033880231B0618433A -:105F8000F9E7437A0B6000230B7102334B71037AFC -:105F90005B0908D1013B8B60027A1F2313400B6120 -:105FA00002230B757047FF238B60FD3B0B73F3E7F8 -:105FB000C37A0B6000230B714B71837A5B0908D1A4 -:105FC000013B8B60827A1F2313400B6102230B7508 -:105FD0007047FF238B6000230B73F3E7C37B0B60D9 -:105FE00000230B7101334B71837B5B0908D1013BAB -:105FF0008B60827B1F2313400B6101230B7570475D -:10600000FF238B60FE3B0B73F3E7437B0B600023A6 -:106010000B714B71037B5B0908D1013B8B60027BE9 -:106020001F2313400B6101230B757047FF238B6007 -:1060300000230B73F3E703230B6000230B714B71F9 -:10604000012252428A600B610B75704710B50B003C -:106050001100012B0DD0032B09D00123002B12D0EE -:1060600083789A0607D45B0609D4FF2010BD00236D -:10607000F4E70023F2E7FFF784FF0520F6E7FFF7D8 -:1060800097FF0420F2E78378DA0605D4DB0707D40C -:10609000FFF7D1FF0120E9E7FFF7A0FF0320E5E7C5 -:1060A000FFF7B3FF0220E1E70068052907D8890060 -:1060B0000D4B5B589F46830601D5EC231360704758 -:1060C000C306FCD56C231360F9E70307F7D5BC239F -:1060D0001360F4E74307F2D53C231360EFE783072F -:1060E000EDD50C231360EAE740F200102823C35CCF -:1060F0001B09012098407047F0B5C64600B54F6AAD -:106100001B38430898460F263E400021002411E02A -:10611000012800D11024701C013363434D00AC46AC -:106120008C446546AD00AC46944443435B006046F6 -:1061300083600131032917D8CB005B1A3800D8409F -:106140000509430A032018401F232B40022809D0C9 -:1061500003D80028DCD10124DDE70328DBD1FA24B1 -:10616000A400D8E78024D6E7434658004044850081 -:106170000C3D5219906880BCB846F0BD10B5446A19 -:10618000816A4A0F032313400A0E1F2111400F2278 -:106190002240022B11D00BD8002B11D0012B11D192 -:1061A00080204000531C013148435843400010BD3B -:1061B000032B09D1FA200002F4E7FA200001F1E7ED -:1061C0001020EFE70020EDE70020EBE7836A190AD3 -:1061D0001F2001400F221A409B0406D408230132DD -:1061E000481C58435043400070474023F7E70623BC -:1061F00003600023037170470423036000230371CD -:10620000704702230360002303714371012252424D -:1062100082600373036103757047122303600023D8 -:10622000037143710122524282600373036103755B -:1062300070473423036000230371437101225242EB -:106240008260037303610233037570473E2303606A -:10625000002202713C3B437101214942816003737A -:1062600002610375704710B50368042922D009D86C -:106270000139C9B2022904D85B062BD51000FFF7FB -:10628000CCFF10BD0529FCD1D90507D4190609D4C6 -:106290005B060BD51000FFF7C0FFF2E71000FFF719 -:1062A000D5FFEEE71000FFF7C4FFEAE71000FFF7A5 -:1062B000A8FFE6E7190605D45B0607D51000FFF72F -:1062C000ACFFDEE71000FFF7B4FFDAE71000FFF7DE -:1062D00098FFD6E71000FFF794FFD2E7052303608D -:1062E0000023037170470000C36A002B10D0036BBA -:1062F000002B0FD00023026B13713A33CA5C1209D2 -:10630000333B1340052B0ED89B00154AD3589F46AC -:1063100001BEECE701BEEDE701235B42C363026B04 -:106320001360C26A136070470223C363036B0122C8 -:106330001A60C36A34321A60F5E74023C363036B03 -:1063400001221A60C36A04321A60ECE78023C36337 -:10635000036B3E221A60C36A01321A60E3E7C0464B -:1063600058F2001060230360002303717047F0B5FA -:1063700005000368042B07D01D200B5CFF2B2BD1DD -:10638000222828D80230F8E74369012040421860EB -:106390004B785B080F261E400023042B07D80124EE -:1063A0009C4030002040844201D00133F5E7032BAC -:1063B0001FD81F1D0020032807D8061D44002418DD -:1063C000A4008E5D16550130F5E76A69C95D11605C -:1063D00058001D3005E00020002802D06B690A5CDF -:1063E0001A60002806D000236A6913716A69537124 -:1063F00003E000206B69FF221A71F0BD70B5002226 -:1064000000240FE023001C33C65C53009B189B0044 -:10641000CB180125B5405D6025001D35455D1D701B -:1064200002340132032AEDD970BD10B5013B9C182E -:106430000855000A002BF9D110BD10B50400002347 -:10644000002003E00002E25C104301338B42F9D3E9 -:1064500010BD000030B587B004001D004B062AD4E3 -:106460001648CB0725D58B0710D5D368002B0DD048 -:106470001A7919780A9B0493012303930295FE333A -:106480000193002300932000FFF714FB0B4B98426D -:1064900001D000280DD10A9B049301230393029598 -:1064A000FE330193002300930022B7212000FFF761 -:1064B00001FB07B030BD0020D3E7C0468000B2002A -:1064C00030B587B004000800150019000C9B049338 -:1064D00000230393029001930B9B00930A9B0022DD -:1064E0002000FFF7E7FA002801D007B030BD0C9B71 -:1064F00000930023012229002000FFF7DFFBF4E7CF -:10650000F0B5DE4657464E464546E0B589B00590A3 -:106510000D0090469B4612AB1B789A4600230693CB -:106520005D4E002400273000139B99462DE0032088 -:1065300000E00420002108E00020FBE72218521AA6 -:10654000AA18D67806AA565401318842F6D84A4687 -:106550000292019006AA0092172202A98C46624478 -:1065600051460598FFF7ACFF00280BD17F00FBB226 -:10657000172202A98C4662441778049A17407A1EA3 -:1065800097411F430834444531D82B5D9B0716D4EF -:10659000631CEB5CE21CAA5C0492172202A98C46E5 -:1065A0006244002111702A1992789209012ABED002 -:1065B000022ABED0002ABFD05A461068BAE70600A9 -:1065C000002E16D0002E5CD12B199B780133DBB244 -:1065D00004935A46D364012B5BD93700B24600239B -:1065E00005961E00A8462500149B994617E02B4EE1 -:1065F000E6E742462B195B78BB42E3D02B199B7828 -:1066000002339B00E418A242F4D2244EDAE7E3609E -:106610005168380002F012FC60600136F6B2049B4B -:106620009E422DD2BA440435434658195B5D0F2172 -:10663000194001220023114207D15200D2B2013386 -:10664000DBB2042BF7D9154A059207683F0A0137D8 -:106650003F02B2005946096D8C58524622605A00DA -:10666000D3189B004A46D2184946CB5CA360936876 -:1066700023615368BB42CAD9E76001236360CCE75A -:10668000059E300009B0F0BCBB46B246A946A04604 -:10669000F0BD014EF5E7C0460600B2000700B200AB -:1066A000F0B587B006000D0010000E9C0A7909783D -:1066B00004940027039702936B79019303230093BB -:1066C00003003000FFF7F6F9002801D007B0F0BD55 -:1066D00029693000FFF73EFB0028F7D12B7D01949C -:1066E000002200920C9A0D993000FFF7B3FA061EB3 -:1066F000ECD1656A06E0012001F058FD013D002D56 -:106700000AD03000A369032BE0D0044B9842DDD0BF -:10671000002DF0D12800F5E70048F3E70200B200B1 -:1067200010B5002134E00B001033DB0100221A50B9 -:10673000CB01C318184C1C192260184C1C1922607C -:10674000822424011C192260842424011C19226043 -:10675000134C1C192260134C1C192260124C1C197A -:106760002260852424011C192260862424011C191E -:1067700022600E4C1C1922600D4C1C1922600D4C1D -:106780001C19226087242401A44663441A60013145 -:106790000329C8D910BDC046080800000C08000035 -:1067A00044080000480800004C080000640800008D -:1067B000680800006C08000010B586B00B001400DB -:1067C0008A69D16800290ED00A79097804940124D5 -:1067D00003941B780293FF23019300230093FFF798 -:1067E00069F906B010BD0148FBE7C0468000B20061 -:1067F00030B587B004000800150019000A9B049307 -:106800000023039302780292FF2201920093002258 -:106810002000FFF74FF9002801D007B030BD0A9BD8 -:1068200000930023012229002000FFF747FAF4E734 -:1068300010B584B00F236B4401241C708C69A36ACB -:10684000002B0DD01B7800920F226A44FFF7D0FF77 -:10685000002805D1A36B0F226A4411780B401370F6 -:106860000F236B441878431E9841C0B204B010BD8A -:10687000F0B5002808D085696B6893421DD92E6D4C -:10688000002E03D0002004E001BEF4E70C4813E022 -:106890000130EB6C83420ED98300F458E3686768DB -:1068A0007B432768BC466344BA42F1D39A42EFD295 -:1068B0000C60002000E00248F0BD0248FCE7C04642 -:1068C0000600B2000400B200F0B58BB006900C00D8 -:1068D00015000793002928D0002D30D0A6697769CC -:1068E0000023099331682800FFF7A7FD020009A9DA -:1068F0002000FFF7BDFF002F1BD03A79FF2A1AD0E6 -:10690000104B984219D0002811D1099B197A079B86 -:106910000493012303932378029301923368009335 -:106920002B000698FFF7C6F80AE001BED4E73978D5 -:10693000EDE7054804E0044802E0034800E00148B0 -:106940000BB0F0BD0400B2008000B200F0B5DE462E -:1069500057464E464546E0B5C9B005000C00160046 -:106960009946002913D02EAAAE4B19881180997828 -:1069700091702DAA19881180997891702CAA198884 -:1069800011809B789370636B9846002305E001BEED -:10699000E9E72FA90022CA540133632BF9D94A46EB -:1069A00031002800FFF750F84346002B13D0529BCC -:1069B00002932FAB01933823009333002EAA414654 -:1069C0002800FFF76DFE071E06D12FAB9B79062B23 -:1069D00002D9954F07E0944F002F04D12FAB1B78BD -:1069E000532B08D0904F380049B0F0BCBB46B2469C -:1069F000A946A046F0BD2FAB5B78462B01D08A4F4D -:106A0000F1E72FAB9B78442B01D0874FEBE72FABFF -:106A1000DB78502B01D0844FE5E72FAB1B79052B9A -:106A200000D8FCE02FAB5B79012B01D07E4FDAE779 -:106A3000049704AB2DAA2FA97C48FFF763FA0597AA -:106A400005AB2CAA2FA97A48FFF75CFA794B98423C -:106A500000D1A0E000230693FF2006AB2EAA2FA9A9 -:106A60000002FFF74FFA071EBDD1A368002B00D12B -:106A700095E0E368002B00D193E02369002B00D15F -:106A800091E06369002B00D18FE0E369002B00D116 -:106A90008DE0236A002B00D18BE0A36A002B00D18C -:106AA00089E0529B02932FAB9A460193069B009379 -:106AB00033002EAA41462800FFF7F2FD070020A967 -:106AC0005046FFF79BFC5046FFF734FA20605046D3 -:106AD000FFF742FA60605046FFF708FB6062E0682B -:106AE000FFF785FB2069FFF787FB0123A363A06AFB -:106AF000FFF7F4FB51462000FFF7F6FBE069FFF7D4 -:106B000031FC5046FFF73AFB60645046FFF75EFBEE -:106B1000A064A3689B461A0049465046FFF796FAC0 -:106B200081462368042B48D0206AFFF76AFB20AA1D -:106B30002FA92000FFF71BFC002809D0431E2FA916 -:106B4000CA5C01239340A36120AAFFF7D5FA206411 -:106B5000236D002B00D146E7529B02932FAB01938C -:106B6000059B009333002CAA41462800FFF798FDAF -:106B7000071E00D037E720AB0293529B019300968B -:106B80002300059A2FA92800FFF7BAFC2A4B984248 -:106B900041D0070027E70023E36423655AE701BEDD -:106BA00067E701BE69E701BE6BE701BE6DE701BEA5 -:106BB0006FE701BE71E701BE73E752463833D15C1F -:106BC000529B0093330022002800FFF743FC071E6E -:106BD00003D0002F0FD00120B0E7529B029307ABE8 -:106BE0000193049B009333002DAA41462800FFF730 -:106BF00057FD0700EDE75A46494607A8FFF754FA44 -:106C0000226A494607A8FFF72EFB20AA07A9200001 -:106C1000FFF7ADFB90E70023E3642365E3E6024F53 -:106C2000E1E6C04670F200100500B20084FF0000EB -:106C300081FF00008000B2000600B200F0B5DE4621 -:106C400057464E464546E0B583B0061E904600D1F5 -:106C5000ACE0002900D1B1E04F68002F00D1AFE0D7 -:106C6000002A00D1AEE00B689946002B03D0002526 -:106C700000239A465DE0544899E001BE70E0524816 -:106C800007E0082B04D198231B019B46B3440CE07A -:106C90004D485346002B00D189E0B2200004184330 -:106CA00085E080231B019B46B3445B46002B00D14B -:106CB0007AE01B68454A1340227A1204C0218902F7 -:106CC0000A4013435A4613606368042210001840B8 -:106CD0001A4257D1A3691B68013B032B00D901BE9F -:106CE000002825D163689B0722D52169E06802F05E -:106CF0002BF9002900D001BE236980225202934261 -:106D000002D35A1E1A4200D001BE21005846FFF796 -:106D100049F80223FF3362681340227A1204C0212B -:106D200089020A4013438022120613435A46136015 -:106D30000135A94536D9AB00FC58002CF8D0227893 -:106D4000531EDBB2012B04D9042A02D0082A00D03A -:106D500001BE237A032B00D901BEA369002B8CD07E -:106D60002378042B09D08CD8012B9AD0022B86D102 -:106D700088231B019B46B34497E790231B019B4646 -:106D8000B34492E7237A2278A1694046009030000C -:106D9000FFF7DCFD00289DD00823AB4052461A4384 -:106DA000924697E7002074E7074872E7064803B069 -:106DB000F0BCBB46B246A946A046F0BD0248F6E785 -:106DC0000148F4E70048F2E70400B200FFFFFCFFCF -:106DD000F0B5D6464F464646C0B507008846140073 -:106DE00099469608194B9A4203D8002E08D10126DD -:106DF00006E0174E04E0A41B00281CD0002C1AD07B -:106E0000FA218900300002F019F88246FA2189003F -:106E1000300002F099F88DB2504601F0D1F9280007 -:106E200001F0D2F94A4641463800FFF701FDB4426D -:106E3000E1D80024E0E7002805D10020E0BCBA46F4 -:106E4000B146A846F0BD0348F8E7C04603093D0037 -:106E500040420F000200B200F0B5DE4657464E46F3 -:106E60004546E0B589B082460F0090469946129C8F -:106E7000139B9B460023079300290BD04B46002B06 -:106E80000AD0BA69956843461B195268934205D8DF -:106E90002D4817E001BEF1E701BEF2E72A4809B02C -:106EA000F0BCBB46B246A946A046F0BD002802D1C0 -:106EB000296900293AD100283CD00028EFD1A41B31 -:106EC000B044B144002CEAD0260080235B029C42EF -:106ED00000D91E00BB691B68002207A94046FFF7C6 -:106EE000A4FABB692A7929785846049000200390B7 -:106EF00038780290687901901B68009307AB504680 -:106F0000FEF7D8FD0028D1D1A9684B1CCED02A7B32 -:106F1000C9B25B4604930023039338780290FF20A4 -:106F2000019000935046FEF7C5FDBFE75046FEF7BF -:106F300011FFC0E72B7D5A46009232004946504669 -:106F4000FEF7BCFEB9E7C0460400B200F0B5DE466D -:106F500057464E464546E0B589B082460F001600BA -:106F60009846129D00230793002910D04346002B1A -:106F70000FD0BA69536A9946136A9B4673195268CF -:106F8000934208D83F483B004F46994618E001BE5F -:106F9000ECE701BEEDE73B4809B0F0BCBB46B246AA -:106FA000A946A046F0BD2C00139A49465046FFF76B -:106FB00003FC00280FD00028EED1A04436192D1B69 -:106FC000002DE9D03900300001F0BEFF6B18BB4244 -:106FD000E9D37C1AE8E74B469B691B68002207A9A6 -:106FE0003000FFF722FA4B469B695A461279594600 -:106FF0000978139804900020039048460078029086 -:107000005846407901901B68009307AB5046FEF745 -:1070100051FD002803D15B4699684B1C12D1002812 -:1070200003D15B46196900291DD100281FD0002813 -:10703000C1D14B469B699A6C139B49465046FFF75A -:10704000C7FEB8E75B461A7BC9B2139B04930023C3 -:107050000393484600780290FF2001900093504629 -:10706000FEF728FDDBE75046FEF774FEDDE75B46E2 -:107070001B7D139A0092220041465046FEF79EFD6A -:10708000D5E7C0460400B200F0B5DE4657464E468E -:107090004546E0B587B007000E0015000093109A32 -:1070A0009046EB18013B01930023059304930029BC -:1070B00048D0B3699B469B699A465B461B6C02931A -:1070C0005B465B68019A93423ED80023994603933E -:1070D000504C504B9C4200D194E04B46E81A51462C -:1070E00001F032FF002900D08BE0039B019A93420C -:1070F00044D3484B9C4200D184E0019B4A46981AF5 -:107100000130514601F020FF002943D1009B002BA4 -:1071100078D02A0004A93000FFF7AAFB041E6AD128 -:10712000049A13690293D3689A46116853685246C9 -:1071300053435B18013B9946019B4B452ED2019B63 -:1071400099462BE001BEB4E72A0004A93000FFF7FE -:107150008FFB041E0AD1049B1A689146DA68924696 -:107160005B6853434B44013B039302E00023994681 -:107170000393009B9A45ACD9264CAAE704A930009A -:10718000FFF776FB041EB4D1049B1A689146DB68B6 -:107190009A46AEE71F4C35E0002CB7D14D45B5D22D -:1071A000424631003800FFF707FB041EF4D15B466E -:1071B0001B68002205A92800FFF737F9434605AAF6 -:1071C00031003800FFF780FB041EE5D1029B5A0115 -:1071D000D21A92009C466244D200434631003800E5 -:1071E000FFF7F6FD009B534508D9554452469B1ABC -:1071F00000930400D0E7019B9946CFE70094040078 -:1072000084E7044C200007B0F0BCBB46B246A94658 -:10721000A046F0BD0400B20010B5002814D1072923 -:107220002ED8FF2A2ED81A4B186883687824005B62 -:107230001B188900C9180B68164803401206120C67 -:107240001A430A60002002E0012801D0124810BD54 -:107250000F2919D880235B029A4217D20C4B186869 -:1072600083687A24005B1B188900C9180B680B48D7 -:10727000034012020A4802401A430A600020E6E76F -:107280000548E4E70448E2E70348E0E70248DEE7B0 -:10729000D45F0108FF00FFFF01004A00FF0000FF6C -:1072A00000FFFF0030B51A4B1B6842241C5D84426E -:1072B00028D9032928D8002901D1072A0FD9012963 -:1072C00005D0022906D0032907D012481BE00F2A57 -:1072D00005D9F6E7032A02D9F5E7002A16D1752465 -:1072E0001D5DA940723CAC40214074241C5D2240CD -:1072F0009B680A43C02189008C4660448000C250CC -:10730000002000E0034830BD0248FCE70148FAE7EE -:10731000D45F010801004A00F0B5032835D80028E1 -:1073200001D107290FD9012805D0022806D003284A -:1073300007D0184828E00F2905D9F6E7032902D914 -:10734000F5E7002923D1144B1C687723E35C032263 -:1073500015009D402B007425655D7626A65D2F00E7 -:10736000B7403B437526A65DB040B240104018437D -:10737000294008438021090608438023DB00A268D6 -:10738000D050A268D3580020F0BD0248FCE7014865 -:10739000FAE7C04601004A00D45F010810B503288F -:1073A00028D8002801D107290FD9012805D00228A3 -:1073B00006D0032807D011481BE00F2905D9F6E7AE -:1073C000032902D9F5E7002916D10D4B1A68752358 -:1073D000D45CA040723BA34018407423D35C194096 -:1073E000926801438020C00501438023DB00D15017 -:1073F000002010BD0148FCE70048FAE701004A0000 -:10740000D45F0108064B1B681A6888215B58D218A4 -:10741000136804490B400002034313607047C046E1 -:10742000D45F0108FF00FFFF044B1A68136888212E -:1074300052589B181868000AC0B27047D45F010800 -:10744000012800D901BE054A136805490B40000216 -:10745000C021890008401843106070470000274091 -:10746000FFFCFFFF10B5074B984200D901BE06494B -:10747000064A8B58064C2340024C20401843885043 -:1074800010BDC046010300000000264004050000B6 -:10749000FEFCFFFF10B50449044A8B58044C2340FE -:1074A000000403438B5010BD00002640040500007B -:1074B000FFFF00FF0349044A885880231B0603434B -:1074C0008B50704700002640040500000349044A21 -:1074D0008B585B005B088B507047C046000026400D -:1074E0000405000010B50300032800D901BE054CB7 -:1074F000A021C900605803229043134018436050F4 -:1075000010BDC04600002640064B1B681A68882143 -:107510005B58D21813681B021B0A00060343136052 -:107520007047C046D45F0108044B1A68136888216D -:1075300052589B181868000E7047C046D45F010867 -:10754000064B1B681A688C215B58D21813680449D3 -:107550000B400002034313607047C046D45F01082C -:10756000FF00FFFF084B1A684023D35C834209D910 -:10757000064AE0308000815880231B060B4383506D -:10758000002070470248FCE7D45F01080000264055 -:1075900001004A0000280ED0094B1A684023D35C32 -:1075A00083420AD9074AE030800083585B005B08B9 -:1075B0008350002070470448FCE70348FAE7C046C0 -:1075C000D45F01080000264001004A0010B50B4BB3 -:1075D0001A684023D35C83420CD90F290CD8084C7D -:1075E000E030800003590F229343114019430151A9 -:1075F000002010BD0348FCE70248FAE7D45F010809 -:107600000000264001004A00064B1A684023D35C64 -:10761000834200D801BEE0308000034BC3580F20E6 -:1076200018407047D45F01080000264010B50C4B8D -:107630001A684023D35C83420DD903290DD8094C25 -:10764000E03080000359302293430901114019436F -:107650000151002010BD0448FCE70348FAE7C0468A -:10766000D45F01080000264001004A00074B1A6859 -:107670004023D35C834200D801BEE0308000044B3D -:10768000C3581B09032018407047C046D45F010847 -:1076900000002640034B1B6904201840431E9841FC -:1076A000C0B270470000274010B504000A4A1368B2 -:1076B00008210B43136003E0012000F077FD013C3B -:1076C000FFF7E8FF002801D1002CF5D1002C01D0F4 -:1076D000002010BD0148FCE70000274002004A00DE -:1076E00000207047002070470349044A88588023CF -:1076F0001B0603438B507047000026400C0500001A -:10770000084AC0235B00D3580122100018401A42D7 -:1077100006D10449044A8B585B005B088B507047C4 -:107720000248FCE7000026400C05000003004A0068 -:10773000064A074BD35801229343002800D1002268 -:1077400013430249024A8B507047C046000026404E -:107750000C050000014B18687047C0460C6001081A -:10776000084AA623DB00D25803231340032B06D07C -:10777000044AA623DB00D35801201840704702209A -:10778000FCE7C0460000264010B5FFF7E9FF0228DD -:1077900001D0002010BD014B1868FBE71060010804 -:1077A000134B1A683E23D35C83421DD9042904D9A4 -:1077B0004B1EFF3B9BB2132B18D8FF290CD91F235C -:1077C00019400C4A0300C0339B009950D030800010 -:1077D00004238350002008E007231940D0308000A4 -:1077E000044BC150002000E0034870470248FCE70A -:1077F000D45F01080000264001004A0003000C4A43 -:1078000011683E228A5C824200D801BE1A00D03242 -:1078100092000849505807221040042800D07047B1 -:10782000C0339B005B581B300340E1301843F6E740 -:10783000D45F01080000264010B52A4B1A683E2389 -:10784000D35C834200D801BEFFF7D8FF88235B00DA -:10785000984231D012D802282BD004D903280BD15A -:10786000FFF73EFF3CE0002839D0012802D1FFF7A6 -:1078700071FF35E0002033E0002031E089235B0018 -:10788000984229D01423FF33984206D1164A174B49 -:10789000D358002B1DDB002022E01223FF33984237 -:1078A00005D1FFF7F7FE002810D1002018E00020D6 -:1078B00016E0FFF769FF13E00B4A0D4BD358002B7E -:1078C00001DB00200CE08020000209E080200002A3 -:1078D00006E08020000203E0FFF704FF00E0054817 -:1078E00010BDC046D45F0108000026403C050000E2 -:1078F0000C05000000127A00024AB023DB00D058C9 -:10790000C00F704700002640034AB223DB00D35863 -:10791000012018407047C046000026400B4BB120A4 -:10792000C0001A580A491140802292050A431A5091 -:10793000B021C9005A58520052085A5005495A58A5 -:10794000520052085A5000207047C046000026409E -:10795000FFFFFFCF8C05000070B5041E00D175E05D -:10796000FFF7CAFF002800D074E08023DB02226802 -:107970009A4200D301BE23689B039B0BE279002A45 -:1079800000D165E08022520413433349B022D20073 -:107990008B50A28880239B019A4200D301BE22898A -:1079A00080239B009A4200D301BEA388DB04DB0C3A -:1079B0002289120429490A4013432749284A8B5037 -:1079C000A37A0F2B00D901BEE37A0F2B00D901BE99 -:1079D000A28980239B019A4200D301BEA27A0F2381 -:1079E0001340E17A0901FF220A401343A2891202DF -:1079F0001C490A401343A27B1207C02189050A4093 -:107A000013431549B122D2008B50A379042B00D91E -:107A100001BE228A80239B009A4200D301BE0E48F9 -:107A200011494358114A1340A2791202E025ED0092 -:107A30002A401343435043580D4A1340228A1204EC -:107A4000064C224013434350002070BD01BE87E71F -:107A5000002299E70748F8E7000026400000FF01F0 -:107A60008405000000FF1F008C050000FFF8FFFFE9 -:107A7000FFFF00FE03004A0010B5002832D01A496B -:107A8000B023DB00CB589A03920B02608022520491 -:107A900013405A1E9341C371144BCB58DA04D20CD5 -:107AA00082801B0CDB05DB0D0381B123DB00CB588F -:107AB0000F2214001C4084721C092240C2721A0A50 -:107AC000D204D20C82811B0F032213408373084B14 -:107AD000CB58190A04320A4082711B0CDB05DB0DFE -:107AE000038210BD01BECAE70000264084050000E5 -:107AF0008C05000070B505002649274A8858802368 -:107B00001B0603438B502C0003E0012000F04EFBCA -:107B1000013C204AB223DB00D3585B0701D4002C80 -:107B2000F3D11C48B121C90043581C4A1A40802394 -:107B30009B0513434350002D01D0002C0CD0154958 -:107B4000B022D200885880231B0603438B5003E0E9 -:107B5000012000F02BFB013CFFF7D6FE002801D1ED -:107B6000002CF5D1002D01D0002C0ED00949B122F6 -:107B7000D2008858C0239B0503438B50002D02D0B0 -:107B8000002C05D00025280070BDFFF7C7FEF5E7E3 -:107B9000034DF8E7000026408C050000FFFFFFCFF3 -:107BA00002004A000138074B1A683F23D35C834226 -:107BB00000D801BE8130FF308000034BC058C00F99 -:107BC0007047C046D45F01080000264070B50138F8 -:107BD0000D4B1A683F23D35C834201D80B4870BD1C -:107BE0000B4D8130FF30840063590A4A1A408023CC -:107BF0009B0513436351012000F0D8FA63595B00E1 -:107C00005B0863510020EAE7D45F010801004A00E5 -:107C100000002640FFFFFFCFF8B504000D002F4BFA -:107C20001A683F23D35C834201D22D48F8BDFFF789 -:107C3000B9FF002845D1AA78931EDBB20E2B42D89B -:107C40006B78002B41D0122B41D82F783E00E97879 -:107C5000002932D0133086423BD300292FD0382060 -:107C6000864238D8013C2879022816D07F20384037 -:107C70001B02F8267601334003431204F820400328 -:107C800002401A43C90680231B05194011432300F3 -:107C90008133FF339B00134A995012498134FF34DA -:107CA000A4006358104A13402A791207C0208005A7 -:107CB0000240134363500020B8E71620CBE7702042 -:107CC000CEE70A48B2E70648B0E70548AEE7044801 -:107CD000ACE70348AAE70248A8E7C046D45F01081A -:107CE00001004A0000002640FFFFFFCF03004A00CA -:107CF0000138114B1A683F23D35C83421AD9813073 -:107D0000FF3080000D4BC3587F221A400A70180ABA -:107D10001F2210404870180C02408A708022120501 -:107D20001A40501E8241CA701B0F032213400B7170 -:107D3000002070470248FCE7D45F0108000026409D -:107D400001004A0070B50D00461E294B1A683F23FA -:107D5000D35CB34249D9274933008133FF339B00B9 -:107D600058588022120602435A502C0003E001208A -:107D700000F01CFA013C33009133FF339B001D4A95 -:107D80009B58DB0701D4002CF1D1002D01D0002C31 -:107D900017D033008133FF339B00164A9A58120FD5 -:107DA00003231340022B01D0002070BD114A8136FD -:107DB000FF36B600B158C0239B050B43B3500020DB -:107DC000F3E70C4C8136FF36B60033590A4A1A40A5 -:107DD00080239B0513433351012000F0E7F9335909 -:107DE0005B005B0833510548DFE70548DDE7C04627 -:107DF000D45F010800002640FFFFFFCF02004A00C9 -:107E000001004A00F0B587B01422002101A802F059 -:107E1000E8FB01A8FFF730FEFFF76EFD002807D052 -:107E200001AB9B7B022B01D0012302E0002300E089 -:107E3000002301AA019E94882000D279002A1FD035 -:107E40000225002B1ED000281DD00020FFF7F4FCD7 -:107E500032000023002101F087F906000F002A00FC -:107E600000232000002101F07FF902000B00CC0765 -:107E70004008204349088019794101F055F902E092 -:107E80000125DEE7002007B0F0BD0000F0B585B0A9 -:107E900004002E4B1B683F229A5C002A53D0002816 -:107EA00052D03E229B5C834200D801BE274B1A6809 -:107EB0003F23D35CA34201D2002045E005220021EC -:107EC00002A802F08EFB02A92000FFF711FF20009C -:107ED000FFF768FE002807D002AB1B79022B01D008 -:107EE000012302E0002300E0002302AA167857785D -:107EF00038009578002B24D0002F25D0002D01D1FB -:107F0000280021E02000FFF797FC32000023002129 -:107F100001F02AF9009001912A0000233800002185 -:107F200001F022F902000B00CC0740082043490869 -:107F3000009C019D24184D412000290001F0F4F817 -:107F400002E0002000E0002005B0F0BDD45F010891 -:107F500010B504000D4B1A683E23D35C834200D851 -:107F600001BE002C09D0094B1A683F23D35CA34201 -:107F700008D22000FFF760FC10BDFFF743FF002888 -:107F8000FAD1F6E72000FFF781FFF8E7D45F010898 -:107F900070B50600FFF76AFB05000124844030003D -:107FA000FFF732FBFFF7D4FF64082018E84070BDEC -:107FB00010B50020FFF7ECFF0400FFF7B5FA411CF5 -:107FC0004808001900F03AFF10BD10B5FFF7F0FFA8 -:107FD0000400FFF729FA411C4808001900F02EFFA1 -:107FE00010BD000030B5194B1B682C229A5C1F2A6B -:107FF00015D884080722250095432A1E22D1033272 -:108000001040C000FC3282401B682033A4001B19C2 -:108010001C688140614011406140196012E03C22BF -:108020009A5E0BB29A420ED007230340074A1268A9 -:10803000126880200006184380239B019C466144FF -:108040008900885030BD01BEEEE7C046D45F01080C -:1080500010B50A4B1B682C229A5C1F2A0AD91A6891 -:1080600080239B019C46614489008B585B005B0820 -:108070008B5010BD998FFFF7B5FFFAE7D45F010869 -:10808000094B9A68094B9A4204D010308000084B83 -:10809000C0587047002905D01030044A8300985812 -:1080A0009950F6E701BEF7E700ED00E00000000898 -:1080B00000000010F0B5C64600B582B0041E019164 -:1080C0004FD04368032B00D901BE0023E05E002897 -:1080D00025DA254E0023E25E6168002A24DB93083E -:1080E000224DC0339B005859804603273A40D200A6 -:1080F000FF208446070097404046B84307008901A7 -:1081000060460840904038435851194B9A68194BC3 -:108110009A4220D0300002B080BCB846F0BD6188E1 -:10812000FFF760FF0026D5E70F231340083B9B08AD -:1081300006339B000E48844663445F680320024078 -:10814000D200FC3005009540AF43890108409040C3 -:1081500038435860D9E70023E05E0199FFF790FFAC -:10816000D8E7014ED6E7C0460100560000E100E026 -:1081700000ED00E00000000810B5040006E0084B28 -:108180001868F8F701FA074B9C46644480231B02E9 -:108190009C42F4D8044B18686043F8F7F5F910BD19 -:1081A0008C0000080080FFFF9000000810B5034B12 -:1081B0001B785843F8F7E8F910BDC0469400000852 -:1081C00010B5FFF7D9FF10BD10B5FFF7EFFF10BDD9 -:1081D000054B802212069A649B6C002B01DB002069 -:1081E00070470248FCE7C0460000274003004600F5 -:1081F0000D4B8022120198585B68FF221A4202D070 -:108200008023DB021843084A084BD3581B0402D0D2 -:1082100080235B021843044A044BD3581B0C02D042 -:1082200080239B021843704700002640040800008A -:10823000FEE7000010B50A4B0268DA6142681A6274 -:1082400082685A62C2689A620269DA6242691A6393 -:1082500082695A63C2699A63FFF7EAFF10BDC0469C -:1082600038070008F0B5C64600B5002833D01923FA -:108270008B429B415B42314C22681668AC27D25B33 -:10828000B61832680325AA432B401A433260266889 -:108290003268F65B92191768294E374017602768D5 -:1082A0003A689046AE229446BF5A3A004244176854 -:1082B000AF433B431360226813686446125B9B180C -:1082C0001A6832401A60002807D010291DD92129C8 -:1082D00027D801221AE06423CAE7184B1B685522ED -:1082E0009A5C8A421FD256229A5C8A421DD2572239 -:1082F0009A5C8A421BD258229A5C8A4219D259222D -:108300009B5C8B4217D3553A00E000220B4B1B6855 -:1083100059680B680F20834313430B6080BCB84639 -:10832000F0BD0222F2E70022F0E70122EEE702228E -:10833000ECE70322EAE70522E8E7C046D45F01083C -:10834000FFFCFFFFB0235B055B78002B04D0B0235C -:108350005B055878C0B270472120FCE7B0235B056D -:108360009B899BB2002B04D0B0235B05988980B217 -:10837000704780204000FBE770B5FFF7EFFF8023D8 -:108380005B0098421AD0B0204005174BC358174ADB -:108390001340174C21680A689C25495952181168E6 -:1083A000C025AD0029400B43136022681368A0214B -:1083B00052589B180F4A82581A6070BD0C4B1A68AD -:1083C00011689C20125889180A680F24A2439A3811 -:1083D00002430A601B681A68A0215B58D218136810 -:1083E000A34303431360E8E748180000FFFCFFFFC6 -:1083F000D45F01084418000070B5FFF7AFFF802379 -:108400005B0098421AD0B0204005134BC358134A62 -:108410001340134C21680A689C2549595218116869 -:10842000C025AD0029400B43136022681368A021CA -:1084300052589B180B4A82581A6070BD084B1A6834 -:1084400013689C2152589B181A68074911408022D2 -:10845000D2010A431A60F0E750180000FFFCFFFF4A -:10846000D45F01084C180000FF8FFFFF10B5FFF725 -:1084700075FF80235B00984212D0B02252050F4B4B -:10848000D3580F4A13400F4A11680A689C200958B4 -:1084900052181168C020800001400B43136010BDCA -:1084A000084B1A6813689C2152589B181A68064991 -:1084B0001140C022D2010A431A60F0E71C180000E4 -:1084C000FFFCFFFFD45F0108FF8FFFFF70B5FFF7D0 -:1084D00045FF80235B0098421BD0B0204005184B1D -:1084E000C358184A1340184C21680A689C254959FA -:1084F00052181168C025AD0029400B431360226853 -:108500001368A02152589B18C122520182581A6048 -:1085100070BD0D4B1A6811689C20125889180A68A2 -:108520000F24A243993802430A601B681A68A021ED -:108530005B58D2181368A34303431360E8E7C046AF -:1085400024180000FFFCFFFFD45F010870B5204B2A -:108550001A6813689C2152589B181C68C02000019F -:108560000440FFF7FBFE80235B0098421FD01849B0 -:10857000086803689C2280581B181868154D28400D -:1085800018600868036880581B181D68C0263601EB -:108590003000A04305431D6009680B688A589B188A -:1085A00018683040001B431E9841C0B270BD0020C7 -:1085B000FCF7A4FE0400FFF7C5FE222803D8002C18 -:1085C00003D10120F2E70120F0E70020EEE7C046EA -:1085D000D45F0108FFF3FFFF70B584B006000D0003 -:1085E000022804D9042802D0032800D001BE6B1E43 -:1085F000DBB2012B04D9042D02D0082D00D001BE1E -:10860000B300294A9C58042D1FD0012D1FD0022DE4 -:1086100033D026006469002CFBD1002034E064696B -:10862000002C18D0214B984213D0A3682B42F6D1CE -:10863000E3681A6802925B6801930393290002A819 -:10864000236898471A4B1C60E9E70020E8E7002000 -:10865000E6E7012DE9D1012D01D004B070BD134B27 -:10866000984204D0B600134B0022F250F5E7B60052 -:108670000F4B1A680F4BF250EFE70D4B1E68002EA0 -:10868000CBD03669C9E73669002EE6D0B3682B42F5 -:10869000F9D1F3681A6802925B6801930393290089 -:1086A00002A833689847EEE754600108FF004200D3 -:1086B000506001083C600108F0B5C64600B50700EF -:1086C000012800D901BEFFF73DFE85B2FFF746FE47 -:1086D00006000020FCF712FE041E17D180235B0069 -:1086E0009E4201D02A4C12E0222D42D8294B1B6811 -:1086F000586829494358294A134098463A06802326 -:108700005B041A4043461343435000E0204C80234F -:108710005B009E422FD080235B009E4225D01D4BE4 -:108720001A683323D35C002B00D101BE194B1B68A0 -:108730001D6A80235B009E4220D0002F24D0184A5F -:1087400001212800FCF784FB00280ED1114B1A6888 -:10875000BC23D3585B191B68002BF7DBEB681B0E9F -:108760001B06A0221206934210D0200080BCB846FF -:10877000F0BD074CCBE7222DD1D8CCE7002F01D09C -:10878000084ADDE7084ADBE7084AD9E70400ECE7D6 -:1087900004004200D45F010818F00000FFFFFFFE54 -:1087A0000300000C01010030010000300100000C4A -:1087B00000283DD01F4B1B6888229A5819688C46A8 -:1087C0006244126802628C229A5819688C4662448C -:1087D0001268426246229A5C002A28D0E0229968F8 -:1087E0008A58D20623D5DA68F223DB01D358036016 -:1087F000104B1B68F022D201D9688A5842600E4A99 -:10880000D9688A5882600D4AD9688A58C2600C4A71 -:10881000D9688A5802610B4AD9688A5842610A4A63 -:10882000D9688A588261DA68084BD358C3617047A7 -:1088300001BEBFE7D45F010804780000087800009B -:108840000C78000010780000147800001878000000 -:1088500010B500283BD01F4B19680A6888240959B5 -:108860005218016A116019680A68043409595218CB -:10887000416A11601B6846229A5C002A26D0E022D9 -:1088800099688A58D20621D5F022D201D968446865 -:108890008C50114AD96884688C50104AD968C468D1 -:1088A0008C500F4AD96804698C500E4AD9684469C3 -:1088B0008C500D4AD96884698C500C4AD968C469B7 -:1088C0008C50DA680168F223DB01D15010BD01BE83 -:1088D000C1E7C046D45F01080478000008780000B2 -:1088E0000C78000010780000147800001878000060 -:1088F000F0B5C64600B50700FFF724FD0500012FBF -:1089000000D901BE7E4B5B68002B00D187E00121BE -:108910000120FFF761FE041E72D1F7F73EFE06004C -:10892000774B5B68002B03D004210120FFF754FE36 -:10893000744B1A68136ABA21515ACA00521A9B180A -:108940001A68002AF4DADB68DA0000D569E08020D2 -:10895000800518436B4B1B68BA215D5AEA00521B15 -:108960001D6AAC466244D060585AC200121A186A96 -:1089700084466244002050601A6A595ACB005B1A40 -:10898000D3185B68FFF7EAFC80235B00984200D1B4 -:108990007FE05C4B1A683323D35C002B00D101BE0F -:1089A000584B1A68116ABC23D3585B181B68002BFC -:1089B00000DB72E0544C534B1A68136ABA21515AC7 -:1089C000CA00521A9B181A68002AF4DADD68EB0014 -:1089D00000D581E04D4B1D404A4B1B68BA21585AC7 -:1089E000C200121A186A84466244D5601A6A595A3B -:1089F000CB005B1AD31800225A603000F7F7D1FD84 -:108A0000002C00D06DE03E4B5B68002B03D00821AA -:108A10000120FFF7E1FD200080BCB846F0BD002436 -:108A20007BE71B0F1B0798463948FFF7C1FE212D36 -:108A300018D0344D2B68196888229B58C9180B68C8 -:108A400034480340783213430B6029680B688C2547 -:108A500049595B18196801400A431A602C4B424679 -:108A6000134374E7274D2B68196888229B58C9184F -:108A70000B68284803409022120113430B602968B9 -:108A80000B688C2549595B18196801400A431A6024 -:108A9000E4E7380005F000FA8DE73323D35C012BBF -:108AA00000D801BE174B1968BA23CA5A0B6A9C46F4 -:108AB0006244BC23CB589B181B68002B0ADB164A68 -:108AC000136904210B431361012F01D030BF72E7FA -:108AD00020BF70E70C4C6EE728010009FFF7B8FED5 -:108AE00078E7074B5B68002B03D002210120FFF7DA -:108AF00073FD054B9C4200D18DE7084C8BE7C046C7 -:108B000054600108D45F010805004200FFFFFFDF49 -:108B100014600108FF00FFFF00ED00E0FF004200CD -:108B2000074A084BD3581F200340B0214905E822CB -:108B3000D200885CC01A431E9841C0B27047C0463C -:108B4000000026401CFF0000044B186880231B0413 -:108B5000184043425841C0B27047C046000026400A -:108B600010B5FFF7F1FF002810D01C4A13681C490C -:108B70000B4013600820FFF719FB6423174A1268A3 -:108B8000002A09DB002B07D0013BF7E7134A1368E3 -:108B900014490B401360EDE7002B01D1124810BDC2 -:108BA0000E4A136811490B4013600120FFF7FEFACB -:108BB000FFF7CAFF002801D10020F0E7FFF7B0FF60 -:108BC000012801D00020EAE7B0225205084BD15815 -:108BD000024A084BD1500020E1E7C0460000264081 -:108BE000FFFFFBACFFFFFBAD02004200FFFFFFFBFE -:108BF00010180000307F000010B5FFF7A5FF002817 -:108C000008D0054B054A10681840C01A4342584125 -:108C1000C0B210BD024BF5E700000453000026402F -:108C200000000452F8B50400012800D901BEFFF786 -:108C30008DFC002802D12D4D2800F8BDF7F7ADFCC2 -:108C40000600002C14D12A4A2A4B0021D150B02210 -:108C50005205E823DB00D75CFFB20120FFF72CFDB3 -:108C6000051E02D0002D2AD11DE0FFF785FBF9E794 -:108C7000FFF7C2FF002826D01D4A1E4B5021D150BD -:108C8000B02252051C4BD75CFFB219491B4A8B58C6 -:108C90001F208343143803438B500838FFF786FAAC -:108CA000FFF7AAFB00251248144943581F2293439B -:108CB0003A4013434350002C0DD1FFF7D7FB30004F -:108CC000F7F76FFCB8E7B02252050D4BD158084AB0 -:108CD000084BD150D4E70720FFF768FAFFF7F6FBFF -:108CE0000020FFF7E9FC0500E9E7C0460300420069 -:108CF00000002640307F0000410700001CFF0000FC -:108D000010180000084B5A6C120AFF2313403A2B2C -:108D100000D0704704494B6C044A1A40E8239B0179 -:108D200013434B64F5E7C04600002740FFC5FFDF53 -:108D300004494B6C044A1A40E8239B0113434B64DB -:108D40007047C04600002740FF00FFFF042810D0F6 -:108D500000060B4B1A681368A42152589B18C022B6 -:108D6000920410401860074A1368A0398B431360BF -:108D70007047044A136804210B431360F8E7C046A8 -:108D8000D45F010810E000E0044AC0235B00D05823 -:108D9000800F431E9841C0B27047C0460000264075 -:108DA0000749C02252008B589B009B088020C005B9 -:108DB00003438B50885880231B0603438B50704716 -:108DC0000000264010B5040080235B02984200D3C7 -:108DD00001BEFFF7D9FF002809D1054AC4235B0073 -:108DE000D058000C00042404240C0443D45010BDBB -:108DF0000000264010B504000F2800D901BEFFF77F -:108E0000C3FF00280BD10649C42252008B580548E5 -:108E100003402404F020000304401C438C5010BD88 -:108E200000002640FFFFF0FF034AE023DB000121A2 -:108E3000D150D3587047C046000026400022430856 -:108E40008B4274D303098B425FD3030A8B4244D312 -:108E5000030B8B4228D3030C8B420DD3FF22090254 -:108E600012BA030C8B4202D31212090265D0030B13 -:108E70008B4219D300E0090AC30B8B4201D3CB0309 -:108E8000C01A5241830B8B4201D38B03C01A52414B -:108E9000430B8B4201D34B03C01A5241030B8B424D -:108EA00001D30B03C01A5241C30A8B4201D3CB0238 -:108EB000C01A5241830A8B4201D38B02C01A52411D -:108EC000430A8B4201D34B02C01A5241030A8B4220 -:108ED00001D30B02C01A5241CDD2C3098B4201D338 -:108EE000CB01C01A524183098B4201D38B01C01AB6 -:108EF000524143098B4201D34B01C01A524103092D -:108F00008B4201D30B01C01A5241C3088B4201D3DB -:108F1000CB00C01A524183088B4201D38B00C01A88 -:108F2000524143088B4201D34B00C01A5241411AAF -:108F300000D20146524110467047FFE701B50020BC -:108F400000F0F0F802BDC0460029F7D076E7704780 -:108F500003460B437FD4002243088B4274D303099A -:108F60008B425FD3030A8B4244D3030B8B4228D33B -:108F7000030C8B420DD3FF22090212BA030C8B4261 -:108F800002D31212090265D0030B8B4219D300E001 -:108F9000090AC30B8B4201D3CB03C01A5241830B86 -:108FA0008B4201D38B03C01A5241430B8B4201D336 -:108FB0004B03C01A5241030B8B4201D30B03C01A5F -:108FC0005241C30A8B4201D3CB02C01A5241830AD9 -:108FD0008B4201D38B02C01A5241430A8B4201D308 -:108FE0004B02C01A5241030A8B4201D30B02C01A32 -:108FF0005241CDD2C3098B4201D3CB01C01A524199 -:1090000083098B4201D38B01C01A524143098B4221 -:1090100001D34B01C01A524103098B4201D30B010A -:10902000C01A5241C3088B4201D3CB00C01A52412F -:1090300083088B4201D38B00C01A524143088B42F4 -:1090400001D34B00C01A5241411A00D2014652418D -:10905000104670475DE0CA0F00D04942031000D3AC -:109060004042534000229C4603098B422DD3030A01 -:109070008B4212D3FC22890112BA030A8B420CD311 -:10908000890192118B4208D3890192118B4204D33A -:1090900089013AD0921100E08909C3098B4201D3BA -:1090A000CB01C01A524183098B4201D38B01C01AF4 -:1090B000524143098B4201D34B01C01A524103096B -:1090C0008B4201D30B01C01A5241C3088B4201D31A -:1090D000CB00C01A524183088B4201D38B00C01AC7 -:1090E0005241D9D243088B4201D34B00C01A52419E -:1090F000411A00D20146634652415B10104601D32B -:109100004042002B00D54942704763465B1000D3B4 -:10911000404201B5002000F005F802BD0029F8D05A -:1091200016E770477047C046002B11D1002A0FD1B7 -:10913000002900D1002802D00021C943080007B44B -:10914000024802A14018029003BDC046D9FFFFFFAC -:1091500003B4684601B5029800F052F8019B9E46A0 -:1091600002B00CBC7047C046F0B5CE46474680B54D -:10917000070099463B0C9C4613041B0C1D000E0077 -:1091800061460004140C000C45434B4360436143AB -:10919000C0182C0C20188C46834203D980235B0214 -:1091A0009846C444494679437243030C63442D04F2 -:1091B0002D0CC918000440198918C0BCB946B04626 -:1091C000F0BDC04670B500220C4B04000D0001F04C -:1091D00005F8002804D12000290000F065FF70BDCB -:1091E000064B00222000290000F0CCFB00F05CFFC1 -:1091F00080231B069C466044F1E7C0460000E04126 -:10920000F0B557464E464546DE46E0B504000D0033 -:109210009246994683B08B4230D82DD0494650466D -:1092200001F004F829000600200000F0FFFF331AC7 -:109230009846203B9B4633D45A4653469340424679 -:109240001F00534693401E00AF423AD8AF4200D1B0 -:1092500078E05B46A41BBD41002B00DA75E00022DC -:1092600000230092019301235A4693400193012366 -:1092700042469340009328E08242CFD90022002347 -:10928000009201930C9B002B01D01C605D60009844 -:10929000019903B0F0BCBB46B246A946A046F0BD5A -:1092A000424620239B1A5246DA40414613004A4662 -:1092B0008A40170042461F43534693401E00AF4268 -:1092C000C4D900220023009201934346002BD9D039 -:1092D000FB0772081A4346467B080EE0AB4201D1F9 -:1092E000A2420CD8A41A9D41012024196D410021ED -:1092F000013E24184D41002E06D0AB42EED9013E6E -:1093000024196D41002EF8D1009801995B4600198F -:109310006941002B24DB2B005A464446D3402A00E7 -:10932000E2401C005B461500002B2ADB26009E4015 -:10933000330026004746BE403200801A9941009013 -:1093400001919FE7A342BCD883E742462023002136 -:109350009B1A0022009101920122DA40019286E7D5 -:10936000424620239B1A2A0046469A402300F34097 -:10937000444613432A00E2401C005B461500002BC4 -:10938000D4DA42462F002023260097409B1ADE4065 -:109390003B003343CDE7C046F0B557464E46454601 -:1093A000DE46E0B5814605000C03480092461F00EA -:1093B00085B0240B400DCE0F002800D156E1D44BD0 -:1093C000984200D172E16B0FE4001C4380231B0420 -:1093D00023439846CF4BED009B4600239946834498 -:1093E00000933C037B005046240B5B0DFF0F002BCA -:1093F00000D11FE1C64A934200D162E1C549420F44 -:109400008C46E40059461443802263441204CB1A6C -:1094100014439B46C200002033007B409A464B46D3 -:109420000F2B27D8BC499B00CB589F46B246009BC8 -:10943000022B16D0032B00D18EE2012B00D0D9E0F5 -:1094400000230024002552461B052343D207134363 -:109450002800190005B0F0BCBB46B246A946A0469C -:10946000F0BD00240025AA4BEDE7BA46A046150042 -:109470000090DCE7444500D2C7E100D1C2E10123FE -:109480005B429C462E0040460025E3442302140E16 -:109490001C431B0C994623041F0C120249460092E0 -:1094A0000197FFF751FD02007A430B04310C80460F -:1094B00019438A4207D901235B429C460919E044BB -:1094C0008C4200D807E2881A4946FFF73DFD09049F -:1094D0008C4631046646019A090C4243030031432D -:1094E0008A4204D90919013B8C4200D8EDE1881A5F -:1094F000424612041A4390464146009B0E041B0C40 -:109500001F000293009B360C1B04190C0B007343C5 -:10951000120C7E43039151437A431F0CBC467618CC -:109520006644B14203D9802149028C466244310C21 -:109530008A1831041E04360C8E19904202D312D1BF -:10954000B54210D24346591E009B9C4665441F00FD -:109550009D429B415B421B19C018844200D2A0E18E -:1095600000D19BE18846AE1BB542AD41801A6D42E9 -:10957000401B844200D1D5E14946FFF7E5FC019A42 -:109580000B044243310C050019438A4200D96CE1B7 -:10959000881A4946FFF7D8FC019A36044243090469 -:1095A000360C03000E43B24200D953E10398B61AB9 -:1095B00002002D041D43029F2B041B0C5A437B43C6 -:1095C0009C46290C4843130C8444634479439842D5 -:1095D00003D98020400284466144180C12041B0405 -:1095E000120C41189B188E4200D2FFE000D1FAE025 -:1095F00001231D43494A5A44002A00DCAAE06B07B4 -:1096000000D03DE1ED084346DB0106D54246444B20 -:109610001A4090468022D2005A44424B9A4200DDC2 -:109620001FE743465B071D43434652055C02240B7C -:10963000530D08E75246224300D17BE0002C00D1B5 -:10964000FAE0200000F0D4FD02000B3A1D230100D7 -:109650009B1A52460839DA408C40144352468A40DD -:10966000314B58449B4683440020D5E64B46234368 -:10967000984644D0002C00D1CEE0200000F0B8FD88 -:10968000010002000B391D235B1A49461000D94026 -:10969000083884400B004D462343984685402348B4 -:1096A000831A9B460023994600939AE64B46234330 -:1096B00098461DD108239946063B00258346009312 -:1096C0008FE65246224309D1022349461943184BDB -:1096D00089469C4600240220E3449DE603234A4633 -:1096E0001A43134B91469C4652460320E34493E6AB -:1096F0000C239946093BA0468346009371E6042358 -:10970000994600239B4601330025009369E6C04635 -:10971000FF07000001FCFFFF74F20010FF030000D0 -:10972000FFFFFFFEFE070000F30300000DFCFFFF3C -:1097300001F8FFFF4946012319438946002401200F -:109740006AE6002380249A4600258A4B24037AE6A1 -:1097500001256D4201239B1A382B00DD70E61F2B7B -:1097600000DCBFE01F2149428A1A4146D1400A006D -:10977000202B04D04146804B5B4499400D436B1E27 -:109780009D4107232A431D0000241540134200D1A8 -:10979000D4E00F2100231140042900D1CBE0111D9A -:1097A0009142924152429B180A00190200D4C2E031 -:1097B00001230024002546E6802341461B0319426D -:1097C00008D01C4206D11C432403BA461500694B3D -:1097D000240B38E68024434624031C432403B2466A -:1097E000644B240B2FE6002B00D103E7A619681E5B -:1097F000A64200D28DE08E4200D2A3E000D1B3E0B9 -:109800000500F5E6AA4200D939E64346DE075808C6 -:109810006B081E43ED0739E6484600F0E9FC0100FD -:109820000200153120321C2900DC2CE74B46083899 -:1098300083400025984632E700F0DAFC03001A0066 -:10984000153220301C2A00DC00E75446083B002279 -:109850009C4005E73619013BB44200D9A6E6B24266 -:1098600000D8A3E6831E3619A0E60919013D8C42F3 -:1098700000D98DE68A4200D88AE6851E091987E656 -:109880000F232B40042B00D1BCE605235B42AB42E7 -:109890009B4104355B42ED089844B4E6AF4200D9E1 -:1098A00060E6824204D800D05CE6AE4200D859E6B9 -:1098B00002235B429C46009BE0449C4665449D42DB -:1098C0009B415B421B19C0184DE68A4200D80EE648 -:1098D000831E09190BE68A4200D8F4E5831E9846D8 -:1098E0000919F0E52549280059448D4042468A402F -:1098F000691E8D414146D840D94002432A430B009E -:10990000510700D151E70F211140042900D046E74B -:109910004BE705008E4200D06AE6009A934200D0E1 -:1099200066E667E6164A5A44002A00DC10E701237F -:109930000025984467E65D075B021C0BD2080023F4 -:10994000154380E50098023D42008242BF417F42BC -:109950003C1936190092DDE78024434624031C435A -:109960002403044B240B6EE5009A9A42EAD30500C7 -:10997000D3E7C046FF0700003E0400001E040000BD -:10998000FF030000F8B557464E464546DE46E0B5B3 -:109990001E0017004A000B03520D5B0A9046420F4F -:1099A0001A43CD0FCD4C3103C300944670007A0F9B -:1099B000490AFF009A46B946400DF60F1143A042EE -:1099C00000D1B1E001225640B346B54200D188E053 -:1099D0004246121A002A00DCAEE0002800D1C1E0A5 -:1099E000BE48804500D151E1802000040143382A5F -:1099F00000DD7BE11F2A00DDEEE120203E00801A21 -:109A00000C00D640D140874062468440521A781EEE -:109A10008741944634432743DC1BA3429B41624663 -:109A20005B42D31A99464B461B0200D418E14B46C1 -:109A30005802430A99464B46002B00D137E148466D -:109A400000F0D6FB010008392023220048465B1AAB -:109A5000DA4088408C4043461043884500DD36E1BB -:109A6000C91A4B1C1F2B00DDEAE020222600D21A67 -:109A700001009440DE40D84000239140621E944192 -:109A80008146984631430C43630709D00F23234096 -:109A9000042B05D0231DA342A4416442A1441C0011 -:109AA0004B461B0200D4DEE041468C4B013199420B -:109AB00000D1E7E04B468A48E40803401800490516 -:109AC0005B07400223434A0D040B1205ED072243B6 -:109AD0002A4318001100F0BCBB46B246A946A04676 -:109AE000F8BD4246121A002A52DD002800D19CE03F -:109AF000A04500D1CAE0802000040143382A00DDDF -:109B000049E11F2A00DC97E110000E002038C64012 -:109B1000202A04D04020821A91400F43B9464C4677 -:109B2000621E944134433AE10A003A4328D0B346D6 -:109B3000B5422BD06B4A4244002A5DD0424644468F -:109B4000821A002C00D0F5E065461D4300D19CE14F -:109B5000551E012A00D1FBE1604CA24200D1BDE1BB -:109B60002A00F0E00800384300D1C3E0501E012A6B -:109B700000D1A8E1594CA24200D187E0020036E7AB -:109B800001225640B346B54200D021E7554A42442F -:109B9000002A00D1B5E042464446821A002C00D18A -:109BA00038E14E4EB04200D1DEE1802664463604F4 -:109BB0003443A446382A00DD96E11F2A00DD24E262 -:109BC0002026B41AA24664465646B440A1461C005C -:109BD0004E46D440264334005646B3405E1EB34141 -:109BE0001C436346D340C918E419BC42BF417F42BD -:109BF000B94680468944D8E040463B4C013020427B -:109C000000D0B4E04046002800D044E1604618434C -:109C100000D190E10800384300D0AAE16146DB089A -:109C200049070B436146CC0827E00800384361D060 -:109C3000501E012A00D139E1A24227D002005DE77F -:109C400002001F39CA401100202B03D04022D31A32 -:109C500098400443631E9C410023994698460C4358 -:109C6000630700D012E74B464A46E4085B072343EC -:109C7000D408424619498A420ED024035205240BC7 -:109C8000520D22E70A00002400231EE7DB0862468B -:109C9000520713436246D4081A00224300D1FCE164 -:109CA00080221203144324030C4A240B0DE72000E6 -:109CB00000F09EFA010018311F2900DCC4E60838C4 -:109CC0008440434620000024884500DCC8E6044A5E -:109CD0005B1A104098468146D6E6C046FF07000052 -:109CE000FFFF7FFF01F8FFFFFE0700000F437A1E12 -:109CF000974191E66146DB0849070B436146CC0872 -:109D0000B8E74046D34C0130204200D0A2E04046A4 -:109D1000002800D001E16046184300D15EE1080050 -:109D2000384300D05FE16146DB0849070B436146D9 -:109D3000CC08A2E7C84DA84200D1CFE080256446F8 -:109D40002D042C43A446382A56DC1F2A00DDD1E01E -:109D500020251E00AD1A6446AB40AC40D6405D1EC7 -:109D6000AB41344323436446D440091B49E0604679 -:109D7000DC1B461AA34280414042814630004E46D9 -:109D8000801B8146000276D44B46234300D052E626 -:109D90000024002571E739430C00621E9441E41849 -:109DA0009C429B415B42634499464B461B0200D454 -:109DB00056E701239C46A84BE044984538D04B46D3 -:109DC000A648012203401800630814401C43C3073F -:109DD0001C434308994657E610000E002038C64041 -:109DE000202A04D04020821A91400F43B9464F46A2 -:109DF0007A1E974137430FE662461A4313005A1EF4 -:109E00009341FC1AA742BF417F42CB1B99465D4656 -:109E1000804608E666461E4300D1BEE0561E012A73 -:109E200000D109E18C4CA24200D119E13200C1E617 -:109E300042460024002348E620200C00801A3E0001 -:109E400087408440D640781E8741D14034433C430C -:109E50008C44A4E7804A904200D1E9E0DF199F4298 -:109E60009B4161445B42C918CC077F084B08994667 -:109E700080463C43F4E6FC1AA742BF4163467F425A -:109E8000C91ACB1B99465D46D5E5FF084B075D46D1 -:109E90003B43CC08EEE662461A4300D082E00B005A -:109EA0003B431BD1802400252403F9E6DC199C42A6 -:109EB0009B41614489465B4299444B461B0244D412 -:109EC00001239846CCE6DC1B6246A3429B41511A13 -:109ED0005B42CB1A994601239846A4E5FF084B073D -:109EE0005D463B43CC08D7E662461A431400631E26 -:109EF0009C4179E615006446203DEC40A046202AAE -:109F000005D040256446AA1A944023439A465446F5 -:109F1000631E9C414346234373E762461A4323D0A2 -:109F20000A003A4300D0A0E06246DB085207134320 -:109F30006246D408B0E60B003B4300D128E7FF0897 -:109F40004B075D463B43CC0897E60223984636E72D -:109F5000FC1AA742BF4163467F42C91ACB1B9946F0 -:109F600001235D4698465EE54B07FF083B43CC085E -:109F700092E6DC1B6046A342B641401A7642801B43 -:109F80008146000260D5FC1AA742BF4163467F426A -:109F9000C91ACB1B99465D4676E5FF084B073B4344 -:109FA000CC0867E60A00DB083A4300D16FE6624658 -:109FB000520713436246D40880221203144207D08A -:109FC000C808104204D15D460400FB0849070B4352 -:109FD0005A0FDB00DB08520713435DE64B07FF080F -:109FE0003B43CC0849E6DC199C429B4161448946CD -:109FF0005B4299444B461B0200D431E64A46174B5C -:10A000001A400123914698462AE616006446203EEF -:10A01000F440A046202A05D040266446B21A944057 -:10A0200023439A465446631E9C4143461C43DBE54A -:10A0300002000024002348E5DC19BC42BF41614412 -:10A0400089467F42B94438E74B46234300D19FE617 -:10A0500006E6C046FE070000FF070000FFFF7FFF87 -:10A06000FF084B073B43CC0816E66246DB08520765 -:10A0700013436246D40880221203144207D0C80852 -:10A08000104204D15D460400FB0849070B435A0FF8 -:10A09000DB005207DB081343FEE50023014A1C00E6 -:10A0A00013E5C046FF0700000A0030B5134C53000B -:10A0B00009030500090B00205B0DD20FA34204DD4C -:10A0C0000F48834202DD0F4BD01830BD8020400383 -:10A0D00001430D48C01A1F2808DD0C48C31AD94097 -:10A0E0000B005842002AF0D11800EEE7084CC5409A -:10A0F000A446634499400B002B43F2E7FE030000A3 -:10A100001D040000FFFFFF7F330400001304000064 -:10A11000EDFBFFFF70B5002816D0C317C5185D40D2 -:10A12000C40F280000F064F8114A121A0A2816DC3D -:10A1300003002E0015339E400B23181AC54052050C -:10A140002D032D0B530D03E00024002300250026D2 -:10A150001B052B43E40723433000190070BD0B3867 -:10A16000854052052D0300262D0B530DF0E7C04608 -:10A170001E0400008446100062468C4619006346A7 -:10A1800000E0C0461FB500F005F9002801D4002109 -:10A19000C8421FBD10B500F055F84042013010BD57 -:10A1A00010B500F0F7F8002801DB002010BD0120F9 -:10A1B00010BDC04610B500F0EDF8002801DD00200C -:10A1C00010BD012010BDC04610B500F07DF800287C -:10A1D00001DC002010BD012010BDC04610B500F00C -:10A1E00073F8002801DA002010BD012010BDC04620 -:10A1F0001C2101231B04984201D3000C10391B0AB7 -:10A20000984201D3000A08391B09984201D300097A -:10A21000043902A2105C40187047C04604030202D1 -:10A2200001010101000000000000000010B500293C -:10A2300003D1FFF7DDFF203002E00800FFF7D8FF71 -:10A2400010BDC046F0B54E464546DE4657469046E0 -:10A25000E0B517001A03120B0500844619480E03D7 -:10A260004C0091465A00DB0F9B46360B640DC90F1C -:10A27000520D844219D0824210D0012094420ED156 -:10A280004E450CD10120C44509D1594517D0002CA9 -:10A2900005D130002843431E984100E00120F0BC66 -:10A2A000BB46B246A946A046F0BD330001202B4371 -:10A2B000F5D1A242F3D14B463B43F0D1E2E7002077 -:10A2C000EDE7C046FF070000F0B54746CE46040064 -:10A2D000180016001B031B0B2D4D4A00994680B534 -:10A2E00043000F03A446B0463F0B520DC90F5B0D50 -:10A2F000C00FAA4221D0AB4213D0002A22D13C4346 -:10A30000002B02D14D462E4322D0002C10D081428A -:10A3100022D00220013908400138C0BCB946B046FD -:10A32000F0BD4D462E4329D1002AF0D13C43EED159 -:10A330000028F2D101204042EFE73D0025431DD126 -:10A340009342EED0002BE2D14C462643DFD1E0E72A -:10A350000020002CE1D0DCE79A420ADCE8DB4F4524 -:10A36000D7D80ED000204F45D7D20029E2D0080020 -:10A37000D3E74342584140000138CEE70220404233 -:10A38000CBE7C445C5D80020C445C6D2EDE7C046DA -:10A39000FF070000F0B54746CE460400180016003F -:10A3A0001B031B0B2C4D4A00994680B543000F033D -:10A3B000A446B0463F0B520DC90F5B0DC00FAA4219 -:10A3C0000DD0AB4210D0002A27D13C43002B11D135 -:10A3D0004D462E430ED10020002C15D00EE03D003E -:10A3E000254310D1934218D14D462E430BD1002A5C -:10A3F00002D13C43002C0BD0814214D00220013901 -:10A400000840013800E00220C0BCB946B046F0BDAB -:10A410000028F9D101204042F6E7002BECD14C4650 -:10A420002643E9D1EAE79A4204DD4342584140001D -:10A430000138E9E79A42EBDB4F45DFD806D0002030 -:10A440004F45E1D20029E5D00800DDE7C445D5D865 -:10A450000020C445D8D2F5E7FF07000030B514004E -:10A460001A00094B05001B6885B0D868074B002C03 -:10A4700001D1074B1C00019300912B000549029468 -:10A4800000F00AF801F07CF8EC010008B4F20010CA -:10A49000EFF20010C1F200100EB403B5010003ABDF -:10A4A000044804CB0068019300F0DAF902B008BC5C -:10A4B00003B01847EC010008F7B553430500170037 -:10A4C000089C01910093002804D08369002B01D1DE -:10A4D00002F030F8274B9C4225D16C68636EDB0795 -:10A4E00005D4A3899B0502D4A06D00F057F8A38979 -:10A4F0001B0722D52369002B1FD00026009B9E42FC -:10A5000022D0019B995DA368013BA360002B04DA74 -:10A51000A269934226DB0A2924D023685A1C2260B0 -:10A5200019700136EAE7144B9C4201D1AC68D5E7BB -:10A53000124B9C42D2D1EC68D0E72100280000F0F9 -:10A54000A7FF0026B042D8D0636EDB0705D4A389ED -:10A550009B0502D4A06D00F022F839003000FEF710 -:10A560006DFCFEBD2200280000F03CFF431CD8D14A -:10A57000EAE7C046F0F4001010F50010D0F4001027 -:10A5800007B5009313000A00010002480068FFF7B6 -:10A5900093FF0EBDEC01000870477047704770478D -:10A5A00010B5034B0100186800F0BCF810BDC046A0 -:10A5B000EC01000830B500240139A24201D100208D -:10A5C00005E0035D01340D5DAB42F6D0581B30BD94 -:10A5D000002310B59A4200D110BDCC5CC4540133A5 -:10A5E000F8E703008218934200D1704719700133D5 -:10A5F000F9E770B5130C0D0C1ED1002B0CD189B2EC -:10A6000094B24C43210000F08DF8051E1BD02200AF -:10A610000021FFF7E6FF16E01D1C0B1C92B289B269 -:10A620009CB25143ABB263430C0C1C19220C07D1F2 -:10A63000240489B20C43E5E7002B01D1131CEDE79C -:10A640000C2300250360280070BD000070B50500D4 -:10A65000002910D00C1F2368002B00DAE418280012 -:10A6600002F096F81D4A1368002B05D16360146050 -:10A67000280002F095F870BDA34208D9216860183F -:10A680008342F3D118685B6841182160EEE71A0035 -:10A690005B68002B01D0A342F9D911685018A04281 -:10A6A0000BD120680918501811608342E0D1186856 -:10A6B0005B68411811605360DAE7A04202D90C23AD -:10A6C0002B60D5E721686018834203D118685B6866 -:10A6D0004118216063605460CAE7C0466C6001089D -:10A6E00070B50F4E0D0031680400002902D100F052 -:10A6F0005FFE30602900200000F05AFE431C0AD0A3 -:10A700000323C51C9D43A84207D0291A200000F04E -:10A710004FFE431C01D101256D42280070BDC0468B -:10A7200070600108F7B50322CB1C93430833060081 -:10A730001F000C2B32D20C27B94231D8300002F066 -:10A7400027F8324D2B681C00002C2ED13900300028 -:10A75000FFF7C6FF0400431C1ED12C682500002D06 -:10A760004AD123682900E3183000019300F020FE4D -:10A77000019B834243D123680337FF1A03239F437E -:10A7800008370C2F00D20C2739003000FFF7A8FF44 -:10A79000431C34D02368DF19276013E0002BCBDA89 -:10A7A0000C23002533602800FEBD2268D11B20D475 -:10A7B0000B2917D9E2192760A34211D12A606368D7 -:10A7C000116053603000250001F0EAFF07220B35CD -:10A7D000231D9543EA1A9D42E5D05B1BA350E2E797 -:10A7E0005A60ECE76268A34201D12A60EAE75A6046 -:10A7F000E8E723006468A7E72C006D68AFE70C2347 -:10A800003000336001F0CCFFCDE7C0466C6001083A -:10A81000936810B5013B9360002B04DA9469A3425E -:10A8200007DB0A2905D01368581C1060197008004E -:10A8300010BD00F0D7FD0100F9E7F8B506000F00E4 -:10A840001400D518AC4201D1002007E021783A006D -:10A850003000FFF7DDFF0134431CF3D1F8BD0000E9 -:10A86000F0B5A1B006000C001F000392002804D030 -:10A870008369002B01D101F05DFE8E4B9C421CD1FF -:10A880007468636EDB0705D4A3899B0502D4A06DB1 -:10A89000FFF784FEA3891B0702D52369002B1DD176 -:10A8A0002100300000F0F4FD002817D0636EDB07B4 -:10A8B0000DD50120404221B0F0BD7F4B9C4201D11B -:10A8C000B468DEE77D4B9C42DBD1F468D9E7A3890D -:10A8D0009B05EED4A06DFFF762FEEAE7002308AD0A -:10A8E0006B6120336B761033AB760797039F3B7811 -:10A8F000002B01D0252B4ED1039BFB1A0593039B04 -:10A900009F420DD0059B21003000039AFFF795FF71 -:10A91000431C00D1B5E06A69059B944663446B61B2 -:10A920003B78002B00D1ACE001227B1C0393002379 -:10A9300052426A6004A9543252182B60EB60AB603B -:10A940001370AB65039B052219785D4801F014FF75 -:10A95000039B5F1C002820D12A68D30604D553230B -:10A9600004A95B1820211970130704D5532304A9E7 -:10A970005B182B211970039B1B782A2B16D0002102 -:10A98000EB68039F3A78781C303A8446092A4FD9FD -:10A99000002911D117E00137A9E7494B2A68C01AED -:10A9A0000123834013432B600397CBE7079B191DBB -:10A9B0001B680791002B01DB0B9304E05B42EB600B -:10A9C000022313432B603B782E2B0AD17B782A2B52 -:10A9D00037D1079B02371A1D1B680792002B2DDB0E -:10A9E000099303223978374801F0C6FE002807D0C2 -:10A9F000344B2A68C01A40238340134301372B602D -:10AA000039787B1C062230480393297601F0B4FE86 -:10AA1000002845D02D4B002B27D10722079B073359 -:10AA20009343083307936B69049A9B186B615DE746 -:10AA30000A214B4367469B180939A3E701235B4270 -:10AA4000CEE700231A0001376B603978781C303963 -:10AA50008446092903D9002BC3D00992C1E70A23F0 -:10AA60005A4367465218093BEFE707AB00932200B1 -:10AA700029003000164B00F0D7F80490049B0133F6 -:10AA8000D1D1636EDB0705D4A3899B0502D4A06DE9 -:10AA9000FFF785FDA3895B0600D50AE70D980AE755 -:10AAA00007AB0093220029003000094B00F06EFB39 -:10AAB000E3E7C046F0F4001010F50010D0F40010E9 -:10AAC000F4F20010FAF20010FEF2001029AC0010AF -:10AAD0003BA80010F0B51E00002314008BB09E426E -:10AAE00004DA8021090673181E002D23129A149F80 -:10AAF0001370202303229F43462F07D03B00453B82 -:10AB000059424B411099013ACB18109309AB049369 -:10AB100008AB0393139B00920293109B22000193B6 -:10AB2000330000F0BFFD0500472F02D1119BDB076A -:10AB300028D5109BEB180793462F14D12B78302B78 -:10AB40000CD10022002320003100FFF723FB002856 -:10AB500004D10123109A9B1A139A1360139B079A2E -:10AB60001B68D31807930022002320003100FFF751 -:10AB700011FB002801D0079B09933022099B0799FC -:10AB80008B4206D32800099B159A5B1B13600BB000 -:10AB9000F0BD591C09911A70F0E7F0B5831C87B01D -:10ABA000039305000C002B230270002901DA4C42AC -:10ABB00002336B70092C31DD0A2704ABDE1D200047 -:10ABC00039000196FEF7AAFA013E303120003170BB -:10ABD00039000294FEF7BCF9029B0400632BEEDC03 -:10ABE000019B30349A1E13000399147004A8073097 -:10ABF00098420ED804AB073300209A4204D804AB25 -:10AC00000930C018019BC01A039B1818401B07B0DD -:10AC1000F0BD1878013308700131E7E73023E418FC -:10AC2000AB70281DEC70F1E7F0B595B00C000992FF -:10AC30001E001A9D070001F01DFD036818000C930B -:10AC400000F0C8FB00231293237E07220A93236897 -:10AC50000E900D930D992B68C90547D59B1893430A -:10AC60001A0008322A601A685B68A264E364012251 -:10AC7000A36CE56C0B936B005B080F930B98A74BD1 -:10AC80000F99524203F076F8002831D10122A34BEC -:10AC90000B980F995242FFF78DFA002828D1002215 -:10ACA000002329000B98FFF77BFA002803D023002C -:10ACB0002D2243331A700A9B994D472B00D9994D89 -:10ACC00003230D9A236101339A43002322600B93DF -:10ACD000099B21003800009613AA00F0E7F9431CF5 -:10ACE00000D0A2E00120404215B0F0BD0733B6E726 -:10ACF0000B9A2B001000290003F03CF800280BD021 -:10AD0000002D03DA23002D2243331A700A9B864D4F -:10AD1000472BD5D9854DD3E720220A996368914303 -:10AD20000F915A1C49D10733636080230D9ADB00D1 -:10AD300013430022069212AA05920A9A08A90492C5 -:10AD400011AA03922322236001936368521802928E -:10AD5000009338002B000B9AFFF7BCFE0F9B0500F9 -:10AD60001199472B08D1CB1C02DB6368994248DD5F -:10AD70000A9B023BDBB20A930A9B652B24D8200076 -:10AD80001A00013950301191FFF707FF129A0B900A -:10AD900013182361012A02DC2268D20701D501338E -:10ADA0002361232308AA9B181B78002B00D18FE76F -:10ADB00023002D2243331A708AE70F9A472AB4D111 -:10ADC000002BB2D10133AFE70A9B662B1BD163681E -:10ADD00000290DDD2161002B02D12268D20702D5A6 -:10ADE000013359182161119BA36500230B93D8E708 -:10ADF000002B03D101222168114200D09A1C22614C -:10AE0000F1E767230A93119B129A934206DB2268AB -:10AE10002361D207E7D501332361E4E70121002B49 -:10AE200001DC4918C91A5218E9E72268530507D40A -:10AE300023692A0038000999B047431C28D151E7FB -:10AE40000A9B652B00D8E1E0A06CE16C0022002396 -:10AE5000FFF7A0F9002831D001233800344A0999BE -:10AE6000B047431C00D13DE7119B129A934202DB8D -:10AE70002368DB070CD538000E9B0C9A0999B04764 -:10AE80000025431C00D12DE7129B013BAB420ADC9D -:10AE900023689B0700D506E1139BE068984200DB1E -:10AEA00022E7180020E722000123380009991A320E -:10AEB000B047431C00D115E70135E5E7119B002B96 -:10AEC00038DC012338001A4A0999B047431C00D1E5 -:10AED00008E7119B129A134302D12368DB07D7D5E9 -:10AEE0000E9B38000C9A0999B047431C00D1F9E633 -:10AEF00000230A93119B0A9A5B42934201DC129B46 -:10AF000097E722000123380009991A32B047431C01 -:10AF100000D1E7E60A9B0133EBE7C046FFFFEF7F76 -:10AF200005F3001009F300100DF3001011F30010E9 -:10AF300015F30010129AA36D0A929A4200DD0A934B -:10AF40000A9B002B3CDC00230D930A9BDB43DB17A1 -:10AF50000F93A36D0F9A0B930A9B13400B9AD31A6E -:10AF60000D9A934234DC119B129A93423DDB236885 -:10AF7000DB073AD4129A0B9B1199D31A521A0A92F0 -:10AF80009A4200DD0A930A9B002B36DC0A9B0025BF -:10AF9000DB43DB170B93119A129B0B999B1A0A9AAE -:10AFA0000A409B1AAB4200DC72E722000123380002 -:10AFB00009991A32B047431C00D193E60135EAE7FC -:10AFC0000A9B2A0038000999B047431CBBD189E687 -:10AFD00022000123380009991A32B047431C00D1DE -:10AFE00080E60D9B01330D93B3E70E9B38000C9A5E -:10AFF0000999B047431CBDD174E60B9B3800EA1891 -:10B0000009990A9BB047431CC0D16BE6129B012BE8 -:10B0100002DC01231A4234D001232A0038000999A6 -:10B02000B047431C00D15DE60E9B38000C9A09998D -:10B03000B047431C00D155E6A06CE16C0022002310 -:10B04000FFF7A8F800281AD1129B6A1C013B3800B0 -:10B050000999B047431C0ED144E622000123380071 -:10B0600009991A32B047431C00D13BE60135129BC7 -:10B07000013BAB42F1DC22000B9B5032DAE60025AB -:10B08000F5E72A00E3E72200012338000999193285 -:10B09000B047431C00D125E60135E368139A9B1A9B -:10B0A000AB42F0DCF8E60025F7E7C046F7B515003F -:10B0B00001938A680B690C000090934200DA130038 -:10B0C00022002B6043321278002A01D001332B601A -:10B0D00023689B0602D52B6802332B602268062367 -:10B0E00017001F401A4227D0230043331B785A1EF3 -:10B0F00093412268920630D4220001990098089E5C -:10B100004332B047431C25D0062320682A68E168F3 -:10B1100000250340042B03D18D1AEB43DB171D40A0 -:10B12000A3682269934201DD9B1AED180027BD42F6 -:10B1300020D1002010E00137E3682A689B1ABB4247 -:10B14000D2DD2200012301990098089E1932B047F0 -:10B15000431CF0D101204042FEBD3020E1184331B4 -:10B16000087021005A1C45310978A2184332023375 -:10B170001170C1E72200012301990098089E1A323C -:10B18000B047431CE6D00137D1E70000F0B58BB0E3 -:10B1900006920A0043320793059004920A7E0C003F -:10B1A000109B782A07D8622A09D8002A00D1C1E06A -:10B1B000582A00D18CE026004236327022E010007E -:10B1C00063381528F7D802F023F816001F00F6FFA1 -:10B1D000F6FFF6FFF6FF1F00F6FFF6FFF6FFF6FF9D -:10B1E000A80036009A00F6FFF6FFB900F6FF360019 -:10B1F000F6FFF6FF9E0026001A684236111D196000 -:10B20000136833700123A7E0086819680A1D050652 -:10B210000BD50D681A60002D03DA2D23049A6D42B8 -:10B220001370614B0A2703931BE00D681A604106F7 -:10B23000F1D52DB2EFE70D681968081D18602E06CC -:10B2400001D50D6803E06D06FBD50D68ADB2564B18 -:10B25000082703936F2A00D00237230000224333CC -:10B260001A706368A360002B03DB042221689143FA -:10B270002160002D02D1049E002B0CD0049E2800DA -:10B280003900FDF761FE039B013E5B5C33702B00D0 -:10B2900005009F42F3D9082F09D12368DB0706D5A3 -:10B2A00063682269934202DC3023013E3370049BC1 -:10B2B0009B1B2361079B210000930598069B09AA0D -:10B2C000FFF7F4FE431C4CD1012040420BB0F0BD0F -:10B2D00045310A70344A03921A68216820CA1A60FC -:10B2E000080616D5CB0702D5202319432160102765 -:10B2F000002DB2D1202322689A432260ADE720229C -:10B3000009680A4322602200782145321170274AD9 -:10B31000E1E74806E6D5ADB2E4E71A680D68101D0E -:10B320004969186013682E0601D5196002E06D06A0 -:10B33000FBD519800023049E2361BBE71A68111D09 -:10B340001960166800213000626801F015FA0028C3 -:10B3500001D0801B6060636823610023049A13702E -:10B36000A8E72369320006990598079DA847431C62 -:10B37000AAD023689B0715D4099BE0689842A5DAF8 -:10B380001800A3E72200012306990598079E1932A9 -:10B39000B047431C98D00135E368099A9B1AAB4229 -:10B3A000F0DCE9E70025F7E717F3001028F30010B9 -:10B3B000002370B5064D040008002B6002F04EFD1E -:10B3C000431C03D12B68002B00D0236070BDC04606 -:10B3D000746001080023C25C0133002AFBD1581EAF -:10B3E00070470000F8B505000E001400002804D0D6 -:10B3F0008369002B01D101F09DF8224B9C422ED194 -:10B400006C68A369A360A3891B0732D52369002B4D -:10B410002FD023682269F7B2981A6369F6B2834283 -:10B4200005DC2100280000F0E3FF002827D1A368F5 -:10B430000130013BA36023685A1C22601F706369BE -:10B44000834204D0A389DB0707D50A2E05D121004A -:10B45000280000F0CDFF002811D13000F8BD0A4BC4 -:10B460009C4201D1AC68CCE7084B9C42C9D1EC6846 -:10B47000C7E72100280000F00BF80028C9D00126FA -:10B480007642EAE7F0F4001010F50010D0F4001056 -:10B49000374B70B51D6806000C00002D05D0AB6958 -:10B4A000002B02D1280001F045F8324B9C420FD10D -:10B4B0006C680C23E25E93B211072DD4D90611D427 -:10B4C00009230120336037331343A381404270BD09 -:10B4D000294B9C4201D1AC68EBE7284B9C42E8D158 -:10B4E000EC68E6E75B0713D5616B002908D0230001 -:10B4F0004433994202D03000FFF7A8F80023636379 -:10B500002422A3899343A3810023636023692360DA -:10B510000823A2891343A3812369002B0BD1A02107 -:10B520008022A389890092000B40934203D021001E -:10B53000300001F0CBF80C22A35E01201A0099B272 -:10B54000024003420FD00022A26062695242A2610F -:10B55000002022698242BAD10A06B8D5402213439C -:10B56000A3810138B3E7880700D46269A260EFE7DE -:10B57000EC010008F0F4001010F50010D0F40010F9 -:10B58000062010B501F0DAFC012002F075FCF0B5E0 -:10B5900006000B69326987B0002003919A4265DB8F -:10B5A000013B9C0000930B00143305931B1904937B -:10B5B0003300143302931C19049B27681B6838005E -:10B5C0005D1C29000193FDF739FC0190AF4224D3A3 -:10B5D0000025AC460298059F08CF019A99B25143C5 -:10B5E0001B0C534349190A0C9B18026889B292B28A -:10B5F0006244521A01681D0C090C9BB2CB1A11143B -:10B600005B18191492B21B041A43049B8C4604C0A5 -:10B61000BB42E1D22368002B30D03000039901F007 -:10B620004BFB002821DB30000024019B03990133F0 -:10B63000019314301431036820C99AB21419AAB2C4 -:10B64000A21A1B0C2D0C14145B1B1B191C1492B298 -:10B650001B04134308C0049B8B42ECD2009B029A4C -:10B660009B00D3181A68002A15D0019807B0F0BDC6 -:10B670002368002B06D1009B013B0093029B043CF6 -:10B68000A342F5D3009B3361C7E71A68002A06D1AD -:10B69000009A013A0092029A043B9A42F5D3009B29 -:10B6A0003361E2E7F0B59DB002920393029B039CE5 -:10B6B00008930994446A0700259D002C0ED11020A0 -:10B6C000FEF76EFF021E786204D1EA21C74BC8481C -:10B6D000FEF7C4FE446084600460C4607B6A19683D -:10B6E00000290AD05A68012393404A608B603800D1 -:10B6F00001F0A2F800227B6A1A60039B002B20DA7B -:10B7000001232B60039B5B005B080993099DB94BE8 -:10B71000B84A2B40934217D1B74B249A28031360A1 -:10B72000029B000B184301D100F0BFFDB348269BDC -:10B730000690002B02D0B24B269A136006981DB0DB -:10B74000F0BD00232B60E1E7089B099C1293139442 -:10B750001298139900220023FEF71CFD041E09D045 -:10B760000123249A1360A74B0693269B002BE5D058 -:10B77000A54BE1E71AAB01931BAB00933800129A7B -:10B78000139B01F04DFB6E000590760D00D17CE01F -:10B7900012981399139B9D4A1B031B0B1A4311000C -:10B7A0009B4B1894F61800229A4BFEF7EBF89A4A36 -:10B7B0009A4B02F073F89A4A9A4B01F033FD040059 -:10B7C00030000D00FEF7A6FC974A984B02F066F891 -:10B7D00002000B002000290001F024FD04000D00F0 -:10B7E000FEF762FC00220290002320002900FEF7F1 -:10B7F000D7FC00280BD00298FEF78CFC2B0022000F -:10B80000FEF7C8FC43425841029B1B1A02930123D6 -:10B810001693029B162B0FD812981399DA00844BBB -:10B820009B181A685B68FEF7BBFC002849D0029B96 -:10B83000013B0293002316931A9B9E1B00230A933D -:10B840003300013B0D9304D501239B1B0A93002376 -:10B850000D93029B002B36DB029A0D9B94466344AA -:10B860000D93002315920E93229B0124092B64D87B -:10B87000052B02DD0024043B2293229B981E032803 -:10B8800064D801F0BBFC293836581A9B1B9A9E18C5 -:10B89000684BF218202A0FDD40239B1A9D40664B0F -:10B8A0000298F318D840284302F082FA0123634C2F -:10B8B000013E0919189376E7202302989B1A9840B5 -:10B8C000F2E71690B8E70A9B029A9B1A0A93534232 -:10B8D0000E9300231593C7E700230F93239B0C932C -:10B8E0000793002B13DC01231A000C930793239278 -:10B8F0000DE00123F1E70023239A0F939446029B66 -:10B9000063440C9301330793002B00DC01230022D6 -:10B91000786A426004321500143541689D4219D995 -:10B92000380000F045FF0690002817D1D52102000D -:10B93000434B4900CBE60123DEE700230F9422931B -:10B94000013B0C93079300221333D0E701230F939D -:10B95000023BF6E7013141605200DCE77B6A069A60 -:10B960001A60079B0E2B00D9EBE0002C00D1E8E019 -:10B97000029B002B68DD1A000F212D4B0A40D200DC -:10B980009B181D685E68029B1C1102231093029B8A -:10B99000DB050BD52B4B0C401A6A5B6A1298139986 -:10B9A000FDF7FAFC0323089009911093254B14939B -:10B9B000002C08D1089809992A003300FDF7ECFC07 -:10B9C000089009915CE001231C420BD0109B2800D9 -:10B9D00001331093149B31001A685B6801F05EFF1D -:10B9E00005000E00149B64100833E0E747F40010D4 -:10B9F0005EF400100000F07F0F27000043F40010F9 -:10BA000046F4001015F3001016F300100000F03F8C -:10BA100001FCFFFF0000F83F61436F63A787D23F3F -:10BA2000B3C8608B288AC63FFB799F501344D33F2D -:10BA3000C8F500103204000012040000000010FEDF -:10BA4000BCF40010A0F5001002231093029B002B01 -:10BA500016D0129813995C420F23B64A2340DB009C -:10BA6000D3181A685B6801F019FF012600230890BB -:10BA70000991B14D2411002C00D094E0002B9FD1EE -:10BA8000169B002B00D19BE0089C099D0022200002 -:10BA90002900AA4BFEF784FB002800D190E0079B09 -:10BAA000002B00D18CE00C9B002B46DD029B00227A -:10BAB000200029005E1EA24B01F0F0FE109B0890B2 -:10BAC0000991013310930C9B1098089C099D1493C5 -:10BAD000FEF720FB22002B0001F0E0FE0022994B34 -:10BAE00001F0A0FB10901191109A119B08920993FC -:10BAF000954A119B9446634417930993149B002B1A -:10BB000061D1002220002900904BFDF73BFF089AED -:10BB1000179B04000D00FEF757FB002800D0AFE292 -:10BB20008B481199844661440B0020002900089A33 -:10BB3000FEF736FB002800D09FE2129B139C08936F -:10BB400009941B9B002B00DA72E1029A0E2A00DD99 -:10BB50006EE1784BD2009B185C681B680A930B94CB -:10BB6000239B002B00DBF7E0079B002B00DDF3E0BD -:10BB700000D082E20A980B990022744B01F08EFEED -:10BB8000089A099BFEF72AFB079E3500002800D083 -:10BB900059E2069B069A0133089331231370029BE6 -:10BBA0000133029354E2344207D0109B01331093C7 -:10BBB0002A686B6801F072FE3300641008355AE79A -:10BBC000029E079B80E7149B0F995A1E594BD20087 -:10BBD0009B181A685B68002951D000205D49FDF769 -:10BBE000DBFB089A099BFDF7CDFE069A069B94465F -:10BBF0001793149B1090119163441993290020000E -:10BC0000FEF752FA1490FEF785FA02000B002000AE -:10BC10002900FDF7B7FE179B179A01330893149B71 -:10BC2000040030331370109A119B0D00FEF7B8FA20 -:10BC3000002875D122002B0000204049FDF7A2FE0C -:10BC4000109A119BFEF7ACFA002800D0D2E0199BA5 -:10BC5000089A934200D170E7109811990022384B4E -:10BC600001F01CFE364B109011910022200029009B -:10BC700001F014FE089B04000D001793BEE708981E -:10BC8000099901F00BFE069A069B94460893149BB3 -:10BC9000109011916344199329002000FEF704FAD3 -:10BCA0001790FEF737FA02000B0020002900FDF77D -:10BCB00069FE179B089A303313701300199A0133E9 -:10BCC00004000D00089393422CD110981199069A04 -:10BCD000149B94466344002208931E4B01F0A2FA81 -:10BCE00002000B0020002900FEF76EFA002800D0A9 -:10BCF00080E0109A119B00201649FDF743FE0200D8 -:10BD00000B0020002900FEF74BFA002800D114E7B1 -:10BD1000089B1A00013A08921278302AF8D008934A -:10BD2000029655E00022064B01F0B8FD04000D001C -:10BD3000B2E7C046C8F50010A0F500100000F03FC3 -:10BD40000000244000001C400000C0FC0000144023 -:10BD50000000C07C0000E03F079B069E013B9B1952 -:10BD60000C93089C099D0A9A0B9B20002900FDF763 -:10BD700013FBFEF799F90790FEF7CCF90A9A0B9B93 -:10BD800001F08CFD02000B0020002900FDF7FAFDF8 -:10BD90003300079A013630321A700C9A08969A428C -:10BDA00039D102000B0001F03DFA0A9A0B9B040006 -:10BDB0000D00FEF709FA00281BD10A9A0B9B200000 -:10BDC0002900FEF7E7F9002802D0079BDB0710D413 -:10BDD0003800059900F030FD0023089A029813708E -:10BDE000249B01301860269B002B00D1A6E41A602A -:10BDF000A4E4029E089B0893013B1A78392A06D1D5 -:10BE0000069A9A42F7D13022069901360A701A78BA -:10BE100001321A7084E70022AA4B01F03FFD002294 -:10BE2000002304000D00FEF7B5F900289BD0CFE7F2 -:10BE30000F9D0E9E0A9C002D12D0229A012A66DCCC -:10BE4000189A002A5DD0A04A9B180A9A0121D2189C -:10BE50000A920D9A3800D3180D9300F09DFD05004D -:10BE6000002C0EDD0D9B002B0BDD0D9A2300944260 -:10BE700000DD13000A9AE41AD21A0A920D9AD31A14 -:10BE80000D930E9B002B1FD00F9B002B54D0002E28 -:10BE900011DD29003200380000F044FE059A01004F -:10BEA0000500380000F08EFD05991490380000F070 -:10BEB000C3FC149B05930E9B9A1BB34204D038001D -:10BEC000059900F02FFE05900121380000F064FD77 -:10BED000159B0600002B31DD1A000100380000F030 -:10BEE00021FE229B0600012B2DDD00230E933369DA -:10BEF00003339B00F318586800F006FD2023181A3E -:10BF000039E036231A9A0E9E0A9C9B1A9DE7079BDE -:10BF10005E1E0E9BB34207DB9E1B079B0A9C002BF9 -:10BF200093DAE41A002390E70E9B159AF31AD318BC -:10BF30000E9615930026F0E70E9AC0E700230E93A5 -:10BF4000229B012B13DC00230E93089B002B0ED1A8 -:10BF5000099B1B030BD15D4B099A134207D00A9B27 -:10BF600001330A930D9B01330D9301230E93159B0F -:10BF70000120002BBBD10D9B1F221818030013407A -:10BF8000104246D00132D21A042A3FDD1C22D31AB5 -:10BF90000A9AE418D2180A920D9AD3180D930A9BA4 -:10BFA000002B05DD1A003800059900F017FE0590FA -:10BFB0000D9B002B05DD31001A00380000F00EFE4D -:10BFC0000600169B002B26D03100059800F074FE69 -:10BFD000002820DA029B0A22013B0293380000234A -:10BFE000059900F04DFC0F9B0590002B00D166E1F8 -:10BFF000002329000A22380000F042FC0C9B0500B7 -:10C00000002B47DC229B022B0DDC43E0042AC6D028 -:10C0100013001C33BCE7079B002B35DC229B022B53 -:10C0200032DD079B0C930C9B002B0CD131000522B9 -:10C03000380000F025FC06000100059800F03CFEE9 -:10C04000002800DDA5E5239BDB430293069B0893B4 -:10C0500000243100380000F0EFFB002D00D1B7E6DE -:10C06000002C05D0AC4203D02100380000F0E4FBE6 -:10C070002900380000F0E0FBAAE600263500E2E7E0 -:10C080000296149E350084E50F9B002B00D1CEE074 -:10C09000079B0C93002C05DD29002200380000F0DE -:10C0A0009DFD05000E9B2800002B22D038006968FA -:10C0B00000F07EFB041E0FD10200054B0549FFF77F -:10C0C00006FBC04600002440330400000000F07F5F -:10C0D000BCF40010EA02000029002B690C319A1C04 -:10C0E00092000C30FEF774FA01222100380000F0B3 -:10C0F00075FD069B0C9A0A93013B9B1801222C00AC -:10C1000005001493089B13400F9331000598FFF727 -:10C110003EFA0300210030330D900598079300F09C -:10C12000CBFD2A000E903100380000F0E1FDC3681D -:10C130000890109301230C93109B002B04D1010055 -:10C14000059800F0B9FD0C903800089900F074FBD8 -:10C150000A9B0C9A01330893229B13430F9A1343B3 -:10C160000CD1079B392B26D00E9B002B02DD0D9B9B -:10C17000313307930A9B079A1A706AE70E9B002BCC -:10C1800004DB229A13430F9A13431FD10C9B002BFD -:10C19000F0DD05990122380000F020FD3100059006 -:10C1A00000F08AFD002803DCE4D1079BDB07E1D522 -:10C1B000079B392BDBD139230A9A1370089B08930C -:10C1C000013B1A78392A68D00132D5E70C9B002B45 -:10C1D00007DD079B392BEED0079B0A9A01331370BA -:10C1E00037E70A9B079A1A70149B0A9A93423ED02B -:10C1F00000230A220599380000F042FB0023059035 -:10C200000A2221003800AC4206D100F039FB0400BC -:10C210000500089B0A9378E700F032FB2900040030 -:10C2200000230A22380000F02BFB0500F1E7079BF2 -:10C230000C93002431000598FFF7A9F9069B3030D4 -:10C2400018550C9B01340790A34207DD00230A22F6 -:10C250003800059900F014FB0590EBE70C9B0120DA -:10C26000002B00DD18000024069B1B18089305997D -:10C270000122380000F0B2FC3100059000F01CFDF6 -:10C2800000289BDC02D1079BDB0797D4089B08930F -:10C29000013B1A78302AFAD0DBE6069A9A428ED110 -:10C2A000029B01330293312399E7094B269A0693A7 -:10C2B000084B002A01D0FFF73FFAFFF73FFA0C9B2B -:10C2C000002BB6DC229B022B00DDACE6B1E7C046BA -:10C2D0003AF4001042F40010F7B58B8905000C0009 -:10C2E0001A075FD44A68002A04DC0A6C002A01DCC1 -:10C2F0000020FEBDE76A002FFAD0002280212E68C0 -:10C300002A601A0049010A400B4234D0606DA389AB -:10C310005B0706D56368C01A636B002B01D0236CE2 -:10C32000C01A0200216A00232800E76AB847A189E1 -:10C33000431C06D12B681D2B31D82C4ADA40D30779 -:10C340002DD50023636023692360CB0405D5431CEE -:10C3500002D12B68002B00D16065616B2E60002933 -:10C36000C6D023004433994202D02800FEF76EF96C -:10C3700000206063BDE701232800216AB847431C01 -:10C38000C5D12B68002BC2D01D2B01D0162B01D19B -:10C390002E60ADE74023A2891343A381A9E7402380 -:10C3A0000B43FAE70F69002FA2D00A680F60D21B77 -:10C3B000019200229B0700D14A69A260019B002BD9 -:10C3C00000DC95E73A002800019B216AA66AB04785 -:10C3D000002806DC40230120A28940421343A381A8 -:10C3E00087E7019B3F181B1A0193E7E701004020F4 -:10C3F0000B6970B505000C00002B02D10025280048 -:10C4000070BD002804D08369002B01D100F092F8A0 -:10C41000144B9C421BD16C680C22A35E002BEDD008 -:10C42000626ED20704D49B0502D4A06DFEF7B6F865 -:10C4300028002100FFF750FF636E0500DB07DED404 -:10C44000A3899B05DBD4A06DFEF7A9F8D7E7064BBF -:10C450009C4201D1AC68DFE7044B9C42DCD1EC6824 -:10C46000DAE7C046F0F4001010F50010D0F4001028 -:10C47000002310B50400036043608360818143663C -:10C480001900C28103614361836108225C30FEF7B9 -:10C49000A8F8054B24626362044BA362044BE36279 -:10C4A000044B236310BDC0467DCF0010A5CF001004 -:10C4B000DDCF001009D0001010B5024900F0BAF825 -:10C4C00010BDC0467DD0001070B568254A1E55438A -:10C4D0000E0029007431FEF725F9041E08D0002152 -:10C4E0002A00016046600C30A0606832FEF779F8DF -:10C4F000200070BD10B50248FEF750F810BDC046D0 -:10C500006960010810B50248FEF749F810BDC04641 -:10C510006960010810B50248FEF740F810BDC0463A -:10C520006A60010810B50248FEF739F810BDC04630 -:10C530006A60010813B50400FFF7ECFFA369002B44 -:10C5400002D0FFF7EFFF13BDA364E3642365134B31 -:10C55000134A1B68A2620193A34201D10123A36184 -:10C56000200000F01FF86060200000F01BF8A060C1 -:10C57000200000F017F800220421E0606068FFF757 -:10C5800077FF01220921A068FFF772FF0222122122 -:10C59000E068FFF76DFF0123A361D2E7F0F200101E -:10C5A000B9C40010F8B50700FFF7A4FF1F4B1868C7 -:10C5B0008369002B01D1FFF7BDFF3E004836B46808 -:10C5C0007368013B04D53368002B22D03668F6E748 -:10C5D0000C22A55E002D1AD12000154B5830E360C7 -:10C5E0006566FDF7D9FFFFF78DFF200008222900BF -:10C5F0002560A560656025616561A5615C30FDF71A -:10C60000F0FF6563A563A564E5642000F8BD6834A8 -:10C61000D7E704213800FFF757FF041E3060D5D15B -:10C62000FFF770FF0C233B60EFE7C046F0F200100D -:10C630000100FFFFF7B50400060000270191483410 -:10C640006368A5680093009B013B009304D52468B0 -:10C65000002CF5D13800FEBDAB89012B08D90E2284 -:10C66000AB5E013304D029003000019B984707439B -:10C670006835E8E7004870474003000870B50E00D1 -:10C680001D000E23C95E140096B0002908DA0C22A2 -:10C69000B35E00222A601B0611D48023DB000FE06A -:10C6A0006A4600F05FFD0028F1DBF02301991B02D0 -:10C6B0001940054BC9184B4259412960EDE7402309 -:10C6C0000020236016B070BD00E0FFFFF7B5022622 -:10C6D0008B8905000C00334206D0230047332360CA -:10C6E000236101236361F7BD6A4601ABFFF7C6FF13 -:10C6F000009907002800FEF715F8002808D10C2241 -:10C70000A35E9A05EFD4032293431E43A681E4E778 -:10C710000F4BAB628023A28920601343A381009B4F -:10C7200020616361019B002B0DD028000E23E15E88 -:10C7300000F02AFD002806D00322A38993431A00A3 -:10C7400001231343A381A0890743A781CBE7C046F8 -:10C75000B9C4001082B0002900D101A9101E06D072 -:10C76000002B06D013780B601078431E984102B05E -:10C77000704702204042FAE7C9B28218904201D1C4 -:10C780000020704703788B42FBD00130F6E70000B1 -:10C7900010B50248FDF702FF10BDC04668600108F1 -:10C7A00010B50248FDF7FBFE10BDC04668600108E9 -:10C7B00070B5456A06000C00002D0ED11020FDF763 -:10C7C000EFFE021E706204D16621194B1948FDF775 -:10C7D00045FE456085600560C560756AEB68002BA5 -:10C7E00013D0736AA200DB689B181868002818D160 -:10C7F00001210D00A5406A1D30009200FDF7F9FEF1 -:10C8000000280CD0446085600DE021220421300016 -:10C81000FDF7EFFE736AE860DB68002BE1D10020D2 -:10C8200070BD02681A6000230361C360F8E7C04668 -:10C8300047F400103AF5001070B5466A05000C0088 -:10C84000002E0ED11020FDF7ABFE021E686204D14F -:10C850008A21094B0948FDF701FE466086600660A3 -:10C86000C660002C07D06B6A6268DB6892009B1878 -:10C870001A6822601C6070BD47F400103AF5001081 -:10C88000F7B50E0001900C001D0000200F69143652 -:10C890003368013099B251431B0C534349190D0CB5 -:10C8A0005B191D0C89B21B045B1808C68742EFDCBC -:10C8B000002D22D0A368BB4219DC63680198591C83 -:10C8C000FFF776FF061E05D10200B5210C4B0D487F -:10C8D000FDF7C4FD210023690C319A1C92000C3035 -:10C8E000FDF776FE21000198FFF7A6FF34003B1DFF -:10C8F0009B00E3185D607B1C23612000FEBDC046E9 -:10C90000BCF400103AF500100300020C0020824233 -:10C9100001D11B0410301A0E01D108301B021A0F6E -:10C9200001D104301B019A0F01D102309B00002B72 -:10C9300003DB01305B0000D4202070470368020055 -:10C940000721180008400B420DD0063900200B4289 -:10C9500005D10230034203D0CB400800136070477A -:10C960009B081360FBE799B2002901D110201B0C32 -:10C97000D9B2002901D108301B0A190701D10430AE -:10C980001B09990701D102309B08D907E9D401306E -:10C990005B08E6D12020E2E710B50C000121FFF78B -:10C9A00007FF002806D1A0210200044B04484900DB -:10C9B000FDF754FD01234461036110BDBCF4001078 -:10C9C0003AF50010F0B50B69140012690D0089B03A -:10C9D000934201DA25000C002F6926696968BB19AA -:10C9E0000293AB68BA19934200DA0131FFF7E0FE17 -:10C9F0000190002806D15E210200484B4848FF31D3 -:10CA0000FDF72CFD019B002214339C46BB199B00B3 -:10CA100063440393634603998B422CD32B0022007B -:10CA20001433BF0014320693B600DB190493931934 -:10CA30000793042305932B00049915330092994220 -:10CA400005D34B1B153B9B0801339B000593079BAC -:10CA5000009A9A4211D3029B002B06DD039B043BF4 -:10CA600003931B680093002B53D0019B029A18007C -:10CA70001A6109B0F0BD04C3CDE7009B1B6898B2F2 -:10CA800000281BD067460024069E02CE3A688BB26F -:10CA9000434392B29B181B190C0C44433A68110C87 -:10CAA00061181C0C09190C0C9BB209040B4308C734 -:10CAB000049BB342E9D86346059A9C50009B1B68CF -:10CAC0001E0C20D063462C00604600271B681434DF -:10CAD00022689BB291B271430268120C8918CF1977 -:10CAE00039040B43036002CC4368090C71439BB2C9 -:10CAF0003F0CCB18049ADB191F0C0430A242E7D874 -:10CB0000624605995350009B0433009304239C44D0 -:10CB10009DE7029B013B02939DE7C046BCF40010D9 -:10CB20003AF50010F7B50323150007000E001A4070 -:10CB30001D4208D02549013A920052580023310085 -:10CB4000FFF79EFE0600AD103DD07C6A002C0FD191 -:10CB50001020FDF725FD021E786205D1D7211C4B60 -:10CB60001C484900FDF77AFC446084600460C4609E -:10CB70007B6A9C680193002C08D138001649FFF7A6 -:10CB80000BFF019B040098600023036001231D42FA -:10CB90000AD0310022003800FFF714FF3100019065 -:10CBA0003800FFF749FE019E6D100CD02068002868 -:10CBB00007D1220021003800FFF704FF0023206086 -:10CBC00003600400E2E73000FEBDC04690F60010AE -:10CBD00047F400103AF5001071020000F0B50C00A7 -:10CBE00017002369551187B0EB18029301330193A5 -:10CBF0004968A3680490019A934210DB0498FFF7F8 -:10CC0000D7FD0023020006001900143298420CD10F -:10CC1000DA210200264B2748FF31FDF71FFC0131C6 -:10CC20005B00E8E7980011500133AB42FADBEB43BD -:10CC3000DB171D401F2123003800AD005519226964 -:10CC400014339200084084469A180F422AD00131CA -:10CC5000091A05910021039567461868B8400143F9 -:10CC6000039802C002CB03900598C1409A42F3D8C2 -:10CC7000200015300423824204D3131B153B9B086C -:10CC800001339B00E950002902D0029B023301933B -:10CC9000019B0498013B21003361FFF7CDFD30007B -:10CCA00007B0F0BD02CB02C59A42FBD8F0E7C04600 -:10CCB000BCF400103AF5001002690B6930B50400AD -:10CCC000D01A9A420DD19B0014341431E218C918BD -:10CCD000043A043915680B689D4203D001209D4237 -:10CCE00003D330BD9442F3D3FBE74042F9E70000A1 -:10CCF000F0B50E0007001100300087B01400FFF7F8 -:10CD0000DBFF051E10D101003800FFF751FD021EA8 -:10CD100004D1404B40494148FDF7A0FB0123456148 -:10CD20000361100007B0F0BD01230193002804DB6C -:10CD3000230034001E000023019338006168FFF7D0 -:10CD400037FD021E03D19021324B8900E3E7019B9E -:10CD50000027C360206914340194019B84001B19CF -:10CD60003400029333691434990063180393130059 -:10CD700014339C460593019B0493049B02CC20CB67 -:10CD80000493ABB2DF198BB2FB1A090C2D0C6D1A90 -:10CD900019146D1861462F149BB22D042B4308C142 -:10CDA000039B8C46A342E8D83100039C1531042331 -:10CDB0008C4204D3A31B153B9B0801339B000199B4 -:10CDC000CC1805992600CB189C4602998E4210D3A8 -:10CDD000029EE11E00258E4204D3310003310C1B5C -:10CDE000A408A5005B19043B196800290FD0106145 -:10CDF00097E702CE8DB2ED190F0C291479180F1494 -:10CE0000ADB209040D43614620C18C46DDE701380F -:10CE1000E9E7C046BCF40010320200003AF5001009 -:10CE2000F7B5012114001E00089FFFF7C1FC051E85 -:10CE300005D10200264B27492748FDF70FFB330396 -:10CE400076001B0B760D24D10193002C27D0684669 -:10CE50000094FFF773FD009C00281ED0019B202149 -:10CE60001A00091A8A40C34022436A610193019C57 -:10CE7000AC61631E9C4101342C61002E18D0174B0D -:10CE8000F61835233618181A099B3E6018602800DA -:10CE9000FEBD802252031343D6E76C61E7E701A889 -:10CEA000FFF74CFD0124019B2C616B612030E4E70E -:10CEB0000B4BC0180B4B3860E3189B00EB185869FC -:10CEC000FFF722FD6401099B241A1C60DFE7C046BE -:10CED000BCF400100A0300003AF50010CDFBFFFF80 -:10CEE000CEFBFFFFFFFFFF3F70B504000D001F29C1 -:10CEF00004D9162303600120404270BD436C002B0F -:10CF000004D08A009B181A68002A08D1200000F07B -:10CF100031F82A000100200000F01AF8EDE70020A7 -:10CF2000012AEAD0511C03D1162301302360E4E723 -:10CF3000002428001C6090472000DEE710B5034B5A -:10CF400001001868FFF7D0FF10BDC046EC010008D3 -:10CF5000002370B5064D0400080011002B6000F09E -:10CF60006DFF431C03D12B68002B00D0236070BDE4 -:10CF70007460010810B500F051FF10BD70B50C00D1 -:10CF80000E25495F00F026F9002803DB636D1B18AE -:10CF9000636570BDA389024A1340A381F9E7C046C7 -:10CFA000FFEFFFFFF8B51F008B8905000C0016008E -:10CFB000DB0505D50E23C95E0022022300F0F6F83A -:10CFC000A389054A28001340A38132000E23E15EA5 -:10CFD0003B0000F02DF8F8BDFFEFFFFF70B50C002F -:10CFE0000E25495F00F0E2F8A389421C03D1054AEF -:10CFF0001340A38170BD802252011343A381606559 -:10D00000F8E7C046FFEFFFFF10B50E23C95E00F042 -:10D0100023F810BD0300081E05D0FF2A04D98A2278 -:10D0200001201A604042704701200A70FBE70000AF -:10D0300070B50400080011001A000023054D2B6094 -:10D04000F6F7B6FA431C03D12B68002B00D02360FF -:10D0500070BDC04674600108002370B5064D040021 -:10D0600008002B6000F0CAFE431C03D12B68002B84 -:10D0700000D0236070BDC0467460010870B5050023 -:10D080000C1E02D10026300070BD002804D0836938 -:10D09000002B01D1FFF74EFA2F4B9C4217D16C6841 -:10D0A000636EDB0705D4A3899B0502D4A06DFDF751 -:10D0B00075FA0C22A35E002B13D1626E01331600A9 -:10D0C0001E401A42DED1A06DFDF769FADBE7234B63 -:10D0D0009C4201D1AC68E3E7214B9C42E0D1EC6873 -:10D0E000DEE721002800FFF7F7F8236B0600002B8E -:10D0F00006D02800216A9847002801DA01267642E6 -:10D10000A3891B0603D528002169FDF79FFA616BEF -:10D11000002908D023004433994202D02800FDF7AB -:10D1200095FA00236363A16C002904D02800FDF761 -:10D130008DFA0023A364FFF7DDF90023A381636E5A -:10D14000DB0702D4A06DFDF72AFAA06DFDF725FAE2 -:10D15000FFF7D8F997E7C046F0F4001010F500107B -:10D16000D0F40010002370B5064D04000800110033 -:10D170002B6000F04BFE431C03D12B68002B00D02A -:10D18000236070BD74600108002370B5064D040073 -:10D1900008002B6000F04AFE431C03D12B68002BD3 -:10D1A00000D0236070BDC0467460010870B50400F3 -:10D1B000080011001A000023054D2B6000F046FE08 -:10D1C000431C03D12B68002B00D0236070BDC046E8 -:10D1D0007460010870B50400080011001A000023F3 -:10D1E000054D2B60F6F704FA431C03D12B68002B86 -:10D1F00000D0236070BDC0467460010802B471465F -:10D2000049084900095C49008E4402BC7047C04689 -:10D2100003B47146490840004900095E49008E4444 -:10D2200003BC7047F0B54F464646D6460D00040095 -:10D23000C0B51F0011002803620F400A10437A0096 -:10D24000520DE3003C039146640AFA0F4F0F6E0043 -:10D2500027439246B846760DED0FC900954200D19E -:10D2600099E04C46341BA446002C00DC7CE04A4686 -:10D27000002A00D1B8E0C54A964200D11CE18022C4 -:10D280003C0012041443A0466246382A00DD61E1E6 -:10D290001F2A00DDCCE164462022121B4446944044 -:10D2A0000F00A14664469140E7404C464A1E91411A -:10D2B0003C43424621436446E240801A5C1AA34242 -:10D2C0009B415F42C71B3B0200D4D0E07F027F0A34 -:10D2D000002F00D1FFE03800FCF78AFF0100083979 -:10D2E000202322005B1A8F40DA408C401743B14262 -:10D2F00000DAFFE0891B4B1C1F2B00DDA8E0202279 -:10D300003900D21A200094409140D840621E9441C6 -:10D31000DF40002601430C43630709D00F2323405D -:10D32000042B05D0231DA342A44164423F191C00D5 -:10D330003B0200D49EE0954B01369E4200D1B7E0FF -:10D34000934AE40817407B0771057F0223433F0B94 -:10D350004A0D12053A43ED072A4318001100E0BCBC -:10D36000BA46B146A846F0BD002C4BD04C46A41B93 -:10D37000A446002E00D023E104001C4300D1AFE1FD -:10D380006246541E012A00D115E2804DAC4500D101 -:10D39000C8E1A4461BE14A46B21A9446002A00DCC2 -:10D3A000ACE04A46002A43D0784A964200D1AFE129 -:10D3B00080223C0012041443A0466246382A67DCEF -:10D3C0001F2A00DC5FE14746203AD7406246202A08 -:10D3D00005D064464022121B4446944021434A1E15 -:10D3E00091410C003C4357E03A000A4300D105E16B -:10D3F0002200013A012C00D182E1644CA4455BD0AB -:10D40000944641E7634C771C274200D0C4E00400F7 -:10D410001C43002E00D069E1002C00D1BFE144463E -:10D420000C4300D0D0E14207DB081343C00829E0D9 -:10D430003A000A4300D170E162466446013A012C89 -:10D4400000D1E0E0514CA44500D161E19446B4E73D -:10D450003A001F39CA401100202B03D04022D31AB2 -:10D460009F403C43631E9C41002700260C436307FA -:10D4700000D053E7B446E4087B072343F808434A47 -:10D4800094451DD06246070352053F0B520D60E7DD -:10D4900044460C43621E9441E4189C429B415F4207 -:10D4A0003F183B02E3D5394B01369E4200D0B5E030 -:10D4B0003200002700234CE74207DB081343C00873 -:10D4C0001A00024300D1E1E180273F0307433F03F5 -:10D4D0002E4A3F0B3DE72000FCF78AFE0100183181 -:10D4E0001F2900DCFCE60838844027000024B142F4 -:10D4F00000DBFFE6264A761A17400DE7002A2FD0F8 -:10D500004A46921B9446002E00D1ADE01F4A914539 -:10D5100000D10FE18022120410436246382A00DD58 -:10D520000FE11F2A00DD80E1644620221E00121B4D -:10D530006746040093409440FE405A1E9341F840D1 -:10D5400034431C43804464188C42BF417F424E46A2 -:10D550004744A6E742460A4311004A1E9141ADE600 -:10D560000C4C721C224200D0A1E002001A43002E93 -:10D5700000D0FAE0002A00D145E13A000A4300D089 -:10D5800046E14207DB081343C0087BE7FF070000C2 -:10D59000FFFF7FFFFE07000047465C1AC21BA34245 -:10D5A000BF417F42B94617004A46BF1A3A0200D52A -:10D5B0008DE023003B4300D08AE60020002561E790 -:10D5C000B44CA14500D1ADE080242404204364463E -:10D5D000382C3DDC62461F2C00DDB7E020251E0004 -:10D5E0002D1B0400AB40AC40D640D04042465D1EEF -:10D5F000AB413443121A904623432CE04207DB0828 -:10D600001343C0083BE75C189C429B4140445B428B -:10D61000C71801263B0200D429E702269E4A630868 -:10D620001740012214401C43FB071C437F0873E68C -:10D630004446203AD4406246202A05D0674640221C -:10D64000D21B4746974039434A1E9141214335E654 -:10D650000343581E8341CC1AA142BF4143467F4237 -:10D6600055464E46DF1B2EE602001A4300D1BDE0B0 -:10D6700062466446013A012C00D1E5E0854CA445A0 -:10D6800058D0944649E764462022121B44469440F1 -:10D690000F00A14664469140E7404C464A1E914126 -:10D6A0003C4342460C436146CA408018F4E6794C3C -:10D6B000A24200D1FDE6591899429B4140445F4285 -:10D6C000C719FC07490816000C437F08CFE6CC1A9F -:10D6D000A142BF4143467F42181A5546C71BF7E592 -:10D6E000C9087B0755460B43F808C8E6002C00D054 -:10D6F00081E043460B4315D1802000250003E3E67B -:10D700005C1AA3429B41C71B5B420126FF1ADAE564 -:10D710004207DB081343C008D2E64207DB08134385 -:10D72000C008ACE643464246C9085B0755460B4372 -:10D73000D008C5E6434642465B07C9080B43D008FC -:10D74000BEE603431C00631E9C41FCE60200203C35 -:10D75000E24014006246202A03D04025AD1AA840BA -:10D760000343581E8341234375E7002AE2D03A0061 -:10D770000A43CDD04207DB0813438022C0081203BE -:10D78000104206D0FC08144203D12000CB087A07CF -:10D7900013435A0FDB005207DB08134390E643465E -:10D7A0000B4300D109E743464246C9085B0755468B -:10D7B0000B43D00866E6CC1AA14289413F1A494280 -:10D7C000554601267F1A7EE542465C1A871AA34217 -:10D7D00092415242BF1A3A023DD5CC1AA142894128 -:10D7E000434649421F1A55467F1A95E57B07C908EB -:10D7F0000B43F80843E64446DB080C4330D14207AC -:10D800001343C0085CE67B07C9080B43F80839E6F8 -:10D810005C189C429B4140445B42C7183B0200D4C9 -:10D8200025E61D4B01261F4021E60400203AD44086 -:10D830006246202A04D040226646921B9040034351 -:10D840005A1E93411C437EE65C188C428941404439 -:10D8500049424718DDE623003B4300D1ADE606E62A -:10D86000440723438024C0082403204208D04246B2 -:10D87000D608264204D155463000CB0851070B4349 -:10D880005A0FDB00DB085207134319E60023014A55 -:10D890001F005EE5FF070000FFFF7FFFF0B5574662 -:10D8A0004E464546DE46E0B598460C034B00060062 -:10D8B000924687B0240B5B0DCF0F002B00D15CE1AB -:10D8C000D94A934200D175E1420FE400144380220B -:10D8D00012041443D54AC5009446634400930023C0 -:10D8E00099469B46434642461E03D20F5B00504674 -:10D8F0009046360B5B0D00D120E1CB4A934200D11C -:10D9000062E1CA49420F8C4600996344F6008C4696 -:10D91000164380229C44120463461643C200002032 -:10D9200000930099434601318C4649467B40019360 -:10D930000F2926D8BE4B890059588F46434601937C -:10D940003400150083465B46022B16D0032B00D112 -:10D9500003E2012B00D0CDE0002200240025019B32 -:10D9600012052243DB071A432800110007B0F0BC60 -:10D97000BB46B246A946A046F0BD00240025AA4AEF -:10D98000EDE7280C2D042D0C2B00110C1204120CA9 -:10D990005343984613002F00434399464F434F4447 -:10D9A000BB4647460B003F0CBA464343DA4402935A -:10D9B000D14504D980277F02B9464B440293534690 -:10D9C0001B0C9B4653461F0443461B041B0C9846E6 -:10D9D0003B0043440493330C3604360C9846330022 -:10D9E00043439946434643432F009A464346774371 -:10D9F0005D43380C4D444519A94503D980235B028A -:10DA00009946CA443F04280C3F0C2D04ED19270CFD -:10DA10002404240C0300200050437A4391463A002A -:10DA200053440593030C9A464A4361434944514485 -:10DA3000AB44894503D980235B0299464A440004DC -:10DA40000B0C000C0904091820009946434670434A -:10DA50005C437E435F43030C9846A41944444A4404 -:10DA60000397A64204D980235B0298464744039754 -:10DA70002304029E9A46059B5E449846AE42AD4101 -:10DA800076188E4289410004000C504440446D4297 -:10DA90004719B846934649428946C344D9449842F7 -:10DAA0008041A845AD4193459241894589416D42E8 -:10DAB00040422843240C524249420A43039B001926 -:10DAC0008018C7184B46DC0D049B75021D436A1E67 -:10DAD00095414B46F60D7F0235435A023C431543B0 -:10DAE000FB0100D41CE101216A080D401543E20747 -:10DAF000154364084F496144002900DCB0E06B071E -:10DB000009D00F222A40042A05D02A1DAA42AD417D -:10DB10006D4264191500E30104D58021464AC9000D -:10DB200014406144454A914200DD26E76207ED0852 -:10DB3000640249051543240B4A0D10E7524632434F -:10DB400000D17FE0002E00D1DCE03000FCF750FB7C -:10DB500002000B3A1D2301009B1A52460839DA4095 -:10DB60008E40164352468A40009B3549181A0300DE -:10DB70008C46634400200093D3E6250005434AD039 -:10DB8000002C00D1B0E02000FCF732FB01000200C5 -:10DB90000B391D2310005B1A310035000838844012 -:10DBA000D94085400C432648831A009300239946A8 -:10DBB0009B4697E60500254326D1082200930223C1 -:10DBC000002491469B468DE65246009B324310D17D -:10DBD000154900268C4663444946009302231943A5 -:10DBE000894602209DE65B460197022B00D0ADE6F8 -:10DBF000C3E60D4A0320944663444A460093032338 -:10DC00001A43914652468CE60C22009303230500EA -:10DC100091469B4666E60423994600230093013310 -:10DC200000249B465EE6C046FF07000001FCFFFFA4 -:10DC30009CF60010FF030000FFFFFFFEFE07000040 -:10DC40000DFCFFFF494601231943894600260120A8 -:10DC500067E6002380240025434A019324037EE6DF -:10DC60000120401A382800DD76E61F285BDD1F22E0 -:10DC700023005242511ACB401900202803D03B4ABE -:10DC80006244944025436A1E95412A000A430721B5 -:10DC90000D000024154011425BD00F2100241140DB -:10DCA000042953D0111D914292415242A4180A00F6 -:10DCB00023024BD501220024002550E680231B03BC -:10DCC0001C4209D01E4207D133431C0343461500B2 -:10DCD000240B254A019342E68022120314432403B5 -:10DCE000214A240B01973AE6FCF782FA0100020070 -:10DCF000153120321C2900DC4BE7340008380025A0 -:10DD0000844050E7FCF774FA03001A001532203003 -:10DD10001C2A00DC1EE75646083B00229E4023E7F3 -:10DD2000009B9C46E6E61249220061442E008D408D -:10DD30008A40C640691E8D4132432A43C44053077E -:10DD4000B6D00F2111400429ACD1B1E765076402B8 -:10DD5000240BD2081543002201E68022120314434B -:10DD60002403014A240BFAE5FF0700003E040000EB -:10DD70001E04000070B505000C481C0316005B0073 -:10DD80000A034900120B490D240B5B0D814208D098 -:10DD9000064A0020934203D120003043431E98419D -:10DDA00070BD01202A43FBD1F2E7C046FF07000007 -:10DDB00010B5041E10D0FCF71BFA0F4B1B1A0A28D3 -:10DDC00011DC0B222100121AD14015300A035B0529 -:10DDD0008440120B5B0D01E0002300221B0513435E -:10DDE0002000190010BD22000B3882405B05120391 -:10DDF0000024120B5B0DF1E71E04000058220120E5 -:10DE0000014B40421A60704774600108582201209B -:10DE1000014B40421A60704774600108582201208B -:10DE2000014B40421A607047746001085822024B4F -:10DE300000201A607047C046746001085822012013 -:10DE4000014B40421A60704774600108582201205B -:10DE5000014B40421A60704774600108044A030095 -:10DE60001068002802D0C318136070470148FAE711 -:10DE70007860010880600108FEE7C046F8B5C0463A -:10DE8000F8BC08BC9E467047F8B5C046F8BC08BC54 -:10DE90009E4670470000000001B40248844601BC61 -:10DEA000604700BF0906000801B40248844601BC6F -:10DEB000604700BFA5040008000000000800000043 -:10DEC0000800000000020000000000000000000048 -:10DED0000000000000000000000000000000000042 -:10DEE000000000000B0000003F00000000000000E8 -:10DEF0003F00000000000000010000000B000000D7 -:10DF00001D000000000000000000000000000000F4 -:10DF10000000000001000000000000000000000000 -:10DF200000000000000000000000000001000000F0 -:10DF30000A0000001D0000000000000000000000BA -:10DF400000000000000000000100000000000000D0 -:10DF500000000000000000000000000000000000C1 -:10DF600001000000060000001D000000000000008D -:10DF700000000000000000000000000001000000A0 -:10DF80000000000000000000000000000000000091 -:10DF90000000000001000000080000001200000066 -:10DFA0000000000000000000000000000000000071 -:10DFB0000100000000000000000000000000000060 -:10DFC000000000000000000001000000060000004A -:10DFD000120000000000000000000000000000002F -:10DFE0000000000001000000000000000000000030 -:10DFF0000000000000000000000000000100000020 -:10E000000000000000000000000000000000000010 -:10E0100000000000000000000100000000000000FF -:10E0200000000000000000000000000000000000F0 -:10E0300001000000000000000000000000000000DF -:10E0400000000000000000000000000001000000CF -:10E0500000000000000000000000000000000000C0 -:10E0600000000000010000000300000000000000AC -:10E0700000000018000000040000000058E100103B -:10E080006000000000000000FFFFFFFF0000000034 -:10E090000000000000000000DC00000000000000A4 -:10E0A000FFFFFFFF00000000000000000000000074 -:10E0B0003400000000000000FFFFFFFF020000002E -:10E0C0000000000002000000EC0000000002000060 -:10E0D0000100000002000000040000000200000037 -:10E0E0003500000000000000FFFFFFFF00000000FF -:10E0F000000000000000000005000000000000001B -:10E10000FFFFFFFF00000000000000000000000013 -:10E110000400000000000000FFFFFFFF00000000FF -:10E1200000000000000000000600000000000000E9 -:10E13000FFFFFFFF000000000000000000000000E3 -:10E140000100000000000000FFFFFFFF00000000D2 -:10E1500000000000000000000400000000000004B7 -:10E16000C8E0001028E1001010E1001098E0001055 -:10E170000000040080E00010B0E000100002000089 -:10E18000F8E00010E0E0001040E1001000000000A6 -:10E190000100000002000000280A0000E00407005F -:10E1A0001405000000000000000000000100000055 -:10E1B000BCE10010020000001400000064E0001048 -:10E1C000F4010000140004010A000905080003001E -:10E1D0006301000024010200000000005B494E467C -:10E1E0005D205374617274696E6720557365722087 -:10E1F0004170706C69636174696F6E206F6E20434B -:10E200004D342E20506C6561736520776169742EE2 -:10E210002E2E0A0D000000005B494E465D201B5B60 -:10E22000324A1B5B3B480A0D000000005B494E462A -:10E230005D204D4355626F6F7420426F6F746C6F39 -:10E240006164657220537461727465640A0D000024 -:10E250005B494E465D2045787465726E616C204D59 -:10E26000656D6F727920696E697469616C697A6530 -:10E2700064207573696E6720534644500A0D000090 -:10E280005B4552525D2045787465726E616C204D1D -:10E29000656D6F727920696E697469616C697A6104 -:10E2A00074696F6E207573696E6720534644502001 -:10E2B0004641494C45443A203078253032780A0DA1 -:10E2C000000000005B494E465D2055736572204199 -:10E2D00070706C69636174696F6E2076616C6964DB -:10E2E00061746564207375636365737366756C6CC4 -:10E2F000790A0D005B494E465D204D4355626F6FB4 -:10E300007420426F6F746C6F6164657220666F7504 -:10E310006E64206E6F20626F6F7461626C6520693D -:10E320006D6167650A0D0000030000000100000038 -:10E330000100000000000000050360000400000070 -:10E340000100000000000000010000000604600061 -:10E3500008000000F0080008A905001028696D6198 -:10E3600067655F6E756D29203C203078460000009F -:10E370002E2E2F6D74625F7368617265642F6D63FA -:10E3800075626F6F742F76312E372E302D63797052 -:10E39000726573732F626F6F742F626F6F74757411 -:10E3A000696C2F7372632F626F6F747574696C5F21 -:10E3B0006D6973632E63000028737761705F7479F1 -:10E3C000706529203C2030784600000062616400BE -:10E3D000676F6F6400000000756E73657400000065 -:10E3E00074657374000000007065726D00000000B9 -:10E3F0004255473B2063616E2774206861707065E9 -:10E400006E0000007265766572740000626F6F7452 -:10E410005F737761705F747970655F6D756C746937 -:10E420003A205072696D61727920696D616765008B -:10E430005B494E465D2025733A206D616769633DF7 -:10E4400025732C20737761705F747970653D307827 -:10E4500025782C20636F70795F646F6E653D30782E -:10E4600025782C20696D6167655F6F6B3D3078257D -:10E47000780A0D00626F6F745F737761705F7479F3 -:10E4800070655F6D756C74693A205365636F6E6477 -:10E4900061727920696D6167650000005B494E46D5 -:10E4A0005D205377617020747970653A2025730A76 -:10E4B0000D0000005B494E465D205377617020746B -:10E4C0007970653A206E6F6E650A0D00626F6F7429 -:10E4D0005F77726974655F737761705F696E666F8D -:10E4E0000000000077C295F360D2EF7F3552500FE5 -:10E4F0002CB679800401040304020401040104031E -:10E500000103030401040000000000006FC75E1057 -:10E51000DE8EBD20B149E330BC1D7B41D3DA2551ED -:10E520006293C6610D549871783BF68217FCA892ED -:10E53000A6B54BA2C97215B2C4268DC3ABE1D3D325 -:10E540001AA830E3756F6EF37365636F6E64617262 -:10E55000790000007072696D617279005B455252FA -:10E560005D20496D61676520696E207468652025AE -:10E570007320736C6F74206973206E6F74207661E2 -:10E580006C6964210A0D00007263203D3D2030005B -:10E590002E2E2F6D74625F7368617265642F6D63D8 -:10E5A00075626F6F742F76312E372E302D63797030 -:10E5B000726573732F626F6F742F626F6F747574EF -:10E5C000696C2F7372632F6C6F616465722E6300C8 -:10E5D0005B4552525D2070616E6963210A0D000037 -:10E5E000300000005B57524E5D204661696C6564E7 -:10E5F0002072656164696E6720736563746F7273FE -:10E600003B20424F4F545F4D41585F494D475F5348 -:10E610004543544F52533D2564202D20746F6F2085 -:10E62000736D616C6C3F0A0D000000005B57524E29 -:10E630005D204661696C65642072656164696E671E -:10E6400020696D61676520686561646572733B2050 -:10E65000496D6167653D25750A0D00005B57524E97 -:10E660005D204661696C65642072656164696E67EE -:10E6700020626F6F74207374617475733B20496DF1 -:10E680006167653D25750A0D000000005B4552522B -:10E690005D2062616420696D616765206D616769F5 -:10E6A00063203078256C783B20496D6167653D2596 -:10E6B000750A0D00626F6F745F706572666F726DC0 -:10E6C0005F75706461746500626F6F745F7377610A -:10E6D000705F696D61676500626F6F745F636F6D16 -:10E6E000706C6574655F7061727469616C5F73777B -:10E6F00061700000626F6F745F7072657061726547 -:10E700005F696D6167655F666F725F757064617484 -:10E7100065000000636F6E746578745F626F6F747C -:10E720005F676F002E2E2F6D74625F736861726574 -:10E73000642F6D6375626F6F742F76312E372E30B4 -:10E740002D637970726573732F626F6F742F626FB0 -:10E750006F747574696C2F7372632F737761705F58 -:10E760007374617475732E63000000005B45525230 -:10E770005D20446574656374656420696E636F6EC3 -:10E7800073697374656E7420737461747573210A90 -:10E790000D0000005B57524E5D2043616E6E6F743A -:10E7A00020757067726164653A206E6F7420612015 -:10E7B000636F6D70617469626C6520616D6F756EF9 -:10E7C00074206F6620736563746F72730A0D0000A6 -:10E7D0005B57524E5D2043616E6E6F74207570679B -:10E7E000726164653A206D6F726520736563746F42 -:10E7F0007273207468616E20616C6C6F7765640A57 -:10E800000D0000005B57524E5D2043616E6E6F74C9 -:10E8100020757067726164653A206E6F7420736151 -:10E820006D6520736563746F72206C61796F7574A8 -:10E830000A0D0000737761705F7374617475735FA4 -:10E84000736F757263653A205072696D61727920D9 -:10E85000696D6167650000005B494E465D20426F4F -:10E860006F7420736F757263653A207072696D61A1 -:10E87000727920736C6F740A0D0000005B494E467C -:10E880005D20426F6F7420736F757263653A206EFE -:10E890006F6E650A0D00000066697875705F7265BD -:10E8A000766572743A205365636F6E646172792085 -:10E8B000696D616765000000626F6F745F737761F7 -:10E8C000705F736563746F7273000000626F6F74C2 -:10E8D0005F6D6F76655F736563746F725F757000EF -:10E8E000737761705F72756E0000000066697875FD -:10E8F000705F7265766572740000000073776170F6 -:10E900005F7374617475735F736F75726365000014 -:10E91000737761705F726561645F7374617475733E -:10E920005F627974657300005B494E465D204572F5 -:10E930006173696E6720747261696C65723B2066F1 -:10E94000615F69643D25640A0D0000002E2E2F6D65 -:10E9500074625F7368617265642F6D6375626F6F57 -:10E96000742F76312E372E302D6379707265737364 -:10E970002F626F6F742F626F6F747574696C2F7371 -:10E9800072632F737761705F7374617475735F6DF9 -:10E990006973632E63000000737761705F72656155 -:10E9A000645F737461747573000000007377617045 -:10E9B0005F7374617475735F696E69740000000041 -:10E9C000737761705F65726173655F747261696CA2 -:10E9D00065725F736563746F727300002E2E2F6D06 -:10E9E00074625F7368617265642F6D6375626F6FC7 -:10E9F000742F76312E372E302D63797072657373D4 -:10EA00002F626F6F742F626F6F747574696C2F73E0 -:10EA100072632F737761705F7374617475735F7065 -:10EA20006172742E63000000286F666673202B20CD -:10EA30006C656E29203C3D20424F4F545F53574137 -:10EA4000505F5354415455535F445F53495A455F97 -:10EA500052415700696E69745F6F666673203E3D70 -:10EA600020300000737761705F7374617475735F39 -:10EA70007265747269657665000000007377617075 -:10EA80005F7374617475735F77726974655F7265C3 -:10EA9000636F726400000000737761705F7374616C -:10EAA0007475735F7570646174650000737761706D -:10EAB0005F7374617475735F726561645F726563BF -:10EAC0006F726400AFBEADDE6F6666203C2066618B -:10EAD0002D3E66615F6F6666000000002E2E2F6D72 -:10EAE00074625F7368617265642F6D6375626F6FC6 -:10EAF000742F76312E372E302D63797072657373D3 -:10EB00002F626F6F742F637970726573732F6379DF -:10EB10005F666C6173685F70616C2F63795F666CB0 -:10EB20006173685F6D61702E630000006F66662020 -:10EB30002B206C656E203C2066612D3E66615F6F08 -:10EB4000666600005B4552525D20466C617368202A -:10EB5000617265612072656164206572726F722CEA -:10EB6000207263203D2025640A0D000021286C6579 -:10EB70006E20252043595F464C4153485F53495A04 -:10EB8000454F465F524F57290000000021287772F9 -:10EB90006974655F73746172745F61646472202567 -:10EBA0002043595F464C4153485F53495A454F46AD -:10EBB0005F524F57290000006C656E203C3D206677 -:10EBC000612D3E66615F73697A6500006F6666203D -:10EBD0003C2066612D3E66615F73697A65000000C6 -:10EBE0006F6666202B206C656E203C2066612D3E92 -:10EBF00066615F6F6666202B2066612D3E66615FF1 -:10EC000073697A65000000007263203D3D2043591E -:10EC10005F464C4153485F4452565F53554343450A -:10EC20005353000066616C73650000007365637484 -:10EC30006F72735F6E203C3D202A636E740000008B -:10EC4000666C6173685F617265615F6765745F734D -:10EC50006563746F72730000666C6173685F6172E4 -:10EC600065615F6572617365645F76616C00000069 -:10EC7000666C6173685F617265615F65726173651F -:10EC800000000000666C6173685F617265615F77A8 -:10EC90007269746500000000666C6173685F617280 -:10ECA00065615F7265616400010000000E00000094 -:10ECB0001100000000000000000000000000000043 -:10ECC0000000000001000000000000000000000043 -:10ECD0000000000000000000000000000100000033 -:10ECE0000E00000011000000000000000000000005 -:10ECF0000000000000000000010000000000000013 -:10ED00000000000000000000000000000000000003 -:10ED1000010000000E0000001100000000000000D3 -:10ED200000000000000000000000000001000000E2 -:10ED300000000000000000000000000000000000D3 -:10ED400000000000010000000E00000011000000A3 -:10ED500000000000000000000000000000000000B3 -:10ED600001000000000000000000000000000000A2 -:10ED7000000000000000000001000000060000008C -:10ED80001100000000000000000000000000000072 -:10ED90000000000001000000000000000000000072 -:10EDA0000000000000000000000000000000000063 -:10EDB000010000000100000000000000010001004F -:10EDC00000010001A10FB90BD107DC05E903EE0238 -:10EDD000F5017701FB00BC007E005E003F002F00C4 -:10EDE0002000180010000C000800060004000300BA -:10EDF0000200020001000100000020400000244049 -:10EE000000000040000000000000234000003040EF -:10EE10000000314000009F400000224000001040F0 -:10EE200000009D402020202020101010101D1D806B -:10EE300017007500FF0306020600360410200000CC -:10EE40007FC0000000040000000000000019324BE9 -:10EE5000647D0000000000804000080B10000000EE -:10EE60000000FF012002001F00800004FF081018AE -:10EE7000001000140018001C4044484C50000000D2 -:10EE8000081000000800000004000000041000004A -:10EE90000012000004210000002100000016000004 -:10EEA00040114002C41300138013A01340138813B1 -:10EEB000A81320001C000000040000004000000017 -:10EEC0004400000048000000800000000001000035 -:10EED000100200008802000000040000100400007E -:10EEE00020040000400400004804000080040000EA -:10EEF0008404000090040000C0070000C407000064 -:10EF0000C8070000CC07000000400000041000000B -:10EF1000401000004410000048100000C014000021 -:10EF20000011000018020000980200000014000008 -:10EF300010140000201400004014000048140000C9 -:10EF400080140000841400009014000000010000F0 -:10EF500004010000080100000C0100000080000016 -:10EF6000AA3D0010D43D0010FE3D0010263E0010CA -:10EF7000523E0010A83E00107C3E00100123456761 -:10EF800089ABCDEFFEDCBA9876543210F0E1D2C3F3 -:10EF9000D89E05C107D57C3617DD703039590EF77C -:10EFA000310BC0FF11155868A78FF964A44FFABE42 -:10EFB00067E6096A85AE67BB72F36E3C3AF54FA50A -:10EFC0007F520E518C68059BABD9831F19CDE05B36 -:10EFD0005D9DBBCBD89E05C12A299A6207D57C3698 -:10EFE0005A01599117DD7030D8EC2F1539590EF7A9 -:10EFF00067263367310BC0FF874AB48E11155868F6 -:10F000000D2E0CDBA78FF9641D48B547A44FFABE3F -:10F0100067E6096A08C9BCF385AE67BB3BA7CA842B -:10F0200072F36E3C2BF894FE3AF54FA5F1361D5F56 -:10F030007F520E51D182E6AD8C68059B1F6C3E2B32 -:10F04000ABD9831F6BBD41FB19CDE05B79217E13EA -:10F05000C8373D8CA24D54196699E173D6D4DC892A -:10F06000AEB7FA1D829CFF3214D59D67CF9F2F58F3 -:10F07000692B6D0FA84DD47B736FE3774289C4046D -:10F08000A8859D3FC8361D6AADE61211A192D691A2 -:10F09000942131222CF72BFCA35F559FC2644CC8EE -:10F0A0006BB8932351B1536F19773896BDEA405925 -:10F0B000E23E2896E3FF8EA8251E5EBE9239865357 -:10F0C000FC99012BAAB8852CDC2DB70EA22CC5818A -:10F0D000BE400010FA400010DC4000103841001023 -:10F0E0001A41001058410010784100106745230173 -:10F0F000EFCDAB8998BADCFE10325476C3D2E1F082 -:10F10000C1059ED8367CD5073070DD17F70E59390A -:10F11000FFC00B316858151164F98FA7BEFA4FA4D0 -:10F120006A09E667BB67AE853C6EF372A54FF53A98 -:10F13000510E527F9B05688C1F83D9AB5BE0CD19C4 -:10F14000CBBB9D5DC1059ED8629A292A367CD50726 -:10F150009159015A3070DD17152FECD8F70E593937 -:10F1600067332667FFC00B318EB44A876858151184 -:10F17000DB0C2E0D64F98FA747B5481DBEFA4FA4CE -:10F180006A09E667F3BCC908BB67AE8584CAA73BBA -:10F190003C6EF372FE94F82BA54FF53A5F1D36F1E5 -:10F1A000510E527FADE682D19B05688C2B3E6C1FC1 -:10F1B0001F83D9ABFB41BD6B5BE0CD19137E217979 -:10F1C0008C3D37C819544DA273E1996689DCD4D6B9 -:10F1D0001DFAB7AE32FF9C82679DD514582F9FCF82 -:10F1E0000F6D2B697BD44DA877E36F7304C48942FC -:10F1F0003F9D85A86A1D36C81112E6AD91D692A131 -:10F2000022312194FC2BF72C9F555FA3C84C64C27C -:10F210002393B86B6F53B151963877195940EABDB3 -:10F2200096283EE2A88EFFE3BE5E1E2553863992E5 -:10F230002B0199FC2C85B8AA0EB72DDC81C52CA218 -:10F24000BE600010DE600010D4600010CA600010C4 -:10F25000C0600010B6600010186300102863001032 -:10F260003A6300104C6300102863001028630010FC -:10F27000000000007494001062940010409400108C -:10F280006A940010409400104297001040940010BF -:10F290006A9400106294001062940010429700106B -:10F2A0006A9400102C9400102C9400102C940010E0 -:10F2B000B89700102C2066756E6374696F6E3A20E3 -:10F2C00000617373657274696F6E2022257322204A -:10F2D0006661696C65643A2066696C6520222573F5 -:10F2E000222C206C696E65202564257325730A0025 -:10F2F000F0010008232D302B2000686C4C0065665F -:10F300006745464700494E4600696E66004E414ECD -:10F31000006E616E003000303132333435363738AC -:10F320003941424344454600303132333435363773 -:10F330003839616263646566000020202020202047 -:10F340002020202828282828202020202020202095 -:10F350002020202020202020202088101010101095 -:10F3600010101010101010101010040404040404E5 -:10F3700004040404101010101010104141414141C8 -:10F38000410101010101010101010101010101012D -:10F3900001010101011010101010104242424242BE -:10F3A00042020202020202020202020202020202FD -:10F3B00002020202021010101020000000000000E3 -:10F3C000000000000000000000000000000000003D -:10F3D000000000000000000000000000000000002D -:10F3E000000000000000000000000000000000001D -:10F3F000000000000000000000000000000000000D -:10F4000000000000000000000000000000000000FC -:10F4100000000000000000000000000000000000EC -:10F4200000000000000000000000000000000000DC -:10F4300000000000000000000000496E66696E696F -:10F440007479004E614E005245454E54206D616CFA -:10F450006C6F6320737563636565646564002F6812 -:10F460006F6D652F706172616C6C656C732F746F5A -:10F470006F6C636861696E2F6763632D61726D2DB8 -:10F480006E6F6E652D656162692D31302E332D32C0 -:10F490003032312E30372F7372632F6E65776C697F -:10F4A000622F6E65776C69622F6C6962632F73746B -:10F4B000646C69622F64746F612E630042616C6CCE -:10F4C0006F632073756363656564656400000000A5 -:10F4D000000000000000000000000000000000002C -:10F4E000000000000000000000000000000000001C -:10F4F000000000000000000000000000000000000C -:10F5000000000000000000000000000000000000FB -:10F5100000000000000000000000000000000000EB -:10F5200000000000000000000000000000000000DB -:10F530004300504F534958002E002F686F6D652FC0 -:10F54000706172616C6C656C732F746F6F6C636843 -:10F5500061696E2F6763632D61726D2D6E6F6E65CD -:10F560002D656162692D31302E332D323032312ECE -:10F5700030372F7372632F6E65776C69622F6E65FB -:10F58000776C69622F6C6962632F7374646C696253 -:10F590002F6D707265632E63000000000000000094 -:10F5A0000080E03779C34143176E05B5B5B893467F -:10F5B000F5F93FE9034F384D321D30F94877825A4B -:10F5C0003CBF737FDD4F1575000000000000F03F69 -:10F5D000000000000000244000000000000059402E -:10F5E0000000000000408F40000000000088C34081 -:10F5F00000000000006AF8400000000080842E41F6 -:10F6000000000000D01263410000000084D7974141 -:10F610000000000065CDCD41000000205FA0024247 -:10F62000000000E876483742000000A2941A6D42BC -:10F63000000040E59C30A2420000901EC4BCD642AF -:10F6400000003426F56B0C430080E03779C341435A -:10F6500000A0D8855734764300C84E676DC1AB43D0 -:10F66000003D9160E458E143408CB5781DAF1544EE -:10F6700050EFE2D6E41A4B4492D54D06CFF08044C9 -:10F68000F64AE1C7022DB544B49DD9794378EA44DE -:10F6900005000000190000007D00000082D9001064 -:10F6A00040D9001040D900103CD9001046D90010B4 -:10F6B00046D9001052DC00103CD9001046D9001089 -:10F6C00052DC001046D900103CD90010E6DB0010D7 -:10F6D000E6DB0010E6DB0010BCDC001000000000E0 -:08F6E000209BFF7F01000000E8 -:10F6E80000000010000000088000000008F700106B -:08F6F80080000008A0060000DC -:08F7000074070008085901001C -:10F7080000093D0000127A0000093D000000D00702 -:10F71800A00F000004000000FFFFFFFFFFFFFFFF36 -:10F72800B4000008C0000008CC000008D800000899 -:10F7380000000000007F00000000001000800100B1 -:10F74800017F00000080011000001C000280000002 -:10F758000000001800001C00077F000000801D103A -:10F768000048000001000000060000001100000031 -:10F778000000000000000000000000000000000081 -:10F788000100000000000000000000000000000070 -:10F79800000000000000000004000000000000005D -:10F7A800F05E0108545F01083C5F0108C05E010873 -:10F7B80000000000A85E0108D85E010800000000F3 -:10F7C800085F0108205F01086C5F0108BC010008A0 -:10F7D8000000000000000000000000000000000021 -:10F7E8000000000000000000000000000100000010 -:10F7F80004000000000000000000001800000000E5 -:10F8080000000000180100086C0100088005314064 -:10F8180002000000110000008005314001000000D6 -:10F8280011000000800531400000000011000000B8 -:10F838000006314004000000110000005A000000DA -:10F8480000000000FFFFFFFF0000000008000000AC -:10F85800000000000100000088010008000000000E -:10F86800000000000700A00001000000F0010008EF -:10F8780000000000F0F4001010F50010D0F40010A3 -:10F888000000000000000000000000000000000070 -:10F898000000000000000000000000000000000060 -:10F8A8000000000000000000000000000000000050 -:10F8B8000000000000000000000000000000000040 -:10F8C8000000000000000000000000000000000030 -:10F8D80043000000000000000000000000000000DD -:10F8E8000000000000000000000000000000000010 -:10F8F80043000000000000000000000000000000BD -:10F9080000000000000000000000000000000000EF -:10F91800430000000000000000000000000000009C -:10F9280000000000000000000000000000000000CF -:10F93800430000000000000000000000000000007C -:10F9480000000000000000000000000000000000AF -:10F95800430000000000000000000000000000005C -:10F96800000000000000000000000000000000008F -:10F97800430000000000000000000000000000003C -:10F98800000000000000000000000000000000006F -:10F99800430000000000000000000000000000001C -:10F9A800000000000000000000000000000000004F -:10F9B80015D0001055C700100000000039F30010E2 -:10F9C80038F50010EFF20010EFF20010EFF200101F -:10F9D800EFF20010EFF20010EFF20010EFF200105B -:10F9E800EFF20010EFF20010FFFFFFFFFFFFFFFF35 -:10F9F800FFFFFFFFFFFF000001004153434949009B -:10FA080000000000000000000000000000000000EE -:10FA18000000000000000000000041534349490075 -:10FA280000000000000000000000000000000000CE -:10FA3800000000000000000000000000A900001005 -:10FA48008100001010B50004440B002827D0144B87 -:10FA58001A68136ABA21515ACA00521A9B181B68AD -:10FA6800002BF4DA0F4B3E221A600F4B0F4A1A6034 -:10FA78000F4BA322D200062199500E4A9C509B5846 -:10FA8800074B1A68136AB431515ACA00521A9B18A4 -:10FA980000225A60064A074BD358002BFADA10BDE9 -:10FAA800D45F010804012640080126401E1F0000FB -:10FAB800000026401C05000010B54378FF2B00D03D -:10FAC80010BD00F035F9124B1A683323D35C032BB1 -:10FAD80000D801BE0E4B1A68136ABA21515A4A005F -:10FAE80052189B18DB680B4A13600B4A00211160FF -:10FAF80001310A4A11605A68094B1A6013680B43AE -:10FB080013601368DB07FCD400F03AF9D8E7C04665 -:10FB1800D45F010800600108F45F0108F85F01087C -:10FB2800FC5F0108F0B583B0009001914D4B1A6855 -:10FB38003323D35C002B00D101BE4A4B1B681F6ADC -:10FB4800BC229C58E4196C3A9B5C002B69D000F0ED -:10FB5800E7F8060003280ED000F0EAF80500424A4C -:10FB6800424BD358002B3DDB414C032E52D028008A -:10FB780000F006F96DE03B4B1A683323D35C062B83 -:10FB880000D801BE374B1968BA23CA5A53009A18CD -:10FB980052000B6A9C466244BC23CB589B181B68D6 -:10FBA800002B5BDB002000F0DBF8324B984257D08B -:10FBB800314B1A6800230021012000F0D9F8051EF6 -:10FBC80002D02B4C45E00135002000F0C9F8294B44 -:10FBD800984202D0294B9D42F5D9284B9D42BBD96A -:10FBE800234C36E0264A0121380000F0A9F8002805 -:10FBF80001D01F4CB9E70198FFF724FF009B002BA9 -:10FC080006D02368002BFCDB00F0C2F80400ACE748 -:10FC18001C4CAAE70121002000F09AF80028F9D12D -:10FC2800A5E700F085F80600154A0121380000F024 -:10FC380087F8002809D1009B002B0DD02368002BE2 -:10FC4800FCDB00F0A5F8040000E0094C300000F0EF -:10FC580097F8200003B0F0BD0A4CF7E7044CF8E72A -:10FC6800034CF6E7D45F0108000026401C0500009D -:10FC78000500520001018800F05F0108EF49020009 -:10FC8800E05F010801005000F0B5C64600B51C4B06 -:10FC98001B6859681B4A136904242343136101280C -:10FCA8002CD030BF86235B00CB58002B23D1164CB9 -:10FCB8002768164BA320C0001E58154A90461568A1 -:10FCC800144A226006241C503E2042461060124A04 -:10FCD800063098500D4A104BD358002BFADA862379 -:10FCE8005B000E4ACA50084B1F60084AA323DB007A -:10FCF800D650074B1D6080BCB846F0BD20BFD1E789 -:10FD0800D45F010800ED00E008012640000026400D -:10FD1800040126401E1F00001C050000AAAAAAAA6A -:10FD280001B40248844601BC604700BFE5060010E4 -:10FD380001B40248844601BC604700BF9B0500101F -:10FD480001B40248844601BC604700BF514E001010 -:10FD580001B40248844601BC604700BF415200100C -:10FD680001B40248844601BC604700BFC15200107C -:10FD780001B40248844601BC604700BFF54F00103B -:10FD880001B40248844601BC604700BFA3050010C7 -:10FD980001B40248844601BC604700BF55490010C1 -:10FDA800000000000000000000000000000000004B -:08FDB800000000000000000043 -:020000041600E4 -:08080000ACE100100000000053 -:107C0000FC01000020122101000000000008001605 -:107C10000000001000000000000000000000000054 -:107C20000000000000000000000000000000000054 -:107C30000000000000000000000000000000000044 -:107C40000000000000000000000000000000000034 -:107C50000000000000000000000000000000000024 -:107C60000000000000000000000000000000000014 -:107C70000000000000000000000000000000000004 -:107C800000000000000000000000000000000000F4 -:107C900000000000000000000000000000000000E4 -:107CA00000000000000000000000000000000000D4 -:107CB00000000000000000000000000000000000C4 -:107CC00000000000000000000000000000000000B4 -:107CD00000000000000000000000000000000000A4 -:107CE0000000000000000000000000000000000094 -:107CF0000000000000000000000000000000000084 -:107D00000000000000000000000000000000000073 -:107D10000000000000000000000000000000000063 -:107D20000000000000000000000000000000000053 -:107D30000000000000000000000000000000000043 -:107D40000000000000000000000000000000000033 -:107D50000000000000000000000000000000000023 -:107D60000000000000000000000000000000000013 -:107D70000000000000000000000000000000000003 -:107D800000000000000000000000000000000000F3 -:107D900000000000000000000000000000000000E3 -:107DA00000000000000000000000000000000000D3 -:107DB00000000000000000000000000000000000C3 -:107DC00000000000000000000000000000000000B3 -:107DD00000000000000000000000000000000000A3 -:107DE0000000000000000000000000000000000093 -:107DF0000000000000000000C20200000000B33BD1 -:0400000510000507DB -:00000001FF +:020000041000EA +:10000000000002081B0500100D0000007D05001017 +:1000100000000000000000000000000000000000E0 +:100020000000000000000000000000007905001042 +:1000300000000000000000007905001079050010A4 +:100040007905001079050010790500107905001078 +:100050007905001079050010790500107905001068 +:100060007905001079050010790500107905001058 +:100070007905001079050010790500107905001048 +:100080000448054B10B5834203D0044B002B00D02D +:10009000984710BD80060008800600080000000098 +:1000A00006480749091A8B10C90FC91810B549101D +:1000B00003D0044B002B00D0984710BD80060008E9 +:1000C000800600080000000010B5074C2378002BC4 +:1000D00009D1FFF7D5FF054B002B02D0044800E003 +:1000E00000BF0123237010BD24070008000000009A +:1000F000CC5F0110054B10B5002B03D00449054817 +:1001000000E000BFFFF7CCFF10BDC04600000000BC +:1001100028070008CC5F011010B5012004F0E6FAB2 +:1001200004F038F80028FBD104F03CF810BD0000C2 +:100130000FB400B583B004AA02CA0192044B1B6835 +:10014000D86812F03FFA03B008BC04B01847C046A4 +:1001500014030008F0B58DB00400002309930028B3 +:1001600000D1A7E00368002B00D1A5E0007909A920 +:1001700004F080FB002800D097E0099AA368D21809 +:1001800023681B899B1807AD07934D4F7B4008934D +:1001900001AE33002A0003CA03C34A48FFF7C8FF71 +:1001A00005AB1A0003CE03C203CB03C2089A079B18 +:1001B0005740BB424BD105994348FFF7B9FF20791F +:1001C00009A904F057FB00283FD1099AA368D21867 +:1001D00023681B89D21807AB07923948424008921E +:1001E0000AA90A001C0060CC60C203AA140060C9FE +:1001F00060C401A9C0C9C0C434490091190030CA03 +:1002000030C1089A079B5040834222D107AB05AA10 +:10021000190011CA11C10899079A294B4B409A42FB +:1002200019D1059A039B9A4217D0069A049B9A42C9 +:1002300016D0059A039B9A4203D0009A244B9A4207 +:1002400014D0009A224B9A4212D0002035E000F0E0 +:100250009FFB00F09DFB00F09BFB1E4B0093E4E72F +:10026000009AC5231B0113430093E2E700F090FBC3 +:100270001948FFF75DFF1948FFF75AFFFFF74CFFDA +:1002800005AB01AA190011CA11C10A0011CB11C195 +:100290005168079A0A4B4B409A4204D1059811F0D5 +:1002A000E3FB012009E000F073FB0D48FFF740FF7E +:1002B000002002E0002000E000200DB0F0BDC046AC +:1002C0001CA379B7503301107C330110C3A5000083 +:1002D0005A3C00000A300000A0330110C433011062 +:1002E0000834011010B5084B1968084A116018331A +:1002F0005360074810F024FD002800D010BD0548C9 +:10030000FFF716FF01BEF9E7B860010840070008D3 +:10031000800000082C34011070B592B00C2200212E +:100320000DA812F06DFD09AB624A0992624A0A9269 +:100330000BAA11CB11C211F0BFFD002802D001BEE3 +:1003400030BFFDE762B6E1235B020093FF231A0092 +:100350002821292003F0F4FE002802D001BE30BF7E +:10036000FDE75648FFF7E4FE5548FFF7E1FE0120A0 +:1003700004F064F9011E65D15248FFF7D9FE01214E +:1003800007A800F00FFB09AE4A4B09934A4B0A93AA +:100390000BAC2300320003CA03C302AD19002800CE +:1003A00002F0E2F9230006CD06C30798089900F091 +:1003B00059FB330006CC06C30A99099A424B4B40BD +:1003C0009A4246D109AB414A0992414A0A9210A980 +:1003D0000A00180030C830C205AA140060C860C402 +:1003E000200060C960C03B490491190011CA11C1C5 +:1003F0000A99099A344B4B4093422CD109AB07AA76 +:10040000190011CA11C10A99099A2F4B4B409A42FF +:1004100023D1079A059B9A4221D0089A069B9A42BB +:1004200020D0079A059B9A4203D0049A2A4B9A42FD +:100430001ED0049A284B9A421CD02848FFF778FE19 +:10044000002403E02648FFF773FE0024FFF74AFF6D +:1004500029E000F09DFA00F09BFA00F099FA214B98 +:100460000493DAE7049AC5231B0113430493D8E7E6 +:1004700000F08EFA1C48FFF75BFEFA21090100200C +:100480000BF0DCFD002808D10DA8FFF763FE041E69 +:10049000DCD11648FFF74CFED8E71548FFF748FEB9 +:1004A0000024D3E730BF002CFCD0002010F02CFE3D +:1004B000F9E7C0465555AAAA690F690F64340110BF +:1004C000783401109C3401103C5AC3A5AAAA555592 +:1004D00096F096F0C3A500005A3C00007835011054 +:1004E000CC3401100A3000000C3501103C350110ED +:1004F0005C350110000000000230800803D001309C +:100500000238FCD1C046C0467047EFF3108072B687 +:10051000704780F3108870477047FFF7FDFF72B691 +:100520000F4C104DAC4209DA21686268A368043BA5 +:1005300002DBC858D050FAE70C34F3E70A490B4AFB +:100540000020521A02DD043A8850FCDC08480949B0 +:100550000860BFF34F8F11F00BFAFFF7DDFEFEE7E7 +:10056000D85F0110F05F01102407000878690108C6 +:100570000000000808ED00E0FEE7FEE700B50420FB +:100580007146084202D0EFF3098002E0EFF30880E1 +:10059000043010F003FAFEE7F0B583B007006846B8 +:1005A000114C0094114C44603C0060C860C40024AD +:1005B00000E001349C420CD20D192E78F6B21519C8 +:1005C0002D78EDB2AE42F4D000F0A2FA380003B0BC +:1005D000F0BD9C42F8D16B46054A0092054A5A602C +:1005E0003A0003CB03C2EFE75555AAAA690F690F7A +:1005F000AAAA555596F096F043001B18D800C01AC9 +:100600004002704710B5FFF7F7FF303010BD10B54E +:10061000040002F073FE01000122200000F06DF8DA +:1006200010BD10B582B00400019102F071FE01000E +:10063000042301AA200002F073FE02B010BD0000E6 +:100640000FB400B583B004AA02CA0192044B1B6820 +:10065000D86811F0B7FF03B008BC04B01847C04613 +:100660001403000804280BD0052804D101394B1EBF +:100670009941C8B27047401A43425841C0B2F9E7A5 +:100680000120F7E700280FD0002A03D1002070478F +:1006900001301A00531E002A04D002788A42F7D093 +:1006A0000020F4E70120F2E70020F0E770B50C002D +:1006B0001500002807D004F0CDFA01002A00200020 +:1006C000FFF7E0FF70BD0020FCE710B582B00C0022 +:1006D00000230193C0B201A904F0F4F8002803D06C +:1006E0000124200002B010BD0198210002F084FE18 +:1006F0000400019804F01CF9F3E700B583B013007F +:1007000001AA1370012302F00BFE03B000BD10B567 +:10071000040002F0EFFD010001222000FFF7EDFFD1 +:1007200010BD000010B582B004000E2A12D80E29A8 +:1007300017D81201D2B26B46DA710A43DA7102F0AD +:10074000E2FD010001236A460732200002F0E8FDC5 +:1007500002B010BD064B074ADD210748490011F0E1 +:1007600099FD064B034ADD210348490011F092FD33 +:10077000B435011078370110C83501101436011056 +:1007800030B587B004000522002104A812F038FB20 +:100790000522002102A812F033FB251E0CD0012CEB +:1007A00005D1601C4000FF2807D9FF2005E0002C80 +:1007B00015D1A01C4000F6E70120C0B204A9FFF744 +:1007C00084FF002800D0A2E0002D10D0012D08D118 +:1007D000601C40000130FF280AD9FF2008E0FF20FC +:1007E000EBE7002D31D1601C40000330F3E702201D +:1007F000C0B202A9FFF769FF012828D0002800D065 +:1008000087E004AB1B78012B31D0032B2DD0424A5B +:1008100004A94B788C78CD784049414801950094E3 +:10082000FFF70EFF02AB1B78012B24D0032B20D047 +:10083000394A02A94B788C78CD783A4938480195E5 +:100840000094FFF7FDFE00241FE0FF20D0E73648AC +:100850002100FFF7F5FE02AB03221A700121597047 +:100860009A70DA7000221A71CBE7304AD0E7304A2A +:10087000CEE72E4ADDE72E4ADBE72B79042B28D082 +:1008800004AA9278934224D00134022C39D8630010 +:100890001B195B00274AD518D05C04AB1978FFF709 +:1008A000E1FE0028F0D0687802AB1978FFF7DAFE95 +:1008B0000028E9D0AB78042B03D004AAD278934265 +:1008C000E2D1EB78042BD8D002AAD2789342DBD1C4 +:1008D000D3E76B79022B07D0032B10D0042B01D068 +:1008E000154902E0154900E015491648FFF7A8FE32 +:1008F0006879831EDBB2022B07D9FF2005E012497D +:10090000F3E71248FFF79CFE012007B030BDFF203F +:10091000FBE7FF20F9E7C04628360110B836011082 +:10092000DC36011020370110683601103436011012 +:100930002C360110A03701104C3601106036011022 +:1009400044360110483701103C3601106037011061 +:1009500070B50600002915D001204042337843408D +:100960001D090F221340094C9B001B596B401809AD +:100970001A40920013595840013901360029EDD12F +:10098000C04370BD01204042FAE7C046B4370110B1 +:10099000FEE7FCE7FAE7F8E7F6E7F4E7F2E7F0E767 +:1009A000EEE7FEE7F0B587B004000D002B4B020028 +:1009B000190041C941C269460A0041CB41C208221F +:1009C00002A812F068FA0399029A254B4B409A420A +:1009D00039D1009BEA439A4237D369461F4B0A003C +:1009E00041CB41C2082202A812F055FA0399029A9B +:1009F0001B4B4B409A422AD1009BED1802AE029548 +:100A0000174F7D40039504AD08223100280012F0F5 +:100A100042FA124B1A0003CD03C2320003CB03C2C9 +:100A2000039A029B5740BB4213D102AB1A0021002C +:100A300021C921C20399029A094B4B409A420AD11B +:100A4000200007B0F0BDFFF7A3FFFFF7A1FFFFF7FE +:100A50009FFFFFF79DFFFFF79BFFC046F0000008D8 +:100A60001CA379B770B58AB06A46009051602348DC +:100A7000099003AB190030CA30C1214A60CA60C175 +:100A800002900A0011CB11C15168079A1D4B4B40CF +:100A90009A4222D107AB05AA190011CA11C10899BF +:100AA000079A184B4B409A4219D1059A039B9A42D8 +:100AB00017D0069A049B9A4216D0059A039B9A4235 +:100AC00003D0029A104B9A4214D0029B0993099AC0 +:100AD0000D4B9A4210D10AB070BDFFF759FFFFF7D6 +:100AE00057FF0A4B0293E4E7029AC5231B01134305 +:100AF0000293E2E7FFF74CFFFFF74AFFC3A50000B0 +:100B0000F00000081CA379B75A3C00000A3000002E +:100B100070B586B06946214B0A0011CB11C208227C +:100B200002A812F0B8F90399029A1D4B4B409A4261 +:100B30002CD1009B002B2BD06946184B0A0011CBFF +:100B400011C2082202A812F0A6F90399029A144BC6 +:100B50004B409A421ED1009B013B02AC0293104EC7 +:100B60007340039304AD08222100280012F093F98A +:100B70000A4B1A0003CD03C2220003CB03C2039A1F +:100B8000029B5640B34207D106B070BDFFF700FF8D +:100B9000FFF7FEFEFFF7FCFEFFF7FAFEF00000088D +:100BA0001CA379B730B589B00400302307AA04F03C +:100BB000FEF900282ED12568079BED1801AB04AA89 +:100BC0002900200004F036FA002826D1059B072BC7 +:100BD00026D106981D49072212F004F9002822D1D7 +:100BE000029B082B22D103981949082212F0FAF827 +:100BF00000281ED107AA2900200004F001FA0028CD +:100C00001AD12368079A9B18AB4218D1412A19D1EF +:100C100009B030BD01204042FAE702204042F7E728 +:100C200003204042F4E703204042F1E70420404221 +:100C3000EEE704204042EBE706204042E8E70720C9 +:100C40004042E5E708204042E2E7C046F4370110A1 +:100C5000FC370110F0B5B3B0060002911500039304 +:100C600038AB80CB1A78354CD20013590693A418B0 +:100C7000626814681C19210006A8FFF793FF00287A +:100C80000CD1202D13D004AB2D4A04922D4A05928D +:100C9000320003CB03C2300033B0F0BD04AB284AAE +:100CA0000492284A0592320003CB03C2F3E707A857 +:100CB00006F07CF8069D641B032107A808F03EF8A7 +:100CC000002826D123002A0029A907A807F0ACFB99 +:100CD000002821D129A907A807F0EEFB00281ED182 +:100CE0000097039B2022029907A806F055F8041EDE +:100CF00018D107A806F05EF8FFF70AFF002C14D001 +:100D000004AB0F4A04920F4A0592320003CB03C290 +:100D1000C1E701246442ECE701246442E9E70124CD +:100D20006442E6E701246442E3E704AB064A049226 +:100D3000064A0592320003CB03C2ACE7503E0110D5 +:100D40005555AAAA690F690FAAAA555596F096F0AB +:100D5000F0B5CE46474680B59DB014009946249F15 +:100D6000259B984601A808F053F8002101A808F037 +:100D700055F8279B002B02D0289B002B06DC2289EC +:100D8000E3689B186689F618002513E01A00279976 +:100D900001A808F037FFF2E723003A00290048468F +:100DA00003F0E8FD002811D12200390001A808F065 +:100DB00029FF2D19B54204D2741B4445ECD9444691 +:100DC000EAE7269901A808F067FF00201DB0C0BC23 +:100DD000B946B046F0BD0000F0B5A5B007000E0062 +:100DE000202926D10024144B1B68A3421CDD09A82E +:100DF00008F00EF8002109A808F010F80F4BE500E4 +:100E0000E9585B195B681A6809A808F0FBFE01A99C +:100E100009A808F041FF3200390001A811F0E2FFF3 +:100E2000002803D00134DEE701246442200025B00D +:100E3000F0BD01246442F9E74C3E0110503E011020 +:100E4000F0B5DE4657464E464546E0B5C7B004000D +:100E50008A4691469B46509B98460EADD04E0E96C4 +:100E6000D04F0F97082229003EA812F014F80E96D2 +:100E70000F97230006CD06C3549B0493539B039303 +:100E80000295529B0193519B009343465A46494613 +:100E90005046FFF75DFF051E00D096E1559B002BE5 +:100EA00004D0202210A9180011F0F5FF00230093B0 +:100EB000BD4B4246594638A803F02EF8051E00D017 +:100EC00083E101277F427CE001277F4279E001270F +:100ED0007F4276E06B460333FF331B88202B00D024 +:100EE0008DE1419918AA404603F044FD051E00D04B +:100EF0006BE101210CA8FFF755FD0EAEA84B0E9338 +:100F0000A84B73602300320003CA03C3202318AA2E +:100F100010A906A8FFF740FB06AB220003CB03C2D3 +:100F20000C980D99FFF79EFD3300220003CA03C3FE +:100F300071680E9A9D4B4B409A4200D09FE09C4BAB +:100F40000E939C4B0F9308220EA942A811F0A3FF09 +:100F50000AAE3300220003CA03C3082242A91800C4 +:100F600011F099FF944B0893082231000EA811F05C +:100F700092FF0F990E9A8D4B4B409A4200D080E021 +:100F800008220CA90EA811F086FF0F990E9A874B24 +:100F90004B409A4277D10C9A0A9B9A4275D00D9A8F +:100FA0000B9B9A4274D00C9A0A9B9A4203D0089ADF +:100FB000824B9A4272D0089A804B9A4200D004E148 +:100FC000012540AB6A460332FF3241A938A803F03D +:100FD00017F8002800DAF7E000DD7BE040AB1B8863 +:100FE000102B00D176E7012B5AD0222BE9D1002F0C +:100FF00000DA69E7724B1B68BB4200DC67E76B46AF +:101000000333FF331B88802B00D9FEE0419918AAD7 +:10101000404603F0AFFC002800D0ECE001210CA812 +:10102000FFF7C0FC5E4B0E935E4B0F933EAE082263 +:101030000EA9300011F02FFFFFB201976B4603336A +:10104000FF331B88009318AB202210A906A8FFF7D6 +:1010500001FE06AB320003CB03C20C980D99FFF7DB +:1010600001FD082231000EA811F015FF0F990E9A0C +:101070004E4B4B409A422BD101277F42A1E7FFF70D +:1010800087FCFFF785FCFFF783FC4E4B089386E750 +:10109000089AC5231B011343089384E7FFF778FCE4 +:1010A0006B460333FF331B88202B00D0AAE0419905 +:1010B00018AA404603F05EFC002800D099E06B4679 +:1010C0000333FF33197818A8FFF786FE070078E787 +:1010D000FFF75EFC6E426E41F6B2002D00D18CE04F +:1010E0000EAD2F4B0E932F4B6B6023002A0003CACB +:1010F00003C32F4B0E932F4B6B600822290044A88B +:1011000011F0C9FE08223EA90AA811F0C4FE082267 +:1011100044A90CA811F0BFFE274B099308220AA985 +:10112000280011F0B8FE69680E9A204B4B409A4295 +:1011300020D108220CA90EA811F0ADFE0F990E9A2D +:101140001A4B4B409A4217D10C9A0A9B9A4215D0DF +:101150000D9A0B9B9A4214D00C9A0A9B9A4203D088 +:10116000099A164B9A4212D0099A144B9A4210D0FF +:1011700035002AE0FFF70CFCFFF70AFC114B09933E +:10118000E6E7099AC5231B0113430993E4E7FFF738 +:10119000FFFB3EAB220003CB03C2350015E0C04687 +:1011A0005555AAAA690F690FFFFF00003C5AC3A555 +:1011B000AAAA555596F096F0C3A500005A3C000027 +:1011C0004C3E01100A3000000500002D07D00EAB88 +:1011D0000E950F4A6A400F92220003CB03C2FFF71D +:1011E00097FC200047B0F0BCBB46B246A946A046DB +:1011F000F0BD0500E9E70500E7E73500E5E7012573 +:101200006D42E4E701256D42E1E701256D42DEE72D +:101210003C5AC3A500207047036A5B780B71036AD0 +:101220005B688B600860704710B502680A4B9A4291 +:101230000FD1C2680389D843824202D8D418012052 +:1012400000E00020002805D08B68A34202D80020CF +:1012500000E0002010BDC0463DB8F3960020704766 +:1012600010B582B004000800E022120101920129A9 +:1012700008D0022911D0032912D0072913D1A26E58 +:101280006C3401E0626A283401A903F009FD0028EA +:1012900001D1019B236002B010BD226D5434F3E7ED +:1012A000E26D6034F0E70120F5E7000070B505005D +:1012B000006A03F06FFC041E08D0A86D03F06AFCFE +:1012C00000280AD0844200D3200070BD064B074A94 +:1012D0009E210748490010F0DDFF064B034AA0217C +:1012E0000348490010F0D6FF08380110043B0110F4 +:1012F000183801105C380110F0B585B005000C00FD +:10130000019200230393002003F06AFCC0B203A9FA +:1013100003F0D8FA002806D00127039803F008FB51 +:10132000380005B0F0BD2C236343EB181A89DE6842 +:1013300096190398042302AA310003F01BFB071E31 +:1013400026D12C236343ED186C8902AB1A88134B0A +:101350009A420DD0002C1DD102AB1A88104B9A4234 +:101360001AD1331902AA52889B18019A1360D4E744 +:1013700002AB59888C4201D00327CEE78919039824 +:10138000042302AA03F0F6FA0028E5D00127C4E7F7 +:101390000127C2E70327C0E70327BEE7086900006B +:1013A0000769000070B505000026002E00DD70BD45 +:1013B000A86D03F0BDFA002408E00122121B2C23C3 +:1013C0005343EB18186A03F0B3FA0134012CF4D933 +:1013D0000136EAE7F0B583B004000F000023019363 +:1013E000002003F0FDFBC0B201A903F06BFA061E5A +:1013F0001AD1019803F02EFC0500019803F098FA29 +:101400002C237B43E4180023032B05D8E25C954290 +:1014100008D10133DBB2F7E70123002B07D03000FE +:1014200003B0F0BD0023F8E701267642F7E7012676 +:101430007642F4E70FB400B583B004AA02CA019261 +:10144000044B1B68D86811F0BDF803B008BC04B0A9 +:101450001847C04614030008F8B506000D00170031 +:101460000024012C11DC2C226243B2183B00210025 +:10147000300001F03DFC002801D10134F1E7002CDF +:1014800004DD002D02D1002000E00020F8BD0000A6 +:10149000F0B5CE46474680B58DB0040091469846DB +:1014A0000AAD1F4F0A971F4E6E6003002A0003CA41 +:1014B00003C3012108A8FFF775FA0A976E6023009D +:1014C0002A0003CA03C306AE0023059304930393C3 +:1014D0000133FF330293144B0193434600934B4671 +:1014E000002200213000FFF7ABFC230006CE06C32C +:1014F00008980999FFF7B6FA2B00220003CA03C324 +:1015000069680A9A094B4B409A4207D1FFF700FBE2 +:1015100020000DB0C0BCB946B046F0BDFFF738FAA8 +:101520005555AAAA690F690FC05B01083C5AC3A5AB +:10153000F0B5D6464F464646C0B594B004000F00FD +:101540001500039300230F930DAA9B4B0D939B4B08 +:101550000E93030003CA03C32900002003F040FBDD +:10156000C0B20FA903F0AEF9002800D0B6E02C20DD +:1015700068438046B84429003800FFF72BFF002855 +:1015800000D1AEE043461B69DB0600D5A9E00DABF8 +:10159000012294460D928A4A91460E9220001A002A +:1015A00042CA42C062460D924A460E9210AA944622 +:1015B000180042C842C209AA91461000260006CE71 +:1015C00006C0614644C944C07E49079119004A4695 +:1015D00041CA41C10E990D9A7B4B4B409A4200D0B3 +:1015E00096E00DAB0BAA190041CA41C10E990D9AA4 +:1015F000754B4B409A4200D08CE00B9A099B9A4263 +:1016000000D189E00C9A0A9B9A4200D187E00B9A9C +:10161000099B9A4204D0079A6C4B9A4200D184E00D +:10162000079A6A4B9A4200D181E00F9E31004046F2 +:10163000FFF7FAFD002842D00DAB654A0D92654ACE +:101640000E9212AA9446180082C882C209AA904635 +:101650001000270006CF06C0614684C984C05949DE +:1016600008911900424681CA81C10E990D9A564BC4 +:101670004B409A4200D088E00DAB0BAA190081CAFA +:1016800081C10E990D9A504B4B409A4200D07EE09A +:101690000B9A099B9A4200D17BE00C9A0A9B9A42D2 +:1016A00000D179E00B9A099B9A4204D0089A474BE3 +:1016B0009A4200D176E0089A444B9A4217D0002D06 +:1016C00000D071E0002D00D074E043494348FFF79B +:1016D000B1FE434B220003CB03C208E0FFF718FA28 +:1016E0000AE0002D0FD13E4B220003CB03C20F981E +:1016F00003F01EF9FFF70CFA200014B0E0BCBA4664 +:10170000B146A846F0BD0F99380001F0FDFFEAE7A9 +:10171000FFF73EF9FFF73CF9324B079372E7079A60 +:10172000C5231B011343079371E7FFF731F901212B +:101730000BA8FFF737F90DAB99461F4B0D931F4BC5 +:101740004A465360230003CA03C304AB9A460F9B67 +:10175000039A0092424639005046FFF799FE230053 +:10176000524603CA03C30B980C99FFF77BF94B460B +:10177000220003CA03C34B4659680D9A124B4B40D3 +:101780009A4200D151E7FFF703F9FFF701F9FFF79C +:10179000FFF8144B089380E7089AC5231B011343F5 +:1017A00008937FE7FFF7F4F8B2680021300003F0F8 +:1017B00097F987E70C4989E75555AAAA690F690F78 +:1017C0003D5AC3A5C3A500003C5AC3A55A3C00001E +:1017D000AAAA555596F096F0683801107C38011089 +:1017E000AC3A01100A30000070380110F0B591B029 +:1017F00001900F006A4B0A936A4B0B9308220AA9C7 +:101800000CA811F048FB0020FEF7BAFF04000228E4 +:1018100006D0042804D0032802D0200011B0F0BD67 +:10182000012108A8FFF7BEF85D4B0A935D4B0B93AF +:101830000CAD08220AA9280011F02DFB02AE3B00D6 +:10184000012201993000FFF773FE2B0003CE03C382 +:1018500008980999FFF706F9082229000AA811F04B +:101860001AFB0B990A9A504B4B409A4276D14F4B38 +:101870000A934F4B0B9308220AA90EA811F00BFBF9 +:1018800008220CA906A811F006FB08220EA908A838 +:1018900011F001FB474B0493082206A90AA811F096 +:1018A000FAFA0B990A9A404B4B409A4258D10822B7 +:1018B00008A90AA811F0EFFA0B990A9A3A4B4B4083 +:1018C0009A424FD1089A069B9A424DD0099A079B9B +:1018D0009A424CD0089A069B9A4203D0049A364BFF +:1018E0009A424AD0049A344B9A4200D195E7082292 +:1018F0000CA906A811F0CFFA08AA304B11CB11C2DF +:101900002C4B0593082206A90AA811F0C4FA0B99DA +:101910000A9A254B4B409A4231D1082208A90AA8BD +:1019200011F0B9FA0B990A9A1F4B4B409A4228D1F1 +:10193000089A069B9A4226D0099A079B9A4225D07C +:10194000089A069B9A4203D0059A1B4B9A4223D0D1 +:10195000059A194B9A4221D005245EE7FFF718F843 +:10196000FFF716F8FFF714F8154B0493AEE7049A47 +:10197000C5231B0113430493ACE7FFF709F8FFF7F6 +:1019800007F8FFF705F80E4B0593D5E7059AC52331 +:101990001B0113430593D3E7FEF7FAFF01243CE74D +:1019A0005555AAAA690F690F3C5AC3A5AAAA55554D +:1019B00096F096F0C3A500005A3C0000AC3A011026 +:1019C0000A30000070B504000121FFF749FC00282F +:1019D00002D00125280070BD02212000FFF740FC45 +:1019E000002814D107212000FFF73AFC002801D07D +:1019F0000125EFE703212000FFF732FC051E01D08F +:101A00000125E7E72000FFF751FC6067E2E70925C1 +:101A1000E0E7002383718360C36001334371036097 +:101A20000371C37170474379012B01D000207047C7 +:101A30000368012B01D00020F9E70379012B01D0C5 +:101A40000020F4E70120F2E770B582B005000C0039 +:101A50000023009301930800FFF7E5FF002836D02C +:101A60002A68254B9A4218D001267642EA6A224B10 +:101A70009A421FD0019B009A934200D90093009B89 +:101A8000A360009A2100280001F0DAFA1B4B1968C4 +:101A900000292CDC300002B070BD6A46002128000D +:101AA000FFF72AFC061EE1D0154B164A16481749C7 +:101AB00010F0F0FB01AA01212800FFF71DFC061E13 +:101AC000D8D00F4B0F4A1048114910F0E3FB21000A +:101AD0000831002001F002FE061E02D1A368009327 +:101AE000CFE7074B074A08480A4910F0D3FB0A48DA +:101AF000FFF7A0FCCEE7C0463DB8F396C05C0108F6 +:101B0000A8380110D83A0110183801103405000027 +:101B10004C0500006D050000B038011070B50400E0 +:101B20000D00FFF791FF002812D1EB797022A3542A +:101B3000033BDBB2012B11D9EB79022B17D0042B1D +:101B400015D0032B13D07023E35CFF2B18D070BD8E +:101B5000104B114A1148124910F09CFB002000F074 +:101B60006FFE0028E8D07023FF22E254E4E7002053 +:101B700000F03EFE0028E6D07023FF22E254E2E7A8 +:101B80000848FFF757FC084B034A0448074910F080 +:101B900081FBC046A8380110E83A0110183801103E +:101BA000B2060000E4380110F4380110CA06000043 +:101BB000F0B5C64600B594B004000E002E4B0A9353 +:101BC0002E4B0B9308220AA90CA811F064F92000EF +:101BD000FFF7F8FE051E09D0E02129480901FFF7AB +:101BE00029FC70230122E254012D0ED00022002195 +:101BF0002000FFF731FC00280BD1200001F0E4F8B1 +:101C000000280ED170230122E25414B080BCB846E3 +:101C1000F0BD1C480021FFF70DFC70230122E254A7 +:101C2000F3E73000FFF7F5FE00230293002500E004 +:101C30000135012D2AD802AA29002000FFF75CFBFC +:101C40000028F5D12C236B43E3181F6A002FEFD037 +:101C50002C236B43E3189A6A013A636F5343029A49 +:101C60009A42E5D908482900FFF7E4FBBA68002149 +:101C7000380002F035FFDBE75555AAAA690F690F56 +:101C8000F83801104039011070390110310020007E +:101C900001F0EAFD002800D077E13000FFF7C3FE35 +:101CA00001235840C1B232002000FFF7D5FB0028C5 +:101CB00000D072E13000FFF7B6FE002800D17BE1D2 +:101CC000F379012B00D195E1012108A8FEF76AFE06 +:101CD000E14B0A93E14B0B930CAD08220AA92800B3 +:101CE00011F0D9F86F463300012221003800FFF7C8 +:101CF0001FFC2B0006CF06C308980999FEF7B2FE19 +:101D0000082229000AA811F0C6F80B990A9AD44BA8 +:101D10004B409A4200D074E1D24B0A93D24B0B93C2 +:101D200008220AA90EA811F0B6F808220CA906A8E4 +:101D300011F0B1F808220EA908A811F0ACF8CB4BAD +:101D40000393082206A90AA811F0A5F80B990A9A8C +:101D5000C34B4B409A4200D055E1082208A90AA87B +:101D600011F099F80B990A9ABD4B4B409A4200D05A +:101D70004BE1089A069B9A4200D148E1099A079BD9 +:101D80009A4200D146E1089A069B9A4204D0039AEF +:101D9000B74B9A4200D143E1039AB54B9A4200D126 +:101DA00040E170230522E2547023E35C012B00D054 +:101DB0002BE700212000FFF70DFB8046012108A83A +:101DC000FEF7F0FDA44B0A93A44B0B930CAD082235 +:101DD0000AA9280011F05FF86F46330000222100A5 +:101DE0003800FFF7A5FB2B0006CF06C3089809991A +:101DF000FEF738FE082229000AA811F04CF80B99CA +:101E00000A9A974B4B409A4200D00FE14346002B71 +:101E100044D0944B0A93944B0B9308220AA910A820 +:101E200011F039F808220CA906A811F034F808229C +:101E300010A908A811F02FF88C4B0493082206A9CA +:101E40000AA811F028F80B990A9A854B4B409A4240 +:101E500000D0EDE0082208A90AA811F01CF80B999F +:101E60000A9A7F4B4B409A4200D0E3E0089A069BC7 +:101E70009A4200D1E0E0099A079B9A4200D1DEE045 +:101E8000089A069B9A4204D0049A794B9A4200D150 +:101E9000DBE0049A764B9A4200D1B6E6E36A9846B4 +:101EA000012108A8FEF77EFD6B4B0A936B4B0B9349 +:101EB0000CAD08220AA9280010F0EDFF6F46330090 +:101EC000012221003800FFF733FB2B0006CF06C3A9 +:101ED00008980999FEF7C6FD082229000AA810F003 +:101EE000DAFF0B990A9A5E4B4B409A4200D0AEE063 +:101EF000604B984500D088E65A4B0A935A4B0B9397 +:101F000008220AA912A810F0C6FF08220CA906A8E8 +:101F100010F0C1FF082212A908A810F0BCFF534B13 +:101F20000593082206A90AA810F0B5FF0B990A9A92 +:101F30004B4B4B409A4200D08BE0082208A90AA8DC +:101F400010F0A9FF0B990A9A454B4B409A4200D0DA +:101F5000A0E0089A069B9A4200D19DE0099A079B4F +:101F60009A4200D19BE0089A069B9A4204D0059AB7 +:101F70003F4B9A4200D198E0059A3D4B9A4200D0DF +:101F800043E670230422E2543FE63B480021FFF77A +:101F900051FA70230122E25437E600212000FFF7B6 +:101FA00019FA002800D185E634480021FFF742FAEB +:101FB00070230122E25428E631002000FFF7AEFD35 +:101FC00000280AD1320000212000FFF745FA00283E +:101FD0000AD170230122E25417E6294B294AF42141 +:101FE0002948C90010F056F9254B264A26482749AA +:101FF00010F050F931002000FFF7F8FB7023E05497 +:10200000D2E6FEF7C5FCFEF7C3FCFEF7C1FC204B91 +:102010000393B3E6039AC5231B0113430393B2E66C +:10202000FEF7B6FCF2797023E254BDE6FEF7B0FC91 +:10203000FEF7AEFCFEF7ACFC154B04931BE7049ACD +:10204000C5231B01134304931AE7FEF7A1FCFEF717 +:102050009FFCFEF79DFCC0465555AAAA690F690F63 +:102060003C5AC3A5AAAA555596F096F0C3A5000000 +:102070005A3C00003DB8F396DC390110403901109C +:10208000A8380110143B011018380110A6070000F1 +:102090000A300000FEF77CFC054B05935EE7059ACD +:1020A000C5231B01134305935DE7FEF771FCC04692 +:1020B0000A30000010B502F013FD10BDF8B5DE4681 +:1020C00057464E464546E0B58946924698460A9B95 +:1020D0009B460B9E002512E0134A4346E918230055 +:1020E000484602F047FC002819D10F4A5B46E91820 +:1020F0002300504602F09AFC002812D12D19B54257 +:1021000006D2741B80239B009C42E5D91C00E3E7A8 +:102110000020F0BCBB46B246A946A046F8BD01204F +:10212000F7E70120F5E7C046C0070008F0B5C6464E +:1021300000B584B007000023039302933948FFF7EA +:1021400079F93948FFF776F903A9012002F0BAFBC3 +:10215000002819D102A9022002F0B4FB002819D1ED +:10216000BB6A98460025002444451FD27B6AE200E2 +:102170009B185E68039832002900FFF79BFF002838 +:102180000ED1AD190134EFE7284B294A29482A49D5 +:1021900010F080F8254B264A2648284910F07AF896 +:1021A000224B234A2348264910F074F82548290079 +:1021B000FFF740F9039A0299019500230093380034 +:1021C000FFF77CFF041E04D0200004B080BCB8469A +:1021D000F0BD3B6D5A6802980021FFF76BFF0028A5 +:1021E00014D17B6D013B3A6DDB00D318196812687E +:1021F000891A5A680298FFF75DFF041E0CD10398F4 +:1022000002F096FB029802F093FBDDE7074B084AC9 +:1022100008480D4910F03EF8044B054A05480B49A3 +:1022200010F038F80C3A0110443A0110A8380110A7 +:10223000B43A0110183801109B0400009F040000FC +:10224000A6040000683A0110FA040000020500002C +:10225000F0B5CE46474680B58FB004000F006D4BF9 +:10226000994608936C4E09960AAD082208A92800E1 +:1022700010F011FE00212000FFF7ACF8804601218C +:1022800006A8FEF78FFB4B4608930996082208A97B +:10229000280010F000FE6E463B00002221003000B6 +:1022A000FFF746F92B0006CE06C306980799FEF7FE +:1022B000D9FB0822290008A810F0EDFD0999089A19 +:1022C000564B4B409A4200D072E04346002B3ED022 +:1022D000534B0893534B0993082208A90CA810F0FC +:1022E000DAFD08220AA904A810F0D5FD08220CA9DD +:1022F00006A810F0D0FD4C4B0393082204A908A8AF +:1023000010F0C9FD0999089A444B4B409A4251D1AB +:10231000082206A908A810F0BEFD0999089A3F4BAB +:102320004B409A4248D1069A049B9A4246D0079A5B +:10233000059B9A4245D0069A049B9A4203D0039A81 +:102340003A4B9A4243D0039A384B9A424DD00023DD +:10235000089308A9012002F0B5FA002839D108999C +:102360003A00200001F026FA002838D1089802F03F +:10237000DFFA39002000FFF7D9FE00283AD1702398 +:10238000E55CEB1EDBB2012B3AD9022D03D0042D04 +:1023900001D0032D07D1002000F02AFA002802D036 +:1023A0007023FF22E2540FB0C0BCB946B046F0BD66 +:1023B000FEF7EEFAFEF7ECFAFEF7EAFA1C4B03938F +:1023C000B5E7039AC5231B0113430393B3E7FEF755 +:1023D000DFFA184B184A194819490FF05BFF154BE3 +:1023E000154A164817490FF055FF39002000FFF72E +:1023F0002BFBC2E70F4B104A104813490FF04AFF5E +:10240000002000F01DFA0028BFD07023FF22E25404 +:10241000FF25BCE75555AAAA690F690F3C5AC3A509 +:10242000AAAA555596F096F0C3A500005A3C0000A4 +:102430000A300000A8380110C43A01101838011001 +:1024400061060000640600006F060000F0B5D64685 +:102450004F464646C0B590B005000C00170010224C +:1024600000210AA810F0CCFC08ABA34A0892A34AAA +:1024700009922A0003CB03C2002398460126764224 +:102480004346002B02DD002398463FE09C4B6362ED +:102490009C4B23659C4BE3659C4BA3660026012E59 +:1024A00014D83100002002F09BFB2C217143203115 +:1024B0006118C0B202F006FA002801D10136EEE739 +:1024C000934B944A944895490FF0E4FE210058310B +:1024D000032002F0F7F9061E07D10AA92000FFF732 +:1024E00067FB01239C46E044CAE7894B894A8A4836 +:1024F0008B490FF0CFFE022B1CD2012B27D170236A +:10250000E35CFF2B27D001239C46E0444346002B8D +:102510002ADC7023E35C0AAAD371042BEBD9052BC8 +:1025200015D1002000F08CF9061EE8D07023FF22A0 +:10253000E254E4E70AA92000FFF78AFE061EDED077 +:10254000734B744A8A21744809010FF0A3FE70236B +:10255000FF22E254D3E77348FEF76CFF724B6D4ADB +:102560006D4872490FF096FE00239A465346002BA1 +:102570002DDD236A5B783B71236A5B68BB603C603E +:10258000102200210AA810F03BFC39002000FEF7C1 +:1025900043FE08AB664A0892664A09922A0003CBBA +:1025A00003C22000FEF7FEFE002E07D008AB0896FF +:1025B000614A724009922A0003CB03C2FEF7A8FACF +:1025C000280010B0E0BCBA46B146A846F0BD702362 +:1025D000E35C012B06D00AAA00212000FEF73CFF95 +:1025E000061EDED1012106A8FEF7DCF908AB9846ED +:1025F000414B0893414B424653602B0003CA03C32F +:10260000E9461300002221004846FEF791FF2B0007 +:102610004A4603CA03C306980799FEF723FA4346BE +:102620002A0003CA03C343465968089A424B4B40E9 +:102630009A4250D13E4B08933E4B0993082208A979 +:102640000EA810F028FC04AB98462A0003CA03C366 +:1026500008220EA9180010F01EFC384B0393082224 +:10266000414608A810F017FC0999089A324B4B40D4 +:102670009A4232D1082206A908A810F00CFC099948 +:10268000089A2D4B4B409A4229D1069A049B9A42B4 +:1026900027D0079A059B9A4226D0069A049B9A4215 +:1026A00003D0039A264B9A4224D0039A244B9A4291 +:1026B00000D076E72000FEF7D1FD061E00D070E7BF +:1026C00000212000FEF7A6FD061E00D069E70123C9 +:1026D0009C46E2444AE7FEF75BF9FEF759F9FEF73C +:1026E00057F9184B0393D4E7039AC5231B011343EF +:1026F0000393D2E7FEF74CF95555AAAA690F690F63 +:10270000C0090008C0E90008C0790008C0590108E4 +:10271000A8380110343B011018380110530800008C +:1027200058080000E4380110F4380110B90800001E +:10273000AAAA555596F096F03C5AC3A5C3A5000029 +:102740005A3C00000A30000010B5002804D078225E +:10275000002110F055FB10BD02487822002110F036 +:102760004FFBF8E748070008F0B5C64600B586B04D +:102770000400884604AD1A4F04971A4E6E60030099 +:102780002A0003CA03C30020FFF7DEFF012102A8CD +:10279000FEF708F904976E6023002A0003CA03C3FA +:1027A0006E46114942463000FFF750FE230006CE28 +:1027B00006C302980399FEF755F92B00220003CABD +:1027C00003C36968049A094B4B409A4206D1FEF74D +:1027D0009FF9200006B080BCB846F0BDFEF7D8F8DF +:1027E0005555AAAA690F690F480700083C5AC3A5A6 +:1027F00010B582B00023019300280CD0012805D128 +:1028000001304000FF2807D9FF2005E000280DD146 +:1028100002304000F6E70120C0B201A902F052F8F0 +:10282000002805D00124200002B010BDFF20F3E7EE +:102830000198FDF7ECFE0400019802F079F8F2E748 +:1028400010B584B00400002303930522002101A8E1 +:1028500010F0D6FA002C0CD0012C05D10134600008 +:10286000FF2807D9FF2005E0002C0DD102346000BD +:10287000F6E70120C0B203A902F024F8002805D031 +:102880000124200004B010BDFF20F3E7039801A944 +:1028900000F0B2FD041E0CD101ABDB78032B03D09A +:1028A000039802F045F8ECE70398FDF730FF0400C9 +:1028B000F6E70124F4E770B50500836D9E680020FB +:1028C00001E001391800002906DB6B6ACC001B19F6 +:1028D0005B68C3189E42F4D20131116070BD0000E4 +:1028E0000FB400B583B004AA02CA0192044B1B685E +:1028F000D8680FF067FE03B008BC04B01847C046A4 +:1029000014030008F0B5CE46474680B589B00400F0 +:10291000884617001E00002307930693059305229F +:10292000002103A810F06CFA796AE4000B590868DA +:102930001B1A99467A6F80239B009A4200D91A008D +:10294000BC6A013CE300CB185B689A423DD8434621 +:102950004B44E4000959091A8B4239D943469C1A61 +:102960003368012B36D00023B37107A9012001F091 +:10297000A9FF002834D106A9022001F0A3FF0028F6 +:1029800034D105A9032001F09DFF002834D133790B +:10299000012B37D03379022B00D196E03379032B0A +:1029A00000D1CFE0079801F0C3FF069801F0C0FF07 +:1029B000059801F0BDFF09B0C0BCB946B046F0BDF6 +:1029C000013CE5004D196D685B199A42F8D8BEE7E5 +:1029D0004446C5E7444501D00123C5E70023C3E7CA +:1029E000AC4BAD4AAD48AE490FF054FCA94BAA4AD6 +:1029F000AA48AC490FF04EFCA64BA74AA748AA49E3 +:102A00000FF048FC059882680021FFF753FB00286F +:102A10001AD13368012B1DD0059A06990194002321 +:102A200000934B463800FFF749FB002847D131009F +:102A3000380000F0AFFC022333710028AAD09B4A73 +:102A4000136801331360A5E7924B934A9348984962 +:102A50000FF020FC05993200380000F0ABFE002892 +:102A60001BD1B379002BD7D10799380000F04CFE69 +:102A7000002818D107993200380000F09BFE00288A +:102A800017D10599380000F03FFE0028C4D0814BD3 +:102A9000814A824887490FF0FDFB7E4B7E4A7F4882 +:102AA00085490FF0F7FB7B4B7B4A7C4883490FF04D +:102AB000F1FB784B784A794881490FF0EBFB754B75 +:102AC000754A76487F490FF0E5FB0698424649462D +:102AD000FFF7F0FA00281DD1069A079901944B469A +:102AE00000933800FFF7EAFA002819D13368012B68 +:102AF00002D1B379002B19D03100380000F04AFC24 +:102B000003233371002800D148E7684A1368013372 +:102B1000136043E75F4B604A60486B490FF0BAFBB4 +:102B20005C4B5D4A5D4869490FF0B4FB069938007B +:102B300000F0EAFD0028DFD0564B574A5748644959 +:102B40000FF0A8FB079842464946FFF7B3FA002862 +:102B500069D1079A059901944B46009300233800E8 +:102B6000FFF7ACFA002865D1B379002B32D0059875 +:102B700000F0D3FB0300786F079A0599400001909D +:102B80004C4400943800FFF799FA002803D0474AD4 +:102B9000136801331360059803A900F02DFC002889 +:102BA0004ED103ABDB78012B50D003AB5978012910 +:102BB00005D007980022FDF7B5FD002851D1B16876 +:102BC0000798FDF72EFD002851D1079800F0D0FBA3 +:102BD000002852D1B4790023B3713100380000F0DD +:102BE000D9FB33680133336001233371002803D0EC +:102BF0002E4A136801331360002C00D1D2E60599E8 +:102C0000380000F081FD00283DD10699380000F021 +:102C10007BFD002800D1C5E61E4B1F4AC4211F487A +:102C200089000FF037FB1B4B1B4AB3211B4889005F +:102C30000FF030FB174B184A184826490FF02AFBB3 +:102C4000144B154A154824490FF024FB0798FDF74B +:102C50005EFD0028A9D00F4B0F4A10481F490FF006 +:102C600019FB0C4B0C4A0D481D490FF013FB094B87 +:102C7000094A0A481B490FF00DFB064B064A074854 +:102C800019490FF007FB034B034A044817490FF09B +:102C900001FBC046A83801103C3D01104C3B01101F +:102CA0007F0200008302000086020000C05C010871 +:102CB0008B020000A7020000930200009B020000AC +:102CC0009E020000AE020000B7020000BB0200003E +:102CD000C2020000D3020000DF020000E302000095 +:102CE000E9020000ED020000F70200000D03000001 +:102CF000F0B583B00D0017001E0000230193002ED5 +:102D000004D03379022B11D0032B13D0002001F013 +:102D100067FFC0B201A901F0D5FD041E1FD0012438 +:102D2000019801F005FE200003B0F0BD0129EDD1AE +:102D30000221EBE700290CD1836D9B683268534375 +:102D4000C168826B914206D8521A9A4205D3022179 +:102D5000DCE70221DAE70221D8E70121D6E7019872 +:102D600020233A00002101F005FE002826DB002E7A +:102D7000D6D03A68134B9A42D2D03379012BCFD0B8 +:102D8000019801F0D5FD2900002001F029FFC0B213 +:102D900001A901F097FD041E01D00124C0E70198AC +:102DA00020233A00002101F0E5FD002808DB3A6805 +:102DB000044B9A42B4D001246442B1E70124AFE746 +:102DC0000124ADE73DB8F396F0B5DE4657464E46D2 +:102DD0004546E0B583B0836A0193436D9C46002B62 +:102DE00011D0E0231B01019A9A4212D89C4510D8B9 +:102DF000836D9B689A460025002400210023984695 +:102E00009946002220E032480021FFF769FD0020AA +:102E100003E03048FFF764FD002003B0F0BCBB4680 +:102E2000B246A946A046F0BD466ACF00BB465E4406 +:102E300076689B19066DE700BB465E44766892197A +:102E400001310134934227D0019EB14201D3644540 +:102E500031D29342E8D00FD2466ACF00BB465E44DF +:102E600076689B19022D02D001310125EAE71A4844 +:102E7000FFF736FD0020D0E7066DE700BB465E4455 +:102E800076689219012D02D001340225DAE7124842 +:102E9000FFF726FD0020C0E799449044534505D82C +:102EA000524503D8002500220023CDE70B48FFF749 +:102EB00017FD0020B1E7B14203D1644501D1C145FE +:102EC00004D00748FFF70CFD0020A6E70120A4E787 +:102ED000983B0110C03B0110F43B0110303C011045 +:102EE0006C3C011070B586B00522002104A80FF0DB +:102EF00087FF0522002102A80FF082FF02A901200E +:102F0000FDF7E3FB002829D104A90320FDF7DDFB31 +:102F1000051E2AD102AB1B78012B2FD0032B2BD0FF +:102F2000374A02A94B788C78CE78364936480196D4 +:102F30000094FFF7D5FC04AB1B78012B22D0032BA8 +:102F40001ED02F4A04A94B788C78CE782F492E4872 +:102F500001960094FFF7C4FC00241FE02C4B2D4A7F +:102F6000E3212D4849000FF095F9294B294AE52125 +:102F7000294849000FF08EF9284AD2E7284AD0E7BD +:102F8000264ADFE7264ADDE7264900E026492748AA +:102F9000FFF7A6FC30E02649F9E70134032C28D8D6 +:102FA000244BA200D05C02AB1978FDF75BFB002834 +:102FB000F3D0204BA2009B18587804AB1978FDF78A +:102FC00051FB0028E9D01B4BA2009B189B78042BD7 +:102FD00003D002AA92789342DFD1164BA4001B19AA +:102FE000DD78002DD2D0012DD5D0022DCCD01249C4 +:102FF000CDE71248FFF774FC280006B070BDC0464C +:1030000028360110C03C0110DC360110D03C011004 +:10301000A8380110503D01104C3B0110343601100E +:103020002C360110B03C0110A83C0110D83C011016 +:10303000A03C0110643D01104C360110F03C011021 +:10304000F0B5C64600B582B0060088461500204897 +:10305000FFF746FC002400230020002101E001319D +:103060000130AB4201D3A34204D2726ACF00D2191D +:1030700052689B18AC4201D3A34204D9326DC700F9 +:10308000D2195268A418AB42E9D3AC42E7D3A342A9 +:10309000E5D1022342465371002402E0019901392F +:1030A000013400290FDB01AA3000FFF704FC010006 +:1030B00043461B68013BA342F0D8019843463200C7 +:1030C000FFF720FCEAE702B080BCB846F0BDC0467E +:1030D0000C3D01100FB400B583B004AA02CA0192DE +:1030E000044B1B68D8680FF06DFA03B008BC04B03D +:1030F0001847C04614030008F0B5DE4657464E4652 +:103100004546E0B585B0060092460023039302AA27 +:10311000D37003A9072001F0D5FB0190002800D04F +:1031200078E03378032B15D0E0231B0198460398F1 +:1031300001F090FD04008146300000F0EEF8070039 +:1031400000940024002501235B429B463300464641 +:10315000984613E0023B9846E9E7039801F0E8FB44 +:1031600001235B42019340E0002D06D05B46013312 +:1031700003D1A34601E0009301250134A64215D9ED +:1031800043461878E119012302AA033200F066FDD4 +:103190000028E2DB02AB03331B784B45E4D0002D63 +:1031A000E9D05A46002A28DC0093E6E70025002DE6 +:1031B00025D15B46013315D051460831002000F07F +:1031C0008DFA00281FDB009B0133DBB2032B02D9F1 +:1031D00001239C46E344022251464A715246594615 +:1031E00011601371039801F0A3FB019805B0F0BCC6 +:1031F000BB46B246A946A046F0BD0093D7E70748B4 +:10320000FFF768FFD5E7039801F092FB01235B42CB +:103210000193EAE701235B420193E6E7743D011065 +:103220000368013B594308007047012800D17047EB +:103230000220FCE70FB400B583B004AA02CA0192D1 +:10324000044B1B68D8680FF0BDF903B008BC04B08C +:103250001847C0461403000810B5054910220FF0A6 +:10326000C1FD002801D0022010BD0120FCE7C046AE +:103270009037011070B584B004000E0010220021B8 +:1032800068460FF0BDFD002C2CD10CD0012C05D1CF +:1032900001346400FF2C07D9FF2405E0002C0DD178 +:1032A00002346400F6E70124E4B23100200001F0AA +:1032B00009FB051E04D0280004B070BDFF24F3E70D +:1032C00010236A460949200000F0C8FC051E05D1FC +:1032D0000749102268460FF085FD0500306801F0AF +:1032E00027FBE8E701256D42E5E7C04684110000B1 +:1032F00090370110004870478311000010B5FFF7A8 +:10330000F9FF013810BD10B5FFF7F8FF013810BD07 +:1033100010B5FFF7F8FF043810BD0020704700001B +:10332000F8B504000D0017001E00FFF7E7FFA842E4 +:1033300002D12378012B08D0207833003A002900ED +:1033400000F020FC00280DD1F8BD012EF4D12000A2 +:1033500000F0E8FC0028EFD00448FFF76BFF0120E5 +:103360004042F1E701204042EEE7C0469C3D01109B +:1033700010B50078054A1023054900F003FC002829 +:1033800000D110BD01204042FBE7C046903701103C +:103390008411000030B583B00C00002301930B684A +:1033A000002B27D08B79002B0CD0032001A901F032 +:1033B00089FA002808D00124019801F0B9FA200008 +:1033C00003B030BD0120F1E70198FFF7A6FF05002B +:1033D00001212000FFF724FF291823796A460332D0 +:1033E0001370019B1878012300F0CCFB041EE3D07E +:1033F0000124E1E70124E2E7F0B5DE4657464E46F8 +:103400004546E0B589B004000D001022002104A853 +:103410000FF0F6FC002302AAD371029302A9072041 +:1034200001F050FA002800D03AE12078102304AAD5 +:10343000A94900F013FC002800DA34E10023002B36 +:1034400012D000239B469A460298102204A9FDF749 +:103450002DF900286ED003232B705B46002B3CD146 +:103460000027002399466CE02178002B0CD0012B1B +:1034700005D15A1C5200FF2A07D9FF2205E0002B74 +:1034800011D19A1C5200F6E70122D2B291421AD011 +:10349000002B10D0012B08D15A1C52000132FF2AF8 +:1034A0000AD9FF2208E0FF22EFE7002B09D15A1CBE +:1034B00052000332F3E70222D2B2914208D0013324 +:1034C000BDE7FF22F8E700239B4601339A46BBE79E +:1034D00001239B4600239A46B6E7A3681022524276 +:1034E00091469944102304AA4946200001F042FA6B +:1034F000061E00D0DAE0102204A92000FDF7D6F85D +:10350000002803D003232B7000271AE004A8FFF73C +:10351000A3FEC0B22870012804D0002E00DAC8E053 +:1035200001270EE02078102304AA6B4900F02AFB43 +:103530000600F2E704A8FFF78FFE2870002700239B +:1035400099462000FFF7DFFE01002078012302AA40 +:10355000073200F083FB002800DAADE00298012278 +:1035600002ABD91DFDF7A2F8002802D16B78042B1D +:1035700058D901236B7000232B712000FFF7BEFE8A +:1035800001002078AE1C0123320000F067FB002808 +:1035900000DA94E0029801223100FDF787F8002854 +:1035A00049D00323AB702000FFF7A4FE0100019077 +:1035B0002078EB1C98460123424600F04FFB061E84 +:1035C00000DA7FE0029801224146FDF76FF80028FB +:1035D00049D00323EB70AB78013B5A425341DBB235 +:1035E0002278032A05D05A46002A04D15246002ADE +:1035F0004CD0002B3BD0A3681822524291469944EC +:10360000012342464946200001F0B4F9061E5CD170 +:10361000012241462000FDF749F8002810D003237D +:10362000EB7024E002AB07331B780F221A406A705C +:103630001B092B71A1E7A878FFF7F7FDA870B2E787 +:10364000E878FFF7F2FDC0B2E870022803D1002E3F +:103650003EDB00270BE0207801234246019900F071 +:1036600091FA0600F3E7E878FFF7DFFDE870002F36 +:1036700004D02378032B01D0002E0AD0300009B0EB +:10368000F0BCBB46B246A946A046F0BD0126764234 +:10369000EDE710224946200001F022FA0600EDE78E +:1036A00001267642EAE701267642E7E701267642DE +:1036B000E4E701267642E1E701267642DEE70126CD +:1036C0007642DBE701267642D8E701267642D5E747 +:1036D00001267642D2E7C0468411000030B583B09F +:1036E0000C0001A9FFF7C6FD002801D003B030BDD2 +:1036F000019D2800FFF70CFE01002878042322001A +:1037000000F0ACFAF2E7000030B583B00C000978A5 +:103710002748FFF78FFD0023019301A9072001F03F +:10372000D1F8002831D12378032B11D0002101F0EA +:1037300057FA00282CDBC5B20121002001F050FA15 +:10374000002828DBC0B22378AB4201D0834225D1C8 +:10375000207800F0FBF9011E23DB902201989201F2 +:1037600001F0BEF9051E1FD12378032B05D1019866 +:1037700001F0DEF8280003B030BDA16840394022D6 +:10378000200001F0ADF90500F1E701256D42F1E7F8 +:1037900001256D42EEE701256D42EBE701256D4203 +:1037A000E8E701256D42E5E701256D42E2E7C04605 +:1037B000B83D011030B583B00C0015000522002182 +:1037C00068460FF01DFB69460220FCF77EFF0028CB +:1037D00013D1E979012916D16B46DB78012B1ED074 +:1037E000A9682000FCF71DFF002824D12000FFF766 +:1037F000BFFD002826D103B030BD154B154A164831 +:1038000016490EF047FD00222000FCF78BFF002830 +:10381000E2D00F4B0F4A104811490EF03BFD20003B +:10382000FCF775FF0028DBD0094B0A4A9F210A48A4 +:1038300089000EF02FFD064B064AA021064889009C +:103840000EF028FD024B034A034806490EF022FD04 +:10385000DC3D0110343E0110E43D01107302000014 +:10386000770200008B020000F0B585B006000D0065 +:103870000023039302936A46D371FFF733FB041EC0 +:10388000E8603BD002283CD001283CD1032703A9A3 +:10389000380001F017F8002838D102A9073001F0EC +:1038A00011F8002835D103982A003100FFF724FCD5 +:1038B000041E1DD10398FFF726FD010001236A466F +:1038C0000732380000F0CAF9061E25DB02980122F3 +:1038D0006B46D91DFCF7EAFE002803D06B46012297 +:1038E000DA7126006B46DA790F231340EB7134004E +:1038F000039801F01DF8029801F01AF8200005B0B5 +:10390000F0BD0127C3E701246442F7E701246442C4 +:10391000F4E701246442F1E701246442EEE7000089 +:10392000F0B5DE4657464E464546E0B587B0804680 +:103930000091914603930023059305A9072000F009 +:10394000C1FF051E00D093E000260023019300274D +:103950009B46029319E04948494BC35C1B06FF2272 +:103960005200825C12041343FE22FF32825C120278 +:1039700013430831425C13439A46FCF7E9FF504574 +:103980002AD001239C46E3440136012E3FD8F4009F +:10399000A419640244448023384A05989B002100FE +:1039A00000F0E8FF051E66D1344AF823FF33D35CEC +:1039B0001B06FB214900515C09040B43F621FF3132 +:1039C000515C09020B43FA214900525C13432D4A12 +:1039D0009342C0D00137D7E7284AFC23FF33D35C9A +:1039E0001B06FD214900515C09040B43FA21FF31FC +:1039F000515C09020B43FC214900525C1343019ABC +:103A00009A42C1D8039A166001930294BCE7022F30 +:103A10000FD05B46022B1CD101256D42059800F0AA +:103A200087FF280007B0F0BCBB46B246A946A046B7 +:103A3000F0BD0123039A136000234A4613600598E2 +:103A400001F008F90100FA22520000980FF0D8F9AD +:103A5000E4E74B46019A1A60FA2305985B00009A46 +:103A6000029900F087FF051ED8D001256D42D5E7E9 +:103A700001256D42D5E701256D42D2E7C45C0108FE +:103A8000FF010000EFBEADDEF0B5CE46474680B583 +:103A900083B006000D009846531C99460020019003 +:103AA00001A9073000F00EFF002836D11E4CFA277E +:103AB0007F003A00414620000FF0EDF9FC235B0047 +:103AC0004A46E250194B1B68E35108373900200081 +:103AD000FCF73EFFE051012D1DD00135EC006419CB +:103AE0006402A419802201989200210000F0F8FFDE +:103AF000002815D180230C4A01989B00210000F07A +:103B000095FF0400019800F013FF200003B0C0BC33 +:103B1000B946B046F0BD0025E0E701246442F4E771 +:103B200001246442F1E7C046C45C0108483E01102C +:103B300010B5054910220FF055F9002801D00220D8 +:103B400010BD0120FCE7C0469037011082B0020092 +:103B500001AB0121197001315970013199700023B5 +:103B6000002004E0902189018C4660440133022B3F +:103B700004D801A9C95C9142F4D101E0012040427E +:103B800002B07047F0B5CE46474680B583B0060018 +:103B90000F0090461C00002301930093FA21490076 +:103BA00038000EF02DFA0D00FB43A34242D33B191F +:103BB000284A934241D83000FFF7C8FF061E3FDB7A +:103BC000FA21490038000EF095F940023618002716 +:103BD0000120404203E0220010E000240025002CD8 +:103BE00033D01D4901AB6A463000FFF799FE00282B +:103BF00029DBFA235B009C42EDD95A1B164B9946F0 +:103C0000280048444346D9190FF045F9009A019914 +:103C10004B463000FFF738FF002816D1FA235B002F +:103C20009C42DAD3F53CFF3C0C339C466644F537A6 +:103C3000FF37D3E70120404207E00120404204E083 +:103C40000120404201E00120404203B0C0BCB9461F +:103C5000B046F0BD94110000C45E0108F0B5CE4638 +:103C6000474680B583B007000D0091461C00002335 +:103C700001930093FA21490028000EF0C1F90E00CB +:103C8000EB43A34239D32B19244A934238D8380046 +:103C9000FFF75CFF071E36DBFA21490028000EF013 +:103CA00029F940023F1800239846002515E022001C +:103CB000484640441A4971180FF0EDF8FA235B00AA +:103CC0009C4208D3F53CFF3C0C339C4667440C3BBC +:103CD0009C46E04400E000240026002C18D0104947 +:103CE00001AB6A463800FFF71BFE051E0EDBFA2308 +:103CF0005B009C42DBD99A1BDAE701256D4207E0A5 +:103D000001256D4204E001256D4201E001256D426F +:103D1000280003B0C0BCB946B046F0BD9411000005 +:103D2000C45E0108F0B5CE46474680B5764CA54442 +:103D300006000023829382A9072000F0C3FD00281B +:103D400006D08B239B009D44C0BCB946B046F0BD55 +:103D5000829800F07FFF01900700829800F0E8FD54 +:103D60001722002184A80FF04BF834783000FFF7B9 +:103D7000CFFA0100172384AA2000FFF76FFF002865 +:103D8000DFD1624802AB9C466044FFF7D1FE0128B8 +:103D900000D0B0E00020FCF735FC0500300000F05A +:103DA000F9FE80239B00984200D91800431E802210 +:103DB0009200934200D3A1E0040000E02418AC423A +:103DC000FCD380239B009C4200D99AE0B168091B78 +:103DD0002200300000F084FE0028B2D1300000F054 +:103DE00039FF81464A4B02AA944663441870601B0F +:103DF00060442A0049460FF003F810235B429846BE +:103E0000A044B94509D010220199404802AB9C4614 +:103E10006044FCF737FC002846D1404602AB9C4684 +:103E200060441022394961440FF035F82200183AF5 +:103E3000374B02A98C4663441B78BB423FD084A910 +:103E40008979B94240D033496144097802A8815444 +:103E500001212200203A8154083ABB4239D084A97A +:103E60000979B94237D085A9097802A8815430224E +:103E700052429046A044BB4206D03432019984A8F5 +:103E8000FCF700FC00282BD1404602AB9C46604466 +:103E9000042284A90EF0FFFFB168091B230002AAC7 +:103EA000300000F0C3FD4CE7404602AB9C46604446 +:103EB000174B6344197810220EF0A2FFB6E715499C +:103EC00002A884466144C0E7114902A884466144BF +:103ED000BBE785A9C8E70E4902A884466144C3E749 +:103EE000404602AB9C466044094B63441978042267 +:103EF0000EF086FFD0E70120404222E70120404239 +:103F00001FE7012040421CE7D4FDFFFF0F02000025 +:103F1000070200000E020000F0B5D6464F464646A6 +:103F2000C0B582B004000D00170099460AAA1378A4 +:103F30009A46002844D0002946D0002F48D00E8948 +:103F4000CB68F618042301AA3100380000F012FDF6 +:103F50008046002840D101AB1A88274B9A421FD0D7 +:103F60006B89002B40D101AB1A88244B9A423FD178 +:103F7000256067604B4623815346A3726B899B196A +:103F8000E3606B899B1901AA52889B186361043610 +:103F90002661404602B0E0BCBA46B146A846F0BD34 +:103FA0006B8901AA51888B421AD1891904233800E0 +:103FB00000F0E0FC0028D6D001235B429846E8E7F9 +:103FC00001235B429846E4E701235B429846E0E721 +:103FD00001235B429846DCE701235B429846D8E721 +:103FE00001235B429846D4E701235B429846D0E721 +:103FF00001235B429846CCE708690000076900008E +:10400000F0B583B004000F0015001E00002849D051 +:104010000368002B4AD04368002B4AD000294BD0BC +:10402000002A1FD1012040423EE02169606804233C +:1040300001AA00F09FFC002841D1A37A002B03D0F5 +:104040002269E3689A423DD223891F4A934217D0DE +:1040500001AA1288934213D001AB58882369C01873 +:104060000430206123696269934219D2226852891F +:10407000002ADAD0E2689A42D7D104332361D4E728 +:10408000002E02D001AB1B883380236904333B60D0 +:1040900001AB5B882B8022699B180433236103E00A +:1040A000012001E00120404203B0F0BD0120404268 +:1040B000FAE701204042F7E701204042F4E70120FF +:1040C0004042F1E70120EFE7FFFF000070B50D006F +:1040D0001600002902D00020002406E00024200061 +:1040E00070BD0028FBD101350134B442F7DA002855 +:1040F000F7D12978014807F0C3FDF2E7B86001085D +:1041000070B50C001600002914D0002503E000282B +:1041100011D1B5420FDA09480022210007F084FDD1 +:104120000028F4D1013523780A2B04D00D2B02D0BE +:104130000134ECE70025280070BDC046B8600108D6 +:10414000F0B5C64600B58AB007009446984605AD5E +:104150000E4C2E000DCC0DC609CC09C60C4802959C +:10416000002401944346009363460A00390007F097 +:10417000D1FD002803D00AB080BCB846F0BD044889 +:104180000022109907F074FBF5E7C046B83E011015 +:10419000B860010810B5024807F086FD10BDC046A2 +:1041A000B860010810B5FA24A400002C08DDFFF760 +:1041B000F1FF002804D0012007F030F8013CF4E7BB +:1041C000002C00D101BE024807F08EFA10BDC04697 +:1041D000B8600108F0B5C64600B58C680A6884234B +:1041E000C558753B2B400825ED1A2300AC4226D953 +:1041F0002B0024E055782D0216783543D678360604 +:1042000097783F043E4335439827C55155792D0291 +:1042100016793543A846D679360695792D042E436E +:1042200045463543C551D218E41A8423C558753B19 +:104230002B400825ED1A2300AC4200D92B00002B9F +:104240004CD0082B31D89D002E4E7559AF461678AC +:1042500090254651E7E753781B0215782B439425A8 +:1042600043510223DFE753781B0215782B43D5789F +:104270002D069678360435432B4398254351042365 +:10428000D1E753781B0215782B43D5782D06967805 +:10429000360435432B439825435153791B02157936 +:1042A0002B43942543510623BDE753781B02157811 +:1042B0002B43D5782D069678360435432B43982624 +:1042C000835153791B0215792B43D5792D069779A4 +:1042D0003F043D432B4383510823A4E70A608C60CD +:1042E000002C0CD1F924E40003590122934303511B +:1042F0008A61CB69002B02D0CB690120984780BC32 +:10430000B846F0BDCC3E0110F8B50E004C69CB6844 +:10431000C42282580F21114022008C421CD90A006D +:104320001AE0D825415919700F0A5F700F0C9F7061 +:10433000090ED970415919710D0A5D710D0C9D71ED +:10434000090ED9719B18A41AC42282580F25154052 +:104350002200AC4200D92A00002A63D0082A4ED895 +:1043600095003A4949598F46D02141581970E9E7DB +:10437000D42141581970090A5970E3E7D4214158F2 +:104380001970090A5970D02141589970DAE7D8217B +:10439000415819700D0A5D700D0C9D70090ED97091 +:1043A000D0E7D821415819700D0A5D700D0C9D7031 +:1043B000090ED970D02141581971C3E7D82141584D +:1043C00019700D0A5D700D0C9D70090ED970D42105 +:1043D00041581971090A5971B4E7D8214158197027 +:1043E0000D0A5D700D0C9D70090ED970D4214158D5 +:1043F0001971090A5971D02141589971A2E7D82140 +:1044000042581A70150A5D70150C9D70120EDA7004 +:1044100042581A71110A5971110C9971120EDA7100 +:1044200008228FE7F3607461002C0DD1F922D200CD +:10443000835802218B4383500323B361336A002BDB +:1044400002D0336A032098477461F8BDF03E011032 +:1044500010B5264A264BD358DA070DD49A0716D43E +:104460005A071FD5234B05229A61204AF823DB0007 +:104470000421D150D35809E01E491C4C2000FFF7FD +:10448000A9FEF823DB000122E250E35810BD1949D0 +:10449000164C2000FFF738FFF823DB000222E25021 +:1044A000E358F3E71A0709D5124B06229A610F4A1F +:1044B000F823DB000821D150D358E7E7DA0609D505 +:1044C0000C4B07229A61094AF823DB001021D150D6 +:1044D000D358DBE79B06D9D5064B08229A61034ADD +:1044E000F823DB002021D150D358CFE70000424011 +:1044F000CC0700007462010810B5314A314C032129 +:10450000200008F09BF811220321200007F096FFFD +:104510002D4A0421200008F091F8112204212000E6 +:1045200007F08CFF294A0521200008F087F81122A6 +:104530000521200007F082FF254A0621200008F00F +:104540007DF811220621200007F078FF214A07217B +:10455000200008F073F811220721200007F06EFFF9 +:10456000002102200BF04EFA012102200BF07AFA12 +:1045700002200BF001FA184918480CF021F9184BE9 +:10458000FA2218499200184809F0B6F9041E01D021 +:10459000200010BD1249FA20800009F0EBFD0F4BFE +:1045A00000229B5E002B06DB1F2213401E3A9A401E +:1045B00013000E4A13600A490B4809F04FFBE7E766 +:1045C000B03F0110800531407C3F0110483F011091 +:1045D000143F0110E43F011051440010D8010008BD +:1045E00074620108184001100000424000E100E040 +:1045F000024B1B685B688000C0587047306301083D +:10460000004870470000424000487047746201084B +:1046100010B50400FFF770FF002800D010BD044B58 +:104620001C60044A2100044809F0B2FBF6E7C046CA +:1046300030630108746201080000424070B5234BEA +:104640005B6803282ED009D8012810D0022803D196 +:104650001B6802221A700DE01D4C06E0042803D1ED +:104660001B6808221A7005E0194C200070BD1B68F9 +:1046700001221A700138174B420011188900CC58DA +:104680001118890059184D680E7A134A16722900BC +:10469000200007F0D3FF32002900200007F0CEFEF3 +:1046A0000A2507E01B6804221A70E3E7002CDCD01F +:1046B000002DDAD00548FFF7ABFF0400013D0028CC +:1046C000F4D0FA2040000CF00FF9EFE7C801000821 +:1046D0000400B2002C400110F8000008024B5B6897 +:1046E0001B689B6998697047C801000870B5040091 +:1046F0001D4D280009F020FC2B685B005B082B6037 +:1047000002200BF063F9194B00229B5E002B0BDBA0 +:104710001F2213401E3A9A401300154980228B50E5 +:10472000BFF34F8FBFF36F8F104B59880020185E77 +:104730000BF0E2FF013C0F4A600000198000805836 +:1047400007F052FE0C4C200007F04EFE200007F050 +:104750004BFE200007F048FE200007F045FE200039 +:1047600007F042FE70BDC04600004240D80100087C +:1047700000E100E02C400110800531407F2807D087 +:1047800040B2002801DB00207047C0204005FBE755 +:1047900080204005F8E780208000704700207047A7 +:1047A00000207047704770B58A18490A4D02540AB4 +:1047B0006402A54210D0641B640A01235B42002CF2 +:1047C00008D0013C6002401907F094FD0023002846 +:1047D000F5D00123180070BD280007F08BFD0028DC +:1047E00001D00123F6E70023F4E7F8B50D00141E0D +:1047F00016D0DA0516D1CA05D60D002A14D15F0AE3 +:104800000120BE420DD22100280007F0ADFD002896 +:104810000CD180239B009C46654464440136F0E73C +:104820000120F8BD0720FCE70720FAE70120F8E7A0 +:1048300010B514001A0020000EF02DFB844201D1A7 +:10484000002010BD01204042FBE7000010B500220F +:1048500000E00132064B9400E358002B05D01C7891 +:104860008442F6D10B60002001E00120404210BDDF +:104870009C00000810B50C1E14D07F2810D043B245 +:10488000002B07DA0A4B002B0FD0DB69984720601A +:10489000002010BD074B084A084856210DF0FAFCCD +:1048A000074BF0E701204042F3E701204042F0E7E8 +:1048B000044101107C400110F040011084400110BF +:1048C0005C40011010B5002901D000220CE001204D +:1048D000404220E0104B114A114856210DF0DAFCFD +:1048E000104C002C11D101320F4B9400E358002BD7 +:1048F0000FD01C788442F6D10B605B787F2BEFD011 +:104900005CB2002CE6DA094CEBE72268180090470D +:1049100001E00120404210BD7C400110F040011038 +:10492000844001105C4001109C000008044101100B +:1049300010B500280AD040787F280ED043B2002B53 +:1049400005DA074B002B01D05B68984710BD054B7B +:10495000054A064856210DF09DFC054BF2E7C0467E +:10496000044101107C400110F0400110844001100E +:104970005C400110F0B583B004000D0016001F006C +:1049800000230193002844D083688B4207D3BB42A5 +:104990001FD3CA1993421ED30120404200E00720D2 +:1049A00063787F2B1FD05AB2002A16DA1A4A002ADF +:1049B0000DD001A91800FFF75DFF002807D101996C +:1049C000002904D06368C918491900290DD103B022 +:1049D000F0BD0720E4E70720E2E7104B104A11483A +:1049E00056210DF057FC104AE1E760787F280ED081 +:1049F00043B2002B05DA084B9C683B003200A0470D +:104A0000E5E7064B064A074856210DF043FC064BE6 +:104A1000F2E701204042DAE7044101107C40011036 +:104A2000F0400110844001105C400110F0B583B0EB +:104A300004000D0017001E0000230193002841D040 +:104A400083688B4206D3B34228D38A19934227D373 +:104A5000012000E0072063787F2B29D05AB2002A7A +:104A600020DA1A4A002A2ED001A91800FFF702FF07 +:104A7000002828D10199002925D06368C91849194F +:104A8000002920D060787F281AD043B2002B11DA99 +:104A90000E4BDC6833003A00A04714E00720DAE749 +:104AA0000720D8E70A4B0B4A0B4856210DF0F2FBC2 +:104AB0000A4AD7E7064B074A074856210DF0EAFB9A +:104AC000064BE6E7012003B0F0BDC04604410110EB +:104AD0007C400110F0400110844001105C40011046 +:104AE00070B582B004000D00160000230193002869 +:104AF00043D083688B4207D393421FD38A189342D3 +:104B00001ED30120404200E0072063787F2B1FD096 +:104B10005AB2002A16DA1A4A002A0DD001A9180042 +:104B2000FFF7A8FE002807D10199002904D0636887 +:104B3000C918491900290DD102B070BD0720E4E75A +:104B40000720E2E70F4B104A104856210DF0A2FB58 +:104B50000F4AE1E760787F280DD043B2002B04DADA +:104B6000074B1B6932009847E6E7064B064A0748A1 +:104B700056210DF08FFB064BF3E701204042DBE7A7 +:104B8000044101107C400110F040011084400110EC +:104B90005C40011010B5002813D040787F280ED05B +:104BA00043B2002B05DA094B002B0CD09B699847C8 +:104BB00008E0074B074A084856210DF06BFB074BEE +:104BC000F2E7002010BD0020FCE7C04604410110C0 +:104BD0007C400110F0400110844001105C40011045 +:104BE000002832D101291AD0022931D0002902D05F +:104BF00001204042704700280CD0012805D1013027 +:104C00004000FF2807D9FF2005E0002805D1023029 +:104C10004000F6E70120C0B2ECE7FF20FBE70028E8 +:104C20000ED0012806D1013040000130FF2808D9FC +:104C3000FF2006E0002806D1013040000330F5E7F0 +:104C40000220C0B2D6E7FF20FBE701204042D1E7B7 +:104C50000320CFE710B5002813D040787F280ED06E +:104C600043B2002B05DA094B002B0CD05B69984747 +:104C700010BD074B074A084856210DF00BFB074BA8 +:104C8000F2E70020F4E70020F2E7C04604410110FB +:104C90007C400110F0400110844001105C40011084 +:104CA000F0B5D6464F464646C0B582B089469046D6 +:104CB0000023019301A9FFF7C9FD8246019B002B48 +:104CC00051D04A46002A52D04246002A53D00028EA +:104CD00055D158787F281DD043B2002B14DA2E4BC3 +:104CE000002B50D09B6998470700019DAC680019C4 +:104CF000013839000DF0FEF8E0231B01984200D97D +:104D00007F006D68002614E0244B254A2548562173 +:104D10000DF0C0FA244BE3E73900A14200D921008D +:104D2000F300434459601D606D18A1420BD8641A0A +:104D30000136002C0AD0390028000DF061F9002955 +:104D4000EAD0791AE9E701360024F2E74B461B68FE +:104D5000B3421CD34B461E60504602B0E0BCBA467C +:104D6000B146A846F0BD01235B429A46F4E7012311 +:104D70005B429A46F0E701235B429A46ECE7012347 +:104D80005B429A46E8E701235B429A46E4E7012347 +:104D90005B429A46E0E7C046044101107C400110A6 +:104DA000F0400110844001105C40011040B2002826 +:104DB00001DB00207047C0204005FBE7FF20704763 +:104DC00000207047704710B5FFF788FC10BDF0B5A4 +:104DD000C64600B582B00D00141E2FD00020FFF78C +:104DE00007FC8046FFF77AFC0600E8231B069C467A +:104DF000654447422F40002001E0E41ABF19002C0F +:104E000012D0002810D1FFF7FBFB0500FFF7FCFBD9 +:104E1000009033003A004146280009F087FB230048 +:104E2000B442EAD93300E8E7002804D1002002B0F8 +:104E300080BCB846F0BD01204042F8E70120404266 +:104E4000F5E7F0B5C64600B582B00C0017001D00AE +:104E50000020FFF7CDFB0600E8231B069C466444B8 +:104E6000FFF7CEFB8046FFF7CFFB019000953B009C +:104E700022003100404609F09BFA002804D10020AE +:104E800002B080BCB846F0BD01204042F8E7F0B562 +:104E9000C64600B582B00C0017001D000020FFF7C9 +:104EA000A7FB0600E8231B069C466444FFF7A8FB0B +:104EB0008046FFF7A9FB019000953B0022003100DE +:104EC000404609F0DDF9002804D1002002B080BC82 +:104ED000B846F0BD01204042F8E770B50368CD1A2E +:104EE000002D52DD1E7800241C57002C0ADB5C1CB0 +:104EF00004601B78136013680268891A8B4253D8C8 +:104F0000002070BD7F243440032C30D011D8012CF8 +:104F100025D0022C0AD1022D3DDD5C7824029B783D +:104F200023431360036803330360E4E764204042D3 +:104F3000E7E7042C10D1042D33DD5C7824069D783E +:104F40002D042C43DD782D022C431B792343136061 +:104F5000036805330360CEE764204042D1E7012DAA +:104F600016DD5B781360036802330360C3E7032D2B +:104F700014DD5C7824049D782D022C43DB782343D8 +:104F80001360036804330360B5E760204042B8E76C +:104F900060204042B5E760204042B2E760204042D6 +:104FA000AFE760204042ACE760204042A9E770B51F +:104FB00004680D1B002D07DD25789D4207D10134C3 +:104FC0000460FFF78AFF70BD60204042FBE762206B +:104FD0004042F8E730B583B004001500022301AA6F +:104FE000FFF7E5FF002801D003B030BD019A21682A +:104FF000280000F0CCFD2368019A9B182360F3E79A +:1050000070B5050014000323FFF7D1FF00280AD173 +:105010002368002B08D0013B23602B681A78002AF4 +:1050200005D101332B6070BD68204042FBE768204A +:105030004042F8E7F0B5C64600B582B005008846A4 +:1050400017001E00302301AAFFF7B1FF041E2CD168 +:105050002B684246D11A002931DD1B783A0008C27C +:105060002968019B88469844062341462800FFF79B +:105070009EFF041E19D12A68BA607B68D2182A6084 +:10508000424517D01378320008C22B6801332B60D9 +:1050900041462800FFF721FF041E06D12B68B360AC +:1050A00072689B182B6043450CD1200002B080BC75 +:1050B000B846F0BD0C21300003F0A0FEF5E76024F7 +:1050C0006442F2E766246442EFE7431C013150007A +:1050D00059400840584001387047F0B5CE46474621 +:1050E00080B591465A42944600260DE0B4004A46E7 +:1050F000155967463D400C192768B8465F1E424661 +:1051000017403D43256001368642EFD3C0BCB94607 +:10511000B046F0BD020080231B0600201F2804D8E3 +:105120001A4202D15B080130F8E77047030048409B +:105130005B1A594008405840C00F7047F0B5C6464A +:1051400000B584469846002000250EE0AE00945934 +:105150008442BF417F42241A43469B599C4280416E +:105160004042C019E41A8C5101356545EED380BC2C +:10517000B846F0BDF0B5CE46474680B587B0844608 +:1051800003910292019300230593DFE103980299B2 +:10519000059A019B1F0CB9461F043F0CB84640C836 +:1051A000370C3604360C444674434B465E434D463A +:1051B0007D4343465F43330CED183B0CED18A418B8 +:1051C000002255413304E41855413B04E41855418D +:1051D0000B68E4186A4110C140C8370C3604360C1D +:1051E000444674434B465E434D467D4343465F43CE +:1051F000330CED183B0CED18A41800225541330474 +:10520000E41855413B04E41855410B68E4186A4121 +:1052100010C140C8370C3604360C444674434B4624 +:105220005E434D467D4343465F43330CED183B0CD4 +:10523000ED18A418002255413304E41855413B04ED +:10524000E41855410B68E4186A4110C140C8370C96 +:105250003604360C444674434B465E434D467D430C +:1052600043465F43330CED183B0CED18A4180022A5 +:1052700055413304E41855413B04E41855410B688B +:10528000E4186A4110C140C8370C3604360C444655 +:1052900074434B465E434D467D4343465F43330C68 +:1052A000ED183B0CED18A418002255413304E41806 +:1052B00055413B04E41855410B68E4186A4110C19C +:1052C00040C8370C3604360C444674434B465E43A4 +:1052D0004D467D4343465F43330CED183B0CED18C0 +:1052E000A418002255413304E41855413B04E41846 +:1052F00055410B68E4186A4110C140C8370C3604A8 +:10530000360C444674434B465E434D467D4343460C +:105310005F43330CED183B0CED18A41800225541E7 +:105320003304E41855413B04E41855410B68E41874 +:105330006A4110C140C8370C3604360C44467443E9 +:105340004B465E434D467D4343465F43330CED1869 +:105350003B0CED18A418002255413304E4185541C4 +:105360003B04E41855410B68E4186A4110C140C879 +:10537000370C3604360C444674434B465E434D4668 +:105380007D4343465F43330CED183B0CED18A418E6 +:10539000002255413304E41855413B04E4185541BB +:1053A0000B68E4186A4110C140C8370C3604360C4B +:1053B000444674434B465E434D467D4343465F43FC +:1053C000330CED183B0CED18A418002255413304A2 +:1053D000E41855413B04E41855410B68E4186A4150 +:1053E00010C140C8370C3604360C444674434B4653 +:1053F0005E434D467D4343465F43330CED183B0C03 +:10540000ED18A418002255413304E41855413B041B +:10541000E41855410B68E4186A4110C140C8370CC4 +:105420003604360C444674434B465E434D467D433A +:1054300043465F43330CED183B0CED18A4180022D3 +:1054400055413304E41855413B04E41855410B68B9 +:10545000E4186A4110C140C8370C3604360C444683 +:1054600074434B465E434D467D4343465F43330C96 +:10547000ED183B0CED18A418002255413304E41834 +:1054800055413B04E41855410B68E4186A4110C1CA +:1054900040C8370C3604360C444674434B465E43D2 +:1054A0004D467D4343465F43330CED183B0CED18EE +:1054B000A418002255413304E41855413B04E41874 +:1054C00055410B68E4186A4110C140C8370C3604D6 +:1054D000360C444674434B465E434D467D4343463B +:1054E0005F43330CED183B0CED18A4180022554116 +:1054F0003304E41855413B04E41855410B68E418A3 +:105500006A4110C140C8370C3604360C4446744317 +:105510004B465E434D467D4343465F43330CED1897 +:105520003B0CED18A418002255413304E4185541F2 +:105530003B04E41855410B68E4186A4110C1059218 +:105540000291039010235B429846C44463460F2B9C +:1055500000D91BE66346072B00D825E10398029982 +:10556000059A019B1F0CB9461F043F0CB84640C862 +:10557000370C3604360C444674434B465E434D4666 +:105580007D4343465F43330CED183B0CED18A418E4 +:10559000002255413304E41855413B04E4185541B9 +:1055A0000B68E4186A4110C140C8370C3604360C49 +:1055B000444674434B465E434D467D4343465F43FA +:1055C000330CED183B0CED18A418002255413304A0 +:1055D000E41855413B04E41855410B68E4186A414E +:1055E00010C140C8370C3604360C444674434B4651 +:1055F0005E434D467D4343465F43330CED183B0C01 +:10560000ED18A418002255413304E41855413B0419 +:10561000E41855410B68E4186A4110C140C8370CC2 +:105620003604360C444674434B465E434D467D4338 +:1056300043465F43330CED183B0CED18A4180022D1 +:1056400055413304E41855413B04E41855410B68B7 +:10565000E4186A4110C140C8370C3604360C444681 +:1056600074434B465E434D467D4343465F43330C94 +:10567000ED183B0CED18A418002255413304E41832 +:1056800055413B04E41855410B68E4186A4110C1C8 +:1056900040C8370C3604360C444674434B465E43D0 +:1056A0004D467D4343465F43330CED183B0CED18EC +:1056B000A418002255413304E41855413B04E41872 +:1056C00055410B68E4186A4110C140C8370C3604D4 +:1056D000360C444674434B465E434D467D43434639 +:1056E0005F43330CED183B0CED18A4180022554114 +:1056F0003304E41855413B04E41855410B68E418A1 +:105700006A4110C140C8370C3604360C4446744315 +:105710004B465E434D467D4343465F43330CED1895 +:105720003B0CED18A418002255413304E4185541F0 +:105730003B04E41855410B68E4186A4110C1059216 +:105740000291039008235B429846C44402E7039801 +:105750000299059A019B1F0CB9461F043F0CB846DD +:1057600040C8370C3604360C444674434B465E43FF +:105770004D467D4343465F43330CED183B0CED181B +:10578000A418002255413304E41855413B04E418A1 +:1057900055410B68E4186A4110C1059202910390CB +:1057A00001235B429846C4446346002BCFD10BE0F3 +:1057B00002990B689B180B60029A08CA05998B42E4 +:1057C0009B415B4205930292059A002AF0D107B0F3 +:1057D000C0BCB946B046F0BDF8B507000D001400D6 +:1057E0001E00002A10D082420ED900230800390082 +:1057F0000CF02AFC002901D001204042002E02D0EA +:1058000044432D1B3560F8BD002E02D001235B42BE +:10581000336001204042F6E710B5890003F0EEFA4C +:1058200010BD00BA7047000070B50500002911D006 +:10583000094B9C4661448C00041909E02868FFF775 +:10584000F0FF06002068FFF7ECFF01C52660043C6E +:10585000A542F3D970BDC046FFFFFF3FF0B5D64665 +:105860004F464646C0B504000D00924698468E0845 +:10587000032129404B1E99417618B30099465F1BBE +:105880004368B3421ED380683A0000210DF0B8FA95 +:10589000A0686268921B9200484400210DF0B0FAA3 +:1058A000A168C9192A004046D047051E05D0280026 +:1058B000E0BCBA46B146A846F0BDA0683100FFF78B +:1058C000B3FFF4E704256D42F1E7012303600023F1 +:1058D00043608360704710B5041E0DD080680028B7 +:1058E00005D06168FFF798FFA0680CF077FE0123F0 +:1058F000236000236360A36010BD0000F8B50600BC +:105900000C00124B99421BD845688D4201D30020F0 +:10591000F8BD042120000CF0DBFC071E13D0B16899 +:10592000002909D0AA000DF0B6FA7168B068FFF737 +:1059300073FFB0680CF052FE7460B7600020E7E7B8 +:1059400010204042E4E710204042E1E71027000029 +:1059500070B505000C1E09D043688B420AD0FFF7D2 +:10596000BAFF21002800FFF7C9FF70BDFFF7B3FFA2 +:105970000020FAE780688A0000210DF041FA012337 +:105980002B600020F1E7000070B504000D001A4BF9 +:1059900099422AD843688B4209D9013B002B09D090 +:1059A000A26898008258002A04D1013BF6E7FFF76D +:1059B000A5FF19E001339D4200D81D0004212800F5 +:1059C0000CF086FC061E13D0A168002909D0AA009D +:1059D0000DF061FA6168A068FFF71EFFA0680CF087 +:1059E000FDFD6560A660002070BD10204042FBE711 +:1059F00010204042F8E7C04610270000F8B5060026 +:105A00000D00884236D04A68002A01D0013A0DE0E4 +:105A10004268002A01D100272AE001230360806840 +:105A2000920000210DF0ECF9F5E7013A002A04D0CC +:105A3000AB689400E358002BF7D0541C2B683360FC +:105A40007268A24206D221003000FFF757FF071EFE +:105A500009D00DE0B068A300C018121B920000210D +:105A60000DF0CEF90027B068A968A2000DF013FA76 +:105A70003800F8BD0027FBE7F8B504000F005542D9 +:105A8000EDB21543ED094968FFF738FF061E01D056 +:105A90003000F8BD396820682A00FFF716FB206047 +:105AA0007868BA68A1682B00FFF717FB7A6807E0EF +:105AB000A1689300C9186B1E086803400B6001328F +:105AC00063689342F4D8E3E770B504000E00012147 +:105AD000FFF714FF051E01D0280070BDA0686268A2 +:105AE000920000210DF08CF9A368F11772184A405A +:105AF0001A60002E02DB01232360EDE701235B42E5 +:105B0000FAE743685B018B4209D982684B099B0025 +:105B10009B581F220A40D3400120184070470020A4 +:105B2000FCE730B50400002000256368AB420DD9C6 +:105B300000221F2A08D8A368A900CB58D340DB074E +:105B400005D401320130F4E70135EEE7002030BD25 +:105B500010B501004068002812D0441E002C06D069 +:105B60008B68A200D358002B01D1013CF6E78A686C +:105B7000A300D058FFF7CEFA2023181A640120188A +:105B800010BD10B5FFF7E4FF0730C00810BDF0B539 +:105B9000CE4600B582B0050001911400960803239B +:105BA00013405A1E9341F618B000031B994631006A +:105BB0002800FFF7CDFE071E01D1002C04D13800CC +:105BC00002B080BCB946F0BDA868484422000199E3 +:105BD0000DF061F9A8683100FFF726FEEFE700003D +:105BE000F0B5C64600B504000F004D091F260E4053 +:105BF000FFF7AEFFC01963685B01834203D31F2F19 +:105C000026D9636817E041091F2303405A1E9341B8 +:105C1000C9182000FFF772FE0028F0D01BE0A06832 +:105C20005A1B1B4959188900194FBC4662449200FF +:105C300012584250013BAB42F1D807E0A268144928 +:105C400059188900521800211160013B002BF5D131 +:105C5000002E1BD1002080BCB846F0BDA368A9006F +:105C60005B1818682022921B90460200B2401A600E +:105C7000A3685B1819683943196001354346D84059 +:105C800007006368AB42E9D80020E4E70027F8E7A3 +:105C9000FFFFFF3FF0B5C64600B54C091F250D407C +:105CA0004368A34209D306D01F2916D8002D3BD044 +:105CB0004168002632E0002DF6D00021FFF704FFF6 +:105CC0002FE081681A199E00920052588A510133C0 +:105CD0004268121B9A42F4D807E00023F8E7826872 +:105CE0009900521800211160013342689A42F6D897 +:105CF000DCE783680D4A8A1892009B181F682024ED +:105D0000641BA0463C00EC401C6083689B181A682A +:105D100032431A6001393E0043469E400029E8D1D3 +:105D2000002080BCB846F0BD0020FAE7FFFFFF3F2F +:105D300030B54368002B08D084681B4A9A1892003B +:105D40001259002A01D1013BF4E74A68002A08D021 +:105D50008D68154C1419A4006459002C01D1013A26 +:105D6000F4E71C00144312D0934212D813D3002B33 +:105D70000BD084680C4A9A189200A4588D68AA58CF +:105D800094420BD80CD3013BF1E7002000E0002047 +:105D900030BD0120FCE701204042F9E70120F7E790 +:105DA00001204042F4E7C046FFFFFF3F70B5060008 +:105DB0004368002B08D0B468214A9A1892001259FF +:105DC000002A01D1013BF4E74A68002A08D08D6817 +:105DD0001B481418A4006459002C01D1013AF4E7BF +:105DE0001800104324D0934219D81AD330680028E1 +:105DF00002DD0A68002A1DDB0A68002A01DD00288E +:105E00001ADB002B12D0B4680D4A9A189200A458DD +:105E10008D68AA5894420CD806D3013BF1E730684C +:105E200007E00868404204E0404202E0002000E051 +:105E3000002070BD0120FCE701204042F9E7C04688 +:105E4000FFFFFF3FF0B5DE4657464E464546E0B5FC +:105E500083B082468B46914642684B689A4246D14F +:105E600003685B1001252900194001915A46126808 +:105E7000521053401D400B002B404A4613604368AC +:105E8000984629E05B469B681A4F4744BF0052463C +:105E90009268D159D859FFF749F90126741B04407B +:105EA000019B1C4049460B681C430C60054351464E +:105EB0008B6859468A68D159D859FFF737F9731B4F +:105EC0000340019AB61A1E4034434B461C600543FA +:105ED00001235B429C46E0444346002BD2D1002084 +:105EE00003B0F0BCBB46B246A946A046F0BD0420B4 +:105EF0004042F5E7FFFFFF3F00B585B0CA178B189A +:105F00005340009300290ADB0123019301230293EC +:105F10006B46039301A9FFF749FF05B000BD0123BC +:105F20005B42F2E7F8B507001400904214D0B94282 +:105F300004D03800FFF762FD002843D101233B6005 +:105F40006668002E0BD0A1681F4BF3189B005B58AE +:105F5000002B04D1013EF4E70C000100E7E731001B +:105F60003800FFF7CBFC00282CD1A168BA680024C8 +:105F700000250EE008C99C461368E3181360A3428D +:105F8000A4416442634408C263459B415B421C19BF +:105F90000135B542EED306E01368E31808C2A34208 +:105FA000A44164420135002C0CD07B68AB42F3D88D +:105FB000691C3800FFF7A2FC002803D1BA68AB00C7 +:105FC000D218E9E7F8BDC046FFFFFF3FF0B5C6466F +:105FD00000B5060088461700546800E0013C002C1C +:105FE00006D0BD682B4BE3189B005B59002BF5D006 +:105FF00043465968A14247D33000FFF77FFC051E96 +:1060000013D143465B68A34213D873684246526873 +:1060100093421AD843469A68BB68B1682000FFF7DC +:106020008DF800281AD101233360280080BCB846BF +:10603000F0BDB068A20094466044424691681B1BC4 +:106040009A0061440CF027FFDFE7B0689100401828 +:106050009A1A920000210CF0D3FEDBE77168A1428E +:1060600009D9B368A2009B181A68002A03D1013A23 +:106070001A600134F2E7A14209D0B368A4001B19E9 +:106080001A68013A1A60CEE70A256D42CDE70A2563 +:106090006D42CAE7FFFFFF3FF8B506000C00150090 +:1060A0000F6813687B43002B18DA11002000FFF7FC +:1060B0003FFE002808DB2A0021003000FFF786FFA2 +:1060C000002810D137600EE0220029003000FFF7D1 +:1060D0007DFF002807D17F42376004E0FFF722FFF1 +:1060E000002800D13760F8BDF8B506000C00150097 +:1060F0000F6813687B43002B18DD11002000FFF7A9 +:1061000017FE002808DB2A0021003000FFF75EFFA1 +:10611000002800D13760F8BD220029003000FFF7C9 +:1061200055FF0028F7D17F423760F4E7FFF7FAFE0A +:106130000028F0D13760EEE710B584B0D4171319FA +:1061400063400093002A0ADB012301930123029399 +:106150006B46039301AAFFF7C7FF04B010BD0123EC +:106160005B42F2E7F0B5D6464F464646C0B586B02C +:1061700080460E00170003A8FFF7A7FB6846FFF74D +:10618000A4FBB0450DD0B84514D07568002D1AD0C9 +:10619000B268344BEB189B009B58002B13D1013D88 +:1061A000F4E7310003A8FFF729FC8246002828D134 +:1061B00003AEE8E739006846FFF720FC8246002876 +:1061C0001FD16F46E1E7002D0DD0002399467C6872 +:1061D000002C0BD0BA68234BE3189B009B58002B74 +:1061E00004D1013CF4E701239946F0E7002C01D1EA +:1061F0000123994629194046FFF780FB8246002873 +:106200000CD06846FFF767FB03A8FFF764FB504616 +:1062100006B0E0BCBA46B146A846F0BD00214046F3 +:10622000FFF752FC824600280DD0EAE7B1684346EA +:106230009A680C4BE0188000BB681B5812182800A5 +:10624000FEF798FF013C002CF0D14B46002B03D009 +:10625000012342461360D4E732683B685343424609 +:106260001360CEE7FFFFFF3FF0B5C64600B580469E +:106270000E0017004C6800E0013C002C06D0B56809 +:10628000134BE3189B005B59002BF5D0002F01D076 +:10629000002C08D100214046FFF716FC050028001D +:1062A00080BCB846F0BD611C4046FFF727FB051EC9 +:1062B000F5D131004046FFF7A1FB051EEFD1B168D3 +:1062C0007B1E424692682000FEF754FFE7E7C04677 +:1062D000FFFFFF3FF0B5DE4657464E464546E0B568 +:1062E00099B00700884616001D0000211800FFF72E +:1062F00003FE002800D1A7E115A8FFF7E6FA12A8CF +:10630000FFF7E3FA0FA8FFF7E0FA0CA8FFF7DDFAB2 +:106310000123099302330A9306AB0B932900300043 +:10632000FFF706FD002812DA002F05D00021380003 +:10633000FFF7CAFB041E10D14346002B05D03100E5 +:106340004046FFF75BFB041E07D1002415E0310037 +:1063500015A8FFF753FB041E17D015A8FFF7BBFACB +:1063600012A8FFF7B8FA0FA8FFF7B5FA0CA8FFF7C5 +:10637000B2FA0C2106A802F041FD200019B0F0BCD1 +:10638000BB46B246A946A046F0BD290012A8FFF7B9 +:1063900035FB041EE1D1012312931593716802317C +:1063A0000FA8FFF7ABFA041ED7D100210FA8FFF703 +:1063B0008BFB041ED1D1716802310CA8FFF79EFA45 +:1063C000041ECAD112A8FFF7C3FB1F2318401E28C2 +:1063D0000FD81B1A02939946190015A8FFF700FC65 +:1063E000041EBAD1494612A8FFF7FAFB041E02D0D8 +:1063F000B3E700230293169B5A1E0192139A934609 +:10640000013A03925A469B1A99465B019A46190033 +:1064100012A8FFF7E5FB041E9FD14C4612A915A850 +:10642000FFF7C4FC00280EDB119BA2009B181A6822 +:1064300001321A6012AA15A90800FFF755FE0028BC +:10644000ECD0040089E7514612A8FFF723FC041E94 +:1064500000D082E7B946039F0496AA46019BBB423F +:1064600000D8BEE0179B01998C001859149ABD0002 +:106470005259904230D3119ACB1B75498C466344D4 +:106480009B0001214942D150019B012B39D9179A18 +:1064900070498C4663449B00D2580B9B1A60019B49 +:1064A000002B30D0179A6A498C4663449B00D2581F +:1064B0000B9B5A60179A0B9B12599A60119B019A79 +:1064C000D21B0392624E94466644B6009B191A682A +:1064D00001321A605C462EE001995D4EB44661447B +:1064E0008E000596119E0199C91B03910399614481 +:1064F00089007618059959580023FFF76DF9306027 +:10650000C2E70022C9E7019AD2E73A000E9B1A605F +:10651000149A0E9B52595A60119B9A590CA9080063 +:10652000FFF7A2FE002800D08CE009A90CA8FFF715 +:106530003DFC002813DD119B9B191A68013A1A6073 +:1065400000210CA8FFF7C0FA002800D078E0002F47 +:10655000DBD0149A3F4BE3189B00D258D6E7A346F2 +:10656000119B9A5912A90CA8FFF77EFE041E00D0B9 +:10657000F3E6039D013D6D0129000CA8FFF730FBF8 +:10658000041E00D0E9E60CAA15A90800FFF7ACFD2F +:10659000041E00D0E1E6002115A8FFF7ADFC00289D +:1065A00003DB019B013B019358E712A90CA8FFF7FD +:1065B00025FA041E00D0D0E629000CA8FFF710FB36 +:1065C000041E00D0C9E60CAA15A90800FFF764FD57 +:1065D000041E00D0C1E6119B9B191A68013A1A608B +:1065E000DFE74F46049E5546002F0AD00FA94846C4 +:1065F000FFF704FA041E00D0AFE632682B6853435D +:106600003B604346002B00D1A7E6029915A8FFF78F +:1066100041FB041E00D0A0E63368159315A940463F +:10662000FFF7ECF9041E00D097E600214046FFF783 +:1066300063FC002800D090E60123424613608CE6FC +:1066400004008AE6040088E60C24644295E6C0460D +:10665000FFFFFF3FFEFFFF3F70B505000C00160077 +:1066600000211000FFF748FC002824DB3300220043 +:1066700029000020FFF72EFE041E0CD10021280067 +:10668000FFF73AFC002808DA320029002800FFF75B +:1066900003FD041EF2D0200070BD31002800FFF77A +:1066A00085FB0028F7DB320029002800FFF71CFDDE +:1066B000041EF2D0EFE70A246442ECE7F0B587B09D +:1066C00005000F00160003A8FFF7FFF86846FFF764 +:1066D000FCF8390003A8FFF791F9041E08D003A8BD +:1066E000FFF7F9F86846FFF7F6F8200007B0F0BDAD +:1066F00031006846FFF782F9041EF0D103A8FFF7C6 +:1067000010FA04006846FFF70CFA061E05D10021B6 +:106710006846FFF7F6F9002806D0B44200D82600F4 +:1067200001230093039312E039002800FFF766F974 +:106730000400D4E703AA69466846FFF747FC041E35 +:10674000CDD101216846FFF7A5FA041EC7D100216B +:1067500003A8FFF7D1FB002825D003A8FFF7E1F934 +:10676000010003A8FFF796FA041EB8D16846FFF7A8 +:10677000D8F901006846FFF78DFA041EAFD16946CB +:1067800003A8FFF713FB0028D4DB6A4603A908001F +:10679000FFF71CFC041EA2D1012103A8FFF77AFA1F +:1067A000041ED4D09BE731006846FFF719FA041E97 +:1067B00000D094E769462800FFF720F904008EE72F +:1067C000F0B5DE4657464E464546E0B589B0050071 +:1067D00089461600019301230793002306931000B6 +:1067E000FFF7B6F98046072343449A46DB089B46E9 +:1067F0004B46002B58DB49463000FFF77DFB002855 +:1068000055DD5346272B14D91E2703A8FFF75DF843 +:1068100071682800FFF79CF8041E0CD003A8FFF74E +:106820005AF8200009B0F0BCBB46B246A946A046C3 +:10683000F0BDFA27E9E7716803A8FFF75FF8041EC7 +:10684000ECD1494603A8FFF73FF9041EE6D1129B9D +:10685000019A59462800FFF701F8041EDED10723EC +:10686000514699434346C91A2800FFF713FA041EFC +:10687000D4D1013F002F14D007AA03A92800FFF7A5 +:10688000E1FA041ECAD106AA31002800FFF7DAFA9D +:10689000041EC3D1079B002BD9D1069B002BD6D059 +:1068A000BCE70E246442B9E704246442B9E7042437 +:1068B0006442B6E7F0B59DB005000F001600012157 +:1068C0001000FFF719FB002800DC39E116A8FEF7DD +:1068D000FCFF13A8FEF7F9FF10A8FEF7F6FF0DA8BE +:1068E000FEF7F3FF19A8FEF7F0FF0AA8FEF7EDFF89 +:1068F00007A8FEF7EAFF04A8FEF7E7FF01A8FEF7E6 +:10690000E4FF3200390019A8FFF7D8FE041E07D1B2 +:10691000012119A8FFF7F0FA00281FD00E246442C5 +:1069200016A8FEF7D8FF13A8FEF7D5FF10A8FEF7AC +:10693000D2FF0DA8FEF7CFFF19A8FEF7CCFF0AA8DB +:10694000FEF7C9FF07A8FEF7C6FF04A8FEF7C3FFBE +:1069500001A8FEF7C0FF20001DB0F0BD32003900D5 +:1069600016A8FFF779FE041EDAD116A913A8FFF7BF +:1069700045F8041ED4D131000AA8FFF73FF8041EE1 +:10698000CED1310007A8FFF739F8041EC8D1012184 +:1069900010A8FFF799F8041EC2D100210DA8FFF737 +:1069A00093F8041EBCD1002104A8FFF78DF8041E43 +:1069B000B6D1012101A8FFF787F8041E1CD0AFE76C +:1069C0000AAA10A90800FFF767FB041EA8D116AA9F +:1069D0000DA90800FFF788FB041EA1D1012110A812 +:1069E000FFF758F9041E00D09AE701210DA8FFF720 +:1069F00051F9041E00D093E7159B1B68DB072DD4CB +:106A0000012113A8FFF746F9041E00D088E7129B66 +:106A10001B68DB07D4D40F9B1B68DB07DED5CFE7F1 +:106A20000AAA04A90800FFF737FB041E00D077E785 +:106A300016AA01A90800FFF757FB041E00D06FE754 +:106A4000012104A8FFF726F9041E00D068E7012100 +:106A500001A8FFF71FF9041E00D061E7099B1B681E +:106A6000DB070FD4012107A8FFF714F9041E00D09B +:106A700056E7069B1B68DB07D2D4039B1B68DB072A +:106A8000DED5CDE707A913A8FFF790F900282BDB87 +:106A900007AA13A90800FFF727FB041E00D03FE751 +:106AA00004AA10A90800FFF71FFB041E00D037E757 +:106AB00001AA0DA90800FFF717FB041E00D02FE75D +:106AC000002113A8FFF718FA002895D1002104A887 +:106AD000FFF712FA00281FDA320004A90800FFF7B6 +:106AE000DBFA041EF2D01BE713AA07A90800FFF780 +:106AF000FBFA041E00D013E710AA04A90800FFF750 +:106B0000F3FA041E00D00BE70DAA01A90800FFF755 +:106B1000EBFA041ED4D003E7310004A8FFF746F9CE +:106B2000002807DB320004A90800FFF7DDFA041E85 +:106B3000F2D0F5E604A92800FEF760FF0400EFE6B6 +:106B40000424644207E7F8B506000F001100C46D85 +:106B50000734E4089C4200D91C0022003800FFF7EB +:106B600016F8051E10D1E400F16D8C4205D9611AAA +:106B70003800FFF78FF8051E06D14C36310038007B +:106B8000FFF714F9002801DA2800F8BD32003900B7 +:106B90003800FFF7A9FA0500F6E70120704700006A +:106BA000F0B59DB004000D001600059307A800F095 +:106BB000F7FF19A8FEF789FE16A8FEF786FE13A8B0 +:106BC000FEF783FE10A8FEF780FE2078FFF7E5FFB2 +:106BD000002800D182E0636D002B00D180E001210C +:106BE0002298FFF789F9002807DB27004C37390086 +:106BF0002298FFF7DBF8002812DB3A4D07A801F0D6 +:106C00000AF819A8FEF767FE16A8FEF764FE13A897 +:106C1000FEF761FE10A8FEF75EFE28001DB0F0BD75 +:106C200001212398FFF768F90028E6DB3900239853 +:106C3000FFF7BCF80028E0DA33002A0019A9200089 +:106C4000FFF781FF051ED9D13A00239916A8FFF757 +:106C500031FE051ED2D116AA19A913A8FFF782FA90 +:106C6000051ECBD13A0013A90800FFF7F5FC051E5D +:106C7000C4D116AA229910A8FFF774FA051EBDD137 +:106C80003A0010A90800FFF7E7FC051EB6D1230063 +:106C9000283300220292059A019210AA009213AAA8 +:106CA00007A9200001F0B4FC051EA7D107A801F038 +:106CB000B3FB002801D00B4DA0E73A0007A908005C +:106CC000FFF7CAFC051E00D098E7229907A8FFF736 +:106CD0006DF8002800D191E7024D8FE7024D9CE747 +:106CE000014D9AE700B2FFFF80B0FFFFF0B58DB015 +:106CF00004000D0016001F000B93129B9C46674476 +:106D000007A8FEF7E2FD04A8FEF7DFFD30230AAA7C +:106D100039000BA8FEF74BF9002816D10B9B0A9AF5 +:106D20009B18BB422FD107AA39000BA8FEF752F9D6 +:106D300000280DD0154BC41807A8FEF7CCFD04A8F9 +:106D4000FEF7C9FD20000DB0F0BD104BC418F3E7ED +:106D500004AA39000BA8FEF73DF90028EAD1230068 +:106D60008833139A029204AA019207AA0092320071 +:106D700029002000FFF714FF041EDDD10B9BBB424E +:106D8000DAD0034CD8E7034CD6E7C04680B0FFFF0B +:106D900000B4FFFF1AB0FFFF10B582B000240194C9 +:106DA000049C0094FFF7A2FF02B010BD10B500F0E4 +:106DB00025FF10BD10B5002801D000F071FF10BDF7 +:106DC000436F002B04D0836F002B03D0002070474B +:106DD0000020FCE70120FAE770B5C56DC0235B0019 +:106DE0009D4211D30524002901D00134E4B20029C9 +:106DF00003D0FFF7E5FF002802D1042C00D90424BA +:106E0000A54203D9200070BD0424ECE70224F9E771 +:106E100070B506000D0011001A002800FFF764F994 +:106E2000041E0FD12B68002B0CDA00212800FFF77D +:106E300063F8002806D0321D29002800FFF72CF93E +:106E4000041EEFD0200070BDF8B505000E004B6E9B +:106E5000002B1FD00368002B22DB2800FEF778FEF2 +:106E6000B36D5B00984220D8736E28009847041ECB +:106E70002BD12B68002B1ADA00212800FFF73CF8F1 +:106E8000002814D0321D29002800FFF705F9041E40 +:106E9000EFD01AE00A1D0100FFF7DEFB040014E04A +:106EA0000021FFF729F80028D7D0094C0DE0371D45 +:106EB00039002800FEF77AFF002806DB3A00290097 +:106EC0002800FFF783F8041EF1D02000F8BDC0466B +:106ED00080B0FFFF70B505000C0011001A00200003 +:106EE000FFF740F9002800D070BD29002000FFF70F +:106EF000ABFF0028F8D1024A136801331360F3E7AF +:106F000084630108F8B507000D0011002800FEF7A2 +:106F100067FE041E0DD13E1D31002800FEF746FF1E +:106F2000002806DB320029002800FFF74FF8041E76 +:106F3000F1D02000F8BD70B584B005000C0016003B +:106F400001A8FEF7C2FC0C34291D220001A8FFF79E +:106F5000CBF8051E05D001A8FEF7BDFC280004B043 +:106F600070BD00212000FEF7C7FF0200531E9A41AA +:106F7000324001A92000FEF77FFD0500EBE7F0B5E8 +:106F8000DE4657464E464546E0B583B001900F00B9 +:106F9000924698460CAB1B789B465B083F221A40F2 +:106FA0009146002501E00135EDB2454519D2EC00CE +:106FB0006419A40054444B46EE1A73425E41F6B283 +:106FC000320021003800FEF757FD00280FD12100C4 +:106FD0000C3138000C303200FEF74EFD0028E2D0B4 +:106FE00005E05B46DA0939000198FFF7A4FF03B01A +:106FF000F0BCBB46B246A946A046F0BDF8B5CE46A9 +:10700000474680B506000F00904699464A1C00216D +:107010000BF0F6FE00250EE03900614349194846A1 +:10702000FEF76FFD0300A340705D184370550134F7 +:10703000A045F1D80135BD4201D20024F8E7002374 +:1070400001201CE03518315C1A000A409446594072 +:10705000297001234B4001221A409146441E335DA2 +:107060005343DAB290460B406246134342465140C6 +:1070700029704A46D201315D0A4332550130B84287 +:10708000E0D9C0BCB946B046F8BD0000F0B589B043 +:1070900007000E00009201930EAB1D7805A8FEF7C5 +:1070A00014FC02A8FEF711FC4C3700213800FEF753 +:1070B00028FD01282CD100213000FEF722FD43429B +:1070C00058410F9C2070310005A8FEF797FC041E64 +:1070D00008D002A8FEF7FFFB05A8FEF7FCFB200086 +:1070E00009B0F0BD3200390002A8FEF7FDFF041E12 +:1070F000EFD10F9C227802A905A8FEF7BDFC041E63 +:10710000E7D105AB2A0001990098FFF777FFE0E788 +:10711000004CE4E780B0FFFFF0B587B006000F0039 +:1071200000213800FEF7E8FE00282CDB3C000C3480 +:1071300000212000FEF7E0FE002824DB351D290099 +:107140003800FEF733FE00281DDA29002000FEF784 +:107150002DFE002817DA03A8FEF7B7FB6846FEF7F6 +:10716000B4FB2200210003A8FEF7FCFF041E0CD094 +:10717000002C15D003A8FEF7AEFB6846FEF7ABFB6C +:10718000200007B0F0BD444CFAE7310003A8FFF738 +:107190005BFE041EECD1414A136801331360E7E73C +:1071A0003A0039006846FEF7DDFF041E45D0002C8A +:1071B000E0D1B369002B4BD03200103269466846EB +:1071C000FEF76AFF041E0DD1351D29006846FEF743 +:1071D000EDFD002806DB2A0069466846FEF7F6FE4C +:1071E000041EF1D0002CC5D13A0069466846FEF76E +:1071F000B9FF041E45D0002CBCD132001C326946B8 +:107200006846FEF749FF041E0DD1351D290068466A +:10721000FEF7CCFD002806DB2A0069466846FEF72B +:10722000D5FE041EF1D0002CA4D1694603A8FEF7B8 +:10723000BDFD00289ED0184C9CE731006846FFF742 +:1072400003FE041EB3D1154A136801331360AEE781 +:10725000032269466846FEF76FFF041E00D089E7E7 +:10726000009B002BC0DA00216846FEF745FE00288F +:10727000BAD02A0069466846FEF70EFF041EEFD01A +:1072800078E731006846FFF7DFFD041EB3D1034AFB +:10729000136801331360AEE780B3FFFF8463010816 +:1072A000F0B587B005000E000F0018370021380038 +:1072B000FEF722FE041E02D1200007B0F0BD03A895 +:1072C000FEF703FB6846FEF700FB2A1D390003A802 +:1072D000FFF7F0FA041E06D003A8FEF7FCFA684692 +:1072E000FEF7F9FAE8E703AA11006846FEF73AFF4D +:1072F000041E23D0002CEFD16A4631003000FEF787 +:1073000031FF041E25D0002CE6D10C366A46310030 +:107310003000FEF727FF041E26D0002CDCD103AA84 +:1073200031003000FEF71EFF041E28D0002CD3D100 +:1073300001213800FEF7C8FB0400CDE729006846AC +:10734000FFF782FD041ED5D1124A13680133136082 +:10735000D0E729003000FFF777FD041ED3D10D4A96 +:10736000136801331360CEE729003000FFF76CFD8E +:10737000041ED2D1074A136801331360CDE72900F8 +:107380003000FFF761FD041ED0D1024A13680133BB +:107390001360CBE784630108F0B5DE4657464E46DE +:1073A0004546E0B58BB0814688461600012A08D9CB +:1073B0000C2110000AF08CFF051E00D120E10024F2 +:1073C0000BE00968FFF76CFF040011E16000001991 +:1073D00080002818FEF779FA0134B442F6D307A8E2 +:1073E000FEF773FA04A8FEF770FA01A8FEF76DFA2B +:1073F0004346196818312800FEF700FB041E36D1F9 +:10740000012702E0002C32D10137B7421AD27900AD +:10741000C91989006B189A460C396918BB00424695 +:107420009A5818325046FEF79DFE041EEAD149468E +:107430005046FFF709FD041EE4D1724A1368013378 +:107440001360DFE77100891989000C3969184B4610 +:107450001A1D07A8FFF72EFA041E08D1731E9A46BC +:1074600068E007A904A8FEF7C9FA041E17D007A808 +:10747000FEF731FA04A8FEF72EFA01A8FEF72BFA60 +:107480000027B0E0494604A8FFF7DEFC041E5FD1E8 +:107490005C4A1368013313605AE0002CE7D104AA58 +:1074A000110001A8FEF75EFE041E69D0002CDED19B +:1074B00053469F0047443B689B4601AA19001800A9 +:1074C000FEF750FE041E66D0002CD0D13B680C2283 +:1074D00093469B4401AA59465846FEF743FE041EB4 +:1074E00064D0002CC3D13B680C2293469B4404AA71 +:1074F00059465846FEF736FE041E62D0002CB6D11F +:1075000038684B469968FEF73FFA041EAFD13868D9 +:107510004B4699680C30FEF737FA041EA7D138683D +:107520001830FEF7D8F95346002BA0D001235B4258 +:107530009C46E2445346002B93D05A00524492009A +:107540000C3AAA1807A904A8FEF70CFE041E99D04D +:10755000002C8CD153469B0042469A58183207A9FA +:107560000800FEF7FFFD041E97D1494607A8FFF764 +:107570006BFC041E91D1234A1368013313608CE71E +:10758000494601A8FFF760FC041E8FD11D4A13680D +:10759000013313608AE749465846FFF755FC041E3D +:1075A00092D1184A1368013313608DE74946584653 +:1075B000FFF74AFC041E94D1124A1368013313608A +:1075C0008FE749465846FFF73FFC041E96D10D4A07 +:1075D00013680133136091E77800C0198000281800 +:1075E000FEF779F90137B742F6D328000AF0F6FF23 +:1075F00020000BB0F0BCBB46B246A946A046F0BD89 +:10760000014CF5E78463010880B2FFFFF0B589B053 +:1076100006000F0014001D0005A8FEF756F902A889 +:10762000FEF753F9321D00952300022105A8FFF74C +:10763000C7F8041E0CD005A8FEF74DF902A8FEF706 +:107640004AF923000E3300D167E0200009B0F0BDF5 +:107650003D00183505AA29002800FEF783FD041E09 +:107660002FD0002CE7D105AA110002A8FEF77AFD61 +:10767000041E31D0002CDED102AA39003800FEF7FA +:1076800071FD041E33D0002CD5D105AA02A9080033 +:10769000FEF768FD041E35D0002CCCD10C3702AAB1 +:1076A00039003800FEF75EFD041EC4D131003800F9 +:1076B000FFF7CAFB041EBED1194A136801331360D9 +:1076C000B9E731002800FFF7BFFB041EC9D1144AF7 +:1076D000136801331360C4E7310002A8FFF7B4FB5D +:1076E000041EC7D10E4A136801331360C2E731008C +:1076F0003800FFF7A9FB041EC5D1094A13680133FE +:107700001360C0E7310002A8FFF79EFB041EC3D13F +:10771000034A136801331360BEE7024C95E7C04685 +:107720008463010800B3FFFFF0B5CE46474680B53D +:107730008FB0050001911700604A13680133136090 +:107740000BA8FEF7C2F808A8FEF7BFF805A8FEF7D9 +:10775000BCF802A8FEF7B9F8AB69002B1CD03A00C0 +:10776000390008A8FEF7FEFC041E00D183E0002CBF +:1077700000D18CE00BA8FEF7AEF808A8FEF7ABF836 +:1077800005A8FEF7A8F802A8FEF7A5F820000FB09C +:10779000C0BCB946B046F0BD390018310A0008A88F +:1077A000FEF7E0FC041E50D0002CE3D108AA3900FB +:1077B00005A8FEF771FC041E0DD12E1D310005A891 +:1077C000FEF7F4FA002806DB320005A90800FEF7F0 +:1077D000FDFB041EF1D0002CCCD108AA390002A870 +:1077E000FEF782FC041E0FD1029B002B0CDA002155 +:1077F00002A8FEF781FB002806D02A1D02A9080076 +:10780000FEF74AFC041EEFD0002CB3D102AA05A952 +:1078100008A8FEF7A7FC041E22D0002CAAD1032240 +:1078200008A90BA8FEF720FD041EA3D12C1D2100E2 +:107830000BA8FEF7BBFA00284EDB22000BA90800BC +:10784000FEF7C4FB041EF1D094E7290008A8FFF757 +:10785000FBFA041EA8D11A4A136801331360A3E788 +:10786000290008A8FFF7F0FA041ED6D1144A1368BD +:1078700001331360D1E7290008A8FFF7E5FA041ED9 +:1078800000D074E70E4A1368013313606FE70322D8 +:1078900008A90BA8FEF7E8FC041E00D06AE72C1D1F +:1078A00021000BA8FEF782FA00280BDB22000BA9AF +:1078B0000800FEF78BFB041EF1D05BE78063010834 +:1078C0008463010810239846A84400214046FEF72F +:1078D00013FB002800D0CBE00C239946B9444A465C +:1078E000494605A8FEF73EFC041E00D119E1002C14 +:1078F00000D03FE7012105A8FEF772F9041E0DD163 +:107900002E1D310005A8FEF751FA002806DB3200D3 +:1079100005A90800FEF75AFB041EF1D0002C00D088 +:1079200028E705AA390008A8FEF71CFC041E00D1B0 +:1079300003E1002C00D01DE7012108A8FEF750F953 +:10794000041E0ED12B1D9846190008A8FEF72EFA2A +:10795000002806DB424608A90800FEF737FB041E94 +:10796000F0D0002C00D005E705AA110002A8FEF710 +:10797000F9FB041E00D1ECE0002C00D0FAE6012156 +:1079800002A8FEF72DF9041E0ED12B1D98461900F2 +:1079900002A8FEF70BFA002806DB424602A90800FF +:1079A000FEF714FB041EF0D0002C00D0E2E60BAA78 +:1079B000110005A8FEF7D6FB041E00D1D5E0002C6F +:1079C00000D0D7E608AB05AA11002800FFF720FA7F +:1079D000041E00D0CEE608AB05AA11002800FFF770 +:1079E00017FA041E00D0C5E605AB08AA110028004E +:1079F000FFF70EFA041E00D0BCE60BAB08AA11007C +:107A00002800FFF767FA041E00D0B3E602AB08AA0D +:107A100011002800FFF7FCF9041E00D0AAE63B0085 +:107A200018334A4602A92800FFF754FA041E00D072 +:107A3000A0E6012202A92800FFF764FA041E00D084 +:107A400098E605A9019D2800FDF7D8FF041E00D087 +:107A500090E628000C3008A9FDF7D0FF041E00D0E6 +:107A600088E62800183002A9FDF7C8FF040081E667 +:107A7000390018310A0008A8FEF774FB041E2FD045 +:107A8000002C00D076E608AA110005A8FEF76AFBD4 +:107A9000041E30D0002C00D06CE6424605A908A890 +:107AA000FEF760FB041E31D0002C00D062E608AA6D +:107AB0000BA90800FEF7F0FA041E0DD12E1D3100AF +:107AC0000BA8FEF773F9002806DB32000BA90800AB +:107AD000FEF77CFA041EF1D0002C00D1FCE649E64A +:107AE000290008A8FFF7B0F9041EC9D1254A136878 +:107AF00001331360C4E7290005A8FFF7A5F9041EA8 +:107B0000C8D1204A136801331360C3E7290008A8CD +:107B1000FFF79AF9041EC7D11A4A1368013313609C +:107B2000C2E7290005A8FFF78FF9041E00D0DEE6A2 +:107B3000144A136801331360D9E6290008A8FFF737 +:107B400083F9041E00D0F4E60E4A13680133136073 +:107B5000EFE6290002A8FFF777F9041E00D00BE733 +:107B6000084A13680133136006E7290005A8FFF7E8 +:107B70006BF9041E00D022E7024A13680133136038 +:107B80001DE7C04684630108036B002B06D0C36B5E +:107B9000002B01D0012070470220FCE70020FAE70B +:107BA00010B50400FDF791FE20000C30FDF78DFEAE +:107BB00020001830FDF789FE10BD70B504000025C7 +:107BC00005700430FDF781FE20001030FDF77DFECA +:107BD00020001C30FDF779FE20002830FFF7E0FF81 +:107BE00020004C30FDF771FEA565E56525666566EC +:107BF000A566E56625676567A56770BD10B50400D5 +:107C0000FFF7DBFF20007C30FDF75FFE20008830AF +:107C1000FFF7C6FF10BD10B5041E09D0FDF75BFECF +:107C200020000C30FDF757FE20001830FDF753FE02 +:107C300010BD70B5041E32D0036E012B09D1200097 +:107C4000FFF7BEF8002826D1636F002B23D0002554 +:107C50001BE00430FDF73FFE20001030FDF73BFE37 +:107C600020001C30FDF737FE20002830FFF7D3FF3F +:107C700020004C30FDF72FFEE1E7606FEB005B1951 +:107C80009B00C018FFF7C7FF0135A36FAB42F4D8C4 +:107C9000606F0AF0A3FC7C21200001F0AFF870BDFA +:107CA00010B5041E09D0FFF7C4FF20007C30FDF79B +:107CB00012FE20008830FFF7AEFF10BD70B5040043 +:107CC0000D00FDF79BFE002800D070BD29000C318F +:107CD00020000C30FDF792FE0028F6D12900183163 +:107CE00020001830FDF78AFEEFE710B504000121EF +:107CF000FDF7EAFE002800D010BD20000C30012165 +:107D0000FDF7E2FE0028F7D1200018300021FDF732 +:107D1000DBFEF1E7F0B5C64600B598B080460191AC +:107D200017001D007E4A1368013313603E001836A9 +:107D300000213000FEF7E0F800284CD02B6A002B21 +:107D400006D0280018300021FEF7D6F8002848D0C9 +:107D50002B6A002B07D0280018300121FEF7CCF841 +:107D6000002800D093E115A8FDF7AFFD12A8FDF79C +:107D7000ACFD0FA8FDF7A9FD0CA8FDF7A6FD09A80D +:107D8000FDF7A3FD06A8FDF7A0FD03A8FDF79DFDE7 +:107D90003200310015A8FEF7E5F9041E27D0002CAB +:107DA00030D015A8FDF797FD12A8FDF794FD0FA898 +:107DB000FDF791FD0CA8FDF78EFD09A8FDF78BFDE1 +:107DC00006A8FDF788FD03A8FDF785FD200018B083 +:107DD00080BCB846F0BD29000198FFF76FFF040092 +:107DE000F4E739000198FFF769FF0400EEE7414628 +:107DF00015A8FFF729F8041ED1D14A4A13680133A8 +:107E00001360CCE7320015A912A8FEF7ABF9041EE7 +:107E10005FD0002CC5D12A0015A90800FEF7A2F9F1 +:107E2000041E61D0002CBCD12A000C3212A908001B +:107E3000FEF798F9041E62D0002CB2D13A0015A9C1 +:107E40000800FEF751F9041E10D1159B002B0DDA26 +:107E5000002115A8FEF750F8002807D043461A1D48 +:107E600015A90800FEF718F9041EEED0002C00D06A +:107E700097E73D000C352A0012A90800FEF734F9F7 +:107E8000041E10D1129B002B0DDA002112A8FEF760 +:107E900033F8002807D043461A1D12A90800FEF740 +:107EA000FBF8041EEED0002C00D07AE7002115A8C4 +:107EB000FEF722F8002837D1002112A8FEF71CF89F +:107EC000002827D13A0001994046FFF72DFC040015 +:107ED00067E7414612A8FEF7B7FF041E99D1114A81 +:107EE00013680133136094E7414615A8FEF7ACFF11 +:107EF000041E97D10B4A13680133136092E7414681 +:107F000012A8FEF7A1FF041E96D1064A136801339A +:107F1000136091E70198FFF7E8FE040041E7C046CF +:107F20007C6301088463010815AA310003A8FEF7E9 +:107F300019F9041E00D186E0002C00D031E715AA03 +:107F400011000FA8FEF70EF9041E00D187E0002CE7 +:107F500000D026E715AA0FA90CA8FEF703F9041E06 +:107F600000D188E0002C00D01BE73B000FAA1100D5 +:107F70004046FEF7AFFF041E00D012E70FA915A878 +:107F8000FDF73CFD041E00D00BE7012215A9404679 +:107F9000FEF7B8FF041E00D003E712AB1A0009A9D0 +:107FA0004046FEF797FF041E00D0FAE615AB09AA7B +:107FB00011004046FEF72CFF041E00D0F1E60CAB8A +:107FC00009AA11004046FEF723FF041E00D0E8E690 +:107FD00009AB0FAA11004046FEF71AFF041E00D09D +:107FE000DFE612AB0FAA11004046FEF773FF041E36 +:107FF00000D0D6E62B000CAA11004046FEF76AFF1F +:10800000041E00D0CDE60CAB0FAA06A94046FEF731 +:10801000FFFE041E00D0C4E609A9019D2800FDF75B +:10802000EDFC041E00D0BCE628000C3006A9FDF7CC +:10803000E5FC041E00D0B4E62800183003A9FDF7C3 +:10804000DDFC0400ADE6414603A8FEF7FDFE041E7C +:1080500000D071E70F4A1368013313606CE74146A3 +:108060000FA8FEF7F1FE041E00D070E7094A13685E +:10807000013313606BE741460CA8FEF7E5FE041ED2 +:1080800000D06FE7034A1368013313606AE7024CBC +:108090009CE6C0468463010880B0FFFFF0B5DE4671 +:1080A00057464E464546E0B58BB081460E0011005E +:1080B000149F013B9A460123524693400193DBB241 +:1080C0009B463000FFF7FAFD00285DD1002507E050 +:1080D000220021004846FFF727FB002854D1013534 +:1080E00053467B43AB421FD93900280009F002FFF9 +:1080F00001228240D3B29846FF231340DC00E418EB +:10810000A40034193900280009F07AFF0029DFD1D2 +:1081100043465B08D900C918890071182000FFF791 +:10812000CDFD0028D4D02FE00022012109E0CB00B2 +:108130005B189B00F318940003A823504900C9B2B0 +:1081400001325945F3D303A94846FFF725F9002822 +:108150001AD101275F4521D23D003C002300013C9C +:10816000002B18D02B19D900C9188900E200121968 +:108170009200B218EB005B199B00F3187118484687 +:10818000FFF7C8FD0028E9D00BB0F0BCBB46B246F3 +:10819000A946A046F0BD7F00FFB2DBE7002207E062 +:1081A000CB005B189B00F318920003A813500A0041 +:1081B000511CFF23019803409942F1D303A948467B +:1081C000FFF7EAF8E0E7F0B5D6464F4680B58DB048 +:1081D00006000D0091469A46159F03A8FFF7E0FCA4 +:1081E000149BDB5D009353464A4629003000FEF79E +:1081F000C6FE041E08D003A8FFF70DFD20000DB039 +:10820000C0BCBA46B146F0BD280018300121FDF7C8 +:108210005BFC041EEFD1169B002B07D0179B169A10 +:1082200029003000FFF7F2F9041EE4D1002FE2D05C +:10823000013F2A0029003000FFF776FA041EDAD148 +:10824000149BDB5D009353464A4603A93000FEF7BA +:1082500096FE041ECFD103AB2A0029003000FFF7A1 +:1082600059FD041EE2D0C6E7F0B5A9B004000E0027 +:1082700011001D002EAB1F782FAB1B789F226A4484 +:1082800001920093309B07AAFEF700FF002801D05F +:1082900029B0F0BD339B0493329B0393319B02932F +:1082A000309B019307AB00933B002A003100200074 +:1082B000FFF789FF0028EBD19F236B441A78310028 +:1082C0002000FEF738FE0028E2D1319B002B07D0BA +:1082D000329B319A31002000FFF798F90028D7D15E +:1082E00031002000FEF7DCFFD2E70000F0B5DE46EB +:1082F00057464E464546E0B58BB0070008910992B7 +:108300009A460100343118000C30FDF74FFD041E71 +:1083100032D00024E3B2984619003800FEF75CFD25 +:1083200081460300013B01249C40E6B2F86D4844BD +:108330000138494609F0DEFD07904346002B24D062 +:108340007D6F002D21D0169B0593159B0493149BE4 +:108350000393079B02934B46019300962B00099AC7 +:1083600008993800FFF780FF04007B6FAB4243D0D1 +:10837000002D41D000273AE0390028315046FDF762 +:1083800015FD0028C6D10134C4E7FF2323409B46D6 +:108390002421180009F09CFF051E1ED0002407E0D0 +:1083A000E000001980002818FFF7FAFB0134E4B25E +:1083B000B442F5D3169B0193079B00934B4652465C +:1083C00029003800FFF76AFE041ECED14346002B79 +:1083D000B9D07D675B46BB67B5E70E4CC5E7F800D3 +:1083E000C01980002818FFF716FC0137FFB2B7420A +:1083F000F5D328000AF0F2F8002C07D120000BB0CA +:10840000F0BCBB46B246A946A046F0BD0898FFF7AF +:1084100002FCF3E780B2FFFF10B518300021FDF732 +:108420006BFD4342584110BDF0B5C64600B505008E +:108430000F0014001E1E31D00430FDF7A2FB804651 +:108440002800FFF7A1FB01282AD12378002B07D1B0 +:10845000012E27D13800FFF748FC80BCB846F0BD9C +:10846000042B21D143465B000133B3421ED1611C72 +:1084700042463800FDF78BFB0028EED14346591CDD +:10848000611838000C304246FDF781FB0028E4D12A +:10849000380018300121FDF717FBDEE70448DCE760 +:1084A0000448DAE70248D8E70248D6E70048D4E7AC +:1084B00080B0FFFF80B1FFFF70B505000C00080021 +:1084C00018300121FDF718FD002809D12800FFF719 +:1084D0005BFB012806D121002800FEF71DFE70BDC0 +:1084E0000148FCE70148FAE780B3FFFF80B0FFFFD7 +:1084F00070B504000D00FFF747FB012810D10121E2 +:108500002800FDF7F9FC002808DB21004C31280089 +:10851000FDF74CFC002801DA002070BD0148FCE7A3 +:108520000148FAE780B3FFFF80B0FFFFF0B585B0E8 +:1085300005000C0016001F001100FFF7D9FF0028EE +:1085400001D005B0F0BD39002800FFF7B5FF0028C5 +:10855000F7D12800FFF718FB01280CD10C9B0293E0 +:108560000B9B01930A9B00933B00320021002800E3 +:10857000FFF7BCFEE5E70148E3E7C04680B0FFFF38 +:10858000F0B585B006000D0014001F00002110009A +:10859000FDF7B2FC002806D12800FFF7A6FB040077 +:1085A000200005B0F0BD01212000FDF7A5FC00284A +:1085B00005D139002800FFF781FB0400F0E7012115 +:1085C00049422000FDF798FC002813D1390028000B +:1085D000FFF774FB041EE3D10C3500212800FDF7E2 +:1085E0008BFC0028DCD0311D2A002800FDF77CFD23 +:1085F0000400D5E70A9B02930023019300933B00FC +:10860000220029003000FFF791FF0400C8E70000B6 +:10861000F0B58DB005000E0014001F00FFF7B4FA8E +:1086200001282AD103A8FFF7BBFA149B00933B0053 +:10863000220003A92800FFF7A3FF041E05D003A80A +:10864000FFF7E9FA20000DB0F0BD149B0093139BD7 +:10865000129A31002800FFF793FF041EEFD1330078 +:1086600003AA31002800FFF755FB041EE7D13100B3 +:108670002800FEF715FE0400E1E7014CE2E7C046E2 +:1086800080B1FFFFF0B5002406E08368A5005B1908 +:108690001D68ED431D6001345709A742F5D200243F +:1086A0008368A6009B191D6801351D60836801342D +:1086B0009D59002D01D1A742F2D2012464420460E9 +:1086C000D208032082439B181A68521A1A60F0BD20 +:1086D000F8B504001121FDF711F9051E00D0F2E1F3 +:1086E000A2681168136AC91899429B415842536A9B +:1086F000591899429B415B421B18D66AB14280418E +:1087000040421B1ADBB2891B166BB14280414042CA +:108710001B1ADBB2891B566BB142804140421B1AC7 +:10872000DBB2891B966BB142804140421B1A58B2A2 +:10873000891B1160A26851681B0600D593E10918D6 +:10874000814280414642506A411881428041404204 +:108750008019C0B2936A591899429B415B421B1819 +:10876000DBB2166BB142804140421B1ADBB2891B5F +:10877000566BB142804140421B1ADBB2891B966B9B +:10878000B142804140421B1ADBB2891BD66BB14219 +:10879000804140421B1A58B2891B5160A2689168FF +:1087A0001B0600D564E10918814280414642906A67 +:1087B00041188142804140428019C0B2D36A5918A1 +:1087C00099429B415B421B18DBB2566BB142804120 +:1087D00040421B1ADBB2891B966BB142804140427A +:1087E0001B1ADBB2891BD66BB142804140421B1A77 +:1087F00058B2891B9160A168CA681B0600D53CE18C +:108800001318834280414742C86AC3188342B64165 +:108810007642F619F6B2C31883428041404280196D +:10882000C0B20A6BD3189342B64176423618F6B2FC +:10883000D3189342804140428019C0B24A6BD3188A +:108840009342924152421218D2B2CE6BB34280414F +:108850004042121AD2B29B1B0E6AB3428041404280 +:10886000121AD2B29B1B4E6AB34280414042121A86 +:1088700050B29B1BCB60A1680B69120600D501E1C9 +:108880001A18824280414742086B82188242B641E0 +:108890007642F619F6B2821882428041404280192F +:1088A000C0B24B6B9A189A42B64176423618F6B26D +:1088B0009A189A42804140428019C0B28B6B9A1834 +:1088C0009A429B415B421B18DBB24E6AB242804126 +:1088D00040421B1ADBB2921B8E6AB2428041404278 +:1088E0001B1A58B2921B0A61A1684A691B0600D57F +:1088F000CDE01218824280414742486B8218824282 +:10890000B6417642F619F6B2821882428041404260 +:108910008019C0B28B6B9A189A42B64176423618CB +:10892000F6B29A189A42804140428019C0B2CB6B8D +:108930009E189E42924152421218D2B2886A8642D2 +:108940009B415B42D21AD2B2361ACF6ABE429B41D9 +:108950005B42D21A50B2F61B4E61A1688B691206B7 +:1089600000D599E01B18834280414642886BC318AA +:108970008342924152429219D2B2C3188342BF41FC +:108980007F42BF18FFB2CA6BD3189342B6417642FA +:10899000F619F6B2D3189342924152429219D2B2CA +:1089A000C3188342804140428018C0B24A6BD3183A +:1089B0009342924152421218D2B20E6AB34280419F +:1089C0004042121AD2B29B1B4F6ABB4280414042C6 +:1089D000121A56B2DB1B8B61A068C369120660D401 +:1089E0009B19B342B6417242C66BF318B342894138 +:1089F00049428918C9B2F318B342924152425218FF +:108A0000D2B2F318B342B6417642B618F6B2016A52 +:108A1000CB188B42894149428919C9B2866AB3424F +:108A200092415242891AC9B29B1BC66AB342924113 +:108A30005242891AC9B29B1B066BB3429241524201 +:108A4000891AC9B29B1B466BB34292415242891AA2 +:108A500049B29B1BC3610B1C002927DB5BB2A268D8 +:108A60001362082329E04642B142B64141186AE642 +:108A70004642B142B641411899E64742BA42BF4127 +:108A80008318C1E64742BB42BF41C218FCE64742D9 +:108A9000BA42BF41821830E74642B342B641C318DA +:108AA00064E7724293429241F3189DE70023D5E7B1 +:108AB000A2689800121800201060013362689A4280 +:108AC000F6D8002901DB2800F8BD802252002000E2 +:108AD000FFF7D8FDF7E7F8B504000F21FCF70EFF0C +:108AE000061E00D0E2E0A1680B68C869834292418B +:108AF000D2B21B1ACD6AAB4280414042121A50B228 +:108B00005B1B0B60A1684B68120600D5A3E01B1825 +:108B10008342804142420D6AAB4280414042121A78 +:108B2000D2B25B1B0D6BAB4280414042121A50B275 +:108B30005B1B4B60A1688B68120600D590E01B1888 +:108B40008342804142424D6AAB4280414042121A08 +:108B5000D2B25B1B4D6BAB4280414042121A50B205 +:108B60005B1B8B60A168CB6812067ED41B18834206 +:108B700080414542886A834292415242AD1AEDB229 +:108B80001B1AC869C3188342804140424019C0B2D1 +:108B9000CA6AD318934292415242121850B2CB6023 +:108BA000A1680B69120665D41B18834280414542B7 +:108BB000C86A834292415242AD1AEDB21B1A086A4A +:108BC000C3188342804140424019C0B20A6BD31897 +:108BD000934292415242121850B20B61A1684B6904 +:108BE00012064CD41B18834280414542086B8342D5 +:108BF00092415242AD1AEDB21B1A486AC318834221 +:108C0000804140424019C0B24A6BD318934292410E +:108C10005242121857B24B61A0688369120633D4CE +:108C2000DB19BB42BF417D42416B8B4292415242B4 +:108C3000AD1AEDB25B1A816ACB188B428941494269 +:108C4000491949B283610B1C002922DB5BB2A2687F +:108C5000D361072324E0424293429241C3185AE76A +:108C6000424293429241C3186DE74542AB42AD4147 +:108C7000C3187FE74542AB42AD41C31898E7454270 +:108C8000AB42AD41C318B1E77D42AB42AD41FB18E9 +:108C9000CAE70023DAE7A2689D0052190025156093 +:108CA000013362689A42F6D8002901DB3000F8BD32 +:108CB000E0222000FFF7E6FCF8E7000070B50400B2 +:108CC0000430012565609208A260E160002B05D0A8 +:108CD00001222261049A92086261A3610125E56183 +:108CE000069B9B082362059B636226004C36E56465 +:108CF0000C9B9B0823650B9B6365A562089B9B08E7 +:108D0000E362079B236365630A9B9B08A363099B3C +:108D1000E36325646564084BA364FCF719FFA06551 +:108D20003000FCF715FFE06525660D9B63670023A7 +:108D3000A367002070BDC046E001000830B58BB0CD +:108D400004000D00FEF775FF2570022D05D0032DE0 +:108D50001DD0002323701A4817E01A4B63661A4986 +:108D60001A4B09931C230893194A07920693194A30 +:108D700005920493184A03920293184B019300231F +:108D8000009320222000FFF799FF0BB030BD144B59 +:108D900063661449144B099320230893134A0792DE +:108DA0000693134A05920493124A03920293124BBC +:108DB00001930023009320222000FFF77FFFE4E7C8 +:108DC00080B1FFFFD78A0010D44701102441011061 +:108DD000B84701109C4701108047011064470110FB +:108DE000D1860010B44E0110F4470110944E0110CA +:108DF000744E0110544E0110344E011010B50A1E6D +:108E000003D0024B1B680021984710BDE401000805 +:108E100010B56C22002109F0F3FF10BD00230360A0 +:108E20004360002912D1124B8360124BC360124B76 +:108E30000361124B4361124B8361124BC361124BAE +:108E40000362124B4362816600207047104B8360BF +:108E5000104BC360104B0361104B4361104B836197 +:108E6000104BC361104B0362104B4362EBE7C046EB +:108E700067E6096A85AE67BB72F36E3C3AF54FA5AB +:108E80007F520E518C68059BABD9831F19CDE05BD7 +:108E9000D89E05C107D57C3617DD703039590EF7DD +:108EA000310BC0FF11155868A78FF964A44FFABEA3 +:108EB000F0B5DE4657464E464546E0B5DBB00F906E +:108EC00000230400072B09D89A1C920010591A009D +:108ED0004232920010AD50510133F3E7002010E010 +:108EE00082008B5C1B068A185478240423439478F0 +:108EF00024022343D2781343821C920010AC1351F6 +:108F000001300F28ECD90023009376E210AA9223B7 +:108F10005B00D25810A88C21490041580D00062052 +:108F2000C5412B000D000B24E5416B4008001925BD +:108F3000E8414340D21810AE0835FF3573598E27EB +:108F40007F00F659B2463000584008405840121889 +:108F5000FE48009FBC008446205812180237029732 +:108F6000BD0010AE0595A8591218109284277F00F5 +:108F7000F4592000073FFF3FF84127000D25EC4141 +:108F8000250045403C001620C4416540862464000D +:108F90003659B1463000384010AE04343659B04628 +:108FA0004C4604973C43270037403843281811901B +:108FB00010AE8A256D002C007559551935511218BF +:108FC000103432512C000620C441270028000B2405 +:108FD000E04178402E001927FE417040181856468F +:108FE0004E4033002B4056467340C318009E701C01 +:108FF000800067460397C0591B18F01C8600B446D2 +:1090000010AE604680591818019010901600022783 +:10901000FE41300016000B37FE4137004740160076 +:109020001620C64177401600049B1E4030001E00EB +:1090300016434B461E40304338181190019FBB46E3 +:10904000D84410AE88277F004346F35183445846E6 +:1090500090235B000190F05046460620C641370041 +:1090600046462300E6413000784046461927FE4137 +:10907000704050440E006E403700464637404F4027 +:10908000C7190398059C20583818029F0237BF0063 +:1090900010AEBF59C01910905E460227FE41B2467D +:1090A0005E460D24E6413700564677405E46093459 +:1090B000E6417E40B2465C465E46164037001600EA +:1090C0002643049C26403743BA44564611964E46E2 +:1090D000371810AE862464003751504404008E20A7 +:1090E0004000029434503E000624E641B2463E0061 +:1090F000DE41B146564648464640B1463E0013342E +:10910000E641B2464E4650464640B1468944414645 +:109110006940394069404944039866463658B44628 +:109120006144009B5E1DB600B24610AE53469E5988 +:10913000B44661441091029B1E00173CE641B446C0 +:109140001E000B34E641B14666464C466640B146C9 +:109150001E001624E641B4464E4664466640B146BB +:109160001C001E00019B1E40B4461E0026431640F4 +:10917000B34666465C462643B446CC4466461196E2 +:10918000049E741810AE84235B00F45061441033C5 +:10919000F1502600133BFF3BDE41B146260005336C +:1091A000DE41B4464E4663465E40B446260019236F +:1091B000DE41B14666464B465E40B446AC44464648 +:1091C0007E4035002540464675406544009B1E1D87 +:1091D000B6003658B44665449E1DB60010AB0496E2 +:1091E000F658B446AC44664610960B000225EB4197 +:1091F00099460B000B35EB411D004E4675400E00A5 +:109200001623DE416E40B1460E00029B1E40350023 +:109210001E000E43019B1E4035434D44119591465F +:10922000E14410AE922252004B46B3502A006244F1 +:109230008A256D0072514E460623DE41B4464E46E5 +:109240000A3DFF3DEE413500664675404E461333FC +:10925000DE417540A8443E00664035004E4635402C +:109260007D40454456463658B4466544009BDE1D55 +:10927000B600B34610AE58468659B44665441095BC +:1092800016000220C641B44616000D23DE41B0464A +:10929000664640464640B04616001620C641B446D3 +:1092A000464660464640B04616000E40B4460E00A4 +:1092B000164302980640B246664650460643B446F8 +:1092C000E04446461196019EB446AC4410AE1433B9 +:1092D000FF336046F0504544103BF55066460B3B6B +:1092E000FF3BDE41B04666460533DE41330046466D +:1092F000734066461920C6417340FF184E466640CB +:109300003300664633406340FB18039F049EF759C1 +:10931000DB190826B04600988246D044464601969E +:10932000B70010AEBF59DB1910932E000227FE4183 +:10933000B0462E000B37FE413700464677402E00E0 +:109340001620C6417E40B04602E0C046D44E011011 +:109350002E001640370016002E430E403743B84407 +:1093600040461190029882469A4410AE8E204000EA +:109370005746375043441F0086235B00F75056463C +:10938000073BFF3BDE41330056461238FF38C641EB +:10939000734056460E30C6417340E31864464E464D +:1093A00074405046044074401B1903985C46205892 +:1093B0001B18009E0936B60010A830581B181093D1 +:1093C00038000224E0413E000B34E64170403E008C +:1093D0001624E64170403C002C403D432A40224385 +:1093E00082181192C91810AC8C20400021509B1893 +:1093F00084277F00E351019B0093009B0F2B00D833 +:1094000084E510231800DCE310AA92235B00D358F4 +:1094100011008C22520089588C460A000621CA414C +:1094200061460B24E1414A4061461926F1414A4018 +:109430009B1810AA90277F00D15914008E22520049 +:10944000A458A24622004A40644622404A409B1843 +:10945000FE4A84000192A2589B18871E069710AE00 +:109460000A94A45922001127FA411500220002375C +:10947000FA415540A20A6A40C41F0794441FA40041 +:10948000A459121904000D3CA400A14634004E4614 +:1094900035592F000724E7413E002C001227FC41DC +:1094A0007440ED086C40141902000E3A920010AEA0 +:1094B0009259A218841C0B94A4000494A2519846BB +:1094C00090444346109384225200B4582700073A30 +:1094D000FF3AD7413E0027000B32D7417E402200A1 +:1094E0001627FA41564010AAF637D2599346224021 +:1094F000150010AF88225200BA585F462743174024 +:109500003D437519119510AB8A277F003E00DF5946 +:10951000474400979F512B00434410AF92256D00A4 +:109520007B51009F1F3DFF3DEF413E00009F0535F1 +:10953000EF413D007540009F1926F7417D404D19D0 +:10954000514667467940009F39405746794069182F +:10955000451CAD00019E0595AD594919471E089758 +:1095600010AF059DED592F001126F741B8462F0089 +:109570000236F7413E0047467E40AD0A6E40871FE7 +:109580000997051FAD0010AFED59761907000C3F84 +:10959000BF0010AD0C977D59A8462F000725EF415D +:1095A000029747460B35EF413D00029F7D404746FD +:1095B000FF087D40751910AF4E46F659AD19C61C0F +:1095C000B6000D96F5518946A944494610911F00F1 +:1095D0000226F7413D001F000B36F7413E006E406A +:1095E0001F001625EF417E401F0027403D00270049 +:1095F0001F4359460F403D43751911954A4410A920 +:109600008826760002928A514D440F00902149002D +:1096100003957D5002990F000625EF413E000F0093 +:109620000535EF413D0075400F001926F7413E001A +:109630006E4056446746009D6F403D000D406146B8 +:109640004D4075190199049A5658AD1910AFD65965 +:1096500037001121CF41B94637000231CF41B8461A +:109660004F4641464F40B60A7E40C71EBF00B8462F +:1096700010AF4146CF59B84646440B277F42B84603 +:1096800080444746BF0010A90E97795889460F00BD +:109690000721CF41BA464F460B31CF41B846574616 +:1096A00041464F404946C9084F40B846B04410AE05 +:1096B0000C9FBE5946440B990227B84641448F007F +:1096C00010A90B977E50AE191096039A1700022529 +:1096D000EF41B84617000B35EF413D0047467D404E +:1096E00017001621CF416F40B84617001F403D00BC +:1096F0001F00174327403D4345441195D846B044C9 +:1097000010AFF63142467A5076198E256D007E51A3 +:109710004746173DFF3DEF41B94647460535EF4106 +:109720003D004A4655404746F339CF417D40AC4461 +:10973000009F02994F403D0042461540009F7D40EA +:10974000654401990D9F7A589446AC4410AABD58BF +:109750002F001121CF41BA462F000231CF41B94627 +:1097600057464A465740AD0A7D40069FBA0091468B +:1097700010AA4F46BA589146A94407000A3FBF00B5 +:1097800010AA0697BA58924617000725EF41BB4624 +:1097900017000B35EF413D005A4655405246D2085E +:1097A00055404D4410AA0E9FBA5891464D44421D53 +:1097B0009200934610AA5F46BD506544109537004D +:1097C0001139CF41BC4637000B31CF41B94667460E +:1097D0004A465740B94637000931CF41BC464F464B +:1097E00062465740B9463700039A1740BC461700F7 +:1097F00037431F40BA46674652461743BC46E144CA +:109800004A461192A446AC4410AA842464006746D8 +:109810001751AA46CA4454468C256D005451133D35 +:10982000FF3DEF41B94667460535EF413D004A46E9 +:10983000554067460331CF417D40009FB9464D44B6 +:10984000474602994F40624602E0C046D44E01109E +:1098500017404F40EF19051DAD0001996D587F1954 +:10986000009710AA0B998D582F001121CF41BA46AD +:109870002F000231CF41B94657464A465740AD0AFC +:109880007D40089FBA00914610AA4F46BA589146AB +:10989000A9440700093FBF0010AA0897BA5817004B +:1098A0000725EF4111000B35E9410D007D40D2083D +:1098B00055404D4410AA06998A5891464D44821D40 +:1098C000910010AA06918D50009FB946A9444F46B9 +:1098D0000097109721000225E941894621000B35A8 +:1098E000E9410D004A46554027001621CF416F40FF +:1098F000B946270037403D003700274303990F4002 +:109900003D434D441195009FB9464B4410AA922106 +:109910004900009353507F198A235B00D750009968 +:109920000B000625EB4199460B000535EB411D0068 +:109930004A4655400B001921CB415D40029B994698 +:109940004D44424663465A40009B1A4043465A40A3 +:10995000AA1801995B465D58521910AB5D46ED5847 +:109960002B001121CB419A462B000231CB41994665 +:10997000534649464B40AD0A5D4010A90A9B5B58CF +:109980009946A9440300083B9B000A935B589A46FA +:109990000725EB419B4653461221CB411D005B46F8 +:1099A0005D405346DB085D404D4410A9089B5B5861 +:1099B00099464D44C31D9B009B460B005946CD5014 +:1099C00055192A0010953B000221CB4199463B00D6 +:1099D0000B31CB411D004B465D403B000931CB4173 +:1099E0006B4099463B0023401D0023003B4333401E +:1099F0001D434D44119503999146494410AA902363 +:109A00005B00D150A9444D4610AA103B0295D55099 +:109A10000A000625EA4191460A000535EA4115008B +:109A20004A4655400B001922D3415D40A844624686 +:109A3000009B5A4015000D40624655404544019A2E +:109A4000069B9A589046A84410AA9D582B001122B4 +:109A5000D3419A462B000232D341994653464A4697 +:109A60005340AD0A5D4010AA059B9B589946A944F6 +:109A7000079B9B0003939B589A460725EB41524650 +:109A80000B35EA4115005D405346DB085D404D440F +:109A900010AA0A9B9B5899464D4408239946814435 +:109AA0004B4605939B00994613004A46D550A8445F +:109AB00043461093029A13000225EB419946130086 +:109AC0000B35EB411D004B465D4013001622D34180 +:109AD0006B409946029A13003B401D003B00134324 +:109AE00023401D434D441195B146C14410AE8E2311 +:109AF0005B004A46F2504544103BF5504B46062663 +:109B0000F34198464B460536F3411E0043465E40FE +:109B10004B461922D3415E406644009A51404B4661 +:109B2000194013004B40F318019A594689585B18A5 +:109B300010A95E46765831001122D1418C46310081 +:109B40000232D14162465140B60A714010AA049EC9 +:109B5000B6588919099EB600B658B4460722D641B0 +:109B6000B04666460B32D641424656406246D2085F +:109B700056408E1910AA039989587118093080002F +:109B80008150591810912E000222D641330028002E +:109B90000B32D041434028000932D04143402800D5 +:109BA000029A10402A433A4002439B1811936418CA +:109BB00010AE8C256D007451C91884246400315195 +:109BC00005983F2800D81FE400230F98072B0BD8D7 +:109BD0001A004232920010A954589A1C920011584F +:109BE000091911500133F1E79421490010A8FFF73A +:109BF00005F900205BB0F0BCBB46B246A946A046C2 +:109C0000F0BDC046F8B5CE46474680B506000D000B +:109C1000141E3CD003683F271F404022D21B9046B1 +:109C20001B190360A34202D2436801334360002F33 +:109C300001D044450AD23F2C1CD929003000FFF73F +:109C400037F9002824D14035403CF4E728239946D1 +:109C5000B1444B46D8194246290009F01CF949463F +:109C60003000FFF725F9002812D14544403FE419A0 +:109C70000027E0E7002C01D1002009E03000283067 +:109C8000C0192200290009F006F9002000E0002098 +:109C9000C0BCB946B046F8BD70B504000D000268FE +:109CA0003F231340581CE318283380221A703828A9 +:109CB00079D823002833483A121A1818002109F0DD +:109CC0009FF82268510F6368DB001943D2001E0E13 +:109CD000602026541E0C013026541B0A01302354E8 +:109CE0006323E154110E0133E154110C0133E154AB +:109CF000110A0133E1540133E254210028312000DC +:109D0000FFF7D6F800285CD1E37A2B70A37A6B704A +:109D1000A3681B0AAB70237AEB70E37B2B71A37BE8 +:109D20006B71E3681B0AAB71237BEB71E37C2B72D5 +:109D3000A37C6B7223691B0AAB72237CEB72E37DFD +:109D40002B73A37D6B7363691B0AAB73237DEB736A +:109D5000E37E2B74A37E6B74A3691B0AAB74237E12 +:109D6000EB74E37F2B75A37F6B75E3691B0AAB75FF +:109D7000237FEB75236A1B0E2B76638C6B76236A2D +:109D80001B0AAB76236AEB76A36E002B19D1626AAD +:109D9000120E2A77E28C6A77626A120AAA77626ADE +:109DA000EA7718000DE0260028364022121A3018F3 +:109DB000002109F025F831002000FFF779F800288C +:109DC00000D070BD38220021300009F019F878E782 +:109DD00001BE01487047C04602020204024B0B60FC +:109DE00009231360002070472C02000810B540784A +:109DF00006F022FC10BD000070B504001500914271 +:109E00009B415B4283420AD001234340DBB28A423A +:109E1000894149428B4202D0002C0CD070BD07F022 +:109E2000F3FA06000549280008F064F80100300044 +:109E300006F0CCFDF0E707F05BFDEFE740420F00D6 +:109E4000F8B504000A7813000D3BDBB2012B04D9EE +:109E50000F2A32D14D78013500E04D78002005F011 +:109E600021FE0600002005F0EBFD06F0C5FBF040EA +:109E70000700280006F0C0FBF04006006378002BC6 +:109E80000FD06078E9B205F0BDFD05006378002BC6 +:109E900014D100280BD1320039000020FFF7ACFFAD +:109EA0000CE0020039000120FFF7A6FFE9E73A00C5 +:109EB00031000020FFF7A0FF00E0014D2800F8BDB1 +:109EC00001020204F8B5060004292BD026D8012986 +:109ED0002AD0022920D10124002005F0E3FD05004D +:109EE000002005F0ADFD06F087FB0700EF40E040E5 +:109EF00005007378002B19D07078210005F0B2FDB1 +:109F000004007378002B1ED1002815D12A003900D7 +:109F10000020FFF771FF16E00C4C14E0082911D166 +:109F20000324D9E70224D7E70024D5E7020039004B +:109F30000120FFF761FFDFE73A0029000020FFF76B +:109F40005BFF00E0014C2000F8BDC04600020204A7 +:109F500010B5002903D0407805F00EFD10BD407803 +:109F600005F034FDFAE710B5407805F01DFD10BD91 +:109F700010B503000A000178880706D4013A0320CF +:109F80000840597805F0EAFA10BD013A032008406C +:109F90005978002305F028FBF6E710B503000029E7 +:109FA00006D0027803201040597805F0BFFB10BDA1 +:109FB000027803201040597805F0FAFBF7E700001B +:109FC0000048704754570110F0B585B005000E00E9 +:109FD0000192080001F090FFC7B2002401E00134B3 +:109FE000E4B2BC420FD203A805230370467084700C +:109FF00000F0D0FB0028F2D12E706C700123AB7002 +:10A00000019B6B6000E0014805B0F0BD020D020449 +:10A0100070B582B006000C0000280FD0002C0FD0C5 +:10A0200001A805230370237843706378837000F0E0 +:10A03000B1FB051E06D0280002B070BD01BEEDE7E1 +:10A0400001BEEDE708222100300008F024FF0123C3 +:10A05000B370F0E710B5002808D00378122B07D0B2 +:10A06000032B08D943685B68984710BD01BEF4E72D +:10A07000FFF76EFFF9E7FFF790FFF6E710B500284E +:10A0800008D00378122B07D0032B08D943681B692B +:10A09000984710BD01BEF4E7FFF714FFF9E7FFF79B +:10A0A00067FFF6E710B582B0041E10D0A378002B2E +:10A0B00000D101BE01A805230370237843706378A3 +:10A0C000837000F0AFFB0023A37002B010BD01BE8F +:10A0D000ECE710B5002808D00378082B07D0092B2F +:10A0E00000D001BE00F054FA10BD01BEF4E700F04C +:10A0F000FDF8F9E710B5002808D00378082B07D041 +:10A10000092B00D001BE00F08DFA10BD01BEF4E7AE +:10A1100000F02AF9F9E710B5002808D00378082BD9 +:10A1200007D0092B00D001BE00F0A0FA10BD01BE7F +:10A13000F4E700F04BF9F9E710B5041E1BD020003E +:10A14000FFF7C7FF002800D001BE02212000FFF763 +:10A15000E2FF002800D001BE7823E15A00290CD18B +:10A160002378082B11D02378092B12D07A23E35CB3 +:10A17000002B12D010BD01BEE1E702222000FFF744 +:10A18000B9FF0028ECD001BEEAE7200000F032F869 +:10A19000E9E7200000F06CF9E8E7200000F042FB5E +:10A1A000E8E70000054A80239B019C46604480004C +:10A1B00083585B005B0883507047C0460000204016 +:10A1C0000023032B07D8064A99008A58002A04D195 +:10A1D0000133DBB2F5E7002070470120FCE7C04601 +:10A1E000886301088000C0B24018C0B20230C0B21B +:10A1F00070470000F0B5C64600B50600443001F0D7 +:10A20000CFFFB178324801F0D5FF7478A400E4B2F2 +:10A21000B378E418E4B23434200006F085FA05007F +:10A2200001238340DB435BB22A4A11780B40137051 +:10A23000210006F061FA280000F0A2FC002D29DBC5 +:10A24000AB08254FC0339B00DA59944603212940BF +:10A25000C900FF22904615008D406246AA431500B2 +:10A260008001424602408A402A43DA512000FFF72B +:10A2700099FF72789200D2B2B3789B18DBB2174A7A +:10A280009B0000219950FFF79BFF002819D080BC4C +:10A29000B846F0BD0F232B40083B9B0806339B00BC +:10A2A0000F4A94466344596803221540ED00FC327E +:10A2B0001700AF40B94380010240AA400A435A60E8 +:10A2C000D4E7084800F046FF074B00221A70DEE78B +:10A2D00000002A40AF64010800E100E08863010843 +:10A2E00000ED00E05002000898630108054B9A68F1 +:10A2F000FF231340817801228A4013405A1E934164 +:10A30000D8B2704700002A4070B5022924D008292D +:10A3100022D0012916D001BE1BE000231D430134C9 +:10A32000E4B2032C11D8002D0FD10D4BA200D05850 +:10A330000028F2D0FFF7DAFF002801D00123EDE773 +:10A340000023EBE700240025EBE701235D40054BEC +:10A350001D70044B187870BD024B00221A70F8E78C +:10A36000886301089863010870B50C00022A26D89A +:10A370008378032B00D901BE124910331B025A58AF +:10A38000520052085A50436CC02293434364403AEF +:10A39000134343648378032B00D901BE094910336A +:10A3A0001B025D58802212062A435A508178407859 +:10A3B000FFF718FF0100200000F072FB70BD02489B +:10A3C000FCE7C04600002A400106020402291ED80C +:10A3D0008378032B00D901BE0E4910331B025A5853 +:10A3E000520052085A50436C302293434364134343 +:10A3F00043648378032B00D901BE064910331B0246 +:10A4000058588022120602435A50002070470248D2 +:10A41000FCE7C04600002A4001060204054A8023EA +:10A420009B019C466044800083585B005B0883501E +:10A430007047C046000020400023392B07D8064A49 +:10A4400099008A58002A04D10133DBB2F5E70020D5 +:10A4500000E001207047C0469C630108C3001B1A3E +:10A460009B00C018C0B24018C0B20630C0B27047DE +:10A47000F0B5C64600B50500443001F049FE6B78E2 +:10A48000002B4CD13948A97801F04EFE6B78002B97 +:10A4900002D1AE781C2E44D9012B44D001BE344EDB +:10A4A000300006F041F9040001238340DB435BB236 +:10A4B000304A11780B401370310006F01DF920006E +:10A4C00000F05EFB002C33DBA3082B4FC0339B0056 +:10A4D000DA59944603212140C900FF229046140016 +:10A4E0008C406246A24314008001424602408A40EA +:10A4F0002243DA513000FFF791FF6A78D3009B1AAC +:10A500009B009B18AA789B181C4A9B00002199501D +:10A51000FFF792FF002822D080BCB846F0BD184853 +:10A52000B1E73836BCE7AE781C2EB7D85536B7E75A +:10A530000F232340083B9B0806339B00114A944697 +:10A540006344596803221440E400FC321700A7401A +:10A55000B94380010240A2400A435A60CAE70A4850 +:10A5600000F0F8FD094B00221A70D5E700002840E2 +:10A57000FF030000AF64010800E100E09C630108F4 +:10A580000000294000ED00E060020008846401083A +:10A590004378002B0DD1084B084A12685E21515AAE +:10A5A0005B1881786020125A4A439B185868C00F84 +:10A5B0007047034BF0E7C046000028400C660108D6 +:10A5C0000000294070B5022924D0082922D0012991 +:10A5D00016D001BE1BE000231D430134E4B2392C28 +:10A5E00011D8002D0FD10D4BA200D0580028F2D069 +:10A5F000FFF7CEFF002801D00123EDE70023EBE7B2 +:10A6000000240025EBE701235D40054B1D70044B42 +:10A61000187870BD024B00221A70F8E79C6301089D +:10A620008464010870B504000D00022A19D878234B +:10A63000C35A002B00D101BE636CC02293436364F4 +:10A64000403A13436364A1786078FFF707FF010085 +:10A65000280000F025FA002802D178230022E252D7 +:10A6600070BD0148FCE7C04601060204022907D874 +:10A67000436C302293434364134343640020704788 +:10A680000048FCE701060204F0B504280DD00D00D7 +:10A6900011000700304A4400A45A421C1D2A07D862 +:10A6A000D2B22D4E5200965B04E00D250520F0E756 +:10A6B0003226FF360122BA40284F3A4206D16419A9 +:10A6C0001C801B88B34244D20020F0BDC21ED7B20A +:10A6D000182F1DD8BA00224FBA589746214A00E0D9 +:10A6E000214A1E80002AECD00338C7B2182F2BD87D +:10A6F000B8001E4F385887461D4AF2E71D4AF0E75A +:10A700001D4AEEE71D4AECE71D4AEAE71D4AE8E765 +:10A7100001BE0022E5E71C4AE3E70127BD42D0D293 +:10A720006800805A001980B241181980691CB9422A +:10A73000C7DA4D00AE5A3619B6B2C2E70227EDE7C6 +:10A740001027EBE70227E9E701BE0027E6E71A2713 +:10A75000E4E70E48B9E7C046CC580110280B0A0CB4 +:10A76000945701105C58011094580110F8570110CB +:10A7700098580110C85801109C580110BC5801107D +:10A78000C0580110C458011060580110000D020497 +:10A7900000207047F0B583B005000026F5F7B5FE40 +:10A7A000070028786978AA786B460633FFF76CFFB4 +:10A7B000041E0ED16B4606331B88DA08D2B207217D +:10A7C0000B4016498A5C01369E401640731E9E411E +:10A7D000F6B2002C01D1002E1DD1002C05D038007E +:10A7E000F5F797FE200003B0F0BD28786978AA78C5 +:10A7F0006B460633FFF748FF041EF0D16B46DA883C +:10A80000D308DBB207211140044A01208840D15C03 +:10A810000143D154E3E7024CE1E7C04688640108F4 +:10A82000010D020430B583B00400F5F76EFE05009B +:10A8300020786178A2786B460633FFF725FF031E68 +:10A840000ED16A4606321288D108C9B207241440D4 +:10A8500007480122A240D24352B2445C22404254F3 +:10A86000002B00D001BE2800F5F753FE03B030BD29 +:10A8700088640108020000230020002B00D07047EC +:10A88000002A00D018000133DBB2F6E710B504004F +:10A89000FFF7F0FF200010BD002001E00130C0B242 +:10A8A000102805D8044B1B5C002BF7D040B201E008 +:10A8B000012040427047C0466851011070B5050044 +:10A8C0000C00FFF7E9FF0300114A525D002A10D087 +:10A8D000104A11688A687020085A1218A400EB1AEE +:10A8E00010337220095A4B43E418A4182068C0B2F0 +:10A8F00070BD084B1A6893687021515A5B18A40008 +:10A900007221525A6A43A418E4182068EFE7C0463F +:10A91000685101100C660108F8B5CE46474680B56F +:10A92000070015001C0008AB1B78984609AB1E7881 +:10A93000234B1B5C002B17D0411ACDB22800FFF728 +:10A94000A5FF000204432800FFF794FF000404431E +:10A950001C482043002E04D04246002106F0C0FED1 +:10A9600024E006F017FF21E0FFF790FF030299466D +:10A970001D433800FFF77EFF0304280018434A46B2 +:10A98000224313438021C9051943002E12D10E4BD7 +:10A990001A6893687021515A5B18A4007221525AA8 +:10A9A0007A43A418E418002323600020C0BCB946F1 +:10A9B000B046F8BD4346002206F02EFEF6E7C0463C +:10A9C00068510110001000400C660108F0B5CE4639 +:10A9D00000B584B00C0002924508EDB20123184086 +:10A9E0008146FFF759FF0390264B1F5D1B57002B35 +:10A9F00013DB102F40D8244B1E5D00243A00234B5C +:10AA00007900CB5AA34232D9214BB900CB581B5DF8 +:10AA1000AB4208D00134A4B2F0E77F233B40C2B27E +:10AA20009B18DFB2E5E71B4B9B5C002B02D0B3B257 +:10AA3000A34223D1029B022B05D031003800FFF73F +:10AA40003DFF00281CD1029B002B01D100200FE00C +:10AA5000E2B26B46197B029D013D6B425D4101955F +:10AA60004B46009333003800FFF756FF00E00A48DA +:10AA700004B080BCB946F0BD0748F9E70648F7E7DF +:10AA80000648F5E7FC50011074560110E05601101D +:10AA9000E801000868510110010C0204000C0204D6 +:10AAA00010B50222FFF792FF10BD000070B582B012 +:10AAB0000C008378DA08772B15D8134909688E695A +:10AAC000D201B618C27807251D400092012322004A +:10AAD0002900300001F0DEFC0A2C08D00B2C0CD031 +:10AAE000002002B070BD084A12689669EAE70122A8 +:10AAF0002900300001F026FDF2E700222900300095 +:10AB000001F020FDECE7C0460C66010800B583B0FB +:10AB10000300C20877280FD8094909688869D2015B +:10AB2000801807211940002300930133082201F007 +:10AB3000B1FC002003B000BD014A12689069F0E743 +:10AB40000C66010870B54300C01885B22A000020C9 +:10AB500010E0D308D1B207241440EEB2891BC9B269 +:10AB6000064EF35C2341012423408B401843C0B2BE +:10AB7000013292B2EB1C9A42EBD370BDB064010873 +:10AB8000F8B506000024FF2700E00134A72C0CD8FC +:10AB9000A5B2280005F0C8FDB042F6D12800FFF7A5 +:10ABA000D1FF8742F1D90700EFE73800F8BD000078 +:10ABB00070B582B00E0011000023072B15DC0C4A83 +:10ABC00015782C001C41E40701D50133F5E7DCB210 +:10ABD00001229A40064B15431D706B461C8058801D +:10ABE0000196684605F0ECFD00E0024802B070BD39 +:10ABF000AF640108020D020470B5094C83001C59B2 +:10AC000008481D58002C09D0002D05D00023181E1F +:10AC100001D12000A84770BD0123F8E70123F6E722 +:10AC200024650108F0640108F0B5C64600B50600C9 +:10AC30008846080001F045F907000024012517E0C7 +:10AC4000022231003800FFF7D7FF0137FFB2BC42C4 +:10AC5000F6D84346022B19D0082B17D0012B18D158 +:10AC6000002D16D00D4B01221A7012E00134E4B20F +:10AC70000C2CEED83A0031002000FFF7BDFF051E76 +:10AC8000F4D14346012BF1D10027E0E7034B00222A +:10AC90001A70280080BCB846F0BDC046EF640108B9 +:10ACA000020000200C2806D8044B1B5C934203D002 +:10ACB0000130C0B2F6E7FF207047C046C45901100A +:10ACC00010B5123883B2202B1DD89800104B1B589A +:10ACD0009F46002000E00220FFF7E2FF10BD0320A6 +:10ACE000FAE70420F8E70520F6E70620F4E7072056 +:10ACF000F2E70820F0E70920EEE70A20ECE70B2056 +:10AD0000EAE70C20E8E701BEFF20E5E70120E3E7E2 +:10AD10000859011010B5EFF30580103800B205F0A6 +:10AD20001DFD054B984205D0FFF7CAFF034B80007D +:10AD3000C05810BD0020FCE7FF0300002465010897 +:10AD4000F0B5D6464F464646C0B582B081468846E5 +:10AD500017009A46002614E053469A7863789A4280 +:10AD600001D0002320E001231EE001A81723037077 +:10AD70002378437063788370FFF70CFD002816D0AA +:10AD80000136BE4217D2B4004444A5784D45F7D1F0 +:10AD90005346002BE9D01B78172BE6D153465A783F +:10ADA00023789A42D8D00023002BE9D004E001A8F0 +:10ADB000FFF738FD00E00024200002B0E0BCBA46F6 +:10ADC000B146A846F0BDF0B5CE46474680B583B043 +:10ADD00080460F00160000250023994600E001354B +:10ADE000B5421CD2AC003C19A3784345F7D120787A +:10ADF000FFF756FF01AB17221A70587062789A70ED +:10AE00001800FFF7C7FC0028E9D101A8FFF70AFDE9 +:10AE10002278012393404A461A439146DFE7484689 +:10AE200003B0C0BCB946B046F0BD0000014B187875 +:10AE30007047C046EF64010870B50D001400FFF7BD +:10AE40002FFF134B8000C550124BC450002300202D +:10AE500001E00133DBB20C2B08D80D4A9C00A2584C +:10AE6000002AF6D0012809D00130F2E7002806D1E7 +:10AE7000002D00D001BE084800F06CF970BD01281B +:10AE8000FCD1002DFAD0044800F058F9F6E7C0468E +:10AE900024650108F064010870020008F0B5C64698 +:10AEA00000B50400884616001F0005E00123424655 +:10AEB0001370002B1AD0E4680E4DAC4216D02568F2 +:10AEC000002DF8D020793040B042F4D163793B4076 +:10AED000BB42F0D0A26839003000A8470028E5D175 +:10AEE000012F01D00123E2E70023E0E7200080BC2E +:10AEF000B846F0BD89070000F8B504000F00160041 +:10AF000000E0E468BC420ED02568002DF9D023791A +:10AF10003340B342F5D163799B07F2D4A268022192 +:10AF20003000A847EDE7F8BD70B505000C00F5F757 +:10AF3000ECFAE368002B02D0F5F7EBFA70BD2B6852 +:10AF4000E3602C60F8E7000070B504000D00F5F731 +:10AF5000DCFA01E00C331C002368064A934205D05A +:10AF6000AB42F7D1EB6823600023EB60F5F7D1FA31 +:10AF700070BDC04689070000F0B5D64600B584B064 +:10AF80000D0000F0ABFF0090060002AB0122DA7169 +:10AF9000022809D0082807D0102805D01E4B1B68AE +:10AFA0009A461E4B1F6804E01B4B1F681B4B1B6817 +:10AFB0009A4602ABDC1D009B2A0021003800FFF7F7 +:10AFC0006DFF01902378002B11D1504602AB07335F +:10AFD0001B78002B01D1012E10D002AB07331B7858 +:10AFE000002B16D0002004B080BCBA46F0BD009BF8 +:10AFF0002A0021005046FFF751FFE7E72A00010031 +:10B000005046FFF779FF2A0001993800FFF774FFD7 +:10B01000E3E70348E7E7C04684020008800200082F +:10B02000FF00420070B50C0020212000FFF7A4FFB4 +:10B030000500042C01D0280070BD002005F0FCFAAA +:10B04000034906F057FF0100012005F0BFFCF2E7BD +:10B0500040420F0070B50C0010212000FFF78CFF5C +:10B060000500082C01D0280070BD002005F0E4FA8E +:10B07000034906F03FFF0100002005F0A7FCF2E7BE +:10B0800040420F0010B508000821FFF775FF10BD02 +:10B0900010B50400FFF770FF042C02D0082C15D067 +:10B0A00010BD0F4B1B68DB0705D50E4B1B78002B23 +:10B0B00002D0012300E000230B4A1370002BEFD0D5 +:10B0C000074A136801218B431360E9E7064B1B789D +:10B0D000002BE5D0024A136801210B431360DFE720 +:10B0E00010E000E05A650108F465010810B5080099 +:10B0F000012903D1044B1B88002B03D10221FFF748 +:10B10000C7FF10BD0148FCE758650108FF00420079 +:10B1100010B508000121FFF7BBFF10BD70B504009A +:10B120000D00160004491C2207F0B5FE26602571AB +:10B13000200005F005FE70BDF059011010B5011E8C +:10B1400003D00348FFF7F0FE10BD01BEF9E7C0468B +:10B150008402000810B5011E03D00348FFF7F4FE77 +:10B1600010BD01BEF9E7C0468402000810B506F024 +:10B1700027FA002808D1194A19480021FFF7CEFF05 +:10B18000002804D1174810BD05F08EFEF3E7164ADB +:10B1900016480121FFF7C2FF002801D11148F2E74C +:10B1A000134A14480221FFF7B9FF002801D10D48C6 +:10B1B000E9E7114A11480321FFF7B0FF002801D148 +:10B1C0000848E0E70E4A0F480421FFF7A7FF0028D0 +:10B1D00001D00020D7E70348D5E7C04611B10010E1 +:10B1E000D4650108011A0204EDB00010646501087D +:10B1F00085B000108065010855B00010B8650108E1 +:10B2000025B000109C650108002800D001BE024B4B +:10B210008000C1507047C046F065010810B505F0C8 +:10B2200063FB002010BD10B5FFF7F8FF002800D029 +:10B2300001BE10BD064B1B681A6880239B019C460B +:10B2400060448000815880231B060B438350704765 +:10B250000C660108054A80239B019C4660448000DF +:10B2600083585B005B0883507047C0460000204055 +:10B27000012803D0022803D1013070470220FCE7E7 +:10B280000020FAE703280DD005D801280CD00228A9 +:10B2900005D104207047042801D10820FAE701BE37 +:10B2A0000220F7E70620F5E70220F3E710B50300D8 +:10B2B000814206D9091A64204843190006F01AFE93 +:10B2C00010BD411A64204843190006F013FEF7E749 +:10B2D000F0B5DE4657464E464546E0B587B0050018 +:10B2E0000E000192984610AB1B7899461E230371FD +:10B2F00000234373FF33C371037243728372FF29C8 +:10B300001CD0019BFF2B1ED0FF2E03D1019BFF2BD6 +:10B3100000D1F4E0F5F7F9F882467A4B1F68FF2E6A +:10B3200016D10198FF281AD14346FF2B1DD14B4659 +:10B33000FF2B21D1002F26D000242BE04B46FF2BE2 +:10B34000DFD0714CAEE04346FF2BDDD06E4CA9E060 +:10B350006E4913223000FFF736FD0740E1E76C49E4 +:10B360001322FFF730FD0740DEE76A49122240460C +:10B37000FFF729FD0740DAE7674912224846FFF741 +:10B3800022FD0740D6E75046F5F7C3F85E4C89E04A +:10B390000134E4B23B00E340DB07F9D5172304AAEC +:10B3A0001371547100239371584905AB1322300077 +:10B3B000FFF7C6FC8346564905AB13220198FFF7F9 +:10B3C000BFFC0390534905AB12224046FFF7B8FC7F +:10B3D0000290514905AB12224846FFF7B1FC070025 +:10B3E000FF2E02D05B46002B10D0019BFF2B02D01A +:10B3F000039B002B0AD04346FF2B02D0029B002B5D +:10B4000004D04B46FF2B02D0002F00D101BE1723E2 +:10B4100004AA13702000FFF743FC04AB587000230C +:10B4200004AA93701000FFF7B5F904005046F5F731 +:10B4300070F8002C36D105AB1A88AA809B78AB71C6 +:10B44000FF2E37D1002C02D1019EFF2E3AD1002CC5 +:10B450000CD1029B002B09D00821180000F0DDFC64 +:10B46000041E03D10123EB7243466B72002C0BD1F7 +:10B47000002F09D00621380000F0CFFC041E03D1B4 +:10B4800001232B734B46AB72002C09D1119B002B6F +:10B4900020D000236B732B001033119A03CA03C30F +:10B4A000002C23D0200007B0F0BCBB46B246A94612 +:10B4B000A046F0BD0621584600F0AFFC041EC1D1E5 +:10B4C0002E72BFE70821039800F0A7FC041EBED12E +:10B4D000EE71BCE7291D280010300133012200F075 +:10B4E00023FD0400434243416B73D9E768792B7C09 +:10B4F000032119406A7C04F0DFF80400D2E7024C13 +:10B50000D0E7C0468C590110001F0204B050011052 +:10B5100064500110D44F01101C500110F8B52E4D8D +:10B520002F68FFF7F7FB041E286054D000682B4BF0 +:10B53000C5582B4BC6582100183101F0F7FFAB0658 +:10B540000AD52268F8231B012021D150D358E36C7F +:10B55000002B01D0202098476B060AD52268F823DB +:10B560001B014021D150D358E36C002B01D0202087 +:10B570009847EB0705D5E36C002B02D080204000F4 +:10B580009847AD0510D52168F822120180239B0051 +:10B590008B508A582268134951580B431248014274 +:10B5A00000D001BE0F49535073060AD52268FC2310 +:10B5B0001B014021D150D358E36C002B01D0102047 +:10B5C0009847F60705D5E36C002B02D08020800059 +:10B5D0009847014B1F60F8BDF86501088C0F00000B +:10B5E000CC0F0000880F00008CF8FFFF70B50D0035 +:10B5F000140005F031F82100694306F07BFC70BDB2 +:10B60000F0B5C64600B582B080460E000824FF277C +:10B610000823019301E00134E4B2102C17D835005F +:10B62000654305F019F86B08C018290006F062FCA4 +:10B63000010022004046FFF7D9FF01003000FFF76C +:10B6400035FEC0B28742E6D907000194E3E70198CE +:10B6500002B080BCB846F0BD70B504004079FFF779 +:10B660001FFB06001B4B8200D05820602100543184 +:10B670002200183201F09AFC051E01D0280070BD8E +:10B6800000239C22A3500432A3500C3AA350124B27 +:10B690007600F65A114A03213000FFF789FA30008C +:10B6A000FFF7C8FD300005F03FF8002805DB1F2339 +:10B6B00018401E3B83400A4A13600A4A6079210001 +:10B6C000FFF7BAFB2268116880231B060B43136047 +:10B6D000D4E7C04690590110D45901101DB500108F +:10B6E00000E100E06DB90010F0B5C64600B582B0CB +:10B6F000041E26D02068002808D02100183101F04F +:10B700000FFE206801F0DAFD0023236023791E2B51 +:10B7100019D1A423E35C002B00D177E0AC23E35CD8 +:10B72000002B0AD1B033E35C1E2B00D086E09623B9 +:10B730005B00E35C1E2B00D088E002B080BCB84602 +:10B74000F0BD01BED6E76079FFF7AAFA444B40008E +:10B75000C65A300004F0E8FF050001238340DB43B4 +:10B760005BB2404A11780B401370310004F0C4FF03 +:10B770002800FFF705FA002D24DBAB083A4FC03351 +:10B780009B00DA59944603212940C900FF229046C4 +:10B7900015008D406246AA431500800142460240D2 +:10B7A0008A402A43DA513000FFF754FD60790022C5 +:10B7B0000021FFF741FBA423E35C002B19D01E23DB +:10B7C0002371A6E70F232B40083B9B0806339B0001 +:10B7D000264A94466344596803221540ED00FC3222 +:10B7E0001700AF40B94380010240AA400A435A60A3 +:10B7F000D9E701AD17332B706079FFF751FA687004 +:10B80000A379AB702800FFF70DF8D8E7E01D00F032 +:10B81000F9FA2000083000F0F5FA20000A3000F0B4 +:10B82000F1FA2000093000F0EDFA637B002B00D123 +:10B8300074E720001030FEF735FC6FE72000B030D1 +:10B84000FEF77AFCB0231E22E25470E720002D3070 +:10B85000FF30FEF771FC96235B001E22E2546CE77A +:10B86000D4590110AF64010800E100E000ED00E0F0 +:10B87000F0B5D6464F464646C0B504000D0016004A +:10B88000A823C3588B4201D0A823C150637B002B4F +:10B8900005D13548E0BCBA46B146A846F0BD20689F +:10B8A000002101F03DFD2700103700220021380063 +:10B8B000FEF7D0FB002806D02268116880231B0603 +:10B8C0000B431360E6E7231D994629001800FFF794 +:10B8D00097FE8046A065454304F0BEFE6B08C01885 +:10B8E000290006F007FB824601003800FEF7C6FB80 +:10B8F000051E29D1424651464846FFF777FE002EE5 +:10B9000000D03060002201213800FEF7A3FB702335 +:10B91000E35C002B25D080235B02E26D082A01D86E +:10B9200080252D012B434246013A0F210A40134343 +:10B9300021688022920413430B60226811688023DF +:10B940001B060B431360A5E7002201213800FEF718 +:10B9500081FB2268116880231B060B4313602800BB +:10B9600098E72B00D9E7C046061F0204F0B5DE4673 +:10B9700057464E464546E0B583B004001500067AAA +:10B98000FF2E0ED0F308772E06D8A44A12689269CB +:10B99000DB019046984406E0A04B1B689B699846E3 +:10B9A00001E000239846A37AFF2B0FD0227B002AC8 +:10B9B0003BD0DA08772B05D8984800688769D20110 +:10B9C000BF1804E0954A1268976900E00027072233 +:10B9D00016401A409146102929D0202927D0042D3D +:10B9E00000D10CE100D996E0012D00D19AE0022DA2 +:10B9F00000D093E02268116880231B060B4313607C +:10BA00004346002B05D09823E25C3100404600F00D +:10BA100015FD002F00D1FEE09923E25C4946380075 +:10BA200000F00CFD01239A4609E00027CFE7012D25 +:10BA30000DD000239A46082D44D0042D56D05046F0 +:10BA400003B0F0BCBB46B246A946A046F0BD206894 +:10BA500026001836310001F01FFDC00702D5002373 +:10BA60009A46E8E72068310001F014FD0123034005 +:10BA7000DA225200A0585A425341424250411840E3 +:10BA8000D8235B00E3585A4253411A0002409246C1 +:10BA90000342D0D02068822292008358DB05DB0D60 +:10BAA0008158C90B01220A409B18002B07D1C223E1 +:10BAB0009B00C358DB05BED000239A46BBE700239A +:10BAC0009A46B8E7A823E15800222000FFF7D0FEED +:10BAD000002F08D09923E25C4946380000F0AEFC04 +:10BAE00001239A46A9E701239A46A6E7002F00D131 +:10BAF00082E04946380000F007FD9923E0544946AA +:10BB0000380000F02DFD00224946380000F096FC78 +:10BB100001239A4693E7082D00D16BE701BE00236D +:10BB20009A468CE7206825001835290001F0B4FCFE +:10BB3000C00702D500239A4681E72068290001F05A +:10BB4000A9FC01230340DA225200A0585A42534173 +:10BB5000424250411840D8235B00E3585A425341B7 +:10BB60001A0002409246034200D168E722682C4B3B +:10BB7000D3589C462B4BD0580190822189005358B2 +:10BB8000DB05DB0D5158C90B8B460121584601409E +:10BB90005B18002B36D1C2239B00D358DB0534D170 +:10BBA00063460198184333D14346002B0ED0310031 +:10BBB000404600F0A9FC9823E0543100404600F0D4 +:10BBC000CFFC00223100404600F038FC002F0ED0A0 +:10BBD0004946380000F098FC9923E0544946380063 +:10BBE00000F0BEFC00224946380000F027FC206827 +:10BBF000290001F095FB22E701239A461FE7012364 +:10BC00009A461CE700239A4619E700239A4616E74E +:10BC100000239A4613E701239A4610E70C660108B1 +:10BC20008C0F0000CC0F0000F0B583B0050001912F +:10BC30001700FFF7FBF8002819D12A68D0239B00D2 +:10BC4000D3583E0003E02C68D0239B00E3585A1CD5 +:10BC500008D1002FF7D0002E0BD00120FFF7DEFA1D +:10BC6000013EF0E7019A1370002003B0F0BD0248D6 +:10BC7000FBE70248F9E7C046031A0204021F020468 +:10BC800070B504000D00FFF7D1F8002805D0054875 +:10BC900006E02068290001F068F80028F9D00020AB +:10BCA00070BDC046031A02048369DB0715D401681E +:10BCB000822292008B58DB05DB0D8958C90B0122CB +:10BCC0000A409B18002B0AD1B133FF33C358002B15 +:10BCD00001D0012002E0002000E001207047012097 +:10BCE000FCE7000010B5002807D0002907D0AC23DE +:10BCF000C35C002B05D1064810BD01BEF5E701BEAF +:10BD0000F5E703001833006801F016FB0020F3E7A5 +:10BD1000041F0204F0B5CE46474680B583B0040048 +:10BD20008946170098460AAB1D780C9E002856D00D +:10BD3000DE2252000021200007F062F8AC2301222D +:10BD4000E2541E200433E0547C33E054843BE1226F +:10BD50005202E2500B9B0193009543463A0049463C +:10BD60002000FFF7B5FA051E1AD1254920005430EE +:10BD7000402207F090F8E27A7423E254002E0BD0B0 +:10BD80003368E3653079FFF77DFA6123E054307A58 +:10BD9000FFF76EFA6223E0542000FFF75DFC050018 +:10BDA000002D14D1002E06D0F168002903D032698D +:10BDB0002000FFF797FF637B002B12D123681B68DD +:10BDC0001B0516D580235B08DC225200A350002DF2 +:10BDD00011D1280003B0C0BCB946B046F0BD01BEC9 +:10BDE000A6E7A823E15800222000FFF741FD050047 +:10BDF000E4E74023E7E72000FFF776FCE9E7C046E9 +:10BE00000C5A011010B504000078FF2800D110BDB5 +:10BE100000F031F8FF232370F9E770B584B0060015 +:10BE20000D0082780B2369460B70D3084B700723F3 +:10BE300013408B7003AA0B8813808B78937002AB2E +:10BE40001188198092789A701A8869468A809B783E +:10BE50008B7101A8FEF79EFC041E02D0200004B0E6 +:10BE600070BD29003000FEF721FE041EF6D001A8A7 +:10BE7000FEF7D8FCF2E710B584B00400FEF746FEEA +:10BE8000002800D001BE0B236A461370E3085370EC +:10BE900007232340937003AA6B461B8813806B46CD +:10BEA0009B78937002AB1188198092789A701A88E7 +:10BEB00069468A809B788B7101A8FEF7B3FC04B0B9 +:10BEC00010BD042804D004D8012801D0022802D1D2 +:10BED00070470828FCD001BE0120F9E7042804D0EF +:10BEE00004D8012801D0022802D170470828FCD0CC +:10BEF00001BE0120F9E7000012280FD88000094B8D +:10BF00001B589F46082000E0042070470120FCE7F2 +:10BF10000220FAE70620F8E70620F6E70120F4E71A +:10BF20001020F2E74C5A0110F0B5C64600B584B0B7 +:10BF3000070015000193002908D00C78053CE3B2F6 +:10BF4000182B34D89C00284B1B599F4601BEF4E7A0 +:10BF500002AA264B083311CB11C202A93800FEF702 +:10BF600057F804B080BCB846F0BD02AA1F4B10338E +:10BF700011CB11C2F1E702AA1C4B183311CB11C22D +:10BF8000EBE74B78002B05D102AA184B203311CBDD +:10BF900011C2E2E702AA154B103311CB11C2DCE744 +:10BFA00001BE1348DDE701260DE001BE0DE00024CF +:10BFB00000261048032CD4D80F4B1B5D98469D4299 +:10BFC000F1D0002E0DD0002FEFD0FDF7F9FF0200C9 +:10BFD00041463800FDF7F8FF0028C2D0019B002B36 +:10BFE000BFD00134E6E7C046985A0110045701104B +:10BFF00002020204020D0204FC5A011010B505F001 +:10C0000023FC0649C02252008B58012003438B5069 +:10C0100005F05EFC05F000FC10BDC04600002640A7 +:10C0200010B505F011FC0449C02252008B580120C4 +:10C0300083438B5010BDC04600002640F8B5050074 +:10C040000C004A1E264B9A4246D8264B1B78002BE2 +:10C0500044D1FFF7E5FF05F03BFC2349E122D20084 +:10C060008B58012083438B50204B1C6000200C28F0 +:10C070000DD81F4BC2009B185B68A34201D9013049 +:10C08000F5E71B4BD358A34202D91C0000E00C205B +:10C09000184E3060184F3C6005F000FC386832687C +:10C0A0000F239B1A02249C40C003FA21890005F04B +:10C0B00021FF0D4AC2235B00D3581B041B0CC01880 +:10C0C000013C204005F0D2FB2800FFF797FF054B0D +:10C0D00001221A700020F8BD0848FCE70848FAE77A +:10C0E0006F17000004660108000026400066010882 +:10C0F000005B0110FC6501080866010800210204CC +:10C1000001210204014B18607047C0460C6601080B +:10C11000002807D00023036043608360C36003618D +:10C120004361704701BEF5E7F0B51B4B984229D03B +:10C130001A4B1A683623D25C002391425B41DBB272 +:10C14000002B00D001BE154F3A685E26935B1B188A +:10C150006025525B4A439B1800241C603B689A5B35 +:10C1600082185F5B4F43D21994609A5B82185F5BC1 +:10C170004F43D219D4609A5B80185B5B59434018D7 +:10C180008461F0BD054B1A683523D25C00239142CF +:10C190005B41DBB2D4E7C046000028400C660108D2 +:10C1A0000023036043608360C36003614361836174 +:10C1B000C3617047032900D901BE0A001032120280 +:10C1C0000023135009024018812252018218136083 +:10C1D000024A9446604403607047C04688100000DD +:10C1E000C00543425841C0B270470000A0231B065F +:10C1F00098422AD014D8802829D008D980235B00FF +:10C2000098422AD01B4B984209D01B4807E01028BF +:10C210001FD0402801D1194801E000281BD17047E8 +:10C22000174B98421BD007D9164B98421ED0164B7D +:10C2300098421DD11548F2E7154B984211D0154B85 +:10C24000984211D1A420C003E9E70020E7E7124893 +:10C25000E5E71248E3E70848E1E70648DFE710486A +:10C26000DDE7A020C003DAE70348D8E70D48D6E7AA +:10C270000148D4E706005200FF00520002005000BF +:10C28000030000F0040000F0050000F0030052007D +:10C29000090000A0010000F005005200010050005C +:10C2A000010052000200520010B50F4B1A683323F0 +:10C2B000D35C002B00D101BE0B4B1C68226ABC234F +:10C2C000E3589B181B68002B0BDB084B1868FFF723 +:10C2D0008DFF636801229A6063689B68002BFBD125 +:10C2E00010BD0348FCE7C0460C6601081066010853 +:10C2F0000200500010B50400FFF772FF002801D1C2 +:10C30000134810BD05F0F4FA124B134A1A605C6032 +:10C3100000229A60DA60114B1A685423D35C002B18 +:10C3200010D004F0A6F9FA21890005F0E3FD010020 +:10C330000B4805F0DFFD0B4BC1188020400006F0D4 +:10C34000F7FFDEE780200021400006F0F1FFD8E78C +:10C3500006005200106601080001001C0C6601086E +:10C3600060F590009808000070B504000D00FFF71C +:10C3700037FF002827D0002D27D005F0B9FA144B3D +:10C38000144A1A6000225A609C60DD60124B1A68E1 +:10C390005223D35C002B10D004F06BF9FA218900F2 +:10C3A00005F0A8FD01000D4805F0A4FD0C4BC118D7 +:10C3B0008020400006F0BCFF06E080200021400005 +:10C3C00006F0B6FF00E0074870BD0648FCE7C0462F +:10C3D00010660108000100050C660108C0EA210191 +:10C3E000482600000600520030B5134A11688B69D8 +:10C3F000C31ADB0949691B01C918002303601568CA +:10C4000081242C5D04192360156882242C5D041995 +:10C410002360156883242C5D04192360156880242B +:10C420002C5D04192360836114688422A25C801847 +:10C4300003600B604B6030BD0C66010810B5072926 +:10C4400000D901BE1F2314009C4300D001BE104B35 +:10C450001B689C69001BC0095B6900011B1803294C +:10C460000AD81C68C9001F20884084431F2002404E +:10C470008A4022431A6010BD04395C68C9001F203D +:10C48000884084431F2002408A4022435A60F2E7DA +:10C490000C660108F8B506000C0015001F0006AB7D +:10C4A0001A78072900D901BE0F232900994303D127 +:10C4B000012D01D0092D00D101BE012F00D901BEEF +:10C4C0001F231100994300D001BE21003000FFF767 +:10C4D000B5FF336801210A00A24093433940A140CF +:10C4E00019433160074B1A688123D25C9219116895 +:10C4F000A400723B1800A04081432B40A3400B4393 +:10C500001360F8BD0C660108072900D901BE0C4B69 +:10C510001B689A69801AC0095B6900011B1803290E +:10C5200006D81B68C900CB401F201840C0B2704716 +:10C5300004395B68C900CB401F201840F6E7C046AD +:10C540000C660108072900D901BE012A00D901BEE5 +:10C5500001238B40002A01D1436070478360FCE7D0 +:10C56000072900D901BE01238B408360704700007A +:10C5700030B50300072900D901BE0F201400844301 +:10C5800003D1012A01D0092A00D101BE8900074840 +:10C5900004688120205CC01804680F231D008D40B2 +:10C5A000AC4313408B402343036030BD0C6601084D +:10C5B00030B50300072900D901BE012A00D901BE08 +:10C5C000074804688220205CC018046801231D000D +:10C5D0008D40AC4313408B402343036030BDC046C5 +:10C5E0000C66010830B5082900D901BE012A00D91E +:10C5F00001BE846901231D008D40AC4313408B4074 +:10C600002343836130BD000030B50300082900D901 +:10C6100001BE032A00D901BE4900074804688020F2 +:10C62000205CC018046803231D008D40AC431340F8 +:10C630008B402343036030BD0C660108F0B5D6463D +:10C640004F464646C0B507000E001400002800D132 +:10C65000AFE0002A00D1AEE0072900D901BE23686F +:10C66000012B00D901BE63680F221900914303D149 +:10C67000012B01D0092B00D101BE237A1F22934345 +:10C6800000D001BEE368032B00D901BE2369012B52 +:10C6900000D901BE6369012B00D901BE236A012BB9 +:10C6A00000D901BE636A012B00D901BEA36A012B28 +:10C6B00000D901BEE36A032B00D901BE236B072B0F +:10C6C00000D901BEE369032B00D901BEA369012B88 +:10C6D00000D901BE01252B00B340700010300322A9 +:10C6E0009146110081400B439C46344B9846196893 +:10C6F0008323C95CC9190B68624693439C46A369AE +:10C700002B40B340624613439A46E2694B461340BE +:10C710001A008240534613430B60227A31003800DE +:10C72000FFF78CFE626831003800FFF721FFE268F6 +:10C7300031003800FFF768FF226931003800FFF749 +:10C7400051FF626931003800FFF732FF43461A6833 +:10C750008423D25CBA1810687B3398469843236AC6 +:10C760002B40656A6D00AC46022561460D402B43A7 +:10C77000A56AA90004250D402B43E56AE9001825A8 +:10C780000D402B43256B6D01414629400B43B10001 +:10C79000FE25AD0029408B40034313602268310021 +:10C7A0003800FFF7CFFE0020E0BCBA46B146A846ED +:10C7B000F0BD0348F8E70248F6E7C0460C660108FA +:10C7C00001005A00084B1A68BC23D3581B181B6879 +:10C7D000002B07DA0B0C00D001BE0904090C4160E4 +:10C7E000002070470148FCE70C66010801008A0040 +:10C7F0000368002B08DAC2600B0C00D001BE0904EC +:10C80000090C8160002070470048FCE701008A00A5 +:10C8100000290BD0074B1A68BC23D3581B181B6880 +:10C82000002B05DAC3680B600020704701BEF1E7FA +:10C830000148FAE70C66010801008A00034B1B68F7 +:10C84000002B00D07047014B1860FBE734660108ED +:10C8500070B505002248006800283FD020480068D5 +:10C860002C246C430019FF2426001E4006601D0A7C +:10C870002C4044601B0C83601A4B1C683323E35C20 +:10C880009E4200D301BE174B1C68236ABA25655B24 +:10C8900075435B19036143683425645DA34200D38B +:10C8A00001BE104C2468246A80335B01E4184461A3 +:10C8B00083681D0C00D001BE1D0C00D001BE1B04FE +:10C8C0001D0C2B43A360C261016200238361049BA2 +:10C8D000002B02D000229B5E838170BD01BEBDE7AC +:10C8E000346601080C660108F0B58FB00400082218 +:10C8F00000210CA806F084FA002C41D06368032BB9 +:10C9000000D901BEE36A002B3CD0236B002B3BD047 +:10C9100007A80300220062CA62C322CA22C302AE71 +:10C92000230014333200A2CBA2C222CB22C208229F +:10C93000835E0CAD2B80079B9BB217336B80089BEB +:10C940000D93E16AA26A0B9B0A980095FFF780FF9E +:10C95000069B0598002200920021FFF779FF216BCA +:10C96000280003F02DFF0022AB5E002B06DB1F2208 +:10C9700013401E3A9A401300044A13600FB0F0BDF2 +:10C9800001BEBBE701BEC0E701BEC1E700E100E0B8 +:10C99000F0B5CE46474680B583B00400171E01931C +:10C9A00040D0254B1B68002B3ED0234B1D682C2309 +:10C9B0005C432C194B43ED186868204B1A683423EC +:10C9C000D35C9946190005F01BFB012633008B4010 +:10C9D0001B0498466068494605F012FB33008B4003 +:10C9E0002269002A22D0A869002821D11268002AD1 +:10C9F00020DA3A681204120C3A6041460A433A605F +:10CA00002269D7600122AA61019A6A622269190C1F +:10CA100000D001BE1B041B0C936003B0C0BCB94620 +:10CA2000B046F0BD01BEBCE701BEBEE70448F4E776 +:10CA30000448F2E70348F0E7346601080C66010891 +:10CA400004028A0007028A0070B582B00400002345 +:10CA5000019300282BD02369002B2AD06369002B77 +:10CA600029D0236A002B28D06369DD682A0C0BD0FB +:10CA700012041A601B682069204B1A68BC23D35823 +:10CA80001B181B68002B1ADB2D042A0C002D0AD062 +:10CA900063691A601B68636A002B2AD098470023D9 +:10CAA00063620023A36163691B6802B070BD01BEAD +:10CAB000D1E701BED2E701BED3E701BED4E701A9A9 +:10CAC000FFF7A6FE00280ED101980268160CFF237E +:10CAD0001340E2699A4207D9226A9B00D358002B7F +:10CAE00002D0984700E0002620693100FFF76AFE77 +:10CAF000CAE7A36A002BD4D09847D2E70C66010896 +:10CB000010B50200064B1B68002B07D0044B1868B9 +:10CB10002C235343C018FFF797FF10BD01BEF5E764 +:10CB20003466010870B50C00224B1A683323D35CBD +:10CB300083423AD900293AD00B681F210A001A40D3 +:10CB4000194201D01C4831E01A4B19683323CB5CE1 +:10CB5000984200D301BE174B19680B6ABA25495B8E +:10CB600048431818154B186005E0636891005B187E +:10CB700000211960013223685B099342F5D8002136 +:10CB8000FFF720FE0D4B186822000021FFF730FE52 +:10CB9000002801D00A4809E0084B18680021FFF777 +:10CBA00011FE002802D0064800E0034870BD02488C +:10CBB000FCE7C0460C66010803018A0038660108DC +:10CBC00001018A0010B50B00002A05D0002A1DD0F3 +:10CBD000002B15D10E4810BD0029F7D10D4A116860 +:10CBE00033228A5C904200D301BE0A4A11680A6A65 +:10CBF000BA24095B4143521807490A601800EAE762 +:10CC000006490B604A60FFF78DFFE4E70048E2E762 +:10CC100003018A000C6601083866010880060008D6 +:10CC2000F0B5C64600B50C001B4B1B68002B2FD07F +:10CC3000DB681A6882422DD947091F22024001256C +:10CC400095405E6800290FD000239846124B186863 +:10CC50000368002B16DABF00F61933681D4207D0AF +:10CC6000AB433360002504E0F3F74FFC8046EDE76B +:10CC70000A4D0021FFF7A6FD002C05D0280080BC3E +:10CC8000B846F0BD064DF7E74046F3F742FCF5E73E +:10CC9000024DF3E7034DF1E7386601080201880011 +:10CCA0000301880004018A000C4B1B68002B0FD085 +:10CCB000DB681A6882420DD941091F2210401E3AD2 +:10CCC0008240586889000B581A4205D0044802E097 +:10CCD000044800E0044870470448FCE7386601084F +:10CCE000010188000201880004018A000001880017 +:10CCF000074B1B689B6CC340DB0700D401BE044B91 +:10CD00001B681B6910308002C3580F201840704701 +:10CD10000C66010830B5C0239B00C45808252B00C1 +:10CD20002340254206D000230DE0D024A40004595E +:10CD3000CC5401339342F8D330BDD024A40005591C +:10CD40005C000D5301339342F7D3F5E710B514009F +:10CD5000C2239B00C358DB05DB0D9A4200D31C00A5 +:10CD60002200FFF7D7FF200010BD03681B050CD57C +:10CD7000802282239B00C358DB05DB0D934206D043 +:10CD800090239B00C150012070474022F1E7002012 +:10CD9000FAE730B580239B00C45808252B002340B8 +:10CDA000254206D000230DE0CD5C9024A40005515F +:10CDB00001339342F8D330BD5C00655A9024A4003F +:10CDC000055101339342F7D3F5E710B5140003681A +:10CDD0001B050ED5802282239B00C358DB05DB0D8B +:10CDE000D31AA34200D81C002200FFF7D2FF200074 +:10CDF00010BD4022EFE703000268120509D580202C +:10CE000040081B6DFF22110019401A4200D0080093 +:10CE100070474020F4E70000F0B5C64600B50500B5 +:10CE20000C0003681B0515D5802780239B00EB5859 +:10CE300008261E40A26A012A0ED882239B00EB58C6 +:10CE4000DB05DB0D9F4202D0A36A012B1AD080BC08 +:10CE5000B846F0BD4027E8E7636A9846E262013AC7 +:10CE6000002B01D0002A00D101BE41462800FFF767 +:10CE7000ACFFA36A1B1AA362002E00D040004044FE +:10CE80006062DAE70023A362002E23D1636A1F7871 +:10CE9000F3F73BFBF8231B018026B600EE50EB585E +:10CEA00090239B00EF50F3F734FB0C4BEA580C4BEC +:10CEB00013401E430B4B1A4200D001BE074BEE50ED +:10CEC0002368022213432360636B002BBFD0012031 +:10CED0009847BCE7636A1F88DAE7C046880F0000FE +:10CEE000FEFDFFFF8CF8FFFF70B505000C00FFF79B +:10CEF00082FF0600A169E269002901D0002A00D161 +:10CF000001BE2800FFF722FF236A1B182362E36992 +:10CF10001B1AE3612AD1A368002B23D0E268B24236 +:10CF20001CD3721E2B681B051AD580239A4200D38E +:10CF300001BEC12080002B58FF218B4311400B43C1 +:10CF40002B50194B0122EA5063680122934363601E +:10CF5000636B002B01D00420984770BD013AE1E7D4 +:10CF60004023E3E7104B0022EA50EDE7A269C0211D +:10CF700089006958090700D540001218A261B34220 +:10CF8000EBD2013B2A6812050CD58022934200D3D4 +:10CF900001BEC12080002A58FF218A4319400A435C +:10CFA0002A50DAE74022F1E7C80F0000F0B5002868 +:10CFB00000D16CE1002900D16BE10B78022B00D984 +:10CFC00001BE4B7B023BDBB2062B00D901BE8B7B43 +:10CFD000002B04D0022B02D0032B00D001BE212352 +:10CFE000CB5C012B00D901BE2823CB5C012B00D9DF +:10CFF00001BE0B78012B07D98B7F002B09D04B6822 +:10D00000013B062B05D903E04B68083B082B00D9F0 +:10D0100001BE8B68053B042B00D901BE4B69FF2B79 +:10D0200000D901BE8B69FF2B00D901BE8B7C002B80 +:10D0300006D00B78002B02D18B68092B74D001BE6F +:10D040004C6B964B1C4200D001BECC6B944B1C42E7 +:10D0500000D001BE0B78022B6AD04D68013D0B7FDA +:10D06000002B6AD080235B028C68082C67D8802450 +:10D07000240123430F242C4023438024A40423436E +:10D0800003600C6B03681B055BD580239C4200D3B7 +:10D0900001BE8C6B03681B0555D580239C4200D3D1 +:10D0A00001BE4C6A03681B054FD580239C4200D308 +:10D0B00001BE0B781B06C024A404234003644B7FED +:10D0C000002B44D040238C7C002C42D08024E400F0 +:10D0D00023430C7C002C3ED08024640023434C7CF2 +:10D0E000002C3AD08024A4002343CC6A013C2404C1 +:10D0F000F0252D032C4023434D7B013D07242C407C +:10D1000023438D7B2D0130242C40234383640B7BF0 +:10D11000002B24D080246400CB7B002B21D10B7802 +:10D12000022B46D000231EE08B7B002B88D086E7A5 +:10D130008B7F002B91D1002591E7002394E70024F9 +:10D1400097E74023A2E74023A8E74023AEE7002368 +:10D15000B9E70024BCE70024C0E70024C4E70024AA +:10D16000DAE780239B001C438D68013D0F231D409F +:10D170002C43C026B60084514D69FF242C408D6994 +:10D180002D04FF273F043D402C43C425AD004451EE +:10D19000CC6A85592B4003339C4201D3102C00D913 +:10D1A00001BECB7F002B07D00B78012B5FD0002571 +:10D1B00003E080239B00D6E700254C7B013C07233E +:10D1C00023402B438D7B2D0130242C40234343648B +:10D1D0000B7B002B4ED080256D008C68013C0F230B +:10D1E00023402B430C78012C46D000242343802479 +:10D1F000A40003510C6BFF232340C124A40003515E +:10D200002023CB5C002B3AD080239B0421240C5D8F +:10D21000012C36D00024234328240C5D012C33D06C +:10D22000002423434D6AFF2425402B4303658B6B69 +:10D230001C4081239B00C4504B6B1A4C23401A4C5A +:10D240000351CB6B194C2340194C0351002A22D0B7 +:10D250000023536013609360D3601362D3625363FF +:10D26000897F3033D154134B93630020F0BD802568 +:10D270006D00A2E70025B0E780246402B6E7002332 +:10D28000C4E780246404C6E780246402C9E70A482E +:10D29000ECE70948EAE70020E8E7C04692F4FFFF20 +:10D2A0008CF8FFFF6D0B0000C80F00007307000033 +:10D2B000880F0000EFCDAB000160AA00114B0360A6 +:10D2C0000F3B0364002383640822FF32C0218900DE +:10D2D0004250043143500C31435043641139FF39FB +:10D2E0004250FD3283500365074A8350074A8350FA +:10D2F000074A8350074A8350074A8350074A83509E +:10D300007047C0460F000003C80E0000880E0000E2 +:10D31000C80F0000880F0000080F0000480F000031 +:10D3200003685B005B080360002904D000234B60A6 +:10D330000B600B62CB627047F0B5C64600B5804605 +:10D340000F0016001C1E10D0A56B1C4B9D4200D078 +:10D3500001BE002F01D0002E00D101BE002F01D050 +:10D36000002E04D180BCB846F0BD01BEECE74046BB +:10D37000FFF741FDA760E6600023236163618642F9 +:10D3800017D3461E43461B681B0514D580239E42B7 +:10D3900000D301BEC120800043461B58FF218B43B0 +:10D3A00031400B4342461350054B01224146CA50BF +:10D3B000D8E7013EE6E74023E9E7C046EFCDAB0002 +:10D3C000C80F000008694B69834202D84B69C01A34 +:10D3D0007047CB684A699B1A1818F9E7F0B5C6463A +:10D3E00000B507000D00FFF706FD8046C2239B0035 +:10D3F000FE58F605F60D2C6934E0002438E06B6B1E +:10D40000002B01D0082098476B69A34233D1204BF1 +:10D410000022FA50002C1ED0013C2C61EC6829003F +:10D420003800FFF7CFFF201A804511D9002800D01F +:10D4300001383B681B0528D58023984200D301BEE4 +:10D44000C12189007B58FF229343024013437B5044 +:10D4500080BCB846F0BDEC68013CDEE7A96863001B +:10D46000CA52013E002ED8D00134EB68A342C4D08A +:10D470006B69A342C3D0D0239B00FA58403BFB58B2 +:10D480001B07EBD4AB681A55EBE74023D5E7C04642 +:10D49000C80F0000486870470868704770B5046896 +:10D4A000466802292ED0082933D0012902D01E4D0A +:10D4B000280070BD31002000FFF7EEFFC00701D546 +:10D4C000194DF5E731002000FFF7E4FFC00727D42E +:10D4D00082229200A358DB05DB0DA158C90B012263 +:10D4E0000A409B18002B1DD1C2239B00E358DB058B +:10D4F000DD0D002B01D00C4DDAE731002000FFF7E5 +:10D500000FFFD5E7226880231B0613432360002505 +:10D51000CEE7226880231B06134323600025C7E75C +:10D52000014DC5E7004DC3E7FF00420070B50400A0 +:10D530000D00E0231B01C3581B0741D54C4BC258BB +:10D54000C8239B00110019401A420BD06B680B4393 +:10D550006B60FC231B01C150C3586B6B002B01D0C7 +:10D5600010209847424BE3581B0508D56B68802272 +:10D57000120113436B60FC231B01E250E3583C4B48 +:10D58000E358DB070ED5EB69002B5DD1AB68002BB0 +:10D5900003D029002000FFF721FFFC231B010122FB +:10D5A000E250E358324BE3585B0709D56B6B002B15 +:10D5B00001D040209847FC231B010422E250E3588D +:10D5C000E0231B01E3585B073DD52A4BE258A0231B +:10D5D000DB00110019401A420BD02B680B432B6063 +:10D5E000F8231B01E150E3586B6B002B01D0202086 +:10D5F0009847204BE358DB072BD41E4BE3589B0581 +:10D6000013D52B68012B2ED0F8231B01802292000A +:10D61000E250E3582B68012293432B600023EB6216 +:10D620006B6B002B01D002209847124BE358DB06AE +:10D6300009D56B6B002B01D080209847F8231B0184 +:10D640001022E250E35870BD29002000FFF74CFC87 +:10D65000A3E729002000FFF7DFFBF8231B010122CD +:10D66000E250E358C9E7044B0022E250D2E7C0463B +:10D67000CC0F00008C0F0000880F0000F0B5C646EC +:10D6800000B58C680A688423C558753B2B40082573 +:10D69000ED1A2300AC4226D92B0024E055782D0248 +:10D6A00016783543D678360697783F043E4335439F +:10D6B0009827C55155792D0216793543A846D67954 +:10D6C000360695792D042E4345463543C551D2186B +:10D6D000E41A8423C558753B2B400825ED1A230016 +:10D6E000AC4200D92B00002B4CD0082B31D89D0028 +:10D6F0002E4E7559AF46167890254651E7E7537878 +:10D700001B0215782B43942543510223DFE75378FE +:10D710001B0215782B43D5782D06967836043543B1 +:10D720002B43982543510423D1E753781B021578E6 +:10D730002B43D5782D069678360435432B43982510 +:10D74000435153791B0215792B43942543510623EA +:10D75000BDE753781B0215782B43D5782D069678B4 +:10D76000360435432B439826835153791B02157990 +:10D770002B43D5792D0697793F043D432B438351A5 +:10D780000823A4E70A608C60002C0CD1F924E40083 +:10D7900003590122934303518A61CB69002B02D0C4 +:10D7A000CB690120984780BCB846F0BD285C0110C9 +:10D7B000F8B50E004C69CB68C42282580F21114085 +:10D7C00022008C421CD90A001AE0D8254159197050 +:10D7D0000F0A5F700F0C9F70090ED97041591971B3 +:10D7E0000D0A5D710D0C9D71090ED9719B18A41A5B +:10D7F000C42282580F2515402200AC4200D92A00CD +:10D80000002A63D0082A4ED895003A4949598F46D4 +:10D81000D02141581970E9E7D42141581970090AFB +:10D820005970E3E7D42141581970090A5970D02181 +:10D8300041589970DAE7D821415819700D0A5D7086 +:10D840000D0C9D70090ED970D0E7D8214158197080 +:10D850000D0A5D700D0C9D70090ED970D0214158D4 +:10D860001971C3E7D821415819700D0A5D700D0C6C +:10D870009D70090ED970D42141581971090A597146 +:10D88000B4E7D821415819700D0A5D700D0C9D70D8 +:10D89000090ED970D42141581971090A5971D02142 +:10D8A00041589971A2E7D82142581A70150A5D7043 +:10D8B000150C9D70120EDA7042581A71110A5971C6 +:10D8C000110C9971120EDA7108228FE7F3607461FE +:10D8D000002C0DD1F922D200835802218B438350B2 +:10D8E0000323B361336A002B02D0336A03209847C5 +:10D8F0007461F8BD4C5C011010B500283BD00029C4 +:10D900003BD0002B3BD004685A6200221A85002CC1 +:10D910002DDBF922D20083580324A34383500B78D4 +:10D92000012B00D901BE0B7A032B00D901BE4B6835 +:10D93000072B00D901BE0B7B012B00D901BE0A6861 +:10D94000012313408A681203C024A4012240134318 +:10D950004A681204E024E40222401343CA68120613 +:10D96000802149040A4013430360002010BDE407EE +:10D97000CFD50020FAE70348F8E70248F6E7014868 +:10D98000F4E7C0460400B200082904D88B235B00EA +:10D99000CB40DB0700D401BE032A00D901BE042915 +:10D9A00020D008D801290DD002291AD188231B01C3 +:10D9B0009C4660440AE0082913D198231B019C4629 +:10D9C000604403E080231B019C466044002808D08B +:10D9D000036807490B401204C02189020A4013431F +:10D9E0000360704790231B019C466044EEE7C046ED +:10D9F000FFFFFCFFF8B5DE4657464E464546E0B50C +:10DA000007009A460AAB40CB1B789B460CAB1B78B1 +:10DA1000101FC0B2FA2800D801BE58460438C0B260 +:10DA2000FA2800D801BE581EC0B2012804D9042B20 +:10DA300002D0082B00D001BE002E02D05046002894 +:10DA40001CD0002E02D05846FF2819D01B02F0200F +:10DA50000001034099460E9B5D6A1204C0239B029D +:10DA60001A404B461A430A43002E0BD10D9BDB078D +:10DA70001B0C1A433A65002400200CE001BEE0E7CD +:10DA800001BEE3E70023F4E703433B650134E4B25E +:10DA9000002D1FD128002100B44225D2154B9842F9 +:10DAA00022D07B6C0422100018401A42F0D1534659 +:10DAB0005B5C4A46134398465A461204C0239B02B5 +:10DAC0001A40434613430131B142DDD30D9AD007CA +:10DAD000000CD9E7012002F021FF013D002D01D00B +:10DAE0000020D8E70348D6E7F0BCBB46B246A946BB +:10DAF000A046F8BD0200B20070B58CB00500181F3A +:10DB0000C0B2FA2800D801BE002A34D0686C0426BE +:10DB100034000440064231D11B04C020800203407F +:10DB2000501E0004000C03438020C00203432B65F9 +:10DB3000002925D0109B5E6A01910392002308936F +:10DB400002330793200006E0012002F0E7FE013EC9 +:10DB5000002E0ED02000079B022B0DD1094B9842BE +:10DB60000AD001A92800FFF789FD002EECD1300072 +:10DB7000F1E70448EFE704480CB070BD0348FBE749 +:10DB80002000F9E70200B2000400B2000100B20078 +:10DB900070B58CB00500181FC0B2FA2800D801BEBD +:10DBA000002A34D0686C042634000440064231D187 +:10DBB0001B04C02080020340501E0004000C0343DD +:10DBC0008020000303432B65002925D0109B5E6A4B +:10DBD000049106920023099304330793200006E082 +:10DBE000012002F09BFE013E002E0ED02000079B7C +:10DBF000042B0DD1094B98420AD001A92800FFF748 +:10DC0000D7FD002EECD13000F1E70448EFE70448DF +:10DC10000CB070BD0348FBE72000F9E70200B2003A +:10DC20000400B2000100B20010B5030000290DD0BD +:10DC3000426C042420001040144209D10139090427 +:10DC4000090CC02212030A431A6510BD0148FCE703 +:10DC50000148FAE70400B2000100B20000230B60A3 +:10DC60004B608B60CB600B614B618B6102688023E2 +:10DC70001B0613430360704770B58D69AA682B6A51 +:10DC8000CC68FF26B44384600C696442B443C4602A +:10DC90002D68013D03242C404969002901D08021D1 +:10DCA000490021430162002A33D01468611C67D007 +:10DCB000FF21214014792404C025AD022C402143CA +:10DCC000802424062143016451790904C024A4025C +:10DCD000214041649468611C54D0FF212140147B91 +:10DCE0002404C025AD022C40214380242406214376 +:10DCF00081641169002905D001391F240C4080215D +:10DD000009062143C164127D1204C02189020A4020 +:10DD10000265002B33D019684A1C35D0FF220A4017 +:10DD200019790904C024A40221400A43802109066C +:10DD30000A4302665A791204C02189020A404266E7 +:10DD400099684A1C22D0FF220A40197B0904C0248A +:10DD5000A40221400A43802109060A4382661A6907 +:10DD6000002A05D0013A1F211140802212060A43E1 +:10DD7000C2661B7D1B04C02292021340036770BD64 +:10DD80000021A0E70021B3E70022D2E70022E5E767 +:10DD9000F0B5DE4657464E464546E0B583B0061E12 +:10DDA000904600D1B6E0002900D1BBE04F68002FBB +:10DDB00000D1B9E0002A00D1B8E00B689946002BE9 +:10DDC00003D0002500239A4663E05948A3E0584851 +:10DDD00007E0082B04D198231B019B46B3440CE0B9 +:10DDE00053485346002B00D195E0B220000418435D +:10DDF00091E080231B019B46B3445B46002B00D17E +:10DE000086E01B684B4A1340227A1204C021890223 +:10DE10000A4013435A4613606368042210001840F6 +:10DE20001A4261D1A3691B68013B032B00D901BED3 +:10DE300000282DD163689B072AD53368DB0727D4D8 +:10DE4000E068216904F0DCF8002900D001BE2369F4 +:10DE500080225202934202D35A1E1A4200D001BEBF +:10DE600021005846FFF708FF636801221A40DB08CB +:10DE70001B02802149000B401343227A1204C02167 +:10DE800089020A4013438022120613435A46136044 +:10DE90000135A94538D9AB00FC58002CF8D02278C0 +:10DEA000531EDBB2012B04D9042A02D0082A00D069 +:10DEB00001BE237A032B00D901BEA369002B25D014 +:10DEC0002378042B0BD000D983E7012B91D0022BB0 +:10DED00000D07CE788231B019B46B3448DE7902349 +:10DEE0001B019B46B34488E7A1692278237A404608 +:10DEF0000090300001F01AFB002893D00823AB40BB +:10DF000052461A4392468DE700206AE7084868E7C0 +:10DF1000074866E7064803B0F0BCBB46B246A946D0 +:10DF2000A046F0BD0248F6E70148F4E70048F2E7F2 +:10DF30000400B200FFFFFCFF10B5002134E00B002D +:10DF40001033DB0100221A50CB01C318184C1C19E6 +:10DF50002260184C1C192260822424011C192260A2 +:10DF6000842424011C192260134C1C192260134CB8 +:10DF70001C192260124C1C192260852424011C19D2 +:10DF80002260862424011C1922600E4C1C19226078 +:10DF90000D4C1C1922600D4C1C1922608724240191 +:10DFA000A44663441A6001310329C8D910BDC04694 +:10DFB000080800000C0800004408000048080000A1 +:10DFC0004C08000064080000680800006C080000AD +:10DFD00030B587B013008A69D468002C0ED00D7854 +:10DFE000227921780493012303930295FE33019350 +:10DFF00000230093FFF7FEFC07B030BD0048FBE7AD +:10E000008000B20030B587B0040008001500190088 +:10E0100002780A9B0493002303930292FF22019249 +:10E02000009300222000FFF7E5FC002801D007B094 +:10E0300030BD0A9B00930023012229002000FFF736 +:10E04000A7FDF4E710B584B00E236B4401241C80B7 +:10E050008C69A36A002B0ED01B7800920E226A44B2 +:10E06000FFF7D0FF002806D1A26BD2B20E2169447F +:10E070000B8813400B800E236B441888431E984175 +:10E08000C0B204B010BD0000F0B583B0019100280B +:10E0900008D087697B6893421ED9396D002903D067 +:10E0A000002004E001BEF4E70C4813E00130FB6CF3 +:10E0B00083420ED98300CC5825686668E3687343B1 +:10E0C0005B19AA42F2D39A42F0D2019B1C60002055 +:10E0D00000E0024803B0F0BD0148FBE70600B200D3 +:10E0E0000400B200F0B58BB006900F001600079345 +:10E0F000002908D0002E36D0BC6965690023099339 +:10E100002068002205E001BEF4E71202F15C0A4338 +:10E1100001339842F9D809A93800FFF7B5FF002D5F +:10E120001BD02A79FF2A1AD0104B984219D0002808 +:10E1300011D1099B19893B78C9B207980490012035 +:10E140000390029301922368009333000698FFF72F +:10E1500051FC0BB0F0BD2988EDE70548F9E704480C +:10E16000F7E70348F5E70148F3E7C0460400B200CB +:10E170008000B200002901D00885704701BEFBE78E +:10E18000F0B5D6464F464646C0B505000F00140010 +:10E190001E001A00FFF756FF002E0AD0338D984656 +:10E1A000002B21D000285BD0A34214D3A3B2984601 +:10E1B00011E001BEF2E7404602F0B0FB3200390048 +:10E1C0002800FFF73FFFA0450CD24346E41A002881 +:10E1D00046D0002C44D02B68DB07ECD4404602F03C +:10E1E000A7FBEBE70024F2E7002839D0A308994603 +:10E1F000204B9C4205D84B46002B18D10123994651 +:10E2000015E01D4B994612E0504602F06DFB40466A +:10E2100002F084FB320039002800FFF713FF4C4561 +:10E220001CD94B46E41A00281AD0002C18D0FA2129 +:10E230008900484603F05EFE8246FA21890048467E +:10E2400003F0DEFE8BB298462B68DB07DCD4504629 +:10E25000FCF7E9FF404602F06BFBDBE70024E2E756 +:10E26000002805D10020E0BCBA46B146A846F0BD62 +:10E270000248F8E703093D0040420F000200B200E7 +:10E28000F0B5DE4657464E464546E0B58BB0834670 +:10E29000884691469A46149D00230993002919D077 +:10E2A0005346002B18D043469A6996684B465B1933 +:10E2B0005268934200D977E05B461B680122110047 +:10E2C000194007911A4209D1384C20004446159B49 +:10E2D000984613E001BEE3E701BEE4E7F2F715F963 +:10E2E0000790F1E7002802D1316900293ED10028CA +:10E2F00040D0002847D1ED1BB944BA44002D42D08C +:10E300002F0080235B029D4200D91F00A3691B6878 +:10E310004A46013B09A9CA54120A002BF9D1A36944 +:10E32000069320783279317843460493002303938F +:10E33000029070790190069B1B68009309AB5846C8 +:10E34000FFF758FB0028CDD1B1684B1CCAD020780C +:10E35000327BC9B243460493002303930290FF200B +:10E36000019000935846FFF745FBBBE75846FFF77F +:10E370005BFCBCE7337D424600923A00514658466A +:10E38000FFF706FCB5E704005B461B68DB0707D414 +:10E3900020000BB0F0BCBB46B246A946A046F0BD7B +:10E3A0000798F2F7B6F8F3E7004CF1E70400B20083 +:10E3B000F0B5DE4657464E464546E0B58BB083463F +:10E3C000884617009946149E0023099300291AD005 +:10E3D0004B46002B19D043469A69536A9A46136AF2 +:10E3E0001C00BB195268934200D99AE05B461B6837 +:10E3F00001221100194007911A4208D14A4D280004 +:10E400005546A24614E001BEE2E701BEE3E7F2F79B +:10E410007CF80790F2E73400159A41465846FFF71A +:10E42000D7FD00280FD000286AD1A1443F19361B20 +:10E43000002E65D02900380003F0E2FD7318AB42CE +:10E44000E9D36C1AE8E743469B691B683A00013B35 +:10E4500009A9CA54120A002BF9D143469B690693B5 +:10E46000424610785246127951460978159B04931A +:10E47000002303930290534658790190069B1B6832 +:10E48000009309AB5846FFF7B5FA002803D153466D +:10E4900099684B1C15D1002803D1534619690029EE +:10E4A00020D1002822D00028BDD143469B699A6A1A +:10E4B000002AB8D09A6C159B41465846FFF760FE7B +:10E4C000B1E74346187853461A7BC9B2159B0493AB +:10E4D000002303930290FF20019000935846FFF71A +:10E4E00089FAD8E75846FFF79FFBDAE753461B7DCA +:10E4F000159A0092220049465846FFF7FDFAD2E7E6 +:10E5000005005B461B68DB0707D428000BB0F0BC96 +:10E51000BB46B246A946A046F0BD0798F1F7F9FF01 +:10E52000F3E7014DF1E7C0460400B200F0B5DE4666 +:10E5300057464E464546E0B589B007000E00150027 +:10E540000093129A9046EC18631E019300230793E0 +:10E550000693002914D0B3699B469B699A465B4693 +:10E560001B6C02935B465B68019A93420AD8794C14 +:10E57000200009B0F0BCBB46B246A946A046F0BD9B +:10E5800001BEE8E7002305932A0005A93000FFF744 +:10E590007BFD002836D1059B002B33D01C68281B3F +:10E5A000DD68290003F0A6FC45436519019B9946E7 +:10E5B0001A0005A93000FFF767FD041E43D1059B33 +:10E5C000196801914A46521A0132DB6899461900CE +:10E5D0000392100003F08EFC00904946039803F06C +:10E5E0000FFD002902D0009B01330093009B4A4697 +:10E5F0005343019A94466344013B01935B1B0133EF +:10E60000009320E05146280003F0FAFC002905D0D1 +:10E610005146280003F06EFC554645435146200004 +:10E6200003F0EEFC002909D001985044013851460E +:10E6300003F060FC53465843431E0193019B5B1B50 +:10E640000133009300245B465B68019A934200D833 +:10E650007DE03B6801221100194003911A4201D16B +:10E66000B94648E0F1F751FF0390B94643E0002C6A +:10E670002ED145453DD24A4631003800FFF7A8FC6F +:10E68000041EF4D15B461B682A00013B07A9CA544B +:10E69000120A002BF9D14B460A0031003800FFF76F +:10E6A00021FD041EE3D1029B5A01D21A92009C461E +:10E6B0006244D2004B4631003800FFF761FD009BF9 +:10E6C000534536D9554452469B1A00930400CEE771 +:10E6D000C846B9460FE0019F43461293B8464F46DD +:10E6E0009946C6E7019F43461293B8464F4699465E +:10E6F000BFE7C846B946009B002B1FD02A0006A9D9 +:10E700003000FFF7C1FC041EE5D1069B1A69029296 +:10E71000DA6892461A685F6853465F43BF18013F44 +:10E72000019BBB42DED343461293B8464F469946FF +:10E730009FE7C846B94600940400DCE74F463B68B3 +:10E74000DB0700D414E70398F1F7E3FE10E7014C70 +:10E750000EE7C0460400B200C36A002B0BD0036B67 +:10E76000002B0AD0036B00221A7106290ED88900EB +:10E77000194B5B589F4601BEF1E701BEF2E701234A +:10E780005B42C363026B1360C26A1360704702236B +:10E79000C363036B01221A60C36A34321A60F5E75F +:10E7A0004023C363036B01221A60C36A04321A60F8 +:10E7B000ECE78023C363036B3E221A60C36A013215 +:10E7C0001A60E3E70223C363036B31221A60C36A52 +:10E7D00004321A60DAE7C046705C011070B58D69CA +:10E7E000AA682B6ACC68FF26B44384600C69644233 +:10E7F000B443C4602D68013D03242C4049690029BD +:10E8000001D08021490021430162002A33D01468DD +:10E81000611C67D0FF21214014792404C025AD027A +:10E820002C402143802424062143016451790904AA +:10E83000C024A402214041649468611C54D0FF218B +:10E840002140147B2404C025AD022C4021438024A8 +:10E850002406214381641169002905D001391F2450 +:10E860000C40802109062143C164127D1204C0219D +:10E8700089020A400265002B33D019684A1C35D042 +:10E88000FF220A4019790904C024A40221400A4346 +:10E89000802109060A4302665A791204C0218902BE +:10E8A0000A40426699684A1C22D0FF220A40197B1E +:10E8B0000904C024A40221400A43802109060A4316 +:10E8C00082661A69002A05D0013A1F211140802270 +:10E8D00012060A43C2661B7D1B04C022920213402B +:10E8E000036770BD0021A0E70021B3E70022D2E753 +:10E8F0000022E5E770B5050008220026002000E0B0 +:10E9000008328B790133DB00934216D3FF232B406F +:10E910008C5CA342F4D12C0AFF2323408C18E479A9 +:10E92000A342EDD18B185B78B342E9D38C18A4785D +:10E93000012CE5D11E001000E2E770BD70B50C009F +:10E9400015001E00FFF7D6FF00280AD024182379EF +:10E95000AB7063796B70A3792B70E3789B00337095 +:10E9600070BD00233370FBE7827852080323134005 +:10E97000012B07D0022B0BD0002B01D000207047B9 +:10E980000320FCE780235B04994203D90420F6E7C7 +:10E990000420F4E70320F2E7020040790002137933 +:10E9A0001843D3791B069279120413431843002BA2 +:10E9B00002DB0130C0087047033880231B06184370 +:10E9C000F9E7437A0B6000230B7102334B71037A32 +:10E9D0005B0908D1013B8B60027A1F2313400B6156 +:10E9E00002230B757047FF238B60FD3B0B73F3E72E +:10E9F000C37A0B6000230B714B71837A5B0908D1DA +:10EA0000013B8B60827A1F2313400B6102230B753D +:10EA10007047FF238B6000230B73F3E7C37B0B600E +:10EA200000230B7101334B71837B5B0908D1013BE0 +:10EA30008B60827B1F2313400B6101230B75704792 +:10EA4000FF238B60FE3B0B73F3E7437B0B600023DC +:10EA50000B714B71037B5B0908D1013B8B60027B1F +:10EA60001F2313400B6101230B757047FF238B603D +:10EA700000230B73F3E703230B6000230B714B712F +:10EA8000012252428A600B610B75704710B50C0071 +:10EA90001900012C07D0032C0FD0012A01D9012322 +:10EAA00002E0002300E00023002B10D083789A06B8 +:10EAB00005D45B0607D4FF2015E00023F4E7FFF739 +:10EAC00080FF05200FE0FFF793FF04200BE0837821 +:10EAD000DC0601D5002A07D1DB0701D5002A07D1C2 +:10EAE000FFF7C9FF012010BDFFF798FF0320FAE7E9 +:10EAF000FFF7ABFF0220F6E70368052907D8890076 +:10EB00000D4841588F469B0601D5EC231360704792 +:10EB1000DB06FCD56C231360F9E71B07F7D5BC2394 +:10EB20001360F4E75B07F2D53C231360EFE79B0724 +:10EB3000EDD50C231360EAE78C5C01102823C35C3D +:10EB40001B09012098407047F0B5DE4657464E46F7 +:10EB50004546E0B593464F6A1B38430898460F2652 +:10EB60003E40B2460021002510E001255246541CCB +:10EB700001336B434A0094468C44624692009446AB +:10EB8000DC4463435B0062469360013103291BD878 +:10EB9000CB005B1A3C00DC4023099946640A03263B +:10EBA000300020401F234A4613402642DDD0012872 +:10EBB00006D0022806D00328D8D1FA25AD00D5E723 +:10EBC0001025D3E78025D1E743465B0043449B00F3 +:10EBD0000C3B5B449868F0BCBB46B246A946A046D5 +:10EBE000F0BD30B5456A836A590F032004000C401C +:10EBF0001B0E1F221A400F232B40084207D0012C66 +:10EC00000CD0022C0DD0032C0ED0002000E01020E0 +:10EC10000133013250435843400030BD8020400052 +:10EC2000F6E7FA200001F3E7FA200002F0E7816A34 +:10EC30000B0A1F221A400F230B40890406D4082018 +:10EC40000133013250435843400070474020F7E7FA +:10EC5000062303600023037170470423036000232D +:10EC60000371704702230360002303714371012283 +:10EC7000524282600373036103757047122303607D +:10EC800000230371437101225242826003730361C6 +:10EC9000037570473423036000230371437101221D +:10ECA00052428260037303610233037570473E234F +:10ECB0000360002202713C3B4371012149428160A3 +:10ECC000037302610375704710B50368042922D0ED +:10ECD00009D80139C9B2022904D85B062BD5100026 +:10ECE000FFF7CCFF10BD0529FCD1D90507D41906C3 +:10ECF00009D45B060BD51000FFF7C0FFF2E7100048 +:10ED0000FFF7D5FFEEE71000FFF7C4FFEAE71000BA +:10ED1000FFF7A8FFE6E7190605D45B0607D5100044 +:10ED2000FFF7ACFFDEE71000FFF7B4FFDAE71000F3 +:10ED3000FFF798FFD6E71000FFF794FFD2E705230F +:10ED40000360002303717047602303600023037195 +:10ED50007047F0B505000368042B07D01D200B5C3D +:10ED6000FF2B2BD1222828D80230F8E74369012055 +:10ED7000404218604B785B080F261E400023042B8E +:10ED800007D801249C4030002040844201D0013348 +:10ED9000F5E7032B1FD81F1D0020032807D8061DE9 +:10EDA00044002418A4008E5D16550130F5E76A6909 +:10EDB000C95D116058001D3005E00020002802D018 +:10EDC0006B690A5C1A60002806D06A690023137117 +:10EDD0006A69537103E000206B69FF221A71F0BD6C +:10EDE00070B5002200240FE023001C33C65C5300E2 +:10EDF0009B189B00CB180125B5405D6025001D3593 +:10EE0000455D1D7002340132032AEDD970BD00004A +:10EE100070B586B005000C001E004B0628D08B078D +:10EE200010D5D368002B21D01A7919780A9B049346 +:10EE3000012303930296FE33019300230093FEF710 +:10EE4000D9FD00E00020A40713D0002811D10A9BAF +:10EE50000493012303930296FE330193002300934E +:10EE60000022B7212800FEF7C5FD02E00020EAE7F6 +:10EE7000014806B070BDC0468000B200F0B587B052 +:10EE800005000C0010000A794E7909780E9F04974E +:10EE900000270397029301960323009303002800A1 +:10EEA000FEF7A8FD002801D007B0F0BD21692800B9 +:10EEB000FEF7BAFE0028F7D1237D0E9A00920C9A35 +:10EEC0000D992800FEF764FEEEE70000F0B5DE467F +:10EED00057464E464546E0B58DB083460D009146F7 +:10EEE000099316AB1B780893002303E00AAA0021BC +:10EEF000D1540133032BF9D9724E002400231F0093 +:10EF00003000179B98463CE003220BE0042209E006 +:10EF1000002207E0A018C01A2818C6780AA8C6540C +:10EF20000133DBB29342F5D353461B780F201840D0 +:10EF3000824603000F2843D04346049300230393E3 +:10EF400008980290019300920AAB00225846FEF7FF +:10EF500051FD002802D15346002B34D1002837D070 +:10EF600000280BD17B00DBB21F2204A98C4662442F +:10EF70001778079A17407A1E97411F4308344C456B +:10EF80004BD82A5D02210B00134011422CD1621C88 +:10EF9000A95CE21CAA5C07921F2204A88446624472 +:10EFA00000201070A21CA8188246AA5C9209012AAF +:10EFB000AAD0022AAAD0002AAAD0099A1268B1E7D8 +:10EFC000073B9A46B8E751465846FEF72DFEC5E77F +:10EFD00043460093002301221F2104A88446614474 +:10EFE0005846FEF7D5FDBBE7B8460600002E17D001 +:10EFF000002E5CD12B199B780133DBB29B46099B19 +:10F000005A46DA64002A5AD03700B24600220796E0 +:10F0100026001400A846994618E0B8462A4EE5E7AF +:10F02000424649462B195B789342E1D02B199B78D5 +:10F0300002339B00E418A142F4D2234ED8E7E960E2 +:10F04000380002F057FF68600134E4B25C452DD20D +:10F05000BA440436434698199B5D0F21194001229A +:10F060000023114207D15200D2B20133DBB2042B8C +:10F07000F7D9154A079207683F0A01373F024A4607 +:10F08000116DA2008D5852462A605A00D3189B0079 +:10F09000189AD2181899CB5CAB6093682B615168B1 +:10F0A000B942CCD9EF6001236B60CDE7079E3000F9 +:10F0B0000DB0F0BCBB46B246A946A046F0BD014E1D +:10F0C000F5E7C0460600B2000700B2007047000036 +:10F0D000F0B5DE4657464E464546E0B5D9B0050088 +:10F0E0000C1E0492059317D0A369002B16D00023A1 +:10F0F000932204A98C4662441370922262441370D6 +:10F10000912262441370A76923789846237A9A461D +:10F110007B6B9946002307E001BEE5E701BEE6E709 +:10F1200038AA0021D15401337F2BF9D9002308E0FC +:10F13000002237A9CA5436A9CA5435A9CA54013382 +:10F14000DBB2022BF4D9524641462800FEF71CFCE4 +:10F1500041462800FFF7BAFF4B46002B00D174E16F +:10F16000629B029338AB019338230093434637AA3E +:10F1700049462800FFF782FE061E00D0CAE138ABE0 +:10F180001B78532B01D0C74EC5E138AB5B78462BBB +:10F1900001D0C44EBFE138AB9B78442B01D0C14EA7 +:10F1A000B9E138ABDB78502B01D0BE4EB3E138ABC0 +:10F1B0005B79012B01D0BB4EADE138A90B790793E8 +:10F1C000932304AA944663449B46FF2037AA000277 +:10F1D000FFF7B4FB5B461B78002B01D1B14E9AE1DF +:10F1E000922304AA9446634436AA38A9AE48FFF78E +:10F1F000A5FB912304AA944663449B4635AA38A9EB +:10F20000AA48FFF79BFB5B461B78002B02D100222C +:10F21000FA643A65932204A98C4662441278802AE3 +:10F2200000D938E1802B00D937E1002E00D00DE164 +:10F23000FB68002B6AD0629B029338AB9B4601931C +:10F24000932304AA944663441B780093434637AA49 +:10F2500049462800FFF712FE069029A95846FFF7F5 +:10F26000BFFD5846FFF798FB010078605846FFF74E +:10F270007BFB3860F868FFF7EBFC3869FFF7EDFCC3 +:10F280000123BB63B86AFFF75AFD049B012B0BD91E +:10F29000079B002B4BD05A463A23D15C0909333BDC +:10F2A00019403800FFF758FAF869FFF74DFDBB68C1 +:10F2B0009B46079B002B3FD038A8FFF73FFC7862A6 +:10F2C00080235B00984200D97B6238A8FFF789FC55 +:10F2D000786438A8FFF7ABFCB8645B46049A5146E3 +:10F2E00038A8FFF7D3FB82463A68042A00D096E09C +:10F2F000FF2832D038AA3F23D15C629B009343465B +:10F300003A002800FFF784FD069026E03B69002BB9 +:10F3100091D17B69002B8ED1FB69002B8BD13B6A8D +:10F32000002B88D1BB6A002B85D101BE83E70599EC +:10F330003800FFF711FAB7E780235B007B62FA23FE +:10F340001B027B645A4BBB64059B002BC5D1049305 +:10F35000C3E708AB00229A5501367F2EF9D9069BE8 +:10F36000002B39D0069E002E48D00120431E38AA1B +:10F37000D25C01239340BB61079B002B5BD1FA2336 +:10F380009B003B643B6D002B60D0629B029338ABCB +:10F390000193912304AA944663441B780093434647 +:10F3A00035AA49462800FFF769FD061E4ED1912374 +:10F3B00004AA944663441A7829AB0293629B019392 +:10F3C000434600933B0038A92800FFF77FFD394BE7 +:10F3D000984236D0060039E0629B029308AB019355 +:10F3E000922304AA944663441B780093434636AAAA +:10F3F00049462800FFF742FD0690B3E75A465146BA +:10F4000008A8FFF779FB3A6A514608A8FFF75CFCA9 +:10F4100029AA08A93800FFF79CFC069E08E0386A74 +:10F42000FFF720FC29AA38A93800FFF792FC069EB6 +:10F430000028A7D09AE729AA38A9FFF785FB3864E6 +:10F44000A0E70023FB643B6502E0164E002E62D16C +:10F4500063689B075FD52B68DB075CD4E068216994 +:10F4600002F0CEFD002900D001BE236980225202A5 +:10F47000934202D35A1E1A4200D001BE4346042BC7 +:10F4800043D01BD8012B22D0022B08D188231B018B +:10F490009C4665441FE0084ED8E7074ED6E7002596 +:10F4A0001FE0C0460500B20084FF000081FF00009D +:10F4B000A08601000600B2008100B200082B04D132 +:10F4C00098231B019C46654405E0002509E0802344 +:10F4D0001B019C466544002D03D021002800FFF746 +:10F4E0007DF9636801221A40DB081B028021490074 +:10F4F0000B401343227A1204C02189020A401343AD +:10F500008022120613432B6005E090231B019C46CA +:10F510006544E0E7044E300059B0F0BCBB46B2464B +:10F52000A946A046F0BDC0460500B20010B58AB09D +:10F53000002911D06C462273002204922375069292 +:10F540000792089209910C9B00930023033203A9B0 +:10F55000FFF7BEFD0AB010BD01BEEBE710B50028F5 +:10F5600014D107292ED8FF2A2ED81A4B1868836881 +:10F570007824005B1B188900C9180B6816480340E3 +:10F580001206120C1A430A60002002E0012801D082 +:10F59000124810BD0F2919D880235B029A4217D256 +:10F5A0000C4B186883687A24005B1B188900C91803 +:10F5B0000B680B48034012020A48024013430B60D9 +:10F5C0000020E6E70548E4E70448E2E70348E0E70F +:10F5D0000248DEE70C660108FF00FFFF01004A0059 +:10F5E000FF0000FF00FFFF00F0B5022803D0032852 +:10F5F00028D02D48F0BD03294AD8802040028242FD +:10F6000048D21F2B48D88900284E306884687C2552 +:10F61000405B24180C192068254F38401202254FF2 +:10F620003A400243226030688268405B12188918B1 +:10F630000A68F8208243D800FF23034013430B607D +:10F640000020D7E7002929D180204004824227D218 +:10F650001F2B27D88C00154884460568A8687E278C +:10F66000ED5B401920180568FF26354012022A4339 +:10F670000260624610688268C05B1218A2181068A7 +:10F68000F824A043DB001E40304310600800B1E7BF +:10F690000548AFE70448ADE70348ABE70248A9E7F0 +:10F6A0000148A7E70048A5E701004A000C660108E9 +:10F6B000FF0000FF00FFFF0030B51A4B1B6842241B +:10F6C0001C5D844228D9032928D8002901D1072AA2 +:10F6D0000FD9012905D0022906D0032907D01248E5 +:10F6E0001BE00F2A05D9F6E7032A02D9F5E7002A1D +:10F6F00016D175241D5DA940723CAC402140742494 +:10F700001C5D22409C680A43C0239B009C466044C9 +:10F7100080000251002000E0034830BD0248FCE7B1 +:10F720000148FAE70C66010801004A00F0B50B0039 +:10F73000032835D8002801D107290FD9012805D081 +:10F74000022806D0032807D0174828E00F2B05D938 +:10F75000F6E7032B02D9F5E7002B23D1134A1468EF +:10F760007722A15C743A15008D4029007425655DEF +:10F770007626A65D2F00B74039437526A65DB040BA +:10F78000B240024011432B40A068194380231B065E +:10F790000B438022D2008350A3689B580020F0BD09 +:10F7A0000148FCE70048FAE701004A000C6601083E +:10F7B00010B5032828D8002801D107290FD901281E +:10F7C00005D0022806D0032807D011481BE00F29D6 +:10F7D00005D9F6E7032902D9F5E7002916D10D4B23 +:10F7E0001A687523D45CA040723BA3400340742088 +:10F7F000105C014090680B438022D20513438022A5 +:10F80000D2008350002010BD0148FCE70048FAE711 +:10F8100001004A000C660108064B1B681A68882123 +:10F820005B58D218136804490B400002034313606D +:10F830007047C0460C660108FF00FFFF044B1A68C2 +:10F840001368882152589B181868000AC0B2704784 +:10F850000C660108012800D901BE054A1368054954 +:10F860000B400002C0218900084003431360704729 +:10F8700000002740FFFCFFFF10B5074B984200D95E +:10F8800001BE0649064A8B58064C2340024C2040D4 +:10F8900003438B5010BDC04601030000000026400A +:10F8A00004050000FEFCFFFF10B50449044A8B5814 +:10F8B000044C2340000403438B5010BD000026403D +:10F8C00004050000FFFF00FF0349044A8858802315 +:10F8D0001B0603438B5070470000264004050000C0 +:10F8E0000349044A8B585B005B088B507047C04645 +:10F8F000000026400405000010B50300032800D9CD +:10F9000001BE054CA021C90060580322904313405A +:10F910001843605010BDC04600002640064B1B68CF +:10F920001A6888215B58D21813681B021B0A00064C +:10F93000034313607047C0460C660108044B1A6805 +:10F940001368882152589B181868000E7047C046EB +:10F950000C660108064B1B681A688C215B58D2188C +:10F96000136804490B400002034313607047C0460C +:10F970000C660108FF00FFFF084B1A684023D35CA8 +:10F98000834209D9064AE0308000815880231B0653 +:10F990000B438350002070470248FCE70C660108C7 +:10F9A0000000264001004A00064B1A684023D35C41 +:10F9B000834205D9E0308000034BC058C00F704728 +:10F9C0000020FCE70C6601080000264000280ED04D +:10F9D000094B1A684023D35C83420AD9074AE030B6 +:10F9E000800083585B005B08835000207047044808 +:10F9F000FCE70348FAE7C0460C6601080000264011 +:10FA000001004A0010B50B4B1A684023D35C8342B7 +:10FA10000CD90F290CD8084CE030800003590F2274 +:10FA200093430A4013430351002010BD0348FCE7F1 +:10FA30000248FAE70C6601080000264001004A006F +:10FA4000064B1A684023D35C834200D801BEE030E5 +:10FA50008000034BC3580F20184070470C66010804 +:10FA60000000264010B50C4B1A684023D35C83423B +:10FA70000DD903290DD8094CE030800003593022FC +:10FA8000934309010A4013430351002010BD044869 +:10FA9000FCE70348FAE7C0460C6601080000264070 +:10FAA00001004A00074B1A684023D35C834200D808 +:10FAB00001BEE0308000044BC3581B0903201840EE +:10FAC0007047C0460C66010800002640034B1B69C6 +:10FAD00004201840431E9841C0B2704700002740E0 +:10FAE00010B504000A4A136808210B43136003E0B1 +:10FAF000012000F013FF013CFFF7E8FF002801D1CF +:10FB0000002CF5D1002C01D0002010BD0148FCE7ED +:10FB10000000274002004A00002070470020704784 +:10FB20000349044A885880231B0603438B507047BF +:10FB3000000026400C050000084AC0235B00D35893 +:10FB40000122100018401A4206D10449044A8B5879 +:10FB50005B005B088B5070470248FCE700002640C2 +:10FB60000C05000003004A00064A074BD358012247 +:10FB70009343002800D1002213430249024A8B50CC +:10FB80007047C046000026400C050000014B186875 +:10FB90007047C04640660108084AA623DB00D258D9 +:10FBA00003231340032B06D0044AA623DB00D358BB +:10FBB0000120184070470220FCE7C04600002640A4 +:10FBC00010B5FFF7E9FF022801D0002010BD014B5E +:10FBD0001868FBE744660108134B1A683E23D35CA0 +:10FBE00083421DD9042904D94B1EFF3B9BB2132B22 +:10FBF00018D8FF290CD91F220A400C490300C03332 +:10FC00009B005A50D030800004234350002008E06D +:10FC100007230B40D0308000044A8350002000E0CE +:10FC2000034870470248FCE70C66010800002640C4 +:10FC300001004A0003000C4A11683E228A5C82429D +:10FC400000D801BE1A00D03292000849505807224D +:10FC50001040042800D07047C0339B005A581F231F +:10FC60001340FC301843F6E70C66010800002640FC +:10FC700010B52A4B1A683E23D35C834200D801BEDC +:10FC8000FFF7D8FF88235B00984231D012D80228B2 +:10FC90002BD004D903280BD1FFF73EFF3CE000280E +:10FCA00039D0012802D1FFF771FF35E0002033E0A1 +:10FCB000002031E089235B00984229D01423FF33D0 +:10FCC000984206D1164A174BD358002B1DDB002053 +:10FCD00022E01223FF33984205D1FFF7F7FE0028F8 +:10FCE00010D1002018E0002016E0FFF769FF13E0B4 +:10FCF0000B4A0D4BD358002B01DB00200CE0802079 +:10FD0000000209E08020000206E08020000203E0FB +:10FD1000FFF704FF00E0054810BDC0460C6601086F +:10FD2000000026403C0500000C05000000127A008F +:10FD3000024AB023DB00D058C00F704700002640B5 +:10FD4000034AB223DB00D358012018407047C04655 +:10FD5000000026400B4BB120C00019580A4A114040 +:10FD6000802292050A431A50B021C9005A58520005 +:10FD700052085A5005495A58520052085A50002009 +:10FD80007047C04600002640FFFFFFCF8C050000F3 +:10FD900070B5041E00D175E0FFF7CAFF002800D03F +:10FDA00074E022688023DB029A4200D301BE2368FC +:10FDB0009B039B0BE279002A00D165E0802252046C +:10FDC00013433349B022D2008B50A28880239B0179 +:10FDD0009A4200D301BE228980239B009A4200D31D +:10FDE00001BEA388DB04DB0C2289120429490A40E6 +:10FDF00013432749284A8B50A37A0F2B00D901BE01 +:10FE0000E37A0F2B00D901BEA28980239B019A427D +:10FE100000D301BEA27A0F231340E17A0901FF2229 +:10FE20000A401343A28912021C490A401343A27BD1 +:10FE30001207C02189050A4013431549B122D20097 +:10FE40008B50A379042B00D901BE228A80239B000A +:10FE50009A4200D301BE0E4811494358114A13403B +:10FE6000A2791202E025ED002A4013434350435883 +:10FE70000D4A1340228A1204064C22401343435079 +:10FE8000002070BD01BE87E7002299E70748F8E728 +:10FE9000000026400000FF018405000000FF1F0055 +:10FEA0008C050000FFF8FFFFFFFF00FE03004A0083 +:10FEB00010B5002832D01A49B023DB00CB589A0382 +:10FEC000920B02608022520413405A1E9341C37168 +:10FED000144BCB58DA04D20C82801B0CDB05DB0DF3 +:10FEE0000381B123DB00CB580F2214001C40847225 +:10FEF0001C092240C2721A0AD204D20C82811B0F42 +:10FF0000032213408373084BCB58190A04320A406A +:10FF100082711B0CDB05DB0D038210BD01BECAE73D +:10FF200000002640840500008C05000070B5050027 +:10FF30002649274A885880231B0603438B502C00F0 +:10FF400003E0012000F0EAFC013C204AB223DB0080 +:10FF5000D3585B0701D4002CF3D11C48B121C90050 +:10FF600042581C4B1A4080239B0513434350002DDD +:10FF700001D0002C0CD01549B022D2008858802323 +:10FF80001B0603438B5003E0012000F0C7FC013C3B +:10FF9000FFF7D6FE002801D1002CF5D1002D01D0AD +:10FFA000002C0ED00949B122D2008858C0239B05ED +:10FFB00003438B50002D02D0002C05D000252800D3 +:10FFC00070BDFFF7C7FEF5E7034DF8E700002640D8 +:10FFD0008C050000FFFFFFCF02004A000138074BED +:10FFE0001A683F23D35C834200D801BE8130FF30C2 +:10FFF0008000034BC058C00F7047C0460C66010814 +:020000041001E9 +:10000000000026400138074B1A683F23D35C834227 +:1000100000D801BE9130FF308000034BC35801204F +:10002000184070470C6601080000264070B5013882 +:100030000D4B1A683F23D35C834201D80B4870BD37 +:100040000B4D8130FF30840062590A4B1A408023E7 +:100050009B0513436351012000F060FC63595B0072 +:100060005B0863510020EAE70C66010801004A00C2 +:1000700000002640FFFFFFCFF8B504000D002F4B16 +:100080001A683F23D35C834201D22D48F8BDFFF7A5 +:10009000A5FF002845D1AA78931EDBB20E2B42D8CB +:1000A0006B78002B41D0122B41D82E783000E978A4 +:1000B000002932D01327B8423BD300292FD038274C +:1000C000B84238D8013C2879022816D07F20304029 +:1000D0001B02F8267601334003431204F820400344 +:1000E00002401343C9068022120511400B4322002F +:1000F0008132FF3292001349535012498134FF3448 +:10010000A4006358104A13402A791207C0208005C2 +:100110000240134363500020B8E71627CBE770274F +:10012000CEE70A48B2E70648B0E70548AEE704481C +:10013000ACE70348AAE70248A8E7C0460C660108F6 +:1001400001004A0000002640FFFFFFCF03004A00E5 +:100150000138114B1A683F23D35C83421AD981308E +:10016000FF3080000D4BC3587F221A400A70180AD6 +:100170001F2210404870180C02408A70802212051D +:100180001A40501E8241CA701B0F032213400B718C +:10019000002070470248FCE70C660108000026407A +:1001A00001004A0070B50C00461E294B1A683F2317 +:1001B000D35CB34249D9274933008133FF339B00D5 +:1001C00058588022120602435A50250003E00120AD +:1001D00000F0A4FB013D33009133FF339B001D4A27 +:1001E0009B58DB0701D4002DF1D1002C01D0002D4C +:1001F00017D033008133FF339B00164A9A58120FF1 +:1002000003231340022B01D0002070BD114A813618 +:10021000FF36B600B158C0239B050B43B3500020F6 +:10022000F3E70C4C8136FF36B60032590A4B1A40C0 +:1002300080239B0513433351012000F06FFB33599A +:100240005B005B0833510548DFE70548DDE7C04642 +:100250000C66010800002640FFFFFFCF02004A00A5 +:1002600001004A00F8B504292AD00AD801291DD076 +:10027000022904D1834B00221A70002614E0824E1A +:1002800012E008290FD1814B1B88002B00D1D9E047 +:100290007F4CFFF781FC022800D17CE0002C00D1CC +:1002A00079E0013CF5E7784E3000F8BD794B1B78DA +:1002B000002B00D0E3E0734B01221A700026F3E715 +:1002C000724B00221A80744B1A80002405E0200033 +:1002D000FFF784FE00280BD10134704B1A683F23CE +:1002E000D35CA34255D3002CF1D1FFF721FDF1E7F8 +:1002F0002000FFF79FFC02280CD0002CECD16848AE +:10030000B121C9004258674B1A4080239B05134313 +:100310004350E1E7002C15D16148B121C900425892 +:10032000604B1A4080239B0513434350002120005B +:10033000FFF752FC0123A3409BB2544A11880B43A0 +:100340001380C9E7631E22008032FF3292005449B5 +:100350005258120F920709D01A008132FF329200D0 +:100360005158090F03220A40012A06D10122A24056 +:1003700092B24949088802430A8049488133FF33D1 +:100380009B001958474A1140802292050A431A508F +:10039000CCE7002688E7002C51D1434E394B002290 +:1003A0001A7081E7013CFFF7CBFC002801D1002C3B +:1003B000F8D1002C0AD0002D26D13949B122D20023 +:1003C0008858C0239B0503438B502E000135334BC7 +:1003D0001A683F23D35CAB42E0D30123AB409FB20A +:1003E0002A4A12881342F1D002212800FFF7F4FBB9 +:1003F000002DD8D000E0013C2800FFF703FE0028C4 +:10040000D7D1002CF7D1D4E7234B1B883B420AD02D +:1004100023492B008033FF339B005A582148024068 +:100420005A500026D2E71E492B008033FF339B0031 +:100430005858C022920502435A500026C6E70025AC +:10044000194EC4E7FFF774FC002814D10026A5E775 +:10045000013CFFF775FC002801D1002CF8D1002CDD +:100460000BD00F49B122D2008858C0239B0503430B +:100470008B50002692E7064CEBE70B4E8EE7024EC0 +:1004800012E7C0464A660108FF0042003C660108C8 +:1004900040420F003E660108486601080C660108EC +:1004A00000002640FFFFFFCF02004200F0B587B0FA +:1004B00001A8FFF7FDFCFFF73BFC002807D001ABCC +:1004C0009B7B022B01D0012302E0002300E00023EC +:1004D00001AA019E94882000D279002A21D0022509 +:1004E000002B20D000281FD00020FFF7C1FB3200D6 +:1004F0000023002101F0C8FD06000F002A000023A0 +:100500002000002101F0C0FD02000B00C9075408C3 +:100510000C435D08300039000019694101F094FD79 +:1005200002E00125DCE7002007B0F0BDF0B585B0A2 +:100530000400304B1B683F229A5C002A53D00028ED +:1005400055D03E229B5C834200D801BE294B1A68DD +:100550003F23D35CA34201D2002545E002A920003D +:10056000FFF7F6FD00280BD000230027002500260A +:10057000002B36D0002D37D0002F14D13D0033E0B2 +:100580002000FFF72BFD002807D002AB1B79022BC0 +:1005900001D0012302E0002300E0002302AA167824 +:1005A00055789778E4E72000FFF762FB32000023DC +:1005B000002101F069FD009001913A00002328001C +:1005C000002101F061FD02000B00C90754080C4333 +:1005D0005D08009801990019694101F035FD050099 +:1005E00002E0002500E00025280005B0F0BD050070 +:1005F000FAE7C0460C66010810B504000D4B1A68F6 +:100600003E23D35C834200D801BE002C09D0094BA5 +:100610001A683F23D35CA34208D22000FFF728FBCF +:1006200010BDFFF743FF0028FAD1F6E72000FFF7DF +:100630007DFFF8E70C66010870B50600FFF732FA97 +:100640000500012484403000FFF7FAF9FFF7D4FFDA +:1006500064082018E84070BD10B50020FFF7ECFFDB +:100660000400FFF76BF9411C4808001901F042FC37 +:1006700010BD10B5FFF7F0FF0400FFF7DFF8411CD5 +:100680004808001901F036FC10BD000030B5194BC8 +:100690001B682C229A5C1F2A15D884080722250083 +:1006A00095432A1E22D103321040C000FC32824002 +:1006B0001B682033A4001B191C6881406140114055 +:1006C0006140196012E03C229A5E0BB29A420ED051 +:1006D00007220240074B1B68186880231B06134340 +:1006E000802292019446614489000B5030BD01BEC6 +:1006F000EEE7C0460C66010810B50A4B1B682C22B9 +:100700009A5C1F2A0AD91A6880239B019C4661447F +:1007100089008B585B005B088B5010BD998FFFF7E9 +:10072000B5FFFAE70C6601080B4B1A683C21535ED3 +:10073000116880229201821892005258002A01DB2F +:1007400018B2704780239B019C4660448000425849 +:1007500007231340F4E7C0460C6601080A4B1B68E8 +:100760003C215A5E072108401B68882149018C46BC +:10077000634480001B181968002901DB90B27047A0 +:100780001A689205920DF9E70C660108094B9A6800 +:10079000094B9A4204D01030084B8000C058704773 +:1007A000002905D01030044A830098589950F6E784 +:1007B00001BEF7E700ED00E00000000800000010B7 +:1007C000F0B583B0041E019100D182E04368032B91 +:1007D00000D901BE0023E05E00283EDB6188FFF700 +:1007E00055FF0023E25E6168002A18DB93083A4E49 +:1007F000C0339B009F5903201040C000FF2215000A +:100800008540AF4389010A4082403A439A51334BB5 +:100810009A68334B9A4219D0002003B0F0BD0F23E1 +:100820001340083B9B0806339B002C4884466344D6 +:100830005E6803200240D200FC3007009740BE43B0 +:1008400089010840904030435860E0E70023E05EB3 +:100850000199FFF79BFF0020DFE761880222A35E7A +:100860006268002B17DB9B081B4EC0339B009F590F +:1008700003200840C000FF210D008540AF439201D6 +:100880001140814039439951144B9A68144B9A4254 +:1008900018D01448C1E70F230B40083B9B080633D0 +:1008A0009B000E48844663445E6803200840C000F5 +:1008B000FF210F008740BE43920111408140314328 +:1008C0005960E1E70023E05E0199FFF75FFF05480B +:1008D000A3E70448A1E7C04600E100E000ED00E026 +:1008E000000000080100560070B504000A4B1968AA +:1008F0000120404201F0FEFA050005E0064B1868B1 +:100900006843EFF7F9FD641BAC42F7D8024B186857 +:100910006043EFF7F1FD70BD9802000810B5034B7E +:100920001B785843EFF7E8FD10BDC0469C02000855 +:1009300010B5FFF7F3FF10BD054B802212069A6435 +:100940009B6C002B01DB002070470248FCE7C0468F +:1009500000002740030046000D4B802212019858EA +:100960005B68FF221A4202D080231B061843084A04 +:10097000084BD3581B0402D080235B021843044A5F +:10098000044BD3581B0C02D080239B0218437047A2 +:100990000000264004080000FEE7000010B50268D1 +:1009A000094B1A6242685A6282689A62C268DA62C5 +:1009B00002691A6342695A6382699A63C269DA6397 +:1009C000FFF7EAFF10BDC046E4060008F0B5C646D2 +:1009D00000B5002833D019238B429B415B42314C38 +:1009E00022681668AC27D25BB61832680325AA4382 +:1009F0002B401A43326026683268F65B92191768FA +:100A0000294E3740176027683A689046AE229446D0 +:100A1000BF5A3A0042441768AF433B431360226811 +:100A200013686446125B9B181A6832401A600028EB +:100A300007D010291DD9212927D801221AE06423C3 +:100A4000CAE7184B1B6855229A5C8A421FD256226D +:100A50009A5C8A421DD257229A5C8A421BD2582243 +:100A60009A5C8A4219D259229B5C8B4217D3553A21 +:100A700000E000220B4B1B6859680B680F20834372 +:100A800013430B6080BCB846F0BD0222F2E700229F +:100A9000F0E70122EEE70222ECE70322EAE7052273 +:100AA000E8E7C0460C660108FFFCFFFFB0235B05CA +:100AB0005B78002B04D0B0235B055878C0B2704738 +:100AC0002120FCE7B0235B059B899BB2002B04D05F +:100AD000B0235B05988980B2704780204000FBE717 +:100AE00070B5FFF7EFFF80235B0098421AD0B0206B +:100AF0004005174BC358174A1340174C21680A6822 +:100B00009C25495952181168C025AD0029400B4356 +:100B1000136022681368A02152589B180F4A82580C +:100B20001A6070BD0C4C23681A689C215B58D2185F +:100B300013680F2083439A390B43136023681A68A4 +:100B4000A0241B59D218136883430B431360E8E7B2 +:100B500048180000FFFCFFFF0C6601084418000065 +:100B600070B5FFF7AFFF80235B0098421AD0B0202A +:100B70004005134BC358134A1340134C21680A68AD +:100B80009C25495952181168C025AD0029400B43D6 +:100B9000136022681368A02152589B180B4A825890 +:100BA0001A6070BD084B1A6813689C2152589B1834 +:100BB0001968074A11408022D2010A431A60F0E7FF +:100BC00050180000FFFCFFFF0C6601084C180000E5 +:100BD000FF8FFFFF10B5FFF775FF80235B00984282 +:100BE00012D0B02252050F4BD3580F4A13400F4A70 +:100BF00011680A689C20095852181168C0208000AA +:100C000001400B43136010BD084B1A6813689C2108 +:100C100052589B181968064A1140C022D2010A4353 +:100C20001A60F0E71C180000FFFCFFFF0C660108CB +:100C3000FF8FFFFF70B5FFF745FF80235B009842F1 +:100C40001BD0B0204005184BC358184A1340184C0D +:100C500021680A689C25495952181168C025AD00C1 +:100C600029400B43136022681368A02152589B1837 +:100C7000C122520182581A6070BD0D4C23681A6857 +:100C80009C215B58D21813680F20834399390B437A +:100C9000136023681A68A0241B59D2181368834371 +:100CA0000B431360E8E7C04624180000FFFCFFFF79 +:100CB0000C66010870B5204B1A6813689C215258C5 +:100CC0009B181C68C0231B011C40FFF7FBFE802300 +:100CD0005B0098421FD01849086803689C2280581E +:100CE0001B181868154D284018600868036880585C +:100CF0001B181868C0252D012E00A643304318602C +:100D000009680B688A589B1818682840001B431E06 +:100D10009841C0B270BD0020FBF7EAFF0400FFF766 +:100D2000C5FE222803D8002C03D10120F2E70120C0 +:100D3000F0E70020EEE7C0460C660108FFF3FFFF76 +:100D400030B500283CD0C368002B3BD00368002B93 +:100D50003AD005791E4BAA00D258002A28D0140098 +:100D600000E01A005369002B07D0824205D0197E9B +:100D7000027E9142F5D81C00F3E7824226D0236917 +:100D8000002B08D0636943610461002B00D0186117 +:100D90006061012015E0027E237E9A42F2D2446116 +:100DA0000023036120610A4BAD00E850012008E0F8 +:100DB000074BAD00E850002343610361012000E0D0 +:100DC000002030BD0020FCE70020FAE70020F8E713 +:100DD0008C66010870B582B006000D00042800D9A9 +:100DE00001BE6B1EDBB2012B04D9042D02D0082DED +:100DF00000D001BE284BB200D458042D1ED0012DC6 +:100E00001ED0022D32D026006469002CFBD10020B8 +:100E100033E06469002C17D0204B984212D0A368AD +:100E20002B42F6D1E3681A6800925B68019323684D +:100E30002900684698471A4B1C60EAE70020E9E75A +:100E40000020E7E7012DEAD1012D01D002B070BDED +:100E5000124B984204D0134BB6000022F250F5E733 +:100E6000104BB6000E4A1268F250EFE70C4B1E68AA +:100E7000002ECCD03669CAE73669002EE6D0B368BA +:100E80002B42F9D1F3681A6800925B6801933368CA +:100E9000290068469847EFE78C660108FF0042008A +:100EA000886601087466010810B5EFF72EFB074B42 +:100EB0005968074C2140E82292010A435A605A6857 +:100EC00022405A605B68EFF724FB10BD000026400B +:100ED000FF00FC0FF0B5C64600B50700012800D999 +:100EE00001BEFFF7E3FD85B2FFF7ECFD0600002031 +:100EF000FBF7FEFE041E17D180235B009E4201D04B +:100F00002A4C12E0222D42D8294B1B6858682949E7 +:100F10004358294A134098463A0680235B041A40F6 +:100F200043461343435000E0204C80235B009E4225 +:100F30002FD080235B009E4225D01D4B1A6833239F +:100F4000D35C002B00D101BE194B1B681D6A8023A6 +:100F50005B009E4220D0002F24D0184A0121280097 +:100F6000FBF746FC00280ED1114B1A68BC23D3585E +:100F70005B191B68002BF7DBEB681B0E1B06A0221E +:100F80001206934210D0200080BCB846F0BD074C3A +:100F9000CBE7222DD1D8CCE7002F01D0084ADDE7DE +:100FA000084ADBE7084AD9E70400ECE704004200FE +:100FB0000C66010818F00000FFFFFFFE0300000CA4 +:100FC00001010030010000300100000C00283BD07E +:100FD0001E4B1B681A688821595852181268026201 +:100FE0001A688C21595852181268426246229A5C3B +:100FF000002A28D09968E0228A58D20623D5DA68D8 +:10100000F223DB01D3580360104B1B68D968F02230 +:10101000D2018A584260D9680D4A8A588260D968DC +:101020000C4A8A58C260D9680B4A8A580261D9684A +:101030000A4A8A584261D968094A8A588261DA683C +:10104000084BD358C361704701BEC1E70C66010865 +:1010500004780000087800000C7800001078000088 +:10106000147800001878000010B500283BD01F4B02 +:1010700019680A68882409595218016A11601968A8 +:101080000A68043409595218416A11601B684622E3 +:101090009A5C002A26D09968E0228A58D20621D587 +:1010A000D9684468F022D2018C50D9688468104A0B +:1010B0008C50D968C4680F4A8C50D96804690E4AAC +:1010C0008C50D96844690D4A8C50D96884690C4A9F +:1010D0008C50D968C4690B4A8C50DA680168F223D5 +:1010E000DB01D15010BD01BEC1E7C0460C6601084E +:1010F00004780000087800000C78000010780000E8 +:101100001478000018780000F0B5C64600B5070056 +:10111000FFF7CCFC0500012F00D901BE7C4B5B68BA +:10112000002B00D184E001210120FFF753FE041EB3 +:101130006FD1EFF7EAF98046754B5B68002B03D05F +:1011400004210120FFF746FE724B1A68136ABA2188 +:10115000515ACA00521A9B181A68002AF4DADB683E +:10116000DA0000D566E0802080051843694B1B68D3 +:101170001A6ABA215E5AF500AD1B5219D0601A6A7C +:101180005D5AE800401B1218002050601A6A595A34 +:10119000CB005B1AD3185B68FFF794FC80235B00DD +:1011A000984200D17CE05B4B1A683323D35C002B60 +:1011B00000D101BE574B1B681A6ABC215B589B18B3 +:1011C0001B68002B00DB6FE0534C524B1A68136A0C +:1011D000BA21515ACA00521A9B181A68002AF4DA26 +:1011E000DD68EB0000D57FE04C4B1D40494B1B6890 +:1011F0001A6ABA201F5AF900C91B5218D5601A6A18 +:10120000195ACB005B1AD31800225A604046EFF7F8 +:1012100080F9002C00D06CE03D4B5B68002B03D0C4 +:1012200008210120FFF7D6FD200080BCB846F0BDA4 +:1012300000247EE71B0F1E073948FFF7C7FE212D4C +:1012400017D0344D2B68196888229B58C9180B6831 +:1012500034480340783213430B6029680B688C25AF +:1012600049595B18196801400A431A602C4B3343F3 +:1012700079E7284D2B68196888229B58C9180B6894 +:10128000284803409022120113430B6029680B6821 +:101290008C2549595B18196801400A431A60E5E733 +:1012A000380002F04DF890E71A4B1A683323D35CEC +:1012B000012B00D801BE174B1B681A6ABA21595A74 +:1012C0005218BC215B589B181B68002B0ADB164A7E +:1012D0001369B8390B431361012F01D030BF74E794 +:1012E00020BF72E70C4C70E728010009FFF7BCFE35 +:1012F0007AE7074B5B68002B03D002210120FFF740 +:1013000069FD054B9C4200D18EE7084C8CE7C04636 +:101310008C6601080C66010805004200FFFFFFDF34 +:101320004C660108FF00FFFF00ED00E0FF004200F7 +:10133000024B5B69072018407047C04600002640FA +:10134000074A084BD2581F231340B0214905E82211 +:10135000D200885CC01A431E9841C0B27047C04694 +:10136000000026401CFF0000044B186880231B046B +:10137000184043425841C0B27047C0460000264062 +:1013800010B5204B19680B6890228A589A18146877 +:1013900003202040032804D01268D20710D502246D +:1013A00000E0042494228A589B18196803220A40FA +:1013B000032A07D01B68DB0711D520231C4303E059 +:1013C0000124EFE740231C43FFF7CEFF00280DD098 +:1013D000FFF7B6FF002805D0802020430CE0102343 +:1013E0001C43F1E780200001204305E0FFF7A0FF48 +:1013F000022802D08020204310BD8020000120431D +:10140000FAE7C0460C66010810B5FFF7B9FF802364 +:101410001B011840431E9841C0B210BD10B5FFF724 +:10142000A3FF002810D01C4A13681C490B4013600E +:101430000820FFF773FA6423174A1268002A09DBB1 +:10144000002B07D0013BF7E7134A136814490B4000 +:101450001360EDE7002B01D1124810BD0E4A13684E +:1014600011490B4013600120FFF758FAFFF77CFF8A +:10147000002801D10020F0E7FFF762FF012801D02A +:101480000020EAE7B0225205084BD158024A084B27 +:10149000D1500020E1E7C04600002640FFFFFBAC32 +:1014A000FFFFFBAD02004200FFFFFFFB1018000032 +:1014B000307F000010B5FFF757FF002808D0054B1C +:1014C000054A10681840C01A43425841C0B210BDC6 +:1014D000024BF5E7000004530000264000000452D0 +:1014E000F8B50400012800D901BEFFF7E3FB00288E +:1014F00002D12D4D2800F8BDEFF707F80600002CAB +:1015000014D12A4A2A4B0021D150B0225205E82397 +:10151000DB00D75CFFB20120FFF7DCFC051E02D028 +:10152000002D2AD11DE0FFF7DBFAF9E7FFF7C2FF34 +:10153000002826D01D4A1E4B5021D150B022520502 +:101540001C4BD75CFFB219491B4A8B581F208343A1 +:10155000143803438B500838FFF7E0F9FFF700FB1E +:1015600000251248144943581F2293433A4013431D +:101570004350002C0DD1FFF72DFB3000EEF7C9FFD3 +:10158000B8E7B02252050D4BD158084A084BD1504C +:10159000D4E70720FFF7C2F9FFF74CFB0020FFF765 +:1015A00099FC0500E9E7C046030042000000264020 +:1015B000307F0000410700001CFF000010180000F1 +:1015C000024B5B685B0C012018407047000026400E +:1015D000084B5A6C120AFF2313403A2B00D0704775 +:1015E00004494A6C044B1A40E8239B0113434B64A3 +:1015F000F5E7C04600002740FFC5FFDF04494A6CFD +:10160000044B1A40E8239B0113434B647047C046C8 +:1016100000002740FF00FFFFF0B5D6464F46464684 +:10162000C0B582B007000C0001921E00012B00D94A +:1016300001BE3B0B00D001BE264B1A687223D35A61 +:101640009B08013B244A134322009A4301D16300C3 +:1016500000D401BEF02212013B0063401D00154082 +:10166000134207D01D4D280002B0E0BCBA46B14677 +:10167000A846F0BDEEF749FF8046164B1868816812 +:101680007023C35AC9187223C25A9308013B2340DE +:101690009B009A466E23C35A1C40240A62431300DF +:1016A00053445B181A68920A9102FF223A4001984B +:1016B00000280DD080246400224376028024A400F8 +:1016C000264032430A431A604046EEF722FFCAE73B +:1016D0002C00F1E70C660108000F00400100CE006D +:1016E000F0B5C64600B504000E001500012A00D969 +:1016F00001BE234B1A687223D35A9B08013B214A2F +:10170000134322009A4304D11F4B22001A409A42ED +:1017100000D001BE1A4B1A683023D35C1F2B03D8AC +:101720001A4880BCB846F0BDEEF7EFFE144B1F68B8 +:10173000B9687023FB5AC9187223FA5A9308013BFF +:1017400023409B0098466E23FF5A3C40240A624384 +:10175000130043445B181A680D490A40002E0CD050 +:101760000224FF346D02802189000D4025432A4365 +:101770001A60EEF7CEFE0020D3E70124F2E7C04660 +:101780000C660108001F0040001000400100CE0060 +:10179000FFFCFFFF70B504001A4B1A687223D35A7E +:1017A0009B08013B184A134302009A4304D1174B8C +:1017B00002001A409A4200D001BE124B1A68302330 +:1017C000D35C1F2B01D8124870BDEEF79EFE0D4B67 +:1017D0001A6891687023D35AC9187223D35A9D0886 +:1017E000013D6E26925B2240120A53432C40A40016 +:1017F0001B195B181A6807490A401A60EEF789FE40 +:101800000020E1E70C660108001F004000100040C6 +:101810000100CE00FEFCFFFF0449C02252008858A0 +:10182000C0231B0603438B507047C0460000264070 +:10183000044AC0235B00D058800F431E9841C0B2B9 +:101840007047C046000026400749C02252008B580E +:101850009B009B088020C00503438B508858802341 +:101860001B0603438B5070470000264010B5040050 +:1018700080235B02984200D301BEFFF7D9FF002806 +:1018800009D10549C42252008B581B0C1B042404A7 +:10189000240C23438B5010BD0000264010B50400DB +:1018A0000F2800D901BEFFF7C3FF00280BD106495E +:1018B000C42252008B58054803402404F020000342 +:1018C000044023438B5010BD00002640FFFFF0FF73 +:1018D000034AE023DB000121D150D3587047C046B2 +:1018E0000000264010B50020FBF70AF910BD704734 +:1018F00010B50020FEF7A0FE041E00D110BD154B50 +:101900001860FEF71BF8411C200000F0F3FA0400F9 +:10191000114B1860FDF792FF411C200000F0EAFA1D +:1019200004000E4B1860013C0D49200000F0E2FA63 +:1019300001300C4B1870FA218900200000F0DAFA0F +:101940000130094B18600020FEF776FE074B186047 +:10195000D4E7C046900200089402000888020008FC +:1019600040420F009C020008980200088C02000808 +:1019700010B52248FAF7C6FB214CB022D200A3587A +:101980005B005B08A350E02189006358302083434B +:10199000635080235B04A3501A4B1B4AE25004336C +:1019A000A0229201E250194BFF22E250FFF74CFFB8 +:1019B000C0225200A35801218B43A350FFF797FF89 +:1019C000FFF796FF124B1B681A6ABA201C5AE100F7 +:1019D000091B52180021D1601A6A185AC3001B1A39 +:1019E000D31859600B4A80310320FBF7EBF80A4803 +:1019F000FAF724FF0948FAF777FF10BD685B01107A +:101A00000000264084050000010002008C05000053 +:101A10000C66010888060008A0660108A45C011095 +:101A2000034A90235B01D358032018407047C046F7 +:101A30000000204010B5EEF768FD084C90214901E8 +:101A40006258074B1A40074B13436350034B5B68C4 +:101A5000DB06FBD5EEF75DFD10BDC0460000204063 +:101A6000FCFF00000100FA0570B50400830500D0FA +:101A700001BEEEF74AFD0500FFF7D2FF032813D0A1 +:101A80000B4B802292009C50902040011958094A2B +:101A90001140094A0A431A50054B5B68DB06FBD527 +:101AA0002800EEF736FD70BDFFF7C4FFE8E7C0463B +:101AB00000002040FCFF00000300FA0510B500F014 +:101AC000CFF800F00DF800F0BBF800F045F800F09A +:101AD0004BF810BD10B500F02DF800F05FF810BD08 +:101AE00010B50F210120FDF763FE00220F21012018 +:101AF000FDF734FD0F210120FDF718FE0021002025 +:101B0000FDF756FE002200210020FDF727FD0021F1 +:101B10000020FDF70BFE07210020FDF749FE002203 +:101B200007210020FDF71AFD07210020FDF7FEFD2B +:101B300010BD000010B50548F8F72CFE0448F8F772 +:101B400029FE0448F8F726FE10BDC046E05C0110EF +:101B5000D85C0110DC5C011010B5002200212F20A0 +:101B6000FDF7AAFD10BD000010B5084A084C04217D +:101B70002000FAF763FD074A06212000FAF75EFD10 +:101B8000054A07212000FAF759FD10BD805D0110BC +:101B900000033140485D0110105D011010B5184878 +:101BA000F8F7F8FD1748F8F7F5FD1748F8F7F2FDD4 +:101BB0001648F8F7EFFD1648F8F7ECFD1548F8F76A +:101BC000E9FD1548F8F7E6FD1448F8F7E3FD144879 +:101BD000F8F7E0FD1348F8F7DDFD1348F8F7DAFDF4 +:101BE0001248F8F7D7FD1248F8F7D4FD1148F8F776 +:101BF000D1FD1148F8F7CEFD1048F8F7CBFD10BD28 +:101C0000B85D0110BC5D0110F85C0110B45D0110FD +:101C10007C5D0110445D0110E45C0110E85C011082 +:101C2000EC5C0110F05C0110F45C0110FC5C011034 +:101C3000005D0110045D0110085D01100C5D0110D4 +:101C4000034B332203495A5003495A507047C04648 +:101C5000000030400820000010200000FEE70000D7 +:101C600030B583B0072200213220FDF725FD9621F3 +:101C70000020FEF7ABFEFEF76FFE00281BD1794A6D +:101C8000FF231B02D4583F231C40FEF755FE0028BB +:101C900006D00120FEF742FE724B9B6C002B27DB27 +:101CA000704AFF231B02D450FDF746FFFDF738FFB3 +:101CB0000120FDF759FF0120FFF712FCFFF7AEFBF3 +:101CC000FFF79CFCFFF784FCFEF744F8002100209E +:101CD000FDF7C8FE0020FDF73DFE0120FDF71EFECA +:101CE0000020FDF799FD604B1A683F23D45C06E0A5 +:101CF0000620FFF7B3FF2000FEF798F9013C002C07 +:101D0000F9D100210120FDF767FF0020FDF798FEC3 +:101D1000002800D18BE000210020FDF75DFF0021AD +:101D20000020FDF76FFE514C002500950023002296 +:101D300000212000FAF7AEFB0095002300220121CC +:101D40002000FAF7A7FB4A48FDF7CAFE002800D09A +:101D500079E00120FDF7D0FD0020FDF7FBFD00201C +:101D6000FDF7DCFD0020FDF757FD00210120FDF708 +:101D700033FF00210020FDF72FFF00210220FDF797 +:101D80002BFF00210320FDF727FF00210420FDF792 +:101D900023FF00210520FDF71FFF3648FDF7F8FF60 +:101DA000002853D13448FEF7C1F8002851D1002152 +:101DB0000020FDF727FE00210020FDF753FE2F49EC +:101DC0000120FEF759F9002846D12D490120FEF7E0 +:101DD000E9F9002843D1FDF783FD0020FDF74CFD14 +:101DE0000020FDF761FDFDF76FFD0120FDF732FDDD +:101DF000FDF796FE0120FDF7B7FE64210020FEF7F7 +:101E0000E5FDFFF775FD1F48F8F7C4FC1E48F8F71D +:101E1000C1FC1E48F8F7BEFC1D48F8F7BBFC1D4886 +:101E2000F8F7B8FC1C48F8F7B5FC03B030BDFDF777 +:101E300001FF1223FF33984200D06CE701210020FC +:101E4000FDF7E0FD67E70520FFF708FF0420FFF737 +:101E500005FF0420FFF702FF0320FFF7FFFE03202A +:101E6000FFF7FCFE000027400C660108000031402F +:101E700040420F002C5F0110400D0300585F01101D +:101E800010270000405F0110445F0110485F0110FF +:101E90004C5F0110505F0110545F011010B50448F1 +:101EA000FEF74EFF002801D0002010BD0148FCE7DE +:101EB000A00200080000020610B5F8F769FC041E35 +:101EC00009D0002C0BD0FFF7F9FDFFF703FE002C23 +:101ED0000AD0200010BDF9F749F90400F1E70449E0 +:101EE0000020F9F791F9EEE7FFF7D8FF0400F0E7DB +:101EF000E40C0000002243088B4274D303098B4298 +:101F00005FD3030A8B4244D3030B8B4228D3030CC9 +:101F10008B420DD3FF22090212BA030C8B4202D36B +:101F20001212090265D0030B8B4219D300E0090A93 +:101F3000C30B8B4201D3CB03C01A5241830B8B429C +:101F400001D38B03C01A5241430B8B4201D34B0385 +:101F5000C01A5241030B8B4201D30B03C01A5241EA +:101F6000C30A8B4201D3CB02C01A5241830A8B426F +:101F700001D38B02C01A5241430A8B4201D34B0258 +:101F8000C01A5241030A8B4201D30B02C01A5241BC +:101F9000CDD2C3098B4201D3CB01C01A5241830970 +:101FA0008B4201D38B01C01A524143098B4201D3AA +:101FB0004B01C01A524103098B4201D30B01C01AD5 +:101FC0005241C3088B4201D3CB00C01A524183084F +:101FD0008B4201D38B00C01A524143088B4201D37C +:101FE0004B00C01A5241411A00D2014652411046DC +:101FF0007047FFE701B5002000F006F802BDC046BB +:102000000029F7D076E770477047C0461C210123AE +:102010001B04984201D3000C10391B0A984201D3CB +:10202000000A08391B09984201D30009043902A2A9 +:10203000105C40187047C046040302020101010110 +:102040000000000000000000002B11D1002A0FD179 +:10205000002900D1002802D00021C943080007B49C +:10206000024802A14018029003BDC0469DFFFFFF39 +:1020700003B4684601B5029800F034F8019B9E460F +:1020800002B00CBC7047C046F0B5CE469946030C72 +:102090009C46130447461B0C1D000E0061460404B9 +:1020A000240C80B50700100C4B436543414360434B +:1020B0002C0CC01820188C46834203D980235B0265 +:1020C0009846C444494679435643030C2D042D0CCD +:1020D0008919634400044019C918C0BCB946B04608 +:1020E000F0BDC046F0B557464E464546DE46E0B523 +:1020F00004000D009246994683B08B4230D82DD013 +:102100004946504600F0BAF829000600200000F0C9 +:10211000B5F8331A9846203B34D49B4653465A466A +:10212000934042461F00534693401E00AF423BD8A7 +:10213000AF4200D179E05B46A41BBD41002B00DA21 +:1021400076E0002200230092019301235A46934037 +:102150000193012342469340009329E08242CFD964 +:1021600000220023009201930C9B002B01D01C60E5 +:102170005D600098019903B0F0BCBB46B246A94629 +:10218000A046F0BD42469B4620239B1A5246DA40A9 +:10219000414613004A468A40170042461F435346B1 +:1021A00093401E00AF42C3D9002200230092019346 +:1021B0004346002BD8D0FB0772081A4346467B08DB +:1021C0000EE0AB4201D1A2420CD8A41A9D410120DD +:1021D00024196D410021013E24184D41002E06D0E6 +:1021E000AB42EED9013E24196D41002EF8D1009882 +:1021F00001995B4600196941002B24DB2B005A46EC +:102200004446D3402A00E2401C005B461500002BE8 +:102210002ADB26009E40330026004746BE4032009F +:10222000801A9941009001919EE7A342BCD882E7B1 +:102230004246202300219B1A002200910192012294 +:10224000DA40019285E7424620239B1A2A0046463F +:102250009A402300F340444613432A00E2401C0006 +:102260005B461500002BD4DA42462F0020232600BF +:1022700097409B1ADE403B003343CDE710B5002961 +:1022800003D1FFF7C3FE203002E00800FFF7BEFED7 +:1022900010BDC0467FB514001A00094B05001B682D +:1022A0000E00D868074B002C01D1074B1C000749D2 +:1022B000019302942B00009600F05CFC00F0F4FD0A +:1022C000140300085D5F0110985F01106A5F011040 +:1022D00010B5034B0A000100186800F003F810BDA8 +:1022E0001403000870B50B0C150C002B1ED1002D2B +:1022F0000CD189B294B24C43210000F09BF9051E29 +:102300001BD02200002100F07BFD16E02B1C0C1CD2 +:1023100089B292B24A43A1B29CB24C43130CE41866 +:10232000230C07D1240492B21443E5E7002D01D118 +:10233000141CEDE70C2300250360280070BD936892 +:1023400010B5013B9360002B04DA9469A34207DBCC +:102350000A2905D01368581C10601970080010BDB8 +:1023600000F034FC0100F9E7F8B506000F00140096 +:10237000D518AC4201D1002007E021783A003000A6 +:10238000FFF7DDFF0134431CF3D1F8BDF0B5A1B078 +:102390000F0015001E000390002804D0036A002BD4 +:1023A00001D100F0CFFB7B6EDB0705D4BB899B0519 +:1023B00002D4B86D00F062FDBB891B0702D53B69F2 +:1023C000002B13D13900039800F042FC00280DD0F7 +:1023D0007B6EDB0703D50120404221B0F0BDBB89F5 +:1023E0009B05F8D4B86D00F04AFDF4E7002308AC73 +:1023F0006361203363761033A37607962E0033781B +:10240000002B01D0252B48D1731B0593AE420BD076 +:102410002A0039000398FFF7A7FF013000D1AFE091 +:102420006369059A9B1863613378002B00D1A7E09C +:10243000012200235242626004A954325218751CD2 +:102440002360E360A3601370A365594B0522180055 +:102450002978059300F014FD6E1C00281FD1226816 +:10246000D30604D5532304A95B1820211970130740 +:1024700004D5532304A95B182B2119702B782A2B20 +:1024800016D02E0000210A20E3683278751C303AFD +:10249000092A4ED9002911D117E00136AFE7059B73 +:1024A0002268C01A01238340134335002360CCE720 +:1024B000079B191D1B680791002B01DB0B9304E0A0 +:1024C0005B42E36002231343236033782E2B0AD14F +:1024D00073782A2B35D1079B02361A1D1B68079289 +:1024E000002B2BDB0993334D03222800317800F0B9 +:1024F000C7FC002806D04023401B834022680136D9 +:1025000013432360317806222B48751C217600F096 +:10251000B7FC002843D0294B002B25D10722079B6D +:1025200007339343083307936369049A9B186361E5 +:1025300064E743432E0001219B18A6E701235B4279 +:10254000D0E700230A201A00013663603178751C39 +:102550003039092903D9002BC5D00992C3E742437A +:102560002E0001235218F1E707AA009221003A0039 +:10257000134B039800E000BF0490049B0133D3D1B8 +:102580007B6EDB0705D4BB899B0502D4B86D00F0D8 +:1025900076FCBB895B0600D51DE70D981DE707AAF1 +:1025A000009221003A00064B039800F02DF9E3E772 +:1025B000995F01109F5F0110A35F011000000000F0 +:1025C0006923011010B5044C13000A0001002068B3 +:1025D000FFF7DCFE10BDC0461403000810B5034B26 +:1025E0000100186800F068FC10BDC0461403000824 +:1025F00070B50F4E0D0031680400002902D100F0C3 +:102600002BFC30602900200000F026FC431C0AD07F +:102610000323C51C9D43A84207D0291A200000F0BF +:102620001BFC013001D101256D42280070BDC04660 +:102630002C680108F7B50322CB1C9343083306002E +:102640001F000C2B34D20C27B94233D8300000F0D5 +:10265000EBF9344D2B681C00002C30D139003000D0 +:10266000FFF7C6FF0400431C59D12C682500002D3C +:102670004CD1002C4DD023682900E3183000019381 +:1026800000F0EAFB019B834243D123680337FF1A22 +:1026900003239F4308370C2F00D20C27390030004A +:1026A000FFF7A6FF013034D02368DB19236013E065 +:1026B000002BC9DA0C23002533602800FEBD2168F9 +:1026C000C91B20D40B2917D9E2192760A34211D1C5 +:1026D0002A606368116053603000250000F0ACF997 +:1026E00007220B35231D9543EA1A9D42E5D05B1B5B +:1026F000A350E2E75A60ECE76268A34201D12A6086 +:10270000EAE75A60E8E723006468A5E72C006D68F3 +:10271000ADE70C233000336000F08EF9CDE7276081 +:10272000DAE7C04628680108F7B5160001938A6801 +:102730000B690C000090934200DA13002200336012 +:1027400043321278002A01D00133336023689B069C +:1027500002D53368023333602268062315001D401A +:102760001A4227D0230043331B785A1E9341226814 +:10277000920630D4220001990098089D4332A84760 +:10278000013025D00622236800251340042B05D1F3 +:102790003368E568ED1AEB43DB171D40A368226937 +:1027A000934201DD9B1AED180026B54220D100208E +:1027B00010E00135E36832689B1AAB42D2DD22009B +:1027C000012301990098089F1932B8470130F0D1D0 +:1027D00001204042FEBD3020E11843310870210045 +:1027E0005A1C45310978A218433202331170C1E7EF +:1027F0002200012301990098089F1A32B84701303E +:10280000E6D00136D1E70000F0B58BB006920A00A1 +:1028100043320793059004920A7E0C00109B782A9D +:1028200009D8622A0BD8002A00D1BEE07C49039166 +:10283000582A00D193E026004236327022E0100080 +:1028400063381528F7D800F01BFD16001F00F6FFAF +:10285000F6FFF6FFF6FF1F00F6FFF6FFF6FFF6FFA6 +:10286000A30036008300F6FFF6FFB400F6FF360043 +:10287000F6FFF6FF870026001A684236111D196020 +:10288000136833700123A2E018680968021D0D0661 +:102890000BD505681A60002D03DA2D23049A6D42CA +:1028A00013705F4B0A2703931BE005681A60490603 +:1028B000F1D52DB2EFE70D681968081D18602E06D6 +:1028C00001D50D6803E06D06FBD50D68ADB2544B24 +:1028D000082703936F2A00D00237230000224333D6 +:1028E0001A706368A360002B03DB042122688A430B +:1028F0002260002D02D1049E002B0CD0049E2800E3 +:102900003900FFF77DFB039B013E5B5C33702B00BE +:1029100005009F42F3D9082F09D12368DB0706D5AC +:10292000626823699A4202DC3023013E3370049BC3 +:102930009B1B2361079B210000930598069B09AA16 +:10294000FFF7F2FE013047D1012040420BB0F0BD4D +:10295000202209680A43226078223249039121002B +:1029600045310A701968226820C9100602D4500641 +:1029700000D5ADB21960D30702D5202313432360DD +:102980001027002DA9D12022236893432360A4E7B8 +:102990001A680D68101D4969186013682E0601D564 +:1029A000196002E06D06FBD519800023049E2361A7 +:1029B000C0E71A68111D19601668002130006268AE +:1029C00000F05EFA002801D0801B6060636823611C +:1029D0000023049A1370ADE7320023690699059825 +:1029E000079DA8470130AFD023689B0715D4099BEA +:1029F000E0689842AADA1800A8E7220001230699A5 +:102A00000598079E1932B04701309DD00135E36823 +:102A1000099A9B1AAB42F0DCE9E70025F7E7C046CC +:102A2000AA5F0110BB5F011010B5024800F026FA42 +:102A300010BDC0466C69010810B5024800F01FFACD +:102A400010BDC0466C690108002310B50400036086 +:102A500043608360818143661900C28103614361E1 +:102A6000836108225C3000F0CBF9054B246263627D +:102A7000044BA362044BE362044B236310BDC046C6 +:102A8000B9300110E1300110193101104531011048 +:102A900010B5034A0349044800F07CF810BDC04655 +:102AA000BC02000861300110C802000841680B4BED +:102AB00010B50400994201D000F0D2FAA168084B89 +:102AC000994202D0200000F0CBFAE168054B994210 +:102AD00002D0200000F0C4FA10BDC04630680108E2 +:102AE000986801080069010810B5094B094A0421DA +:102AF0001A6009480022FFF7A7FF012209210748B1 +:102B0000FFF7A2FF022212210548FFF79DFF10BD2B +:102B100068690108912A0110306801089868010865 +:102B20000069010810B5024800F0A8F910BDC046C0 +:102B30006D69010810B5024800F0A1F910BDC0464A +:102B40006D69010810B50400FFF7ECFF236A002B44 +:102B500002D0FFF7EFFF10BD044B2362044B1B684C +:102B6000002BF6D1FFF7C0FFF3E7C046AD2A0110F6 +:102B7000686901080EB417B5054C05AB04CB01001C +:102B800020680193FFF702FC1EBC08BC03B0184785 +:102B900014030008F7B51400002600900191A56801 +:102BA0006768013F04D52468002CF8D13000FEBDD1 +:102BB000AB89012B08D90E22AB5E013304D029006A +:102BC0000098019B984706436835EAE7F8B5060088 +:102BD0000D001400002804D0036A002B01D1FFF778 +:102BE000B1FFA369A360A3891B0728D52369002B24 +:102BF00025D023692068EFB2C01A6369EDB2834221 +:102C000005DC2100300000F02BFA00281DD1A3685C +:102C10000130013BA36023685A1C22601F70636966 +:102C2000834204D0A389DB0707D50A2D05D12100F3 +:102C3000300000F015FA002807D12800F8BD210067 +:102C4000300000F005F80028D3D001256D42F4E7EC +:102C5000304B70B5050018680C00002804D0036ADA +:102C6000002B01D1FFF76EFF0C23E25E93B2110738 +:102C700023D4D90607D4092301202B60373313430B +:102C8000A381404270BD5B0713D5616B002908D05A +:102C900023004433994202D0280000F00DF90023AC +:102CA00063632422A3899343A38100236360236980 +:102CB00023600823A2891343A3812369002B0BD12E +:102CC000A0218022A389890092000B40934203D067 +:102CD0002100280000F048F80C22A35E01201A0011 +:102CE00099B2024003420FD00022A26062695242B0 +:102CF000A261002022698242C4D10906C2D54022C5 +:102D00001343A3810138BDE7880700D46269A2603C +:102D1000EFE7C0461403000870B50E001D000E2337 +:102D2000C95E140096B000290CDAB2898023110024 +:102D300019401A4213D00021403B00202960236033 +:102D400016B070BD6A4600F063F80028EDDBF02392 +:102D500001991B021940034BC9184B42594180236A +:102D6000DB00EAE700E0FFFFF7B502268B890500EC +:102D70000C00334206D02300473323602361012334 +:102D80006361F7BD6A4601ABFFF7C6FF0099070014 +:102D90002800FFF74FFC002808D10C22A35E9A05FB +:102DA000EFD4032293431E43A681E4E78023A28944 +:102DB00020601343A381009B20616361019B002B72 +:102DC0000CD028000E23E15E00F034F8002805D076 +:102DD0000323A2899A43023B1343A381A3893B4364 +:102DE000A381CEE730B500240139A24201D10020F1 +:102DF00005E0035D01340D5DAB42F6D0581B30BDDC +:102E000003008218934200D1704719700133F9E72B +:102E1000002370B5064D0400080011002B6000F07F +:102E200041FA431C03D12B68002B00D0236070BDF6 +:102E300070690108002370B5064D040008002B607E +:102E400000F040FA431C03D12B68002B00D0236014 +:102E500070BDC04670690108002370B5064D0400BE +:102E600008002B6000F046FA431C03D12B68002BAE +:102E700000D0236070BDC04670690108704770477C +:102E8000C9B28218904201D10020704703788B426A +:102E9000FBD00130F6E7002310B59A4200D110BDF7 +:102EA000CC5CC4540133F8E7062010B500F0B4F947 +:102EB000012000F02DFA000070B50500002910D0A7 +:102EC0000C1F2368002B00DAE4182800FFF7ACFD84 +:102ED0001D4A1368002B05D1636014602800FFF7BA +:102EE000ABFD70BDA34208D9206821188B42F3D1F5 +:102EF00019685B6809182160EEE71A005B68002B0F +:102F000001D0A342F9D911685018A0420BD1206812 +:102F10000918501811608342E0D118685B684118A5 +:102F200011605360DAE7A04202D90C232B60D5E789 +:102F3000206821188B4203D119685B680918216049 +:102F400063605460CAE7C04628680108F7B58B89FA +:102F500005000C001A075CD44A68002A04DC0A6CDD +:102F6000002A01DC0020FEBDE76A002FFAD0002213 +:102F700080202E682A601A004001216A0240034224 +:102F800034D0606DA3895B0706D56368C01A636B94 +:102F9000002B01D0236CC01A020000232800E76A2E +:102FA000216AB847A289431C06D129681D292CD85B +:102FB0002A4B0B41DB0728D400236360236923607D +:102FC000D20405D5431C02D12B68002B00D16065CB +:102FD000616B2E600029C5D023004433994202D092 +:102FE0002800FFF769FF00206063BCE70123280089 +:102FF000B847431CC6D12B68002BC3D01D2B01D072 +:10300000162B01D12E60ADE7A28940231343A38183 +:10301000A9E70E69002EA5D00F680E60BA1B0192B9 +:1030200000229B0700D14A69A260019B002B99DD19 +:10303000A36A32001F002800019B216AB8470028BC +:1030400006DC40230120A28940421343A3818AE782 +:10305000019B36181B1A0193E7E7C046FEFFBFDF4E +:103060000B6970B505000C00002B02D1002528006B +:1030700070BD002804D0036A002B01D1FFF762FD68 +:103080000C22A35E002BF1D0626ED20704D49B0504 +:1030900002D4A06DFFF7F2FE28002100FFF756FFD3 +:1030A000636E0500DB07E2D4A3899B05DFD4A06D26 +:1030B000FFF7E5FEDBE7000070B50C000E25495F69 +:1030C00000F06CF8002803DB636D1B18636570BDAE +:1030D000A389024A1340A381F9E7C046FFEFFFFF2F +:1030E000F8B51F008B8905000C001600DB0505D51F +:1030F0000E23C95E0022022300F03CF8A389054A92 +:1031000028001340A38132000E23E15E3B0000F053 +:10311000A3F8F8BDFFEFFFFF70B50C000E25495F67 +:1031200000F028F8A389421C03D1054A1340A3816B +:1031300070BD802252011343A3816065F8E7C04649 +:10314000FFEFFFFF10B50E23C95E00F001F810BDC0 +:10315000002370B5064D040008002B6000F09AF8BB +:10316000431C03D12B68002B00D0236070BDC046E8 +:103170007069010870B50400080011001A000023EE +:10318000054D2B6000F0AEF8431C03D12B68002BDB +:1031900000D0236070BDC0467069010870B504009E +:1031A000080011001A000023054D2B60F0F7A8FF5E +:1031B000431C03D12B68002B00D0236070BDC04698 +:1031C0007069010870B504000D001F2904D9162389 +:1031D00003600120404270BDC36B002B04D08A0005 +:1031E0009B181A68002A08D1200000F031F82A0044 +:1031F0000100200000F01AF8EDE70020012AEAD0D3 +:10320000511C03D1162301302360E4E70024280079 +:103210001C6090472000DEE710B5034B01001868E2 +:10322000FFF7D0FF10BDC04614030008002370B59F +:10323000064D0400080011002B6000F04BF8431C01 +:1032400003D12B68002B00D0236070BD706901088A +:1032500010B500F02FF810BD70B504000800110083 +:103260001A000023054D2B60F0F730FF431C03D1FB +:103270002B68002B00D0236070BDC0467069010828 +:1032800003B47146490840004900095E49008E4474 +:1032900003BC704758220120014B40421A6070471E +:1032A0007069010858220120014B40421A607047A2 +:1032B0007069010858220120014B40421A60704792 +:1032C000706901085822024B00201A607047C046FE +:1032D0007069010858220120014B40421A60704772 +:1032E0007069010858220120014B40421A60704762 +:1032F00070690108044A03001068002802D0C3184E +:10330000136070470148FAE7746901087869010899 +:10331000FEE7C046F8B5C046F8BC08BC9E467047FC +:10332000F8B5C046F8BC08BC9E46704700000000D7 +:1033300001B40248844601BC604700BF0104000894 +:1033400001B40248844601BC604700BF650500081F +:103350005B494E465D205374617274696E672055F7 +:10336000736572204170706C69636174696F6E205F +:103370002877616974292E2E2E0A0D005B494E466E +:103380005D20537461727420736C6F7420416464A7 +:10339000726573733A2030782530386C780A0D00E6 +:1033A0005B494E465D204C61756E6368696E6720AF +:1033B000617070206F6E20434D3420636F72650A18 +:1033C0000D0000005B494E465D204D4355426F6F36 +:1033D0007420426F6F746C6F616465722066696EF1 +:1033E00069736865642E0D0A4465696E6974696164 +:1033F0006C697A696E672068617264776172652EA4 +:103400002E2E0A0D000000005B4552525D20466CD6 +:1034100061736820646576696365204944206E6F36 +:103420007420666F756E640A0D0000005B45525291 +:103430005D204661696C656420746F207265676900 +:103440007374657220737973706D417070536C651D +:10345000657043616C6C6261636B48616E646C653E +:10346000720A0D005B494E465D201B5B324A1B5BB6 +:103470003B480A0D000000005B494E465D204D436D +:1034800055426F6F7420426F6F746C6F6164657228 +:1034900020537461727465640A0D00005B494E46E6 +:1034A0005D2045787465726E616C204D656D6F723C +:1034B0007920696E697469616C697A656420772F17 +:1034C00020534644502E0A0D000000005B45525226 +:1034D0005D2045787465726E616C204D656D6F720C +:1034E0007920696E697469616C697A6174696F6E5B +:1034F00020772F2053464450204641494C45443ABA +:103500002030782530386C780A0D00005B494E4633 +:103510005D2055736572204170706C6963617469D8 +:103520006F6E2076616C6964617465642073756385 +:103530006365737366756C6C790A0D005B45525256 +:103540005D20426F6F74206F66206E657874206115 +:103550007070206661696C65640A0D005B455252AB +:103560005D204661696C656420746F20696E6974C2 +:10357000205744540A0D00005B4552525D204D43D4 +:1035800055426F6F7420426F6F746C6F6164657227 +:1035900020666F756E64206E6F6E65206F662062A8 +:1035A0006F6F7461626C6520696D616765730A0D88 +:1035B0000000000028696D6167655F6E756D2920E8 +:1035C0003C203078465500002E2E2F2E2E2F6D7465 +:1035D000625F7368617265642F6D6375626F6F748B +:1035E0002F76312E392E312D637970726573732FDA +:1035F000626F6F742F626F6F747574696C2F737262 +:10360000632F626F6F747574696C5F7075626C693B +:10361000632E630028737761705F74797065292069 +:103620003C2030784655000062616400676F6F642B +:1036300000000000756E7365740000007065726DA7 +:103640000000000074657374000000004255473BA1 +:103650002063616E27742068617070656E000000E1 +:1036600072657665727400005B494E465D20536555 +:10367000636F6E6461727920696D616765206F6642 +:1036800020696D6167652070616972202825642E4C +:103690002920697320756E726561636861626C656B +:1036A0002E20547265617420697420617320656DE9 +:1036B0007074790A0D000000626F6F745F73776138 +:1036C000705F747970655F6D756C74693A205072C3 +:1036D000696D61727920696D616765005B494E466D +:1036E0005D2025733A206D616769633D25732C2049 +:1036F000737761705F747970653D307825782C2020 +:10370000636F70795F646F6E653D307825782C202B +:10371000696D6167655F6F6B3D307825780A0D00D4 +:10372000626F6F745F737761705F747970655F6DDE +:10373000756C74693A205365636F6E6461727920A9 +:10374000696D6167650000005B494E465D205377F7 +:10375000617020747970653A2025730A0D000000AD +:103760005B494E465D205377617020747970653AED +:10377000206E6F6E650A0D00626F6F745F777269FD +:1037800074655F737761705F696E666F000000003B +:1037900077C295F360D2EF7F3552500F2CB6798007 +:1037A00004010403040204010401040301030304EB +:1037B00001040000000000006FC75E10DE8EBD2017 +:1037C000B149E330BC1D7B41D3DA25516293C66118 +:1037D0000D549871783BF68217FCA892A6B54BA2BF +:1037E000C97215B2C4268DC3ABE1D3D31AA830E396 +:1037F000756F6EF32A8648CE3D0201002A8648CEB8 +:103800003D03010700000000656C656D5F737A2061 +:10381000213D2030750000002E2E2F2E2E2F6D748E +:10382000625F7368617265642F6D6375626F6F7438 +:103830002F76312E392E312D637970726573732F87 +:10384000626F6F742F626F6F747574696C2F73720F +:10385000632F6C6F616465722E630000616C696731 +:103860006E20213D203075007072696D61727900A3 +:103870007365636F6E646172790000005B4552523C +:103880005D20496D61676520696E2074686520253B +:103890007320736C6F74206973206E6F742076616F +:1038A0006C6964210A0D00007263203D3D203000E8 +:1038B0005B57524E5D2025642073746174757320CC +:1038C0007772697465206661696C732070657266D1 +:1038D0006F726D696E672074686520737761700A16 +:1038E0000D0000005B4552525D2070616E696321DE +:1038F0000A0D0000300000005B57524E5D2046610B +:10390000696C65642072656164696E6720736563C4 +:10391000746F72733B20424F4F545F4D41585F4963 +:103920004D475F534543544F52533D2575202D203D +:10393000746F6F20736D616C6C3F0A0D00000000A6 +:103940005B57524E5D204661696C6564207265610B +:1039500064696E6720696D6167652068656164658B +:1039600072733B20496D6167653D25750A0D000046 +:103970005B4552525D204669726D77617265202BFE +:1039800020746C767320696E20736C6F74202575BB +:10399000206F7665726C6170732077697468206C33 +:1039A00061737420736563746F722C207768696328 +:1039B0006820636F6E7461696E7320747261696CE4 +:1039C00065722C2065726173696E67207468697313 +:1039D00020696D6167650A0D000000005B57524E5B +:1039E0005D204661696C65642072656164696E671B +:1039F00020626F6F74207374617475733B20496D1E +:103A00006167653D25750A0D000000005B494E4663 +:103A10005D20496D6167652075706772616465201E +:103A20007365636F6E6461727920736C6F74202D9F +:103A30003E207072696D61727920736C6F740A0D2B +:103A4000000000005B494E465D2045726173696E5F +:103A50006720746865207072696D61727920736C7B +:103A60006F740A0D000000005B494E465D20436FF5 +:103A70007079696E6720746865207365636F6E6422 +:103A800061727920736C6F7420746F207468652084 +:103A90007072696D61727920736C6F743A2030783E +:103AA000256C782062797465730A0D002E745C3A77 +:103AB000122E9F9F626F6F745F636F70795F696D85 +:103AC00061676500626F6F745F706572666F726DBB +:103AD0005F75706461746500626F6F745F737761A6 +:103AE000705F696D61676500626F6F745F636F6DB2 +:103AF000706C6574655F7061727469616C5F737717 +:103B000061700000626F6F745F77726974655F73D4 +:103B10007A000000626F6F745F7072657061726529 +:103B20005F696D6167655F666F725F757064617410 +:103B300065000000636F6E746578745F626F6F7408 +:103B40005F676F5F666C6173680000002E2E2F2E1A +:103B50002E2F6D74625F7368617265642F6D63757B +:103B6000626F6F742F76312E392E312D637970721A +:103B70006573732F626F6F742F626F6F74757469E2 +:103B80006C2F7372632F737761705F7363726174EC +:103B900063682E63000000005B57524E5D20557035 +:103BA00067726164652064697361626C6564206634 +:103BB0006F7220696D6167652025750A0D00000030 +:103BC0005B57524E5D2043616E6E6F742075706757 +:103BD000726164653A206D6F726520736563746FFE +:103BE0007273207468616E20616C6C6F7765640A13 +:103BF0000D0000005B57524E5D2043616E6E6F7486 +:103C000020757067726164653A20736C6F747320FD +:103C100068617665206E6F6E2D636F6D706174697B +:103C2000626C6520736563746F72730A0D00000027 +:103C30005B57524E5D2043616E6E6F7420757067E6 +:103C4000726164653A206E6F7420616C6C207365DC +:103C500063746F72732066697420696E736964653A +:103C600020736372617463680A0D00005B57524EE3 +:103C70005D2043616E6E6F7420757067726164655C +:103C80003A20736C6F747320617265206E6F7420BC +:103C9000636F6D70617469626C650A0D00000000ED +:103CA00073637261746368006E6F6E65000000007C +:103CB0007072696D61727920736C6F74000000001E +:103CC0005072696D61727920696D616765000000ED +:103CD00053637261746368005B494E465D20426FB6 +:103CE0006F7420736F757263653A2025730A0D0037 +:103CF0005B494E465D20426F6F7420736F7572632F +:103D0000653A206E6F6E650A0D0000005B494E46F5 +:103D10005D205374617274696E67207377617020DF +:103D20007573696E67207363726174636820616C78 +:103D3000676F726974686D2E0A0D0000626F6F7490 +:103D40005F737761705F736563746F7273000000F7 +:103D5000737761705F7374617475735F736F75727D +:103D6000636500000105010001050302040104016F +:103D7000030403025B4552525D204465746563741D +:103D8000656420696E636F6E73697374656E742009 +:103D9000737461747573210A0D0000005B45525203 +:103DA0005D20747261696C657220636F7079206642 +:103DB00061696C65640A0D005B494E465D20457281 +:103DC0006173696E6720747261696C65723B20660D +:103DD000615F69643D25750A0D00000030203D3D9E +:103DE000207263002E2E2F2E2E2F6D74625F73684B +:103DF000617265642F6D6375626F6F742F76312EFB +:103E0000392E312D637970726573732F626F6F7401 +:103E10002F626F6F747574696C2F7372632F737771 +:103E200061705F7374617475735F6D6973632E6322 +:103E300000000000737761705F7374617475735F65 +:103E4000696E697400000000EFBEADDE0100000085 +:103E5000583E0110B43E01103059301306072A862F +:103E600048CE3D020106082A8648CE3D03010703DD +:103E7000420004FF36BA0D0127531A8E9B4BCAF439 +:103E8000F82FB7D18706D162D57215ACFBDF439C02 +:103E9000EAF7499A1A96FEBFA4234856BC05BF729A +:103EA000A426C9AC6546CD366C5E30FAFE2257C6F4 +:103EB00018F834005B00000008000000010000005A +:103EC000000000000000000000000000AA420010F6 +:103ED0004E4200105642001056420010664200103A +:103EE000664200108242001082420010F44100102D +:103EF000FE43001068430010704300107C43001024 +:103F00008E430010A2430010BC430010DA4300109F +:103F100022430010010000000E000000110000000C +:103F20000000000000000000000000000000000091 +:103F30000100000000000000000000000000000080 +:103F40000000000000000000010000000E00000062 +:103F50001100000000000000000000000000000050 +:103F60000000000001000000000000000000000050 +:103F70000000000000000000000000000100000040 +:103F80000E00000011000000000000000000000012 +:103F90000000000000000000010000000000000020 +:103FA0000000000000000000000000000000000011 +:103FB000010000000E0000001100000000000000E1 +:103FC00000000000000000000000000001000000F0 +:103FD00000000000000000000000000000000000E1 +:103FE00000000000010000000600000011000000B9 +:103FF00000000000000000000000000000000000C1 +:1040000001000000000000000000000000000000AF +:10401000000000000000000000000000010000009F +:104020000100000000000000000000008005314099 +:104030000200000011000000800531400100000076 +:104040001100000080053140000000001100000058 +:10405000000631400400000011000000A1470010DC +:10406000A547001031480010EB470010A74700108B +:104070009D470010974700107D47001066616C73E4 +:10408000650000002E2E2F2E2E2F6D74625F736838 +:10409000617265642F6D6375626F6F742F76312E58 +:1040A000392E312D637970726573732F626F6F745F +:1040B0002F637970726573732F706C6174666F72A1 +:1040C0006D732F6D656D6F72792F50534F43362F7F +:1040D000666C6173685F6D61705F6261636B656E72 +:1040E000645F706C6174666F726D2E680000000012 +:1040F000666C6173685F617265615F6765745F615B +:1041000070690000C14D0010C54D00108F4E0010A9 +:10411000434E0010CF4D0010BD4D0010C74D001094 +:10412000AD4D0010010000000800000064430110C4 +:10413000010000000800000084430110010000009D +:1041400001000000E001000801000000080000007C +:104150002445011001000000080000004445011042 +:10416000010000000000000000000000010000004D +:104170000800000064450110010000000800000074 +:104180008445011001000000000000000000000054 +:104190000100000008000000A4450110010000001B +:1041A00008000000C44501100100000000000000EC +:1041B000000000000100000008000000E4450110BC +:1041C000010000000800000004460110010000008A +:1041D00000000000000000000100000008000000D6 +:1041E00024460110010000000800000044460110B0 +:1041F00001000000000000000000000001000000BD +:1042000008000000644601100100000008000000E2 +:1042100084460110010000000000000000000000C2 +:104220000100000008000000A44601100100000089 +:1042300008000000C446011001000000000000005A +:10424000000000000100000008000000E44601102A +:1042500001000000080000000447011001000000F8 +:104260000000000000000000010000000800000045 +:10427000244701100100000008000000444701101D +:10428000010000000000000000000000010000002C +:1042900008000000A4430110010000000800000015 +:1042A000C4430110010000000000000000000000F5 +:1042B0000100000008000000E443011001000000BC +:1042C000080000000444011001000000000000008C +:1042D000000000000100000008000000244401105C +:1042E000010000000800000044440110010000002B +:1042F00000000000000000000100000008000000B5 +:104300006444011001000000080000008444011012 +:10431000010000000000000000000000010000009B +:1043200008000000A4440110010000000800000083 +:10433000C444011001000000000000000000000063 +:104340000100000008000000E4440110010000002A +:1043500008000000044501100100000000000000FA +:1043600000000000211D5C11D68032342211C2569B +:10437000D3C1034AB99013327FBFB46BBD0C0EB7E3 +:1043800000000000347E00859981D5446447075AB7 +:10439000A07543CDE6DF224CFB23F7B5886337BD1C +:1043A00000000000635FA86C468343FAFAA99311EA +:1043B000B6075774772A9D03897ED73C7B8C62CFE2 +:1043C00000000000442C1359CCFA849E51B948BC1B +:1043D00057C7B37CFC0A38242E3A2825BC0A43B8B8 +:1043E000000000005925ABC1EE703CE1F3DB451D38 +:1043F0004A807535E81F4D2D9A05F4CB6B10F05AA5 +:10440000000000003595E1DC1586C37BECDC27D18C +:1044100056A1140D590BD6774E44A2F89442711F41 +:10442000000000003086B2B0C82F7BFE96EFCBDBD9 +:10443000BC9E3BC51B0386DD5BF58D46589579D642 +:1044400000000000843214DA9B4F0739B53EFB06AA +:10445000EEA74040761FDF7161FD8BBE808BAB8B7A +:1044600000000000C934B3B4BC9FB05EE65848A851 +:1044700077BB132F41C6F734CC89210ACA33DD1F1D +:1044800000000000CC81EFA4F2100BCD83F76E7218 +:104490004ADFDDE867230A53031662D20B76FD3C40 +:1044A00000000000CB14A1FAA018BE07032AE1D730 +:1044B000B06CA0DED1C0B0C66324CD4E33382CB171 +:1044C00000000000EECD7D200CFEACC309979FA23A +:1044D000B645F77BCA99F3D22002EB0443185B7B05 +:1044E000000000002BDD779160EAFDD37DD3B5D6C7 +:1044F00090170E1A00F428C1F253F6634958DC6194 +:1045000000000000A82001FBF1BD5F45D07F06DA66 +:1045100011CBBAA6A74100A41B303379F4FF27CAF8 +:1045200000000000E0F9B8D03DD2D3FA1EFD992674 +:1045300019FE136E1C0E4C487CA217013DA31357A5 +:10454000000000009F165C8FAAED0F58BFC54334D2 +:1045500093052A4CE4E36CCAC614C225D3436CD736 +:1045600000000000C35A981EC8A542A39849567877 +:10457000F8EFED651BBB64B64C545FD12F0C33CC08 +:1045800000000000FA79CB2E08FFD8E62E1FD4D702 +:1045900057E93945D8D63B0A1C87B76AEB30D805AE +:1045A00000000000AD79749AE6BBC2C2B45BA66796 +:1045B000C191E764F0DF3882192C4CCAD12E39C57D +:1045C000000000009936784EAE5B027614F68BF848 +:1045D000F4926B42BA4D7135E70C2C989BA51FAE37 +:1045E00000000000AF1C4BDF5BF251B70574B15AFD +:1045F000C60F0E61E8240962AFFCDB4543E180553C +:10460000000000003C82FEADC3E5CFD824A26217B3 +:1046100076F05AFA3EB8E5ACB76638AA97FD86053B +:104620000000000059D30C3CD166B0F1BC59B48DE8 +:104630009010B7A296479BE6558AE4EEB149DB7825 +:10464000000000004197EDDEFFB3DF4810B983B7EB +:10465000EBBE408DAFD3D3CD0E82793D9B831BF053 +:10466000000000003F22BB54D33156FC8036E5E009 +:1046700089968E71E1EF0AEDD0114AFF1500572798 +:104680000000000013CA3DF7649B6E8590E3706BD9 +:1046900041D7ED8F02444480CE13379294738079D2 +:1046A00000000000B74D707D310F1C586D358847F4 +:1046B000C424783FBAF0CD9181B3DEB604CEC6F7FC +:1046C00000000000E99C2DE8D2008F10D55E7C0E22 +:1046D0000C6E5802AE8121CE43F4243D9EBCF0F412 +:1046E00000000000D610C2744A8F8ACF8967F42B6D +:1046F000382B3517F5E70CA9FA775CBDE033192B99 +:1047000000000000E73E962253E1E9BEE013BCA1A1 +:1047100016EC011A9A00C97AC373A545E1F45EC18B +:1047200000000000A895D6D932302BD07742090579 +:10473000612A7E827384A205886465F9032D90B393 +:10474000000000000AE72E8555807C790FC1AC7807 +:10475000B4AFFB6ED3C3288E79181F583446CF49A7 +:1047600000000000B4FF552343390B27BAD8BFD748 +:10477000B7B04450563241F5ABB3040C850A05B4CA +:10478000211D5C11D68032342211C256D3C1034A96 +:10479000B99013327FBFB46BBD0C0EB7347E008569 +:1047A0009981D5446447075AA07543CDE6DF224C72 +:1047B000FB23F7B5886337BD3D2A5C5C4529DD13D3 +:1047C0003EF0B8E0A216FFFFFFFFFFFFFFFFFFFF75 +:1047D000FFFFFFFF010000000000000000000000DC +:1047E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD9 +:1047F000000000000100000008000000344A011021 +:104800000100000008000000544A011001000000EF +:1048100001000000E00100080100000008000000A5 +:10482000F44B01100100000008000000144C0110BE +:104830000100000000000000000000000100000076 +:1048400008000000344C01100100000008000000C6 +:10485000544C0110010000000000000000000000A6 +:104860000100000008000000744C0110010000006D +:1048700008000000944C011001000000000000003E +:10488000000000000100000008000000B44C01100E +:104890000100000008000000D44C011001000000DD +:1048A00000000000000000000100000008000000FF +:1048B000F44C01100100000008000000144D01102C +:1048C00001000000000000000000000001000000E6 +:1048D00008000000344D0110010000000800000035 +:1048E000544D011001000000000000000000000015 +:1048F0000100000008000000744D011001000000DC +:1049000008000000944D01100100000000000000AC +:10491000000000000100000008000000B44D01107C +:104920000100000008000000D44D0110010000004B +:10493000000000000000000001000000080000006E +:10494000F44D01100100000008000000144E011099 +:104950000100000000000000000000000100000055 +:1049600008000000744A0110010000000800000067 +:10497000944A011001000000000000000000000047 +:104980000100000008000000B44A0110010000000E +:1049900008000000D44A01100100000000000000DF +:1049A000000000000100000008000000F44A0110AF +:1049B0000100000008000000144B0110010000007D +:1049C00000000000000000000100000008000000DE +:1049D000344B01100100000008000000544B01108E +:1049E00001000000000000000000000001000000C5 +:1049F00008000000744B01100100000008000000D6 +:104A0000944B0110010000000000000000000000B5 +:104A10000100000008000000B44B0110010000007C +:104A200008000000D44B011001000000000000004D +:104A30000000000096C298D84539A1F4A033EB2DB0 +:104A4000817D0377F240A463E5E6BCF847422CE1A0 +:104A5000F2D1176BF551BF376840B6CBCE5E316BE4 +:104A60005733CE2B169E0F7C4AEBE78E9B7F1AFEA8 +:104A7000E242E34FC9D23AE803C56D5DBE35D0AE20 +:104A80001D7A9FCA331ED2CBAC882755F0B99CE063 +:104A900031DD998661F99B3296415838F95A2AB826 +:104AA000960EB24CC1782CC708991924B75928E939 +:104AB0008454E616DD3830DB702C0AA27C5C9DE95C +:104AC000D5460B5F830B604B377DB9C95E24F33D40 +:104AD000797F6C187FE51C4F6024F72AEDD8E291AE +:104AE0007F89499297A72E8D6AB339811389B59A28 +:104AF000B88D429C8D45E64B3F4F1E1F47655E5962 +:104B000022CC725FF1931A271E34C55B63F2A5585D +:104B10005C152EC6F47FBA585A846F5FADA6367EF8 +:104B2000DCF7E167044DAAEE57763AD34E7E26189D +:104B300022239FFF1D4C64C755023FE3D80290BB60 +:104B4000C3EC30409F6F64F4166948A4FA449C9506 +:104B50000C7D675E44918BD8D0D7E7E21FF948629D +:104B60006FA8935DEA3A9902D50B3DE31ED300315D +:104B7000E60C9F4456B2AAFD8815DF524C3527310A +:104B800044CDC06853F891A57194842A92CBD093F8 +:104B9000E988DAE424C639165DA31E6DBA07372604 +:104BA000362AFE6051BCF3D0DE50FC97802E0610F2 +:104BB000154DFAF72765695B66A2752E9C16005A9B +:104BC000B030251A42FB864280C1C4765B1D838EBD +:104BD00094015F82393770EF1FA1F0DB6A105BCE62 +:104BE000C49B6F10501111244F4C7961173A72BC5D +:104BF000FE72584370C8BA04B74BD2F7ABC6233A1B +:104C0000A0093A591D9D4CF95823CCDF02ED7B29B0 +:104C1000870FFA3C4069F2400BA398CEAFA8480238 +:104C20000D1C12629BAF098380AA58A7C612BE70E2 +:104C30009476E3E47D7DEF86FFE337DDDB868B084A +:104C4000277CD7F691544C254F9AFE285EFDF06DD7 +:104C5000370369D696D5DAAD9249F09FF973439E32 +:104C6000AFA7D1F3674107DF78953EA1223DD1E69A +:104C70003CA5E220BF6A5D5235D7BFAE5AA2BE96B0 +:104C8000F4F802C3A4204954EAB382DB2EDBEA0223 +:104C9000D1751C62F085F49E4CDC3989636DC45774 +:104CA000D8035D22707F2D526FC9DA4F9D64FAB42C +:104CB000FEA4C4D72A37B9C0AA59C68B3F58D9ED2C +:104CC000589965F7887D268C4AF9059F9D739AC986 +:104CD000E746DC00F2D055DF000AF54A6ABF56818C +:104CE0002D20EBB511C12852ABE3D14024347945D6 +:104CF00057A51203EECFB87EF792968D3D018C0D2D +:104D000023F2E305592EE384527A3476E5A1B015F7 +:104D100090E2533CD498E7FAA57D8B539135D200AD +:104D2000D11B9F1B3F69089A72F0A911B3FE0E14A4 +:104D3000DA7C0ED383F6E8F887F7FC6D90BE7F3FF0 +:104D40007A2BD713CF32F22D946D42FDAD9AE35FEB +:104D500042BB84EDFC952973A1673E02E3305435D4 +:104D60008E0ADD6703D7A197613BF80CF2333C58FC +:104D7000553423A3995D165F7BBCBBCE61EE4E8A92 +:104D8000C151CC501F0D4D1B53231DB3DA2A386679 +:104D90005284E1955B9B830A814FADAC0FFF42418A +:104DA0006EA9A2A02FA14F1F8982AA3EF3B80F6B54 +:104DB0008F8CD668F1B3BB5169A21193654F0F8DEB +:104DC000BD260FE8B9CBEC6B34C33D9DE45D1E10EE +:104DD000D544E254289EB1F16E4CADB3B7E3C2584E +:104DE000C0FB3443259CDF350741BD19B66E10EC7E +:104DF0000EECBBD6C8CFEF3F831A88E80B29B5B9B4 +:104E0000E0C9A3AE88461E77CD7EB310B621D0D4BC +:104E1000A31608EEA1CAA8B3BF29998ED1F205C185 +:104E2000CF5D91489F0149DB82DF5F3AE10690AD9B +:104E3000E338A4C44B60D2273E3CCE3BF6B053CC03 +:104E4000B0061D65BC86987655BDEBB3E7933AAACC +:104E5000D835C65A96C298D84539A1F4A033EB2D5F +:104E6000817D0377F240A463E5E6BCF847422CE17C +:104E7000F2D1176BF551BF376840B6CBCE5E316BC0 +:104E80005733CE2B169E0F7C4AEBE78E9B7F1AFE84 +:104E9000E242E34F512563FCC2CAB9F3849E17A7CF +:104EA000ADFAE6BCFFFFFFFFFFFFFFFF00000000C1 +:104EB000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF02 +:104EC00000000000000000000000000001000000E1 +:104ED000FFFFFFFF982F8A4291443771CFFBC0B587 +:104EE000A5DBB5E95BC25639F111F159A4823F92B5 +:104EF000D55E1CAB98AA07D8015B8312BE8531240E +:104F0000C37D0C55745DBE72FEB1DE80A706DC9BCE +:104F100074F19BC1C1699BE48647BEEFC69DC10F7A +:104F2000CCA10C246F2CE92DAA84744ADCA9B05CB6 +:104F3000DA88F97652513E986DC631A8C82703B079 +:104F4000C77F59BFF30BE0C64791A7D55163CA0687 +:104F500067292914850AB72738211B2EFC6D2C4D93 +:104F6000130D385354730A65BB0A6A762EC9C28181 +:104F7000852C7292A1E8BFA24B661AA8708B4BC217 +:104F8000A3516CC719E892D1240699D685350EF441 +:104F900070A06A1016C1A419086C371E4C774827F8 +:104FA000B5BCB034B30C1C394AAAD84E4FCA9C5B6E +:104FB000F36F2E68EE828F746F63A5781478C884BF +:104FC0000802C78CFAFFBE90EB6C50A4F7A3F9BEA1 +:104FD000F27871C60000051207000B1201001312CF +:104FE0000900171202001B1205002B120A002F12D3 +:104FF000030033120600371204003B120400431270 +:105000000B00471202004B120100531205005B1205 +:105010000600631206006B120C006F1200000412EF +:1050200007000A12010012120900161202001A12D9 +:1050300005002A120A002E12030032120600361250 +:1050400004003A12040042120B00461202004A12F7 +:105050000100521205005A120600621206006A127E +:105060000C006E120000021207000812010010125C +:10507000090014120200181207002012050028125D +:105080000A002C12030030120600341204003812F9 +:10509000040040120B00441202004812010050129A +:1050A0000500581206006012060068120C006C120F +:1050B0000000031207000912010011120900151265 +:1050C0000200191207002112050029120A002D12F0 +:1050D0000300311206003512040039120400411297 +:1050E0000B0045120200491201005112050059122D +:1050F00006006112060069120C006D120505060615 +:105100000606000000000000000085858585858575 +:105110008585808080808080808080808080820102 +:1051200001010101010101818181818181818181EF +:105130008181818181838384848484840809070434 +:105140000405050202020202020202020202020237 +:10515000020303030303030303030303030303869D +:105160008686868686868600000000000000000095 +:10517000000001010101010101000000000C0D0E01 +:105180000F10111213292A2B2C2D2E2F30B393D34D +:10519000B494D4B595D5B696D6BB9BDBBC9CDCBD90 +:1051A0009DDDBE9EDEBF9FDFC0A0E0C1A1E1C2A227 +:1051B000E2C3A3E3C4A4E4C5A5E5C6A6E608090ABC +:1051C0000B4E4F505152535455565758595A5B062F +:1051D00007464700847785788679877A887B897C3B +:1051E0008A7D8B7E8C7F8D808E818F829083000064 +:1051F0004D00000092910000030105040200000030 +:10520000F3F4F5F6F7F8F9FA1415161718191A1B2E +:10521000000C0D0E0F10111213292A2B2C2D2E2FDE +:1052200030B797D7B898D8B999D9BA9ADAC7A7E753 +:10523000C8A8E8C9A9E9CAAAEACBABEBCCACECCDCB +:10524000ADEDCEAEEECFAFEFD0B0F0D1B1F1D2B286 +:10525000F208090A0B4A5C5D5E5F60616263646527 +:10526000666768694B4C0000000C0D0E0F101112A0 +:1052700013B393D3B494D4B595D5B696D6B797D780 +:10528000B898D8B999D9BA9ADABB9BDBBC9CDCBD7B +:105290009DDDBE9EDEBF9FDFC0A0E0C1A1E1C2A236 +:1052A000E208090A0B6A84776B85786C86796D87CA +:1052B0007A6E887B6F897C708A7D718B7E728C7F21 +:1052C000738D80748E81758F827690839291F3F4C2 +:1052D000F5F6F7F8F9FA03010504024D494E4F506F +:1052E0005152535455565758595A5B06074B4C0068 +:1052F00000292A2B2C2D2E2F30B393D3B494D4B560 +:1053000095D5B696D6B797D7B898D8B999D9BA9A45 +:10531000DABB9BDBBC9CDCBD9DDDBE9EDEBF9FDFA0 +:10532000C0A0E0C1A1E1C2A2E208090A0B6A847729 +:105330006B85786C86796D877A6E887B6F897C70D7 +:105340008A7D718B7E728C7F738D80748E81758F58 +:10535000827690839291F3F4F5F6F7F8F9FA030167 +:105360000504024D495C5D5E5F6061626364656671 +:1053700067686946474B4C00000C0D0E0F10111268 +:10538000131415161718191A1B1C1D1E1F20212275 +:10539000232425262728292A2B2C2D2E2F30313265 +:1053A000333435363738393A3B3C3D3E3F40414255 +:1053B000434445B393D3B494D4B595D5B696D6B7F4 +:1053C00097D7B898D8B999D9BA9ADABB9BDBBC9C65 +:1053D000DCBD9DDDBE9EDEBF9FDFC0A0E0C1A1E1C0 +:1053E000C2A2E2C3A3E3C4A4E4C5A5E5C6A6E6C77A +:1053F000A7E7C8A8E8C9A9E9CAAAEACBABEBCCAC35 +:10540000ECCDADEDCEAEEECFAFEFD0B0F0D1B1F18F +:10541000D2B2F208090A0B6A84776B85786C8679B8 +:105420006D877A6E887B6F897C708A7D718B7E72C6 +:105430008C7F738D80748E81758F8276908392912C +:10544000F3F4F5F6F7F8F9FA030105040249484ABE +:105450004D464706074B4C00000C0D0E0F10111265 +:10546000131415161718191A1B1C1D1E1F20212294 +:10547000232425262728292A2B2C2D2E2F30313284 +:10548000333435363738393A3B3C3D3E3F40414274 +:10549000434445B393D3B494D4B595D5B696D6B713 +:1054A00097D7B898D8B999D9BA9ADABB9BDBBC9C84 +:1054B000DCBD9DDDBE9EDEBF9FDFC0A0E0C1A1E1DF +:1054C000C2A2E2C3A3E3C4A4E4C5A5E5C6A6E6C799 +:1054D000A7E7C8A8E8C9A9E9CAAAEACBABEBCCAC54 +:1054E000ECCDADEDCEAEEECFAFEFD0B0F0D1B1F1AF +:1054F000D2B2F208090A0B6A84776B85786C8679D8 +:105500006D877A6E887B6F897C708A7D718B7E72E5 +:105510008C7F738D80748E81758F8276908392914B +:10552000F3F4F5F6F7F8F9FA030105040249484ADD +:105530004D4E4F505152535455565758595A5B5C23 +:105540005D5E5F60616263646566676869464706C1 +:10555000074B4C0000BB9BDBBC9CDCBD9DDDBE9EB5 +:10556000DEBF9FDFC0A0E0C1A1E1C2A2E292910034 +:105570000006070000B393D3B494D4B595D5B6967E +:10558000D6B797D7B898D8B999D9BA9ADABB9BDB6E +:10559000BC9CDCBD9DDDBE9EDEBF9FDFC0A0E0C128 +:1055A000A1E1C2A2E2C3A3E3C4A4E4C5A5E5C6A6E3 +:1055B000E6C7A7E7C8A8E8C9A9E9CAAAEACBABEB3E +:1055C000CCACECCDADEDCEAEEECFAFEFD0B0F0D1F8 +:1055D000B1F1D2B2F24E4F50515253545556575822 +:1055E000595A5B5C5D5E5F606162636465666768B3 +:1055F000694B4C0000B393D3B494D4B595D5B6960B +:10560000D6B797D7B898D8B999D9BA9ADABB9BDBED +:10561000BC9CDCBD9DDDBE9EDEBF9FDFC0A0E0C1A7 +:10562000A1E1C2A2E2C3A3E3C4A4E4C5A5E5C6A662 +:10563000E6C7A7E7C8A8E8C9A9E9CAAAEACBABEBBD +:10564000CCACECCDADEDCEAEEECFAFEFD0B0F0D177 +:10565000B1F1D2B2F24E4F505152535455565758A1 +:10566000595A5B5C5D5E5F60616263646566676832 +:10567000694B4C0000010001020300010203040514 +:1056800006070001020304050607000102030405E2 +:10569000060708090A0B00000102030405060700BB +:1056A0000102030405060708090A0B0C0D0001009E +:1056B00001020304000000000102030001020304D0 +:1056C00005060708090A0B0C0D0001020304050674 +:1056D0000708090A0B0C0D00010203040506070068 +:1056E0005700560087008700DF00FB001B00030007 +:1056F0007F007F000C000E00010002000500080082 +:105700000800000012000000745701101201000090 +:1057100074570110120200007457011012030000A8 +:105720007457011012040000745701101205000094 +:1057300074570110050E0000050D00050D01050D43 +:1057400002050D03050D04050D050000050F0005FC +:105750000F01000000000000000000000000000039 +:105760000000000000000000000000000000000039 +:1057700000000000679F0010519F0010ED9D001079 +:10578000D19D0010C59E0010DD9D0010419E0010AF +:1057900015000000DCA6001010A7001016A70010CE +:1057A00010A7001010A70010E0A60010F8A6001027 +:1057B00010A7001000A7001010A7001010A70010DD +:1057C00010A7001010A7001010A7001004A70010C9 +:1057D00010A7001008A7001010A7001010A70010B5 +:1057E00010A7001010A7001010A7001010A700109D +:1057F0000CA70010FCA600101AA7001048A7001064 +:105800004EA7001048A7001048A700101AA70010C4 +:105810003CA7001048A7001040A7001048A70010A0 +:1058200048A7001048A7001048A7001048A700107C +:105830001AA7001048A700101AA7001048A70010C8 +:1058400048A7001048A7001048A7001048A700105C +:1058500048A7001044A700101AA70010000000007D +:105860000000080018001C001D001E001F00200082 +:105870002100220023002400250026002C002D00FA +:105880002F00300031003700380039003A003B006B +:105890003C003D000000000000001D00000008006A +:1058A0001000180020002800300038004000480098 +:1058B0005000580060006800700078000000000090 +:1058C00000000000000008000000000000000100CF +:1058D00001000100010001003F00400040004400C1 +:1058E0007E007E00F600F800F800F800F900F900EC +:1058F000FB00FD00FD00FF00000101010E01100191 +:105900001001300130013001F2AC001006AD001082 +:1059100006AD001006AD001006AD001006AD00107B +:1059200006AD001006AD001006AD001006AD00106B +:1059300006AD001006AD001006AD001006AD00105B +:1059400006AD001006AD001006AD001006AD00104B +:1059500006AD001006AD001006AD0010D2AC001070 +:105960000CAD0010D6AC0010DEAC0010E2AC0010A4 +:10597000E6AC0010EAAC0010EEAC0010F6AC001083 +:10598000FAAC0010FEAC001002AD0010FF1F0000CA +:105990000000604000006140000062400000634081 +:1059A0000000644000006540000066400000674061 +:1059B000000068400000694000006A4000006B4041 +:1059C00000006C40000102030405060708090A0BE9 +:1059D0000C0000002700280029002A002B002C00C2 +:1059E0002D002E0012002F00300031003200000088 +:1059F0000000000000000000000000005C650108DD +:105A000000000000000000000A000000000000008C +:105A10000C00000008000000000200000000000070 +:105A20000000000000000000000000000000000076 +:105A300014000000000000000B0000000000000047 +:105A4000000000003F0000000000000004BF001044 +:105A500020BF001008BF00100CBF00101CBF0010BA +:105A60001CBF00101CBF00101CBF00101CBF00108A +:105A70001CBF00101CBF00101CBF00101CBF00107A +:105A800014BF00101CBF001010BF00101CBF00107E +:105A90001CBF001018BF0010A0BF0010AEBF001048 +:105AA000AEBF0010AEBF0010AEBF0010AEBF001002 +:105AB000AEBF001050BF0010AEBF0010AEBF001050 +:105AC000AEBF0010AEBF0010AEBF0010AEBF0010E2 +:105AD000AEBF001050BF00106ABF0010AEBF001074 +:105AE000AEBF001082BF0010AEBF0010AEBF0010EE +:105AF000AEBF0010AEBF001076BF00100001020361 +:105B0000A00F0000B90B0000D0070000DD05000069 +:105B1000E8030000EF020000F4010000780100003B +:105B2000FA000000BC0000007D0000005E000000E4 +:105B30003F0000002F0000002000000018000000BF +:105B4000100000000C00000008000000060000002B +:105B5000040000000300000002000000020000003A +:105B6000010000000100000000002040000024406F +:105B70000000004000000000000023400000304012 +:105B80000000314000009F40000022400000104013 +:105B900000009D402020202020101010101D1D808E +:105BA00017007500FF0306020600360410200000EF +:105BB0007FC0000000040000000000000019324B0C +:105BC000647D0000000000804000080B1000000011 +:105BD0000000FF012002001F00800004FF081018D1 +:105BE000001000140018001C4044484C50000000F5 +:105BF000081000000800000004000000041000006D +:105C00000012000004210000002100000016000026 +:105C100040114002C41300138013A01340138813D3 +:105C2000A81320001C00000052D70010F6D6001068 +:105C3000FED60010FED600100ED700100ED70010B2 +:105C40002AD700102AD700109CD60010A6D8001022 +:105C500010D8001018D8001024D8001036D8001022 +:105C60004AD8001064D8001082D80010CAD700109B +:105C70007EE700108EE70010A0E70010B2E70010EA +:105C80008EE700108EE70010C4E700100EEB001046 +:105C90002EEB001024EB00101AEB001010EB00109C +:105CA00006EB0010030000000100000001000000EE +:105CB0000000000005036000040000000100000077 +:105CC0000000000001000000060460000800000061 +:105CD00000680108E5180110050000000500070034 +:105CE00005010F000B0701000B0702000B0707005F +:105CF0000B0801000B0802000B0100000B08030059 +:105D00000B0804000B0805000B0806000B08070031 +:105D1000010000000B0000001D000000000000005A +:105D20000000000000000000000000000100000072 +:105D30000000000000000000000000000000000063 +:105D4000000000000B060700010000000A00000030 +:105D50001D00000000000000000000000000000026 +:105D60000000000001000000000000000000000032 +:105D70000000000000000000000000000B0606000C +:105D800001000000060000001D00000000000000EF +:105D90000000000000000000000000000100000002 +:105DA00000000000000000000000000000000000F3 +:105DB000000000000B0604000B0000000B000100B7 +:105DC00001000000030000000000000000000018B7 +:105DD0000000000400000000B45E0110600000003C +:105DE00000000000FFFFFFFF0000000000000000B7 +:105DF00000000000DC00000000000000FFFFFFFFCB +:105E0000000000000000000000000000340000005E +:105E100000000000FFFFFFFF020000000000000084 +:105E200002000000EC000000000200000100000081 +:105E30000200000004000000020000003500000025 +:105E400000000000FFFFFFFF000000000000000056 +:105E5000000000000500000000000000FFFFFFFF41 +:105E6000000000000000000000000000040000002E +:105E700000000000FFFFFFFF000000000000000026 +:105E8000000000000600000000000000FFFFFFFF10 +:105E90000000000000000000000000000100000001 +:105EA00000000000FFFFFFFF0000000000000000F6 +:105EB000000000000400000000000004245E011047 +:105EC000845E01106C5E0110F45D0110000004009E +:105ED000DC5D01100C5E011000020000545E011038 +:105EE0003C5E01109C5E01100000000001000000FB +:105EF00002000000280A0000E0040700140500006A +:105F00000000000000000000000000000000000091 +:105F1000000000000000000001000000285F0110E8 +:105F20000200000046000000C05D0110F401000006 +:105F3000140004010A0009050800030063010000C1 +:105F4000040000000401000004020000040300003B +:105F500004040000040500001E010500002C20665A +:105F6000756E6374696F6E3A200061737365727445 +:105F7000696F6E2022257322206661696C65643A20 +:105F80002066696C6520222573222C206C696E6561 +:105F9000202564257325730A00232D302B200068EB +:105FA0006C4C006566674546470030313233343506 +:105FB0003637383941424344454600303132333474 +:105FC0003536373839616263646566000000000069 +:085FD00014C1FF7F0100000075 +:105FD800000000100000000880000000F85F0110B9 +:085FE800800000080006000023 +:085FF0002407000854620100BF +:105FF8009DD40010010000000000000040070008C8 +:10600800000000000000000000000000B4000008CC +:10601800C0000008CC000008D8000008E400000810 +:1060280000000000007F0000000000000080020067 +:10603800017F00000080020000001C0002800000B8 +:106048000002000000001C00077F000000801E0006 +:10605800006C0000038000000000440000000800FD +:10606800000000001CA379B7010000000600000032 +:106078001100000000000000000000000000000007 +:106088000000000001000000000000000000000007 +:1060980000000000000000000000000004000000F4 +:1060A80000000000E86201084C630108346301083D +:1060B800B862010800000000A0620108D06201086F +:1060C8000000000000630108186301086463010808 +:1060D800B0010008000000000000000000000000FF +:1060E80000000000000000000000000000000000A8 +:1060F8000000000000000000000000000000000098 +:106108000100000006000000000000000000001868 +:1061180000000008000000002C01000890010008A1 +:106128005A00000000000000FFFFFFFF0000000011 +:10613800080000000000000001000000AC01000899 +:1061480000000000000000000700A000010000009F +:1061580001000000012E01107C51011010520110A5 +:1061680068520110F0520110785301105854011070 +:10617800545501107055011074550110F455011053 +:10618800D4510110E0510110F0510110F4510110E7 +:10619800F851011000520110085201103457011033 +:1061A8004C5701104F570110385701103B57011039 +:1061B8003E5701104157011044570110475701102D +:1061C80009A300100E1400000000000000000000E9 +:1061D800C5A500100E14000000000000000000001B +:1061E80029AC00103E000000000000000000000084 +:1061F800890700008907000000093D0000093D00EB +:1062080000127A0000093D00A00F00000400000001 +:10621800650201100100000000000000206801086C +:106228000000000000000000FF0000000000000067 +:106238000300000030680108000000003068010811 +:1062480098680108006901080000000000000000CB +:106258000000000000000000000000000000000036 +:106268000000000000000000000000000000000026 +:106278000000000000000000000000000000000016 +:1062880000000000C8020008F5000010C900001056 +:1062980010B50004440B002827D0144B1A68136A61 +:1062A800BA21515ACA00521A9B181B68002BF4DAFB +:1062B8000F4B3E221A600F4B0F4A1A600F4BA32256 +:1062C800D200062199500E4A9C509B58074B1A68D9 +:1062D800136AB431515ACA00521A9B1800225A60E4 +:1062E800064A074BD358002BFADA10BD0C66010892 +:1062F80004012640080126401E1F00000000264019 +:106308001C05000010B54378FF2B00D010BD00F02D +:1063180047F9124B1A683323D35C032B00D801BE0C +:106328000E4B1A68136ABA21515A4A0052189B1820 +:10633800DA680B4B1A600B4B002119600A4B0131CC +:1063480019605268094B1A6013680B43136013688D +:10635800DB07FCD400F044F9D8E7C0460C66010816 +:106368003066010824660108286601082C660108C1 +:10637800F0B583B0009001914D4B1A683323D35C7C +:10638800002B00D101BE4A4B1B681F6ABC229C58D7 +:10639800E4196C3A9B5C002B68D000F0F1F8060019 +:1063A80003280ED000F0FCF80500424A424BD358AF +:1063B800002B3CDB414C032E51D0280000F010F993 +:1063C8006CE03B4B1A683323D35C062B00D801BE24 +:1063D800374B19680A6ABA23C85A43001B185B006E +:1063E800D218BC23CB589B181B68002B5BDB002002 +:1063F80000F0EEF8324B984257D0324B1A6800231F +:106408000021012000F0B4F8051E02D02B4C45E015 +:106418000135002000F0DCF8294B984202D02A4BC5 +:106428009D42F5D9284B9D42BCD9244C36E0274AD9 +:106438000121380000F0C4F8002801D01F4CBAE749 +:106448000198FFF725FF009B002B06D02368002B3F +:10645800FCDB00F09DF80400ADE71D4CABE7012123 +:10646800002000F0A5F80028F9D1A6E700F098F878 +:106478000600164A0121380000F0A2F8002809D1C8 +:10648800009B002B0DD02368002BFCDB00F080F86C +:10649800040000E0094C300000F0A2F8200003B02E +:1064A800F0BD0B4CF7E7054CF8E7044CF6E7C0469F +:1064B8000C660108000026401C050000050052007B +:1064C8000101880020660108EF49020010660108F2 +:1064D80001005000F0B5C64600B51C4B1B68596852 +:1064E8001B4A136904242343136101282CD030BFAD +:1064F80086235B00CB58002B23D1164C2768164BFC +:10650800A320C0001E58154A90461568144A2260F8 +:1065180006241C503E2042461060124A063098500D +:106528000D4A104BD358002BFADA86235B000E4A2B +:10653800CA50084B1F60084AA323DB00D650074BFC +:106548001D6080BCB846F0BD20BFD1E70C660108CD +:1065580000ED00E008012640000026400401264026 +:106568001E1F00001C050000AAAAAAAA000000001D +:1065780001B40248844601BC604700BF91C90010BD +:1065880001B40248844601BC604700BF211A0110CB +:1065980001B40248844601BC604700BFA9C200108C +:1065A80001B40248844601BC604700BF0B050010D7 +:1065B80001B40248844601BC604700BF21CC0010EA +:1065C80001B40248844601BC604700BFF1C700100F +:1065D80001B40248844601BC604700BFA9CC001042 +:1065E80001B40248844601BC604700BF130500108F +:1065F8000000000000000000000000000000000093 +:0866080000000000000000008A +:020000041600E4 +:08080000185F01100000000068 +:107C0000FC01000020122101000000000008001605 +:107C10000000001000000000000000000000000054 +:107C20000000000000000000000000000000000054 +:107C30000000000000000000000000000000000044 +:107C40000000000000000000000000000000000034 +:107C50000000000000000000000000000000000024 +:107C60000000000000000000000000000000000014 +:107C70000000000000000000000000000000000004 +:107C800000000000000000000000000000000000F4 +:107C900000000000000000000000000000000000E4 +:107CA00000000000000000000000000000000000D4 +:107CB00000000000000000000000000000000000C4 +:107CC00000000000000000000000000000000000B4 +:107CD00000000000000000000000000000000000A4 +:107CE0000000000000000000000000000000000094 +:107CF0000000000000000000000000000000000084 +:107D00000000000000000000000000000000000073 +:107D10000000000000000000000000000000000063 +:107D20000000000000000000000000000000000053 +:107D30000000000000000000000000000000000043 +:107D40000000000000000000000000000000000033 +:107D50000000000000000000000000000000000023 +:107D60000000000000000000000000000000000013 +:107D70000000000000000000000000000000000003 +:107D800000000000000000000000000000000000F3 +:107D900000000000000000000000000000000000E3 +:107DA00000000000000000000000000000000000D3 +:107DB00000000000000000000000000000000000C3 +:107DC00000000000000000000000000000000000B3 +:107DD00000000000000000000000000000000000A3 +:107DE0000000000000000000000000000000000093 +:107DF0000000000000000000C20200000000B33BD1 +:040000051000051BC7 +:00000001FF diff --git a/third_party/infineon/psoc6/psoc6_sdk/ota/ota_base_build.sh b/third_party/infineon/psoc6/psoc6_sdk/ota/ota_base_build.sh index ef6bf3bc30ad95..da17582944adc7 100755 --- a/third_party/infineon/psoc6/psoc6_sdk/ota/ota_base_build.sh +++ b/third_party/infineon/psoc6/psoc6_sdk/ota/ota_base_build.sh @@ -1,7 +1,22 @@ -OUT_DIR=$1 -HEX_NAME=$2 -ANYCLOUD_DIR=third_party/infineon/psoc6/psoc6_sdk/libs/anycloud-ota/ +#!/bin/bash -mv "$OUT_DIR"/"$HEX_NAME".hex "$OUT_DIR"/"$HEX_NAME".unsigned.hex +SCRIPT_ROOT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/" && pwd)" +# Windows: convert /cygdrive/d/git to D:/git +if [[ ${OS:-} == Windows_NT ]]; then + SCRIPT_ROOT_DIR="$(cygpath --mixed "$SCRIPT_ROOT_PATH")" +else + SCRIPT_ROOT_DIR="$SCRIPT_ROOT_PATH" +fi -./"$ANYCLOUD_DIR"/scripts/sign_script.bash "$OUT_DIR"/ "$HEX_NAME" python3 arm-none-eabi-objcopy "-O ihex" "" "$ANYCLOUD_DIR"/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/scripts/ imgtool_v1.7.0/imgtool.py create 0xFF 0x400 3584 1.0.0 0x00018000 0x001C0000 arm-none-eabi-objcopy "" +APP=${1:-"psoc6-lock"} # {psoc6-lock, psoc6-light, psoc6-all-clusters} +HEX_NAME=${2:-"chip-psoc6-lock-example"} # {chip-psoc6-lock-example, chip-psoc6-lighting-example, chip-psoc6-clusters-example} + +LIBS_DIR="$SCRIPT_ROOT_DIR/../libs" +MATTER_SCRIPTS_DIR="$SCRIPT_ROOT_DIR/../../../../../scripts" +OUT_DIR="$SCRIPT_ROOT_DIR/../../../../../out/infineon-$APP-ota" + +source "$MATTER_SCRIPTS_DIR/activate.sh" + +arm-none-eabi-objcopy -I ihex -O elf32-little "$OUT_DIR/$HEX_NAME".hex "$OUT_DIR/$HEX_NAME".elf +chmod +x "$OUT_DIR/$HEX_NAME".elf +"$LIBS_DIR"/ota-bootloader-abstraction/scripts/mcuboot/sign_script.bash "$OUT_DIR" "$HEX_NAME" python3 arm-none-eabi-objcopy "-O ihex" "elf_first" "$LIBS_DIR"/ota-bootloader-abstraction/makefiles/mcuboot/../../scripts/mcuboot/imgtool imgtool.py create 0xFF 0x400 3584 1.0.0 0x028000 0x1c0000 arm-none-eabi-objcopy "-k $LIBS_DIR/ota-bootloader-abstraction/scripts/mcuboot/keys/cypress-test-ec-p256.pem" diff --git a/third_party/infineon/psoc6/psoc6_sdk/ota/ota_update_build.sh b/third_party/infineon/psoc6/psoc6_sdk/ota/ota_update_build.sh index 4f1c67797967bb..c6d46fd5c2ad3e 100755 --- a/third_party/infineon/psoc6/psoc6_sdk/ota/ota_update_build.sh +++ b/third_party/infineon/psoc6/psoc6_sdk/ota/ota_update_build.sh @@ -1,13 +1,30 @@ -OUT_DIR=$1 -HEX_NAME=$2 -ANYCLOUD_DIR=third_party/infineon/psoc6/psoc6_sdk/libs/anycloud-ota/ +#!/bin/bash -mv "$OUT_DIR"/"$HEX_NAME".hex "$OUT_DIR"/"$HEX_NAME".unsigned.hex +SCRIPT_ROOT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/" && pwd)" +# Windows: convert /cygdrive/d/git to D:/git +if [[ ${OS:-} == Windows_NT ]]; then + SCRIPT_ROOT_DIR="$(cygpath --mixed "$SCRIPT_ROOT_PATH")" +else + SCRIPT_ROOT_DIR="$SCRIPT_ROOT_PATH" +fi + +APP=${1:-"psoc6-lock"} # {psoc6-lock, psoc6-light, psoc6-all-clusters} +HEX_NAME=${2:-"chip-psoc6-lock-example"} # {chip-psoc6-lock-example, chip-psoc6-lighting-example, chip-psoc6-clusters-example} + +LIBS_DIR="$SCRIPT_ROOT_DIR/../libs" +ROOT_DIR="$SCRIPT_ROOT_DIR/../../../../../" +OUT_DIR="$ROOT_DIR/out/infineon-$APP-ota-updateimage" + +source "$ROOT_DIR/scripts/activate.sh" + +arm-none-eabi-objcopy -I ihex -O elf32-little "$OUT_DIR/$HEX_NAME".hex "$OUT_DIR/$HEX_NAME".elf + +chmod +x "$OUT_DIR/$HEX_NAME".elf -./"$ANYCLOUD_DIR"/scripts/sign_script.bash "$OUT_DIR"/ "$HEX_NAME" python3 arm-none-eabi-objcopy "-O ihex" "" "$ANYCLOUD_DIR"/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/scripts/ imgtool_v1.7.0/imgtool.py sign 0xFF 0x400 3584 1.0.0 0x00018000 0x001C0000 arm-none-eabi-objcopy "-k $ANYCLOUD_DIR/source/COMPONENT_OTA_MCUBOOT_PSOC/mcuboot/keys/cypress-test-ec-p256.pem" +"$LIBS_DIR"/ota-bootloader-abstraction/scripts/mcuboot/sign_script.bash "$OUT_DIR" "$HEX_NAME" python3 arm-none-eabi-objcopy "-O ihex" "elf_first" "$LIBS_DIR"/ota-bootloader-abstraction/makefiles/mcuboot/../../scripts/mcuboot/imgtool imgtool.py sign 0xFF 0x400 3584 1.0.0 0x028000 0x1c0000 arm-none-eabi-objcopy "-k $LIBS_DIR/ota-bootloader-abstraction/scripts/mcuboot/keys/cypress-test-ec-p256.pem" if [ -f "$OUT_DIR"/"$HEX_NAME".ota ]; then rm "$OUT_DIR"/"$HEX_NAME".ota fi -src/app/ota_image_tool.py create -v 0xFFF1 -p 0x8000 -vn 2 -vs "2.0" -da sha256 "$OUT_DIR"/"$HEX_NAME".bin "$OUT_DIR"/"$HEX_NAME".ota +python3 "$ROOT_DIR"/src/app/ota_image_tool.py create -v 0xFFF1 -p 0x8000 -vn 2 -vs "2.0" -da sha256 "$OUT_DIR"/"$HEX_NAME".bin "$OUT_DIR"/"$HEX_NAME".ota diff --git a/third_party/nlunit-test/repo b/third_party/nlunit-test/repo deleted file mode 160000 index 0c8c9073af9c07..00000000000000 --- a/third_party/nlunit-test/repo +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0c8c9073af9c07aa089861295b7d7ced56ad174d diff --git a/third_party/nxp/k32w0_sdk/BUILD.gn b/third_party/nxp/k32w0_sdk/BUILD.gn deleted file mode 100644 index 6052497bd43145..00000000000000 --- a/third_party/nxp/k32w0_sdk/BUILD.gn +++ /dev/null @@ -1,104 +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. - -import("//build_overrides/chip.gni") -import("//build_overrides/chip.gni") -import("//build_overrides/mbedtls.gni") -import("//build_overrides/nxp_sdk.gni") - -import("${mbedtls_root}/mbedtls.gni") -import("${nxp_sdk_build_root}/nxp_sdk.gni") - -import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") - -declare_args() { - # Build target to use for k32w0 SDK. Use this to set global SDK defines. - k32w0_sdk_target = "" -} - -assert(k32w0_sdk_target != "", "k32w0_sdk_target must be specified") - -group("nxp_sdk") { - public_deps = [ k32w0_sdk_target ] -} - -config("mbedtls_k32w0_config") { - defines = [ - "MBEDTLS_CONFIG_FILE=", - "MBEDTLS_USER_CONFIG_FILE=", - - # These options should really be in the config.h... - "MBEDTLS_FREESCALE_FREERTOS_CALLOC_ALT=1", - "MBEDTLS_THREADING_C=1", - "MBEDTLS_THREADING_ALT=1", - "MBEDTLS_X509_CSR_WRITE_C", - "MBEDTLS_X509_CREATE_C", - "MBEDTLS_PEM_WRITE_C", - "MBEDTLS_HKDF_C", - "MBEDTLS_PKCS5_C", - ] - - if (chip_mdns == "none") { - defines += [ - "MBEDTLS_PK_WRITE_C", - "MBEDTLS_OID_C", - "MBEDTLS_BASE64_C", - ] - } - - if (chip_with_factory_data == 1) { - defines += [ - "MBEDTLS_X509_CRT_PARSE_C", - "MBEDTLS_X509_USE_C", - ] - } - - if (chip_crypto == "platform" && chip_crypto_flavor == "tinycrypt") { - defines += [ - "MBEDTLS_USE_TINYCRYPT", - "MBEDTLS_OPTIMIZE_TINYCRYPT_ASM", - ] - } - - include_dirs = [ chip_root ] - - if (chip_crypto == "platform" && chip_crypto_flavor == "tinycrypt") { - include_dirs += [ - "${chip_root}/third_party/openthread/ot-nxp/third_party/tinycrypt/inc", - ] - } -} - -mbedtls_target("mbedtls") { - sources = [ - "${k32w0_sdk_root}/middleware/mbedtls/port/ksdk/aes_alt.c", - "${k32w0_sdk_root}/middleware/mbedtls/port/matter/ksdk_mbedtls.c", - ] - - if (chip_crypto == "platform" && chip_crypto_flavor == "tinycrypt") { - sources += [ - "${chip_root}/third_party/openthread/ot-nxp/third_party/tinycrypt/src/ecc.c", - "${chip_root}/third_party/openthread/ot-nxp/third_party/tinycrypt/src/ecc_dh.c", - "${chip_root}/third_party/openthread/ot-nxp/third_party/tinycrypt/src/ecc_dsa.c", - "${chip_root}/third_party/openthread/ot-nxp/third_party/tinycrypt/src/tinycrypt_util.c", - ] - } - - public_configs = [ ":mbedtls_k32w0_config" ] - - public_deps = [ - ":nxp_sdk", - "${chip_root}/third_party/openthread/platforms/nxp/k32w/k32w0:openthread_mbedtls_config_k32w0", - ] -} diff --git a/third_party/nxp/k32w0_sdk/k32w0_sdk.gni b/third_party/nxp/k32w0_sdk/k32w0_sdk.gni deleted file mode 100644 index 509a4584316a9f..00000000000000 --- a/third_party/nxp/k32w0_sdk/k32w0_sdk.gni +++ /dev/null @@ -1,744 +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. - -import("//build_overrides/build.gni") -import("//build_overrides/chip.gni") -import("//build_overrides/mbedtls.gni") -import("//build_overrides/nxp_sdk.gni") -import("//build_overrides/openthread.gni") - -import("${build_root}/config/compiler/compiler.gni") -import("${chip_root}/src/crypto/crypto.gni") -import("${chip_root}/src/lib/core/core.gni") -import("${chip_root}/src/platform/device.gni") -import("${chip_root}/src/platform/nxp/${nxp_platform}/args.gni") - -declare_args() { - # Location of the k32w0 SDK. - k32w0_sdk_root = getenv("NXP_K32W0_SDK_ROOT") - chip_with_DK6 = true - chip_with_OM15082 = 0 - chip_with_ot_cli = 0 - chip_with_low_power = 0 - build_for_k32w061 = 1 - build_for_k32w041am = 0 - build_for_k32w041a = 0 - build_for_k32w041 = 0 - device = "K32W061" - board = "k32w061dk6" - chip_with_ntag = 1 - chip_with_high_power = 0 - use_fro_32k = 0 - use_custom_factory_provider = 0 - chip_crypto_flavor = "NXP-Ultrafast-P256" - chip_reduce_ssbl_size = false - chip_enable_ota_firmware_processor = 1 - chip_enable_ota_factory_data_processor = 0 - chip_with_pdm_encryption = 1 - ota_custom_entry_address = "0x000C1000" - use_antenna_diversity = 0 - - chip_with_ota_encryption = 0 - chip_with_ota_key = "1234567890ABCDEFA1B2C3D4E5F6F1B4" - chip_with_sdk_package = 1 -} - -assert(k32w0_sdk_root != "", "k32w0_sdk_root must be specified") - -if (chip_crypto == "platform") { - assert(chip_crypto_flavor == "tinycrypt" || - chip_crypto_flavor == "NXP-Ultrafast-P256", - "choose tinycrypt or NXP-Ultrafast-P256 as crypto platform") -} - -# Defines an k32w SDK build target. -# -# Parameters: -# k32w0_sdk_root - The location of the k32w SDK. -# sources - Extra source files to build. -template("k32w0_sdk") { - if (defined(invoker.k32w0_sdk_root)) { - k32w0_sdk_root = invoker.k32w0_sdk_root - } - - if (defined(invoker.override_is_DK6)) { - chip_with_DK6 = invoker.override_is_DK6 - } - - assert(k32w0_sdk_root != "", "k32w0_sdk_root must be specified") - assert(chip_with_OM15082 == 0 || chip_with_DK6, - "OM15082 expansion board is only supported on DK6 board") - assert( - chip_with_low_power == 0 || - (chip_with_low_power == 1 && chip_with_OM15082 == 0 && - chip_with_ot_cli == 0 && chip_with_se05x == 0), - "Please disable low power if expansion board, openthread CLI or SE is needed!") - - assert( - use_custom_factory_provider == 0 || chip_with_factory_data == 1, - "Please set chip_with_factory_data=1 if using custom factory provider.") - - assert( - chip_enable_ota_factory_data_processor == 0 || - chip_enable_ota_firmware_processor == 1, - "Please set chip_enable_ota_firmware_processor=1 if using default factory data processor.") - - assert( - chip_enable_ota_factory_data_processor == 0 || - chip_with_factory_data == 1, - "Please set chip_with_factory_data=1 if using default factory data processor.") - - assert( - chip_enable_ota_factory_data_processor == 0 || - chip_enable_ota_firmware_processor == 1, - "Please set chip_enable_ota_firmware_processor=1 if using default factory data processor.") - - assert( - chip_enable_ota_factory_data_processor == 0 || - chip_with_factory_data == 1, - "Please set chip_with_factory_data=1 if using default factory data processor.") - - if (build_for_k32w041am == 1 || build_for_k32w041a == 1 || - build_for_k32w041 == 1) { - build_for_k32w061 = 0 - } - - if (build_for_k32w061 == 1) { - assert(build_for_k32w061 == 1 && build_for_k32w041am == 0 && - build_for_k32w041a == 0 && build_for_k32w041 == 0, - "Please build for only one platform") - device = "K32W061" - board = "k32w061dk6" - chip_with_ntag = 0 - } - if (build_for_k32w041am == 1) { - assert(build_for_k32w041am == 1 && build_for_k32w061 == 0 && - build_for_k32w041a == 0 && build_for_k32w041 == 0, - "Please build for only one platform") - device = "K32W041AM" - board = "k32w041amdk6" - chip_with_ntag = 0 - } - if (build_for_k32w041a == 1) { - assert(build_for_k32w041a == 1 && build_for_k32w061 == 0 && - build_for_k32w041am == 0 && build_for_k32w041 == 0, - "Please build for only one platform") - device = "K32W041A" - board = "k32w041adk6" - chip_with_ntag = 0 - } - if (build_for_k32w041 == 1) { - assert(build_for_k32w041 == 1 && build_for_k32w061 == 0 && - build_for_k32w041am == 0 && build_for_k32w041a == 0, - "Please build for only one platform") - device = "K32W041" - board = "k32w041dk6" - chip_with_ntag = 0 - } - - if (k32w0_sdk_root == "${chip_root}/third_party/nxp/k32w0_sdk/repo/core" || - k32w0_sdk_root == "/opt/sdk/core") { - chip_with_sdk_package = 0 - } else { - chip_with_sdk_package = 1 - } - print("device:", device) - print("board:", board) - print("ntag:", chip_with_ntag) - print("increased TX power:", chip_with_high_power) - print("FRO32k: ", use_fro_32k) - print("low power: ", chip_with_low_power) - print("OTA default firmware processor: ", chip_enable_ota_firmware_processor) - print("OTA default factory data processor: ", - chip_enable_ota_factory_data_processor) - print("PDM Encryption: ", chip_with_pdm_encryption) - print("Antenna Diversity enabled: ", use_antenna_diversity) - - if (chip_with_low_power == 1 && chip_logging == true) { - print( - "WARNING: enabling logs in low power might break the LP timings. Use at your own risk!") - print("WARNING: set chip_logging=false to disable logging.") - } - - if (chip_crypto == "platform") { - print("ECC crypto lib: ", chip_crypto_flavor) - } - - print("chip_with_sdk_package:", chip_with_sdk_package) - device_lowercase = string_replace(board, "dk6", "") - - sdk_target_name = target_name - - config("${sdk_target_name}_config") { - include_dirs = [] - if (defined(invoker.include_dirs)) { - include_dirs += invoker.include_dirs - } - - # We want to treat SDK headers as system headers, so that warnings in those - # headers are not fatal. Therefore don't add them directly to include_dirs; - # we will add them to cflags below instead. - _sdk_include_dirs = [] - - # Directories specified with -isystem options are scanned in left-to-right order. - # sha256_alt.h is present in both these paths, but the one from port/matter will - # be selected, which is intended. Both paths are needed, because some header - # files are not overwritten (e.g. aes_alt.h). - _sdk_include_dirs += [ - "${k32w0_sdk_root}/middleware/mbedtls/port/matter", - "${k32w0_sdk_root}/middleware/mbedtls/port/ksdk", - ] - - if (chip_with_DK6) { - if (chip_with_low_power != 0) { - _sdk_include_dirs += [ "${k32w0_sdk_root}/boards/${board}/wireless_examples/openthread/lped/bm" ] - } else { - _sdk_include_dirs += [ "${k32w0_sdk_root}/boards/${board}/wireless_examples/openthread/reed/bm" ] - } - } - - if (chip_with_low_power != 0) { - _sdk_include_dirs += [ "${k32w0_sdk_root}/boards/${board}/wireless_examples/hybrid/ble_ot/lped_ble_wuart/ble_802_15_4_common" ] - } - - if (chip_with_ntag != 0) { - _sdk_include_dirs += [ - "${k32w0_sdk_root}/middleware/ntag_i2c_plus/HAL_I2C/inc", - "${k32w0_sdk_root}/middleware/ntag_i2c_plus/HAL_NTAG/inc", - "${k32w0_sdk_root}/middleware/ntag_i2c_plus/inc", - "${k32w0_sdk_root}/middleware/ntag_i2c_plus/HAL_TMR/inc", - ] - } - - _sdk_include_dirs += [ - "${chip_root}/src/platform/nxp/k32w/k32w0", - "${k32w0_sdk_root}/CMSIS/Include", - "${k32w0_sdk_root}/components/serial_manager", - "${k32w0_sdk_root}/components/uart", - "${k32w0_sdk_root}/devices/${device}", - - "${k32w0_sdk_root}/utilities/debug_console/str", - "${k32w0_sdk_root}/utilities/debug_console", - "${k32w0_sdk_root}/devices/${device}/utilities", - "${k32w0_sdk_root}/devices/${device}/utilities/debug_console", - "${k32w0_sdk_root}/devices/${device}/utilities/str", - "${k32w0_sdk_root}/middleware/wireless/ble_controller/interface", - "${k32w0_sdk_root}/middleware/wireless/bluetooth/application/common", - "${k32w0_sdk_root}/middleware/wireless/bluetooth/application/common/gatt_db", - "${k32w0_sdk_root}/middleware/wireless/bluetooth/application/common/gatt_db/macros", - "${k32w0_sdk_root}/middleware/wireless/bluetooth/host/config", - "${k32w0_sdk_root}/middleware/wireless/bluetooth/host/interface", - "${k32w0_sdk_root}/middleware/wireless/framework/Common", - "${k32w0_sdk_root}/middleware/wireless/framework/Flash/External/Interface", - "${k32w0_sdk_root}/middleware/wireless/framework/Flash/Internal", - "${k32w0_sdk_root}/middleware/wireless/framework/FunctionLib", - "${k32w0_sdk_root}/middleware/wireless/framework/GPIO", - "${k32w0_sdk_root}/middleware/wireless/framework/Logging/Interface", - "${k32w0_sdk_root}/middleware/wireless/framework/Keyboard/Interface", - "${k32w0_sdk_root}/middleware/wireless/framework/LED/Interface", - "${k32w0_sdk_root}/middleware/wireless/framework/Lists", - "${k32w0_sdk_root}/middleware/wireless/framework/LowPower/Interface/${board}", - "${k32w0_sdk_root}/middleware/wireless/framework/MemManager/Interface", - "${k32w0_sdk_root}/middleware/wireless/framework/Messaging/Interface", - "${k32w0_sdk_root}/middleware/wireless/framework/ModuleInfo", - "${k32w0_sdk_root}/middleware/wireless/framework/OSAbstraction/Interface", - "${k32w0_sdk_root}/middleware/wireless/framework/OtaSupport/Interface/", - "${k32w0_sdk_root}/middleware/wireless/framework/Panic/Interface", - "${k32w0_sdk_root}/middleware/wireless/framework/PDM/Include", - "${k32w0_sdk_root}/middleware/wireless/framework/RNG/Interface", - "${k32w0_sdk_root}/middleware/wireless/framework/SecLib", - "${k32w0_sdk_root}/middleware/wireless/framework/SerialManager/Interface", - "${k32w0_sdk_root}/middleware/wireless/framework/SerialManager/Source", - "${k32w0_sdk_root}/middleware/wireless/framework/TimersManager/Interface", - "${k32w0_sdk_root}/middleware/wireless/framework/TimersManager/Source", - "${k32w0_sdk_root}/middleware/wireless/framework/XCVR/DK6", - "${k32w0_sdk_root}/middleware/wireless/framework/XCVR/DK6/Build/Include", - "${k32w0_sdk_root}/middleware/wireless/ieee-802.15.4/MacDynamic/Include", - "${k32w0_sdk_root}/middleware/wireless/ieee-802.15.4/uMac/Include", - "${k32w0_sdk_root}/rtos/amazon-freertos/lib/FreeRTOS/portable/GCC/ARM_CM3", - "${k32w0_sdk_root}/rtos/amazon-freertos/lib/include", - "${k32w0_sdk_root}/rtos/amazon-freertos/lib/include/private", - "${k32w0_sdk_root}/rtos/amazon-freertos/lib/third_party/unity/src", - ] - if (chip_with_sdk_package == 1) { - _sdk_include_dirs += [ "${k32w0_sdk_root}/devices/${device}/drivers" ] - } else { - _sdk_include_dirs += [ - "${k32w0_sdk_root}/devices/K32W061/drivers", - "${k32w0_sdk_root}/drivers/common", - "${k32w0_sdk_root}/drivers/lpc_gpio", - "${k32w0_sdk_root}/drivers/aes", - "${k32w0_sdk_root}/drivers/jn_iocon", - "${k32w0_sdk_root}/drivers/lpc_adc", - "${k32w0_sdk_root}/drivers/aes", - "${k32w0_sdk_root}/drivers/jn_flash", - "${k32w0_sdk_root}/drivers/sha", - "${k32w0_sdk_root}/drivers/flexcomm", - "${k32w0_sdk_root}/drivers/lpc_dma", - "${k32w0_sdk_root}/drivers/pint", - "${k32w0_sdk_root}/drivers/inputmux", - "${k32w0_sdk_root}/drivers/spifi", - "${k32w0_sdk_root}/drivers/jn_rtc", - "${k32w0_sdk_root}/drivers/fmeas", - "${k32w0_sdk_root}/drivers/jn_rng", - "${k32w0_sdk_root}/drivers/ctimer", - "${k32w0_sdk_root}/drivers/wwdt", - "${k32w0_sdk_root}/drivers/gint", - ] - } - - libs = [ - "${k32w0_sdk_root}/middleware/wireless/ble_controller/lib/lib_ble_controller_peripheral_commissioning.a", - "${k32w0_sdk_root}//middleware/wireless/bluetooth/host/lib/lib_ble_5-0_host_matter_cm4_noFP.a", - "${k32w0_sdk_root}/middleware/wireless/ieee-802.15.4/lib/libMiniMac_Sched.a", - "${k32w0_sdk_root}/middleware/wireless/framework/PDM/Library/libPDM_extFlash.a", - "${k32w0_sdk_root}/middleware/wireless/framework/XCVR/lib/libRadio.a", - "${k32w0_sdk_root}/middleware/wireless/framework/SecLib/lib_crypto_m4.a", - ] - - defines = [ - "gMainThreadPriority_c=5", - "CPU_JN518X", - "CPU_JN518X_REV=2", - "JENNIC_CHIP_FAMILY_NAME=_JN518x", - "MAC_PROTO_TAG=1", - "JENNIC_CHIP_FAMILY_JN518x", - "gPWR_LDOMEM_0_9V_PD=0", - "SDK_DEBUGCONSOLE=DEBUGCONSOLE_REDIRECT_TO_SDK", - "PRINTF_ADVANCED_ENABLE", - "NO_SYSCORECLK_UPD=0", - "USE_RTOS=1", - "USE_SDK_OSA=0", - "gSerialManagerMaxInterfaces_c=2", - "FSL_RTOS_FREE_RTOS=1", - "gTotalHeapSize_c=0xF000", - "DEBUG_SERIAL_INTERFACE_INSTANCE=0", - "APP_SERIAL_INTERFACE_INSTANCE=1", - "gOTA_externalFlash_d=1", - "gEepromPostedOperations_d=1", - "gOtaEepromPostedOperations_d=1", - "gOtaVerifyWrite_d=0", - "gExternalFlashIsCiphered_d=1", - "PDM_USE_DYNAMIC_MEMORY=1", - "PDM_SAVE_IDLE=1", - "gBootData_None_c=1", - "PROGRAM_PAGE_SZ=256", - "configFRTOS_MEMORY_SCHEME=4", - "osCustomStartup=1", - "ENABLE_RAM_VECTOR_TABLE=1", - "gTMR_Enabled_d=1", - "gTimestamp_Enabled_d=0", - "CHIP_ENABLE_OPENTHREAD=1", - "gOtaMemPoolId_c=1", - "PoolsDetails_c=_block_size_ 32 _number_of_blocks_ 6 _pool_id_(0) _eol_ _block_size_ 256 _number_of_blocks_ 3 _pool_id_(0) _eol_ _block_size_ 512 _number_of_blocks_ 2 _pool_id_(0) _eol_ _block_size_ 768 _number_of_blocks_ 1 _pool_id_(0) _eol_ _block_size_ 268 _number_of_blocks_ 8 _pool_id_(gOtaMemPoolId_c) _eol_", - "SUPPORT_FOR_15_4=1", - "gAppMaxConnections_c=1", - "gAppUseBonding_d=0", - "gAppUsePairing_d=0", - "gAppUsePrivacy_d=0", - "gController_ReducedRxThoughput=1", - "gPasskeyValue_c=999999", - "gSupportBle=1", - "SUPPORT_FOR_BLE=1", - "gEnableBleInactivityTimeNotify=1", - "gConnPhyUpdateReqTxPhySettings_c=(gLePhy2MFlag_c)", - "gConnPhyUpdateReqRxPhySettings_c=(gLePhy2MFlag_c)", - "gConnPhyUpdateReqPhyOptions_c=(gLeCodingNoPreference_c)", - "BLE_HIGH_TX_POWER=0", - "gAdvertisingPowerLeveldBm_c=0", - "gConnectPowerLeveldBm_c=0", - "DUAL_MODE_APP=1", - "gMainThreadStackSize_c=5096", - "HEAP_SIZE=gTotalHeapSize_c", - "gLoggingActive_d=0", - "gLogRingPlacementOffset_c=0xF000", - "gSecLibUseSha256Alt_d=1", - "gOTA_UseSecLibAes=1", - "gResetSystemReset_d=1", - - # TODO: move these platform specific defines to args.gni - "NXP_OT_IDLE_INTERVAL=${nxp_ot_idle_interval_ms}", - "NXP_OT_ACTIVE_INTERVAL=${nxp_ot_active_interval_ms}", - "NXP_ICD_ENABLED=1", - "NXP_ACTIVE_MODE_THRESHOLD=${nxp_active_mode_threshold_ms}", - "NXP_ACTIVE_MODE_DURATION_MS=${nxp_active_mode_duration_ms}", - "NXP_IDLE_MODE_DURATION_SEC=${nxp_idle_mode_duration_s}", - "NXP_ICD_SUPPORTED_CLIENTS_PER_FABRIC=${nxp_icd_supported_clients_per_fabric}", - ] - - if (use_antenna_diversity == 1) { - print("Check ADO/ADE pin configuration when using Antenna Diversity.") - defines += [ "ANTENNA_DIVERSITY_ENABLE" ] - } - - # If OTA default processors are enabled, then OTA custom entry structure - # will be saved in external flash: gOTACustomOtaEntryMemory=OTACustomStorage_ExtFlash (1) - if (chip_enable_ota_firmware_processor == 1) { - defines += [ - "gOTAAllowCustomStartAddress=1", - "gOTAUseCustomOtaEntry=1", - "gOTACustomOtaEntryMemory=1", - "OTA_ENTRY_TOP_ADDR=${ota_custom_entry_address}", - ] - - if (chip_enable_ota_factory_data_processor == 1) { - defines += [ "CONFIG_CHIP_K32W0_OTA_FACTORY_DATA_PROCESSOR=1" ] - } - } - - if (chip_crypto == "platform" && - chip_crypto_flavor == "NXP-Ultrafast-P256") { - defines += [ "EC_P256_DSPEXT=1" ] - } - - if (use_fro_32k == 1) { - defines += [ - "gClkUseFro32K=1", - "gPWR_CpuClk_48MHz=0", - ] - } else { - defines += [ - "gClkUseFro32K=0", - "gPWR_CpuClk_48MHz=1", - ] - } - - if (chip_with_pdm_encryption == 1) { - defines += [ "PDM_ENCRYPTION=1" ] - } else { - defines += [ "PDM_ENCRYPTION=0" ] - } - - if (chip_with_pdm_encryption == 1) { - defines += [ "PDM_ENCRYPTION=1" ] - } else { - defines += [ "PDM_ENCRYPTION=0" ] - } - - if (chip_with_ota_encryption == 1) { - defines += [ - "OTA_ENCRYPTION_ENABLE=1", - "OTA_ENCRYPTION_KEY=\"${chip_with_ota_key}\"", - ] - } else { - defines += [ "OTA_ENCRYPTION_ENABLE=0" ] - } - - if (chip_mdns == "platform") { - defines += [ - "OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE=1", - "OPENTHREAD_CONFIG_ECDSA_ENABLE=1", - "OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE=1", - "OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1", - ] - } - - if (chip_with_se05x == 1) { - defines += [ - "MBEDTLS_FREESCALE_FREERTOS_CALLOC_ALT=1", - "CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE=9216", - ] - } - - if (chip_with_DK6) { - defines += [ - "gUsePdm_d=1", - "PDM_EXT_FLASH=1", - "gEepromType_d=gEepromDevice_MX25R8035F_c", - "gPdmNbSegments=63", - "gRadioUsePdm_d=1", - ] - - if (chip_with_OM15082 != 0) { - defines += [ - "OM15082=1", - "gKeyBoardSupported_d=1", - "gKBD_KeysCount_c=4", - ] - } else { - defines += [ - "gKeyBoardSupported_d=1", - "gKBD_KeysCount_c=2", - ] - } - - if (chip_with_low_power == 0) { - defines += [ - "gLEDSupported_d=1", - "gLEDsOnTargetBoardCnt_c=2", - "gLED_InvertedMode_d=1", - ] - } - } - - if (chip_with_ot_cli == 1) { - defines += [ "CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI=1" ] - } - - if (chip_with_low_power == 1) { - defines += [ - "chip_with_low_power=1", - "cPWR_UsePowerDownMode=1", - "cPWR_FullPowerDownMode=1", - "DBG_PostStepTickAssess=0", - "gPWR_FreqScalingWFI=0", - "mAppUseTickLessMode_c=1", - "cPWR_DiscardRunningTimerForPowerDown=1", - ] - - if (chip_logging == false) { - defines += [ - "K32W_LOG_ENABLED=0", - "gUartDebugConsole_d=0", - ] - } else { - defines += [ - "K32W_LOG_ENABLED=1", - "gUartDebugConsole_d=1", - ] - } - } else { - defines += [ - "cPWR_UsePowerDownMode=0", - "cPWR_FullPowerDownMode=0", - "K32W_LOG_ENABLED=1", - "gUartDebugConsole_d=1", - ] - } - - if (build_for_k32w061 == 1) { - defines += [ "CPU_K32W061HN" ] - } else if (build_for_k32w041am == 1) { - defines += [ "CPU_K32W041AMZ" ] - } else if (build_for_k32w041a == 1) { - defines += [ "CPU_K32W041AZ" ] - } else if (build_for_k32w041 == 1) { - defines += [ "CPU_K32W041HN" ] - } - - if (chip_with_high_power == 1) { - defines += [ - "K32WMCM_APP_BUILD", - "JENNIC_CHIP_FAMILY_JN518x", - ] - _sdk_include_dirs += [ - "${k32w0_sdk_root}/middleware/wireless/ieee-802.15.4/Include", - "${k32w0_sdk_root}/middleware/wireless/ieee-802.15.4/mMac/Include", - ] - } - - if (chip_with_ntag == 1) { - defines += [ - "CONFIG_CHIP_NFC_COMMISSIONING=1", - "CHIP_DEVICE_CONFIG_ENABLE_NFC=1", - ] - } - - if (chip_with_factory_data == 1) { - defines += [ "CONFIG_CHIP_LOAD_REAL_FACTORY_DATA=1" ] - } - - if (defined(invoker.defines)) { - defines += invoker.defines - } - - cflags = [ - "-Wno-unused-function", - "-Wno-conversion", - "-Wno-sign-compare", - "-Wno-clobbered", - "-Wno-implicit-fallthrough", - "-Wno-shadow", - "-mthumb", - "-MMD", - "-MP", - ] - - if (is_clang) { - cflags += [ - "-Wno-self-assign", - "-Wno-parentheses-equality", - ] - } else { - cflags += [ - "-fno-optimize-strlen", - - # TODO After upgrading the compiler we started to see new error from address - # warning. To allow PR that rolls up compiler we have suppress this warning - # as an error temporarily. - # see https://github.com/project-chip/connectedhomeip/issues/26221 - "-Wno-error=address", - ] - } - - # Now add our "system-header" include dirs - foreach(include_dir, _sdk_include_dirs) { - cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] - } - } - - # TODO - Break up this monolith and make it configurable. - source_set(sdk_target_name) { - forward_variables_from(invoker, "*") - - if (!defined(sources)) { - sources = [] - } - - sources += [ - "${k32w0_sdk_root}/components/serial_manager/serial_manager.c", - "${k32w0_sdk_root}/components/serial_manager/serial_port_uart.c", - "${k32w0_sdk_root}/components/uart/usart_adapter.c", - "${k32w0_sdk_root}/devices/${device}/mcuxpresso/startup_${device_lowercase}.c", - "${k32w0_sdk_root}/devices/${device}/system_${device}.c", - "${k32w0_sdk_root}/middleware/wireless/ble_controller/config/controller_config.c", - "${k32w0_sdk_root}/middleware/wireless/bluetooth/application/common/ble_conn_manager.c", - "${k32w0_sdk_root}/middleware/wireless/bluetooth/application/common/ble_host_tasks.c", - "${k32w0_sdk_root}/middleware/wireless/bluetooth/host/config/ble_globals.c", - "${k32w0_sdk_root}/middleware/wireless/framework/Common/MicroInt_arm_sdk2.c", - "${k32w0_sdk_root}/middleware/wireless/framework/Flash/External/Source/Eeprom_MX25R8035F.c", - "${k32w0_sdk_root}/middleware/wireless/framework/Flash/Internal/Flash_Adapter.c", - "${k32w0_sdk_root}/middleware/wireless/framework/FunctionLib/FunctionLib.c", - "${k32w0_sdk_root}/middleware/wireless/framework/GPIO/GPIO_Adapter.c", - "${k32w0_sdk_root}/middleware/wireless/framework/Keyboard/Source/Keyboard.c", - "${k32w0_sdk_root}/middleware/wireless/framework/LED/Source/LED.c", - "${k32w0_sdk_root}/middleware/wireless/framework/Lists/GenericList.c", - "${k32w0_sdk_root}/middleware/wireless/framework/Logging/Source/dbg_logging.c", - "${k32w0_sdk_root}/middleware/wireless/framework/LowPower/Source/${board}/PWR.c", - "${k32w0_sdk_root}/middleware/wireless/framework/LowPower/Source/${board}/PWRLib.c", - "${k32w0_sdk_root}/middleware/wireless/framework/LowPower/Source/${board}/PWR_setjmp.S", - "${k32w0_sdk_root}/middleware/wireless/framework/MemManager/Source/MemManager.c", - "${k32w0_sdk_root}/middleware/wireless/framework/Messaging/Source/Messaging.c", - "${k32w0_sdk_root}/middleware/wireless/framework/OSAbstraction/Source/fsl_os_abstraction_free_rtos.c", - "${k32w0_sdk_root}/middleware/wireless/framework/OtaSupport/Source/OtaSupport.c", - "${k32w0_sdk_root}/middleware/wireless/framework/OtaSupport/Source/OtaUtils.c", - "${k32w0_sdk_root}/middleware/wireless/framework/PDM/pdm_port.c", - "${k32w0_sdk_root}/middleware/wireless/framework/Panic/Source/Panic.c", - "${k32w0_sdk_root}/middleware/wireless/framework/RNG/Source/RNG.c", - "${k32w0_sdk_root}/middleware/wireless/framework/Reset/Reset.c", - "${k32w0_sdk_root}/middleware/wireless/framework/SecLib/SecLib.c", - "${k32w0_sdk_root}/middleware/wireless/framework/SecLib/SecLib_ecp256_sw.c", - "${k32w0_sdk_root}/middleware/wireless/framework/SerialManager/Source/SerialManager.c", - "${k32w0_sdk_root}/middleware/wireless/framework/SerialManager/Source/UART_Serial_Adapter.c", - "${k32w0_sdk_root}/middleware/wireless/framework/TimersManager/Source/TMR_Adapter.c", - "${k32w0_sdk_root}/middleware/wireless/framework/TimersManager/Source/TimersManager.c", - "${k32w0_sdk_root}/middleware/wireless/framework/XCVR/DK6/fsl_xcvr.c", - "${k32w0_sdk_root}/rtos/amazon-freertos/lib/FreeRTOS/event_groups.c", - "${k32w0_sdk_root}/rtos/amazon-freertos/lib/FreeRTOS/list.c", - "${k32w0_sdk_root}/rtos/amazon-freertos/lib/FreeRTOS/portable/GCC/ARM_CM3/port.c", - "${k32w0_sdk_root}/rtos/amazon-freertos/lib/FreeRTOS/portable/MemMang/heap_4.c", - "${k32w0_sdk_root}/rtos/amazon-freertos/lib/FreeRTOS/queue.c", - "${k32w0_sdk_root}/rtos/amazon-freertos/lib/FreeRTOS/tasks.c", - "${k32w0_sdk_root}/rtos/amazon-freertos/lib/FreeRTOS/timers.c", - ] - if (chip_with_sdk_package == 1) { - sources += [ - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_adc.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_aes.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_clock.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_common.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_ctimer.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_flash.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_flexcomm.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_fmeas.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_gpio.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_i2c.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_i2c_freertos.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_inputmux.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_pint.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_power.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_reset.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_rng.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_rtc.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_sha.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_spifi.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_usart.c", - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_wtimer.c", - "${k32w0_sdk_root}/devices/${device}/utilities/debug_console/fsl_debug_console.c", - "${k32w0_sdk_root}/devices/${device}/utilities/str/fsl_str.c", - ] - } else { - sources += [ - "${k32w0_sdk_root}/devices/K32W061/drivers/fsl_clock.c", - "${k32w0_sdk_root}/devices/K32W061/drivers/fsl_power.c", - "${k32w0_sdk_root}/devices/K32W061/drivers/fsl_reset.c", - "${k32w0_sdk_root}/devices/K32W061/drivers/fsl_wtimer.c", - "${k32w0_sdk_root}/drivers/aes/fsl_aes.c", - "${k32w0_sdk_root}/drivers/common/fsl_common.c", - "${k32w0_sdk_root}/drivers/ctimer/fsl_ctimer.c", - "${k32w0_sdk_root}/drivers/flexcomm/fsl_flexcomm.c", - "${k32w0_sdk_root}/drivers/flexcomm/fsl_i2c.c", - "${k32w0_sdk_root}/drivers/flexcomm/fsl_i2c_freertos.c", - "${k32w0_sdk_root}/drivers/flexcomm/fsl_usart.c", - "${k32w0_sdk_root}/drivers/fmeas/fsl_fmeas.c", - "${k32w0_sdk_root}/drivers/inputmux/fsl_inputmux.c", - "${k32w0_sdk_root}/drivers/jn_flash/fsl_flash.c", - "${k32w0_sdk_root}/drivers/jn_rng/fsl_rng.c", - "${k32w0_sdk_root}/drivers/jn_rtc/fsl_rtc.c", - "${k32w0_sdk_root}/drivers/lpc_adc/fsl_adc.c", - "${k32w0_sdk_root}/drivers/lpc_gpio/fsl_gpio.c", - "${k32w0_sdk_root}/drivers/pint/fsl_pint.c", - "${k32w0_sdk_root}/drivers/sha/fsl_sha.c", - "${k32w0_sdk_root}/drivers/spifi/fsl_spifi.c", - "${k32w0_sdk_root}/utilities/debug_console/fsl_debug_console.c", - "${k32w0_sdk_root}/utilities/debug_console/str/fsl_str.c", - ] - } - - if (chip_with_DK6) { - sources += [ - "${k32w0_sdk_root}/boards/${board}/wireless_examples/openthread/reed/bm/board.c", - "${k32w0_sdk_root}/boards/${board}/wireless_examples/openthread/reed/bm/board_utility.c", - "${k32w0_sdk_root}/boards/${board}/wireless_examples/openthread/reed/bm/hardware_init.c", - ] - - if (chip_with_se05x != 0) { - sources += [ - "${chip_root}/third_party/simw-top-mini/repo/demos/ksdk/common/boards/DK6/wireless_examples/chip/clock_config.c", - "${chip_root}/third_party/simw-top-mini/repo/demos/ksdk/common/boards/DK6/wireless_examples/chip/pin_mux.c", - ] - } else { - sources += [ - "${k32w0_sdk_root}/boards/${board}/wireless_examples/openthread/reed/bm/clock_config.c", - "${k32w0_sdk_root}/boards/${board}/wireless_examples/openthread/reed/bm/pin_mux.c", - ] - } - } - - if (chip_with_low_power != 0) { - sources += [ "${k32w0_sdk_root}/boards/${board}/wireless_examples/hybrid/ble_ot/lped_ble_wuart/ble_802_15_4_common/app_dual_mode_low_power.c" ] - } - - if (chip_with_ntag != 0) { - sources += [ - "${k32w0_sdk_root}/devices/${device}/drivers/fsl_ntag.c", - "${k32w0_sdk_root}/middleware/ntag_i2c_plus/HAL_I2C/i2c_jn_fsl.c", - "${k32w0_sdk_root}/middleware/ntag_i2c_plus/HAL_NTAG/ntag_driver.c", - "${k32w0_sdk_root}/middleware/ntag_i2c_plus/HAL_TMR/timer_driver_jn.c", - ] - } - - if (!defined(public_deps)) { - public_deps = [] - } - - public_deps += [ "${openthread_root}/src/core:libopenthread_core_headers" ] - - if (!defined(public_configs)) { - public_configs = [] - } - - public_configs += [ ":${sdk_target_name}_config" ] - } -} diff --git a/third_party/nxp/k32w0_sdk/nxp_executable.gni b/third_party/nxp/k32w0_sdk/nxp_executable.gni deleted file mode 100644 index 3f4b148fc11646..00000000000000 --- a/third_party/nxp/k32w0_sdk/nxp_executable.gni +++ /dev/null @@ -1,34 +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. - -import("//build_overrides/build.gni") -import("//build_overrides/chip.gni") - -import("${build_root}/toolchain/flashable_executable.gni") - -template("k32w0_executable") { - output_base_name = get_path_info(invoker.output_name, "name") - objcopy_image_name = output_base_name + ".hex" - objcopy_image_format = "srec" - objcopy = "arm-none-eabi-objcopy" - - # Copy flashing dependencies to the output directory so that the output - # is collectively self-contained; this allows flashing to work reliably - # even if the build and flashing steps take place on different machines - # or in different containers. - - flashable_executable(target_name) { - forward_variables_from(invoker, "*") - } -} diff --git a/third_party/nxp/k32w0_sdk/repo/.gitignore b/third_party/nxp/k32w0_sdk/repo/.gitignore deleted file mode 100644 index 16b30e08a957c7..00000000000000 --- a/third_party/nxp/k32w0_sdk/repo/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -core -.west diff --git a/third_party/nxp/k32w0_sdk/repo/manifest/west.yml b/third_party/nxp/k32w0_sdk/repo/manifest/west.yml deleted file mode 100644 index 0febc2e377bd1e..00000000000000 --- a/third_party/nxp/k32w0_sdk/repo/manifest/west.yml +++ /dev/null @@ -1,43 +0,0 @@ -# The west manifest file (west.yml) for MCUXpresso SDK delivery. -# -# See the west documentation for more information: -# -# https://docs.zephyrproject.org/latest/guides/west/index.html -manifest: - remotes: - - name: nxpmicro - url-base: https://github.com/NXPmicro - defaults: - remote: nxpmicro - projects: - - name: mcux-sdk - revision: 7219c54f5dbd5a8636242f9f1771ddb70be146c9 - path: core - - name: amazon-freertos - url: https://github.com/NXP/amazon-freertos.git - path: core/rtos/amazon-freertos - revision: fb74168634e716fb5f0a61714e5c0d1ac6246ba - - name: mbedtls - url: https://github.com/nxp-mcuxpresso/mbedtls.git - path: core/middleware/mbedtls - revision: 15458495823165de372f62c3dad621a8da6c86e3 - - name: framework - url: https://github.com/NXP/mcux-sdk-middleware-connectivity-framework.git - revision: 2ccc3df70ee5b73c451fceee13e6172518412518 - path: core/middleware/wireless/framework - - name: ble_controller - url: https://github.com/NXP/mcux-sdk-middleware-bluetooth-controller.git - revision: 0e4effc707a0d5569160b9335bc2e57c17255f01 - path: core/middleware/wireless/ble_controller - - name: bluetooth - url: https://github.com/NXP/mcux-sdk-middleware-bluetooth-host.git - revision: e5a1b7b9e3b44b49c6c0318edfc3acac74b342d8 - path: core/middleware/wireless/bluetooth - - name: ieee-802.15.4 - url: https://github.com/NXP/mcux-sdk-middleware-ieee_802.15.4.git - revision: e8c96197346a7e37ce3a872096a22bf4aee47e3d - path: core/middleware/wireless/ieee-802.15.4 - - name: examples - url: https://github.com/nxp-mcuxpresso/mcux-sdk-examples.git - revision: 6735550f5a41dfb997d4dd3ce6eebfe1f1d41054 - path: core/boards diff --git a/third_party/nxp/k32w0_sdk/sdk_fixes/patch_k32w_sdk.sh b/third_party/nxp/k32w0_sdk/sdk_fixes/patch_k32w_sdk.sh deleted file mode 100755 index c9e048d64a4f39..00000000000000 --- a/third_party/nxp/k32w0_sdk/sdk_fixes/patch_k32w_sdk.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -if [[ ! -d $NXP_K32W0_SDK_ROOT ]]; then - echo "NXP_K32W0_SDK_ROOT is not set" - exit 1 -fi - -board=$(ls "$NXP_K32W0_SDK_ROOT"/boards) - -convert_to_dos() { - - [[ $(file -b - <$1) != *"CRLF"* ]] && sed -i 's/$/\r/' "$1" -} - -SOURCE=${BASH_SOURCE[0]} -SOURCE_DIR=$(cd "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd) - -echo "K32W0 SDK 2.6.11 no patch needed!" -exit 0 diff --git a/third_party/nxp/k32w1_sdk/BUILD.gn b/third_party/nxp/k32w1_sdk/BUILD.gn deleted file mode 100644 index 9a6cf009555de3..00000000000000 --- a/third_party/nxp/k32w1_sdk/BUILD.gn +++ /dev/null @@ -1,91 +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. - -import("//build_overrides/nxp_sdk.gni") - -import("//build_overrides/mbedtls.gni") - -import("${nxp_sdk_build_root}/nxp_sdk.gni") - -import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") - -import("${mbedtls_root}/mbedtls.gni") - -declare_args() { - # Build target to use for k32w1 SDK. Use this to set global SDK defines. - k32w1_sdk_target = "" -} - -assert(k32w1_sdk_target != "", "k32w1_sdk_target must be specified") - -group("nxp_sdk") { - public_deps = [ k32w1_sdk_target ] -} - -config("mbedtls_k32w1_config") { - defines = [ - "MBEDTLS_CONFIG_FILE=", - "MBEDTLS_USER_CONFIG_FILE=", - - # These options should really be in the config.h... - "MBEDTLS_FREESCALE_FREERTOS_CALLOC_ALT=1", - "MBEDTLS_THREADING_C=1", - "MBEDTLS_THREADING_ALT=1", - "MBEDTLS_X509_CSR_WRITE_C", - "MBEDTLS_X509_CREATE_C", - "MBEDTLS_PEM_WRITE_C", - "MBEDTLS_HKDF_C", - "MBEDTLS_ERROR_C", - "MBEDTLS_PKCS5_C", - - "MBEDTLS_ECP_FIXED_POINT_OPTIM=0", # To reduce peak memory usage - "MBEDTLS_MPI_WINDOW_SIZE=1", - "MBEDTLS_ECP_WINDOW_SIZE=2", - "MBEDTLS_MPI_MAX_SIZE=32", # Maximum number of bytes for usable MPIs. - "MBEDTLS_ECP_MAX_BITS=256", # Maximum bit size of groups */ - "MBEDTLS_ENTROPY_MAX_SOURCES=1", # Maximum number of sources supported - - "MBEDTLS_ENTROPY_HARDWARE_ALT", - ] - - if (chip_mdns == "none") { - defines += [ - "MBEDTLS_PK_WRITE_C", - "MBEDTLS_OID_C", - "MBEDTLS_BASE64_C", - ] - } - - if (chip_crypto == "platform") { - defines += [ - # "MBEDTLS_CCM_ALT", - ] - } - - include_dirs = [ chip_root ] -} - -mbedtls_target("mbedtls") { - sources = [ - "${k32w1_sdk_root}/middleware/mbedtls/port/sssapi/ccm_alt.c", - "${k32w1_sdk_root}/middleware/mbedtls/port/sssapi/entropy_poll_alt.c", - ] - - public_configs = [ ":mbedtls_k32w1_config" ] - - public_deps = [ - ":nxp_sdk", - "${chip_root}/third_party/openthread/platforms/nxp/k32w/k32w1:openthread_mbedtls_config_k32w1", - ] -} diff --git a/third_party/nxp/k32w1_sdk/Jlink_Script/K32W1.jlink b/third_party/nxp/k32w1_sdk/Jlink_Script/K32W1.jlink deleted file mode 100644 index 9d9e4264c1b7d9..00000000000000 --- a/third_party/nxp/k32w1_sdk/Jlink_Script/K32W1.jlink +++ /dev/null @@ -1,6 +0,0 @@ -r -h -loadfile chip-k32w1-light-example.srec -r -g -q \ No newline at end of file diff --git a/third_party/nxp/k32w1_sdk/k32w1_executable.gni b/third_party/nxp/k32w1_sdk/k32w1_executable.gni deleted file mode 100644 index bc78dfc13bf95c..00000000000000 --- a/third_party/nxp/k32w1_sdk/k32w1_executable.gni +++ /dev/null @@ -1,34 +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. - -import("//build_overrides/build.gni") -import("//build_overrides/chip.gni") - -import("${build_root}/toolchain/flashable_executable.gni") - -template("k32w1_executable") { - output_base_name = get_path_info(invoker.output_name, "name") - objcopy_image_name = output_base_name + ".srec" - objcopy_image_format = "srec" - objcopy = "arm-none-eabi-objcopy" - - # Copy flashing dependencies to the output directory so that the output - # is collectively self-contained; this allows flashing to work reliably - # even if the build and flashing steps take place on different machines - # or in different containers. - - flashable_executable(target_name) { - forward_variables_from(invoker, "*") - } -} diff --git a/third_party/nxp/k32w1_sdk/k32w1_sdk.gni b/third_party/nxp/k32w1_sdk/k32w1_sdk.gni deleted file mode 100644 index 5a9e37991e149c..00000000000000 --- a/third_party/nxp/k32w1_sdk/k32w1_sdk.gni +++ /dev/null @@ -1,579 +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. -import("//build_overrides/build.gni") -import("//build_overrides/chip.gni") - -import("//build_overrides/nxp_sdk.gni") - -import("//build_overrides/mbedtls.gni") -import("//build_overrides/openthread.gni") - -import("${build_root}/config/compiler/compiler.gni") -import("${chip_root}/src/crypto/crypto.gni") - -import("${chip_root}/src/platform/device.gni") - -import("${chip_root}/src/lib/core/core.gni") -import("${chip_root}/src/platform/nxp/${nxp_platform}/args.gni") - -import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") - -declare_args() { - # Location of the k32w1 SDK. - k32w1_sdk_root = getenv("NXP_K32W1_SDK_ROOT") - use_smu2_static = false - use_smu2_dynamic = false - use_hw_sha256 = false - use_hw_aes = false - chip_config_dimmable_led = false -} - -openthread_nxp_root = "${chip_root}/third_party/openthread/ot-nxp" - -assert(k32w1_sdk_root != "", "k32w1_sdk_root must be specified") - -assert(!((use_smu2_static && !chip_openthread_ftd) || - (use_smu2_dynamic && !chip_openthread_ftd)), - "SMU2 can be used as system memory only with OT-FTD suppport") - -# Defines an k32w1 SDK build target. -# -# Parameters: -# k32w1_sdk_root - The location of the k32w1 SDK. -# sources - Extra source files to build. -template("k32w1_sdk") { - if (defined(invoker.k32w1_sdk_root)) { - k32w1_sdk_root = invoker.k32w1_sdk_root - } - - assert(chip_with_low_power == 0 || - (chip_with_low_power == 1 && chip_with_ot_cli == 0), - "Please disable low power if openthread CLI is needed!") - - sdk_target_name = target_name - - config("${sdk_target_name}_config") { - include_dirs = [] - if (defined(invoker.include_dirs)) { - include_dirs += invoker.include_dirs - } - - # We want to treat SDK headers as system headers, so that warnings in those - # headers are not fatal. Therefore don't add them directly to include_dirs; - # we will add them to cflags below instead. - _sdk_include_dirs = [ - "${k32w1_sdk_root}/devices/K32W1480", - "${k32w1_sdk_root}/CMSIS/Core/Include", - "${k32w1_sdk_root}/platform/drivers/elemu", - "${k32w1_sdk_root}/platform/drivers/spc", - "${k32w1_sdk_root}/platform/drivers/ccm32k", - "${k32w1_sdk_root}/platform/drivers/wuu", - "${k32w1_sdk_root}/platform/drivers/cmc", - "${k32w1_sdk_root}/platform/drivers/lpspi", - "${k32w1_sdk_root}/components/osa", - "${k32w1_sdk_root}/components/lists", - "${k32w1_sdk_root}/components/messaging", - "${k32w1_sdk_root}/components/mem_manager", - "${k32w1_sdk_root}/components/panic", - "${k32w1_sdk_root}/components/serial_manager", - "${k32w1_sdk_root}/components/uart", - "${k32w1_sdk_root}/components/gpio", - "${k32w1_sdk_root}/components/led", - "${k32w1_sdk_root}/components/button", - "${k32w1_sdk_root}/components/timer_manager", - "${k32w1_sdk_root}/components/time_stamp", - "${k32w1_sdk_root}/components/timer", - "${k32w1_sdk_root}/components/rpmsg", - "${k32w1_sdk_root}/components/internal_flash", - "${k32w1_sdk_root}/components/reset", - "${k32w1_sdk_root}/components/flash/nor/lpspi", - "${k32w1_sdk_root}/components/flash/nor", - "${k32w1_sdk_root}/components/power_manager/boards", - "${k32w1_sdk_root}/components/power_manager/boards/K32W148-EVK", - "${k32w1_sdk_root}/components/power_manager/core", - - "${k32w1_sdk_root}/middleware/wireless/framework/DBG", - "${k32w1_sdk_root}/middleware/wireless/framework/Common", - "${k32w1_sdk_root}/middleware/wireless/framework/FunctionLib", - "${k32w1_sdk_root}/middleware/wireless/framework/HWParameter", - "${k32w1_sdk_root}/middleware/wireless/framework/SecLib", - "${k32w1_sdk_root}/middleware/wireless/framework/RNG", - "${k32w1_sdk_root}/middleware/wireless/framework/Sensors", - "${k32w1_sdk_root}/middleware/wireless/framework/LowPower", - "${k32w1_sdk_root}/middleware/wireless/framework/NVM/Source", - "${k32w1_sdk_root}/middleware/wireless/framework/NVM/Interface", - "${k32w1_sdk_root}/middleware/wireless/framework/ModuleInfo", - "${k32w1_sdk_root}/middleware/wireless/framework/OtaSupport/Interface", - "${k32w1_sdk_root}/middleware/wireless/framework/OtaSupport/Source", - "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1", - "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/K32W1480", - "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1", - "${k32w1_sdk_root}/middleware/wireless/framework/platform/include", - "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/configs", - "${openthread_nxp_root}/third_party/k32w1_sdk", - - "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/include", - "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/include/platform/k32w1", - "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/include/environment/freertos", - "${k32w1_sdk_root}/middleware/multicore/mcmgr/src", - - "${k32w1_sdk_root}/middleware/wireless/ble_controller/interface", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/hci_transport/interface", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/port", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/gatt_db", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/gatt_db/macros", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/host/config", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/host/interface", - - "${k32w1_sdk_root}/middleware/mbedtls/port/sssapi", - "${k32w1_sdk_root}/middleware/mbedtls/port/ksdk", - "${k32w1_sdk_root}/middleware/mbedtls/include/mbedtls", - "${k32w1_sdk_root}/middleware/mbedtls/include", - "${k32w1_sdk_root}/middleware/secure-subsystem/inc", - "${k32w1_sdk_root}/middleware/secure-subsystem/inc/elemu", - "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1", - - "${k32w1_sdk_root}/middleware/wireless/XCVR/drv", - "${k32w1_sdk_root}/middleware/wireless/XCVR/drv/nb2p4ghz", - "${k32w1_sdk_root}/middleware/wireless/XCVR/drv/nb2p4ghz/configs/gen45", - "${k32w1_sdk_root}/middleware/wireless/ieee-802.15.4/ieee_802_15_4/phy/interface", - "${k32w1_sdk_root}/middleware/wireless/ieee-802.15.4/utils", - - "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/include", - "${k32w1_sdk_root}/rtos/freertos/libraries/3rdparty/mbedtls_config", - "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/portable/GCC/ARM_CM33_NTZ/non_secure", - - "${chip_root}/src/platform/nxp/k32w/k32w1", - ] - - if (chip_config_dimmable_led) { - _sdk_include_dirs += [ "${k32w1_sdk_root}/components/pwm" ] - } - - if (sdk_release == 1) { - _sdk_include_dirs += [ - "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/matter", - "${k32w1_sdk_root}/devices/K32W1480/drivers", - "${k32w1_sdk_root}/devices/K32W1480/utilities", - "${k32w1_sdk_root}/devices/K32W1480/utilities/debug_console", - "${k32w1_sdk_root}/devices/K32W1480/utilities/str", - "${k32w1_sdk_root}/devices/K32W1480/utilities/format", - ] - } else { - _sdk_include_dirs += [ - "${k32w1_sdk_root}/devices/KW45B41Z83/drivers", - "${k32w1_sdk_root}/devices/KW45B41Z83/drivers/romapi", - "${k32w1_sdk_root}/platform/drivers/common", - "${k32w1_sdk_root}/platform/drivers/flash_k4", - "${k32w1_sdk_root}/platform/drivers/gpio", - "${k32w1_sdk_root}/platform/drivers/lpuart", - "${k32w1_sdk_root}/platform/drivers/ltc", - "${k32w1_sdk_root}/platform/drivers/port", - "${k32w1_sdk_root}/platform/drivers/lptmr", - "${k32w1_sdk_root}/platform/drivers/ccm32k", - "${k32w1_sdk_root}/platform/drivers/imu", - "${k32w1_sdk_root}/platform/drivers/crc", - "${k32w1_sdk_root}/platform/utilities/misc_utilities", - "${k32w1_sdk_root}/platform/utilities/debug_console", - "${k32w1_sdk_root}/platform/utilities/str", - ] - } - - libs = [ - "${k32w1_sdk_root}/middleware/wireless/bluetooth/host/lib/lib_ble_host_matter_cm33_gcc.a", - "${k32w1_sdk_root}/middleware/wireless/framework/SecLib/lib_crypto_m33.a", - ] - - defines = [ - "gMainThreadPriority_c=5", - "CPU_K32W1480VFTA", - "__STARTUP_CLEAR_BSS", - "SERIAL_MANAGER_NON_BLOCKING_MODE=1", - "SERIAL_USE_CONFIGURE_STRUCTURE=1", - "SDK_COMPONENT_INTEGRATION=1", - "gSerialManagerMaxInterfaces_c=1", - "SDK_OS_FREE_RTOS", - "gAppHighSystemClockFrequency_d=1", - - "USE_NBU=1", - "KW45_A0_SUPPORT=0", - "HAL_RPMSG_SELECT_ROLE=0", - "TM_ENABLE_TIME_STAMP=1", - "FSL_OSA_TASK_ENABLE=1", - "FSL_OSA_MAIN_FUNC_ENABLE=1", - "gAspCapability_d=1", - "gNvStorageIncluded_d=1", - "gUnmirroredFeatureSet_d=1", - "gNvFragmentation_Enabled_d=1", - "gAppButtonCnt_c=2", - "gAppLowpowerEnabled_d=1", - "BUTTON_SHORT_PRESS_THRESHOLD=1500", - "BUTTON_LONG_PRESS_THRESHOLD=2500", - "SSS_CONFIG_FILE=\"fsl_sss_config_elemu.h\"", - "SSCP_CONFIG_FILE=\"fsl_sscp_config_elemu.h\"", - - "SDK_DEBUGCONSOLE=1", - "NO_SYSCORECLK_UPD=0", - "USE_RTOS=1", - "USE_SDK_OSA=0", - "FSL_RTOS_FREE_RTOS=1", - "MinimalHeapSize_c=0x7C00", - "gMemManagerLightExtendHeapAreaUsage=0", - "DEBUG_SERIAL_INTERFACE_INSTANCE=0", - "APP_SERIAL_INTERFACE_INSTANCE=1", - - "configFRTOS_MEMORY_SCHEME=4", - "osCustomStartup=1", - - "ENABLE_RAM_VECTOR_TABLE=1", - - "CHIP_ENABLE_OPENTHREAD=1", - "gUseHciTransportDownward_d=1", - "gAppMaxConnections_c=1", - "gL2caMaxLeCbChannels_c=2", - "gGapSimultaneousEAChainedReports_c=0", - "gTmrStackTimers_c= 3 + gAppMaxConnections_c * 2 + gL2caMaxLeCbChannels_c + gGapSimultaneousEAChainedReports_c", - "gAppUseBonding_d=0", - "gAppUsePairing_d=0", - "gAppUsePrivacy_d=0", - "gGattUseUpdateDatabaseCopyProc_c=0", - "gBleBondIdentityHeaderSize_c=56", - "gPasskeyValue_c=999999", - "gMainThreadStackSize_c=3096", - "gHost_TaskStackSize_c=2400", - "gBleSetMacAddrFromVendorCommand_d=1", - "gLoggingActive_d=0", - "gLogRingPlacementOffset_c=0xF000", - "CHIP_PLAT_NVM_SUPPORT=1", - "mAdvertisingDefaultTxPower_c=0", # default advertising TX power - "mConnectionDefaultTxPower_c=0", # default connection TX power - "BLE_HIGH_TX_POWER=0", # when enabled overwrite default tx power with - # following values gAdvertisingPowerLeveldBm_c and - # gConnectPowerLeveldBm_c - "gAdvertisingPowerLeveldBm_c=0", - "gConnectPowerLeveldBm_c=0", - - #move these platform specific defines to args.gni - "NXP_OT_IDLE_INTERVAL=${nxp_ot_idle_interval_ms}", - "NXP_OT_ACTIVE_INTERVAL=${nxp_ot_active_interval_ms}", - "NXP_ICD_ENABLED=1", - "NXP_ACTIVE_MODE_THRESHOLD=${nxp_active_mode_threshold_ms}", - "NXP_ACTIVE_MODE_DURATION_MS=${nxp_active_mode_duration_ms}", - "NXP_IDLE_MODE_DURATION_SEC=${nxp_idle_mode_duration_s}", - "NXP_ICD_SUPPORTED_CLIENTS_PER_FABRIC=${nxp_icd_supported_clients_per_fabric}", - ] - - if (chip_enable_pw_rpc) { - defines += [ "SERIAL_PORT_TYPE_UART_DMA=1" ] - } else { - defines += [ "SERIAL_PORT_TYPE_UART=1" ] - } - - if (chip_with_low_power == 1 && chip_logging == true) { - print( - "WARNING: enabling logs in low power might break the LP timings. Use at your own risk!") - print("WARNING: set chip_logging=false to disable logging.") - } - - if (chip_mdns == "platform") { - defines += [ - "OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE=1", - "OPENTHREAD_CONFIG_ECDSA_ENABLE=1", - "OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE=1", - "OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1", - ] - } - - if (chip_with_ot_cli == 1) { - defines += [ "CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI=1" ] - } - - if (use_smu2_static) { - defines += [ - "__STARTUP_CLEAR_SMU2", - "USE_SMU2_AS_SYSTEM_MEMORY", - "USE_SMU2_STATIC", - ] - } - - if (use_smu2_dynamic) { - defines += [ - "USE_SMU2_AS_SYSTEM_MEMORY", - "USE_SMU2_DYNAMIC", - ] - } - - if (chip_with_factory_data == 1) { - defines += [ "CONFIG_CHIP_LOAD_REAL_FACTORY_DATA=1" ] - } - - if (chip_with_low_power == 1) { - defines += [ - "chip_with_low_power=1", - "cPWR_UsePowerDownMode=1", - "gAppLowpowerEnabled_d=1", - ] - - if (chip_logging == false) { - defines += [ - "K32W_LOG_ENABLED=0", - "gUartDebugConsole_d=0", - ] - } else { - defines += [ - "K32W_LOG_ENABLED=1", - "OSA_USED=1", - "gUartDebugConsole_d=1", - ] - } - } else { - defines += [ - "gAppLedCnt_c=2", - "K32W_LOG_ENABLED=1", - "gUartDebugConsole_d=1", - ] - } - - if (use_hw_sha256) { - defines += [ "USE_HW_SHA256" ] - } - - if (use_hw_aes) { - defines += [ "USE_HW_AES" ] - } - - if (nxp_software_version != "") { - defines += - [ "NXP_CONFIG_DEVICE_SOFTWARE_VERSION=${nxp_software_version}" ] - } - - if (nxp_software_version_string != "") { - defines += [ "NXP_CONFIG_DEVICE_SOFTWARE_VERSION_STRING=\"${nxp_software_version_string}\"" ] - } - - if (defined(invoker.defines)) { - defines += invoker.defines - } - - cflags = [ - "-Wno-unused-function", - "-Wno-conversion", - "-Wno-sign-compare", - "-Wno-clobbered", - "-Wno-implicit-fallthrough", - "-fno-optimize-strlen", - "-mthumb", - "-MMD", - "-MP", - ] - - cflags += [ - # TODO After upgrading the compiler we started to see new error from address - # warning. To allow PR that rolls up compiler we have suppress this warning - # as an error temporarily. - # see https://github.com/project-chip/connectedhomeip/issues/26221 - "-Wno-error=address", - ] - - # Now add our "system-header" include dirs - foreach(include_dir, _sdk_include_dirs) { - cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] - } - } - - # TODO - Break up this monolith and make it configurable. - source_set(sdk_target_name) { - forward_variables_from(invoker, "*") - - if (!defined(sources)) { - sources = [] - } - - if (sdk_release == 1) { - sources += [ - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_ccm32k.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_clock.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_cmc.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_crc.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_elemu.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_gpio.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_imu.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_k4_controller.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_k4_flash.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_lpspi.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_lptmr.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_lpuart.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_ltc.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_spc.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_wuu.c", - "${k32w1_sdk_root}/devices/K32W1480/utilities/debug_console/fsl_debug_console.c", - "${k32w1_sdk_root}/devices/K32W1480/utilities/fsl_assert.c", - "${k32w1_sdk_root}/devices/K32W1480/utilities/str/fsl_str.c", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/matter/ble_init.c", - ] - - if (chip_config_dimmable_led) { - sources += [ "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_tpm.c" ] - } - - if (chip_enable_pw_rpc) { - sources += [ - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_edma.c", - "${k32w1_sdk_root}/devices/K32W1480/drivers/fsl_lpuart_edma.c", - ] - } - } else { - sources += [ - "${k32w1_sdk_root}/devices/KW45B41Z83/drivers/fsl_clock.c", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/ble_init.c", - "${k32w1_sdk_root}/platform/drivers/ccm32k/fsl_ccm32k.c", - "${k32w1_sdk_root}/platform/drivers/cmc/fsl_cmc.c", - "${k32w1_sdk_root}/platform/drivers/crc/fsl_crc.c", - "${k32w1_sdk_root}/platform/drivers/elemu/fsl_elemu.c", - "${k32w1_sdk_root}/platform/drivers/flash_k4/fsl_k4_controller.c", - "${k32w1_sdk_root}/platform/drivers/flash_k4/fsl_k4_flash.c", - "${k32w1_sdk_root}/platform/drivers/gpio/fsl_gpio.c", - "${k32w1_sdk_root}/platform/drivers/imu/fsl_imu.c", - "${k32w1_sdk_root}/platform/drivers/lpspi/fsl_lpspi.c", - "${k32w1_sdk_root}/platform/drivers/lptmr/fsl_lptmr.c", - "${k32w1_sdk_root}/platform/drivers/lpuart/fsl_lpuart.c", - "${k32w1_sdk_root}/platform/drivers/ltc/fsl_ltc.c", - "${k32w1_sdk_root}/platform/drivers/spc/fsl_spc.c", - "${k32w1_sdk_root}/platform/drivers/wuu/fsl_wuu.c", - "${k32w1_sdk_root}/platform/utilities/assert/fsl_assert.c", - "${k32w1_sdk_root}/platform/utilities/debug_console/fsl_debug_console.c", - "${k32w1_sdk_root}/platform/utilities/str/fsl_str.c", - ] - - if (chip_enable_pw_rpc) { - sources += [ - "${k32w1_sdk_root}/platform/drivers/lpuart/fsl_edma.c", - "${k32w1_sdk_root}/platform/drivers/lpuart/fsl_lpuart_edma.c", - ] - } - } - - sources += [ - "${k32w1_sdk_root}/components/button/fsl_component_button.c", - "${k32w1_sdk_root}/components/flash//nor/lpspi/fsl_lpspi_mem_adapter.c", - "${k32w1_sdk_root}/components/flash//nor/lpspi/fsl_lpspi_nor_flash.c", - "${k32w1_sdk_root}/components/gpio/fsl_adapter_gpio.c", - "${k32w1_sdk_root}/components/internal_flash/fsl_adapter_k4_flash.c", - "${k32w1_sdk_root}/components/led/fsl_component_led.c", - "${k32w1_sdk_root}/components/lists/fsl_component_generic_list.c", - "${k32w1_sdk_root}/components/mem_manager/fsl_component_mem_manager_light.c", - "${k32w1_sdk_root}/components/messaging/fsl_component_messaging.c", - "${k32w1_sdk_root}/components/osa/fsl_os_abstraction_free_rtos.c", - "${k32w1_sdk_root}/components/panic/fsl_component_panic.c", - "${k32w1_sdk_root}/components/power_manager/boards/K32W148-EVK/fsl_pm_board.c", - "${k32w1_sdk_root}/components/power_manager/core/fsl_pm_core.c", - "${k32w1_sdk_root}/components/reset/fsl_adapter_reset.c", - "${k32w1_sdk_root}/components/rpmsg/fsl_adapter_rpmsg.c", - "${k32w1_sdk_root}/components/serial_manager/fsl_component_serial_manager.c", - "${k32w1_sdk_root}/components/serial_manager/fsl_component_serial_port_uart.c", - "${k32w1_sdk_root}/components/time_stamp/fsl_adapter_lptmr_time_stamp.c", - "${k32w1_sdk_root}/components/timer/fsl_adapter_lptmr.c", - "${k32w1_sdk_root}/components/timer_manager/fsl_component_timer_manager.c", - "${k32w1_sdk_root}/components/uart/fsl_adapter_lpuart.c", - "${k32w1_sdk_root}/devices/K32W1480/gcc/startup_K32W1480.S", - "${k32w1_sdk_root}/devices/K32W1480/system_K32W1480.c", - "${k32w1_sdk_root}/middleware/multicore/mcmgr/src/mcmgr.c", - "${k32w1_sdk_root}/middleware/multicore/mcmgr/src/mcmgr_imu_internal.c", - "${k32w1_sdk_root}/middleware/multicore/mcmgr/src/mcmgr_internal_core_api_k32w1.c", - "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/common/llist.c", - "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/rpmsg_lite/porting/environment/rpmsg_env_freertos.c", - "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/rpmsg_lite/porting/platform/k32w1/rpmsg_platform.c", - "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/rpmsg_lite/rpmsg_lite.c", - "${k32w1_sdk_root}/middleware/multicore/rpmsg_lite/lib/virtio/virtqueue.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_aes.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_aes_cmac.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_ccm.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_ecdh.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_hmac_sha256.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_init.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/port/kw45_k4w1/sss_sha256.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/src/sscp/fsl_sscp_mu.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/src/sscp/fsl_sss_mgmt.c", - "${k32w1_sdk_root}/middleware/secure-subsystem/src/sscp/fsl_sss_sscp.c", - "${k32w1_sdk_root}/middleware/wireless/ble_controller/src/controller_api.c", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/ble_conn_manager.c", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/application/common/gatt_db/gatt_database.c", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/hci_transport/source/hcit_generic_adapter_interface.c", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/host/config/ble_globals.c", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/port/fwk_generic_list.c", - "${k32w1_sdk_root}/middleware/wireless/bluetooth/port/fwk_timer_manager.c", - "${k32w1_sdk_root}/middleware/wireless/framework/Common/rtos/freertos/heap_mem_manager.c", - "${k32w1_sdk_root}/middleware/wireless/framework/FunctionLib/FunctionLib.c", - "${k32w1_sdk_root}/middleware/wireless/framework/HWParameter/HWParameter.c", - "${k32w1_sdk_root}/middleware/wireless/framework/LowPower/PWR.c", - "${k32w1_sdk_root}/middleware/wireless/framework/LowPower/PWR_systicks.c", - "${k32w1_sdk_root}/middleware/wireless/framework/NVM/Source/NV_Flash.c", - "${k32w1_sdk_root}/middleware/wireless/framework/OtaSupport/Source/OtaExternalFlash.c", - "${k32w1_sdk_root}/middleware/wireless/framework/OtaSupport/Source/OtaSupport.c", - "${k32w1_sdk_root}/middleware/wireless/framework/RNG/RNG.c", - "${k32w1_sdk_root}/middleware/wireless/framework/SecLib/SecLib_sss.c", - "${k32w1_sdk_root}/middleware/wireless/framework/Sensors/sensors.c", - "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/K32W1480/clock_config.c", - "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/K32W1480/pin_mux.c", - "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/app_services_init.c", - "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board.c", - "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_comp.c", - "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_dcdc.c", - "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_extflash.c", - "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_lp.c", - "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/hardware_init.c", - "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform.c", - "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_ble.c", - "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_extflash.c", - "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_ics.c", - "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_lowpower.c", - "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_lowpower_timer.c", - "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_ot.c", - "${k32w1_sdk_root}/middleware/wireless/framework/platform/kw45_k32w1/fwk_platform_ota.c", - "${k32w1_sdk_root}/middleware/wireless/ieee-802.15.4/ieee_802_15_4/phy/source/PhyTime.c", - "${k32w1_sdk_root}/middleware/wireless/ieee-802.15.4/ieee_802_15_4/phy/source/SerialDevice/ASP.c", - "${k32w1_sdk_root}/middleware/wireless/ieee-802.15.4/ieee_802_15_4/phy/source/SerialDevice/Phy.c", - "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/croutine.c", - "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/event_groups.c", - "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/list.c", - "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/portable/GCC/ARM_CM33_NTZ/non_secure/port.c", - "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/portable/GCC/ARM_CM33_NTZ/non_secure/portasm.c", - "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/queue.c", - "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/stream_buffer.c", - "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/tasks.c", - "${k32w1_sdk_root}/rtos/freertos/freertos_kernel/timers.c", - ] - - if (chip_config_dimmable_led) { - sources += [ "${k32w1_sdk_root}/components/pwm/fsl_adapter_pwm_tpm.c" ] - } - - if (chip_with_low_power == 1) { - sources += [] - } - - if (!defined(public_deps)) { - public_deps = [] - } - - public_deps += [ "${openthread_root}/src/core:libopenthread_core_headers" ] - - if (!defined(public_configs)) { - public_configs = [] - } - - public_configs += [ ":${sdk_target_name}_config" ] - } -} diff --git a/third_party/nxp/k32w1_sdk/nxp_executable.gni b/third_party/nxp/k32w1_sdk/nxp_executable.gni deleted file mode 100644 index bc78dfc13bf95c..00000000000000 --- a/third_party/nxp/k32w1_sdk/nxp_executable.gni +++ /dev/null @@ -1,34 +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. - -import("//build_overrides/build.gni") -import("//build_overrides/chip.gni") - -import("${build_root}/toolchain/flashable_executable.gni") - -template("k32w1_executable") { - output_base_name = get_path_info(invoker.output_name, "name") - objcopy_image_name = output_base_name + ".srec" - objcopy_image_format = "srec" - objcopy = "arm-none-eabi-objcopy" - - # Copy flashing dependencies to the output directory so that the output - # is collectively self-contained; this allows flashing to work reliably - # even if the build and flashing steps take place on different machines - # or in different containers. - - flashable_executable(target_name) { - forward_variables_from(invoker, "*") - } -} diff --git a/third_party/nxp/nxp_matter_support b/third_party/nxp/nxp_matter_support new file mode 160000 index 00000000000000..ac504a0cc38963 --- /dev/null +++ b/third_party/nxp/nxp_matter_support @@ -0,0 +1 @@ +Subproject commit ac504a0cc389632c0e26b4f04e65914d3a9ba8bd diff --git a/third_party/nxp/nxp_sdk.gni b/third_party/nxp/nxp_sdk.gni deleted file mode 100644 index cb27d5c7554c84..00000000000000 --- a/third_party/nxp/nxp_sdk.gni +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright (c) 2022 Project CHIP Authors -# Copyright 2023 NXP -# -# 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. - -declare_args() { - # Indicates the name of the nxp platform targeted - nxp_platform = "" - - # Specifies the CHIP_DEVICE_LAYER_TARGET in src/platform/BUILD.gn - nxp_device_layer = "nxp/common" - - # Enables target nxp_lwip. Used by RT platforms. - nxp_use_lwip = true - - # Enables target nxp_mbedtls. Used by RT platforms. - nxp_use_mbedtls_port = true - - # Enables the support of the Matter CLI - chip_enable_matter_cli = false - - # Enables the support of factory data - chip_with_factory_data = 0 - - # Enables the auto pairing advertisement at boot - chip_enable_pairing_autostart = 1 - - # Indicates if the nxp SDK used has the SDK package format - is_sdk_package = false - - # Indicates if the nxp SDK used has the nxp SDK internal format - is_sdk_internal = false - - # Defines the current software version - nxp_software_version = 1 - - # Defines the current software string version - nxp_software_version_string = "1.3" - - # ICD Matter Configuration flags - nxp_ot_idle_interval_ms = 2000 # 2s Idle Intervals - nxp_ot_active_interval_ms = 500 # 500ms Active Intervals - - nxp_idle_mode_duration_s = 600 # 10min Idle Mode Interval - nxp_active_mode_duration_ms = 10000 # 10s Active Mode Interval - nxp_active_mode_threshold_ms = 5000 # 5s Active Mode Threshold - nxp_icd_supported_clients_per_fabric = 2 # 2 registration slots per fabric -} - -declare_args() { - nxp_sdk_name = "${nxp_platform}_sdk" -} - -assert(nxp_platform != "", "nxp_platform should be defined") diff --git a/third_party/nxp/rt_sdk/BUILD.gn b/third_party/nxp/rt_sdk/BUILD.gn deleted file mode 100644 index 0fd636441543b1..00000000000000 --- a/third_party/nxp/rt_sdk/BUILD.gn +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# Copyright 2023 NXP -# -# 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/nxp_sdk.gni") - -#allows to get common NXP SDK gn options -import("${nxp_sdk_build_root}/nxp_sdk.gni") - -# Allows to get various RT gn options -import("${nxp_sdk_build_root}/${nxp_sdk_name}/rt_sdk.gni") - -import( - "${nxp_sdk_build_root}/${nxp_sdk_name}/${rt_platform}/${rt_platform}.gni") -import("${nxp_sdk_build_root}/${nxp_sdk_name}/bt_ble/bt_ble.gni") -import("${nxp_sdk_build_root}/${nxp_sdk_name}/lwip/lwip.gni") - -import("//build_overrides/openthread.gni") - -import("${chip_root}/src/platform/device.gni") -import("${chip_root}/src/platform/nxp/${nxp_platform}/args.gni") - -group("nxp_sdk") { - public_deps = [ - ":nxp_transceiver", - "${nxp_sdk_build_root}/${nxp_sdk_name}/${rt_platform}:nxp_sdk", - nxp_sdk_driver_target, - nxp_sdk_target, - ] - - if (chip_enable_ble) { - public_deps += [ ":nxp_bt_ble" ] - } - - if (chip_enable_wifi) { - public_deps += [ ":nxp_wifi" ] - } - if (chip_enable_openthread) { - public_deps += [ "${openthread_root}/src/core:libopenthread_core_headers" ] - } -} - -group("nxp_mbedtls") { - public_deps = - [ "${nxp_sdk_build_root}/${nxp_sdk_name}/${rt_platform}:nxp_mbedtls" ] -} - -config("lwip_rt_config") { - include_dirs = [ - "${rt_sdk_root}/middleware/lwip/src/include", - "${rt_sdk_root}/middleware/lwip/port", - "lwip/common", - ] - if (chip_enable_ethernet) { - include_dirs += [ "lwip/ethernet" ] - } else if (chip_enable_openthread && chip_enable_wifi) { - include_dirs += [ "lwip/wifi_openthread" ] - } else if (chip_enable_openthread) { - include_dirs += [ "lwip/openthread" ] - } else if (chip_enable_wifi) { - include_dirs += [ - "lwip/wifi", - "${rt_sdk_root}/middleware/wifi_nxp/port/lwip", - ] - } -} - -lwip_target("nxp_lwip") { - public = [] - sources = [ - #lwip port file - "${rt_sdk_root}/middleware/lwip/port/sys_arch.c", - ] - if (chip_enable_ethernet) { - sources += [ - "${rt_sdk_root}/middleware/lwip/port/enet_ethernetif.c", - "${rt_sdk_root}/middleware/lwip/port/enet_ethernetif_kinetis.c", - ] - } - - if (chip_enable_wifi) { - sources += [ - "${rt_sdk_root}/middleware/wifi_nxp/port/lwip/net.c", - "${rt_sdk_root}/middleware/wifi_nxp/port/lwip/wifi_netif.c", - ] - } - - public_configs = [ ":lwip_rt_config" ] - - public_deps = [ ":nxp_sdk" ] - rt_sdk_root = rt_sdk_root -} - -bt_ble_target("nxp_bt_ble") { - public_deps = [ nxp_sdk_target ] - rt_sdk_root = rt_sdk_root -} - -rt_transceiver("nxp_transceiver") { - public_deps = [ nxp_sdk_target ] -} - -rt_wifi("nxp_wifi") { - public_deps = [ nxp_sdk_target ] -} diff --git a/third_party/nxp/rt_sdk/bt_ble/bt_ble.gni b/third_party/nxp/rt_sdk/bt_ble/bt_ble.gni deleted file mode 100644 index 83d2495ed9808d..00000000000000 --- a/third_party/nxp/rt_sdk/bt_ble/bt_ble.gni +++ /dev/null @@ -1,236 +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. - -import("//build_overrides/nxp_sdk.gni") - -#allows to get common NXP SDK gn options -import("${nxp_sdk_build_root}/nxp_sdk.gni") - -# Allows to get various RT gn options -import("${nxp_sdk_build_root}/${nxp_sdk_name}/rt_sdk.gni") -template("bt_ble_target") { - if (defined(invoker.rt_sdk_root)) { - rt_sdk_root = invoker.rt_sdk_root - } - - assert(rt_sdk_root != "", "rt_sdk_root must be specified") - bt_ble_target_name = target_name - - config("${bt_ble_target_name}_warnings") { - cflags = [ - "-Wno-maybe-uninitialized", - "-Wno-string-concatenation", - ] - } - - config("${bt_ble_target_name}_config") { - cflags = [] - defines = [] - if (defined(invoker.cflags)) { - cflags += invoker.cflags - } - - bt_ble_include_dirs = [ - #fatfs required for ethermind - "${rt_sdk_root}/middleware/fatfs/source", - - #edgefast_bluetooth - "${rt_sdk_root}/middleware/edgefast_bluetooth/include", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/porting", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/platform", - - #ethermind - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/export/include", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/export/eOSAL", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/export/extension", - "${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/bluetooth", - "${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/bluetooth/controller", - "${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/ethal", - "${rt_sdk_root}/middleware/wireless/ethermind/port/osal/src/freertos", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/lib/mcux/default/config", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/protocols/sm", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/protocols/sdp", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/protocols/dbase", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/protocols/rfcomm", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/protocols/bnep", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/protocols/avdtp", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/protocols/avctp", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/protocols/smp", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/protocols/obex", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/protocols/mcap", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/protocols/att", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/protocols/hci_1.2", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/utils/aes_cmac", - - # Common edgeFast config file - "${rt_sdk_root}/middleware/edgefast_bluetooth/output/templates/config", - - # Transceiver - "${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/bluetooth/controller", - - # SDK hook requires to build the BLEManagerImpl.cpp from Zephyr - "${nxp_sdk_build_root}/${nxp_sdk_name}/sdk_hook", - ] - libs = [] - - if (hci_spinel_single_uart) { - # Allows to wrap hci_uart functions to another implementation. - # The goal is to have hci and spinel encapsulated in hdlc frames. - # To view the content of new implementations, the code of spinel_hci_hdlc.cpp should be checked - ldflags = [ - "-Wl,--defsym,hci_uart_write_data=__wrap_hci_uart_write_data", - "-Wl,--wrap=hci_uart_bt_init", - "-Wl,--wrap=hci_uart_bt_shutdown", - "-Wl,--wrap=hci_uart_init", - ] - bt_ble_include_dirs += [ - "${rt_sdk_root}/middleware/wireless/ethermind/port/pal", - - # SDK hook to be able to undef the value of EM_HAVE_STATIC_DECL - # so that we can do an extern of the hci_uart_state variable - "${nxp_sdk_build_root}/${nxp_sdk_name}/sdk_hook/bt_pal", - ] - } else { - defines += [ "HAL_UART_DMA_ENABLE=1" ] - bt_ble_include_dirs += - [ "${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux" ] - } - - if (is_sdk_2_15) { - bt_ble_include_dirs += [ - #sdk hook for fatfs config file required for ethermind include files - "${nxp_sdk_build_root}/${nxp_sdk_name}/sdk_hook/fatfs/config", - ] - } else { - bt_ble_include_dirs += [ "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/platform/configs" ] - } - - defines += [ - #BT config, - "CONFIG_BT_PERIPHERAL=1", - "CONFIG_BT_GATT_DYNAMIC_DB=1", - "CONFIG_BT_SETTINGS=0", - "CONFIG_BT_HOST_CRYPTO=1", - "CONFIG_BT_KEYS_OVERWRITE_OLDEST=1", - "BT_BLE_PLATFORM_INIT_ESCAPE", - "BT_CHIP_SUPPORT", - - #increase the Max transmission Unit (MTU) to 247 as defined in the Matter specific - # BT_L2CAP_RX_MTU = CONFIG_BT_BUF_ACL_RX_SIZE - BT_L2CAP_HDR_SIZE with BT_L2CAP_HDR_SIZE = 4 - # therefore define CONFIG_BT_BUF_ACL_RX_SIZE to 251 - "CONFIG_BT_BUF_ACL_RX_SIZE=251", - - #BT_L2CAP_TX_MTU = CONFIG_BT_L2CAP_TX_MTU - # so define CONFIG_BT_L2CAP_TX_MTU to 247 - "CONFIG_BT_L2CAP_TX_MTU=247", - ] - - #Define ZEPHYR to 1 to have the function MapErrorZephyr linked - defines += [ "__ZEPHYR__=1" ] - - # Now add our "system-header" include dirs - foreach(include_dir, bt_ble_include_dirs) { - cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] - } - } - - source_set(bt_ble_target_name) { - forward_variables_from(invoker, "*") - sources = [ - # SDK hook for ethermind - #"${nxp_sdk_build_root}/${nxp_sdk_name}/sdk_hook/btsnoop_pl.c", - #edgefast_bluetooth - "${nxp_sdk_build_root}/${nxp_sdk_name}/sdk_hook/littlefs_pl.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/bt_db_gen.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/common/addr.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_addr.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_adv.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_att.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_buf.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_conn.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_crypto.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_gatt.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_hci_core.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_id.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_l2cap.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_settings.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_smp.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_smp_null.c", - - #"${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_ecc.c", - #"${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_keys.c", - #"${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_keys_br.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/host/bt_pal_uuid.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/platform/bt_ble_platform.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/impl/ethermind/platform/bt_ble_settings.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/porting/atomic_c.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/porting/buf.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/porting/porting.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/porting/slist.c", - "${rt_sdk_root}/middleware/edgefast_bluetooth/source/porting/work_queue.c", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/export/extension/BT_common_pl.c", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/export/extension/aes_cmac_pl.c", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/export/extension/device_queue_pl.c", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/export/extension/sm_pl.c", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/export/extension/sm_ssp_pl.c", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/export/extension/smp_pl.c", - "${rt_sdk_root}/middleware/wireless/ethermind/port/osal/src/freertos/EM_serial.c", - "${rt_sdk_root}/middleware/wireless/ethermind/port/osal/src/freertos/EM_timer.c", - "${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/bluetooth/BT_status_pl.c", - "${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/bluetooth/BT_storage_pl.c", - "${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/bluetooth/btsnoop_pl.c", - "${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/bluetooth/ht_read_task_pl.c", - - #ethermind files - "${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/bluetooth/sco_audio_pl.c", - "${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/bluetooth/write_task_pl.c", - "${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/ethal/ethal_config.c", - - #"${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/bluetooth/littlefs_pl.c", - "${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/ethal/ethal_debug.c", - - #"${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/ethal/ethal_fops.c", - "${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/ethal/ethal_os.c", - ] - - if (!defined(configs)) { - configs = [] - } - - # Relax warnings for third_party code. - configs += [ - ":${bt_ble_target_name}_warnings", - - # Dependencies required to have the rand32.cpp file building - # A dependency to is required therefore add a dependency to below components - "${chip_root}/src:includes", - "${nxp_sdk_build_root}/${nxp_sdk_name}:lwip_rt_config", - "${chip_root}/third_party/nlassert:nlassert_config", - ] - - if (!defined(deps)) { - deps = [] - } - - defines = - [ "vApplicationMallocFailedHook=vApplicationMallocFailedHookBTBLE" ] - - if (!defined(public_configs)) { - public_configs = [] - } - - public_configs += [ ":${bt_ble_target_name}_config" ] - } -} diff --git a/third_party/nxp/rt_sdk/lwip/common/lwipopts_common.h b/third_party/nxp/rt_sdk/lwip/common/lwipopts_common.h deleted file mode 100644 index 14b8fad5823d85..00000000000000 --- a/third_party/nxp/rt_sdk/lwip/common/lwipopts_common.h +++ /dev/null @@ -1,603 +0,0 @@ -/* - * Copyright (c) 2020 Nest Labs, Inc. - * Copyright 2023 NXP - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Compile-time configuration for LwIP on NXP platforms using the - * NXP SDK. - * - */ - -#ifndef __LWIPOPTS_COMMON_H__ -#define __LWIPOPTS_COMMON_H__ - -#if CHIP_HAVE_CONFIG_H -#include -#endif - -#include - -#define LWIP_PROVIDE_ERRNO - -#ifndef CONFIG_NETWORK_HIGH_PERF -#define CONFIG_NETWORK_HIGH_PERF 1 -#endif - -#if USE_RTOS - -/** - * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain - * critical regions during buffer allocation, deallocation and memory - * allocation and deallocation. - */ -#define SYS_LIGHTWEIGHT_PROT 1 - -/** - * NO_SYS==0: Use RTOS - */ -#define NO_SYS 0 -/** - * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c) - */ -#define LWIP_NETCONN 1 -/** - * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c) - */ -#define LWIP_SOCKET 1 - -/** - * LWIP_SO_RCVTIMEO==1: Enable receive timeout for sockets/netconns and - * SO_RCVTIMEO processing. - */ -#define LWIP_SO_RCVTIMEO 1 - -#else -/** - * NO_SYS==1: Bare metal lwIP - */ -#define NO_SYS 1 -/** - * LWIP_NETCONN==0: Disable Netconn API (require to use api_lib.c) - */ -#define LWIP_NETCONN 0 -/** - * LWIP_SOCKET==0: Disable Socket API (require to use sockets.c) - */ -#define LWIP_SOCKET 0 - -#endif - -/* ---------- Multicast DNS options ---------- */ -/* Multicast DNS module */ -#ifndef LWIP_MDNS_RESPONDER -#define LWIP_MDNS_RESPONDER 1 -#endif - -/** - * The maximum number of services per netif - * recommended to be two times greater than number of matter fabrics supported - */ -#ifndef MDNS_MAX_SERVICES -#define MDNS_MAX_SERVICES 10 -#endif - -/* Search over multicast DNS module */ -#ifndef LWIP_MDNS_SEARCH -#define LWIP_MDNS_SEARCH 0 -#endif - -/* Provide strncasecmp to lwIP so it does not provide it's own lwip_strnicmp implementation along the strncasecmp from toolchain */ -#ifndef lwip_strnicmp -#define lwip_strnicmp strncasecmp -#endif - -/* ---------- Core locking ---------- */ - -#ifdef __cplusplus -extern "C" { -#endif - -#define LWIP_TCPIP_CORE_LOCKING 1 - -void sys_lock_tcpip_core(void); -#define LOCK_TCPIP_CORE() sys_lock_tcpip_core() - -void sys_unlock_tcpip_core(void); -#define UNLOCK_TCPIP_CORE() sys_unlock_tcpip_core() - -// void sys_check_core_locking(void); -// #define LWIP_ASSERT_CORE_LOCKED() sys_check_core_locking() - -// void sys_mark_tcpip_thread(void); -// #define LWIP_MARK_TCPIP_THREAD() sys_mark_tcpip_thread() - -#ifdef __cplusplus -} -#endif - -#define LWIP_NETIF_HOSTNAME 1 - -/* ---------- Memory options ---------- */ -/** - * MEM_ALIGNMENT: should be set to the alignment of the CPU - * 4 byte alignment -> #define MEM_ALIGNMENT 4 - * 2 byte alignment -> #define MEM_ALIGNMENT 2 - */ -#ifndef MEM_ALIGNMENT -#define MEM_ALIGNMENT 4 -#endif - -/** - * MEM_SIZE: the size of the heap memory. If the application will send - * a lot of data that needs to be copied, this should be set high. - */ -#ifndef MEM_SIZE -#define MEM_SIZE (22 * 1024) -#endif - -/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application - sends a lot of data out of ROM (or other static memory), this - should be set high. */ -#ifndef MEMP_NUM_PBUF -#if CONFIG_NETWORK_HIGH_PERF -#define MEMP_NUM_PBUF 30 -#else -#define MEMP_NUM_PBUF 15 -#endif -#endif - -/** - * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used - * for incoming packets. - * (only needed if you use tcpip.c) - */ -#ifndef MEMP_NUM_TCPIP_MSG_INPKT -#if CONFIG_NETWORK_HIGH_PERF -#define MEMP_NUM_TCPIP_MSG_INPKT 32 -#else -#define MEMP_NUM_TCPIP_MSG_INPKT 16 -#endif -#endif - -/** MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used - for sequential API communication and incoming packets. Used in - src/api/tcpip.c. */ -#ifndef MEMP_NUM_TCPIP_MSG_API -#if CONFIG_NETWORK_HIGH_PERF -#define MEMP_NUM_TCPIP_MSG_API 64 -#else -#define MEMP_NUM_TCPIP_MSG_API 16 -#endif -#endif - -/** - * MEMP_NUM_NETBUF: the number of struct netbufs. - * (only needed if you use the sequential API, like api_lib.c) - */ -#ifndef MEMP_NUM_NETBUF -#if CONFIG_NETWORK_HIGH_PERF -#define MEMP_NUM_NETBUF 32 -#else -#define MEMP_NUM_NETBUF 16 -#endif -#endif - -/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One - per active UDP "connection". */ -#ifndef MEMP_NUM_UDP_PCB -#define MEMP_NUM_UDP_PCB (6 + (LWIP_MDNS_RESPONDER)) -#endif -/* MEMP_NUM_TCP_PCB: the number of simultaneously active TCP - connections. */ -#ifndef MEMP_NUM_TCP_PCB -#define MEMP_NUM_TCP_PCB 10 -#endif -/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP - connections. */ -#ifndef MEMP_NUM_TCP_PCB_LISTEN -#define MEMP_NUM_TCP_PCB_LISTEN 6 -#endif -/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP - segments. */ -#ifndef MEMP_NUM_TCP_SEG -#if CONFIG_NETWORK_HIGH_PERF -#define MEMP_NUM_TCP_SEG 48 -#else -#define MEMP_NUM_TCP_SEG 22 -#endif -#endif -/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active - timeouts. */ -#ifndef MEMP_NUM_SYS_TIMEOUT -#define MEMP_NUM_SYS_TIMEOUT (10 + (7 * (LWIP_MDNS_RESPONDER))) -#endif - -/* ---------- Pbuf options ---------- */ -/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ -#ifndef PBUF_POOL_SIZE -#define PBUF_POOL_SIZE 40 -#endif - -/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */ -/* Default value is defined in lwip\src\include\lwip\opt.h as - * LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)*/ - -/* ---------- TCP options ---------- */ -#ifndef LWIP_TCP -#define LWIP_TCP 1 -#endif - -#ifndef TCP_TTL -#define TCP_TTL 255 -#endif - -/* Controls if TCP should queue segments that arrive out of - order. Define to 0 if your device is low on memory. */ -#ifndef TCP_QUEUE_OOSEQ -#define TCP_QUEUE_OOSEQ 0 -#endif - -/* TCP Maximum segment size. */ -#ifndef TCP_MSS -#define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */ -#endif - -/* TCP sender buffer space (bytes). */ -#ifndef TCP_SND_BUF -#if CONFIG_NETWORK_HIGH_PERF -#define TCP_SND_BUF (12 * TCP_MSS) -#else -#define TCP_SND_BUF (6 * TCP_MSS) -#endif -#endif - -/* TCP sender buffer space (pbufs). This must be at least = 2 * - TCP_SND_BUF/TCP_MSS for things to work. */ -#ifndef TCP_SND_QUEUELEN -#define TCP_SND_QUEUELEN (3 * TCP_SND_BUF) / TCP_MSS -#endif - -/* TCP receive window. */ -#ifndef TCP_WND -#if CONFIG_NETWORK_HIGH_PERF -#define TCP_WND (15 * TCP_MSS) -#else -#define TCP_WND (2 * TCP_MSS) -#endif -#endif - -/* Enable backlog*/ -#ifndef TCP_LISTEN_BACKLOG -#define TCP_LISTEN_BACKLOG 1 -#endif - -/* ---------- Network Interfaces options ---------- */ -/* Support netif api (in netifapi.c). */ -#ifndef LWIP_NETIF_API -#define LWIP_NETIF_API 1 -#endif - -/* Support an extended callback function - * for several netif related event that supports multiple subscribers. */ -#ifndef LWIP_NETIF_EXT_STATUS_CALLBACK -#define LWIP_NETIF_EXT_STATUS_CALLBACK 1 -#endif - -/* Number of clients that may store data in client_data member array of struct netif (max. 256). */ -#ifndef LWIP_NUM_NETIF_CLIENT_DATA -#define LWIP_NUM_NETIF_CLIENT_DATA (LWIP_MDNS_RESPONDER) -#endif - -/* ---------- ICMP options ---------- */ -#ifndef LWIP_ICMP -#define LWIP_ICMP 1 -#endif - -/* ---------- DHCP options ---------- */ -/* Enable DHCP module. */ -#ifndef LWIP_DHCP -#define LWIP_DHCP 1 -#endif - -/* ---------- IGMP options ---------- */ -/** - * LWIP_IGMP==1: Turn on IGMP module. - */ -#define LWIP_IGMP 1 - -/* ---------- UDP options ---------- */ -#ifndef LWIP_UDP -#define LWIP_UDP 1 -#endif -#ifndef UDP_TTL -#define UDP_TTL 255 -#endif - -/* ---------- Statistics options ---------- */ -#ifndef LWIP_STATS -#define LWIP_STATS 0 -#endif -#ifndef LWIP_PROVIDE_ERRNO -#define LWIP_PROVIDE_ERRNO 1 -#endif - -/* - -------------------------------------- - ---------- Checksum options ---------- - -------------------------------------- -*/ - -/* -Some MCU allow computing and verifying the IP, UDP, TCP and ICMP checksums by hardware: - - To use this feature let the following define uncommented. - - To disable it and process by CPU comment the the checksum. -*/ -// #define CHECKSUM_BY_HARDWARE - -#ifdef CHECKSUM_BY_HARDWARE -/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/ -#define CHECKSUM_GEN_IP 0 -/* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/ -#define CHECKSUM_GEN_UDP 0 -/* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/ -#define CHECKSUM_GEN_TCP 0 -/* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/ -#define CHECKSUM_CHECK_IP 0 -/* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/ -#define CHECKSUM_CHECK_UDP 0 -/* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/ -#define CHECKSUM_CHECK_TCP 0 -#else -/* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/ -#define CHECKSUM_GEN_IP 1 -/* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/ -#define CHECKSUM_GEN_UDP 1 -/* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/ -#define CHECKSUM_GEN_TCP 1 -/* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/ -#define CHECKSUM_CHECK_IP 1 -/* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/ -#define CHECKSUM_CHECK_UDP 1 -/* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/ -#define CHECKSUM_CHECK_TCP 1 -#endif - -/** - * DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread. - * The stack size value itself is platform-dependent, but is passed to - * sys_thread_new() when the thread is created. - */ -#ifndef DEFAULT_THREAD_STACKSIZE -#define DEFAULT_THREAD_STACKSIZE 3000 -#endif - -/** - * DEFAULT_THREAD_PRIO: The priority assigned to any other lwIP thread. - * The priority value itself is platform-dependent, but is passed to - * sys_thread_new() when the thread is created. - */ -#ifndef DEFAULT_THREAD_PRIO -#define DEFAULT_THREAD_PRIO 8 -#endif - -#define LWIP_TIMEVAL_PRIVATE (0) -#define LWIP_COMPAT_MUTEX (0) - -#define LWIP_SOCKET_SET_ERRNO 0 -#define IP_REASS_MAX_PBUFS 0 -#define IP_REASSEMBLY 0 -#define MEMP_NUM_REASSDATA 0 - -#define SO_REUSE (0) -#define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS (0) - -#define TCP_QUEUE_OOSEQ 0 -#define ARP_QUEUEING (0) - -// For Thread-only platforms this is unnecessary but Border router config needs to redefine to larger value -#define LWIP_RAW 1 -#ifndef MEMP_NUM_RAW_PCB -#define MEMP_NUM_RAW_PCB (1) -#endif - -// TODO: verify count - -#define LWIP_HAVE_LOOPIF (0) - -// TODO: not sure why this is disabled -#define LWIP_NETIF_LOOPBACK (0) - -#ifndef MEMP_NUM_NETCONN -#define MEMP_NUM_NETCONN (0) -#endif - -#ifndef LWIP_IPV4 -#define LWIP_IPV4 0 -#endif -// LWIP IPV6 is mandatory to build matter application -#define LWIP_IPV6 1 -#define LWIP_ARP (1) -#ifndef LWIP_DNS -#define LWIP_DNS (1) -#endif - -#if LWIP_IPV6 -// #define LWIP_IPV6_REASS (0) -// #define LWIP_IPV6_DHCP6 0 -// #define LWIP_IPV6_AUTOCONFIG (1) -// #define LWIP_IPV6_ROUTER_SUPPORT 0 -// #define LWIP_ND6_LISTEN_RA 0 - -// #define LWIP_ND6_NUM_NEIGHBORS (0) -// #define LWIP_ND6_NUM_DESTINATIONS (0) -// #define LWIP_ND6_NUM_PREFIXES (0) -// #define LWIP_ND6_NUM_ROUTERS (0) -// #define LWIP_ND6_MAX_MULTICAST_SOLICIT (0) -// #define LWIP_ND6_MAX_UNICAST_SOLICIT (0) -// #define LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT (0) -// #define LWIP_ND6_TCP_REACHABILITY_HINTS (0) -#endif /* LWIP_IPV6 */ - -#define MEMP_SEPARATE_POOLS (0) -#define LWIP_PBUF_FROM_CUSTOM_POOLS (0) -#define MEMP_USE_CUSTOM_POOLS (0) - -#define MEM_LIBC_MALLOC 1 -#define mem_clib_malloc pvPortMalloc -#define mem_clib_free vPortFree - -#define mem_clib_calloc pvPortCalloc - -#define PBUF_CUSTOM_POOL_IDX_START (MEMP_NUM_PBUF) -#define PBUF_CUSTOM_POOL_IDX_END (MEMP_NUM_PBUF) - -#define ETH_PAD_SIZE (0) -#define SUB_ETHERNET_HEADER_SPACE (0) -#define PBUF_LINK_HLEN (14) - -#if LWIP_IPV6 -#ifndef LWIP_IPV6_NUM_ADDRESSES -#define LWIP_IPV6_NUM_ADDRESSES 5 -#endif - -#define LWIP_IPV6_MLD 1 -#define LWIP_ND6_QUEUEING 0 - -#ifndef LWIP_IPV6_SCOPES -#define LWIP_IPV6_SCOPES 0 -#endif - -#endif /* LWIP_IPV6 */ - -#define LWIP_MULTICAST_PING 0 - -#define LWIP_DNS_FOUND_CALLBACK_TYPE dns_found_callback - -// TODO: make LWIP_DEBUG conditional on build type - -#define MEMP_OVERFLOW_CHECK (0) -#define MEMP_SANITY_CHECK (0) -#define MDNS_DEBUG (LWIP_DBG_OFF) -#define MEM_DEBUG (LWIP_DBG_OFF) -#define MEMP_DEBUG (LWIP_DBG_OFF) -#define PBUF_DEBUG (LWIP_DBG_OFF) -#define API_LIB_DEBUG (LWIP_DBG_OFF) -#define API_MSG_DEBUG (LWIP_DBG_OFF) -#define TCPIP_DEBUG (LWIP_DBG_OFF) -#define NETIF_DEBUG (LWIP_DBG_OFF) -#define SOCKETS_DEBUG (LWIP_DBG_OFF) -#define DEMO_DEBUG (LWIP_DBG_OFF) -#define DHCP_DEBUG (LWIP_DBG_OFF) -#define AUTOIP_DEBUG (LWIP_DBG_OFF) -#define ETHARP_DEBUG (LWIP_DBG_OFF) -#define IP_DEBUG (LWIP_DBG_OFF) -#define IP_REASS_DEBUG (LWIP_DBG_OFF) -#define IP6_DEBUG (LWIP_DBG_OFF) -#define RAW_DEBUG (LWIP_DBG_OFF) -#define ICMP_DEBUG (LWIP_DBG_OFF) -#define UDP_DEBUG (LWIP_DBG_OFF) -#define TCP_DEBUG (LWIP_DBG_OFF) -#define TCP_INPUT_DEBUG (LWIP_DBG_OFF) -#define TCP_OUTPUT_DEBUG (LWIP_DBG_OFF) -#define TCP_RTO_DEBUG (LWIP_DBG_OFF) -#define TCP_CWND_DEBUG (LWIP_DBG_OFF) -#define TCP_WND_DEBUG (LWIP_DBG_OFF) -#define TCP_FR_DEBUG (LWIP_DBG_OFF) -#define TCP_QLEN_DEBUG (LWIP_DBG_OFF) -#define TCP_RST_DEBUG (LWIP_DBG_OFF) -#define PPP_DEBUG (LWIP_DBG_OFF) - -#define LWIP_DBG_TYPES_ON \ - (LWIP_DBG_ON | LWIP_DBG_TRACE) /* (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT) */ - -/* - ------------------------------------ - ---------- Debugging options ---------- - ------------------------------------ -*/ - -#ifdef LWIP_DEBUG -#define U8_F "c" -#define S8_F "c" -#define X8_F "02x" -#define U16_F "u" -#define S16_F "d" -#define X16_F "x" -#define U32_F "u" -#define S32_F "d" -#define X32_F "x" -#define SZT_F "u" -#endif - -#ifndef TCPIP_MBOX_SIZE -#if CONFIG_NETWORK_HIGH_PERF -#define TCPIP_MBOX_SIZE 64 -#else -#define TCPIP_MBOX_SIZE 32 -#endif -#endif - -#define TCPIP_THREAD_STACKSIZE 1024 -#define TCPIP_THREAD_PRIO 8 - -/** - * DEFAULT_RAW_RECVMBOX_SIZE: The mailbox size for the incoming packets on a - * NETCONN_RAW. The queue size value itself is platform-dependent, but is passed - * to sys_mbox_new() when the recvmbox is created. - */ -#define DEFAULT_RAW_RECVMBOX_SIZE 12 - -/** - * DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a - * NETCONN_UDP. The queue size value itself is platform-dependent, but is passed - * to sys_mbox_new() when the recvmbox is created. - */ -#define DEFAULT_UDP_RECVMBOX_SIZE 12 - -/** - * DEFAULT_TCP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a - * NETCONN_TCP. The queue size value itself is platform-dependent, but is passed - * to sys_mbox_new() when the recvmbox is created. - */ -#define DEFAULT_TCP_RECVMBOX_SIZE 32 - -/** - * DEFAULT_ACCEPTMBOX_SIZE: The mailbox size for the incoming connections. - * The queue size value itself is platform-dependent, but is passed to - * sys_mbox_new() when the acceptmbox is created. - */ -#define DEFAULT_ACCEPTMBOX_SIZE 12 - -#if (LWIP_DNS || LWIP_IGMP || LWIP_IPV6) && !defined(LWIP_RAND) -/* When using IGMP or IPv6, LWIP_RAND() needs to be defined to a random-function returning an u32_t random value*/ -#include "lwip/arch.h" -u32_t lwip_rand(void); -#define LWIP_RAND() lwip_rand() -#endif - -/** - * DAC macro (initially defined in MIMXRT1176_cm7_features.h) must be undefined - * in the use case of RT1170 platform. - * This is due to DAC name being used by Matter, which causes a conflict - * resulting in a compilation failure. - */ -#ifdef MIMXRT1176_cm7_SERIES -#undef DAC -#endif - -#endif /* __LWIPOPTS_COMMON_H__ */ diff --git a/third_party/nxp/rt_sdk/lwip/common/lwippools.h b/third_party/nxp/rt_sdk/lwip/common/lwippools.h deleted file mode 100644 index 80a6e755709ec1..00000000000000 --- a/third_party/nxp/rt_sdk/lwip/common/lwippools.h +++ /dev/null @@ -1,30 +0,0 @@ -/* @file lwippools.h - * - * @brief This file contains custom LwIP memory pool definitions - * - * Copyright 2020 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef __LWIPPOOLS_H__ -#define __LWIPPOOLS_H__ - -#ifdef MEMP_USE_CUSTOM_POOLS - -#if CHIP_DEVICE_CONFIG_ENABLE_WPA - -/* - * We explicitly move certain large LwIP memory pools to the custom defined - * .wlan_data section in (flash) memory to avoid memory overflow in the - * m_data section (RAM). - */ -extern unsigned char __attribute__((section(".wlan_data"))) memp_memory_PBUF_POOL_base[]; -extern unsigned char __attribute__((section(".wlan_data"))) memp_memory_TCP_PCB_POOL_base[]; - -#endif /* CHIP_DEVICE_CONFIG_ENABLE_WPA */ - -#endif /* MEMP_USE_CUSTOM_POOLS */ - -#endif /* __LWIPPOOLS_H__ */ diff --git a/third_party/nxp/rt_sdk/lwip/ethernet/lwipopts.h b/third_party/nxp/rt_sdk/lwip/ethernet/lwipopts.h deleted file mode 100644 index 7e59f4c48df3ee..00000000000000 --- a/third_party/nxp/rt_sdk/lwip/ethernet/lwipopts.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * Copyright (c) 2020 Nest Labs, Inc. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Compile-time configuration for LwIP - */ - -#ifndef __LWIPOPTS_H__ -#define __LWIPOPTS_H__ - -#define LWIP_DISABLE_PBUF_POOL_SIZE_SANITY_CHECKS 1 -#define PBUF_POOL_SIZE 15 -#define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */ -#define TCP_WND (8 * TCP_MSS) /* ENET_RXBD_NUM minus spare buffer */ -#define ENET_RXBUFF_NUM 14 -#define ENET_RXBD_NUM 9 - -#define LWIP_ETHERNET 1 -#define LWIP_IPV4 0 - -#include "lwipopts_common.h" - -#endif /* __LWIPOPTS_H__ */ diff --git a/third_party/nxp/rt_sdk/lwip/lwip.gni b/third_party/nxp/rt_sdk/lwip/lwip.gni deleted file mode 100644 index 22f9d64bb13f01..00000000000000 --- a/third_party/nxp/rt_sdk/lwip/lwip.gni +++ /dev/null @@ -1,252 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# Copyright 2023 NXP -# -# 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. - -# Defines a lwIP build target. -# -# lwIP depends on external header files to compile. This template defines -# a combined build of the lwIP sources plus target configuration. -template("lwip_target") { - lwip_sdk_root = invoker.rt_sdk_root - - _lwip_root = "${lwip_sdk_root}/middleware/lwip" - - lwip_target_name = target_name - - # Apply overrides for lwIP features. - forward_variables_from(invoker, - [ - "lwip_ipv4", - "lwip_ipv6", - "lwip_api", - "lwip_ethernet", - "lwip_slip", - "lwip_6lowpan", - ]) - - if (!defined(lwip_ipv4)) { - lwip_ipv4 = true - } - if (!defined(lwip_ipv6)) { - lwip_ipv6 = true - } - if (!defined(lwip_api)) { - lwip_api = true - } - if (!defined(lwip_ethernet)) { - lwip_ethernet = true - } - if (!defined(lwip_slip)) { - lwip_slip = false - } - if (!defined(lwip_6lowpan)) { - lwip_6lowpan = false - } - - config("${lwip_target_name}_base_config") { - include_dirs = [ "${lwip_sdk_root}/middleware/lwip/src/include" ] - } - - source_set(lwip_target_name) { - forward_variables_from(invoker, - [ - "sources", - "public", - "public_configs", - "public_deps", - ]) - - # lwIP headers become empty if the relevant feature is disabled, so the - # whole interface can be public regardless of build options. - public += [ - "${_lwip_root}/src/include/lwip/acd.h", - "${_lwip_root}/src/include/lwip/altcp.h", - "${_lwip_root}/src/include/lwip/altcp_tcp.h", - "${_lwip_root}/src/include/lwip/altcp_tls.h", - "${_lwip_root}/src/include/lwip/api.h", - "${_lwip_root}/src/include/lwip/apps/mdns.h", - "${_lwip_root}/src/include/lwip/apps/mdns_domain.h", - "${_lwip_root}/src/include/lwip/apps/mdns_opts.h", - "${_lwip_root}/src/include/lwip/apps/mdns_out.h", - "${_lwip_root}/src/include/lwip/apps/mdns_priv.h", - "${_lwip_root}/src/include/lwip/arch.h", - "${_lwip_root}/src/include/lwip/autoip.h", - "${_lwip_root}/src/include/lwip/debug.h", - "${_lwip_root}/src/include/lwip/def.h", - "${_lwip_root}/src/include/lwip/dhcp.h", - "${_lwip_root}/src/include/lwip/dhcp6.h", - "${_lwip_root}/src/include/lwip/dns.h", - "${_lwip_root}/src/include/lwip/err.h", - "${_lwip_root}/src/include/lwip/errno.h", - "${_lwip_root}/src/include/lwip/etharp.h", - "${_lwip_root}/src/include/lwip/ethip6.h", - "${_lwip_root}/src/include/lwip/icmp.h", - "${_lwip_root}/src/include/lwip/icmp6.h", - "${_lwip_root}/src/include/lwip/if_api.h", - "${_lwip_root}/src/include/lwip/igmp.h", - "${_lwip_root}/src/include/lwip/inet.h", - "${_lwip_root}/src/include/lwip/inet_chksum.h", - "${_lwip_root}/src/include/lwip/init.h", - "${_lwip_root}/src/include/lwip/ip.h", - "${_lwip_root}/src/include/lwip/ip4.h", - "${_lwip_root}/src/include/lwip/ip4_addr.h", - "${_lwip_root}/src/include/lwip/ip4_frag.h", - "${_lwip_root}/src/include/lwip/ip6.h", - "${_lwip_root}/src/include/lwip/ip6_addr.h", - "${_lwip_root}/src/include/lwip/ip6_frag.h", - "${_lwip_root}/src/include/lwip/ip6_zone.h", - "${_lwip_root}/src/include/lwip/ip_addr.h", - "${_lwip_root}/src/include/lwip/mem.h", - "${_lwip_root}/src/include/lwip/memp.h", - "${_lwip_root}/src/include/lwip/mld6.h", - "${_lwip_root}/src/include/lwip/nd6.h", - "${_lwip_root}/src/include/lwip/netbuf.h", - "${_lwip_root}/src/include/lwip/netdb.h", - "${_lwip_root}/src/include/lwip/netif.h", - "${_lwip_root}/src/include/lwip/netifapi.h", - "${_lwip_root}/src/include/lwip/opt.h", - "${_lwip_root}/src/include/lwip/pbuf.h", - "${_lwip_root}/src/include/lwip/priv/tcp_priv.h", - "${_lwip_root}/src/include/lwip/priv/tcpip_priv.h", - "${_lwip_root}/src/include/lwip/prot/acd.h", - "${_lwip_root}/src/include/lwip/prot/autoip.h", - "${_lwip_root}/src/include/lwip/prot/dhcp.h", - "${_lwip_root}/src/include/lwip/prot/dhcp6.h", - "${_lwip_root}/src/include/lwip/prot/dns.h", - "${_lwip_root}/src/include/lwip/prot/etharp.h", - "${_lwip_root}/src/include/lwip/prot/ethernet.h", - "${_lwip_root}/src/include/lwip/prot/iana.h", - "${_lwip_root}/src/include/lwip/prot/icmp.h", - "${_lwip_root}/src/include/lwip/prot/icmp6.h", - "${_lwip_root}/src/include/lwip/prot/ieee.h", - "${_lwip_root}/src/include/lwip/prot/igmp.h", - "${_lwip_root}/src/include/lwip/prot/ip.h", - "${_lwip_root}/src/include/lwip/prot/ip4.h", - "${_lwip_root}/src/include/lwip/prot/ip6.h", - "${_lwip_root}/src/include/lwip/prot/mld6.h", - "${_lwip_root}/src/include/lwip/prot/nd6.h", - "${_lwip_root}/src/include/lwip/prot/tcp.h", - "${_lwip_root}/src/include/lwip/prot/udp.h", - "${_lwip_root}/src/include/lwip/raw.h", - "${_lwip_root}/src/include/lwip/sio.h", - "${_lwip_root}/src/include/lwip/snmp.h", - "${_lwip_root}/src/include/lwip/sockets.h", - "${_lwip_root}/src/include/lwip/stats.h", - "${_lwip_root}/src/include/lwip/sys.h", - "${_lwip_root}/src/include/lwip/tcp.h", - "${_lwip_root}/src/include/lwip/tcpbase.h", - "${_lwip_root}/src/include/lwip/tcpip.h", - "${_lwip_root}/src/include/lwip/timeouts.h", - "${_lwip_root}/src/include/lwip/udp.h", - ] - - sources += [ - "${_lwip_root}/src/apps/mdns/mdns.c", - "${_lwip_root}/src/apps/mdns/mdns_domain.c", - "${_lwip_root}/src/apps/mdns/mdns_out.c", - "${_lwip_root}/src/core/altcp.c", - "${_lwip_root}/src/core/altcp_alloc.c", - "${_lwip_root}/src/core/altcp_tcp.c", - "${_lwip_root}/src/core/def.c", - "${_lwip_root}/src/core/dns.c", - "${_lwip_root}/src/core/inet_chksum.c", - "${_lwip_root}/src/core/init.c", - "${_lwip_root}/src/core/ip.c", - "${_lwip_root}/src/core/mem.c", - "${_lwip_root}/src/core/memp.c", - "${_lwip_root}/src/core/netif.c", - "${_lwip_root}/src/core/pbuf.c", - "${_lwip_root}/src/core/raw.c", - "${_lwip_root}/src/core/stats.c", - "${_lwip_root}/src/core/sys.c", - "${_lwip_root}/src/core/tcp.c", - "${_lwip_root}/src/core/tcp_in.c", - "${_lwip_root}/src/core/tcp_out.c", - "${_lwip_root}/src/core/timeouts.c", - "${_lwip_root}/src/core/udp.c", - "${_lwip_root}/src/include/lwip/priv/altcp_priv.h", - "${_lwip_root}/src/include/lwip/priv/api_msg.h", - "${_lwip_root}/src/include/lwip/priv/api_msg.h", - "${_lwip_root}/src/include/lwip/priv/mem_priv.h", - "${_lwip_root}/src/include/lwip/priv/memp_priv.h", - "${_lwip_root}/src/include/lwip/priv/memp_std.h", - "${_lwip_root}/src/include/lwip/priv/nd6_priv.h", - "${_lwip_root}/src/include/lwip/priv/raw_priv.h", - "${_lwip_root}/src/include/lwip/priv/sockets_priv.h", - ] - - if (lwip_ipv4) { - sources += [ - "${_lwip_root}/src/core/ipv4/acd.c", - "${_lwip_root}/src/core/ipv4/autoip.c", - "${_lwip_root}/src/core/ipv4/dhcp.c", - "${_lwip_root}/src/core/ipv4/etharp.c", - "${_lwip_root}/src/core/ipv4/icmp.c", - "${_lwip_root}/src/core/ipv4/igmp.c", - "${_lwip_root}/src/core/ipv4/ip4.c", - "${_lwip_root}/src/core/ipv4/ip4_addr.c", - "${_lwip_root}/src/core/ipv4/ip4_frag.c", - ] - } - - if (lwip_ipv6) { - sources += [ - "${_lwip_root}/src/core/ipv6/dhcp6.c", - "${_lwip_root}/src/core/ipv6/ethip6.c", - "${_lwip_root}/src/core/ipv6/icmp6.c", - "${_lwip_root}/src/core/ipv6/inet6.c", - "${_lwip_root}/src/core/ipv6/ip6.c", - "${_lwip_root}/src/core/ipv6/ip6_addr.c", - "${_lwip_root}/src/core/ipv6/ip6_frag.c", - "${_lwip_root}/src/core/ipv6/mld6.c", - "${_lwip_root}/src/core/ipv6/nd6.c", - ] - } - - if (lwip_api) { - sources += [ - "${_lwip_root}/src/api/api_lib.c", - "${_lwip_root}/src/api/api_msg.c", - "${_lwip_root}/src/api/err.c", - "${_lwip_root}/src/api/if_api.c", - "${_lwip_root}/src/api/netbuf.c", - "${_lwip_root}/src/api/netdb.c", - "${_lwip_root}/src/api/netifapi.c", - "${_lwip_root}/src/api/sockets.c", - "${_lwip_root}/src/api/tcpip.c", - ] - } - - if (lwip_ethernet) { - sources += [ "${_lwip_root}/src/netif/ethernet.c" ] - } - - if (lwip_slip) { - sources += [ "${_lwip_root}/src/netif/slipif.c" ] - } - - if (lwip_6lowpan) { - sources += [ "${_lwip_root}/src/netif/lowpan6.c" ] - } - - if (defined(lwip_remove_configs)) { - configs -= lwip_remove_configs - } - if (defined(lwip_add_configs)) { - configs += lwip_add_configs - } - - public_configs += [ ":${lwip_target_name}_base_config" ] - } -} diff --git a/third_party/nxp/rt_sdk/lwip/wifi_openthread/lwipopts.h b/third_party/nxp/rt_sdk/lwip/wifi_openthread/lwipopts.h deleted file mode 100644 index f45675af6f7166..00000000000000 --- a/third_party/nxp/rt_sdk/lwip/wifi_openthread/lwipopts.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * - * Copyright (c) 2020 Nest Labs, Inc. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Compile-time configuration for LwIP - */ - -#ifndef __LWIPOPTS_H__ -#define __LWIPOPTS_H__ - -#define LWIP_IPV4 1 -#define MEMP_NUM_NETCONN (4) -#define NETIF_MAX_HWADDR_LEN 8U - -// BR specific defines -#define LWIP_IPV6_SCOPES 1 -#define MAX_SOCKETS_UDP 10 -#define MEMP_NUM_UDP_PCB (MAX_SOCKETS_UDP + 2) -#define LWIP_IPV6_NUM_ADDRESSES 8 -#define LWIP_IPV6_FORWARD 1 -#define MEMP_NUM_RAW_PCB (2) -// Note: According to Thread Conformance v1.2.0, a Thread Border Router MUST be able to hold a Multicast Listeners Table -// in memory with at least seventy five (75) entries. -#define MEMP_NUM_MLD6_GROUP 10 + 75 - -// DHCPv6 Prefix Delegation -#define LWIP_IPV6_DHCP6 1 -#define LWIP_IPV6_DHCP6_STATEFUL 1 -#define LWIP_IPV6_DHCP6_PD 1 - -// Header file with lwIP hooks -#define LWIP_HOOK_FILENAME "lwip_hooks.h" - -// Hook for multicast forwarding and other filtering -#define LWIP_HOOK_IP6_CANFORWARD lwipCanForwardHook - -// Hook for filtering of input traffic -#define LWIP_HOOK_IP6_INPUT lwipInputHook - -#include "lwipopts_common.h" - -#endif /* __LWIPOPTS_H__ */ diff --git a/third_party/nxp/rt_sdk/mbedtls/config/matter_ksdk_mbedtls_config.h b/third_party/nxp/rt_sdk/mbedtls/config/matter_ksdk_mbedtls_config.h deleted file mode 100644 index f5f3d61606b149..00000000000000 --- a/third_party/nxp/rt_sdk/mbedtls/config/matter_ksdk_mbedtls_config.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2022 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef MATTER_MBEDTLS_CONFIG_H -#define MATTER_MBEDTLS_CONFIG_H - -/* SDK mbetdls config include */ -#include "ksdk_mbedtls_config.h" - -#undef MBEDTLS_FREESCALE_FREERTOS_CALLOC_ALT - -#endif // MATTER_MBEDTLS_CONFIG_H diff --git a/third_party/nxp/rt_sdk/mbedtls/mbedtls.gni b/third_party/nxp/rt_sdk/mbedtls/mbedtls.gni deleted file mode 100644 index 04f628686d29a9..00000000000000 --- a/third_party/nxp/rt_sdk/mbedtls/mbedtls.gni +++ /dev/null @@ -1,141 +0,0 @@ -# Copyright (c) 2022 Project CHIP Authors -# Copyright 2023 NXP -# -# 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. - -template("mbedtls_target") { - if (defined(invoker.rt_sdk_root)) { - rt_sdk_root = invoker.rt_sdk_root - } - - assert(rt_sdk_root != "", "rt_sdk_root must be specified") - mbedtls_sdk_root = rt_sdk_root - mbedtls_target_name = target_name - _mbedtls_root = "${mbedtls_sdk_root}/middleware/mbedtls" - - config("${mbedtls_target_name}_warnings") { - cflags = [ - "-Wno-maybe-uninitialized", - "-Wno-string-concatenation", - ] - } - - config("${mbedtls_target_name}_config") { - include_dirs = [ - "${_mbedtls_root}/include", - "${rt_sdk_root}/middleware/mbedtls/library", - ] - } - - static_library(mbedtls_target_name) { - forward_variables_from(invoker, "*") - if (!defined(sources)) { - sources = [] - } - sources += [ - "${_mbedtls_root}/library/aes.c", - "${_mbedtls_root}/library/aesni.c", - "${_mbedtls_root}/library/arc4.c", - "${_mbedtls_root}/library/asn1parse.c", - "${_mbedtls_root}/library/asn1write.c", - "${_mbedtls_root}/library/base64.c", - "${_mbedtls_root}/library/bignum.c", - "${_mbedtls_root}/library/blowfish.c", - "${_mbedtls_root}/library/camellia.c", - "${_mbedtls_root}/library/ccm.c", - "${_mbedtls_root}/library/certs.c", - "${_mbedtls_root}/library/chacha20.c", - "${_mbedtls_root}/library/chachapoly.c", - "${_mbedtls_root}/library/cipher.c", - "${_mbedtls_root}/library/cipher_wrap.c", - "${_mbedtls_root}/library/cmac.c", - "${_mbedtls_root}/library/constant_time.c", - "${_mbedtls_root}/library/ctr_drbg.c", - "${_mbedtls_root}/library/debug.c", - "${_mbedtls_root}/library/des.c", - "${_mbedtls_root}/library/dhm.c", - "${_mbedtls_root}/library/ecdh.c", - "${_mbedtls_root}/library/ecdsa.c", - "${_mbedtls_root}/library/ecjpake.c", - "${_mbedtls_root}/library/ecp.c", - "${_mbedtls_root}/library/ecp_curves.c", - "${_mbedtls_root}/library/entropy.c", - "${_mbedtls_root}/library/entropy_poll.c", - "${_mbedtls_root}/library/error.c", - "${_mbedtls_root}/library/gcm.c", - "${_mbedtls_root}/library/hkdf.c", - "${_mbedtls_root}/library/hmac_drbg.c", - "${_mbedtls_root}/library/md.c", - "${_mbedtls_root}/library/md5.c", - "${_mbedtls_root}/library/nist_kw.c", - "${_mbedtls_root}/library/oid.c", - "${_mbedtls_root}/library/padlock.c", - "${_mbedtls_root}/library/pem.c", - "${_mbedtls_root}/library/pk.c", - "${_mbedtls_root}/library/pk_wrap.c", - "${_mbedtls_root}/library/pkcs12.c", - "${_mbedtls_root}/library/pkcs5.c", - "${_mbedtls_root}/library/pkparse.c", - "${_mbedtls_root}/library/pkwrite.c", - "${_mbedtls_root}/library/platform.c", - "${_mbedtls_root}/library/platform_util.c", - "${_mbedtls_root}/library/poly1305.c", - "${_mbedtls_root}/library/psa_crypto_client.c", - "${_mbedtls_root}/library/ripemd160.c", - "${_mbedtls_root}/library/rsa.c", - "${_mbedtls_root}/library/rsa_internal.c", - "${_mbedtls_root}/library/sha1.c", - "${_mbedtls_root}/library/sha256.c", - "${_mbedtls_root}/library/sha512.c", - "${_mbedtls_root}/library/ssl_cache.c", - "${_mbedtls_root}/library/ssl_ciphersuites.c", - "${_mbedtls_root}/library/ssl_cli.c", - "${_mbedtls_root}/library/ssl_cookie.c", - "${_mbedtls_root}/library/ssl_msg.c", - "${_mbedtls_root}/library/ssl_srv.c", - "${_mbedtls_root}/library/ssl_ticket.c", - "${_mbedtls_root}/library/ssl_tls.c", - "${_mbedtls_root}/library/threading.c", - "${_mbedtls_root}/library/version.c", - "${_mbedtls_root}/library/version_features.c", - "${_mbedtls_root}/library/x509.c", - "${_mbedtls_root}/library/x509_create.c", - "${_mbedtls_root}/library/x509_crl.c", - "${_mbedtls_root}/library/x509_crt.c", - "${_mbedtls_root}/library/x509_csr.c", - "${_mbedtls_root}/library/x509write_crt.c", - "${_mbedtls_root}/library/x509write_csr.c", - "${_mbedtls_root}/library/xtea.c", - ] - - if (current_os != "freertos") { - sources += [ "${_mbedtls_root}/library/timing.c" ] - } - - if (!defined(configs)) { - configs = [] - } - - # Relax warnings for third_party code. - configs += [ ":${mbedtls_target_name}_warnings" ] - - if (!defined(public_configs)) { - public_configs = [] - } - - public_configs += [ ":${mbedtls_target_name}_config" ] - - output_name = "lib${mbedtls_target_name}" - output_dir = "${root_out_dir}/lib" - } -} diff --git a/third_party/nxp/rt_sdk/nxp_arm.gni b/third_party/nxp/rt_sdk/nxp_arm.gni deleted file mode 100644 index 560b076ef57a0d..00000000000000 --- a/third_party/nxp/rt_sdk/nxp_arm.gni +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2023 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build_overrides/nxp_sdk.gni") -import("${nxp_sdk_build_root}/nxp_sdk.gni") - -assert(nxp_platform == "rt/rt1060" || nxp_platform == "rt/rt1170" || - nxp_platform == "rt/rw61x", - "${nxp_platform} must be one of: rt/rt1060, rt/rt1170, rt/rw61x.") - -if (nxp_platform == "rt/rt1060" || nxp_platform == "rt/rt1170") { - arm_arch = "armv7e-m" - arm_abi = "aapcs" - arm_cpu = "cortex-m7" - arm_fpu = "fpv5-d16" - arm_float_abi = "hard" -} else if (nxp_platform == "rt/rw61x") { - arm_arch = "armv8-m.main" - arm_abi = "aapcs" - arm_cpu = "cortex-m33+nodsp" - arm_fpu = "fpv5-sp-d16" - arm_float_abi = "hard" -} diff --git a/third_party/nxp/rt_sdk/nxp_executable.gni b/third_party/nxp/rt_sdk/nxp_executable.gni deleted file mode 100644 index 2acfe190a2d960..00000000000000 --- a/third_party/nxp/rt_sdk/nxp_executable.gni +++ /dev/null @@ -1,34 +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. - -import("//build_overrides/build.gni") -import("//build_overrides/chip.gni") - -import("${build_root}/toolchain/flashable_executable.gni") - -template("rt_executable") { - output_base_name = get_path_info(invoker.output_name, "name") - objcopy_image_name = output_base_name + ".hex" - objcopy_image_format = "srec" - objcopy = "arm-none-eabi-objcopy" - - # Copy flashing dependencies to the output directory so that the output - # is collectively self-contained; this allows flashing to work reliably - # even if the build and flashing steps take place on different machines - # or in different containers. - - flashable_executable(target_name) { - forward_variables_from(invoker, "*") - } -} diff --git a/third_party/nxp/rt_sdk/rt_executable.gni b/third_party/nxp/rt_sdk/rt_executable.gni deleted file mode 100644 index e1ad6698062939..00000000000000 --- a/third_party/nxp/rt_sdk/rt_executable.gni +++ /dev/null @@ -1,34 +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. - -import("//build_overrides/build.gni") -import("//build_overrides/chip.gni") - -import("${build_root}/toolchain/flashable_executable.gni") - -template("rt_executable") { - output_base_name = get_path_info(invoker.output_name, "name") - objcopy_image_name = output_base_name + ".hex" - objcopy_image_format = "ihex" - objcopy = "arm-none-eabi-objcopy" - - # Copy flashing dependencies to the output directory so that the output - # is collectively self-contained; this allows flashing to work reliably - # even if the build and flashing steps take place on different machines - # or in different containers. - - flashable_executable(target_name) { - forward_variables_from(invoker, "*") - } -} diff --git a/third_party/nxp/rt_sdk/rt_sdk.gni b/third_party/nxp/rt_sdk/rt_sdk.gni deleted file mode 100644 index eb44f01802ce14..00000000000000 --- a/third_party/nxp/rt_sdk/rt_sdk.gni +++ /dev/null @@ -1,704 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# Copyright 2023 NXP -# -# 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/openthread.gni") - -import("${chip_root}/src/platform/device.gni") # declares chip_enable_wifi -import("${chip_root}/src/platform/nxp/${nxp_platform}/args.gni") # declares all - # rt local - # args -import("${nxp_sdk_build_root}/nxp_sdk.gni") # declares some sdk args such as - # chip_with_ot_cli - -declare_args() { - # Location of the rt SDK. - rt_sdk_root = "${chip_root}/third_party/nxp/rt_sdk/repo/sdk-2.15" - - # Enables Matter over Ethernet support - chip_enable_ethernet = false - - # transceiver lists - iw416_transceiver = false - k32w0_transceiver = false - k32w0_transceiver_bin_path = rebase_path( - "${chip_root}/third_party/openthread/ot-nxp/build_k32w061/ot_rcp_ble_hci_bb_single_uart_fc/bin/ot-rcp-ble-hci-bb-k32w061.elf.bin.h") - w8801_transceiver = false - iwx12_transceiver = false - - # Enables hci and spinel communication on single UART - # Could be used only if k32w0_transceiver is enabled - hci_spinel_single_uart = false - - # Enables spinel communication over spi - # Could be used only if iwx12_transceiver is enabled - spinel_over_spi = false - - # Allows to enable OTW logs to see - # firmware download logs for K32W0 transceiver - otw_logs_enabled = false - - # Defines the RT NVM component supported - rt_nvm_component = "littlefs" - - # KeyStorage enable only for RW61x - #if(nxp_platform == "rt/rw61x"){ - #rt_nvm_component = "key_storage" - #} - - # Enable wifi PTA support - wifi_enable_pta = false - - # RT platform name - rt_platform = "" - - # Support or not assert component from the SDK - sdk_fsl_assert_support = true - - # Defines the name of the nxp SDK target instance - nxp_sdk_target = "" - - # Defines the name of the nxp SDK driver target instance - nxp_sdk_driver_target = "" - - # Enables Watchdog support - use_watchdog = 0 - - # SDK 2.15 support - is_sdk_2_15 = false - - # Describe the transceiver detail flags - nxp_transceiver_interface_detail = "WIFI_IW612_BOARD_MURATA_2EL_USD" -} - -declare_args() { - rt_core_sdk_root = "${rt_sdk_root}/core" -} - -if (is_sdk_package || is_sdk_internal) { - rt_core_sdk_root = getenv("NXP_SDK_ROOT") - rt_sdk_root = getenv("NXP_SDK_ROOT") -} - -if (!defined(rt_fwk_platform)) { - rt_fwk_platform = rt_platform -} - -assert(rt_sdk_root != "", "rt_sdk_root must be specified") - -# Assuming 2.15 SDK support for RT1170 -if (rt_platform == "rt1060" || rt_platform == "rt1170") { - is_sdk_2_15 = true -} - -if (rt_platform == "rt1060") { - nxp_transceiver_interface_detail = "WIFI_IW612_BOARD_MURATA_2EL_M2" -} - -if (iwx12_transceiver && chip_enable_openthread) { - spinel_over_spi = true -} - -rt_sdk_freertos_kernel = "${rt_sdk_root}/rtos/freertos/freertos-kernel" - -template("rt_transceiver") { - config("${target_name}_config") { - include_dirs = [] - _transceiver_include_dirs = [] - - if (defined(invoker.include_dirs)) { - include_dirs += invoker.include_dirs - } - - if (iw416_transceiver || w8801_transceiver || iwx12_transceiver) { - _transceiver_include_dirs += [ - # Transceiver files - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/incl", - "${rt_sdk_root}/middleware/sdmmc/common", - "${rt_sdk_root}/middleware/sdmmc/sdio", - "${rt_sdk_root}/middleware/sdmmc/host/usdhc", - "${rt_sdk_root}/middleware/sdmmc/osa", - "${rt_sdk_root}/middleware/wifi_nxp/incl/wifidriver", - "${rt_sdk_root}/middleware/wifi_nxp/incl", - "${rt_sdk_root}/middleware/wifi_nxp/incl/wlcmgr", - "${rt_sdk_root}/middleware/wifi_nxp/incl/port/os", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/incl", - "${rt_sdk_root}/middleware/wifi_nxp/fwdnld_intf_abs", - "${rt_sdk_root}/middleware/wifi_nxp/sdio_nxp_abs/incl", - "${rt_sdk_root}/middleware/wifi_nxp/firmware_dnld", - ] - if (is_sdk_2_15) { - _transceiver_include_dirs += [ - "${rt_sdk_root}/middleware/wifi_nxp/wifi_bt_firmware/nw61x", - "${rt_sdk_root}/middleware/wifi_nxp/fwdnld_intf_abs", - "${rt_sdk_root}/middleware/wifi_nxp/sdio_nxp_abs/incl", - "${rt_sdk_root}/middleware/wifi_nxp/firmware_dnld", - ] - } else { - _transceiver_include_dirs += - [ "${rt_sdk_root}/middleware/wifi_nxp/wifi_bt_firmware" ] - } - } - - libs = [] - - if (defined(invoker.defines)) { - defines += invoker.defines - } - - cflags = [] - - if (defined(invoker.cflags)) { - cflags += invoker.cflags - } - - # Now add our "system-header" include dirs - foreach(include_dir, _transceiver_include_dirs) { - cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] - } - } - - source_set(target_name) { - forward_variables_from(invoker, "*") - - if (!defined(sources)) { - sources = [] - } - - if (iw416_transceiver || w8801_transceiver || iwx12_transceiver) { - sources += [ - # Transceiver files - "${rt_sdk_root}/middleware/sdmmc/common/fsl_sdmmc_common.c", - "${rt_sdk_root}/middleware/sdmmc/host/usdhc/non_blocking/fsl_sdmmc_host.c", - "${rt_sdk_root}/middleware/sdmmc/osa/fsl_sdmmc_osa.c", - "${rt_sdk_root}/middleware/sdmmc/sdio/fsl_sdio.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/sdio.c", - ] - if (is_sdk_2_15) { - sources += [ - "${rt_sdk_root}/middleware/wifi_nxp/firmware_dnld/firmware_dnld.c", - "${rt_sdk_root}/middleware/wifi_nxp/fwdnld_intf_abs/fwdnld_intf_abs.c", - "${rt_sdk_root}/middleware/wifi_nxp/sdio_nxp_abs/fwdnld_sdio.c", - "${rt_sdk_root}/middleware/wifi_nxp/sdio_nxp_abs/mlan_sdio.c", - ] - } else { - sources += [ - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/firmware_dnld.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_sdio.c", - ] - } - } - - if (!defined(public_configs)) { - public_configs = [] - } - - public_configs += [ ":${target_name}_config" ] - } -} - -template("rt_wifi") { - config("${target_name}_config") { - include_dirs = [] - - if (defined(invoker.include_dirs)) { - include_dirs += invoker.include_dirs - } - - _wifi_include_dirs = [ - # Wi-Fi - "${rt_sdk_root}/middleware/wifi_nxp/incl/port/lwip", - "${rt_sdk_root}/middleware/wifi_nxp/port/lwip", - "${rt_sdk_root}/middleware/wifi_nxp/incl", - "${rt_sdk_root}/middleware/wifi_nxp/incl/port/os", - "${rt_sdk_root}/middleware/wifi_nxp/incl/wifidriver", - "${rt_sdk_root}/middleware/wifi_nxp/incl/wlcmgr", - "${rt_sdk_root}/middleware/wifi_nxp/wifi_bt_firmware", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/incl", - ] - - libs = [] - - if (defined(invoker.defines)) { - defines += invoker.defines - } else { - defines = [] - } - - defines += [ - "CHIP_DEVICE_CONFIG_ENABLE_WPA", - "CONFIG_IPV6=1", # missing in wifi_config.h - ] - - if (wifi_enable_pta) { - defines += [ "WIFI_PTA_ENABLED=1" ] - } - - cflags = [] - - if (defined(invoker.cflags)) { - cflags += invoker.cflags - } - - # Now add our "system-header" include dirs - foreach(include_dir, _wifi_include_dirs) { - cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] - } - } - - source_set(target_name) { - forward_variables_from(invoker, "*") - - if (!defined(sources)) { - sources = [] - } - - sources += [ - # Wi-Fi - "${rt_sdk_root}/middleware/wifi_nxp/cli/cli_utils.c", - "${rt_sdk_root}/middleware/wifi_nxp/dhcpd/dhcp-server-main.c", - "${rt_sdk_root}/middleware/wifi_nxp/dhcpd/dhcp-server.c", - "${rt_sdk_root}/middleware/wifi_nxp/dhcpd/dns-server.c", - "${rt_sdk_root}/middleware/wifi_nxp/port/os/os.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_11ac.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_11d.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_11h.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_11n.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_11n_aggr.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_11n_rxreorder.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_api.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_cfp.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_cmdevt.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_glue.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_init.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_join.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_misc.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_scan.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_shim.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_sta_cmd.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_sta_cmdresp.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_sta_event.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_sta_ioctl.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_sta_rx.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_txrx.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_uap_cmdevent.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_uap_ioctl.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_wmm.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/wifi-debug.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/wifi-mem.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/wifi-uap.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/wifi.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/wifi_pwrmgr.c", - "${rt_sdk_root}/middleware/wifi_nxp/wlcmgr/wlan.c", - "${rt_sdk_root}/middleware/wifi_nxp/wlcmgr/wlan_txpwrlimit_cfg.c", - ] - - if (!defined(public_configs)) { - public_configs = [] - } - - public_configs += [ ":${target_name}_config" ] - } -} - -template("rt_sdk") { - sdk_target_name = target_name - - config("${sdk_target_name}_config") { - include_dirs = [] - - if (defined(invoker.include_dirs)) { - include_dirs += invoker.include_dirs - } - - # We want to treat SDK headers as system headers, so that warnings in those - # headers are not fatal. Therefore don't add them directly to include_dirs; - # we will add them to cflags below instead. - _sdk_include_dirs = [ - #freertos includes - "${rt_sdk_freertos_kernel}/include", - - #CMSIS includes - "${rt_core_sdk_root}/CMSIS/Core/Include", - - #SDK components - "${rt_core_sdk_root}/components/uart", - "${rt_core_sdk_root}/components/spi", - "${rt_core_sdk_root}/components/serial_manager", - "${rt_core_sdk_root}/components/lists", - "${rt_core_sdk_root}/components/osa", - "${rt_core_sdk_root}/components/common_task", - "${rt_core_sdk_root}/components/log", - "${rt_core_sdk_root}/components/timer_manager", - "${rt_core_sdk_root}/components/timer", - "${rt_core_sdk_root}/components/internal_flash", - "${rt_core_sdk_root}/components/button", - "${rt_core_sdk_root}/components/gpio", - "${rt_core_sdk_root}/components/phy/device/phyksz8081", - "${rt_core_sdk_root}/components/phy", - "${rt_core_sdk_root}/components/wifi_bt_module/AzureWave/tx_pwr_limits", - "${rt_core_sdk_root}/components/wifi_bt_module/Murata/tx_pwr_limits", - "${rt_core_sdk_root}/components/wifi_bt_module/template", - "${rt_core_sdk_root}/components/wifi_bt_module/incl", - "${rt_core_sdk_root}/components/messaging", - "${rt_core_sdk_root}/components/mem_manager", - "${rt_core_sdk_root}/components/flash/mflash", - "${rt_core_sdk_root}/components/time_stamp", - - #Framework files - "${rt_sdk_root}/middleware/wireless/framework/FunctionLib", - "${rt_sdk_root}/middleware/wireless/framework/Common", - "${rt_sdk_root}/middleware/wireless/framework/platform/${rt_fwk_platform}", - "${rt_sdk_root}/middleware/wireless/framework/platform/include", - "${rt_sdk_root}/middleware/wireless/framework/FileSystem", - "${rt_sdk_root}/middleware/wireless/framework/FileCache", - "${rt_sdk_root}/middleware/wireless/framework/FSAbstraction", - "${rt_sdk_root}/middleware/wireless/framework/KeyStorage", - - #"${rt_sdk_root}/middleware/wireless/framework/DBG", - - #littlefs - "${rt_sdk_root}/middleware/littlefs", - ] - - #OtaSupport - if (chip_enable_ota_requestor) { - _sdk_include_dirs += [ - "${rt_sdk_root}/middleware/wireless/framework/OtaSupport/Interface", - "${rt_sdk_root}/middleware/wireless/framework/OtaSupport/Source", - ] - } - - if (rt_nvm_component == "nvm_fwk") { - _sdk_include_dirs += - [ "${rt_sdk_root}/middleware/wireless/framework/NVM/Interface" ] - } - - libs = [] - - defines = [ - "__STARTUP_CLEAR_BSS", - "__STARTUP_INITIALIZE_NONCACHEDATA", - "__STARTUP_INITIALIZE_RAMFUNCTION", - - #"SERIAL_MANAGER_NON_BLOCKING_MODE=1", - "SERIAL_MANAGER_TASK_HANDLE_RX_AVAILABLE_NOTIFY=1", - "SERIAL_MANAGER_RING_BUFFER_FLOWCONTROL=1", - "SDK_OS_FREE_RTOS", - - #Enable the OSA startup task - "OSA_USED", - "FSL_OSA_TASK_ENABLE", - - #Startup task stack size todo :to remove - "gMainThreadStackSize_c=4096", - "XIP_EXTERNAL_FLASH=1", - "XIP_BOOT_HEADER_ENABLE=1", - "FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL=1", - "SDK_COMPONENT_INTEGRATION=1", - "FSL_DRIVER_TRANSFER_DOUBLE_WEAK_IRQ=0", - - # Serial Manager already in Non blocking state by default - # but can be changed with other compile switch (DEBUG_CONSOLE_TRANSFER_NON_BLOCKING), - # so better to explicitly set to 1 here except when DEBUG_CONSOLE_TRANSFER_NON_BLOCKING is set - # "SERIAL_MANAGER_NON_BLOCKING_MODE=1", - # For Debug Console, This flag is not use for Debug Console Light - "DEBUG_CONSOLE_TRANSFER_NON_BLOCKING", - "HAL_UART_ADAPTER_FIFO=1", - "SDK_DEBUGCONSOLE_UART=1", - "SERIAL_PORT_TYPE_UART=1", - "CONFIG_ARM=1", - "SERIAL_MANAGER_TASK_STACK_SIZE=4048", - - #LWIP common options - "USE_RTOS=1", - "BUTTON_SHORT_PRESS_THRESHOLD=500", - "BUTTON_LONG_PRESS_THRESHOLD=2000", - - #Multithread tests - "PRINTF_ADVANCED_ENABLE=1", - ] - - if (use_watchdog != 0) { - defines += [ "WATCHDOG_ALLOWED" ] - } - - if (rt_nvm_component == "nvm_fwk") { - defines += [ - #NVM flags - "gNvStorageIncluded_d=1", - "gNvTableKeptInRam_d=1", - "NVM_NO_COMPONNET=1", - ] - } - - if (rt_nvm_component == "littlefs" || rt_nvm_component == "key_storage") { - defines += [ - "LFS_THREADSAFE=1", - "LFS_NO_DEBUG", - "LFS_NO_ERROR", - "LFS_NO_WARN", - ] - } - - if (chip_enable_wifi || chip_enable_ethernet) { - defines += [ - "SDK_DEBUGCONSOLE=1", - "MCUXPRESSO_SDK", - "PRINTF_FLOAT_ENABLE=0", - "DEBUG", - "__GCC", - "__USE_CMSIS", - "PRINT_FLOAT_ENABLE=0", - "CR_INTEGER_PRINTF", - - # No OSA main task - "FSL_OSA_MAIN_FUNC_ENABLE=0", - ] - if (chip_enable_openthread) { - defines += [ "CONFIG_MAX_IPV6_ADDRESSES=8" ] - } else { - defines += [ "CONFIG_MAX_IPV6_ADDRESSES=5" ] - } - } - - if (chip_enable_ethernet) { - defines += [ "FSL_FEATURE_PHYKSZ8081_USE_RMII50M_MODE" ] - } - - if (chip_enable_pairing_autostart == 1) { - defines += [ "CHIP_DEVICE_CONFIG_ENABLE_PAIRING_AUTOSTART=1" ] - } else { - defines += [ "CHIP_DEVICE_CONFIG_ENABLE_PAIRING_AUTOSTART=0" ] - } - - if (iw416_transceiver) { - defines += [ - "WIFI_IW416_BOARD_AW_AM510_USD", - "SDIO_ENABLED", - ] - } - - if (w8801_transceiver) { - defines += [ - "WIFI_88W8801_BOARD_MURATA_2DS_USD", - "SDIO_ENABLED", - ] - } - - if (iwx12_transceiver) { - defines += [ - nxp_transceiver_interface_detail, - "SDIO_ENABLED", - ] - } - - if (k32w0_transceiver) { - defines += [ "K32W061_TRANSCEIVER" ] - defines += [ "BOARD_OTW_K32W0_PIN_INIT" ] - - #Framework OTW defines to locate transceiver binary header - defines += [ "K32W0_RCP_BINARY_H_FILE=\"${k32w0_transceiver_bin_path}\"" ] - - #SDK defines for OTW - defines += [ "HAL_UART_DMA_ENABLE=1" ] - _sdk_include_dirs += - [ "${rt_sdk_root}/middleware/wireless/framework/OTW/Interface" ] - if (otw_logs_enabled) { - defines += [ "OTW_LOG_ENABLED=1" ] - } - } - - if (nxp_software_version != "") { - defines += - [ "NXP_CONFIG_DEVICE_SOFTWARE_VERSION=${nxp_software_version}" ] - } - - if (nxp_software_version_string != "") { - defines += [ "NXP_CONFIG_DEVICE_SOFTWARE_VERSION_STRING=\"${nxp_software_version_string}\"" ] - } - - if (defined(invoker.defines)) { - defines += invoker.defines - } - cflags = [] - - if (defined(invoker.cflags)) { - cflags += invoker.cflags - } - - cflags += [ - "-Wno-unused-function", - "-Wno-conversion", - "-Wno-sign-compare", - "-Wno-shadow", - "-Wno-empty-body", - "-Wno-implicit-fallthrough", - "-Wno-stringop-truncation", - "-Wno-unused-variable", - "-Wno-format-truncation", - ] - - if (chip_enable_openthread) { - defines += [ "CHIP_DEVICE_CONFIG_ENABLE_THREAD=1" ] - } - - if (chip_enable_ble) { - defines += [ "CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE=1" ] - } - - if (chip_enable_wifi) { - defines += [ "CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION=1" ] - } - - # Now add our "system-header" include dirs - foreach(include_dir, _sdk_include_dirs) { - cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] - } - - if (is_sdk_2_15) { - defines += [ "NXP_SDK_2_15_SUPPORT" ] - } - - #Adding pre-include files - cflags += [ "-include" + rebase_path( - "${nxp_sdk_build_root}/${nxp_sdk_name}/transceiver/app_transceiver_config.h", - root_build_dir) ] - } - - # TODO - Break up this monolith and make it configurable. - source_set(sdk_target_name) { - forward_variables_from(invoker, "*") - - if (!defined(sources)) { - sources = [] - } - - sources += [ - #freertos files - "${rt_sdk_freertos_kernel}/croutine.c", - "${rt_sdk_freertos_kernel}/event_groups.c", - "${rt_sdk_freertos_kernel}/list.c", - "${rt_sdk_freertos_kernel}/queue.c", - "${rt_sdk_freertos_kernel}/stream_buffer.c", - "${rt_sdk_freertos_kernel}/tasks.c", - "${rt_sdk_freertos_kernel}/timers.c", - - #SDK components - "${rt_core_sdk_root}/components/button/fsl_component_button.c", - "${rt_core_sdk_root}/components/lists/fsl_component_generic_list.c", - "${rt_core_sdk_root}/components/log/fsl_component_log.c", - "${rt_core_sdk_root}/components/log/fsl_component_log_backend_debugconsole.c", - "${rt_core_sdk_root}/components/messaging/fsl_component_messaging.c", - "${rt_core_sdk_root}/components/osa/fsl_os_abstraction_free_rtos.c", - "${rt_core_sdk_root}/components/phy/device/phyksz8081/fsl_phyksz8081.c", - "${rt_core_sdk_root}/components/serial_manager/fsl_component_serial_manager.c", - "${rt_core_sdk_root}/components/serial_manager/fsl_component_serial_port_uart.c", - "${rt_core_sdk_root}/components/timer_manager/fsl_component_timer_manager.c", - - #Framework files - "${rt_sdk_root}/middleware/wireless/framework/FunctionLib/FunctionLib.c", - ] - - #OtaSupport files - if (chip_enable_ota_requestor) { - sources += [ - "${rt_sdk_root}/middleware/wireless/framework/OtaSupport/Source/OtaExternalFlash.c", - "${rt_sdk_root}/middleware/wireless/framework/OtaSupport/Source/OtaPrivate.h", - "${rt_sdk_root}/middleware/wireless/framework/OtaSupport/Source/OtaSupport.c", - "${rt_sdk_root}/middleware/wireless/framework/platform/${rt_fwk_platform}/fwk_platform_extflash.c", - "${rt_sdk_root}/middleware/wireless/framework/platform/${rt_fwk_platform}/fwk_platform_ota.c", - ] - } - - if (rt_nvm_component == "nvm_fwk") { - sources += [ - "${rt_sdk_root}/middleware/wireless/framework/FileSystem/fwk_filesystem.c", - "${rt_sdk_root}/middleware/wireless/framework/NVM/Source/NV_Flash.c", - "${rt_sdk_root}/middleware/wireless/framework/platform/${rt_fwk_platform}/fwk_platform_flash.c", - ] - } - - if (rt_nvm_component == "key_storage") { - sources += [ - "${rt_sdk_root}/middleware/wireless/framework/FSAbstraction/fwk_fs_abstraction.c", - "${rt_sdk_root}/middleware/wireless/framework/FSAbstraction/fwk_lfs_mflash.c", - "${rt_sdk_root}/middleware/wireless/framework/FileCache/fwk_file_cache.c", - "${rt_sdk_root}/middleware/wireless/framework/KeyStorage/fwk_key_storage.c", - ] - sources += [ - #littlefs - "${rt_sdk_root}/middleware/littlefs/lfs.c", - "${rt_sdk_root}/middleware/littlefs/lfs_util.c", - ] - } - - if (rt_nvm_component == "littlefs") { - sources += [ - "${rt_sdk_root}/middleware/wireless/framework/FileSystem/fwk_filesystem.c", - "${rt_sdk_root}/middleware/wireless/framework/platform/${rt_fwk_platform}/fwk_platform_flash.c", - ] - sources += [ - #littlefs - "${rt_sdk_root}/middleware/littlefs/lfs.c", - "${rt_sdk_root}/middleware/littlefs/lfs_util.c", - ] - } - - if (iwx12_transceiver) { - sources += [ "${rt_sdk_root}/middleware/wireless/framework/platform/imx_rt/iw612/fwk_platform_coex.c" ] - } - - if (k32w0_transceiver) { - sources += [ - "${rt_sdk_root}/middleware/wireless/framework/OTW/k32w0_transceiver/fwk_otw.c", - "${rt_sdk_root}/middleware/wireless/framework/platform/imx_rt/k32w0/fwk_platform_coex.c", - ] - } - - if (!defined(public_configs)) { - public_configs = [] - } - - if (!defined(public_deps)) { - public_deps = [] - } - - public_configs += [ ":${sdk_target_name}_config" ] - - public_configs += - [ "${nxp_sdk_build_root}/${nxp_sdk_name}:nxp_transceiver_config" ] - - public_configs += [ - "${nxp_sdk_build_root}/${nxp_sdk_name}:nxp_lwip_base_config", - "${nxp_sdk_build_root}/${nxp_sdk_name}:lwip_rt_config", - ] - - public_configs += [ "" + nxp_sdk_driver_target + "_config" ] - - if (chip_enable_ble) { - public_configs += - [ "${nxp_sdk_build_root}/${nxp_sdk_name}:nxp_bt_ble_config" ] - } - if (chip_enable_wifi) { - public_configs += - [ "${nxp_sdk_build_root}/${nxp_sdk_name}:nxp_wifi_config" ] - } - - all_dependent_configs = public_configs - } -} diff --git a/third_party/nxp/rt_sdk/rw61x/BUILD.gn b/third_party/nxp/rt_sdk/rw61x/BUILD.gn deleted file mode 100644 index 2b439c6e55ef14..00000000000000 --- a/third_party/nxp/rt_sdk/rw61x/BUILD.gn +++ /dev/null @@ -1,100 +0,0 @@ -# Copyright (c) 2022 Project CHIP Authors -# Copyright 2023 NXP -# -# 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/nxp_sdk.gni") - -#allows to get common NXP SDK gn options -import("${nxp_sdk_build_root}/nxp_sdk.gni") - -# Allows to get various RT gn options -import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") - -import( - "${nxp_sdk_build_root}/${nxp_sdk_name}/${rt_platform}/${rt_platform}.gni") - -#allows to get common NXP SDK gn options -import("${nxp_sdk_build_root}/nxp_sdk.gni") - -import("${nxp_sdk_build_root}/${nxp_sdk_name}/mbedtls/mbedtls.gni") -rt_mbedtls_root = "${rt_sdk_root}/middleware/mbedtls" - -config("mbedtls_els_pkc_config") { - include_dirs = [ - "${rt_mbedtls_root}/port/els", - "${rt_mbedtls_root}/port/pkc", - ] - defines = [ "MBEDTLS_PORT_INCLUDE=" ] - - if (chip_enable_openthread) { - defines += [ "MBEDTLS_CONFIG_FILE=" ] - } else { - defines += [ "MBEDTLS_CONFIG_FILE=" ] - } -} - -mbedtls_target("nxp_els_pkc_mbedtls") { - sources = [] - public_configs = [ ":mbedtls_els_pkc_config" ] - public_deps = [ nxp_sdk_driver_target ] - sources += [ - # els port - "${rt_mbedtls_root}/port/els/aes_alt.c", - "${rt_mbedtls_root}/port/els/cbc_mac_alt.c", - "${rt_mbedtls_root}/port/els/cmac_alt.c", - "${rt_mbedtls_root}/port/els/ctr_drbg_alt.c", - "${rt_mbedtls_root}/port/els/els_mbedtls.c", - "${rt_mbedtls_root}/port/els/entropy_poll_alt.c", - "${rt_mbedtls_root}/port/els/gcm_alt.c", - "${rt_mbedtls_root}/port/els/sha256_alt.c", - "${rt_mbedtls_root}/port/els/sha512_alt.c", - - # pkc port - "${rt_mbedtls_root}/port/pkc/ecc_alt.c", - "${rt_mbedtls_root}/port/pkc/ecdh_alt.c", - "${rt_mbedtls_root}/port/pkc/ecdsa_alt.c", - "${rt_mbedtls_root}/port/pkc/els_pkc_mbedtls.c", - "${rt_mbedtls_root}/port/pkc/rsa_alt.c", - ] - if (chip_enable_openthread) { - public_deps += [ "${openthread_root}/src/core:libopenthread_core_headers" ] - } -} - -group("nxp_sdk_mbedtls_config") { - public_configs = [ ":mbedtls_els_pkc_config" ] -} - -group("nxp_mbedtls") { - public_deps = [ ":nxp_els_pkc_mbedtls" ] -} - -source_set("nxp_sdk_mbedtls_dep") { - # Add here SDK source files which have a dependency on mbedtls - # this approach helps avoid circular dependencies between mbedtls and rw61x_sdk_drivers targets - if (chip_enable_secure_dac_private_key_storage == 0) { - sources = [ "${rt_sdk_root}/middleware/wireless/framework/FactoryDataProvider/fwk_factory_data_provider.c" ] - } - - deps = [ - "${nxp_sdk_build_root}/${nxp_sdk_name}/${rt_platform}:nxp_mbedtls", - "${nxp_sdk_build_root}/${nxp_sdk_name}/${rt_platform}:nxp_sdk_mbedtls_config", - nxp_sdk_driver_target, - ] -} - -group("nxp_sdk") { - # Add SDK's source set which depends on mbedtls - public_deps = [ ":nxp_sdk_mbedtls_dep" ] -} diff --git a/third_party/nxp/rt_sdk/rw61x/rw61x.gni b/third_party/nxp/rt_sdk/rw61x/rw61x.gni deleted file mode 100644 index c15b4dbabf5e22..00000000000000 --- a/third_party/nxp/rt_sdk/rw61x/rw61x.gni +++ /dev/null @@ -1,701 +0,0 @@ -# Copyright (c) 2022 Project CHIP Authors -# Copyright 2023 NXP -# -# 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/nxp_sdk.gni") - -#allows to get common NXP SDK gn options -import("${nxp_sdk_build_root}/nxp_sdk.gni") - -# Allows to get various RT gn options -import("${nxp_sdk_build_root}/${nxp_sdk_name}/rt_sdk.gni") -declare_args() { - board_version = "A1" - deviceBoardName = "RW612" - cpu1_cpu2_fw_type = "sb" -} - -if (is_sdk_internal) { - DRIVER_FILES_PATH = "${rt_sdk_root}/platform/drivers" - UTILITIES_FILES_PATH = "${rt_sdk_root}/platform/utilities" -} else { - if (!is_sdk_package) { - # sdk github is used (default sdk type) # - DRIVER_FILES_PATH = "${rt_core_sdk_root}/drivers" - UTILITIES_FILES_PATH = "${rt_core_sdk_root}/utilities" - } -} - -if (is_sdk_package) { - COMPONENT_FILES_PATH = "${rt_sdk_root}/components" - DRIVER_FILES_PATH = "${rt_sdk_root}/devices/${deviceBoardName}/drivers" - DRIVER_USART_FILES_PATH = "${DRIVER_FILES_PATH}" - DRIVER_DMA_FILES_PATH = "${DRIVER_FILES_PATH}" - DRIVER_MRT_FILES_PATH = "${DRIVER_FILES_PATH}" - DRIVER_TRNG_FILES_PATH = "${DRIVER_FILES_PATH}" - DRIVER_FLEXSPI_FILES_PATH = "${DRIVER_FILES_PATH}" - DRIVER_LPC_GPIO_FILES_PATH = "${DRIVER_FILES_PATH}" - DRIVER_ENET_FILES_PATH = "${DRIVER_FILES_PATH}" - DRIVER_DCP_FILES_PATH = "${DRIVER_FILES_PATH}" - DRIVER_CACHE_FILES_PATH = "${DRIVER_FILES_PATH}" - DRIVER_COMMON_FILES_PATH = "${DRIVER_FILES_PATH}" - DRIVER_DEVICE_FILES_PATH = "${DRIVER_FILES_PATH}" - DRIVER_FLEXCOMM_FILES_PATH = "${DRIVER_FILES_PATH}" - DRIVER_IMU_FILES_PATH = "${DRIVER_FILES_PATH}" - DRIVER_GDMA_FILES_PATH = "${DRIVER_FILES_PATH}" - DRIVER_INPUTMUX_FILES_PATH = "${DRIVER_FILES_PATH}" - DRIVER_PINT_FILES_PATH = "${DRIVER_FILES_PATH}" - COMPONENT_CRC_FILES_PATH = "${COMPONENT_FILES_PATH}/crc" - COMPONENT_RNG_FILES_PATH = "${COMPONENT_FILES_PATH}/rng" - COMPONENT_RPMSG_FILES_PATH = "${COMPONENT_FILES_PATH}/rpmsg" - COMPONENT_UART_FILES_PATH = "${COMPONENT_FILES_PATH}/uart" - COMPONENT_TIMER_FILES_PATH = "${COMPONENT_FILES_PATH}/timer" - COMPONENT_GPIO_FILES_PATH = "${COMPONENT_FILES_PATH}/gpio" - COMPONENT_SILICON_ID_FILES_PATH = "${COMPONENT_FILES_PATH}/silicon_id" - COMPONENT_SILICON_ID_SOCS_FILES_PATH = - "${COMPONENT_SILICON_ID_FILES_PATH}/socs" - COMPONENT_MEM_MANAGER_FILES_PATH = "${COMPONENT_FILES_PATH}/mem_manager" - UTILITIES_FILES_PATH = "${rt_sdk_root}/utilities" - UTILITIES_DEVICE_FILES_PATH = - "${rt_sdk_root}/devices/${deviceBoardName}/utilities" - UTILITIES_ASSERT_FILES_PATH = "${UTILITIES_DEVICE_FILES_PATH}" - UTILITIES_SHELL_FILES_PATH = "${UTILITIES_DEVICE_FILES_PATH}" - DEBUG_CONSOLE_FILES_PATH = "${UTILITIES_DEVICE_FILES_PATH}/debug_console_lite" - FORMAT_FILES_PATH = "${UTILITIES_DEVICE_FILES_PATH}/format" - STR_FILES_PATH = "${UTILITIES_DEVICE_FILES_PATH}/str" - WIFI_BT_TEMPLATE_PATH = "${COMPONENT_FILES_PATH}/wifi_bt_module/template" -} else { - # sdk github or internal sdk (bitbucket) are used # - COMPONENT_FILES_PATH = "${rt_core_sdk_root}/components" - DRIVER_FLEXCOMM_FILES_PATH = "${DRIVER_FILES_PATH}/flexcomm" - DRIVER_USART_FILES_PATH = "${DRIVER_FLEXCOMM_FILES_PATH}/usart" - DRIVER_DMA_FILES_PATH = "${DRIVER_FILES_PATH}/lpc_dma" - DRIVER_MRT_FILES_PATH = "${DRIVER_FILES_PATH}/mrt" - DRIVER_TRNG_FILES_PATH = "${DRIVER_FILES_PATH}/trng" - DRIVER_FLEXSPI_FILES_PATH = "${DRIVER_FILES_PATH}/flexspi" - DRIVER_LPC_GPIO_FILES_PATH = "${DRIVER_FILES_PATH}/lpc_gpio" - DRIVER_ENET_FILES_PATH = "${DRIVER_FILES_PATH}/enet" - DRIVER_DCP_FILES_PATH = "${DRIVER_FILES_PATH}/dcp" - DRIVER_CACHE_FILES_PATH = "${DRIVER_FILES_PATH}/cache/cache64" - DRIVER_COMMON_FILES_PATH = "${DRIVER_FILES_PATH}/common" - DRIVER_DEVICE_FILES_PATH = - "${rt_core_sdk_root}/devices/${deviceBoardName}/drivers" - DRIVER_IMU_FILES_PATH = "${DRIVER_FILES_PATH}/imu" - DRIVER_GDMA_FILES_PATH = "${DRIVER_FILES_PATH}/gdma" - DRIVER_INPUTMUX_FILES_PATH = "${DRIVER_FILES_PATH}/inputmux" - DRIVER_PINT_FILES_PATH = "${DRIVER_FILES_PATH}/pint" - COMPONENT_CRC_FILES_PATH = "${COMPONENT_FILES_PATH}/crc" - COMPONENT_RNG_FILES_PATH = "${COMPONENT_FILES_PATH}/rng" - COMPONENT_RPMSG_FILES_PATH = "${COMPONENT_FILES_PATH}/rpmsg" - COMPONENT_UART_FILES_PATH = "${COMPONENT_FILES_PATH}/uart" - COMPONENT_TIMER_FILES_PATH = "${COMPONENT_FILES_PATH}/timer" - COMPONENT_GPIO_FILES_PATH = "${COMPONENT_FILES_PATH}/gpio" - COMPONENT_MEM_MANAGER_FILES_PATH = "${COMPONENT_FILES_PATH}/mem_manager" - COMPONENT_SILICON_ID_FILES_PATH = "${COMPONENT_FILES_PATH}/silicon_id" - COMPONENT_SILICON_ID_SOCS_FILES_PATH = - "${COMPONENT_SILICON_ID_FILES_PATH}/socs" - UTILITIES_DEVICE_FILES_PATH = - "${rt_core_sdk_root}/devices/${deviceBoardName}/utilities" - UTILITIES_ASSERT_FILES_PATH = "${UTILITIES_FILES_PATH}/assert" - UTILITIES_SHELL_FILES_PATH = "${UTILITIES_FILES_PATH}/shell" - DEBUG_CONSOLE_FILES_PATH = "${UTILITIES_FILES_PATH}/debug_console_lite" - FORMAT_FILES_PATH = "${UTILITIES_FILES_PATH}/misc_utilities" - STR_FILES_PATH = "${UTILITIES_FILES_PATH}/str" - WIFI_BT_TEMPLATE_PATH = "${COMPONENT_FILES_PATH}/wifi_bt_module/template" -} - -ELS_PKC_CL_PATH = "${rt_sdk_root}/components/els_pkc/" - -template("rw61x_sdk_drivers") { - # Convert the CPU1/CPU2 fw binaries into src files - fw_bin_path = "${rt_sdk_root}/components/conn_fwloader" - fw_args = [ - "-t", - cpu1_cpu2_fw_type, - rebase_path(fw_bin_path, root_build_dir), - ] - - #In case A0 target board version, explicitly generate A0 fw binaries - if (board_version == "A0") { - fw_args += [ - "-r", - board_version, - ] - } - - print(exec_script( - "${rt_sdk_root}/components/conn_fwloader/script/fw_bin2c_conv.py", - fw_args, - "list lines")) - - config("${target_name}_config") { - include_dirs = [] - - if (defined(invoker.include_dirs)) { - include_dirs += invoker.include_dirs - } - - _rw61x_sdk_drivers_include_dirs = [ - #Drivers files - "${DRIVER_DEVICE_FILES_PATH}", - "${rt_core_sdk_root}/devices/${deviceBoardName}", - "${COMPONENT_CRC_FILES_PATH}", - "${COMPONENT_RNG_FILES_PATH}", - "${COMPONENT_RPMSG_FILES_PATH}", - "${COMPONENT_UART_FILES_PATH}", - "${COMPONENT_TIMER_FILES_PATH}", - "${COMPONENT_GPIO_FILES_PATH}", - "${COMPONENT_SILICON_ID_FILES_PATH}", - "${COMPONENT_SILICON_ID_SOCS_FILES_PATH}", - "${COMPONENT_MEM_MANAGER_FILES_PATH}", - "${DRIVER_COMMON_FILES_PATH}", - "${DRIVER_FLEXCOMM_FILES_PATH}", - "${DRIVER_USART_FILES_PATH}", - "${DRIVER_LPC_GPIO_FILES_PATH}", - "${DRIVER_DCP_FILES_PATH}", - "${DRIVER_ENET_FILES_PATH}", - "${DRIVER_CACHE_FILES_PATH}", - "${DRIVER_MRT_FILES_PATH}", - "${DRIVER_TRNG_FILES_PATH}", - "${DRIVER_FLEXSPI_FILES_PATH}", - "${DRIVER_DMA_FILES_PATH}", - "${UTILITIES_FILES_PATH}", - "${UTILITIES_DEVICE_FILES_PATH}", - "${DEBUG_CONSOLE_FILES_PATH}", - "${FORMAT_FILES_PATH}", - "${STR_FILES_PATH}", - "${DRIVER_IMU_FILES_PATH}", - "${DRIVER_GDMA_FILES_PATH}", - "${DRIVER_INPUTMUX_FILES_PATH}", - "${DRIVER_PINT_FILES_PATH}", - - # XIP - "${rt_core_sdk_root}/components/flash/mflash", - "${rt_core_sdk_root}/components/flash/mflash/rdrw612bga", - - # loader files - "${rt_core_sdk_root}/components/conn_fwloader/include", - - #power manager - "${rt_core_sdk_root}/components/power_manager/core", - "${rt_core_sdk_root}/components/power_manager/devices/RW612", - - #flash config - "${rt_core_sdk_root}/boards/rdrw612bga/flash_config", - - # freertos - "${rt_sdk_freertos_kernel}/portable/GCC/ARM_CM33_NTZ/non_secure", - - # framework - "${rt_sdk_root}/middleware/wireless/framework/platform/${rt_fwk_platform}/configs", - "${rt_sdk_root}/middleware/wireless/framework/FactoryDataProvider", - ] - - libs = [] - - if (defined(invoker.defines)) { - defines += invoker.defines - } else { - defines = [] - } - - defines += [ - "CPU_RW612ETA1I", - "CPU3", - "FSL_RTOS_FREE_RTOS", - - # when DEBUG_CONSOLE_TRANSFER_NON_BLOCKING is defined - # SERIAL_MANAGER_NON_BLOCKING_MODE is set to 1 by default - #"SERIAL_MANAGER_NON_BLOCKING_MODE=1", - "IMU_TASK_STACK_SIZE=1024", - "RPMSG_TXQ_BUFSIZE=16", - "RPMSG_TXQ_BUFLENGTH=256", - "gMemManagerLightExtendHeapAreaUsage=1", - "APP_FLEXSPI_AMBA_BASE=0x08000000", - "gAspCapability_d=1", - "FFU_CNS_TX_PWR_TABLE_CALIBRATION=1", - "USE_RTOS=1", - "BOOT_HEADER_ENABLE=1", - "WIFI_BOARD_RW610", - - # This allows the CPU1/CPU2 fw to be embedded in the application - "gPlatformMonolithicApp_d=1", - ] - - if (board_version != "A1") { - defines += [ "RW610_A1=0" ] - } - - if (rw610_mbedtls_port_els_pkc) { - defines += [ - # needed to compile els_pkc port for mbedtls - "MBEDTLS_MCUX_ELS_PKC_API", - ] - _rw61x_sdk_drivers_include_dirs += [ - "${ELS_PKC_CL_PATH}", - "${ELS_PKC_CL_PATH}/src/compiler", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClAead/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClAead/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClAeadModes/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClAeadModes/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClAes/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClAes/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClCipher/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClCipher/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClCipherModes/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClCipherModes/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClCore/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEls/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEls/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClHash/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClHashModes/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClHashModes/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClHmac/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClKey/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMac/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMac/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMacModes/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMacModes/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMath/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMath/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMemory/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClPadding/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClPadding/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClPkc/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClPkc/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClPrng/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClPrng/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRandom/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRandom/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRandomModes/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRandomModes/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClSession/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClSession/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClTrng/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClTrng/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxCsslCPreProcessor/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxCsslDataIntegrity/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxCsslFlowProtection/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxCsslMemory/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxCsslMemory/inc/internal", - "${ELS_PKC_CL_PATH}/src/comps/mcuxCsslParamIntegrity/inc", - "${ELS_PKC_CL_PATH}/src/comps/mcuxCsslSecureCounter/inc", - "${ELS_PKC_CL_PATH}/src/inc", - "${ELS_PKC_CL_PATH}/src/inc/impl", - "${ELS_PKC_CL_PATH}/src/platforms/rw61x", - "${ELS_PKC_CL_PATH}/src/platforms/rw61x/inc", - ] - } - - if (chip_enable_wifi) { - _rw61x_sdk_drivers_include_dirs += [ - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver", - - # Include lpm.h and host_sleep.h files - "${rt_sdk_root}/boards/rdrw612bga/wifi_examples/common/lpm", - - # wifi config file path - "${WIFI_BT_TEMPLATE_PATH}", - ] - } - - if (chip_enable_ble) { - libs += [ - #ethermind bt libs - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/lib/mcux/default/ble/cm33nodsp/gcc/libethermind_ble_core.a", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/lib/mcux/default/ble/cm33nodsp/gcc/libethermind_ble_gatt.a", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/lib/mcux/default/ble/cm33nodsp/gcc/libethermind_ble_protocol.a", - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/private/lib/mcux/default/ble/cm33nodsp/gcc/libethermind_ble_util.a", - ] - defines += [ - "gPlatformDisableBleLowPower_d=1", - "BT_PLATFORM", - "GATT_DB", - "CFG_BLE", - ] - } - - if (chip_enable_matter_cli) { - #When the CLI is enabled the debug console should be moved in UART0 for RW61x - defines += [ "DEBUG_CONSOLE_UART_INDEX=0" ] - } - - if (chip_enable_openthread) { - if (!spinel_interface_rpmsg) { - _rw61x_sdk_drivers_include_dirs += [ - "${rt_sdk_root}/middleware/wireless/ieee-802.15.4/ieee_802_15_4/phy/interface", - "${rt_sdk_root}/middleware/wireless/ieee-802.15.4/ieee_802_15_4/phy/source/RW610N/RW610_RPMSG", - "${rt_sdk_root}/middleware/wireless/ieee-802.15.4/utils", - ] - } else { - defines += [ "SPINEL_INTERFACE_RPMSG" ] - } - } - - cflags = [] - cflags_c = [] - - if (defined(invoker.cflags)) { - cflags += invoker.cflags - } - - cflags_c += [ - "-Wno-unused-variable", - "-Wno-int-in-bool-context", - "-Wno-memset-elt-size", - "-Wno-parentheses", - "-Wno-vla", - "-Wno-cpp", - "-Wno-int-conversion", - "-Wno-error", - ] - - # Now add our "system-header" include dirs - foreach(include_dir, _rw61x_sdk_drivers_include_dirs) { - cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] - } - } - - source_set(target_name) { - forward_variables_from(invoker, "*") - - if (!defined(sources)) { - sources = [] - } - - sources += [ - "${COMPONENT_CRC_FILES_PATH}/fsl_adapter_software_crc.c", - "${COMPONENT_GPIO_FILES_PATH}/fsl_adapter_lpc_gpio.c", - "${COMPONENT_MEM_MANAGER_FILES_PATH}/fsl_component_mem_manager_light.c", - - #"${COMPONENT_RNG_FILES_PATH}/fsl_adapter_trng.c", - "${COMPONENT_RNG_FILES_PATH}/fsl_adapter_software_rng.c", - "${COMPONENT_RPMSG_FILES_PATH}/fsl_adapter_rfimu.c", - "${COMPONENT_SILICON_ID_FILES_PATH}/fsl_silicon_id.c", - "${COMPONENT_TIMER_FILES_PATH}/fsl_adapter_mrt.c", - "${COMPONENT_UART_FILES_PATH}/fsl_adapter_usart.c", - "${DEBUG_CONSOLE_FILES_PATH}/fsl_debug_console.c", - "${DRIVER_CACHE_FILES_PATH}/fsl_cache.c", - "${DRIVER_COMMON_FILES_PATH}/fsl_common.c", - "${DRIVER_COMMON_FILES_PATH}/fsl_common_arm.c", - "${DRIVER_DEVICE_FILES_PATH}/fsl_clock.c", - "${DRIVER_DEVICE_FILES_PATH}/fsl_ocotp.c", - "${DRIVER_DEVICE_FILES_PATH}/fsl_power.c", - "${DRIVER_DEVICE_FILES_PATH}/fsl_reset.c", - "${DRIVER_ENET_FILES_PATH}/fsl_enet.c", - "${DRIVER_FLEXCOMM_FILES_PATH}/fsl_flexcomm.c", - "${DRIVER_FLEXSPI_FILES_PATH}/fsl_flexspi.c", - "${DRIVER_GDMA_FILES_PATH}/fsl_gdma.c", - "${DRIVER_IMU_FILES_PATH}/fsl_imu.c", - "${DRIVER_INPUTMUX_FILES_PATH}/fsl_inputmux.c", - "${DRIVER_LPC_GPIO_FILES_PATH}/fsl_gpio.c", - "${DRIVER_MRT_FILES_PATH}/fsl_mrt.c", - "${DRIVER_PINT_FILES_PATH}/fsl_pint.c", - "${DRIVER_TRNG_FILES_PATH}/fsl_trng.c", - "${DRIVER_USART_FILES_PATH}/fsl_usart.c", - "${DRIVER_USART_FILES_PATH}/fsl_usart_dma.c", - "${FORMAT_FILES_PATH}/fsl_format.c", - "${UTILITIES_SHELL_FILES_PATH}/fsl_shell.c", - - #sdk hook - "${nxp_sdk_build_root}/${nxp_sdk_name}/sdk_hook/zephyr/kernel.c", - "${rt_core_sdk_root}/boards/rdrw612bga/flash_config/flash_config.c", - - # Loader files - "${rt_core_sdk_root}/components/conn_fwloader/fsl_loader.c", - "${rt_core_sdk_root}/components/conn_fwloader/life_cycle.c", - "${rt_core_sdk_root}/components/conn_fwloader/nboot_hal.c", - "${rt_core_sdk_root}/components/flash/mflash/rdrw612bga/mflash_drv.c", - - # comment fsl_str.c if using debug console light - #"${STR_FILES_PATH}/fsl_str.c", - # flash - "${rt_core_sdk_root}/components/internal_flash/rdrw612bga/fsl_adapter_flexspi_nor_flash.c", - - # power manager - "${rt_core_sdk_root}/components/power_manager/core/fsl_pm_core.c", - - #startup files - "${rt_core_sdk_root}/devices/${deviceBoardName}/gcc/startup_${deviceBoardName}.S", - "${rt_core_sdk_root}/devices/${deviceBoardName}/system_${deviceBoardName}.c", - - # freertos files - "${rt_sdk_freertos_kernel}/portable/GCC/ARM_CM33_NTZ/non_secure/port.c", - "${rt_sdk_freertos_kernel}/portable/GCC/ARM_CM33_NTZ/non_secure/portasm.c", - "${rt_sdk_freertos_kernel}/portable/MemMang/heap_4.c", - - # fw binaries for cpu1/cpu2 - "${rt_sdk_root}/components/conn_fwloader/${board_version}/fw_cpu1.c", - "${rt_sdk_root}/components/conn_fwloader/${board_version}/fw_cpu2_ble.c", - "${rt_sdk_root}/components/conn_fwloader/${board_version}/fw_cpu2_combo.c", - - # this platform file is needed for BLE/15.4 Controller wake up - "${rt_sdk_root}/middleware/wireless/framework/platform/${rt_fwk_platform}/fwk_platform_ble.c", - - # framework coex file to initialize controllers - "${rt_sdk_root}/middleware/wireless/framework/platform/${rt_fwk_platform}/fwk_platform_coex.c", - ] - - if (sdk_fsl_assert_support) { - sources += [ "${UTILITIES_ASSERT_FILES_PATH}/fsl_assert.c" ] - } - - if (rw610_mbedtls_port_els_pkc) { - # els_pkc component for mbedtls els_pkc port - sources += [ - "${ELS_PKC_CL_PATH}/src/comps/mcuxClAead/src/mcuxClAead.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClAeadModes/src/mcuxClAeadModes_Els_AesCcm.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClAeadModes/src/mcuxClAeadModes_Els_AesGcm.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClAeadModes/src/mcuxClAeadModes_Els_CcmEngineAes.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClAeadModes/src/mcuxClAeadModes_Els_GcmEngineAes.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClAeadModes/src/mcuxClAeadModes_Els_Modes.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClAeadModes/src/mcuxClAeadModes_Els_Multipart.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClAeadModes/src/mcuxClAeadModes_Els_Oneshot.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClAes/src/mcuxClAes_KeyTypes.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClCipher/src/mcuxClCipher.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClCipherModes/src/mcuxClCipherModes_Els_Aes.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClCipherModes/src/mcuxClCipherModes_Els_EngineAes.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClCipherModes/src/mcuxClCipherModes_Helper.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClCipherModes/src/mcuxClCipherModes_Modes.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Constants.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_EdDSA_GenerateKeyPair.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_EdDSA_GenerateKeyPair_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_EdDSA_GenerateSignature.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_EdDSA_GenerateSignatureMode.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_EdDSA_GenerateSignature_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_EdDSA_InitPrivKeyInputMode.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_EdDSA_Internal_CalcHashModN.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_EdDSA_Internal_CalcHashModN_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_EdDSA_Internal_DecodePoint_Ed25519.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_EdDSA_Internal_DecodePoint_Ed448.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_EdDSA_Internal_DecodePoint_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_EdDSA_Internal_SetupEnvironment.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_EdDSA_Internal_SignatureMechanisms.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_EdDSA_VerifySignature.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Internal_BlindedScalarMult.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Internal_Convert_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Internal_GenerateMultiplicativeBlinding.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Internal_InterleaveScalar.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Internal_InterleaveTwoScalars.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Internal_Interleave_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Internal_PointComparison_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Internal_RecodeAndReorderScalar.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Internal_SetupEnvironment.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Internal_SetupEnvironment_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Internal_Types.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_KeyTypes.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Mont_DhKeyAgreement.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Mont_DhKeyGeneration.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Mont_Internal_DhSetupEnvironment.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Mont_Internal_MontDhX.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Mont_Internal_MontDhX_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Mont_Internal_SecureScalarMult_XZMontLadder.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Mont_Internal_SecureScalarMult_XZMontLadder_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_SignatureMechanisms.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_TwEd_Internal_FixScalarMult.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_TwEd_Internal_PlainFixScalarMult25519.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_TwEd_Internal_PlainPtrSelectComb.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_TwEd_Internal_PlainPtrSelectML.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_TwEd_Internal_PlainVarScalarMult.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_TwEd_Internal_PointArithmeticEd25519.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_TwEd_Internal_PointArithmeticEd25519_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_TwEd_Internal_PointSubtraction_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_TwEd_Internal_PointValidation_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_TwEd_Internal_PrecPointImportAndValidate.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_TwEd_Internal_VarScalarMult.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_TwEd_Internal_VarScalarMult_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_WeierECC_Internal_GenerateCustomKeyType.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_WeierECC_Internal_GenerateDomainParams.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_WeierECC_Internal_GenerateDomainParams_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_WeierECC_Internal_SetupEnvironment.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_Internal_ConvertPoint_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_Internal_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_Internal_KeyGen.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_Internal_KeyGen_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_Internal_PointArithmetic.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_Internal_PointArithmetic_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_Internal_PointCheck.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_Internal_PointCheck_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_Internal_PointMult.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_Internal_SecurePointMult_CoZMontLadder.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_Internal_SecurePointMult_CoZMontLadder_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_Internal_SetupEnvironment.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_KeyGen.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_KeyGen_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_PointMult.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_PointMult_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_Sign.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_Sign_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_Verify.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEcc/src/mcuxClEcc_Weier_Verify_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEls/src/mcuxClEls_Aead.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEls/src/mcuxClEls_Cipher.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEls/src/mcuxClEls_Cmac.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEls/src/mcuxClEls_Common.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEls/src/mcuxClEls_Ecc.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEls/src/mcuxClEls_GlitchDetector.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEls/src/mcuxClEls_Hash.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEls/src/mcuxClEls_Hmac.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEls/src/mcuxClEls_Kdf.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEls/src/mcuxClEls_KeyManagement.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClEls/src/mcuxClEls_Rng.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClHash/src/mcuxClHash_api_multipart_common.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClHash/src/mcuxClHash_api_multipart_compute.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClHash/src/mcuxClHash_api_oneshot_compute.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClHashModes/src/mcuxClHashModes_Core_els_sha2.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClHashModes/src/mcuxClHashModes_Internal_els_sha2.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClHmac/src/mcuxClHmac_Els.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClHmac/src/mcuxClHmac_Functions.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClHmac/src/mcuxClHmac_Helper.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClHmac/src/mcuxClHmac_KeyTypes.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClHmac/src/mcuxClHmac_Modes.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClHmac/src/mcuxClHmac_Sw.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClKey/src/mcuxClKey.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClKey/src/mcuxClKey_Protection.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMac/src/mcuxClMac.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMacModes/src/mcuxClMacModes.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMacModes/src/mcuxClMacModes_Els_Cbcmac.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMacModes/src/mcuxClMacModes_Els_Cmac.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMacModes/src/mcuxClMacModes_Els_Functions.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMacModes/src/mcuxClMacModes_Modes.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMath/src/mcuxClMath_ExactDivide.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMath/src/mcuxClMath_ExactDivideOdd.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMath/src/mcuxClMath_ExactDivideOdd_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMath/src/mcuxClMath_ModExp_SqrMultL2R.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMath/src/mcuxClMath_ModInv.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMath/src/mcuxClMath_ModInv_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMath/src/mcuxClMath_NDash.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMath/src/mcuxClMath_NDash_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMath/src/mcuxClMath_QDash.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMath/src/mcuxClMath_QDash_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMath/src/mcuxClMath_ReduceModEven.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMath/src/mcuxClMath_SecModExp.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMath/src/mcuxClMath_SecModExp_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMath/src/mcuxClMath_Utils.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClMemory/src/mcuxClMemory.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClPadding/src/mcuxClPadding.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClPkc/src/mcuxClPkc_Calculate.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClPkc/src/mcuxClPkc_ImportExport.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClPkc/src/mcuxClPkc_Initialize.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClPkc/src/mcuxClPkc_UPTRT.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClPrng/src/mcuxClPrng_ELS.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRandom/src/mcuxClRandom_DRBG.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRandom/src/mcuxClRandom_PRNG.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRandomModes/src/mcuxClRandomModes_CtrDrbg.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRandomModes/src/mcuxClRandomModes_CtrDrbg_Els.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRandomModes/src/mcuxClRandomModes_CtrDrbg_PrDisabled.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRandomModes/src/mcuxClRandomModes_ElsMode.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRandomModes/src/mcuxClRandomModes_NormalMode.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRandomModes/src/mcuxClRandomModes_PatchMode.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRandomModes/src/mcuxClRandomModes_PrDisabled.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRandomModes/src/mcuxClRandomModes_TestMode.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_ComputeD.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_ComputeD_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_GenerateProbablePrime.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_KeyGeneration_Crt.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_KeyGeneration_Crt_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_KeyGeneration_Plain.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_Mgf1.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_MillerRabinTest.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_MillerRabinTest_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_ModInv.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_NoEncode.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_NoVerify.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_Pkcs1v15Encode_sign.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_Pkcs1v15Verify.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_PrivateCrt.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_PrivateCrt_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_PrivatePlain.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_PssEncode.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_PssVerify.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_Public.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_Public_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_RemoveBlinding.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_RemoveBlinding_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_Sign.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_TestPQDistance.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_TestPQDistance_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_TestPrimeCandidate.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_TestPrimeCandidate_FUP.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_Verify.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClRsa/src/mcuxClRsa_VerifyE.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClSession/src/mcuxClSession.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxClTrng/src/mcuxClTrng_SA_TRNG.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxCsslMemory/src/mcuxCsslMemory_Clear.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxCsslMemory/src/mcuxCsslMemory_Compare.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxCsslMemory/src/mcuxCsslMemory_Copy.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxCsslMemory/src/mcuxCsslMemory_Internal_SecureCompare_Stub.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxCsslMemory/src/mcuxCsslMemory_Set.c", - "${ELS_PKC_CL_PATH}/src/comps/mcuxCsslParamIntegrity/src/mcuxCsslParamIntegrity.c", - "${ELS_PKC_CL_PATH}/src/platforms/rw61x/mcux_els.c", - "${ELS_PKC_CL_PATH}/src/platforms/rw61x/mcux_pkc.c", - ] - } - - if (chip_enable_ble) { - sources += [ - "${rt_sdk_root}/middleware/wireless/ethermind/bluetooth/export/extension/gatt_db_pl.c", - "${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/bluetooth/controller/controller_rw610.c", - "${rt_sdk_root}/middleware/wireless/ethermind/port/pal/mcux/bluetooth/hci_platform.c", - ] - } - - if (chip_enable_wifi) { - sources += [ - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_11ax.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_11k.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_11v.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_action.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/mlan_mbo.c", - "${rt_sdk_root}/middleware/wifi_nxp/wifidriver/wifi-imu.c", - ] - } - - if (chip_enable_openthread) { - sources += [ - "${rt_sdk_root}/middleware/wireless/framework/platform/${rt_fwk_platform}/fwk_platform_hdlc.c", - "${rt_sdk_root}/middleware/wireless/framework/platform/${rt_fwk_platform}/fwk_platform_ot.c", - ] - if (!spinel_interface_rpmsg) { - sources += [ - "${rt_sdk_root}/middleware/wireless/ieee-802.15.4/ieee_802_15_4/phy/source/RW610N/RW610_RPMSG/ASP.c", - "${rt_sdk_root}/middleware/wireless/ieee-802.15.4/ieee_802_15_4/phy/source/RW610N/RW610_RPMSG/Phy.c", - ] - } - } - - if (!defined(public_configs)) { - public_configs = [] - } - - if (!defined(public_deps)) { - public_deps = [] - } - - if (!defined(deps)) { - deps = [] - } - - public_configs += [ ":${target_name}_config" ] - public_deps += [ nxp_sdk_target ] - - if (chip_enable_openthread) { - #Dep to ot header files required for mbedtls as mbedtls config file has a dependency to ot - deps += [ "${openthread_root}/src/core:libopenthread_core_headers" ] - } - } -} diff --git a/third_party/nxp/rt_sdk/sdk_hook/bt_pal/EM_platform.h b/third_party/nxp/rt_sdk/sdk_hook/bt_pal/EM_platform.h deleted file mode 100644 index 5d85b366aeb486..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/bt_pal/EM_platform.h +++ /dev/null @@ -1,22 +0,0 @@ - -/** - * \file EM_platform.h - * - * - */ - -/* - * Copyright 2022 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef _H_EM_PLATFORM_HOOK -#define _H_EM_PLATFORM_HOOK - -#include "mcux/EM_platform.h" -#undef EM_HAVE_STATIC_DECL - -#endif /* _H_EM_PLATFORM_HOOK */ diff --git a/third_party/nxp/rt_sdk/sdk_hook/fatfs/config/ffconf.h b/third_party/nxp/rt_sdk/sdk_hook/fatfs/config/ffconf.h deleted file mode 100644 index 7138317b86f169..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/fatfs/config/ffconf.h +++ /dev/null @@ -1,302 +0,0 @@ -/*----------------------------------------------------------------------------/ -/ FatFs - Generic FAT Filesystem Module R0.14b / -/-----------------------------------------------------------------------------/ -/ -/ Copyright (C) 2021, ChaN, all right reserved. -/ Copyright 2023 NXP -/ -/ -/ FatFs module is an open source software. Redistribution and use of FatFs in -/ source and binary forms, with or without modification, are permitted provided -/ that the following condition is met: -/ -/ 1. Redistributions of source code must retain the above copyright notice, -/ this condition and the following disclaimer. -/ -/ This software is provided by the copyright holder and contributors "AS IS" -/ and any warranties related to this software are DISCLAIMED. -/ The copyright owner or contributors be NOT LIABLE for any damages caused -/ by use of this software. -/ -/----------------------------------------------------------------------------*/ - -#ifndef _FFCONF_H_ -#define _FFCONF_H_ - -/*---------------------------------------------------------------------------/ -/ FatFs Functional Configurations -/---------------------------------------------------------------------------*/ - -#define FFCONF_DEF 80286 /* Revision ID */ - -/*---------------------------------------------------------------------------/ -/ MSDK adaptation configuration -/---------------------------------------------------------------------------*/ -#define USB_DISK_ENABLE - -/*---------------------------------------------------------------------------/ -/ Function Configurations -/---------------------------------------------------------------------------*/ - -#define FF_FS_READONLY 0 -/* This option switches read-only configuration. (0:Read/Write or 1:Read-only) -/ Read-only configuration removes writing API functions, f_write(), f_sync(), -/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree() -/ and optional writing functions as well. */ - -#define FF_FS_MINIMIZE 0 -/* This option defines minimization level to remove some basic API functions. -/ -/ 0: Basic functions are fully enabled. -/ 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename() -/ are removed. -/ 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1. -/ 3: f_lseek() function is removed in addition to 2. */ - -#define FF_USE_STRFUNC 1 -/* This option switches string functions, f_gets(), f_putc(), f_puts() and f_printf(). -/ -/ 0: Disable string functions. -/ 1: Enable without LF-CRLF conversion. -/ 2: Enable with LF-CRLF conversion. */ - -#define FF_USE_FIND 0 -/* This option switches filtered directory read functions, f_findfirst() and -/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */ - -#define FF_USE_MKFS 0 -/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */ - -#define FF_USE_FASTSEEK 0 -/* This option switches fast seek function. (0:Disable or 1:Enable) */ - -#define FF_USE_EXPAND 0 -/* This option switches f_expand function. (0:Disable or 1:Enable) */ - -#define FF_USE_CHMOD 1 -/* This option switches attribute manipulation functions, f_chmod() and f_utime(). -/ (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */ - -#define FF_USE_LABEL 0 -/* This option switches volume label functions, f_getlabel() and f_setlabel(). -/ (0:Disable or 1:Enable) */ - -#define FF_USE_FORWARD 0 -/* This option switches f_forward() function. (0:Disable or 1:Enable) */ - -/*---------------------------------------------------------------------------/ -/ Locale and Namespace Configurations -/---------------------------------------------------------------------------*/ - -#define FF_CODE_PAGE 932 -/* This option specifies the OEM code page to be used on the target system. -/ Incorrect code page setting can cause a file open failure. -/ -/ 437 - U.S. -/ 720 - Arabic -/ 737 - Greek -/ 771 - KBL -/ 775 - Baltic -/ 850 - Latin 1 -/ 852 - Latin 2 -/ 855 - Cyrillic -/ 857 - Turkish -/ 860 - Portuguese -/ 861 - Icelandic -/ 862 - Hebrew -/ 863 - Canadian French -/ 864 - Arabic -/ 865 - Nordic -/ 866 - Russian -/ 869 - Greek 2 -/ 932 - Japanese (DBCS) -/ 936 - Simplified Chinese (DBCS) -/ 949 - Korean (DBCS) -/ 950 - Traditional Chinese (DBCS) -/ 0 - Include all code pages above and configured by f_setcp() -*/ - -#define FF_USE_LFN 1 -#define FF_MAX_LFN 255 -/* The FF_USE_LFN switches the support for LFN (long file name). -/ -/ 0: Disable LFN. FF_MAX_LFN has no effect. -/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe. -/ 2: Enable LFN with dynamic working buffer on the STACK. -/ 3: Enable LFN with dynamic working buffer on the HEAP. -/ -/ To enable the LFN, ffunicode.c needs to be added to the project. The LFN function -/ requiers certain internal working buffer occupies (FF_MAX_LFN + 1) * 2 bytes and -/ additional (FF_MAX_LFN + 44) / 15 * 32 bytes when exFAT is enabled. -/ The FF_MAX_LFN defines size of the working buffer in UTF-16 code unit and it can -/ be in range of 12 to 255. It is recommended to be set it 255 to fully support LFN -/ specification. -/ When use stack for the working buffer, take care on stack overflow. When use heap -/ memory for the working buffer, memory management functions, ff_memalloc() and -/ ff_memfree() exemplified in ffsystem.c, need to be added to the project. */ - -#define FF_LFN_UNICODE 0 -/* This option switches the character encoding on the API when LFN is enabled. -/ -/ 0: ANSI/OEM in current CP (TCHAR = char) -/ 1: Unicode in UTF-16 (TCHAR = WCHAR) -/ 2: Unicode in UTF-8 (TCHAR = char) -/ 3: Unicode in UTF-32 (TCHAR = DWORD) -/ -/ Also behavior of string I/O functions will be affected by this option. -/ When LFN is not enabled, this option has no effect. */ - -#define FF_LFN_BUF 255 -#define FF_SFN_BUF 12 -/* This set of options defines size of file name members in the FILINFO structure -/ which is used to read out directory items. These values should be suffcient for -/ the file names to read. The maximum possible length of the read file name depends -/ on character encoding. When LFN is not enabled, these options have no effect. */ - -#define FF_STRF_ENCODE 3 -/* When FF_LFN_UNICODE >= 1 with LFN enabled, string I/O functions, f_gets(), -/ f_putc(), f_puts and f_printf() convert the character encoding in it. -/ This option selects assumption of character encoding ON THE FILE to be -/ read/written via those functions. -/ -/ 0: ANSI/OEM in current CP -/ 1: Unicode in UTF-16LE -/ 2: Unicode in UTF-16BE -/ 3: Unicode in UTF-8 -*/ - -#define FF_FS_RPATH 0 -/* This option configures support for relative path. -/ -/ 0: Disable relative path and remove related functions. -/ 1: Enable relative path. f_chdir() and f_chdrive() are available. -/ 2: f_getcwd() function is available in addition to 1. -*/ - -/*---------------------------------------------------------------------------/ -/ Drive/Volume Configurations -/---------------------------------------------------------------------------*/ - -#define FF_VOLUMES 3 -/* Number of volumes (logical drives) to be used. (1-10) */ - -#define FF_STR_VOLUME_ID 0 -#define FF_VOLUME_STRS "RAM", "NAND", "CF", "SD", "SD2", "USB", "USB2", "USB3" -/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings. -/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive -/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each -/ logical drives. Number of items must not be less than FF_VOLUMES. Valid -/ characters for the volume ID strings are A-Z, a-z and 0-9, however, they are -/ compared in case-insensitive. If FF_STR_VOLUME_ID >= 1 and FF_VOLUME_STRS is -/ not defined, a user defined volume string table needs to be defined as: -/ -/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",... -*/ - -#define FF_MULTI_PARTITION 0 -/* This option switches support for multiple volumes on the physical drive. -/ By default (0), each logical drive number is bound to the same physical drive -/ number and only an FAT volume found on the physical drive will be mounted. -/ When this function is enabled (1), each logical drive number can be bound to -/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk() -/ funciton will be available. */ - -#define FF_MIN_SS 512 -#define FF_MAX_SS 4096 -/* This set of options configures the range of sector size to be supported. (512, -/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and -/ harddisk. But a larger value may be required for on-board flash memory and some -/ type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured -/ for variable sector size mode and disk_ioctl() function needs to implement -/ GET_SECTOR_SIZE command. */ - -#define FF_LBA64 0 -/* This option switches support for 64-bit LBA. (0:Disable or 1:Enable) -/ To enable the 64-bit LBA, also exFAT needs to be enabled. (FF_FS_EXFAT == 1) */ - -#define FF_MIN_GPT 0x100000000 -/* Minimum number of sectors to switch GPT format to create partition in f_mkfs and -/ f_fdisk function. 0x100000000 max. This option has no effect when FF_LBA64 == 0. */ - -#define FF_USE_TRIM 0 -/* This option switches support for ATA-TRIM. (0:Disable or 1:Enable) -/ To enable Trim function, also CTRL_TRIM command should be implemented to the -/ disk_ioctl() function. */ - -/*---------------------------------------------------------------------------/ -/ System Configurations -/---------------------------------------------------------------------------*/ - -#define FF_FS_TINY 0 -/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny) -/ At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes. -/ Instead of private sector buffer eliminated from the file object, common sector -/ buffer in the filesystem object (FATFS) is used for the file data transfer. */ - -#define FF_FS_EXFAT 0 -/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable) -/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1) -/ Note that enabling exFAT discards ANSI C (C89) compatibility. */ - -#define FF_FS_NORTC 1 -#define FF_NORTC_MON 1 -#define FF_NORTC_MDAY 1 -#define FF_NORTC_YEAR 2018 -/* The option FF_FS_NORTC switches timestamp functiton. If the system does not have -/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable -/ the timestamp function. Every object modified by FatFs will have a fixed timestamp -/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time. -/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be -/ added to the project to read current time form real-time clock. FF_NORTC_MON, -/ FF_NORTC_MDAY and FF_NORTC_YEAR have no effect. -/ These options have no effect in read-only configuration (FF_FS_READONLY = 1). */ - -#define FF_FS_NOFSINFO 0 -/* If you need to know correct free space on the FAT32 volume, set bit 0 of this -/ option, and f_getfree() function at first time after volume mount will force -/ a full FAT scan. Bit 1 controls the use of last allocated cluster number. -/ -/ bit0=0: Use free cluster count in the FSINFO if available. -/ bit0=1: Do not trust free cluster count in the FSINFO. -/ bit1=0: Use last allocated cluster number in the FSINFO if available. -/ bit1=1: Do not trust last allocated cluster number in the FSINFO. -*/ - -#define FF_FS_LOCK 0 -/* The option FF_FS_LOCK switches file lock function to control duplicated file open -/ and illegal operation to open objects. This option must be 0 when FF_FS_READONLY -/ is 1. -/ -/ 0: Disable file lock function. To avoid volume corruption, application program -/ should avoid illegal open, remove and rename to the open objects. -/ >0: Enable file lock function. The value defines how many files/sub-directories -/ can be opened simultaneously under file lock control. Note that the file -/ lock control is independent of re-entrancy. */ - -#define FF_FS_REENTRANT 0 -#define FF_FS_TIMEOUT 5000 -#if FF_FS_REENTRANT -#include "FreeRTOS.h" -#include "semphr.h" -#define FF_SYNC_t SemaphoreHandle_t -#endif -/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs -/ module itself. Note that regardless of this option, file access to different -/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs() -/ and f_fdisk() function, are always not re-entrant. Only file/directory access -/ to the same volume is under control of this function. -/ -/ 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect. -/ 1: Enable re-entrancy. Also user provided synchronization handlers, -/ ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj() -/ function, must be added to the project. Samples are available in -/ option/syscall.c. -/ -/ The FF_FS_TIMEOUT defines timeout period in unit of time tick. -/ The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*, -/ SemaphoreHandle_t and etc. A header file for O/S definitions needs to be -/ included somewhere in the scope of ff.h. */ - -/*--- End of configuration options ---*/ - -#endif /* _FFCONF_H_ */ diff --git a/third_party/nxp/rt_sdk/sdk_hook/littlefs_pl.c b/third_party/nxp/rt_sdk/sdk_hook/littlefs_pl.c deleted file mode 100644 index b25469e343080a..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/littlefs_pl.c +++ /dev/null @@ -1,16 +0,0 @@ - -/* - * Copyright 2021 - 2022 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "littlefs_pl.h" -#include "lfs.h" -// #include "fwk_filesystem.h" - -/*lfs_t * lfs_pl_init(void) -{ - return (lfs_t*)FS_InitGetHandle(); -}*/ diff --git a/third_party/nxp/rt_sdk/sdk_hook/mbedtls/ksdk_mbedtls_hook.c b/third_party/nxp/rt_sdk/sdk_hook/mbedtls/ksdk_mbedtls_hook.c deleted file mode 100644 index b72121566bc312..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/mbedtls/ksdk_mbedtls_hook.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2023 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "fsl_common.h" -#include "fsl_trng.h" - -#define TRGN_MAX_RETRY 10 - -int __wrap_mbedtls_hardware_poll(void * data, unsigned char * output, size_t len, size_t * olen) -{ - status_t result = kStatus_Fail; - int nbRetry = 0; - - do - { - result = TRNG_GetRandomData(TRNG, output, len); - if (result == kStatus_Success) - break; - nbRetry++; - } while (nbRetry < TRGN_MAX_RETRY); - - if (result == kStatus_Success) - { - *olen = len; - return 0; - } - else - { - return result; - } -} diff --git a/third_party/nxp/rt_sdk/sdk_hook/mbedtls/ksdk_mbedtls_software.c b/third_party/nxp/rt_sdk/sdk_hook/mbedtls/ksdk_mbedtls_software.c deleted file mode 100644 index 3749cf1872ddac..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/mbedtls/ksdk_mbedtls_software.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright 2022 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif - -#include "mbedtls/platform.h" - -#if defined(MBEDTLS_THREADING_C) -/* Threading mutex implementations for mbedTLS. */ -#include "mbedtls/threading.h" -#include "threading_alt.h" -#endif - -#if !defined(MBEDTLS_MCUX_FREERTOS_THREADING_ALT) && defined(MBEDTLS_THREADING_C) && defined(MBEDTLS_THREADING_ALT) -extern void CRYPTO_ConfigureThreading(void); -#endif - -#include "fsl_adapter_rng.h" -#include "fsl_common.h" -#include "ksdk_mbedtls.h" - -/******************************************************************************/ -/*************************** FreeRTOS ********************************************/ -/******************************************************************************/ -#if defined(USE_RTOS) && defined(SDK_OS_FREE_RTOS) && defined(MBEDTLS_FREESCALE_FREERTOS_CALLOC_ALT) -#include "FreeRTOS.h" -#include "task.h" -#include - -/*---------HEAP_4 calloc --------------------------------------------------*/ -#if defined(configFRTOS_MEMORY_SCHEME) && (configFRTOS_MEMORY_SCHEME == 4) -void * pvPortCalloc(size_t num, size_t size) -{ - void * ptr; - - ptr = pvPortMalloc(num * size); - if (!ptr) - { - extern void vApplicationMallocFailedHook(void); - vApplicationMallocFailedHook(); - } - else - { - memset(ptr, 0, num * size); - } - return ptr; -} -#else // HEAP_3 -void * pvPortCalloc(size_t num, size_t size) -{ - void * pvReturn; - - vTaskSuspendAll(); - { - pvReturn = calloc(num, size); - traceMALLOC(pvReturn, size); - } - (void) xTaskResumeAll(); - -#if (configUSE_MALLOC_FAILED_HOOK == 1) - { - if (pvReturn == NULL) - { - extern void vApplicationMallocFailedHook(void); - vApplicationMallocFailedHook(); - } - } -#endif - - return pvReturn; -} -#endif // configFRTOS_MEMORY_SCHEME -#endif /* USE_RTOS && defined(SDK_OS_FREE_RTOS) && defined(MBEDTLS_FREESCALE_FREERTOS_CALLOC_ALT) */ - -/*-----------------------------------------------------------*/ -/*--------- mbedTLS threading functions for FreeRTOS --------*/ -/*--------------- See MBEDTLS_THREADING_ALT -----------------*/ -/*-----------------------------------------------------------*/ -#if defined(MBEDTLS_MCUX_FREERTOS_THREADING_ALT) -/* Threading mutex implementations for mbedTLS. */ -#include "mbedtls/threading.h" -#include "threading_alt.h" - -/** - * @brief Implementation of mbedtls_mutex_init for thread-safety. - * - */ -void mcux_mbedtls_mutex_init(mbedtls_threading_mutex_t * mutex) -{ - mutex->mutex = xSemaphoreCreateMutex(); - - if (mutex->mutex != NULL) - { - mutex->is_valid = 1; - } - else - { - mutex->is_valid = 0; - } -} - -/** - * @brief Implementation of mbedtls_mutex_free for thread-safety. - * - */ -void mcux_mbedtls_mutex_free(mbedtls_threading_mutex_t * mutex) -{ - if (mutex->is_valid == 1) - { - vSemaphoreDelete(mutex->mutex); - mutex->is_valid = 0; - } -} - -/** - * @brief Implementation of mbedtls_mutex_lock for thread-safety. - * - * @return 0 if successful, MBEDTLS_ERR_THREADING_MUTEX_ERROR if timeout, - * MBEDTLS_ERR_THREADING_BAD_INPUT_DATA if the mutex is not valid. - */ -int mcux_mbedtls_mutex_lock(mbedtls_threading_mutex_t * mutex) -{ - int ret = MBEDTLS_ERR_THREADING_BAD_INPUT_DATA; - - if (mutex->is_valid == 1) - { - if (xSemaphoreTake(mutex->mutex, portMAX_DELAY)) - { - ret = 0; - } - else - { - ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR; - } - } - - return ret; -} - -/** - * @brief Implementation of mbedtls_mutex_unlock for thread-safety. - * - * @return 0 if successful, MBEDTLS_ERR_THREADING_MUTEX_ERROR if timeout, - * MBEDTLS_ERR_THREADING_BAD_INPUT_DATA if the mutex is not valid. - */ -int mcux_mbedtls_mutex_unlock(mbedtls_threading_mutex_t * mutex) -{ - int ret = MBEDTLS_ERR_THREADING_BAD_INPUT_DATA; - - if (mutex->is_valid == 1) - { - if (xSemaphoreGive(mutex->mutex)) - { - ret = 0; - } - else - { - ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR; - } - } - - return ret; -} - -static void CRYPTO_ConfigureThreadingMcux(void) -{ - /* Configure mbedtls to use FreeRTOS mutexes. */ - mbedtls_threading_set_alt(mcux_mbedtls_mutex_init, mcux_mbedtls_mutex_free, mcux_mbedtls_mutex_lock, mcux_mbedtls_mutex_unlock); -} -#endif /* defined(MBEDTLS_MCUX_FREERTOS_THREADING_ALT) */ - -status_t CRYPTO_InitHardware(void) -{ -#if defined(MBEDTLS_THREADING_C) && defined(MBEDTLS_THREADING_ALT) - - CRYPTO_ConfigureThreadingMcux(); - -#endif /* (MBEDTLS_THREADING_C) && defined(MBEDTLS_THREADING_ALT) */ - - return kStatus_HAL_RngSuccess; -} - -int mbedtls_hardware_poll(void * data, unsigned char * output, size_t len, size_t * olen) -{ - hal_rng_status_t status; - - status = HAL_RngGetData(output, len); - - if (status == kStatus_HAL_RngSuccess) - { - *olen = len; - return 0; - } - return kStatus_Fail; -} diff --git a/third_party/nxp/rt_sdk/sdk_hook/zephyr/bluetooth/addr.h b/third_party/nxp/rt_sdk/sdk_hook/zephyr/bluetooth/addr.h deleted file mode 100644 index b3f0431f86291f..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/zephyr/bluetooth/addr.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2023 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#if defined(__cplusplus) -extern "C" { -#endif /* _cplusplus */ - -#include - -#if defined(__cplusplus) -} -#endif diff --git a/third_party/nxp/rt_sdk/sdk_hook/zephyr/bluetooth/bluetooth.h b/third_party/nxp/rt_sdk/sdk_hook/zephyr/bluetooth/bluetooth.h deleted file mode 100644 index 7a0ab815021f74..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/zephyr/bluetooth/bluetooth.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2023 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#if defined(__cplusplus) -extern "C" { -#endif /* _cplusplus */ - -#include - -#if defined(__cplusplus) -} -#endif diff --git a/third_party/nxp/rt_sdk/sdk_hook/zephyr/bluetooth/conn.h b/third_party/nxp/rt_sdk/sdk_hook/zephyr/bluetooth/conn.h deleted file mode 100644 index aca6ccd51d0650..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/zephyr/bluetooth/conn.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2023 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#if defined(__cplusplus) -extern "C" { -#endif /* _cplusplus */ - -#include - -#if defined(__cplusplus) -} -#endif diff --git a/third_party/nxp/rt_sdk/sdk_hook/zephyr/bluetooth/gatt.h b/third_party/nxp/rt_sdk/sdk_hook/zephyr/bluetooth/gatt.h deleted file mode 100644 index d8d26a93040183..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/zephyr/bluetooth/gatt.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2023 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#if defined(__cplusplus) -extern "C" { -#endif /* _cplusplus */ - -#include - -#if defined(__cplusplus) -} -#endif diff --git a/third_party/nxp/rt_sdk/sdk_hook/zephyr/bluetooth/hci.h b/third_party/nxp/rt_sdk/sdk_hook/zephyr/bluetooth/hci.h deleted file mode 100644 index effc18d6095571..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/zephyr/bluetooth/hci.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2023 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#if defined(__cplusplus) -extern "C" { -#endif /* _cplusplus */ - -#include - -#if defined(__cplusplus) -} -#endif diff --git a/third_party/nxp/rt_sdk/sdk_hook/zephyr/kernel.c b/third_party/nxp/rt_sdk/sdk_hook/zephyr/kernel.c deleted file mode 100644 index 4f94ffe7a7377e..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/zephyr/kernel.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2023 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "kernel.h" - -void k_usleep(useconds_t usec) -{ - usleep(usec); -} diff --git a/third_party/nxp/rt_sdk/sdk_hook/zephyr/kernel.h b/third_party/nxp/rt_sdk/sdk_hook/zephyr/kernel.h deleted file mode 100644 index fc71ecbfcb1dbd..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/zephyr/kernel.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2023 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#if defined(__cplusplus) -extern "C" { -#endif /* _cplusplus */ - -#include - -void k_usleep(useconds_t usec); - -#if defined(__cplusplus) -} -#endif diff --git a/third_party/nxp/rt_sdk/sdk_hook/zephyr/random/random.cpp b/third_party/nxp/rt_sdk/sdk_hook/zephyr/random/random.cpp deleted file mode 100644 index d6ea3cd3b156ce..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/zephyr/random/random.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2022 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#include - -/** - * Fill the buffer given as an arg with random values - * Returns 0 if success, -1 otherwise - * - */ -int sys_csrand_get(void * dst, size_t len) -{ - CHIP_ERROR error; - error = chip::Crypto::DRBG_get_bytes(reinterpret_cast(dst), len); - - return ((error == CHIP_NO_ERROR) ? 0 : -1); -} diff --git a/third_party/nxp/rt_sdk/sdk_hook/zephyr/random/random.h b/third_party/nxp/rt_sdk/sdk_hook/zephyr/random/random.h deleted file mode 100644 index ed953ef68010c0..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/zephyr/random/random.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2022 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef RAND32_H_ -#define RAND32_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** - * Fill the buffer given as an arg with random values - * Returns 0 if success, -1 otherwise - * - */ -int sys_csrand_get(void * dst, size_t len); - -#ifdef __cplusplus -} -#endif - -#endif /* RAND32_H_ */ diff --git a/third_party/nxp/rt_sdk/sdk_hook/zephyr/sys/byteorder.h b/third_party/nxp/rt_sdk/sdk_hook/zephyr/sys/byteorder.h deleted file mode 100644 index 6dda868fddeb28..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/zephyr/sys/byteorder.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2023 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#if defined(__cplusplus) -extern "C" { -#endif /* _cplusplus */ - -#include - -#if defined(__cplusplus) -} -#endif diff --git a/third_party/nxp/rt_sdk/sdk_hook/zephyr/sys/slist.h b/third_party/nxp/rt_sdk/sdk_hook/zephyr/sys/slist.h deleted file mode 100644 index 3dee49cb0d86c7..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/zephyr/sys/slist.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2023 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#if defined(__cplusplus) -extern "C" { -#endif /* _cplusplus */ - -#include "sys/slist.h" - -#if defined(__cplusplus) -} -#endif diff --git a/third_party/nxp/rt_sdk/sdk_hook/zephyr/sys/util.h b/third_party/nxp/rt_sdk/sdk_hook/zephyr/sys/util.h deleted file mode 100644 index 66bd735853e765..00000000000000 --- a/third_party/nxp/rt_sdk/sdk_hook/zephyr/sys/util.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2023 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#if defined(__cplusplus) -extern "C" { -#endif /* _cplusplus */ - -#include - -#if defined(__cplusplus) -} -#endif diff --git a/third_party/nxp/rt_sdk/transceiver/app_transceiver_config.h b/third_party/nxp/rt_sdk/transceiver/app_transceiver_config.h deleted file mode 100644 index edeec45a19fd19..00000000000000 --- a/third_party/nxp/rt_sdk/transceiver/app_transceiver_config.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2020-2023 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#define USB_HOST_CONFIG_EHCI 2 -#define CONTROLLER_ID kUSB_ControllerEhci0 - -#if defined(WIFI_IW416_BOARD_AW_AM457_USD) || defined(WIFI_IW416_BOARD_AW_AM510_USD) || \ - defined(WIFI_88W8987_BOARD_AW_CM358_USD) || defined(WIFI_IW612_BOARD_RD_USD) || defined(WIFI_BOARD_RW610) || \ - defined(WIFI_88W8801_BOARD_MURATA_2DS_USD) || defined(WIFI_IW612_BOARD_MURATA_2EL_USD) || \ - defined(WIFI_IW612_BOARD_MURATA_2EL_M2) -#define WIFI_TRANSCEIVER_SUPPORT 1 -#else -#define WIFI_TRANSCEIVER_SUPPORT 0 -#endif - -/* - * Check if the transceiver is supported. - * Applies only for Matter over Wi-fi or Matter over Thread - */ -#if (CHIP_DEVICE_CONFIG_ENABLE_WPA || CHIP_DEVICE_CONFIG_ENABLE_THREAD) -#if !WIFI_TRANSCEIVER_SUPPORT && !defined(K32W061_TRANSCEIVER) -#error The transceiver module is unsupported -#endif -#endif /* CHIP_DEVICE_CONFIG_ENABLE_WPA || CHIP_DEVICE_CONFIG_ENABLE_THREAD */ - -#if WIFI_TRANSCEIVER_SUPPORT -#ifdef NXP_SDK_2_15_SUPPORT -/* comes from: /components/wifi_bt_module/incl/wifi_bt_module_config.h */ -#include "wifi_bt_module_config.h" -#else -#define NOT_DEFINE_DEFAULT_WIFI_MODULE -/* app_config.h comes from: /components/wifi_bt_module/template */ -#include "app_config.h" -#endif -/* comes from: /components/wifi_bt_module/template/wifi_config.h */ -#include "wifi_config.h" -#endif /* WIFI_TRANSCEIVER_SUPPORT */ - -#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#define CONFIG_BT_DEVICE_NAME "NXP BLE test" -#include "edgefast_bluetooth_config.h" -#endif /* CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE */ diff --git a/third_party/openthread/platforms/efr32/BUILD.gn b/third_party/openthread/platforms/efr32/BUILD.gn index 381c6407f2c7cd..69e55a5d76151d 100644 --- a/third_party/openthread/platforms/efr32/BUILD.gn +++ b/third_party/openthread/platforms/efr32/BUILD.gn @@ -32,11 +32,9 @@ config("openthread_efr32_config") { "${sl_ot_efr32_root}", "${chip_root}/examples/platform/efr32", "${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}", + "${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}/config", "${sl_ot_platform_abstraction}/include", "${sl_ot_platform_abstraction}/rtos", - - #TODO this is for sl_openthread_features_config.h. should use generated one per board when sl_ot_abstraction is integrated - "${sl_ot_libs_path}/config", ] # temporarily disable check until gsdk pulls in a more recent version of openthread diff --git a/third_party/silabs/BUILD.gn b/third_party/silabs/BUILD.gn index 915cf8ba2bf164..e08c7cd0bd11bd 100644 --- a/third_party/silabs/BUILD.gn +++ b/third_party/silabs/BUILD.gn @@ -211,6 +211,7 @@ if (wifi_soc != true) { # CCP board include_dirs = [ "${sl_ot_platform_abstraction}/include" ] } + sources += [ "${sl_ot_platform_abstraction}/efr32/sleep.c" ] # Use silabs openthread library stack with or without coap api enabled COAP_API = "" diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni index 6bdef4162a0b58..5faba08acd3d3b 100644 --- a/third_party/silabs/SiWx917_sdk.gni +++ b/third_party/silabs/SiWx917_sdk.gni @@ -188,7 +188,7 @@ template("siwx917_sdk") { "SL_HEAP_SIZE=32768", "SL_WIFI=1", "CCP_SI917_BRINGUP=1", - "SL_COMPONENT_CATALOG_PRESENT", + "SL_COMPONENT_CATALOG_PRESENT=1", "RS911X_WIFI=1", "RSI_WLAN_ENABLE", "SLI_SI91X_ENABLE_OS=1", @@ -226,7 +226,7 @@ template("siwx917_sdk") { "SL_SI91X_SI917_RAM_MEM_CONFIG=3", "SL_SI91x_DUAL_INTERRUPTS_ERRATA=1", "EXT_IRQ_COUNT=75", - "FLASH_PAGE_SIZE=1", + "FLASH_PAGE_SIZE=4096", "DEBUG_ENABLE=1", "ENABLE_DEBUG_MODULE=1", "SI91X_SYSRTC_PRESENT=1", @@ -240,6 +240,16 @@ template("siwx917_sdk") { "configUSE_POSIX_ERRNO=1", "NVM3_LOCK_OVERRIDE=1", "SL_MEMORY_POOL_LIGHT=1", + "SL_CODE_COMPONENT_CORE=core", + "SLI_SI91X_MCU_EXTERNAL_LDO_FOR_PSRAM=1", + "CLOCK_ROMDRIVER_PRESENT=1", + "ULPSS_CLOCK_ROMDRIVER_PRESENT=1", + "SL_SI91X_BOARD_INIT=1", + "CRC_ROMDRIVER_PRESENT=1", + "TIMER_ROMDRIVER_PRESENT=1", + "UDMA_ROMDRIVER_PRESENT=1", + "PLL_ROMDRIVER_PRESENT=1", + "SL_MATTER_GN_BUILD=1", ] if (silabs_log_enabled && chip_logging) { @@ -281,14 +291,20 @@ template("siwx917_sdk") { if (invoker.enable_dic) { _include_dirs += [ "${chip_root}/third_party/silabs/mqtt/stack" ] } + + if (chip_enable_icd_server || !disable_lcd) { + defines += [ + "SL_SLEEP_TIMER=1", + "SI91X_SYSRTC_COUNT=1", + ] + } + if (!disable_lcd) { defines += [ "CONFIG_ENABLE_UART", - "SI91X_SYSRTC_COUNT=1", "SYSCALLS_WRITE", "SPI_MULTI_SLAVE", "SL_ULP_TIMER", - "SL_SLEEP_TIMER", ] } @@ -745,6 +761,14 @@ template("siwx917_sdk") { ] } + if (chip_enable_icd_server || !disable_lcd) { + sources += [ + "${efr32_sdk_root}/platform/service/sleeptimer/src/sl_sleeptimer.c", + "${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/peripheral_drivers/src/rsi_sysrtc.c", + "${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/service/sleeptimer/src/sl_sleeptimer_hal_si91x_sysrtc.c", + ] + } + if (!disable_lcd) { sources += [ "${efr32_sdk_root}/platform/middleware/glib/dmd/display/dmd_memlcd.c", @@ -759,13 +783,10 @@ template("siwx917_sdk") { "${efr32_sdk_root}/platform/middleware/glib/glib/glib_polygon.c", "${efr32_sdk_root}/platform/middleware/glib/glib/glib_rectangle.c", "${efr32_sdk_root}/platform/middleware/glib/glib/glib_string.c", - "${efr32_sdk_root}/platform/service/sleeptimer/src/sl_sleeptimer.c", "${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/cmsis_driver/SPI.c", "${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/hardware_drivers/memlcd/src/memlcd_917/sl_memlcd_spi.c", "${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/hardware_drivers/memlcd/src/sl_memlcd.c", "${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/hardware_drivers/memlcd/src/sl_memlcd_display.c", - "${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/peripheral_drivers/src/rsi_sysrtc.c", - "${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/service/sleeptimer/src/sl_sleeptimer_hal_si91x_sysrtc.c", "${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/unified_api/src/sl_si91x_ulp_timer.c", ] } diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index ac30e83f123bfa..08695af1fc3800 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -81,8 +81,11 @@ declare_args() { # Multi-chip OTA chip_enable_multi_ota_requestor = false } + examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" silabs_plat_efr32_wifi_dir = "${chip_root}/src/platform/silabs/efr32/wifi" +is_series_2 = silabs_family == "mgm24" || silabs_family == "efr32mg24" || + silabs_family == "efr32mg26" assert(efr32_sdk_root != "", "efr32_sdk_root must be specified") @@ -135,6 +138,8 @@ template("efr32_sdk") { config("${sdk_target_name}_config") { include_dirs = [] libs = [] + defines = [] + if (defined(invoker.include_dirs)) { include_dirs += invoker.include_dirs } @@ -217,17 +222,105 @@ template("efr32_sdk") { "${efr32_sdk_root}/util/third_party/freertos/kernel/include", "${silabs_gen_folder}/config", "${silabs_gen_folder}/autogen", + "${sl_ot_platform_abstraction}/rtos", + "${efr32_sdk_root}/protocol/openthread/include", + "${efr32_sdk_root}/util/third_party/openthread/include", + "${efr32_sdk_root}/util/third_party/openthread/src/core", + "${efr32_sdk_root}/util/third_party/openthread/examples/platforms/", + "${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}/config", # Headers needed for Init no function will be called if OT is not used "${sl_ot_efr32_root}", - - # TODO this is for sl_openthread_features_config.h. should use generated one per board when sl_ot_abstraction is integrated - "${sl_ot_libs_path}/config", ] + if (is_series_2) { + _include_dirs += [ + "${efr32_sdk_root}/platform/emdrv/dmadrv/inc/s2_signals", + "${efr32_sdk_root}/platform/driver/debug/inc/", + "${efr32_sdk_root}/platform/radio/rail_lib/chip/efr32/efr32xg2x", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/fem_util/", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_rssi/", + "${efr32_sdk_root}/platform/service/device_init/config/s2/", + "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM33_NTZ/non_secure", + ] + + libs += [ + "${sdk_support_root}/platform/emdrv/nvm3/lib/libnvm3_CM33_gcc.a", + "${sdk_support_root}/protocol/openthread/libs/libsl_openthread_efr32mg2x_gcc.a", + ] + + if (!chip_enable_ble_rs911x) { + libs += [ + "${sdk_support_root}/protocol/bluetooth/bgcommon/lib/build/gcc/cortex-m33/bgcommon/release/libbgcommon.a", + "${sdk_support_root}/protocol/bluetooth/build/gcc/cortex-m33/bt_host/release/libbt_host.a", + "${sdk_support_root}/protocol/bluetooth/build/gcc/cortex-m33/bt_host/hal/release/libbt_hal_series2.a", + ] + } + } + if (silabs_family == "efr32mg24") { - _include_dirs += - [ "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG24/Include" ] + _include_dirs += [ + "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG24/Include", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24/config", + "${efr32_sdk_root}/platform/emdrv/spidrv/inc", + "${efr32_sdk_root}/platform/emdrv/spidrv/config", + ] + + libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_multiprotocol_efr32xg24_gcc_release.a" ] + + if (!chip_enable_ble_rs911x) { + libs += [ "${sdk_support_root}/protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg24_gcc_release.a" ] + } + + defines += [ "EFR32MG24" ] + } else if (silabs_family == "mgm24") { + _include_dirs += [ + "${efr32_sdk_root}/platform/Device/SiliconLabs/MGM24/Include", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24/config", + ] + + libs += [ + "${sdk_support_root}/protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg24_gcc_release.a", + "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_multiprotocol_module_efr32xg24_gcc_release.a", + ] + + if (silabs_mcu == "MGM240PB32VNA") { + libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240pb32vna_gcc.a" ] + } else if (silabs_mcu == "MGM240PB22VNA") { + libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240pb22vna_gcc.a" ] + } else if (silabs_mcu == "MGM240L022RNF") { + libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240l022rnf_gcc.a" ] + } else if (silabs_mcu == "MGM240SD22VNA") { + libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240sd22vna_gcc.a" ] + defines += [ "SLI_RADIOAES_REQUIRES_MASKING=1" ] + } + + defines += [ "MGM24" ] + } else if (silabs_family == "efr32mg26") { + _include_dirs += [ + "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG26/Include", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg26", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg26/config", + ] + + libs += [ + "${sdk_support_root}/protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg26_gcc_release.a", + "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_multiprotocol_efr32xg26_gcc_release.a", + ] + + defines += [ "EFR32MG26" ] + } + + if (use_wf200) { + _include_dirs += [ + "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver", + "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/bus", + "${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", + ] } if (use_SiWx917) { @@ -279,12 +372,39 @@ template("efr32_sdk") { } } + if (use_system_view) { + _include_dirs += [ + "${efr32_sdk_root}/util/third_party/segger/systemview/SEGGER", + "${efr32_sdk_root}/util/third_party/segger/systemview/init/", + "${efr32_sdk_root}/util/third_party/segger/systemview/profiles/freertos_v10/", + ] + + defines += [ + "SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT", + "SEGGER_SYSVIEW_RTT_BUFFER_SIZE=8192", + ] + } + + if (use_wstk_leds) { + _include_dirs += [ "${efr32_sdk_root}/platform/driver/leddrv/inc" ] + + defines += [ "ENABLE_WSTK_LEDS" ] + } + + if (use_wstk_buttons) { + _include_dirs += [ "${efr32_sdk_root}/platform/driver/button/inc" ] + } + + if (invoker.enable_dic) { + _include_dirs += [ "${chip_root}/third_party/silabs/mqtt/stack" ] + } + # Note that we're setting the mbedTLS and PSA configuration files through a # define. This means the build system by default does not pick up changes in # the content of these, only when changing the filename itself. # To fix this, these files are also manually depended upon in the source set # declared in efr32_mbedtls_config further down this file. - defines = [ + defines += [ "MBEDTLS_CONFIG_FILE=\"efr32-chip-mbedtls-config.h\"", "MBEDTLS_PSA_CRYPTO_CONFIG_FILE=\"efr32-psa-crypto-config.h\"", "__STARTUP_CLEAR_BSS", @@ -315,11 +435,11 @@ template("efr32_sdk") { "SL_RAIL_UTIL_PA_CONFIG_HEADER=", "RADIO_CONFIG_DMP_SUPPORT=1", "SL_MATTER_BLE_EXTENDED_ADV=${sl_matter_ble_extended_adv}", + "SL_MATTER_GN_BUILD=1", "SL_MEMORY_POOL_LIGHT=1", "SL_OPENTHREAD_STACK_FEATURES_CONFIG_FILE=\"sl_openthread_features_config.h\"", "SL_CSL_TIMEOUT=${sl_ot_csl_timeout_sec}", "CIRCULAR_QUEUE_USE_LOCAL_CONFIG_HEADER=1", - "MATTER_INTEGRATION=1", ] if (silabs_log_enabled && chip_logging) { @@ -357,6 +477,25 @@ template("efr32_sdk") { ] } + if (defined(invoker.chip_enable_openthread) && + invoker.chip_enable_openthread) { + defines += [ + "SL_OT_ENABLE=1", + + #TODO: Remove these defines once sl_openthread_rtos_config is included in sl_ot_rtos_adaptation.c + "SL_OPENTHREAD_RTOS_STACK_TASK_PRIORITY=24", + "SL_OPENTHREAD_RTOS_APP_TASK_PRIORITY=23", + "SL_OPENTHREAD_RTOS_CLI_TASK_PRIORITY=16", + "SL_OPENTHREAD_STACK_TASK_MEM_SIZE=4608", + "SL_OPENTHREAD_APP_TASK_MEM_SIZE=4608", + "SL_OPENTHREAD_CLI_TASK_MEM_SIZE=2048", + "SL_OPENTHREAD_RTOS_CLI_TASK_PRIORITY=16", + "SL_OPENTHREAD_OS_CLI_TASK_SIZE=2048", + "SL_OPENTHREAD_ENABLE_APP_TASK=0", + "SL_OPENTHREAD_ENABLE_CLI_TASK=0", + ] + } + if (defined(invoker.chip_enable_wifi) && invoker.chip_enable_wifi) { if (enable_dic) { assert(chip_enable_wifi_ipv4, "enable chip_enable_wifi_ipv4") @@ -427,29 +566,6 @@ template("efr32_sdk") { } } - if (use_system_view) { - _include_dirs += [ - "${efr32_sdk_root}/util/third_party/segger/systemview/SEGGER", - "${efr32_sdk_root}/util/third_party/segger/systemview/init/", - "${efr32_sdk_root}/util/third_party/segger/systemview/profiles/freertos_v10/", - ] - - defines += [ - "SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT", - "SEGGER_SYSVIEW_RTT_BUFFER_SIZE=8192", - ] - } - - if (use_wstk_leds) { - _include_dirs += [ "${efr32_sdk_root}/platform/driver/leddrv/inc" ] - - defines += [ "ENABLE_WSTK_LEDS" ] - } - - if (use_wstk_buttons) { - _include_dirs += [ "${efr32_sdk_root}/platform/driver/button/inc" ] - } - if (chip_enable_icd_server) { defines += [ "SL_ICD_ENABLED=1", @@ -519,96 +635,10 @@ template("efr32_sdk") { ] } - if (invoker.enable_dic) { - _include_dirs += [ "${chip_root}/third_party/silabs/mqtt/stack" ] - } - if (sl_use_subscription_synching) { defines += [ "CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED=1" ] } - if (silabs_family == "efr32mg24") { - _include_dirs += [ - "${efr32_sdk_root}/platform/radio/rail_lib/chip/efr32/efr32xg2x", - "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM33_NTZ/non_secure", - "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24", - "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24/config", - "${efr32_sdk_root}/platform/service/device_init/config/s2/", - "${efr32_sdk_root}/platform/emdrv/spidrv/inc", - "${efr32_sdk_root}/platform/emdrv/spidrv/config", - "${efr32_sdk_root}/platform/emdrv/dmadrv/inc/s2_signals", - ] - - libs += [ - "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_multiprotocol_efr32xg24_gcc_release.a", - "${sdk_support_root}/platform/emdrv/nvm3/lib/libnvm3_CM33_gcc.a", - "${sdk_support_root}/protocol/openthread/libs/libsl_openthread_efr32mg2x_gcc.a", - ] - - if (!chip_enable_ble_rs911x) { - libs += [ - "${sdk_support_root}/protocol/bluetooth/bgcommon/lib/build/gcc/cortex-m33/bgcommon/release/libbgcommon.a", - "${sdk_support_root}/protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg24_gcc_release.a", - "${sdk_support_root}/protocol/bluetooth/build/gcc/cortex-m33/bt_host/release/libbt_host.a", - "${sdk_support_root}/protocol/bluetooth/build/gcc/cortex-m33/bt_host/hal/release/libbt_hal_series2.a", - ] - } - - defines += [ - "EFR32MG24", - "EFR32_SERIES2_CONFIG4_MICRO", - ] - } else if (silabs_family == "mgm24") { - _include_dirs += [ - "${efr32_sdk_root}/platform/Device/SiliconLabs/MGM24/Include", - "${efr32_sdk_root}/platform/driver/debug/inc/", - "${efr32_sdk_root}/platform/radio/rail_lib/chip/efr32/efr32xg2x", - "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM33_NTZ/non_secure", - "${efr32_sdk_root}/platform/radio/rail_lib/plugin/fem_util/", - "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_rssi/", - "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24", - "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24/config", - "${efr32_sdk_root}/platform/service/device_init/config/s2/", - "${efr32_sdk_root}/platform/emdrv/dmadrv/inc/s2_signals", - ] - - libs += [ - "${sdk_support_root}/protocol/bluetooth/bgcommon/lib/build/gcc/cortex-m33/bgcommon/release/libbgcommon.a", - "${sdk_support_root}/protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg24_gcc_release.a", - "${sdk_support_root}/protocol/bluetooth/build/gcc/cortex-m33/bt_host/release/libbt_host.a", - "${sdk_support_root}/protocol/bluetooth/build/gcc/cortex-m33/bt_host/hal/release/libbt_hal_series2.a", - "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_multiprotocol_module_efr32xg24_gcc_release.a", - "${sdk_support_root}/platform/emdrv/nvm3/lib/libnvm3_CM33_gcc.a", - "${sdk_support_root}/protocol/openthread/libs/libsl_openthread_efr32mg2x_gcc.a", - ] - - if (silabs_mcu == "MGM240PB32VNA") { - libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240pb32vna_gcc.a" ] - } else if (silabs_mcu == "MGM240PB22VNA") { - libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240pb22vna_gcc.a" ] - } else if (silabs_mcu == "MGM240L022RNF") { - libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240l022rnf_gcc.a" ] - } else if (silabs_mcu == "MGM240SD22VNA") { - libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240sd22vna_gcc.a" ] - defines += [ "SLI_RADIOAES_REQUIRES_MASKING=1" ] - } - - defines += [ - "MGM24", - "EFR32_SERIES2_CONFIG4_MICRO", - ] - } - - if (use_wf200) { - _include_dirs += [ - "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver", - "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/bus", - "${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", - ] - } - cflags = [] foreach(include_dir, _include_dirs) { cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] @@ -616,7 +646,7 @@ template("efr32_sdk") { cflags += [ "-Wno-shadow" ] - if (silabs_family == "efr32mg24" || silabs_family == "mgm24") { + if (is_series_2) { cflags += [ "-mcmse" ] } @@ -800,6 +830,15 @@ template("efr32_sdk") { ] } + if (defined(invoker.chip_enable_openthread) && + invoker.chip_enable_openthread) { + sources += [ + "${silabs_gen_folder}/autogen/sl_ot_custom_cli.c", + "${silabs_gen_folder}/autogen/sl_ot_init.c", + "${sl_ot_platform_abstraction}/rtos/sl_ot_rtos_adaptation.c", + ] + } + if (use_wstk_buttons) { sources += [ "${efr32_sdk_root}/platform/driver/button/src/sl_button.c", @@ -877,6 +916,8 @@ template("efr32_sdk") { sources += [ "${efr32_sdk_root}/hardware/driver/configuration_over_swo/src/sl_cos.c", "${efr32_sdk_root}/platform/driver/debug/src/sl_debug_swo.c", + "${efr32_sdk_root}/util/third_party/mbedtls/library/hmac_drbg.c", + "${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_ecp.c", ] } @@ -930,19 +971,30 @@ template("efr32_sdk") { sources += [ "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG24/Source/startup_efr32mg24.c", "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG24/Source/system_efr32mg24.c", - "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/pa_curves_efr32.c", + "${efr32_sdk_root}/platform/service/device_manager/clocks/sl_device_clock_efr32xg24.c", + "${efr32_sdk_root}/platform/service/device_manager/devices/sl_device_peripheral_hal_efr32xg24.c", ] } else if (silabs_family == "mgm24") { sources += [ "${efr32_sdk_root}/platform/Device/SiliconLabs/MGM24/Source/startup_mgm24.c", "${efr32_sdk_root}/platform/Device/SiliconLabs/MGM24/Source/system_mgm24.c", "${efr32_sdk_root}/platform/radio/rail_lib/plugin/fem_util/sl_fem_util.c", - "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_rssi/sl_rail_util_rssi.c", + "${efr32_sdk_root}/platform/service/device_manager/clocks/sl_device_clock_efr32xg24.c", + "${efr32_sdk_root}/platform/service/device_manager/devices/sl_device_peripheral_hal_efr32xg24.c", + ] + } else if (silabs_family == "efr32mg26") { + sources += [ + "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG26/Source/startup_efr32mg26.c", + "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG26/Source/system_efr32mg26.c", + "${efr32_sdk_root}/platform/service/device_manager/clocks/sl_device_clock_efr32xg26.c", + "${efr32_sdk_root}/platform/service/device_manager/devices/sl_device_peripheral_hal_efr32xg26.c", ] } - if (silabs_family == "mgm24" || silabs_family == "efr32mg24") { + if (is_series_2) { sources += [ + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/pa_curves_efr32.c", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_rssi/sl_rail_util_rssi.c", "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_sequencer/sl_rail_util_sequencer.c", "${efr32_sdk_root}/platform/security/sl_component/se_manager/src/sl_se_manager.c", "${efr32_sdk_root}/platform/security/sl_component/se_manager/src/sl_se_manager_attestation.c", @@ -975,8 +1027,6 @@ template("efr32_sdk") { "${efr32_sdk_root}/platform/service/clock_manager/src/sl_clock_manager_hal_s2.c", "${efr32_sdk_root}/platform/service/clock_manager/src/sl_clock_manager_init_hal_s2.c", "${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_dcdc_s2.c", - "${efr32_sdk_root}/platform/service/device_manager/clocks/sl_device_clock_efr32xg24.c", - "${efr32_sdk_root}/platform/service/device_manager/devices/sl_device_peripheral_hal_efr32xg24.c", "${efr32_sdk_root}/platform/service/hfxo_manager/src/sl_hfxo_manager_hal_s2.c", "${efr32_sdk_root}/platform/service/power_manager/src/sl_power_manager_hal_s2.c", "${efr32_sdk_root}/platform/service/sleeptimer/src/sl_sleeptimer_hal_sysrtc.c", diff --git a/third_party/silabs/lwip.gni b/third_party/silabs/lwip.gni index 9a35e7c45f7a61..b0b6a0db0d2c9f 100644 --- a/third_party/silabs/lwip.gni +++ b/third_party/silabs/lwip.gni @@ -169,8 +169,10 @@ template("lwip_target") { "${_lwip_root}/src/core/ipv6/ip6.c", "${_lwip_root}/src/core/ipv6/ip6_addr.c", "${_lwip_root}/src/core/ipv6/ip6_frag.c", - "${_lwip_root}/src/core/ipv6/mld6.c", "${_lwip_root}/src/core/ipv6/nd6.c", + + # TODO: When updating to next Si SDK version, revert change. + "${sdk_support_root}/src/core/ipv6/mld6.c", ] } diff --git a/third_party/silabs/matter_support b/third_party/silabs/matter_support index 256bb77c094980..9084b6fa2f9407 160000 --- a/third_party/silabs/matter_support +++ b/third_party/silabs/matter_support @@ -1 +1 @@ -Subproject commit 256bb77c094980316e342fa493df06ec652f060f +Subproject commit 9084b6fa2f9407396a7f2db12975e6e89fe07a8c diff --git a/third_party/silabs/silabs_arm.gni b/third_party/silabs/silabs_arm.gni index 30e6ed6ed09af8..f5e77f0d3ee736 100644 --- a/third_party/silabs/silabs_arm.gni +++ b/third_party/silabs/silabs_arm.gni @@ -20,7 +20,8 @@ if (silabs_family == "SiWx917-common") { arm_cpu = "cortex-m4" arm_float_abi = "softfp" arm_fpu = "fpv4-sp-d16" -} else if (silabs_family == "efr32mg24" || silabs_family == "mgm24") { +} else if (silabs_family == "efr32mg24" || silabs_family == "mgm24" || + silabs_family == "efr32mg26") { arm_arch = "armv8-m.main+dsp" arm_abi = "aapcs" arm_cpu = "cortex-m33" diff --git a/third_party/silabs/silabs_board.gni b/third_party/silabs/silabs_board.gni index 6b69fb59b9af06..7c1d77d036a41f 100644 --- a/third_party/silabs/silabs_board.gni +++ b/third_party/silabs/silabs_board.gni @@ -64,10 +64,13 @@ if (silabs_board == "") { assert(silabs_board != "", "silabs_board must be specified") +# Si917 WIFI board ---------- if (silabs_board == "BRD4338A") { silabs_family = "SiWx917-common" silabs_mcu = "SiWG917M111MGTBA" wifi_soc = true + + # EFR32 MG24 series ---------- } else if (silabs_board == "BRD4186A" || silabs_board == "BRD4187A") { variant = string_replace(silabs_board, "A", "C") print( @@ -95,6 +98,8 @@ if (silabs_board == "BRD4338A") { use_external_flash = false show_qr_code = false disable_lcd = true + + # EFR32 MG24 Modules series ---------- } else if (silabs_board == "BRD4316A") { silabs_family = "mgm24" silabs_mcu = "MGM240PB22VNA" @@ -130,6 +135,24 @@ if (silabs_board == "BRD4338A") { } else if (silabs_board == "BRD4318A") { silabs_family = "mgm24" silabs_mcu = "MGM240SD22VNA" + + # EFR32 MG26 series ---------- +} else if (silabs_board == "BRD4116A") { + silabs_family = "efr32mg26" + silabs_mcu = "EFR32MG26B410F3200IM48" +} else if (silabs_board == "BRD4117A") { + silabs_family = "efr32mg26" + silabs_mcu = "EFR32MG26B420F3200IM48" +} else if (silabs_board == "BRD4118A") { + silabs_family = "efr32mg26" + silabs_mcu = "EFR32MG26B510F3200IL136" +} else if (silabs_board == "BRD2608A") { + silabs_family = "efr32mg26" + silabs_mcu = "EFR32MG26B510F3200IM68" + + # ThunderBoards don't have a LCD, + show_qr_code = false + disable_lcd = true } else { assert( false, 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 e349271c1d9ed5..766c20979a5ee7 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 @@ -15001,6 +15001,10 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu } // namespace Attributes } // namespace ElectricalEnergyMeasurement +namespace WaterHeaterManagement { +namespace Attributes {} // namespace Attributes +} // namespace WaterHeaterManagement + namespace DemandResponseLoadControl { namespace Attributes { @@ -16007,6 +16011,234 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu } // namespace Attributes } // namespace EnergyEvseMode +namespace WaterHeaterMode { +namespace Attributes { + +namespace StartUpMode { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::WaterHeaterMode::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::WaterHeaterMode::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::WaterHeaterMode::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::WaterHeaterMode::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::WaterHeaterMode::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty) +{ + if (value.IsNull()) + { + return SetNull(endpoint, markDirty); + } + + return Set(endpoint, value.Value(), markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace StartUpMode + +namespace OnMode { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::WaterHeaterMode::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::WaterHeaterMode::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::WaterHeaterMode::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::WaterHeaterMode::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::WaterHeaterMode::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty) +{ + if (value.IsNull()) + { + return SetNull(endpoint, markDirty); + } + + return Set(endpoint, value.Value(), markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace OnMode + +namespace ClusterRevision { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::WaterHeaterMode::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(chip::EndpointId endpoint, uint16_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(endpoint, Clusters::WaterHeaterMode::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_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::WaterHeaterMode::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); +} + +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace WaterHeaterMode + namespace DeviceEnergyManagementMode { namespace Attributes { @@ -25976,113 +26208,63 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value) } // namespace PresetsSchedulesEditable -namespace TemperatureSetpointHoldPolicy { +namespace SetpointHoldExpiryTimestamp { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, - chip::BitMask * value) +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) { - using Traits = NumericAttributeTraits>; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = emberAfReadAttribute(endpoint, Clusters::Thermostat::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + if (Traits::IsNullValue(temp)) { - return Protocols::InteractionModel::Status::ConstraintError; + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); } - *value = Traits::StorageToWorking(temp); return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::BitMask value, - MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) { - using Traits = NumericAttributeTraits>; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) { return Protocols::InteractionModel::Status::ConstraintError; } Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_BITMAP8_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE, markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::BitMask value) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) { - using Traits = NumericAttributeTraits>; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) { return Protocols::InteractionModel::Status::ConstraintError; } Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_BITMAP8_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE); } -} // namespace TemperatureSetpointHoldPolicy - -namespace SetpointHoldExpiryTimestamp { +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE, markDirty); +} -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::Thermostat::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) { using Traits = NumericAttributeTraits; Traits::StorageType value; @@ -34992,103 +35174,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu namespace ThreadBorderRouterManagement { namespace Attributes { -namespace BorderRouterName { - -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::MutableCharSpan & value) -{ - uint8_t zclString[63 + 1]; - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ThreadBorderRouterManagement::Id, Id, zclString, sizeof(zclString)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - size_t length = emberAfStringLength(zclString); - if (length == NumericAttributeTraits::kNullValue) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - - VerifyOrReturnError(value.size() == 63, Protocols::InteractionModel::Status::InvalidDataType); - memcpy(value.data(), &zclString[1], 63); - value.reduce_size(length); - return status; -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value, MarkAttributeDirty markDirty) -{ - - static_assert(63 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); - VerifyOrReturnError(value.size() <= 63, Protocols::InteractionModel::Status::ConstraintError); - uint8_t zclString[63 + 1]; - auto length = static_cast(value.size()); - Encoding::Put8(zclString, length); - memcpy(&zclString[1], value.data(), value.size()); - return emberAfWriteAttribute(endpoint, Clusters::ThreadBorderRouterManagement::Id, Id, zclString, - ZCL_CHAR_STRING_ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value) -{ - - static_assert(63 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); - VerifyOrReturnError(value.size() <= 63, Protocols::InteractionModel::Status::ConstraintError); - uint8_t zclString[63 + 1]; - auto length = static_cast(value.size()); - Encoding::Put8(zclString, length); - memcpy(&zclString[1], value.data(), value.size()); - return emberAfWriteAttribute(endpoint, Clusters::ThreadBorderRouterManagement::Id, Id, zclString, - ZCL_CHAR_STRING_ATTRIBUTE_TYPE); -} - -} // namespace BorderRouterName - -namespace BorderAgentID { - -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::MutableByteSpan & value) -{ - uint8_t zclString[254 + 1]; - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ThreadBorderRouterManagement::Id, Id, zclString, sizeof(zclString)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - size_t length = emberAfStringLength(zclString); - if (length == NumericAttributeTraits::kNullValue) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - - VerifyOrReturnError(value.size() == 254, Protocols::InteractionModel::Status::InvalidDataType); - memcpy(value.data(), &zclString[1], 254); - value.reduce_size(length); - return status; -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::ByteSpan value, MarkAttributeDirty markDirty) -{ - - static_assert(254 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); - VerifyOrReturnError(value.size() <= 254, Protocols::InteractionModel::Status::ConstraintError); - uint8_t zclString[254 + 1]; - auto length = static_cast(value.size()); - Encoding::Put8(zclString, length); - memcpy(&zclString[1], value.data(), value.size()); - return emberAfWriteAttribute(endpoint, Clusters::ThreadBorderRouterManagement::Id, Id, zclString, - ZCL_OCTET_STRING_ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::ByteSpan value) -{ - - static_assert(254 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); - VerifyOrReturnError(value.size() <= 254, Protocols::InteractionModel::Status::ConstraintError); - uint8_t zclString[254 + 1]; - auto length = static_cast(value.size()); - Encoding::Put8(zclString, length); - memcpy(&zclString[1], value.data(), value.size()); - return emberAfWriteAttribute(endpoint, Clusters::ThreadBorderRouterManagement::Id, Id, zclString, - ZCL_OCTET_STRING_ATTRIBUTE_TYPE); -} - -} // namespace BorderAgentID - -namespace ThreadVersion { +namespace ClusterRevision { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value) { @@ -35133,17 +35219,23 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu return emberAfWriteAttribute(endpoint, Clusters::ThreadBorderRouterManagement::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); } -} // namespace ThreadVersion +} // namespace ClusterRevision -namespace InterfaceEnabled { +} // namespace Attributes +} // namespace ThreadBorderRouterManagement -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, bool * value) +namespace ThreadNetworkDirectory { +namespace Attributes { + +namespace FeatureMap { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ThreadBorderRouterManagement::Id, Id, readable, sizeof(temp)); + emberAfReadAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { @@ -35153,9 +35245,9 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, bool * value) return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -35163,13 +35255,13 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value, M Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ThreadBorderRouterManagement::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE, + return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE, markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -35177,458 +35269,85 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ThreadBorderRouterManagement::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); } -} // namespace InterfaceEnabled +} // namespace FeatureMap -namespace ActiveDatasetTimestamp { +namespace ClusterRevision { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ThreadBorderRouterManagement::Id, Id, readable, sizeof(temp)); + emberAfReadAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { - value.SetNonNull() = Traits::StorageToWorking(temp); + return Protocols::InteractionModel::Status::ConstraintError; } + *value = Traits::StorageToWorking(temp); return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint64_t value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) { - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, 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::ThreadBorderRouterManagement::Id, Id, writable, ZCL_INT64U_ATTRIBUTE_TYPE, + return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE, markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint64_t value) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value) { - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, 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::ThreadBorderRouterManagement::Id, Id, writable, ZCL_INT64U_ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::ThreadBorderRouterManagement::Id, Id, writable, ZCL_INT64U_ATTRIBUTE_TYPE, - markDirty); -} - -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::ThreadBorderRouterManagement::Id, Id, writable, ZCL_INT64U_ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, - MarkAttributeDirty markDirty) -{ - if (value.IsNull()) - { - return SetNull(endpoint, markDirty); - } - - return Set(endpoint, value.Value(), markDirty); + return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } +} // namespace ClusterRevision - return Set(endpoint, value.Value()); -} +} // namespace Attributes +} // namespace ThreadNetworkDirectory -} // namespace ActiveDatasetTimestamp +namespace WakeOnLan { +namespace Attributes { -namespace FeatureMap { +namespace MACAddress { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value) +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::MutableCharSpan & value) { - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + uint8_t zclString[12 + 1]; Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ThreadBorderRouterManagement::Id, Id, readable, sizeof(temp)); + emberAfReadAttribute(endpoint, Clusters::WakeOnLan::Id, Id, zclString, sizeof(zclString)); VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) { return Protocols::InteractionModel::Status::ConstraintError; } - *value = Traits::StorageToWorking(temp); + + VerifyOrReturnError(value.size() == 12, Protocols::InteractionModel::Status::InvalidDataType); + memcpy(value.data(), &zclString[1], 12); + value.reduce_size(length); return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_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(endpoint, Clusters::ThreadBorderRouterManagement::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE, - markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_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::ThreadBorderRouterManagement::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - -namespace ClusterRevision { - -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ThreadBorderRouterManagement::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(chip::EndpointId endpoint, uint16_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(endpoint, Clusters::ThreadBorderRouterManagement::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE, - markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_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::ThreadBorderRouterManagement::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); -} - -} // namespace ClusterRevision - -} // namespace Attributes -} // namespace ThreadBorderRouterManagement - -namespace ThreadNetworkDirectory { -namespace Attributes { - -namespace PreferredExtendedPanID { - -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint64_t value, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT64U_ATTRIBUTE_TYPE, - markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint64_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT64U_ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT64U_ATTRIBUTE_TYPE, - markDirty); -} - -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT64U_ATTRIBUTE_TYPE); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, - MarkAttributeDirty markDirty) -{ - if (value.IsNull()) - { - return SetNull(endpoint, markDirty); - } - - return Set(endpoint, value.Value(), markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace PreferredExtendedPanID - -namespace ThreadNetworkTableSize { - -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ThreadNetworkDirectory::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(chip::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(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status Set(chip::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::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); -} - -} // namespace ThreadNetworkTableSize - -namespace FeatureMap { - -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ThreadNetworkDirectory::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(chip::EndpointId endpoint, uint32_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(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE, - markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_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::ThreadNetworkDirectory::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - -namespace ClusterRevision { - -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ThreadNetworkDirectory::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(chip::EndpointId endpoint, uint16_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(endpoint, Clusters::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE, - markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_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::ThreadNetworkDirectory::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); -} - -} // namespace ClusterRevision - -} // namespace Attributes -} // namespace ThreadNetworkDirectory - -namespace WakeOnLan { -namespace Attributes { - -namespace MACAddress { - -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::MutableCharSpan & value) -{ - uint8_t zclString[12 + 1]; - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::WakeOnLan::Id, Id, zclString, sizeof(zclString)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - size_t length = emberAfStringLength(zclString); - if (length == NumericAttributeTraits::kNullValue) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - - VerifyOrReturnError(value.size() == 12, Protocols::InteractionModel::Status::InvalidDataType); - memcpy(value.data(), &zclString[1], 12); - value.reduce_size(length); - return status; -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value, MarkAttributeDirty markDirty) { static_assert(12 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); @@ -37865,67 +37584,303 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpa return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE, markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value) +{ + + static_assert(8 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); + VerifyOrReturnError(value.size() <= 8, Protocols::InteractionModel::Status::ConstraintError); + uint8_t zclString[8 + 1]; + auto length = static_cast(value.size()); + Encoding::Put8(zclString, length); + memcpy(&zclString[1], value.data(), value.size()); + return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); +} + +} // namespace OnDemandRatingThreshold + +namespace ScheduledContentRatingThreshold { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::MutableCharSpan & value) +{ + uint8_t zclString[8 + 1]; + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ContentControl::Id, Id, zclString, sizeof(zclString)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + + VerifyOrReturnError(value.size() == 8, Protocols::InteractionModel::Status::InvalidDataType); + memcpy(value.data(), &zclString[1], 8); + value.reduce_size(length); + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value, MarkAttributeDirty markDirty) +{ + + static_assert(8 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); + VerifyOrReturnError(value.size() <= 8, Protocols::InteractionModel::Status::ConstraintError); + uint8_t zclString[8 + 1]; + auto length = static_cast(value.size()); + Encoding::Put8(zclString, length); + memcpy(&zclString[1], value.data(), value.size()); + return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value) +{ + + static_assert(8 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); + VerifyOrReturnError(value.size() <= 8, Protocols::InteractionModel::Status::ConstraintError); + uint8_t zclString[8 + 1]; + auto length = static_cast(value.size()); + Encoding::Put8(zclString, length); + memcpy(&zclString[1], value.data(), value.size()); + return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); +} + +} // namespace ScheduledContentRatingThreshold + +namespace ScreenDailyTime { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ContentControl::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(chip::EndpointId endpoint, uint32_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(endpoint, Clusters::ContentControl::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_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::ContentControl::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); +} + +} // namespace ScreenDailyTime + +namespace RemainingScreenTime { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ContentControl::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(chip::EndpointId endpoint, uint32_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(endpoint, Clusters::ContentControl::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_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::ContentControl::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); +} + +} // namespace RemainingScreenTime + +namespace BlockUnrated { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, bool * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ContentControl::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(chip::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(endpoint, Clusters::ContentControl::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::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::ContentControl::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE); +} + +} // namespace BlockUnrated + +namespace FeatureMap { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::ContentControl::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(chip::EndpointId endpoint, uint32_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(endpoint, Clusters::ContentControl::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) { - - static_assert(8 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); - VerifyOrReturnError(value.size() <= 8, Protocols::InteractionModel::Status::ConstraintError); - uint8_t zclString[8 + 1]; - auto length = static_cast(value.size()); - Encoding::Put8(zclString, length); - memcpy(&zclString[1], value.data(), value.size()); - return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); + 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::ContentControl::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); } -} // namespace OnDemandRatingThreshold +} // namespace FeatureMap -namespace ScheduledContentRatingThreshold { +namespace ClusterRevision { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::MutableCharSpan & value) +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value) { - uint8_t zclString[8 + 1]; + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ContentControl::Id, Id, zclString, sizeof(zclString)); + emberAfReadAttribute(endpoint, Clusters::ContentControl::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - size_t length = emberAfStringLength(zclString); - if (length == NumericAttributeTraits::kNullValue) + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { return Protocols::InteractionModel::Status::ConstraintError; } - - VerifyOrReturnError(value.size() == 8, Protocols::InteractionModel::Status::InvalidDataType); - memcpy(value.data(), &zclString[1], 8); - value.reduce_size(length); + *value = Traits::StorageToWorking(temp); return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) { - - static_assert(8 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); - VerifyOrReturnError(value.size() <= 8, Protocols::InteractionModel::Status::ConstraintError); - uint8_t zclString[8 + 1]; - auto length = static_cast(value.size()); - Encoding::Put8(zclString, length); - memcpy(&zclString[1], value.data(), value.size()); - return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE, 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(endpoint, Clusters::ContentControl::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE, markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value) { - - static_assert(8 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); - VerifyOrReturnError(value.size() <= 8, Protocols::InteractionModel::Status::ConstraintError); - uint8_t zclString[8 + 1]; - auto length = static_cast(value.size()); - Encoding::Put8(zclString, length); - memcpy(&zclString[1], value.data(), value.size()); - return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); + 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::ContentControl::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); } -} // namespace ScheduledContentRatingThreshold +} // namespace ClusterRevision -namespace ScreenDailyTime { +} // namespace Attributes +} // namespace ContentControl + +namespace ContentAppObserver { +namespace Attributes { + +namespace FeatureMap { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value) { @@ -37933,7 +37888,7 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * va Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ContentControl::Id, Id, readable, sizeof(temp)); + emberAfReadAttribute(endpoint, Clusters::ContentAppObserver::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { @@ -37953,7 +37908,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(endpoint, Clusters::ContentAppObserver::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE, markDirty); } Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) @@ -37966,20 +37921,20 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::ContentAppObserver::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); } -} // namespace ScreenDailyTime +} // namespace FeatureMap -namespace RemainingScreenTime { +namespace ClusterRevision { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value) +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ContentControl::Id, Id, readable, sizeof(temp)); + emberAfReadAttribute(endpoint, Clusters::ContentAppObserver::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { @@ -37989,9 +37944,9 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * va return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -37999,12 +37954,12 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(endpoint, Clusters::ContentAppObserver::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE, markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -38012,56 +37967,106 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::ContentAppObserver::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); } -} // namespace RemainingScreenTime +} // namespace ClusterRevision -namespace BlockUnrated { +} // namespace Attributes +} // namespace ContentAppObserver -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, bool * value) +namespace EcosystemInformation { +namespace Attributes { + +namespace RemovedOn { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ContentControl::Id, Id, readable, sizeof(temp)); + emberAfReadAttribute(endpoint, Clusters::EcosystemInformation::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + if (Traits::IsNullValue(temp)) { - return Protocols::InteractionModel::Status::ConstraintError; + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); } - *value = Traits::StorageToWorking(temp); return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint64_t value, MarkAttributeDirty markDirty) { - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) { return Protocols::InteractionModel::Status::ConstraintError; } Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(endpoint, Clusters::EcosystemInformation::Id, Id, writable, ZCL_EPOCH_US_ATTRIBUTE_TYPE, + markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint64_t value) { - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) { return Protocols::InteractionModel::Status::ConstraintError; } Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EcosystemInformation::Id, Id, writable, ZCL_EPOCH_US_ATTRIBUTE_TYPE); } -} // namespace BlockUnrated +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EcosystemInformation::Id, Id, writable, ZCL_EPOCH_US_ATTRIBUTE_TYPE, + markDirty); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EcosystemInformation::Id, Id, writable, ZCL_EPOCH_US_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty) +{ + if (value.IsNull()) + { + return SetNull(endpoint, markDirty); + } + + return Set(endpoint, value.Value(), markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace RemovedOn namespace FeatureMap { @@ -38071,7 +38076,7 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * va Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ContentControl::Id, Id, readable, sizeof(temp)); + emberAfReadAttribute(endpoint, Clusters::EcosystemInformation::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { @@ -38091,7 +38096,8 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(endpoint, Clusters::EcosystemInformation::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE, + markDirty); } Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) @@ -38104,7 +38110,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EcosystemInformation::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); } } // namespace FeatureMap @@ -38117,7 +38123,7 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * va Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ContentControl::Id, Id, readable, sizeof(temp)); + emberAfReadAttribute(endpoint, Clusters::EcosystemInformation::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { @@ -38137,7 +38143,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(endpoint, Clusters::EcosystemInformation::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE, markDirty); } Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value) @@ -38150,17 +38156,67 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ContentControl::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EcosystemInformation::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); } } // namespace ClusterRevision } // namespace Attributes -} // namespace ContentControl +} // namespace EcosystemInformation -namespace ContentAppObserver { +namespace CommissionerControl { namespace Attributes { +namespace SupportedDeviceCategories { + +Protocols::InteractionModel::Status +Get(chip::EndpointId endpoint, chip::BitMask * value) +{ + using Traits = NumericAttributeTraits>; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::CommissionerControl::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(chip::EndpointId endpoint, chip::BitMask 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(endpoint, Clusters::CommissionerControl::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, chip::BitMask 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::CommissionerControl::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); +} + +} // namespace SupportedDeviceCategories + namespace FeatureMap { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value) @@ -38169,7 +38225,7 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * va Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ContentAppObserver::Id, Id, readable, sizeof(temp)); + emberAfReadAttribute(endpoint, Clusters::CommissionerControl::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { @@ -38189,7 +38245,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ContentAppObserver::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(endpoint, Clusters::CommissionerControl::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE, markDirty); } Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value) @@ -38202,7 +38258,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ContentAppObserver::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::CommissionerControl::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); } } // namespace FeatureMap @@ -38215,7 +38271,7 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * va Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::ContentAppObserver::Id, Id, readable, sizeof(temp)); + emberAfReadAttribute(endpoint, Clusters::CommissionerControl::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { @@ -38235,7 +38291,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ContentAppObserver::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(endpoint, Clusters::CommissionerControl::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE, markDirty); } Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value) @@ -38248,13 +38304,13 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ContentAppObserver::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::CommissionerControl::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); } } // namespace ClusterRevision } // namespace Attributes -} // namespace ContentAppObserver +} // namespace CommissionerControl namespace ElectricalMeasurement { namespace Attributes { 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 acf4ff18b97443..991677cfbf4549 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 @@ -2467,6 +2467,10 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu } // namespace Attributes } // namespace ElectricalEnergyMeasurement +namespace WaterHeaterManagement { +namespace Attributes {} // namespace Attributes +} // namespace WaterHeaterManagement + namespace DemandResponseLoadControl { namespace Attributes { @@ -2633,6 +2637,40 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu } // namespace Attributes } // namespace EnergyEvseMode +namespace WaterHeaterMode { +namespace Attributes { + +namespace StartUpMode { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int8u +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty); +} // namespace StartUpMode + +namespace OnMode { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int8u +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty); +} // namespace OnMode + +namespace ClusterRevision { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value); // int16u +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace WaterHeaterMode + namespace DeviceEnergyManagementMode { namespace Attributes { @@ -4055,17 +4093,6 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value); Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value, MarkAttributeDirty markDirty); } // namespace PresetsSchedulesEditable -namespace TemperatureSetpointHoldPolicy { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, - chip::BitMask * - value); // TemperatureSetpointHoldPolicyBitmap -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::BitMask value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::BitMask value, - MarkAttributeDirty markDirty); -} // namespace TemperatureSetpointHoldPolicy - namespace SetpointHoldExpiryTimestamp { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_s Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); @@ -5383,47 +5410,6 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu namespace ThreadBorderRouterManagement { namespace Attributes { -namespace BorderRouterName { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::MutableCharSpan & value); // char_string -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value, MarkAttributeDirty markDirty); -} // namespace BorderRouterName - -namespace BorderAgentID { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::MutableByteSpan & value); // octet_string -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::ByteSpan value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::ByteSpan value, MarkAttributeDirty markDirty); -} // namespace BorderAgentID - -namespace ThreadVersion { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value); // int16u -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); -} // namespace ThreadVersion - -namespace InterfaceEnabled { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, bool * value); // boolean -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value, MarkAttributeDirty markDirty); -} // namespace InterfaceEnabled - -namespace ActiveDatasetTimestamp { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int64u -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint64_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint64_t value, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, - MarkAttributeDirty markDirty); -} // namespace ActiveDatasetTimestamp - -namespace FeatureMap { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); -} // namespace FeatureMap - namespace ClusterRevision { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value); // int16u Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value); @@ -5436,23 +5422,6 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu namespace ThreadNetworkDirectory { namespace Attributes { -namespace PreferredExtendedPanID { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int64u -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint64_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint64_t value, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); -Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, - MarkAttributeDirty markDirty); -} // namespace PreferredExtendedPanID - -namespace ThreadNetworkTableSize { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value); // int8u -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty); -} // namespace ThreadNetworkTableSize - namespace FeatureMap { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); @@ -5894,6 +5863,64 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t valu } // namespace Attributes } // namespace ContentAppObserver +namespace EcosystemInformation { +namespace Attributes { + +namespace RemovedOn { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_us +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint64_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint64_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty); +} // namespace RemovedOn + +namespace FeatureMap { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +} // namespace FeatureMap + +namespace ClusterRevision { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value); // int16u +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace EcosystemInformation + +namespace CommissionerControl { +namespace Attributes { + +namespace SupportedDeviceCategories { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, + chip::BitMask * + value); // SupportedDeviceCategoryBitmap +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, chip::BitMask value); +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, chip::BitMask value, + MarkAttributeDirty markDirty); +} // namespace SupportedDeviceCategories + +namespace FeatureMap { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value, MarkAttributeDirty markDirty); +} // namespace FeatureMap + +namespace ClusterRevision { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value); // int16u +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace CommissionerControl + namespace ElectricalMeasurement { namespace Attributes { 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 104f2a09bfb362..248292de5747fb 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -368,6 +368,11 @@ void emberAfElectricalPowerMeasurementClusterInitCallback(chip::EndpointId endpo */ void emberAfElectricalEnergyMeasurementClusterInitCallback(chip::EndpointId endpoint); +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfWaterHeaterManagementClusterInitCallback(chip::EndpointId endpoint); + /** * @param endpoint Endpoint that is being initialized */ @@ -403,6 +408,11 @@ void emberAfPowerTopologyClusterInitCallback(chip::EndpointId endpoint); */ void emberAfEnergyEvseModeClusterInitCallback(chip::EndpointId endpoint); +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfWaterHeaterModeClusterInitCallback(chip::EndpointId endpoint); + /** * @param endpoint Endpoint that is being initialized */ @@ -623,6 +633,16 @@ void emberAfContentControlClusterInitCallback(chip::EndpointId endpoint); */ void emberAfContentAppObserverClusterInitCallback(chip::EndpointId endpoint); +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfEcosystemInformationClusterInitCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfCommissionerControlClusterInitCallback(chip::EndpointId endpoint); + /** * @param endpoint Endpoint that is being initialized */ @@ -3230,6 +3250,44 @@ chip::Protocols::InteractionModel::Status MatterElectricalEnergyMeasurementClust */ void emberAfElectricalEnergyMeasurementClusterServerTickCallback(chip::EndpointId endpoint); +// +// Water Heater Management Cluster +// + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfWaterHeaterManagementClusterServerInitCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being shutdown + */ +void MatterWaterHeaterManagementClusterServerShutdownCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfWaterHeaterManagementClusterClientInitCallback(chip::EndpointId endpoint); + +/** + * @param attributePath Concrete attribute path that changed + */ +void MatterWaterHeaterManagementClusterServerAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath); + +/** + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +chip::Protocols::InteractionModel::Status MatterWaterHeaterManagementClusterServerPreAttributeChangedCallback( + const chip::app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); + +/** + * @param endpoint Endpoint that is being served + */ +void emberAfWaterHeaterManagementClusterServerTickCallback(chip::EndpointId endpoint); + // // Demand Response Load Control Cluster // @@ -3501,6 +3559,45 @@ MatterEnergyEvseModeClusterServerPreAttributeChangedCallback(const chip::app::Co */ void emberAfEnergyEvseModeClusterServerTickCallback(chip::EndpointId endpoint); +// +// Water Heater Mode Cluster +// + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfWaterHeaterModeClusterServerInitCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being shutdown + */ +void MatterWaterHeaterModeClusterServerShutdownCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfWaterHeaterModeClusterClientInitCallback(chip::EndpointId endpoint); + +/** + * @param attributePath Concrete attribute path that changed + */ +void MatterWaterHeaterModeClusterServerAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath); + +/** + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +chip::Protocols::InteractionModel::Status +MatterWaterHeaterModeClusterServerPreAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath, + EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); + +/** + * @param endpoint Endpoint that is being served + */ +void emberAfWaterHeaterModeClusterServerTickCallback(chip::EndpointId endpoint); + // // Device Energy Management Mode Cluster // @@ -5206,6 +5303,82 @@ chip::Protocols::InteractionModel::Status MatterContentAppObserverClusterServerP */ void emberAfContentAppObserverClusterServerTickCallback(chip::EndpointId endpoint); +// +// Ecosystem Information Cluster +// + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfEcosystemInformationClusterServerInitCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being shutdown + */ +void MatterEcosystemInformationClusterServerShutdownCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfEcosystemInformationClusterClientInitCallback(chip::EndpointId endpoint); + +/** + * @param attributePath Concrete attribute path that changed + */ +void MatterEcosystemInformationClusterServerAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath); + +/** + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +chip::Protocols::InteractionModel::Status MatterEcosystemInformationClusterServerPreAttributeChangedCallback( + const chip::app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); + +/** + * @param endpoint Endpoint that is being served + */ +void emberAfEcosystemInformationClusterServerTickCallback(chip::EndpointId endpoint); + +// +// Commissioner Control Cluster +// + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfCommissionerControlClusterServerInitCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being shutdown + */ +void MatterCommissionerControlClusterServerShutdownCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfCommissionerControlClusterClientInitCallback(chip::EndpointId endpoint); + +/** + * @param attributePath Concrete attribute path that changed + */ +void MatterCommissionerControlClusterServerAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath); + +/** + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +chip::Protocols::InteractionModel::Status MatterCommissionerControlClusterServerPreAttributeChangedCallback( + const chip::app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); + +/** + * @param endpoint Endpoint that is being served + */ +void emberAfCommissionerControlClusterServerTickCallback(chip::EndpointId endpoint); + // // Electrical Measurement Cluster // @@ -5498,6 +5671,12 @@ bool emberAfLevelControlClusterStopWithOnOffCallback( bool emberAfLevelControlClusterMoveToClosestFrequencyCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::LevelControl::Commands::MoveToClosestFrequency::DecodableType & commandData); +/** + * @brief Access Control Cluster ReviewFabricRestrictions Command callback (from client) + */ +bool emberAfAccessControlClusterReviewFabricRestrictionsCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::AccessControl::Commands::ReviewFabricRestrictions::DecodableType & commandData); /** * @brief Actions Cluster InstantAction Command callback (from client) */ @@ -5696,6 +5875,12 @@ bool emberAfTimeSynchronizationClusterSetDSTOffsetCallback( bool emberAfTimeSynchronizationClusterSetDefaultNTPCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::TimeSynchronization::Commands::SetDefaultNTP::DecodableType & commandData); +/** + * @brief Bridged Device Basic Information Cluster KeepActive Command callback (from client) + */ +bool emberAfBridgedDeviceBasicInformationClusterKeepActiveCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::BridgedDeviceBasicInformation::Commands::KeepActive::DecodableType & commandData); /** * @brief Administrator Commissioning Cluster OpenCommissioningWindow Command callback (from client) */ @@ -6169,18 +6354,6 @@ bool emberAfThermostatClusterCancelPresetsSchedulesEditRequestCallback( bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Thermostat::Commands::CommitPresetsSchedulesRequest::DecodableType & commandData); -/** - * @brief Thermostat Cluster CancelSetActivePresetRequest Command callback (from client) - */ -bool emberAfThermostatClusterCancelSetActivePresetRequestCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::CancelSetActivePresetRequest::DecodableType & commandData); -/** - * @brief Thermostat Cluster SetTemperatureSetpointHoldPolicy Command callback (from client) - */ -bool emberAfThermostatClusterSetTemperatureSetpointHoldPolicyCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::SetTemperatureSetpointHoldPolicy::DecodableType & commandData); /** * @brief Fan Control Cluster Step Command callback (from client) */ @@ -6301,48 +6474,6 @@ bool emberAfColorControlClusterMoveColorTemperatureCallback( bool emberAfColorControlClusterStepColorTemperatureCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::ColorControl::Commands::StepColorTemperature::DecodableType & commandData); -/** - * @brief Thread Border Router Management Cluster GetActiveDatasetRequest Command callback (from client) - */ -bool emberAfThreadBorderRouterManagementClusterGetActiveDatasetRequestCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::ThreadBorderRouterManagement::Commands::GetActiveDatasetRequest::DecodableType & commandData); -/** - * @brief Thread Border Router Management Cluster GetPendingDatasetRequest Command callback (from client) - */ -bool emberAfThreadBorderRouterManagementClusterGetPendingDatasetRequestCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::ThreadBorderRouterManagement::Commands::GetPendingDatasetRequest::DecodableType & commandData); -/** - * @brief Thread Border Router Management Cluster SetActiveDatasetRequest Command callback (from client) - */ -bool emberAfThreadBorderRouterManagementClusterSetActiveDatasetRequestCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::ThreadBorderRouterManagement::Commands::SetActiveDatasetRequest::DecodableType & commandData); -/** - * @brief Thread Border Router Management Cluster SetPendingDatasetRequest Command callback (from client) - */ -bool emberAfThreadBorderRouterManagementClusterSetPendingDatasetRequestCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::ThreadBorderRouterManagement::Commands::SetPendingDatasetRequest::DecodableType & commandData); -/** - * @brief Thread Network Directory Cluster AddNetwork Command callback (from client) - */ -bool emberAfThreadNetworkDirectoryClusterAddNetworkCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::ThreadNetworkDirectory::Commands::AddNetwork::DecodableType & commandData); -/** - * @brief Thread Network Directory Cluster RemoveNetwork Command callback (from client) - */ -bool emberAfThreadNetworkDirectoryClusterRemoveNetworkCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::ThreadNetworkDirectory::Commands::RemoveNetwork::DecodableType & commandData); -/** - * @brief Thread Network Directory Cluster GetOperationalDataset Command callback (from client) - */ -bool emberAfThreadNetworkDirectoryClusterGetOperationalDatasetCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::ThreadNetworkDirectory::Commands::GetOperationalDataset::DecodableType & commandData); /** * @brief Channel Cluster ChangeChannel Command callback (from client) */ @@ -6630,6 +6761,18 @@ bool emberAfContentControlClusterSetScheduledContentRatingThresholdCallback( bool emberAfContentAppObserverClusterContentAppMessageCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::ContentAppObserver::Commands::ContentAppMessage::DecodableType & commandData); +/** + * @brief Commissioner Control Cluster RequestCommissioningApproval Command callback (from client) + */ +bool emberAfCommissionerControlClusterRequestCommissioningApprovalCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::CommissionerControl::Commands::RequestCommissioningApproval::DecodableType & commandData); +/** + * @brief Commissioner Control Cluster CommissionNode Command callback (from client) + */ +bool emberAfCommissionerControlClusterCommissionNodeCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::CommissionerControl::Commands::CommissionNode::DecodableType & commandData); /** * @brief Electrical Measurement Cluster GetProfileInfoCommand Command callback (from client) */ diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h index 7e52fd09a2c13c..228a214df7339e 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h @@ -24,6 +24,111 @@ namespace chip { namespace app { namespace Clusters { +static auto __attribute__((unused)) EnsureKnownEnumValue(detail::AreaTypeTag val) +{ + using EnumType = detail::AreaTypeTag; + switch (val) + { + case EnumType::kAisle: + case EnumType::kAttic: + case EnumType::kBackDoor: + case EnumType::kBackYard: + case EnumType::kBalcony: + case EnumType::kBallroom: + case EnumType::kBathroom: + case EnumType::kBedroom: + case EnumType::kBorder: + case EnumType::kBoxroom: + case EnumType::kBreakfastRoom: + case EnumType::kCarport: + case EnumType::kCellar: + case EnumType::kCloakroom: + case EnumType::kCloset: + case EnumType::kConservatory: + case EnumType::kCorridor: + case EnumType::kCraftRoom: + case EnumType::kCupboard: + case EnumType::kDeck: + case EnumType::kDen: + case EnumType::kDining: + case EnumType::kDrawingRoom: + case EnumType::kDressingRoom: + case EnumType::kDriveway: + case EnumType::kElevator: + case EnumType::kEnsuite: + case EnumType::kEntrance: + case EnumType::kEntryway: + case EnumType::kFamilyRoom: + case EnumType::kFoyer: + case EnumType::kFrontDoor: + case EnumType::kFrontYard: + case EnumType::kGameRoom: + case EnumType::kGarage: + case EnumType::kGarageDoor: + case EnumType::kGarden: + case EnumType::kGardenDoor: + case EnumType::kGuestBathroom: + case EnumType::kGuestBedroom: + case EnumType::kGuestRestroom: + case EnumType::kGuestRoom: + case EnumType::kGym: + case EnumType::kHallway: + case EnumType::kHearthRoom: + case EnumType::kKidsRoom: + case EnumType::kKidsBedroom: + case EnumType::kKitchen: + case EnumType::kLarder: + case EnumType::kLaundryRoom: + case EnumType::kLawn: + case EnumType::kLibrary: + case EnumType::kLivingRoom: + case EnumType::kLounge: + case EnumType::kMediaTvRoom: + case EnumType::kMudRoom: + case EnumType::kMusicRoom: + case EnumType::kNursery: + case EnumType::kOffice: + case EnumType::kOutdoorKitchen: + case EnumType::kOutside: + case EnumType::kPantry: + case EnumType::kParkingLot: + case EnumType::kParlor: + case EnumType::kPatio: + case EnumType::kPlayRoom: + case EnumType::kPoolRoom: + case EnumType::kPorch: + case EnumType::kPrimaryBathroom: + case EnumType::kPrimaryBedroom: + case EnumType::kRamp: + case EnumType::kReceptionRoom: + case EnumType::kRecreationRoom: + case EnumType::kRestroom: + case EnumType::kRoof: + case EnumType::kSauna: + case EnumType::kScullery: + case EnumType::kSewingRoom: + case EnumType::kShed: + case EnumType::kSideDoor: + case EnumType::kSideYard: + case EnumType::kSittingRoom: + case EnumType::kSnug: + case EnumType::kSpa: + case EnumType::kStaircase: + case EnumType::kSteamRoom: + case EnumType::kStorageRoom: + case EnumType::kStudio: + case EnumType::kStudy: + case EnumType::kSunRoom: + case EnumType::kSwimmingPool: + case EnumType::kTerrace: + case EnumType::kUtilityRoom: + case EnumType::kWard: + case EnumType::kWorkshop: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} static auto __attribute__((unused)) EnsureKnownEnumValue(detail::ChangeIndicationEnum val) { using EnumType = detail::ChangeIndicationEnum; @@ -163,6 +268,19 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(detail::ProductIdentifi return EnumType::kUnknownEnumValue; } } +static auto __attribute__((unused)) EnsureKnownEnumValue(Globals::TestGlobalEnum val) +{ + using EnumType = Globals::TestGlobalEnum; + switch (val) + { + case EnumType::kSomeValue: + case EnumType::kSomeOtherValue: + case EnumType::kFinalValue: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} static auto __attribute__((unused)) EnsureKnownEnumValue(Identify::EffectIdentifierEnum val) { @@ -311,6 +429,20 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(AccessControl::AccessCo return EnumType::kUnknownEnumValue; } } +static auto __attribute__((unused)) EnsureKnownEnumValue(AccessControl::AccessRestrictionTypeEnum val) +{ + using EnumType = AccessControl::AccessRestrictionTypeEnum; + switch (val) + { + case EnumType::kAttributeAccessForbidden: + case EnumType::kAttributeWriteForbidden: + case EnumType::kCommandForbidden: + case EnumType::kEventForbidden: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} static auto __attribute__((unused)) EnsureKnownEnumValue(AccessControl::ChangeTypeEnum val) { using EnumType = AccessControl::ChangeTypeEnum; @@ -1572,6 +1704,19 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(ElectricalPowerMeasurem } } +static auto __attribute__((unused)) EnsureKnownEnumValue(WaterHeaterManagement::BoostStateEnum val) +{ + using EnumType = WaterHeaterManagement::BoostStateEnum; + switch (val) + { + case EnumType::kInactive: + case EnumType::kActive: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} + static auto __attribute__((unused)) EnsureKnownEnumValue(DemandResponseLoadControl::CriticalityLevelEnum val) { using EnumType = DemandResponseLoadControl::CriticalityLevelEnum; @@ -1860,6 +2005,7 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(EnergyEvse::SupplyState case EnumType::kDischargingEnabled: case EnumType::kDisabledError: case EnumType::kDisabledDiagnostics: + case EnumType::kEnabled: return val; default: return EnumType::kUnknownEnumValue; @@ -2280,111 +2426,6 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(WindowCovering::Type va } } -static auto __attribute__((unused)) EnsureKnownEnumValue(ServiceArea::AreaTypeTag val) -{ - using EnumType = ServiceArea::AreaTypeTag; - switch (val) - { - case EnumType::kAisle: - case EnumType::kAttic: - case EnumType::kBackDoor: - case EnumType::kBackYard: - case EnumType::kBalcony: - case EnumType::kBallroom: - case EnumType::kBathroom: - case EnumType::kBedroom: - case EnumType::kBorder: - case EnumType::kBoxroom: - case EnumType::kBreakfastRoom: - case EnumType::kCarport: - case EnumType::kCellar: - case EnumType::kCloakroom: - case EnumType::kCloset: - case EnumType::kConservatory: - case EnumType::kCorridor: - case EnumType::kCraftRoom: - case EnumType::kCupboard: - case EnumType::kDeck: - case EnumType::kDen: - case EnumType::kDining: - case EnumType::kDrawingRoom: - case EnumType::kDressingRoom: - case EnumType::kDriveway: - case EnumType::kElevator: - case EnumType::kEnsuite: - case EnumType::kEntrance: - case EnumType::kEntryway: - case EnumType::kFamilyRoom: - case EnumType::kFoyer: - case EnumType::kFrontDoor: - case EnumType::kFrontYard: - case EnumType::kGameRoom: - case EnumType::kGarage: - case EnumType::kGarageDoor: - case EnumType::kGarden: - case EnumType::kGardenDoor: - case EnumType::kGuestBathroom: - case EnumType::kGuestBedroom: - case EnumType::kGuestRestroom: - case EnumType::kGuestRoom: - case EnumType::kGym: - case EnumType::kHallway: - case EnumType::kHearthRoom: - case EnumType::kKidsRoom: - case EnumType::kKidsBedroom: - case EnumType::kKitchen: - case EnumType::kLarder: - case EnumType::kLaundryRoom: - case EnumType::kLawn: - case EnumType::kLibrary: - case EnumType::kLivingRoom: - case EnumType::kLounge: - case EnumType::kMediaTvRoom: - case EnumType::kMudRoom: - case EnumType::kMusicRoom: - case EnumType::kNursery: - case EnumType::kOffice: - case EnumType::kOutdoorKitchen: - case EnumType::kOutside: - case EnumType::kPantry: - case EnumType::kParkingLot: - case EnumType::kParlor: - case EnumType::kPatio: - case EnumType::kPlayRoom: - case EnumType::kPoolRoom: - case EnumType::kPorch: - case EnumType::kPrimaryBathroom: - case EnumType::kPrimaryBedroom: - case EnumType::kRamp: - case EnumType::kReceptionRoom: - case EnumType::kRecreationRoom: - case EnumType::kRestroom: - case EnumType::kRoof: - case EnumType::kSauna: - case EnumType::kScullery: - case EnumType::kSewingRoom: - case EnumType::kShed: - case EnumType::kSideDoor: - case EnumType::kSideYard: - case EnumType::kSittingRoom: - case EnumType::kSnug: - case EnumType::kSpa: - case EnumType::kStaircase: - case EnumType::kSteamRoom: - case EnumType::kStorageRoom: - case EnumType::kStudio: - case EnumType::kStudy: - case EnumType::kSunRoom: - case EnumType::kSwimmingPool: - case EnumType::kTerrace: - case EnumType::kUtilityRoom: - case EnumType::kWard: - case EnumType::kWorkshop: - return val; - default: - return EnumType::kUnknownEnumValue; - } -} static auto __attribute__((unused)) EnsureKnownEnumValue(ServiceArea::FloorSurfaceTag val) { using EnumType = ServiceArea::FloorSurfaceTag; @@ -2674,6 +2715,7 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(Thermostat::PresetScena case EnumType::kSleep: case EnumType::kWake: case EnumType::kVacation: + case EnumType::kGoingToSleep: case EnumType::kUserDefined: return val; default: 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 52e953741808d1..0f4a640e84a4e3 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 @@ -28,6 +28,111 @@ namespace Clusters { namespace detail { // Enums shared across multiple clusters. +// Enum for AreaTypeTag +enum class AreaTypeTag : uint8_t +{ + kAisle = 0x00, + kAttic = 0x01, + kBackDoor = 0x02, + kBackYard = 0x03, + kBalcony = 0x04, + kBallroom = 0x05, + kBathroom = 0x06, + kBedroom = 0x07, + kBorder = 0x08, + kBoxroom = 0x09, + kBreakfastRoom = 0x0A, + kCarport = 0x0B, + kCellar = 0x0C, + kCloakroom = 0x0D, + kCloset = 0x0E, + kConservatory = 0x0F, + kCorridor = 0x10, + kCraftRoom = 0x11, + kCupboard = 0x12, + kDeck = 0x13, + kDen = 0x14, + kDining = 0x15, + kDrawingRoom = 0x16, + kDressingRoom = 0x17, + kDriveway = 0x18, + kElevator = 0x19, + kEnsuite = 0x1A, + kEntrance = 0x1B, + kEntryway = 0x1C, + kFamilyRoom = 0x1D, + kFoyer = 0x1E, + kFrontDoor = 0x1F, + kFrontYard = 0x20, + kGameRoom = 0x21, + kGarage = 0x22, + kGarageDoor = 0x23, + kGarden = 0x24, + kGardenDoor = 0x25, + kGuestBathroom = 0x26, + kGuestBedroom = 0x27, + kGuestRestroom = 0x28, + kGuestRoom = 0x29, + kGym = 0x2A, + kHallway = 0x2B, + kHearthRoom = 0x2C, + kKidsRoom = 0x2D, + kKidsBedroom = 0x2E, + kKitchen = 0x2F, + kLarder = 0x30, + kLaundryRoom = 0x31, + kLawn = 0x32, + kLibrary = 0x33, + kLivingRoom = 0x34, + kLounge = 0x35, + kMediaTvRoom = 0x36, + kMudRoom = 0x37, + kMusicRoom = 0x38, + kNursery = 0x39, + kOffice = 0x3A, + kOutdoorKitchen = 0x3B, + kOutside = 0x3C, + kPantry = 0x3D, + kParkingLot = 0x3E, + kParlor = 0x3F, + kPatio = 0x40, + kPlayRoom = 0x41, + kPoolRoom = 0x42, + kPorch = 0x43, + kPrimaryBathroom = 0x44, + kPrimaryBedroom = 0x45, + kRamp = 0x46, + kReceptionRoom = 0x47, + kRecreationRoom = 0x48, + kRestroom = 0x49, + kRoof = 0x4A, + kSauna = 0x4B, + kScullery = 0x4C, + kSewingRoom = 0x4D, + kShed = 0x4E, + kSideDoor = 0x4F, + kSideYard = 0x50, + kSittingRoom = 0x51, + kSnug = 0x52, + kSpa = 0x53, + kStaircase = 0x54, + kSteamRoom = 0x55, + kStorageRoom = 0x56, + kStudio = 0x57, + kStudy = 0x58, + kSunRoom = 0x59, + kSwimmingPool = 0x5A, + kTerrace = 0x5B, + kUtilityRoom = 0x5C, + kWard = 0x5D, + kWorkshop = 0x5E, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 95, +}; + // Enum for ChangeIndicationEnum enum class ChangeIndicationEnum : uint8_t { @@ -171,6 +276,33 @@ enum class ProductIdentifierTypeEnum : uint8_t } // namespace detail +namespace Globals { +// Global enums. + +// Enum for TestGlobalEnum +enum class TestGlobalEnum : uint8_t +{ + kSomeValue = 0x00, + kSomeOtherValue = 0x01, + kFinalValue = 0x02, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 3, +}; + +// Global bitmaps. + +// Bitmap for TestGlobalBitmap +enum class TestGlobalBitmap : uint32_t +{ + kFirstBit = 0x1, + kSecondBit = 0x2, +}; + +} // namespace Globals + namespace Identify { // Enum for EffectIdentifierEnum @@ -387,6 +519,20 @@ enum class AccessControlEntryPrivilegeEnum : uint8_t kUnknownEnumValue = 0, }; +// Enum for AccessRestrictionTypeEnum +enum class AccessRestrictionTypeEnum : uint8_t +{ + kAttributeAccessForbidden = 0x00, + kAttributeWriteForbidden = 0x01, + kCommandForbidden = 0x02, + kEventForbidden = 0x03, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 4, +}; + // Enum for ChangeTypeEnum enum class ChangeTypeEnum : uint8_t { @@ -399,6 +545,13 @@ enum class ChangeTypeEnum : uint8_t // enum value. This specific should never be transmitted. kUnknownEnumValue = 3, }; + +// Bitmap for Feature +enum class Feature : uint32_t +{ + kExtension = 0x1, + kManagedDevice = 0x2, +}; } // namespace AccessControl namespace Actions { @@ -1480,6 +1633,12 @@ enum class ProductFinishEnum : uint8_t // enum value. This specific should never be transmitted. kUnknownEnumValue = 6, }; + +// Bitmap for Feature +enum class Feature : uint32_t +{ + kBridgedICDSupport = 0x100000, +}; } // namespace BridgedDeviceBasicInformation namespace Switch { @@ -1631,6 +1790,7 @@ enum class Feature : uint32_t kCheckInProtocolSupport = 0x1, kUserActiveModeTrigger = 0x2, kLongIdleTimeSupport = 0x4, + kDynamicSitLitSupport = 0x8, }; // Bitmap for UserActiveModeTriggerBitmap @@ -2299,6 +2459,48 @@ enum class Feature : uint32_t }; } // namespace ElectricalEnergyMeasurement +namespace WaterHeaterManagement { + +// Enum for BoostStateEnum +enum class BoostStateEnum : uint8_t +{ + kInactive = 0x00, + kActive = 0x01, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 2, +}; + +// Bitmap for Feature +enum class Feature : uint32_t +{ + kEnergyManagement = 0x1, + kTankPercent = 0x2, +}; + +// Bitmap for WaterHeaterDemandBitmap +enum class WaterHeaterDemandBitmap : uint8_t +{ + kImmersionElement1 = 0x1, + kImmersionElement2 = 0x2, + kHeatPump = 0x4, + kBoiler = 0x8, + kOther = 0x10, +}; + +// Bitmap for WaterHeaterTypeBitmap +enum class WaterHeaterTypeBitmap : uint8_t +{ + kImmersionElement1 = 0x1, + kImmersionElement2 = 0x2, + kHeatPump = 0x4, + kBoiler = 0x8, + kOther = 0x10, +}; +} // namespace WaterHeaterManagement + namespace DemandResponseLoadControl { // Enum for CriticalityLevelEnum @@ -2677,11 +2879,12 @@ enum class SupplyStateEnum : uint8_t kDischargingEnabled = 0x02, kDisabledError = 0x03, kDisabledDiagnostics = 0x04, + kEnabled = 0x05, // All received enum values that are not listed above will be mapped // to kUnknownEnumValue. This is a helper enum value that should only // be used by code to process how it handles receiving and unknown // enum value. This specific should never be transmitted. - kUnknownEnumValue = 5, + kUnknownEnumValue = 6, }; // Bitmap for Feature @@ -2765,6 +2968,28 @@ enum class Feature : uint32_t }; } // namespace EnergyEvseMode +namespace WaterHeaterMode { + +// Enum for ModeTag +enum class ModeTag : uint16_t +{ + kOff = 0x4000, + kManual = 0x4001, + kTimed = 0x4002, + // kUnknownEnumValue intentionally not defined. This enum never goes + // through DataModel::Decode, likely because it is a part of a derived + // cluster. As a result having kUnknownEnumValue in this enum is error + // prone, and was removed. See + // src/app/common/templates/config-data.yaml. +}; + +// Bitmap for Feature +enum class Feature : uint32_t +{ + kOnOff = 0x1, +}; +} // namespace WaterHeaterMode + namespace DeviceEnergyManagementMode { // Enum for ModeTag @@ -3440,110 +3665,7 @@ enum class BarrierControlSafetyStatus : uint16_t namespace ServiceArea { -// Enum for AreaTypeTag -enum class AreaTypeTag : uint8_t -{ - kAisle = 0x00, - kAttic = 0x01, - kBackDoor = 0x02, - kBackYard = 0x03, - kBalcony = 0x04, - kBallroom = 0x05, - kBathroom = 0x06, - kBedroom = 0x07, - kBorder = 0x08, - kBoxroom = 0x09, - kBreakfastRoom = 0x0A, - kCarport = 0x0B, - kCellar = 0x0C, - kCloakroom = 0x0D, - kCloset = 0x0E, - kConservatory = 0x0F, - kCorridor = 0x10, - kCraftRoom = 0x11, - kCupboard = 0x12, - kDeck = 0x13, - kDen = 0x14, - kDining = 0x15, - kDrawingRoom = 0x16, - kDressingRoom = 0x17, - kDriveway = 0x18, - kElevator = 0x19, - kEnsuite = 0x1A, - kEntrance = 0x1B, - kEntryway = 0x1C, - kFamilyRoom = 0x1D, - kFoyer = 0x1E, - kFrontDoor = 0x1F, - kFrontYard = 0x20, - kGameRoom = 0x21, - kGarage = 0x22, - kGarageDoor = 0x23, - kGarden = 0x24, - kGardenDoor = 0x25, - kGuestBathroom = 0x26, - kGuestBedroom = 0x27, - kGuestRestroom = 0x28, - kGuestRoom = 0x29, - kGym = 0x2A, - kHallway = 0x2B, - kHearthRoom = 0x2C, - kKidsRoom = 0x2D, - kKidsBedroom = 0x2E, - kKitchen = 0x2F, - kLarder = 0x30, - kLaundryRoom = 0x31, - kLawn = 0x32, - kLibrary = 0x33, - kLivingRoom = 0x34, - kLounge = 0x35, - kMediaTvRoom = 0x36, - kMudRoom = 0x37, - kMusicRoom = 0x38, - kNursery = 0x39, - kOffice = 0x3A, - kOutdoorKitchen = 0x3B, - kOutside = 0x3C, - kPantry = 0x3D, - kParkingLot = 0x3E, - kParlor = 0x3F, - kPatio = 0x40, - kPlayRoom = 0x41, - kPoolRoom = 0x42, - kPorch = 0x43, - kPrimaryBathroom = 0x44, - kPrimaryBedroom = 0x45, - kRamp = 0x46, - kReceptionRoom = 0x47, - kRecreationRoom = 0x48, - kRestroom = 0x49, - kRoof = 0x4A, - kSauna = 0x4B, - kScullery = 0x4C, - kSewingRoom = 0x4D, - kShed = 0x4E, - kSideDoor = 0x4F, - kSideYard = 0x50, - kSittingRoom = 0x51, - kSnug = 0x52, - kSpa = 0x53, - kStaircase = 0x54, - kSteamRoom = 0x55, - kStorageRoom = 0x56, - kStudio = 0x57, - kStudy = 0x58, - kSunRoom = 0x59, - kSwimmingPool = 0x5A, - kTerrace = 0x5B, - kUtilityRoom = 0x5C, - kWard = 0x5D, - kWorkshop = 0x5E, - // All received enum values that are not listed above will be mapped - // to kUnknownEnumValue. This is a helper enum value that should only - // be used by code to process how it handles receiving and unknown - // enum value. This specific should never be transmitted. - kUnknownEnumValue = 95, -}; +using AreaTypeTag = Clusters::detail::AreaTypeTag; // Enum for FloorSurfaceTag enum class FloorSurfaceTag : uint8_t @@ -3863,13 +3985,14 @@ enum class ControlSequenceOfOperationEnum : uint8_t // Enum for PresetScenarioEnum enum class PresetScenarioEnum : uint8_t { - kUnspecified = 0x00, - kOccupied = 0x01, - kUnoccupied = 0x02, - kSleep = 0x03, - kWake = 0x04, - kVacation = 0x05, - kUserDefined = 0x06, + kUnspecified = 0x00, + kOccupied = 0x01, + kUnoccupied = 0x02, + kSleep = 0x03, + kWake = 0x04, + kVacation = 0x05, + kGoingToSleep = 0x06, + kUserDefined = 0xFE, // All received enum values that are not listed above will be mapped // to kUnknownEnumValue. This is a helper enum value that should only // be used by code to process how it handles receiving and unknown @@ -3987,7 +4110,6 @@ enum class Feature : uint32_t kMatterScheduleConfiguration = 0x80, kPresets = 0x100, kSetpoints = 0x200, - kQueuedPresetsSupported = 0x400, }; // Bitmap for HVACSystemTypeBitmap @@ -4062,13 +4184,6 @@ enum class ScheduleTypeFeaturesBitmap : uint16_t kSupportsNames = 0x4, kSupportsOff = 0x8, }; - -// Bitmap for TemperatureSetpointHoldPolicyBitmap -enum class TemperatureSetpointHoldPolicyBitmap : uint8_t -{ - kHoldDurationElapsed = 0x1, - kHoldDurationElapsedOrPresetChanged = 0x2, -}; } // namespace Thermostat namespace FanControl { @@ -5133,6 +5248,20 @@ enum class StatusEnum : uint8_t }; } // namespace ContentAppObserver +namespace EcosystemInformation { + +using AreaTypeTag = Clusters::detail::AreaTypeTag; +} // namespace EcosystemInformation + +namespace CommissionerControl { + +// Bitmap for SupportedDeviceCategoryBitmap +enum class SupportedDeviceCategoryBitmap : uint32_t +{ + kFabricSynchronization = 0x1, +}; +} // namespace CommissionerControl + namespace ElectricalMeasurement {} // namespace ElectricalMeasurement namespace UnitTesting { 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 42a36d6da15918..5be9fcbca49e35 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 @@ -294,6 +294,93 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace MeasurementAccuracyStruct +namespace LocationDescriptorStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kLocationName), locationName); + encoder.Encode(to_underlying(Fields::kFloorNumber), floorNumber); + encoder.Encode(to_underlying(Fields::kAreaType), areaType); + 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::kLocationName)) + { + err = DataModel::Decode(reader, locationName); + } + else if (__context_tag == to_underlying(Fields::kFloorNumber)) + { + err = DataModel::Decode(reader, floorNumber); + } + else if (__context_tag == to_underlying(Fields::kAreaType)) + { + err = DataModel::Decode(reader, areaType); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace LocationDescriptorStruct + +namespace DeviceTypeStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kDeviceType), deviceType); + encoder.Encode(to_underlying(Fields::kRevision), revision); + 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::kDeviceType)) + { + err = DataModel::Decode(reader, deviceType); + } + else if (__context_tag == to_underlying(Fields::kRevision)) + { + err = DataModel::Decode(reader, revision); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace DeviceTypeStruct + namespace ApplicationStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { @@ -465,6 +552,59 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace Structs } // namespace detail +namespace Globals { +// Global structs +namespace Structs { + +namespace TestGlobalStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kName), name); + encoder.Encode(to_underlying(Fields::kMyBitmap), myBitmap); + encoder.Encode(to_underlying(Fields::kMyEnum), myEnum); + 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::kName)) + { + err = DataModel::Decode(reader, name); + } + else if (__context_tag == to_underlying(Fields::kMyBitmap)) + { + err = DataModel::Decode(reader, myBitmap); + } + else if (__context_tag == to_underlying(Fields::kMyEnum)) + { + err = DataModel::Decode(reader, myEnum); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace TestGlobalStruct + +} // namespace Structs +} // namespace Globals + namespace Identify { namespace Commands { @@ -1761,47 +1901,6 @@ namespace Events {} // namespace Events namespace Descriptor { namespace Structs { -namespace DeviceTypeStruct { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kDeviceType), deviceType); - encoder.Encode(to_underlying(Fields::kRevision), revision); - 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::kDeviceType)) - { - err = DataModel::Decode(reader, deviceType); - } - else if (__context_tag == to_underlying(Fields::kRevision)) - { - err = DataModel::Decode(reader, revision); - } - else - { - } - - ReturnErrorOnFailure(err); - } -} - -} // namespace DeviceTypeStruct - namespace SemanticTagStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { @@ -2001,13 +2100,12 @@ namespace Events {} // namespace Events namespace AccessControl { namespace Structs { -namespace AccessControlTargetStruct { +namespace AccessRestrictionStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kCluster), cluster); - encoder.Encode(to_underlying(Fields::kEndpoint), endpoint); - encoder.Encode(to_underlying(Fields::kDeviceType), deviceType); + encoder.Encode(to_underlying(Fields::kType), type); + encoder.Encode(to_underlying(Fields::kId), id); return encoder.Finalize(); } @@ -2025,17 +2123,13 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) CHIP_ERROR err = CHIP_NO_ERROR; const uint8_t __context_tag = std::get(__element); - if (__context_tag == to_underlying(Fields::kCluster)) - { - err = DataModel::Decode(reader, cluster); - } - else if (__context_tag == to_underlying(Fields::kEndpoint)) + if (__context_tag == to_underlying(Fields::kType)) { - err = DataModel::Decode(reader, endpoint); + err = DataModel::Decode(reader, type); } - else if (__context_tag == to_underlying(Fields::kDeviceType)) + else if (__context_tag == to_underlying(Fields::kId)) { - err = DataModel::Decode(reader, deviceType); + err = DataModel::Decode(reader, id); } else { @@ -2045,46 +2139,15 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } -} // namespace AccessControlTargetStruct - -namespace AccessControlEntryStruct { -CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - return DoEncode(aWriter, aTag, NullOptional); -} - -CHIP_ERROR Type::EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const -{ - return DoEncode(aWriter, aTag, MakeOptional(aAccessingFabricIndex)); -} +} // namespace AccessRestrictionStruct -CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional & aAccessingFabricIndex) const +namespace CommissioningAccessRestrictionEntryStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { - bool includeSensitive = !aAccessingFabricIndex.HasValue() || (aAccessingFabricIndex.Value() == fabricIndex); - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - - if (includeSensitive) - { - encoder.Encode(to_underlying(Fields::kPrivilege), privilege); - } - if (includeSensitive) - { - encoder.Encode(to_underlying(Fields::kAuthMode), authMode); - } - if (includeSensitive) - { - encoder.Encode(to_underlying(Fields::kSubjects), subjects); - } - if (includeSensitive) - { - encoder.Encode(to_underlying(Fields::kTargets), targets); - } - if (aAccessingFabricIndex.HasValue()) - { - encoder.Encode(to_underlying(Fields::kFabricIndex), fabricIndex); - } - + encoder.Encode(to_underlying(Fields::kEndpoint), endpoint); + encoder.Encode(to_underlying(Fields::kCluster), cluster); + encoder.Encode(to_underlying(Fields::kRestrictions), restrictions); return encoder.Finalize(); } @@ -2102,25 +2165,17 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) CHIP_ERROR err = CHIP_NO_ERROR; const uint8_t __context_tag = std::get(__element); - if (__context_tag == to_underlying(Fields::kPrivilege)) - { - err = DataModel::Decode(reader, privilege); - } - else if (__context_tag == to_underlying(Fields::kAuthMode)) - { - err = DataModel::Decode(reader, authMode); - } - else if (__context_tag == to_underlying(Fields::kSubjects)) + if (__context_tag == to_underlying(Fields::kEndpoint)) { - err = DataModel::Decode(reader, subjects); + err = DataModel::Decode(reader, endpoint); } - else if (__context_tag == to_underlying(Fields::kTargets)) + else if (__context_tag == to_underlying(Fields::kCluster)) { - err = DataModel::Decode(reader, targets); + err = DataModel::Decode(reader, cluster); } - else if (__context_tag == to_underlying(Fields::kFabricIndex)) + else if (__context_tag == to_underlying(Fields::kRestrictions)) { - err = DataModel::Decode(reader, fabricIndex); + err = DataModel::Decode(reader, restrictions); } else { @@ -2130,9 +2185,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } -} // namespace AccessControlEntryStruct +} // namespace CommissioningAccessRestrictionEntryStruct -namespace AccessControlExtensionStruct { +namespace AccessRestrictionEntryStruct { CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { return DoEncode(aWriter, aTag, NullOptional); @@ -2151,7 +2206,15 @@ CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optiona if (includeSensitive) { - encoder.Encode(to_underlying(Fields::kData), data); + encoder.Encode(to_underlying(Fields::kEndpoint), endpoint); + } + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kCluster), cluster); + } + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kRestrictions), restrictions); } if (aAccessingFabricIndex.HasValue()) { @@ -2175,11 +2238,211 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) CHIP_ERROR err = CHIP_NO_ERROR; const uint8_t __context_tag = std::get(__element); - if (__context_tag == to_underlying(Fields::kData)) + if (__context_tag == to_underlying(Fields::kEndpoint)) { - err = DataModel::Decode(reader, data); + err = DataModel::Decode(reader, endpoint); } - else if (__context_tag == to_underlying(Fields::kFabricIndex)) + else if (__context_tag == to_underlying(Fields::kCluster)) + { + err = DataModel::Decode(reader, cluster); + } + else if (__context_tag == to_underlying(Fields::kRestrictions)) + { + err = DataModel::Decode(reader, restrictions); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace AccessRestrictionEntryStruct + +namespace AccessControlTargetStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kCluster), cluster); + encoder.Encode(to_underlying(Fields::kEndpoint), endpoint); + encoder.Encode(to_underlying(Fields::kDeviceType), deviceType); + 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::kCluster)) + { + err = DataModel::Decode(reader, cluster); + } + else if (__context_tag == to_underlying(Fields::kEndpoint)) + { + err = DataModel::Decode(reader, endpoint); + } + else if (__context_tag == to_underlying(Fields::kDeviceType)) + { + err = DataModel::Decode(reader, deviceType); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace AccessControlTargetStruct + +namespace AccessControlEntryStruct { +CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + return DoEncode(aWriter, aTag, NullOptional); +} + +CHIP_ERROR Type::EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const +{ + return DoEncode(aWriter, aTag, MakeOptional(aAccessingFabricIndex)); +} + +CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional & aAccessingFabricIndex) const +{ + bool includeSensitive = !aAccessingFabricIndex.HasValue() || (aAccessingFabricIndex.Value() == fabricIndex); + + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kPrivilege), privilege); + } + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kAuthMode), authMode); + } + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kSubjects), subjects); + } + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kTargets), targets); + } + if (aAccessingFabricIndex.HasValue()) + { + encoder.Encode(to_underlying(Fields::kFabricIndex), fabricIndex); + } + + 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::kPrivilege)) + { + err = DataModel::Decode(reader, privilege); + } + else if (__context_tag == to_underlying(Fields::kAuthMode)) + { + err = DataModel::Decode(reader, authMode); + } + else if (__context_tag == to_underlying(Fields::kSubjects)) + { + err = DataModel::Decode(reader, subjects); + } + else if (__context_tag == to_underlying(Fields::kTargets)) + { + err = DataModel::Decode(reader, targets); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace AccessControlEntryStruct + +namespace AccessControlExtensionStruct { +CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + return DoEncode(aWriter, aTag, NullOptional); +} + +CHIP_ERROR Type::EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const +{ + return DoEncode(aWriter, aTag, MakeOptional(aAccessingFabricIndex)); +} + +CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional & aAccessingFabricIndex) const +{ + bool includeSensitive = !aAccessingFabricIndex.HasValue() || (aAccessingFabricIndex.Value() == fabricIndex); + + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kData), data); + } + if (aAccessingFabricIndex.HasValue()) + { + encoder.Encode(to_underlying(Fields::kFabricIndex), fabricIndex); + } + + 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::kData)) + { + err = DataModel::Decode(reader, data); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) { err = DataModel::Decode(reader, fabricIndex); } @@ -2194,7 +2457,76 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace AccessControlExtensionStruct } // namespace Structs -namespace Commands {} // namespace Commands +namespace Commands { +namespace ReviewFabricRestrictions { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kArl), arl); + 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::kArl)) + { + err = DataModel::Decode(reader, arl); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace ReviewFabricRestrictions. +namespace ReviewFabricRestrictionsResponse { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kToken), token); + 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::kToken)) + { + err = DataModel::Decode(reader, token); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace ReviewFabricRestrictionsResponse. +} // namespace Commands namespace Attributes { CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path) @@ -2211,6 +2543,10 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, targetsPerAccessControlEntry); case Attributes::AccessControlEntriesPerFabric::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, accessControlEntriesPerFabric); + case Attributes::CommissioningARL::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, commissioningARL); + case Attributes::Arl::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, arl); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): @@ -2340,6 +2676,91 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } } // namespace AccessControlExtensionChanged. +namespace AccessRestrictionEntryChanged { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kFabricIndex), fabricIndex)); + return aWriter.EndContainer(outer); +} + +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::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace AccessRestrictionEntryChanged. +namespace FabricRestrictionReviewUpdate { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kToken), token)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kInstruction), instruction)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kRedirectURL), redirectURL)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kFabricIndex), fabricIndex)); + return aWriter.EndContainer(outer); +} + +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::kToken)) + { + err = DataModel::Decode(reader, token); + } + else if (__context_tag == to_underlying(Fields::kInstruction)) + { + err = DataModel::Decode(reader, instruction); + } + else if (__context_tag == to_underlying(Fields::kRedirectURL)) + { + err = DataModel::Decode(reader, redirectURL); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace FabricRestrictionReviewUpdate. } // namespace Events } // namespace AccessControl @@ -7678,7 +8099,42 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace ProductAppearanceStruct } // namespace Structs -namespace Commands {} // namespace Commands +namespace Commands { +namespace KeepActive { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kStayActiveDuration), stayActiveDuration); + 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::kStayActiveDuration)) + { + err = DataModel::Decode(reader, stayActiveDuration); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace KeepActive. +} // namespace Commands namespace Attributes { CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path) @@ -7848,6 +8304,41 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } } // namespace ReachableChanged. +namespace ActiveChanged { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kPromisedActiveDuration), promisedActiveDuration)); + return aWriter.EndContainer(outer); +} + +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::kPromisedActiveDuration)) + { + err = DataModel::Decode(reader, promisedActiveDuration); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace ActiveChanged. } // namespace Events } // namespace BridgedDeviceBasicInformation @@ -9896,6 +10387,8 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, userActiveModeTriggerInstruction); case Attributes::OperatingMode::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, operatingMode); + case Attributes::MaximumCheckInBackOff::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, maximumCheckInBackOff); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): @@ -12594,12 +13087,19 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) namespace ScenesManagement { namespace Structs { -namespace AttributeValuePair { +namespace AttributeValuePairStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; encoder.Encode(to_underlying(Fields::kAttributeID), attributeID); - encoder.Encode(to_underlying(Fields::kAttributeValue), attributeValue); + encoder.Encode(to_underlying(Fields::kValueUnsigned8), valueUnsigned8); + encoder.Encode(to_underlying(Fields::kValueSigned8), valueSigned8); + encoder.Encode(to_underlying(Fields::kValueUnsigned16), valueUnsigned16); + encoder.Encode(to_underlying(Fields::kValueSigned16), valueSigned16); + encoder.Encode(to_underlying(Fields::kValueUnsigned32), valueUnsigned32); + encoder.Encode(to_underlying(Fields::kValueSigned32), valueSigned32); + encoder.Encode(to_underlying(Fields::kValueUnsigned64), valueUnsigned64); + encoder.Encode(to_underlying(Fields::kValueSigned64), valueSigned64); return encoder.Finalize(); } @@ -12621,9 +13121,37 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { err = DataModel::Decode(reader, attributeID); } - else if (__context_tag == to_underlying(Fields::kAttributeValue)) + else if (__context_tag == to_underlying(Fields::kValueUnsigned8)) + { + err = DataModel::Decode(reader, valueUnsigned8); + } + else if (__context_tag == to_underlying(Fields::kValueSigned8)) + { + err = DataModel::Decode(reader, valueSigned8); + } + else if (__context_tag == to_underlying(Fields::kValueUnsigned16)) + { + err = DataModel::Decode(reader, valueUnsigned16); + } + else if (__context_tag == to_underlying(Fields::kValueSigned16)) + { + err = DataModel::Decode(reader, valueSigned16); + } + else if (__context_tag == to_underlying(Fields::kValueUnsigned32)) + { + err = DataModel::Decode(reader, valueUnsigned32); + } + else if (__context_tag == to_underlying(Fields::kValueSigned32)) + { + err = DataModel::Decode(reader, valueSigned32); + } + else if (__context_tag == to_underlying(Fields::kValueUnsigned64)) + { + err = DataModel::Decode(reader, valueUnsigned64); + } + else if (__context_tag == to_underlying(Fields::kValueSigned64)) { - err = DataModel::Decode(reader, attributeValue); + err = DataModel::Decode(reader, valueSigned64); } else { @@ -12633,7 +13161,7 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } -} // namespace AttributeValuePair +} // namespace AttributeValuePairStruct namespace ExtensionFieldSet { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const @@ -14515,6 +15043,128 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace Events } // namespace ElectricalEnergyMeasurement +namespace WaterHeaterManagement { + +namespace Commands { +namespace Boost { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kDuration), duration); + encoder.Encode(to_underlying(Fields::kOneShot), oneShot); + encoder.Encode(to_underlying(Fields::kEmergencyBoost), emergencyBoost); + encoder.Encode(to_underlying(Fields::kTemporarySetpoint), temporarySetpoint); + encoder.Encode(to_underlying(Fields::kTargetPercentage), targetPercentage); + encoder.Encode(to_underlying(Fields::kTargetReheat), targetReheat); + 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::kDuration)) + { + err = DataModel::Decode(reader, duration); + } + else if (__context_tag == to_underlying(Fields::kOneShot)) + { + err = DataModel::Decode(reader, oneShot); + } + else if (__context_tag == to_underlying(Fields::kEmergencyBoost)) + { + err = DataModel::Decode(reader, emergencyBoost); + } + else if (__context_tag == to_underlying(Fields::kTemporarySetpoint)) + { + err = DataModel::Decode(reader, temporarySetpoint); + } + else if (__context_tag == to_underlying(Fields::kTargetPercentage)) + { + err = DataModel::Decode(reader, targetPercentage); + } + else if (__context_tag == to_underlying(Fields::kTargetReheat)) + { + err = DataModel::Decode(reader, targetReheat); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace Boost. +namespace CancelBoost { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + 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); + } + } +} +} // namespace CancelBoost. +} // namespace Commands + +namespace Attributes { +CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path) +{ + switch (path.mAttributeId) + { + case Attributes::HeaterTypes::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, heaterTypes); + case Attributes::HeatDemand::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, heatDemand); + case Attributes::TankVolume::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, tankVolume); + case Attributes::EstimatedHeatRequired::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, estimatedHeatRequired); + case Attributes::TankPercentage::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, tankPercentage); + case Attributes::BoostState::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, boostState); + case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, generatedCommandList); + case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, acceptedCommandList); + case Attributes::EventList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, eventList); + case Attributes::AttributeList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, attributeList); + case Attributes::FeatureMap::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, featureMap); + case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, clusterRevision); + default: + return CHIP_NO_ERROR; + } +} +} // namespace Attributes + +namespace Events {} // namespace Events + +} // namespace WaterHeaterManagement namespace DemandResponseLoadControl { namespace Structs { @@ -16929,6 +17579,7 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kSessionID), sessionID)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kState), state)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kMaximumCurrent), maximumCurrent)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kMaximumDischargeCurrent), maximumDischargeCurrent)); return aWriter.EndContainer(outer); } @@ -16958,6 +17609,10 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { err = DataModel::Decode(reader, maximumCurrent); } + else if (__context_tag == to_underlying(Fields::kMaximumDischargeCurrent)) + { + err = DataModel::Decode(reader, maximumDischargeCurrent); + } else { } @@ -16975,6 +17630,7 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kState), state)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kReason), reason)); ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEnergyTransferred), energyTransferred)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEnergyDischarged), energyDischarged)); return aWriter.EndContainer(outer); } @@ -17006,7 +17662,11 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } else if (__context_tag == to_underlying(Fields::kEnergyTransferred)) { - err = DataModel::Decode(reader, energyTransferred); + err = DataModel::Decode(reader, energyTransferred); + } + else if (__context_tag == to_underlying(Fields::kEnergyDischarged)) + { + err = DataModel::Decode(reader, energyDischarged); } else { @@ -17334,6 +17994,119 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre namespace Events {} // namespace Events } // namespace EnergyEvseMode +namespace WaterHeaterMode { +namespace Structs {} // namespace Structs + +namespace Commands { +namespace ChangeToMode { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kNewMode), newMode); + 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::kNewMode)) + { + err = DataModel::Decode(reader, newMode); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace ChangeToMode. +namespace ChangeToModeResponse { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kStatus), status); + encoder.Encode(to_underlying(Fields::kStatusText), statusText); + 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::kStatus)) + { + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kStatusText)) + { + err = DataModel::Decode(reader, statusText); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace ChangeToModeResponse. +} // namespace Commands + +namespace Attributes { +CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path) +{ + switch (path.mAttributeId) + { + case Attributes::SupportedModes::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, supportedModes); + case Attributes::CurrentMode::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, currentMode); + case Attributes::StartUpMode::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, startUpMode); + case Attributes::OnMode::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, onMode); + case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, generatedCommandList); + case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, acceptedCommandList); + case Attributes::EventList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, eventList); + case Attributes::AttributeList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, attributeList); + case Attributes::FeatureMap::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, featureMap); + case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, clusterRevision); + default: + return CHIP_NO_ERROR; + } +} +} // namespace Attributes + +namespace Events {} // namespace Events + +} // namespace WaterHeaterMode namespace DeviceEnergyManagementMode { namespace Structs {} // namespace Structs @@ -19460,52 +20233,6 @@ namespace Events {} // namespace Events namespace ServiceArea { namespace Structs { -namespace HomeLocationStruct { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kLocationName), locationName); - encoder.Encode(to_underlying(Fields::kFloorNumber), floorNumber); - encoder.Encode(to_underlying(Fields::kAreaType), areaType); - 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::kLocationName)) - { - err = DataModel::Decode(reader, locationName); - } - else if (__context_tag == to_underlying(Fields::kFloorNumber)) - { - err = DataModel::Decode(reader, floorNumber); - } - else if (__context_tag == to_underlying(Fields::kAreaType)) - { - err = DataModel::Decode(reader, areaType); - } - else - { - } - - ReturnErrorOnFailure(err); - } -} - -} // namespace HomeLocationStruct - namespace LocationInfoStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { @@ -20535,47 +21262,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace PresetTypeStruct -namespace QueuedPresetStruct { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kPresetHandle), presetHandle); - encoder.Encode(to_underlying(Fields::kTransitionTimestamp), transitionTimestamp); - 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::kPresetHandle)) - { - err = DataModel::Decode(reader, presetHandle); - } - else if (__context_tag == to_underlying(Fields::kTransitionTimestamp)) - { - err = DataModel::Decode(reader, transitionTimestamp); - } - else - { - } - - ReturnErrorOnFailure(err); - } -} - -} // namespace QueuedPresetStruct - namespace ScheduleTypeStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { @@ -20905,7 +21591,6 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; encoder.Encode(to_underlying(Fields::kPresetHandle), presetHandle); - encoder.Encode(to_underlying(Fields::kDelayMinutes), delayMinutes); return encoder.Finalize(); } @@ -20921,82 +21606,25 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } CHIP_ERROR err = CHIP_NO_ERROR; - const uint8_t __context_tag = std::get(__element); - - if (__context_tag == to_underlying(Fields::kPresetHandle)) - { - err = DataModel::Decode(reader, presetHandle); - } - else if (__context_tag == to_underlying(Fields::kDelayMinutes)) - { - err = DataModel::Decode(reader, delayMinutes); - } - else - { - } - - ReturnErrorOnFailure(err); - } -} -} // namespace SetActivePresetRequest. -namespace StartPresetsSchedulesEditRequest { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kTimeoutSeconds), timeoutSeconds); - 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::kTimeoutSeconds)) - { - err = DataModel::Decode(reader, timeoutSeconds); - } - else - { - } - - ReturnErrorOnFailure(err); - } -} -} // namespace StartPresetsSchedulesEditRequest. -namespace CancelPresetsSchedulesEditRequest { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - 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)) + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kPresetHandle)) + { + err = DataModel::Decode(reader, presetHandle); + } + else { - return std::get(__element); } + + ReturnErrorOnFailure(err); } } -} // namespace CancelPresetsSchedulesEditRequest. -namespace CommitPresetsSchedulesRequest { +} // namespace SetActivePresetRequest. +namespace StartPresetsSchedulesEditRequest { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kTimeoutSeconds), timeoutSeconds); return encoder.Finalize(); } @@ -21010,10 +21638,23 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { return std::get(__element); } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kTimeoutSeconds)) + { + err = DataModel::Decode(reader, timeoutSeconds); + } + else + { + } + + ReturnErrorOnFailure(err); } } -} // namespace CommitPresetsSchedulesRequest. -namespace CancelSetActivePresetRequest { +} // namespace StartPresetsSchedulesEditRequest. +namespace CancelPresetsSchedulesEditRequest { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; @@ -21032,12 +21673,11 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } } -} // namespace CancelSetActivePresetRequest. -namespace SetTemperatureSetpointHoldPolicy { +} // namespace CancelPresetsSchedulesEditRequest. +namespace CommitPresetsSchedulesRequest { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kTemperatureSetpointHoldPolicy), temperatureSetpointHoldPolicy); return encoder.Finalize(); } @@ -21051,22 +21691,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { return std::get(__element); } - - CHIP_ERROR err = CHIP_NO_ERROR; - const uint8_t __context_tag = std::get(__element); - - if (__context_tag == to_underlying(Fields::kTemperatureSetpointHoldPolicy)) - { - err = DataModel::Decode(reader, temperatureSetpointHoldPolicy); - } - else - { - } - - ReturnErrorOnFailure(err); } } -} // namespace SetTemperatureSetpointHoldPolicy. +} // namespace CommitPresetsSchedulesRequest. } // namespace Commands namespace Attributes { @@ -21194,12 +21821,8 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, schedules); case Attributes::PresetsSchedulesEditable::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, presetsSchedulesEditable); - case Attributes::TemperatureSetpointHoldPolicy::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, temperatureSetpointHoldPolicy); case Attributes::SetpointHoldExpiryTimestamp::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, setpointHoldExpiryTimestamp); - case Attributes::QueuedPreset::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, queuedPreset); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): @@ -23449,6 +24072,8 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre { case Attributes::Ssid::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, ssid); + case Attributes::PassphraseSurrogate::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, passphraseSurrogate); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): @@ -23668,6 +24293,7 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const encoder.Encode(to_underlying(Fields::kExtendedPanID), extendedPanID); encoder.Encode(to_underlying(Fields::kNetworkName), networkName); encoder.Encode(to_underlying(Fields::kChannel), channel); + encoder.Encode(to_underlying(Fields::kActiveTimestamp), activeTimestamp); return encoder.Finalize(); } @@ -23697,6 +24323,10 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { err = DataModel::Decode(reader, channel); } + else if (__context_tag == to_underlying(Fields::kActiveTimestamp)) + { + err = DataModel::Decode(reader, activeTimestamp); + } else { } @@ -23876,43 +24506,7 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre } } // namespace Attributes -namespace Events { -namespace NetworkChanged { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - TLV::TLVType outer; - ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kExtendedPanID), extendedPanID)); - return aWriter.EndContainer(outer); -} - -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::kExtendedPanID)) - { - err = DataModel::Decode(reader, extendedPanID); - } - else - { - } - - ReturnErrorOnFailure(err); - } -} -} // namespace NetworkChanged. -} // namespace Events +namespace Events {} // namespace Events } // namespace ThreadNetworkDirectory namespace WakeOnLan { @@ -27247,8 +27841,184 @@ namespace RatingNameStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kRatingName), ratingName); - encoder.Encode(to_underlying(Fields::kRatingNameDesc), ratingNameDesc); + encoder.Encode(to_underlying(Fields::kRatingName), ratingName); + encoder.Encode(to_underlying(Fields::kRatingNameDesc), ratingNameDesc); + 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::kRatingName)) + { + err = DataModel::Decode(reader, ratingName); + } + else if (__context_tag == to_underlying(Fields::kRatingNameDesc)) + { + err = DataModel::Decode(reader, ratingNameDesc); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace RatingNameStruct +} // namespace Structs + +namespace Commands { +namespace UpdatePIN { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kOldPIN), oldPIN); + encoder.Encode(to_underlying(Fields::kNewPIN), newPIN); + 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::kOldPIN)) + { + err = DataModel::Decode(reader, oldPIN); + } + else if (__context_tag == to_underlying(Fields::kNewPIN)) + { + err = DataModel::Decode(reader, newPIN); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace UpdatePIN. +namespace ResetPIN { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + 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); + } + } +} +} // namespace ResetPIN. +namespace ResetPINResponse { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kPINCode), PINCode); + 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::kPINCode)) + { + err = DataModel::Decode(reader, PINCode); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace ResetPINResponse. +namespace Enable { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + 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); + } + } +} +} // namespace Enable. +namespace Disable { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + 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); + } + } +} +} // namespace Disable. +namespace AddBonusTime { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kPINCode), PINCode); + encoder.Encode(to_underlying(Fields::kBonusTime), bonusTime); return encoder.Finalize(); } @@ -27266,13 +28036,13 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) CHIP_ERROR err = CHIP_NO_ERROR; const uint8_t __context_tag = std::get(__element); - if (__context_tag == to_underlying(Fields::kRatingName)) + if (__context_tag == to_underlying(Fields::kPINCode)) { - err = DataModel::Decode(reader, ratingName); + err = DataModel::Decode(reader, PINCode); } - else if (__context_tag == to_underlying(Fields::kRatingNameDesc)) + else if (__context_tag == to_underlying(Fields::kBonusTime)) { - err = DataModel::Decode(reader, ratingNameDesc); + err = DataModel::Decode(reader, bonusTime); } else { @@ -27281,17 +28051,12 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) ReturnErrorOnFailure(err); } } - -} // namespace RatingNameStruct -} // namespace Structs - -namespace Commands { -namespace UpdatePIN { +} // namespace AddBonusTime. +namespace SetScreenDailyTime { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kOldPIN), oldPIN); - encoder.Encode(to_underlying(Fields::kNewPIN), newPIN); + encoder.Encode(to_underlying(Fields::kScreenTime), screenTime); return encoder.Finalize(); } @@ -27309,13 +28074,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) CHIP_ERROR err = CHIP_NO_ERROR; const uint8_t __context_tag = std::get(__element); - if (__context_tag == to_underlying(Fields::kOldPIN)) - { - err = DataModel::Decode(reader, oldPIN); - } - else if (__context_tag == to_underlying(Fields::kNewPIN)) + if (__context_tag == to_underlying(Fields::kScreenTime)) { - err = DataModel::Decode(reader, newPIN); + err = DataModel::Decode(reader, screenTime); } else { @@ -27324,8 +28085,8 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) ReturnErrorOnFailure(err); } } -} // namespace UpdatePIN. -namespace ResetPIN { +} // namespace SetScreenDailyTime. +namespace BlockUnratedContent { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; @@ -27344,12 +28105,32 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } } -} // namespace ResetPIN. -namespace ResetPINResponse { +} // namespace BlockUnratedContent. +namespace UnblockUnratedContent { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kPINCode), PINCode); + 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); + } + } +} +} // namespace UnblockUnratedContent. +namespace SetOnDemandRatingThreshold { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kRating), rating); return encoder.Finalize(); } @@ -27367,9 +28148,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) CHIP_ERROR err = CHIP_NO_ERROR; const uint8_t __context_tag = std::get(__element); - if (__context_tag == to_underlying(Fields::kPINCode)) + if (__context_tag == to_underlying(Fields::kRating)) { - err = DataModel::Decode(reader, PINCode); + err = DataModel::Decode(reader, rating); } else { @@ -27378,11 +28159,12 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) ReturnErrorOnFailure(err); } } -} // namespace ResetPINResponse. -namespace Enable { +} // namespace SetOnDemandRatingThreshold. +namespace SetScheduledContentRatingThreshold { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kRating), rating); return encoder.Finalize(); } @@ -27396,14 +28178,70 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { return std::get(__element); } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kRating)) + { + err = DataModel::Decode(reader, rating); + } + else + { + } + + ReturnErrorOnFailure(err); } } -} // namespace Enable. -namespace Disable { +} // namespace SetScheduledContentRatingThreshold. +} // namespace Commands + +namespace Attributes { +CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path) +{ + switch (path.mAttributeId) + { + case Attributes::Enabled::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, enabled); + case Attributes::OnDemandRatings::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, onDemandRatings); + case Attributes::OnDemandRatingThreshold::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, onDemandRatingThreshold); + case Attributes::ScheduledContentRatings::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, scheduledContentRatings); + case Attributes::ScheduledContentRatingThreshold::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, scheduledContentRatingThreshold); + case Attributes::ScreenDailyTime::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, screenDailyTime); + case Attributes::RemainingScreenTime::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, remainingScreenTime); + case Attributes::BlockUnrated::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, blockUnrated); + case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, generatedCommandList); + case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, acceptedCommandList); + case Attributes::EventList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, eventList); + case Attributes::AttributeList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, attributeList); + case Attributes::FeatureMap::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, featureMap); + case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, clusterRevision); + default: + return CHIP_NO_ERROR; + } +} +} // namespace Attributes + +namespace Events { +namespace RemainingScreenTimeExpired { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - return encoder.Finalize(); + TLV::TLVType outer; + ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) @@ -27418,13 +28256,19 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } } -} // namespace Disable. -namespace AddBonusTime { +} // namespace RemainingScreenTimeExpired. +} // namespace Events + +} // namespace ContentControl +namespace ContentAppObserver { + +namespace Commands { +namespace ContentAppMessage { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kPINCode), PINCode); - encoder.Encode(to_underlying(Fields::kBonusTime), bonusTime); + encoder.Encode(to_underlying(Fields::kData), data); + encoder.Encode(to_underlying(Fields::kEncodingHint), encodingHint); return encoder.Finalize(); } @@ -27442,13 +28286,13 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) CHIP_ERROR err = CHIP_NO_ERROR; const uint8_t __context_tag = std::get(__element); - if (__context_tag == to_underlying(Fields::kPINCode)) + if (__context_tag == to_underlying(Fields::kData)) { - err = DataModel::Decode(reader, PINCode); + err = DataModel::Decode(reader, data); } - else if (__context_tag == to_underlying(Fields::kBonusTime)) + else if (__context_tag == to_underlying(Fields::kEncodingHint)) { - err = DataModel::Decode(reader, bonusTime); + err = DataModel::Decode(reader, encodingHint); } else { @@ -27457,12 +28301,14 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) ReturnErrorOnFailure(err); } } -} // namespace AddBonusTime. -namespace SetScreenDailyTime { +} // namespace ContentAppMessage. +namespace ContentAppMessageResponse { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kScreenTime), screenTime); + encoder.Encode(to_underlying(Fields::kStatus), status); + encoder.Encode(to_underlying(Fields::kData), data); + encoder.Encode(to_underlying(Fields::kEncodingHint), encodingHint); return encoder.Finalize(); } @@ -27480,9 +28326,17 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) CHIP_ERROR err = CHIP_NO_ERROR; const uint8_t __context_tag = std::get(__element); - if (__context_tag == to_underlying(Fields::kScreenTime)) + if (__context_tag == to_underlying(Fields::kStatus)) { - err = DataModel::Decode(reader, screenTime); + err = DataModel::Decode(reader, status); + } + else if (__context_tag == to_underlying(Fields::kData)) + { + err = DataModel::Decode(reader, data); + } + else if (__context_tag == to_underlying(Fields::kEncodingHint)) + { + err = DataModel::Decode(reader, encodingHint); } else { @@ -27491,52 +28345,72 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) ReturnErrorOnFailure(err); } } -} // namespace SetScreenDailyTime. -namespace BlockUnratedContent { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - return encoder.Finalize(); -} +} // namespace ContentAppMessageResponse. +} // namespace Commands -CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +namespace Attributes { +CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path) { - detail::StructDecodeIterator __iterator(reader); - while (true) + switch (path.mAttributeId) { - auto __element = __iterator.Next(); - if (std::holds_alternative(__element)) - { - return std::get(__element); - } + case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, generatedCommandList); + case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, acceptedCommandList); + case Attributes::EventList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, eventList); + case Attributes::AttributeList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, attributeList); + case Attributes::FeatureMap::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, featureMap); + case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, clusterRevision); + default: + return CHIP_NO_ERROR; } } -} // namespace BlockUnratedContent. -namespace UnblockUnratedContent { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +} // namespace Attributes + +namespace Events {} // namespace Events + +} // namespace ContentAppObserver +namespace EcosystemInformation { +namespace Structs { + +namespace EcosystemLocationStruct { +CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - return encoder.Finalize(); + return DoEncode(aWriter, aTag, NullOptional); } -CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +CHIP_ERROR Type::EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const { - detail::StructDecodeIterator __iterator(reader); - while (true) - { - auto __element = __iterator.Next(); - if (std::holds_alternative(__element)) - { - return std::get(__element); - } - } + return DoEncode(aWriter, aTag, MakeOptional(aAccessingFabricIndex)); } -} // namespace UnblockUnratedContent. -namespace SetOnDemandRatingThreshold { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const + +CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional & aAccessingFabricIndex) const { + bool includeSensitive = !aAccessingFabricIndex.HasValue() || (aAccessingFabricIndex.Value() == fabricIndex); + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kRating), rating); + + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kUniqueLocationID), uniqueLocationID); + } + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kLocationDescriptor), locationDescriptor); + } + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kLocationDescriptorLastEdit), locationDescriptorLastEdit); + } + if (aAccessingFabricIndex.HasValue()) + { + encoder.Encode(to_underlying(Fields::kFabricIndex), fabricIndex); + } + return encoder.Finalize(); } @@ -27554,9 +28428,21 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) CHIP_ERROR err = CHIP_NO_ERROR; const uint8_t __context_tag = std::get(__element); - if (__context_tag == to_underlying(Fields::kRating)) + if (__context_tag == to_underlying(Fields::kUniqueLocationID)) { - err = DataModel::Decode(reader, rating); + err = DataModel::Decode(reader, uniqueLocationID); + } + else if (__context_tag == to_underlying(Fields::kLocationDescriptor)) + { + err = DataModel::Decode(reader, locationDescriptor); + } + else if (__context_tag == to_underlying(Fields::kLocationDescriptorLastEdit)) + { + err = DataModel::Decode(reader, locationDescriptorLastEdit); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); } else { @@ -27565,12 +28451,59 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) ReturnErrorOnFailure(err); } } -} // namespace SetOnDemandRatingThreshold. -namespace SetScheduledContentRatingThreshold { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const + +} // namespace EcosystemLocationStruct + +namespace EcosystemDeviceStruct { +CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + return DoEncode(aWriter, aTag, NullOptional); +} + +CHIP_ERROR Type::EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const +{ + return DoEncode(aWriter, aTag, MakeOptional(aAccessingFabricIndex)); +} + +CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional & aAccessingFabricIndex) const { + bool includeSensitive = !aAccessingFabricIndex.HasValue() || (aAccessingFabricIndex.Value() == fabricIndex); + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kRating), rating); + + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kDeviceName), deviceName); + } + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kDeviceNameLastEdit), deviceNameLastEdit); + } + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kBridgedEndpoint), bridgedEndpoint); + } + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kOriginalEndpoint), originalEndpoint); + } + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kDeviceTypes), deviceTypes); + } + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kUniqueLocationIDs), uniqueLocationIDs); + } + if (includeSensitive) + { + encoder.Encode(to_underlying(Fields::kUniqueLocationIDsLastEdit), uniqueLocationIDsLastEdit); + } + if (aAccessingFabricIndex.HasValue()) + { + encoder.Encode(to_underlying(Fields::kFabricIndex), fabricIndex); + } + return encoder.Finalize(); } @@ -27588,9 +28521,37 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) CHIP_ERROR err = CHIP_NO_ERROR; const uint8_t __context_tag = std::get(__element); - if (__context_tag == to_underlying(Fields::kRating)) + if (__context_tag == to_underlying(Fields::kDeviceName)) { - err = DataModel::Decode(reader, rating); + err = DataModel::Decode(reader, deviceName); + } + else if (__context_tag == to_underlying(Fields::kDeviceNameLastEdit)) + { + err = DataModel::Decode(reader, deviceNameLastEdit); + } + else if (__context_tag == to_underlying(Fields::kBridgedEndpoint)) + { + err = DataModel::Decode(reader, bridgedEndpoint); + } + else if (__context_tag == to_underlying(Fields::kOriginalEndpoint)) + { + err = DataModel::Decode(reader, originalEndpoint); + } + else if (__context_tag == to_underlying(Fields::kDeviceTypes)) + { + err = DataModel::Decode(reader, deviceTypes); + } + else if (__context_tag == to_underlying(Fields::kUniqueLocationIDs)) + { + err = DataModel::Decode(reader, uniqueLocationIDs); + } + else if (__context_tag == to_underlying(Fields::kUniqueLocationIDsLastEdit)) + { + err = DataModel::Decode(reader, uniqueLocationIDsLastEdit); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); } else { @@ -27599,30 +28560,23 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) ReturnErrorOnFailure(err); } } -} // namespace SetScheduledContentRatingThreshold. -} // namespace Commands + +} // namespace EcosystemDeviceStruct +} // namespace Structs + +namespace Commands {} // namespace Commands namespace Attributes { CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path) { switch (path.mAttributeId) { - case Attributes::Enabled::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, enabled); - case Attributes::OnDemandRatings::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, onDemandRatings); - case Attributes::OnDemandRatingThreshold::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, onDemandRatingThreshold); - case Attributes::ScheduledContentRatings::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, scheduledContentRatings); - case Attributes::ScheduledContentRatingThreshold::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, scheduledContentRatingThreshold); - case Attributes::ScreenDailyTime::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, screenDailyTime); - case Attributes::RemainingScreenTime::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, remainingScreenTime); - case Attributes::BlockUnrated::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, blockUnrated); + case Attributes::RemovedOn::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, removedOn); + case Attributes::DeviceDirectory::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, deviceDirectory); + case Attributes::LocationDirectory::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, locationDirectory); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): @@ -27641,13 +28595,21 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre } } // namespace Attributes -namespace Events { -namespace RemainingScreenTimeExpired { +namespace Events {} // namespace Events + +} // namespace EcosystemInformation +namespace CommissionerControl { + +namespace Commands { +namespace RequestCommissioningApproval { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { - TLV::TLVType outer; - ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); - return aWriter.EndContainer(outer); + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kRequestId), requestId); + encoder.Encode(to_underlying(Fields::kVendorId), vendorId); + encoder.Encode(to_underlying(Fields::kProductId), productId); + encoder.Encode(to_underlying(Fields::kLabel), label); + return encoder.Finalize(); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) @@ -27660,21 +28622,42 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { return std::get(__element); } - } -} -} // namespace RemainingScreenTimeExpired. -} // namespace Events -} // namespace ContentControl -namespace ContentAppObserver { + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); -namespace Commands { -namespace ContentAppMessage { + if (__context_tag == to_underlying(Fields::kRequestId)) + { + err = DataModel::Decode(reader, requestId); + } + else if (__context_tag == to_underlying(Fields::kVendorId)) + { + err = DataModel::Decode(reader, vendorId); + } + else if (__context_tag == to_underlying(Fields::kProductId)) + { + err = DataModel::Decode(reader, productId); + } + else if (__context_tag == to_underlying(Fields::kLabel)) + { + err = DataModel::Decode(reader, label); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace RequestCommissioningApproval. +namespace CommissionNode { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kData), data); - encoder.Encode(to_underlying(Fields::kEncodingHint), encodingHint); + encoder.Encode(to_underlying(Fields::kRequestId), requestId); + encoder.Encode(to_underlying(Fields::kResponseTimeoutSeconds), responseTimeoutSeconds); + encoder.Encode(to_underlying(Fields::kIpAddress), ipAddress); + encoder.Encode(to_underlying(Fields::kPort), port); return encoder.Finalize(); } @@ -27692,13 +28675,21 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) CHIP_ERROR err = CHIP_NO_ERROR; const uint8_t __context_tag = std::get(__element); - if (__context_tag == to_underlying(Fields::kData)) + if (__context_tag == to_underlying(Fields::kRequestId)) { - err = DataModel::Decode(reader, data); + err = DataModel::Decode(reader, requestId); } - else if (__context_tag == to_underlying(Fields::kEncodingHint)) + else if (__context_tag == to_underlying(Fields::kResponseTimeoutSeconds)) { - err = DataModel::Decode(reader, encodingHint); + err = DataModel::Decode(reader, responseTimeoutSeconds); + } + else if (__context_tag == to_underlying(Fields::kIpAddress)) + { + err = DataModel::Decode(reader, ipAddress); + } + else if (__context_tag == to_underlying(Fields::kPort)) + { + err = DataModel::Decode(reader, port); } else { @@ -27707,14 +28698,16 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) ReturnErrorOnFailure(err); } } -} // namespace ContentAppMessage. -namespace ContentAppMessageResponse { +} // namespace CommissionNode. +namespace ReverseOpenCommissioningWindow { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kStatus), status); - encoder.Encode(to_underlying(Fields::kData), data); - encoder.Encode(to_underlying(Fields::kEncodingHint), encodingHint); + encoder.Encode(to_underlying(Fields::kCommissioningTimeout), commissioningTimeout); + encoder.Encode(to_underlying(Fields::kPAKEPasscodeVerifier), PAKEPasscodeVerifier); + encoder.Encode(to_underlying(Fields::kDiscriminator), discriminator); + encoder.Encode(to_underlying(Fields::kIterations), iterations); + encoder.Encode(to_underlying(Fields::kSalt), salt); return encoder.Finalize(); } @@ -27732,17 +28725,25 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) CHIP_ERROR err = CHIP_NO_ERROR; const uint8_t __context_tag = std::get(__element); - if (__context_tag == to_underlying(Fields::kStatus)) + if (__context_tag == to_underlying(Fields::kCommissioningTimeout)) { - err = DataModel::Decode(reader, status); + err = DataModel::Decode(reader, commissioningTimeout); } - else if (__context_tag == to_underlying(Fields::kData)) + else if (__context_tag == to_underlying(Fields::kPAKEPasscodeVerifier)) { - err = DataModel::Decode(reader, data); + err = DataModel::Decode(reader, PAKEPasscodeVerifier); } - else if (__context_tag == to_underlying(Fields::kEncodingHint)) + else if (__context_tag == to_underlying(Fields::kDiscriminator)) { - err = DataModel::Decode(reader, encodingHint); + err = DataModel::Decode(reader, discriminator); + } + else if (__context_tag == to_underlying(Fields::kIterations)) + { + err = DataModel::Decode(reader, iterations); + } + else if (__context_tag == to_underlying(Fields::kSalt)) + { + err = DataModel::Decode(reader, salt); } else { @@ -27751,7 +28752,7 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) ReturnErrorOnFailure(err); } } -} // namespace ContentAppMessageResponse. +} // namespace ReverseOpenCommissioningWindow. } // namespace Commands namespace Attributes { @@ -27759,6 +28760,8 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre { switch (path.mAttributeId) { + case Attributes::SupportedDeviceCategories::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, supportedDeviceCategories); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): @@ -27777,9 +28780,60 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre } } // namespace Attributes -namespace Events {} // namespace Events +namespace Events { +namespace CommissioningRequestResult { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kRequestId), requestId)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kClientNodeId), clientNodeId)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kStatusCode), statusCode)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kFabricIndex), fabricIndex)); + return aWriter.EndContainer(outer); +} -} // namespace ContentAppObserver +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::kRequestId)) + { + err = DataModel::Decode(reader, requestId); + } + else if (__context_tag == to_underlying(Fields::kClientNodeId)) + { + err = DataModel::Decode(reader, clientNodeId); + } + else if (__context_tag == to_underlying(Fields::kStatusCode)) + { + err = DataModel::Decode(reader, statusCode); + } + else if (__context_tag == to_underlying(Fields::kFabricIndex)) + { + err = DataModel::Decode(reader, fabricIndex); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace CommissioningRequestResult. +} // namespace Events + +} // namespace CommissionerControl namespace ElectricalMeasurement { namespace Commands { @@ -31012,7 +32066,6 @@ bool CommandNeedsTimedInvoke(ClusterId aCluster, CommandId aCommand) { case Clusters::ThreadNetworkDirectory::Commands::AddNetwork::Id: case Clusters::ThreadNetworkDirectory::Commands::RemoveNetwork::Id: - case Clusters::ThreadNetworkDirectory::Commands::GetOperationalDataset::Id: return true; default: return false; @@ -31091,6 +32144,15 @@ bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand) return false; } } + case Clusters::AccessControl::Id: { + switch (aCommand) + { + case Clusters::AccessControl::Commands::ReviewFabricRestrictions::Id: + return true; + default: + return false; + } + } case Clusters::Actions::Id: { switch (aCommand) { @@ -31186,6 +32248,13 @@ bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand) return false; } } + case Clusters::BridgedDeviceBasicInformation::Id: { + switch (aCommand) + { + default: + return false; + } + } case Clusters::AdministratorCommissioning::Id: { switch (aCommand) { @@ -31386,6 +32455,13 @@ bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand) return false; } } + case Clusters::WaterHeaterManagement::Id: { + switch (aCommand) + { + default: + return false; + } + } case Clusters::DemandResponseLoadControl::Id: { switch (aCommand) { @@ -31425,6 +32501,13 @@ bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand) return false; } } + case Clusters::WaterHeaterMode::Id: { + switch (aCommand) + { + default: + return false; + } + } case Clusters::DeviceEnergyManagementMode::Id: { switch (aCommand) { @@ -31592,6 +32675,13 @@ bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand) return false; } } + case Clusters::CommissionerControl::Id: { + switch (aCommand) + { + default: + return false; + } + } case Clusters::ElectricalMeasurement::Id: { switch (aCommand) { 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 a1fb80c760815c..d063efed42f33c 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 @@ -173,6 +173,54 @@ struct DecodableType }; } // namespace MeasurementAccuracyStruct +namespace LocationDescriptorStruct { +enum class Fields : uint8_t +{ + kLocationName = 0, + kFloorNumber = 1, + kAreaType = 2, +}; + +struct Type +{ +public: + chip::CharSpan locationName; + DataModel::Nullable floorNumber; + DataModel::Nullable areaType; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace LocationDescriptorStruct +namespace DeviceTypeStruct { +enum class Fields : uint8_t +{ + kDeviceType = 0, + kRevision = 1, +}; + +struct Type +{ +public: + chip::DeviceTypeId deviceType = static_cast(0); + uint16_t revision = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace DeviceTypeStruct namespace ApplicationStruct { enum class Fields : uint8_t { @@ -271,6 +319,38 @@ using DecodableType = Type; } // namespace detail namespace Globals { + +// Global structs. +namespace Structs { + +namespace TestGlobalStruct { +enum class Fields : uint8_t +{ + kName = 0, + kMyBitmap = 1, + kMyEnum = 2, +}; + +struct Type +{ +public: + chip::CharSpan name; + DataModel::Nullable> myBitmap; + Optional> myEnum; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace TestGlobalStruct + +} // namespace Structs + namespace Attributes { namespace GeneratedCommandList { struct TypeInfo @@ -2307,29 +2387,7 @@ struct TypeInfo } // namespace PulseWidthModulation namespace Descriptor { namespace Structs { -namespace DeviceTypeStruct { -enum class Fields : uint8_t -{ - kDeviceType = 0, - kRevision = 1, -}; - -struct Type -{ -public: - chip::DeviceTypeId deviceType = static_cast(0); - uint16_t revision = static_cast(0); - - CHIP_ERROR Decode(TLV::TLVReader & reader); - - static constexpr bool kIsFabricScoped = false; - - CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; -}; - -using DecodableType = Type; - -} // namespace DeviceTypeStruct +namespace DeviceTypeStruct = Clusters::detail::Structs::DeviceTypeStruct; namespace SemanticTagStruct { enum class Fields : uint8_t { @@ -2599,6 +2657,110 @@ struct TypeInfo } // namespace Binding namespace AccessControl { namespace Structs { +namespace AccessRestrictionStruct { +enum class Fields : uint8_t +{ + kType = 0, + kId = 1, +}; + +struct Type +{ +public: + AccessRestrictionTypeEnum type = static_cast(0); + DataModel::Nullable id; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace AccessRestrictionStruct +namespace CommissioningAccessRestrictionEntryStruct { +enum class Fields : uint8_t +{ + kEndpoint = 0, + kCluster = 1, + kRestrictions = 2, +}; + +struct Type +{ +public: + chip::EndpointId endpoint = static_cast(0); + chip::ClusterId cluster = static_cast(0); + DataModel::List restrictions; + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + chip::EndpointId endpoint = static_cast(0); + chip::ClusterId cluster = static_cast(0); + DataModel::DecodableList restrictions; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; +}; + +} // namespace CommissioningAccessRestrictionEntryStruct +namespace AccessRestrictionEntryStruct { +enum class Fields : uint8_t +{ + kEndpoint = 0, + kCluster = 1, + kRestrictions = 2, + kFabricIndex = 254, +}; + +struct Type +{ +public: + chip::EndpointId endpoint = static_cast(0); + chip::ClusterId cluster = static_cast(0); + DataModel::List restrictions; + chip::FabricIndex fabricIndex = static_cast(0); + + static constexpr bool kIsFabricScoped = true; + + auto GetFabricIndex() const { return fabricIndex; } + + void SetFabricIndex(chip::FabricIndex fabricIndex_) { fabricIndex = fabricIndex_; } + + CHIP_ERROR EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + CHIP_ERROR EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const; + +private: + CHIP_ERROR DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional & aAccessingFabricIndex) const; +}; + +struct DecodableType +{ +public: + chip::EndpointId endpoint = static_cast(0); + chip::ClusterId cluster = static_cast(0); + DataModel::DecodableList restrictions; + chip::FabricIndex fabricIndex = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = true; + + auto GetFabricIndex() const { return fabricIndex; } + + void SetFabricIndex(chip::FabricIndex fabricIndex_) { fabricIndex = fabricIndex_; } +}; + +} // namespace AccessRestrictionEntryStruct namespace AccessControlTargetStruct { enum class Fields : uint8_t { @@ -2708,6 +2870,88 @@ using DecodableType = Type; } // namespace AccessControlExtensionStruct } // namespace Structs +namespace Commands { +// Forward-declarations so we can reference these later. + +namespace ReviewFabricRestrictions { +struct Type; +struct DecodableType; +} // namespace ReviewFabricRestrictions + +namespace ReviewFabricRestrictionsResponse { +struct Type; +struct DecodableType; +} // namespace ReviewFabricRestrictionsResponse + +} // namespace Commands + +namespace Commands { +namespace ReviewFabricRestrictions { +enum class Fields : uint8_t +{ + kArl = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::ReviewFabricRestrictions::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::AccessControl::Id; } + + DataModel::List arl; + + 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::ReviewFabricRestrictions::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::AccessControl::Id; } + + DataModel::DecodableList arl; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace ReviewFabricRestrictions +namespace ReviewFabricRestrictionsResponse { +enum class Fields : uint8_t +{ + kToken = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::ReviewFabricRestrictionsResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::AccessControl::Id; } + + uint64_t token = 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::ReviewFabricRestrictionsResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::AccessControl::Id; } + + uint64_t token = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace ReviewFabricRestrictionsResponse +} // namespace Commands + namespace Attributes { namespace Acl { @@ -2774,6 +3018,35 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace AccessControlEntriesPerFabric +namespace CommissioningARL { +struct TypeInfo +{ + using Type = chip::app::DataModel::List< + const chip::app::Clusters::AccessControl::Structs::CommissioningAccessRestrictionEntryStruct::Type>; + using DecodableType = chip::app::DataModel::DecodableList< + chip::app::Clusters::AccessControl::Structs::CommissioningAccessRestrictionEntryStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::DecodableList< + chip::app::Clusters::AccessControl::Structs::CommissioningAccessRestrictionEntryStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::AccessControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::CommissioningARL::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace CommissioningARL +namespace Arl { +struct TypeInfo +{ + using Type = chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList< + chip::app::Clusters::AccessControl::Structs::AccessRestrictionEntryStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::DecodableList< + chip::app::Clusters::AccessControl::Structs::AccessRestrictionEntryStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::AccessControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::Arl::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace Arl namespace GeneratedCommandList { struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo { @@ -2824,6 +3097,8 @@ struct TypeInfo Attributes::SubjectsPerAccessControlEntry::TypeInfo::DecodableType subjectsPerAccessControlEntry = static_cast(0); Attributes::TargetsPerAccessControlEntry::TypeInfo::DecodableType targetsPerAccessControlEntry = static_cast(0); Attributes::AccessControlEntriesPerFabric::TypeInfo::DecodableType accessControlEntriesPerFabric = static_cast(0); + Attributes::CommissioningARL::TypeInfo::DecodableType commissioningARL; + Attributes::Arl::TypeInfo::DecodableType arl; Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::EventList::TypeInfo::DecodableType eventList; @@ -2928,6 +3203,85 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; } // namespace AccessControlExtensionChanged +namespace AccessRestrictionEntryChanged { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; + +enum class Fields : uint8_t +{ + kFabricIndex = 254, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::AccessRestrictionEntryChanged::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::AccessControl::Id; } + static constexpr bool kIsFabricScoped = true; + + chip::FabricIndex fabricIndex = static_cast(0); + + auto GetFabricIndex() const { return fabricIndex; } + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::AccessRestrictionEntryChanged::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::AccessControl::Id; } + + chip::FabricIndex fabricIndex = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace AccessRestrictionEntryChanged +namespace FabricRestrictionReviewUpdate { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; + +enum class Fields : uint8_t +{ + kToken = 0, + kInstruction = 1, + kRedirectURL = 2, + kFabricIndex = 254, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::FabricRestrictionReviewUpdate::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::AccessControl::Id; } + static constexpr bool kIsFabricScoped = true; + + uint64_t token = static_cast(0); + DataModel::Nullable instruction; + DataModel::Nullable redirectURL; + chip::FabricIndex fabricIndex = static_cast(0); + + auto GetFabricIndex() const { return fabricIndex; } + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::FabricRestrictionReviewUpdate::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::AccessControl::Id; } + + uint64_t token = static_cast(0); + DataModel::Nullable instruction; + DataModel::Nullable redirectURL; + chip::FabricIndex fabricIndex = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace FabricRestrictionReviewUpdate } // namespace Events } // namespace AccessControl namespace Actions { @@ -10566,6 +10920,51 @@ using DecodableType = Type; } // namespace ProductAppearanceStruct } // namespace Structs +namespace Commands { +// Forward-declarations so we can reference these later. + +namespace KeepActive { +struct Type; +struct DecodableType; +} // namespace KeepActive + +} // namespace Commands + +namespace Commands { +namespace KeepActive { +enum class Fields : uint8_t +{ + kStayActiveDuration = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::KeepActive::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::BridgedDeviceBasicInformation::Id; } + + uint32_t stayActiveDuration = 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::KeepActive::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::BridgedDeviceBasicInformation::Id; } + + uint32_t stayActiveDuration = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace KeepActive +} // namespace Commands + namespace Attributes { namespace VendorName { @@ -10965,6 +11364,39 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; } // namespace ReachableChanged +namespace ActiveChanged { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; + +enum class Fields : uint8_t +{ + kPromisedActiveDuration = 0, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::ActiveChanged::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::BridgedDeviceBasicInformation::Id; } + static constexpr bool kIsFabricScoped = false; + + uint32_t promisedActiveDuration = static_cast(0); + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::ActiveChanged::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::BridgedDeviceBasicInformation::Id; } + + uint32_t promisedActiveDuration = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace ActiveChanged } // namespace Events } // namespace BridgedDeviceBasicInformation namespace Switch { @@ -13483,6 +13915,18 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace OperatingMode +namespace MaximumCheckInBackOff { +struct TypeInfo +{ + using Type = uint32_t; + using DecodableType = uint32_t; + using DecodableArgType = uint32_t; + + static constexpr ClusterId GetClusterId() { return Clusters::IcdManagement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::MaximumCheckInBackOff::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace MaximumCheckInBackOff namespace GeneratedCommandList { struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo { @@ -13539,6 +13983,7 @@ struct TypeInfo Attributes::UserActiveModeTriggerInstruction::TypeInfo::DecodableType userActiveModeTriggerInstruction; Attributes::OperatingMode::TypeInfo::DecodableType operatingMode = static_cast(0); + Attributes::MaximumCheckInBackOff::TypeInfo::DecodableType maximumCheckInBackOff = static_cast(0); Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::EventList::TypeInfo::DecodableType eventList; @@ -18174,18 +18619,32 @@ struct DecodableType } // namespace RvcOperationalState namespace ScenesManagement { namespace Structs { -namespace AttributeValuePair { +namespace AttributeValuePairStruct { enum class Fields : uint8_t { - kAttributeID = 0, - kAttributeValue = 1, + kAttributeID = 0, + kValueUnsigned8 = 1, + kValueSigned8 = 2, + kValueUnsigned16 = 3, + kValueSigned16 = 4, + kValueUnsigned32 = 5, + kValueSigned32 = 6, + kValueUnsigned64 = 7, + kValueSigned64 = 8, }; struct Type { public: chip::AttributeId attributeID = static_cast(0); - uint32_t attributeValue = static_cast(0); + Optional valueUnsigned8; + Optional valueSigned8; + Optional valueUnsigned16; + Optional valueSigned16; + Optional valueUnsigned32; + Optional valueSigned32; + Optional valueUnsigned64; + Optional valueSigned64; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -18196,7 +18655,7 @@ struct Type using DecodableType = Type; -} // namespace AttributeValuePair +} // namespace AttributeValuePairStruct namespace ExtensionFieldSet { enum class Fields : uint8_t { @@ -18208,7 +18667,7 @@ struct Type { public: chip::ClusterId clusterID = static_cast(0); - DataModel::List attributeValueList; + DataModel::List attributeValueList; static constexpr bool kIsFabricScoped = false; @@ -18219,7 +18678,7 @@ struct DecodableType { public: chip::ClusterId clusterID = static_cast(0); - DataModel::DecodableList attributeValueList; + DataModel::DecodableList attributeValueList; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -20822,6 +21281,239 @@ struct DecodableType } // namespace PeriodicEnergyMeasured } // namespace Events } // namespace ElectricalEnergyMeasurement +namespace WaterHeaterManagement { + +namespace Commands { +// Forward-declarations so we can reference these later. + +namespace Boost { +struct Type; +struct DecodableType; +} // namespace Boost + +namespace CancelBoost { +struct Type; +struct DecodableType; +} // namespace CancelBoost + +} // namespace Commands + +namespace Commands { +namespace Boost { +enum class Fields : uint8_t +{ + kDuration = 0, + kOneShot = 1, + kEmergencyBoost = 2, + kTemporarySetpoint = 3, + kTargetPercentage = 4, + kTargetReheat = 5, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::Boost::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } + + uint32_t duration = static_cast(0); + Optional oneShot; + Optional emergencyBoost; + Optional temporarySetpoint; + Optional targetPercentage; + Optional targetReheat; + + 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::Boost::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } + + uint32_t duration = static_cast(0); + Optional oneShot; + Optional emergencyBoost; + Optional temporarySetpoint; + Optional targetPercentage; + Optional targetReheat; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace Boost +namespace CancelBoost { +enum class Fields : uint8_t +{ +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::CancelBoost::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } + + 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::CancelBoost::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace CancelBoost +} // namespace Commands + +namespace Attributes { + +namespace HeaterTypes { +struct TypeInfo +{ + using Type = chip::BitMask; + using DecodableType = chip::BitMask; + using DecodableArgType = chip::BitMask; + + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::HeaterTypes::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace HeaterTypes +namespace HeatDemand { +struct TypeInfo +{ + using Type = chip::BitMask; + using DecodableType = chip::BitMask; + using DecodableArgType = chip::BitMask; + + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::HeatDemand::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace HeatDemand +namespace TankVolume { +struct TypeInfo +{ + using Type = uint16_t; + using DecodableType = uint16_t; + using DecodableArgType = uint16_t; + + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::TankVolume::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace TankVolume +namespace EstimatedHeatRequired { +struct TypeInfo +{ + using Type = int64_t; + using DecodableType = int64_t; + using DecodableArgType = int64_t; + + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::EstimatedHeatRequired::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace EstimatedHeatRequired +namespace TankPercentage { +struct TypeInfo +{ + using Type = chip::Percent; + using DecodableType = chip::Percent; + using DecodableArgType = chip::Percent; + + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::TankPercentage::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace TankPercentage +namespace BoostState { +struct TypeInfo +{ + using Type = chip::app::Clusters::WaterHeaterManagement::BoostStateEnum; + using DecodableType = chip::app::Clusters::WaterHeaterManagement::BoostStateEnum; + using DecodableArgType = chip::app::Clusters::WaterHeaterManagement::BoostStateEnum; + + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::BoostState::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace BoostState +namespace GeneratedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } +}; +} // namespace GeneratedCommandList +namespace AcceptedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::AcceptedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } +}; +} // namespace AcceptedCommandList +namespace EventList { +struct TypeInfo : public Clusters::Globals::Attributes::EventList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } +}; +} // namespace EventList +namespace AttributeList { +struct TypeInfo : public Clusters::Globals::Attributes::AttributeList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } +}; +} // namespace AttributeList +namespace FeatureMap { +struct TypeInfo : public Clusters::Globals::Attributes::FeatureMap::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } +}; +} // namespace FeatureMap +namespace ClusterRevision { +struct TypeInfo : public Clusters::Globals::Attributes::ClusterRevision::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } +}; +} // namespace ClusterRevision + +struct TypeInfo +{ + struct DecodableType + { + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterManagement::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); + + Attributes::HeaterTypes::TypeInfo::DecodableType heaterTypes = + static_cast>(0); + Attributes::HeatDemand::TypeInfo::DecodableType heatDemand = + static_cast>(0); + Attributes::TankVolume::TypeInfo::DecodableType tankVolume = static_cast(0); + Attributes::EstimatedHeatRequired::TypeInfo::DecodableType estimatedHeatRequired = static_cast(0); + Attributes::TankPercentage::TypeInfo::DecodableType tankPercentage = static_cast(0); + Attributes::BoostState::TypeInfo::DecodableType boostState = + static_cast(0); + Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; + Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; + Attributes::EventList::TypeInfo::DecodableType eventList; + Attributes::AttributeList::TypeInfo::DecodableType attributeList; + Attributes::FeatureMap::TypeInfo::DecodableType featureMap = static_cast(0); + Attributes::ClusterRevision::TypeInfo::DecodableType clusterRevision = static_cast(0); + }; +}; +} // namespace Attributes +} // namespace WaterHeaterManagement namespace DemandResponseLoadControl { namespace Structs { namespace HeatingSourceControlStruct { @@ -23518,9 +24210,10 @@ static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; enum class Fields : uint8_t { - kSessionID = 0, - kState = 1, - kMaximumCurrent = 2, + kSessionID = 0, + kState = 1, + kMaximumCurrent = 2, + kMaximumDischargeCurrent = 3, }; struct Type @@ -23534,6 +24227,7 @@ struct Type uint32_t sessionID = static_cast(0); StateEnum state = static_cast(0); int64_t maximumCurrent = static_cast(0); + Optional maximumDischargeCurrent; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; }; @@ -23548,6 +24242,7 @@ struct DecodableType uint32_t sessionID = static_cast(0); StateEnum state = static_cast(0); int64_t maximumCurrent = static_cast(0); + Optional maximumDischargeCurrent; CHIP_ERROR Decode(TLV::TLVReader & reader); }; @@ -23561,6 +24256,7 @@ enum class Fields : uint8_t kState = 1, kReason = 2, kEnergyTransferred = 4, + kEnergyDischarged = 5, }; struct Type @@ -23575,6 +24271,7 @@ struct Type StateEnum state = static_cast(0); EnergyTransferStoppedReasonEnum reason = static_cast(0); int64_t energyTransferred = static_cast(0); + Optional energyDischarged; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; }; @@ -23590,6 +24287,7 @@ struct DecodableType StateEnum state = static_cast(0); EnergyTransferStoppedReasonEnum reason = static_cast(0); int64_t energyTransferred = static_cast(0); + Optional energyDischarged; CHIP_ERROR Decode(TLV::TLVReader & reader); }; @@ -24112,6 +24810,208 @@ struct TypeInfo }; } // namespace Attributes } // namespace EnergyEvseMode +namespace WaterHeaterMode { +namespace Structs { +namespace ModeTagStruct = Clusters::detail::Structs::ModeTagStruct; +namespace ModeOptionStruct = Clusters::detail::Structs::ModeOptionStruct; +} // namespace Structs + +namespace Commands { +// Forward-declarations so we can reference these later. + +namespace ChangeToMode { +struct Type; +struct DecodableType; +} // namespace ChangeToMode + +namespace ChangeToModeResponse { +struct Type; +struct DecodableType; +} // namespace ChangeToModeResponse + +} // namespace Commands + +namespace Commands { +namespace ChangeToMode { +enum class Fields : uint8_t +{ + kNewMode = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::ChangeToMode::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterMode::Id; } + + uint8_t newMode = static_cast(0); + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = Clusters::WaterHeaterMode::Commands::ChangeToModeResponse::DecodableType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::ChangeToMode::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterMode::Id; } + + uint8_t newMode = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace ChangeToMode +namespace ChangeToModeResponse { +enum class Fields : uint8_t +{ + kStatus = 0, + kStatusText = 1, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::ChangeToModeResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterMode::Id; } + + uint8_t status = static_cast(0); + Optional statusText; + + 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::ChangeToModeResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterMode::Id; } + + uint8_t status = static_cast(0); + Optional statusText; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace ChangeToModeResponse +} // namespace Commands + +namespace Attributes { + +namespace SupportedModes { +struct TypeInfo +{ + using Type = chip::app::DataModel::List; + using DecodableType = + chip::app::DataModel::DecodableList; + using DecodableArgType = + const chip::app::DataModel::DecodableList &; + + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterMode::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::SupportedModes::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace SupportedModes +namespace CurrentMode { +struct TypeInfo +{ + using Type = uint8_t; + using DecodableType = uint8_t; + using DecodableArgType = uint8_t; + + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterMode::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::CurrentMode::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace CurrentMode +namespace StartUpMode { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterMode::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::StartUpMode::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace StartUpMode +namespace OnMode { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterMode::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::OnMode::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace OnMode +namespace GeneratedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterMode::Id; } +}; +} // namespace GeneratedCommandList +namespace AcceptedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::AcceptedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterMode::Id; } +}; +} // namespace AcceptedCommandList +namespace EventList { +struct TypeInfo : public Clusters::Globals::Attributes::EventList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterMode::Id; } +}; +} // namespace EventList +namespace AttributeList { +struct TypeInfo : public Clusters::Globals::Attributes::AttributeList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterMode::Id; } +}; +} // namespace AttributeList +namespace FeatureMap { +struct TypeInfo : public Clusters::Globals::Attributes::FeatureMap::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterMode::Id; } +}; +} // namespace FeatureMap +namespace ClusterRevision { +struct TypeInfo : public Clusters::Globals::Attributes::ClusterRevision::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterMode::Id; } +}; +} // namespace ClusterRevision + +struct TypeInfo +{ + struct DecodableType + { + static constexpr ClusterId GetClusterId() { return Clusters::WaterHeaterMode::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); + + Attributes::SupportedModes::TypeInfo::DecodableType supportedModes; + Attributes::CurrentMode::TypeInfo::DecodableType currentMode = static_cast(0); + Attributes::StartUpMode::TypeInfo::DecodableType startUpMode; + Attributes::OnMode::TypeInfo::DecodableType onMode; + Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; + Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; + Attributes::EventList::TypeInfo::DecodableType eventList; + Attributes::AttributeList::TypeInfo::DecodableType attributeList; + Attributes::FeatureMap::TypeInfo::DecodableType featureMap = static_cast(0); + Attributes::ClusterRevision::TypeInfo::DecodableType clusterRevision = static_cast(0); + }; +}; +} // namespace Attributes +} // namespace WaterHeaterMode namespace DeviceEnergyManagementMode { namespace Structs { namespace ModeTagStruct = Clusters::detail::Structs::ModeTagStruct; @@ -27277,31 +28177,7 @@ struct TypeInfo } // namespace BarrierControl namespace ServiceArea { namespace Structs { -namespace HomeLocationStruct { -enum class Fields : uint8_t -{ - kLocationName = 0, - kFloorNumber = 1, - kAreaType = 2, -}; - -struct Type -{ -public: - chip::CharSpan locationName; - DataModel::Nullable floorNumber; - DataModel::Nullable areaType; - - CHIP_ERROR Decode(TLV::TLVReader & reader); - - static constexpr bool kIsFabricScoped = false; - - CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; -}; - -using DecodableType = Type; - -} // namespace HomeLocationStruct +namespace LocationDescriptorStruct = Clusters::detail::Structs::LocationDescriptorStruct; namespace LocationInfoStruct { enum class Fields : uint8_t { @@ -27314,7 +28190,7 @@ enum class Fields : uint8_t struct Type { public: - DataModel::Nullable locationInfo; + DataModel::Nullable locationInfo; DataModel::Nullable landmarkTag; DataModel::Nullable positionTag; DataModel::Nullable surfaceTag; @@ -28679,29 +29555,6 @@ struct Type using DecodableType = Type; } // namespace PresetTypeStruct -namespace QueuedPresetStruct { -enum class Fields : uint8_t -{ - kPresetHandle = 0, - kTransitionTimestamp = 1, -}; - -struct Type -{ -public: - DataModel::Nullable presetHandle; - DataModel::Nullable transitionTimestamp; - - CHIP_ERROR Decode(TLV::TLVReader & reader); - - static constexpr bool kIsFabricScoped = false; - - CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; -}; - -using DecodableType = Type; - -} // namespace QueuedPresetStruct namespace ScheduleTypeStruct { enum class Fields : uint8_t { @@ -28807,16 +29660,6 @@ struct Type; struct DecodableType; } // namespace CommitPresetsSchedulesRequest -namespace CancelSetActivePresetRequest { -struct Type; -struct DecodableType; -} // namespace CancelSetActivePresetRequest - -namespace SetTemperatureSetpointHoldPolicy { -struct Type; -struct DecodableType; -} // namespace SetTemperatureSetpointHoldPolicy - } // namespace Commands namespace Commands { @@ -29036,7 +29879,6 @@ namespace SetActivePresetRequest { enum class Fields : uint8_t { kPresetHandle = 0, - kDelayMinutes = 1, }; struct Type @@ -29047,7 +29889,6 @@ struct Type static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } chip::ByteSpan presetHandle; - Optional delayMinutes; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -29063,7 +29904,6 @@ struct DecodableType static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } chip::ByteSpan presetHandle; - Optional delayMinutes; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace SetActivePresetRequest @@ -29155,68 +29995,6 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace CommitPresetsSchedulesRequest -namespace CancelSetActivePresetRequest { -enum class Fields : uint8_t -{ -}; - -struct Type -{ -public: - // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::CancelSetActivePresetRequest::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - - 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::CancelSetActivePresetRequest::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - - CHIP_ERROR Decode(TLV::TLVReader & reader); -}; -}; // namespace CancelSetActivePresetRequest -namespace SetTemperatureSetpointHoldPolicy { -enum class Fields : uint8_t -{ - kTemperatureSetpointHoldPolicy = 0, -}; - -struct Type -{ -public: - // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::SetTemperatureSetpointHoldPolicy::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - - chip::BitMask temperatureSetpointHoldPolicy = - 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::SetTemperatureSetpointHoldPolicy::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - - chip::BitMask temperatureSetpointHoldPolicy = - static_cast>(0); - CHIP_ERROR Decode(TLV::TLVReader & reader); -}; -}; // namespace SetTemperatureSetpointHoldPolicy } // namespace Commands namespace Attributes { @@ -29951,18 +30729,6 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace PresetsSchedulesEditable -namespace TemperatureSetpointHoldPolicy { -struct TypeInfo -{ - using Type = chip::BitMask; - using DecodableType = chip::BitMask; - using DecodableArgType = chip::BitMask; - - static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::TemperatureSetpointHoldPolicy::Id; } - static constexpr bool MustUseTimedWrite() { return false; } -}; -} // namespace TemperatureSetpointHoldPolicy namespace SetpointHoldExpiryTimestamp { struct TypeInfo { @@ -29975,20 +30741,6 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace SetpointHoldExpiryTimestamp -namespace QueuedPreset { -struct TypeInfo -{ - using Type = chip::app::DataModel::Nullable; - using DecodableType = - chip::app::DataModel::Nullable; - using DecodableArgType = - const chip::app::DataModel::Nullable &; - - static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::QueuedPreset::Id; } - static constexpr bool MustUseTimedWrite() { return false; } -}; -} // namespace QueuedPreset namespace GeneratedCommandList { struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo { @@ -30108,10 +30860,7 @@ struct TypeInfo Attributes::Presets::TypeInfo::DecodableType presets; Attributes::Schedules::TypeInfo::DecodableType schedules; Attributes::PresetsSchedulesEditable::TypeInfo::DecodableType presetsSchedulesEditable = static_cast(0); - Attributes::TemperatureSetpointHoldPolicy::TypeInfo::DecodableType temperatureSetpointHoldPolicy = - static_cast>(0); Attributes::SetpointHoldExpiryTimestamp::TypeInfo::DecodableType setpointHoldExpiryTimestamp; - Attributes::QueuedPreset::TypeInfo::DecodableType queuedPreset; Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::EventList::TypeInfo::DecodableType eventList; @@ -35461,6 +36210,18 @@ struct TypeInfo static constexpr size_t MaxLength() { return 32; } }; } // namespace Ssid +namespace PassphraseSurrogate { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::WiFiNetworkManagement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::PassphraseSurrogate::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace PassphraseSurrogate namespace GeneratedCommandList { struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo { @@ -35507,6 +36268,7 @@ struct TypeInfo CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); Attributes::Ssid::TypeInfo::DecodableType ssid; + Attributes::PassphraseSurrogate::TypeInfo::DecodableType passphraseSurrogate; Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::EventList::TypeInfo::DecodableType eventList; @@ -35836,17 +36598,19 @@ namespace Structs { namespace ThreadNetworkStruct { enum class Fields : uint8_t { - kExtendedPanID = 0, - kNetworkName = 1, - kChannel = 2, + kExtendedPanID = 0, + kNetworkName = 1, + kChannel = 2, + kActiveTimestamp = 3, }; struct Type { public: - uint64_t extendedPanID = static_cast(0); + chip::ByteSpan extendedPanID; chip::CharSpan networkName; - uint16_t channel = static_cast(0); + uint16_t channel = static_cast(0); + uint64_t activeTimestamp = static_cast(0); CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -35931,7 +36695,7 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::RemoveNetwork::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } - uint64_t extendedPanID = static_cast(0); + chip::ByteSpan extendedPanID; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -35946,7 +36710,7 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::RemoveNetwork::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } - uint64_t extendedPanID = static_cast(0); + chip::ByteSpan extendedPanID; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace RemoveNetwork @@ -35963,13 +36727,13 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::GetOperationalDataset::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } - uint64_t extendedPanID = static_cast(0); + chip::ByteSpan extendedPanID; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; using ResponseType = Clusters::ThreadNetworkDirectory::Commands::OperationalDatasetResponse::DecodableType; - static constexpr bool MustUseTimedInvoke() { return true; } + static constexpr bool MustUseTimedInvoke() { return false; } }; struct DecodableType @@ -35978,7 +36742,7 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::GetOperationalDataset::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } - uint64_t extendedPanID = static_cast(0); + chip::ByteSpan extendedPanID; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace GetOperationalDataset @@ -36021,13 +36785,14 @@ namespace Attributes { namespace PreferredExtendedPanID { struct TypeInfo { - using Type = chip::app::DataModel::Nullable; - using DecodableType = chip::app::DataModel::Nullable; - using DecodableArgType = const chip::app::DataModel::Nullable &; + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::PreferredExtendedPanID::Id; } static constexpr bool MustUseTimedWrite() { return false; } + static constexpr size_t MaxLength() { return 8; } }; } // namespace PreferredExtendedPanID namespace ThreadNetworks { @@ -36113,41 +36878,6 @@ struct TypeInfo }; }; } // namespace Attributes -namespace Events { -namespace NetworkChanged { -static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; - -enum class Fields : uint8_t -{ - kExtendedPanID = 0, -}; - -struct Type -{ -public: - static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } - static constexpr EventId GetEventId() { return Events::NetworkChanged::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } - static constexpr bool kIsFabricScoped = false; - - uint64_t extendedPanID = static_cast(0); - - CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; -}; - -struct DecodableType -{ -public: - static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } - static constexpr EventId GetEventId() { return Events::NetworkChanged::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::ThreadNetworkDirectory::Id; } - - uint64_t extendedPanID = static_cast(0); - - CHIP_ERROR Decode(TLV::TLVReader & reader); -}; -} // namespace NetworkChanged -} // namespace Events } // namespace ThreadNetworkDirectory namespace WakeOnLan { @@ -40736,6 +41466,476 @@ struct TypeInfo }; } // namespace Attributes } // namespace ContentAppObserver +namespace EcosystemInformation { +namespace Structs { +namespace LocationDescriptorStruct = Clusters::detail::Structs::LocationDescriptorStruct; +namespace EcosystemLocationStruct { +enum class Fields : uint8_t +{ + kUniqueLocationID = 0, + kLocationDescriptor = 1, + kLocationDescriptorLastEdit = 2, + kFabricIndex = 254, +}; + +struct Type +{ +public: + chip::CharSpan uniqueLocationID; + Structs::LocationDescriptorStruct::Type locationDescriptor; + uint64_t locationDescriptorLastEdit = static_cast(0); + chip::FabricIndex fabricIndex = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = true; + + auto GetFabricIndex() const { return fabricIndex; } + + void SetFabricIndex(chip::FabricIndex fabricIndex_) { fabricIndex = fabricIndex_; } + + CHIP_ERROR EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + CHIP_ERROR EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const; + +private: + CHIP_ERROR DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional & aAccessingFabricIndex) const; +}; + +using DecodableType = Type; + +} // namespace EcosystemLocationStruct +namespace DeviceTypeStruct = Clusters::detail::Structs::DeviceTypeStruct; +namespace EcosystemDeviceStruct { +enum class Fields : uint8_t +{ + kDeviceName = 0, + kDeviceNameLastEdit = 1, + kBridgedEndpoint = 2, + kOriginalEndpoint = 3, + kDeviceTypes = 4, + kUniqueLocationIDs = 5, + kUniqueLocationIDsLastEdit = 6, + kFabricIndex = 254, +}; + +struct Type +{ +public: + Optional deviceName; + Optional deviceNameLastEdit; + chip::EndpointId bridgedEndpoint = static_cast(0); + chip::EndpointId originalEndpoint = static_cast(0); + DataModel::List deviceTypes; + DataModel::List uniqueLocationIDs; + uint64_t uniqueLocationIDsLastEdit = static_cast(0); + chip::FabricIndex fabricIndex = static_cast(0); + + static constexpr bool kIsFabricScoped = true; + + auto GetFabricIndex() const { return fabricIndex; } + + void SetFabricIndex(chip::FabricIndex fabricIndex_) { fabricIndex = fabricIndex_; } + + CHIP_ERROR EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + CHIP_ERROR EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const; + +private: + CHIP_ERROR DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional & aAccessingFabricIndex) const; +}; + +struct DecodableType +{ +public: + Optional deviceName; + Optional deviceNameLastEdit; + chip::EndpointId bridgedEndpoint = static_cast(0); + chip::EndpointId originalEndpoint = static_cast(0); + DataModel::DecodableList deviceTypes; + DataModel::DecodableList uniqueLocationIDs; + uint64_t uniqueLocationIDsLastEdit = static_cast(0); + chip::FabricIndex fabricIndex = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = true; + + auto GetFabricIndex() const { return fabricIndex; } + + void SetFabricIndex(chip::FabricIndex fabricIndex_) { fabricIndex = fabricIndex_; } +}; + +} // namespace EcosystemDeviceStruct +} // namespace Structs + +namespace Attributes { + +namespace RemovedOn { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::EcosystemInformation::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::RemovedOn::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace RemovedOn +namespace DeviceDirectory { +struct TypeInfo +{ + using Type = chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList< + chip::app::Clusters::EcosystemInformation::Structs::EcosystemDeviceStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::DecodableList< + chip::app::Clusters::EcosystemInformation::Structs::EcosystemDeviceStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::EcosystemInformation::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::DeviceDirectory::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace DeviceDirectory +namespace LocationDirectory { +struct TypeInfo +{ + using Type = + chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList< + chip::app::Clusters::EcosystemInformation::Structs::EcosystemLocationStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::DecodableList< + chip::app::Clusters::EcosystemInformation::Structs::EcosystemLocationStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::EcosystemInformation::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::LocationDirectory::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace LocationDirectory +namespace GeneratedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::EcosystemInformation::Id; } +}; +} // namespace GeneratedCommandList +namespace AcceptedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::AcceptedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::EcosystemInformation::Id; } +}; +} // namespace AcceptedCommandList +namespace EventList { +struct TypeInfo : public Clusters::Globals::Attributes::EventList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::EcosystemInformation::Id; } +}; +} // namespace EventList +namespace AttributeList { +struct TypeInfo : public Clusters::Globals::Attributes::AttributeList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::EcosystemInformation::Id; } +}; +} // namespace AttributeList +namespace FeatureMap { +struct TypeInfo : public Clusters::Globals::Attributes::FeatureMap::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::EcosystemInformation::Id; } +}; +} // namespace FeatureMap +namespace ClusterRevision { +struct TypeInfo : public Clusters::Globals::Attributes::ClusterRevision::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::EcosystemInformation::Id; } +}; +} // namespace ClusterRevision + +struct TypeInfo +{ + struct DecodableType + { + static constexpr ClusterId GetClusterId() { return Clusters::EcosystemInformation::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); + + Attributes::RemovedOn::TypeInfo::DecodableType removedOn; + Attributes::DeviceDirectory::TypeInfo::DecodableType deviceDirectory; + Attributes::LocationDirectory::TypeInfo::DecodableType locationDirectory; + Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; + Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; + Attributes::EventList::TypeInfo::DecodableType eventList; + Attributes::AttributeList::TypeInfo::DecodableType attributeList; + Attributes::FeatureMap::TypeInfo::DecodableType featureMap = static_cast(0); + Attributes::ClusterRevision::TypeInfo::DecodableType clusterRevision = static_cast(0); + }; +}; +} // namespace Attributes +} // namespace EcosystemInformation +namespace CommissionerControl { + +namespace Commands { +// Forward-declarations so we can reference these later. + +namespace RequestCommissioningApproval { +struct Type; +struct DecodableType; +} // namespace RequestCommissioningApproval + +namespace CommissionNode { +struct Type; +struct DecodableType; +} // namespace CommissionNode + +namespace ReverseOpenCommissioningWindow { +struct Type; +struct DecodableType; +} // namespace ReverseOpenCommissioningWindow + +} // namespace Commands + +namespace Commands { +namespace RequestCommissioningApproval { +enum class Fields : uint8_t +{ + kRequestId = 0, + kVendorId = 1, + kProductId = 2, + kLabel = 3, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::RequestCommissioningApproval::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::CommissionerControl::Id; } + + uint64_t requestId = static_cast(0); + chip::VendorId vendorId = static_cast(0); + uint16_t productId = static_cast(0); + Optional label; + + 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::RequestCommissioningApproval::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::CommissionerControl::Id; } + + uint64_t requestId = static_cast(0); + chip::VendorId vendorId = static_cast(0); + uint16_t productId = static_cast(0); + Optional label; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace RequestCommissioningApproval +namespace CommissionNode { +enum class Fields : uint8_t +{ + kRequestId = 0, + kResponseTimeoutSeconds = 1, + kIpAddress = 2, + kPort = 3, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::CommissionNode::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::CommissionerControl::Id; } + + uint64_t requestId = static_cast(0); + uint16_t responseTimeoutSeconds = static_cast(0); + Optional ipAddress; + Optional port; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = Clusters::CommissionerControl::Commands::ReverseOpenCommissioningWindow::DecodableType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::CommissionNode::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::CommissionerControl::Id; } + + uint64_t requestId = static_cast(0); + uint16_t responseTimeoutSeconds = static_cast(0); + Optional ipAddress; + Optional port; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace CommissionNode +namespace ReverseOpenCommissioningWindow { +enum class Fields : uint8_t +{ + kCommissioningTimeout = 0, + kPAKEPasscodeVerifier = 1, + kDiscriminator = 2, + kIterations = 3, + kSalt = 4, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::ReverseOpenCommissioningWindow::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::CommissionerControl::Id; } + + uint16_t commissioningTimeout = static_cast(0); + chip::ByteSpan PAKEPasscodeVerifier; + uint16_t discriminator = static_cast(0); + uint32_t iterations = static_cast(0); + chip::ByteSpan salt; + + 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::ReverseOpenCommissioningWindow::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::CommissionerControl::Id; } + + uint16_t commissioningTimeout = static_cast(0); + chip::ByteSpan PAKEPasscodeVerifier; + uint16_t discriminator = static_cast(0); + uint32_t iterations = static_cast(0); + chip::ByteSpan salt; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace ReverseOpenCommissioningWindow +} // namespace Commands + +namespace Attributes { + +namespace SupportedDeviceCategories { +struct TypeInfo +{ + using Type = chip::BitMask; + using DecodableType = chip::BitMask; + using DecodableArgType = chip::BitMask; + + static constexpr ClusterId GetClusterId() { return Clusters::CommissionerControl::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::SupportedDeviceCategories::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace SupportedDeviceCategories +namespace GeneratedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::CommissionerControl::Id; } +}; +} // namespace GeneratedCommandList +namespace AcceptedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::AcceptedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::CommissionerControl::Id; } +}; +} // namespace AcceptedCommandList +namespace EventList { +struct TypeInfo : public Clusters::Globals::Attributes::EventList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::CommissionerControl::Id; } +}; +} // namespace EventList +namespace AttributeList { +struct TypeInfo : public Clusters::Globals::Attributes::AttributeList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::CommissionerControl::Id; } +}; +} // namespace AttributeList +namespace FeatureMap { +struct TypeInfo : public Clusters::Globals::Attributes::FeatureMap::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::CommissionerControl::Id; } +}; +} // namespace FeatureMap +namespace ClusterRevision { +struct TypeInfo : public Clusters::Globals::Attributes::ClusterRevision::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::CommissionerControl::Id; } +}; +} // namespace ClusterRevision + +struct TypeInfo +{ + struct DecodableType + { + static constexpr ClusterId GetClusterId() { return Clusters::CommissionerControl::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); + + Attributes::SupportedDeviceCategories::TypeInfo::DecodableType supportedDeviceCategories = + static_cast>(0); + Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; + Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; + Attributes::EventList::TypeInfo::DecodableType eventList; + Attributes::AttributeList::TypeInfo::DecodableType attributeList; + Attributes::FeatureMap::TypeInfo::DecodableType featureMap = static_cast(0); + Attributes::ClusterRevision::TypeInfo::DecodableType clusterRevision = static_cast(0); + }; +}; +} // namespace Attributes +namespace Events { +namespace CommissioningRequestResult { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; + +enum class Fields : uint8_t +{ + kRequestId = 0, + kClientNodeId = 1, + kStatusCode = 2, + kFabricIndex = 254, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::CommissioningRequestResult::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::CommissionerControl::Id; } + static constexpr bool kIsFabricScoped = true; + + uint64_t requestId = static_cast(0); + chip::NodeId clientNodeId = static_cast(0); + uint8_t statusCode = static_cast(0); + chip::FabricIndex fabricIndex = static_cast(0); + + auto GetFabricIndex() const { return fabricIndex; } + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::CommissioningRequestResult::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::CommissionerControl::Id; } + + uint64_t requestId = static_cast(0); + chip::NodeId clientNodeId = static_cast(0); + uint8_t statusCode = static_cast(0); + chip::FabricIndex fabricIndex = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace CommissioningRequestResult +} // namespace Events +} // namespace CommissionerControl namespace ElectricalMeasurement { namespace Commands { 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 7bfad24bf56998..44fae1a19e4624 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 @@ -504,6 +504,14 @@ namespace AccessControlEntriesPerFabric { static constexpr AttributeId Id = 0x00000004; } // namespace AccessControlEntriesPerFabric +namespace CommissioningARL { +static constexpr AttributeId Id = 0x00000005; +} // namespace CommissioningARL + +namespace Arl { +static constexpr AttributeId Id = 0x00000006; +} // namespace Arl + namespace GeneratedCommandList { static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; } // namespace GeneratedCommandList @@ -2364,6 +2372,10 @@ namespace OperatingMode { static constexpr AttributeId Id = 0x00000008; } // namespace OperatingMode +namespace MaximumCheckInBackOff { +static constexpr AttributeId Id = 0x00000009; +} // namespace MaximumCheckInBackOff + namespace GeneratedCommandList { static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; } // namespace GeneratedCommandList @@ -3801,6 +3813,60 @@ static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; } // namespace Attributes } // namespace ElectricalEnergyMeasurement +namespace WaterHeaterManagement { +namespace Attributes { + +namespace HeaterTypes { +static constexpr AttributeId Id = 0x00000000; +} // namespace HeaterTypes + +namespace HeatDemand { +static constexpr AttributeId Id = 0x00000001; +} // namespace HeatDemand + +namespace TankVolume { +static constexpr AttributeId Id = 0x00000002; +} // namespace TankVolume + +namespace EstimatedHeatRequired { +static constexpr AttributeId Id = 0x00000003; +} // namespace EstimatedHeatRequired + +namespace TankPercentage { +static constexpr AttributeId Id = 0x00000004; +} // namespace TankPercentage + +namespace BoostState { +static constexpr AttributeId Id = 0x00000005; +} // namespace BoostState + +namespace GeneratedCommandList { +static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; +} // namespace GeneratedCommandList + +namespace AcceptedCommandList { +static constexpr AttributeId Id = Globals::Attributes::AcceptedCommandList::Id; +} // namespace AcceptedCommandList + +namespace EventList { +static constexpr AttributeId Id = Globals::Attributes::EventList::Id; +} // namespace EventList + +namespace AttributeList { +static constexpr AttributeId Id = Globals::Attributes::AttributeList::Id; +} // namespace AttributeList + +namespace FeatureMap { +static constexpr AttributeId Id = Globals::Attributes::FeatureMap::Id; +} // namespace FeatureMap + +namespace ClusterRevision { +static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace WaterHeaterManagement + namespace DemandResponseLoadControl { namespace Attributes { @@ -4219,6 +4285,52 @@ static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; } // namespace Attributes } // namespace EnergyEvseMode +namespace WaterHeaterMode { +namespace Attributes { + +namespace SupportedModes { +static constexpr AttributeId Id = 0x00000000; +} // namespace SupportedModes + +namespace CurrentMode { +static constexpr AttributeId Id = 0x00000001; +} // namespace CurrentMode + +namespace StartUpMode { +static constexpr AttributeId Id = 0x00000002; +} // namespace StartUpMode + +namespace OnMode { +static constexpr AttributeId Id = 0x00000003; +} // namespace OnMode + +namespace GeneratedCommandList { +static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; +} // namespace GeneratedCommandList + +namespace AcceptedCommandList { +static constexpr AttributeId Id = Globals::Attributes::AcceptedCommandList::Id; +} // namespace AcceptedCommandList + +namespace EventList { +static constexpr AttributeId Id = Globals::Attributes::EventList::Id; +} // namespace EventList + +namespace AttributeList { +static constexpr AttributeId Id = Globals::Attributes::AttributeList::Id; +} // namespace AttributeList + +namespace FeatureMap { +static constexpr AttributeId Id = Globals::Attributes::FeatureMap::Id; +} // namespace FeatureMap + +namespace ClusterRevision { +static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace WaterHeaterMode + namespace DeviceEnergyManagementMode { namespace Attributes { @@ -5082,18 +5194,10 @@ namespace PresetsSchedulesEditable { static constexpr AttributeId Id = 0x00000052; } // namespace PresetsSchedulesEditable -namespace TemperatureSetpointHoldPolicy { -static constexpr AttributeId Id = 0x00000053; -} // namespace TemperatureSetpointHoldPolicy - namespace SetpointHoldExpiryTimestamp { -static constexpr AttributeId Id = 0x00000054; +static constexpr AttributeId Id = 0x00000053; } // namespace SetpointHoldExpiryTimestamp -namespace QueuedPreset { -static constexpr AttributeId Id = 0x00000055; -} // namespace QueuedPreset - namespace GeneratedCommandList { static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; } // namespace GeneratedCommandList @@ -6649,9 +6753,13 @@ namespace WiFiNetworkManagement { namespace Attributes { namespace Ssid { -static constexpr AttributeId Id = 0x00000001; +static constexpr AttributeId Id = 0x00000000; } // namespace Ssid +namespace PassphraseSurrogate { +static constexpr AttributeId Id = 0x00000001; +} // namespace PassphraseSurrogate + namespace GeneratedCommandList { static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; } // namespace GeneratedCommandList @@ -6699,7 +6807,7 @@ static constexpr AttributeId Id = 0x00000003; } // namespace InterfaceEnabled namespace ActiveDatasetTimestamp { -static constexpr AttributeId Id = 0x00000005; +static constexpr AttributeId Id = 0x00000004; } // namespace ActiveDatasetTimestamp namespace GeneratedCommandList { @@ -7359,6 +7467,82 @@ static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; } // namespace Attributes } // namespace ContentAppObserver +namespace EcosystemInformation { +namespace Attributes { + +namespace RemovedOn { +static constexpr AttributeId Id = 0x00000000; +} // namespace RemovedOn + +namespace DeviceDirectory { +static constexpr AttributeId Id = 0x00000001; +} // namespace DeviceDirectory + +namespace LocationDirectory { +static constexpr AttributeId Id = 0x00000002; +} // namespace LocationDirectory + +namespace GeneratedCommandList { +static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; +} // namespace GeneratedCommandList + +namespace AcceptedCommandList { +static constexpr AttributeId Id = Globals::Attributes::AcceptedCommandList::Id; +} // namespace AcceptedCommandList + +namespace EventList { +static constexpr AttributeId Id = Globals::Attributes::EventList::Id; +} // namespace EventList + +namespace AttributeList { +static constexpr AttributeId Id = Globals::Attributes::AttributeList::Id; +} // namespace AttributeList + +namespace FeatureMap { +static constexpr AttributeId Id = Globals::Attributes::FeatureMap::Id; +} // namespace FeatureMap + +namespace ClusterRevision { +static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace EcosystemInformation + +namespace CommissionerControl { +namespace Attributes { + +namespace SupportedDeviceCategories { +static constexpr AttributeId Id = 0x00000000; +} // namespace SupportedDeviceCategories + +namespace GeneratedCommandList { +static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; +} // namespace GeneratedCommandList + +namespace AcceptedCommandList { +static constexpr AttributeId Id = Globals::Attributes::AcceptedCommandList::Id; +} // namespace AcceptedCommandList + +namespace EventList { +static constexpr AttributeId Id = Globals::Attributes::EventList::Id; +} // namespace EventList + +namespace AttributeList { +static constexpr AttributeId Id = Globals::Attributes::AttributeList::Id; +} // namespace AttributeList + +namespace FeatureMap { +static constexpr AttributeId Id = Globals::Attributes::FeatureMap::Id; +} // namespace FeatureMap + +namespace ClusterRevision { +static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace CommissionerControl + namespace ElectricalMeasurement { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h b/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h index eab334c8ce3a29..9e5bb87b52ef51 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h @@ -226,6 +226,9 @@ static constexpr ClusterId Id = 0x00000090; namespace ElectricalEnergyMeasurement { static constexpr ClusterId Id = 0x00000091; } // namespace ElectricalEnergyMeasurement +namespace WaterHeaterManagement { +static constexpr ClusterId Id = 0x00000094; +} // namespace WaterHeaterManagement namespace DemandResponseLoadControl { static constexpr ClusterId Id = 0x00000096; } // namespace DemandResponseLoadControl @@ -247,6 +250,9 @@ static constexpr ClusterId Id = 0x0000009C; namespace EnergyEvseMode { static constexpr ClusterId Id = 0x0000009D; } // namespace EnergyEvseMode +namespace WaterHeaterMode { +static constexpr ClusterId Id = 0x0000009E; +} // namespace WaterHeaterMode namespace DeviceEnergyManagementMode { static constexpr ClusterId Id = 0x0000009F; } // namespace DeviceEnergyManagementMode @@ -379,6 +385,12 @@ static constexpr ClusterId Id = 0x0000050F; namespace ContentAppObserver { static constexpr ClusterId Id = 0x00000510; } // namespace ContentAppObserver +namespace EcosystemInformation { +static constexpr ClusterId Id = 0x00000750; +} // namespace EcosystemInformation +namespace CommissionerControl { +static constexpr ClusterId Id = 0x00000751; +} // namespace CommissionerControl namespace ElectricalMeasurement { static constexpr ClusterId Id = 0x00000B04; } // namespace ElectricalMeasurement 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 cff6ad343f0db3..fa7ba01be1aa4c 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 @@ -159,6 +159,20 @@ static constexpr CommandId Id = 0x00000008; } // namespace Commands } // namespace LevelControl +namespace AccessControl { +namespace Commands { + +namespace ReviewFabricRestrictions { +static constexpr CommandId Id = 0x00000000; +} // namespace ReviewFabricRestrictions + +namespace ReviewFabricRestrictionsResponse { +static constexpr CommandId Id = 0x00000001; +} // namespace ReviewFabricRestrictionsResponse + +} // namespace Commands +} // namespace AccessControl + namespace Actions { namespace Commands { @@ -449,6 +463,16 @@ static constexpr CommandId Id = 0x00000005; } // namespace Commands } // namespace TimeSynchronization +namespace BridgedDeviceBasicInformation { +namespace Commands { + +namespace KeepActive { +static constexpr CommandId Id = 0x00000080; +} // namespace KeepActive + +} // namespace Commands +} // namespace BridgedDeviceBasicInformation + namespace AdministratorCommissioning { namespace Commands { @@ -929,6 +953,20 @@ static constexpr CommandId Id = 0x00000001; } // namespace Commands } // namespace ValveConfigurationAndControl +namespace WaterHeaterManagement { +namespace Commands { + +namespace Boost { +static constexpr CommandId Id = 0x00000000; +} // namespace Boost + +namespace CancelBoost { +static constexpr CommandId Id = 0x00000001; +} // namespace CancelBoost + +} // namespace Commands +} // namespace WaterHeaterManagement + namespace DemandResponseLoadControl { namespace Commands { @@ -1059,6 +1097,20 @@ static constexpr CommandId Id = 0x00000001; } // namespace Commands } // namespace EnergyEvseMode +namespace WaterHeaterMode { +namespace Commands { + +namespace ChangeToMode { +static constexpr CommandId Id = 0x00000000; +} // namespace ChangeToMode + +namespace ChangeToModeResponse { +static constexpr CommandId Id = 0x00000001; +} // namespace ChangeToModeResponse + +} // namespace Commands +} // namespace WaterHeaterMode + namespace DeviceEnergyManagementMode { namespace Commands { @@ -1300,14 +1352,6 @@ namespace CommitPresetsSchedulesRequest { static constexpr CommandId Id = 0x00000009; } // namespace CommitPresetsSchedulesRequest -namespace CancelSetActivePresetRequest { -static constexpr CommandId Id = 0x0000000A; -} // namespace CancelSetActivePresetRequest - -namespace SetTemperatureSetpointHoldPolicy { -static constexpr CommandId Id = 0x0000000B; -} // namespace SetTemperatureSetpointHoldPolicy - } // namespace Commands } // namespace Thermostat @@ -1429,15 +1473,15 @@ static constexpr CommandId Id = 0x00000001; } // namespace GetPendingDatasetRequest namespace DatasetResponse { -static constexpr CommandId Id = 0x00000003; +static constexpr CommandId Id = 0x00000002; } // namespace DatasetResponse namespace SetActiveDatasetRequest { -static constexpr CommandId Id = 0x00000004; +static constexpr CommandId Id = 0x00000003; } // namespace SetActiveDatasetRequest namespace SetPendingDatasetRequest { -static constexpr CommandId Id = 0x00000005; +static constexpr CommandId Id = 0x00000004; } // namespace SetPendingDatasetRequest } // namespace Commands @@ -1769,6 +1813,24 @@ static constexpr CommandId Id = 0x00000001; } // namespace Commands } // namespace ContentAppObserver +namespace CommissionerControl { +namespace Commands { + +namespace RequestCommissioningApproval { +static constexpr CommandId Id = 0x00000000; +} // namespace RequestCommissioningApproval + +namespace CommissionNode { +static constexpr CommandId Id = 0x00000001; +} // namespace CommissionNode + +namespace ReverseOpenCommissioningWindow { +static constexpr CommandId Id = 0x00000002; +} // namespace ReverseOpenCommissioningWindow + +} // namespace Commands +} // namespace CommissionerControl + namespace ElectricalMeasurement { namespace Commands { diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Events.h b/zzz_generated/app-common/app-common/zap-generated/ids/Events.h index 1592020a008379..f8243c506f906d 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Events.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Events.h @@ -36,6 +36,14 @@ namespace AccessControlExtensionChanged { static constexpr EventId Id = 0x00000001; } // namespace AccessControlExtensionChanged +namespace AccessRestrictionEntryChanged { +static constexpr EventId Id = 0x00000002; +} // namespace AccessRestrictionEntryChanged + +namespace FabricRestrictionReviewUpdate { +static constexpr EventId Id = 0x00000003; +} // namespace FabricRestrictionReviewUpdate + } // namespace Events } // namespace AccessControl @@ -220,6 +228,10 @@ namespace ReachableChanged { static constexpr EventId Id = 0x00000003; } // namespace ReachableChanged +namespace ActiveChanged { +static constexpr EventId Id = 0x00000080; +} // namespace ActiveChanged + } // namespace Events } // namespace BridgedDeviceBasicInformation @@ -611,16 +623,6 @@ static constexpr EventId Id = 0x00000010; } // namespace Events } // namespace PumpConfigurationAndControl -namespace ThreadNetworkDirectory { -namespace Events { - -namespace NetworkChanged { -static constexpr EventId Id = 0x00000000; -} // namespace NetworkChanged - -} // namespace Events -} // namespace ThreadNetworkDirectory - namespace TargetNavigator { namespace Events { @@ -661,6 +663,16 @@ static constexpr EventId Id = 0x00000000; } // namespace Events } // namespace ContentControl +namespace CommissionerControl { +namespace Events { + +namespace CommissioningRequestResult { +static constexpr EventId Id = 0x00000000; +} // namespace CommissioningRequestResult + +} // namespace Events +} // namespace CommissionerControl + namespace UnitTesting { namespace Events { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index a7bae21539e5b8..ef106d4b455b5a 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -102,6 +102,7 @@ | ValveConfigurationAndControl | 0x0081 | | ElectricalPowerMeasurement | 0x0090 | | ElectricalEnergyMeasurement | 0x0091 | +| WaterHeaterManagement | 0x0094 | | DemandResponseLoadControl | 0x0096 | | Messages | 0x0097 | | DeviceEnergyManagement | 0x0098 | @@ -109,6 +110,7 @@ | EnergyPreference | 0x009B | | PowerTopology | 0x009C | | EnergyEvseMode | 0x009D | +| WaterHeaterMode | 0x009E | | DeviceEnergyManagementMode | 0x009F | | DoorLock | 0x0101 | | WindowCovering | 0x0102 | @@ -153,6 +155,8 @@ | AccountLogin | 0x050E | | ContentControl | 0x050F | | ContentAppObserver | 0x0510 | +| EcosystemInformation | 0x0750 | +| CommissionerControl | 0x0751 | | ElectricalMeasurement | 0x0B04 | | UnitTesting | 0xFFF1FC05| | FaultInjection | 0xFFF1FC06| @@ -1249,6 +1253,7 @@ class LevelControlMoveToClosestFrequency : public ClusterCommand | Cluster AccessControl | 0x001F | |------------------------------------------------------------------------------| | Commands: | | +| * ReviewFabricRestrictions | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * Acl | 0x0000 | @@ -1256,6 +1261,8 @@ class LevelControlMoveToClosestFrequency : public ClusterCommand | * SubjectsPerAccessControlEntry | 0x0002 | | * TargetsPerAccessControlEntry | 0x0003 | | * AccessControlEntriesPerFabric | 0x0004 | +| * CommissioningARL | 0x0005 | +| * Arl | 0x0006 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -1266,8 +1273,51 @@ class LevelControlMoveToClosestFrequency : public ClusterCommand | Events: | | | * AccessControlEntryChanged | 0x0000 | | * AccessControlExtensionChanged | 0x0001 | +| * AccessRestrictionEntryChanged | 0x0002 | +| * FabricRestrictionReviewUpdate | 0x0003 | \*----------------------------------------------------------------------------*/ +/* + * Command ReviewFabricRestrictions + */ +class AccessControlReviewFabricRestrictions : public ClusterCommand +{ +public: + AccessControlReviewFabricRestrictions(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("review-fabric-restrictions", credsIssuerConfig), mComplex_Arl(&mRequest.arl) + { + AddArgument("Arl", &mComplex_Arl); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::AccessControl::Commands::ReviewFabricRestrictions::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::AccessControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::AccessControl::Commands::ReviewFabricRestrictions::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::AccessControl::Commands::ReviewFabricRestrictions::Type mRequest; + TypedComplexArgument< + chip::app::DataModel::List> + mComplex_Arl; +}; + /*----------------------------------------------------------------------------*\ | Cluster Actions | 0x0025 | |------------------------------------------------------------------------------| @@ -3389,6 +3439,7 @@ class TimeSynchronizationSetDefaultNTP : public ClusterCommand | Cluster BridgedDeviceBasicInformation | 0x0039 | |------------------------------------------------------------------------------| | Commands: | | +| * KeepActive | 0x80 | |------------------------------------------------------------------------------| | Attributes: | | | * VendorName | 0x0001 | @@ -3419,8 +3470,47 @@ class TimeSynchronizationSetDefaultNTP : public ClusterCommand | * ShutDown | 0x0001 | | * Leave | 0x0002 | | * ReachableChanged | 0x0003 | +| * ActiveChanged | 0x0080 | \*----------------------------------------------------------------------------*/ +/* + * Command KeepActive + */ +class BridgedDeviceBasicInformationKeepActive : public ClusterCommand +{ +public: + BridgedDeviceBasicInformationKeepActive(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("keep-active", credsIssuerConfig) + { + AddArgument("StayActiveDuration", 0, UINT32_MAX, &mRequest.stayActiveDuration); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::BridgedDeviceBasicInformation::Commands::KeepActive::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::BridgedDeviceBasicInformation::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::BridgedDeviceBasicInformation::Commands::KeepActive::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::BridgedDeviceBasicInformation::Commands::KeepActive::Type mRequest; +}; + /*----------------------------------------------------------------------------*\ | Cluster Switch | 0x003B | |------------------------------------------------------------------------------| @@ -4220,6 +4310,7 @@ class GroupKeyManagementKeySetReadAllIndices : public ClusterCommand | * UserActiveModeTriggerHint | 0x0006 | | * UserActiveModeTriggerInstruction | 0x0007 | | * OperatingMode | 0x0008 | +| * MaximumCheckInBackOff | 0x0009 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -6573,6 +6664,109 @@ class ValveConfigurationAndControlClose : public ClusterCommand | * PeriodicEnergyMeasured | 0x0001 | \*----------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------*\ +| Cluster WaterHeaterManagement | 0x0094 | +|------------------------------------------------------------------------------| +| Commands: | | +| * Boost | 0x00 | +| * CancelBoost | 0x01 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * HeaterTypes | 0x0000 | +| * HeatDemand | 0x0001 | +| * TankVolume | 0x0002 | +| * EstimatedHeatRequired | 0x0003 | +| * TankPercentage | 0x0004 | +| * BoostState | 0x0005 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +/* + * Command Boost + */ +class WaterHeaterManagementBoost : public ClusterCommand +{ +public: + WaterHeaterManagementBoost(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("boost", credsIssuerConfig) + { + AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); + AddArgument("OneShot", 0, 1, &mRequest.oneShot); + AddArgument("EmergencyBoost", 0, 1, &mRequest.emergencyBoost); + AddArgument("TemporarySetpoint", INT16_MIN, INT16_MAX, &mRequest.temporarySetpoint); + AddArgument("TargetPercentage", 0, UINT8_MAX, &mRequest.targetPercentage); + AddArgument("TargetReheat", 0, UINT8_MAX, &mRequest.targetReheat); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WaterHeaterManagement::Commands::Boost::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::WaterHeaterManagement::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WaterHeaterManagement::Commands::Boost::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::WaterHeaterManagement::Commands::Boost::Type mRequest; +}; + +/* + * Command CancelBoost + */ +class WaterHeaterManagementCancelBoost : public ClusterCommand +{ +public: + WaterHeaterManagementCancelBoost(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("cancel-boost", credsIssuerConfig) + { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WaterHeaterManagement::Commands::CancelBoost::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::WaterHeaterManagement::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WaterHeaterManagement::Commands::CancelBoost::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::WaterHeaterManagement::Commands::CancelBoost::Type mRequest; +}; + /*----------------------------------------------------------------------------*\ | Cluster DemandResponseLoadControl | 0x0096 | |------------------------------------------------------------------------------| @@ -7681,6 +7875,64 @@ class EnergyEvseModeChangeToMode : public ClusterCommand chip::app::Clusters::EnergyEvseMode::Commands::ChangeToMode::Type mRequest; }; +/*----------------------------------------------------------------------------*\ +| Cluster WaterHeaterMode | 0x009E | +|------------------------------------------------------------------------------| +| Commands: | | +| * ChangeToMode | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * SupportedModes | 0x0000 | +| * CurrentMode | 0x0001 | +| * StartUpMode | 0x0002 | +| * OnMode | 0x0003 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +/* + * Command ChangeToMode + */ +class WaterHeaterModeChangeToMode : public ClusterCommand +{ +public: + WaterHeaterModeChangeToMode(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("change-to-mode", credsIssuerConfig) + { + AddArgument("NewMode", 0, UINT8_MAX, &mRequest.newMode); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WaterHeaterMode::Commands::ChangeToMode::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::WaterHeaterMode::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WaterHeaterMode::Commands::ChangeToMode::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::WaterHeaterMode::Commands::ChangeToMode::Type mRequest; +}; + /*----------------------------------------------------------------------------*\ | Cluster DeviceEnergyManagementMode | 0x009F | |------------------------------------------------------------------------------| @@ -9230,8 +9482,6 @@ class ServiceAreaSkipCurrentLocation : public ClusterCommand | * StartPresetsSchedulesEditRequest | 0x07 | | * CancelPresetsSchedulesEditRequest | 0x08 | | * CommitPresetsSchedulesRequest | 0x09 | -| * CancelSetActivePresetRequest | 0x0A | -| * SetTemperatureSetpointHoldPolicy | 0x0B | |------------------------------------------------------------------------------| | Attributes: | | | * LocalTemperature | 0x0000 | @@ -9294,9 +9544,7 @@ class ServiceAreaSkipCurrentLocation : public ClusterCommand | * Presets | 0x0050 | | * Schedules | 0x0051 | | * PresetsSchedulesEditable | 0x0052 | -| * TemperatureSetpointHoldPolicy | 0x0053 | -| * SetpointHoldExpiryTimestamp | 0x0054 | -| * QueuedPreset | 0x0055 | +| * SetpointHoldExpiryTimestamp | 0x0053 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -9514,7 +9762,6 @@ class ThermostatSetActivePresetRequest : public ClusterCommand ClusterCommand("set-active-preset-request", credsIssuerConfig) { AddArgument("PresetHandle", &mRequest.presetHandle); - AddArgument("DelayMinutes", 0, UINT16_MAX, &mRequest.delayMinutes); ClusterCommand::AddArguments(); } @@ -9655,81 +9902,6 @@ class ThermostatCommitPresetsSchedulesRequest : public ClusterCommand chip::app::Clusters::Thermostat::Commands::CommitPresetsSchedulesRequest::Type mRequest; }; -/* - * Command CancelSetActivePresetRequest - */ -class ThermostatCancelSetActivePresetRequest : public ClusterCommand -{ -public: - ThermostatCancelSetActivePresetRequest(CredentialIssuerCommands * credsIssuerConfig) : - ClusterCommand("cancel-set-active-preset-request", credsIssuerConfig) - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::CancelSetActivePresetRequest::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::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::CancelSetActivePresetRequest::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::Thermostat::Commands::CancelSetActivePresetRequest::Type mRequest; -}; - -/* - * Command SetTemperatureSetpointHoldPolicy - */ -class ThermostatSetTemperatureSetpointHoldPolicy : public ClusterCommand -{ -public: - ThermostatSetTemperatureSetpointHoldPolicy(CredentialIssuerCommands * credsIssuerConfig) : - ClusterCommand("set-temperature-setpoint-hold-policy", credsIssuerConfig) - { - AddArgument("TemperatureSetpointHoldPolicy", 0, UINT8_MAX, &mRequest.temperatureSetpointHoldPolicy); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::SetTemperatureSetpointHoldPolicy::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::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::SetTemperatureSetpointHoldPolicy::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::Thermostat::Commands::SetTemperatureSetpointHoldPolicy::Type mRequest; -}; - /*----------------------------------------------------------------------------*\ | Cluster FanControl | 0x0202 | |------------------------------------------------------------------------------| @@ -11131,7 +11303,8 @@ class ColorControlStepColorTemperature : public ClusterCommand | * NetworkPassphraseRequest | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | -| * Ssid | 0x0001 | +| * Ssid | 0x0000 | +| * PassphraseSurrogate | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -11185,15 +11358,15 @@ class WiFiNetworkManagementNetworkPassphraseRequest : public ClusterCommand | Commands: | | | * GetActiveDatasetRequest | 0x00 | | * GetPendingDatasetRequest | 0x01 | -| * SetActiveDatasetRequest | 0x04 | -| * SetPendingDatasetRequest | 0x05 | +| * SetActiveDatasetRequest | 0x03 | +| * SetPendingDatasetRequest | 0x04 | |------------------------------------------------------------------------------| | Attributes: | | | * BorderRouterName | 0x0000 | | * BorderAgentID | 0x0001 | | * ThreadVersion | 0x0002 | | * InterfaceEnabled | 0x0003 | -| * ActiveDatasetTimestamp | 0x0005 | +| * ActiveDatasetTimestamp | 0x0004 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -11383,7 +11556,6 @@ class ThreadBorderRouterManagementSetPendingDatasetRequest : public ClusterComma | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | -| * NetworkChanged | 0x0000 | \*----------------------------------------------------------------------------*/ /* @@ -11433,7 +11605,7 @@ class ThreadNetworkDirectoryRemoveNetwork : public ClusterCommand ThreadNetworkDirectoryRemoveNetwork(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("remove-network", credsIssuerConfig) { - AddArgument("ExtendedPanID", 0, UINT64_MAX, &mRequest.extendedPanID); + AddArgument("ExtendedPanID", &mRequest.extendedPanID); ClusterCommand::AddArguments(); } @@ -11471,7 +11643,7 @@ class ThreadNetworkDirectoryGetOperationalDataset : public ClusterCommand ThreadNetworkDirectoryGetOperationalDataset(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("get-operational-dataset", credsIssuerConfig) { - AddArgument("ExtendedPanID", 0, UINT64_MAX, &mRequest.extendedPanID); + AddArgument("ExtendedPanID", &mRequest.extendedPanID); ClusterCommand::AddArguments(); } @@ -13621,15 +13793,136 @@ class ContentAppObserverContentAppMessage : public ClusterCommand ContentAppObserverContentAppMessage(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("content-app-message", credsIssuerConfig) { - AddArgument("Data", &mRequest.data); - AddArgument("EncodingHint", &mRequest.encodingHint); + AddArgument("Data", &mRequest.data); + AddArgument("EncodingHint", &mRequest.encodingHint); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentAppObserver::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ContentAppObserver::Commands::ContentAppMessage::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::ContentAppObserver::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::ContentAppObserver::Commands::ContentAppMessage::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::ContentAppObserver::Commands::ContentAppMessage::Type mRequest; +}; + +/*----------------------------------------------------------------------------*\ +| Cluster EcosystemInformation | 0x0750 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * RemovedOn | 0x0000 | +| * DeviceDirectory | 0x0001 | +| * LocationDirectory | 0x0002 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------*\ +| Cluster CommissionerControl | 0x0751 | +|------------------------------------------------------------------------------| +| Commands: | | +| * RequestCommissioningApproval | 0x00 | +| * CommissionNode | 0x01 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * SupportedDeviceCategories | 0x0000 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * CommissioningRequestResult | 0x0000 | +\*----------------------------------------------------------------------------*/ + +/* + * Command RequestCommissioningApproval + */ +class CommissionerControlRequestCommissioningApproval : public ClusterCommand +{ +public: + CommissionerControlRequestCommissioningApproval(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("request-commissioning-approval", credsIssuerConfig) + { + AddArgument("RequestId", 0, UINT64_MAX, &mRequest.requestId); + AddArgument("VendorId", 0, UINT16_MAX, &mRequest.vendorId); + AddArgument("ProductId", 0, UINT16_MAX, &mRequest.productId); + AddArgument("Label", &mRequest.label); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::CommissionerControl::Commands::RequestCommissioningApproval::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::CommissionerControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::CommissionerControl::Commands::RequestCommissioningApproval::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::CommissionerControl::Commands::RequestCommissioningApproval::Type mRequest; +}; + +/* + * Command CommissionNode + */ +class CommissionerControlCommissionNode : public ClusterCommand +{ +public: + CommissionerControlCommissionNode(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("commission-node", credsIssuerConfig) + { + AddArgument("RequestId", 0, UINT64_MAX, &mRequest.requestId); + AddArgument("ResponseTimeoutSeconds", 0, UINT16_MAX, &mRequest.responseTimeoutSeconds); + AddArgument("IpAddress", &mRequest.ipAddress); + AddArgument("Port", 0, UINT16_MAX, &mRequest.port); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override { - constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentAppObserver::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::ContentAppObserver::Commands::ContentAppMessage::Id; + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::CommissionerControl::Commands::CommissionNode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointIds.at(0)); @@ -13638,8 +13931,8 @@ class ContentAppObserverContentAppMessage : public ClusterCommand CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentAppObserver::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::ContentAppObserver::Commands::ContentAppMessage::Id; + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::CommissionerControl::Commands::CommissionNode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, groupId); @@ -13648,7 +13941,7 @@ class ContentAppObserverContentAppMessage : public ClusterCommand } private: - chip::app::Clusters::ContentAppObserver::Commands::ContentAppMessage::Type mRequest; + chip::app::Clusters::CommissionerControl::Commands::CommissionNode::Type mRequest; }; /*----------------------------------------------------------------------------*\ @@ -15894,7 +16187,8 @@ void registerClusterAccessControl(Commands & commands, CredentialIssuerCommands // // Commands // - make_unique(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // // // Attributes // @@ -15907,6 +16201,8 @@ void registerClusterAccessControl(Commands & commands, CredentialIssuerCommands credsIssuerConfig), // make_unique(Id, "access-control-entries-per-fabric", Attributes::AccessControlEntriesPerFabric::Id, credsIssuerConfig), // + make_unique(Id, "commissioning-arl", Attributes::CommissioningARL::Id, credsIssuerConfig), // + make_unique(Id, "arl", Attributes::Arl::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // @@ -15929,6 +16225,12 @@ void registerClusterAccessControl(Commands & commands, CredentialIssuerCommands make_unique>(Id, "access-control-entries-per-fabric", 0, UINT16_MAX, Attributes::AccessControlEntriesPerFabric::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "commissioning-arl", Attributes::CommissioningARL::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "arl", Attributes::Arl::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -15951,6 +16253,8 @@ void registerClusterAccessControl(Commands & commands, CredentialIssuerCommands credsIssuerConfig), // make_unique(Id, "access-control-entries-per-fabric", Attributes::AccessControlEntriesPerFabric::Id, credsIssuerConfig), // + make_unique(Id, "commissioning-arl", Attributes::CommissioningARL::Id, credsIssuerConfig), // + make_unique(Id, "arl", Attributes::Arl::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // @@ -15963,12 +16267,20 @@ void registerClusterAccessControl(Commands & commands, CredentialIssuerCommands make_unique(Id, credsIssuerConfig), // make_unique(Id, "access-control-entry-changed", Events::AccessControlEntryChanged::Id, credsIssuerConfig), // make_unique(Id, "access-control-extension-changed", Events::AccessControlExtensionChanged::Id, + credsIssuerConfig), // + make_unique(Id, "access-restriction-entry-changed", Events::AccessRestrictionEntryChanged::Id, + credsIssuerConfig), // + make_unique(Id, "fabric-restriction-review-update", Events::FabricRestrictionReviewUpdate::Id, credsIssuerConfig), // make_unique(Id, credsIssuerConfig), // make_unique(Id, "access-control-entry-changed", Events::AccessControlEntryChanged::Id, credsIssuerConfig), // make_unique(Id, "access-control-extension-changed", Events::AccessControlExtensionChanged::Id, credsIssuerConfig), // + make_unique(Id, "access-restriction-entry-changed", Events::AccessRestrictionEntryChanged::Id, + credsIssuerConfig), // + make_unique(Id, "fabric-restriction-review-update", Events::FabricRestrictionReviewUpdate::Id, + credsIssuerConfig), // }; commands.RegisterCluster(clusterName, clusterCommands); @@ -17890,7 +18202,8 @@ void registerClusterBridgedDeviceBasicInformation(Commands & commands, Credentia // // Commands // - make_unique(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // // // Attributes // @@ -17995,11 +18308,13 @@ void registerClusterBridgedDeviceBasicInformation(Commands & commands, Credentia make_unique(Id, "shut-down", Events::ShutDown::Id, credsIssuerConfig), // make_unique(Id, "leave", Events::Leave::Id, credsIssuerConfig), // make_unique(Id, "reachable-changed", Events::ReachableChanged::Id, credsIssuerConfig), // + make_unique(Id, "active-changed", Events::ActiveChanged::Id, credsIssuerConfig), // make_unique(Id, credsIssuerConfig), // make_unique(Id, "start-up", Events::StartUp::Id, credsIssuerConfig), // make_unique(Id, "shut-down", Events::ShutDown::Id, credsIssuerConfig), // make_unique(Id, "leave", Events::Leave::Id, credsIssuerConfig), // make_unique(Id, "reachable-changed", Events::ReachableChanged::Id, credsIssuerConfig), // + make_unique(Id, "active-changed", Events::ActiveChanged::Id, credsIssuerConfig), // }; commands.RegisterCluster(clusterName, clusterCommands); @@ -18660,15 +18975,16 @@ void registerClusterIcdManagement(Commands & commands, CredentialIssuerCommands make_unique(Id, "user-active-mode-trigger-hint", Attributes::UserActiveModeTriggerHint::Id, credsIssuerConfig), // make_unique(Id, "user-active-mode-trigger-instruction", Attributes::UserActiveModeTriggerInstruction::Id, - credsIssuerConfig), // - make_unique(Id, "operating-mode", Attributes::OperatingMode::Id, credsIssuerConfig), // - make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // - make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // - make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // - make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // - make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // - make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // - make_unique>(Id, credsIssuerConfig), // + credsIssuerConfig), // + make_unique(Id, "operating-mode", Attributes::OperatingMode::Id, credsIssuerConfig), // + make_unique(Id, "maximum-check-in-back-off", Attributes::MaximumCheckInBackOff::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + make_unique>(Id, credsIssuerConfig), // make_unique>(Id, "idle-mode-duration", 0, UINT32_MAX, Attributes::IdleModeDuration::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "active-mode-duration", 0, UINT32_MAX, Attributes::ActiveModeDuration::Id, @@ -18691,6 +19007,8 @@ void registerClusterIcdManagement(Commands & commands, CredentialIssuerCommands credsIssuerConfig), // make_unique>( Id, "operating-mode", 0, UINT8_MAX, Attributes::OperatingMode::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "maximum-check-in-back-off", 0, UINT32_MAX, Attributes::MaximumCheckInBackOff::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -18715,8 +19033,10 @@ void registerClusterIcdManagement(Commands & commands, CredentialIssuerCommands make_unique(Id, "user-active-mode-trigger-hint", Attributes::UserActiveModeTriggerHint::Id, credsIssuerConfig), // make_unique(Id, "user-active-mode-trigger-instruction", - Attributes::UserActiveModeTriggerInstruction::Id, credsIssuerConfig), // - make_unique(Id, "operating-mode", Attributes::OperatingMode::Id, credsIssuerConfig), // + Attributes::UserActiveModeTriggerInstruction::Id, credsIssuerConfig), // + make_unique(Id, "operating-mode", Attributes::OperatingMode::Id, credsIssuerConfig), // + make_unique(Id, "maximum-check-in-back-off", Attributes::MaximumCheckInBackOff::Id, + credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // @@ -20903,6 +21223,84 @@ void registerClusterElectricalEnergyMeasurement(Commands & commands, CredentialI commands.RegisterCluster(clusterName, clusterCommands); } +void registerClusterWaterHeaterManagement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + using namespace chip::app::Clusters::WaterHeaterManagement; + + const char * clusterName = "WaterHeaterManagement"; + + commands_list clusterCommands = { + // + // Commands + // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + // + // Attributes + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "heater-types", Attributes::HeaterTypes::Id, credsIssuerConfig), // + make_unique(Id, "heat-demand", Attributes::HeatDemand::Id, credsIssuerConfig), // + make_unique(Id, "tank-volume", Attributes::TankVolume::Id, credsIssuerConfig), // + make_unique(Id, "estimated-heat-required", Attributes::EstimatedHeatRequired::Id, credsIssuerConfig), // + make_unique(Id, "tank-percentage", Attributes::TankPercentage::Id, credsIssuerConfig), // + make_unique(Id, "boost-state", Attributes::BoostState::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + make_unique>(Id, credsIssuerConfig), // + make_unique>>( + Id, "heater-types", 0, UINT8_MAX, Attributes::HeaterTypes::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "heat-demand", 0, UINT8_MAX, Attributes::HeatDemand::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "tank-volume", 0, UINT16_MAX, Attributes::TankVolume::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "estimated-heat-required", INT64_MIN, INT64_MAX, + Attributes::EstimatedHeatRequired::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>(Id, "tank-percentage", 0, UINT8_MAX, Attributes::TankPercentage::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>( + Id, "boost-state", 0, UINT8_MAX, Attributes::BoostState::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>( + Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "event-list", Attributes::EventList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "attribute-list", Attributes::AttributeList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "feature-map", 0, UINT32_MAX, Attributes::FeatureMap::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "cluster-revision", 0, UINT16_MAX, Attributes::ClusterRevision::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "heater-types", Attributes::HeaterTypes::Id, credsIssuerConfig), // + make_unique(Id, "heat-demand", Attributes::HeatDemand::Id, credsIssuerConfig), // + make_unique(Id, "tank-volume", Attributes::TankVolume::Id, credsIssuerConfig), // + make_unique(Id, "estimated-heat-required", Attributes::EstimatedHeatRequired::Id, credsIssuerConfig), // + make_unique(Id, "tank-percentage", Attributes::TankPercentage::Id, credsIssuerConfig), // + make_unique(Id, "boost-state", Attributes::BoostState::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + // + // Events + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + }; + + commands.RegisterCluster(clusterName, clusterCommands); +} void registerClusterDemandResponseLoadControl(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { using namespace chip::app::Clusters::DemandResponseLoadControl; @@ -21573,6 +21971,75 @@ void registerClusterEnergyEvseMode(Commands & commands, CredentialIssuerCommands commands.RegisterCluster(clusterName, clusterCommands); } +void registerClusterWaterHeaterMode(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + using namespace chip::app::Clusters::WaterHeaterMode; + + const char * clusterName = "WaterHeaterMode"; + + commands_list clusterCommands = { + // + // Commands + // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // + // + // Attributes + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "supported-modes", Attributes::SupportedModes::Id, credsIssuerConfig), // + make_unique(Id, "current-mode", Attributes::CurrentMode::Id, credsIssuerConfig), // + make_unique(Id, "start-up-mode", Attributes::StartUpMode::Id, credsIssuerConfig), // + make_unique(Id, "on-mode", Attributes::OnMode::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + make_unique>(Id, credsIssuerConfig), // + make_unique>>( + Id, "supported-modes", Attributes::SupportedModes::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "current-mode", 0, UINT8_MAX, Attributes::CurrentMode::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "start-up-mode", 0, UINT8_MAX, Attributes::StartUpMode::Id, WriteCommandType::kWrite, credsIssuerConfig), // + make_unique>>(Id, "on-mode", 0, UINT8_MAX, Attributes::OnMode::Id, + WriteCommandType::kWrite, credsIssuerConfig), // + make_unique>>( + Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>( + Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "event-list", Attributes::EventList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "attribute-list", Attributes::AttributeList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "feature-map", 0, UINT32_MAX, Attributes::FeatureMap::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "cluster-revision", 0, UINT16_MAX, Attributes::ClusterRevision::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "supported-modes", Attributes::SupportedModes::Id, credsIssuerConfig), // + make_unique(Id, "current-mode", Attributes::CurrentMode::Id, credsIssuerConfig), // + make_unique(Id, "start-up-mode", Attributes::StartUpMode::Id, credsIssuerConfig), // + make_unique(Id, "on-mode", Attributes::OnMode::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + // + // Events + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + }; + + commands.RegisterCluster(clusterName, clusterCommands); +} void registerClusterDeviceEnergyManagementMode(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { using namespace chip::app::Clusters::DeviceEnergyManagementMode; @@ -22551,8 +23018,6 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c make_unique(credsIssuerConfig), // make_unique(credsIssuerConfig), // make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // // // Attributes // @@ -22634,11 +23099,8 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c make_unique(Id, "schedules", Attributes::Schedules::Id, credsIssuerConfig), // make_unique(Id, "presets-schedules-editable", Attributes::PresetsSchedulesEditable::Id, credsIssuerConfig), // - make_unique(Id, "temperature-setpoint-hold-policy", Attributes::TemperatureSetpointHoldPolicy::Id, - credsIssuerConfig), // make_unique(Id, "setpoint-hold-expiry-timestamp", Attributes::SetpointHoldExpiryTimestamp::Id, credsIssuerConfig), // - make_unique(Id, "queued-preset", Attributes::QueuedPreset::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // @@ -22805,15 +23267,9 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c Id, "schedules", Attributes::Schedules::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "presets-schedules-editable", 0, 1, Attributes::PresetsSchedulesEditable::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>( - Id, "temperature-setpoint-hold-policy", 0, UINT8_MAX, Attributes::TemperatureSetpointHoldPolicy::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>(Id, "setpoint-hold-expiry-timestamp", 0, UINT32_MAX, Attributes::SetpointHoldExpiryTimestamp::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>( - Id, "queued-preset", Attributes::QueuedPreset::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -22909,11 +23365,8 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c make_unique(Id, "schedules", Attributes::Schedules::Id, credsIssuerConfig), // make_unique(Id, "presets-schedules-editable", Attributes::PresetsSchedulesEditable::Id, credsIssuerConfig), // - make_unique(Id, "temperature-setpoint-hold-policy", Attributes::TemperatureSetpointHoldPolicy::Id, - credsIssuerConfig), // make_unique(Id, "setpoint-hold-expiry-timestamp", Attributes::SetpointHoldExpiryTimestamp::Id, credsIssuerConfig), // - make_unique(Id, "queued-preset", Attributes::QueuedPreset::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // @@ -25136,6 +25589,7 @@ void registerClusterWiFiNetworkManagement(Commands & commands, CredentialIssuerC // make_unique(Id, credsIssuerConfig), // make_unique(Id, "ssid", Attributes::Ssid::Id, credsIssuerConfig), // + make_unique(Id, "passphrase-surrogate", Attributes::PassphraseSurrogate::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // @@ -25145,6 +25599,9 @@ void registerClusterWiFiNetworkManagement(Commands & commands, CredentialIssuerC make_unique>(Id, credsIssuerConfig), // make_unique>>( Id, "ssid", Attributes::Ssid::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>(Id, "passphrase-surrogate", 0, UINT64_MAX, + Attributes::PassphraseSurrogate::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -25160,6 +25617,7 @@ void registerClusterWiFiNetworkManagement(Commands & commands, CredentialIssuerC WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique(Id, credsIssuerConfig), // make_unique(Id, "ssid", Attributes::Ssid::Id, credsIssuerConfig), // + make_unique(Id, "passphrase-surrogate", Attributes::PassphraseSurrogate::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // @@ -25280,9 +25738,9 @@ void registerClusterThreadNetworkDirectory(Commands & commands, CredentialIssuer make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // make_unique>(Id, credsIssuerConfig), // - make_unique>>(Id, "preferred-extended-pan-id", 0, UINT64_MAX, - Attributes::PreferredExtendedPanID::Id, - WriteCommandType::kWrite, credsIssuerConfig), // + make_unique>>(Id, "preferred-extended-pan-id", + Attributes::PreferredExtendedPanID::Id, + WriteCommandType::kWrite, credsIssuerConfig), // make_unique>>( Id, "thread-networks", Attributes::ThreadNetworks::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -25316,10 +25774,8 @@ void registerClusterThreadNetworkDirectory(Commands & commands, CredentialIssuer // // Events // - make_unique(Id, credsIssuerConfig), // - make_unique(Id, "network-changed", Events::NetworkChanged::Id, credsIssuerConfig), // - make_unique(Id, credsIssuerConfig), // - make_unique(Id, "network-changed", Events::NetworkChanged::Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // }; commands.RegisterCluster(clusterName, clusterCommands); @@ -26289,6 +26745,134 @@ void registerClusterContentAppObserver(Commands & commands, CredentialIssuerComm commands.RegisterCluster(clusterName, clusterCommands); } +void registerClusterEcosystemInformation(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + using namespace chip::app::Clusters::EcosystemInformation; + + const char * clusterName = "EcosystemInformation"; + + commands_list clusterCommands = { + // + // Commands + // + make_unique(Id, credsIssuerConfig), // + // + // Attributes + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "removed-on", Attributes::RemovedOn::Id, credsIssuerConfig), // + make_unique(Id, "device-directory", Attributes::DeviceDirectory::Id, credsIssuerConfig), // + make_unique(Id, "location-directory", Attributes::LocationDirectory::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + make_unique>(Id, credsIssuerConfig), // + make_unique>>( + Id, "removed-on", 0, UINT64_MAX, Attributes::RemovedOn::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "device-directory", Attributes::DeviceDirectory::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "location-directory", Attributes::LocationDirectory::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>( + Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "event-list", Attributes::EventList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "attribute-list", Attributes::AttributeList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "feature-map", 0, UINT32_MAX, Attributes::FeatureMap::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "cluster-revision", 0, UINT16_MAX, Attributes::ClusterRevision::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "removed-on", Attributes::RemovedOn::Id, credsIssuerConfig), // + make_unique(Id, "device-directory", Attributes::DeviceDirectory::Id, credsIssuerConfig), // + make_unique(Id, "location-directory", Attributes::LocationDirectory::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + // + // Events + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + }; + + commands.RegisterCluster(clusterName, clusterCommands); +} +void registerClusterCommissionerControl(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + using namespace chip::app::Clusters::CommissionerControl; + + const char * clusterName = "CommissionerControl"; + + commands_list clusterCommands = { + // + // Commands + // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + // + // Attributes + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "supported-device-categories", Attributes::SupportedDeviceCategories::Id, + credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + make_unique>(Id, credsIssuerConfig), // + make_unique>>( + Id, "supported-device-categories", 0, UINT32_MAX, Attributes::SupportedDeviceCategories::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>( + Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "event-list", Attributes::EventList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "attribute-list", Attributes::AttributeList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "feature-map", 0, UINT32_MAX, Attributes::FeatureMap::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "cluster-revision", 0, UINT16_MAX, Attributes::ClusterRevision::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "supported-device-categories", Attributes::SupportedDeviceCategories::Id, + credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + // + // Events + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "commissioning-request-result", Events::CommissioningRequestResult::Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "commissioning-request-result", Events::CommissioningRequestResult::Id, + credsIssuerConfig), // + }; + + commands.RegisterCluster(clusterName, clusterCommands); +} void registerClusterElectricalMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { using namespace chip::app::Clusters::ElectricalMeasurement; @@ -27646,6 +28230,7 @@ void registerClusters(Commands & commands, CredentialIssuerCommands * credsIssue registerClusterValveConfigurationAndControl(commands, credsIssuerConfig); registerClusterElectricalPowerMeasurement(commands, credsIssuerConfig); registerClusterElectricalEnergyMeasurement(commands, credsIssuerConfig); + registerClusterWaterHeaterManagement(commands, credsIssuerConfig); registerClusterDemandResponseLoadControl(commands, credsIssuerConfig); registerClusterMessages(commands, credsIssuerConfig); registerClusterDeviceEnergyManagement(commands, credsIssuerConfig); @@ -27653,6 +28238,7 @@ void registerClusters(Commands & commands, CredentialIssuerCommands * credsIssue registerClusterEnergyPreference(commands, credsIssuerConfig); registerClusterPowerTopology(commands, credsIssuerConfig); registerClusterEnergyEvseMode(commands, credsIssuerConfig); + registerClusterWaterHeaterMode(commands, credsIssuerConfig); registerClusterDeviceEnergyManagementMode(commands, credsIssuerConfig); registerClusterDoorLock(commands, credsIssuerConfig); registerClusterWindowCovering(commands, credsIssuerConfig); @@ -27697,6 +28283,8 @@ void registerClusters(Commands & commands, CredentialIssuerCommands * credsIssue registerClusterAccountLogin(commands, credsIssuerConfig); registerClusterContentControl(commands, credsIssuerConfig); registerClusterContentAppObserver(commands, credsIssuerConfig); + registerClusterEcosystemInformation(commands, credsIssuerConfig); + registerClusterCommissionerControl(commands, credsIssuerConfig); registerClusterElectricalMeasurement(commands, credsIssuerConfig); registerClusterUnitTesting(commands, credsIssuerConfig); registerClusterFaultInjection(commands, credsIssuerConfig); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index c094853ab71712..3b958cf45af7ff 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -219,6 +219,76 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::Measu ComplexArgumentParser::Finalize(request.accuracyRanges); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::detail::Structs::LocationDescriptorStruct::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("LocationDescriptorStruct.locationName", "locationName", + value.isMember("locationName"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("LocationDescriptorStruct.floorNumber", "floorNumber", + value.isMember("floorNumber"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("LocationDescriptorStruct.areaType", "areaType", value.isMember("areaType"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "locationName"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.locationName, value["locationName"])); + valueCopy.removeMember("locationName"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "floorNumber"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.floorNumber, value["floorNumber"])); + valueCopy.removeMember("floorNumber"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "areaType"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.areaType, value["areaType"])); + valueCopy.removeMember("areaType"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::LocationDescriptorStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.locationName); + ComplexArgumentParser::Finalize(request.floorNumber); + ComplexArgumentParser::Finalize(request.areaType); +} + +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::detail::Structs::DeviceTypeStruct::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("DeviceTypeStruct.deviceType", "deviceType", value.isMember("deviceType"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("DeviceTypeStruct.revision", "revision", value.isMember("revision"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "deviceType"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.deviceType, value["deviceType"])); + valueCopy.removeMember("deviceType"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "revision"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.revision, value["revision"])); + valueCopy.removeMember("revision"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::DeviceTypeStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.deviceType); + ComplexArgumentParser::Finalize(request.revision); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::detail::Structs::ApplicationStruct::Type & request, Json::Value & value) { @@ -353,8 +423,7 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::Opera ComplexArgumentParser::Finalize(request.operationalStateLabel); } -CHIP_ERROR ComplexArgumentParser::Setup(const char * label, - chip::app::Clusters::Descriptor::Structs::DeviceTypeStruct::Type & request, +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::Globals::Structs::TestGlobalStruct::Type & request, Json::Value & value) { VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); @@ -362,27 +431,34 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, // Copy to track which members we already processed. Json::Value valueCopy(value); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("TestGlobalStruct.name", "name", value.isMember("name"))); ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("DeviceTypeStruct.deviceType", "deviceType", value.isMember("deviceType"))); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("DeviceTypeStruct.revision", "revision", value.isMember("revision"))); + ComplexArgumentParser::EnsureMemberExist("TestGlobalStruct.myBitmap", "myBitmap", value.isMember("myBitmap"))); char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "deviceType"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.deviceType, value["deviceType"])); - valueCopy.removeMember("deviceType"); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "name"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.name, value["name"])); + valueCopy.removeMember("name"); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "revision"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.revision, value["revision"])); - valueCopy.removeMember("revision"); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "myBitmap"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.myBitmap, value["myBitmap"])); + valueCopy.removeMember("myBitmap"); + + if (value.isMember("myEnum")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "myEnum"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.myEnum, value["myEnum"])); + } + valueCopy.removeMember("myEnum"); return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); } -void ComplexArgumentParser::Finalize(chip::app::Clusters::Descriptor::Structs::DeviceTypeStruct::Type & request) +void ComplexArgumentParser::Finalize(chip::app::Clusters::Globals::Structs::TestGlobalStruct::Type & request) { - ComplexArgumentParser::Finalize(request.deviceType); - ComplexArgumentParser::Finalize(request.revision); + ComplexArgumentParser::Finalize(request.name); + ComplexArgumentParser::Finalize(request.myBitmap); + ComplexArgumentParser::Finalize(request.myEnum); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, @@ -487,6 +563,124 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::Binding::Structs::Targ ComplexArgumentParser::Finalize(request.fabricIndex); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::AccessControl::Structs::AccessRestrictionStruct::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("AccessRestrictionStruct.type", "type", value.isMember("type"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AccessRestrictionStruct.id", "id", value.isMember("id"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "type"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.type, value["type"])); + valueCopy.removeMember("type"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "id"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.id, value["id"])); + valueCopy.removeMember("id"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::AccessControl::Structs::AccessRestrictionStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.type); + ComplexArgumentParser::Finalize(request.id); +} + +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::AccessControl::Structs::CommissioningAccessRestrictionEntryStruct::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("CommissioningAccessRestrictionEntryStruct.endpoint", "endpoint", + value.isMember("endpoint"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("CommissioningAccessRestrictionEntryStruct.cluster", "cluster", + value.isMember("cluster"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("CommissioningAccessRestrictionEntryStruct.restrictions", + "restrictions", value.isMember("restrictions"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endpoint"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endpoint, value["endpoint"])); + valueCopy.removeMember("endpoint"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "cluster"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.cluster, value["cluster"])); + valueCopy.removeMember("cluster"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "restrictions"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.restrictions, value["restrictions"])); + valueCopy.removeMember("restrictions"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::AccessControl::Structs::CommissioningAccessRestrictionEntryStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.endpoint); + ComplexArgumentParser::Finalize(request.cluster); + ComplexArgumentParser::Finalize(request.restrictions); +} + +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::AccessControl::Structs::AccessRestrictionEntryStruct::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("AccessRestrictionEntryStruct.endpoint", "endpoint", value.isMember("endpoint"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("AccessRestrictionEntryStruct.cluster", "cluster", value.isMember("cluster"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AccessRestrictionEntryStruct.restrictions", "restrictions", + value.isMember("restrictions"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endpoint"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endpoint, value["endpoint"])); + valueCopy.removeMember("endpoint"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "cluster"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.cluster, value["cluster"])); + valueCopy.removeMember("cluster"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "restrictions"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.restrictions, value["restrictions"])); + valueCopy.removeMember("restrictions"); + + if (value.isMember("fabricIndex")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + } + valueCopy.removeMember("fabricIndex"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::AccessControl::Structs::AccessRestrictionEntryStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.endpoint); + ComplexArgumentParser::Finalize(request.cluster); + ComplexArgumentParser::Finalize(request.restrictions); + ComplexArgumentParser::Finalize(request.fabricIndex); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::AccessControl::Structs::AccessControlTargetStruct::Type & request, Json::Value & value) @@ -2169,7 +2363,7 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::ModeSelect::Structs::M } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, - chip::app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type & request, + chip::app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type & request, Json::Value & value) { VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); @@ -2177,27 +2371,84 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, // Copy to track which members we already processed. Json::Value valueCopy(value); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("AttributeValuePair.attributeID", "attributeID", value.isMember("attributeID"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AttributeValuePair.attributeValue", "attributeValue", - value.isMember("attributeValue"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AttributeValuePairStruct.attributeID", "attributeID", + value.isMember("attributeID"))); char labelWithMember[kMaxLabelLength]; snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "attributeID"); ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.attributeID, value["attributeID"])); valueCopy.removeMember("attributeID"); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "attributeValue"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.attributeValue, value["attributeValue"])); - valueCopy.removeMember("attributeValue"); + if (value.isMember("valueUnsigned8")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "valueUnsigned8"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.valueUnsigned8, value["valueUnsigned8"])); + } + valueCopy.removeMember("valueUnsigned8"); + + if (value.isMember("valueSigned8")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "valueSigned8"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.valueSigned8, value["valueSigned8"])); + } + valueCopy.removeMember("valueSigned8"); + + if (value.isMember("valueUnsigned16")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "valueUnsigned16"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.valueUnsigned16, value["valueUnsigned16"])); + } + valueCopy.removeMember("valueUnsigned16"); + + if (value.isMember("valueSigned16")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "valueSigned16"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.valueSigned16, value["valueSigned16"])); + } + valueCopy.removeMember("valueSigned16"); + + if (value.isMember("valueUnsigned32")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "valueUnsigned32"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.valueUnsigned32, value["valueUnsigned32"])); + } + valueCopy.removeMember("valueUnsigned32"); + + if (value.isMember("valueSigned32")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "valueSigned32"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.valueSigned32, value["valueSigned32"])); + } + valueCopy.removeMember("valueSigned32"); + + if (value.isMember("valueUnsigned64")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "valueUnsigned64"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.valueUnsigned64, value["valueUnsigned64"])); + } + valueCopy.removeMember("valueUnsigned64"); + + if (value.isMember("valueSigned64")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "valueSigned64"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.valueSigned64, value["valueSigned64"])); + } + valueCopy.removeMember("valueSigned64"); return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); } -void ComplexArgumentParser::Finalize(chip::app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type & request) +void ComplexArgumentParser::Finalize(chip::app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type & request) { ComplexArgumentParser::Finalize(request.attributeID); - ComplexArgumentParser::Finalize(request.attributeValue); + ComplexArgumentParser::Finalize(request.valueUnsigned8); + ComplexArgumentParser::Finalize(request.valueSigned8); + ComplexArgumentParser::Finalize(request.valueUnsigned16); + ComplexArgumentParser::Finalize(request.valueSigned16); + ComplexArgumentParser::Finalize(request.valueUnsigned32); + ComplexArgumentParser::Finalize(request.valueSigned32); + ComplexArgumentParser::Finalize(request.valueUnsigned64); + ComplexArgumentParser::Finalize(request.valueSigned64); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, @@ -3691,45 +3942,6 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::DoorLock::Structs::Cre ComplexArgumentParser::Finalize(request.credentialIndex); } -CHIP_ERROR ComplexArgumentParser::Setup(const char * label, - chip::app::Clusters::ServiceArea::Structs::HomeLocationStruct::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("HomeLocationStruct.locationName", "locationName", - value.isMember("locationName"))); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("HomeLocationStruct.floorNumber", "floorNumber", value.isMember("floorNumber"))); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("HomeLocationStruct.areaType", "areaType", value.isMember("areaType"))); - - char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "locationName"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.locationName, value["locationName"])); - valueCopy.removeMember("locationName"); - - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "floorNumber"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.floorNumber, value["floorNumber"])); - valueCopy.removeMember("floorNumber"); - - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "areaType"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.areaType, value["areaType"])); - valueCopy.removeMember("areaType"); - - return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); -} - -void ComplexArgumentParser::Finalize(chip::app::Clusters::ServiceArea::Structs::HomeLocationStruct::Type & request) -{ - ComplexArgumentParser::Finalize(request.locationName); - ComplexArgumentParser::Finalize(request.floorNumber); - ComplexArgumentParser::Finalize(request.areaType); -} - CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::ServiceArea::Structs::LocationInfoStruct::Type & request, Json::Value & value) @@ -4118,38 +4330,6 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::Thermostat::Structs::P ComplexArgumentParser::Finalize(request.presetTypeFeatures); } -CHIP_ERROR ComplexArgumentParser::Setup(const char * label, - chip::app::Clusters::Thermostat::Structs::QueuedPresetStruct::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("QueuedPresetStruct.presetHandle", "presetHandle", - value.isMember("presetHandle"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("QueuedPresetStruct.transitionTimestamp", "transitionTimestamp", - value.isMember("transitionTimestamp"))); - - char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "presetHandle"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.presetHandle, value["presetHandle"])); - valueCopy.removeMember("presetHandle"); - - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "transitionTimestamp"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.transitionTimestamp, value["transitionTimestamp"])); - valueCopy.removeMember("transitionTimestamp"); - - return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); -} - -void ComplexArgumentParser::Finalize(chip::app::Clusters::Thermostat::Structs::QueuedPresetStruct::Type & request) -{ - ComplexArgumentParser::Finalize(request.presetHandle); - ComplexArgumentParser::Finalize(request.transitionTimestamp); -} - CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::Thermostat::Structs::ScheduleTypeStruct::Type & request, Json::Value & value) @@ -4283,6 +4463,8 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, ComplexArgumentParser::EnsureMemberExist("ThreadNetworkStruct.networkName", "networkName", value.isMember("networkName"))); ReturnErrorOnFailure( ComplexArgumentParser::EnsureMemberExist("ThreadNetworkStruct.channel", "channel", value.isMember("channel"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ThreadNetworkStruct.activeTimestamp", "activeTimestamp", + value.isMember("activeTimestamp"))); char labelWithMember[kMaxLabelLength]; snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "extendedPanID"); @@ -4297,6 +4479,10 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.channel, value["channel"])); valueCopy.removeMember("channel"); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "activeTimestamp"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.activeTimestamp, value["activeTimestamp"])); + valueCopy.removeMember("activeTimestamp"); + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); } @@ -4305,6 +4491,7 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::ThreadNetworkDirectory ComplexArgumentParser::Finalize(request.extendedPanID); ComplexArgumentParser::Finalize(request.networkName); ComplexArgumentParser::Finalize(request.channel); + ComplexArgumentParser::Finalize(request.activeTimestamp); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, @@ -5373,6 +5560,135 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::ContentControl::Struct ComplexArgumentParser::Finalize(request.ratingNameDesc); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::EcosystemInformation::Structs::EcosystemLocationStruct::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("EcosystemLocationStruct.uniqueLocationID", "uniqueLocationID", + value.isMember("uniqueLocationID"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("EcosystemLocationStruct.locationDescriptor", + "locationDescriptor", value.isMember("locationDescriptor"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("EcosystemLocationStruct.locationDescriptorLastEdit", + "locationDescriptorLastEdit", + value.isMember("locationDescriptorLastEdit"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "uniqueLocationID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.uniqueLocationID, value["uniqueLocationID"])); + valueCopy.removeMember("uniqueLocationID"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "locationDescriptor"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.locationDescriptor, value["locationDescriptor"])); + valueCopy.removeMember("locationDescriptor"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "locationDescriptorLastEdit"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.locationDescriptorLastEdit, value["locationDescriptorLastEdit"])); + valueCopy.removeMember("locationDescriptorLastEdit"); + + if (value.isMember("fabricIndex")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + } + valueCopy.removeMember("fabricIndex"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::EcosystemInformation::Structs::EcosystemLocationStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.uniqueLocationID); + ComplexArgumentParser::Finalize(request.locationDescriptor); + ComplexArgumentParser::Finalize(request.locationDescriptorLastEdit); + ComplexArgumentParser::Finalize(request.fabricIndex); +} + +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::EcosystemInformation::Structs::EcosystemDeviceStruct::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("EcosystemDeviceStruct.bridgedEndpoint", "bridgedEndpoint", + value.isMember("bridgedEndpoint"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("EcosystemDeviceStruct.originalEndpoint", "originalEndpoint", + value.isMember("originalEndpoint"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("EcosystemDeviceStruct.deviceTypes", "deviceTypes", + value.isMember("deviceTypes"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("EcosystemDeviceStruct.uniqueLocationIDs", "uniqueLocationIDs", + value.isMember("uniqueLocationIDs"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("EcosystemDeviceStruct.uniqueLocationIDsLastEdit", + "uniqueLocationIDsLastEdit", + value.isMember("uniqueLocationIDsLastEdit"))); + + char labelWithMember[kMaxLabelLength]; + if (value.isMember("deviceName")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "deviceName"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.deviceName, value["deviceName"])); + } + valueCopy.removeMember("deviceName"); + + if (value.isMember("deviceNameLastEdit")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "deviceNameLastEdit"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.deviceNameLastEdit, value["deviceNameLastEdit"])); + } + valueCopy.removeMember("deviceNameLastEdit"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "bridgedEndpoint"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.bridgedEndpoint, value["bridgedEndpoint"])); + valueCopy.removeMember("bridgedEndpoint"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "originalEndpoint"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.originalEndpoint, value["originalEndpoint"])); + valueCopy.removeMember("originalEndpoint"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "deviceTypes"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.deviceTypes, value["deviceTypes"])); + valueCopy.removeMember("deviceTypes"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "uniqueLocationIDs"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.uniqueLocationIDs, value["uniqueLocationIDs"])); + valueCopy.removeMember("uniqueLocationIDs"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "uniqueLocationIDsLastEdit"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.uniqueLocationIDsLastEdit, value["uniqueLocationIDsLastEdit"])); + valueCopy.removeMember("uniqueLocationIDsLastEdit"); + + if (value.isMember("fabricIndex")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + } + valueCopy.removeMember("fabricIndex"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::EcosystemInformation::Structs::EcosystemDeviceStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.deviceName); + ComplexArgumentParser::Finalize(request.deviceNameLastEdit); + ComplexArgumentParser::Finalize(request.bridgedEndpoint); + ComplexArgumentParser::Finalize(request.originalEndpoint); + ComplexArgumentParser::Finalize(request.deviceTypes); + ComplexArgumentParser::Finalize(request.uniqueLocationIDs); + ComplexArgumentParser::Finalize(request.uniqueLocationIDsLastEdit); + ComplexArgumentParser::Finalize(request.fabricIndex); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::UnitTesting::Structs::SimpleStruct::Type & request, Json::Value & value) { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index f2893064ebafe0..47683b1ab87888 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -42,6 +42,16 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs static void Finalize(chip::app::Clusters::detail::Structs::MeasurementAccuracyStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::LocationDescriptorStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::detail::Structs::LocationDescriptorStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::DeviceTypeStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::detail::Structs::DeviceTypeStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::ApplicationStruct::Type & request, Json::Value & value); @@ -61,10 +71,10 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs static void Finalize(chip::app::Clusters::detail::Structs::OperationalStateStruct::Type & request); -static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Descriptor::Structs::DeviceTypeStruct::Type & request, +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Globals::Structs::TestGlobalStruct::Type & request, Json::Value & value); -static void Finalize(chip::app::Clusters::Descriptor::Structs::DeviceTypeStruct::Type & request); +static void Finalize(chip::app::Clusters::Globals::Structs::TestGlobalStruct::Type & request); static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Descriptor::Structs::SemanticTagStruct::Type & request, Json::Value & value); @@ -76,6 +86,23 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Binding::Struct static void Finalize(chip::app::Clusters::Binding::Structs::TargetStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::AccessControl::Structs::AccessRestrictionStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::AccessControl::Structs::AccessRestrictionStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::AccessControl::Structs::CommissioningAccessRestrictionEntryStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::AccessControl::Structs::CommissioningAccessRestrictionEntryStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::AccessControl::Structs::AccessRestrictionEntryStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::AccessControl::Structs::AccessRestrictionEntryStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::AccessControl::Structs::AccessControlTargetStruct::Type & request, Json::Value & value); @@ -259,10 +286,11 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ModeSelect::Str static void Finalize(chip::app::Clusters::ModeSelect::Structs::ModeOptionStruct::Type & request); -static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type & request, +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type & request, Json::Value & value); -static void Finalize(chip::app::Clusters::ScenesManagement::Structs::AttributeValuePair::Type & request); +static void Finalize(chip::app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::Type & request); static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type & request, Json::Value & value); @@ -425,11 +453,6 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::DoorLock::Struc static void Finalize(chip::app::Clusters::DoorLock::Structs::CredentialStruct::Type & request); -static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ServiceArea::Structs::HomeLocationStruct::Type & request, - Json::Value & value); - -static void Finalize(chip::app::Clusters::ServiceArea::Structs::HomeLocationStruct::Type & request); - static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ServiceArea::Structs::LocationInfoStruct::Type & request, Json::Value & value); @@ -470,11 +493,6 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Thermostat::Str static void Finalize(chip::app::Clusters::Thermostat::Structs::PresetTypeStruct::Type & request); -static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Thermostat::Structs::QueuedPresetStruct::Type & request, - Json::Value & value); - -static void Finalize(chip::app::Clusters::Thermostat::Structs::QueuedPresetStruct::Type & request); - static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Thermostat::Structs::ScheduleTypeStruct::Type & request, Json::Value & value); @@ -624,6 +642,18 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ContentControl: static void Finalize(chip::app::Clusters::ContentControl::Structs::RatingNameStruct::Type & request); +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::EcosystemInformation::Structs::EcosystemLocationStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::EcosystemInformation::Structs::EcosystemLocationStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::EcosystemInformation::Structs::EcosystemDeviceStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::EcosystemInformation::Structs::EcosystemDeviceStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::UnitTesting::Structs::SimpleStruct::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index d61ba121300baa..6cab73f83024a4 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -202,6 +202,64 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::detail::Structs::LocationDescriptorStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("LocationName", indent + 1, value.locationName); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'LocationName'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("FloorNumber", indent + 1, value.floorNumber); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FloorNumber'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("AreaType", indent + 1, value.areaType); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'AreaType'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::detail::Structs::DeviceTypeStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("DeviceType", indent + 1, value.deviceType); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DeviceType'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Revision", indent + 1, value.revision); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Revision'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::ApplicationStruct::DecodableType & value) { @@ -311,22 +369,30 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, } CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const chip::app::Clusters::Descriptor::Structs::DeviceTypeStruct::DecodableType & value) + const chip::app::Clusters::Globals::Structs::TestGlobalStruct::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); { - CHIP_ERROR err = LogValue("DeviceType", indent + 1, value.deviceType); + CHIP_ERROR err = LogValue("Name", indent + 1, value.name); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DeviceType'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Name'"); return err; } } { - CHIP_ERROR err = LogValue("Revision", indent + 1, value.revision); + CHIP_ERROR err = LogValue("MyBitmap", indent + 1, value.myBitmap); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Revision'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MyBitmap'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("MyEnum", indent + 1, value.myEnum); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MyEnum'"); return err; } } @@ -425,6 +491,108 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR +DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::AccessControl::Structs::AccessRestrictionStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Type", indent + 1, value.type); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Type'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Id", indent + 1, value.id); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Id'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::AccessControl::Structs::CommissioningAccessRestrictionEntryStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Endpoint", indent + 1, value.endpoint); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Endpoint'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Cluster", indent + 1, value.cluster); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Cluster'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Restrictions", indent + 1, value.restrictions); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Restrictions'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR +DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::AccessControl::Structs::AccessRestrictionEntryStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Endpoint", indent + 1, value.endpoint); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Endpoint'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Cluster", indent + 1, value.cluster); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Cluster'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Restrictions", indent + 1, value.restrictions); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Restrictions'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::AccessControl::Structs::AccessControlTargetStruct::DecodableType & value) @@ -1959,7 +2127,7 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const chip::app::Clusters::ScenesManagement::Structs::AttributeValuePair::DecodableType & value) + const chip::app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); { @@ -1971,10 +2139,66 @@ DataModelLogger::LogValue(const char * label, size_t indent, } } { - CHIP_ERROR err = LogValue("AttributeValue", indent + 1, value.attributeValue); + CHIP_ERROR err = LogValue("ValueUnsigned8", indent + 1, value.valueUnsigned8); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValueUnsigned8'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValueSigned8", indent + 1, value.valueSigned8); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValueSigned8'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValueUnsigned16", indent + 1, value.valueUnsigned16); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'AttributeValue'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValueUnsigned16'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValueSigned16", indent + 1, value.valueSigned16); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValueSigned16'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValueUnsigned32", indent + 1, value.valueUnsigned32); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValueUnsigned32'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValueSigned32", indent + 1, value.valueSigned32); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValueSigned32'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValueUnsigned64", indent + 1, value.valueUnsigned64); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValueUnsigned64'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ValueSigned64", indent + 1, value.valueSigned64); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ValueSigned64'"); return err; } } @@ -3265,39 +3489,6 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } -CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const chip::app::Clusters::ServiceArea::Structs::HomeLocationStruct::DecodableType & value) -{ - DataModelLogger::LogString(label, indent, "{"); - { - CHIP_ERROR err = LogValue("LocationName", indent + 1, value.locationName); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'LocationName'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("FloorNumber", indent + 1, value.floorNumber); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FloorNumber'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("AreaType", indent + 1, value.areaType); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'AreaType'"); - return err; - } - } - DataModelLogger::LogString(indent, "}"); - - return CHIP_NO_ERROR; -} - CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::ServiceArea::Structs::LocationInfoStruct::DecodableType & value) { @@ -3643,31 +3834,6 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } -CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const chip::app::Clusters::Thermostat::Structs::QueuedPresetStruct::DecodableType & value) -{ - DataModelLogger::LogString(label, indent, "{"); - { - CHIP_ERROR err = LogValue("PresetHandle", indent + 1, value.presetHandle); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PresetHandle'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("TransitionTimestamp", indent + 1, value.transitionTimestamp); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'TransitionTimestamp'"); - return err; - } - } - DataModelLogger::LogString(indent, "}"); - - return CHIP_NO_ERROR; -} - CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::Thermostat::Structs::ScheduleTypeStruct::DecodableType & value) { @@ -3798,6 +3964,14 @@ DataModelLogger::LogValue(const char * label, size_t indent, return err; } } + { + CHIP_ERROR err = LogValue("ActiveTimestamp", indent + 1, value.activeTimestamp); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ActiveTimestamp'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; @@ -4725,6 +4899,122 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR +DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::EcosystemInformation::Structs::EcosystemLocationStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("UniqueLocationID", indent + 1, value.uniqueLocationID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'UniqueLocationID'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("LocationDescriptor", indent + 1, value.locationDescriptor); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'LocationDescriptor'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("LocationDescriptorLastEdit", indent + 1, value.locationDescriptorLastEdit); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'LocationDescriptorLastEdit'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR +DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::EcosystemInformation::Structs::EcosystemDeviceStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("DeviceName", indent + 1, value.deviceName); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DeviceName'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("DeviceNameLastEdit", indent + 1, value.deviceNameLastEdit); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DeviceNameLastEdit'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("BridgedEndpoint", indent + 1, value.bridgedEndpoint); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'BridgedEndpoint'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("OriginalEndpoint", indent + 1, value.originalEndpoint); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'OriginalEndpoint'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("DeviceTypes", indent + 1, value.deviceTypes); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DeviceTypes'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("UniqueLocationIDs", indent + 1, value.uniqueLocationIDs); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'UniqueLocationIDs'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("UniqueLocationIDsLastEdit", indent + 1, value.uniqueLocationIDsLastEdit); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'UniqueLocationIDsLastEdit'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::UnitTesting::Structs::SimpleStruct::DecodableType & value) { @@ -5214,6 +5504,62 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const AccessControl::Events::AccessRestrictionEntryChanged::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("FabricIndex", indent + 1, value.fabricIndex); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'FabricIndex'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const AccessControl::Events::FabricRestrictionReviewUpdate::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("Token", indent + 1, value.token); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'Token'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("Instruction", indent + 1, value.instruction); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'Instruction'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("RedirectURL", indent + 1, value.redirectURL); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'RedirectURL'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("FabricIndex", indent + 1, value.fabricIndex); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'FabricIndex'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const Actions::Events::StateChanged::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); @@ -5844,6 +6190,22 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const BridgedDeviceBasicInformation::Events::ActiveChanged::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("PromisedActiveDuration", indent + 1, value.promisedActiveDuration); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'PromisedActiveDuration'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const Switch::Events::SwitchLatched::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); @@ -6794,6 +7156,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return err; } } + { + CHIP_ERROR err = DataModelLogger::LogValue("MaximumDischargeCurrent", indent + 1, value.maximumDischargeCurrent); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'MaximumDischargeCurrent'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; @@ -6834,6 +7204,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return err; } } + { + CHIP_ERROR err = DataModelLogger::LogValue("EnergyDischarged", indent + 1, value.energyDischarged); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'EnergyDischarged'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; @@ -7244,22 +7622,6 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } -CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const ThreadNetworkDirectory::Events::NetworkChanged::DecodableType & value) -{ - DataModelLogger::LogString(label, indent, "{"); - { - CHIP_ERROR err = DataModelLogger::LogValue("ExtendedPanID", indent + 1, value.extendedPanID); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'ExtendedPanID'"); - return err; - } - } - DataModelLogger::LogString(indent, "}"); - - return CHIP_NO_ERROR; -} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const TargetNavigator::Events::TargetUpdated::DecodableType & value) { @@ -7377,10 +7739,58 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, { DataModelLogger::LogString(label, indent, "{"); { - CHIP_ERROR err = DataModelLogger::LogValue("Node", indent + 1, value.node); + CHIP_ERROR err = DataModelLogger::LogValue("Node", indent + 1, value.node); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'Node'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const ContentControl::Events::RemainingScreenTimeExpired::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const CommissionerControl::Events::CommissioningRequestResult::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("RequestId", indent + 1, value.requestId); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'RequestId'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("ClientNodeId", indent + 1, value.clientNodeId); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'ClientNodeId'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("StatusCode", indent + 1, value.statusCode); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'StatusCode'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("FabricIndex", indent + 1, value.fabricIndex); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'Node'"); + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'FabricIndex'"); return err; } } @@ -7388,14 +7798,6 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } -CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, - const ContentControl::Events::RemainingScreenTimeExpired::DecodableType & value) -{ - DataModelLogger::LogString(label, indent, "{"); - DataModelLogger::LogString(indent, "}"); - - return CHIP_NO_ERROR; -} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const UnitTesting::Events::TestEvent::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); @@ -7545,6 +7947,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const AccessControl::Commands::ReviewFabricRestrictionsResponse::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + ReturnErrorOnFailure(DataModelLogger::LogValue("token", indent + 1, value.token)); + DataModelLogger::LogString(indent, "}"); + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const OtaSoftwareUpdateProvider::Commands::QueryImageResponse::DecodableType & value) { @@ -7911,6 +8321,15 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const WaterHeaterMode::Commands::ChangeToModeResponse::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + ReturnErrorOnFailure(DataModelLogger::LogValue("status", indent + 1, value.status)); + ReturnErrorOnFailure(DataModelLogger::LogValue("statusText", indent + 1, value.statusText)); + DataModelLogger::LogString(indent, "}"); + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const DeviceEnergyManagementMode::Commands::ChangeToModeResponse::DecodableType & value) { @@ -8140,6 +8559,18 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const CommissionerControl::Commands::ReverseOpenCommissioningWindow::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + ReturnErrorOnFailure(DataModelLogger::LogValue("commissioningTimeout", indent + 1, value.commissioningTimeout)); + ReturnErrorOnFailure(DataModelLogger::LogValue("PAKEPasscodeVerifier", indent + 1, value.PAKEPasscodeVerifier)); + ReturnErrorOnFailure(DataModelLogger::LogValue("discriminator", indent + 1, value.discriminator)); + ReturnErrorOnFailure(DataModelLogger::LogValue("iterations", indent + 1, value.iterations)); + ReturnErrorOnFailure(DataModelLogger::LogValue("salt", indent + 1, value.salt)); + DataModelLogger::LogString(indent, "}"); + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const ElectricalMeasurement::Commands::GetProfileInfoResponseCommand::DecodableType & value) { @@ -8896,6 +9327,20 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("AccessControlEntriesPerFabric", 1, value); } + case AccessControl::Attributes::CommissioningARL::Id: { + chip::app::DataModel::DecodableList< + chip::app::Clusters::AccessControl::Structs::CommissioningAccessRestrictionEntryStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("CommissioningARL", 1, value); + } + case AccessControl::Attributes::Arl::Id: { + chip::app::DataModel::DecodableList< + chip::app::Clusters::AccessControl::Structs::AccessRestrictionEntryStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ARL", 1, value); + } case AccessControl::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); @@ -11201,6 +11646,11 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("OperatingMode", 1, value); } + case IcdManagement::Attributes::MaximumCheckInBackOff::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("MaximumCheckInBackOff", 1, value); + } case IcdManagement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); @@ -12990,6 +13440,72 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP } break; } + case WaterHeaterManagement::Id: { + switch (path.mAttributeId) + { + case WaterHeaterManagement::Attributes::HeaterTypes::Id: { + chip::BitMask value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("HeaterTypes", 1, value); + } + case WaterHeaterManagement::Attributes::HeatDemand::Id: { + chip::BitMask value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("HeatDemand", 1, value); + } + case WaterHeaterManagement::Attributes::TankVolume::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("TankVolume", 1, value); + } + case WaterHeaterManagement::Attributes::EstimatedHeatRequired::Id: { + int64_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("EstimatedHeatRequired", 1, value); + } + case WaterHeaterManagement::Attributes::TankPercentage::Id: { + chip::Percent value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("TankPercentage", 1, value); + } + case WaterHeaterManagement::Attributes::BoostState::Id: { + chip::app::Clusters::WaterHeaterManagement::BoostStateEnum value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("BoostState", 1, value); + } + case WaterHeaterManagement::Attributes::GeneratedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + } + case WaterHeaterManagement::Attributes::AcceptedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + } + case WaterHeaterManagement::Attributes::EventList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("EventList", 1, value); + } + case WaterHeaterManagement::Attributes::AttributeList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AttributeList", 1, value); + } + case WaterHeaterManagement::Attributes::FeatureMap::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("FeatureMap", 1, value); + } + case WaterHeaterManagement::Attributes::ClusterRevision::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ClusterRevision", 1, value); + } + } + break; + } case DemandResponseLoadControl::Id: { switch (path.mAttributeId) { @@ -13512,6 +14028,63 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP } break; } + case WaterHeaterMode::Id: { + switch (path.mAttributeId) + { + case WaterHeaterMode::Attributes::SupportedModes::Id: { + chip::app::DataModel::DecodableList + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("SupportedModes", 1, value); + } + case WaterHeaterMode::Attributes::CurrentMode::Id: { + uint8_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("CurrentMode", 1, value); + } + case WaterHeaterMode::Attributes::StartUpMode::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("StartUpMode", 1, value); + } + case WaterHeaterMode::Attributes::OnMode::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("OnMode", 1, value); + } + case WaterHeaterMode::Attributes::GeneratedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + } + case WaterHeaterMode::Attributes::AcceptedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + } + case WaterHeaterMode::Attributes::EventList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("EventList", 1, value); + } + case WaterHeaterMode::Attributes::AttributeList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AttributeList", 1, value); + } + case WaterHeaterMode::Attributes::FeatureMap::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("FeatureMap", 1, value); + } + case WaterHeaterMode::Attributes::ClusterRevision::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ClusterRevision", 1, value); + } + } + break; + } case DeviceEnergyManagementMode::Id: { switch (path.mAttributeId) { @@ -14587,21 +15160,11 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("PresetsSchedulesEditable", 1, value); } - case Thermostat::Attributes::TemperatureSetpointHoldPolicy::Id: { - chip::BitMask value; - ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("TemperatureSetpointHoldPolicy", 1, value); - } case Thermostat::Attributes::SetpointHoldExpiryTimestamp::Id: { chip::app::DataModel::Nullable value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("SetpointHoldExpiryTimestamp", 1, value); } - case Thermostat::Attributes::QueuedPreset::Id: { - chip::app::DataModel::Nullable value; - ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("QueuedPreset", 1, value); - } case Thermostat::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); @@ -16518,6 +17081,11 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("SSID", 1, value); } + case WiFiNetworkManagement::Attributes::PassphraseSurrogate::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("PassphraseSurrogate", 1, value); + } case WiFiNetworkManagement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); @@ -16616,7 +17184,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP switch (path.mAttributeId) { case ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::Id: { - chip::app::DataModel::Nullable value; + chip::app::DataModel::Nullable value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("PreferredExtendedPanID", 1, value); } @@ -17388,6 +17956,102 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP } break; } + case EcosystemInformation::Id: { + switch (path.mAttributeId) + { + case EcosystemInformation::Attributes::RemovedOn::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("RemovedOn", 1, value); + } + case EcosystemInformation::Attributes::DeviceDirectory::Id: { + chip::app::DataModel::DecodableList< + chip::app::Clusters::EcosystemInformation::Structs::EcosystemDeviceStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("DeviceDirectory", 1, value); + } + case EcosystemInformation::Attributes::LocationDirectory::Id: { + chip::app::DataModel::DecodableList< + chip::app::Clusters::EcosystemInformation::Structs::EcosystemLocationStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("LocationDirectory", 1, value); + } + case EcosystemInformation::Attributes::GeneratedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + } + case EcosystemInformation::Attributes::AcceptedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + } + case EcosystemInformation::Attributes::EventList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("EventList", 1, value); + } + case EcosystemInformation::Attributes::AttributeList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AttributeList", 1, value); + } + case EcosystemInformation::Attributes::FeatureMap::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("FeatureMap", 1, value); + } + case EcosystemInformation::Attributes::ClusterRevision::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ClusterRevision", 1, value); + } + } + break; + } + case CommissionerControl::Id: { + switch (path.mAttributeId) + { + case CommissionerControl::Attributes::SupportedDeviceCategories::Id: { + chip::BitMask value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("SupportedDeviceCategories", 1, value); + } + case CommissionerControl::Attributes::GeneratedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + } + case CommissionerControl::Attributes::AcceptedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + } + case CommissionerControl::Attributes::EventList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("EventList", 1, value); + } + case CommissionerControl::Attributes::AttributeList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AttributeList", 1, value); + } + case CommissionerControl::Attributes::FeatureMap::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("FeatureMap", 1, value); + } + case CommissionerControl::Attributes::ClusterRevision::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ClusterRevision", 1, value); + } + } + break; + } case ElectricalMeasurement::Id: { switch (path.mAttributeId) { @@ -18635,6 +19299,17 @@ CHIP_ERROR DataModelLogger::LogCommand(const chip::app::ConcreteCommandPath & pa } break; } + case AccessControl::Id: { + switch (path.mCommandId) + { + case AccessControl::Commands::ReviewFabricRestrictionsResponse::Id: { + AccessControl::Commands::ReviewFabricRestrictionsResponse::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ReviewFabricRestrictionsResponse", 1, value); + } + } + break; + } case OtaSoftwareUpdateProvider::Id: { switch (path.mCommandId) { @@ -18956,6 +19631,17 @@ CHIP_ERROR DataModelLogger::LogCommand(const chip::app::ConcreteCommandPath & pa } break; } + case WaterHeaterMode::Id: { + switch (path.mCommandId) + { + case WaterHeaterMode::Commands::ChangeToModeResponse::Id: { + WaterHeaterMode::Commands::ChangeToModeResponse::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ChangeToModeResponse", 1, value); + } + } + break; + } case DeviceEnergyManagementMode::Id: { switch (path.mCommandId) { @@ -19167,6 +19853,17 @@ CHIP_ERROR DataModelLogger::LogCommand(const chip::app::ConcreteCommandPath & pa } break; } + case CommissionerControl::Id: { + switch (path.mCommandId) + { + case CommissionerControl::Commands::ReverseOpenCommissioningWindow::Id: { + CommissionerControl::Commands::ReverseOpenCommissioningWindow::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ReverseOpenCommissioningWindow", 1, value); + } + } + break; + } case ElectricalMeasurement::Id: { switch (path.mCommandId) { @@ -19323,6 +20020,16 @@ CHIP_ERROR DataModelLogger::LogEvent(const chip::app::EventHeader & header, chip ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("AccessControlExtensionChanged", 1, value); } + case AccessControl::Events::AccessRestrictionEntryChanged::Id: { + chip::app::Clusters::AccessControl::Events::AccessRestrictionEntryChanged::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AccessRestrictionEntryChanged", 1, value); + } + case AccessControl::Events::FabricRestrictionReviewUpdate::Id: { + chip::app::Clusters::AccessControl::Events::FabricRestrictionReviewUpdate::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("FabricRestrictionReviewUpdate", 1, value); + } } break; } @@ -19538,6 +20245,11 @@ CHIP_ERROR DataModelLogger::LogEvent(const chip::app::EventHeader & header, chip ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("ReachableChanged", 1, value); } + case BridgedDeviceBasicInformation::Events::ActiveChanged::Id: { + chip::app::Clusters::BridgedDeviceBasicInformation::Events::ActiveChanged::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ActiveChanged", 1, value); + } } break; } @@ -19999,17 +20711,6 @@ CHIP_ERROR DataModelLogger::LogEvent(const chip::app::EventHeader & header, chip } break; } - case ThreadNetworkDirectory::Id: { - switch (header.mPath.mEventId) - { - case ThreadNetworkDirectory::Events::NetworkChanged::Id: { - chip::app::Clusters::ThreadNetworkDirectory::Events::NetworkChanged::DecodableType value; - ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("NetworkChanged", 1, value); - } - } - break; - } case TargetNavigator::Id: { switch (header.mPath.mEventId) { @@ -20054,6 +20755,17 @@ CHIP_ERROR DataModelLogger::LogEvent(const chip::app::EventHeader & header, chip } break; } + case CommissionerControl::Id: { + switch (header.mPath.mEventId) + { + case CommissionerControl::Events::CommissioningRequestResult::Id: { + chip::app::Clusters::CommissionerControl::Events::CommissioningRequestResult::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("CommissioningRequestResult", 1, value); + } + } + break; + } case UnitTesting::Id: { switch (header.mPath.mEventId) { 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 f0474e39422622..c1b1f9eb35349a 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -32,6 +32,12 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::MeasurementAccuracyStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::detail::Structs::LocationDescriptorStruct::DecodableType & value); + +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::detail::Structs::DeviceTypeStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::ApplicationStruct::DecodableType & value); @@ -45,7 +51,7 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::OperationalStateStruct::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::Descriptor::Structs::DeviceTypeStruct::DecodableType & value); + const chip::app::Clusters::Globals::Structs::TestGlobalStruct::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Descriptor::Structs::SemanticTagStruct::DecodableType & value); @@ -53,6 +59,16 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Binding::Structs::TargetStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::AccessControl::Structs::AccessRestrictionStruct::DecodableType & value); + +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::AccessControl::Structs::CommissioningAccessRestrictionEntryStruct::DecodableType & value); + +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::AccessControl::Structs::AccessRestrictionEntryStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::AccessControl::Structs::AccessControlTargetStruct::DecodableType & value); @@ -163,7 +179,7 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ModeSelect::Structs::ModeOptionStruct::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::ScenesManagement::Structs::AttributeValuePair::DecodableType & value); + const chip::app::Clusters::ScenesManagement::Structs::AttributeValuePairStruct::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::DecodableType & value); @@ -267,9 +283,6 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::DoorLock::Structs::CredentialStruct::DecodableType & value); -static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::ServiceArea::Structs::HomeLocationStruct::DecodableType & value); - static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ServiceArea::Structs::LocationInfoStruct::DecodableType & value); @@ -294,9 +307,6 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Thermostat::Structs::PresetTypeStruct::DecodableType & value); -static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::Thermostat::Structs::QueuedPresetStruct::DecodableType & value); - static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Thermostat::Structs::ScheduleTypeStruct::DecodableType & value); @@ -384,6 +394,13 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ContentControl::Structs::RatingNameStruct::DecodableType & value); +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::EcosystemInformation::Structs::EcosystemLocationStruct::DecodableType & value); + +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::EcosystemInformation::Structs::EcosystemDeviceStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::UnitTesting::Structs::SimpleStruct::DecodableType & value); @@ -409,6 +426,10 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::AccessControl::Events::AccessControlEntryChanged::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::AccessControl::Events::AccessControlExtensionChanged::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::AccessControl::Events::AccessRestrictionEntryChanged::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::AccessControl::Events::FabricRestrictionReviewUpdate::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Actions::Events::StateChanged::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, @@ -472,6 +493,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::BridgedDeviceBasicInformation::Events::ReachableChanged::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::BridgedDeviceBasicInformation::Events::ActiveChanged::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Switch::Events::SwitchLatched::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, @@ -627,8 +650,6 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::PumpConfigurationAndControl::Events::AirDetection::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::PumpConfigurationAndControl::Events::TurbineOperation::DecodableType & value); -static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::ThreadNetworkDirectory::Events::NetworkChanged::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::TargetNavigator::Events::TargetUpdated::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, @@ -637,6 +658,9 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::AccountLogin::Events::LoggedOut::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ContentControl::Events::RemainingScreenTimeExpired::DecodableType & value); +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::CommissionerControl::Events::CommissioningRequestResult::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::UnitTesting::Events::TestEvent::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, @@ -655,6 +679,9 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Groups::Commands::RemoveGroupResponse::DecodableType & value); static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::AccessControl::Commands::ReviewFabricRestrictionsResponse::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImageResponse::DecodableType & value); static CHIP_ERROR @@ -745,6 +772,8 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::EnergyEvse::Commands::GetTargetsResponse::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::EnergyEvseMode::Commands::ChangeToModeResponse::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::WaterHeaterMode::Commands::ChangeToModeResponse::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::DeviceEnergyManagementMode::Commands::ChangeToModeResponse::DecodableType & value); @@ -797,6 +826,9 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ContentAppObserver::Commands::ContentAppMessageResponse::DecodableType & value); static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::CommissionerControl::Commands::ReverseOpenCommissioningWindow::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ElectricalMeasurement::Commands::GetProfileInfoResponseCommand::DecodableType & value); static CHIP_ERROR 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 b91d8584fa83be..8e3aa2bfd88f09 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -104,6 +104,7 @@ | ValveConfigurationAndControl | 0x0081 | | ElectricalPowerMeasurement | 0x0090 | | ElectricalEnergyMeasurement | 0x0091 | +| WaterHeaterManagement | 0x0094 | | DemandResponseLoadControl | 0x0096 | | Messages | 0x0097 | | DeviceEnergyManagement | 0x0098 | @@ -111,6 +112,7 @@ | EnergyPreference | 0x009B | | PowerTopology | 0x009C | | EnergyEvseMode | 0x009D | +| WaterHeaterMode | 0x009E | | DeviceEnergyManagementMode | 0x009F | | DoorLock | 0x0101 | | WindowCovering | 0x0102 | @@ -155,6 +157,8 @@ | AccountLogin | 0x050E | | ContentControl | 0x050F | | ContentAppObserver | 0x0510 | +| EcosystemInformation | 0x0750 | +| CommissionerControl | 0x0751 | | ElectricalMeasurement | 0x0B04 | | UnitTesting | 0xFFF1FC05| | FaultInjection | 0xFFF1FC06| @@ -10066,6 +10070,7 @@ class SubscribeAttributeBindingClusterRevision : public SubscribeAttribute { | Cluster AccessControl | 0x001F | |------------------------------------------------------------------------------| | Commands: | | +| * ReviewFabricRestrictions | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * Acl | 0x0000 | @@ -10073,6 +10078,8 @@ class SubscribeAttributeBindingClusterRevision : public SubscribeAttribute { | * SubjectsPerAccessControlEntry | 0x0002 | | * TargetsPerAccessControlEntry | 0x0003 | | * AccessControlEntriesPerFabric | 0x0004 | +| * CommissioningARL | 0x0005 | +| * Arl | 0x0006 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -10083,8 +10090,80 @@ class SubscribeAttributeBindingClusterRevision : public SubscribeAttribute { | Events: | | | * AccessControlEntryChanged | 0x0000 | | * AccessControlExtensionChanged | 0x0001 | +| * AccessRestrictionEntryChanged | 0x0002 | +| * FabricRestrictionReviewUpdate | 0x0003 | \*----------------------------------------------------------------------------*/ +#if MTR_ENABLE_PROVISIONAL +/* + * Command ReviewFabricRestrictions + */ +class AccessControlReviewFabricRestrictions : public ClusterCommand { +public: + AccessControlReviewFabricRestrictions() + : ClusterCommand("review-fabric-restrictions") + , mComplex_Arl(&mRequest.arl) + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("Arl", &mComplex_Arl); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::AccessControl::Commands::ReviewFabricRestrictions::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); + __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRAccessControlClusterReviewFabricRestrictionsParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + for (auto & entry_0 : mRequest.arl) { + MTRAccessControlClusterAccessRestrictionStruct * newElement_0; + newElement_0 = [MTRAccessControlClusterAccessRestrictionStruct new]; + newElement_0.type = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.type)]; + if (entry_0.id.IsNull()) { + newElement_0.id = nil; + } else { + newElement_0.id = [NSNumber numberWithUnsignedInt:entry_0.id.Value()]; + } + [array_0 addObject:newElement_0]; + } + params.arl = array_0; + } +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster reviewFabricRestrictionsWithParams: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::AccessControl::Commands::ReviewFabricRestrictions::Type mRequest; + TypedComplexArgument> mComplex_Arl; +}; + +#endif // MTR_ENABLE_PROVISIONAL + /* * Attribute Acl */ @@ -10653,6 +10732,181 @@ class SubscribeAttributeAccessControlAccessControlEntriesPerFabric : public Subs } }; +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute CommissioningARL + */ +class ReadAccessControlCommissioningARL : public ReadAttribute { +public: + ReadAccessControlCommissioningARL() + : ReadAttribute("commissioning-arl") + { + } + + ~ReadAccessControlCommissioningARL() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::CommissioningARL::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); + __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeCommissioningARLWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"AccessControl.CommissioningARL response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("AccessControl CommissioningARL read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAccessControlCommissioningARL : public SubscribeAttribute { +public: + SubscribeAttributeAccessControlCommissioningARL() + : SubscribeAttribute("commissioning-arl") + { + } + + ~SubscribeAttributeAccessControlCommissioningARL() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::AccessControl::Attributes::CommissioningARL::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); + __auto_type * cluster = [[MTRBaseClusterAccessControl 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 subscribeAttributeCommissioningARLWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"AccessControl.CommissioningARL 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 Arl + */ +class ReadAccessControlArl : public ReadAttribute { +public: + ReadAccessControlArl() + : ReadAttribute("arl") + { + } + + ~ReadAccessControlArl() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::Arl::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); + __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRReadParams alloc] init]; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + [cluster readAttributeARLWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"AccessControl.ARL response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("AccessControl ARL read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeAccessControlArl : public SubscribeAttribute { +public: + SubscribeAttributeAccessControlArl() + : SubscribeAttribute("arl") + { + } + + ~SubscribeAttributeAccessControlArl() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::AccessControl::Attributes::Arl::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); + __auto_type * cluster = [[MTRBaseClusterAccessControl 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 subscribeAttributeARLWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"AccessControl.ARL 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 + /* * Attribute GeneratedCommandList */ @@ -39466,6 +39720,7 @@ class SubscribeAttributeTimeSynchronizationClusterRevision : public SubscribeAtt | Cluster BridgedDeviceBasicInformation | 0x0039 | |------------------------------------------------------------------------------| | Commands: | | +| * KeepActive | 0x80 | |------------------------------------------------------------------------------| | Attributes: | | | * VendorName | 0x0001 | @@ -39496,8 +39751,63 @@ class SubscribeAttributeTimeSynchronizationClusterRevision : public SubscribeAtt | * ShutDown | 0x0001 | | * Leave | 0x0002 | | * ReachableChanged | 0x0003 | +| * ActiveChanged | 0x0080 | \*----------------------------------------------------------------------------*/ +#if MTR_ENABLE_PROVISIONAL +/* + * Command KeepActive + */ +class BridgedDeviceBasicInformationKeepActive : public ClusterCommand { +public: + BridgedDeviceBasicInformationKeepActive() + : ClusterCommand("keep-active") + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("StayActiveDuration", 0, UINT32_MAX, &mRequest.stayActiveDuration); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::BridgedDeviceBasicInformation::Commands::KeepActive::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); + __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRBridgedDeviceBasicInformationClusterKeepActiveParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.stayActiveDuration = [NSNumber numberWithUnsignedInt:mRequest.stayActiveDuration]; +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster keepActiveWithParams: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::BridgedDeviceBasicInformation::Commands::KeepActive::Type mRequest; +}; + +#endif // MTR_ENABLE_PROVISIONAL + /* * Attribute VendorName */ @@ -47494,6 +47804,7 @@ class SubscribeAttributeBooleanStateClusterRevision : public SubscribeAttribute | * UserActiveModeTriggerHint | 0x0006 | | * UserActiveModeTriggerInstruction | 0x0007 | | * OperatingMode | 0x0008 | +| * MaximumCheckInBackOff | 0x0009 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -48485,6 +48796,91 @@ class SubscribeAttributeIcdManagementOperatingMode : public SubscribeAttribute { #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL +/* + * Attribute MaximumCheckInBackOff + */ +class ReadIcdManagementMaximumCheckInBackOff : public ReadAttribute { +public: + ReadIcdManagementMaximumCheckInBackOff() + : ReadAttribute("maximum-check-in-back-off") + { + } + + ~ReadIcdManagementMaximumCheckInBackOff() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::MaximumCheckInBackOff::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); + __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeMaximumCheckInBackOffWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ICDManagement.MaximumCheckInBackOff response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ICDManagement MaximumCheckInBackOff read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeIcdManagementMaximumCheckInBackOff : public SubscribeAttribute { +public: + SubscribeAttributeIcdManagementMaximumCheckInBackOff() + : SubscribeAttribute("maximum-check-in-back-off") + { + } + + ~SubscribeAttributeIcdManagementMaximumCheckInBackOff() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::MaximumCheckInBackOff::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); + __auto_type * cluster = [[MTRBaseClusterICDManagement 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 subscribeAttributeMaximumCheckInBackOffWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ICDManagement.MaximumCheckInBackOff 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 */ @@ -69437,10 +69833,49 @@ class ScenesManagementAddScene : public ClusterCommand { { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.attributeValueList) { - MTRScenesManagementClusterAttributeValuePair * newElement_2; - newElement_2 = [MTRScenesManagementClusterAttributeValuePair new]; + MTRScenesManagementClusterAttributeValuePairStruct * newElement_2; + newElement_2 = [MTRScenesManagementClusterAttributeValuePairStruct new]; newElement_2.attributeID = [NSNumber numberWithUnsignedInt:entry_2.attributeID]; - newElement_2.attributeValue = [NSNumber numberWithUnsignedInt:entry_2.attributeValue]; + if (entry_2.valueUnsigned8.HasValue()) { + newElement_2.valueUnsigned8 = [NSNumber numberWithUnsignedChar:entry_2.valueUnsigned8.Value()]; + } else { + newElement_2.valueUnsigned8 = nil; + } + if (entry_2.valueSigned8.HasValue()) { + newElement_2.valueSigned8 = [NSNumber numberWithChar:entry_2.valueSigned8.Value()]; + } else { + newElement_2.valueSigned8 = nil; + } + if (entry_2.valueUnsigned16.HasValue()) { + newElement_2.valueUnsigned16 = [NSNumber numberWithUnsignedShort:entry_2.valueUnsigned16.Value()]; + } else { + newElement_2.valueUnsigned16 = nil; + } + if (entry_2.valueSigned16.HasValue()) { + newElement_2.valueSigned16 = [NSNumber numberWithShort:entry_2.valueSigned16.Value()]; + } else { + newElement_2.valueSigned16 = nil; + } + if (entry_2.valueUnsigned32.HasValue()) { + newElement_2.valueUnsigned32 = [NSNumber numberWithUnsignedInt:entry_2.valueUnsigned32.Value()]; + } else { + newElement_2.valueUnsigned32 = nil; + } + if (entry_2.valueSigned32.HasValue()) { + newElement_2.valueSigned32 = [NSNumber numberWithInt:entry_2.valueSigned32.Value()]; + } else { + newElement_2.valueSigned32 = nil; + } + if (entry_2.valueUnsigned64.HasValue()) { + newElement_2.valueUnsigned64 = [NSNumber numberWithUnsignedLongLong:entry_2.valueUnsigned64.Value()]; + } else { + newElement_2.valueUnsigned64 = nil; + } + if (entry_2.valueSigned64.HasValue()) { + newElement_2.valueSigned64 = [NSNumber numberWithLongLong:entry_2.valueSigned64.Value()]; + } else { + newElement_2.valueSigned64 = nil; + } [array_2 addObject:newElement_2]; } newElement_0.attributeValueList = array_2; @@ -78955,6 +79390,1202 @@ class SubscribeAttributeElectricalEnergyMeasurementClusterRevision : public Subs } }; +#if MTR_ENABLE_PROVISIONAL +/*----------------------------------------------------------------------------*\ +| Cluster WaterHeaterManagement | 0x0094 | +|------------------------------------------------------------------------------| +| Commands: | | +| * Boost | 0x00 | +| * CancelBoost | 0x01 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * HeaterTypes | 0x0000 | +| * HeatDemand | 0x0001 | +| * TankVolume | 0x0002 | +| * EstimatedHeatRequired | 0x0003 | +| * TankPercentage | 0x0004 | +| * BoostState | 0x0005 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +#if MTR_ENABLE_PROVISIONAL +/* + * Command Boost + */ +class WaterHeaterManagementBoost : public ClusterCommand { +public: + WaterHeaterManagementBoost() + : ClusterCommand("boost") + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("OneShot", 0, 1, &mRequest.oneShot); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("EmergencyBoost", 0, 1, &mRequest.emergencyBoost); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("TemporarySetpoint", INT16_MIN, INT16_MAX, &mRequest.temporarySetpoint); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("TargetPercentage", 0, UINT8_MAX, &mRequest.targetPercentage); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("TargetReheat", 0, UINT8_MAX, &mRequest.targetReheat); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WaterHeaterManagement::Commands::Boost::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWaterHeaterManagementClusterBoostParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.duration = [NSNumber numberWithUnsignedInt:mRequest.duration]; +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.oneShot.HasValue()) { + params.oneShot = [NSNumber numberWithBool:mRequest.oneShot.Value()]; + } else { + params.oneShot = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.emergencyBoost.HasValue()) { + params.emergencyBoost = [NSNumber numberWithBool:mRequest.emergencyBoost.Value()]; + } else { + params.emergencyBoost = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.temporarySetpoint.HasValue()) { + params.temporarySetpoint = [NSNumber numberWithShort:mRequest.temporarySetpoint.Value()]; + } else { + params.temporarySetpoint = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.targetPercentage.HasValue()) { + params.targetPercentage = [NSNumber numberWithUnsignedChar:mRequest.targetPercentage.Value()]; + } else { + params.targetPercentage = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.targetReheat.HasValue()) { + params.targetReheat = [NSNumber numberWithUnsignedChar:mRequest.targetReheat.Value()]; + } else { + params.targetReheat = nil; + } +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster boostWithParams: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::WaterHeaterManagement::Commands::Boost::Type mRequest; +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command CancelBoost + */ +class WaterHeaterManagementCancelBoost : public ClusterCommand { +public: + WaterHeaterManagementCancelBoost() + : ClusterCommand("cancel-boost") + { + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WaterHeaterManagement::Commands::CancelBoost::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWaterHeaterManagementClusterCancelBoostParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster cancelBoostWithParams: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: +}; + +#endif // MTR_ENABLE_PROVISIONAL + +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute HeaterTypes + */ +class ReadWaterHeaterManagementHeaterTypes : public ReadAttribute { +public: + ReadWaterHeaterManagementHeaterTypes() + : ReadAttribute("heater-types") + { + } + + ~ReadWaterHeaterManagementHeaterTypes() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::HeaterTypes::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeHeaterTypesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.HeaterTypes response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterManagement HeaterTypes read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterManagementHeaterTypes : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterManagementHeaterTypes() + : SubscribeAttribute("heater-types") + { + } + + ~SubscribeAttributeWaterHeaterManagementHeaterTypes() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::HeaterTypes::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement 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 subscribeAttributeHeaterTypesWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.HeaterTypes 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 HeatDemand + */ +class ReadWaterHeaterManagementHeatDemand : public ReadAttribute { +public: + ReadWaterHeaterManagementHeatDemand() + : ReadAttribute("heat-demand") + { + } + + ~ReadWaterHeaterManagementHeatDemand() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::HeatDemand::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeHeatDemandWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.HeatDemand response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterManagement HeatDemand read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterManagementHeatDemand : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterManagementHeatDemand() + : SubscribeAttribute("heat-demand") + { + } + + ~SubscribeAttributeWaterHeaterManagementHeatDemand() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::HeatDemand::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement 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 subscribeAttributeHeatDemandWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.HeatDemand 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 TankVolume + */ +class ReadWaterHeaterManagementTankVolume : public ReadAttribute { +public: + ReadWaterHeaterManagementTankVolume() + : ReadAttribute("tank-volume") + { + } + + ~ReadWaterHeaterManagementTankVolume() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::TankVolume::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeTankVolumeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.TankVolume response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterManagement TankVolume read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterManagementTankVolume : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterManagementTankVolume() + : SubscribeAttribute("tank-volume") + { + } + + ~SubscribeAttributeWaterHeaterManagementTankVolume() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::TankVolume::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement 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 subscribeAttributeTankVolumeWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.TankVolume 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 EstimatedHeatRequired + */ +class ReadWaterHeaterManagementEstimatedHeatRequired : public ReadAttribute { +public: + ReadWaterHeaterManagementEstimatedHeatRequired() + : ReadAttribute("estimated-heat-required") + { + } + + ~ReadWaterHeaterManagementEstimatedHeatRequired() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::EstimatedHeatRequired::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeEstimatedHeatRequiredWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.EstimatedHeatRequired response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterManagement EstimatedHeatRequired read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterManagementEstimatedHeatRequired : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterManagementEstimatedHeatRequired() + : SubscribeAttribute("estimated-heat-required") + { + } + + ~SubscribeAttributeWaterHeaterManagementEstimatedHeatRequired() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::EstimatedHeatRequired::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement 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 subscribeAttributeEstimatedHeatRequiredWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.EstimatedHeatRequired 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 TankPercentage + */ +class ReadWaterHeaterManagementTankPercentage : public ReadAttribute { +public: + ReadWaterHeaterManagementTankPercentage() + : ReadAttribute("tank-percentage") + { + } + + ~ReadWaterHeaterManagementTankPercentage() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::TankPercentage::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeTankPercentageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.TankPercentage response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterManagement TankPercentage read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterManagementTankPercentage : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterManagementTankPercentage() + : SubscribeAttribute("tank-percentage") + { + } + + ~SubscribeAttributeWaterHeaterManagementTankPercentage() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::TankPercentage::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement 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 subscribeAttributeTankPercentageWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.TankPercentage 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 BoostState + */ +class ReadWaterHeaterManagementBoostState : public ReadAttribute { +public: + ReadWaterHeaterManagementBoostState() + : ReadAttribute("boost-state") + { + } + + ~ReadWaterHeaterManagementBoostState() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::BoostState::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeBoostStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.BoostState response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterManagement BoostState read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterManagementBoostState : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterManagementBoostState() + : SubscribeAttribute("boost-state") + { + } + + ~SubscribeAttributeWaterHeaterManagementBoostState() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::BoostState::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement 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 subscribeAttributeBoostStateWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.BoostState 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 + */ +class ReadWaterHeaterManagementGeneratedCommandList : public ReadAttribute { +public: + ReadWaterHeaterManagementGeneratedCommandList() + : ReadAttribute("generated-command-list") + { + } + + ~ReadWaterHeaterManagementGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::GeneratedCommandList::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.GeneratedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterManagement GeneratedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterManagementGeneratedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterManagementGeneratedCommandList() + : SubscribeAttribute("generated-command-list") + { + } + + ~SubscribeAttributeWaterHeaterManagementGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::GeneratedCommandList::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement 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 subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.GeneratedCommandList 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 AcceptedCommandList + */ +class ReadWaterHeaterManagementAcceptedCommandList : public ReadAttribute { +public: + ReadWaterHeaterManagementAcceptedCommandList() + : ReadAttribute("accepted-command-list") + { + } + + ~ReadWaterHeaterManagementAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::AcceptedCommandList::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.AcceptedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterManagement AcceptedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterManagementAcceptedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterManagementAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") + { + } + + ~SubscribeAttributeWaterHeaterManagementAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::AcceptedCommandList::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement 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 subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.AcceptedCommandList 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 EventList + */ +class ReadWaterHeaterManagementEventList : public ReadAttribute { +public: + ReadWaterHeaterManagementEventList() + : ReadAttribute("event-list") + { + } + + ~ReadWaterHeaterManagementEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::EventList::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.EventList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterManagement EventList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterManagementEventList : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterManagementEventList() + : SubscribeAttribute("event-list") + { + } + + ~SubscribeAttributeWaterHeaterManagementEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::EventList::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement 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 subscribeAttributeEventListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.EventList 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 AttributeList + */ +class ReadWaterHeaterManagementAttributeList : public ReadAttribute { +public: + ReadWaterHeaterManagementAttributeList() + : ReadAttribute("attribute-list") + { + } + + ~ReadWaterHeaterManagementAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::AttributeList::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.AttributeList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterManagement AttributeList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterManagementAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterManagementAttributeList() + : SubscribeAttribute("attribute-list") + { + } + + ~SubscribeAttributeWaterHeaterManagementAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::AttributeList::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement 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 subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.AttributeList 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 FeatureMap + */ +class ReadWaterHeaterManagementFeatureMap : public ReadAttribute { +public: + ReadWaterHeaterManagementFeatureMap() + : ReadAttribute("feature-map") + { + } + + ~ReadWaterHeaterManagementFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::FeatureMap::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.FeatureMap response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterManagement FeatureMap read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterManagementFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterManagementFeatureMap() + : SubscribeAttribute("feature-map") + { + } + + ~SubscribeAttributeWaterHeaterManagementFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::FeatureMap::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement 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 subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.FeatureMap 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 ClusterRevision + */ +class ReadWaterHeaterManagementClusterRevision : public ReadAttribute { +public: + ReadWaterHeaterManagementClusterRevision() + : ReadAttribute("cluster-revision") + { + } + + ~ReadWaterHeaterManagementClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::ClusterRevision::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.ClusterRevision response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterManagement ClusterRevision read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterManagementClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterManagementClusterRevision() + : SubscribeAttribute("cluster-revision") + { + } + + ~SubscribeAttributeWaterHeaterManagementClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::ClusterRevision::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement 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 subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterManagement.ClusterRevision 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 +#endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster DemandResponseLoadControl | 0x0096 | @@ -89059,6 +90690,1027 @@ class SubscribeAttributeEnergyEvseModeClusterRevision : public SubscribeAttribut } }; +#endif // MTR_ENABLE_PROVISIONAL +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/*----------------------------------------------------------------------------*\ +| Cluster WaterHeaterMode | 0x009E | +|------------------------------------------------------------------------------| +| Commands: | | +| * ChangeToMode | 0x00 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * SupportedModes | 0x0000 | +| * CurrentMode | 0x0001 | +| * StartUpMode | 0x0002 | +| * OnMode | 0x0003 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +#if MTR_ENABLE_PROVISIONAL +/* + * Command ChangeToMode + */ +class WaterHeaterModeChangeToMode : public ClusterCommand { +public: + WaterHeaterModeChangeToMode() + : ClusterCommand("change-to-mode") + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("NewMode", 0, UINT8_MAX, &mRequest.newMode); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::WaterHeaterMode::Commands::ChangeToMode::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWaterHeaterModeClusterChangeToModeParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.newMode = [NSNumber numberWithUnsignedChar:mRequest.newMode]; +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster changeToModeWithParams:params completion: + ^(MTRWaterHeaterModeClusterChangeToModeResponseParams * _Nullable values, NSError * _Nullable error) { + NSLog(@"Values: %@", values); + if (error == nil) { + constexpr chip::CommandId responseId = chip::app::Clusters::WaterHeaterMode::Commands::ChangeToModeResponse::Id; + RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); + } + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + constexpr chip::CommandId responseId = chip::app::Clusters::WaterHeaterMode::Commands::ChangeToModeResponse::Id; + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::WaterHeaterMode::Commands::ChangeToMode::Type mRequest; +}; + +#endif // MTR_ENABLE_PROVISIONAL + +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute SupportedModes + */ +class ReadWaterHeaterModeSupportedModes : public ReadAttribute { +public: + ReadWaterHeaterModeSupportedModes() + : ReadAttribute("supported-modes") + { + } + + ~ReadWaterHeaterModeSupportedModes() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::SupportedModes::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeSupportedModesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.SupportedModes response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterMode SupportedModes read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterModeSupportedModes : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterModeSupportedModes() + : SubscribeAttribute("supported-modes") + { + } + + ~SubscribeAttributeWaterHeaterModeSupportedModes() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::SupportedModes::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode 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 subscribeAttributeSupportedModesWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.SupportedModes 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 CurrentMode + */ +class ReadWaterHeaterModeCurrentMode : public ReadAttribute { +public: + ReadWaterHeaterModeCurrentMode() + : ReadAttribute("current-mode") + { + } + + ~ReadWaterHeaterModeCurrentMode() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::CurrentMode::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.CurrentMode response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterMode CurrentMode read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterModeCurrentMode : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterModeCurrentMode() + : SubscribeAttribute("current-mode") + { + } + + ~SubscribeAttributeWaterHeaterModeCurrentMode() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::CurrentMode::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode 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 subscribeAttributeCurrentModeWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.CurrentMode 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 StartUpMode + */ +class ReadWaterHeaterModeStartUpMode : public ReadAttribute { +public: + ReadWaterHeaterModeStartUpMode() + : ReadAttribute("start-up-mode") + { + } + + ~ReadWaterHeaterModeStartUpMode() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::StartUpMode::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeStartUpModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.StartUpMode response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterMode StartUpMode read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteWaterHeaterModeStartUpMode : public WriteAttribute { +public: + WriteWaterHeaterModeStartUpMode() + : WriteAttribute("start-up-mode") + { + AddArgument("attr-name", "start-up-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteWaterHeaterModeStartUpMode() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::StartUpMode::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode 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 * _Nullable value = nil; + if (!mValue.IsNull()) { + value = [NSNumber numberWithUnsignedChar:mValue.Value()]; + } + + [cluster writeAttributeStartUpModeWithValue:value params:params completion:^(NSError * _Nullable error) { + if (error != nil) { + LogNSError("WaterHeaterMode StartUpMode write Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } + +private: + chip::app::DataModel::Nullable mValue; +}; + +class SubscribeAttributeWaterHeaterModeStartUpMode : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterModeStartUpMode() + : SubscribeAttribute("start-up-mode") + { + } + + ~SubscribeAttributeWaterHeaterModeStartUpMode() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::StartUpMode::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode 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 subscribeAttributeStartUpModeWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.StartUpMode 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 OnMode + */ +class ReadWaterHeaterModeOnMode : public ReadAttribute { +public: + ReadWaterHeaterModeOnMode() + : ReadAttribute("on-mode") + { + } + + ~ReadWaterHeaterModeOnMode() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::OnMode::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeOnModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.OnMode response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterMode OnMode read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteWaterHeaterModeOnMode : public WriteAttribute { +public: + WriteWaterHeaterModeOnMode() + : WriteAttribute("on-mode") + { + AddArgument("attr-name", "on-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteWaterHeaterModeOnMode() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::OnMode::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode 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 * _Nullable value = nil; + if (!mValue.IsNull()) { + value = [NSNumber numberWithUnsignedChar:mValue.Value()]; + } + + [cluster writeAttributeOnModeWithValue:value params:params completion:^(NSError * _Nullable error) { + if (error != nil) { + LogNSError("WaterHeaterMode OnMode write Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } + +private: + chip::app::DataModel::Nullable mValue; +}; + +class SubscribeAttributeWaterHeaterModeOnMode : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterModeOnMode() + : SubscribeAttribute("on-mode") + { + } + + ~SubscribeAttributeWaterHeaterModeOnMode() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::OnMode::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode 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 subscribeAttributeOnModeWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.OnMode 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 + */ +class ReadWaterHeaterModeGeneratedCommandList : public ReadAttribute { +public: + ReadWaterHeaterModeGeneratedCommandList() + : ReadAttribute("generated-command-list") + { + } + + ~ReadWaterHeaterModeGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::GeneratedCommandList::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.GeneratedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterMode GeneratedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterModeGeneratedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterModeGeneratedCommandList() + : SubscribeAttribute("generated-command-list") + { + } + + ~SubscribeAttributeWaterHeaterModeGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::GeneratedCommandList::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode 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 subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.GeneratedCommandList 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 AcceptedCommandList + */ +class ReadWaterHeaterModeAcceptedCommandList : public ReadAttribute { +public: + ReadWaterHeaterModeAcceptedCommandList() + : ReadAttribute("accepted-command-list") + { + } + + ~ReadWaterHeaterModeAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::AcceptedCommandList::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.AcceptedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterMode AcceptedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterModeAcceptedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterModeAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") + { + } + + ~SubscribeAttributeWaterHeaterModeAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::AcceptedCommandList::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode 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 subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.AcceptedCommandList 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 EventList + */ +class ReadWaterHeaterModeEventList : public ReadAttribute { +public: + ReadWaterHeaterModeEventList() + : ReadAttribute("event-list") + { + } + + ~ReadWaterHeaterModeEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::EventList::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.EventList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterMode EventList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterModeEventList : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterModeEventList() + : SubscribeAttribute("event-list") + { + } + + ~SubscribeAttributeWaterHeaterModeEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::EventList::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode 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 subscribeAttributeEventListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.EventList 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 AttributeList + */ +class ReadWaterHeaterModeAttributeList : public ReadAttribute { +public: + ReadWaterHeaterModeAttributeList() + : ReadAttribute("attribute-list") + { + } + + ~ReadWaterHeaterModeAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::AttributeList::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.AttributeList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterMode AttributeList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterModeAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterModeAttributeList() + : SubscribeAttribute("attribute-list") + { + } + + ~SubscribeAttributeWaterHeaterModeAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::AttributeList::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode 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 subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.AttributeList 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 FeatureMap + */ +class ReadWaterHeaterModeFeatureMap : public ReadAttribute { +public: + ReadWaterHeaterModeFeatureMap() + : ReadAttribute("feature-map") + { + } + + ~ReadWaterHeaterModeFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::FeatureMap::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.FeatureMap response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterMode FeatureMap read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterModeFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterModeFeatureMap() + : SubscribeAttribute("feature-map") + { + } + + ~SubscribeAttributeWaterHeaterModeFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::FeatureMap::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode 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 subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.FeatureMap 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 ClusterRevision + */ +class ReadWaterHeaterModeClusterRevision : public ReadAttribute { +public: + ReadWaterHeaterModeClusterRevision() + : ReadAttribute("cluster-revision") + { + } + + ~ReadWaterHeaterModeClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::ClusterRevision::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.ClusterRevision response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WaterHeaterMode ClusterRevision read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWaterHeaterModeClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeWaterHeaterModeClusterRevision() + : SubscribeAttribute("cluster-revision") + { + } + + ~SubscribeAttributeWaterHeaterModeClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::ClusterRevision::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); + __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode 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 subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WaterHeaterMode.ClusterRevision 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 #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL @@ -104478,8 +107130,6 @@ class SubscribeAttributePumpConfigurationAndControlClusterRevision : public Subs | * StartPresetsSchedulesEditRequest | 0x07 | | * CancelPresetsSchedulesEditRequest | 0x08 | | * CommitPresetsSchedulesRequest | 0x09 | -| * CancelSetActivePresetRequest | 0x0A | -| * SetTemperatureSetpointHoldPolicy | 0x0B | |------------------------------------------------------------------------------| | Attributes: | | | * LocalTemperature | 0x0000 | @@ -104542,9 +107192,7 @@ class SubscribeAttributePumpConfigurationAndControlClusterRevision : public Subs | * Presets | 0x0050 | | * Schedules | 0x0051 | | * PresetsSchedulesEditable | 0x0052 | -| * TemperatureSetpointHoldPolicy | 0x0053 | -| * SetpointHoldExpiryTimestamp | 0x0054 | -| * QueuedPreset | 0x0055 | +| * SetpointHoldExpiryTimestamp | 0x0053 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -104841,9 +107489,6 @@ class ThermostatSetActivePresetRequest : public ClusterCommand { { #if MTR_ENABLE_PROVISIONAL AddArgument("PresetHandle", &mRequest.presetHandle); -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - AddArgument("DelayMinutes", 0, UINT16_MAX, &mRequest.delayMinutes); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } @@ -104861,13 +107506,6 @@ class ThermostatSetActivePresetRequest : public ClusterCommand { params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.presetHandle = [NSData dataWithBytes:mRequest.presetHandle.data() length:mRequest.presetHandle.size()]; -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - if (mRequest.delayMinutes.HasValue()) { - params.delayMinutes = [NSNumber numberWithUnsignedShort:mRequest.delayMinutes.Value()]; - } else { - params.delayMinutes = nil; - } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; @@ -105037,105 +107675,6 @@ class ThermostatCommitPresetsSchedulesRequest : public ClusterCommand { private: }; -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL -/* - * Command CancelSetActivePresetRequest - */ -class ThermostatCancelSetActivePresetRequest : public ClusterCommand { -public: - ThermostatCancelSetActivePresetRequest() - : ClusterCommand("cancel-set-active-preset-request") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::CancelSetActivePresetRequest::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); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRThermostatClusterCancelSetActivePresetRequestParams alloc] init]; - params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster cancelSetActivePresetRequestWithParams: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: -}; - -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL -/* - * Command SetTemperatureSetpointHoldPolicy - */ -class ThermostatSetTemperatureSetpointHoldPolicy : public ClusterCommand { -public: - ThermostatSetTemperatureSetpointHoldPolicy() - : ClusterCommand("set-temperature-setpoint-hold-policy") - { -#if MTR_ENABLE_PROVISIONAL - AddArgument("TemperatureSetpointHoldPolicy", 0, UINT8_MAX, &mRequest.temperatureSetpointHoldPolicy); -#endif // MTR_ENABLE_PROVISIONAL - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::SetTemperatureSetpointHoldPolicy::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); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams alloc] init]; - params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; -#if MTR_ENABLE_PROVISIONAL - params.temperatureSetpointHoldPolicy = [NSNumber numberWithUnsignedChar:mRequest.temperatureSetpointHoldPolicy.Raw()]; -#endif // MTR_ENABLE_PROVISIONAL - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster setTemperatureSetpointHoldPolicyWithParams: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::Thermostat::Commands::SetTemperatureSetpointHoldPolicy::Type mRequest; -}; - #endif // MTR_ENABLE_PROVISIONAL /* @@ -111399,91 +113938,6 @@ class SubscribeAttributeThermostatPresetsSchedulesEditable : public SubscribeAtt #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL -/* - * Attribute TemperatureSetpointHoldPolicy - */ -class ReadThermostatTemperatureSetpointHoldPolicy : public ReadAttribute { -public: - ReadThermostatTemperatureSetpointHoldPolicy() - : ReadAttribute("temperature-setpoint-hold-policy") - { - } - - ~ReadThermostatTemperatureSetpointHoldPolicy() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::TemperatureSetpointHoldPolicy::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); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeTemperatureSetpointHoldPolicyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.TemperatureSetpointHoldPolicy response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - LogNSError("Thermostat TemperatureSetpointHoldPolicy read Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatTemperatureSetpointHoldPolicy : public SubscribeAttribute { -public: - SubscribeAttributeThermostatTemperatureSetpointHoldPolicy() - : SubscribeAttribute("temperature-setpoint-hold-policy") - { - } - - ~SubscribeAttributeThermostatTemperatureSetpointHoldPolicy() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::TemperatureSetpointHoldPolicy::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); - __auto_type * cluster = [[MTRBaseClusterThermostat 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 subscribeAttributeTemperatureSetpointHoldPolicyWithParams:params - subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.TemperatureSetpointHoldPolicy 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 SetpointHoldExpiryTimestamp */ @@ -111566,91 +114020,6 @@ class SubscribeAttributeThermostatSetpointHoldExpiryTimestamp : public Subscribe } }; -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - -/* - * Attribute QueuedPreset - */ -class ReadThermostatQueuedPreset : public ReadAttribute { -public: - ReadThermostatQueuedPreset() - : ReadAttribute("queued-preset") - { - } - - ~ReadThermostatQueuedPreset() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::QueuedPreset::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); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeQueuedPresetWithCompletion:^(MTRThermostatClusterQueuedPresetStruct * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.QueuedPreset response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - LogNSError("Thermostat QueuedPreset read Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatQueuedPreset : public SubscribeAttribute { -public: - SubscribeAttributeThermostatQueuedPreset() - : SubscribeAttribute("queued-preset") - { - } - - ~SubscribeAttributeThermostatQueuedPreset() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::QueuedPreset::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); - __auto_type * cluster = [[MTRBaseClusterThermostat 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 subscribeAttributeQueuedPresetWithParams:params - subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(MTRThermostatClusterQueuedPresetStruct * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.QueuedPreset 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 /* @@ -144448,7 +146817,8 @@ class SubscribeAttributeRadonConcentrationMeasurementClusterRevision : public Su | * NetworkPassphraseRequest | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | -| * Ssid | 0x0001 | +| * Ssid | 0x0000 | +| * PassphraseSurrogate | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -144599,6 +146969,91 @@ class SubscribeAttributeWiFiNetworkManagementSsid : public SubscribeAttribute { #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL +/* + * Attribute PassphraseSurrogate + */ +class ReadWiFiNetworkManagementPassphraseSurrogate : public ReadAttribute { +public: + ReadWiFiNetworkManagementPassphraseSurrogate() + : ReadAttribute("passphrase-surrogate") + { + } + + ~ReadWiFiNetworkManagementPassphraseSurrogate() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::PassphraseSurrogate::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); + __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributePassphraseSurrogateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WiFiNetworkManagement.PassphraseSurrogate response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("WiFiNetworkManagement PassphraseSurrogate read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeWiFiNetworkManagementPassphraseSurrogate : public SubscribeAttribute { +public: + SubscribeAttributeWiFiNetworkManagementPassphraseSurrogate() + : SubscribeAttribute("passphrase-surrogate") + { + } + + ~SubscribeAttributeWiFiNetworkManagementPassphraseSurrogate() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::PassphraseSurrogate::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); + __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement 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 subscribeAttributePassphraseSurrogateWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WiFiNetworkManagement.PassphraseSurrogate 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 */ @@ -145115,15 +147570,15 @@ class SubscribeAttributeWiFiNetworkManagementClusterRevision : public SubscribeA | Commands: | | | * GetActiveDatasetRequest | 0x00 | | * GetPendingDatasetRequest | 0x01 | -| * SetActiveDatasetRequest | 0x04 | -| * SetPendingDatasetRequest | 0x05 | +| * SetActiveDatasetRequest | 0x03 | +| * SetPendingDatasetRequest | 0x04 | |------------------------------------------------------------------------------| | Attributes: | | | * BorderRouterName | 0x0000 | | * BorderAgentID | 0x0001 | | * ThreadVersion | 0x0002 | | * InterfaceEnabled | 0x0003 | -| * ActiveDatasetTimestamp | 0x0005 | +| * ActiveDatasetTimestamp | 0x0004 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -146312,7 +148767,6 @@ class SubscribeAttributeThreadBorderRouterManagementClusterRevision : public Sub | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | -| * NetworkChanged | 0x0000 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL @@ -146378,7 +148832,7 @@ class ThreadNetworkDirectoryRemoveNetwork : public ClusterCommand { : ClusterCommand("remove-network") { #if MTR_ENABLE_PROVISIONAL - AddArgument("ExtendedPanID", 0, UINT64_MAX, &mRequest.extendedPanID); + AddArgument("ExtendedPanID", &mRequest.extendedPanID); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } @@ -146395,7 +148849,7 @@ class ThreadNetworkDirectoryRemoveNetwork : public ClusterCommand { __auto_type * params = [[MTRThreadNetworkDirectoryClusterRemoveNetworkParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL - params.extendedPanID = [NSNumber numberWithUnsignedLongLong:mRequest.extendedPanID]; + params.extendedPanID = [NSData dataWithBytes:mRequest.extendedPanID.data() length:mRequest.extendedPanID.size()]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; @@ -146431,7 +148885,7 @@ class ThreadNetworkDirectoryGetOperationalDataset : public ClusterCommand { : ClusterCommand("get-operational-dataset") { #if MTR_ENABLE_PROVISIONAL - AddArgument("ExtendedPanID", 0, UINT64_MAX, &mRequest.extendedPanID); + AddArgument("ExtendedPanID", &mRequest.extendedPanID); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } @@ -146448,7 +148902,7 @@ class ThreadNetworkDirectoryGetOperationalDataset : public ClusterCommand { __auto_type * params = [[MTRThreadNetworkDirectoryClusterGetOperationalDatasetParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL - params.extendedPanID = [NSNumber numberWithUnsignedLongLong:mRequest.extendedPanID]; + params.extendedPanID = [NSData dataWithBytes:mRequest.extendedPanID.data() length:mRequest.extendedPanID.size()]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; @@ -146506,7 +148960,7 @@ class ReadThreadNetworkDirectoryPreferredExtendedPanID : public ReadAttribute { dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributePreferredExtendedPanIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + [cluster readAttributePreferredExtendedPanIDWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.PreferredExtendedPanID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); @@ -146526,7 +148980,7 @@ class WriteThreadNetworkDirectoryPreferredExtendedPanID : public WriteAttribute : WriteAttribute("preferred-extended-pan-id") { AddArgument("attr-name", "preferred-extended-pan-id"); - AddArgument("attr-value", 0, UINT64_MAX, &mValue); + AddArgument("attr-value", &mValue); WriteAttribute::AddArguments(); } @@ -146545,9 +148999,9 @@ class WriteThreadNetworkDirectoryPreferredExtendedPanID : 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 * _Nullable value = nil; + NSData * _Nullable value = nil; if (!mValue.IsNull()) { - value = [NSNumber numberWithUnsignedLongLong:mValue.Value()]; + value = [[NSData alloc] initWithBytes:mValue.Value().data() length:mValue.Value().size()]; } [cluster writeAttributePreferredExtendedPanIDWithValue:value params:params completion:^(NSError * _Nullable error) { @@ -146561,7 +149015,7 @@ class WriteThreadNetworkDirectoryPreferredExtendedPanID : public WriteAttribute } private: - chip::app::DataModel::Nullable mValue; + chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeThreadNetworkDirectoryPreferredExtendedPanID : public SubscribeAttribute { @@ -146595,7 +149049,7 @@ class SubscribeAttributeThreadNetworkDirectoryPreferredExtendedPanID : public Su } [cluster subscribeAttributePreferredExtendedPanIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.PreferredExtendedPanID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); @@ -161040,6 +163494,1578 @@ class SubscribeAttributeContentAppObserverClusterRevision : public SubscribeAttr } }; +#endif // MTR_ENABLE_PROVISIONAL +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/*----------------------------------------------------------------------------*\ +| Cluster EcosystemInformation | 0x0750 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * RemovedOn | 0x0000 | +| * DeviceDirectory | 0x0001 | +| * LocationDirectory | 0x0002 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +\*----------------------------------------------------------------------------*/ + +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute RemovedOn + */ +class ReadEcosystemInformationRemovedOn : public ReadAttribute { +public: + ReadEcosystemInformationRemovedOn() + : ReadAttribute("removed-on") + { + } + + ~ReadEcosystemInformationRemovedOn() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::RemovedOn::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeRemovedOnWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.RemovedOn response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EcosystemInformation RemovedOn read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEcosystemInformationRemovedOn : public SubscribeAttribute { +public: + SubscribeAttributeEcosystemInformationRemovedOn() + : SubscribeAttribute("removed-on") + { + } + + ~SubscribeAttributeEcosystemInformationRemovedOn() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::RemovedOn::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation 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 subscribeAttributeRemovedOnWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.RemovedOn 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 DeviceDirectory + */ +class ReadEcosystemInformationDeviceDirectory : public ReadAttribute { +public: + ReadEcosystemInformationDeviceDirectory() + : ReadAttribute("device-directory") + { + } + + ~ReadEcosystemInformationDeviceDirectory() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::DeviceDirectory::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRReadParams alloc] init]; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + [cluster readAttributeDeviceDirectoryWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.DeviceDirectory response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EcosystemInformation DeviceDirectory read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEcosystemInformationDeviceDirectory : public SubscribeAttribute { +public: + SubscribeAttributeEcosystemInformationDeviceDirectory() + : SubscribeAttribute("device-directory") + { + } + + ~SubscribeAttributeEcosystemInformationDeviceDirectory() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::DeviceDirectory::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation 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 subscribeAttributeDeviceDirectoryWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.DeviceDirectory 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 LocationDirectory + */ +class ReadEcosystemInformationLocationDirectory : public ReadAttribute { +public: + ReadEcosystemInformationLocationDirectory() + : ReadAttribute("location-directory") + { + } + + ~ReadEcosystemInformationLocationDirectory() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::LocationDirectory::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRReadParams alloc] init]; + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + [cluster readAttributeLocationDirectoryWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.LocationDirectory response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EcosystemInformation LocationDirectory read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEcosystemInformationLocationDirectory : public SubscribeAttribute { +public: + SubscribeAttributeEcosystemInformationLocationDirectory() + : SubscribeAttribute("location-directory") + { + } + + ~SubscribeAttributeEcosystemInformationLocationDirectory() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::LocationDirectory::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation 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 subscribeAttributeLocationDirectoryWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.LocationDirectory 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 + */ +class ReadEcosystemInformationGeneratedCommandList : public ReadAttribute { +public: + ReadEcosystemInformationGeneratedCommandList() + : ReadAttribute("generated-command-list") + { + } + + ~ReadEcosystemInformationGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::GeneratedCommandList::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.GeneratedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EcosystemInformation GeneratedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEcosystemInformationGeneratedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeEcosystemInformationGeneratedCommandList() + : SubscribeAttribute("generated-command-list") + { + } + + ~SubscribeAttributeEcosystemInformationGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::GeneratedCommandList::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation 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 subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.GeneratedCommandList 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 AcceptedCommandList + */ +class ReadEcosystemInformationAcceptedCommandList : public ReadAttribute { +public: + ReadEcosystemInformationAcceptedCommandList() + : ReadAttribute("accepted-command-list") + { + } + + ~ReadEcosystemInformationAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::AcceptedCommandList::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.AcceptedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EcosystemInformation AcceptedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEcosystemInformationAcceptedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeEcosystemInformationAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") + { + } + + ~SubscribeAttributeEcosystemInformationAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::AcceptedCommandList::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation 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 subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.AcceptedCommandList 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 EventList + */ +class ReadEcosystemInformationEventList : public ReadAttribute { +public: + ReadEcosystemInformationEventList() + : ReadAttribute("event-list") + { + } + + ~ReadEcosystemInformationEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::EventList::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.EventList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EcosystemInformation EventList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEcosystemInformationEventList : public SubscribeAttribute { +public: + SubscribeAttributeEcosystemInformationEventList() + : SubscribeAttribute("event-list") + { + } + + ~SubscribeAttributeEcosystemInformationEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::EventList::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation 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 subscribeAttributeEventListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.EventList 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 AttributeList + */ +class ReadEcosystemInformationAttributeList : public ReadAttribute { +public: + ReadEcosystemInformationAttributeList() + : ReadAttribute("attribute-list") + { + } + + ~ReadEcosystemInformationAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::AttributeList::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.AttributeList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EcosystemInformation AttributeList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEcosystemInformationAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeEcosystemInformationAttributeList() + : SubscribeAttribute("attribute-list") + { + } + + ~SubscribeAttributeEcosystemInformationAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::AttributeList::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation 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 subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.AttributeList 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 FeatureMap + */ +class ReadEcosystemInformationFeatureMap : public ReadAttribute { +public: + ReadEcosystemInformationFeatureMap() + : ReadAttribute("feature-map") + { + } + + ~ReadEcosystemInformationFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::FeatureMap::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.FeatureMap response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EcosystemInformation FeatureMap read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEcosystemInformationFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeEcosystemInformationFeatureMap() + : SubscribeAttribute("feature-map") + { + } + + ~SubscribeAttributeEcosystemInformationFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::FeatureMap::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation 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 subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.FeatureMap 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 ClusterRevision + */ +class ReadEcosystemInformationClusterRevision : public ReadAttribute { +public: + ReadEcosystemInformationClusterRevision() + : ReadAttribute("cluster-revision") + { + } + + ~ReadEcosystemInformationClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::ClusterRevision::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.ClusterRevision response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("EcosystemInformation ClusterRevision read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeEcosystemInformationClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeEcosystemInformationClusterRevision() + : SubscribeAttribute("cluster-revision") + { + } + + ~SubscribeAttributeEcosystemInformationClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::ClusterRevision::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); + __auto_type * cluster = [[MTRBaseClusterEcosystemInformation 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 subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"EcosystemInformation.ClusterRevision 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 +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/*----------------------------------------------------------------------------*\ +| Cluster CommissionerControl | 0x0751 | +|------------------------------------------------------------------------------| +| Commands: | | +| * RequestCommissioningApproval | 0x00 | +| * CommissionNode | 0x01 | +|------------------------------------------------------------------------------| +| Attributes: | | +| * SupportedDeviceCategories | 0x0000 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * CommissioningRequestResult | 0x0000 | +\*----------------------------------------------------------------------------*/ + +#if MTR_ENABLE_PROVISIONAL +/* + * Command RequestCommissioningApproval + */ +class CommissionerControlRequestCommissioningApproval : public ClusterCommand { +public: + CommissionerControlRequestCommissioningApproval() + : ClusterCommand("request-commissioning-approval") + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("RequestId", 0, UINT64_MAX, &mRequest.requestId); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("VendorId", 0, UINT16_MAX, &mRequest.vendorId); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("ProductId", 0, UINT16_MAX, &mRequest.productId); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("Label", &mRequest.label); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::CommissionerControl::Commands::RequestCommissioningApproval::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); + __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRCommissionerControlClusterRequestCommissioningApprovalParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.requestId = [NSNumber numberWithUnsignedLongLong:mRequest.requestId]; +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + params.vendorId = [NSNumber numberWithUnsignedShort:chip::to_underlying(mRequest.vendorId)]; +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + params.productId = [NSNumber numberWithUnsignedShort:mRequest.productId]; +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.label.HasValue()) { + params.label = [[NSString alloc] initWithBytes:mRequest.label.Value().data() length:mRequest.label.Value().size() encoding:NSUTF8StringEncoding]; + } else { + params.label = nil; + } +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster requestCommissioningApprovalWithParams: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::CommissionerControl::Commands::RequestCommissioningApproval::Type mRequest; +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command CommissionNode + */ +class CommissionerControlCommissionNode : public ClusterCommand { +public: + CommissionerControlCommissionNode() + : ClusterCommand("commission-node") + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("RequestId", 0, UINT64_MAX, &mRequest.requestId); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("ResponseTimeoutSeconds", 0, UINT16_MAX, &mRequest.responseTimeoutSeconds); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("IpAddress", &mRequest.ipAddress); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("Port", 0, UINT16_MAX, &mRequest.port); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::CommissionerControl::Commands::CommissionNode::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); + __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRCommissionerControlClusterCommissionNodeParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.requestId = [NSNumber numberWithUnsignedLongLong:mRequest.requestId]; +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + params.responseTimeoutSeconds = [NSNumber numberWithUnsignedShort:mRequest.responseTimeoutSeconds]; +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.ipAddress.HasValue()) { + params.ipAddress = [NSData dataWithBytes:mRequest.ipAddress.Value().data() length:mRequest.ipAddress.Value().size()]; + } else { + params.ipAddress = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + if (mRequest.port.HasValue()) { + params.port = [NSNumber numberWithUnsignedShort:mRequest.port.Value()]; + } else { + params.port = nil; + } +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster commissionNodeWithParams:params completion: + ^(MTRCommissionerControlClusterReverseOpenCommissioningWindowParams * _Nullable values, NSError * _Nullable error) { + NSLog(@"Values: %@", values); + if (error == nil) { + constexpr chip::CommandId responseId = chip::app::Clusters::CommissionerControl::Commands::ReverseOpenCommissioningWindow::Id; + RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); + } + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + constexpr chip::CommandId responseId = chip::app::Clusters::CommissionerControl::Commands::ReverseOpenCommissioningWindow::Id; + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::CommissionerControl::Commands::CommissionNode::Type mRequest; +}; + +#endif // MTR_ENABLE_PROVISIONAL + +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute SupportedDeviceCategories + */ +class ReadCommissionerControlSupportedDeviceCategories : public ReadAttribute { +public: + ReadCommissionerControlSupportedDeviceCategories() + : ReadAttribute("supported-device-categories") + { + } + + ~ReadCommissionerControlSupportedDeviceCategories() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CommissionerControl::Attributes::SupportedDeviceCategories::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); + __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeSupportedDeviceCategoriesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"CommissionerControl.SupportedDeviceCategories response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("CommissionerControl SupportedDeviceCategories read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeCommissionerControlSupportedDeviceCategories : public SubscribeAttribute { +public: + SubscribeAttributeCommissionerControlSupportedDeviceCategories() + : SubscribeAttribute("supported-device-categories") + { + } + + ~SubscribeAttributeCommissionerControlSupportedDeviceCategories() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::CommissionerControl::Attributes::SupportedDeviceCategories::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); + __auto_type * cluster = [[MTRBaseClusterCommissionerControl 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 subscribeAttributeSupportedDeviceCategoriesWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"CommissionerControl.SupportedDeviceCategories 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 + */ +class ReadCommissionerControlGeneratedCommandList : public ReadAttribute { +public: + ReadCommissionerControlGeneratedCommandList() + : ReadAttribute("generated-command-list") + { + } + + ~ReadCommissionerControlGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CommissionerControl::Attributes::GeneratedCommandList::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); + __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"CommissionerControl.GeneratedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("CommissionerControl GeneratedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeCommissionerControlGeneratedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeCommissionerControlGeneratedCommandList() + : SubscribeAttribute("generated-command-list") + { + } + + ~SubscribeAttributeCommissionerControlGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::CommissionerControl::Attributes::GeneratedCommandList::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); + __auto_type * cluster = [[MTRBaseClusterCommissionerControl 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 subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"CommissionerControl.GeneratedCommandList 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 AcceptedCommandList + */ +class ReadCommissionerControlAcceptedCommandList : public ReadAttribute { +public: + ReadCommissionerControlAcceptedCommandList() + : ReadAttribute("accepted-command-list") + { + } + + ~ReadCommissionerControlAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CommissionerControl::Attributes::AcceptedCommandList::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); + __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"CommissionerControl.AcceptedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("CommissionerControl AcceptedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeCommissionerControlAcceptedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeCommissionerControlAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") + { + } + + ~SubscribeAttributeCommissionerControlAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::CommissionerControl::Attributes::AcceptedCommandList::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); + __auto_type * cluster = [[MTRBaseClusterCommissionerControl 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 subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"CommissionerControl.AcceptedCommandList 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 EventList + */ +class ReadCommissionerControlEventList : public ReadAttribute { +public: + ReadCommissionerControlEventList() + : ReadAttribute("event-list") + { + } + + ~ReadCommissionerControlEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CommissionerControl::Attributes::EventList::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); + __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"CommissionerControl.EventList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("CommissionerControl EventList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeCommissionerControlEventList : public SubscribeAttribute { +public: + SubscribeAttributeCommissionerControlEventList() + : SubscribeAttribute("event-list") + { + } + + ~SubscribeAttributeCommissionerControlEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::CommissionerControl::Attributes::EventList::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); + __auto_type * cluster = [[MTRBaseClusterCommissionerControl 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 subscribeAttributeEventListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"CommissionerControl.EventList 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 AttributeList + */ +class ReadCommissionerControlAttributeList : public ReadAttribute { +public: + ReadCommissionerControlAttributeList() + : ReadAttribute("attribute-list") + { + } + + ~ReadCommissionerControlAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CommissionerControl::Attributes::AttributeList::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); + __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"CommissionerControl.AttributeList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("CommissionerControl AttributeList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeCommissionerControlAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeCommissionerControlAttributeList() + : SubscribeAttribute("attribute-list") + { + } + + ~SubscribeAttributeCommissionerControlAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::CommissionerControl::Attributes::AttributeList::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); + __auto_type * cluster = [[MTRBaseClusterCommissionerControl 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 subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"CommissionerControl.AttributeList 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 FeatureMap + */ +class ReadCommissionerControlFeatureMap : public ReadAttribute { +public: + ReadCommissionerControlFeatureMap() + : ReadAttribute("feature-map") + { + } + + ~ReadCommissionerControlFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CommissionerControl::Attributes::FeatureMap::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); + __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"CommissionerControl.FeatureMap response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("CommissionerControl FeatureMap read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeCommissionerControlFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeCommissionerControlFeatureMap() + : SubscribeAttribute("feature-map") + { + } + + ~SubscribeAttributeCommissionerControlFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::CommissionerControl::Attributes::FeatureMap::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); + __auto_type * cluster = [[MTRBaseClusterCommissionerControl 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 subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"CommissionerControl.FeatureMap 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 ClusterRevision + */ +class ReadCommissionerControlClusterRevision : public ReadAttribute { +public: + ReadCommissionerControlClusterRevision() + : ReadAttribute("cluster-revision") + { + } + + ~ReadCommissionerControlClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::CommissionerControl::Attributes::ClusterRevision::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); + __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"CommissionerControl.ClusterRevision response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("CommissionerControl ClusterRevision read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeCommissionerControlClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeCommissionerControlClusterRevision() + : SubscribeAttribute("cluster-revision") + { + } + + ~SubscribeAttributeCommissionerControlClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::CommissionerControl::Attributes::ClusterRevision::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); + __auto_type * cluster = [[MTRBaseClusterCommissionerControl 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 subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"CommissionerControl.ClusterRevision 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 #endif // MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ @@ -186828,6 +190854,9 @@ void registerClusterAccessControl(Commands & commands) commands_list clusterCommands = { make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // @@ -186843,6 +190872,14 @@ void registerClusterAccessControl(Commands & commands) make_unique(), // make_unique(), // make_unique(), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // @@ -187916,6 +191953,9 @@ void registerClusterBridgedDeviceBasicInformation(Commands & commands) commands_list clusterCommands = { make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // @@ -188291,6 +192331,10 @@ void registerClusterIcdManagement(Commands & commands) make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // @@ -189820,6 +193864,77 @@ void registerClusterElectricalEnergyMeasurement(Commands & commands) commands.RegisterCluster(clusterName, clusterCommands); } +void registerClusterWaterHeaterManagement(Commands & commands) +{ +#if MTR_ENABLE_PROVISIONAL + using namespace chip::app::Clusters::WaterHeaterManagement; + + const char * clusterName = "WaterHeaterManagement"; + + commands_list clusterCommands = { + make_unique(Id), // +#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), // + make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL + }; + + commands.RegisterCluster(clusterName, clusterCommands); +#endif // MTR_ENABLE_PROVISIONAL +} void registerClusterDemandResponseLoadControl(Commands & commands) { #if MTR_ENABLE_PROVISIONAL @@ -190401,6 +194516,68 @@ void registerClusterEnergyEvseMode(Commands & commands) commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } +void registerClusterWaterHeaterMode(Commands & commands) +{ +#if MTR_ENABLE_PROVISIONAL + using namespace chip::app::Clusters::WaterHeaterMode; + + const char * clusterName = "WaterHeaterMode"; + + commands_list clusterCommands = { + make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL + make_unique(Id), // + make_unique(Id), // + make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + 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(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL + }; + + commands.RegisterCluster(clusterName, clusterCommands); +#endif // MTR_ENABLE_PROVISIONAL +} void registerClusterDeviceEnergyManagementMode(Commands & commands) { #if MTR_ENABLE_PROVISIONAL @@ -190963,12 +195140,6 @@ void registerClusterThermostat(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 make_unique(Id), // make_unique(Id), // @@ -191144,17 +195315,9 @@ void registerClusterThermostat(Commands & commands) make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - make_unique(), // - make_unique(), // -#endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - make_unique(), // - make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // @@ -192301,6 +196464,10 @@ void registerClusterWiFiNetworkManagement(Commands & commands) make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // @@ -192461,8 +196628,6 @@ void registerClusterThreadNetworkDirectory(Commands & commands) make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL - make_unique(Id), // - make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); @@ -193098,6 +197263,112 @@ void registerClusterContentAppObserver(Commands & commands) commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } +void registerClusterEcosystemInformation(Commands & commands) +{ +#if MTR_ENABLE_PROVISIONAL + using namespace chip::app::Clusters::EcosystemInformation; + + const char * clusterName = "EcosystemInformation"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(Id), // + make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL + }; + + commands.RegisterCluster(clusterName, clusterCommands); +#endif // MTR_ENABLE_PROVISIONAL +} +void registerClusterCommissionerControl(Commands & commands) +{ +#if MTR_ENABLE_PROVISIONAL + using namespace chip::app::Clusters::CommissionerControl; + + const char * clusterName = "CommissionerControl"; + + commands_list clusterCommands = { + make_unique(Id), // +#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), // + make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL + make_unique(Id), // + make_unique(Id), // + }; + + commands.RegisterCluster(clusterName, clusterCommands); +#endif // MTR_ENABLE_PROVISIONAL +} void registerClusterElectricalMeasurement(Commands & commands) { using namespace chip::app::Clusters::ElectricalMeasurement; @@ -193848,6 +198119,7 @@ void registerClusters(Commands & commands) registerClusterValveConfigurationAndControl(commands); registerClusterElectricalPowerMeasurement(commands); registerClusterElectricalEnergyMeasurement(commands); + registerClusterWaterHeaterManagement(commands); registerClusterDemandResponseLoadControl(commands); registerClusterMessages(commands); registerClusterDeviceEnergyManagement(commands); @@ -193855,6 +198127,7 @@ void registerClusters(Commands & commands) registerClusterEnergyPreference(commands); registerClusterPowerTopology(commands); registerClusterEnergyEvseMode(commands); + registerClusterWaterHeaterMode(commands); registerClusterDeviceEnergyManagementMode(commands); registerClusterDoorLock(commands); registerClusterWindowCovering(commands); @@ -193899,6 +198172,8 @@ void registerClusters(Commands & commands) registerClusterAccountLogin(commands); registerClusterContentControl(commands); registerClusterContentAppObserver(commands); + registerClusterEcosystemInformation(commands); + registerClusterCommissionerControl(commands); registerClusterElectricalMeasurement(commands); registerClusterUnitTesting(commands); registerClusterSampleMei(commands);